CLI Tools#
CPEX includes the cpex command-line tool for scaffolding new plugin projects from templates.
Installation#
The CLI is included when you install CPEX:
pip install cpexThe cpex command becomes available in your environment. To use the bootstrap subcommand, install the CLI extras:
pip install "cpex[cli]"cpex bootstrap#
Scaffolds a new plugin project from a cookiecutter template.
cpex bootstrap --destination ./my_plugin --template_type nativeOptions#
| Flag | Short | Default | Description |
|---|---|---|---|
--destination | -d | . | Output directory for the new plugin project |
--template_type | -t | native | Template type: native, external, or isolated |
--template_url | -u | — | Custom template URL (overrides built-in templates) |
--vcs_ref | -r | main | Git branch/tag/commit for remote templates |
--no_input | — | false | Use defaults without prompting |
--dry_run | — | false | Preview what would be created without writing files |
Template Types#
native — an in-process plugin with hook stubs for tools and prompts:
cpex bootstrap -d ./my_policy_plugin -t nativeCreates:
my_policy_plugin/
├── __init__.py
└── plugin.py # Plugin subclass with tool + prompt hook stubsexternal — a standalone MCP server plugin with test scaffolding:
cpex bootstrap -d ./my_remote_plugin -t externalCreates:
my_remote_plugin/
├── my_remote_plugin/
│ ├── __init__.py
│ └── plugin.py # Plugin subclass
└── tests/
├── __init__.py
└── test_my_remote_plugin.pyisolated — a venv-isolated plugin:
cpex bootstrap -d ./my_sandboxed_plugin -t isolatedCreates:
my_sandboxed_plugin/
├── __init__.py
└── plugin.py # Plugin subclass for venv isolationDry Run#
Preview what would be created without writing anything:
cpex bootstrap -d ./my_plugin -t native --dry_runCustom Templates#
Point to your own cookiecutter template repository:
cpex bootstrap -d ./my_plugin -u https://github.com/my-org/plugin-template.git -r v2.0Environment Variables#
| Variable | Default | Description |
|---|---|---|
PLUGINS_CLI_COMPLETION | false | Enable shell auto-completion |
PLUGINS_CLI_MARKUP_MODE | rich | Help text rendering: rich, markdown, or disabled |