ข้ามไปยังเนื้อหา

ระบบ Marketplace Plugin

ระบบตลาดกลางช่วยให้คุณค้นหา ติดตั้ง และจัดการปลั๊กอินจากแคตตาล็อกที่โฮสต์บน Git ระบบนี้รองรับรูปแบบรีจิสทรีปลั๊กอินของ Claude Code

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

หรือพิมพ์เพียง /marketplace โดยไม่มีอาร์กิวเมนต์เพื่อเปิดเบราว์เซอร์ปลั๊กอินแบบโต้ตอบ

ตลาดกลาง คือ Git repository (หรือไดเรกทอรีในเครื่อง) ที่มีไฟล์แคตตาล็อกอยู่ที่ .xcsh-plugin/marketplace.json แคตตาล็อกจะแสดงรายการปลั๊กอินที่มีอยู่พร้อมแหล่งที่มา คำอธิบาย และข้อมูลเมตาดาตา

ปลั๊กอิน คือไดเรกทอรีที่บรรจุ skills, commands, hooks, MCP servers หรือ LSP servers ปลั๊กอินถูกระบุด้วย name@marketplace (เช่น code-review@f5-sales-demo-marketplace)

ขอบเขต: ปลั๊กอินสามารถติดตั้งได้สองขอบเขต:

  • user (ค่าเริ่มต้น) — ใช้งานได้ในทุกโปรเจกต์ เก็บไว้ที่ ~/.xcsh/plugins/installed_plugins.json
  • project — ใช้งานได้เฉพาะในโปรเจกต์ปัจจุบัน เก็บไว้ที่ .xcsh/installed_plugins.json

การติดตั้งในขอบเขต project จะบดบังการติดตั้งในขอบเขต user สำหรับปลั๊กอินชื่อเดียวกัน

คำสั่งผลลัพธ์
/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]อัปเกรดปลั๊กอินหนึ่งหรือทั้งหมด

การดำเนินการเดียวกันนี้สามารถใช้ได้จาก command line:

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 shorthandanthropics/f5-sales-demo-marketplace
https://...*.jsonURL แคตตาล็อกโดยตรงhttps://example.com/marketplace.json
https://...*.git หรือ git@...Git repositoryhttps://github.com/org/repo.git
./path หรือ ~/path หรือ /pathไดเรกทอรีในเครื่อง./my-marketplace

ระบบจะโคลน repository (หรืออ่านไดเรกทอรีในเครื่อง) ระบุตำแหน่ง .xcsh-plugin/marketplace.json ตรวจสอบความถูกต้อง และแคชแคตตาล็อกไว้ในเครื่อง

แคตตาล็อกของตลาดกลางอยู่ที่ .xcsh-plugin/marketplace.json ในโฟลเดอร์ root ของ repository:

{
"$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? }
homepageไม่URL
categoryไม่สตริงหมวดหมู่ (เช่น development, productivity, security)
tagsไม่อาร์เรย์ของแท็กสตริง
strictไม่Boolean
commandsไม่คำสั่ง slash ที่ให้บริการ
agentsไม่Agents ที่ให้บริการ
hooksไม่นิยาม hook
mcpServersไม่นิยาม MCP server
lspServersไม่นิยาม LSP server

ฟิลด์ source รองรับหลายรูปแบบ:

Relative path (ภายใน marketplace repo):

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

Git repository URL:

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

GitHub shorthand:

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

Git subdirectory (monorepo):

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

npm package:

"source": {
"source": "npm",
"package": "@scope/my-plugin",
"version": "1.0.0"
}
~/.xcsh/
config/
marketplaces.json # Registry ของตลาดกลางที่เพิ่มไว้
plugins/
installed_plugins.json # ปลั๊กอินที่ติดตั้งในขอบเขต user
cache/
marketplaces/ # แคชแคตตาล็อกตลาดกลาง
plugins/ # แคชไดเรกทอรีปลั๊กอิน
<project>/.xcsh/
installed_plugins.json # ปลั๊กอินที่ติดตั้งในขอบเขต project

ชื่อตลาดกลางและปลั๊กอินต้อง:

  • เริ่มและจบด้วยตัวอักษรพิมพ์เล็กหรือตัวเลข
  • ประกอบด้วยตัวอักษรพิมพ์เล็ก ตัวเลข เครื่องหมายขีดกลาง และจุดเท่านั้น
  • มีความยาวไม่เกิน 64 ตัวอักษร

Plugin ID (name@marketplace) ต้องมีความยาวรวมไม่เกิน 128 ตัวอักษร

ตัวอย่างที่ถูกต้อง: my-plugin, code-review, wordpress.com, ai-firstify ตัวอย่างที่ไม่ถูกต้อง: -bad, bad-, .bad, Bad, under_score