{"meta":{"title":"查找并安装插件适用于GitHub Copilot CLI","intro":"通过安装社区或团队创建的插件来扩展 Copilot功能。","product":"GitHub Copilot","breadcrumbs":[{"href":"/zh/copilot","title":"GitHub Copilot"},{"href":"/zh/copilot/how-tos","title":"操作方法"},{"href":"/zh/copilot/how-tos/copilot-cli","title":"Copilot CLI"},{"href":"/zh/copilot/how-tos/copilot-cli/customize-copilot","title":"自定义 Copilot CLI"},{"href":"/zh/copilot/how-tos/copilot-cli/customize-copilot/plugins-finding-installing","title":"插件：查找并安装"}],"documentType":"article"},"body":"# 查找并安装插件适用于GitHub Copilot CLI\n\n通过安装社区或团队创建的插件来扩展 Copilot功能。\n\n## 介绍\n\n插件是用于扩展Copilot CLI功能的包。 可以从您已通过 CLI 注册的市场中安装插件。\n\n有关详细信息，请参阅“[关于 GitHub Copilot 插件](/zh/copilot/concepts/agents/about-plugins)”。\n\n> \\[!NOTE]\n> 可以通过在终端中输入 `copilot plugin [SUBCOMMAND] --help` 来查找有关使用插件的帮助。\n\n## 查找插件\n\n插件在市场中收集在一起。 市场是可从中浏览和安装的插件的注册表。 可以将市场添加到 CLI 配置，这样就可以使用 CLI 从该市场浏览和安装插件，请参阅 [“添加插件市场](#adding-plugin-marketplaces)”。\nCopilot 默认注册了两个市场平台：`copilot-plugins` 和 `awesome-copilot`。\n\n若要使用 CLI 浏览其中一个已注册市场中的插件，\n\n1. **检查当前已注册哪些市场平台。**\n\n   在终端中，输入以下内容列出可用的市场：\n\n   ```shell copy\n   copilot plugin marketplace list\n   ```\n\n   或者，在交互式会话中，输入：\n\n   ```copilot copy\n   /plugin marketplace list\n   ```\n\n2. **浏览已注册市场中的插件。**\n\n   从已注册的市场列表中，复制要浏览的市场的名称（例如， `awesome-copilot`），然后输入以下命令，替换 `MARKETPLACE-NAME`：\n\n   ```shell copy\n   copilot plugin marketplace browse MARKETPLACE-NAME\n\n   ```\n\n## 安装插件\n\n可以从已注册的市场安装插件。 有关如何注册其他市场的信息，请参阅 [“添加插件市场](#adding-plugin-marketplaces)”。\n\n若要安装插件，请输入：\n\n```shell copy\ncopilot plugin install PLUGIN-NAME@MARKETPLACE-NAME\n```\n\n例如，若要从 `database-data-management` 市场安装 `awesome-copilot` 插件，请输入：\n\n```shell copy\ncopilot plugin install database-data-management@awesome-copilot\n```\n\n或者，在交互式会话中，输入：\n\n```copilot copy\n/plugin install PLUGIN-NAME@MARKETPLACE-NAME\n```\n\n## 管理已安装的插件\n\n```bash\ncopilot plugin list                    # View installed plugins\ncopilot plugin update PLUGIN-NAME      # Update plugin to latest version\ncopilot plugin uninstall PLUGIN-NAME   # Remove plugin completely\n```\n\n## 添加插件市场\n\n若要将市场添加到已注册市场列表，请在终端中输入以下命令：\n\n```shell copy\ncopilot plugin marketplace add OWNER/REPO\n```\n\n其中 OWNER/REPO 标识 GitHub.com 上已配置为 CLI 插件市场的存储库。\n\n例如，要添加托管在 `claude-code-plugins` 的 <https://github.com/anthropics/claude-code> 市场，请输入：\n\n```shell copy\ncopilot plugin marketplace add anthropics/claude-code\n```\n\n或者，在交互式会话中，输入：\n\n```copilot copy\n/plugin marketplace add OWNER/REPO\n```\n\n如果市场位于本地文件系统而非 GitHub.com 上，请使用市场目录路径而非 OWNER/REPO。 例如：\n\n```shell copy\ncopilot plugin marketplace add /PATH/TO/MARKETPLACE-DIRECTORY\n```\n\n如果市场平台所在的 Git 存储库未托管在GitHub.com上，请使用 Git 存储库的 URL。 例如：\n\n```shell copy\ncopilot plugin marketplace add https://gitlab.com/OWNER/REPO.git\n```\n\n## 删除插件市场\n\n若要从 CLI 中删除市场，请输入：\n\n```shell copy\ncopilot plugin marketplace remove MARKETPLACE-NAME\n```\n\n或者，在交互式会话中：\n\n```copilot copy\n/plugin marketplace remove MARKETPLACE-NAME\n```\n\n> \\[!NOTE]\n>\n> * 添加市场时，使用已配置为市场的 GitHub 存储库的 OWNER/REPO 引用该市场。 但是，在删除市场时，你会引用注册市场列表中显示的市场名称。\n> * 如果尝试删除已安装插件的市场，该命令将失败，并显示一条错误消息，其中列出了当前从该市场安装的插件。 将 `--force` 选项添加到命令以删除市场，并卸载从该市场安装的所有插件。\n\n## 延伸阅读\n\n* [为 GitHub Copilot CLI 创建插件](/zh/copilot/how-tos/copilot-cli/customize-copilot/plugins-creating)\n* [为 GitHub Copilot CLI 创建插件市场](/zh/copilot/how-tos/copilot-cli/customize-copilot/plugins-marketplace)"}