跳到內容

市集外掛系統

市集系統讓您可以從 Git 託管的目錄中探索、安裝和管理外掛。它與 Claude Code 外掛登錄格式相容。

/marketplace add anthropics/f5-sales-demo-marketplace
/marketplace install wordpress.com@f5-sales-demo-marketplace

或直接輸入不帶任何參數的 /marketplace,以開啟互動式外掛瀏覽器。

市集是一個 Git 儲存庫(或本地目錄),其中在 .xcsh-plugin/marketplace.json 位置包含一個目錄檔案。該目錄列出了可用的外掛及其來源、描述和中繼資料。

外掛是一個包含技能、命令、鉤子、MCP 伺服器或 LSP 伺服器的目錄。外掛以 name@marketplace 的方式識別(例如 code-review@f5-sales-demo-marketplace)。

範圍:外掛可以在兩種範圍下安裝:

  • user(預設)— 在所有專案中可用,儲存於 ~/.xcsh/plugins/installed_plugins.json
  • project — 僅在目前專案中可用,儲存於 .xcsh/installed_plugins.json

專案範圍的安裝會遮蔽同一外掛的使用者範圍安裝。

命令效果
/marketplace開啟互動式外掛瀏覽器(安裝)
命令效果
/marketplace add <source>新增市集來源
/marketplace remove <name>移除市集
/marketplace update [name]重新擷取目錄;省略名稱則更新全部
/marketplace list列出已設定的市集
命令效果
/marketplace discover [marketplace]瀏覽可用外掛
/marketplace install [--force] [--scope user|project] name@marketplace安裝外掛
/marketplace uninstall [--scope user|project] name@marketplace解除安裝外掛
/marketplace installed列出已安裝的市集外掛
/marketplace upgrade [--scope user|project] [name@marketplace]升級一個或所有外掛

相同的操作也可透過命令列執行:

xcsh plugin marketplace add <source>
xcsh plugin marketplace remove <name>
xcsh plugin marketplace update [name]
xcsh plugin marketplace list
xcsh plugin discover [marketplace]
xcsh plugin install --scope project name@marketplace

當您執行 /marketplace add <source> 時,系統會對來源進行分類:

來源格式類型範例
owner/repoGitHub 簡寫anthropics/f5-sales-demo-marketplace
https://...*.json直接目錄 URLhttps://example.com/marketplace.json
https://...*.gitgit@...Git 儲存庫https://github.com/org/repo.git
./path~/path/path本地目錄./my-marketplace

系統會複製儲存庫(或讀取本地目錄),定位 .xcsh-plugin/marketplace.json,進行驗證,並在本地快取目錄。

市集目錄位於儲存庫根目錄的 .xcsh-plugin/marketplace.json

{
"$schema": "https://anthropic.com/claude-code/marketplace.schema.json",
"name": "my-marketplace",
"owner": {
"name": "Your Name",
"email": "you@example.com"
},
"description": "A collection of plugins",
"plugins": [
{
"name": "my-plugin",
"description": "What this plugin does",
"source": "./plugins/my-plugin",
"category": "development",
"homepage": "https://github.com/you/my-plugin"
}
]
}
欄位描述
name市集名稱。小寫英數字元、連字號和點。必須以英數字元開頭和結尾。最多 64 個字元。
owner.name市集擁有者名稱
plugins外掛項目陣列
欄位必填描述
name外掛名稱(規則與市集名稱相同)
source外掛的所在位置(見下方)
description簡短描述
version版本字串
author{ name, email? }
homepageURL
category類別字串(例如 developmentproductivitysecurity
tags字串標籤陣列
strict布林值
commands提供的斜線命令
agents提供的代理程式
hooks鉤子定義
mcpServersMCP 伺服器定義
lspServersLSP 伺服器定義

source 欄位支援多種格式:

相對路徑(在市集儲存庫內):

"source": "./plugins/my-plugin"

Git 儲存庫 URL

"source": {
"source": "url",
"url": "https://github.com/org/repo.git",
"sha": "abc123..."
}

GitHub 簡寫

"source": {
"source": "github",
"repo": "org/repo",
"ref": "main",
"sha": "abc123..."
}

Git 子目錄(單一儲存庫):

"source": {
"source": "git-subdir",
"url": "https://github.com/org/monorepo.git",
"path": "plugins/my-plugin",
"ref": "main",
"sha": "abc123..."
}

npm 套件

"source": {
"source": "npm",
"package": "@scope/my-plugin",
"version": "1.0.0"
}
~/.xcsh/
config/
marketplaces.json # 已新增市集的登錄
plugins/
installed_plugins.json # 使用者範圍已安裝的外掛
cache/
marketplaces/ # 已快取的市集目錄
plugins/ # 已快取的外掛目錄
<project>/.xcsh/
installed_plugins.json # 專案範圍已安裝的外掛

市集和外掛名稱必須:

  • 以小寫字母或數字開頭和結尾
  • 僅包含小寫字母、數字、連字號和點
  • 最多 64 個字元

外掛 ID(name@marketplace)總長度最多 128 個字元。

有效範例:my-plugincode-reviewwordpress.comai-firstify 無效範例:-badbad-.badBadunder_score