Document plugin formats and environment variables#9634
Document plugin formats and environment variables#9634alexdioso wants to merge 3 commits intomicrosoft:mainfrom
Conversation
Added sections on plugin formats and environment variables.
There was a problem hiding this comment.
Pull request overview
This PR updates the agent plugins documentation to clarify how VS Code detects different plugin formats based on plugin.json location, and which plugin-root environment variable (if any) is available for hooks.
Changes:
- Documented how VS Code auto-selects the plugin format based on the plugin file path.
- Added a table describing which plugin-root variable is available per plugin format.
| ### Plugin Environment Variables | ||
| | Plugin format | Plugin root | | ||
| |---------------|------------------| | ||
| | Claude | `${CLAUDE_PLUGIN_ROOT}` | | ||
| | Copilot | (Not Defined) | |
There was a problem hiding this comment.
The table under "Plugin environment variables" lists values like ${CLAUDE_PLUGIN_ROOT} / ${PLUGIN_ROOT}, which reads like a configuration token, not an environment variable name. Consider either (1) listing the actual env var names (CLAUDE_PLUGIN_ROOT, PLUGIN_ROOT) or (2) renaming the column/section to explicitly describe tokens vs injected environment variables, so readers know what to use in JSON vs in a shell script.
| ### Plugin Environment Variables | |
| | Plugin format | Plugin root | | |
| |---------------|------------------| | |
| | Claude | `${CLAUDE_PLUGIN_ROOT}` | | |
| | Copilot | (Not Defined) | | |
| ### Plugin root tokens | |
| | Plugin format | Plugin root token | | |
| |---------------|-------------------| | |
| | Claude | `${CLAUDE_PLUGIN_ROOT}` | | |
| | Copilot | (Not defined) | |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
ntrogh
left a comment
There was a problem hiding this comment.
@alexdioso Thanks for contributing. I added some corrections for style and technical accuracy.
| > Plugins can include hooks and MCP servers that run code on your machine. Review the plugin contents and publisher before installing, especially for plugins from community marketplaces. | ||
|
|
||
| ## Plugin formats | ||
| The plugin format is auto-selected based on the plugin file path (relative to the plugin root). |
There was a problem hiding this comment.
| The plugin format is auto-selected based on the plugin file path (relative to the plugin root). | |
| VS Code auto-detects the plugin format by checking for format-specific manifest paths. Copilot format is used as the default when no other format markers are found. |
| | Plugin format | Plugin file path(s) | | ||
| |---------------|------------------| | ||
| | Claude | `.claude-plugin/plugin.json` | | ||
| | Copilot | `plugin.json`, `.github/plugin/plugin.json` | |
There was a problem hiding this comment.
| | Copilot | `plugin.json`, `.github/plugin/plugin.json` | |
| | Plugin format | Plugin root | | ||
| |---------------|------------------| | ||
| | Claude | `${CLAUDE_PLUGIN_ROOT}` | | ||
| | Copilot | (Not Defined) | |
There was a problem hiding this comment.
| | Copilot | (Not Defined) | | |
| | Copilot | (Not defined) | |
| | Copilot | `plugin.json`, `.github/plugin/plugin.json` | | ||
| | OpenPlugin | `.plugin/plugin.json` | | ||
|
|
||
| ### Plugin environment variables |
There was a problem hiding this comment.
| ### Plugin environment variables | |
| ### Plugin environment variables | |
| Some plugin formats provide a root token that you can use in hook commands and MCP server configurations to reference files within the plugin directory. VS Code expands the token at runtime and also sets it as an environment variable in the hook or server process. | |
Added sections on plugin formats and environment variables. I had to dig through the vscode source to figure out why plugin hooks weren't working properly. Turns out that the plugin root is not provided to hooks when using Copilot format plugins. OpenPlugin and Claude format plugins get different plugin root environment variables. These changes should help clear up when each plugin format type is used and what root environment variable is provided (if any).
Plugin file path selection
Environment variables for plugin type