cli
main
def main(
ctx:Context, cjm_config:Annotated=None, data_dir:Annotated=None, conda_prefix:Annotated=None,
conda_type:Annotated=None
)->None:
CJM Plugin System CLI for managing isolated plugin environments.
Setup Runtime
The setup-runtime command downloads and installs micromamba for project-local mode. This is required before running install-all when using conda_type: micromamba in the configuration.
setup_runtime
def setup_runtime(
force:bool=<typer.models.OptionInfo object at 0x7fd8cf73dfa0>
)->None:
Download and setup micromamba runtime for project-local mode.
run_cmd
def run_cmd(
cmd:str, # Shell command to execute
check:bool=True, # Whether to raise on non-zero exit
)->None:
Run a shell command and stream output.
Uses the platform’s default shell (no hardcoded /bin/bash).
Regenerate Manifest
The regenerate-manifest command re-runs the introspection pipeline for an already-installed plugin and rewrites its manifest in place. Picks up new substrate-side manifest fields (taxonomy, resources, install-time metadata) without forcing a full install-all --force.
Package-source recovery order: 1. --package <spec> operator override (always wins when provided) 2. The manifest’s own package_source field (post-CR-1+Phase-5a manifests) 3. --plugins plugins.yaml lookup by plugin name (legacy manifests without package_source) 4. Error with actionable message if none of the above resolve
The ecosystem-wide cascade_manifests.py (loops this command over every plugin) is deferred to CR-8’s nested-format migration.
regenerate_manifest
def regenerate_manifest(
plugin_name:str=<typer.models.ArgumentInfo object at 0x7fd8cf3d0650>,
plugins_path:Optional=<typer.models.OptionInfo object at 0x7fd8cf840e30>,
package:Optional=<typer.models.OptionInfo object at 0x7fd8cf843e30>
)->None:
Re-run introspection for an installed plugin and rewrite its manifest.
Reads the existing manifest via load_manifest (handles both v2.0 nested + legacy v1.0 flat layouts), recovers env_name + package_source from the install section, runs _generate_manifest to refresh the code section, then post-writes to preserve the original installed_at so the regenerate only updates regenerated_at semantically. Always emits v2.0 layout — regenerating a v1.0 manifest transparently upgrades it.
install_all
def install_all(
plugins_path:str=<typer.models.OptionInfo object at 0x7fd8cf3d0b60>,
force:bool=<typer.models.OptionInfo object at 0x7fd8cf3d0da0>
)->None:
Install and register all plugins defined in plugins.yaml.
Setup Host Environment
The setup-host command prepares the host application’s Python environment by installing all unique interface libraries referenced in plugins.yaml. This is separate from install-all which sets up isolated plugin environments.
setup_host
def setup_host(
plugins_path:str=<typer.models.OptionInfo object at 0x7fd8cf3d3050>,
yes:bool=<typer.models.OptionInfo object at 0x7fd8cf3d3080>
)->None:
Install interface libraries in the current Python environment.
Estimate Disk Space
The estimate-size command estimates the disk space required for plugin environments before installation. It uses conda’s dry-run feature for accurate conda package sizes and queries PyPI for pip package sizes.
estimate_size
def estimate_size(
plugins_path:str=<typer.models.OptionInfo object at 0x7fd8cf3d12b0>,
plugin_name:Optional=<typer.models.OptionInfo object at 0x7fd8cf3d1310>,
verbose:bool=<typer.models.OptionInfo object at 0x7fd8cf3d14c0>
)->None:
Estimate disk space required for plugin environments.
List Plugins
The list command shows installed plugins by scanning manifest files in the configured manifests directory (defaults to ~/.cjm/manifests/). It can optionally cross-reference with a plugins.yaml file and check conda environment status.
list_plugins
def list_plugins(
plugins_path:Optional=<typer.models.OptionInfo object at 0x7fd8cf894b00>,
show_envs:bool=<typer.models.OptionInfo object at 0x7fd8cf8952b0>
)->None:
List installed plugins from manifest directory.
Remove Plugin
The remove command removes a plugin’s manifest and optionally its conda environment. It can look up the environment name from the manifest or a config file.
remove_plugin
def remove_plugin(
plugin_name:str=<typer.models.ArgumentInfo object at 0x7fd8cf3d0440>,
plugins_path:Optional=<typer.models.OptionInfo object at 0x7fd8cf3d34d0>,
keep_env:bool=<typer.models.OptionInfo object at 0x7fd8cf3d3740>,
yes:bool=<typer.models.OptionInfo object at 0x7fd8cf3d0080>
)->None:
Remove a plugin’s manifest and conda environment.
Validate Command (SG-6)
The validate command checks that a manifest JSON file or a plugins.yaml file conforms to the substrate’s expected structure. Auto-detects format from the file extension (.json → manifest, .yaml/.yml → plugins.yaml).
Composes with CR-8 (manifest schema authority) — when CR-8’s nested manifest format v2.0 lands, the validator gains awareness of both the legacy flat shape and the new nested shape. For now the checks target the flat shape that production manifests currently use.
validate_file
def validate_file(
path:Path=<typer.models.ArgumentInfo object at 0x7fd8cf896750>,
format:Optional=<typer.models.OptionInfo object at 0x7fd8cf8946b0>
)->None:
SG-6: validate a manifest JSON or plugins.yaml file’s structure.
Auto-detects format from the file extension (.json → manifest, .yaml/.yml → plugins.yaml). Exits non-zero with a list of validation errors if any check fails.
list_secrets
def list_secrets(
plugin_name:str=<typer.models.ArgumentInfo object at 0x7fd8cf451490>,
scope:Optional=<typer.models.OptionInfo object at 0x7fd8cf4515b0>
):
List the secret KEY NAMES stored for a plugin — never the values (CR-12).
set_secret
def set_secret(
plugin_name:str=<typer.models.ArgumentInfo object at 0x7fd8cf4516d0>,
key:str=<typer.models.ArgumentInfo object at 0x7fd8cf5f8e30>,
value:Optional=<typer.models.OptionInfo object at 0x7fd8cf5fbe30>,
scope:Optional=<typer.models.OptionInfo object at 0x7fd8cf450770>
):
Store a plugin secret in the project-local SecretStore (CR-12).
The value is written to