Files
herdr-issue/README.md
T

214 lines
9.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# herdr-issue — 用 Herdr 驅動 Gitea 議題
一個可同時被 **Claude Code、Codex、Antigravity、OpenCode、GitHub Copilot** 安裝的 plugin 模板。
核心是以 [Agent Skills(`SKILL.md`)](https://agentskills.io) 標準撰寫的共用 skills(唯一真實來源放在 `skills/`),
搭配各助理各自的 plugin manifest,讓**同一個 repo** 可用各家**原生 plugin CLI** 安裝。
在 Claude Code 與 Antigravity 中,skill 以 **`/herdr-issue:` 前綴**呼叫(例如 `/herdr-issue:herdr-issue`)。
---
## 前綴與呼叫方式
| 助理 | 安裝方式 | 呼叫 | `/herdr-issue:` 前綴 |
| --- | --- | --- | --- |
| Claude Code | `claude plugin`(marketplace) | `/herdr-issue:<name>` 或自動觸發 | ✅ |
| Codex | `codex plugin`(marketplace) | `$<name>` 或 `/skills` 選單 | ❌(用 `$name`) |
| Antigravity | `agy plugin install` | `/herdr-issue:<name>` 或自動觸發 | ✅ |
| OpenCode | skills 目錄(複製/clone) | 描述需求自動觸發 | ❌(依名稱) |
| GitHub Copilot CLI | `copilot plugin`(marketplace) | 自然語言或 plugin skills | ❌(無 `/herdr-issue:` 前綴) |
> Codex 不支援自訂前綴(skill 以 `$name` 呼叫);OpenCode 由模型依描述自動呼叫;Copilot CLI 透過原生 plugin 安裝後以自然語言或 plugin skills 使用。三者皆**不強制**前綴。
---
## 目錄結構
同一個 repo 同時帶四種 manifest,彼此以路徑隔離、互不干擾;各助理都讀同一份 `skills/`。
```
herdr-issue/
├── .claude-plugin/
│ ├── plugin.json # Claude 外掛定義(name: "herdr-issue")
│ └── marketplace.json # Claude marketplace(name: "herdr-issue",source 指向本 repo)
├── .codex-plugin/
│ └── plugin.json # Codex 外掛定義(name: "herdr-issue",skills: "./skills")
├── .agents/plugins/
│ └── marketplace.json # Codex marketplace(name: "herdr-issue",url source 指向本 repo)
├── plugin.json # Antigravity 外掛定義(name: "herdr-issue",skills: "./skills/")
├── skills/ # ★ 唯一真實來源:所有 skills
│ └── herdr-issue/SKILL.md
├── AGENTS.md # 跨助理共用指引
└── README.md
```
---
## 安裝 / 更新 / 移除(各助理)
> 指令中的 repo 網址換成你的:`https://gitea.jsc.idv.tw/plugins/herdr-issue.git`
>
> **Claude / Codex 從 git URL 安裝(會 clone 遠端),請先把本 repo `push` 到 gitea。**
> **Antigravity 的 `agy plugin install <url>` 目前只支援 github.com**;gitea 請改用「clone + 本地路徑」(見 Antigravity 節)。
> 本機/離線:Claude 可用本地路徑加 marketplace;Antigravity 用本地路徑安裝。
### Claude Code
```bash
# 安裝
claude plugin marketplace add https://gitea.jsc.idv.tw/plugins/herdr-issue.git
claude plugin install herdr-issue@herdr-issue
# 更新
claude plugin marketplace update herdr-issue
claude plugin update herdr-issue@herdr-issue
# 移除
claude plugin uninstall herdr-issue@herdr-issue
claude plugin marketplace remove herdr-issue
```
- 工作階段內 slash 版(等價):把 `claude plugin` 換成 `/plugin`。
- 本機開發(免 push):`claude plugin marketplace add <本地路徑>` 後再 install。
- **呼叫**:`/herdr-issue:<name>`(例 `/herdr-issue:herdr-issue`)。
### Codex
```bash
# 安裝
codex plugin marketplace add https://gitea.jsc.idv.tw/plugins/herdr-issue.git
codex plugin add herdr-issue@herdr-issue
# 更新(重新抓取 marketplace 的 git 快照)
codex plugin marketplace upgrade herdr-issue
# 移除
codex plugin remove herdr-issue@herdr-issue
codex plugin marketplace remove herdr-issue
```
- 安裝 token `herdr-issue@herdr-issue` = plugin 名(`.codex-plugin/plugin.json` 的 `name`)@ marketplace 名(`.agents/plugins/marketplace.json` 的 `name`)。
- 本 repo 的 Codex marketplace 以 `url` 來源指向自己,故 Codex **一律從 gitea 安裝**(需先 push);安裝後重啟 Codex。
- **呼叫**:`$<name>`(例 `$herdr-issue`),或用 `/skills` 選單。
### Antigravity(`agy`)
> `agy plugin install <url>` 目前**只支援 github.com**;gitea 等自架 git 不支援 URL 安裝,請先 `git clone` 再用**本地路徑**安裝。
```bash
# 安裝:clone 後用本地路徑
git clone https://gitea.jsc.idv.tw/plugins/herdr-issue.git ~/plugins/herdr-issue
agy plugin install ~/plugins/herdr-issue
# 更新(agy 無 update 子指令 → git pull 後重裝)
git -C ~/plugins/herdr-issue pull
agy plugin uninstall herdr-issue
agy plugin install ~/plugins/herdr-issue
# 移除
agy plugin uninstall herdr-issue
```
- 若把 skills 放到 GitHub,則可直接 `agy plugin install https://github.com/<owner>/<repo>`。
- 其他:`agy plugin list`、`agy plugin enable herdr-issue` / `disable herdr-issue`、`agy plugin validate <path>`。安裝後重啟工作階段。
- **呼叫**:`/herdr-issue:<name>`(例 `/herdr-issue:herdr-issue`)或依描述自動觸發。
### OpenCode
OpenCode 的「plugin」是 TypeScript/npm 套件,不適用於 skill 包;skills 改用**目錄安裝**。
OpenCode 會讀 `~/.config/opencode/skills/`(也會讀 `~/.claude/skills/`、`~/.agents/skills/`)。
```bash
# 安裝
git clone https://gitea.jsc.idv.tw/plugins/herdr-issue.git ~/plugins/herdr-issue
mkdir -p ~/.config/opencode/skills
cp -r ~/plugins/herdr-issue/skills/* ~/.config/opencode/skills/
# 更新
git -C ~/plugins/herdr-issue pull
cp -r ~/plugins/herdr-issue/skills/* ~/.config/opencode/skills/
# 移除
rm -rf ~/.config/opencode/skills/herdr-issue
```
> **Windows PowerShell**:`cp -r A B` → `Copy-Item A B -Recurse -Force`、`rm -rf X` → `Remove-Item X -Recurse -Force`、`~` → `$HOME`。
- **呼叫**:直接描述需求,模型會依 skill 描述自動透過 skill 工具呼叫。
### GitHub Copilot CLI
Copilot CLI 支援與 Claude Code 類似的原生 plugin / marketplace 指令,可直接從 marketplace 安裝、更新與移除本 plugin。
```bash
# 安裝
copilot plugin marketplace add https://gitea.jsc.idv.tw/plugins/herdr-issue.git
copilot plugin install herdr-issue@herdr-issue
# 更新
copilot plugin marketplace update herdr-issue
copilot plugin update herdr-issue@herdr-issue
# 移除
copilot plugin uninstall herdr-issue@herdr-issue
copilot plugin marketplace remove herdr-issue
```
- 安裝 token `herdr-issue@herdr-issue` = plugin 名(plugin manifest 的 `name`)@ marketplace 名。
- `copilot plugin marketplace add` 支援 GitHub `owner/repo`、git URL 與本地路徑;Gitea repo 可用上方 HTTPS URL。
- **呼叫**:在 Copilot CLI 中用自然語言描述需求,例如 `copilot -i "跑 herdr-issue 確認 plugin 裝好了"`。
---
## 用 CLI 直接執行 skill(headless / 一次性)
安裝好之後,不必進互動介面,一行指令就能叫某個 skill 跑完並印出結果:
| 助理 | headless 指令 | 執行 `herdr-issue` skill |
| --- | --- | --- |
| Claude Code | `claude -p "<prompt>"` | `claude -p "/herdr-issue:herdr-issue"` |
| Codex | `codex exec "<prompt>"` | `codex exec '$herdr-issue'` |
| Antigravity | `agy -p "<prompt>"` | `agy -p "/herdr-issue:herdr-issue"` |
| OpenCode | `opencode run "<message>"` | `opencode run "用 herdr-issue skill 打個招呼"` |
| GitHub Copilot CLI | `copilot -p "<message>"` | `copilot -p "用 herdr-issue skill 打個招呼"` |
- Claude / Antigravity 支援 `/herdr-issue:` 前綴,直接 `-p "/herdr-issue:<name>"` 即可。
- Codex 以 `$<name>` 觸發;在 shell 請用**單引號**避免 `$` 被展開:`codex exec '$herdr-issue'`。
- OpenCode 與 Copilot 沒有前綴,用自然語言描述需求;Copilot CLI 會讀取已安裝 plugin 提供的 skills。
- 帶引數就接在後面,例如 `claude -p "/herdr-issue:herdr-issue 參數"`、`codex exec '$herdr-issue 參數'`。
---
## Skills 目錄
> 此區塊列出本 plugin 內含的所有 skills(名稱/描述/使用方法)。
> 新增或修改 skill 後,請同步手動更新標記之間的內容。
<!-- JSC-SKILLS:START -->
### `herdr-issue`
透過 Herdr 讓 Claude agent 逐一實作 Gitea 議題:每個議題一個 worktree 與 tab,監看到議題關閉後清理,並推薦下一批可執行的議題。僅在使用者執行 `/herdr-issue` 或明確要求以 Herdr 驅動 Gitea 議題/repo 連結時觸發。需在 Herdr 內(`HERDR_ENV=1`)執行。
- **Claude Code**:`/herdr-issue:herdr-issue <議題或 repo 連結>`
- **skills CLI**:`npx skills add https://gitea.jsc.idv.tw/plugins/herdr-issue.git --skill herdr-issue -g`,之後 `/herdr-issue <連結>`
<!-- JSC-SKILLS:END -->
---
## 新增一個 skill
1. 複製範本:`cp -r skills/herdr-issue skills/<your-skill-name>`
2. 編輯 `skills/<your-skill-name>/SKILL.md` 的 frontmatter:
- `name`:小寫、數字、連字號(`-`),最長 64 字元。**這就是 Claude Code / Antigravity 的 `/herdr-issue:<name>`**。
- `description`:第三人稱,寫清楚「何時用、何時不用」與觸發關鍵字 — 這是各助理自動載入的唯一依據。
3. 在內文寫下 skill 的具體步驟。
4. 手動把這個 skill 補進上方「Skills 目錄」區塊。
5. **bump 版本並 push**:各助理都以 git 內容/版本判斷更新,請把 `.claude-plugin/plugin.json`、`.codex-plugin/plugin.json`、`plugin.json` 三個 manifest 的 `version` 一起 bump,commit 後 push 到 gitea。
6. 讓各助理更新:
- Claude:`claude plugin update herdr-issue@herdr-issue`
- Codex:`codex plugin marketplace upgrade herdr-issue`
- Antigravity:`git -C ~/jsc-plugin pull && agy plugin uninstall herdr-issue && agy plugin install ~/jsc-plugin`
- OpenCode:`git pull` 後重新複製 `skills/`
- Copilot:`copilot plugin marketplace update herdr-issue && copilot plugin update herdr-issue@herdr-issue`