fix(README): 安裝指令補上 git+ 前綴,否則 npm 會把它當壓縮檔

npm 只有看到 git/git+ssh/git+http/git+https/git+file 才會當成 git repo。
寫成 https://….git 會被歸類成遠端 tarball,下載回來解壓失敗,錯誤是
TAR_BAD_ARCHIVE: Unrecognized archive format——看起來完全不像「網址寫法錯了」,
使用者只會以為套件壞了。

先前那條「README 指令逐字執行得動」的測試沒抓到,因為它只跑 tea-sdlc 開頭的
行,npm 那行從來沒被執行過。補一條規則把 .git 網址必須帶 git+ 前綴釘住:
真的去跑一次 npm 全域安裝要開網路、要三秒,不適合放進這套向來密封的測試裡,
但「前綴在不在」這條規則本身就足以擋掉這個錯。

議題 #25

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-17 15:30:27 +08:00
co-authored by Claude Opus 5
parent 9644b6a638
commit 67528dde5f
2 changed files with 16 additions and 4 deletions
+5 -2
View File
@@ -67,11 +67,14 @@ tea-sdlc/
一行裝好,終端機就多出一個 `tea-sdlc` 指令: 一行裝好,終端機就多出一個 `tea-sdlc` 指令:
```bash ```bash
npm i -g https://gitea.jsc.idv.tw/plugins/tea-sdlc.git npm i -g git+https://gitea.jsc.idv.tw/plugins/tea-sdlc.git
``` ```
要裝特定版本就在網址後面接上 tag:`...tea-sdlc.git#v0.1.0`。不必設定任何 registry 或憑證。 要裝特定版本就在網址後面接上 tag:`...tea-sdlc.git#v0.1.0`。不必設定任何 registry 或憑證。
> `git+` 前綴不能省。npm 只有看到 `git+https://` 才會當成 git repo;寫成 `https://….git`
> 會被當成遠端壓縮檔下載,然後以 `TAR_BAD_ARCHIVE: Unrecognized archive format` 失敗。
接著把六個流程指令佈署到你裝了的每個 agent 平台: 接著把六個流程指令佈署到你裝了的每個 agent 平台:
```bash ```bash
@@ -114,7 +117,7 @@ tea-sdlc install --dry-run
| 想做的事 | 指令 | | 想做的事 | 指令 |
| --- | --- | | --- | --- |
| 更新到最新版 | `npm i -g https://gitea.jsc.idv.tw/plugins/tea-sdlc.git` | | 更新到最新版 | `npm i -g git+https://gitea.jsc.idv.tw/plugins/tea-sdlc.git` |
| 指令數量變了之後重新佈署 | `tea-sdlc install` | | 指令數量變了之後重新佈署 | `tea-sdlc install` |
| 查目前版本、正本位置與環境 | `tea-sdlc status` | | 查目前版本、正本位置與環境 | `tea-sdlc status` |
| 只移除轉接檔(正本不動) | `tea-sdlc uninstall` | | 只移除轉接檔(正本不動) | `tea-sdlc uninstall` |
+11 -2
View File
@@ -27,15 +27,24 @@ test('安裝以 npm 為唯一建議路徑,指令含完整可複製的 git URL'
assert.equal(install.length > 0, true, 'README 沒有 npm 安裝指令'); assert.equal(install.length > 0, true, 'README 沒有 npm 安裝指令');
assert.ok( assert.ok(
install.some((line) => line.includes('https://gitea.jsc.idv.tw/plugins/tea-sdlc.git')), install.some((line) => line.includes('gitea.jsc.idv.tw/plugins/tea-sdlc.git')),
`安裝指令少了完整 git URL:${install.join(' / ')}`, `安裝指令少了完整 git URL:${install.join(' / ')}`,
); );
}); });
test('指向 .git 的安裝指令一律帶 git+ 前綴,否則 npm 會把它當壓縮檔去解', () => {
// npm 只有看到 git/git+ssh/git+http/git+https/git+file 才會當成 git repo;
// 純 https://….git 會被歸類成遠端 tarball,下載回來解壓失敗,錯誤訊息是
// TAR_BAD_ARCHIVE: Unrecognized archive format——看起來完全不像「網址寫法錯了」。
for (const line of commands(readme()).filter((l) => l.startsWith('npm i -g') && l.includes('.git'))) {
assert.match(line, /git\+https:\/\//, `這行 npm 跑不起來:${line}`);
}
});
test('更新與移除各有完整指令表,順序講清楚先 uninstall 再 npm rm', () => { test('更新與移除各有完整指令表,順序講清楚先 uninstall 再 npm rm', () => {
const text = readme(); const text = readme();
assert.match(text, /npm i -g https:\/\/gitea\.jsc\.idv\.tw\/plugins\/tea-sdlc\.git/); assert.match(text, /npm i -g git\+https:\/\/gitea\.jsc\.idv\.tw\/plugins\/tea-sdlc\.git/);
assert.match(text, /tea-sdlc uninstall/); assert.match(text, /tea-sdlc uninstall/);
assert.match(text, /npm rm -g tea-sdlc/); assert.match(text, /npm rm -g tea-sdlc/);
// 先砍套件就再也刪不掉那些孤兒轉接檔,順序本身就是內容 // 先砍套件就再也刪不掉那些孤兒轉接檔,順序本身就是內容