Skip to content

Conversation

@linyiru
Copy link
Contributor

@linyiru linyiru commented Jan 22, 2026

Summary

根據官方文件,套用 marketplace.json 的最佳實踐:

改善項目

改善 說明
使用 pluginRoot 簡化 source 路徑,避免重複 ./plugins/
移除重複 metadata description, version, keywords 已在各 plugin.json 中定義
加入 category 方便分類與搜尋
移除 marketplace version 非必要欄位

Best Practice 原則

  1. DRY (Don't Repeat Yourself) - plugin.json 為 metadata 的唯一來源
  2. Single Source of Truth - 安裝時 marketplace entry 會與 plugin.json 合併
  3. 最小化 marketplace.json - 只保留必要的引用資訊

Before vs After

Before:

{
  "metadata": { "version": "2.1.0" },
  "plugins": [{
    "name": "newebpay",
    "source": "./plugins/newebpay",
    "description": "藍新金流...",
    "version": "2.1.0",
    "keywords": ["newebpay", ...]
  }]
}

After:

{
  "metadata": { "pluginRoot": "./plugins" },
  "plugins": [{
    "name": "newebpay",
    "source": "newebpay",
    "category": "payment"
  }]
}

Test plan

  • 驗證 marketplace 可正常載入
  • 確認 plugin 安裝後 metadata 正確合併

- Use pluginRoot to simplify source paths (DRY principle)
- Remove duplicate metadata (description, version, keywords)
  - Let plugin.json be the single source of truth
  - Marketplace entries merge with plugin.json at install time
- Add category field for better organization
- Remove marketplace-level version (not needed)
The `claude plugin validate` command requires source paths to start
with ./ even when using pluginRoot.
Automated validation on push and PR:
- JSON syntax validation for all config files
- Plugin structure validation (required files/directories)
- Add GitHub Actions validation badge to README
- Add MIT license badge
- Update description to list all supported gateways
@linyiru linyiru merged commit 48a09e7 into main Jan 22, 2026
2 checks passed
@linyiru linyiru deleted the improve/marketplace-best-practice branch January 22, 2026 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant