@tencent-ai/codebuddy-code 2.97.0-next.943311f.20260514 → 2.97.0-next.bcf636d.20260514

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 (32) hide show
  1. package/dist/codebuddy-headless.js +32 -28
  2. package/dist/codebuddy.js +33 -29
  3. package/dist/web-ui/docs/cn/cli/cli-reference.md +7 -6
  4. package/dist/web-ui/docs/cn/cli/env-vars.md +2 -2
  5. package/dist/web-ui/docs/cn/cli/hooks-guide.md +52 -0
  6. package/dist/web-ui/docs/cn/cli/hooks.md +50 -5
  7. package/dist/web-ui/docs/cn/cli/plugins-reference.md +11 -0
  8. package/dist/web-ui/docs/cn/cli/plugins.md +4 -0
  9. package/dist/web-ui/docs/cn/cli/release-notes/README.md +2 -0
  10. package/dist/web-ui/docs/cn/cli/release-notes/v2.95.1.md +27 -0
  11. package/dist/web-ui/docs/cn/cli/release-notes/v2.96.0.md +21 -0
  12. package/dist/web-ui/docs/cn/cli/skills.md +91 -0
  13. package/dist/web-ui/docs/en/cli/cli-reference.md +1 -0
  14. package/dist/web-ui/docs/en/cli/env-vars.md +2 -2
  15. package/dist/web-ui/docs/en/cli/hooks-guide.md +52 -0
  16. package/dist/web-ui/docs/en/cli/hooks.md +61 -14
  17. package/dist/web-ui/docs/en/cli/plugins-reference.md +11 -0
  18. package/dist/web-ui/docs/en/cli/plugins.md +337 -457
  19. package/dist/web-ui/docs/en/cli/release-notes/README.md +2 -0
  20. package/dist/web-ui/docs/en/cli/release-notes/v2.95.1.md +27 -0
  21. package/dist/web-ui/docs/en/cli/release-notes/v2.96.0.md +21 -0
  22. package/dist/web-ui/docs/en/cli/skills.md +91 -0
  23. package/dist/web-ui/docs/search-index-en.json +1 -1
  24. package/dist/web-ui/docs/search-index-zh.json +1 -1
  25. package/dist/web-ui/docs/sidebar-en.json +1 -1
  26. package/dist/web-ui/docs/sidebar-zh.json +1 -1
  27. package/package.json +1 -1
  28. package/product.cloudhosted.json +2 -2
  29. package/product.internal.json +2 -2
  30. package/product.ioa.json +2 -2
  31. package/product.json +2 -2
  32. package/product.selfhosted.json +2 -2
@@ -1,427 +1,269 @@
1
- # CodeBuddy Plugin System
1
+ # Creating Plugins
2
2
 
3
- CodeBuddy Code supports a powerful plugin system that allows you to extend and customize the CLI's functionality. Through plugins, you can add new commands, skills, and hooks, creating a personalized development environment that fits your workflow.
3
+ Plugins let you extend CodeBuddy Code's functionality with custom skills, agents, hooks, and MCP servers. This guide covers how to create your own plugins.
4
4
 
5
- ## Core Concepts
5
+ To install existing plugins, see [Plugin Marketplaces](plugin-marketplaces.md). For complete technical specifications, refer to the [Plugin Reference Documentation](plugins-reference.md).
6
6
 
7
- ### What is a Plugin?
7
+ ## When to Use Plugins vs Standalone Configuration
8
8
 
9
- A plugin is a reusable functionality package that can contain the following components:
9
+ CodeBuddy Code supports two ways to add custom skills, agents, and hooks:
10
10
 
11
- - **Commands**: Slash commands that users can manually trigger
12
- - **Skills**: Specialized capabilities that the AI automatically recognizes and invokes
13
- - **Hooks**: Operations that automatically execute when specific events are triggered
11
+ | Method | Skill Name | Suitable Scenarios |
12
+ |--------|------------|--------------------|
13
+ | **Standalone configuration** (`.codebuddy/` directory) | `/hello` | Personal workflows, project-specific customizations, quick experiments |
14
+ | **Plugin** (directory containing `.codebuddy-plugin/plugin.json`) | `/plugin-name:hello` | Team sharing, community distribution, versioned releases, cross-project reuse |
14
15
 
15
- ### What is a Plugin Marketplace?
16
+ **Use standalone configuration when**:
16
17
 
17
- A plugin marketplace is a publishing and distribution channel for plugins. CodeBuddy supports multiple types of plugin marketplaces:
18
+ - Customizing CodeBuddy Code for a single project
19
+ - The configuration is personal and doesn't need to be shared
20
+ - Experimenting with skills or hooks before packaging them as a plugin
21
+ - You need short skill names like `/hello` or `/deploy`
18
22
 
19
- - **Local Directory Marketplace**: Load plugins from the local filesystem
20
- - **GitHub Repository Marketplace**: Fetch plugins from GitHub repositories
21
- - **HTTP/HTTPS Marketplace**: Fetch plugin manifests and packages from HTTP(S) servers
23
+ **Use plugins when**:
22
24
 
23
- ## Quick Start
24
-
25
- There are three ways to manage plugins: **Team Configuration Auto-Installation**, **Interactive Interface**, and **Command-Line Subcommands**.
26
-
27
- ### Method 1: Team Configuration Auto-Installation (Recommended)
28
-
29
- Teams can configure `extraKnownMarketplaces` and `enabledPlugins` in the project's `.codebuddy/settings.json` to enable automatic plugin installation and activation. When team members start CodeBuddy, the system automatically installs the plugin marketplaces and plugins specified in the configuration.
30
-
31
- #### Configuration Example
32
-
33
- Add the following configuration to `.codebuddy/settings.json`:
34
-
35
- ```json
36
- {
37
- "extraKnownMarketplaces": {
38
- "team-marketplace": {
39
- "source": {
40
- "source": "github",
41
- "repo": "your-org/team-plugins-marketplace"
42
- }
43
- },
44
- "custom-marketplace": {
45
- "source": {
46
- "source": "git",
47
- "url": "https://git.example.com/plugins-marketplace"
48
- }
49
- }
50
- },
51
- "enabledPlugins": {
52
- "team-plugin-a@team-marketplace": true,
53
- "team-plugin-b@team-marketplace": true
54
- }
55
- }
56
- ```
57
-
58
- #### Configuration Explanation
59
-
60
- - **`extraKnownMarketplaces`**: Define additional plugin marketplaces
61
- - Key is the marketplace name (e.g., `team-marketplace`)
62
- - `source.source`: Marketplace type, supports `github`, `git`, and `url`
63
- - `source.repo`: GitHub repository path (format: `owner/repo`, only when source is `github`)
64
- - `source.url`: Git repository URL or HTTP(S) marketplace.json URL (only when source is `git` or `url`)
65
-
66
- - **`enabledPlugins`**: Specify plugins to enable
67
- - Key format: `plugin-name@marketplace-name`
68
- - Value `true` means enabled, `false` means disabled
69
-
70
- #### Automatic Installation Flow
71
-
72
- 1. **Startup Detection**: CodeBuddy automatically detects the configuration file on startup
73
- 2. **Marketplace Installation**: Automatically installs marketplaces from `extraKnownMarketplaces` that are not yet installed
74
- 3. **Plugin Installation**: Automatically installs enabled plugins from `enabledPlugins` that are not yet installed
75
- 4. **Background Execution**: The installation process executes asynchronously in the background without blocking the startup flow
76
- 5. **Logging**: The installation process logs detailed information, viewable with `--debug`
77
-
78
- #### Advantages
79
-
80
- - **Team Consistency**: Ensures team members use the same plugin configuration
81
- - **Automation**: No manual installation needed, improving development efficiency
82
- - **Version Control**: Configuration files can be committed to Git for team collaboration
83
- - **Flexible Override**: Individuals can override team configuration in their local configuration
84
-
85
- ### Method 2: Interactive Interface
86
-
87
- Enter `/plugin` in CodeBuddy conversation to open the interactive plugin management interface.
88
-
89
- #### Opening the Management Interface
25
+ - Sharing functionality with a team or community
26
+ - The same skills/agents need to be used across multiple projects
27
+ - Version control and convenient update mechanisms are required
28
+ - Distributing through a marketplace
29
+ - You can accept namespaced skill names like `/my-plugin:hello` (namespacing prevents conflicts between plugins)
90
30
 
91
- ```bash
92
- /plugin
93
- ```
31
+ > **Tip**: Start with standalone configuration in `.codebuddy/` for fast iteration, then [convert to a plugin](#converting-existing-configuration-to-a-plugin) when you're ready to share.
94
32
 
95
- #### Interface Features
96
-
97
- The interactive interface contains the following 6 tabs:
33
+ ## Quick Start
98
34
 
99
- 1. **Discover** - Browse all available plugins, view installation counts, descriptions, and more
100
- - Real-time plugin search
101
- - Display plugin installation statistics
102
- - Quick plugin installation
35
+ This quick start walks you through creating a plugin that contains a custom skill. You'll create a manifest file (the configuration file that defines the plugin), add a skill, and test it locally with the `--plugin-dir` argument.
103
36
 
104
- 2. **Browse** - Browse and install plugins from configured marketplaces
105
- - Browse by marketplace category
106
- - View plugin details
107
- - Install plugins
37
+ ### Prerequisites
108
38
 
109
- 3. **Installed** - Manage installed plugins
110
- - View installed plugin list and status
111
- - Enable/disable plugins
112
- - Uninstall plugins
113
- - View plugin details
39
+ - CodeBuddy Code [installed and authenticated](quickstart.md)
114
40
 
115
- 4. **Marketplaces** - Manage plugin marketplaces
116
- - View configured marketplace list
117
- - Update marketplace information
118
- - Remove marketplaces
41
+ > If you don't see the `/plugin` command, update CodeBuddy Code to the latest version. See [Troubleshooting](troubleshooting.md) for upgrade instructions.
119
42
 
120
- 5. **Add Marketplace** - Add new plugin marketplace sources
121
- - Support local paths, GitHub repositories, Git URLs, and HTTP URLs
122
- - Automatic marketplace source type detection
123
- - Set marketplace display name
43
+ ### Create Your First Plugin
124
44
 
125
- 6. **Errors** - View errors that occurred during plugin loading and operations
126
- - Detailed error information and error types
127
- - Error timestamps and related context
128
- - Help diagnose and resolve issues
45
+ #### Step 1: Create the plugin directory
129
46
 
130
- #### Interactive Command Examples
47
+ Each plugin has its own directory containing the manifest file and your skills, agents, or hooks. Create one now:
131
48
 
132
49
  ```bash
133
- /plugin # Open management interface
134
- /plugin install my-plugin # Install plugin
135
- /plugin install my-plugin@marketplace # Install from specified marketplace
136
- /plugin enable my-plugin # Enable disabled plugin
137
- /plugin disable my-plugin # Disable enabled plugin
138
- /plugin uninstall my-plugin # Uninstall plugin
139
- /plugin marketplace add <source> # Add marketplace
140
- /plugin marketplace list # List marketplaces
141
- /plugin marketplace update <name> # Update marketplace
142
- /plugin marketplace remove <name> # Remove marketplace
50
+ mkdir my-first-plugin
143
51
  ```
144
52
 
145
- ### Method 3: Command-Line Subcommands
53
+ #### Step 2: Create the plugin manifest
146
54
 
147
- Use the `codebuddy plugin` command in the terminal for management.
55
+ The manifest file is located at `.codebuddy-plugin/plugin.json` and defines the plugin's identity: name, description, and version. CodeBuddy Code uses this metadata to display your plugin in the plugin manager.
148
56
 
149
- #### Plugin Operations
57
+ Create the `.codebuddy-plugin` directory inside the plugin directory:
150
58
 
151
59
  ```bash
152
- # Install plugin
153
- codebuddy plugin install <plugin> # Install from default marketplace
154
- codebuddy plugin install <plugin>@<marketplace> # Install from specified marketplace
155
- codebuddy plugin i <plugin> # Shorthand form
156
-
157
- # Enable and disable plugins
158
- codebuddy plugin enable <plugin> # Enable plugin
159
- codebuddy plugin disable <plugin> # Disable plugin
160
-
161
- # Uninstall plugin
162
- codebuddy plugin uninstall <plugin> # Uninstall plugin
163
- codebuddy plugin remove <plugin> # Alias form
164
-
165
- # Validate plugin or marketplace manifest
166
- codebuddy plugin validate <path> # Validate local plugin or marketplace
60
+ mkdir my-first-plugin/.codebuddy-plugin
167
61
  ```
168
62
 
169
- #### Marketplace Management
63
+ Then create `my-first-plugin/.codebuddy-plugin/plugin.json` with the following content:
170
64
 
171
- ```bash
172
- # Add marketplace
173
- codebuddy plugin marketplace add <source>
174
- codebuddy plugin marketplace add <source> -n <name> # Specify marketplace name
175
-
176
- # List marketplaces
177
- codebuddy plugin marketplace list
178
-
179
- # Update marketplace
180
- codebuddy plugin marketplace update <name>
181
-
182
- # Remove marketplace
183
- codebuddy plugin marketplace remove <name>
184
- codebuddy plugin marketplace rm <name> # Alias form
65
+ ```json
66
+ {
67
+ "name": "my-first-plugin",
68
+ "description": "A greeting plugin to learn the basics",
69
+ "version": "1.0.0",
70
+ "author": {
71
+ "name": "Your Name"
72
+ }
73
+ }
185
74
  ```
186
75
 
187
- ## Plugin Management
76
+ | Field | Purpose |
77
+ |-------|---------|
78
+ | `name` | Unique identifier and skill namespace. Skills are prefixed with this (e.g., `/my-first-plugin:hello`) |
79
+ | `description` | Displayed when browsing or installing the plugin in the plugin manager |
80
+ | `version` | Track releases using [semantic versioning](plugins-reference.md#version-management) |
81
+ | `author` | Optional. Used for attribution |
188
82
 
189
- ### Adding a Plugin Marketplace
83
+ For more fields like `homepage`, `repository`, and `license`, see the [complete manifest schema](plugins-reference.md).
190
84
 
191
- #### Using the Interactive Interface
85
+ #### Step 3: Add a skill
192
86
 
193
- 1. Enter `/plugin`
194
- 2. Select "3. Add marketplace"
195
- 3. Enter the marketplace source address
196
- 4. Wait for automatic marketplace type recognition and plugin manifest loading
87
+ Skills are placed in the `skills/` directory. Each skill is a folder containing a `SKILL.md` file. The folder name becomes the skill name and is prefixed with the plugin namespace (in a plugin named `my-first-plugin`, `hello/` creates `/my-first-plugin:hello`).
197
88
 
198
- #### Using Subcommands
89
+ Create the skill directory in your plugin directory:
199
90
 
200
91
  ```bash
201
- # Add GitHub repository marketplace
202
- codebuddy plugin marketplace add https://github.com/username/plugin-repo
203
-
204
- # Add marketplace and specify display name
205
- codebuddy plugin marketplace add https://github.com/username/plugin-repo -n my-marketplace
206
-
207
- # Add local directory marketplace
208
- codebuddy plugin marketplace add /path/to/local/plugins
209
-
210
- # Add HTTP marketplace
211
- codebuddy plugin marketplace add https://example.com/plugins
92
+ mkdir -p my-first-plugin/skills/hello
212
93
  ```
213
94
 
214
- **Parameter Explanation**:
215
- - `<source>`: Marketplace source address (local path, GitHub URL, or HTTP(S) URL)
216
- - `-n, --name <name>`: Optional, specify a display name for the marketplace
217
-
218
- ### Installing Plugins
219
-
220
- #### Using the Interactive Interface
221
-
222
- 1. Enter `/plugin`
223
- 2. Select "1. Browse and install plugins"
224
- 3. Select the plugin marketplace
225
- 4. Browse available plugins and select to install
226
-
227
- #### Using Subcommands
228
-
229
- ```bash
230
- # Install from default marketplace
231
- codebuddy plugin install my-plugin
95
+ Then create `my-first-plugin/skills/hello/SKILL.md` with the following content:
232
96
 
233
- # Install from specified marketplace
234
- codebuddy plugin install my-plugin@marketplace-name
97
+ ```markdown
235
98
 
236
- # Using alias
237
- codebuddy plugin i my-plugin
99
+ Greet the user warmly and ask how you can help them today.
238
100
  ```
239
101
 
240
- ### Enabling and Disabling Plugins
241
-
242
- #### Using the Interactive Interface
102
+ #### Step 4: Test your plugin
243
103
 
244
- 1. Enter `/plugin`
245
- 2. Select "2. Manage plugins"
246
- 3. Select the plugin to enable or disable
247
-
248
- #### Using Subcommands
104
+ Run CodeBuddy Code with the `--plugin-dir` argument to load your plugin:
249
105
 
250
106
  ```bash
251
- # Enable plugin
252
- codebuddy plugin enable my-plugin
253
-
254
- # Disable plugin
255
- codebuddy plugin disable my-plugin
107
+ codebuddy --plugin-dir ./my-first-plugin
256
108
  ```
257
109
 
258
- **Note**: CodeBuddy must be restarted after enabling/disabling plugins for changes to take effect.
110
+ After startup, try your new skill:
259
111
 
260
- ### Uninstalling Plugins
112
+ ```
113
+ /my-first-plugin:hello
114
+ ```
261
115
 
262
- #### Using the Interactive Interface
116
+ You'll see CodeBuddy reply with a greeting. Run `/help` to see your skill listed under the plugin namespace.
263
117
 
264
- 1. Enter `/plugin`
265
- 2. Select "2. Manage plugins"
266
- 3. Select the plugin to uninstall and confirm uninstallation
118
+ > **Why namespacing?** Plugin skills are always namespaced (e.g., `/my-first-plugin:hello`) to prevent conflicts when multiple plugins have skills with the same name. To change the namespace prefix, update the `name` field in `plugin.json`.
267
119
 
268
- #### Using Subcommands
120
+ #### Step 5: Add skill arguments
269
121
 
270
- ```bash
271
- # Uninstall plugin
272
- codebuddy plugin uninstall my-plugin
122
+ Make the skill more dynamic by accepting user input. The `$ARGUMENTS` placeholder captures any text the user provides after the skill name.
273
123
 
274
- # Using alias
275
- codebuddy plugin remove my-plugin
276
- ```
277
-
278
- ### Managing Plugin Marketplaces
124
+ Update your `SKILL.md` file:
279
125
 
280
- #### List Marketplaces
126
+ ```markdown
127
+ ---
128
+ description: Greet the user with a personalized message
129
+ ---
281
130
 
282
- Using the interactive interface:
283
- 1. Enter `/plugin`
284
- 2. Select "4. Manage marketplaces"
131
+ # Hello Skill
285
132
 
286
- Using subcommands:
287
- ```bash
288
- codebuddy plugin marketplace list
133
+ Greet the user named "$ARGUMENTS" warmly and ask how you can help them today. Make the greeting personal and encouraging.
289
134
  ```
290
135
 
291
- #### Update Marketplace
136
+ Run `/reload-plugins` to pick up the changes, then try the skill with your name:
292
137
 
293
- Using the interactive interface:
294
- 1. Enter `/plugin`
295
- 2. Select "4. Manage marketplaces"
296
- 3. Select the marketplace to update
297
-
298
- Using subcommands:
299
- ```bash
300
- codebuddy plugin marketplace update my-marketplace
138
+ ```
139
+ /my-first-plugin:hello Alex
301
140
  ```
302
141
 
303
- #### Remove Marketplace
142
+ CodeBuddy will greet you by name. For more information about passing arguments to skills, see the [Skills documentation](skills.md).
304
143
 
305
- Using the interactive interface:
306
- 1. Enter `/plugin`
307
- 2. Select "4. Manage marketplaces"
308
- 3. Select the marketplace to remove and confirm removal
144
+ ---
309
145
 
310
- Using subcommands:
311
- ```bash
312
- codebuddy plugin marketplace remove my-marketplace
313
- codebuddy plugin marketplace rm my-marketplace
314
- ```
146
+ You've successfully created and tested a plugin containing the following key components:
315
147
 
316
- ### Validating Plugin or Marketplace Manifests
148
+ - **Plugin manifest** (`.codebuddy-plugin/plugin.json`): Metadata describing the plugin
149
+ - **Skill directory** (`skills/`): Contains your custom skills
150
+ - **Skill arguments** (`$ARGUMENTS`): Capture user input for dynamic behavior
317
151
 
318
- ```bash
319
- # Validate plugin manifest format
320
- codebuddy plugin validate /path/to/plugin
152
+ > The `--plugin-dir` argument is for development and testing. When you're ready to share your plugin with others, see [Plugin Marketplaces](plugin-marketplaces.md).
321
153
 
322
- # Validate marketplace manifest format
323
- codebuddy plugin validate /path/to/marketplace
154
+ ## Plugin Structure Overview
324
155
 
325
- # Validate plugin manifest from GitHub
326
- codebuddy plugin validate https://github.com/username/plugin-repo
327
- ```
156
+ You've created a plugin containing a skill, but plugins can include much more: custom agents, hooks, MCP servers, and LSP servers.
328
157
 
329
- The validate command checks the format and completeness of `plugin.json` or `marketplace.json`.
158
+ > **Common mistake**: Don't put `commands/`, `agents/`, `skills/`, or `hooks/` inside the `.codebuddy-plugin/` directory. Only `plugin.json` goes inside `.codebuddy-plugin/`. All other directories must be at the plugin root level.
330
159
 
331
- ## Plugin Structure
160
+ | Directory | Location | Purpose |
161
+ |-----------|----------|---------|
162
+ | `.codebuddy-plugin/` | Plugin root | Contains the `plugin.json` manifest |
163
+ | `commands/` | Plugin root | Slash commands in Markdown format |
164
+ | `agents/` | Plugin root | Custom agent definitions |
165
+ | `skills/` | Plugin root | Agent skills containing `SKILL.md` files |
166
+ | `hooks/` | Plugin root | `hooks.json` event handlers |
167
+ | `.mcp.json` | Plugin root | MCP server configuration |
168
+ | `.lsp.json` | Plugin root | LSP server configuration (code intelligence) |
169
+ | `bin/` | Plugin root | Executables added to the Bash tool's `PATH` when the plugin is enabled |
170
+ | `settings.json` | Plugin root | Default [settings](settings.md) applied when the plugin is enabled |
332
171
 
333
- ### Standard Plugin Directory Structure
172
+ **Example complete structure**:
334
173
 
335
174
  ```
336
175
  my-plugin/
337
- ├── .codebuddy-plugin/ # Metadata directory (required)
338
- │ └── plugin.json # Plugin manifest file
339
- ├── commands/ # Commands directory (optional)
176
+ ├── .codebuddy-plugin/ # Metadata directory (required)
177
+ │ └── plugin.json # Plugin manifest file
178
+ ├── commands/ # Commands directory (optional)
340
179
  │ └── example.md
341
- ├── agents/ # Agents directory (optional)
180
+ ├── agents/ # Agents directory (optional)
342
181
  │ └── example.md
343
- ├── skills/ # Skills directory (optional)
344
- │ └── example/
182
+ ├── skills/ # Skills directory (optional)
183
+ │ └── code-review/
345
184
  │ └── SKILL.md
346
- ├── hooks/ # Hooks directory (optional)
185
+ ├── hooks/ # Hooks directory (optional)
347
186
  │ └── hooks.json
348
- ├── .mcp.json # MCP configuration file (optional)
349
- └── .lsp.json # LSP configuration file (optional)
187
+ ├── bin/ # Executables directory (optional)
188
+ └── my-tool
189
+ ├── .mcp.json # MCP configuration file (optional)
190
+ ├── .lsp.json # LSP configuration file (optional)
191
+ └── settings.json # Default settings file (optional)
350
192
  ```
351
193
 
352
- ### plugin.json Format
194
+ ## Developing More Complex Plugins
353
195
 
354
- The plugin manifest file defines the plugin's metadata and included components, located at `.codebuddy-plugin/plugin.json`:
196
+ Once you've mastered basic plugins, you can create more sophisticated extensions.
355
197
 
356
- ```json
357
- {
358
- "name": "my-plugin",
359
- "version": "1.0.0",
360
- "description": "Plugin description",
361
- "author": {
362
- "name": "Author Name",
363
- "email": "author@example.com"
364
- },
365
- "homepage": "https://github.com/username/my-plugin",
366
- "repository": "https://github.com/username/my-plugin",
367
- "keywords": ["example"],
368
- "category": "Development Tools",
369
- "commands": [],
370
- "agents": [],
371
- "skills": [],
372
- "hooks": "./hooks/hooks.json"
373
- }
374
- ```
198
+ ### Adding Skills
375
199
 
376
- ### Commands
200
+ Plugins can include [agent skills](skills.md) to extend CodeBuddy's capabilities. Skills are model-invoked: CodeBuddy automatically uses them based on task context.
377
201
 
378
- Plugins can provide custom slash commands that users can manually trigger. Commands are defined as Markdown files.
202
+ Add a `skills/` directory at the plugin root containing skill folders with `SKILL.md` files:
379
203
 
380
- **Example**: `commands/example.md`
204
+ ```
205
+ my-plugin/
206
+ ├── .codebuddy-plugin/
207
+ │ └── plugin.json
208
+ └── skills/
209
+ └── code-review/
210
+ └── SKILL.md
211
+ ```
381
212
 
382
- ```markdown
213
+ Each `SKILL.md` needs frontmatter containing `name` and `description` fields, followed by instructions:
383
214
 
384
- This is an example command. It executes when the user enters /my-plugin:example.
215
+ ```markdown
216
+ ---
217
+ name: code-review
218
+ description: Reviews code for best practices and potential issues. Use when reviewing code, checking PRs, or analyzing code quality.
219
+ ---
385
220
 
386
- Argument: $1
221
+ When reviewing code, check for:
222
+ 1. Code organization and structure
223
+ 2. Error handling
224
+ 3. Security concerns
225
+ 4. Test coverage
387
226
  ```
388
227
 
389
- Commands are registered in the format `/plugin-name:command-name`.
390
-
391
- For detailed information, refer to: [Slash Commands Documentation](slash-commands.md)
228
+ After installing the plugin, run `/reload-plugins` to load the skill. For a complete guide to writing skills, including progressive disclosure and tool restrictions, see [Agent Skills](skills.md).
392
229
 
393
- ### Skills
230
+ ### Adding Commands
394
231
 
395
- Skills are specialized capability templates that the AI can automatically recognize and invoke.
232
+ Plugins can provide custom slash commands that users can manually trigger. Commands are defined as Markdown files.
396
233
 
397
- **Example**: `skills/SKILL.md`
234
+ **Example**: `commands/example.md`
398
235
 
399
236
  ```markdown
400
237
  ---
401
- description: "Skill description"
238
+ description: "Example command description"
239
+ argument-hint: "[argument]"
402
240
  ---
403
241
 
404
- Detailed skill description and usage scenarios...
242
+ This is an example command. It executes when the user enters /my-plugin:example.
243
+
244
+ Argument: $ARGUMENTS
405
245
  ```
406
246
 
407
- For detailed information, refer to: [Skills Documentation](skills.md)
247
+ Commands are registered in the format `/plugin-name:command-name`.
248
+
249
+ For detailed information, refer to the [Slash Commands documentation](slash-commands.md).
408
250
 
409
- ### Hooks
251
+ ### Adding Hooks
410
252
 
411
- Hooks allow automatic execution of operations when specific events occur.
253
+ Hooks allow operations to be automatically executed when specific events occur. Commands receive hook input JSON data via standard input and can use `jq` to extract fields.
412
254
 
413
255
  **Example**: `hooks/hooks.json`
414
256
 
415
257
  ```json
416
258
  {
417
259
  "hooks": {
418
- "user-prompt-submit-hook": [
260
+ "PostToolUse": [
419
261
  {
262
+ "matcher": "Write|Edit",
420
263
  "hooks": [
421
264
  {
422
265
  "type": "command",
423
- "command": "echo 'User submitted: $INPUT'",
424
- "timeout": 5000
266
+ "command": "jq -r '.tool_input.file_path' | xargs npm run lint:fix"
425
267
  }
426
268
  ]
427
269
  }
@@ -430,21 +272,17 @@ Hooks allow automatic execution of operations when specific events occur.
430
272
  }
431
273
  ```
432
274
 
433
- For detailed information, refer to: [Hooks Documentation](hooks.md)
275
+ Hooks in a plugin's `hooks/hooks.json` are automatically **merged** (not overwritten) with user- and project-level hooks when the plugin is enabled, and are **not** subject to the `allowUntrustedFrontmatterHooks` gate (which only applies to hooks declared in Agent / Skill frontmatter).
434
276
 
435
- ### LSP (Language Server Protocol)
277
+ In addition to `command`, hooks also support `type: prompt` (small-model semantic decisions), `type: agent` (subagent validation), and `type: http` (POST/PUT/PATCH to a specified URL). See the [Hooks documentation](hooks.md) for details. If your plugin also needs to ship frontmatter hooks bundled with a Skill, refer to the [Skills documentation - Configuring Hooks in a Skill](skills.md#configuring-hooks-in-a-skill) (note that this path is subject to the security gate).
436
278
 
437
- LSP plugins provide real-time code intelligence for the AI, enabling it to understand code structure, type definitions, function signatures, and more.
279
+ For detailed information, refer to the [Hooks documentation](hooks.md).
438
280
 
439
- #### Usage Recommendations
281
+ ### Adding LSP Servers
440
282
 
441
- For common languages (such as TypeScript, Python, Rust, etc.), it's recommended to install pre-built LSP plugins directly from the official plugin marketplace. You only need to create custom LSP plugins when supporting languages not yet covered.
283
+ > For common languages such as TypeScript, Python, and Rust, it is recommended to install pre-built LSP plugins directly from the official plugin marketplace. Only create custom LSP plugins when you need to support languages not yet covered.
442
284
 
443
- #### Configuring LSP Servers
444
-
445
- Configure LSP servers by adding a `.lsp.json` file to the plugin root directory:
446
-
447
- **Example**: `.lsp.json`
285
+ LSP (Language Server Protocol) plugins provide real-time code intelligence to CodeBuddy. If you need support for a language without an official LSP plugin, you can add a `.lsp.json` file to the plugin:
448
286
 
449
287
  ```json
450
288
  {
@@ -458,12 +296,7 @@ Configure LSP servers by adding a `.lsp.json` file to the plugin root directory:
458
296
  }
459
297
  ```
460
298
 
461
- #### Configuration Field Descriptions
462
-
463
- - **Language Identifier** (e.g., `"go"`): Defines the language supported by the LSP server
464
- - `command`: The command name of the LSP server executable
465
- - `args`: Array of arguments passed to the command
466
- - `extensionToLanguage`: Mapping of file extensions to language identifiers
299
+ Users who install the plugin must have the language server binaries pre-installed on their machine.
467
300
 
468
301
  #### Multi-Language Configuration Example
469
302
 
@@ -488,201 +321,248 @@ Configure LSP servers by adding a `.lsp.json` file to the plugin root directory:
488
321
 
489
322
  #### Installation Requirements
490
323
 
491
- When installing plugins that include LSP configurations, users must have the corresponding language server binaries pre-installed on their system. For example:
324
+ When users install plugins that include LSP configurations, they must have the corresponding language server binaries pre-installed on their system:
492
325
 
493
- - **Go**: Requires `gopls` (`go install golang.org/x/tools/gopls@latest`)
494
- - **Python**: Requires `python-lsp-server` (`pip install python-lsp-server`)
495
- - **Rust**: Requires `rust-analyzer` (`rustup component add rust-analyzer`)
326
+ - **Go**: `go install golang.org/x/tools/gopls@latest`
327
+ - **Python**: `pip install python-lsp-server`
328
+ - **Rust**: `rustup component add rust-analyzer`
496
329
 
497
- #### How It Works
330
+ ### Bundling Default Settings
498
331
 
499
- 1. CodeBuddy reads the `.lsp.json` configuration on startup
500
- 2. Automatically starts the corresponding LSP server based on file extensions
501
- 3. AI obtains code intelligence information via the LSP protocol
502
- 4. Provides more accurate code suggestions and modifications
332
+ Plugins can include a `settings.json` file at the root that applies default configuration when the plugin is enabled. Currently, only the `agent` key is supported.
503
333
 
504
- #### Best Practices
334
+ Setting `agent` activates one of the plugin's [custom agents](sub-agents.md) as the main thread, applying its system prompt, tool restrictions, and model. This allows the plugin to change CodeBuddy Code's default behavior when enabled.
505
335
 
506
- 1. **Provide Installation Instructions**: Clearly document the required language servers in the plugin's README
507
- 2. **Version Compatibility**: Document the supported language server version range
508
- 3. **Use Official Plugins**: Prefer officially maintained LSP plugins to avoid duplicate work
509
- 4. **Thorough Testing**: Ensure LSP configurations work correctly across different operating systems
510
-
511
- ## Plugin Marketplace Types
336
+ ```json
337
+ {
338
+ "agent": "security-reviewer"
339
+ }
340
+ ```
512
341
 
513
- ### GitHub Marketplace
342
+ This example activates the `security-reviewer` agent defined in the plugin's `agents/` directory. Settings in `settings.json` take precedence over the `settings` declared in `plugin.json`. Unknown keys are silently ignored.
514
343
 
515
- Publish and fetch plugins from GitHub repositories.
344
+ ### Testing Plugins Locally
516
345
 
517
- **Repository Structure**:
346
+ Use the `--plugin-dir` argument to test plugins during development. This loads your plugin directly without installation.
518
347
 
348
+ ```bash
349
+ codebuddy --plugin-dir ./my-plugin
519
350
  ```
520
- plugin-repo/
521
- ├── .codebuddy-plugin/
522
- │ └── marketplace.json # Marketplace manifest
523
- └── plugins/
524
- ├── plugin1/
525
- │ ├── .codebuddy-plugin/
526
- │ │ └── plugin.json
527
- │ └── ...
528
- └── plugin2/
529
- ├── .codebuddy-plugin/
530
- │ └── plugin.json
531
- └── ...
532
- ```
533
351
 
534
- **marketplace.json** Format:
352
+ When a `--plugin-dir` plugin has the same name as an installed marketplace plugin, the local copy takes precedence in that session. This lets you test changes to an installed plugin without uninstalling it. Marketplace plugins force-enabled via managed settings are the only exception and cannot be overridden.
353
+
354
+ While modifying a plugin, run `/reload-plugins` to pick up updates without restarting. This reloads plugins, skills, agents, hooks, plugin MCP servers, and plugin LSP servers. Test your plugin components:
355
+
356
+ - Try skills with `/plugin-name:skill-name`
357
+ - Check that agents appear in `/agents`
358
+ - Verify hooks work as expected
359
+
360
+ > You can load multiple plugins simultaneously by specifying the argument multiple times:
361
+ >
362
+ > ```bash
363
+ > codebuddy --plugin-dir ./plugin-one --plugin-dir ./plugin-two
364
+ > ```
365
+
366
+ ### Debugging Plugin Issues
367
+
368
+ If a plugin is not working as expected:
369
+
370
+ 1. **Check structure**: Make sure directories are at the plugin root, not inside `.codebuddy-plugin/`
371
+ 2. **Test components individually**: Check each command, agent, and hook separately
372
+ 3. **Use debug mode**: Start CodeBuddy with the `--debug` argument to see detailed logs
373
+
374
+ ## plugin.json Manifest Format
375
+
376
+ The plugin manifest file defines the plugin's metadata and included components, located at `.codebuddy-plugin/plugin.json`:
535
377
 
536
378
  ```json
537
379
  {
538
- "name": "My Plugin Marketplace",
539
- "plugins": [
540
- {
541
- "name": "plugin1",
542
- "source": "plugins/plugin1",
543
- "description": "Plugin 1 description"
544
- },
545
- {
546
- "name": "plugin2",
547
- "source": "plugins/plugin2",
548
- "description": "Plugin 2 description"
549
- }
550
- ]
380
+ "name": "my-plugin",
381
+ "version": "1.0.0",
382
+ "description": "Plugin description",
383
+ "author": {
384
+ "name": "Author Name",
385
+ "email": "author@example.com"
386
+ },
387
+ "homepage": "https://github.com/username/my-plugin",
388
+ "repository": "https://github.com/username/my-plugin",
389
+ "keywords": ["example"],
390
+ "category": "Development Tools",
391
+ "commands": [],
392
+ "agents": [],
393
+ "skills": [],
394
+ "hooks": "./hooks/hooks.json"
551
395
  }
552
396
  ```
553
397
 
554
- ### HTTP Marketplace
398
+ For complete manifest schema documentation, see the [Plugin Reference Documentation](plugins-reference.md).
399
+
400
+ ## Sharing Your Plugin
401
+
402
+ When your plugin is ready to share:
555
403
 
556
- Provide plugins through HTTP(S) servers.
404
+ 1. **Add documentation**: Include a `README.md` describing installation and usage
405
+ 2. **Version management**: Use [semantic versioning](plugins-reference.md#version-management) in `plugin.json`
406
+ 3. **Create or use a marketplace**: Distribute via [plugin marketplaces](plugin-marketplaces.md)
407
+ 4. **Test with others**: Have team members test the plugin before broader distribution
557
408
 
558
- **Server Requirements**:
409
+ Once your plugin is published to a marketplace, others can install and use it by following the instructions in [Plugin Marketplaces](plugin-marketplaces.md).
559
410
 
560
- - Provide `/marketplace.json` - Marketplace manifest
561
- - Provide `/plugins/<plugin-name>/plugin.json` - Plugin manifest
562
- - Provide plugin file downloads
411
+ ## Converting Existing Configuration to a Plugin
563
412
 
564
- ### Local Directory Marketplace
413
+ If you already have skills or hooks in the `.codebuddy/` directory, you can convert them to a plugin for easier sharing and distribution.
565
414
 
566
- Load plugins from the local filesystem, suitable for development and testing.
415
+ ### Migration Steps
567
416
 
568
- **Directory Structure**:
417
+ #### Step 1: Create the plugin structure
569
418
 
419
+ Create a new plugin directory:
420
+
421
+ ```bash
422
+ mkdir -p my-plugin/.codebuddy-plugin
570
423
  ```
571
- local-plugins/
572
- ├── .codebuddy-plugin/
573
- │ └── marketplace.json
574
- └── plugins/
575
- └── my-plugin/
576
- ├── .codebuddy-plugin/
577
- │ └── plugin.json
578
- └── ...
424
+
425
+ Create the manifest file `my-plugin/.codebuddy-plugin/plugin.json`:
426
+
427
+ ```json
428
+ {
429
+ "name": "my-plugin",
430
+ "description": "Migrated from standalone configuration",
431
+ "version": "1.0.0"
432
+ }
579
433
  ```
580
434
 
581
- ## Best Practices
435
+ #### Step 2: Copy existing files
582
436
 
583
- ### Plugin Development Recommendations
437
+ Copy your existing configuration to the plugin directory:
584
438
 
585
- 1. **Follow Naming Conventions**: Use clear, descriptive plugin names
586
- 2. **Provide Complete Metadata**: Provide detailed descriptions and author information in `plugin.json`
587
- 3. **Version Management**: Use semantic versioning (Semantic Versioning)
588
- 4. **Complete Documentation**: Provide clear descriptions for each command and skill
589
- 5. **Thorough Testing**: Test plugins in local marketplace before publishing
439
+ ```bash
440
+ # Copy commands
441
+ cp -r .codebuddy/commands my-plugin/
590
442
 
591
- ### Security Considerations
443
+ # Copy agents (if any)
444
+ cp -r .codebuddy/agents my-plugin/
592
445
 
593
- 1. **Only Install Plugins from Trusted Sources**: Plugins can execute commands and access the filesystem
594
- 2. **Review Plugin Code**: Check plugin commands and hooks before installation
595
- 3. **Use Permission Controls**: Limit plugin access through CodeBuddy's permission system
446
+ # Copy skills (if any)
447
+ cp -r .codebuddy/skills my-plugin/
448
+ ```
596
449
 
597
- ### Plugin Publishing Workflow
450
+ #### Step 3: Migrate Hooks
598
451
 
599
- 1. Create plugin directory and files
600
- 2. Write `plugin.json`
601
- 3. Test plugin in local marketplace
602
- 4. Create GitHub repository or HTTP server
603
- 5. Add `marketplace.json`
604
- 6. Share marketplace address with users
452
+ If you have hooks in your settings, create the hooks directory:
605
453
 
606
- ## Troubleshooting
454
+ ```bash
455
+ mkdir my-plugin/hooks
456
+ ```
607
457
 
608
- ### Marketplace Not Loading
458
+ Create `my-plugin/hooks/hooks.json` and place the hooks configuration in it. Copy the `hooks` object from `.codebuddy/settings.json` or `settings.local.json` — the format is the same. Commands receive hook input JSON data via standard input and can use `jq` to extract fields:
609
459
 
610
- **Problem**: Unable to add marketplace or can't see plugins from it
460
+ ```json
461
+ {
462
+ "hooks": {
463
+ "PostToolUse": [
464
+ {
465
+ "matcher": "Write|Edit",
466
+ "hooks": [
467
+ {
468
+ "type": "command",
469
+ "command": "jq -r '.tool_input.file_path' | xargs npm run lint:fix"
470
+ }
471
+ ]
472
+ }
473
+ ]
474
+ }
475
+ }
476
+ ```
611
477
 
612
- **Solution**:
478
+ #### Step 4: Test the migrated plugin
613
479
 
614
- * Verify marketplace URL is accessible
615
- * Check if `.codebuddy-plugin/marketplace.json` exists at the specified path
616
- * Use `codebuddy plugin validate` to ensure JSON syntax is valid
617
- * For private repositories, confirm you have access permissions
480
+ Load the plugin to verify everything works:
618
481
 
619
- #### Plugin Installation Failed
482
+ ```bash
483
+ codebuddy --plugin-dir ./my-plugin
484
+ ```
620
485
 
621
- **Problem**: Marketplace appears but plugin installation fails
486
+ Test each component: run your commands, check agents in `/agents`, and verify hooks trigger correctly.
622
487
 
623
- **Solution**:
488
+ ### Before vs After Migration
624
489
 
625
- * Verify plugin source URL is accessible
626
- * Check if plugin directory contains required files
627
- * For GitHub sources, ensure repository is public or you have access permissions
628
- * Test plugin source by manually cloning/downloading
490
+ | Standalone Configuration (`.codebuddy/`) | Plugin |
491
+ |-------------------------------------------|--------|
492
+ | Available in only one project | Shareable via marketplaces |
493
+ | Files in `.codebuddy/commands/` | Files in `plugin-name/commands/` |
494
+ | Hooks in `settings.json` | Hooks in `hooks/hooks.json` |
495
+ | Manual copy required for sharing | Install via `/plugin install` |
629
496
 
630
- ### Plugin Not Loading
497
+ > After migration, you can delete the original files in `.codebuddy/` to avoid duplication. The plugin version takes precedence when loaded.
631
498
 
632
- **Problem**: Plugin is installed but not working
499
+ ## Best Practices
633
500
 
634
- **Solution**:
501
+ ### Plugin Development Recommendations
635
502
 
636
- * Confirm plugin is enabled: `/plugin` "3. Installed"
637
- * Check that `plugin.json` format is correct
638
- * Restart CodeBuddy to load new plugins
639
- * Use `--debug` mode to view loading logs
503
+ 1. **Follow naming conventions**: Use clear, descriptive plugin names (kebab-case, no spaces)
504
+ 2. **Provide complete metadata**: Provide detailed descriptions and author information in `plugin.json`
505
+ 3. **Version management**: Use semantic versioning (Semantic Versioning)
506
+ 4. **Complete documentation**: Provide clear descriptions for each command and skill
507
+ 5. **Thorough testing**: Test plugins locally with `--plugin-dir` before publishing
640
508
 
641
- ### Command Not Available
509
+ ### Security Considerations
642
510
 
643
- **Problem**: Plugin is installed but commands are unavailable
511
+ 1. **Only install plugins from trusted sources**: Plugins can execute commands and access the filesystem
512
+ 2. **Review plugin code**: Check plugin commands and hooks before installation
513
+ 3. **Use permission controls**: Limit plugin access through CodeBuddy's permission system
514
+
515
+ ## Troubleshooting
516
+
517
+ ### Plugin Not Loading
518
+
519
+ **Problem**: Plugin is installed but not working
644
520
 
645
521
  **Solution**:
646
522
 
647
- * Confirm command path is correctly configured in `plugin.json`
648
- * Check that command file exists
649
- * Verify command file format follows Markdown specifications
523
+ - Confirm the plugin is enabled: run `/plugin` and go to the "Installed" tab
524
+ - Check that `plugin.json` format is correct
525
+ - Run `/reload-plugins` to reload plugins
526
+ - Use `--debug` mode to view loading logs
650
527
 
651
- ### Marketplace Connection Failed
528
+ ### Command Not Available
652
529
 
653
- **Problem**: Unable to connect to marketplace or fetch plugin list
530
+ **Problem**: Plugin is installed but commands are unavailable
654
531
 
655
532
  **Solution**:
656
533
 
657
- * **GitHub marketplace**: Check network connection and repository access permissions
658
- * **HTTP marketplace**: Confirm server is accessible
659
- * **Local marketplace**: Verify directory path and permissions
534
+ - Confirm command files are placed in the plugin root's `commands/`, not inside `.codebuddy-plugin/`
535
+ - Check that command files exist and have the correct format
536
+ - Run `/reload-plugins` to refresh
660
537
 
661
538
  ### Validation and Testing
662
539
 
663
- Test your marketplace and plugins before sharing:
540
+ Test your plugin before sharing:
664
541
 
665
542
  ```bash
666
- # Validate marketplace JSON syntax
667
- codebuddy plugin validate .
668
-
669
- # Validate specific plugin
543
+ # Validate plugin format
670
544
  codebuddy plugin validate /path/to/plugin
671
545
 
672
- # Add local marketplace for testing
673
- codebuddy plugin marketplace add ./path/to/marketplace
546
+ # Test locally with --plugin-dir
547
+ codebuddy --plugin-dir ./my-plugin
674
548
 
675
- # Test plugin installation
676
- codebuddy plugin install test-plugin@marketplace-name
549
+ # Test the plugin's skills
550
+ /my-plugin:skill-name
677
551
  ```
678
552
 
679
- ## Related Documentation
553
+ ## Next Steps
680
554
 
681
- - **[Plugin Reference Documentation](plugins-reference.md)** - Complete technical specification for plugin development
682
- - **[Slash Commands](slash-commands.md)** - Learn about the command system
683
- - **[Skills](skills.md)** - Learn about the skills system
684
- - **[Hooks](hooks.md)** - Master the hooks mechanism
555
+ ### For Plugin Users
685
556
 
686
- ---
557
+ - [Plugin Marketplaces](plugin-marketplaces.md) - Browse marketplaces and install plugins
558
+ - [Settings](settings.md) - Learn about plugin configuration options
559
+
560
+ ### For Plugin Developers
687
561
 
688
- *Make CodeBuddy more powerful through the plugin system 🚀*
562
+ - [Plugin Marketplaces](plugin-marketplaces.md) - Package and share your plugin
563
+ - [Plugin Reference Documentation](plugins-reference.md) - Complete technical specification
564
+ - Dive deeper into specific plugin components:
565
+ - [Skills](skills.md) - Skill development details
566
+ - [Sub-agents](sub-agents.md) - Agent configuration and capabilities
567
+ - [Hooks](hooks.md) - Event handling and automation
568
+ - [MCP](mcp.md) - External tool integration