22 claude plugin 命令22 claude plugin 命令
23</h2>23</h2>
24 24
25从 shell 或脚本中运行 `claude plugin <subcommand>`,在 Claude Code 会话外。这些子命令安装和管理 plugins,而不打开 [`/plugin`](#plugin-in-a-session) 面板。25从你的 shell 或脚本运行 `claude plugin <subcommand>`,在 Claude Code 会话外部。这些子命令安装和管理插件,无需打开 [`/plugin`](#plugin-in-a-session) 面板。
26 26
27`claude plugins` 是 `claude plugin` 的别名。27`claude plugins` 是 `claude plugin` 的别名。
28 28
29每个子命令共享这些退出代码、plugin 参数和作用域值:29每个子命令共享这些退出代码、插件参数和作用域值:
30 30
31* **退出代码**:成功时为 `0`,失败时为 `1`。`validate` 为意外错误添加退出 `2`,`eval` 添加 [其部分](#plugin-eval) 中列出的代码。31* **退出代码**:成功时为 `0`,失败时为 `1`。`validate` 为意外错误添加退出 `2`,`eval` 添加 [其部分](#plugin-eval) 中列出的代码。
32* **Plugin 参数**:`<plugin>` 参数是 plugin `name` 或 `name@marketplace`。当两个市场提供相同的名称时,使用限定形式。32* **插件参数**:`<plugin>` 参数是插件 `name` 或 `name@marketplace`。当两个市场提供相同的名称时,使用限定形式。
33* **作用域**:`--scope` 接受 `user`、`project` 或 `local`,并命名命令写入的设置文件。`update` 也接受 `managed`。33* **作用域**:`--scope` 接受 `user`、`project` 或 `local`,并命名命令写入的设置文件。`update` 也接受 `managed`。
34 34
35<h3 id="plugin-init">35<h3 id="plugin-init">
36 plugin init36 plugin init
37</h3>37</h3>
38 38
39在 `~/.claude/skills/<name>/` 处搭建新 plugin。它在您的下一个会话中作为 `<name>@skills-dir` 加载,无需安装步骤。39在 `~/.claude/skills/<name>/` 处搭建新插件。它在你的下一个会话中作为 `<name>@skills-dir` 加载,无需安装步骤。
40 40
41`new` 是 `init` 的别名。41`new` 是 `init` 的别名。
42 42
43对于以此命令开始的创建、测试和编辑工作流,请参阅 [创建 plugin](/docs/zh-CN/plugins/create)。43对于从此命令开始的创建、测试和编辑工作流,请参阅 [创建插件](/docs/zh-CN/plugins/create)。
44 44
45```bash theme={null}45```bash theme={null}
46claude plugin init <name> [options]46claude plugin init <name> [options]
47```47```
48 48
49`<name>` 成为 `~/.claude/skills/` 下的目录名称和 plugin 清单中的 `name`。49`<name>` 成为 `~/.claude/skills/` 下的目录名称和插件清单中的 `name`。
50 50
51该命令没有用于另一个位置的标志。要改为在项目内搭建,请参阅 [创建 plugin](/docs/zh-CN/plugins/create)。51该命令没有用于另一个位置的标志。要在项目内搭建,请参阅 [创建插件](/docs/zh-CN/plugins/create)。
52 52
53| 标志 | 描述 |53| 标志 | 描述 |
54| :- | :- |54| :- | :- |
58| `--with <components...>` | 也为 `skills`、`agents`、`hooks`、`mcp`、`lsp`、`output-style` 或 `channel` 搭建启动文件 |58| `--with <components...>` | 也为 `skills`、`agents`、`hooks`、`mcp`、`lsp`、`output-style` 或 `channel` 搭建启动文件 |
59| `-f, --force` | 覆盖目标处的现有 `.claude-plugin/` |59| `-f, --force` | 覆盖目标处的现有 `.claude-plugin/` |
60 60
61使用启动 skill 和 hook 文件搭建 plugin:61搭建带有启动 skill 和 hook 文件的插件:
62 62
63```bash theme={null}63```bash theme={null}
64claude plugin init my-helper --with skills hooks64claude plugin init my-helper --with skills hooks
65```65```
66 66
67Claude Code 验证其写入的内容并打印 `Created plugin "my-helper" at ~/.claude/skills/my-helper`,后跟它加载的 id 和关闭它的 `claude plugin disable` 命令。67Claude Code 验证它写入的内容并打印 `Created plugin "my-helper" at ~/.claude/skills/my-helper`,后跟它加载的 id 和关闭它的 `claude plugin disable` 命令。
68 68
69当 Claude Code 无法安全搭建时,它退出 `1` 而不写入,消息命名原因。这些是常见原因:69当 Claude Code 无法安全搭建时,它退出 `1` 而不写入,消息命名原因。这些是常见原因:
70 70
71* 未知的 `--with` 值71* 未知的 `--with` 值
72* 目标处的现有搭建,没有 `--force`72* 目标处的现有搭建,没有 `--force`
73* 阻止 skills-directory plugins 的托管设置73* 阻止 skills-directory 插件的托管设置
74 74
75<h3 id="plugin-install">75<h3 id="plugin-install">
76 plugin install76 plugin install
77</h3>77</h3>
78 78
79从您添加的市场安装 plugin。`i` 是 `install` 的别名。79从你添加的市场安装插件。`i` 是 `install` 的别名。
80 80
81```bash theme={null}81```bash theme={null}
82claude plugin install <plugin> [options]82claude plugin install <plugin> [options]
83```83```
84 84
85大多数 plugins 无需提示即可安装。对于其市场条目 [运行命令来安装它](/docs/zh-CN/plugins/host-marketplace) 或 [为其下载设置 `headersHelper`](/docs/zh-CN/plugins/host-marketplace#how-users-accept-a-headershelper-command) 的 plugin,Claude Code 首先打印命令并询问 `Run this command now? [y/N]`。85大多数插件无需提示即可安装。对于其市场条目 [运行命令来安装它](/docs/zh-CN/plugins/host-marketplace) 或 [为其下载设置 `headersHelper`](/docs/zh-CN/plugins/host-marketplace#how-users-accept-a-headershelper-command) 的插件,Claude Code 首先打印命令并询问 `Run this command now? [y/N]`。
86 86
87| 标志 | 描述 |87| 标志 | 描述 |
88| :- | :- |88| :- | :- |
89| `-s, --scope <scope>` | 安装作用域:`user`、`project` 或 `local`。默认为 `user` |89| `-s, --scope <scope>` | 安装作用域:`user`、`project` 或 `local`。默认为 `user` |
90| `--config <key=value>` | 设置 plugin 清单声明的 [`userConfig`](/docs/zh-CN/plugins/manifest-reference) 选项。为每个选项重复该标志。需要 Claude Code v2.1.147 或更高版本 |90| `--config <key=value>` | 设置插件清单声明的 [`userConfig`](/docs/zh-CN/plugins/manifest-reference) 选项。为每个选项重复该标志。需要 Claude Code v2.1.147 或更高版本 |
91| `-y, --yes` | 接受显示的安装命令,无需 `Run this command now?` 提示。当命令在 Claude Code 会话内运行时(例如从 Bash 工具或 hook)被忽略。需要 Claude Code v2.1.229 或更高版本 |91| `-y, --yes` | 接受显示的安装命令,无需 `Run this command now?` 提示。在 Claude Code 会话内运行命令时被忽略,例如从 Bash 工具或 hook。需要 Claude Code v2.1.229 或更高版本 |
92| `--accept-command <sha256>` | 接受显示的安装命令,其 `sha256` 之前的 [`--json` 运行](#plugin-json-result) 在 `shownCommand` 中报告,代替 `-y`。不能与 `-y` 组合。请参阅 [接受显示的安装命令](#accept-a-displayed-install-command)。需要 Claude Code v2.1.271 或更高版本 |92| `--accept-command <sha256>` | 接受显示的安装命令,其 `sha256` 之前的 [`--json` 运行](#plugin-json-result) 在 `shownCommand` 中报告,代替 `-y`。不能与 `-y` 组合。请参阅 [接受显示的安装命令](#accept-a-displayed-install-command)。需要 Claude Code v2.1.271 或更高版本 |
93| `--json` | 将结果作为一个 JSON 对象打印在 stdout 的最后一行,而不是人类可读的消息,供脚本使用。请参阅 [JSON 结果格式](#plugin-json-result)。需要 Claude Code v2.1.268 或更高版本 |93| `--json` | 将结果打印为 stdout 最后一行的一个 JSON 对象,而不是人类可读的消息,供脚本使用。请参阅 [JSON 结果格式](#plugin-json-result)。需要 Claude Code v2.1.268 或更高版本 |
94 94
95从您自己的终端传递 `-y` 以接受显示的命令而无需提示。以下是没有 TTY 和 Claude 运行命令时发生的情况:95从你自己的终端传递 `-y` 以接受显示的命令,无需提示。以下是没有 TTY 和 Claude 运行命令时发生的情况:
96 96
97* **stdin 或 stdout 不是 TTY,您既不传递 `-y` 也不传递 `--accept-command`**:安装被拒绝。输出说命令仅被显示,退出代码为 `1`97* **stdin 或 stdout 不是 TTY,且你既不传递 `-y` 也不传递 `--accept-command`**:安装被拒绝。输出说命令仅被显示,退出代码为 `1`
98* **Claude 通过其 Bash 工具运行命令**:`-y` 被忽略。改为从您自己的终端运行命令98* **Claude 通过其 Bash 工具运行命令**:`-y` 被忽略。改为从你自己的终端运行命令
99 99
100为克隆项目的每个人安装 plugin:100为克隆项目的每个人安装插件:
101 101
102```bash theme={null}102```bash theme={null}
103claude plugin install formatter@my-marketplace --scope project103claude plugin install formatter@my-marketplace --scope project
106Claude Code 打印 `Successfully installed plugin: formatter@my-marketplace (scope: project)`。当没有新内容被安装时,输出说明原因:106Claude Code 打印 `Successfully installed plugin: formatter@my-marketplace (scope: project)`。当没有新内容被安装时,输出说明原因:
107 107
108* **已在该作用域安装**:输出为 `Plugin "formatter@my-marketplace" is already installed (scope: project)`,退出代码为 `0`108* **已在该作用域安装**:输出为 `Plugin "formatter@my-marketplace" is already installed (scope: project)`,退出代码为 `0`
109* **您拒绝命令源提示**:输出为 `Aborted.`,退出代码为 `1`109* **你拒绝命令源提示**:输出为 `Aborted.`,退出代码为 `1`
110* **您拒绝 `headersHelper` 提示,或无法在没有 TTY 的情况下确认**:输出为 `Aborted — the command was not run.`,退出代码为 `1`110* **你拒绝 `headersHelper` 提示,或无法在没有 TTY 的情况下确认**:输出为 `Aborted — the command was not run.`,退出代码为 `1`
111 111
112<h4 id="plugin-json-result">112<h4 id="plugin-json-result">
113 JSON 结果格式113 JSON 结果格式
114</h4>114</h4>
115 115
116当您向 `plugin install` 传递 `--json` 时,stdout 的最后一行是一个 JSON 对象。仅解析该行,因为 Claude Code 在其前面打印市场声明的任何命令。116当你向 `plugin install` 传递 `--json` 时,stdout 的最后一行是一个 JSON 对象。仅解析该行,因为 Claude Code 在其前面打印市场声明的任何命令。
117 117
118三个字段始终存在:118三个字段始终存在:
119 119
123 123
124其他字段,例如 `pluginId`、`scope` 和 `failureCode`,仅在适用时出现。124其他字段,例如 `pluginId`、`scope` 和 `failureCode`,仅在适用时出现。
125 125
126`plugin uninstall`、`plugin update`、`plugin enable` 和 `plugin disable` 上的 `--json` 选项打印相同的对象,带有该子命令自己的字段。126`--json` 选项在 `plugin uninstall`、`plugin update`、`plugin enable` 和 `plugin disable` 上打印相同的对象,带有该子命令自己的字段。
127 127
128使用错误(例如无效的 `--scope`)不打印结果行,退出 `1`,原因在 stderr 上。128使用错误,例如无效的 `--scope`,不打印结果行,退出 `1`,原因在 stderr 上。
129 129
130<h4 id="accept-a-displayed-install-command">130<h4 id="accept-a-displayed-install-command">
131 接受显示的安装命令131 接受显示的安装命令
132</h4>132</h4>
133 133
134当 `--json` 运行显示市场声明的命令且不运行它时,`failed` 结果也带有 `shownCommand` 对象。其字段包括显示的命令、它所属的 plugin 和命令的 `sha256`。134当 `--json` 运行显示市场声明的命令且不运行它时,`failed` 结果也携带 `shownCommand` 对象。其字段包括显示的命令、它所属的插件和命令的 `sha256`。
135 135
136要接受完全相同的命令,从您自己的终端使用该 `sha256` 作为 `--accept-command` 重新运行,因为该标志在 Claude Code 会话内无效。需要 Claude Code v2.1.271 或更高版本。136要接受完全相同的命令,从你自己的终端使用该 `sha256` 作为 `--accept-command` 重新运行,因为该标志在 Claude Code 会话内无效。需要 Claude Code v2.1.271 或更高版本。
137 137
138`sha256` 计为完全相同的命令、plugin 和市场目录的接受。如果自命令显示以来其中任何一个发生了变化,Claude Code 不接受 `sha256` 并再次显示命令。运行自己的市场刷新获取的更改也计为此类更改。138`sha256` 计为对完全相同的命令、插件和市场目录的接受。如果自命令显示以来其中任何一个发生了变化,Claude Code 不接受 `sha256` 并再次显示命令。运行自己的市场刷新获取的更改也计为此类更改。
139 139
140如果 `shownCommand.acceptCommandMatched` 为 `false`,您传递的 `sha256` 与现在显示的命令不匹配。在使用其 `sha256` 重新运行之前查看该命令。140如果 `shownCommand.acceptCommandMatched` 为 `false`,你传递的 `sha256` 与现在显示的命令不匹配。在使用其 `sha256` 重新运行之前,查看该命令。
141 141
142<h3 id="plugin-uninstall">142<h3 id="plugin-uninstall">
143 plugin uninstall143 plugin uninstall
144</h3>144</h3>
145 145
146从一个作用域删除已安装的 plugin。`remove` 和 `rm` 是 `uninstall` 的别名。146从一个作用域移除已安装的插件。`remove` 和 `rm` 是 `uninstall` 的别名。
147 147
148```bash theme={null}148```bash theme={null}
149claude plugin uninstall <plugin> [options]149claude plugin uninstall <plugin> [options]
152| 标志 | 描述 |152| 标志 | 描述 |
153| :- | :- |153| :- | :- |
154| `-s, --scope <scope>` | 从作用域卸载:`user`、`project` 或 `local`。默认为 `user` |154| `-s, --scope <scope>` | 从作用域卸载:`user`、`project` 或 `local`。默认为 `user` |
155| `--keep-data` | 保留 plugin 的持久数据目录 `~/.claude/plugins/data/<id>/` |155| `--keep-data` | 保留插件的持久数据目录 `~/.claude/plugins/data/<id>/` |
156| `--prune` | 也删除自动安装的 [dependencies](/docs/zh-CN/plugins/dependencies),没有剩余 plugin 需要 |156| `--prune` | 也移除自动安装的 [依赖项](/docs/zh-CN/plugins/dependencies),没有剩余插件需要 |
157| `-y, --yes` | 跳过 `--prune` 确认提示。当 stdin 或 stdout 不是 TTY 时,`--prune` 需要 |157| `-y, --yes` | 跳过 `--prune` 确认提示。当 stdin 或 stdout 不是 TTY 时,与 `--prune` 一起需要 |
158| `--json` | 将结果作为一个 JSON 对象打印在 stdout 的最后一行,格式与 [`plugin install --json`](#plugin-json-result) 相同。不能与 `--prune` 组合。需要 Claude Code v2.1.268 或更高版本 |158| `--json` | 将结果打印为 stdout 最后一行的一个 JSON 对象,格式与 [`plugin install --json`](#plugin-json-result) 相同。不能与 `--prune` 组合。需要 Claude Code v2.1.268 或更高版本 |
159 159
160从项目作用域卸载 plugin:160从项目作用域卸载插件:
161 161
162```bash theme={null}162```bash theme={null}
163claude plugin uninstall formatter@my-marketplace --scope project163claude plugin uninstall formatter@my-marketplace --scope project
164```164```
165 165
166Claude Code 打印 `Successfully uninstalled plugin: formatter (scope: project)`。当 plugin 未在该作用域安装时,命令打印以 `Failed to uninstall plugin "formatter@my-marketplace":` 开头的行,退出 `1`。166Claude Code 打印 `Successfully uninstalled plugin: formatter (scope: project)`。当插件未在该作用域安装时,命令打印以 `Failed to uninstall plugin "formatter@my-marketplace":` 开头的行并退出 `1`。
167 167
168如果失败行继续显示 `"formatter" was not uninstalled:`,Claude Code 无法确认该作用域的设置不再打开 plugin,因此 plugin 保持安装状态,并保留其保存的所有内容。使用 `--json`,结果带有 `failureCode: "settings_still_on"`。此设置检查需要 Claude Code v2.1.282 或更高版本。168如果失败行继续为 `"formatter" was not uninstalled:` 并命名设置文件,Claude Code 无法确认作用域的设置不再打开插件,因此插件保持安装状态,保留其保存的所有内容。使用 `--json` 时,结果携带 `failureCode: "settings_still_on"`。此设置检查需要 Claude Code v2.1.282 或更高版本。
169 169
170<h4 id="what-an-uninstall-deletes-and-keeps">170<h4 id="what-an-uninstall-deletes-and-keeps">
171 卸载删除和保留的内容171 卸载删除和保留的内容
172</h4>172</h4>
173 173
174当您从最后一个安装 plugin 的作用域卸载它时,Claude Code 也删除 plugin 的存储 [options 和 secrets](/docs/zh-CN/plugins/manifest-reference#user-configuration) 及其数据目录 `~/.claude/plugins/data/<id>/`。有三个例外:174当你从最后一个安装它的作用域卸载插件时,Claude Code 也删除插件存储的 [选项和密钥](/docs/zh-CN/plugins/manifest-reference#user-configuration) 及其数据目录 `~/.claude/plugins/data/<id>/`。有三个例外:
175 175
176* 使用 `--keep-data`,数据目录保留176* 使用 `--keep-data` 时,数据目录保留
177* 当另一个已安装的 plugin 使用相同的文件夹时,例如其 ID 仅在字母大小写上与此不同的 plugin,数据目录保留177* 当另一个已安装的插件使用相同的文件夹时,例如其 ID 仅在字母大小写上与此不同的插件,数据目录保留
178* 当 Claude Code 无法在从该作用域删除 plugin 后读回已安装 plugins 的列表时,options、secrets 和数据目录都保留,因为 plugin 可能仍在另一个作用域安装。卸载仍然成功。消息列出保留的内容及如何删除它,使用 `--json` 结果带有 `savedKept: "install_records_unreadable"`178* 当 Claude Code 无法在从该作用域移除插件后读回已安装插件的列表时,选项、密钥和数据目录都保留,因为插件可能仍在另一个作用域安装。卸载仍然成功。消息列出保留的内容及如何删除它,使用 `--json` 时结果携带 `savedKept: "install_records_unreadable"`
179 179
180使用 `--json`,`keptData` 报告目录是否保留,`/plugin` 在保留时显示 `· data preserved`。对于在没有 `--keep-data` 的情况下保留的目录,此报告需要 Claude Code v2.1.281 或更高版本。`savedKept` 字段需要 Claude Code v2.1.282 或更高版本。180使用 `--json` 时,`keptData` 报告目录是否保留,`/plugin` 在保留时显示 `· data preserved`。对于在没有 `--keep-data` 的情况下保留的目录,此报告需要 Claude Code v2.1.281 或更高版本。`savedKept` 字段需要 Claude Code v2.1.282 或更高版本。
181 181
182<h3 id="plugin-enable">182<h3 id="plugin-enable">
183 plugin enable183 plugin enable
184</h3>184</h3>
185 185
186启用禁用的 plugin。对于 [从 claude.ai 同步的 plugin](/docs/zh-CN/plugins/loading#synced-plugins),将 `<name>@synced` 作为 plugin 传递。186启用禁用的插件。对于 [从 claude.ai 同步的插件](/docs/zh-CN/plugins/loading#synced-plugins),传递 `<name>@synced` 作为插件。
187 187
188```bash theme={null}188```bash theme={null}
189claude plugin enable <plugin> [options]189claude plugin enable <plugin> [options]
192| 标志 | 描述 |192| 标志 | 描述 |
193| :- | :- |193| :- | :- |
194| `-s, --scope <scope>` | 启用的作用域:`user`、`project` 或 `local`。省略时自动检测 |194| `-s, --scope <scope>` | 启用的作用域:`user`、`project` 或 `local`。省略时自动检测 |
195| `--json` | 将结果作为一个 JSON 对象打印在 stdout 的最后一行,格式与 [`plugin install --json`](#plugin-json-result) 相同。需要 Claude Code v2.1.268 或更高版本 |195| `--json` | 将结果打印为 stdout 最后一行的一个 JSON 对象,格式与 [`plugin install --json`](#plugin-json-result) 相同。需要 Claude Code v2.1.268 或更高版本 |
196 196
197不使用 `--scope`,命令按本地、项目、用户的顺序检查您的设置文件,并使用提及 plugin 的第一个作用域。197不使用 `--scope` 时,命令按本地、项目、用户的顺序检查你的设置文件,并使用第一个提及插件的作用域。
198 198
199如果您传递 plugin 未声明的 `--scope`,命令要么写入覆盖,要么失败:199如果你传递插件未声明的 `--scope`,命令要么写入覆盖,要么失败:
200 200
201* **[优先于](/docs/zh-CN/plugins/loading) 声明作用域的作用域**:Claude Code 在您传递的作用域处写入覆盖。例如,`claude plugin disable formatter --scope local` 仅为您关闭项目启用的 plugin201* **一个 [优先于](/docs/zh-CN/plugins/loading) 声明作用域的作用域**:Claude Code 在你传递的作用域处写入覆盖。例如,`claude plugin disable formatter --scope local` 仅为你关闭项目启用的插件
202* **任何其他作用域**:命令失败,显示 `Plugin "formatter" is installed at project scope, not user. Use --scope project or omit --scope to auto-detect.`202* **任何其他作用域**:命令失败,显示 `Plugin "formatter" is installed at project scope, not user. Use --scope project or omit --scope to auto-detect.`
203 203
204如果 plugin 已在解析的作用域启用,命令打印 `Plugin "formatter" is already enabled` 并退出 `1`。使用 `--json`,结果具有 `"failureCode": "already_in_goal_state"` 和 `"alreadyInGoalState": true`,因此脚本可以将该情况视为成功。204如果插件已在解析的作用域启用,命令打印 `Plugin "formatter" is already enabled` 并退出 `1`。使用 `--json` 时,结果有 `"failureCode": "already_in_goal_state"` 和 `"alreadyInGoalState": true`,所以脚本可以将该情况视为成功。
205 205
206当 plugin 声明 [dependencies](/docs/zh-CN/plugins/dependencies) 时,Claude Code 也启用它们。命令在这些情况下失败:206当插件声明 [依赖项](/docs/zh-CN/plugins/dependencies) 时,Claude Code 也启用它们。命令在这些情况下失败:
207 207
208* **dependency 未安装**:启用失败并为每个缺失的 dependency 打印 `claude plugin install` 命令208* **依赖项未安装**:启用失败并为每个缺失的依赖项打印 `claude plugin install` 命令
209* **dependency 被您组织的 plugin 策略阻止**:启用失败并命名被阻止的 dependency209* **依赖项被你的组织的插件策略阻止**:启用失败并命名被阻止的依赖项
210* **dependency 在优先级高于目标作用域的作用域处设置为 `false`**:启用失败。在该作用域启用 dependency,或传递 `--scope` 以在那里写入210* **依赖项在优先级高于目标作用域的作用域处设置为 `false`**:启用失败。在该作用域启用依赖项,或传递 `--scope` 以在那里写入
211 211
212在声明它的任何地方重新启用 plugin:212在声明它的任何地方重新启用插件:
213 213
214```bash theme={null}214```bash theme={null}
215claude plugin enable formatter215claude plugin enable formatter
221 plugin disable221 plugin disable
222</h3>222</h3>
223 223
224禁用 plugin 而不卸载它。对于 [从 claude.ai 同步的 plugin](/docs/zh-CN/plugins/loading#synced-plugins),将 `<name>@synced` 作为 plugin 传递。224禁用插件而不卸载它。对于 [从 claude.ai 同步的插件](/docs/zh-CN/plugins/loading#synced-plugins),传递 `<name>@synced` 作为插件。
225 225
226```bash theme={null}226```bash theme={null}
227claude plugin disable [plugin] [options]227claude plugin disable [plugin] [options]
229 229
230| 标志 | 描述 |230| 标志 | 描述 |
231| :- | :- |231| :- | :- |
232| `-a, --all` | 禁用每个启用的 plugin。不能与 plugin 名称或 `--scope` 组合 |232| `-a, --all` | 禁用每个启用的插件。不能与插件名称或 `--scope` 组合 |
233| `-s, --scope <scope>` | 禁用的作用域:`user`、`project` 或 `local`。省略时自动检测 |233| `-s, --scope <scope>` | 禁用的作用域:`user`、`project` 或 `local`。省略时自动检测 |
234| `--json` | 将结果作为一个 JSON 对象打印在 stdout 的最后一行,格式与 [`plugin install --json`](#plugin-json-result) 相同。需要 Claude Code v2.1.268 或更高版本 |234| `--json` | 将结果打印为 stdout 最后一行的一个 JSON 对象,格式与 [`plugin install --json`](#plugin-json-result) 相同。需要 Claude Code v2.1.268 或更高版本 |
235 235
236不使用 `--scope`,作用域以与 [`plugin enable`](#plugin-enable) 相同的本地、项目、用户顺序自动检测。236不使用 `--scope` 时,作用域按与 [`plugin enable`](#plugin-enable) 相同的本地、项目、用户顺序自动检测。
237 237
238如果您既不传递 plugin 名称也不传递 `--all`,Claude Code 打印 `Please specify a plugin name or use --all to disable all plugins` 并退出 `1`。禁用已禁用的 plugin 打印 `Plugin "formatter" is already disabled` 并退出 `1`,如 [`plugin enable`](#plugin-enable) 对已启用的 plugin 所做的那样。238如果你既不传递插件名称也不传递 `--all`,Claude Code 打印 `Please specify a plugin name or use --all to disable all plugins` 并退出 `1`。禁用已禁用的插件打印 `Plugin "formatter" is already disabled` 并退出 `1`,如 [`plugin enable`](#plugin-enable) 对已启用的插件所做的那样。
239 239
240命令对仍然需要的 plugin 失败:240命令对仍然需要的插件失败:
241 241
242* **另一个启用的 plugin [depends on](/docs/zh-CN/plugins/dependencies) 它**:命令失败并命名要首先禁用的依赖项242* **另一个启用的插件 [依赖于](/docs/zh-CN/plugins/dependencies) 它**:命令失败并命名要首先禁用的依赖项
243* **您的组织要求它作为同步 plugin**:命令失败并保存任何内容243* **你的组织要求它作为同步插件**:命令失败并不保存任何内容
244 244
245禁用一个 plugin:245禁用一个插件:
246 246
247```bash theme={null}247```bash theme={null}
248claude plugin disable formatter248claude plugin disable formatter
254 plugin update254 plugin update
255</h3>255</h3>
256 256
257将 plugin 更新到其市场提供的最新版本。新版本在您的下一个会话中加载,或在您在运行的会话中运行 `/reload-plugins` 后加载。257将插件更新到其市场提供的最新版本。新版本在你的下一个会话中加载,或在运行中的会话中运行 `/reload-plugins` 后加载。
258 258
259```bash theme={null}259```bash theme={null}
260claude plugin update <plugin> [options]260claude plugin update <plugin> [options]
263| 标志 | 描述 |263| 标志 | 描述 |
264| :- | :- |264| :- | :- |
265| `-s, --scope <scope>` | 更新的作用域:`user`、`project`、`local` 或 `managed`。省略时自动检测 |265| `-s, --scope <scope>` | 更新的作用域:`user`、`project`、`local` 或 `managed`。省略时自动检测 |
266| `-y, --yes` | 接受来自 [command-source](/docs/zh-CN/plugins/host-marketplace) plugin 的更改的安装命令,无需提示。当 stdin 或 stdout 不是 TTY 时需要,除非您传递 `--accept-command`。需要 Claude Code v2.1.229 或更高版本 |266| `-y, --yes` | 接受来自 [命令源](/docs/zh-CN/plugins/host-marketplace) 插件的更改的安装命令,无需提示。当 stdin 或 stdout 不是 TTY 时需要,除非你传递 `--accept-command`。需要 Claude Code v2.1.229 或更高版本 |
267| `--accept-command <sha256>` | 接受市场声明的命令,其 `sha256` 之前的 [`--json` 运行](#plugin-json-result) 在 `shownCommand` 中报告,代替 `-y`。不能与 `-y` 组合。需要 Claude Code v2.1.271 或更高版本 |267| `--accept-command <sha256>` | 接受市场声明的命令,其 `sha256` 之前的 [`--json` 运行](#plugin-json-result) 在 `shownCommand` 中报告,代替 `-y`。不能与 `-y` 组合。需要 Claude Code v2.1.271 或更高版本 |
268| `--json` | 将结果作为一个 JSON 对象打印在 stdout 的最后一行,格式与 [`plugin install --json`](#plugin-json-result) 相同。需要 Claude Code v2.1.268 或更高版本 |268| `--json` | 将结果打印为 stdout 最后一行的一个 JSON 对象,格式与 [`plugin install --json`](#plugin-json-result) 相同。需要 Claude Code v2.1.268 或更高版本 |
269 269
270如果您省略 `--scope`,命令在您当前项目安装的最具体作用域处更新 plugin,检查本地、项目、用户,然后托管。270如果你省略 `--scope`,命令在为你的当前项目安装它的最具体作用域处更新插件,检查本地、项目、用户,然后托管。
271 271
272在 v2.1.281 之前,当您省略 `--scope` 时命令使用 `user`,因此更新仅在项目或本地作用域安装的 plugin 失败,显示 `Plugin "<name>" is not installed at scope user`。在这些版本上,传递 `--scope`。272在 v2.1.281 之前,当你省略 `--scope` 时命令使用 `user`,所以更新仅在项目或本地作用域安装的插件失败,显示 `Plugin "<name>" is not installed at scope user`。在这些版本上,传递 `--scope`。
273 273
274`managed` 是您可以更新但不能安装的唯一作用域。对于管理员安装的 plugins,请参阅 [为您的组织管理 plugins](/docs/zh-CN/plugins/org)。274`managed` 是你可以更新但不能安装的唯一作用域。对于管理员安装的插件,请参阅 [为你的组织管理插件](/docs/zh-CN/plugins/org)。
275 275
276更新 plugin:276更新插件:
277 277
278```bash theme={null}278```bash theme={null}
279claude plugin update formatter@my-marketplace279claude plugin update formatter@my-marketplace
281 281
282Claude Code 打印 `Checking for updates for plugin "formatter@my-marketplace"…`,然后是结果。当没有更新时,它打印 `formatter is already at the latest version (1.0.0).` 并退出 `0`。282Claude Code 打印 `Checking for updates for plugin "formatter@my-marketplace"…`,然后是结果。当没有更新时,它打印 `formatter is already at the latest version (1.0.0).` 并退出 `0`。
283 283
284您可以传递裸 plugin 名称,命令将其与您安装的 plugins 匹配。当来自不同市场的已安装 plugins 共享名称时,命令拒绝更新并列出要运行的限定 `plugin-name@marketplace-name` 命令。按裸名称更新需要 Claude Code v2.1.246 或更高版本。284你可以传递一个裸插件名称,命令将其与你安装的插件匹配。当来自不同市场的已安装插件共享名称时,命令拒绝更新并列出要运行的限定 `plugin-name@marketplace-name` 命令。按裸名称更新需要 Claude Code v2.1.246 或更高版本。
285 285
286<h3 id="plugin-list">286<h3 id="plugin-list">
287 plugin list287 plugin list
288</h3>288</h3>
289 289
290列出已安装的 plugins,包括其版本、作用域和状态。290列出已安装的插件及其版本、作用域和状态。
291 291
292```bash theme={null}292```bash theme={null}
293claude plugin list [options]293claude plugin list [options]
296| 标志 | 描述 |296| 标志 | 描述 |
297| :- | :- |297| :- | :- |
298| `--json` | 将列表打印为 JSON |298| `--json` | 将列表打印为 JSON |
299| `--available` | 也列出您的市场提供但您未安装的 plugins。没有 `--json` 时无效 |299| `--available` | 也列出你的市场提供但你未安装的插件。没有 `--json` 时无效 |
300 300
301Claude Code 按每个 plugin 的加载方式对人类可读的输出进行分组:301Claude Code 按每个插件的加载方式对人类可读的输出进行分组:
302 302
303* **`Installed plugins:`**:您从市场安装的 plugins303* **`Installed plugins:`**:你从市场安装的插件
304* **`Session-only plugins (--plugin-dir / --plugin-url):`**:由同一命令中的这些标志加载的 plugins,如 `claude --plugin-dir ./my-plugin plugin list`304* **`Session-only plugins (--plugin-dir / --plugin-url):`**:由同一命令中的这些标志加载的插件,如 `claude --plugin-dir ./my-plugin plugin list`
305* **`Skills-directory plugins (.claude/skills/*):`**:Claude Code 在 skills 目录中找到的 plugins305* **`Skills-directory plugins (.claude/skills/*):`**:Claude Code 在 skills 目录中找到的插件
306* **`Synced from claude.ai`**:[从您的 claude.ai 账户同步的 plugins](/docs/zh-CN/plugins/loading#synced-plugins)306* **`Synced from claude.ai`**:[从你的 claude.ai 账户同步的插件](/docs/zh-CN/plugins/loading#synced-plugins)
307 307
308当任何组中都没有内容时,Claude Code 打印 ``No plugins installed. Use `claude plugin install` to install a plugin.``308当任何组中都没有内容时,Claude Code 打印 ``No plugins installed. Use `claude plugin install` to install a plugin.``
309 309
311 JSON 输出311 JSON 输出
312</h4>312</h4>
313 313
314使用 `--json`,Claude Code 打印一个数组,每个安装一个对象。每个对象都带有下面的字段。`id`、`version`、`scope`、`enabled` 和 `installPath` 始终存在,其他字段仅在适用时出现。314使用 `--json` 时,Claude Code 打印一个数组,每个安装一个对象。每个对象携带下面的字段。`id`、`version`、`scope`、`enabled` 和 `installPath` 始终存在,其他仅在适用时出现。
315 315
316| 字段 | 类型 | 描述 |316| 字段 | 类型 | 描述 |
317| :- | :- | :- |317| :- | :- | :- |
318| `id` | string | 安装为 `name@marketplace`,会话内 plugins 为 `name@inline`,skills-directory plugins 为 `name@skills-dir`,从 claude.ai 同步的 plugins 为 `name@synced` |318| `id` | string | 安装时为 `name@marketplace`,会话内插件为 `name@inline`,skills-directory 插件为 `name@skills-dir`,从 claude.ai 同步的插件为 `name@synced` |
319| `version` | string | 对于市场安装,[Claude Code 在安装时计算的](/docs/zh-CN/plugins/loading#versions-and-updates) 版本。对于会话内、skills-directory 或同步 plugin,清单的 `version`,或当它不声明任何内容时为 `unknown` |319| `version` | string | 对于市场安装,[Claude Code 在安装时计算的](/docs/zh-CN/plugins/loading#versions-and-updates) 版本。对于会话内、skills-directory 或同步插件,清单的 `version`,或当它不声明时为 `unknown` |
320| `scope` | string | 安装为 `user`、`project`、`local` 或 `managed`;skills-directory plugins 为 `user` 或 `project`;会话内 plugins 为 `session`;从 claude.ai 同步的 plugins 为 `synced` |320| `scope` | string | 安装时为 `user`、`project`、`local` 或 `managed`;skills-directory 插件为 `user` 或 `project`;会话内插件为 `session`;从 claude.ai 同步的插件为 `synced` |
321| `enabled` | boolean | plugin 在您的合并设置中是否启用 |321| `enabled` | boolean | 插件在你的合并设置中是否启用 |
322| `installPath` | string | plugin 加载的目录 |322| `installPath` | string | 插件加载的目录 |
323| `installedAt` | string | 安装的 ISO 时间戳。仅市场安装 |323| `installedAt` | string | 安装的 ISO 时间戳。仅市场安装 |
324| `lastUpdated` | string | 最后更新的 ISO 时间戳。仅市场安装 |324| `lastUpdated` | string | 最后更新的 ISO 时间戳。仅市场安装 |
325| `projectPath` | string | 安装所属的项目。仅 `project` 和 `local` 作用域 |325| `projectPath` | string | 安装所属的项目。仅 `project` 和 `local` 作用域 |
326| `mcpServers` | object | plugin 的 MCP 服务器定义,当市场安装的 plugin 有任何时 |326| `mcpServers` | object | 插件的 MCP 服务器定义,当市场安装的插件有任何时 |
327| `errors` | array of strings | 加载错误,当 plugin 加载失败时 |327| `errors` | array of strings | 加载错误,当插件加载失败时 |
328| `notes` | array of strings | plugin 加载并工作时的创作警告 |328| `notes` | array of strings | 插件加载并工作的创作警告 |
329| `errorDetails` | array of objects | 每个 `errors` 条目一个对象,给出其诊断 `type` 和它引用的名称,例如 plugin、市场、服务器或文件。需要 Claude Code v2.1.268 或更高版本 |329| `errorDetails` | array of objects | 每个 `errors` 条目一个对象,给出其诊断 `type` 和它引用的名称,例如插件、市场、服务器或文件。需要 Claude Code v2.1.268 或更高版本 |
330| `noteDetails` | array of objects | 每个 `notes` 条目的相同详细对象。需要 Claude Code v2.1.268 或更高版本 |330| `noteDetails` | array of objects | 每个 `notes` 条目的相同详细对象。需要 Claude Code v2.1.268 或更高版本 |
331 331
332使用 `--json --available`,Claude Code 打印一个对象而不是数组。其 `installed` 字段保存已安装 plugin 对象的数组,其 `available` 字段保存每个未安装市场 plugin 的一个对象,带有下面的字段。332使用 `--json --available` 时,Claude Code 打印一个对象而不是数组。其 `installed` 字段保存已安装插件对象的数组,其 `available` 字段保存每个未安装的市场插件的一个对象,带有下面的字段。
333 333
334| 字段 | 类型 | 描述 |334| 字段 | 类型 | 描述 |
335| :- | :- | :- |335| :- | :- | :- |
336| `pluginId` | string | `name@marketplace` |336| `pluginId` | string | `name@marketplace` |
337| `name` | string | plugin 在市场中的名称 |337| `name` | string | 插件在市场中的名称 |
338| `marketplaceName` | string | 提供它的市场 |338| `marketplaceName` | string | 提供它的市场 |
339| `source` | string or object | 市场条目的 [source](/docs/zh-CN/plugins/marketplace-reference):相对路径为字符串,否则为对象 |339| `source` | string or object | 市场条目的 [source](/docs/zh-CN/plugins/marketplace-reference):相对路径为字符串,否则为对象 |
340| `description` | string | 条目的描述,当它有时 |340| `description` | string | 条目的描述,当它有时 |
341| `version` | string | 条目的版本,当它声明时 |341| `version` | string | 条目的版本,当它声明时 |
342| `installCount` | number | 安装计数,当 Claude Code 有 plugin 的计数时 |342| `installCount` | number | 安装计数,当 Claude Code 有插件的时 |
343 343
344<h3 id="plugin-details">344<h3 id="plugin-details">
345 plugin details345 plugin details
346</h3>346</h3>
347 347
348显示 plugin 的组件清单及其预计令牌成本。348显示插件的组件清单及其预计令牌成本。
349 349
350plugin 必须被加载:已安装、在 skills 目录中找到,或在同一命令中使用 `--plugin-dir` 或 `--plugin-url` 传递。`<name>` 是 plugin `name` 或 `name@marketplace`。350插件必须被加载:已安装、在 skills 目录中找到,或在同一命令中使用 `--plugin-dir` 或 `--plugin-url` 传递。`<name>` 是插件 `name` 或 `name@marketplace`。
351 351
352```bash theme={null}352```bash theme={null}
353claude plugin details <name>353claude plugin details <name>
354```354```
355 355
356命令除了 `--help` 外不接受任何标志。356该命令除了 `--help` 外不接受标志。
357 357
358显示已安装 plugin 的贡献:358显示已安装插件贡献的内容:
359 359
360```bash theme={null}360```bash theme={null}
361claude plugin details formatter361claude plugin details formatter
362```362```
363 363
364Claude Code 打印 plugin 的名称、版本、描述和源,然后是这些部分:364Claude Code 打印插件的名称、版本、描述和源,然后是这些部分:
365 365
366* **`Component inventory`**:plugin 的 skills、agents、hooks、MCP 服务器和 LSP 服务器366* **`Component inventory`**:插件的 skills、agents、hooks、MCP 服务器和 LSP 服务器
367* **`Projected token cost`**:plugin 添加到每个会话的始终开启令牌367* **`Projected token cost`**:插件添加到每个会话的始终开启令牌
368* **`Per-component (rounded)`**:每个 skill、agent 和命令的始终开启和按调用估计。当 plugin 没有时省略368* **`Per-component (rounded)`**:每个 skill、agent 和命令的始终开启和按调用估计。当插件没有时省略
369 369
370对于两个成本数字的含义,请参阅 [测量 plugin 成本和使用](/docs/zh-CN/plugins/measure)。370对于两个成本数字的含义,请参阅 [测量插件成本和使用](/docs/zh-CN/plugins/measure)。
371 371
372对于未加载的 plugin,Claude Code 打印 ``Plugin "formatter" not found. Run `claude plugin list` to see installed plugins, or pass --plugin-dir <path> to load one from disk.`` 并退出 `1`。372对于未加载的插件,Claude Code 打印 ``Plugin "formatter" not found. Run `claude plugin list` to see installed plugins, or pass --plugin-dir <path> to load one from disk.`` 并退出 `1`。
373 373
374<h3 id="plugin-prune">374<h3 id="plugin-prune">
375 plugin prune375 plugin prune
376</h3>376</h3>
377 377
378删除自动安装的 [dependencies](/docs/zh-CN/plugins/dependencies),没有已安装的 plugin 需要。命令永远不会删除您自己安装的 plugin。`autoremove` 是 `prune` 的别名。378移除自动安装的 [依赖项](/docs/zh-CN/plugins/dependencies),没有已安装的插件需要。命令永远不会移除你自己安装的插件。`autoremove` 是 `prune` 的别名。
379 379
380```bash theme={null}380```bash theme={null}
381claude plugin prune [options]381claude plugin prune [options]
384| 标志 | 描述 |384| 标志 | 描述 |
385| :- | :- |385| :- | :- |
386| `-s, --scope <scope>` | 在作用域处修剪:`user`、`project` 或 `local`。默认为 `user` |386| `-s, --scope <scope>` | 在作用域处修剪:`user`、`project` 或 `local`。默认为 `user` |
387| `--dry-run` | 列出将被删除的内容而不删除它 |387| `--dry-run` | 列出将被移除的内容而不移除它 |
388| `-y, --yes` | 跳过确认提示。当 stdin 或 stdout 不是 TTY 时需要 |388| `-y, --yes` | 跳过确认提示。当 stdin 或 stdout 不是 TTY 时需要 |
389 389
390预览修剪将删除的内容:390预览修剪将移除的内容:
391 391
392```bash theme={null}392```bash theme={null}
393claude plugin prune --dry-run393claude plugin prune --dry-run
394```394```
395 395
396Claude Code 列出孤立的 dependencies 并以 `(dry run — nothing removed)` 结尾。当没有要删除的内容时,它打印以 `Nothing to prune` 开头的行。396Claude Code 列出孤立的依赖项并以 `(dry run — nothing removed)` 结尾。没有要移除的内容时,它打印以 `Nothing to prune` 开头的行。
397 397
398不使用 `--dry-run`,命令仅在您在提示处确认或传递 `-y` 后删除孤立的 dependencies。398不使用 `--dry-run` 时,命令仅在你在提示处确认或传递 `-y` 后移除孤立的依赖项。
399 399
400无论您在提示处的答案如何,退出代码都是 `0`。400无论你在提示处的答案如何,退出代码都是 `0`。
401 401
402`prune` 的作用取决于是否附加了终端以及您是否传递了 `-y`:402`prune` 的作用取决于是否附加了终端以及你是否传递了 `-y`:
403 403
404| 终端和标志 | 发生的情况 |404| 终端和标志 | 发生的情况 |
405| :- | :- |405| :- | :- |
406| 交互式终端,无 `-y` | 列出孤立的 dependencies 并询问 `Remove? [y/N]` |406| 交互式终端,无 `-y` | 列出孤立的依赖项并询问 `Remove? [y/N]` |
407| 任何终端,`-y` | 删除它们并打印 `Removed N auto-installed plugins: <names>` |407| 任何终端,`-y` | 移除它们并打印 `Removed N auto-installed plugins: <names>` |
408| 非 TTY stdin 或 stdout,无 `-y` | 打印列表和 ``Not a TTY — run `claude plugin prune -y` to remove.``,不删除任何内容 |408| 非 TTY stdin 或 stdout,无 `-y` | 打印列表并显示 ``Not a TTY — run `claude plugin prune -y` to remove.``,不移除任何内容 |
409 409
410<h3 id="plugin-eval">410<h3 id="plugin-eval">
411 plugin eval411 plugin eval
412</h3>412</h3>
413 413
414运行 plugin 的 [eval cases](/docs/zh-CN/plugin-evals) 并报告评分结果。需要 Claude Code v2.1.269 或更高版本。414运行插件的 [eval 案例](/docs/zh-CN/plugin-evals) 并报告评分结果。需要 Claude Code v2.1.269 或更高版本。
415 415
416每个案例是一个提示加评分器。Claude Code 在仅加载目标 plugin 的隔离会话中多次运行它,默认情况下也不使用 plugin 运行,以便报告显示差异。416每个案例是一个提示加评分器。Claude Code 在隔离的会话中运行它多次,仅加载目标插件,默认情况下也不加载插件,所以报告显示差异。
417 417
418有关案例格式、评分器、结果和 CI 使用,请参阅 [使用 evals 测试 plugins](/docs/zh-CN/plugin-evals)。418请参阅 [使用 evals 测试插件](/docs/zh-CN/plugin-evals) 了解案例格式、评分器、结果和 CI 使用。
419 419
420```bash theme={null}420```bash theme={null}
421claude plugin eval [target] [options]421claude plugin eval [target] [options]
422```422```
423 423
424可选的 `target` 默认为当前目录,采用以下任何形式:424可选的 `target` 默认为当前目录,并采用以下任何形式:
425 425
426* plugin 目录426* 插件目录
427* 单个 `prompt.md` 或 `case.yaml` 文件427* 单个 `prompt.md` 或 `case.yaml` 文件
428* 已安装的 plugin,如 `name` 或 `name@marketplace`428* 已安装的插件作为 `name` 或 `name@marketplace`
429* `name@skills-dir`429* `name@skills-dir`
430 430
431将目标放在 `--tag`、`--allow-tools` 和 `--json` 之前。这些选项中的每一个都将其后的单词作为其值,因此在其中一个之后写入的目标被读作标签、工具名称或 JSON 输出路径,而不是目标。431将目标放在 `--tag`、`--allow-tools` 和 `--json` 之前。这些选项中的每一个都将其后的单词作为其值,所以在其中一个之后写入的目标被读作标签、工具名称或 JSON 输出路径,而不是目标。
432 432
433此表列出大多数运行使用的选项。运行 `claude plugin eval --help` 以获取完整集合,包括 `--case`、`--tag`、`--output-dir`、`--report`、`--allow-real-servers`、`--keep-temp` 和 `--verbose`。433此表列出大多数运行使用的选项。运行 `claude plugin eval --help` 以获取完整集合,包括 `--case`、`--tag`、`--output-dir`、`--report`、`--allow-real-servers`、`--keep-temp` 和 `--verbose`。
434 434
435| 选项 | 描述 | 默认 |435| 选项 | 描述 | 默认 |
436| :- | :- | :- |436| :- | :- | :- |
437| `--runs <n>` | 每个 [arm](/docs/zh-CN/plugin-evals#compare-against-a-no-plugin-baseline) 中每个案例的运行 | 每个案例的 `runs`,否则 3 |437| `--runs <n>` | 每个 [arm](/docs/zh-CN/plugin-evals#compare-against-a-no-plugin-baseline) 中每个案例的运行 | 每个案例的 `runs`,否则 3 |
438| `-j, --concurrency <n>` | 一次运行的代理会话,1 到 8。它们共享您的速率限制 | `1` |438| `-j, --concurrency <n>` | 一次运行的代理会话,1 到 8。它们共享你的速率限制 | `1` |
439| `--model <model>` | 被测试代理的模型 | 每个案例的 `model`,否则 `ANTHROPIC_MODEL`(如果设置),否则 Claude Code 的默认值 |439| `--model <model>` | 被测试代理的模型 | 每个案例的 `model`,否则 `ANTHROPIC_MODEL` 如果设置,否则 Claude Code 的默认值 |
440| `--judge-model <model>` | `llm` 和 `baseline` 评分器的模型 | 一个小的快速模型 |440| `--judge-model <model>` | `llm` 和 `baseline` 评分器的模型 | 一个小的快速模型 |
441| `--ablation <mode>` | `none` 或 `with-without`。请参阅 [与无 plugin 基线比较](/docs/zh-CN/plugin-evals#compare-against-a-no-plugin-baseline) | 当 plugin 解析时为 `with-without`,否则为 `none` |441| `--ablation <mode>` | `none` 或 `with-without`。请参阅 [与无插件基线比较](/docs/zh-CN/plugin-evals#compare-against-a-no-plugin-baseline) | 当插件解析时为 `with-without`,否则 `none` |
442| `--threshold <0..1>` | 如果任何案例评分低于此,退出 1 | `1.0` |442| `--threshold <0..1>` | 如果任何案例评分低于此,退出 1 | `1.0` |
443| `--max-cost-usd <usd>` | 一旦支出达到此值,在下一次运行前停止,退出 2,并报告部分结果 | 无限制 |443| `--max-cost-usd <usd>` | 一旦支出达到此值,在下一次运行前停止,退出 2,并报告部分结果 | 无限制 |
444| `--allow-tools <tools...>` | 授予超出只读集合的工具,例如 `Bash`、`Write`、`Edit` 或 `"mcp__plugin_<plugin>_<server>__*"`。请参阅 [授予工具](/docs/zh-CN/plugin-evals#grant-tools) | |444| `--allow-tools <tools...>` | 授予超出只读集合的工具,例如 `Bash`、`Write`、`Edit` 或 `"mcp__plugin_<plugin>_<server>__*"`。请参阅 [授予工具](/docs/zh-CN/plugin-evals#grant-tools) | |
445| `--scaffold` | 运行每个案例的 [`scaffold_script`](/docs/zh-CN/plugin-evals#add-setup-or-history-with-case-yaml) | 关闭 |445| `--scaffold` | 运行每个案例的 [`scaffold_script`](/docs/zh-CN/plugin-evals#add-setup-or-history-with-case-yaml) | 关闭 |
446| `--trust-plugin` | 跳过首次运行信任提示,用于 CI。请参阅 [运行可以访问的内容](/docs/zh-CN/plugin-evals#security) | 关闭 |446| `--trust-plugin` | 跳过首次运行信任提示,用于 CI。请参阅 [运行可以访问的内容](/docs/zh-CN/plugin-evals#security) | 关闭 |
447| `--mocks <mode>` | `record` 或 `off`。请参阅 [Mock MCP 服务器](/docs/zh-CN/plugin-evals#mock-mcp-servers) | `record` |447| `--mocks <mode>` | `record` 或 `off`。请参阅 [模拟 MCP 服务器](/docs/zh-CN/plugin-evals#mock-mcp-servers) | `record` |
448| `--eval-dir <dir>` | plugin 下方保存案例的目录 | 清单的 `experimental.evals`,否则 `evals` |448| `--eval-dir <dir>` | 插件下方保存案例的目录 | 清单的 `experimental.evals`,否则 `evals` |
449| `--json [path]` | 将 [结果文档](/docs/zh-CN/plugin-evals#json-result) 打印到 stdout,或将其写入 `.json` 路径 | |449| `--json [path]` | 将 [结果文档](/docs/zh-CN/plugin-evals#json-result) 打印到 stdout,或写入 `.json` 路径 | |
450| `--no-publish` | 保持 HTML 报告本地 | |450| `--no-publish` | 保持 HTML 报告本地 | |
451 451
452退出代码报告运行如何结束。要在管道中对其进行操作,请参阅 [在 CI 中运行 evals](/docs/zh-CN/plugin-evals#run-evals-in-ci)。452退出代码报告运行如何结束。要在管道中对其进行操作,请参阅 [在 CI 中运行 evals](/docs/zh-CN/plugin-evals#run-evals-in-ci)。
454| 退出代码 | 含义 |454| 退出代码 | 含义 |
455| :- | :- |455| :- | :- |
456| `0` | 每个案例都满足阈值 |456| `0` | 每个案例都满足阈值 |
457| `1` | 失败的案例、加载错误或不受信任的 plugin 目录 |457| `1` | 失败的案例、加载错误或不受信任的插件目录 |
458| `2` | 部分运行 |458| `2` | 部分运行 |
459| `130` | 中断 |459| `130` | 中断 |
460| `143` | 终止 |460| `143` | 终止 |
463 plugin eval init463 plugin eval init
464</h3>464</h3>
465 465
466为当前目录中的 plugin 创建 eval 套件。需要 Claude Code v2.1.269 或更高版本。请参阅 [创建您的第一个 eval 套件](/docs/zh-CN/plugin-evals#create-your-first-eval-suite)。466为当前目录中的插件创建 eval 套件。需要 Claude Code v2.1.269 或更高版本。请参阅 [创建你的第一个 eval 套件](/docs/zh-CN/plugin-evals#create-your-first-eval-suite)。
467 467
468```bash theme={null}468```bash theme={null}
469claude plugin eval init [name] [options]469claude plugin eval init [name] [options]
470```470```
471 471
472在终端中,命令打开交互式 Claude Code 会话以进行创作访谈。在访谈中,Claude 执行以下操作:472从插件的根文件夹运行命令,即保存 `.claude-plugin/plugin.json` 或 skill 的 `SKILL.md` 的目录。要有意在另一个目录中搭建套件,传递 `--eval-dir`。
473 473
4741. 读取 plugin474在终端中,命令打开交互式 Claude Code 会话进行创作访谈。在访谈中,Claude 执行以下操作:
4752. 询问您它应该做什么475
4761. 读取插件
4772. 询问你它应该做什么
4763. 提议案例和评分器4783. 提议案例和评分器
4774. 写入案例文件4794. 写入案例文件
4785. 运行案例并与您一起查看评分,以检查评分器是否按您的方式评分4805. 运行案例并与你一起查看评分,以检查评分器是否按你的方式评分
479 481
480使用 `--bare` 或没有终端,命令改为写入空白单案例模板。当 Claude 从 Claude Code 会话内运行命令时,命令打印该会话要遵循的访谈说明,而不是写入模板。482使用 `--bare` 或没有终端时,命令改为写入空白单案例模板。当 Claude 从 Claude Code 会话内运行命令时,命令打印该会话要遵循的访谈说明,而不是写入模板。
481 483
482可选的 `name` 是案例名称。它对于 `--bare` 或没有终端是必需的,因为命令为该案例写入空白模板。访谈不需要。484可选的 `name` 是案例名称。它与 `--bare` 或没有终端时需要,因为命令为该案例写入空白模板。案例名称以字母或数字开头,仅包含字母、数字、`.`、`_` 和 `-`。在每个平台上,命令也拒绝 Windows 无法存储的名称,例如 `con` 或以 `.` 结尾的名称。
483 485
484命令接受这些选项:486命令接受这些选项:
485 487
487| :- | :- | :- |489| :- | :- | :- |
488| `--bare` | 为 `<name>` 写入空白 `prompt.md` 和 `graders/criteria.md`,而不是运行访谈 | |490| `--bare` | 为 `<name>` 写入空白 `prompt.md` 和 `graders/criteria.md`,而不是运行访谈 | |
489| `-i, --interactive` | 需要访谈。没有终端时失败,而不是写入模板 | |491| `-i, --interactive` | 需要访谈。没有终端时失败,而不是写入模板 | |
490| `--eval-dir <dir>` | 当前目录下方写入案例的目录 | 清单的 `experimental.evals`,否则 `evals` |492| `--eval-dir <dir>` | 当前目录下写入案例的目录 | 清单的 `experimental.evals`,否则 `evals` |
491 493
492<h3 id="plugin-tag">494<h3 id="plugin-tag">
493 plugin tag495 plugin tag
494</h3>496</h3>
495 497
496为 plugin 发布创建名为 `<name>--v<version>` 的带注释 git 标签。在标记之前,命令检查 plugin 的 `plugin.json` 和任何列出它的市场条目是否同意版本。498为插件发布创建名为 `<name>--v<version>` 的带注释 git 标签。在标记前,命令检查插件的 `plugin.json` 和任何列出它的市场条目在版本上是否一致。
497 499
498有关何时标记发布,请参阅 [发布 plugin](/docs/zh-CN/plugins/publish)。500关于何时标记发布,请参阅 [发布插件](/docs/zh-CN/plugins/publish)。
499 501
500```bash theme={null}502```bash theme={null}
501claude plugin tag [path] [options]503claude plugin tag [path] [options]
502```504```
503 505
504`[path]` 是 plugin 目录,默认为当前目录。命令通过从该目录向上走到列出 plugin 的 `.claude-plugin/marketplace.json` 来查找市场条目。506`[path]` 是插件目录,默认为当前目录。命令通过从该目录向上走到列出插件的 `.claude-plugin/marketplace.json` 来找到市场条目。
505 507
506| 标志 | 描述 |508| 标志 | 描述 |
507| :- | :- |509| :- | :- |
508| `--push` | 创建后将标签推送到 `--remote` |510| `--push` | 创建标签后推送到 `--remote` |
509| `--dry-run` | 打印将被标记的内容而不创建标签 |511| `--dry-run` | 打印将被标记的内容而不创建标签 |
510| `-f, --force` | 跳过脏工作树和标签已存在检查 |512| `-f, --force` | 跳过脏工作树和标签已存在检查 |
511| `-m, --message <msg>` | 标签注释消息。`%s` 代表版本。默认为 `<name> <version>` |513| `-m, --message <msg>` | 标签注释消息。`%s` 代表版本。默认为 `<name> <version>` |
512| `--remote <name>` | 使用 `--push` 推送到的远程。默认为 `origin` |514| `--remote <name>` | 使用 `--push` 推送到的远程。默认为 `origin` |
513 515
514预览市场检出中 plugin 的标签:516预览市场检出中插件的标签:
515 517
516```bash theme={null}518```bash theme={null}
517claude plugin tag plugins/formatter --dry-run519claude plugin tag plugins/formatter --dry-run
519 521
520Claude Code 打印计划:522Claude Code 打印计划:
521 523
522* plugin 名称524* 插件名称
523* 版本和它来自哪个文件525* 版本及其来自的文件
524* 匹配的市场条目,当有时526* 匹配的市场条目,当有时
525* 标签名称527* 标签名称
526* 它将运行的 `git tag` 和 `git push` 命令528* 它将运行的 `git tag` 和 `git push` 命令
527 529
528不使用 `--dry-run`,Claude Code 打印 `Created tag formatter--v1.0.0` 和 `Pushed to origin` 或您自己运行的推送命令。如果推送失败,标签仍在本地创建,命令以错误退出。530不使用 `--dry-run` 时,Claude Code 打印 `Created tag formatter--v1.0.0` 并打印 `Pushed to origin` 或你自己运行的推送命令。如果推送失败,标签仍在本地创建,命令以错误退出。
529 531
530当它无法安全标记时,命令退出 `1` 并打印原因。常见原因是:532当命令无法安全标记时,它退出 `1` 并打印原因。常见原因是:
531 533
532* `plugin.json` 或市场条目中没有 `version`534* `plugin.json` 或市场条目中没有 `version`
533* 标签已存在535* 标签已存在
537 plugin validate539 plugin validate
538</h3>540</h3>
539 541
540验证 plugin 清单、市场清单或目录中的 skills、agents 和命令,并以 CI 作业可以操作的代码退出。对于创建、测试和编辑工作流,请参阅 [创建 plugin](/docs/zh-CN/plugins/create)。对于验证器在每个清单中检查的内容,请参阅 [plugin 清单参考](/docs/zh-CN/plugins/manifest-reference) 和 [市场参考](/docs/zh-CN/plugins/marketplace-reference)。542验证插件清单、市场清单或目录中的 skills、agents 和命令,并以 CI 作业可以操作的代码退出。对于创建、测试和编辑工作流,请参阅 [创建插件](/docs/zh-CN/plugins/create)。对于验证器在每个清单中检查的内容,请参阅 [插件清单参考](/docs/zh-CN/plugins/manifest-reference) 和 [市场参考](/docs/zh-CN/plugins/marketplace-reference)。
541 543
542```bash theme={null}544```bash theme={null}
543claude plugin validate <path> [options]545claude plugin validate <path> [options]
545 547
546| 标志 | 描述 |548| 标志 | 描述 |
547| :- | :- |549| :- | :- |
548| `--strict` | 将警告视为错误,因此运行时容忍的未识别字段和缺失元数据失败。需要 Claude Code v2.1.145 或更高版本 |550| `--strict` | 将警告视为错误,所以运行时容忍的未识别字段和缺失元数据失败。需要 Claude Code v2.1.145 或更高版本 |
549| `--json` | 将验证报告输出为一个 JSON 对象,具有相同的退出代码。需要 Claude Code v2.1.259 或更高版本 |551| `--json` | 将验证报告输出为一个 JSON 对象,具有相同的退出代码。需要 Claude Code v2.1.259 或更高版本 |
550 552
551在提交前验证 plugin:553在提交前验证插件:
552 554
553```bash theme={null}555```bash theme={null}
554claude plugin validate ./my-plugin --strict556claude plugin validate ./my-plugin --strict
567 * 名为 `.claude` 的目录:其中的 `skills`、`agents` 和 `commands` 目录569 * 名为 `.claude` 的目录:其中的 `skills`、`agents` 和 `commands` 目录
568 * 任何其他目录:其 `.claude` 下的这三个目录570 * 任何其他目录:其 `.claude` 下的这三个目录
569 571
570Claude Code 不跟随您命名的目录内的符号链接。它的作用取决于链接的位置:572Claude Code 不跟随你命名的目录内的符号链接。它的作用取决于链接的位置:
571 573
572* **plugin 或 `.claude` 根下的链接 `skills`、`agents` 或 `commands` 目录**:Claude Code 警告其中的任何内容都未被读取。574* **插件或 `.claude` 根下的链接 `skills`、`agents` 或 `commands` 目录**:Claude Code 警告其中的任何内容都未被读取。
573* **`skills`、`agents` 或 `commands` 目录内的链接条目**:Claude Code 跳过它并警告,每个目录,它跳过了多少条目,会话会加载。575* **`skills`、`agents` 或 `commands` 目录内的链接条目**:Claude Code 跳过它并警告,每个目录,它跳过了多少条目,会话会加载。
574* **您命名的 `skills`、`agents` 或 `commands` 目录本身是符号链接,或其父 `.claude` 目录是**:Claude Code 报告错误并检查其中的任何内容。改为命名真实目录。576* **你命名的 `skills`、`agents` 或 `commands` 目录本身是符号链接,或其父 `.claude` 目录是**:Claude Code 报告错误并检查其中的任何内容。改为命名真实目录。
575 577
576验证运行不读取几个文件:578少数文件不被验证运行读取:
577 579
578* **plugin 根处的 `SKILL.md`**:当您针对 plugin 目录运行 `claude plugin validate` 时,Claude Code 不检查 plugin 根处的 `SKILL.md`580* **插件根处的 `SKILL.md`**:当你针对插件目录运行 `claude plugin validate` 时,Claude Code 不检查插件根处的 `SKILL.md`
579* **plugin 根处的 `CLAUDE.md`**:在 plugin 运行中,Claude Code 也警告 plugin 根处的 `CLAUDE.md`581* **插件根处的 `CLAUDE.md`**:在插件运行中,Claude Code 也警告插件根处的 `CLAUDE.md`
580* **市场运行中的 Plugin 文件**:从市场目录,Claude Code 不打开 plugins 的 skill、agent、command 或 hook 文件。要在这些文件中查找错误,验证每个 plugin 目录582* **市场运行中的插件文件**:从市场目录,Claude Code 不打开插件的 skill、agent、command 或 hook 文件,或它们捆绑的 MCP 服务器文件。要在这些文件中找到错误,验证每个插件目录
581 583
582<h4 id="output-and-exit-codes">584<h4 id="output-and-exit-codes">
583 输出和退出代码585 输出和退出代码
587 589
588| 退出代码 | 判决行 | 含义 |590| 退出代码 | 判决行 | 含义 |
589| :- | :- | :- |591| :- | :- | :- |
590| `0` | `Validation passed` 或 `Validation passed with warnings` | 清单加载。使用 `--strict`,也没有警告 |592| `0` | `Validation passed` 或 `Validation passed with warnings` | 清单加载。使用 `--strict` 时,也没有警告 |
591| `1` | `Validation failed` 或 `Validation failed (--strict treats warnings as errors)` | 错误,或 `--strict` 下的警告 |593| `1` | `Validation failed` 或 `Validation failed (--strict treats warnings as errors)` | 错误,或 `--strict` 下的警告 |
592| `2` | `Unexpected error during validation: <reason>` | 验证器本身失败,例如在不可读的路径上 |594| `2` | `Unexpected error during validation: <reason>` | 验证器本身失败,例如在不可读的路径上 |
593 595
594使用 `--json`,Claude Code 将报告作为一个 JSON 对象写入 stdout,具有这些顶级字段:596使用 `--json` 时,Claude Code 将报告作为一个 JSON 对象写入 stdout,具有这些顶级字段:
595 597
596* `success`:退出代码给出的相同判决598* `success`:退出代码给出的相同判决
597* `strict`:运行是否将警告视为错误599* `strict`:运行是否将警告视为错误
598* `target`:Claude Code 验证的解析路径600* `target`:Claude Code 验证的解析路径
599* `manifest`:清单自己的结果,或没有清单的运行为 `null`601* `manifest`:清单自己的结果,或对没有清单的运行为 `null`
600* `contents`:每个文件的结果,命名其 `file` 并携带 `errors`、`warnings` 和 `notes` 数组602* `contents`:每个文件的结果,命名其 `file` 并携带 `errors`、`warnings` 和 `notes` 数组
601 603
602在退出 `2` 时,命令不向 stdout 写入任何内容。错误消息转到 stderr。604在退出 `2` 时,命令不向 stdout 写入任何内容。错误消息转到 stderr。
636| :- | :- | :- |638| :- | :- | :- |
637| `owner/repo`、`owner/repo#ref` 或 `owner/repo@ref` | `github` | 克隆 GitHub 仓库,给定时固定到 `ref`。所有者和仓库必须遵循 GitHub 命名规则 |639| `owner/repo`、`owner/repo#ref` 或 `owner/repo@ref` | `github` | 克隆 GitHub 仓库,给定时固定到 `ref`。所有者和仓库必须遵循 GitHub 命名规则 |
638| `user@host:path[.git][#ref]` | `git` | 通过 SSH 克隆 |640| `user@host:path[.git][#ref]` | `git` | 通过 SSH 克隆 |
639| `https://example.com/repo.git[#ref]` 或包含 `/_git/` 的 URL | `git` | 通过 HTTPS 克隆,包括 Azure DevOps URL |641| 以 `.git[#ref]` 结尾或包含 `/_git/` 的 `http://` 或 `https://` URL,例如 `https://example.com/repo.git` | `git` | 克隆 URL,包括 Azure DevOps URL |
640| `https://github.com/owner/repo` 或 `https://gitlab.com/namespace/project` | `git` | 在追加 `.git` 后通过 HTTPS 克隆 |642| `https://github.com/owner/repo` 或 `https://gitlab.com/namespace/project`,或相同的 `http://` 形式 | `git` | 在追加 `.git` 后克隆 URL |
641| 任何其他 `http://` 或 `https://` URL,包括没有 `.git` 的自托管 git 主机 | `url` | 将 URL 作为 `marketplace.json` 获取。要改为克隆那里的仓库,请追加 `.git` |643| 任何其他 `http://` 或 `https://` URL,包括没有 `.git` 的自托管 git 主机 | `url` | 将 URL 作为 `marketplace.json` 获取。要改为克隆那里的仓库,请追加 `.git` |
642| `./path`、`../path`、`/path` 或 `~/path` 到目录 | `directory` | 就地读取目录。在 Windows 上,`.\`、`..\` 和 `C:\` 形式也可以工作 |644| `./path`、`../path`、`/path` 或 `~/path` 到目录 | `directory` | 就地读取目录。在 Windows 上,`.\`、`..\` 和 `C:\` 形式也可以工作 |
643| 相同的路径形式,到 `.json` 文件 | `file` | 就地读取文件 |645| 相同的路径形式,到 `.json` 文件 | `file` | 就地读取文件 |
709从你的设置中移除市场的声明。`rm` 是 `remove` 的别名。711从你的设置中移除市场的声明。`rm` 是 `remove` 的别名。
710 712
711<Warning>713<Warning>
712 当你从最后一个声明市场的作用域中移除市场时,Claude Code 也会删除其缓存并卸载你从中安装的每个插件。不使用 `--scope` 时,命令从每个作用域中移除声明。要在不丢失其插件的情况下刷新市场,请改为运行 `plugin marketplace update`。714 当你从最后一个声明市场的作用域中移除市场时,Claude Code 也会删除其缓存并卸载你从中安装的每个插件。它也会删除它们保存的[选项和密钥](/docs/zh-CN/plugins/manifest-reference#user-configuration)和[数据](/docs/zh-CN/plugins/components#path-variables-and-persistent-data)(如果可以的话)。
715
716 要在不丢失其插件的情况下刷新市场,请改为运行 `plugin marketplace update`。
713</Warning>717</Warning>
714 718
715```bash theme={null}719```bash theme={null}
728claude plugin marketplace remove your-marketplace732claude plugin marketplace remove your-marketplace
729```733```
730 734
731Claude Code 打印 `Successfully removed marketplace: your-marketplace`,当你限定作用域时添加 `(from project settings)`。如果你限定作用域到不声明市场的设置文件,命令失败,显示 `Marketplace 'your-marketplace' is not declared in project settings. Omit --scope to remove it from all scopes.`735Claude Code 打印 `Successfully removed marketplace: your-marketplace`。当命令卸载插件时,输出在诸如 `Also uninstalled 2 plugins from this marketplace:` 的行下列出它们。要再次使用其中一个,请添加市场并重新安装插件。
736
737如果你限定作用域到不声明市场的设置文件,命令失败,显示 `Marketplace 'your-marketplace' is not declared in project settings. Omit --scope to remove it from all scopes.`
732 738
733<h3 id="plugin-marketplace-update">739<h3 id="plugin-marketplace-update">
734 plugin marketplace update740 plugin marketplace update
771| `/plugin list [--enabled\|--disabled]` | `ls` | 内联打印您的市场安装 plugins,带有版本、作用域和状态。过滤标志仅显示该状态。启用状态尚未应用的 plugin 标记为 `— run /reload-plugins to apply`。需要 Claude Code v2.1.163 或更高版本 |777| `/plugin list [--enabled\|--disabled]` | `ls` | 内联打印您的市场安装 plugins,带有版本、作用域和状态。过滤标志仅显示该状态。启用状态尚未应用的 plugin 标记为 `— run /reload-plugins to apply`。需要 Claude Code v2.1.163 或更高版本 |
772| `/plugin install` | `i` | 打开 **Discover** 选项卡 |778| `/plugin install` | `i` | 打开 **Discover** 选项卡 |
773| `/plugin install <plugin>` | `i` | 在 **Discover** 选项卡中打开 plugin 的详细信息。使用 `name@marketplace`,在该市场的列表中打开它们 |779| `/plugin install <plugin>` | `i` | 在 **Discover** 选项卡中打开 plugin 的详细信息。使用 `name@marketplace`,在该市场的列表中打开它们 |
780| `/plugin install <source>` | `i` | 当目标是路径、URL 或 `owner/repo` 时报告 [marketplace not found](/docs/zh-CN/plugins/troubleshooting#marketplace-not-found) 错误并不安装任何内容,即使是您已经添加的源。要从源安装,请参阅 [在一个命令中添加市场和安装](/docs/zh-CN/plugins/install#add-a-marketplace-and-install-in-one-command) |
774| `/plugin install <plugin> --marketplace <source>` | `i` | 当您尚未添加时添加 `<source>` 处的市场,要求您首先确认,然后打开 plugin 的详细信息。请参阅 [在一个命令中添加市场和安装](/docs/zh-CN/plugins/install#add-a-marketplace-and-install-in-one-command)。需要 Claude Code v2.1.275 或更高版本 |781| `/plugin install <plugin> --marketplace <source>` | `i` | 当您尚未添加时添加 `<source>` 处的市场,要求您首先确认,然后打开 plugin 的详细信息。请参阅 [在一个命令中添加市场和安装](/docs/zh-CN/plugins/install#add-a-marketplace-and-install-in-one-command)。需要 Claude Code v2.1.275 或更高版本 |
775| `/plugin manage` | | 打开 **Installed** 选项卡 |782| `/plugin manage` | | 打开 **Installed** 选项卡 |
776| `/plugin stats` | | 打开 **Stats** 选项卡,在 [`/skill-doctor`](/docs/zh-CN/skills#find-unused-skills) 可用的会话中。其他任何地方它在 **Discover** 选项卡上打开面板 |783| `/plugin stats` | | 打开 **Stats** 选项卡,在 [`/skill-doctor`](/docs/zh-CN/skills#find-unused-skills) 可用的会话中。其他任何地方它在 **Discover** 选项卡上打开面板 |
843| `--plugin-dir <path>` | 从目录或其 `.zip` 存档加载 plugin。plugins 的文件夹加载每个包含 `.claude-plugin/plugin.json` 的子文件夹。每个标志接受一个路径 | `claude --plugin-dir ./my-plugin --plugin-dir ./other.zip` |850| `--plugin-dir <path>` | 从目录或其 `.zip` 存档加载 plugin。plugins 的文件夹加载每个包含 `.claude-plugin/plugin.json` 的子文件夹。每个标志接受一个路径 | `claude --plugin-dir ./my-plugin --plugin-dir ./other.zip` |
844| `--plugin-url <url>` | 从 URL 获取 plugin `.zip` 存档。重复标志,或在一个引用值中传递多个 URL 空格分隔 | `claude --plugin-url "https://example.com/a.zip https://example.com/b.zip"` |851| `--plugin-url <url>` | 从 URL 获取 plugin `.zip` 存档。重复标志,或在一个引用值中传递多个 URL 空格分隔 | `claude --plugin-url "https://example.com/a.zip https://example.com/b.zip"` |
845 852
846任一标志加载的 plugin 是会话内 plugin。`claude plugin list` 将其显示为 `<name>@inline`,作用域为 `session`,但仅当相同的标志在子命令前时。例如,运行 `claude --plugin-dir ./my-plugin plugin list`。853任一标志加载的 plugin 是会话内 plugin。[`claude plugin list`](#plugin-list) 将其显示为 `<name>@inline`,作用域为 `session`,但仅当相同的标志在子命令前时,例如 `claude --plugin-dir ./my-plugin plugin list`。该 plugin 在以 `Session-only plugins` 开头的标题下显示为 `<name>@inline`,`--json` 将其 `scope` 报告为 `session`。
847 854
848当会话内 plugin 与已安装的 plugin 共享名称时,Claude Code 为该会话加载会话内副本并跳过已安装的副本。如果您使用 `claude plugin disable <name>@inline` 禁用了会话内副本,或托管设置锁定该 plugin 名称,已安装的副本改为加载。有关优先级,请参阅 [Plugin 加载参考](/docs/zh-CN/plugins/loading)。855当会话内 plugin 与已安装的 plugin 共享名称时,Claude Code 为该会话加载会话内副本并跳过已安装的副本。如果您使用 `claude plugin disable <name>@inline` 禁用了会话内副本,或托管设置锁定该 plugin 名称,已安装的副本改为加载。有关优先级,请参阅 [Plugin 加载参考](/docs/zh-CN/plugins/loading)。
849 856