plugins
Manage GPC plugins. Plugins extend the CLI with custom commands and lifecycle hooks.
Commands
| Command | Description |
|---|---|
plugins list | List loaded plugins |
plugins init | Scaffold a new plugin project |
plugins approve | Approve a third-party plugin for loading |
plugins revoke | Revoke approval for a third-party plugin |
Plugin Trust Model
- First-party plugins (
@gpc-cli/*scope) are automatically trusted and loaded. - Third-party plugins must be explicitly approved before they are loaded. This prevents untrusted code from running automatically.
plugins list
List all currently loaded plugins, their version, trust status, and any registered commands.
Synopsis
gpc plugins listOptions
No command-specific options.
Example
gpc plugins listLoaded plugins:
@gpc-cli/plugin-ci@0.8.0 (trusted)
Plugin commands:
gpc ci-summary — Generate CI summary reportWith JSON output:
gpc plugins list --output json[
{
"name": "@gpc-cli/plugin-ci",
"version": "0.8.0",
"trusted": true
}
]When no plugins are loaded:
No plugins loaded.
Configure plugins in .gpcrc.json: { "plugins": ["@gpc-cli/plugin-ci"] }plugins init
Scaffold a new plugin project with all required files (package.json, source, tests, tsconfig).
Synopsis
gpc plugins init <name> [options]Options
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--dir | -d | string | ./gpc-plugin-<name> | Output directory |
--description | string | Plugin description |
Example
Scaffold a new plugin:
gpc plugins init slackPlugin scaffolded at gpc-plugin-slack/
Files created:
package.json
tsconfig.json
src/index.ts
tests/index.test.ts
README.md
Next steps:
cd gpc-plugin-slack
npm install
npm run build
npm testWith custom directory and description:
gpc plugins init notifications \
--dir ./my-plugins/gpc-plugin-notifications \
--description "Send release notifications to Slack and Discord"plugins approve
Approve a third-party plugin for loading. Adds the plugin name to the approvedPlugins array in .gpcrc.json.
Synopsis
gpc plugins approve <name>Options
No command-specific options.
Example
gpc plugins approve gpc-plugin-slackPlugin "gpc-plugin-slack" approved. It will be loaded on next run.This adds to your config:
{
"approvedPlugins": ["gpc-plugin-slack"]
}plugins revoke
Revoke approval for a third-party plugin. Removes the plugin name from the approvedPlugins array. The plugin will no longer be loaded.
Synopsis
gpc plugins revoke <name>Options
No command-specific options.
Example
gpc plugins revoke gpc-plugin-slackPlugin "gpc-plugin-slack" approval revoked.If the plugin was not in the approved list:
Plugin "gpc-plugin-slack" was not in the approved list.Plugin Configuration
Plugins are configured in .gpcrc.json:
{
"plugins": ["@gpc-cli/plugin-ci", "gpc-plugin-slack"],
"approvedPlugins": ["gpc-plugin-slack"]
}GPC discovers plugins from:
- The
pluginsarray in config node_modulespackages matchinggpc-plugin-*or@*/gpc-plugin-*- Local file paths in the
pluginsarray
Related
- config -- Plugin configuration
- Plugin Development Guide -- Build your own plugin