Files
tea-sdlc/README.md
T
jiantw83andClaude Opus 5 f37fe0bba7 feat(佈署): 以 npm 裝出 tea-sdlc 指令並產生各平台轉接檔
單一入口 bin/tea-sdlc.js 認四個子指令。第一個位置參數是子指令,其餘 argv 原樣
交出去——既有的 flag 解析拒絕位置參數,所以子指令必須在那之前就被取走。

轉接檔裡沒有路徑,只有一句 tea-sdlc prompt --name <指令名>。正本在哪由 PATH 上
的 tea-sdlc 自己回推:fnm 把 Node 版號寫進全域安裝路徑,寫死路徑的話升一次
Node,七個平台的轉接檔會同時指向不存在的檔案,而且不會有任何錯誤訊息。

prompt 是全專案唯一輸出非 JSON 的路徑,理由只有一個:它的輸出要餵給模型讀。
失敗仍走 envelope——成功是內容,失敗才需要結構。

status 的 ok 不兼差表達環境好壞,健康與否放在 data.healthy:呼叫端要分得出
「status 掛了」與「status 成功查到你環境有問題」。

install 只寫進偵測得到的平台;缺 git/tea 只警告不中止,因為那兩個完全不影響
轉接檔產生,硬擋等於逼使用者為了裝 plugin 先去裝 tea。uninstall 只刪帶產生標記
的檔案,使用者自己寫的同名檔案一律留著並在輸出裡交代。裝哪些指令以 prompts/ 裡
實際存在的正本為準,不是寫死的六個名字——裝出指向不存在正本的轉接檔,使用者只會
看到 PROMPT_NOT_FOUND。

流程正本的 description 前綴在抄進轉接檔之前就檢查:有三個平台關不掉自動觸發,
全靠那句話把 description 窄到不會被誤判,不能等使用者發現誤觸才知道漏了。

議題 #26 #27 #28 #29 #17

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 14:53:00 +08:00

244 lines
9.8 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.
# tea-sdlc
以 [tea](https://gitea.com/gitea/tea) 與 Gitea REST API 驅動 **SDLC 全流程**的跨平台指令組。
把規劃、分析、實作、修正、整併、工時回報六個階段,固定成可重複、可被任何 coding agent 執行的流程。
- **流程正本只有一份**:平台中立 markdown 放在 `prompts/`,改規則不會出現各平台版本分歧。
- **副作用集中**:所有對 Gitea 與 git 的呼叫下沉到 `scripts/` 的零相依 Node 腳本,統一 JSON 輸入輸出。
- **產出有固定形狀**:議題、PR、報表一律套 `templates/` 的模板。
> **目前仍在實作中。** 安裝、佈署與腳本已經可用,六個流程正本尚未到齊——
> `tea-sdlc install` 只會佈署 `prompts/` 裡已經存在的指令。
> 完整需求見[議題 #1](https://gitea.jsc.idv.tw/plugins/tea-sdlc/issues/1),進度見其底下的工作包。
---
## 六個指令
| 指令 | 做什麼 |
| --- | --- |
| `/sdlc-plan` | 把一段口語需求變成結構化的需求議題 |
| `/sdlc-analyze` | 逐題把可行性疑點問到共識,據以產出工作包 |
| `/sdlc-feat` | 領取工作包、開分支、逐項實作並開 PR |
| `/sdlc-fix` | 處理 PR 上的留言 |
| `/sdlc-sync` | 把散落在留言裡的決策整併回議題描述 |
| `/sdlc-report` | 產出週/月/年工時報表 |
---
## 目錄結構
```
tea-sdlc/
├── prompts/ # ★ 流程正本:六個指令的平台中立 markdown
├── scripts/ # 所有 Gitea / git 副作用的唯一出口(Node,零相依)
├── templates/ # 議題、PR、報表、總覽網頁的輸出模板
├── references/ # 規則正本:實作規範、註解格式、可行性檢查清單
├── bin/tea-sdlc.js # 單一指令入口:install / uninstall / prompt / status
├── skills/ # 各助理原生 plugin 機制讀取的 skills(目前為空)
├── .claude-plugin/ # Claude Code 的 plugin / marketplace manifest
├── .codex-plugin/ # Codex 的 plugin manifest
├── .agents/plugins/ # Codex 的 marketplace manifest
├── plugin.json # Antigravity 的 plugin manifest
├── package.json # npm 打包與測試入口,無任何相依套件
├── AGENTS.md # 給 AI 助理的模組邊界與慣例
└── README.md
```
---
## 前置需求
| 需求 | 用途 | 備註 |
| --- | --- | --- |
| Node.js ≥ 20 | 執行 `scripts/` 與測試 | 不自動安裝,缺少時腳本印出指引並中止 |
| git | 分支與 commit 操作 | 同上 |
| [`tea`](https://gitea.com/gitea/tea) 並已登入 | Gitea 議題、標籤、Milestone、留言、工時 | `tea login add` |
| 目標 repo 已開啟時間追蹤 | 工時碼錶 | Settings → Advanced Settings → Enable Time Tracker |
| 帳號對目標 repo 的 issues unit 有寫入權 | 建立與更新議題 | Gitea 的 unit 權限獨立於 push 權限 |
---
## 安裝
一行裝好,終端機就多出一個 `tea-sdlc` 指令:
```bash
npm i -g https://gitea.jsc.idv.tw/plugins/tea-sdlc.git
```
要裝特定版本就在網址後面接上 tag:`...tea-sdlc.git#v0.1.0`。不必設定任何 registry 或憑證。
接著把六個流程指令佈署到你裝了的每個 agent 平台:
```bash
tea-sdlc install
```
它會列出偵測到的平台讓你勾選(預設全勾),只寫進已經存在的平台目錄,不在沒裝的平台留下孤兒目錄。
沒有終端機可問時(CI、腳本)不會停下來等輸入,直接照預設全裝。
`--platform` 直接指定安裝對象,`--dry-run` 先看會動到哪些檔案:
```bash
tea-sdlc install --platform claude,codex
tea-sdlc install --dry-run
```
| 平台 | 偵測 | 轉接檔落點 | 形式 |
| --- | --- | --- | --- |
| `claude`(Claude Code) | `~/.claude/` | `~/.claude/commands/sdlc-*.md` | command |
| `codex`(Codex) | `~/.codex/` | `~/.codex/prompts/sdlc-*.md` | command |
| `opencode`(OpenCode) | `~/.config/opencode/` | `~/.config/opencode/command/sdlc-*.md` | command |
| `oh-my-pi` | `~/.omp/` | `~/.omp/commands/sdlc-*.md` | command |
| `antigravity`(Antigravity) | `~/.gemini/` | `~/.gemini/skills/sdlc-*/SKILL.md` | skill |
| `kiro`(Kiro) | `~/.kiro/` | `~/.kiro/skills/sdlc-*/SKILL.md` | skill |
| `copilot`(GitHub Copilot) | 專案裡的 `.github/` | `.github/skills/sdlc-*/SKILL.md` | skill |
轉接檔裡**沒有路徑**,只有一句「執行 `tea-sdlc prompt --name sdlc-plan`」。正本在哪由 PATH 上的
`tea-sdlc` 自己回推——升級 Node、換版本管理器、改 npm prefix 都不會讓七個平台的轉接檔同時失效。
還沒裝 `git` 或 [`tea`](https://gitea.com/gitea/tea) 也可以先裝:轉接檔的產生不需要它們,
安裝會把缺的東西列在輸出的 `missingBinaries` 與 `warning` 裡,但不會替你安裝,也不會因此中止。
真正需要它們的是流程指令本身,跑之前補上即可。
---
## 更新 / 移除
改流程正本、腳本、模板或規則,只要重裝套件,下一次叫用就讀到新的,**不必重新佈署**;
只有指令數量或轉接檔模板本身變了,才需要再跑一次 `tea-sdlc install`(轉接檔過時時,
叫用它會在輸出最前面提醒你)。
| 想做的事 | 指令 |
| --- | --- |
| 更新到最新版 | `npm i -g https://gitea.jsc.idv.tw/plugins/tea-sdlc.git` |
| 指令數量變了之後重新佈署 | `tea-sdlc install` |
| 查目前版本、正本位置與環境 | `tea-sdlc status` |
| 只移除轉接檔(正本不動) | `tea-sdlc uninstall` |
| 連套件一起移除 | `tea-sdlc uninstall` → `npm rm -g tea-sdlc` |
> **不要用 `npm update -g`。** 這個套件是從 git URL 裝的,`npm update -g` 認不得它的來源,
> 不會有任何更新發生,也不會報錯——重裝(上表第一行)才是更新的方式。
>
> **移除的順序不能顛倒。** 先 `npm rm -g tea-sdlc` 會把 `tea-sdlc` 指令一起帶走,
> 留在七個平台目錄裡的轉接檔就再也沒有東西能刪它們了,只能手動一個個找出來。
`tea-sdlc uninstall` 只刪自己產生的檔案:每份轉接檔裡都有產生標記,沒有標記的同名檔案一律留著,
並在輸出裡告訴你留了哪些。
---
## 給 agent 的入口
轉接檔指向的就是這一支。它把流程正本原樣印到 stdout,不包 JSON——那些內容是要給模型讀的。
```bash
tea-sdlc prompt --name sdlc-plan
```
其餘子指令與所有腳本一樣輸出單行 JSON `{ok, data, error:{code, message}}`,exit 0 或 1。
```bash
tea-sdlc status # 版本、正本位置、是否 link 模式、node/git/tea/登入、各平台轉接檔現況
```
`status` 在環境不健康時**指令本身仍算成功**(`ok` 為 `true`、`data.healthy` 為 `false`):
「查詢失敗」與「成功查到你環境有問題」的下一步完全不同,不該由同一個旗標表示。
---
## 附錄
### 其他安裝方式(plugin / marketplace 機制)
> 這些是各助理原生的 plugin / marketplace 機制。它們目前**裝不出任何指令**——`skills/` 還是空的,
> 真正會生效的是上面 `tea-sdlc install` 產生的轉接檔。保留在這裡是因為這些機制本身有用
> (自動更新、plugin 清單),等 `skills/` 有內容時會回來。
#### Claude Code
```bash
claude plugin marketplace add https://gitea.jsc.idv.tw/plugins/tea-sdlc.git
claude plugin install tea-sdlc@tea-sdlc
# 更新
claude plugin marketplace update tea-sdlc
claude plugin update tea-sdlc@tea-sdlc
# 移除
claude plugin uninstall tea-sdlc@tea-sdlc
claude plugin marketplace remove tea-sdlc
```
工作階段內 slash 版(等價):把 `claude plugin` 換成 `/plugin`。
本機開發(免 push):`claude plugin marketplace add /root/plugins/tea-sdlc`(本地路徑)後再 install。
#### Codex
```bash
codex plugin marketplace add https://gitea.jsc.idv.tw/plugins/tea-sdlc.git
codex plugin add tea-sdlc@tea-sdlc
# 更新(重新抓取 marketplace 的 git 快照)
codex plugin marketplace upgrade tea-sdlc
# 移除
codex plugin remove tea-sdlc@tea-sdlc
codex plugin marketplace remove tea-sdlc
```
安裝 token `tea-sdlc@tea-sdlc` = plugin 名(`.codex-plugin/plugin.json` 的 `name`)@ marketplace 名(`.agents/plugins/marketplace.json` 的 `name`)。安裝後重啟 Codex。
#### Antigravity(`agy`)
> `agy plugin install <url>` 目前只支援 github.com;Gitea 等自架 git 請先 clone 再用本地路徑安裝。
```bash
git clone https://gitea.jsc.idv.tw/plugins/tea-sdlc.git ~/plugins/tea-sdlc
agy plugin install ~/plugins/tea-sdlc
# 更新(agy 無 update 子指令 → git pull 後重裝)
git -C ~/plugins/tea-sdlc pull
agy plugin uninstall tea-sdlc
agy plugin install ~/plugins/tea-sdlc
```
#### GitHub Copilot CLI
```bash
copilot plugin marketplace add https://gitea.jsc.idv.tw/plugins/tea-sdlc.git
copilot plugin install tea-sdlc@tea-sdlc
# 更新
copilot plugin marketplace update tea-sdlc
copilot plugin update tea-sdlc@tea-sdlc
# 移除
copilot plugin uninstall tea-sdlc@tea-sdlc
copilot plugin marketplace remove tea-sdlc
```
#### OpenCode
OpenCode 的「plugin」是 TypeScript/npm 套件,不適用於本 repo;改用目錄安裝。
OpenCode 會讀 `~/.config/opencode/skills/`(也會讀 `~/.claude/skills/`、`~/.agents/skills/`)。
```bash
git clone https://gitea.jsc.idv.tw/plugins/tea-sdlc.git ~/plugins/tea-sdlc
mkdir -p ~/.config/opencode/skills
cp -r ~/plugins/tea-sdlc/skills/* ~/.config/opencode/skills/
```
> **Windows PowerShell**:`cp -r A B` → `Copy-Item A B -Recurse -Force`、`rm -rf X` → `Remove-Item X -Recurse -Force`、`~` → `$HOME`。
---
## 開發
```bash
npm test # 等同 node --test,使用 Node 內建測試執行器,無任何外部套件
```
測試產生的暫存一律寫到 `.tmp/`(已被 git 忽略,也不會被測試探索掃到)。
模組邊界與其餘慣例見 [`AGENTS.md`](./AGENTS.md)。