@tencent-ai/codebuddy-code 2.95.0-next.fefce1e.20260503 → 2.95.1-next.bd7ff53.20260508

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/codebuddy-headless.js +113 -107
  3. package/dist/codebuddy.js +130 -124
  4. package/dist/web-ui/assets/index-CY6b2fbj.css +32 -0
  5. package/dist/web-ui/assets/{index-BY1JTnsk.js → index-bVNRRvKC.js} +165 -165
  6. package/dist/web-ui/docs/cn/cli/bash-sandboxing.md +11 -0
  7. package/dist/web-ui/docs/cn/cli/env-vars.md +6 -0
  8. package/dist/web-ui/docs/cn/cli/hooks.md +27 -0
  9. package/dist/web-ui/docs/cn/cli/interactive-mode.md +1 -1
  10. package/dist/web-ui/docs/cn/cli/mcp.md +13 -0
  11. package/dist/web-ui/docs/cn/cli/plugins-reference.md +3 -3
  12. package/dist/web-ui/docs/cn/cli/release-notes/README.md +6 -0
  13. package/dist/web-ui/docs/cn/cli/release-notes/v2.93.7.md +22 -0
  14. package/dist/web-ui/docs/cn/cli/release-notes/v2.94.0.md +23 -0
  15. package/dist/web-ui/docs/cn/cli/release-notes/v2.94.1.md +6 -0
  16. package/dist/web-ui/docs/cn/cli/release-notes/v2.94.2.md +5 -0
  17. package/dist/web-ui/docs/cn/cli/release-notes/v2.94.3.md +10 -0
  18. package/dist/web-ui/docs/cn/cli/release-notes/v2.94.4.md +5 -0
  19. package/dist/web-ui/docs/cn/cli/release-notes/v2.95.0.md +43 -0
  20. package/dist/web-ui/docs/cn/cli/settings.md +47 -0
  21. package/dist/web-ui/docs/cn/cli/skills.md +27 -0
  22. package/dist/web-ui/docs/en/cli/bash-sandboxing.md +11 -0
  23. package/dist/web-ui/docs/en/cli/env-vars.md +6 -0
  24. package/dist/web-ui/docs/en/cli/hooks.md +27 -0
  25. package/dist/web-ui/docs/en/cli/interactive-mode.md +1 -1
  26. package/dist/web-ui/docs/en/cli/mcp.md +13 -0
  27. package/dist/web-ui/docs/en/cli/plugins-reference.md +525 -461
  28. package/dist/web-ui/docs/en/cli/release-notes/README.md +6 -0
  29. package/dist/web-ui/docs/en/cli/release-notes/v2.94.0.md +23 -0
  30. package/dist/web-ui/docs/en/cli/release-notes/v2.94.1.md +6 -0
  31. package/dist/web-ui/docs/en/cli/release-notes/v2.94.2.md +5 -0
  32. package/dist/web-ui/docs/en/cli/release-notes/v2.94.3.md +10 -0
  33. package/dist/web-ui/docs/en/cli/release-notes/v2.94.4.md +5 -0
  34. package/dist/web-ui/docs/en/cli/release-notes/v2.95.0.md +43 -0
  35. package/dist/web-ui/docs/en/cli/settings.md +47 -0
  36. package/dist/web-ui/docs/en/cli/skills.md +27 -0
  37. package/dist/web-ui/docs/search-index-en.json +1 -1
  38. package/dist/web-ui/docs/search-index-zh.json +1 -1
  39. package/dist/web-ui/docs/sidebar-en.json +1 -1
  40. package/dist/web-ui/docs/sidebar-zh.json +1 -1
  41. package/dist/web-ui/index.html +2 -2
  42. package/dist/web-ui/sw.js +1 -1
  43. package/package.json +1 -1
  44. package/product.cloudhosted.json +4 -3
  45. package/product.internal.json +2 -2
  46. package/product.ioa.json +2 -2
  47. package/product.json +3 -3
  48. package/product.selfhosted.json +2 -2
  49. package/vendor/sandbox/msvcp140.dll +0 -0
  50. package/vendor/sandbox/sandbox-cli +0 -0
  51. package/vendor/sandbox/sandbox-cli.exe +0 -0
  52. package/vendor/sandbox/sandbox_ffi.dll +0 -0
  53. package/vendor/sandbox/tsbx.dll +0 -0
  54. package/vendor/sandbox/tsbx_sdk.dll +0 -0
  55. package/vendor/sandbox/vcruntime140.dll +0 -0
  56. package/vendor/sandbox/vcruntime140_1.dll +0 -0
  57. package/dist/web-ui/assets/index-BjcZsltA.css +0 -32
@@ -1,125 +1,109 @@
1
1
  # CodeBuddy Plugin Reference
2
2
 
3
- ## Overview
3
+ > A complete technical reference for the CodeBuddy plugin system, covering component specifications, CLI commands, and development tools.
4
4
 
5
- The CodeBuddy plugin system allows you to extend the AI assistant's functionality through a standardized plugin mechanism. Plugins can provide custom commands, agents, skills, hooks, MCP servers, and LSP servers.
5
+ A **plugin** is a self-contained component directory that extends CodeBuddy with custom functionality. Plugin components include Skills, Agents, Hooks, MCP servers, and LSP servers.
6
6
 
7
- description: Command description
8
- allowed-tools: Read,Write,Bash
9
- argument-hint: Argument hint
10
- model: Model ID or name to use
7
+ name: agent-name
8
+ description: The agent's expertise and when to invoke it
9
+ model: sonnet
10
+ effort: medium
11
+ maxTurns: 20
12
+ disallowedTools: Write, Edit
11
13
  ---
12
14
 
13
- Command prompt content
15
+ Detailed system prompt for the agent, describing its role, expertise, and behavior.
14
16
  ```
15
17
 
16
- **Command File Organization**:
17
- - Supports nested subdirectory organization
18
- - Subdirectory paths are converted to command names using colon separators
19
- - Example: `commands/deploy/production.md` → command name `deploy:production`
18
+ Plugin agents support the following frontmatter fields: `name`, `description`, `model`, `effort`, `maxTurns`, `tools`, `disallowedTools`, `skills`, `memory`, `background`, and `isolation`. The only valid value for `isolation` is `"worktree"`. For security reasons, plugin agents do not support the `hooks`, `mcpServers`, or `permissionMode` fields.
20
19
 
21
- ### 2. Agents
20
+ **Integration**:
22
21
 
23
- **Location**: `agents/` directory in the plugin root
24
- **Format**: Markdown files with frontmatter
22
+ - Agents appear in the `/agents` UI.
23
+ - The AI assistant can auto-invoke agents based on task context.
24
+ - Users can also invoke agents manually.
25
+ - Plugin agents cooperate with built-in agents.
25
26
 
26
- **Frontmatter Configuration**:
27
- ```markdown
28
- ---
29
- name: Agent name (optional, defaults to filename)
30
- description: Agent description
31
- model: Model ID or name to use
32
- tools: Read,Write,Bash (comma-separated list of available tools)
33
- color: #FF5733 (agent display color, optional)
34
- ---
35
-
36
- Agent instruction content
37
- ```
38
-
39
- **Features**:
40
- - Agents can be invoked as tools by the main agent
41
- - Support custom tool lists
42
- - Automatically generate source tags to identify origin
43
-
44
- ### 3. Skills
45
-
46
- **Location**: `skills/` directory in the plugin root
47
- **Format**: Each skill is a subdirectory containing a `SKILL.md` file
48
-
49
- **Directory Structure**:
50
- ```
51
- skills/
52
- ├── pdf-processor/
53
- │ ├── SKILL.md
54
- │ ├── reference.md (optional)
55
- │ └── scripts/ (optional)
56
- └── code-reviewer/
57
- └── SKILL.md
58
- ```
27
+ See [Subagents](sub-agents.md) for details.
59
28
 
60
- **SKILL.md Frontmatter Configuration**:
61
- ```markdown
62
- ---
63
- name: Skill name (optional, defaults to directory name)
64
- description: Skill description
65
- allowed-tools: Read,Write,Bash (list of allowed tools)
66
- ---
29
+ ### 3. Hooks
67
30
 
68
- Skill instruction content
69
- ```
31
+ Plugins can provide event handlers that respond to CodeBuddy events automatically.
70
32
 
71
- **Features**:
72
- - Skills can include auxiliary files and scripts
73
- - The skill's `baseDirectory` points to the skill directory, allowing access to resource files in the same directory
33
+ **Location**: `hooks/hooks.json` under the plugin root, or inline configuration in `plugin.json`.
74
34
 
75
- ### 4. Hooks
35
+ **Format**: JSON configuration containing event matchers and actions.
76
36
 
77
- **Location**: `hooks/hooks.json` in the plugin root, or configured via PluginInfo extension fields in `plugin.json`
78
- **Format**: JSON configuration containing event matchers and actions
37
+ **Configuration example**:
79
38
 
80
- **Configuration Example**:
81
39
  ```json
82
40
  {
83
- "PostToolUse": [
84
- {
85
- "matcher": "Write|Edit",
86
- "hooks": [
87
- {
88
- "type": "command",
89
- "command": "${CODEBUDDY_PLUGIN_ROOT}/scripts/format-code.sh",
90
- "timeout": 30000
91
- }
92
- ]
93
- }
94
- ]
41
+ "hooks": {
42
+ "PostToolUse": [
43
+ {
44
+ "matcher": "Write|Edit",
45
+ "hooks": [
46
+ {
47
+ "type": "command",
48
+ "command": "${CODEBUDDY_PLUGIN_ROOT}/scripts/format-code.sh"
49
+ }
50
+ ]
51
+ }
52
+ ]
53
+ }
95
54
  }
96
55
  ```
97
56
 
98
- **Available Events**:
99
- - `PreToolUse`: Triggered before tool use
100
- - `PostToolUse`: Triggered after tool use
101
- - `UserPromptSubmit`: Triggered when user submits a prompt
102
- - `Notification`: Triggered when sending a notification
103
- - `Stop`: Triggered when attempting to stop
104
- - `SubagentStop`: Triggered when sub-agent attempts to stop
105
- - `SessionStart`: Triggered at session start
106
- - `SessionEnd`: Triggered at session end
107
- - `PreCompact`: Triggered before conversation history compression
108
-
109
- **Hook Types**:
110
- - `command`: Execute a shell command or script
57
+ **Available events**:
58
+
59
+ Plugin hooks respond to the same lifecycle events as user-defined hooks:
60
+
61
+ | Event | Trigger |
62
+ |------|---------|
63
+ | `SessionStart` | Session starts or resumes |
64
+ | `UserPromptSubmit` | User submits a prompt, before AI processing |
65
+ | `PreToolUse` | Before tool execution; can block |
66
+ | `PermissionRequest` | When the permission dialog appears |
67
+ | `PermissionDenied` | When a tool call is denied by the auto-mode classifier. Return `{retry: true}` to tell the model it can retry |
68
+ | `PostToolUse` | After a tool call succeeds |
69
+ | `PostToolUseFailure` | After a tool call fails |
70
+ | `Notification` | When CodeBuddy sends a notification |
71
+ | `SubagentStart` | When a sub-agent starts |
72
+ | `SubagentStop` | When a sub-agent finishes |
73
+ | `TaskCreated` | When a task is created via `TaskCreate` |
74
+ | `TaskCompleted` | When a task is marked completed |
75
+ | `Stop` | When the AI finishes its response |
76
+ | `StopFailure` | When the turn ends due to an API error. Output and exit code are ignored |
77
+ | `TeammateIdle` | When a teammate is about to go idle |
78
+ | `InstructionsLoaded` | When CODEBUDDY.md or `.codebuddy/rules/*.md` files are loaded into context |
79
+ | `ConfigChange` | When a configuration file changes during the session |
80
+ | `CwdChanged` | When the working directory changes (e.g., the AI runs `cd`) |
81
+ | `FileChanged` | When a watched file changes on disk. The `matcher` field specifies the filename to watch |
82
+ | `WorktreeCreate` | When a worktree is created via `--worktree` or `isolation: "worktree"` |
83
+ | `WorktreeRemove` | When a worktree is removed (session exit or sub-agent completion) |
84
+ | `PreCompact` | Before context compaction |
85
+ | `PostCompact` | After context compaction completes |
86
+ | `Elicitation` | When an MCP server requests user input during a tool call |
87
+ | `ElicitationResult` | After the user responds to an MCP elicitation, before the response is sent back to the server |
88
+ | `SessionEnd` | When the session terminates |
89
+
90
+ **Hook types**:
91
+
92
+ - `command`: Executes a shell command or script.
93
+ - `http`: Sends the event JSON as a POST request to a URL.
94
+ - `prompt`: Uses an LLM to evaluate a prompt (use the `$ARGUMENTS` placeholder for context).
95
+ - `agent`: Runs an agent validator with tools, for complex validation tasks.
96
+
97
+ ### 4. MCP Servers
98
+
99
+ Plugins can bundle Model Context Protocol (MCP) servers to connect CodeBuddy with external tools and services.
100
+
101
+ **Location**: `.mcp.json` under the plugin root, or inline configuration in `plugin.json`.
102
+
103
+ **Format**: Standard MCP server configuration.
104
+
105
+ **Configuration example**:
111
106
 
112
- **Matcher Rules**:
113
- - Supports regex matching for tool names
114
- - Example: `"Write|Edit"` matches Write or Edit tools
115
-
116
- ### 5. MCP Servers
117
-
118
- **Location**:
119
- - `.mcp.json` configuration file in the plugin root
120
- - Or configured via PluginInfo extension fields in `plugin.json`
121
-
122
- **Configuration Example** (.mcp.json):
123
107
  ```json
124
108
  {
125
109
  "mcpServers": {
@@ -139,28 +123,30 @@ Skill instruction content
139
123
  }
140
124
  ```
141
125
 
142
- **Integration Behavior**:
143
- - MCP servers automatically start when the plugin is enabled
144
- - Servers appear as standard MCP tools in the toolkit
145
- - Server functionality seamlessly integrates with existing tools
126
+ **Integration behavior**:
127
+
128
+ - MCP servers start automatically when the plugin is enabled.
129
+ - Servers appear as standard MCP tools in the toolkit.
130
+ - Server functionality integrates seamlessly with existing tools.
131
+ - Plugin servers can be configured independently of user-level MCP servers.
146
132
 
147
- ### 6. LSP Servers
133
+ ### 5. LSP Servers
148
134
 
149
- > **Tip**: Need to use an LSP plugin? Install from the official marketplace—search for "lsp" in the `/plugin` Discover tab. This section describes how to create LSP plugins for languages not covered by the official marketplace.
135
+ > **Tip**: Need an LSP plugin? You can install one from the official marketplace search for "lsp" in the `/plugin` Discover tab. This section covers how to create LSP plugins for languages not provided by the official marketplace.
150
136
 
151
- Plugins can provide [Language Server Protocol](https://microsoft.github.io/language-server-protocol/) (LSP) servers to give the AI assistant real-time code intelligence support when working on codebases.
137
+ Plugins can provide [Language Server Protocol](https://microsoft.github.io/language-server-protocol/) (LSP) servers to give the AI assistant real-time code intelligence while working on a codebase.
152
138
 
153
139
  LSP integration provides:
154
140
 
155
- * **Instant diagnostics**: AI assistant sees errors and warnings immediately after each edit
156
- * **Code navigation**: Jump to definition, find references, and hover information
157
- * **Language awareness**: Type information and documentation for code symbols
141
+ * **Instant diagnostics**: The AI assistant sees errors and warnings immediately after each edit.
142
+ * **Code navigation**: Go to definition, find references, and hover information.
143
+ * **Language awareness**: Type information and documentation for code symbols.
158
144
 
159
- **Location**: `.lsp.json` file in the plugin root, or inline configuration in `plugin.json`
145
+ **Location**: An `.lsp.json` file under the plugin root, or inline configuration in `plugin.json`.
160
146
 
161
- **Format**: JSON configuration mapping language server names to their configurations
147
+ **Format**: JSON configuration mapping language server names to their configurations.
162
148
 
163
- **`.lsp.json` File Format**:
149
+ **`.lsp.json` file format**:
164
150
 
165
151
  ```json
166
152
  {
@@ -174,7 +160,7 @@ LSP integration provides:
174
160
  }
175
161
  ```
176
162
 
177
- **Inline Configuration in `plugin.json`**:
163
+ **Inline configuration in `plugin.json`**:
178
164
 
179
165
  ```json
180
166
  {
@@ -191,14 +177,14 @@ LSP integration provides:
191
177
  }
192
178
  ```
193
179
 
194
- **Required Fields**:
180
+ **Required fields**:
195
181
 
196
182
  | Field | Description |
197
183
  | :--- | :--- |
198
- | `command` | The LSP binary to execute (must be in PATH) |
184
+ | `command` | LSP binary to execute (must be on PATH) |
199
185
  | `extensionToLanguage` | Maps file extensions to language identifiers |
200
186
 
201
- **Optional Fields**:
187
+ **Optional fields**:
202
188
 
203
189
  | Field | Description |
204
190
  | :--- | :--- |
@@ -208,17 +194,16 @@ LSP integration provides:
208
194
  | `initializationOptions` | Options passed to the server during initialization |
209
195
  | `settings` | Settings passed via `workspace/didChangeConfiguration` |
210
196
  | `workspaceFolder` | Workspace folder path for the server |
211
- | `startupTimeout` | Maximum time to wait for server startup (milliseconds) |
212
- | `shutdownTimeout` | Maximum time to wait for graceful shutdown (milliseconds) |
213
- | `restartOnCrash` | Whether to automatically restart when the server crashes |
197
+ | `startupTimeout` | Maximum time (ms) to wait for server startup |
198
+ | `shutdownTimeout` | Maximum time (ms) to wait for graceful shutdown |
199
+ | `restartOnCrash` | Whether to automatically restart after a crash |
214
200
  | `maxRestarts` | Maximum restart attempts before giving up |
215
- | `loggingConfig` | Debug logging configuration (see below) |
216
201
 
217
- > **Warning**: **You must install the language server binary separately.** LSP plugins configure how CodeBuddy connects to a language server but do not include the server itself. If you see `Executable not found in $PATH` errors in the `/plugin` Errors tab, install the required binary for your language.
202
+ > **Warning**: **You must install the language server binary separately.** LSP plugins configure how CodeBuddy connects to a language server but do not include the server itself. If you see an `Executable not found in $PATH` error in the `/plugin` Errors tab, install the binary for your language.
218
203
 
219
- **Available LSP Plugins**:
204
+ **Available LSP plugins**:
220
205
 
221
- | Plugin | Language Server | Installation Command |
206
+ | Plugin | Language Server | Install Command |
222
207
  | :--- | :--- | :--- |
223
208
  | `pyright-lsp` | Pyright (Python) | `pip install pyright` or `npm install -g pyright` |
224
209
  | `typescript-lsp` | TypeScript Language Server | `npm install -g typescript-language-server typescript` |
@@ -228,7 +213,26 @@ Install the language server first, then install the plugin from the marketplace.
228
213
 
229
214
  ---
230
215
 
231
- ## II. Plugin Manifest Schema (plugin.json)
216
+ ## II. Plugin Installation Scopes
217
+
218
+ When installing a plugin, choose a **scope** that determines where the plugin is available:
219
+
220
+ | Scope | Settings file | Use case |
221
+ | :--- | :--- | :--- |
222
+ | `user` | `~/.codebuddy/settings.json` | Personal plugin, available in all projects (default) |
223
+ | `project` | `.codebuddy/settings.json` | Team plugin, shared via version control |
224
+ | `local` | `.codebuddy/settings.local.json` | Project-specific plugin, gitignored |
225
+ | `managed` | Managed settings | Managed plugins (read-only; updates only) |
226
+
227
+ Plugins use the same scoping system as other CodeBuddy configuration. See [Settings](settings.md) for details.
228
+
229
+ ---
230
+
231
+ ## III. Plugin Manifest Schema (plugin.json)
232
+
233
+ The `.codebuddy-plugin/plugin.json` file (or `.workbuddy-plugin/plugin.json`, `.claude-plugin/plugin.json`) defines plugin metadata and configuration. This section documents all supported fields and options.
234
+
235
+ The manifest is optional. If omitted, CodeBuddy auto-discovers components in the [default locations](#file-location-reference) and derives the plugin name from the directory name. Use a manifest when you need to provide metadata or customize component paths.
232
236
 
233
237
  ### Complete Schema Example
234
238
 
@@ -238,7 +242,7 @@ Install the language server first, then install the plugin from the marketplace.
238
242
  "version": "1.2.0",
239
243
  "description": "Brief plugin description",
240
244
  "author": {
241
- "name": "Author Name",
245
+ "name": "Author name",
242
246
  "email": "[email protected]",
243
247
  "url": "https://github.com/author"
244
248
  },
@@ -246,107 +250,130 @@ Install the language server first, then install the plugin from the marketplace.
246
250
  "repository": "https://github.com/author/plugin",
247
251
  "license": "MIT",
248
252
  "keywords": ["keyword1", "keyword2"],
249
- "category": "Development Tools",
250
- "features": ["Feature 1", "Feature 2"],
251
- "requirements": {
252
- "node": ">=16.0.0"
253
- },
254
253
  "commands": ["./custom/commands/special.md"],
255
254
  "agents": "./custom/agents/",
255
+ "skills": "./custom/skills/",
256
256
  "hooks": "./config/hooks.json",
257
- "mcpServers": [
258
- {
259
- "name": "custom-server",
260
- "command": "node",
261
- "args": ["./servers/custom.js"],
262
- "env": {
263
- "SERVER_PORT": "3000"
264
- }
265
- }
266
- ],
257
+ "mcpServers": "./mcp-config.json",
258
+ "outputStyles": "./styles/",
267
259
  "lspServers": "./.lsp.json"
268
260
  }
269
261
  ```
270
262
 
271
263
  ### Required Fields
272
264
 
265
+ If a manifest is included, `name` is the only required field.
266
+
273
267
  | Field | Type | Description | Example |
274
268
  |------|------|------|------|
275
- | name | string | Unique identifier (kebab-case, no spaces) | "deployment-tools" |
276
- | description | string | Brief plugin purpose | "Deployment automation tools" |
269
+ | `name` | string | Unique identifier (kebab-case, no spaces) | `"deployment-tools"` |
270
+
271
+ This name is used for component namespacing. For example, in the UI, the agent `agent-creator` from plugin `plugin-dev` will appear as `plugin-dev:agent-creator`.
277
272
 
278
273
  ### Metadata Fields
279
274
 
280
275
  | Field | Type | Description | Example |
281
276
  |------|------|------|------|
282
- | version | string | Semantic version | "2.1.0" |
283
- | author | object | Author information | `{"name": "Dev Team", "email": "[email protected]"}` |
284
- | homepage | string | Documentation URL | "https://docs.example.com" |
285
- | repository | string | Source code URL | "https://github.com/user/plugin" |
286
- | license | string | License identifier | "MIT", "Apache-2.0" |
287
- | keywords | array | Discovery tags | `["deployment", "ci-cd"]` |
288
- | category | string | Plugin category | "Development Tools" |
289
- | features | array | Feature list | `["Auto-deployment", "Log analysis"]` |
277
+ | `version` | string | Semantic version. If set in both the marketplace entry and `plugin.json`, `plugin.json` wins. Set in only one place. | `"2.1.0"` |
278
+ | `description` | string | Short description of the plugin's purpose | `"Deployment automation tools"` |
279
+ | `author` | object | Author information | `{"name": "Dev Team", "email": "[email protected]"}` |
280
+ | `homepage` | string | Documentation URL | `"https://docs.example.com"` |
281
+ | `repository` | string | Source code URL | `"https://github.com/user/plugin"` |
282
+ | `license` | string | License identifier | `"MIT"`, `"Apache-2.0"` |
283
+ | `keywords` | array | Discovery tags | `["deployment", "ci-cd"]` |
290
284
 
291
- ### Component Path Fields (PluginManifest)
285
+ ### Component Path Fields
292
286
 
293
287
  | Field | Type | Description | Example |
294
288
  |------|------|------|------|
295
- | commands | string / string[] | Additional command file path array | `["./custom/cmd.md"]` |
296
- | agents | string / string[] | Additional agent file directory path | "./custom/agents/" |
297
- | hooks | string / object | Additional hook file or configuration | "./custom/hooks.json" |
298
- | mcpServers | string / `Record<string,MCPServerConfig>` | MCP server config file path or config object | See MCPServerConfig below |
299
- | lspServers | string / object | [Language Server Protocol](https://microsoft.github.io/language-server-protocol/) configuration for code intelligence (jump to definition, find references, etc.) | `"./.lsp.json"` |
289
+ | `commands` | string \| array | Custom command file/directory (replaces default `commands/`) | `"./custom/cmd.md"` or `["./cmd1.md"]` |
290
+ | `agents` | string \| array | Custom agent files (replaces default `agents/`) | `"./custom/agents/reviewer.md"` |
291
+ | `skills` | string \| array | Custom skill directories (replaces default `skills/`) | `"./custom/skills/"` |
292
+ | `hooks` | string \| array \| object | Hook configuration path or inline configuration | `"./my-extra-hooks.json"` |
293
+ | `mcpServers` | string \| array \| object | MCP configuration path or inline configuration | `"./my-extra-mcp-config.json"` |
294
+ | `outputStyles` | string \| array | Custom output style files/directories (replaces default `output-styles/`) | `"./styles/"` |
295
+ | `lspServers` | string \| array \| object | LSP configuration path or inline configuration | `"./.lsp.json"` |
296
+ | `userConfig` | object | Values CodeBuddy prompts the user to provide when enabling the plugin. See [User Configuration](#user-configuration) | See below |
297
+ | `channels` | array | Channel declarations for message injection. See [Channels](#channels) | See below |
300
298
 
301
- ### MCPServerConfig Structure
299
+ ### User Configuration
302
300
 
303
- ```typescript
301
+ The `userConfig` field declares values that CodeBuddy prompts the user to provide when the plugin is enabled. Use this instead of asking users to edit `settings.json` manually.
302
+
303
+ ```json
304
304
  {
305
- "name": "Server name",
306
- "command": "Execution command",
307
- "args": ["Array of command arguments"],
308
- "env": {
309
- "ENVIRONMENT_VARIABLE": "value"
305
+ "userConfig": {
306
+ "api_endpoint": {
307
+ "description": "Your team's API endpoint",
308
+ "sensitive": false
309
+ },
310
+ "api_token": {
311
+ "description": "API authentication token",
312
+ "sensitive": true
313
+ }
310
314
  }
311
315
  }
312
316
  ```
313
317
 
314
- ### Runtime Extension Fields (PluginInfo)
318
+ Keys must be valid identifiers. Each value can be substituted as `${user_config.KEY}` in MCP and LSP server configs and hook commands, and (for non-sensitive values only) inside skill and agent content. Values are also exported as `CODEBUDDY_PLUGIN_OPTION_<KEY>` environment variables to plugin child processes.
315
319
 
316
- Plugins extend the following fields at runtime, supporting more flexible configuration:
320
+ Non-sensitive values are stored in `pluginConfigs[<plugin-id>].options` in `settings.json`. Sensitive values are stored in the system keychain (or in `~/.codebuddy/.credentials.json` if the keychain is unavailable). Keychain storage is shared with OAuth tokens and has a total limit of around 2 KB, so sensitive values should be kept small.
317
321
 
318
- | Field | Type | Description | Example |
319
- |------|------|------|------|
320
- | agents | string[] | Agent file or directory paths | `["./custom/agents/"]` |
321
- | commands | string[] | Command file or directory paths | `["./custom/commands/"]` |
322
- | skills | string[] | Skill file or directory paths | `["./custom/skills/"]` |
323
- | hooks | `Record<string, any>` \| string | Hook configuration object or file path | "./hooks/custom.json" |
324
- | mcpServers | `Record<string, McpConfig>` \| string | MCP configuration object or file path | "./mcp-config.json" |
325
- | lspServers | `Record<string, LspConfig>` \| string | LSP configuration object or file path | "./.lsp.json" |
326
-
327
- **Note**:
328
- - These extension fields are used in marketplace.json to configure how plugins are loaded
329
- - Support for direct configuration objects or file path strings
330
- - The loader intelligently merges configured paths with default directory scanning results
322
+ ### Channels
323
+
324
+ The `channels` field lets a plugin declare one or more message channels used to inject content into the conversation. Each channel binds to an MCP server provided by the plugin.
325
+
326
+ ```json
327
+ {
328
+ "channels": [
329
+ {
330
+ "server": "telegram",
331
+ "userConfig": {
332
+ "bot_token": { "description": "Telegram bot token", "sensitive": true },
333
+ "owner_id": { "description": "Your Telegram user ID", "sensitive": false }
334
+ }
335
+ }
336
+ ]
337
+ }
338
+ ```
339
+
340
+ The `server` field is required and must match a key in the plugin's `mcpServers`. The optional per-channel `userConfig` uses the same schema as the top-level one, letting you prompt for a bot token or owner ID when the plugin is enabled.
331
341
 
332
342
  ### Path Behavior Rules
333
343
 
334
- **Important**: Custom paths are **supplementary** to default directories, not replacements.
344
+ For `commands`, `agents`, `skills`, and `outputStyles`, a custom path **replaces** the default directory. If the manifest specifies `commands`, the default `commands/` directory is not scanned. Hooks, MCP servers, and LSP servers have different semantics for handling multiple sources.
345
+
346
+ - All paths must be relative to the plugin root and start with `./`.
347
+ - Components under custom paths follow the same naming and namespacing rules.
348
+ - Multiple paths can be specified as an array.
349
+ - To keep the default directory and add more paths, include the default in the array: `"commands": ["./commands/", "./extras/deploy.md"]`.
335
350
 
336
- - If the `commands/` directory exists, it will be loaded along with custom command paths
337
- - All paths must be relative to the plugin root and begin with `./`
338
- - Multiple paths can be specified as arrays for flexibility
339
- - Paths can point to individual files or directories
351
+ **Path examples**:
340
352
 
341
- **Path Resolution Rules**:
342
- - File paths: Must end with `.md` (for commands/agents) or be `SKILL.md` (for skills)
343
- - Directory paths: Recursively scans the directory for all qualifying files
353
+ ```json
354
+ {
355
+ "commands": [
356
+ "./specialized/deploy.md",
357
+ "./utilities/batch-process.md"
358
+ ],
359
+ "agents": [
360
+ "./custom-agents/reviewer.md",
361
+ "./custom-agents/tester.md"
362
+ ]
363
+ }
364
+ ```
344
365
 
345
366
  ### Environment Variables
346
367
 
347
- **`${CODEBUDDY_PLUGIN_ROOT}`**: Contains the absolute path to the plugin directory. Use this variable in hooks, MCP servers, and scripts to ensure correct paths regardless of installation location.
368
+ CodeBuddy provides two variables for referencing plugin paths. Both are substituted inline anywhere in skill content, agent content, hook commands, and MCP or LSP server configuration. Both are also exported as environment variables to hook processes and MCP/LSP server child processes.
369
+
370
+ **`${CODEBUDDY_PLUGIN_ROOT}`**: Absolute path to the plugin installation directory. Use it to reference scripts, binaries, and configuration files bundled with the plugin. This path changes when the plugin is updated, so files written here do not persist across updates.
371
+
372
+ **Compatibility**: The `${CLAUDE_PLUGIN_ROOT}` variable name is also supported for compatibility with Claude Code plugins.
348
373
 
349
- **Compatibility**: Also supports the `${CLAUDE_PLUGIN_ROOT}` variable name for compatibility with Claude Code plugins.
374
+ **`${CODEBUDDY_PLUGIN_DATA}`**: A persistent directory for plugin state that survives updates. Use it for installed dependencies (such as `node_modules` or Python virtual environments), generated code, caches, and any files that need to persist across plugin versions. The directory is created automatically on first reference.
375
+
376
+ **Compatibility**: The `${CLAUDE_PLUGIN_DATA}` variable name is also supported.
350
377
 
351
378
  ```json
352
379
  {
@@ -365,355 +392,414 @@ Plugins extend the following fields at runtime, supporting more flexible configu
365
392
  }
366
393
  ```
367
394
 
395
+ #### Persistent Data Directory
396
+
397
+ The `${CODEBUDDY_PLUGIN_DATA}` directory resolves to `~/.codebuddy/plugins/data/{id}/`, where `{id}` is the plugin identifier with characters outside `a-z`, `A-Z`, `0-9`, `_`, and `-` replaced by `-`. For example, a plugin installed as `formatter@my-marketplace` uses the directory `~/.codebuddy/plugins/data/formatter-my-marketplace/`.
398
+
399
+ A common use is to install language dependencies once and reuse them across sessions and plugin updates. Because the data directory's lifetime outlasts any single plugin version, simply checking for directory existence does not detect when an update has changed the plugin's dependency manifest. The recommended pattern is to compare the bundled manifest with a copy in the data directory and reinstall when they differ.
400
+
401
+ The following `SessionStart` hook installs `node_modules` on first run, and reinstalls them whenever a plugin update includes a changed `package.json`:
402
+
403
+ ```json
404
+ {
405
+ "hooks": {
406
+ "SessionStart": [
407
+ {
408
+ "hooks": [
409
+ {
410
+ "type": "command",
411
+ "command": "diff -q \"${CODEBUDDY_PLUGIN_ROOT}/package.json\" \"${CODEBUDDY_PLUGIN_DATA}/package.json\" >/dev/null 2>&1 || (cd \"${CODEBUDDY_PLUGIN_DATA}\" && cp \"${CODEBUDDY_PLUGIN_ROOT}/package.json\" . && npm install) || rm -f \"${CODEBUDDY_PLUGIN_DATA}/package.json\""
412
+ }
413
+ ]
414
+ }
415
+ ]
416
+ }
417
+ }
418
+ ```
419
+
420
+ `diff` exits non-zero whenever the stored copy is missing or differs from the bundled copy, covering both the first run and dependency-changing updates. If `npm install` fails, the trailing `rm` removes the copied manifest so the next session retries.
421
+
422
+ Scripts bundled under `${CODEBUDDY_PLUGIN_ROOT}` can run against the persisted `node_modules`:
423
+
424
+ ```json
425
+ {
426
+ "mcpServers": {
427
+ "routines": {
428
+ "command": "node",
429
+ "args": ["${CODEBUDDY_PLUGIN_ROOT}/server.js"],
430
+ "env": {
431
+ "NODE_PATH": "${CODEBUDDY_PLUGIN_DATA}/node_modules"
432
+ }
433
+ }
434
+ }
435
+ }
436
+ ```
437
+
438
+ When a plugin is uninstalled (from its last installation scope), the data directory is deleted automatically. The `/plugin` UI shows the directory size and prompts before deletion. The CLI deletes it by default; pass `--keep-data` to retain it.
439
+
440
+ ---
441
+
442
+ ## IV. Plugin Cache and File Resolution
443
+
444
+ Plugins can be specified in two ways:
445
+
446
+ - Via `codebuddy --plugin-dir`, valid for the current session only.
447
+ - Via marketplace installation, valid for future sessions.
448
+
449
+ For security and validation, CodeBuddy copies **marketplace** plugins to the user's local **plugin cache** (`~/.codebuddy/plugins/cache`) rather than using them in place. Understanding this behavior is important when developing plugins that reference external files.
450
+
451
+ ### Path Traversal Restrictions
452
+
453
+ Installed plugins cannot reference files outside their own directory. Paths that traverse outside the plugin root (like `../shared-utils`) do not work after installation because those external files are not copied into the cache.
454
+
455
+ ### Using External Dependencies
456
+
457
+ If a plugin needs access to files outside its directory, you can create symlinks inside the plugin directory that point to external files. Symlinks are preserved during the copy:
458
+
459
+ ```bash
460
+ # Inside the plugin directory
461
+ ln -s /path/to/shared-utils ./shared-utils
462
+ ```
463
+
464
+ The contents of the symlink are copied into the plugin cache. This provides flexibility while preserving the security benefits of the cache system.
465
+
368
466
  ---
369
467
 
370
- ## III. Plugin Directory Structure
468
+ ## V. Plugin Directory Structure
371
469
 
372
470
  ### Standard Plugin Layout
373
471
 
472
+ A complete plugin follows this structure:
473
+
374
474
  ```
375
475
  enterprise-plugin/
376
- ├── .codebuddy-plugin/ # Metadata directory
377
- │ └── plugin.json # Required: Plugin manifest
378
- ├── commands/ # Default commands location
476
+ ├── .codebuddy-plugin/ # Metadata directory (optional)
477
+ │ └── plugin.json # Plugin manifest
478
+ ├── commands/ # Default commands location
379
479
  │ ├── status.md
380
480
  │ └── logs.md
381
- ├── agents/ # Default agents location
481
+ ├── agents/ # Default agents location
382
482
  │ ├── security-reviewer.md
383
483
  │ ├── performance-tester.md
384
484
  │ └── compliance-checker.md
385
- ├── skills/ # Agent skills
485
+ ├── skills/ # Agent skills
386
486
  │ ├── code-reviewer/
387
487
  │ │ └── SKILL.md
388
488
  │ └── pdf-processor/
389
489
  │ ├── SKILL.md
390
490
  │ └── scripts/
391
- ├── hooks/ # Hook configuration
392
- │ └── hooks.json # Hook configuration file
393
- ├── .mcp.json # MCP server definitions
394
- ├── .lsp.json # LSP server configuration
395
- ├── scripts/ # Hooks and utility scripts
491
+ ├── output-styles/ # Output style definitions
492
+ │ └── terse.md
493
+ ├── hooks/ # Hook configuration
494
+ ├── hooks.json # Primary hook configuration
495
+ │ └── security-hooks.json # Additional hooks
496
+ ├── bin/ # Plugin executables, added to PATH
497
+ │ └── my-tool # Callable as a bare command in the Bash tool
498
+ ├── settings.json # Plugin default settings
499
+ ├── .mcp.json # MCP server definitions
500
+ ├── .lsp.json # LSP server configuration
501
+ ├── scripts/ # Hook and utility scripts
396
502
  │ ├── security-scan.sh
397
503
  │ ├── format-code.py
398
504
  │ └── deploy.js
399
- ├── LICENSE # License file
400
- └── README.md # Plugin documentation
505
+ ├── LICENSE # License file
506
+ └── CHANGELOG.md # Version history
401
507
  ```
402
508
 
403
- **Important**:
404
- - The `.codebuddy-plugin/` or `.claude-plugin/` directory contains the `plugin.json` file
405
- - All other directories (`commands/`, `agents/`, `skills/`, `hooks/`) must be located in the plugin root
406
- - The system prioritizes `.codebuddy-plugin/` while also supporting `.claude-plugin/` for compatibility
509
+ > **Important**: The `.codebuddy-plugin/` directory contains the `plugin.json` file. All other directories (`commands/`, `agents/`, `skills/`, `output-styles/`, `hooks/`) must live at the plugin root, not inside `.codebuddy-plugin/`. The `.workbuddy-plugin/` and `.claude-plugin/` directories are also supported for compatibility.
407
510
 
408
511
  ### File Location Reference
409
512
 
410
- | Component | Default Location | Purpose |
513
+ | Component | Default location | Purpose |
411
514
  |------|----------|------|
412
- | Manifest | .codebuddy-plugin/plugin.json | Required metadata file |
413
- | Commands | commands/ | Slash command markdown files |
414
- | Agents | agents/ | Sub-agent markdown files |
415
- | Skills | skills/ | Agent skills with SKILL.md files |
416
- | Hooks | hooks/hooks.json | Hook configuration |
417
- | MCP servers | .mcp.json | MCP server definitions |
418
- | LSP servers | .lsp.json | Language server configuration |
515
+ | **Manifest** | `.codebuddy-plugin/plugin.json` | Plugin metadata and configuration (optional) |
516
+ | **Commands** | `commands/` | Skill Markdown files (legacy; new skills use `skills/`) |
517
+ | **Agents** | `agents/` | Sub-agent Markdown files |
518
+ | **Skills** | `skills/` | Skills following the `<name>/SKILL.md` structure |
519
+ | **Output styles** | `output-styles/` | Output style definitions |
520
+ | **Hooks** | `hooks/hooks.json` | Hook configuration |
521
+ | **MCP servers** | `.mcp.json` | MCP server definitions |
522
+ | **LSP servers** | `.lsp.json` | Language server configuration |
523
+ | **Executables** | `bin/` | Executables added to the Bash tool PATH. When the plugin is enabled, files in this directory can be invoked as bare commands in any Bash tool call |
524
+ | **Settings** | `settings.json` | Default configuration applied when the plugin is enabled. Currently only [agent](sub-agents.md) settings are supported |
419
525
 
420
526
  ---
421
527
 
422
- ## IV. Marketplace Manifest Schema (marketplace.json)
528
+ ## VI. CLI Command Reference
423
529
 
424
- ### Complete Schema Example
530
+ CodeBuddy provides CLI commands for non-interactive plugin management, suitable for scripting and automation.
425
531
 
426
- ```json
427
- {
428
- "name": "Enterprise Plugin Marketplace",
429
- "description": "Internal enterprise plugin collection",
430
- "version": "1.0.0",
431
- "owner": {
432
- "name": "Enterprise Development Team",
433
- "email": "[email protected]"
434
- },
435
- "plugins": [
436
- {
437
- "name": "deployment-tool",
438
- "description": "Automated deployment tools",
439
- "version": "1.0.0",
440
- "source": "plugins/deployment-tool"
441
- },
442
- {
443
- "name": "code-review-bot",
444
- "description": "Code review bot",
445
- "version": "2.1.0",
446
- "source": {
447
- "source": "github",
448
- "repo": "company/code-review-bot"
449
- }
450
- },
451
- {
452
- "name": "security-scanner",
453
- "description": "Security scanning tool",
454
- "version": "1.5.0",
455
- "source": {
456
- "source": "url",
457
- "url": "https://github.com/company/security-scanner.git"
458
- }
459
- }
460
- ]
461
- }
462
- ```
532
+ ### plugin install
463
533
 
464
- ### Required Fields
534
+ Install a plugin from an available marketplace.
465
535
 
466
- | Field | Type | Description | Example |
467
- |------|------|------|------|
468
- | name | string | Marketplace name | "Enterprise Plugin Marketplace" |
469
- | plugins | array | Plugin list | See below |
536
+ ```bash
537
+ codebuddy plugin install <plugin> [options]
538
+ ```
470
539
 
471
- ### Metadata Fields
540
+ **Arguments**:
472
541
 
473
- | Field | Type | Description | Example |
474
- |------|------|------|------|
475
- | description | string | Marketplace description | "Internal enterprise plugin collection" |
476
- | version | string | Marketplace version | "1.0.0" |
477
- | owner | object | Owner information | `{"name": "Team", "email": "..."}` |
542
+ - `<plugin>`: Plugin name, or `plugin-name@marketplace-name` to specify a particular marketplace.
478
543
 
479
- ### Plugin Entry (MarketplacePluginEntry)
544
+ **Options**:
480
545
 
481
- Each plugin entry contains the following fields:
546
+ | Option | Description | Default |
547
+ |------|------|------|
548
+ | `-s, --scope <scope>` | Install scope: `user`, `project`, or `local` | `user` |
549
+ | `-h, --help` | Show command help | |
482
550
 
483
- | Field | Type | Required | Description |
484
- |------|------|------|------|
485
- | name | string | ✓ | Plugin unique identifier |
486
- | description | string | ✓ | Plugin description |
487
- | version | string | | Plugin version number |
488
- | source | string \| PluginSource | ✓ | Plugin source configuration |
489
- | strict | boolean | | Strict mode (compatible with superpowers-marketplace) |
551
+ The scope determines which settings file the installed plugin is added to. For example, `--scope project` writes to `enabledPlugins` in `.codebuddy/settings.json`, making the plugin available to everyone who clones the project repository.
490
552
 
491
- ### PluginSource Configuration
553
+ **Examples**:
492
554
 
493
- Plugin sources support three types:
555
+ ```bash
556
+ # Install at user scope (default)
557
+ codebuddy plugin install formatter@my-marketplace
494
558
 
495
- #### 1. Local Relative Path (string)
496
- ```json
497
- {
498
- "source": "plugins/my-plugin"
499
- }
500
- ```
559
+ # Install at project scope (shared with team)
560
+ codebuddy plugin install formatter@my-marketplace --scope project
501
561
 
502
- #### 2. Local Path (object)
503
- ```json
504
- {
505
- "source": {
506
- "source": "local",
507
- "path": "plugins/my-plugin"
508
- }
509
- }
562
+ # Install at local scope (gitignored)
563
+ codebuddy plugin install formatter@my-marketplace --scope local
510
564
  ```
511
565
 
512
- #### 3. GitHub Repository
513
- ```json
514
- {
515
- "source": {
516
- "source": "github",
517
- "repo": "owner/repo-name"
518
- }
519
- }
566
+ ### plugin uninstall
567
+
568
+ Remove an installed plugin.
569
+
570
+ ```bash
571
+ codebuddy plugin uninstall <plugin> [options]
520
572
  ```
521
573
 
522
- #### 4. Git URL
523
- ```json
524
- {
525
- "source": {
526
- "source": "url",
527
- "url": "https://github.com/owner/repo.git"
528
- }
529
- }
574
+ **Arguments**:
575
+
576
+ - `<plugin>`: Plugin name, or `plugin-name@marketplace-name`.
577
+
578
+ **Options**:
579
+
580
+ | Option | Description | Default |
581
+ |------|------|------|
582
+ | `-s, --scope <scope>` | Uninstall from scope: `user`, `project`, or `local` | `user` |
583
+ | `--keep-data` | Preserve the plugin's [persistent data directory](#persistent-data-directory) | |
584
+ | `-h, --help` | Show command help | |
585
+
586
+ **Aliases**: `remove`, `rm`
587
+
588
+ By default, uninstalling from the last remaining scope also deletes the plugin's `${CODEBUDDY_PLUGIN_DATA}` directory. Use `--keep-data` to preserve it — for example, when reinstalling after testing a new version.
589
+
590
+ ### plugin enable
591
+
592
+ Enable a disabled plugin.
593
+
594
+ ```bash
595
+ codebuddy plugin enable <plugin> [options]
530
596
  ```
531
597
 
532
- ### Marketplace Types
598
+ **Arguments**:
533
599
 
534
- CodeBuddy supports four marketplace types:
600
+ - `<plugin>`: Plugin name, or `plugin-name@marketplace-name`.
535
601
 
536
- | Type | Description | source Field |
537
- |------|------|-------------|
538
- | Directory | Local filesystem directory | path: Absolute local directory path |
539
- | Github | GitHub repository | repo: owner/repo format |
540
- | Git | Git repository | url: Git repository URL |
541
- | URL | HTTP/HTTPS remote | url: URL to marketplace.json |
602
+ **Options**:
542
603
 
543
- ---
604
+ | Option | Description | Default |
605
+ |------|------|------|
606
+ | `-s, --scope <scope>` | Enable scope: `user`, `project`, or `local` | `user` |
607
+ | `-h, --help` | Show command help | |
544
608
 
545
- ## V. Plugin Loading Mechanism
609
+ ### plugin disable
546
610
 
547
- ### Loading Flow
611
+ Disable a plugin without uninstalling it.
548
612
 
549
- 1. **Marketplace Installation**:
550
- - Install marketplace from configured source
551
- - Read `marketplace.json` to get plugin list
613
+ ```bash
614
+ codebuddy plugin disable <plugin> [options]
615
+ ```
552
616
 
553
- 2. **Plugin Installation**:
554
- - Select appropriate installer (Local/Git) based on `source` configuration
555
- - Install plugin content to target location
617
+ **Arguments**:
556
618
 
557
- 3. **Plugin Activation**:
558
- - Read the plugin's `plugin.json` manifest
559
- - Load components based on manifest configuration
619
+ - `<plugin>`: Plugin name, or `plugin-name@marketplace-name`.
560
620
 
561
- 4. **Component Loading**:
562
- - Concurrently load all types of extension components
563
- - Merge configured paths with default directory scanning results
564
- - Cache loaded components for performance
621
+ **Options**:
565
622
 
566
- ### Loader Intelligent Merging
623
+ | Option | Description | Default |
624
+ |------|------|------|
625
+ | `-s, --scope <scope>` | Disable scope: `user`, `project`, or `local` | `user` |
626
+ | `-h, --help` | Show command help | |
567
627
 
568
- Each extension loader intelligently merges content from two sources:
628
+ ### plugin update
569
629
 
570
- 1. **Configured Paths**: Paths specified in `plugin.json` or runtime configuration
571
- 2. **Default Scanning**: Files in default directories (e.g., `commands/`, `agents/`)
630
+ Update a plugin to the latest version.
572
631
 
573
- **Example**:
574
- ```json
575
- {
576
- "commands": ["./custom/deploy.md"],
577
- // Actually loads:
578
- // - ./custom/deploy.md (configured path)
579
- // - All .md files in commands/ directory (default scanning)
580
- }
632
+ ```bash
633
+ codebuddy plugin update <plugin> [options]
581
634
  ```
582
635
 
583
- ### Command Name Generation Rules
636
+ **Arguments**:
584
637
 
585
- - Filename: `command.md` command name: `command`
586
- - Subdirectory: `deploy/prod.md` → command name: `deploy:prod`
587
- - Plugin prefix: Automatically adds plugin name as prefix, e.g., `plugin-name:command`
638
+ - `<plugin>`: Plugin name, or `plugin-name@marketplace-name`.
588
639
 
589
- ### Agent and Skill Tags
640
+ **Options**:
590
641
 
591
- All agents and skills loaded from plugins automatically receive the following tags:
592
- - Source tag: `(plugin-name@marketplace-name)`
593
- - Type tag: `plugin`
594
- - Custom tags: `custom-agent` or `custom-command`
642
+ | Option | Description | Default |
643
+ |------|------|------|
644
+ | `-s, --scope <scope>` | Update scope: `user`, `project`, `local`, or `managed` | `user` |
645
+ | `-h, --help` | Show command help | |
595
646
 
596
- ---
647
+ ### Marketplace Management
648
+
649
+ ```bash
650
+ # Add a marketplace
651
+ codebuddy plugin marketplace add <source> [--name <name>]
652
+
653
+ # List marketplaces
654
+ codebuddy plugin marketplace list
597
655
 
598
- ## VI. Debugging and Development Tools
656
+ # Update a marketplace
657
+ codebuddy plugin marketplace update <name>
599
658
 
600
- ### View Plugin Loading Logs
659
+ # Remove a marketplace
660
+ codebuddy plugin marketplace remove <name>
661
+ ```
601
662
 
602
- Use the `--verbose` parameter to view detailed plugin loading information:
663
+ **Marketplace source formats**:
603
664
 
604
665
  ```bash
605
- codebuddy --verbose
666
+ # Local directory
667
+ codebuddy plugin marketplace add /path/to/marketplace
668
+
669
+ # GitHub shorthand
670
+ codebuddy plugin marketplace add owner/repo
671
+
672
+ # Git URL
673
+ codebuddy plugin marketplace add https://github.com/owner/repo.git
674
+
675
+ # HTTP URL (marketplace.json)
676
+ codebuddy plugin marketplace add https://example.com/marketplace.json
606
677
  ```
607
678
 
608
- **Display Content**:
609
- - Which plugins are being loaded
610
- - Any errors in plugin manifests
611
- - Command, agent, and skill registration
612
- - MCP server initialization
613
- - Hook configuration loading
679
+ ---
680
+
681
+ ## VII. Debugging and Development Tools
682
+
683
+ ### Debug Commands
684
+
685
+ Use `codebuddy --debug` to see plugin loading details:
686
+
687
+ **What it shows**:
688
+
689
+ - Which plugins are being loaded.
690
+ - Any errors in plugin manifests.
691
+ - Command, agent, and hook registration.
692
+ - MCP server initialization.
614
693
 
615
694
  ### Common Troubleshooting
616
695
 
617
696
  | Issue | Cause | Solution |
618
697
  |------|------|----------|
619
- | Plugin not loaded | Invalid plugin.json | Validate JSON syntax, check required fields |
620
- | Command not appearing | Incorrect directory structure | Ensure commands/ is in plugin root |
621
- | Hook not triggering | Script not executable | Run `chmod +x script.sh` |
622
- | MCP server fails | Missing environment variables | Use `${CODEBUDDY_PLUGIN_ROOT}` |
698
+ | Plugin not loaded | Invalid `plugin.json` | Run `codebuddy plugin validate` or `/plugin validate` to check `plugin.json`, skill/agent/command frontmatter, and `hooks/hooks.json` for syntax and schema errors |
699
+ | Command not appearing | Wrong directory structure | Ensure `commands/` is at the plugin root, not inside `.codebuddy-plugin/` |
700
+ | Hook not firing | Script not executable | Run `chmod +x script.sh` |
701
+ | MCP server fails | Missing `${CODEBUDDY_PLUGIN_ROOT}` | Use this variable for all plugin paths |
623
702
  | Path errors | Using absolute paths | All paths must be relative and start with `./` |
624
- | Metadata directory not recognized | Using incorrect directory name | Use `.codebuddy-plugin/` or `.claude-plugin/` |
625
703
  | LSP `Executable not found in $PATH` | Language server not installed | Install the binary (e.g., `npm install -g typescript-language-server typescript`) |
626
704
 
627
- ### Plugin Development Best Practices
705
+ ### Common Error Messages
628
706
 
629
- 1. **Use Relative Paths**: All file references use relative paths to ensure cross-environment compatibility
630
- 2. **Environment Variables**: Use `${CODEBUDDY_PLUGIN_ROOT}` in scripts to reference the plugin directory
631
- 3. **Error Handling**: Add appropriate error handling and timeout settings for hook scripts
632
- 4. **Complete Documentation**: Provide clear installation and usage instructions in README.md
633
- 5. **Semantic Versioning**: Follow semantic versioning conventions to manage plugin versions
634
- 6. **Test Coverage**: Test plugin installation and functionality across different environments
707
+ **Manifest validation errors**:
635
708
 
636
- ---
709
+ - `Invalid JSON syntax: Unexpected token } in JSON at position 142`: Check for missing commas, trailing commas, or unquoted strings.
710
+ - `Plugin has an invalid manifest file at .codebuddy-plugin/plugin.json. Validation errors: name: Required`: Missing required field.
711
+ - `Plugin has a corrupt manifest file at .codebuddy-plugin/plugin.json. JSON parse error: ...`: JSON syntax error.
637
712
 
638
- ## VII. Version Management Reference
713
+ **Plugin loading errors**:
639
714
 
640
- ### Semantic Versioning
715
+ - `Warning: No commands found in plugin my-plugin custom directory: ./cmds. Expected .md files or SKILL.md in subdirectories.`: The command path exists but contains no valid command files.
716
+ - `Plugin directory not found at path: ./plugins/my-plugin. Check that the marketplace entry has the correct path.`: The `source` path in `marketplace.json` points to a non-existent directory.
717
+ - `Plugin my-plugin has conflicting manifests: both plugin.json and marketplace entry specify components.`: Remove duplicate component definitions, or remove `strict: false` from the marketplace entry.
641
718
 
642
- Follow semantic versioning for plugin releases:
719
+ ### Hook Troubleshooting
643
720
 
644
- - **MAJOR version**: Incompatible API changes
645
- - **MINOR version**: Backwards-compatible feature additions
646
- - **PATCH version**: Backwards-compatible bug fixes
721
+ **Hook script not executing**:
647
722
 
648
- Example: `1.2.0` `1.2.1` (fix) `1.3.0` (new feature) → `2.0.0` (breaking change)
723
+ 1. Verify the script is executable: `chmod +x ./scripts/your-script.sh`.
724
+ 2. Check the shebang line: the first line should be `#!/bin/bash` or `#!/usr/bin/env bash`.
725
+ 3. Confirm the path uses `${CODEBUDDY_PLUGIN_ROOT}`: `"command": "${CODEBUDDY_PLUGIN_ROOT}/scripts/your-script.sh"`.
726
+ 4. Test the script manually: `./scripts/your-script.sh`.
649
727
 
650
- ### Plugin Update Process
728
+ **Hook not firing on the expected event**:
651
729
 
652
- 1. Modify plugin code and resources
653
- 2. Update the version field in `plugin.json`
654
- 3. Record changes in CHANGELOG.md
655
- 4. Commit to version control system
656
- 5. Users update plugin through marketplace
730
+ 1. Verify the event name (case-sensitive): `PostToolUse`, not `postToolUse`.
731
+ 2. Check the matcher pattern matches the target tool: `"matcher": "Write|Edit"` for file operations.
732
+ 3. Confirm the hook type is valid: `command`, `http`, `prompt`, or `agent`.
657
733
 
658
- ---
734
+ ### MCP Server Troubleshooting
659
735
 
660
- ## VIII. CLI Command Reference
736
+ **Server does not start**:
661
737
 
662
- ### Marketplace Management
738
+ 1. Check that the command exists and is executable.
739
+ 2. Verify all paths use the `${CODEBUDDY_PLUGIN_ROOT}` variable.
740
+ 3. Check MCP server logs: `codebuddy --debug` shows initialization errors.
741
+ 4. Test the server manually outside of CodeBuddy.
663
742
 
664
- ```bash
665
- # Add marketplace
666
- codebuddy plugin marketplace add <source> [--name <name>]
743
+ **Server tools do not appear**:
667
744
 
668
- # List marketplaces
669
- codebuddy plugin marketplace list
745
+ 1. Ensure the server is correctly configured in `.mcp.json` or `plugin.json`.
746
+ 2. Verify that the server correctly implements the MCP protocol.
747
+ 3. Check for connection timeouts in the debug output.
670
748
 
671
- # Update marketplace
672
- codebuddy plugin marketplace update <name>
749
+ ### Directory Structure Errors
750
+
751
+ **Symptom**: The plugin loads but components (commands, agents, hooks) are missing.
752
+
753
+ **Correct structure**: Components must be at the plugin root, not inside `.codebuddy-plugin/`. Only `plugin.json` belongs in `.codebuddy-plugin/`.
673
754
 
674
- # Remove marketplace
675
- codebuddy plugin marketplace remove <name>
755
+ ```
756
+ my-plugin/
757
+ ├── .codebuddy-plugin/
758
+ │ └── plugin.json <- Only the manifest lives here
759
+ ├── commands/ <- At root level
760
+ ├── agents/ <- At root level
761
+ └── hooks/ <- At root level
676
762
  ```
677
763
 
678
- ### Plugin Management
764
+ If components are inside `.codebuddy-plugin/`, move them up to the plugin root.
679
765
 
680
- ```bash
681
- # Install plugin
682
- codebuddy plugin install <plugin-name> <marketplace-name>
766
+ **Debug checklist**:
683
767
 
684
- # List installed plugins
685
- codebuddy plugin list [--marketplace <name>]
768
+ 1. Run `codebuddy --debug` and look for "loading plugin" messages.
769
+ 2. Verify that each component directory is listed in the debug output.
770
+ 3. Confirm that file permissions allow reading the plugin files.
686
771
 
687
- # Enable plugin
688
- codebuddy plugin enable <plugin-name> <marketplace-name>
772
+ ---
689
773
 
690
- # Disable plugin
691
- codebuddy plugin disable <plugin-name> <marketplace-name>
774
+ ## VIII. Version Management Reference
692
775
 
693
- # Uninstall plugin
694
- codebuddy plugin uninstall <plugin-name> <marketplace-name>
776
+ ### Semantic Versioning
695
777
 
696
- # Update plugin
697
- codebuddy plugin update <plugin-name> <marketplace-name>
698
- ```
778
+ Follow semantic versioning for plugin releases:
699
779
 
700
- ### Marketplace Source Formats
780
+ ```json
781
+ {
782
+ "name": "my-plugin",
783
+ "version": "2.1.0"
784
+ }
785
+ ```
701
786
 
702
- Supports the following formats for adding marketplaces:
787
+ **Version format**: `MAJOR.MINOR.PATCH`
703
788
 
704
- ```bash
705
- # Local directory
706
- codebuddy plugin marketplace add /path/to/marketplace
789
+ - **MAJOR**: Incompatible API changes.
790
+ - **MINOR**: Backwards-compatible feature additions.
791
+ - **PATCH**: Backwards-compatible bug fixes.
707
792
 
708
- # GitHub shorthand
709
- codebuddy plugin marketplace add owner/repo
793
+ **Best practices**:
710
794
 
711
- # Git URL
712
- codebuddy plugin marketplace add https://github.com/owner/repo.git
795
+ - Start the first stable release at `1.0.0`.
796
+ - Update the version in `plugin.json` before distributing changes.
797
+ - Record changes in a `CHANGELOG.md` file.
798
+ - Use pre-release versions (e.g., `2.0.0-beta.1`) for testing.
713
799
 
714
- # HTTP URL (marketplace.json)
715
- codebuddy plugin marketplace add https://example.com/marketplace.json
716
- ```
800
+ > **Note**: CodeBuddy uses the version to decide whether a plugin needs updating. If you change plugin code without bumping the version in `plugin.json`, existing users will not see the change due to caching.
801
+ >
802
+ > If the plugin is in a [marketplace](plugin-marketplaces.md) directory, you can manage versions via `marketplace.json` and omit the `version` field from `plugin.json`.
717
803
 
718
804
  ---
719
805
 
@@ -725,50 +811,28 @@ The CodeBuddy plugin system is designed to be compatible with the Claude Code pl
725
811
 
726
812
  | Concept | Claude Code | CodeBuddy |
727
813
  |------|-------------|-----------|
728
- | Metadata Directory | `.claude-plugin/` | `.codebuddy-plugin/` (priority) or `.claude-plugin/` (compatible) |
729
- | Environment Variable | `${CLAUDE_PLUGIN_ROOT}` | `${CODEBUDDY_PLUGIN_ROOT}` (priority) or `${CLAUDE_PLUGIN_ROOT}` (compatible) |
730
-
731
- ### Extended Features
732
-
733
- CodeBuddy provides the following extensions over Claude Code:
734
-
735
- 1. **Runtime Configuration**: PluginInfo supports runtime extension field configuration
736
- 2. **Multiple Metadata Directories**: Supports both `.codebuddy-plugin/` and `.claude-plugin/`
737
- 3. **Flexible Configuration**: Supports both configuration objects and file path configuration methods
814
+ | Metadata directory | `.claude-plugin/` | `.codebuddy-plugin/` (priority), `.workbuddy-plugin/`, or `.claude-plugin/` (compatible) |
815
+ | Environment variable | `${CLAUDE_PLUGIN_ROOT}` | `${CODEBUDDY_PLUGIN_ROOT}` (priority) or `${CLAUDE_PLUGIN_ROOT}` (compatible) |
816
+ | Data directory variable | `${CLAUDE_PLUGIN_DATA}` | `${CODEBUDDY_PLUGIN_DATA}` (priority) or `${CLAUDE_PLUGIN_DATA}` (compatible) |
738
817
 
739
818
  ### Migration Guide
740
819
 
741
820
  Migrating from Claude Code to CodeBuddy:
742
821
 
743
- 1. Optionally rename `.claude-plugin/` to `.codebuddy-plugin/`
744
- 2. Optionally replace `${CLAUDE_PLUGIN_ROOT}` with `${CODEBUDDY_PLUGIN_ROOT}` in scripts
745
- 3. If using the `mcpServers` field, no changes needed (already uses `mcpServers`)
822
+ 1. Optionally rename `.claude-plugin/` to `.codebuddy-plugin/`.
823
+ 2. Optionally replace `${CLAUDE_PLUGIN_ROOT}` with `${CODEBUDDY_PLUGIN_ROOT}` in scripts.
824
+ 3. Optionally replace `${CLAUDE_PLUGIN_DATA}` with `${CODEBUDDY_PLUGIN_DATA}`.
746
825
 
747
- **Note**: Keeping the original naming is fully compatible; CodeBuddy will automatically recognize it.
826
+ **Note**: Keeping the original names is fully compatible CodeBuddy recognizes them automatically.
748
827
 
749
828
  ---
750
829
 
751
830
  ## Related Resources
752
831
 
753
- - **Plugin Development Tutorial** - How to create custom plugins
754
- - **Marketplace Creation Guide** - Creating and managing plugin marketplaces
755
- - **Hooks Deep Dive** - Event handling and automation
756
- - **MCP Integration Documentation** - External tool integration
757
- - **Settings Configuration** - Plugin configuration options
758
-
759
- ---
760
-
761
- ## Summary
762
-
763
- This document provides the complete technical specification for the CodeBuddy plugin system, covering:
764
-
765
- 1. Six plugin component types (Commands, Agents, Skills, Hooks, MCP Servers, LSP Servers)
766
- 2. Complete plugin.json manifest schema and field descriptions
767
- 3. marketplace.json marketplace manifest schema
768
- 4. Standard directory structure and file locations
769
- 5. Plugin loading mechanism and intelligent merging rules
770
- 6. CLI commands and debugging tools
771
- 7. Version management best practices
772
- 8. Compatibility notes with Claude Code
773
-
774
- Developers can use this reference document to create fully-featured, well-structured CodeBuddy plugins.
832
+ - [Plugins](plugins.md) Tutorial and practical guide
833
+ - [Plugin Marketplaces](plugin-marketplaces.md) Creating and managing marketplaces
834
+ - [Skills](skills.md) Skill development details
835
+ - [Subagents](sub-agents.md) Agent configuration and capabilities
836
+ - [Hooks](hooks.md) Event handling and automation
837
+ - [MCP](mcp.md) – External tool integration
838
+ - [Settings](settings.md) – Plugin configuration options