Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9ed26de7ba | ||
|
|
f5f2cb05bd | ||
|
|
651dc19be9 | ||
|
|
2e237b7674 | ||
|
|
29e9800da8 | ||
|
|
66b865456c | ||
|
|
6d28e207c7 | ||
|
|
5aa4a3da57 | ||
|
|
7dc5c32de3 | ||
|
|
9dabe98f2b | ||
|
|
7dd230d9b4 | ||
|
|
0669b64c5f | ||
|
|
7127999eb3 | ||
|
|
d159847c94 | ||
|
|
0cf2392ae7 | ||
|
|
74aff34872 | ||
|
|
b48665f946 | ||
|
|
2f6c9b05c3 | ||
|
|
137491fcb6 | ||
|
|
ec35ad9a52 | ||
|
|
c593803ed5 | ||
|
|
a88bfe3d21 | ||
|
|
d183f4fba5 | ||
|
|
4ac03f9ae1 | ||
|
|
771d71c28e | ||
|
|
32c619bfb3 | ||
|
|
cc9cd66eb5 | ||
|
|
41cfc8d54c | ||
|
|
08a7d23a12 | ||
|
|
b0ea356ff5 | ||
|
|
ccae8bfd7a | ||
|
|
29080ca6e8 | ||
|
|
baa1f1118f | ||
|
|
a65f546911 | ||
|
|
0ce64ba392 | ||
|
|
816fe07fbd | ||
|
|
478f670d53 | ||
|
|
9a0ea8e248 | ||
|
|
6447416c7b | ||
|
|
47c479d65c | ||
|
|
07d8583937 | ||
|
|
02b36a315c | ||
|
|
769d8f3f33 | ||
|
|
44fce3a68c | ||
|
|
69003a7d2c | ||
|
|
7a2544772f | ||
|
|
7c963b73cf | ||
|
|
19303ca555 | ||
|
|
444ab9762b | ||
|
|
d9d1dafe6e | ||
|
|
106b9f7df3 | ||
|
|
fbb7004e70 | ||
|
|
acbbd30a0f | ||
|
|
dba1aa2b44 | ||
|
|
bdfea58fab | ||
|
|
073c51e145 | ||
|
|
9ab5b42864 | ||
|
|
287e3ff113 |
@@ -43,7 +43,7 @@
|
|||||||
"source": "url",
|
"source": "url",
|
||||||
"url": "https://gitea.jsc.idv.tw/plugins/hooks.git"
|
"url": "https://gitea.jsc.idv.tw/plugins/hooks.git"
|
||||||
},
|
},
|
||||||
"description": "跨 CLI hooks:STE100 語言強制、工時計時、技能用量記錄"
|
"description": "跨 CLI hooks:STE100 語言強制、工時計時、技能用量記錄、SDLC 模型鎖、版本前置檢查"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "jsc-log",
|
"name": "jsc-log",
|
||||||
@@ -75,7 +75,7 @@
|
|||||||
"source": "url",
|
"source": "url",
|
||||||
"url": "https://gitea.jsc.idv.tw/plugins/review.git"
|
"url": "https://gitea.jsc.idv.tw/plugins/review.git"
|
||||||
},
|
},
|
||||||
"description": "程式碼審查:Refactoring 壞味道六組 + 註解規範 + 淺模組"
|
"description": "程式碼審查:Refactoring 壞味道六組、註解規範、淺模組"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "jsc-sdlc",
|
"name": "jsc-sdlc",
|
||||||
@@ -83,7 +83,7 @@
|
|||||||
"source": "url",
|
"source": "url",
|
||||||
"url": "https://gitea.jsc.idv.tw/plugins/sdlc.git"
|
"url": "https://gitea.jsc.idv.tw/plugins/sdlc.git"
|
||||||
},
|
},
|
||||||
"description": "開發生命週期:規劃/分析/實作/維護(wiki 追蹤)"
|
"description": "開發生命週期:規劃、分析、實作、維護(wiki 追蹤)"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
"source": "url",
|
"source": "url",
|
||||||
"url": "https://gitea.jsc.idv.tw/plugins/hooks.git"
|
"url": "https://gitea.jsc.idv.tw/plugins/hooks.git"
|
||||||
},
|
},
|
||||||
"description": "跨 CLI hooks:STE100 語言強制、工時計時、技能用量記錄"
|
"description": "跨 CLI hooks:STE100 語言強制、工時計時、技能用量記錄、SDLC 模型鎖、版本前置檢查"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "jsc-log",
|
"name": "jsc-log",
|
||||||
@@ -75,7 +75,7 @@
|
|||||||
"source": "url",
|
"source": "url",
|
||||||
"url": "https://gitea.jsc.idv.tw/plugins/review.git"
|
"url": "https://gitea.jsc.idv.tw/plugins/review.git"
|
||||||
},
|
},
|
||||||
"description": "程式碼審查:Refactoring 壞味道六組 + 註解規範 + 淺模組"
|
"description": "程式碼審查:Refactoring 壞味道六組、註解規範、淺模組"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "jsc-sdlc",
|
"name": "jsc-sdlc",
|
||||||
@@ -83,7 +83,7 @@
|
|||||||
"source": "url",
|
"source": "url",
|
||||||
"url": "https://gitea.jsc.idv.tw/plugins/sdlc.git"
|
"url": "https://gitea.jsc.idv.tw/plugins/sdlc.git"
|
||||||
},
|
},
|
||||||
"description": "開發生命週期:規劃/分析/實作/維護(wiki 追蹤)"
|
"description": "開發生命週期:規劃、分析、實作、維護(wiki 追蹤)"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "jsc-meta",
|
"name": "jsc-meta",
|
||||||
"version": "0.0.8",
|
"version": "0.2.4",
|
||||||
"description": "技能組自我管理:新建、更新、刪除技能與技能準則",
|
"description": "技能組自我管理:新建、更新、刪除技能與技能準則",
|
||||||
"skills": "./skills",
|
"skills": "./skills",
|
||||||
"author": {
|
"author": {
|
||||||
@@ -13,5 +13,14 @@
|
|||||||
"meta",
|
"meta",
|
||||||
"skills",
|
"skills",
|
||||||
"cross-tool"
|
"cross-tool"
|
||||||
]
|
],
|
||||||
|
"jsc": {
|
||||||
|
"requires": {
|
||||||
|
"jsc-ask": ">=0.0.6",
|
||||||
|
"jsc-cli": ">=0.2.1",
|
||||||
|
"jsc-git": ">=0.0.9",
|
||||||
|
"jsc-gitea": ">=0.1.8",
|
||||||
|
"jsc-hooks": ">=0.3.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,15 @@
|
|||||||
{
|
{
|
||||||
"name": "jsc-meta",
|
"name": "jsc-meta",
|
||||||
"version": "0.0.8",
|
"version": "0.2.4",
|
||||||
"description": "技能組自我管理:新建、更新、刪除技能與技能準則",
|
"description": "技能組自我管理:新建、更新、刪除技能與技能準則",
|
||||||
"skills": "./skills"
|
"skills": "./skills",
|
||||||
|
"jsc": {
|
||||||
|
"requires": {
|
||||||
|
"jsc-ask": ">=0.0.6",
|
||||||
|
"jsc-cli": ">=0.2.1",
|
||||||
|
"jsc-git": ">=0.0.9",
|
||||||
|
"jsc-gitea": ">=0.1.8",
|
||||||
|
"jsc-hooks": ">=0.3.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
jsc 技能組的 meta domain:新建、更新、刪除技能的流程,以及**全技能組的準則單一來源** `references/guidelines.md`(命名、description 規則、hook / 工具 / sub agent 下放、語言、環境變數、wiki 頁命名總表、審核檢查清單)。
|
jsc 技能組的 meta domain:新建、更新、刪除技能的流程,以及**全技能組的準則單一來源** `references/guidelines.md`(命名、description 規則、hook / 工具 / sub agent 下放、語言、環境變數、wiki 頁命名總表、審核檢查清單)。
|
||||||
|
|
||||||
## 安裝 / 更新 / 移除
|
## 安裝、更新、移除
|
||||||
|
|
||||||
Marketplace 統一為 `jsc`(https://gitea.jsc.idv.tw/plugins/meta.git),安裝 token 為 `jsc-meta@jsc`。每個指令一行:
|
Marketplace 統一為 `jsc`(https://gitea.jsc.idv.tw/plugins/meta.git),安裝 token 為 `jsc-meta@jsc`。每個指令一行:
|
||||||
|
|
||||||
@@ -26,27 +26,31 @@ Marketplace 統一為 `jsc`(https://gitea.jsc.idv.tw/plugins/meta.git),安
|
|||||||
|
|
||||||
### `skill-new`
|
### `skill-new`
|
||||||
|
|
||||||
新建技能:決策樹問細節(目標、觸發、輸入輸出、domain)→ 缺 domain 時依 template 結構建立新存取庫 → sub agent 依準則產生技能 → 審核清單自檢 → PR。
|
新建技能:先併行預跑 `list-skills.sh` 與 `sync-domains.sh`,再用決策樹問細節(目標、觸發、輸入輸出、domain)→ 缺 domain 時依 template 結構建立新存取庫 → sub agent 依準則產生技能 → 審核清單自檢 → PR,並依 `references/pr-report.md` 回報 → 依 `references/deploy-verify.md` 部署與驗證。
|
||||||
|
|
||||||
### `skill-update`
|
### `skill-update`
|
||||||
|
|
||||||
更新技能:先查 Gitea 正本 marketplace 取得 domain 清單並補 clone 缺少的存取庫,列出全部技能 → 使用者選擇 → 決策樹問更新細節 → 更新後依審核檢查清單逐項檢查,不符就回到詢問 → PR。
|
更新技能:先查 Gitea 正本 marketplace 取得 domain 清單並補 clone 缺少的存取庫,列出全部技能 → 使用者選擇 → 決策樹問更新細節 → 更新後依審核檢查清單逐項檢查,不符就回到詢問 → PR,並依 `references/pr-report.md` 回報 → 依 `references/deploy-verify.md` 部署與驗證。
|
||||||
|
|
||||||
### `skill-delete`
|
### `skill-delete`
|
||||||
|
|
||||||
刪除技能:先查 Gitea 正本 marketplace 取得 domain 清單並補 clone 缺少的存取庫,列出全部技能 → 使用者選擇 → sub agent 盤點關聯檔案 → 逐檔判斷是否需修正以維持功能(需要就決策樹問修正細節並依準則檢查)→ 刪除 → sub agent 實地檢查各 CLI 的技能與 hook 保存位置,確認沒有殘留 → PR。
|
刪除技能:`sync-domains.sh` 依 Gitea 正本 marketplace 同步所有存取庫,`list-skills.sh` 列出全部技能 → 使用者選擇 → `find-skill-refs.sh` 盤點關聯檔案 → 併行的 sub agent 逐檔判斷是否需修正以維持功能(需要就決策樹問修正細節並依準則檢查)→ 刪除 → PR → 依 `references/deploy-verify.md` 部署,再用 `verify-skill-removed.sh` 實地檢查各 CLI 的技能快取與 hook 設定。深層刪除只在部署後查一次:部署前的刪除還沒生效,查了一定乾淨,證明不了任何事。
|
||||||
|
|
||||||
### `skillset-update`
|
### `skillset-update`
|
||||||
|
|
||||||
批次更新——把一份變更需求套用到整個技能組的多個技能/domain,先檢查工具化、sub agent 與環境變數優先規則,再逐 repo 開 PR;單一技能改用 skill-update。
|
批次更新——把一份變更需求套用到整個技能組的多個技能、domain。同步存取庫與決策樹併行起跑,先檢查工具化、sub agent 與環境變數優先規則,再由併行的 sub agent 逐 repo 改檔與開 PR;PR 回報格式見 `references/pr-report.md`,部署與驗證見 `references/deploy-verify.md`;單一技能改用 skill-update。
|
||||||
|
|
||||||
### `skill-check`
|
### `skill-check`
|
||||||
|
|
||||||
例行稽核——沒有變更需求時,把整個技能組逐一對照準則的審核檢查清單:sub agent 逐 domain 稽核 → 不符項目逐項決策樹確認 → sub agent 套用修正並複檢 → 逐 repo 開 PR。有變更需求改用 skillset-update。
|
例行稽核——沒有變更需求時,同步存取庫之後併行跑三組:`lint-scripts.sh` 加 `check-behaviors.sh` 加 hook smoke、準則審核檢查清單、流程與成本優化審查。優化面向包含可平行化、可下放工具、重複來回、冗餘步驟、過早或過晚的閘門與可省的成本;不符項目與優化建議分開回報,逐項決策樹確認後才套用,最後逐 repo 開 PR。有變更需求改用 skillset-update。
|
||||||
|
|
||||||
### `ste100-sync`
|
### `ste100-sync`
|
||||||
|
|
||||||
同步上游 speak-human-tw 的語言規則:比對 `references/ste100.md` 釘住的上游版本,有新版就萃取適用的變更、更新 lint 樣式、全庫重掃,最後開 PR。適合列為本 repo 的維護方式。
|
同步上游 speak-human-tw 的語言規則:先只讀上游 `SKILL.md` frontmatter 的版本來比對,判定要更新才 clone;有新版就萃取適用的變更、逐項決策樹確認、更新 lint 樣式與 `jsc-hooks` 的簡體字表、全庫併行重掃、bump manifest,最後開 PR。適合列為本 repo 的維護方式。
|
||||||
|
|
||||||
|
### `tooling-guide`
|
||||||
|
|
||||||
|
盤點目前支援的 plugins、skills、hooks 管理與使用路徑,產出技能組基礎指引。基礎盤點一律沿用 `inventory-tooling.sh` 的輸出,不再重跑它內部已經跑過的三支腳本。適合建立技能組地圖、支援清單、hook 管理總覽與新人交接資料;安裝、更新、刪除、稽核與修復改用對應技能。
|
||||||
|
|
||||||
<!-- JSC-SKILLS:END -->
|
<!-- JSC-SKILLS:END -->
|
||||||
|
|
||||||
@@ -56,7 +60,25 @@ Marketplace 統一為 `jsc`(https://gitea.jsc.idv.tw/plugins/meta.git),安
|
|||||||
| --- | --- |
|
| --- | --- |
|
||||||
| `references/guidelines.md` | 技能準則唯一來源,所有 domain 的 AGENTS.md 都指向這裡 |
|
| `references/guidelines.md` | 技能準則唯一來源,所有 domain 的 AGENTS.md 都指向這裡 |
|
||||||
| `references/ste100.md` | STE100 擬人台灣感語言規則唯一來源(改寫自 speak-human-tw,MIT) |
|
| `references/ste100.md` | STE100 擬人台灣感語言規則唯一來源(改寫自 speak-human-tw,MIT) |
|
||||||
| `tools/ste100-lint.sh` | 語言規則的機檢工具:中國用語、中文句內半形標點、AI 套話;命中 exit 1 |
|
| `references/pr-report.md` | PR 收尾回報格式唯一來源,所有會開 PR 的技能都指向這裡 |
|
||||||
|
| `references/deploy-verify.md` | 四支異動技能共用的部署與驗證流程:判路線、部署或工作樹、**在新的 CLI 行程裡驗證**、失敗分流 |
|
||||||
|
| `references/behaviors.md` | 本 domain 的技能行為清單:一支技能一節,五列記下觸發時機、關鍵步驟、外部呼叫、完成條件、可驗證跡象,供稽核與驗證比對。格式合約見 `references/guidelines.md` 的「技能行為清單」 |
|
||||||
|
| `templates/tooling-contents.md` | `TOOLING_CONTENTS` 目錄頁樣板。一列代表一組「機器、CLI、帳號」;只更新自己那一列,別人的列原樣保留,**禁止整頁覆蓋** |
|
||||||
|
| `templates/tooling-page.md` | `TOOLING_{HASH}` 內容頁樣板。分節對應 `inventory-tooling.sh` 的輸出;**每次盤點覆寫整頁**,只留現況,不留歷史 |
|
||||||
|
| `tools/plugins-root.sh` | 推導技能組工作目錄的根,六支腳本共用。以 plugin 形式安裝時「腳本上兩層」會落在快取目錄,所以推導規則抽出來;推不出來 exit 1 並指名要設 `JSC_PLUGINS_ROOT` |
|
||||||
|
| `tools/ste100-lint.sh` | 語言規則的機檢工具:中國用語、中文句內半形標點、AI 套話、簡體字、中文並列斜線;命中 exit 1,沒給檢查對象 exit 2 |
|
||||||
|
| `tools/lint-scripts.sh` | 一個 domain 的腳本檢查三合一:`sh -n` 語法、執行權限、檔頭結束碼宣告;有不合格 exit 1,沒有腳本可掃 exit 3(**不等於通過**) |
|
||||||
|
| `tools/check-behaviors.sh` | 比對一個 domain 的 `references/behaviors.md` 與 `skills/`:節對技能、字典序、每節一張表、五個欄位齊全且內容欄非空;不符 exit 1,用法錯誤 exit 2,找不到清單或找不到技能 exit 3(**不等於通過**) |
|
||||||
|
| `tools/deploy-route.sh` | 判定改動有沒有進存取庫的預設分支,決定走部署路線(exit 0)或工作樹路線(exit 3);判不出來 exit 1,**不等於工作樹路線** |
|
||||||
|
| `tools/sync-domains.sh` | 依 Gitea 正本 marketplace 把所有 domain 存取庫 clone 或 pull 到本機,印出 `domain<TAB>path`;**只有 exit 0 代表全部到位且最新**,exit 3 代表有存取庫跳過或 pull 失敗(stderr 列路徑),exit 2 代表有 domain clone 失敗 |
|
||||||
|
| `tools/list-skills.sh` | 列出正本 marketplace 上各 domain 存取庫的技能,印出 `domain<TAB>name<TAB>description`;不在正本清單上的存取庫不列 |
|
||||||
|
| `tools/inventory-tooling.sh` | 盤點目前支援的 plugins、skills、tools、hooks,輸出技能組基礎指引 Markdown |
|
||||||
|
| `tools/sync-marketplace.sh` | 寫入或更新兩份正本 marketplace 的 plugin 條目,再複製到每個 domain 存取庫(保證位元組一致)。**需要 python3**(json 模組改 JSON),缺 python3 不寫檔並 exit 1;存取庫不在本機 exit 3 |
|
||||||
|
| `tools/sync-skill-manifest.sh` | 同步 domain README 的「Skills 目錄」,並 bump 三份 manifest 的 version;`minor` 與 `patch` 不得超過 `9`,`major` 可以超過 `9`。缺目錄、缺標記或缺 version 欄位 exit 1,用法錯誤 exit 2 |
|
||||||
|
| `tools/find-skill-refs.sh` | 盤點一個技能在正本 marketplace 各 domain 存取庫裡的引用檔案(不掃非技能組存取庫與點開頭目錄);技能名稱為純子字串比對,命中要逐檔確認;零命中 exit 1,掃描失敗 exit 3 |
|
||||||
|
| `tools/verify-skill-removed.sh` | 刪除技能後實地檢查各 CLI 的技能快取與 hook 設定有無殘留;有殘留 exit 1,沒偵測到 CLI 或沒有可查位置 exit 3(**不等於乾淨**) |
|
||||||
|
|
||||||
|
兩份 `TOOLING` 樣板的寫入語意剛好相反,套用前先分清楚。目錄頁是共用的,整頁覆蓋會刪掉別台機器的紀錄,所以只准動自己那一列。內容頁只屬於一組「機器、CLI、帳號」,記的是當下現況,舊的安裝內容早就不成立,所以整頁覆寫。頁名與雜湊規則見 `references/guidelines.md` 的「Wiki 頁命名總表」。
|
||||||
|
|
||||||
## 相關 domain
|
## 相關 domain
|
||||||
|
|
||||||
|
|||||||
+11
-2
@@ -1,6 +1,15 @@
|
|||||||
{
|
{
|
||||||
"name": "jsc-meta",
|
"name": "jsc-meta",
|
||||||
"version": "0.0.8",
|
"version": "0.2.4",
|
||||||
"description": "技能組自我管理:新建、更新、刪除技能與技能準則",
|
"description": "技能組自我管理:新建、更新、刪除技能與技能準則",
|
||||||
"skills": "./skills/"
|
"skills": "./skills/",
|
||||||
|
"jsc": {
|
||||||
|
"requires": {
|
||||||
|
"jsc-ask": ">=0.0.6",
|
||||||
|
"jsc-cli": ">=0.2.1",
|
||||||
|
"jsc-git": ">=0.0.9",
|
||||||
|
"jsc-gitea": ">=0.1.8",
|
||||||
|
"jsc-hooks": ">=0.3.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,73 @@
|
|||||||
|
# jsc-meta 技能行為清單
|
||||||
|
|
||||||
|
本頁記錄 jsc-meta 每支技能的行為基準,供技能驗證比對。技能異動時,在同一個 PR 內一起更新這一頁。
|
||||||
|
|
||||||
|
## skill-check
|
||||||
|
|
||||||
|
| 項目 | 內容 |
|
||||||
|
| --- | --- |
|
||||||
|
| 觸發時機 | 手上沒有異動需求,要對整組技能做例行或臨時稽核時用。帶著異動需求要改多支技能走 skillset-update、只改一支走 skill-update |
|
||||||
|
| 關鍵步驟 | 先跑 sync-domains.sh 同步全部 domain 存取庫、再平行跑三組審查(第一組跑腳本檢查、行為清單檢查與 hook smoke、第二組以 sub agent 逐 domain 對 guidelines 檢查清單稽核、第三組以 sub agent 分六個面向審查流程與成本)、合併三組結果並用決策樹逐項確認、以平行 sub agent 套用確認過的修正並跑 sync-skill-manifest.sh、跑 sync-marketplace.sh 同步兩份正本 marketplace、重跑三組驗證直到接受的修正全通過、每個受影響存取庫各開一條 PR |
|
||||||
|
| 外部呼叫 | tools/sync-domains.sh、tools/lint-scripts.sh、tools/check-behaviors.sh、tools/sync-skill-manifest.sh、tools/sync-marketplace.sh、jsc-cli/tools/detect-clis.sh、jsc-hooks/tools/wire-cli.sh smoke、jsc-ask:ask、jsc-git:pr |
|
||||||
|
| 完成條件 | 每個 domain 都有腳本檢查與行為清單檢查的結論、每個 domain 的檢查清單在合併後補齊、每項不合規與每項優化建議都有決策紀錄、接受的修正重驗通過、每個受影響存取庫都拿到 PR 網址 |
|
||||||
|
| 可驗證跡象 | 受影響存取庫留下檔案改動、改到行為的技能連帶改寫該存取庫的 references/behaviors.md、README 的「Skills 目錄」重寫、三份 manifest 版本號提升、兩份 marketplace 檔逐位元一致、每個受影響存取庫一條 PR |
|
||||||
|
|
||||||
|
## skill-delete
|
||||||
|
|
||||||
|
| 項目 | 內容 |
|
||||||
|
| --- | --- |
|
||||||
|
| 觸發時機 | 要把一支技能從技能組移除時用。改名不走這支,走 skill-update |
|
||||||
|
| 關鍵步驟 | 跑 sync-domains.sh 同步、跑 list-skills.sh 列出全部技能、讓使用者挑一支確認刪除、跑 find-skill-refs.sh 盤點所有引用檔案、以平行 sub agent 逐檔修正到檢查清單全過、刪掉 skills/{name}/ 目錄、移除 references/behaviors.md 對應那一節、跑 sync-skill-manifest.sh、開 PR、依 deploy-verify.md 部署、用新的 CLI 行程驗證、跑 verify-skill-removed.sh 查磁碟殘留、把異動報告附加到 wiki |
|
||||||
|
| 外部呼叫 | tools/sync-domains.sh、tools/list-skills.sh、tools/find-skill-refs.sh、tools/check-behaviors.sh、tools/sync-skill-manifest.sh、tools/deploy-route.sh、tools/verify-skill-removed.sh、jsc-ask:ask、jsc-git:pr、jsc-gitea:wiki |
|
||||||
|
| 完成條件 | 盤點清單每一檔都有「已修正」或「無需修正」的結論、技能目錄與行為清單那一節都不存在、list-skills.sh 查不到那一列、殘留檢查退出 0 或據實記成「無處可查」並帶進報告、PR 網址與 wiki 頁都到手 |
|
||||||
|
| 可驗證跡象 | skills/{name}/ 目錄消失、references/behaviors.md 少一節、README 與三份 manifest 更新、一條 PR、wiki SKILLSET_{HASH} 附加一節並登記在 SKILLSET_CONTENTS |
|
||||||
|
|
||||||
|
## skill-new
|
||||||
|
|
||||||
|
| 項目 | 內容 |
|
||||||
|
| --- | --- |
|
||||||
|
| 觸發時機 | 要在技能組新增一支技能時用。改既有技能走 skill-update |
|
||||||
|
| 關鍵步驟 | 平行跑 list-skills.sh 與 sync-domains.sh 預取技能清單與 domain 清單、用決策樹問出目標、觸發時機、輸入輸出與所屬 domain、domain 未註冊就先確認存取庫在不在、依 template 結構補齊內容再跑 sync-marketplace.sh 註冊、以 sub agent 產生 skills/{name}/SKILL.md、在 references/behaviors.md 依字典序插入該技能一節、跑 sync-skill-manifest.sh、自查 guidelines 檢查清單並跑 check-behaviors.sh、開 PR、依 deploy-verify.md 部署並用新的 CLI 行程驗證、把異動報告附加到 wiki |
|
||||||
|
| 外部呼叫 | tools/list-skills.sh、tools/sync-domains.sh、tools/sync-marketplace.sh、tools/check-behaviors.sh、tools/sync-skill-manifest.sh、tools/deploy-route.sh、jsc-gitea/tools/gitea.sh、jsc-ask:ask、jsc-git:pr、jsc-gitea:wiki |
|
||||||
|
| 完成條件 | 四項提問都有紀錄、SKILL.md 與行為清單那一節都在、README 與三份 manifest 同步、檢查清單全過且 check-behaviors.sh 退出 0、PR 網址到手、deploy-verify.md 第 1 到第 5 節的完成條件全數成立、wiki 頁寫成功 |
|
||||||
|
| 可驗證跡象 | 新增 skills/{name}/SKILL.md、references/behaviors.md 多一節、README 與三份 manifest 更新、新 domain 時兩份 marketplace 檔多一筆 plugin 條目並同步到每個 domain 存取庫、一條 PR、wiki SKILLSET_{HASH} 附加一節 |
|
||||||
|
|
||||||
|
## skill-update
|
||||||
|
|
||||||
|
| 項目 | 內容 |
|
||||||
|
| --- | --- |
|
||||||
|
| 觸發時機 | 要改一支既有技能時用。新增走 skill-new、刪除走 skill-delete、一次改多支或跨 domain 走 skillset-update |
|
||||||
|
| 關鍵步驟 | 跑 sync-domains.sh 同步、跑 list-skills.sh 列出全部技能、讓使用者挑一支、用決策樹問出改動細節、以 sub agent 改 SKILL.md 與相關檔案、同步更新 references/behaviors.md 該技能那一節、跑 sync-skill-manifest.sh、對 guidelines 檢查清單逐項自查並跑 check-behaviors.sh、開 PR、依 deploy-verify.md 部署並用新的 CLI 行程驗證、把異動報告附加到 wiki |
|
||||||
|
| 外部呼叫 | tools/sync-domains.sh、tools/list-skills.sh、tools/check-behaviors.sh、tools/sync-skill-manifest.sh、tools/deploy-route.sh、jsc-ask:ask、jsc-git:pr、jsc-gitea:wiki |
|
||||||
|
| 完成條件 | 每個提問都有紀錄、技能檔案帶著改動、行為清單那一節與新行為一致且 check-behaviors.sh 退出 0、三份 manifest 同版、檢查清單全過、PR 網址到手、deploy-verify.md 第 1 到第 5 節的完成條件全數成立、wiki 頁寫成功 |
|
||||||
|
| 可驗證跡象 | 該技能的 SKILL.md 與相關檔案改動、references/behaviors.md 對應節改寫、README 與三份 manifest 更新、一條 PR、wiki SKILLSET_{HASH} 附加一節 |
|
||||||
|
|
||||||
|
## skillset-update
|
||||||
|
|
||||||
|
| 項目 | 內容 |
|
||||||
|
| --- | --- |
|
||||||
|
| 觸發時機 | 一個異動需求橫跨多支技能或多個 domain,要一次做完時用。只改一支走 skill-update、手上沒有異動需求的例行稽核走 skill-check |
|
||||||
|
| 關鍵步驟 | 平行啟動 sync-domains.sh 與異動細節決策樹、問清楚改哪一條規則、影響哪些技能與 domain,並補問工具化、sub agent、環境變數三項塑形檢查、以每個 domain 一個 sub agent 平行套用改動、同步更新每個受影響 domain 的 references/behaviors.md、逐存取庫跑 sync-skill-manifest.sh、以平行 sub agent 重跑 guidelines 檢查清單與 check-behaviors.sh 直到全過、每個受影響存取庫各開一條 PR、依 deploy-verify.md 部署並用新的 CLI 行程驗證、逐存取庫把異動報告附加到 wiki |
|
||||||
|
| 外部呼叫 | tools/sync-domains.sh、tools/check-behaviors.sh、tools/sync-skill-manifest.sh、tools/deploy-route.sh、tools/list-skills.sh、jsc-ask:ask、jsc-git:pr、jsc-gitea:wiki |
|
||||||
|
| 完成條件 | 受影響技能清單與三項塑形檢查都跟使用者談定、每個受影響存取庫都帶著改動、README 同步與 manifest 提升、每支動過的技能檢查清單全過且該 domain 的 check-behaviors.sh 退出 0、每個受影響存取庫都有 PR 網址、deploy-verify.md 第 1 到第 5 節對每個存取庫都成立、每個存取庫的 wiki 頁都寫成功 |
|
||||||
|
| 可驗證跡象 | 每個受影響存取庫的技能檔案改動、各自的 references/behaviors.md 更新、README 與三份 manifest 更新、每個存取庫一條 PR、每個存取庫的 wiki SKILLSET_{HASH} 各附加一節並登記在 SKILLSET_CONTENTS |
|
||||||
|
|
||||||
|
## ste100-sync
|
||||||
|
|
||||||
|
| 項目 | 內容 |
|
||||||
|
| --- | --- |
|
||||||
|
| 觸發時機 | 定期維護,或上游 speak-human-tw 發佈新版時用。只改本地自訂規則不走這支 |
|
||||||
|
| 關鍵步驟 | 先讀 references/ste100.md 釘住的上游版本、再用 HTTPS 讀上游 SKILL.md frontmatter 的版本比對、同版就回報「上游沒有新版」並停在這裡、有新版才淺層 clone 取 changelog、以 sub agent 蒸餾適用於技術文件與對話的變更、用決策樹逐項確認採用、改寫 references/ste100.md 與「上游版本」行、必要時更新 ste100-lint.sh 的樣式與 jsc-hooks/hooks/simplified.txt、平行對每個 jsc 存取庫重跑 lint、跑 sync-skill-manifest.sh、開 PR |
|
||||||
|
| 外部呼叫 | 上游 speak-human-tw 的 raw SKILL.md 與 git clone、tools/ste100-lint.sh、tools/sync-domains.sh、tools/sync-skill-manifest.sh、jsc-ask:ask、jsc-git:pr |
|
||||||
|
| 完成條件 | 上游同版時停在版本比對並回報;有新版時每項蒸餾出來的變更都有決策、`sh -n tools/ste100-lint.sh` 通過且新採用的詞彙在測試字串上命中、本存取庫 lint 退出 0、其他存取庫的命中附 file:line 交給擁有者、三份 manifest 同版、PR 網址到手 |
|
||||||
|
| 可驗證跡象 | references/ste100.md 的「上游版本」行換值、tools/ste100-lint.sh 的樣式更新、jsc-hooks/hooks/simplified.txt 更新、三份 manifest 版本號提升、一條 PR;上游同版時無寫入跡象,只有回報內容 |
|
||||||
|
|
||||||
|
## tooling-guide
|
||||||
|
|
||||||
|
| 項目 | 內容 |
|
||||||
|
| --- | --- |
|
||||||
|
| 觸發時機 | 使用者要技能組導覽、工具地圖、支援的 plugin 清單、支援的技能清單、hook 管理概觀或新人上手參考時用。安裝、更新、刪除、稽核、修復都不走這支 |
|
||||||
|
| 關鍵步驟 | 跑 plugins-root.sh 確認工作根目錄、跑 sync-domains.sh 取得 domain 與本機路徑、跑 inventory-tooling.sh 產生基準盤點並同時蒐集管理流程事實、需要說明或分組時以 sub agent 綜整導覽草稿、主 agent 逐項核對每個說法的來源、依記錄下來的目標交付、目標是 wiki 頁時才以 sub agent 逐 CLI 算出頁名、先寫內容頁再登記目錄頁 |
|
||||||
|
| 外部呼叫 | tools/plugins-root.sh、tools/sync-domains.sh、tools/inventory-tooling.sh、jsc-gitea/tools/hash-id、jsc-gitea:wiki、jsc-ask:ask |
|
||||||
|
| 完成條件 | 每項事實都指得到來源檔案或工具輸出、必填章節都不是空的、收尾回報寫明交付目標、來源新鮮度、過期輸入與未知的 hook 判定;目標是 wiki 時每一頁都確認寫成功,或列為未寫入並附完整內容 |
|
||||||
|
| 可驗證跡象 | 目標是聊天回應時無寫入跡象,只有回報內容;目標是檔案時只產生使用者指定的那一個檔;目標是 wiki 時每支偵測到的 CLI 各一頁 TOOLING_{HASH},並在 TOOLING_CONTENTS 更新自己那一列 |
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
# 部署與驗證
|
||||||
|
|
||||||
|
`skill-new`、`skill-update`、`skill-delete`、`skillset-update` 四支異動技能的收尾共用這份流程。四支只在 SKILL.md 留一行指標指過來,不各自抄一份——抄四份會各自漂移,改一次要記得改四個地方。
|
||||||
|
|
||||||
|
## 1. 判路線
|
||||||
|
|
||||||
|
改動有沒有進存取庫的**預設分支**,決定走哪條路線。marketplace 與 `version-guard.sh` 都讀預設分支,停在 `develop` 的改動 `jsc-cli:deploy` 看不到。
|
||||||
|
|
||||||
|
判定交給 `jsc-meta/tools/deploy-route.sh {domain-path}`,不要自己用 `git log` 目測。多個 domain 就每個各跑一次,可以並行。
|
||||||
|
|
||||||
|
| 結束碼 | 意思 | 怎麼辦 |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| 0 | 改動已在預設分支上 | 走第 2 節的部署路線 |
|
||||||
|
| 3 | 改動還沒併進預設分支 | 走第 3 節的工作樹路線 |
|
||||||
|
| 2 | 用法錯誤 | 修參數重跑 |
|
||||||
|
| 1 | 判不出來:不是 git 存取庫、沒有 origin、fetch 失敗,或取不到預設分支 | 停下回報 stderr 的原因。**1 不等於工作樹路線**,判不出來就問使用者,不要自己挑一條走 |
|
||||||
|
|
||||||
|
完成條件:每個受影響的 domain 存取庫都有一個路線判定,且判定來自腳本輸出的 `route` 欄位。
|
||||||
|
|
||||||
|
## 2. 部署路線(結束碼 0)
|
||||||
|
|
||||||
|
1. 叫用 `jsc-cli:deploy` 的更新模式,讓每支已安裝的 CLI 都載入新版。deploy 收尾會寫 `$JSC_HOME/restart-required.d/{cli}`,一支 CLI 一份;重啟該支 CLI 之後由 `jsc-hooks` 清掉自己那一份。閘門規則見 [`guidelines.md`](guidelines.md) 的「部署後重啟閘門」。
|
||||||
|
2. deploy 更新不了某些 CLI 時,記下哪幾支確實載入了新版,改用其中一支繼續。一支都沒載入就停下,把這次異動回報為未驗證。
|
||||||
|
|
||||||
|
完成條件:`claude plugin list`(或別支已安裝 CLI 的等效指令)印出的 `jsc-{domain}` 版本,等於三份 manifest 現在的版本。
|
||||||
|
|
||||||
|
## 3. 工作樹路線(結束碼 3)
|
||||||
|
|
||||||
|
改動還沒進預設分支,部署路線的完成條件永遠達不到,所以改對**工作樹**驗證:
|
||||||
|
|
||||||
|
1. 第 4 節的驗證對象改成 `{root}/{domain}` 工作樹,不是已安裝的副本。
|
||||||
|
2. 回報標注「工作樹驗證、尚未部署」。
|
||||||
|
3. 點名還沒合併的釋出 PR——改動要等它合進預設分支才會到任何 CLI。跨多個存取庫的異動要等最後一支合併,所以全部列出來。刪除技能還要補一句:PR 合併前技能仍然裝著,指令仍然叫得動。
|
||||||
|
|
||||||
|
完成條件:第 4 節的驗證在每個工作樹上都通過,且回報裡列出每一支待合的釋出 PR。
|
||||||
|
|
||||||
|
## 4. 功能驗證:一定要換一個工作階段
|
||||||
|
|
||||||
|
**部署會把閘門立在自己腳下。** `jsc-cli:deploy` 收尾寫下重啟閘門的狀態檔,緊接著在**同一個工作階段**叫用剛做好的技能,那支技能不在豁免清單上就必被擋;連修復路徑 `jsc-cli:doctor` 與 `jsc-cli:setup` 也一起被擋。
|
||||||
|
|
||||||
|
解法不是把它們加進豁免清單。豁免只擋得住閘門,擋不住「目前行程還載著舊版」這個事實——豁免過關的驗證,驗到的是舊版行為,等於假通過。
|
||||||
|
|
||||||
|
**正解:驗證一律在新的 CLI 行程裡跑。** 用 `jsc-cli/tools/detect-clis.sh` 取得已安裝 CLI 的執行檔路徑,對每支支援非互動 Prompt 的 CLI,另外開一個行程送出最小 Prompt。新行程是新的工作階段,`jsc-hooks` 開場就清掉那支 CLI 自己的狀態檔,載入的也是磁碟上的新版。
|
||||||
|
|
||||||
|
四支技能都不得在部署的那個工作階段內叫用剛異動的技能。
|
||||||
|
|
||||||
|
驗證項目:
|
||||||
|
|
||||||
|
1. 跑 `jsc-meta/tools/list-skills.sh`,確認該技能的列符合這次異動:新增看得到 `{domain}<TAB>{name}` 那一列;更新看得到新的 `description`;刪除看不到那一列。
|
||||||
|
2. 這次異動碰過的每一支工具,都用真實參數跑一次,把實際結束碼對照工具檔頭宣告的意思。
|
||||||
|
3. 每支可測的 CLI 各開一個新行程,送出一個最小 Prompt 叫用 `/jsc-{domain}:{name}`,記錄 CLI 結束碼與 stderr。新增與更新要確認載入的是異動後的 SKILL.md 內文,不是「未知指令」;刪除要確認指令已消失,或替代路徑仍可用。各支 CLI 可以並行送。
|
||||||
|
|
||||||
|
完成條件:上列三項各有結果;每支可測 CLI 的 Prompt 都沒有非預期 stderr;不可測的 CLI 逐支寫明原因。
|
||||||
|
|
||||||
|
## 5. 驗證失敗怎麼辦
|
||||||
|
|
||||||
|
Prompt 因為 CLI 工具、plugin 安裝、hook 接線、模型標籤表或設定而失敗時:
|
||||||
|
|
||||||
|
1. 先跑 `jsc-cli:doctor`,再用 `jsc-cli:setup` 修待修項目,然後在新行程重跑同一個 Prompt。
|
||||||
|
2. hook 冒煙測試失敗,交給 `jsc-hooks:hooks-install`,由它把 hook 接線或執行期錯誤轉給 `jsc-hooks:repair`。
|
||||||
|
3. 根因若在技能組本身的規格、工具或 hook 實作,就修對應 domain,跑 `jsc-meta/tools/sync-skill-manifest.sh {domain-path}` 同步與驗證,再用 `jsc-git:pr` 對 `develop` 開 PR;PR 送出後回到第 1 節重判路線。
|
||||||
|
|
||||||
|
任一項對不上——列不見、結束碼不在工具文件裡、指令載不到、Prompt 失敗、非預期 stderr——就修掉成因,回到第 1 節重跑整段。
|
||||||
|
|
||||||
|
完成條件:每一項不符都有對應的修正動作與重跑結果,沒有留下「已知失敗但照樣收尾」的項目。
|
||||||
+161
-12
@@ -9,15 +9,45 @@
|
|||||||
3. Skill 名稱:小寫、數字、連字號(`-`),最長 64 字元。名稱即指令(`/jsc-{domain}:{name}`)。
|
3. Skill 名稱:小寫、數字、連字號(`-`),最長 64 字元。名稱即指令(`/jsc-{domain}:{name}`)。
|
||||||
4. 每個 domain 是一個獨立存取庫 `https://gitea.jsc.idv.tw/plugins/{domain}.git`。新 domain 必須依 `https://gitea.jsc.idv.tw/plugins/template` 的結構建立新存取庫(三份 plugin manifest、`skills/`、`README.md`、`AGENTS.md`),並把 plugin 條目(URL 來源指向新存取庫)加入 `plugins/meta` 正本的兩份 marketplace 檔,再把更新後的檔案**同步到所有 domain 存取庫**(含新存取庫自己)。
|
4. 每個 domain 是一個獨立存取庫 `https://gitea.jsc.idv.tw/plugins/{domain}.git`。新 domain 必須依 `https://gitea.jsc.idv.tw/plugins/template` 的結構建立新存取庫(三份 plugin manifest、`skills/`、`README.md`、`AGENTS.md`),並把 plugin 條目(URL 來源指向新存取庫)加入 `plugins/meta` 正本的兩份 marketplace 檔,再把更新後的檔案**同步到所有 domain 存取庫**(含新存取庫自己)。
|
||||||
5. Git 分支名**只允許 ASCII**(`a-z0-9` 與 `/`、`-`);中文需求或標題先翻譯成英文短語再 slug 化。
|
5. Git 分支名**只允許 ASCII**(`a-z0-9` 與 `/`、`-`);中文需求或標題先翻譯成英文短語再 slug 化。
|
||||||
6. Manifest 版本號從 `0.0.1` 開始,三份 manifest 同步 bump。
|
6. Manifest 版本號從 `0.0.1` 開始,三份 manifest 同步 bump;`minor` 與 `patch` 不得超過 `9`,滿 `9` 就往左進位,`major` 可以超過 `9`。
|
||||||
|
|
||||||
|
## PR 分支階梯
|
||||||
|
|
||||||
|
所有存取庫的 PR 一律照階梯逐級上推,**禁止越級**。
|
||||||
|
|
||||||
|
| 類型 | 階梯 |
|
||||||
|
| --- | --- |
|
||||||
|
| `feat`、`docs`、`style`、`refactor`、`perf`、`test`、`chore`、`revert` | `{類型}/{子功能}` → `{類型}/{功能}/main` → `develop` → `master` |
|
||||||
|
| `fix` | `fix/{修改}` → `develop` → `master` |
|
||||||
|
|
||||||
|
1. `{子功能}` = `{功能}/{子功能內容中文簡述}`,可以多層,例如 `{A}/{A的子功能B}/{B的子功能C}/{C的子功能}`。
|
||||||
|
2. `{功能}` = 功能內容中文簡述;`{修改}` = 修改內容中文簡述。
|
||||||
|
3. 中文簡述先交給 `jsc-git/tools/slugify.sh` 轉成 ASCII slug,再組成分支名;分支名本身的字元限制見「命名」第 5 條。
|
||||||
|
4. base 一律由 `jsc-git/tools/base-branch.sh --derive` 推導。推不出唯一合法基底就中止並詢問使用者,不猜,也不退回 `develop`。
|
||||||
|
5. 功能主幹 `{類型}/{功能}/main` 不在 origin 上時,自動從 `develop` 建立並推上去,收尾要回報建立了哪一條分支。
|
||||||
|
6. 階梯最後一級不能省:`develop` 併進 `master` 才會生效,marketplace 與 `version-guard.sh` 都讀存取庫的**預設分支**。
|
||||||
|
|
||||||
|
PR 開立、更新、留言修正的收尾回報格式只看 [`references/pr-report.md`](pr-report.md)。所有會產生 PR 的技能都引用那份文件,不在技能內各自抄欄位。
|
||||||
|
|
||||||
## Description 規則
|
## Description 規則
|
||||||
|
|
||||||
1. frontmatter 的 `description` 為一行英文,不超過 5 句或 5 個步驟。
|
1. frontmatter 的 `description` 為一行英文,不超過 5 句或 5 個步驟——**兩個上限滿足任一個就算通過**,句數與步驟數都超過才要精簡。
|
||||||
2. 使用專有名詞、概念或指引詞(例:WBS、TDD、decision tree、STE100)取代解釋。
|
2. 使用專有名詞、概念或指引詞(例:WBS、TDD、decision tree、STE100)取代解釋。
|
||||||
3. 必須寫清楚觸發時機(何時用、何時不用),這是各 CLI 自動載入的唯一依據。
|
3. 必須寫清楚觸發時機(何時用、何時不用),這是各 CLI 自動載入的唯一依據。
|
||||||
4. 複雜流程透過**組合其他技能**實現,不在單一 description 裡塞流程。
|
4. 複雜流程透過**組合其他技能**實現,不在單一 description 裡塞流程。
|
||||||
|
|
||||||
|
## Manifest 相依版本
|
||||||
|
|
||||||
|
1. Plugin 需要另一個 jsc plugin 的技能、工具、hooks、references 或 templates 才能完成自己的流程時,必須在三份 manifest 寫入 `jsc.requires`。
|
||||||
|
2. `jsc.requires` 是物件。鍵是完整 plugin 名稱,格式為 `jsc-{domain}`。值是最低版本,格式為 `>=x.y.z`。
|
||||||
|
3. 沒有跨 plugin 相依時不寫 `jsc.requires`。不要留下空物件。
|
||||||
|
4. 只宣告 jsc plugin 對 jsc plugin 的相依。系統指令、語言執行環境與第三方套件寫在 README 或工具說明,不寫進這個欄位。
|
||||||
|
5. `jsc-cli/tools/check-requires.sh` 是**部署端**相依版本回報的唯一程式來源。`jsc-cli/tools/deploy.sh update` 必須在更新每個 domain 前呼叫它,**版本不符時照樣更新那個 domain**,只在回報裡寫明缺哪一個 plugin 的哪一版,不得靜默略過這段回報。
|
||||||
|
|
||||||
|
**為什麼不跳過。** 跳過更新會讓落後的 domain 永遠更新不到:它落後所以被跳過,被跳過所以永遠落後,更新指令跑幾次都一樣,只能手動拆。相依版本不符要擋的是「拿舊版去跑」,不是「把舊版換成新版」,更新本身正是解除落後的唯一路徑,擋它等於自鎖。
|
||||||
|
|
||||||
|
阻擋改由 `jsc-hooks/hooks/version-guard.sh` 在技能被呼叫的當下執行,規則見「版本前置檢查」。那個時點才擋得住真正會出事的動作,也不會擋掉更新路徑。
|
||||||
|
|
||||||
## 強制力層級
|
## 強制力層級
|
||||||
|
|
||||||
1. 規則的實現優先順序:**hook > prompt**。凡是可以由 hook 強制的規則(語言、計時、統計),一律下放 hook,SKILL.md 只保留 hook 無法涵蓋的指引。
|
1. 規則的實現優先順序:**hook > prompt**。凡是可以由 hook 強制的規則(語言、計時、統計),一律下放 hook,SKILL.md 只保留 hook 無法涵蓋的指引。
|
||||||
@@ -40,7 +70,7 @@
|
|||||||
|
|
||||||
## 語言
|
## 語言
|
||||||
|
|
||||||
1. 所有交談與輸出內容使用 STE100 繁體中文,帶擬人台灣感:短句、一句一指令、主動語態、術語一致、台灣用語、全形標點、去 AI 味、直接講重點。完整規則的唯一來源:[`references/ste100.md`](ste100.md)。
|
1. **所有非程式碼輸出**一律 STE100 繁體中文、UTF-8、無亂碼、無簡體字,帶擬人台灣感:短句、一句一指令、主動語態、術語一致、台灣用語、全形標點、去 AI 味、直接講重點。範圍涵蓋程式碼註解、commit 訊息、PR 描述、wiki 頁、對使用者的回報、README 與各種文件;程式碼本身(識別字、關鍵字、API 名稱)不受此規則限制。完整適用範圍表、編碼要求與替換表的唯一來源:[`references/ste100.md`](ste100.md)。
|
||||||
2. **技能文件(SKILL.md)整份為英文**:frontmatter 與內文都是。風格比照 STE100:短句、祈使句、術語一致。
|
2. **技能文件(SKILL.md)整份為英文**:frontmatter 與內文都是。風格比照 STE100:短句、祈使句、術語一致。
|
||||||
3. 技能文件裡「要原樣輸出的繁中字面內容」保留繁中:wiki 狀態字串(例:已分析、未完成)、hook 注入文字、要寫進 wiki 或 commit 的文案。技能執行時產生的 commit 訊息、PR 描述、wiki 頁內容仍依第 1 條輸出繁中。
|
3. 技能文件裡「要原樣輸出的繁中字面內容」保留繁中:wiki 狀態字串(例:已分析、未完成)、hook 注入文字、要寫進 wiki 或 commit 的文案。技能執行時產生的 commit 訊息、PR 描述、wiki 頁內容仍依第 1 條輸出繁中。
|
||||||
4. README、AGENTS.md、`templates/`、`references/` 為 STE100 繁體中文。中文並列項用頓號「、」,不用半形「/」;英文項目的並列(CLI 名、頁名前綴)可用「/」。
|
4. README、AGENTS.md、`templates/`、`references/` 為 STE100 繁體中文。中文並列項用頓號「、」,不用半形「/」;英文項目的並列(CLI 名、頁名前綴)可用「/」。
|
||||||
@@ -53,6 +83,32 @@
|
|||||||
4. **漸進揭露**:所有分支都需要的內容留在 SKILL.md;只有部分分支需要的參考資料下放 `references/`,以一行指引指過去。
|
4. **漸進揭露**:所有分支都需要的內容留在 SKILL.md;只有部分分支需要的參考資料下放 `references/`,以一行指引指過去。
|
||||||
5. 善用**引導詞**(WBS、CPM、TDD、seam、STE100 等既有概念)取代整段解釋。
|
5. 善用**引導詞**(WBS、CPM、TDD、seam、STE100 等既有概念)取代整段解釋。
|
||||||
|
|
||||||
|
## 技能行為清單
|
||||||
|
|
||||||
|
每個 domain 都要有一份技能行為清單,記下每支技能實際做的事,供稽核與驗證比對。
|
||||||
|
|
||||||
|
| 項目 | 規則 |
|
||||||
|
| --- | --- |
|
||||||
|
| 位置 | 每個 domain 存取庫的 `references/behaviors.md`,UTF-8 無 BOM,內容為 STE100 繁體中文 |
|
||||||
|
| 第一行 | `# jsc-{domain} 技能行為清單` |
|
||||||
|
| 節 | 每支技能一個 `## {技能名}` 節,名稱與 `skills/` 底下的目錄名逐字相同,節數與技能支數一樣,排列照目錄名的字典序 |
|
||||||
|
| 表格 | 每節恰好一張表,表頭兩欄依序是「項目」與「內容」,五列依序為 觸發時機、關鍵步驟、外部呼叫、完成條件、可驗證跡象,每一列的「內容」欄都不得空白 |
|
||||||
|
| 寫什麼 | 寫技能實際的行為:什麼情況會用、什麼情況不該用、依序做了哪些事、呼叫哪些腳本與技能、做到什麼程度算跑完、跑完在環境裡留下哪些查得到的跡象。不要抄 `description` 的行銷語 |
|
||||||
|
| 純唯讀的技能 | 「可驗證跡象」欄寫「無寫入跡象,只有回報內容」,不得留白 |
|
||||||
|
| 更新時機 | 技能異動時在**同一個 PR 內**一起更新:新增技能就加一節、刪除就移除該節、改行為就改該節 |
|
||||||
|
| 檢查腳本 | `jsc-meta/tools/check-behaviors.sh {domain-path}` |
|
||||||
|
|
||||||
|
`check-behaviors.sh` 的結束碼分流:
|
||||||
|
|
||||||
|
| 結束碼 | 意義 |
|
||||||
|
| --- | --- |
|
||||||
|
| 0 | 行為清單與 `skills/` 相符,五個欄位齊全且內容欄非空 |
|
||||||
|
| 1 | 不符:缺節、多節、順序不對、表格不對、缺欄位或欄位空白,逐項印在 stderr,照著修再重跑 |
|
||||||
|
| 2 | 用法錯誤:本腳本只吃一個參數 |
|
||||||
|
| 3 | 找不到 `references/behaviors.md`、找不到 `skills/`,或 `skills/` 底下一支 `SKILL.md` 都沒有。**什麼都沒查,不等於通過**,先補齊檔案再重跑 |
|
||||||
|
|
||||||
|
**為什麼一個 domain 一份,不集中在 `jsc-meta`。** 技能改動與行為清單放同一個存取庫,才進得了同一個 PR;審的人在一頁 diff 上就看得出行為改了、清單也改了。集中在 meta 的話,改一支技能要開兩條 PR,一條在 domain、一條在 meta,兩條互相等待,先併的那條讓清單與技能對不上,稽核抓到的是自己造出來的漂移。跨存取庫的東西沒有原子性,同一份事實就不要拆兩邊放。
|
||||||
|
|
||||||
## 環境變數
|
## 環境變數
|
||||||
|
|
||||||
| 變數 | 用途 | 未設定時 |
|
| 變數 | 用途 | 未設定時 |
|
||||||
@@ -63,27 +119,40 @@
|
|||||||
| `JSC_WIKI_REPO_PLAN` | `PLAN_CONTENTS`、`PLAN_{HASH}` 所在的 `{owner}/{repo}` | 退回 `JSC_WIKI_REPO` |
|
| `JSC_WIKI_REPO_PLAN` | `PLAN_CONTENTS`、`PLAN_{HASH}` 所在的 `{owner}/{repo}` | 退回 `JSC_WIKI_REPO` |
|
||||||
| `JSC_WIKI_REPO_ANALYZE` | `ANALYZE_CONTENTS`、`ANALYZE_{HASH}` 所在的 `{owner}/{repo}` | 退回 `JSC_WIKI_REPO` |
|
| `JSC_WIKI_REPO_ANALYZE` | `ANALYZE_CONTENTS`、`ANALYZE_{HASH}` 所在的 `{owner}/{repo}` | 退回 `JSC_WIKI_REPO` |
|
||||||
| `JSC_WIKI_REPO_DELIVER` | `DELIVER_CONTENTS`、`DELIVER_{HASH}` 所在的 `{owner}/{repo}` | 退回 `JSC_WIKI_REPO` |
|
| `JSC_WIKI_REPO_DELIVER` | `DELIVER_CONTENTS`、`DELIVER_{HASH}` 所在的 `{owner}/{repo}` | 退回 `JSC_WIKI_REPO` |
|
||||||
| `JSC_WIKI_REPO_MAINTAIN` | `MAINTAIN_CONTENTS`、`MAINTAIN_{HASH}` 所在的 `{owner}/{repo}` | 退回 `JSC_WIKI_REPO` |
|
| `JSC_WIKI_REPO_MAINTAIN` | `MAINTAIN_CONTENTS` 所在的 `{owner}/{repo}`(本類型只有目錄頁) | 退回 `JSC_WIKI_REPO` |
|
||||||
| `JSC_WIKI_REPO_REPO` | `REPO_CONTENTS`、`REPO_{HASH}` 所在的 `{owner}/{repo}` | 退回 `JSC_WIKI_REPO` |
|
| `JSC_WIKI_REPO_REPO` | `REPO_CONTENTS`、`REPO_{HASH}` 所在的 `{owner}/{repo}` | 退回 `JSC_WIKI_REPO` |
|
||||||
| `JSC_WIKI_REPO_LOG` | `LOG_CONTENTS`、`LOG_{HASH}` 所在的 `{owner}/{repo}` | 退回 `JSC_WIKI_REPO` |
|
| `JSC_WIKI_REPO_LOG` | `LOG_CONTENTS`、`LOG_{HASH}` 所在的 `{owner}/{repo}` | 退回 `JSC_WIKI_REPO` |
|
||||||
| `JSC_WIKI_REPO_LEARN` | `LEARN_CONTENTS`、`LEARN_{HASH}` 所在的 `{owner}/{repo}` | 退回 `JSC_WIKI_REPO` |
|
| `JSC_WIKI_REPO_LEARN` | `LEARN_CONTENTS`、`LEARN_{HASH}` 所在的 `{owner}/{repo}` | 退回 `JSC_WIKI_REPO` |
|
||||||
| `JSC_WIKI_REPO_ERROR` | `ERROR_CONTENTS`、`ERROR_{HASH}` 所在的 `{owner}/{repo}` | 退回 `JSC_WIKI_REPO` |
|
| `JSC_WIKI_REPO_ERROR` | `ERROR_CONTENTS`、`ERROR_{HASH}` 所在的 `{owner}/{repo}` | 退回 `JSC_WIKI_REPO` |
|
||||||
|
| `JSC_WIKI_REPO_CHECK` | `CHECK_CONTENTS`、`CHECK_{HASH}` 所在的 `{owner}/{repo}` | 退回 `JSC_WIKI_REPO` |
|
||||||
|
| `JSC_WIKI_REPO_REPORT` | `REPORT_CONTENTS`、`REPORT_{HASH}` 所在的 `{owner}/{repo}` | 退回 `JSC_WIKI_REPO` |
|
||||||
|
| `JSC_WIKI_REPO_SKILLSET` | `SKILLSET_CONTENTS`、`SKILLSET_{HASH}` 所在的 `{owner}/{repo}` | 退回 `JSC_WIKI_REPO` |
|
||||||
|
| `JSC_WIKI_REPO_TOOLING` | `TOOLING_CONTENTS`、`TOOLING_{HASH}` 所在的 `{owner}/{repo}` | 退回 `JSC_WIKI_REPO` |
|
||||||
| `JSC_WIKI_REPO` | 未逐類設定時的共用 wiki `{owner}/{repo}` | 詢問使用者 |
|
| `JSC_WIKI_REPO` | 未逐類設定時的共用 wiki `{owner}/{repo}` | 詢問使用者 |
|
||||||
| `JSC_HOME` | Hook 資料目錄 | 預設 `~/.jsc` |
|
| `JSC_HOME` | Hook 資料目錄 | 預設 `~/.jsc` |
|
||||||
|
| `JSC_PR_WATCH_INTERVAL` | `jsc-gitea/tools/pr-watch.sh` 輪詢 PR 狀態的間隔秒數 | 預設 60 |
|
||||||
|
| `JSC_RESTART_GATE` | 部署後重啟閘門的開關,`off` 關閉整道閘門 | 閘門開啟 |
|
||||||
|
|
||||||
頁面類型只讀自己的 `JSC_WIKI_REPO_{TYPE}`。只有該變數未設定時,才退回 `JSC_WIKI_REPO`。不得跨類型代用。
|
頁面類型只讀自己的 `JSC_WIKI_REPO_{TYPE}`。只有該變數未設定時,才退回 `JSC_WIKI_REPO`。不得跨類型代用。
|
||||||
|
|
||||||
## 版本前置檢查
|
## 版本前置檢查
|
||||||
|
|
||||||
技能組的每一支技能在被呼叫前都要確認本機版本沒有落後遠端發佈版本。判定在程式層,由 `jsc-hooks` 的 `version-guard.sh`(PreToolUse,matcher `Skill`)執行,**不靠技能內文自我約束**——寫在內文的規則,模型可以無視。
|
技能組的每一支技能在被呼叫前都要過兩道版本檢查:本機載入版本沒有落後遠端發佈版本,以及這支技能所屬 plugin 宣告的 `jsc.requires` 每一項都吃得到。兩道判定都在程式層,由 `jsc-hooks` 的 `version-guard.sh`(PreToolUse,matcher `Skill`)執行,**不靠技能內文自我約束**——寫在內文的規則,模型可以無視。
|
||||||
|
|
||||||
|
兩道都只擋「確定落後」一種情況。查不到任何一項基礎資訊就安靜放行(exit 0),不要求先修好環境:五支 CLI 只有 claude 讀得到本機載入版本,fail-closed 會把另外四支整批鎖死。
|
||||||
|
|
||||||
| 項目 | 規則 |
|
| 項目 | 規則 |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| 比對對象 | 遠端發佈版本(`master` 的 `plugin.json`)對本機**實際載入**版本 |
|
| 比對對象 | 遠端發佈版本(存取庫**預設分支**的 `plugin.json`,經 `jsc-gitea/tools/gitea.sh` 讀取,不寫死分支名)對本機**實際載入**版本 |
|
||||||
| 實際載入版本 | 讀 `installed_plugins.json` 的 `installPath` 底下那份 `plugin.json`,**不可只看註冊欄位**——兩者可能不同,只看註冊值會放過真正被載入的舊版 |
|
| 實際載入版本 | 只認 `installed_plugins.json` 的 `installPath` 底下那份 `plugin.json`。註冊在 `installed_plugins.json` 的 `version` 欄位**不當備援**——註冊值可能比實際載入的版本新,拿它來比對會放過真正被載入的舊版 |
|
||||||
| 落後 | 擋下該次技能呼叫(exit 2),並印出更新指令 |
|
| 落後 | 擋下該次技能呼叫(exit 2),並印出更新指令 |
|
||||||
| 相等或超前 | 放行。開發技能組時本機本來就會超前 `master`,擋下去維護者自己動不了 |
|
| 相等或超前 | 放行。開發技能組時本機本來就會超前預設分支,擋下去維護者自己動不了 |
|
||||||
| 查不到遠端版本 | **擋**(fail-closed)。查詢失敗會重試一次,仍失敗才擋 |
|
| 查不到本機載入版本 | **放行**(exit 0,安靜降級)。讀不到 `installed_plugins.json`、裡面沒有該 plugin 的條目、取不到 `installPath`、`installPath` 底下那份 `plugin.json` 讀不到,四種都算這一列,不退回註冊欄位 |
|
||||||
|
| 解不出 Gitea 站台 | **放行**(exit 0,安靜降級) |
|
||||||
|
| 查不到遠端版本 | **放行**(exit 0,安靜降級)。缺基礎設施不等於落後,擋下去會把四支非 Claude CLI 整批鎖死 |
|
||||||
|
| 相依版本落後 | 這支技能所屬 plugin 的 `jsc.requires` 有一項落後就擋下該次呼叫(exit 2),印出缺哪一個 plugin 的哪一版與更新指令。版本比對由 `version-guard.sh` 自己實作,不呼叫 `jsc-cli/tools/check-requires.sh`:hook 專屬存放於 `jsc-hooks`(見「Hook 規則」第 1 條),而且 `jsc-cli` 已宣告相依 `jsc-hooks`,反過來呼叫會做出循環相依。兩支的比法要保持一致,改動任一支就回頭核對另一支 |
|
||||||
|
| 相依版本相等或超前 | 放行。每一項都吃得到才算過 |
|
||||||
|
| 查不到相依資訊 | **放行**(exit 0,安靜降級)。解不出這支技能所屬 plugin 的安裝路徑、讀不到它的 manifest、manifest 沒有 `jsc.requires`、查不到某一項相依 plugin 的本機載入版本,四種都算這一列 |
|
||||||
| 逃生門 | `JSC_VERSION_GUARD=off`(離線工作用),快取秒數 `JSC_VERSION_TTL`(預設 600) |
|
| 逃生門 | `JSC_VERSION_GUARD=off`(離線工作用),快取秒數 `JSC_VERSION_TTL`(預設 600) |
|
||||||
|
|
||||||
**豁免清單**(永遠放行,改動前想清楚後果):
|
**豁免清單**(永遠放行,改動前想清楚後果):
|
||||||
@@ -92,14 +161,57 @@
|
|||||||
| --- | --- |
|
| --- | --- |
|
||||||
| `jsc-cli:deploy` | 更新整組技能的入口。擋了就沒有任何方法更新,形成死鎖 |
|
| `jsc-cli:deploy` | 更新整組技能的入口。擋了就沒有任何方法更新,形成死鎖 |
|
||||||
| `jsc-hooks:hooks-install` | 更新後要重新接線,擋了會讓更新做一半卡住 |
|
| `jsc-hooks:hooks-install` | 更新後要重新接線,擋了會讓更新做一半卡住 |
|
||||||
|
| `jsc-hooks:repair` | hook 壞掉時的唯一修復路徑。擋了就修不好 hook |
|
||||||
| `jsc-cli:models` | SDLC 階段閘門依賴它產生 `model-tags.tsv` |
|
| `jsc-cli:models` | SDLC 階段閘門依賴它產生 `model-tags.tsv` |
|
||||||
| `jsc-meta:*` | 開發技能組本身的工具,擋了就修不了技能組 |
|
| `jsc-meta:*` | 開發技能組本身的工具,擋了就修不了技能組 |
|
||||||
|
| `jsc-ask:ask` | 上面幾支都要問使用者 |
|
||||||
|
| `jsc-gitea:wiki` | 上面幾支的收尾要寫 wiki |
|
||||||
|
|
||||||
|
共 7 項。**兩道檢查共用這一份清單,不另立一份。** 豁免的理由兩道完全一樣:這幾支是解除落後的唯一路徑,擋了就沒有東西能把版本補上來。分成兩份只會兩邊漂移,改了一份、忘了另一份,`deploy` 照樣被相依版本擋死。這張表的唯一真實來源是 `jsc-hooks/hooks/version-guard.sh` 的檔頭與豁免清單,兩邊要逐項對齊。
|
||||||
|
|
||||||
|
相依版本檢查移到這裡,是因為 `deploy.sh update` 原本會跳過不符的 domain,跳過就永遠更新不到,理由見「Manifest 相依版本」第 5 條。更新照跑、呼叫才擋,落後的 domain 才有路徑補上來。
|
||||||
|
|
||||||
沒有 pre-tool hook 的 CLI 接不上這道檢查,`hooks-install` 要據實回報,不得暗示每個 CLI 都有保護。
|
沒有 pre-tool hook 的 CLI 接不上這道檢查,`hooks-install` 要據實回報,不得暗示每個 CLI 都有保護。
|
||||||
|
|
||||||
|
## 部署後重啟閘門
|
||||||
|
|
||||||
|
部署換掉的是磁碟上的技能檔,目前工作階段載入的還是舊版。這段落差期間跑技能,改動看起來沒生效,人會以為部署失敗又重跑一次。
|
||||||
|
|
||||||
|
| 項目 | 規則 |
|
||||||
|
| --- | --- |
|
||||||
|
| 狀態檔 | `$JSC_HOME/restart-required.d/{cli}`,**一支 CLI 一份**,由 `jsc-cli:deploy` 收尾寫入 |
|
||||||
|
| 清除時機 | 重啟 CLI 之後由 `jsc-hooks` 清除**自己那一份**,不必手動刪 |
|
||||||
|
| 該 CLI 那份存在時 | 擋下這支 CLI 的 jsc 技能呼叫,印出要重啟哪一支與狀態檔路徑 |
|
||||||
|
| 該 CLI 那份不存在時 | 放行。別支 CLI 的狀態檔不影響這一支 |
|
||||||
|
| 判定位置 | 程式層,由 `jsc-hooks` 執行,不靠技能內文自我約束 |
|
||||||
|
| 逃生門 | `JSC_RESTART_GATE=off` |
|
||||||
|
|
||||||
|
**豁免清單**(狀態檔存在也放行):
|
||||||
|
|
||||||
|
| 技能 | 為什麼不能擋 |
|
||||||
|
| --- | --- |
|
||||||
|
| `jsc-cli:deploy` | 部署本身的入口。擋了就沒有方法重跑部署,形成死鎖 |
|
||||||
|
| `jsc-hooks:hooks-install` | 部署後要重新接線,擋了會讓部署做一半卡住 |
|
||||||
|
| `jsc-hooks:repair` | hook 壞掉時的唯一修復路徑。擋了就修不好 hook |
|
||||||
|
| `jsc-gitea:wiki` | 寫 `SKILLSET_{HASH}` 異動報告與工作日誌的唯一路徑 |
|
||||||
|
| `jsc-log:worklog` | 部署後還要結清工作日誌 |
|
||||||
|
| `jsc-log:learn` | 部署後還要記這次的教訓 |
|
||||||
|
| `jsc-meta:*` | 開發技能組本身的工具,擋了就修不了技能組 |
|
||||||
|
| `jsc-ask:ask` | 上面幾支都要問使用者。擋了 `deploy` 連 install 或 update 都問不出來 |
|
||||||
|
| `jsc-git:pr` | 報告與異動的收尾要開 PR,擋了收尾做不完 |
|
||||||
|
| `jsc-git:commit` | 同上,`pr` 的第一步就是它 |
|
||||||
|
|
||||||
|
豁免這幾支的理由是同一件事:`jsc-meta` 四支異動技能的收尾要求把驗證結果寫進 `SKILLSET_{HASH}`,還要結清工作日誌,而這條路徑必經 `jsc-gitea:wiki` 與 `jsc-log`。全擋的話,部署一跑完就沒有路徑寫完報告,重啟閘門與報告要求互相打死。閘門不自鎖的通則見「審核檢查清單」的流程檢查第 4 項。共 10 項;這張表的唯一真實來源是 `jsc-hooks/hooks/restart-gate.sh` 的檔頭與豁免清單,兩邊要逐項對齊。
|
||||||
|
|
||||||
|
**豁免清單不是自鎖的通解。** 部署剛跑完就要在同一個工作階段叫用剛做好的技能,那支技能本來就不該靠豁免過關——豁免只擋得住這一道閘門,擋不住「行程還載著舊版」這個事實,驗證結果會是舊版的行為。正解是換一個工作階段:由 `jsc-cli/tools/detect-clis.sh` 開出的新 CLI 行程去叫用,新行程自己會清掉那份狀態檔,載到的也是新版。做法見 [`deploy-verify.md`](deploy-verify.md)。
|
||||||
|
|
||||||
|
**狀態檔為什麼一支 CLI 一份。** 這道閘門管的是「這支 CLI 的行程還在跑舊版」,那是每支 CLI 各自的事實。初版用全機器單一檔案,2026-08-27 部署時實測出兩個後果:並行部署互相覆蓋,`cli=` 與 `domains=` 只留最後一支;更嚴重的是清除也是全域的,**任一支 CLI 重啟就解除全部五支的閘門**,其餘四支沒重啟卻不再被擋,這道閘門在多 CLI 環境等於半失效。改成 per-CLI 之後,`require` 寫自己那份、判定只看自己那份、`clear` 只刪自己那份,`report` 才列得出「哪幾支還沒重啟」。**跨 CLI 或跨工作階段的狀態檔,設計時先問清楚那個事實屬於誰**——同一類錯誤在工作包歸屬狀態檔上也踩過,解法見 `jsc-sdlc/tools/wp-gate.sh` 的 `claim` 與 `owns`:`claim` 在領包當下把歸屬登錄成「這個存取庫目前是哪一包」,`owns` 查驗每支 PR 是不是自己那一包的,兩層各管一件事實,狀態檔也刻意不綁工作階段。
|
||||||
|
|
||||||
|
**清單認的是技能名,不是呼叫鏈。** 豁免技能轉呼叫的下一層若不在清單上,那一層照樣會被擋。後三支(`jsc-ask:ask`、`jsc-git:pr`、`jsc-git:commit`)自己不是收尾規則的主體,是為了讓前七支走得完才補進來的。`version-guard.sh` 的豁免清單當年也是為同一個原因收進 `jsc-ask:ask`。新增豁免技能時要一併想它會呼叫誰。
|
||||||
|
|
||||||
## Wiki 頁命名總表
|
## Wiki 頁命名總表
|
||||||
|
|
||||||
所有 wiki 頁面一律採雙層命名:
|
所有 wiki 頁面一律採雙層命名。`MAINTAIN` 是唯一只有目錄頁的類型,理由見表下:
|
||||||
|
|
||||||
| 類型 | 目錄頁 | 內容頁 | 用途 | 擁有者 |
|
| 類型 | 目錄頁 | 內容頁 | 用途 | 擁有者 |
|
||||||
| --- | --- | --- | --- | --- |
|
| --- | --- | --- | --- | --- |
|
||||||
@@ -107,26 +219,63 @@
|
|||||||
| `PLAN` | `PLAN_CONTENTS` | `PLAN_{HASH}` | 計畫目錄、計畫頁 | jsc-sdlc |
|
| `PLAN` | `PLAN_CONTENTS` | `PLAN_{HASH}` | 計畫目錄、計畫頁 | jsc-sdlc |
|
||||||
| `ANALYZE` | `ANALYZE_CONTENTS` | `ANALYZE_{HASH}` | 分析目錄、分析頁 | jsc-sdlc |
|
| `ANALYZE` | `ANALYZE_CONTENTS` | `ANALYZE_{HASH}` | 分析目錄、分析頁 | jsc-sdlc |
|
||||||
| `DELIVER` | `DELIVER_CONTENTS` | `DELIVER_{HASH}` | 交付目錄、工作包交付文件 | jsc-sdlc |
|
| `DELIVER` | `DELIVER_CONTENTS` | `DELIVER_{HASH}` | 交付目錄、工作包交付文件 | jsc-sdlc |
|
||||||
| `MAINTAIN` | `MAINTAIN_CONTENTS` | `MAINTAIN_{HASH}` | 維護目錄、維護頁 | jsc-sdlc |
|
| `MAINTAIN` | `MAINTAIN_CONTENTS` | 無 | 維護登記目錄:登記進維護期的專案、維護方式、起訖日期與前次維護時間 | jsc-sdlc |
|
||||||
| `REPO` | `REPO_CONTENTS` | `REPO_{HASH}` | 盤點目錄、存取庫盤點頁 | jsc-sdlc |
|
| `REPO` | `REPO_CONTENTS` | `REPO_{HASH}` | 盤點目錄、存取庫盤點頁 | jsc-sdlc |
|
||||||
| `LOG` | `LOG_CONTENTS` | `LOG_{HASH}` | 日誌目錄、工作日誌頁 | jsc-log |
|
| `LOG` | `LOG_CONTENTS` | `LOG_{HASH}` | 日誌目錄、工作日誌頁 | jsc-log |
|
||||||
| `LEARN` | `LEARN_CONTENTS` | `LEARN_{HASH}` | 教訓目錄、技能教訓頁 | jsc-log |
|
| `LEARN` | `LEARN_CONTENTS` | `LEARN_{HASH}` | 教訓目錄、技能教訓頁 | jsc-log |
|
||||||
| `ERROR` | `ERROR_CONTENTS` | `ERROR_{HASH}` | 異常目錄、異常頁 | jsc-hooks |
|
| `ERROR` | `ERROR_CONTENTS` | `ERROR_{HASH}` | 異常目錄、異常頁 | jsc-hooks |
|
||||||
|
| `CHECK` | `CHECK_CONTENTS` | `CHECK_{HASH}` | 體檢目錄、執行環境體檢頁 | jsc-cli |
|
||||||
|
| `REPORT` | `REPORT_CONTENTS` | `REPORT_{HASH}` | 報表目錄、工作報表頁(年、月、週、日各一頁) | jsc-log |
|
||||||
|
| `SKILLSET` | `SKILLSET_CONTENTS` | `SKILLSET_{HASH}` | 技能組異動目錄、技能組異動報告頁(新增、更新、刪除、批次更新之後的驗證結果與改動清單) | jsc-meta |
|
||||||
|
| `TOOLING` | `TOOLING_CONTENTS` | `TOOLING_{HASH}` | 技能盤點目錄、單機單 CLI 的技能盤點頁:一台機器上某一支 CLI 的已安裝 plugin 與版本、可用技能、hook 接線狀態 | jsc-meta |
|
||||||
|
|
||||||
|
`MAINTAIN` 沒有內容頁。維護登記全部寫在 `MAINTAIN_CONTENTS` 的表格裡:`jsc-sdlc:implement` 只往那一頁附加登記,`jsc-sdlc:maintain` 只讀那一頁再回寫「前次維護時間」,兩支都沒有產生 `MAINTAIN_{HASH}` 的步驟,`jsc-sdlc/templates/` 也沒有對應範本。總表以前列著這個內容頁,照著找只會找到一個不存在的頁。要補內容頁就先補技能步驟與範本,不能只在總表上寫著。
|
||||||
|
|
||||||
`{HASH}` 一律為 `{owner}/{repo}`(必要時加上主題字串)的 SHA-1 前 8 碼,大寫。
|
`{HASH}` 一律為 `{owner}/{repo}`(必要時加上主題字串)的 SHA-1 前 8 碼,大寫。
|
||||||
若第一碼是 `0-9`、`A`、`B`、`C`,就改成 `H` 加上原 SHA-1 前 7 碼,總長仍維持 8 碼。
|
若第一碼是 `0-9`、`A`、`B`、`C`,就改成 `H` 加上原 SHA-1 前 7 碼,總長仍維持 8 碼。
|
||||||
同一規則套用到所有目錄頁與內容頁。
|
同一規則套用到所有目錄頁與內容頁。
|
||||||
|
|
||||||
|
`REPORT` 用得到那個主題字串:雜湊來源為 `{owner}/{repo}/{期間}`,期間是 `daily`、`weekly`、`monthly`、`yearly` 其中之一。
|
||||||
|
年、月、週、日各自一頁,每頁內依期間累積分節。
|
||||||
|
|
||||||
|
`SKILLSET` 的雜湊來源就是被改動的 domain 存取庫 `{owner}/{repo}`,算法同上,由同一支 `jsc-gitea/tools/hash-id` 產生。
|
||||||
|
頁內**累積**歷次異動:每次異動附加一節,不覆蓋舊紀錄。要看一支技能改過幾次,就在同一頁上翻。
|
||||||
|
|
||||||
|
`CHECK` 是唯一例外:它記的是一台執行環境,不是一個存取庫,所以雜湊來源為 `{主機名}/{登入帳號}`。
|
||||||
|
8 碼與 `H` 前綴的算法完全相同,由同一支 `jsc-gitea/tools/hash-id` 產生。
|
||||||
|
在沒有存取庫的目錄也跑得出體檢,是這個例外存在的原因。
|
||||||
|
|
||||||
|
`TOOLING` 記的也是機器層事實,雜湊來源再多一段:`{主機名}/{工具名稱}/{登入帳號}`。
|
||||||
|
`{工具名稱}` 是 CLI 代號,取自 `jsc-cli/tools/detect-clis.sh` 輸出的第一欄,值為 `claude`、`codex`、`copilot`、`antigravity`、`kiro` 其中之一。
|
||||||
|
一台機器、一支 CLI、一個帳號各一頁;算法同上,由同一支 `jsc-gitea/tools/hash-id` 產生。
|
||||||
|
|
||||||
|
**為什麼要帶工具名稱。** 每支 CLI 各有自己的已安裝 plugin 集合,也各有自己的 hook 接線狀態,那是五組互相獨立的事實。
|
||||||
|
少了中間那一段,同一台機器上五支 CLI 會算出同一個雜湊,五份盤點互相覆蓋,最後只剩最後寫入的那一支,讀的人卻看不出被蓋掉。
|
||||||
|
帶上工具名稱,一支 CLI 就有一頁,換一支 CLI 重跑也不會動到別支的頁。
|
||||||
|
|
||||||
## 審核檢查清單
|
## 審核檢查清單
|
||||||
|
|
||||||
新增或更新技能後逐項檢查,任一不符就修正:
|
新增或更新技能後逐項檢查,任一不符就修正:
|
||||||
|
|
||||||
- [ ] 名稱符合命名規則,且與既有技能目標不重複
|
- [ ] 名稱符合命名規則,且與既有技能目標不重複
|
||||||
- [ ] description 為英文、≤ 5 句或 5 步驟、含觸發時機
|
- [ ] description 為英文、≤ 5 句或 ≤ 5 步驟(滿足任一即通過)、含觸發時機(何時用、何時不用)
|
||||||
- [ ] 可 hook 的規則已下放 jsc-hooks;可工具化的流程已下放 tools/;SKILL.md 沒有保留可由標準輸入輸出執行的細節流程
|
- [ ] 可 hook 的規則已下放 jsc-hooks;可工具化的流程已下放 tools/;SKILL.md 沒有保留可由標準輸入輸出執行的細節流程
|
||||||
- [ ] 細節流程已標示 MUST run as a sub agent
|
- [ ] 細節流程已標示 MUST run as a sub agent
|
||||||
- [ ] gitea 操作透過 gitea.sh 或 tea
|
- [ ] gitea 操作透過 gitea.sh 或 tea
|
||||||
- [ ] wiki repo 與 Gitea 認證先讀目前 shell 繼承的環境變數;只有缺值或無法解析時才詢問;頁面類型不得跨用其他 `JSC_WIKI_REPO_{TYPE}`
|
- [ ] wiki repo 與 Gitea 認證先讀目前 shell 繼承的環境變數;只有缺值或無法解析時才詢問;頁面類型不得跨用其他 `JSC_WIKI_REPO_{TYPE}`
|
||||||
- [ ] 問詢透過 jsc-ask 決策樹規則
|
- [ ] 問詢透過 jsc-ask 決策樹規則
|
||||||
|
- [ ] `tools/` 與 `hooks/` 內的 shell 腳本都通過 `sh -n`;技能直接呼叫的腳本都存在、可執行,且退出碼有分流
|
||||||
|
- [ ] hook 相關變更已用 `jsc-hooks/tools/wire-cli.sh smoke {cli}` 實測;沒有偵測到 CLI 時,至少跑 `smoke codex` 並標明是預設 hook smoke。行數讀腳本自己印的 `lines` 那一行,**技能與 README 都不得寫死數字**——腳本會自我斷言,抄一份數字進文件,加減判定路徑時就漂移,稽核反而被舊數字誤導
|
||||||
|
- [ ] 唯讀的稽核與體檢流程呼叫 `wire-cli.sh` 時帶 `JSC_READONLY=1`:打錯子命令就由程式擋下(exit 6),不靠呼叫端自我約束;`status` 與 `smoke` 不受影響
|
||||||
- [ ] SKILL.md 整份為英文(要原樣輸出的繁中字面除外);README、AGENTS、templates、references 為 STE100 繁中;UTF-8 無亂碼
|
- [ ] SKILL.md 整份為英文(要原樣輸出的繁中字面除外);README、AGENTS、templates、references 為 STE100 繁中;UTF-8 無亂碼
|
||||||
|
- [ ] 所有非程式碼輸出(程式碼註解、commit 訊息、PR 描述、wiki 頁、回報、文件)為繁體中文、UTF-8、無亂碼、無簡體字,且 `tools/ste100-lint.sh` 對該 domain 全綠
|
||||||
|
- [ ] 該 domain 的 `references/behaviors.md` 與 `skills/` 相符,`tools/check-behaviors.sh {domain-path}` 對該 domain 退出 0;退出 3 是「什麼都沒查」,不算通過
|
||||||
- [ ] 已同步更新該 domain 的 README「Skills 目錄」與三份 manifest 的 version
|
- [ ] 已同步更新該 domain 的 README「Skills 目錄」與三份 manifest 的 version
|
||||||
|
- [ ] PR 的 base 符合「PR 分支階梯」,沒有越級
|
||||||
|
|
||||||
|
流程檢查四項,對照技能自己的流程逐項確認:
|
||||||
|
|
||||||
|
- [ ] 技能內外引用的步驟編號、檔案路徑、節標題都真的存在,指標指得到。踩過的實例:規則搬到 `references/` 後指標指向空處,照著指過去只看到空白
|
||||||
|
- [ ] 每個步驟以可檢核的完成條件結尾,沒有「理解後」「適當地」這類模糊語
|
||||||
|
- [ ] 每個外部呼叫(腳本、API、其他技能)的失敗情況都有明寫怎麼辦,退出碼都有分流
|
||||||
|
- [ ] 技能自己裝的閘門不會擋掉解除那道閘門的唯一路徑(閘門不自鎖)。踩過的實例:工作包閘門若擋掉 `implement`,結清 PR 就沒有路徑
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
# PR 收尾回報
|
||||||
|
|
||||||
|
所有會建立或更新 PR 的技能都用本頁格式回報。不要在各技能複製欄位定義。
|
||||||
|
|
||||||
|
## PR 資訊表格
|
||||||
|
|
||||||
|
只要本輪建立 PR、找到既有 PR,或更新既有 PR,就在回報中列出同一張表。
|
||||||
|
|
||||||
|
| {owner}/{repo} | PR 編號 | PR 連結 | PR 簡述 |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| `{owner}/{repo}` | `{number}` | `{url}` | `{title or one-line summary}` |
|
||||||
|
|
||||||
|
同一輪有多支 PR 時,全部放在同一張表。沒有 PR 時不要印空表,改用一句話說明沒有建立或更新 PR。
|
||||||
|
|
||||||
|
## 留言回覆
|
||||||
|
|
||||||
|
依 PR 留言完成修正、判定不需修正,或判定無法修正後,必須回覆原留言。
|
||||||
|
|
||||||
|
回覆一律走 `jsc-gitea/tools/gitea.sh comment-reply`。不要自行拼 API。
|
||||||
|
|
||||||
|
`pr-comments` 第三欄會標出留言類型與 id。呼叫 `comment-reply` 時使用下列對應。
|
||||||
|
|
||||||
|
| `pr-comments` 第三欄 | `comment-reply` 類型 |
|
||||||
|
| --- | --- |
|
||||||
|
| `留言#{id}` | `issue` |
|
||||||
|
| `審查#{id}` | `review` |
|
||||||
|
| `行內#{id}(...)` | `inline` |
|
||||||
|
|
||||||
|
回覆內容固定包含兩項:
|
||||||
|
|
||||||
|
| 項目 | 內容 |
|
||||||
|
| --- | --- |
|
||||||
|
| 處理結果 | 已修、不需修,或無法修 |
|
||||||
|
| 依據 | commit、檔案,或不修理由 |
|
||||||
|
|
||||||
|
完成條件:本輪處理過的每一則留言,都有對應的回覆連結或明確的回覆失敗原因。
|
||||||
+27
-2
@@ -4,11 +4,36 @@ jsc 技能組所有交談與文件的語言規則,唯一來源在這裡。基
|
|||||||
|
|
||||||
上游版本:speak-human-tw v1.4.0(2026-07-18)。上游有新版時用 `jsc-meta:ste100-sync` 同步。
|
上游版本:speak-human-tw v1.4.0(2026-07-18)。上游有新版時用 `jsc-meta:ste100-sync` 同步。
|
||||||
|
|
||||||
|
## 適用範圍
|
||||||
|
|
||||||
|
**所有非程式碼輸出一律適用**。程式碼本身不受限。
|
||||||
|
|
||||||
|
| 對象 | 適用 | 說明 |
|
||||||
|
| :-- | :-- | :-- |
|
||||||
|
| 程式碼註解 | 是 | 含檔頭說明與行內註解 |
|
||||||
|
| commit 訊息 | 是 | 標題與內文;type 與 scope 仍為英文 |
|
||||||
|
| PR 描述 | 是 | 標題、各節內文 |
|
||||||
|
| wiki 頁內容 | 是 | 頁名前綴與範本欄位名維持英文 |
|
||||||
|
| 對使用者的回報 | 是 | 交談、進度回報、錯誤說明 |
|
||||||
|
| README、AGENTS.md | 是 | |
|
||||||
|
| `references/`、`templates/` | 是 | |
|
||||||
|
| 程式碼識別字、關鍵字、API 名稱 | 否 | 變數、函式、型別、參數、指令、路徑、URL |
|
||||||
|
| SKILL.md | 否 | 整份英文,規則見 `guidelines.md`「語言」 |
|
||||||
|
|
||||||
## 基礎紀律
|
## 基礎紀律
|
||||||
|
|
||||||
1. 短句,一句一指令,主動語態。
|
1. 短句,一句一指令,主動語態。
|
||||||
2. 同一個概念全程用同一個詞,不換詞循環。
|
2. 同一個概念全程用同一個詞,不換詞循環。
|
||||||
3. UTF-8,無亂碼。
|
|
||||||
|
## 編碼
|
||||||
|
|
||||||
|
| 要求 | 內容 | 常見違規 |
|
||||||
|
| :-- | :-- | :-- |
|
||||||
|
| UTF-8 | 檔案一律 UTF-8(無 BOM) | Big5、GBK 存檔 |
|
||||||
|
| 無亂碼 | 不得出現替代字元或雙重編碼殘留 | `�`、`�`、`ä`、`â` 開頭的三字元序列 |
|
||||||
|
| 無簡體字 | 一律繁體字形 | 应、这、说、国、网、码 |
|
||||||
|
|
||||||
|
亂碼多半來自轉檔或複製貼上,肉眼容易漏掉,交給 `tools/ste100-lint.sh` 的「亂碼」類別擋。
|
||||||
|
|
||||||
## 台灣用語
|
## 台灣用語
|
||||||
|
|
||||||
@@ -63,4 +88,4 @@ jsc 技能組所有交談與文件的語言規則,唯一來源在這裡。基
|
|||||||
|
|
||||||
## 機檢
|
## 機檢
|
||||||
|
|
||||||
可機檢的部分(中國用語、中文句內半形標點、AI 套話)用 `tools/ste100-lint.sh <file|dir>` 檢查,命中 exit 1。掃描時跳過本檔(規則文件裡的詞是被討論,不是被使用);語感與翻譯腔仍要人工判讀。
|
可機檢的部分(中國用語、中文句內半形標點、AI 套話、簡體字、亂碼、並列斜線)用 `tools/ste100-lint.sh <file|dir>` 檢查,命中 exit 1。`.md` 與 `.json` 跑全部類別;程式碼檔只跑簡體字與亂碼,其餘類別對英文標點與路徑誤報率太高。掃描時跳過本檔(規則文件裡的詞是被討論,不是被使用);語感與翻譯腔仍要人工判讀。
|
||||||
|
|||||||
@@ -1,17 +1,60 @@
|
|||||||
---
|
---
|
||||||
name: skill-check
|
name: skill-check
|
||||||
description: Routine compliance audit of the whole jsc skill set with no change request in hand. Sync every domain repo from the Gitea canonical marketplace, audit every skill against the guidelines.md audit checklist via sub agents, confirm each failed item with the user via decision tree, apply the confirmed fixes and re-check until all items pass, then open a PR per affected repo via jsc-git pr. Use for periodic or on-demand compliance checks of the skill set; not for applying a change request (use skillset-update) or editing one skill (use skill-update).
|
description: Routine compliance, script, hook, flow-efficiency, and cost-efficiency audit of the whole jsc skill set with no change request in hand. Sync every domain repo from the Gitea canonical marketplace, then run three parallel groups - lint-scripts.sh plus check-behaviors.sh plus hook smoke, the guidelines.md checklist audit, and a review of parallelism, tool extraction, repeated interaction, redundant checks, misplaced gates, and avoidable token, sub-agent, API, scan, or interaction cost. Confirm compliance fixes and optimization suggestions before applying them, re-check until accepted fixes pass, then open a PR per affected repo via jsc-git pr. Use for periodic or on-demand skill-set checks; not for applying a change request (use skillset-update) or editing one skill (use skill-update).
|
||||||
---
|
---
|
||||||
|
|
||||||
# skill-check — audit the skill set against the guidelines
|
# skill-check — audit compliance, flow efficiency, and cost efficiency
|
||||||
|
|
||||||
Single source of guidelines: [`../../references/guidelines.md`](../../references/guidelines.md).
|
Single source of guidelines: [`../../references/guidelines.md`](../../references/guidelines.md).
|
||||||
|
|
||||||
## Flow
|
## Flow
|
||||||
|
|
||||||
1. Query the Gitea canonical marketplace for the authoritative domain list: run `jsc-gitea/tools/gitea.sh api GET /repos/plugins/meta/raw/.claude-plugin/marketplace.json`. Clone any domain repo missing from the working directory (`gitea.sh clone-url plugins/{domain}`) and pull the rest. Completion condition: every domain repo exists locally and is current.
|
1. Run `tools/sync-domains.sh` to sync every domain repo of the Gitea canonical marketplace. Completion condition: the script exits 0 and prints one `domain<TAB>path` line per marketplace domain — exit 0 is the only code that means every repo is present and current. Exit 3 means some repos were not updated: reconcile every path named on stderr (commit or stash the dirty tree, or fix the failing pull) and rerun; when the user confirms a dirty tree is intentional local work, record that decision and continue on the local version — never read exit 3 as current. Exit 2 means a domain could not be cloned. Exit 1 means the root could not be derived, `gitea.sh` was not found, or the canonical marketplace was unreadable; when stderr says the root could not be derived, set `JSC_PLUGINS_ROOT` to the directory that holds the domain repos and rerun, because under a plugin install the script sits in the CLI's plugin cache and its built-in guess lands there instead of the domain workspace. Resolve 2 and 1 before continuing.
|
||||||
2. Audit every skill of every domain against the guidelines.md audit checklist — this step MUST run as a sub agent, one sub agent per domain repo. Each sub agent reports its findings: skill, failed checklist item, evidence (file:line), proposed fix. Completion condition: every domain has an audit result.
|
|
||||||
3. Present each failed item via the `jsc-ask:ask` decision tree (apply the proposed fix / skip / custom fix). Every option states its impact scope (example: skipping leaves the skill non-compliant until the next audit). Completion condition: every finding has a recorded decision.
|
The three review groups of step 2 all read this synced tree, so the sync finishes first.
|
||||||
4. Apply the confirmed fixes — the fix-application part MUST run as a sub agent, one sub agent per affected domain repo: modify the files per the confirmed fix. Then run `tools/sync-skill-manifest.sh {domain-path}` directly (no sub agent needed) for each affected domain repo to refresh that domain README's 「Skills 目錄」 section and bump the version in all three manifests. Completion condition: every affected repo carries the fixes and the manifest bump.
|
2. Run the three review groups over the synced repos. They are independent — every one only reads, none writes a file — so **launch all three in parallel** and merge their results in step 3.
|
||||||
5. Re-check the guidelines.md audit checklist for every touched skill. On any failure, **return to step 3**: confirm and fix again, until all items pass. Completion condition: all checklist items pass.
|
|
||||||
6. Call `jsc-git:pr` once per affected domain repo to open a Push Request. Completion condition: every affected repo has a PR URL.
|
**Group 1 — validate scripts, behavior lists, and hooks.**
|
||||||
|
1. For every synced domain repo, run `tools/lint-scripts.sh {domain-path}`. One run per domain, and the runs go **in parallel** — no domain's verdict depends on another's. The tool covers three checks in one pass: `sh -n` syntax, executable bit, and an exit-code declaration in the file header. Route each exit code: 0 — the domain's scripts pass all three; 1 — the failing items are printed as `{file}:{check}:{detail}`, so report each one; 2 — usage error, the tool takes exactly one argument; 3 — nothing was scanned, because the path is missing or the domain has neither `tools/` nor `hooks/`. Record exit 3 as 「無腳本可掃」; a domain with no script directory is not a failure, but exit 3 is **never** a pass.
|
||||||
|
2. For every synced domain repo, run `tools/check-behaviors.sh {domain-path}`. One run per domain, and the runs go **in parallel** alongside the `lint-scripts.sh` runs — no domain's verdict depends on another's. It compares `references/behaviors.md` against `skills/`: section per skill, dictionary order, one table per section, five rows, no empty content cell. Route each exit code: 0 — that domain's behavior list matches; 1 — the mismatches are printed on stderr as `{檔案}:{技能名}:{說明}`, so report every one as a compliance failure with the skill it belongs to; 2 — usage error, the tool takes exactly one argument; 3 — nothing was checked, because `references/behaviors.md` is missing, `skills/` is missing, or no `SKILL.md` was found. Record exit 3 as 「無清單可查」with the cause from stderr and carry it into the step 3 merge; a domain with no behavior list is a compliance failure, and exit 3 is **never** a pass.
|
||||||
|
3. For every shell script directly named by a SKILL.md, confirm the skill routes every exit code the script's header declares. `lint-scripts.sh` proves the script exists and declares its codes; this check is the other half — that the caller branches on each of them. Report evidence as `skill file:line -> script path`.
|
||||||
|
4. When the `jsc-hooks` domain is present, run `jsc-hooks/tools/wire-cli.sh smoke {cli}` for every CLI reported by `jsc-cli/tools/detect-clis.sh`; the per-CLI smokes run **in parallel**. When no CLI is detected, run `jsc-hooks/tools/wire-cli.sh smoke codex` as the minimum hook behavior check and label it 「預設 hook smoke」 in the report. Use `smoke`, not `purge` or rewiring actions, and set `JSC_READONLY=1` for the whole audit so a mistyped sub-command is refused in code (exit 6) instead of rewiring the machine; `status` and `smoke` are unaffected by that variable. Route each `smoke` exit code: 0 — the run passed its own assertions; 2 — usage error, so fix the CLI code and rerun; 4 — the smoke failed, which includes the script's own result-line count not matching what it expected. **Read the count from the script's `lines<TAB>{數量}` output line; never write the number into this skill.** The script counts its own result lines and asserts them, so a hardcoded number here goes stale the moment a hook or a decision path is added — an out-of-date count in a SKILL.md is exactly what misled the previous audit.
|
||||||
|
5. When a hook or script smoke fails, route it as a compliance failure with script name, exit code, output summary, and proposed fix. Do not continue to report the affected hook as compliant.
|
||||||
|
|
||||||
|
**Group 2 — audit every skill of every domain against the guidelines.md audit checklist.** This group MUST run as a sub agent, one sub agent per domain repo, and those sub agents run **in parallel**. Each sub agent reports its findings: skill, failed checklist item, evidence (file:line), proposed fix. Cover the checklist's four flow checks by name, not only the naming and language items:
|
||||||
|
- Every step number, file path and section title the skill references — inside itself and in other files — really exists (the pointer points at something).
|
||||||
|
- Every step ends in a checkable completion condition, with no vague wording.
|
||||||
|
- Every external call (script, API, other skill) states what to do on failure and routes every exit code.
|
||||||
|
- No gate the skill installs blocks the only path that lifts that gate.
|
||||||
|
|
||||||
|
Four checklist items are **already decided by group 1** and must not be re-run here: `sh -n` on every `tools/` and `hooks/` script, script existence with the executable bit, the hook smoke, and the `references/behaviors.md` match. Tell each sub agent to skip those four and leave them blank; the main agent fills them in from the group 1 verdicts when merging in step 3. Re-scanning the same files in every domain sub agent buys nothing — group 1 already scanned them all, with the same tools, on the same synced tree.
|
||||||
|
|
||||||
|
**Group 3 — a flow and cost optimization review**, kept separate from the compliance audit. Each aspect **MUST run as a sub agent**, and the six aspects run in parallel with each other and with groups 1 and 2:
|
||||||
|
|
||||||
|
| Aspect | Scope |
|
||||||
|
| --- | --- |
|
||||||
|
| 1 Parallelism | Steps that run in series today but have no data dependency and can run in parallel |
|
||||||
|
| 2 Tool extraction | SKILL.md text flows with clear inputs and outputs that should move to `tools/`, including hook-enforceable rules that still rely on prompts |
|
||||||
|
| 3 Repeated interaction | The same user question, repository fact, wiki page, API result, or file content being collected more than once |
|
||||||
|
| 4 Redundant checks | Completion conditions or verification steps that overlap, or a later step that necessarily covers an earlier check |
|
||||||
|
| 5 Gate timing | Gates that run too early or too late, causing wasted work before a block or blocking the only path that clears the gate |
|
||||||
|
| 6 Cost efficiency | Avoidable token, sub-agent, API, file-scan, full-repo audit, or user-interaction cost that can be reduced without weakening correctness |
|
||||||
|
|
||||||
|
Each optimization finding reports skill, aspect, evidence (file:line), current flow step count, proposed flow step count, what time or interaction it saves, what cost it saves, current cost driver, proposed cost driver, whether correctness decreases, and which protection would be weakened if any. Cost savings may be token volume, sub-agent count, API calls, file scans, full-repo audits, or user prompts. Keep optimization findings separate from compliance failures.
|
||||||
|
|
||||||
|
Completion condition for all three groups: every domain has a `lint-scripts.sh` verdict and a `check-behaviors.sh` verdict, every script named by a SKILL.md has an exit-code-routing verdict, and every smoked CLI has a `smoke` exit code plus the `lines` value the script printed for it; every domain has a group 2 audit result that names a verdict for all checklist items — the four flow checks included, and the four group 1 items left blank for the step 3 merge rather than re-scanned; and every one of the six aspects has returned a verdict for every domain, 「無發現」 where an aspect found nothing.
|
||||||
|
3. Merge the three groups, then present compliance failures and optimization findings separately via the `jsc-ask:ask` decision tree. Merging means one thing in code: fill the four skipped checklist items of every group 2 sub agent report from the matching group 1 verdicts, so each domain ends with one complete checklist and no item counted twice.
|
||||||
|
- Compliance failure options: apply the proposed fix / skip / custom fix. Every option states its impact scope, for example skipping leaves the skill non-compliant until the next audit.
|
||||||
|
- Optimization options: apply / defer / custom. Any suggestion that weakens a protection must name the protection it removes and must not be applied unless the user explicitly accepts that tradeoff. Cost optimization may move, merge, cache, or narrow checks; it must not delete a compliance check only because it is expensive.
|
||||||
|
|
||||||
|
Completion condition: every domain's checklist is complete after the merge, and every compliance failure and every optimization finding has a recorded decision.
|
||||||
|
4. Apply the confirmed fixes and accepted optimizations — the file-change part MUST run as a sub agent, one sub agent per affected domain repo, and those sub agents run **in parallel**: each repo's files are independent. A fix that changes a skill's behavior also updates that skill's `## {name}` section in the same repo's `references/behaviors.md`, in the same pass, so the fix and the behavior list land in one PR. Then run `tools/sync-skill-manifest.sh {domain-path}` directly (no sub agent needed) for each affected domain repo to refresh that domain README's 「Skills 目錄」 section and bump the version in all three manifests. Route each exit code: 0 — the README block and all three manifests are synced; 1 — the domain path, `skills/`, `README.md`, the `JSC-SKILLS` markers, a `SKILL.md`, a manifest, or a manifest `version` field is missing, so fix the named cause on stderr and rerun; 2 — usage error, the script takes exactly one argument; any other code — the script runs under `set -e`, so treat it as an environment fault and stop, never as a successful sync. Completion condition: every affected repo carries the changes, the matching `references/behaviors.md` update for every fix that changed a skill's behavior, and the manifest bump.
|
||||||
|
5. Sync the canonical marketplace — a **required** step, never optional. The canonical pair lives in `plugins/meta` and every domain repo carries a byte-identical copy, so a fix that leaves the copies apart makes some repos register a stale plugin set. Run `tools/sync-marketplace.sh {domain} {repo-url} {description}` once with an existing entry's own current values (rewriting the same entry is idempotent); the script rewrites both canonical files and copies them into every domain repo. Route each exit code:
|
||||||
|
- Exit 3 — written, but some domain repo is not present locally. Run `tools/sync-domains.sh`, then rerun this step.
|
||||||
|
- Exit 2 — usage error: the script takes exactly three arguments. Fix them and rerun.
|
||||||
|
- Exit 1 — the root could not be derived, python3 is missing, a canonical file was unreadable, or copies differ byte for byte. Read stderr and fix the named cause: install python3 for the second; for the root case set `JSC_PLUGINS_ROOT` to the directory that holds the domain repos, because under a plugin install the script sits in the CLI's plugin cache and its built-in guess lands there. Then rerun.
|
||||||
|
- Exit 0 — every copy holds identical bytes; the script verifies that itself.
|
||||||
|
|
||||||
|
Completion condition: the script exits 0 and prints the touched paths.
|
||||||
|
6. Re-run the group 1 script, behavior-list, and hook validation, re-check the guidelines.md audit checklist for every touched skill, then re-run the optimization aspect that produced each accepted optimization. These three re-runs are as independent as the first pass, so run them **in parallel** and merge them the same way step 3 did. On any compliance failure, **return to step 3**: confirm and fix again, until all accepted compliance fixes pass. On an accepted optimization that does not produce the promised step reduction or cost reduction, or still weakens correctness beyond the recorded decision, return to step 3 for a new decision. Completion condition: `tools/lint-scripts.sh` exits 0 or 3 for every domain, `tools/check-behaviors.sh` exits 0 for every domain, every hook smoke exits 0 with the `lines` count the script itself asserted, all checklist items pass, and every accepted optimization has a matching verification result.
|
||||||
|
7. Call `jsc-git:pr` once per affected domain repo to open a Push Request. Completion condition: every affected repo has a PR URL, and all URLs are reported in one table with the format in [`../../references/pr-report.md`](../../references/pr-report.md).
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: skill-delete
|
name: skill-delete
|
||||||
description: Remove a skill from the jsc skill set safely. List skills from the Gitea canonical marketplace (cloning any missing domain repo) and let the user pick, inventory every file referencing the skill via a sub agent, fix each affected file through decision-tree questions until guideline checks pass, then delete the skill, verify the removal is clean, and open a PR via jsc-git pr. Use only for removal; not for renaming (use skill-update).
|
description: Remove a skill from the jsc skill set safely. Pick the skill from the Gitea canonical marketplace skill list, inventory every file referencing it, fix each affected file through decision-tree questions in parallel sub agents until guideline checks pass, delete the skill, open a PR via jsc-git pr, then deploy per references/deploy-verify.md and verify from a fresh CLI process that no on-disk leftover remains, and append the change report to wiki SKILLSET_{HASH}. Use only for removal; not for renaming (use skill-update).
|
||||||
---
|
---
|
||||||
|
|
||||||
# skill-delete — delete a skill
|
# skill-delete — delete a skill
|
||||||
@@ -9,14 +9,29 @@ Single source of guidelines: [`../../references/guidelines.md`](../../references
|
|||||||
|
|
||||||
## Flow
|
## Flow
|
||||||
|
|
||||||
1. Query Gitea for the canonical skill set first: run `jsc-gitea/tools/gitea.sh api GET /repos/plugins/meta/raw/.claude-plugin/marketplace.json` to get the authoritative domain list, then scan local `jsc-*/skills/*/SKILL.md` and present a "domain / name / description" list covering every domain in the marketplace. Completion condition: the list covers all marketplace domains.
|
1. Run `tools/sync-domains.sh` to sync every domain repo of the Gitea canonical marketplace. Completion condition: the script exits 0 and prints one `domain<TAB>path` line per marketplace domain — exit 0 is the only code that means every repo is present and current. Exit 3 means some repos were not updated: reconcile every path named on stderr (commit or stash the dirty tree, or fix the failing pull) and rerun; when the user confirms a dirty tree is intentional local work, record that decision and continue on the local version — never read exit 3 as current. Exit 2 means a domain could not be cloned. Exit 1 means the root could not be derived, `gitea.sh` was not found, or the canonical marketplace was unreadable; when stderr says the root could not be derived, set `JSC_PLUGINS_ROOT` to the directory that holds the domain repos and rerun, because under a plugin install the script sits in the CLI's plugin cache and its built-in guess lands there instead of the domain workspace. Resolve 2 and 1 before continuing.
|
||||||
2. For any marketplace domain whose repo is missing from the working directory, clone it first (`gitea.sh clone-url plugins/{domain}`), then rescan. Completion condition: every domain repo exists locally.
|
2. Run `tools/list-skills.sh` and present its `domain / name / description` rows to the user. The tool prints skills, not domains, so read the domain column to prove coverage. Exit 1 means the root could not be derived, the domain list was unreadable, or no skill was found — read stderr, fix the named cause (`JSC_PLUGINS_ROOT` for the root case, as in step 1) and rerun; never read it as an empty skill set. Completion condition: the script exits 0 and every domain printed by step 1 appears in at least one row; a domain with no row means its repo is missing or holds no skill — return to step 1 for that domain.
|
||||||
3. Let the user pick the skill to delete. Options state the impact scope: which skills reference it, and that its command stops working after deletion.
|
3. Let the user pick the skill to delete. Options state the impact scope: which skills reference it, and that its command stops working after deletion. Completion condition: one `{domain}/{name}` pair is confirmed for deletion.
|
||||||
4. Inventory every file related to the skill: run `tools/find-skill-refs.sh {domain} {name}` to list every file across all jsc-* repositories referencing the skill name or its `/jsc-{domain}:{name}` command form (covers other SKILL.md files, the domain README's 「Skills 目錄」 section, the two marketplace.json files in `plugins/meta` plus their synced copies in every domain repo, `tools/`, and the `jsc-hooks` wiring). Completion condition: the tool's file list is captured for step 5.
|
4. Inventory every file related to the skill: run `tools/find-skill-refs.sh {domain} {name}` to list every file that references the skill name or its `/jsc-{domain}:{name}` command form, across every marketplace domain repo on this machine (covers other SKILL.md files, the domain README's 「Skills 目錄」 section, the two marketplace.json files in `plugins/meta` plus their synced copies in every domain repo, `tools/`, and the `jsc-hooks` wiring). The skill-name pattern is a bare substring match, so the list also carries other skills whose name starts with the same word plus plain prose — treat it as candidates to read, not as files that must change. Exit 0 means hits were printed; exit 1 means a clean zero-hit scan; exit 2 means a usage error, so fix the two arguments and rerun; exit 3 means the scan never ran — the root could not be derived, the domain list was unreadable, no domain repo is on this machine, or grep failed. Read stderr and fix the named cause; when it names the root, set `JSC_PLUGINS_ROOT` to the directory that holds the domain repos, because under a plugin install the script sits in the CLI's plugin cache and its built-in guess lands there. **Never read exit 3 as zero hits** — a failed scan taken as "no references" makes this skill skip files it must fix. Completion condition: the tool's file list is captured as the step 5 inventory.
|
||||||
5. For each affected file:
|
5. Fix every file in the step 4 inventory. For each file:
|
||||||
1. Decide whether the file needs a fix to keep its current behavior after the deletion. If no fix is needed, **skip the rest of this loop**.
|
1. Read the file and decide whether it needs a fix to keep its current behavior after the deletion. If no fix is needed, record it as no-fix-needed with the reason and **skip the rest of this loop**. Completion condition: the file carries a recorded verdict — needs-fix or no-fix-needed with a reason.
|
||||||
2. Ask for fix details via the `jsc-ask:ask` decision tree (call a replacement skill? move a deterministic input/output flow to `tools/`? run the detailed flow as a sub agent? drop the feature too?). If the fix touches wiki or Gitea access, confirm it reads inherited environment variables before asking the user. Every option states its impact scope.
|
2. Ask for fix details via the `jsc-ask:ask` decision tree (call a replacement skill? move a deterministic input/output flow to `tools/`? run the detailed flow as a sub agent? drop the feature too?). If the fix touches wiki or Gitea access, confirm it reads inherited environment variables before asking the user. Every option states its impact scope. Completion condition: every question has a recorded answer.
|
||||||
3. After fixing, check the guidelines.md audit checklist. On failure, return to step 5.2.
|
3. Apply the confirmed fix, then check the guidelines.md audit checklist for the file — the per-file fix work MUST run as a sub agent, one sub agent per affected domain repo, and those sub agents **run in parallel**: each repo's files are independent, so serialising them only adds waiting. Each sub agent reports one line per file: the path and either the applied fix or「無需修正」with the reason. On any checklist failure, return to step 5.2. Completion condition: the fix is in the file and every checklist item passes for it.
|
||||||
6. Delete the skill directory `skills/{name}/`, then run `tools/sync-skill-manifest.sh {domain-path}` directly (no sub agent needed) to sync the domain README and bump the version in all three manifests.
|
|
||||||
7. Deep-delete verification — this step MUST run as a sub agent: after deleting via each CLI's native plugin commands, physically inspect every installed CLI's on-disk skill and hook storage. Detect CLIs via `jsc-cli/tools/detect-clis.sh`; check Claude's `~/.claude/plugins/cache/` and hook entries in settings, plus the equivalent locations for codex / copilot / antigravity / kiro. Confirm no file or hook wiring for the deleted skill remains. Completion condition: every location checked and clean; remove any leftover by hand and recheck.
|
Completion condition: every file in the step 4 inventory is marked either fixed-with-a-clean-checklist or explicitly no-fix-needed with a reason — no file is left without a verdict.
|
||||||
8. Call `jsc-git:pr` to open a Push Request.
|
6. Delete the skill directory `skills/{name}/` and remove that skill's `## {name}` section from `references/behaviors.md` — the whole section, its table included, leaving every other section untouched. Both deletions ship in this same PR: a behavior list still carrying a deleted skill fails the domain's next audit, and the extra section is exactly what `check-behaviors.sh` reports. Then run `tools/sync-skill-manifest.sh {domain-path}` directly (no sub agent needed) to sync the domain README and bump the version in all three manifests. Route each exit code: 0 — the README block and all three manifests are synced; 1 — the domain path, `skills/`, `README.md`, the `JSC-SKILLS` markers, a remaining `SKILL.md`, a manifest, or a manifest `version` field is missing, so fix the named cause on stderr and rerun; 2 — usage error, the script takes exactly one argument; any other code — the script runs under `set -e`, so treat it as an environment fault and stop, never as a successful sync.
|
||||||
|
|
||||||
|
Then run `tools/check-behaviors.sh {domain-path}` and route each exit code: 0 — the remaining sections match the remaining skills; 1 — every mismatch is printed on stderr as `{檔案}:{技能名}:{說明}`, so fix each one and rerun, the deleted skill's leftover section included; 2 — usage error, the tool takes exactly one argument; 3 — nothing was checked, because `references/behaviors.md` is missing, `skills/` is missing, or no `SKILL.md` was found, so fix the named cause and rerun. **Exit 3 is never a pass.**
|
||||||
|
|
||||||
|
Completion condition: the directory is gone, `references/behaviors.md` holds no `## {name}` section for the deleted skill, `tools/check-behaviors.sh {domain-path}` exits 0, the README's 「Skills 目錄」 no longer lists the skill, and all three manifests show the same new version.
|
||||||
|
7. Call `jsc-git:pr` to open a Push Request. Completion condition: a PR URL comes back and is reported with the table format in [`../../references/pr-report.md`](../../references/pr-report.md).
|
||||||
|
8. Deploy the deletion, verify it took, then report:
|
||||||
|
1. Follow [`../../references/deploy-verify.md`](../../references/deploy-verify.md) from section 1 to section 5: `tools/deploy-route.sh {domain-path}` picks the route, the deploy route or the worktree route runs, and the verification then runs in a **fresh CLI process**, never in the session that ran the deploy. That session raised the restart gate itself and still holds the old skill set, so verifying inside it either gets blocked or passes on stale behavior. On the worktree route, add that the skill stays installed and stays callable until the outstanding release PR merges. Completion condition: every completion condition in `deploy-verify.md` sections 1 to 5 holds for this domain repo.
|
||||||
|
2. Verify the deletion concretely, on top of the `deploy-verify.md` items:
|
||||||
|
- `tools/list-skills.sh` prints no row carrying the deleted `{domain}/{name}`.
|
||||||
|
- **Deep-delete verification.** Run `tools/verify-skill-removed.sh {domain} {name}`; it detects the installed CLIs and greps each one's skill cache and hook config. Route each exit code: exit 0 — no leftover in the locations listed on stderr; exit 1 — leftovers printed as `{file}:{line}:{content}`, so remove every one by hand and rerun; exit 2 — usage error, fix the two arguments and rerun; exit 3 — nothing was checkable, because the root could not be derived, `detect-clis.sh` was not found, no CLI was detected, or no config location exists. The script printed no leftover because it looked nowhere, so exit 3 is **never** clean: report「無處可查」with the reason from stderr, and carry that sentence into step 8.3's wiki section and the final report, so nobody later reads the deletion as verified on disk. This is the only place the deep-delete check runs — running it before the PR only scanned a deletion that had not been deployed yet, so it always came back clean and proved nothing.
|
||||||
|
- Every tool and skill that step 5 fixed still finishes with its documented exit code — a fix that broke a caller shows up here, not earlier.
|
||||||
|
- One minimal prompt per checkable CLI, each in its own fresh process and all in parallel, confirming `/jsc-{domain}:{name}` is gone or that the replacement path still works.
|
||||||
|
|
||||||
|
On any mismatch — the deleted skill still listed, a leftover from exit 1, a fixed caller that now fails, a prompt failure, or unexpected stderr — fix the cause and rerun this step from 8.1. Completion condition: the skill is absent from the list, the verification script exits 0 or its exit 3 is reported as「無處可查」and carried into step 8.3, every fixed caller ran, every checkable CLI completed the prompt with the expected result, and every untestable CLI has a stated reason.
|
||||||
|
3. Write the change report to wiki page `SKILLSET_{HASH}` — this part MUST run as a sub agent. Call `jsc-gitea:wiki`; `{HASH}` comes from the `{owner}/{repo}` of the domain repo that lost the skill, and the wiki repo resolves through `JSC_WIKI_REPO_SKILLSET` first, then `JSC_WIKI_REPO`. **Append** a section for this change — date, 「刪除」, skill name, changed files (the step 5 inventory verdicts included), PR URL, the step 8.1 route verdict and the step 8.2 verification result per item, the deep-delete verdict「無處可查」included when it applies — and keep every earlier section. Add the page to `SKILLSET_CONTENTS` when it is new. When the write fails — no `{owner}/{repo}` resolves, or `jsc-gitea:wiki` reports an API error — hand the page name and the unwritten entry back to the user and leave this step open; never close the flow on an unwritten report. Completion condition: the page holds the new section plus all earlier sections, and `SKILLSET_CONTENTS` links it.
|
||||||
|
|||||||
+33
-14
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: skill-new
|
name: skill-new
|
||||||
description: Create a new skill in the jsc skill set. Ask skill details via decision tree, generate the skill under the right jsc-{domain} per guidelines.md (create the domain from the template repo if missing), then open a PR via jsc-git pr. Use when the user wants to add a skill; not for editing an existing one (use skill-update).
|
description: Create a new skill in the jsc skill set. Prefetch the skill list and the domain list in parallel, ask skill details via decision tree, generate the skill under the right jsc-{domain} per guidelines.md (create the domain from the template repo if missing), open a PR via jsc-git pr, then deploy and verify per references/deploy-verify.md from a fresh CLI process, and append the change report to wiki SKILLSET_{HASH}. Use when the user wants to add a skill; not for editing an existing one (use skill-update).
|
||||||
---
|
---
|
||||||
|
|
||||||
# skill-new — create a skill
|
# skill-new — create a skill
|
||||||
@@ -9,19 +9,38 @@ Single source of guidelines: [`../../references/guidelines.md`](../../references
|
|||||||
|
|
||||||
## Flow
|
## Flow
|
||||||
|
|
||||||
1. Ask for skill details via the `jsc-ask:ask` decision tree until no doubt remains:
|
1. Collect the decision tree's inputs first, then ask:
|
||||||
- Goal (single and not duplicating an existing skill; first scan `jsc-*/skills/*/SKILL.md` and list similar skills for comparison — options must state the impact scope of "reuse existing" versus "create new")
|
1. Prefetch both inputs — run `tools/list-skills.sh` and `tools/sync-domains.sh` **in parallel**. They share no data, and both answers are needed before the first question, so running them after the questions only makes the user wait. Route each exit code:
|
||||||
|
- `list-skills.sh` exit 0 — keep the `domain<TAB>name<TAB>description` rows. Exit 1 — the root could not be derived, the domain list was unreadable, or no skill was found; read stderr and fix the named cause. When stderr says the root could not be derived, set `JSC_PLUGINS_ROOT` to the directory that holds the domain repos and rerun: under a plugin install the script sits in the CLI's plugin cache, so its built-in guess lands in that cache instead of the domain workspace.
|
||||||
|
- `sync-domains.sh` exit 0 — the only code that means every repo is present and current; keep the `domain<TAB>path` rows. Exit 3 — some repos were not updated: reconcile every path named on stderr (commit or stash the dirty tree, or fix the failing pull) and rerun; when the user confirms a dirty tree is intentional local work, record that decision and continue on the local version. Exit 2 — a domain could not be cloned. Exit 1 — the root could not be derived, `gitea.sh` was not found, or the canonical marketplace was unreadable; for the root case set `JSC_PLUGINS_ROOT` as above and rerun. Resolve 2 and 1 before continuing.
|
||||||
|
|
||||||
|
Completion condition: the skill rows and the `domain<TAB>path` rows are both in hand.
|
||||||
|
2. Ask for skill details via the `jsc-ask:ask` decision tree until no doubt remains:
|
||||||
|
- Goal (single and not duplicating an existing skill; show the similar skills from the step 1.1 rows for comparison — options must state the impact scope of "reuse existing" versus "create new")
|
||||||
- Trigger (when to use, when not to, trigger keywords)
|
- Trigger (when to use, when not to, trigger keywords)
|
||||||
- Input and output (can a standard input/output flow move down to `tools/`; does it need Gitea operations — if so, make the skill use `jsc-gitea/tools/gitea.sh` + token)
|
- Input and output (can a standard input/output flow move down to `tools/`; does it need Gitea operations — if so, make the skill use `jsc-gitea/tools/gitea.sh` + token)
|
||||||
- Owning domain (list the existing `jsc-*` domains to choose from)
|
- Owning domain (offer the domain list from the step 1.1 `domain<TAB>path` rows — the domains registered in the canonical marketplace)
|
||||||
2. If the domain does not exist (if the repository exists on Gitea but not in the working directory, clone it and skip to step 3):
|
|
||||||
1. Propose one short English word for the new domain (a single word preferred) and confirm it with the user.
|
|
||||||
2. Ask the user to create the repository `plugins/{domain}`. Clone it, then build the content following the structure of `https://gitea.jsc.idv.tw/plugins/template`: three plugin manifests (plugin name `jsc-{domain}`, version starting at `0.0.1`), `skills/`, README.md, AGENTS.md.
|
|
||||||
3. Add the plugin entry (URL source pointing at the new repository) to `.claude-plugin/marketplace.json` and `.agents/plugins/marketplace.json` in `plugins/meta` (the canonical copy), then sync the two updated files to every domain repository, including the new one. Every repo carries the same marketplace files, so any repo works as the registration entry point. The sync MUST run as a sub agent.
|
|
||||||
3. Generate the skill per guidelines.md — this step MUST run as a sub agent:
|
|
||||||
- `skills/{name}/SKILL.md`: entirely in English (description ≤ 5 sentences with trigger conditions; body in STE100-style English)
|
|
||||||
- Rules enforceable by hooks go to `jsc-hooks` (never scattered in this domain); standard input/output flows go to `tools/`
|
|
||||||
|
|
||||||
Then run `tools/sync-skill-manifest.sh {domain-path}` directly (no sub agent needed) to sync the domain README's 「Skills 目錄」 section and bump the version in all three manifests.
|
Completion condition: goal, trigger, input/output and owning domain each have a recorded answer.
|
||||||
4. Self-check every item of the guidelines.md audit checklist; fix anything that fails.
|
2. If the domain does not exist (`tools/sync-domains.sh` clones every domain **registered in the marketplace**, so a missing directory means the domain is unregistered — the repository itself may already exist on Gitea):
|
||||||
5. Call `jsc-git:pr` to open a Push Request.
|
1. Propose one short English word for the new domain (a single word preferred) and confirm it with the user. Completion condition: the user confirms the domain word.
|
||||||
|
2. Check before creating: run `jsc-gitea/tools/gitea.sh clone-url plugins/{domain}`. A URL comes back when the repository already exists — clone it, skip creation, and go on to step 2.3 to fill in whatever content is missing. Only when no URL comes back create the repository through the tool, never by hand: `gitea.sh api POST /orgs/plugins/repos` when `plugins` is an organization, `POST /user/repos` when `plugins` is the token's own account (`tea repo create` does the same job). Only when the call is refused (403 — the token has write but not admin rights on the owner) ask the user to create `plugins/{domain}` by hand, then continue. Completion condition: `gitea.sh clone-url plugins/{domain}` prints a URL and cloning it succeeds.
|
||||||
|
3. Build the content following the structure of `https://gitea.jsc.idv.tw/plugins/template`: three plugin manifests (plugin name `jsc-{domain}`, version starting at `0.0.1`), `skills/`, README.md, AGENTS.md. Completion condition: the three manifests, `skills/`, README.md and AGENTS.md all exist in the new repo.
|
||||||
|
4. Register the plugin: run `tools/sync-marketplace.sh {domain} {repo-url} {description}`. It needs `python3` on PATH — it edits the marketplace JSON with the json module. It writes the entry into both canonical marketplace files in `plugins/meta` and copies both into every domain repo, so any repo works as the registration entry point. Route each exit code:
|
||||||
|
- Exit 3 — written, but some domain repo is not present locally. Run `tools/sync-domains.sh`, then rerun this step.
|
||||||
|
- Exit 2 — usage error. Fix the three arguments and rerun.
|
||||||
|
- Exit 1 — the root could not be derived, python3 is missing, a canonical file was unreadable, or copies differ byte for byte. Read stderr and fix the named cause: install python3 for the second; for the root case set `JSC_PLUGINS_ROOT` to the directory that holds the domain repos, because under a plugin install the script sits in the CLI's plugin cache and its built-in guess lands there. Then rerun.
|
||||||
|
- Exit 0 — every copy holds identical bytes; the script verifies that itself.
|
||||||
|
|
||||||
|
Completion condition: the script exits 0 and prints the touched paths.
|
||||||
|
3. Generate the skill per guidelines.md — this step MUST run as a sub agent:
|
||||||
|
- `skills/{name}/SKILL.md`: entirely in English (description within either cap — ≤ 5 sentences or ≤ 5 steps — and stating when to use and when not to; body in STE100-style English)
|
||||||
|
- Rules enforceable by hooks go to `jsc-hooks` (never scattered in this domain); standard input/output flows go to `tools/`
|
||||||
|
- `references/behaviors.md`: add one `## {name}` section for the new skill, placed in dictionary order among the existing sections, carrying the five rows the guidelines' 「技能行為清單」 section defines — 觸發時機、關鍵步驟、外部呼叫、完成條件、可驗證跡象. Write what the skill really does; do not copy the `description`. A read-only skill still fills 可驗證跡象 with 「無寫入跡象,只有回報內容」. The behavior list ships in this same PR — a skill added without its section leaves the domain's list out of sync the moment this PR merges. When the domain has no `references/behaviors.md` yet, create it with the header line `# jsc-{domain} 技能行為清單`.
|
||||||
|
|
||||||
|
Then run `tools/sync-skill-manifest.sh {domain-path}` directly (no sub agent needed) to sync the domain README's 「Skills 目錄」 section and bump the version in all three manifests. Route each exit code: 0 — the README block and all three manifests are synced; 1 — the domain path, `skills/`, `README.md`, the `JSC-SKILLS` markers, a `SKILL.md`, a manifest, or a manifest `version` field is missing, so fix the named cause on stderr and rerun; 2 — usage error, the script takes exactly one argument; any other code — the script runs under `set -e`, so treat it as an environment fault and stop, never as a successful sync. Completion condition: `skills/{name}/SKILL.md` exists, `references/behaviors.md` holds a `## {name}` section with all five rows filled, the README lists the skill, and all three manifests show the same new version.
|
||||||
|
4. Self-check every item of the guidelines.md audit checklist; fix anything that fails. Run `tools/check-behaviors.sh {domain-path}` for the behavior-list item instead of comparing by eye, and route each exit code: 0 — the list matches `skills/` and all five rows are filled; 1 — every mismatch is printed on stderr as `{檔案}:{技能名}:{說明}`, so fix each one and rerun; 2 — usage error, the tool takes exactly one argument; 3 — nothing was checked, because `references/behaviors.md` is missing, `skills/` is missing, or no `SKILL.md` was found, so create the missing file and rerun. **Exit 3 is never a pass.** Completion condition: every checklist item passes and `tools/check-behaviors.sh {domain-path}` exits 0.
|
||||||
|
5. Call `jsc-git:pr` to open a Push Request. Completion condition: a PR URL comes back and is reported with the table format in [`../../references/pr-report.md`](../../references/pr-report.md).
|
||||||
|
6. Deploy the new skill, verify it runs, then report:
|
||||||
|
1. Follow [`../../references/deploy-verify.md`](../../references/deploy-verify.md) from section 1 to section 5: `tools/deploy-route.sh {domain-path}` picks the route, the deploy route or the worktree route runs, and the verification then runs in a **fresh CLI process**, never in the session that ran the deploy. That session raised the restart gate itself and still holds the old skill body, so verifying inside it either gets blocked or passes on stale behavior. Verify the added skill's row in `tools/list-skills.sh`, every tool the skill added, and one minimal prompt per checkable CLI — the per-CLI prompts run in parallel. Completion condition: every completion condition in `deploy-verify.md` sections 1 to 5 holds for this domain repo.
|
||||||
|
2. Write the change report to wiki page `SKILLSET_{HASH}` — this part MUST run as a sub agent. Call `jsc-gitea:wiki`; `{HASH}` comes from the `{owner}/{repo}` of the domain repo that gained the skill, and the wiki repo resolves through `JSC_WIKI_REPO_SKILLSET` first, then `JSC_WIKI_REPO`. **Append** a section for this change — date, 「新增」, skill name, changed files, PR URL, the step 6.1 route verdict and verification result per item — and keep every earlier section. Add the page to `SKILLSET_CONTENTS` when it is new. When the write fails — no `{owner}/{repo}` resolves, or `jsc-gitea:wiki` reports an API error — hand the page name and the unwritten entry back to the user and leave this step open; never close the flow on an unwritten report. Completion condition: the page holds the new section plus all earlier sections, and `SKILLSET_CONTENTS` links it.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: skill-update
|
name: skill-update
|
||||||
description: Update an existing skill in the jsc skill set. List all skills from the Gitea canonical marketplace (cloning any missing domain repo) and let the user pick one, ask update details via decision tree, apply the change, then re-check against the guidelines checklist until it passes and open a PR via jsc-git pr. Use for modifying a skill; not for creating (skill-new) or removing (skill-delete).
|
description: Update one existing skill in the jsc skill set. List all skills from the Gitea canonical marketplace (cloning any missing domain repo) and let the user pick one, ask update details via decision tree, apply the change, re-check against the guidelines checklist until it passes, open a PR via jsc-git pr, then deploy and verify per references/deploy-verify.md from a fresh CLI process, and append the change report to wiki SKILLSET_{HASH}. Use for modifying a single skill; not for creating (skill-new), not for removing (skill-delete), and not for a change spanning several skills or domains (skillset-update).
|
||||||
---
|
---
|
||||||
|
|
||||||
# skill-update — update a skill
|
# skill-update — update a skill
|
||||||
@@ -9,10 +9,13 @@ Single source of guidelines: [`../../references/guidelines.md`](../../references
|
|||||||
|
|
||||||
## Flow
|
## Flow
|
||||||
|
|
||||||
1. Query Gitea for the canonical skill set first: run `jsc-gitea/tools/gitea.sh api GET /repos/plugins/meta/raw/.claude-plugin/marketplace.json` to get the authoritative domain list, then scan local `jsc-*/skills/*/SKILL.md` and present a "domain / name / description" list covering every domain in the marketplace. Completion condition: the list covers all marketplace domains.
|
1. Run `tools/sync-domains.sh` to sync every domain repo of the Gitea canonical marketplace. Completion condition: the script exits 0 and prints one `domain<TAB>path` line per marketplace domain — exit 0 is the only code that means every repo is present and current. Exit 3 means some repos were not updated: reconcile every path named on stderr (commit or stash the dirty tree, or fix the failing pull) and rerun; when the user confirms a dirty tree is intentional local work, record that decision and continue on the local version — never read exit 3 as current. Exit 2 means a domain could not be cloned. Exit 1 means the root could not be derived, `gitea.sh` was not found, or the canonical marketplace was unreadable; when stderr says the root could not be derived, set `JSC_PLUGINS_ROOT` to the directory that holds the domain repos and rerun, because under a plugin install the script sits in the CLI's plugin cache and its built-in guess lands there instead of the domain workspace. Resolve 2 and 1 before continuing.
|
||||||
2. For any marketplace domain whose repo is missing from the working directory, clone it first (`gitea.sh clone-url plugins/{domain}`), then rescan. Completion condition: every domain repo exists locally.
|
2. Run `tools/list-skills.sh` and present its `domain / name / description` rows to the user. The tool prints skills, not domains, so read the domain column to prove coverage. Exit 1 means the root could not be derived, the domain list was unreadable, or no skill was found — read stderr, fix the named cause (`JSC_PLUGINS_ROOT` for the root case, as in step 1) and rerun; never read it as an empty skill set. Completion condition: the script exits 0 and every domain printed by step 1 appears in at least one row; a domain with no row means its repo is missing or holds no skill — return to step 1 for that domain.
|
||||||
3. Let the user pick the skill to update.
|
3. Let the user pick the skill to update. Completion condition: one `{domain}/{name}` pair is confirmed.
|
||||||
4. Ask for update details via the `jsc-ask:ask` decision tree (change the goal? the trigger? the flow? move rules down to a hook or a tool?). Every option states its impact scope (example: renaming breaks the existing invocation command).
|
4. Ask for update details via the `jsc-ask:ask` decision tree (change the goal? the trigger? the flow? move rules down to a hook or a tool?). Every option states its impact scope (example: renaming breaks the existing invocation command). Completion condition: every question has a recorded answer.
|
||||||
5. Update the skill — the modification part MUST run as a sub agent: modify SKILL.md and related files. Then run `tools/sync-skill-manifest.sh {domain-path}` directly (no sub agent needed) to sync the domain README's 「Skills 目錄」 section and bump the version in all three manifests.
|
5. Update the skill — the modification part MUST run as a sub agent: modify SKILL.md and related files. In the same pass, update this skill's `## {name}` section in `references/behaviors.md` so its five rows — 觸發時機、關鍵步驟、外部呼叫、完成條件、可驗證跡象 — describe the new behavior. A renamed skill gets its section renamed and moved back into dictionary order. The behavior list ships in this same PR: a behavior change that lands without its section makes the domain's list wrong from the merge onward, and the next audit reports drift this step created. Then run `tools/sync-skill-manifest.sh {domain-path}` directly (no sub agent needed) to sync the domain README's 「Skills 目錄」 section and bump the version in all three manifests. Route each exit code: 0 — the README block and all three manifests are synced; 1 — the domain path, `skills/`, `README.md`, the `JSC-SKILLS` markers, a `SKILL.md`, a manifest, or a manifest `version` field is missing, so fix the named cause on stderr and rerun; 2 — usage error, the script takes exactly one argument; any other code — the script runs under `set -e`, so treat it as an environment fault and stop, never as a successful sync. Completion condition: the skill files carry the change, the skill's `references/behaviors.md` section states the new behavior with all five rows filled, and all three manifests show the same new version.
|
||||||
6. Check every item of the guidelines.md audit checklist. On any failure, **return to step 4**: ask again and fix, until all items pass.
|
6. Check every item of the guidelines.md audit checklist. Run `tools/check-behaviors.sh {domain-path}` for the behavior-list item instead of comparing by eye, and route each exit code: 0 — the list matches `skills/` and all five rows are filled; 1 — every mismatch is printed on stderr as `{檔案}:{技能名}:{說明}`, so fix each one and rerun; 2 — usage error, the tool takes exactly one argument; 3 — nothing was checked, because `references/behaviors.md` is missing, `skills/` is missing, or no `SKILL.md` was found, so create the missing file and rerun. **Exit 3 is never a pass.** On any failure, **return to step 4**: ask again and fix, until all items pass. Completion condition: every checklist item passes and `tools/check-behaviors.sh {domain-path}` exits 0.
|
||||||
7. Call `jsc-git:pr` to open a Push Request.
|
7. Call `jsc-git:pr` to open a Push Request. Completion condition: a PR URL comes back and is reported with the table format in [`../../references/pr-report.md`](../../references/pr-report.md).
|
||||||
|
8. Deploy the update, verify it runs, then report:
|
||||||
|
1. Follow [`../../references/deploy-verify.md`](../../references/deploy-verify.md) from section 1 to section 5: `tools/deploy-route.sh {domain-path}` picks the route, the deploy route or the worktree route runs, and the verification then runs in a **fresh CLI process**, never in the session that ran the deploy. That session raised the restart gate itself and still holds the old skill body, so verifying inside it either gets blocked or passes on stale behavior. Verify the updated `description` in the skill's `tools/list-skills.sh` row, every tool this change touched, and one minimal prompt per checkable CLI — the per-CLI prompts run in parallel. Completion condition: every completion condition in `deploy-verify.md` sections 1 to 5 holds for this domain repo.
|
||||||
|
2. Write the change report to wiki page `SKILLSET_{HASH}` — this part MUST run as a sub agent. Call `jsc-gitea:wiki`; `{HASH}` comes from the `{owner}/{repo}` of the changed domain repo, and the wiki repo resolves through `JSC_WIKI_REPO_SKILLSET` first, then `JSC_WIKI_REPO`. **Append** a section for this change — date, 「更新」, skill name, changed files, PR URL, the step 8.1 route verdict and verification result per item — and keep every earlier section. Add the page to `SKILLSET_CONTENTS` when it is new. When the write fails — no `{owner}/{repo}` resolves, or `jsc-gitea:wiki` reports an API error — hand the page name and the unwritten entry back to the user and leave this step open; never close the flow on an unwritten report. Completion condition: the page holds the new section plus all earlier sections, and `SKILLSET_CONTENTS` links it.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: skillset-update
|
name: skillset-update
|
||||||
description: Apply one change request across the whole jsc skill set — multiple skills in multiple domains in one pass. Ask the change details via decision tree, sync every domain repo from the Gitea canonical marketplace, apply the change per affected domain via sub agents, re-check against the guidelines checklist until it passes, then open a PR per affected repo via jsc-git pr. Use when a change spans multiple skills or domains; not for a single skill (use skill-update).
|
description: Apply one change request across the whole jsc skill set — multiple skills in multiple domains in one pass. Sync every domain repo from the Gitea canonical marketplace while the decision tree asks the change details, apply the change per affected domain via parallel sub agents, re-check against the guidelines checklist until it passes, open a PR per affected repo via jsc-git pr, then deploy and verify per references/deploy-verify.md from a fresh CLI process, and append the change report to wiki SKILLSET_{HASH}. Use when a change spans multiple skills or domains; not for a single skill (use skill-update).
|
||||||
---
|
---
|
||||||
|
|
||||||
# skillset-update — apply one change across the skill set
|
# skillset-update — apply one change across the skill set
|
||||||
@@ -9,8 +9,14 @@ Single source of guidelines: [`../../references/guidelines.md`](../../references
|
|||||||
|
|
||||||
## Flow
|
## Flow
|
||||||
|
|
||||||
1. Ask for the change details via the `jsc-ask:ask` decision tree: what rule or behavior changes, which skills and which domains are affected. Include three required checks before the affected-skill list is final: whether any deterministic input/output flow must move to `tools/`, whether any detailed flow must run as a sub agent, and whether any wiki or Gitea flow must read inherited environment variables before asking the user. Every option states its impact scope (example: changing a shared flow step touches every skill that calls it). Completion condition: the affected-skill list and the three checks are agreed with the user.
|
1. Start `tools/sync-domains.sh` and the change-details decision tree **in parallel** — the sync touches no answer the tree needs, and the tree's answers change nothing the sync does, so waiting for one before the other only adds idle time.
|
||||||
2. Query the Gitea canonical marketplace for the authoritative domain list: run `jsc-gitea/tools/gitea.sh api GET /repos/plugins/meta/raw/.claude-plugin/marketplace.json`. Clone any domain repo missing from the working directory (`gitea.sh clone-url plugins/{domain}`) and pull the rest. Completion condition: every domain repo exists locally and is current.
|
1. Run `tools/sync-domains.sh` to sync every domain repo of the Gitea canonical marketplace. Exit 0 is the only code that means every repo is present and current; keep the `domain<TAB>path` rows. Exit 3 means some repos were not updated: reconcile every path named on stderr (commit or stash the dirty tree, or fix the failing pull) and rerun; when the user confirms a dirty tree is intentional local work, record that decision and continue on the local version — never read exit 3 as current. Exit 2 means a domain could not be cloned. Exit 1 means the root could not be derived, `gitea.sh` was not found, or the canonical marketplace was unreadable; when stderr says the root could not be derived, set `JSC_PLUGINS_ROOT` to the directory that holds the domain repos and rerun, because under a plugin install the script sits in the CLI's plugin cache and its built-in guess lands there instead of the domain workspace. Resolve 2 and 1 before continuing.
|
||||||
3. Apply the change to every affected skill — the modification part MUST run as a sub agent, one sub agent per affected domain repo: modify SKILL.md and related files and tools. Then run `tools/sync-skill-manifest.sh {domain-path}` directly (no sub agent needed) for each affected domain repo to sync that domain README's 「Skills 目錄」 section and bump the version in all three manifests. Completion condition: every affected domain repo carries the change, the README sync, and the manifest bump.
|
2. Ask for the change details via the `jsc-ask:ask` decision tree: what rule or behavior changes, which skills and which domains are affected. Include three required checks before the affected-skill list is final: whether any deterministic input/output flow must move to `tools/`, whether any detailed flow must run as a sub agent, and whether any wiki or Gitea flow must read inherited environment variables before asking the user. Every option states its impact scope (example: changing a shared flow step touches every skill that calls it). These three are a shaping guardrail asked before any file is touched; keep asking them even when a later step would catch the same problem.
|
||||||
4. Check every item of the guidelines.md audit checklist for each touched skill. On any failure, **return to step 1**: ask again and fix, until all items pass.
|
|
||||||
5. Call `jsc-git:pr` once per affected domain repo to open a Push Request. Completion condition: every affected repo has a PR URL.
|
Completion condition: the `domain<TAB>path` rows are in hand, and the affected-skill list plus the three checks are agreed with the user.
|
||||||
|
2. Apply the change to every affected skill — the modification part MUST run as a sub agent, one sub agent per affected domain repo, and those sub agents **run in parallel**: each repo's files are independent. Every sub agent also updates its own repo's `references/behaviors.md` in the same pass: a changed behavior rewrites that skill's `## {name}` section, a new skill gets a section inserted in dictionary order, a removed skill loses its section. Keep all five rows filled — 觸發時機、關鍵步驟、外部呼叫、完成條件、可驗證跡象. Each repo's behavior list ships in that repo's own PR, so no cross-repo PR pair has to be merged in order. Then run `tools/sync-skill-manifest.sh {domain-path}` directly (no sub agent needed) for each affected domain repo to sync that domain README's 「Skills 目錄」 section and bump the version in all three manifests; these runs are independent per repo and may also go in parallel. Route each exit code: 0 — the README block and all three manifests are synced; 1 — the domain path, `skills/`, `README.md`, the `JSC-SKILLS` markers, a `SKILL.md`, a manifest, or a manifest `version` field is missing, so fix the named cause on stderr and rerun; 2 — usage error, the script takes exactly one argument; any other code — the script runs under `set -e`, so treat it as an environment fault and stop, never as a successful sync. Completion condition: every affected domain repo carries the change, its behavior-list update, the README sync, and the manifest bump.
|
||||||
|
3. Check every item of the guidelines.md audit checklist for each touched skill — one sub agent per affected domain repo, run in parallel. Each sub agent runs `tools/check-behaviors.sh {domain-path}` for the behavior-list item of its own repo instead of comparing by eye, and routes each exit code: 0 — that repo's list matches its `skills/` and all five rows are filled; 1 — every mismatch is printed on stderr as `{檔案}:{技能名}:{說明}`, so fix each one and rerun; 2 — usage error, the tool takes exactly one argument; 3 — nothing was checked, because `references/behaviors.md` is missing, `skills/` is missing, or no `SKILL.md` was found, so create the missing file and rerun. **Exit 3 is never a pass.** On any failure, **return to step 1.2**: ask again and fix, until all items pass. Completion condition: every checklist item passes for every touched skill, and `tools/check-behaviors.sh` exits 0 for every affected domain repo.
|
||||||
|
4. Call `jsc-git:pr` once per affected domain repo to open a Push Request. Completion condition: every affected repo has a PR URL, and all URLs are reported in one table with the format in [`../../references/pr-report.md`](../../references/pr-report.md).
|
||||||
|
5. Deploy the batch change, verify it runs, then report:
|
||||||
|
1. Follow [`../../references/deploy-verify.md`](../../references/deploy-verify.md) from section 1 to section 5, once per affected domain repo — the route judgements run in parallel. The batch takes the deploy route only when **every** affected repo's `tools/deploy-route.sh` exits 0; a single exit 3 puts the whole batch on the worktree route, because the change reaches the CLIs only when the last repo merges, so name every outstanding release PR. The verification then runs in a **fresh CLI process**, never in the session that ran the deploy: that session raised the restart gate itself and still holds the old skill bodies. Verify every touched skill's row in `tools/list-skills.sh`, every tool this change touched, and one minimal prompt per affected domain per checkable CLI — the per-CLI and per-domain prompts run in parallel. Completion condition: every completion condition in `deploy-verify.md` sections 1 to 5 holds for every affected domain repo.
|
||||||
|
2. Write the change report to wiki page `SKILLSET_{HASH}` — this part MUST run as a sub agent, one sub agent per affected domain repo, run in parallel. Call `jsc-gitea:wiki`; `{HASH}` comes from that repo's `{owner}/{repo}`, and the wiki repo resolves through `JSC_WIKI_REPO_SKILLSET` first, then `JSC_WIKI_REPO`. **Append** a section for this change — date, 「批次更新」, the change request in one line, touched skills, changed files, PR URL, the step 5.1 route verdict and verification result per item — and keep every earlier section. Add each page to `SKILLSET_CONTENTS` when it is new. When a write fails — no `{owner}/{repo}` resolves, or `jsc-gitea:wiki` reports an API error — hand the page name and the unwritten entry back to the user and leave this step open; never close the flow on an unwritten report. Completion condition: every affected repo's page holds the new section plus all earlier sections, and `SKILLSET_CONTENTS` links them all.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: ste100-sync
|
name: ste100-sync
|
||||||
description: Sync the STE100 language rules with upstream speak-human-tw. Compare the pinned upstream version in references/ste100.md against the latest release, distill applicable changes, refresh ste100-lint.sh patterns, re-lint all jsc repos, then open a PR via jsc-git pr. Use on periodic maintenance or when upstream releases a new version; not for editing local-only rules.
|
description: Sync the STE100 language rules with upstream speak-human-tw. Compare the pinned upstream version in references/ste100.md against the raw upstream frontmatter version before cloning anything, distill applicable changes and confirm each one via decision tree, refresh ste100-lint.sh patterns and jsc-hooks simplified.txt, re-lint all jsc repos in parallel, then open a PR via jsc-git pr. Use on periodic maintenance or when upstream releases a new version; not for editing local-only rules.
|
||||||
---
|
---
|
||||||
|
|
||||||
# ste100-sync
|
# ste100-sync
|
||||||
@@ -9,17 +9,24 @@ Keep `references/ste100.md` in sync with its upstream source, [speak-human-tw](h
|
|||||||
|
|
||||||
## Steps
|
## Steps
|
||||||
|
|
||||||
1. Read the pinned version from the「上游版本」line in `references/ste100.md`.
|
1. Compare versions before fetching anything large — the common case is that upstream has no new release, and a clone done first is then wasted every time:
|
||||||
2. Clone the upstream repo (`--depth 1`). Read the `version` and `changelog` fields in its `SKILL.md` frontmatter.
|
1. Read the pinned version from the「上游版本」line in `references/ste100.md`. Completion condition: the pinned version string is in hand.
|
||||||
3. Same version: report「上游沒有新版」and stop.
|
2. Read the upstream `version` from the raw `SKILL.md` frontmatter over HTTPS, without cloning. When the raw read fails — network error, a moved path, or no `version` line in the frontmatter — fall back to the `--depth 1` clone and read the same field from the working copy. Completion condition: the upstream version string is in hand, and the report names which route produced it, raw or clone.
|
||||||
4. Newer version — distill the changes. **MUST run as a sub agent**:
|
3. Same version: report「上游沒有新版」and stop, without cloning. Completion condition: either the run stops here, or the upstream version is newer than the pinned one.
|
||||||
|
2. Newer version — get the changelog. Clone the upstream repo (`--depth 1`) when step 1.2 did not already clone it, and read the `changelog` field in its `SKILL.md` frontmatter. Completion condition: the changelog entries newer than the pinned version are in hand.
|
||||||
|
3. Distill the changes into a change list. **MUST run as a sub agent**:
|
||||||
- Walk the changelog entries newer than the pinned version.
|
- Walk the changelog entries newer than the pinned version.
|
||||||
- Keep only changes that apply to technical documents and conversation: Taiwan term replacements, punctuation rules, de-AI patterns, humanize targets.
|
- Keep only changes that apply to technical documents and conversation: Taiwan term replacements, punctuation rules, de-AI patterns, humanize targets.
|
||||||
- Drop marketing-copy scenes, eval material, and workflow-mode changes.
|
- Drop marketing-copy scenes, eval material, and workflow-mode changes.
|
||||||
- Apply the distilled changes to `references/ste100.md`. Keep its trimmed structure. Update the「上游版本」line.
|
- Decide nothing and edit no file. Report one line per candidate change: the rule, the upstream wording, and what it would change in `references/ste100.md` or in the lint patterns.
|
||||||
5. If the replacement table or cliché list changed, update the `TERMS` and `CLICHES` patterns in `tools/ste100-lint.sh`.
|
|
||||||
6. Run `tools/ste100-lint.sh` over every jsc repo. Fix hits in files this repo owns; report hits elsewhere.
|
Completion condition: every kept changelog entry appears as one line in the distilled list.
|
||||||
7. Open a PR via `jsc-git:pr`.
|
4. Present the distilled list via the `jsc-ask:ask` decision tree, one question per change (adopt / drop / adapt). Every option states its impact scope (example: adopting a term replacement changes the `TERMS` pattern, so every repo re-linted in step 7 can gain new hits). `references/ste100.md` is the single source of truth for the whole skill set, so no change lands without a recorded decision. Completion condition: every distilled change has a recorded decision.
|
||||||
|
5. Apply the adopted and adapted changes to `references/ste100.md`. Keep its trimmed structure. Update the「上游版本」line. Completion condition: every adopted change is visible in the file and the「上游版本」line shows the new upstream version.
|
||||||
|
6. If the replacement table or the cliché list changed, update the `TERMS`, `CLICHES` and `SIMPLIFIED_FALLBACK` patterns in `tools/ste100-lint.sh`. `SIMPLIFIED` is the runtime variable the lint builds from the shared character table, not an editable pattern: the real source is `jsc-hooks/hooks/simplified.txt`, which `ste100-guard.sh` reads too, and `SIMPLIFIED_FALLBACK` is only the built-in backup for machines without `jsc-hooks`. A simplified-character change therefore lands in `simplified.txt` first and in `SIMPLIFIED_FALLBACK` second — editing the lint alone leaves the hook enforcing the old table. Completion condition: `sh -n tools/ste100-lint.sh` passes, each newly adopted term hits on a test string, and any simplified-character change is in `jsc-hooks/hooks/simplified.txt` as well.
|
||||||
|
7. Run `tools/ste100-lint.sh` over every jsc repo (`tools/sync-domains.sh` prints the repo paths). The repos are independent, so lint them **in parallel**, one run per repo. Route each exit code: 0 — that repo is clean; 1 — hits printed as `{檔案}:{行號}:{類別}:{命中內容}`; 2 — no target was given, so fix the arguments and rerun, never read it as clean. Fix hits in files this repo owns. Completion condition: the lint exits 0 for this repo, and hits in other repos are reported with `file:line` for their owners.
|
||||||
|
8. Run `tools/sync-skill-manifest.sh .` to sync the README's 「Skills 目錄」 section and bump the manifests. Route each exit code: 0 — the README block and all three manifests are synced; 1 — `skills/`, `README.md`, the `JSC-SKILLS` markers, a `SKILL.md`, a manifest, or a manifest `version` field is missing, so fix the named cause on stderr and rerun; 2 — usage error, the script takes exactly one argument; any other code — the script runs under `set -e`, so treat it as an environment fault and stop, never as a successful sync. Completion condition: all three manifests show the same new version.
|
||||||
|
9. Open a PR via `jsc-git:pr`. Completion condition: a PR URL comes back and is reported with the table format in [`../../references/pr-report.md`](../../references/pr-report.md).
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,120 @@
|
|||||||
|
---
|
||||||
|
name: tooling-guide
|
||||||
|
description: Inventory the current jsc plugins, skills, hook management, and usage paths as the baseline tooling guide, taking the skill, CLI, and hook-wiring facts from one inventory-tooling.sh run rather than re-running the scripts it already called. On request, publish that inventory through jsc-gitea:wiki to TOOLING_{HASH}, hashed from {hostname}/{tool}/{account}, and register it in TOOLING_CONTENTS. Use when the user asks for a skill-set guide, tooling map, supported plugin list, supported skill list, hook management overview, or onboarding reference. Do not use for installing, updating, deleting, auditing, or repairing the skill set; use jsc-cli:deploy, jsc-meta:skill-check, jsc-meta:skill-update, jsc-meta:skill-delete, or jsc-hooks:hooks-install instead.
|
||||||
|
---
|
||||||
|
|
||||||
|
# tooling-guide - build the baseline tooling guide
|
||||||
|
|
||||||
|
Goal: produce a current guide for the jsc skill set from the local repos and the supported tooling scripts.
|
||||||
|
|
||||||
|
Single source of guidelines: [`../../references/guidelines.md`](../../references/guidelines.md).
|
||||||
|
|
||||||
|
## Rules
|
||||||
|
|
||||||
|
- Every factual claim in the guide carries the source path or the tool output line it came from.
|
||||||
|
- Prefer script output over copied lists.
|
||||||
|
- Use `tools/inventory-tooling.sh` for the baseline inventory.
|
||||||
|
- Keep command syntax in the guide only when it comes from README files or tool output.
|
||||||
|
- Do not modify README files, manifests, marketplace files, hooks, tools, or other skills.
|
||||||
|
- Put generated guide text in the response or in the user-requested target only.
|
||||||
|
- Run detail synthesis as a sub agent when the guide needs explanations, grouping, or onboarding prose.
|
||||||
|
- Route every wiki read and write through `jsc-gitea:wiki`, and every `{HASH}` through `jsc-gitea/tools/hash-id`.
|
||||||
|
|
||||||
|
Done when each rule above has a recorded pass, or a recorded exception naming the claim and the reason, checked before the final report.
|
||||||
|
|
||||||
|
## Inputs
|
||||||
|
|
||||||
|
- Optional user scope: plugin inventory, skill inventory, hook management, CLI usage, or all areas.
|
||||||
|
- Optional output target: chat response, wiki draft text, a named file that the user explicitly requests, or the wiki pages `TOOLING_{HASH}` and `TOOLING_CONTENTS`.
|
||||||
|
|
||||||
|
Done when the scope and the output target are each written down as one of the values listed above. With no scope given, write down `all areas`. With no target given, write down `chat response`. Only the `wiki page` target runs step 7.
|
||||||
|
|
||||||
|
## Flow
|
||||||
|
|
||||||
|
1. Confirm the working roots. Run `tools/plugins-root.sh` — it prints the workspace root that holds the domain checkouts, and it is the same derivation every other tool here uses. Exit 1 means the root could not be derived: read stderr, set `JSC_PLUGINS_ROOT` to the directory that holds the domain repos, and rerun. Under a plugin install the tools sit in the CLI's plugin cache, so the built-in guess lands in that cache instead of the workspace. The meta root is `{root}/meta`, or `{root}/jsc-meta` when that is the checkout name; the sibling directories under `{root}` are the domain checkouts. Completion condition: the script exits 0, and the meta root it names exists and contains `references/guidelines.md`.
|
||||||
|
|
||||||
|
2. Sync the domain inventory with `tools/sync-domains.sh`. This script owns marketplace discovery and local repo synchronization.
|
||||||
|
- Exit 0: continue with the printed `domain<TAB>path` rows.
|
||||||
|
- Exit 3: keep the printed rows, report every skipped or dirty repo from stderr as stale input, and continue only after the user accepts a guide with stale rows.
|
||||||
|
- Exit 2: report the clone failure and stop.
|
||||||
|
- Exit 1: report which cause stderr names — the root could not be derived, `gitea.sh` was not found, or the canonical marketplace was unreadable — then stop. For the root case, fix it the same way as step 1 and rerun.
|
||||||
|
|
||||||
|
Completion condition: each plugin row used by the guide has a domain and a local path, or the stale-input decision is recorded.
|
||||||
|
|
||||||
|
3. Collect the baseline inventory and the management-flow facts. The two halves are independent — one reads tool output, the other reads files — so run them **at the same time**.
|
||||||
|
|
||||||
|
**Baseline inventory.** Build it with `tools/inventory-tooling.sh` and use its Markdown output as the base document.
|
||||||
|
- Exit 0: continue with the generated guide.
|
||||||
|
- Exit 1: report which cause stderr names — the root could not be derived, the root does not exist, or the marketplace or `list-skills.sh` is missing — then stop.
|
||||||
|
- Any other exit: report the command, exit code, and stderr, then stop.
|
||||||
|
|
||||||
|
**This one run already covers the skill catalog, the CLI detection and the hook wiring status.** Internally it runs `meta/tools/list-skills.sh`, `cli/tools/detect-clis.sh` and `hooks/tools/wire-cli.sh status {cli}` and writes each result into its own section, so read those sections instead of calling the three scripts again:
|
||||||
|
- `Supported skills` — one row per skill, from `list-skills.sh`. An empty table means no skill was scanned; return to step 2.
|
||||||
|
- `Supported CLIs` — one row per detected CLI with its path and version, from `detect-clis.sh`. The single placeholder row means no CLI is installed here, or `detect-clis.sh` is missing; mark CLI-specific checks as not available on this machine.
|
||||||
|
- `Hook wiring status` — one row per detected CLI with the `wire-cli.sh status` exit code and verdict, `CLI 代號不符合 wire-cli.sh 用法` for exit 2 and `未知狀態,結束碼 {rc}` for anything outside 0, 1, 3 and 5. The single placeholder row means no CLI was detected or `wire-cli.sh` is missing; state the hook verdict as unknown and say why.
|
||||||
|
|
||||||
|
Re-running those three scripts on top of this buys nothing and can disagree with the base document — the second run sees a different machine state, and the guide then carries two answers for one fact. What that costs is written down under `Notes`.
|
||||||
|
|
||||||
|
**Management-flow facts.** Collect them from the current docs and skills. Read only README files, `SKILL.md` files, and tool help or headers from `tools/` under the domain repo paths that step 2 printed — never a hardcoded absolute path, because the workspace root differs per machine and per install form. Do not infer support from missing or stale files.
|
||||||
|
|
||||||
|
Completion condition: the generated guide contains `Source freshness`, `Supported plugins`, `Supported skills`, `Supported CLIs`, `Hook wiring status`, `Hook management`, `Plugin and skill management`, `Operational checks` and `Use this when`; the skill, CLI and hook facts used by the guide are quoted from those sections; and each management flow in the guide points to one source file or one tool output.
|
||||||
|
|
||||||
|
4. Synthesize the guide. This step MUST run as a sub agent when the output needs explanations, grouping, onboarding prose, or cross-domain comparison. Give the sub agent only the collected inventories, the relevant README and SKILL paths, and this required section list:
|
||||||
|
- Supported plugins
|
||||||
|
- Supported skills
|
||||||
|
- Supported CLIs and usage forms
|
||||||
|
- Hook management
|
||||||
|
- Plugin and skill management
|
||||||
|
- Health checks and repair paths
|
||||||
|
- Known coverage limits
|
||||||
|
|
||||||
|
Completion condition: the sub agent returns a guide draft with every required section and with source paths for each factual claim.
|
||||||
|
|
||||||
|
5. Verify the draft in the main agent.
|
||||||
|
- Check that each plugin comes from the step 2 `sync-domains.sh` rows.
|
||||||
|
- Check that each skill comes from the step 3 `Supported skills` section.
|
||||||
|
- Check that each CLI fact comes from the step 3 `Supported CLIs` section, and each hook-wiring fact from the step 3 `Hook wiring status` section.
|
||||||
|
- Check that install, update, delete, audit, repair, and health-check actions point to the owning skill or tool.
|
||||||
|
- Check that the draft does not copy long implementation details from README files or scripts.
|
||||||
|
|
||||||
|
Completion condition: every factual claim has a source path or tool output, and no required section is empty.
|
||||||
|
|
||||||
|
6. Deliver the guide in the requested target. If the target is chat, keep it concise and include the source paths used. If the target is a file, write only that user-requested file and do not update manifests or README files. If the target is the wiki page, step 7 performs the delivery — keep the chat summary short here and let step 7 report the page names and URLs. Completion condition: the guide is delivered and the final report names the target, source freshness, stale inputs if any, and any unknown hook verdicts.
|
||||||
|
|
||||||
|
7. Publish the inventory to the wiki. Run this step only when the recorded output target is the wiki page; for any other target, record `wiki publish skipped — target is {target}` and go to the final report. **This whole step MUST run as a sub agent.** Every wiki read and write goes through `jsc-gitea:wiki`; never assemble a Gitea API call here.
|
||||||
|
|
||||||
|
7.1 **Build one page name per detected CLI.** Take the CLI code names from the step 3 `Supported CLIs` section — that section already carries the first column of `jsc-cli/tools/detect-clis.sh`, one of `claude`, `codex`, `copilot`, `antigravity`, `kiro`. Pair each code name with this machine's host name and the current login account, then hand `{hostname}/{tool}/{account}` to `jsc-gitea/tools/hash-id`. The hash rules live in `../../references/guidelines.md` and are not restated here; compute nothing by hand. One page per host, CLI, and account: every CLI carries its own installed plugin set and its own hook wiring, and the tool segment is what keeps five CLIs off one page. A missing host name, tool name, or account stops the step — name the missing segment and substitute no default value. `hash-id` exit 1 means this machine has neither `sha1sum` nor `shasum`: stop and report that one of them has to be installed. Completion condition: every detected CLI has one `TOOLING_{HASH}` name built from three non-empty segments, all of them produced by `hash-id`.
|
||||||
|
|
||||||
|
7.2 **Resolve the wiki repo** for type `TOOLING` through `jsc-gitea:wiki`, which reads `JSC_WIKI_REPO_TOOLING` first and `JSC_WIKI_REPO` second. Exit 3 — neither variable is set: ask for that type's `{owner}/{repo}` per the `jsc-ask:ask` rules. Exit 2 — the installed `jsc-gitea` does not accept the `TOOLING` type yet: stop and report that the type has to be registered there first. Completion condition: exactly one `{owner}/{repo}` is recorded, and every write in this step targets it.
|
||||||
|
|
||||||
|
7.3 **Write the content pages first.** Render `templates/tooling-page.md` for each `TOOLING_{HASH}` from the step 3 inventory, keeping only that page's own CLI row in the `Supported CLIs` and `Hook wiring status` tables. Each run overwrites the whole page: it records what this machine looks like right now, so keeping earlier runs buys nothing. Content pages go before the contents page for the same reason as every other jsc skill — a contents row must never point at a page whose write failed. Completion condition: every `TOOLING_{HASH}` write returned exit 0, or its failure went to step 7.5.
|
||||||
|
|
||||||
|
7.4 **Register the pages in `TOOLING_CONTENTS` second.** Read that page first, then route the read exit code:
|
||||||
|
- 0 — the page is there. Find the row whose host, tool, and account all match this run, refresh that one row per `templates/tooling-contents.md`, leave every other row exactly as it was, and write the whole page back.
|
||||||
|
- 4 — the page does not exist yet. **This is the only code that allows creating it.** Build it from the template with this run's rows.
|
||||||
|
- 7 or 8 — the key was rejected, or the API failed, so the old content is unknown. Stop. Create nothing and overwrite nothing: a page built on top of unknown content deletes rows that nobody can get back. Report the exit code and the page name.
|
||||||
|
|
||||||
|
Completion condition: `TOOLING_CONTENTS` holds one row per page written in step 7.3, every row belonging to another machine or CLI is unchanged, or the step stopped with the read exit code and the page name reported.
|
||||||
|
|
||||||
|
7.5 **Route a failed write.** Retry the failed `jsc-gitea:wiki` write once. When it fails again, stop the publish and report the page name together with the content that never reached the wiki, so the user can place it by hand. Report a page as written only after its write returned exit 0. Completion condition: every page named in this step is either confirmed written with its page name, or listed as unwritten with its exit code and its full content.
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
- **Removed protection, on purpose.** The flow used to carry three more steps that re-ran `list-skills.sh`, `detect-clis.sh` and `wire-cli.sh status {cli}` after `inventory-tooling.sh` had already called all three. That second pass doubled as an independent cross-check: it read the same three facts straight from the source scripts, so a wrong skill row, a missing CLI, or a stale hook verdict produced by `inventory-tooling.sh` surfaced as a disagreement between the two sets. That cross-check is gone. The guide now takes the skill catalog, the CLI list and the hook wiring status from one `inventory-tooling.sh` run, with no second raw output to compare against, so a bug in that script's own scanning, parsing, or section writing reaches the guide unnoticed and reads as fact. Two things bound the risk: step 5 still rejects any claim with no source section behind it, and `Hook wiring status` carries the per-CLI exit code, so a nonsense verdict stays visible. When a decision rests on the guide's skill, CLI, or hook facts, get the second opinion elsewhere — run the three scripts by hand and compare, or run `jsc-cli:doctor` for an independent wiring verdict.
|
||||||
|
|
||||||
|
## Output Contract
|
||||||
|
|
||||||
|
The guide must include these fields in this order:
|
||||||
|
|
||||||
|
1. `Source freshness`: synced, stale accepted, or blocked.
|
||||||
|
2. `Supported plugins`: one row per domain.
|
||||||
|
3. `Supported skills`: one row per skill.
|
||||||
|
4. `Supported CLIs`: one row per detected CLI, or one sentence for none detected.
|
||||||
|
5. `Hook management`: wiring, smoke, error scan, repair owner, and coverage limits, with the per-CLI wiring verdicts from `Hook wiring status`.
|
||||||
|
6. `Plugin and skill management`: install, update, delete, audit, and creation owners.
|
||||||
|
7. `Operational checks`: doctor, setup, version guard, restart gate, language guard, and comment-scope guard.
|
||||||
|
8. `Use this when`: short usage guidance for maintainers.
|
||||||
|
|
||||||
|
Done when the output has all fields in order and each non-empty table has at least one source reference.
|
||||||
|
|
||||||
|
For the wiki-page target, the same fields go to `TOOLING_{HASH}` in the section order of `templates/tooling-page.md`, and the row registered in `TOOLING_CONTENTS` follows `templates/tooling-contents.md`. Both templates own their own field lists; do not restate them here.
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# 技能盤點目錄
|
||||||
|
|
||||||
|
> 由 `jsc-meta:tooling-guide` 維護。這是目錄頁 `TOOLING_CONTENTS`。
|
||||||
|
> 一列代表一組「機器、CLI、帳號」。同一台機器裝了幾支 CLI,就有幾列。
|
||||||
|
> `TOOLING_{HASH}` 的 `{HASH}` 交給 `jsc-gitea/tools/hash-id` 產生,雜湊來源見 `jsc-meta/references/guidelines.md` 的「Wiki 頁命名總表」。
|
||||||
|
|
||||||
|
| 盤點頁 | 主機 | 工具 | 帳號 | plugin 數 | 技能數 | hook 接線 | 最後盤點 |
|
||||||
|
| --- | --- | --- | --- | ---: | ---: | --- | --- |
|
||||||
|
| [[TOOLING_{HASH}]] | {主機名} | {claude、codex、copilot、antigravity、kiro 五選一} | {登入帳號} | {n} | {n} | {wired、degraded、unwired、unknown 四選一} | {yyyy-MM-dd HH:mm} |
|
||||||
|
|
||||||
|
## 欄位說明
|
||||||
|
|
||||||
|
| 欄位 | 內容 |
|
||||||
|
| --- | --- |
|
||||||
|
| 盤點頁 | 指向 `TOOLING_{HASH}` 的同 wiki 連結 |
|
||||||
|
| 主機 | 這次盤點的機器名,與雜湊第一段相同 |
|
||||||
|
| 工具 | CLI 代號,與雜湊第二段相同 |
|
||||||
|
| 帳號 | 執行盤點的登入帳號,與雜湊第三段相同 |
|
||||||
|
| plugin 數 | 該頁「已安裝 plugin」表的列數 |
|
||||||
|
| 技能數 | 該頁「可用技能」表的列數 |
|
||||||
|
| hook 接線 | 該頁「hook 接線狀態」對這支 CLI 的判定 |
|
||||||
|
| 最後盤點 | 該頁盤點時間,與內容頁標頭一致 |
|
||||||
|
|
||||||
|
## 寫入規則
|
||||||
|
|
||||||
|
- 先整頁讀回來,再比對主機、工具、帳號三欄。
|
||||||
|
- 三欄都相同就更新那一列,其餘欄位覆寫成本次結果。
|
||||||
|
- 三欄找不到相同的一列,才新增一列。
|
||||||
|
- 只動自己那一列,別人的列原樣保留。
|
||||||
|
- 禁止整頁覆蓋。這一頁是共用目錄,覆蓋等於刪掉別台機器的紀錄。
|
||||||
|
- 讀不到舊內容就中止,不新增列,也不寫入。
|
||||||
@@ -0,0 +1,129 @@
|
|||||||
|
# 技能盤點 — {主機名}/{工具名稱}/{登入帳號}
|
||||||
|
|
||||||
|
> 由 `jsc-meta:tooling-guide` 維護。這是盤點頁 `TOOLING_{HASH}`。
|
||||||
|
> 這頁記的是「現在這台機器上這支 CLI 長什麼樣」。每次盤點覆寫整頁,不保留歷史。
|
||||||
|
> 覆寫是刻意的:舊的安裝內容與接線狀態早就不成立,留著只會讓人照著過期的事實下判斷。
|
||||||
|
> 目錄頁 `TOOLING_CONTENTS` 的規則相反,那頁只更新自己那一列,兩者不要混用。
|
||||||
|
> 要看技能組歷次異動請翻 `SKILLSET_{HASH}`,累積紀錄在那一頁。
|
||||||
|
|
||||||
|
## 本次盤點
|
||||||
|
|
||||||
|
| 項目 | 內容 |
|
||||||
|
| --- | --- |
|
||||||
|
| 盤點時間 | {yyyy-MM-dd HH:mm} |
|
||||||
|
| 主機 | {主機名} |
|
||||||
|
| 工具 | {claude、codex、copilot、antigravity、kiro 五選一} |
|
||||||
|
| 帳號 | {登入帳號} |
|
||||||
|
| 資料來源 | `meta/tools/inventory-tooling.sh` 單次執行的輸出 |
|
||||||
|
| plugins 根目錄 | {絕對路徑} |
|
||||||
|
| marketplace | {絕對路徑} |
|
||||||
|
|
||||||
|
> 全頁事實出自上面那一次執行。同一趟不重跑 `list-skills.sh`、`detect-clis.sh` 與 `wire-cli.sh status`,避免同一件事出現兩個答案。
|
||||||
|
|
||||||
|
## 資料新鮮度
|
||||||
|
|
||||||
|
對應輸出的 `Source freshness` 一節。
|
||||||
|
|
||||||
|
| 項目 | 狀態 |
|
||||||
|
| --- | --- |
|
||||||
|
| 本機 domain 清單 | {synced、stale accepted、blocked 三選一} |
|
||||||
|
| marketplace | {絕對路徑} |
|
||||||
|
|
||||||
|
## 現況摘要
|
||||||
|
|
||||||
|
對應輸出的 `現況摘要` 一節。
|
||||||
|
|
||||||
|
| 項目 | 數量 |
|
||||||
|
| --- | ---: |
|
||||||
|
| 已註冊 plugin domain | {n} |
|
||||||
|
| 已掃到技能 | {n} |
|
||||||
|
| 已偵測 CLI | {n} |
|
||||||
|
|
||||||
|
## 已安裝 plugin
|
||||||
|
|
||||||
|
對應輸出的 `Supported plugins` 一節。
|
||||||
|
|
||||||
|
| domain | 版本 | 本機路徑 |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| {domain} | {版本或「缺本機存取庫」} | {絕對路徑} |
|
||||||
|
|
||||||
|
## 可用技能
|
||||||
|
|
||||||
|
對應輸出的 `Supported skills` 一節。
|
||||||
|
|
||||||
|
| domain | skill | 用途 |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| {domain} | {技能名} | {一句用途} |
|
||||||
|
|
||||||
|
## 已偵測 CLI
|
||||||
|
|
||||||
|
對應輸出的 `Supported CLIs` 一節。只留這一頁對應的那支 CLI,其餘 CLI 各自有自己的盤點頁。
|
||||||
|
|
||||||
|
| CLI | 執行檔 | 版本 |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| {工具名稱} | {絕對路徑} | {版本字串} |
|
||||||
|
|
||||||
|
## 可用工具
|
||||||
|
|
||||||
|
對應輸出的 `Supported tools` 一節。
|
||||||
|
|
||||||
|
| domain | tool | 用途 |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| {domain} | {腳本檔名} | {檔頭第二行的說明} |
|
||||||
|
|
||||||
|
## hook 管理
|
||||||
|
|
||||||
|
對應輸出的 `Hook management` 一節。
|
||||||
|
|
||||||
|
| hook | 用途 |
|
||||||
|
| --- | --- |
|
||||||
|
| {腳本檔名} | {檔頭第二行的說明} |
|
||||||
|
|
||||||
|
## hook 接線狀態
|
||||||
|
|
||||||
|
對應輸出的 `Hook wiring status` 一節。只留這一頁對應的那支 CLI。
|
||||||
|
|
||||||
|
| CLI | 結束碼 | 狀態 |
|
||||||
|
| --- | ---: | --- |
|
||||||
|
| {工具名稱} | {n} | {狀態字串;查不到就寫「未知狀態,結束碼 {n}」} |
|
||||||
|
|
||||||
|
## plugin 與技能管理
|
||||||
|
|
||||||
|
對應輸出的 `Plugin and skill management` 一節。
|
||||||
|
|
||||||
|
| 需求 | 入口 |
|
||||||
|
| --- | --- |
|
||||||
|
| 新增技能 | `jsc-meta:skill-new` |
|
||||||
|
| 更新單一技能 | `jsc-meta:skill-update` |
|
||||||
|
| 批次更新技能組 | `jsc-meta:skillset-update` |
|
||||||
|
| 刪除技能 | `jsc-meta:skill-delete` |
|
||||||
|
| 安裝、更新、移除整組 plugin | `jsc-cli:deploy` |
|
||||||
|
| 例行稽核 | `jsc-meta:skill-check` |
|
||||||
|
| 重新接線 hook | `jsc-hooks:hooks-install` |
|
||||||
|
|
||||||
|
## 例行檢查
|
||||||
|
|
||||||
|
對應輸出的 `Operational checks` 一節。
|
||||||
|
|
||||||
|
| 檢查 | 負責的技能或 hook |
|
||||||
|
| --- | --- |
|
||||||
|
| 體檢目前環境 | `jsc-cli:doctor` |
|
||||||
|
| 修復體檢項目 | `jsc-cli:setup` |
|
||||||
|
| 版本前置檢查 | `jsc-hooks/hooks/version-guard.sh` |
|
||||||
|
| 部署後重啟閘門 | `jsc-hooks/hooks/restart-gate.sh` |
|
||||||
|
| 語言提示與掃描 | `jsc-hooks/hooks/ste100-guard.sh`、`jsc-hooks/hooks/lang-guard.sh` |
|
||||||
|
| 註解範圍檢查 | `jsc-hooks/hooks/comment-scope.sh` |
|
||||||
|
|
||||||
|
## 使用時機
|
||||||
|
|
||||||
|
對應輸出的 `Use this when` 一節。
|
||||||
|
|
||||||
|
- 這頁只回答「這台機器這支 CLI 現在裝了什麼」。
|
||||||
|
- 要動手安裝、更新或修復,照上面兩張表找對應的入口。
|
||||||
|
- 盤點時間離現在太久就重跑一次 `jsc-meta:tooling-guide`,不要拿舊頁當現況。
|
||||||
|
|
||||||
|
## 已知限制
|
||||||
|
|
||||||
|
| 限制 | 說明 |
|
||||||
|
| --- | --- |
|
||||||
|
| {限制項目} | {為什麼這一項在這台機器上查不到或不適用} |
|
||||||
Executable
+171
@@ -0,0 +1,171 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
# check-behaviors.sh — 檢查一個 domain 的技能行為清單 references/behaviors.md 有沒有跟 skills/ 對齊。
|
||||||
|
#
|
||||||
|
# 用法: check-behaviors.sh <domain-path>
|
||||||
|
#
|
||||||
|
# 檢查六項(格式合約見 jsc-meta references/guidelines.md 的「技能行為清單」一節):
|
||||||
|
# 1. 標題 — 第一行是「# jsc-{domain} 技能行為清單」,檔案不得有 UTF-8 BOM。
|
||||||
|
# 2. 節對技能 — 每支 skills/*/SKILL.md 一個「## {技能名}」節,名稱與目錄名逐字相同,不多不少。
|
||||||
|
# 3. 節順序 — 節的排列照技能目錄名的字典序(LC_ALL=C)。
|
||||||
|
# 4. 表格 — 每節恰好一張表,表頭是「| 項目 | 內容 |」。
|
||||||
|
# 5. 五個欄位 — 依序為 觸發時機、關鍵步驟、外部呼叫、完成條件、可驗證跡象,不多不少。
|
||||||
|
# 6. 內容 — 每一列的「內容」欄不得空白。
|
||||||
|
#
|
||||||
|
# 為什麼要這支: 技能改了行為、清單沒跟著改,兩邊就漂移。漂移靠眼睛比對,10 個 domain 每次稽核
|
||||||
|
# 都要重做一遍,還會漏。這六項的輸入輸出固定,交給程式判定才穩。
|
||||||
|
#
|
||||||
|
# 輸出: 一行一個不合格項目,格式 {behaviors.md 路徑}:{技能名或 -}:{說明}(stderr);
|
||||||
|
# 通過時在 stderr 印一行摘要。stdout 不印東西。
|
||||||
|
# 結束碼: 0=行為清單與 skills/ 相符,五個欄位齊全且內容欄非空
|
||||||
|
# 1=不符:缺節、多節、順序不對、表格不對、缺欄位或欄位空白,清單在 stderr
|
||||||
|
# 2=用法錯誤(本腳本只吃一個參數)
|
||||||
|
# 3=找不到 {domain-path}/references/behaviors.md,或找不到 {domain-path}/skills/,
|
||||||
|
# 或 skills/ 底下一支 SKILL.md 都沒有——**什麼都沒查**,不等於通過
|
||||||
|
set -u
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo 'usage: check-behaviors.sh <domain-path>' >&2
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
|
||||||
|
[ "$#" -eq 1 ] || usage
|
||||||
|
DOMAIN=${1%/}
|
||||||
|
[ -n "$DOMAIN" ] || usage
|
||||||
|
|
||||||
|
SKILLS="$DOMAIN/skills"
|
||||||
|
DOC="$DOMAIN/references/behaviors.md"
|
||||||
|
[ -d "$DOMAIN" ] || { echo "找不到 domain 路徑:$DOMAIN" >&2; exit 3; }
|
||||||
|
[ -d "$SKILLS" ] || { echo "找不到 skills/:$SKILLS" >&2; exit 3; }
|
||||||
|
[ -f "$DOC" ] || { echo "找不到行為清單:$DOC" >&2; exit 3; }
|
||||||
|
|
||||||
|
TMPD=$(mktemp -d) || { echo "無法建立暫存目錄" >&2; exit 3; }
|
||||||
|
trap 'rm -rf "$TMPD"' EXIT
|
||||||
|
|
||||||
|
TAB=$(printf '\t')
|
||||||
|
BOM=$(printf '\357\273\277')
|
||||||
|
FIELDS='觸發時機 關鍵步驟 外部呼叫 完成條件 可驗證跡象'
|
||||||
|
|
||||||
|
fail=0
|
||||||
|
report() { # $1=技能名或 -,$2=說明
|
||||||
|
printf '%s:%s:%s\n' "$DOC" "$1" "$2" >&2
|
||||||
|
fail=1
|
||||||
|
}
|
||||||
|
|
||||||
|
# 技能清單: skills/ 底下帶 SKILL.md 的目錄名,字典序。
|
||||||
|
for d in "$SKILLS"/*/; do
|
||||||
|
[ -f "${d}SKILL.md" ] || continue
|
||||||
|
n=${d%/}
|
||||||
|
echo "${n##*/}"
|
||||||
|
done | LC_ALL=C sort > "$TMPD/skills.txt"
|
||||||
|
[ -s "$TMPD/skills.txt" ] || { echo "skills/ 底下沒有任何 SKILL.md:$SKILLS" >&2; exit 3; }
|
||||||
|
|
||||||
|
# 解析 behaviors.md,攤平成三種記錄:
|
||||||
|
# SEC<TAB>{節名} 一個「## 」標題
|
||||||
|
# HDR<TAB>{節名} 一列表頭「| 項目 | 內容 |」
|
||||||
|
# ROW<TAB>{節名}<TAB>{項目}<TAB>{內容} 一列資料(分隔列不算)
|
||||||
|
awk '
|
||||||
|
function trim(s) { gsub(/^[ \t]+/, "", s); gsub(/[ \t]+$/, "", s); return s }
|
||||||
|
BEGIN { FS = "|"; sec = "-" }
|
||||||
|
{ sub(/\r$/, "") }
|
||||||
|
/^## / {
|
||||||
|
sec = trim(substr($0, 4))
|
||||||
|
printf "SEC\t%s\n", sec
|
||||||
|
next
|
||||||
|
}
|
||||||
|
/^[ \t]*\|/ {
|
||||||
|
item = trim($2)
|
||||||
|
body = ""
|
||||||
|
for (i = 3; i < NF; i++) body = (body == "" ? $i : body "|" $i)
|
||||||
|
body = trim(body)
|
||||||
|
if (item ~ /^[-: ]+$/ && body ~ /^[-: ]*$/) next
|
||||||
|
if (item == "項目" && body == "內容") { printf "HDR\t%s\n", sec; next }
|
||||||
|
printf "ROW\t%s\t%s\t%s\n", sec, item, body
|
||||||
|
}
|
||||||
|
' "$DOC" > "$TMPD/parsed.txt"
|
||||||
|
|
||||||
|
# --- 1. 標題 ---
|
||||||
|
first=$(head -1 "$DOC" | tr -d '\r')
|
||||||
|
case $first in
|
||||||
|
"$BOM"*) report - '檔頭帶 UTF-8 BOM,請改存無 BOM'; first=${first#"$BOM"} ;;
|
||||||
|
esac
|
||||||
|
# domain 名以 plugin.json 的 name 為準,checkout 目錄名只是退路。
|
||||||
|
# 目錄名是誰 clone 誰決定的,同一個 repo 換一台機器就可能叫別的名字,
|
||||||
|
# 拿它當唯一來源會在別人的工作區誤報一次「標題不符」。
|
||||||
|
dom=$(sed -n 's/.*"name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' "$DOMAIN/plugin.json" 2>/dev/null | head -n1)
|
||||||
|
if [ -z "$dom" ]; then
|
||||||
|
dom=$(cd "$DOMAIN" 2>/dev/null && pwd) || dom=$DOMAIN
|
||||||
|
dom=${dom##*/}
|
||||||
|
fi
|
||||||
|
dom=${dom#jsc-}
|
||||||
|
want_title="# jsc-$dom 技能行為清單"
|
||||||
|
[ "$first" = "$want_title" ] || report - "第一行要是「$want_title」,實際是「$first」"
|
||||||
|
|
||||||
|
# --- 2. 節對技能 ---
|
||||||
|
awk -F"$TAB" '$1 == "SEC" { print $2 }' "$TMPD/parsed.txt" > "$TMPD/sections.txt"
|
||||||
|
LC_ALL=C sort "$TMPD/sections.txt" > "$TMPD/sections-sorted.txt"
|
||||||
|
|
||||||
|
LC_ALL=C uniq -d "$TMPD/sections-sorted.txt" | while IFS= read -r s; do
|
||||||
|
[ -n "$s" ] && printf '%s:%s:%s\n' "$DOC" "$s" '同一支技能出現多個節,只留一節' >&2
|
||||||
|
done
|
||||||
|
if [ -n "$(LC_ALL=C uniq -d "$TMPD/sections-sorted.txt")" ]; then fail=1; fi
|
||||||
|
|
||||||
|
LC_ALL=C uniq "$TMPD/sections-sorted.txt" > "$TMPD/sections-uniq.txt"
|
||||||
|
LC_ALL=C comm -23 "$TMPD/skills.txt" "$TMPD/sections-uniq.txt" > "$TMPD/missing.txt"
|
||||||
|
LC_ALL=C comm -13 "$TMPD/skills.txt" "$TMPD/sections-uniq.txt" > "$TMPD/extra.txt"
|
||||||
|
|
||||||
|
while IFS= read -r s; do
|
||||||
|
[ -n "$s" ] || continue
|
||||||
|
report "$s" "skills/$s/SKILL.md 存在,行為清單缺這一節,請補「## $s」"
|
||||||
|
done < "$TMPD/missing.txt"
|
||||||
|
|
||||||
|
while IFS= read -r s; do
|
||||||
|
[ -n "$s" ] || continue
|
||||||
|
report "$s" "行為清單多這一節,skills/ 底下沒有這支技能,請移除或改名"
|
||||||
|
done < "$TMPD/extra.txt"
|
||||||
|
|
||||||
|
# --- 3. 節順序 ---
|
||||||
|
if ! cmp -s "$TMPD/sections.txt" "$TMPD/sections-sorted.txt"; then
|
||||||
|
report - '節的排列不是技能目錄名的字典序,請重排'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# --- 4~6. 逐節查表格與五個欄位 ---
|
||||||
|
while IFS= read -r name; do
|
||||||
|
[ -n "$name" ] || continue
|
||||||
|
grep -q "^$name\$" "$TMPD/missing.txt" && continue
|
||||||
|
|
||||||
|
hdr=$(awk -F"$TAB" -v s="$name" '$1 == "HDR" && $2 == s' "$TMPD/parsed.txt" | wc -l)
|
||||||
|
hdr=$((hdr + 0))
|
||||||
|
if [ "$hdr" -eq 0 ]; then
|
||||||
|
report "$name" '這一節沒有表頭「| 項目 | 內容 |」,五個欄位無從判讀'
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
[ "$hdr" -eq 1 ] || report "$name" "這一節有 $hdr 張表,合約規定恰好一張"
|
||||||
|
|
||||||
|
awk -F"$TAB" -v s="$name" '$1 == "ROW" && $2 == s { print $3 "\t" $4 }' \
|
||||||
|
"$TMPD/parsed.txt" > "$TMPD/rows.txt"
|
||||||
|
|
||||||
|
rows=$(wc -l < "$TMPD/rows.txt")
|
||||||
|
rows=$((rows + 0))
|
||||||
|
[ "$rows" -eq 5 ] || report "$name" "表格有 $rows 列,合約規定 5 列:$FIELDS"
|
||||||
|
|
||||||
|
i=0
|
||||||
|
while IFS="$TAB" read -r item body; do
|
||||||
|
i=$((i + 1))
|
||||||
|
[ "$i" -le 5 ] || { report "$name" "第 $i 列「$item」是多的,合約只收 5 列"; continue; }
|
||||||
|
want=$(echo "$FIELDS" | cut -d' ' -f"$i")
|
||||||
|
[ "$item" = "$want" ] || report "$name" "第 $i 列的項目要是「$want」,實際是「$item」"
|
||||||
|
[ -n "$body" ] || report "$name" "「$item」的內容欄空白,請補實際行為"
|
||||||
|
done < "$TMPD/rows.txt"
|
||||||
|
done < "$TMPD/skills.txt"
|
||||||
|
|
||||||
|
# --- 節裡以外的表格 ---
|
||||||
|
if awk -F"$TAB" '$2 == "-" { found = 1 } END { exit found ? 0 : 1 }' "$TMPD/parsed.txt"; then
|
||||||
|
report - '有表格落在任何「## 」節之外,請搬進所屬技能的節裡'
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$fail" -eq 0 ]; then
|
||||||
|
echo "行為清單檢查通過:$DOC 對上 $(wc -l < "$TMPD/skills.txt" | tr -d ' ') 支技能,五個欄位齊全" >&2
|
||||||
|
else
|
||||||
|
echo "行為清單檢查不符:$DOC 與 $SKILLS 對不起來,逐項見上方" >&2
|
||||||
|
fi
|
||||||
|
exit $fail
|
||||||
Executable
+95
@@ -0,0 +1,95 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
# deploy-route.sh — 判定一個 domain 存取庫的改動是否已進預設分支,決定走部署路線或工作樹路線。
|
||||||
|
#
|
||||||
|
# 用法: deploy-route.sh <domain-path> [branch]
|
||||||
|
# branch 不給就用目前分支。
|
||||||
|
#
|
||||||
|
# 為什麼要有這支: marketplace 與 version-guard.sh 都讀存取庫的**預設分支**,
|
||||||
|
# 停在 develop 的改動 jsc-cli:deploy 看不到,部署路線的完成條件永遠達不到。
|
||||||
|
# skill-new、skill-update、skill-delete、skillset-update 四支各抄一段同樣的判定散文,
|
||||||
|
# 四份會各自漂移,所以下放成同一支腳本。
|
||||||
|
#
|
||||||
|
# 判定:
|
||||||
|
# 1. git fetch --prune origin,讓比對基準是遠端而不是本機殘影。
|
||||||
|
# 2. 預設分支依序取 origin/HEAD 的指向、遠端有沒有 master、遠端有沒有 main。
|
||||||
|
# 3. 待判分支的 HEAD 是不是 origin/{預設分支} 的祖先——是就代表已經合進去。
|
||||||
|
#
|
||||||
|
# 輸出(stdout,一行一組 {鍵}<TAB>{值}):
|
||||||
|
# route<TAB>deploy|worktree 要走哪條路線
|
||||||
|
# default-branch<TAB>{name} 比對用的預設分支
|
||||||
|
# branch<TAB>{name} 被判定的分支
|
||||||
|
# head<TAB>{sha} 被判定分支的 commit
|
||||||
|
# pending<TAB>{name} 只有 worktree 路線才有:還沒併進預設分支的分支名
|
||||||
|
# 說明與失敗原因走 stderr。
|
||||||
|
#
|
||||||
|
# 結束碼: 0=deploy 路線,改動已在預設分支上,可以叫 jsc-cli:deploy
|
||||||
|
# 3=worktree 路線,改動還沒進預設分支,要改對工作樹驗證並在回報裡點名待合的 PR
|
||||||
|
# 2=用法錯誤(一或兩個參數)
|
||||||
|
# 1=判不出來:路徑不是 git 存取庫、沒有 origin、fetch 失敗,或取不到預設分支。
|
||||||
|
# **1 不等於 worktree**:判不出來就停下問人,別自己挑一條路線走。
|
||||||
|
set -u
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo 'usage: deploy-route.sh <domain-path> [branch]' >&2
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
|
||||||
|
[ "$#" -ge 1 ] && [ "$#" -le 2 ] || usage
|
||||||
|
DOMAIN=${1%/}
|
||||||
|
[ -n "$DOMAIN" ] || usage
|
||||||
|
BRANCH=${2:-}
|
||||||
|
|
||||||
|
[ -d "$DOMAIN/.git" ] || git -C "$DOMAIN" rev-parse --git-dir >/dev/null 2>&1 || {
|
||||||
|
echo "不是 git 存取庫:$DOMAIN" >&2; exit 1; }
|
||||||
|
|
||||||
|
git -C "$DOMAIN" remote get-url origin >/dev/null 2>&1 || {
|
||||||
|
echo "存取庫沒有 origin 遠端,無從比對預設分支:$DOMAIN" >&2; exit 1; }
|
||||||
|
|
||||||
|
git -C "$DOMAIN" fetch --prune --quiet origin >/dev/null 2>&1 || {
|
||||||
|
echo "git fetch origin 失敗,比對基準會是本機殘影,先修連線再重跑:$DOMAIN" >&2; exit 1; }
|
||||||
|
|
||||||
|
if [ -z "$BRANCH" ]; then
|
||||||
|
BRANCH=$(git -C "$DOMAIN" rev-parse --abbrev-ref HEAD 2>/dev/null) || BRANCH=''
|
||||||
|
fi
|
||||||
|
[ -n "$BRANCH" ] && [ "$BRANCH" != HEAD ] || {
|
||||||
|
echo "取不到目前分支名(可能在 detached HEAD),請用第二個參數指定分支:$DOMAIN" >&2; exit 1; }
|
||||||
|
|
||||||
|
# 預設分支:先問 origin/HEAD,再退回遠端實際存在的 master、main。
|
||||||
|
DEFAULT=$(git -C "$DOMAIN" symbolic-ref --short refs/remotes/origin/HEAD 2>/dev/null) || DEFAULT=''
|
||||||
|
DEFAULT=${DEFAULT#origin/}
|
||||||
|
if [ -z "$DEFAULT" ]; then
|
||||||
|
for cand in master main; do
|
||||||
|
if git -C "$DOMAIN" rev-parse --verify --quiet "refs/remotes/origin/$cand" >/dev/null 2>&1; then
|
||||||
|
DEFAULT=$cand
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
[ -n "$DEFAULT" ] || { echo "取不到預設分支(origin/HEAD、origin/master、origin/main 都沒有):$DOMAIN" >&2; exit 1; }
|
||||||
|
|
||||||
|
git -C "$DOMAIN" rev-parse --verify --quiet "refs/remotes/origin/$DEFAULT" >/dev/null 2>&1 || {
|
||||||
|
echo "遠端沒有 origin/$DEFAULT:$DOMAIN" >&2; exit 1; }
|
||||||
|
|
||||||
|
HEADSHA=$(git -C "$DOMAIN" rev-parse --verify --quiet "$BRANCH" 2>/dev/null) || HEADSHA=''
|
||||||
|
[ -n "$HEADSHA" ] || { echo "取不到分支的 commit:$BRANCH" >&2; exit 1; }
|
||||||
|
|
||||||
|
TAB=$(printf '\t')
|
||||||
|
if git -C "$DOMAIN" merge-base --is-ancestor "$HEADSHA" "origin/$DEFAULT" 2>/dev/null; then
|
||||||
|
ROUTE=deploy
|
||||||
|
else
|
||||||
|
ROUTE=worktree
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf 'route%s%s\n' "$TAB" "$ROUTE"
|
||||||
|
printf 'default-branch%s%s\n' "$TAB" "$DEFAULT"
|
||||||
|
printf 'branch%s%s\n' "$TAB" "$BRANCH"
|
||||||
|
printf 'head%s%s\n' "$TAB" "$HEADSHA"
|
||||||
|
|
||||||
|
if [ "$ROUTE" = deploy ]; then
|
||||||
|
echo "改動已在 origin/$DEFAULT 上,走部署路線:$DOMAIN" >&2
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf 'pending%s%s\n' "$TAB" "$BRANCH"
|
||||||
|
echo "改動還沒併進 origin/$DEFAULT,走工作樹路線;回報時要點名待合的 PR:$DOMAIN" >&2
|
||||||
|
exit 3
|
||||||
@@ -4,15 +4,31 @@
|
|||||||
# 用法: find-skill-refs.sh <domain> <skill-name>
|
# 用法: find-skill-refs.sh <domain> <skill-name>
|
||||||
#
|
#
|
||||||
# 掃描樣式:
|
# 掃描樣式:
|
||||||
# 1. 技能名稱字面 {skill-name}
|
# 1. 技能名稱字面 {skill-name}——**純子字串比對**,不看邊界。
|
||||||
|
# 所以短名稱也會命中「名稱+後綴」的其他技能名,以及純敘述文字裡的同一個詞。
|
||||||
|
# 這是故意的:盤點寧可多列,漏一個引用會讓刪除技能少改檔案。
|
||||||
|
# 呼叫端必須逐檔看過命中內容再判斷,不可把清單當成「一定要改的檔案」。
|
||||||
# 2. 指令形式 /jsc-{domain}:{skill-name}
|
# 2. 指令形式 /jsc-{domain}:{skill-name}
|
||||||
# 這兩個樣式已涵蓋其他 SKILL.md 的引用、domain README 的「Skills 目錄」小節、
|
# 這兩個樣式已涵蓋其他 SKILL.md 的引用、domain README 的「Skills 目錄」小節、
|
||||||
# plugins/meta 兩份 marketplace.json 與其在各 domain 存取庫的同步副本、tools/ 腳本、
|
# plugins/meta 兩份 marketplace.json 與其在各 domain 存取庫的同步副本、tools/ 腳本、
|
||||||
# jsc-hooks 接線等位置——只要檔案裡出現技能名稱或指令形式就會被列出。
|
# jsc-hooks 接線等位置——只要檔案裡出現技能名稱或指令形式就會被列出。
|
||||||
#
|
#
|
||||||
# 掃描範圍: /root/plugins 底下所有 domain 存取庫,排除 .git 目錄。
|
# 掃描範圍: **只掃正本 marketplace 上的 domain 存取庫**。
|
||||||
# 輸出: 命中檔案清單(去重、排序),一行一個路徑;exit 0 一律成功,即使沒有命中。
|
# 工作區可能還放著不屬於技能組的存取庫(例 shared、persona、code、doc)與
|
||||||
set -eu
|
# 點開頭的目錄(例 .jsc-monorepo-archive、.kiro),掃進去會讓刪除技能改到
|
||||||
|
# 技能組以外的檔案。domain 清單取自 marketplace.json,不寫死。
|
||||||
|
# 每個 domain 先找 {root}/{domain},再找 {root}/jsc-{domain};兩者都沒有就略過。
|
||||||
|
# 每個存取庫內排除 .git 目錄。
|
||||||
|
# 根目錄交給 tools/plugins-root.sh 推導(JSC_PLUGINS_ROOT -> 從 $PWD 往上找 ->
|
||||||
|
# 腳本位置上兩層 -> $HOME/plugins)。以 plugin 形式安裝時,「腳本位置上兩層」會落在
|
||||||
|
# plugin 快取目錄,單靠它一定推錯,所以推導規則抽成共用腳本。
|
||||||
|
# 輸出: 命中檔案清單(去重、排序),一行一個路徑(stdout);掃描摘要走 stderr。
|
||||||
|
# 結束碼: 0=有命中 1=掃完但零命中 2=用法錯誤
|
||||||
|
# 3=推導不出根目錄、讀不到 domain 清單、本機一個 domain 存取庫都沒有、
|
||||||
|
# 建不了暫存檔,或掃描失敗
|
||||||
|
# 零命中與掃描失敗必須分開:拿掃描失敗當「沒有引用」會讓刪除技能少改檔案。
|
||||||
|
# 環境變數: JSC_PLUGINS_ROOT(根目錄,見 plugins-root.sh)
|
||||||
|
set -u
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo 'usage: find-skill-refs.sh <domain> <skill-name>' >&2
|
echo 'usage: find-skill-refs.sh <domain> <skill-name>' >&2
|
||||||
@@ -22,13 +38,51 @@ usage() {
|
|||||||
[ "$#" -eq 2 ] || usage
|
[ "$#" -eq 2 ] || usage
|
||||||
DOMAIN=$1
|
DOMAIN=$1
|
||||||
SKILL=$2
|
SKILL=$2
|
||||||
|
[ -n "$DOMAIN" ] && [ -n "$SKILL" ] || usage
|
||||||
|
|
||||||
ROOT=/root/plugins
|
HERE=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
||||||
[ -d "$ROOT" ] || { echo "找不到 plugins 根目錄: $ROOT" >&2; exit 1; }
|
. "$HERE/plugins-root.sh"
|
||||||
|
ROOT=$(jsc_plugins_root) || exit 3
|
||||||
|
|
||||||
|
# 正本 domain 清單:優先讀本機任一份 marketplace 副本(每個 repo 都帶同一份)。
|
||||||
|
mkt=""
|
||||||
|
for cand in "$HERE/../.claude-plugin/marketplace.json" "$ROOT"/*/.claude-plugin/marketplace.json; do
|
||||||
|
[ -f "$cand" ] && { mkt="$cand"; break; }
|
||||||
|
done
|
||||||
|
[ -n "$mkt" ] || { echo "找不到 marketplace.json,無法判定 domain 清單" >&2; exit 3; }
|
||||||
|
DOMAINS=$(sed -n 's/.*"name"[[:space:]]*:[[:space:]]*"jsc-\([a-z0-9-]*\)".*/\1/p' "$mkt" | sort -u)
|
||||||
|
[ -n "$DOMAINS" ] || { echo "marketplace.json 裡沒有 jsc-{domain} 條目:$mkt" >&2; exit 3; }
|
||||||
|
|
||||||
|
# 只收本機存在、且不是點開頭目錄的 domain 存取庫路徑。
|
||||||
|
TARGETS=""
|
||||||
|
for d in $DOMAINS; do
|
||||||
|
for cand in "$ROOT/$d" "$ROOT/jsc-$d"; do
|
||||||
|
[ -d "$cand" ] || continue
|
||||||
|
TARGETS="$TARGETS $cand"
|
||||||
|
break
|
||||||
|
done
|
||||||
|
done
|
||||||
|
[ -n "$TARGETS" ] || { echo "本機找不到任何 domain 存取庫:$ROOT(先跑 sync-domains.sh)" >&2; exit 3; }
|
||||||
|
|
||||||
PATTERN1="$SKILL"
|
PATTERN1="$SKILL"
|
||||||
PATTERN2="/jsc-${DOMAIN}:${SKILL}"
|
PATTERN2="/jsc-${DOMAIN}:${SKILL}"
|
||||||
|
|
||||||
grep -rlE --exclude-dir=.git -e "$PATTERN1" -e "$PATTERN2" "$ROOT" 2>/dev/null | sort -u
|
TMP=$(mktemp) || { echo "無法建立暫存檔" >&2; exit 3; }
|
||||||
|
trap 'rm -f "$TMP"' EXIT
|
||||||
|
# grep 的結束碼要單獨看:接管線的話 sort 永遠回 0,掃描失敗就被吃掉了。
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
grep -rlI --exclude-dir=.git -e "$PATTERN1" -e "$PATTERN2" $TARGETS > "$TMP" 2>/dev/null
|
||||||
|
status=$?
|
||||||
|
[ "$status" -le 1 ] || { echo "掃描失敗:$ROOT(grep 結束碼 $status)" >&2; exit 3; }
|
||||||
|
OUT=$(sort -u "$TMP")
|
||||||
|
|
||||||
|
count=$(printf '%s' "$TARGETS" | wc -w | tr -d ' ')
|
||||||
|
if [ -z "$OUT" ]; then
|
||||||
|
echo "掃描完成,零命中:$count 個 domain 存取庫" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf '%s\n' "$OUT"
|
||||||
|
printf '掃描完成,命中 %s 個檔案(掃了 %s 個 domain 存取庫;技能名稱為純子字串比對,請逐檔確認)\n' \
|
||||||
|
"$(printf '%s\n' "$OUT" | wc -l | tr -d ' ')" "$count" >&2
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
Executable
+283
@@ -0,0 +1,283 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
# inventory-tooling.sh — 盤點 jsc plugins、skills、tools、hooks,輸出技能組基礎指引。
|
||||||
|
#
|
||||||
|
# 用法: inventory-tooling.sh [root]
|
||||||
|
#
|
||||||
|
# root: 給了參數就用參數。沒給就交給 tools/plugins-root.sh 推導
|
||||||
|
# (JSC_PLUGINS_ROOT -> 從 $PWD 往上找 -> 腳本位置上兩層 -> $HOME/plugins)。
|
||||||
|
# 以 plugin 形式安裝時,「腳本位置上兩層」會落在 plugin 快取目錄,單靠它一定推錯,
|
||||||
|
# 所以推導規則抽成共用腳本。
|
||||||
|
#
|
||||||
|
# 輸出: Markdown。內容包含 domain、manifest、技能、工具、hooks 與管理入口。
|
||||||
|
# 同一趟已經跑過 list-skills.sh、detect-clis.sh 與 wire-cli.sh status,結果都寫進輸出,
|
||||||
|
# 呼叫端沿用即可,不必再各跑一次。
|
||||||
|
# 結束碼: 0=成功 1=推導不出根目錄、根目錄不存在、marketplace 或必要工具缺失
|
||||||
|
# 環境變數: JSC_PLUGINS_ROOT(根目錄,見 plugins-root.sh)
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
HERE=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
||||||
|
. "$HERE/plugins-root.sh"
|
||||||
|
if [ "$#" -ge 1 ] && [ -n "$1" ]; then
|
||||||
|
ROOT=$1
|
||||||
|
else
|
||||||
|
ROOT=$(jsc_plugins_root) || exit 1
|
||||||
|
fi
|
||||||
|
ROOT=${ROOT%/}
|
||||||
|
|
||||||
|
[ -d "$ROOT" ] || { echo "找不到 plugins 根目錄:$ROOT" >&2; exit 1; }
|
||||||
|
|
||||||
|
MARKETPLACE=""
|
||||||
|
for cand in "$ROOT/meta/.claude-plugin/marketplace.json" "$ROOT"/*/.claude-plugin/marketplace.json; do
|
||||||
|
[ -f "$cand" ] && { MARKETPLACE=$cand; break; }
|
||||||
|
done
|
||||||
|
[ -n "$MARKETPLACE" ] || { echo "找不到 marketplace.json,無法判定 domain 清單" >&2; exit 1; }
|
||||||
|
|
||||||
|
LIST_SKILLS="$ROOT/meta/tools/list-skills.sh"
|
||||||
|
[ -x "$LIST_SKILLS" ] || { echo "找不到可執行的 list-skills.sh:$LIST_SKILLS" >&2; exit 1; }
|
||||||
|
|
||||||
|
tmp=$(mktemp -d)
|
||||||
|
trap 'rm -rf "$tmp"' EXIT
|
||||||
|
|
||||||
|
domains_file="$tmp/domains.tsv"
|
||||||
|
skills_file="$tmp/skills.tsv"
|
||||||
|
clis_file="$tmp/clis.tsv"
|
||||||
|
hook_status_file="$tmp/hook-status.tsv"
|
||||||
|
|
||||||
|
sed -n 's/.*"name"[[:space:]]*:[[:space:]]*"jsc-\([a-z0-9-]*\)".*/\1/p' "$MARKETPLACE" |
|
||||||
|
sort -u |
|
||||||
|
while read -r domain; do
|
||||||
|
[ -n "$domain" ] || continue
|
||||||
|
path="$ROOT/$domain"
|
||||||
|
[ -d "$path" ] || path="$ROOT/jsc-$domain"
|
||||||
|
if [ -d "$path" ]; then
|
||||||
|
version=$(sed -n 's/.*"version": *"\([^"]*\)".*/\1/p' "$path/plugin.json" 2>/dev/null | head -1)
|
||||||
|
[ -n "$version" ] || version="未知"
|
||||||
|
printf '%s\t%s\t%s\n' "$domain" "$version" "$path"
|
||||||
|
else
|
||||||
|
printf '%s\t%s\t%s\n' "$domain" "缺本機存取庫" "-"
|
||||||
|
fi
|
||||||
|
done > "$domains_file"
|
||||||
|
|
||||||
|
JSC_PLUGINS_ROOT="$ROOT" "$LIST_SKILLS" > "$skills_file" 2>/dev/null || : > "$skills_file"
|
||||||
|
|
||||||
|
DETECT_CLIS="$ROOT/cli/tools/detect-clis.sh"
|
||||||
|
if [ -x "$DETECT_CLIS" ]; then
|
||||||
|
"$DETECT_CLIS" > "$clis_file" 2>/dev/null || : > "$clis_file"
|
||||||
|
else
|
||||||
|
: > "$clis_file"
|
||||||
|
fi
|
||||||
|
|
||||||
|
WIRE_CLI="$ROOT/hooks/tools/wire-cli.sh"
|
||||||
|
: > "$hook_status_file"
|
||||||
|
if [ -x "$WIRE_CLI" ] && [ -s "$clis_file" ]; then
|
||||||
|
while IFS="$(printf '\t')" read -r cli path version; do
|
||||||
|
[ -n "$cli" ] || continue
|
||||||
|
out="$tmp/wire-$cli.out"
|
||||||
|
err="$tmp/wire-$cli.err"
|
||||||
|
if "$WIRE_CLI" status "$cli" > "$out" 2> "$err"; then
|
||||||
|
rc=0
|
||||||
|
else
|
||||||
|
rc=$?
|
||||||
|
fi
|
||||||
|
verdict=$(sed -n '1{s/[|]/-/g;p;}' "$out")
|
||||||
|
[ -n "$verdict" ] || verdict=$(sed -n '1{s/[|]/-/g;p;}' "$err")
|
||||||
|
[ -n "$verdict" ] || verdict="無狀態輸出"
|
||||||
|
case "$rc" in
|
||||||
|
0|1|3|5) ;;
|
||||||
|
2) verdict="CLI 代號不符合 wire-cli.sh 用法" ;;
|
||||||
|
*) verdict="未知狀態,結束碼 $rc" ;;
|
||||||
|
esac
|
||||||
|
printf '%s\t%s\t%s\n' "$cli" "$rc" "$verdict" >> "$hook_status_file"
|
||||||
|
done < "$clis_file"
|
||||||
|
fi
|
||||||
|
|
||||||
|
count_lines() {
|
||||||
|
file=$1
|
||||||
|
[ -s "$file" ] || { echo 0; return; }
|
||||||
|
wc -l < "$file" | tr -d ' '
|
||||||
|
}
|
||||||
|
|
||||||
|
domains_count=$(count_lines "$domains_file")
|
||||||
|
skills_count=$(count_lines "$skills_file")
|
||||||
|
clis_count=$(count_lines "$clis_file")
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
# jsc 技能組基礎指引
|
||||||
|
|
||||||
|
產生時間:$(date '+%Y-%m-%d %H:%M:%S %z')
|
||||||
|
|
||||||
|
資料來源:
|
||||||
|
|
||||||
|
- plugins 根目錄:\`$ROOT\`
|
||||||
|
- marketplace:\`$MARKETPLACE\`
|
||||||
|
- 技能清單工具:\`$LIST_SKILLS\`
|
||||||
|
|
||||||
|
## Source freshness
|
||||||
|
|
||||||
|
| 項目 | 狀態 |
|
||||||
|
| --- | --- |
|
||||||
|
| 本機 domain 清單 | synced |
|
||||||
|
| marketplace | \`$MARKETPLACE\` |
|
||||||
|
|
||||||
|
## 現況摘要
|
||||||
|
|
||||||
|
| 項目 | 數量 |
|
||||||
|
| --- | ---: |
|
||||||
|
| 已註冊 plugin domain | $domains_count |
|
||||||
|
| 已掃到技能 | $skills_count |
|
||||||
|
| 已偵測 CLI | $clis_count |
|
||||||
|
|
||||||
|
## Supported plugins
|
||||||
|
|
||||||
|
| domain | version | 本機路徑 |
|
||||||
|
| --- | --- | --- |
|
||||||
|
EOF
|
||||||
|
|
||||||
|
while IFS="$(printf '\t')" read -r domain version path; do
|
||||||
|
[ -n "$domain" ] || continue
|
||||||
|
printf '| `%s` | `%s` | `%s` |\n' "$domain" "$version" "$path"
|
||||||
|
done < "$domains_file"
|
||||||
|
|
||||||
|
cat <<'EOF'
|
||||||
|
|
||||||
|
## Supported skills
|
||||||
|
|
||||||
|
| domain | skill | 用途 |
|
||||||
|
| --- | --- | --- |
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [ -s "$skills_file" ]; then
|
||||||
|
while IFS="$(printf '\t')" read -r domain name desc; do
|
||||||
|
[ -n "$domain" ] || continue
|
||||||
|
printf '| `%s` | `%s` | %s |\n' "$domain" "$name" "$desc"
|
||||||
|
done < "$skills_file"
|
||||||
|
else
|
||||||
|
echo '| - | - | 未掃到技能。請先執行 `meta/tools/sync-domains.sh`。 |'
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat <<'EOF'
|
||||||
|
|
||||||
|
Skill 使用方式:
|
||||||
|
|
||||||
|
- Claude、Antigravity:使用 `/jsc-{domain}:{name}`。
|
||||||
|
- Codex:使用技能名稱或自然語意觸發。
|
||||||
|
- Copilot、Kiro:用需求描述觸發。
|
||||||
|
- 每支技能只保留決策與流程。可標準輸入輸出的細節放到 `tools/`。
|
||||||
|
- 需要強制執行的規則放到 `jsc-hooks`,不要散落在各 domain。
|
||||||
|
|
||||||
|
## Supported CLIs
|
||||||
|
|
||||||
|
| CLI | 執行檔 | 版本 |
|
||||||
|
| --- | --- | --- |
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [ -s "$clis_file" ]; then
|
||||||
|
while IFS="$(printf '\t')" read -r cli path version; do
|
||||||
|
[ -n "$cli" ] || continue
|
||||||
|
printf '| `%s` | `%s` | `%s` |\n' "$cli" "$path" "$version"
|
||||||
|
done < "$clis_file"
|
||||||
|
else
|
||||||
|
echo '| - | - | 這台機器未偵測到支援的 CLI,或找不到 `cli/tools/detect-clis.sh`。 |'
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat <<'EOF'
|
||||||
|
|
||||||
|
## Supported tools
|
||||||
|
|
||||||
|
| domain | tool | 用途 |
|
||||||
|
| --- | --- | --- |
|
||||||
|
EOF
|
||||||
|
|
||||||
|
while IFS="$(printf '\t')" read -r domain version path; do
|
||||||
|
[ -d "$path/tools" ] || continue
|
||||||
|
for tool in "$path"/tools/*; do
|
||||||
|
[ -f "$tool" ] || continue
|
||||||
|
base=$(basename "$tool")
|
||||||
|
first=$(sed -n '2{s/^# *//;p;}' "$tool" 2>/dev/null)
|
||||||
|
[ -n "$first" ] || first="工具腳本"
|
||||||
|
printf '| `%s` | `%s` | %s |\n' "$domain" "$base" "$first"
|
||||||
|
done
|
||||||
|
done < "$domains_file"
|
||||||
|
|
||||||
|
cat <<'EOF'
|
||||||
|
|
||||||
|
Tool 使用方式:
|
||||||
|
|
||||||
|
- 先讀工具檔頭的用法與結束碼。
|
||||||
|
- 用真實參數驗證新增或修改的工具。
|
||||||
|
- 結束碼沒有文件化時,先補工具說明,再讓技能呼叫它。
|
||||||
|
|
||||||
|
## Hook management
|
||||||
|
|
||||||
|
| hook | 用途 |
|
||||||
|
| --- | --- |
|
||||||
|
EOF
|
||||||
|
|
||||||
|
HOOK_DIR="$ROOT/hooks/hooks"
|
||||||
|
if [ -d "$HOOK_DIR" ]; then
|
||||||
|
for hook in "$HOOK_DIR"/*.sh; do
|
||||||
|
[ -f "$hook" ] || continue
|
||||||
|
base=$(basename "$hook")
|
||||||
|
first=$(sed -n '2{s/^# *//;p;}' "$hook" 2>/dev/null)
|
||||||
|
[ -n "$first" ] || first="hook 腳本"
|
||||||
|
printf '| `%s` | %s |\n' "$base" "$first"
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo '| - | 找不到 `hooks/hooks`。請先執行 `meta/tools/sync-domains.sh`。 |'
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat <<'EOF'
|
||||||
|
|
||||||
|
Hook 使用方式:
|
||||||
|
|
||||||
|
- Hook 只放在 `jsc-hooks` domain。
|
||||||
|
- `jsc-hooks:hooks-install` 負責接線到各 CLI。
|
||||||
|
- hook 腳本要能接受 stdin JSON 與環境變數。
|
||||||
|
- 缺欄位時安靜降級並 `exit 0`。
|
||||||
|
- 版本閘門與重啟閘門要保留解除自己的路徑。
|
||||||
|
|
||||||
|
## Hook wiring status
|
||||||
|
|
||||||
|
| CLI | 結束碼 | 狀態 |
|
||||||
|
| --- | ---: | --- |
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [ -s "$hook_status_file" ]; then
|
||||||
|
while IFS="$(printf '\t')" read -r cli rc status; do
|
||||||
|
[ -n "$cli" ] || continue
|
||||||
|
printf '| `%s` | %s | %s |\n' "$cli" "$rc" "$status"
|
||||||
|
done < "$hook_status_file"
|
||||||
|
else
|
||||||
|
echo '| - | - | 未偵測到 CLI,或找不到 `hooks/tools/wire-cli.sh`。 |'
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat <<'EOF'
|
||||||
|
|
||||||
|
## Plugin and skill management
|
||||||
|
|
||||||
|
- 新增技能:使用 `jsc-meta:skill-new`。
|
||||||
|
- 更新單一技能:使用 `jsc-meta:skill-update`。
|
||||||
|
- 批次更新技能組:使用 `jsc-meta:skillset-update`。
|
||||||
|
- 刪除技能:使用 `jsc-meta:skill-delete`。
|
||||||
|
- 安裝、更新、移除整組 plugin:使用 `jsc-cli:deploy`。
|
||||||
|
- 例行稽核:使用 `jsc-meta:skill-check`。
|
||||||
|
- 重新接線 hooks:使用 `jsc-hooks:hooks-install`。
|
||||||
|
|
||||||
|
## Operational checks
|
||||||
|
|
||||||
|
- 體檢目前環境:使用 `jsc-cli:doctor`。
|
||||||
|
- 修復體檢項目:使用 `jsc-cli:setup`。
|
||||||
|
- 版本前置檢查:由 `jsc-hooks/hooks/version-guard.sh` 管理。
|
||||||
|
- 部署後重啟閘門:由 `jsc-hooks/hooks/restart-gate.sh` 管理。
|
||||||
|
- 語言提示與掃描:由 `jsc-hooks/hooks/ste100-guard.sh` 與 `jsc-hooks/hooks/lang-guard.sh` 管理。
|
||||||
|
- 註解範圍檢查:由 `jsc-hooks/hooks/comment-scope.sh` 管理。
|
||||||
|
|
||||||
|
## Use this when
|
||||||
|
|
||||||
|
- 先執行 `meta/tools/sync-domains.sh`,同步 marketplace 上的 domain。
|
||||||
|
- 再執行 `meta/tools/list-skills.sh`,確認技能清單。
|
||||||
|
- 執行本工具,產出基礎指引。
|
||||||
|
- 若新增或修改技能,執行 `meta/tools/sync-skill-manifest.sh {domain-path}`。
|
||||||
|
- 執行 `meta/tools/ste100-lint.sh {domain-path}`。
|
||||||
|
- 依 `jsc-git:pr` 開立 Push Request。
|
||||||
|
EOF
|
||||||
Executable
+105
@@ -0,0 +1,105 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
# lint-scripts.sh — 檢查一個 domain 存取庫的 shell 腳本:語法、可執行、結束碼有沒有記載。
|
||||||
|
#
|
||||||
|
# 用法: lint-scripts.sh <domain-path>
|
||||||
|
#
|
||||||
|
# 檢查三項(掃 {domain-path}/tools 與 {domain-path}/hooks 底下的 *.sh):
|
||||||
|
# 1. 語法 — sh -n 通過。
|
||||||
|
# 2. 可執行 — 檔案有執行權限。技能直接呼叫的腳本沒有 +x,會在部署後才炸。
|
||||||
|
# 3. 結束碼 — 檔頭前 60 行要有結束碼宣告列(「結束碼:」或「exit code」)。
|
||||||
|
# 沒有宣告的腳本,呼叫端沒辦法逐碼分流,只能猜;猜錯就把失敗當成功。
|
||||||
|
#
|
||||||
|
# 為什麼合成一支: skill-check 原本在 SKILL.md 裡寫 find ... -exec sh -n,另外兩項靠散文
|
||||||
|
# 要求人工比對。三項的輸入輸出都固定,散文版每個 domain 各做一次,還會跟腳本實況漂移。
|
||||||
|
#
|
||||||
|
# 例外: 只被 source 的共用函式庫(判準見 is_library)第 2、3 項都不查——它不是可執行入口,
|
||||||
|
# 沒有 +x 的必要,也沒有結束碼語意可宣告。第 1 項語法檢查照查,函式庫一樣會被 sh -n 讀。
|
||||||
|
# 豁免不是靜默的: 每豁免一支就在 stderr 記一行,摘要也帶函式庫支數,才看得出誰被跳過。
|
||||||
|
#
|
||||||
|
# 輸出: 一行一個不合格項目,格式 {檔案}:{檢查項}:{說明}(stdout);
|
||||||
|
# 函式庫豁免通知與統計摘要走 stderr。
|
||||||
|
# 結束碼: 0=掃到腳本且三項全過
|
||||||
|
# 1=有不合格項目(清單在 stdout)
|
||||||
|
# 2=用法錯誤(本腳本只吃一個參數)
|
||||||
|
# 3=domain 路徑不存在,或 tools/ 與 hooks/ 都沒有 *.sh——**什麼都沒掃**,
|
||||||
|
# 不等於通過。缺這兩個目錄本身不是失敗,呼叫端照實記「無腳本可掃」即可。
|
||||||
|
set -u
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo 'usage: lint-scripts.sh <domain-path>' >&2
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
|
||||||
|
[ "$#" -eq 1 ] || usage
|
||||||
|
DOMAIN=${1%/}
|
||||||
|
[ -n "$DOMAIN" ] || usage
|
||||||
|
[ -d "$DOMAIN" ] || { echo "找不到 domain 路徑:$DOMAIN" >&2; exit 3; }
|
||||||
|
|
||||||
|
SCAN=''
|
||||||
|
for d in "$DOMAIN/tools" "$DOMAIN/hooks"; do
|
||||||
|
[ -d "$d" ] && SCAN="$SCAN $d"
|
||||||
|
done
|
||||||
|
[ -n "$SCAN" ] || { echo "沒有 tools/ 也沒有 hooks/,無腳本可掃:$DOMAIN" >&2; exit 3; }
|
||||||
|
|
||||||
|
TMP=$(mktemp) || { echo "無法建立暫存檔" >&2; exit 3; }
|
||||||
|
trap 'rm -f "$TMP"' EXIT
|
||||||
|
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
find $SCAN -type f -name '*.sh' 2>/dev/null | sort > "$TMP"
|
||||||
|
[ -s "$TMP" ] || { echo "tools/ 與 hooks/ 底下沒有 *.sh,無腳本可掃:$DOMAIN" >&2; exit 3; }
|
||||||
|
|
||||||
|
has_exit_stmt() { # $1=檔案;去掉整行註解後還找得到 exit 敘述就回 0
|
||||||
|
grep -v '^[[:space:]]*#' "$1" 2>/dev/null \
|
||||||
|
| grep -qE '(^|[;&|(){}[:space:]])exit([[:space:]]|$)'
|
||||||
|
}
|
||||||
|
|
||||||
|
is_library() { # $1=檔案;只被 source 的共用函式庫,可執行與結束碼兩項都豁免
|
||||||
|
# 判準兩條,缺一不可:
|
||||||
|
# 1. 自我宣告是函式庫——檔名 lib.sh,或檔頭前 30 行寫了「以 source 載入」。
|
||||||
|
# 2. 程式碼裡一個 exit 敘述都沒有。沒有 exit 就沒有結束碼語意,也就沒有東西可宣告;
|
||||||
|
# 這一條同時是「不是可執行入口」的證據,兩項豁免共用同一個事實。
|
||||||
|
# 為什麼不能只看第 1 條: 那是字樣比對,會命中「提到這件事」的腳本。本腳本自己的
|
||||||
|
# 例外段就寫了「以 source 載入」,plugins-root.sh 的用法段也寫了,但兩支都是有
|
||||||
|
# 結束碼語意的可執行入口。只拿第 1 條去豁免結束碼,等於把工具自己漏掉。
|
||||||
|
case "${1##*/}" in
|
||||||
|
lib.sh) ;;
|
||||||
|
*) head -30 "$1" 2>/dev/null | grep -q '以 source 載入' || return 1 ;;
|
||||||
|
esac
|
||||||
|
! has_exit_stmt "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
hit=0
|
||||||
|
total=0
|
||||||
|
libs=0
|
||||||
|
while IFS= read -r f; do
|
||||||
|
[ -n "$f" ] || continue
|
||||||
|
total=$((total + 1))
|
||||||
|
|
||||||
|
err=$(sh -n "$f" 2>&1) || {
|
||||||
|
printf '%s:語法:%s\n' "$f" "$(printf '%s' "$err" | tr '\n' ' ')"
|
||||||
|
hit=1
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_library "$f"; then
|
||||||
|
libs=$((libs + 1))
|
||||||
|
printf '%s:函式庫:判定為只被 source 的共用函式庫(無 exit 敘述),略過「可執行」與「結束碼」\n' "$f" >&2
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -x "$f" ]; then
|
||||||
|
printf '%s:可執行:缺執行權限,請 chmod +x\n' "$f"
|
||||||
|
hit=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! head -60 "$f" 2>/dev/null | grep -qE '結束碼|exit code'; then
|
||||||
|
printf '%s:結束碼:檔頭沒有結束碼宣告列,呼叫端無法逐碼分流\n' "$f"
|
||||||
|
hit=1
|
||||||
|
fi
|
||||||
|
done < "$TMP"
|
||||||
|
|
||||||
|
if [ "$hit" -eq 0 ]; then
|
||||||
|
echo "腳本檢查通過:$total 支(語法、可執行、結束碼宣告),其中 $libs 支判定為函式庫" >&2
|
||||||
|
else
|
||||||
|
echo "腳本檢查有不合格項目:共掃 $total 支(其中 $libs 支判定為函式庫),清單見 stdout" >&2
|
||||||
|
fi
|
||||||
|
exit $hit
|
||||||
Executable
+56
@@ -0,0 +1,56 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
# list-skills.sh — 列出本機所有 domain 存取庫的技能,供選技能與稽核用。
|
||||||
|
#
|
||||||
|
# 用法: list-skills.sh(不吃參數)
|
||||||
|
#
|
||||||
|
# 掃描: {root}/*/skills/*/SKILL.md,讀 frontmatter 的 name 與 description。
|
||||||
|
# domain 取存取庫目錄名,開頭的 jsc- 會去掉。
|
||||||
|
# **只列正本 marketplace 上的 domain**:工作區可能還放著不屬於技能組的
|
||||||
|
# 存取庫(例 shared、persona、code、doc),列出來會讓選技能的流程
|
||||||
|
# 誤把它們當成技能組的一部分。domain 清單取自 marketplace.json,不寫死。
|
||||||
|
# 清單只反映本機檔案;要確保檔案齊全請先跑 sync-domains.sh。
|
||||||
|
#
|
||||||
|
# 根目錄: 交給 tools/plugins-root.sh 推導(JSC_PLUGINS_ROOT -> 從 $PWD 往上找 ->
|
||||||
|
# 腳本位置上兩層 -> $HOME/plugins)。以 plugin 形式安裝時,「腳本位置上兩層」會落在
|
||||||
|
# plugin 快取目錄,單靠它一定推錯,所以推導規則抽成共用腳本。
|
||||||
|
#
|
||||||
|
# 輸出: 一行一個技能,格式 {domain}<TAB>{name}<TAB>{description},依 domain、name 排序。
|
||||||
|
# 結束碼: 0=至少列出一個技能
|
||||||
|
# 1=推導不出根目錄、讀不到 domain 清單,或一個技能都沒有
|
||||||
|
set -u
|
||||||
|
|
||||||
|
HERE=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
||||||
|
. "$HERE/plugins-root.sh"
|
||||||
|
|
||||||
|
ROOT=$(jsc_plugins_root) || exit 1
|
||||||
|
|
||||||
|
# 正本 domain 清單:優先讀本機任一份 marketplace 副本(每個 repo 都帶同一份)。
|
||||||
|
mkt=""
|
||||||
|
for cand in "$HERE/../.claude-plugin/marketplace.json" "$ROOT"/*/.claude-plugin/marketplace.json; do
|
||||||
|
[ -f "$cand" ] && { mkt="$cand"; break; }
|
||||||
|
done
|
||||||
|
[ -n "$mkt" ] || { echo "找不到 marketplace.json,無法判定 domain 清單" >&2; exit 1; }
|
||||||
|
DOMAINS=$(sed -n 's/.*"name"[[:space:]]*:[[:space:]]*"jsc-\([a-z0-9-]*\)".*/\1/p' "$mkt" | sort -u)
|
||||||
|
[ -n "$DOMAINS" ] || { echo "marketplace.json 裡沒有 jsc-{domain} 條目:$mkt" >&2; exit 1; }
|
||||||
|
|
||||||
|
OUT=$(
|
||||||
|
for f in "$ROOT"/*/skills/*/SKILL.md; do
|
||||||
|
[ -f "$f" ] || continue
|
||||||
|
repo=${f#"$ROOT"/}
|
||||||
|
repo=${repo%%/*}
|
||||||
|
domain=${repo#jsc-}
|
||||||
|
# 不在正本清單上的存取庫直接跳過。
|
||||||
|
printf '%s\n' "$DOMAINS" | grep -qx "$domain" || continue
|
||||||
|
name=$(awk 'BEGIN{f=0} /^---$/{f++; next} f==1 && /^name:/{sub(/^name: */,""); print; exit}' "$f")
|
||||||
|
desc=$(awk 'BEGIN{f=0} /^---$/{f++; next} f==1 && /^description:/{sub(/^description: */,""); print; exit}' "$f")
|
||||||
|
[ -n "$name" ] || continue
|
||||||
|
printf '%s\t%s\t%s\n' "$domain" "$name" "$desc"
|
||||||
|
done | sort -t"$(printf '\t')" -k1,1 -k2,2
|
||||||
|
)
|
||||||
|
|
||||||
|
[ -n "$OUT" ] || { echo "掃不到任何 SKILL.md:$ROOT/*/skills/*/SKILL.md(先跑 sync-domains.sh)" >&2; exit 1; }
|
||||||
|
|
||||||
|
printf '%s\n' "$OUT"
|
||||||
|
count=$(printf '%s\n' "$OUT" | wc -l | tr -d ' ')
|
||||||
|
echo "共 $count 個技能" >&2
|
||||||
|
exit 0
|
||||||
Executable
+95
@@ -0,0 +1,95 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
# plugins-root.sh — 推導 jsc 技能組工作目錄的根,meta/tools 六支腳本共用同一套規則。
|
||||||
|
#
|
||||||
|
# 用法:
|
||||||
|
# . "$(dirname -- "$0")/plugins-root.sh" # 以 source 載入,取得 jsc_plugins_root()
|
||||||
|
# ROOT=$(jsc_plugins_root) || exit {該腳本的碼}
|
||||||
|
# sh plugins-root.sh # 直接執行,把推導結果印到 stdout
|
||||||
|
#
|
||||||
|
# 為什麼要抽出來:
|
||||||
|
# 舊寫法一律取「本腳本位置的上兩層」。技能組以 plugin 形式安裝時,腳本落在
|
||||||
|
# ~/.claude/plugins/cache/jsc/jsc-meta/{版本}/tools/,上兩層是 .../cache/jsc/jsc-meta,
|
||||||
|
# 那是 plugin 快取,不是放各 domain 存取庫的工作目錄,**一定推錯**。
|
||||||
|
# 2026-08 例行稽核第一步就實際踩到:不手動設 JSC_PLUGINS_ROOT 就跑不動,
|
||||||
|
# 而呼叫這些腳本的 SKILL.md 都沒提要設。
|
||||||
|
#
|
||||||
|
# 推導順序(取第一個帶得出 gitea.sh 的候選):
|
||||||
|
# 1. JSC_PLUGINS_ROOT
|
||||||
|
# 2. 從 $PWD 逐層往上,找含 meta/.claude-plugin/marketplace.json
|
||||||
|
# (或 jsc-meta/.claude-plugin/marketplace.json)的目錄
|
||||||
|
# 3. 本腳本位置的上兩層({root}/meta/tools -> {root})
|
||||||
|
# 4. $HOME/plugins
|
||||||
|
#
|
||||||
|
# 判準: 候選目錄下要有 gitea/tools/gitea.sh 或 jsc-gitea/tools/gitea.sh。
|
||||||
|
# marketplace.json 每個 domain 存取庫都帶一份,單看它會把某個 domain 存取庫自己
|
||||||
|
# 誤判成根;gitea.sh 只存在於 jsc-gitea 存取庫裡,拿它當標記才分得出根與 domain。
|
||||||
|
#
|
||||||
|
# 逃生門: 候選都不帶 gitea.sh,但 JSC_PLUGINS_ROOT 有設且是目錄時,照設定值使用,
|
||||||
|
# 並在 stderr 提醒。只 clone plugins/meta 的環境(CI、單存取庫維護)本來就沒有
|
||||||
|
# jsc-gitea;這時硬擋會讓「請設 JSC_PLUGINS_ROOT」變成解不開的死路。
|
||||||
|
#
|
||||||
|
# 結束碼(直接執行時): 0=推導成功,根目錄印在 stdout
|
||||||
|
# 1=推導不出來,訊息會指名要設 JSC_PLUGINS_ROOT 並列出試過的候選
|
||||||
|
# 環境變數: JSC_PLUGINS_ROOT(根目錄,最優先)
|
||||||
|
set -u
|
||||||
|
|
||||||
|
_jsc_walk_up() { # 從 $PWD 逐層往上,印出第一個含 meta 存取庫的目錄
|
||||||
|
_jpr_d=$(pwd -P 2>/dev/null) || return 1
|
||||||
|
while [ -n "$_jpr_d" ]; do
|
||||||
|
if [ -f "$_jpr_d/meta/.claude-plugin/marketplace.json" ] ||
|
||||||
|
[ -f "$_jpr_d/jsc-meta/.claude-plugin/marketplace.json" ]; then
|
||||||
|
printf '%s\n' "$_jpr_d"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
[ "$_jpr_d" = / ] && break
|
||||||
|
_jpr_d=$(dirname -- "$_jpr_d")
|
||||||
|
done
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_jsc_has_gitea() { # $1=候選根目錄;jsc-gitea 存取庫是「這是根」的唯一可靠標記
|
||||||
|
[ -f "$1/gitea/tools/gitea.sh" ] || [ -f "$1/jsc-gitea/tools/gitea.sh" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
jsc_plugins_root() { # 印出根目錄(stdout);推不出來回 1,說明走 stderr
|
||||||
|
_jpr_tried=''
|
||||||
|
for _jpr_src in env pwd here home; do
|
||||||
|
case "$_jpr_src" in
|
||||||
|
env) _jpr_c="${JSC_PLUGINS_ROOT:-}" ;;
|
||||||
|
pwd) _jpr_c=$(_jsc_walk_up 2>/dev/null) || _jpr_c='' ;;
|
||||||
|
here) _jpr_c=$(CDPATH= cd -- "$(dirname -- "$0")/../.." 2>/dev/null && pwd) || _jpr_c='' ;;
|
||||||
|
home) if [ -n "${HOME:-}" ]; then _jpr_c="$HOME/plugins"; else _jpr_c=''; fi ;;
|
||||||
|
*) _jpr_c='' ;;
|
||||||
|
esac
|
||||||
|
[ -n "$_jpr_c" ] || continue
|
||||||
|
_jpr_tried="$_jpr_tried $_jpr_src: $_jpr_c
|
||||||
|
"
|
||||||
|
[ -d "$_jpr_c" ] || continue
|
||||||
|
_jsc_has_gitea "$_jpr_c" || continue
|
||||||
|
_jpr_c=$(CDPATH= cd -- "$_jpr_c" && pwd) || continue
|
||||||
|
printf '%s\n' "${_jpr_c%/}"
|
||||||
|
return 0
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -n "${JSC_PLUGINS_ROOT:-}" ] && [ -d "$JSC_PLUGINS_ROOT" ]; then
|
||||||
|
echo "JSC_PLUGINS_ROOT 底下找不到 gitea/tools/gitea.sh,仍照設定值使用:$JSC_PLUGINS_ROOT" >&2
|
||||||
|
_jpr_c=$(CDPATH= cd -- "$JSC_PLUGINS_ROOT" && pwd) || return 1
|
||||||
|
printf '%s\n' "${_jpr_c%/}"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
{
|
||||||
|
echo '推導不出 jsc 技能組的根目錄。'
|
||||||
|
echo '以 plugin 形式安裝時,腳本位在 ~/.claude/plugins/cache/jsc/jsc-meta/{版本}/tools/,'
|
||||||
|
echo '上兩層落在 plugin 快取目錄,不是放各 domain 存取庫的工作目錄,所以推不出來。'
|
||||||
|
echo '請設 JSC_PLUGINS_ROOT 指向放各 domain 存取庫的工作目錄(底下要有 gitea 或 jsc-gitea)。'
|
||||||
|
echo '已試過的候選:'
|
||||||
|
printf '%s' "$_jpr_tried"
|
||||||
|
} >&2
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# 直接執行時印出結果;被 source 時只提供函式。
|
||||||
|
case "${0##*/}" in
|
||||||
|
plugins-root.sh) jsc_plugins_root || exit 1 ;;
|
||||||
|
esac
|
||||||
+104
-3
@@ -5,15 +5,108 @@
|
|||||||
# 1. 中國用語(references/ste100.md 的替換表左欄)
|
# 1. 中國用語(references/ste100.md 的替換表左欄)
|
||||||
# 2. 中文句內的半形標點(, ; ! ? 緊鄰中日韓字元)
|
# 2. 中文句內的半形標點(, ; ! ? 緊鄰中日韓字元)
|
||||||
# 3. 常見 AI 套話(總的來說、綜上所述、希望這對你有幫助 等)
|
# 3. 常見 AI 套話(總的來說、綜上所述、希望這對你有幫助 等)
|
||||||
# 輸出: {檔案}:{行號}:{類別}:{命中內容};全部通過 exit 0,有命中 exit 1。
|
# 4. 簡體字(只收沒有繁體正當用法的字,避免誤報)
|
||||||
# 限制: 只掃 .md 檔;程式碼圍欄內的內容可能誤報,人工複核。
|
# 5. 中文並列項用斜線(半形 / 或全形 / 夾在中日韓字元之間),應改頓號「、」
|
||||||
|
# 6. 亂碼(U+FFFD 替代字元、Latin-1 雙重編碼殘留)
|
||||||
|
# 輸出: {檔案}:{行號}:{類別}:{命中內容}(stdout);用法錯誤走 stderr。
|
||||||
|
# 結束碼: 0=掃過的檔案全部通過 1=有命中 2=沒給檢查對象(空跑會回 0,看起來像通過,所以擋掉)
|
||||||
|
# 環境變數: JSC_SIMPLIFIED_FILE(簡體字表路徑,優先於自動搜尋)
|
||||||
|
# 掃描範圍與分流:
|
||||||
|
# 文件檔(.md、.json)跑全部六項。
|
||||||
|
# 程式碼檔(.sh .js .ts .py .cs .java .go .rb .php .sql .yml .yaml .toml)只跑簡體字與亂碼。
|
||||||
|
# 理由: 程式碼註解也要繁中無亂碼,但中國用語、半形標點、AI 套話、並列斜線這四項在程式碼裡
|
||||||
|
# 誤報率太高——英文標點、檔案路徑、URL、正規表示式到處都是半形逗號與斜線,識別字也常撞到
|
||||||
|
# 替換表左欄。只留簡體字與亂碼,命中就幾乎都是真的。
|
||||||
|
# 限制: 程式碼圍欄內的內容可能誤報,人工複核。
|
||||||
|
# references/ste100.md 與本檔本身跳過——規則文件與規則實作裡的詞是被討論,不是被使用。
|
||||||
|
# 並列斜線會誤報兩類:含中文的路徑或分支名範例(例 feat/報表/P2),
|
||||||
|
# 以及英文項目並列(準則允許)。命中後先判斷是不是真的並列項。
|
||||||
set -u
|
set -u
|
||||||
TERMS='默認|支持某|兼容|信息|數據庫|服務器|軟件|硬件|網絡|質量|卸載|反饋|視頻|屏幕|鼠標|打印|立馬|靠譜|賦能|閉環|抓手|復盤'
|
TERMS='默認|支持某|兼容|信息|數據庫|服務器|軟件|硬件|網絡|質量|卸載|反饋|視頻|屏幕|鼠標|打印|立馬|靠譜|賦能|閉環|抓手|復盤'
|
||||||
CLICHES='總的來說|綜上所述|希望這對你有幫助|好問題|在當今|瞬息萬變|標誌著|奠定了基礎|體現了|不僅僅是|讓我們一起'
|
CLICHES='總的來說|綜上所述|希望這對你有幫助|好問題|在當今|瞬息萬變|標誌著|奠定了基礎|體現了|不僅僅是|讓我們一起'
|
||||||
|
# 亂碼特徵,全部用十六進位跳脫寫,本檔才不會存進真的亂碼字元自己打自己:
|
||||||
|
# \x{fffd} 替代字元,轉檔失敗留下的痕跡
|
||||||
|
# \x{ef}\x{bf}\x{bd} U+FFFD 本身又被雙重編碼一次(顯示成 �)
|
||||||
|
# [\x{c2}-\x{f4}][\x{80}-\x{bf}]
|
||||||
|
# 雙重編碼特徵:UTF-8 位元組被當 Latin-1 解讀再存回去,原本的前導位元組變成
|
||||||
|
# U+00C2–U+00F4 的拉丁字母(Ã、â、ä),後面緊跟著本來的續接位元組 U+0080–U+00BF。
|
||||||
|
# 兩者相連在正常文字裡幾乎不會出現,所以誤報極低;只寫 Ã 或 â 開頭會漏掉中日韓
|
||||||
|
# 字元最常見的 ä¸ 這一類。
|
||||||
|
GARBLED='\x{fffd}|\x{ef}\x{bf}\x{bd}|[\x{c2}-\x{f4}][\x{80}-\x{bf}]'
|
||||||
|
# 簡體字表的真實來源是 jsc-hooks 的 hooks/simplified.txt(ste100-guard.sh 共用同一份)。
|
||||||
|
# 讀不到就退回下面的內建備援字表。備援不能拿掉: jsc-hooks 不一定裝在這台機器上(單獨 clone
|
||||||
|
# plugins/meta、CI 只取一個 repo 都會發生),缺了基礎設施就讓簡體字檢查靜靜失效,會把「沒命中」
|
||||||
|
# 變成假通過,比不檢查更危險。
|
||||||
|
# 刻意排除繁體也在用的字(后、台、干、只、里、面、制、志),只留簡化後才出現的字形。
|
||||||
|
SIMPLIFIED_FALLBACK='应|为|这|说|发|国|过|对|开|关|问|题|东|车|马|鸟|龙|飞|见|无|产|业|务|书|写|学|习|报|纸|认|识|证|际|网|络|计|划|实|现|给|条|约|级|组|织|变|换|电|脑|两|双|单|构|价|钱|众|议|论|传|统|么|儿|们|从|来|时|间|长|门|闻|声|员|图|团|转|输|达|运|进|远|连|边|还|经|该|营|规|则|范|围|参|数|类|结|态|设|备|辑|译|码|库|档'
|
||||||
|
|
||||||
|
# 找共用字表。搜尋路徑比照 jsc-hooks/hooks/lib.sh 的 jsc_gitea_sh():
|
||||||
|
# 先環境變數,再開發用的並排存取庫版面,最後已安裝的 plugin 快取版面。
|
||||||
|
simplified_file() {
|
||||||
|
if [ -n "${JSC_SIMPLIFIED_FILE:-}" ] && [ -f "$JSC_SIMPLIFIED_FILE" ]; then
|
||||||
|
printf '%s\n' "$JSC_SIMPLIFIED_FILE"; return 0
|
||||||
|
fi
|
||||||
|
_root="${CLAUDE_PLUGIN_ROOT:-$(dirname "$0")/..}"
|
||||||
|
# 開發用的並排存取庫版面:{workspace}/meta 旁邊就是 {workspace}/hooks
|
||||||
|
for _c in "$_root/../hooks/hooks/simplified.txt" "$_root/../jsc-hooks/hooks/simplified.txt"; do
|
||||||
|
[ -f "$_c" ] && { printf '%s\n' "$_c"; return 0; }
|
||||||
|
done
|
||||||
|
# 已安裝版面:每個 plugin 各有版本目錄,取排序最後的一份(通常即最新版)
|
||||||
|
_c=$(ls "$_root"/../../jsc-hooks/*/hooks/simplified.txt \
|
||||||
|
"$_root"/../../hooks/*/hooks/simplified.txt \
|
||||||
|
"$HOME"/.claude/plugins/cache/*/jsc-hooks/*/hooks/simplified.txt 2>/dev/null \
|
||||||
|
| sort | tail -n1)
|
||||||
|
[ -n "$_c" ] && [ -f "$_c" ] && { printf '%s\n' "$_c"; return 0; }
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
SIMPLIFIED=''
|
||||||
|
SIMPLIFIED_SRC=$(simplified_file || true)
|
||||||
|
if [ -n "$SIMPLIFIED_SRC" ]; then
|
||||||
|
# 一行一個字,# 開頭與空行忽略,行內空白去掉,再串成 grep -E 的交替式
|
||||||
|
SIMPLIFIED=$(sed 's/#.*//; s/[[:space:]]//g' "$SIMPLIFIED_SRC" \
|
||||||
|
| grep -v '^$' | tr '\n' '|' | sed 's/|$//')
|
||||||
|
fi
|
||||||
|
[ -n "$SIMPLIFIED" ] || SIMPLIFIED=$SIMPLIFIED_FALLBACK
|
||||||
|
|
||||||
hit=0
|
hit=0
|
||||||
|
# 不帶參數會空跑並回 0,看起來像「全部通過」。這種假通過比不檢查更危險,所以擋掉。
|
||||||
|
if [ "$#" -eq 0 ]; then
|
||||||
|
echo '用法: ste100-lint.sh <file|dir> [...]' >&2
|
||||||
|
echo '沒有給檢查對象。空跑會回 0,看起來像通過,所以這裡直接視為錯誤。' >&2
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
skip() { # $1=路徑;規則文件、字表與規則實作本身不掃
|
||||||
|
# 這幾個檔案裡的簡體字是被討論、被列舉的對象,不是被使用。掃它們等於自己打自己,
|
||||||
|
# 每次都命中卻永遠改不掉,久了就會有人把整個檢查關掉。
|
||||||
|
case "$1" in
|
||||||
|
*/references/ste100.md|references/ste100.md) return 0 ;;
|
||||||
|
*/tools/ste100-lint.sh|tools/ste100-lint.sh) return 0 ;;
|
||||||
|
*/hooks/simplified.txt|simplified.txt) return 0 ;;
|
||||||
|
*/hooks/ste100-guard.sh|ste100-guard.sh) return 0 ;;
|
||||||
|
*/hooks/lang-guard.sh|lang-guard.sh) return 0 ;;
|
||||||
|
*) return 1 ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
kind() { # $1=路徑;輸出 doc(跑全部六項)或 code(只跑簡體字與亂碼),其餘不掃
|
||||||
|
case "$1" in
|
||||||
|
*.md|*.json) printf 'doc' ;;
|
||||||
|
*.sh|*.js|*.ts|*.py|*.cs|*.java|*.go|*.rb|*.php|*.sql|*.yml|*.yaml|*.toml) printf 'code' ;;
|
||||||
|
*) printf '' ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
files() {
|
files() {
|
||||||
for p in "$@"; do
|
for p in "$@"; do
|
||||||
if [ -d "$p" ]; then find "$p" -name '*.md' -not -path '*/.git/*'; else echo "$p"; fi
|
if [ -d "$p" ]; then
|
||||||
|
find "$p" \( \
|
||||||
|
-name '*.md' -o -name '*.json' \
|
||||||
|
-o -name '*.sh' -o -name '*.js' -o -name '*.ts' -o -name '*.py' \
|
||||||
|
-o -name '*.cs' -o -name '*.java' -o -name '*.go' -o -name '*.rb' \
|
||||||
|
-o -name '*.php' -o -name '*.sql' -o -name '*.yml' -o -name '*.yaml' \
|
||||||
|
-o -name '*.toml' \) -not -path '*/.git/*'
|
||||||
|
else
|
||||||
|
echo "$p"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
check() { # $1=檔案 $2=類別 $3=grep 模式 $4=grep 旗標
|
check() { # $1=檔案 $2=類別 $3=grep 模式 $4=grep 旗標
|
||||||
@@ -21,8 +114,16 @@ check() { # $1=檔案 $2=類別 $3=grep 模式 $4=grep 旗標
|
|||||||
if [ -n "$out" ]; then printf '%s\n' "$out"; hit=1; fi
|
if [ -n "$out" ]; then printf '%s\n' "$out"; hit=1; fi
|
||||||
}
|
}
|
||||||
for f in $(files "$@"); do
|
for f in $(files "$@"); do
|
||||||
|
skip "$f" && continue
|
||||||
|
k=$(kind "$f")
|
||||||
|
[ -n "$k" ] || continue
|
||||||
|
if [ "$k" = doc ]; then
|
||||||
check "$f" "中國用語" "$TERMS" E
|
check "$f" "中國用語" "$TERMS" E
|
||||||
check "$f" "半形標點" '[\x{4e00}-\x{9fff}][,;!?]|[,;][\x{4e00}-\x{9fff}]' P
|
check "$f" "半形標點" '[\x{4e00}-\x{9fff}][,;!?]|[,;][\x{4e00}-\x{9fff}]' P
|
||||||
check "$f" "AI 套話" "$CLICHES" E
|
check "$f" "AI 套話" "$CLICHES" E
|
||||||
|
check "$f" "並列斜線" '[\x{4e00}-\x{9fff}][ ]?[//][ ]?[\x{4e00}-\x{9fff}]' P
|
||||||
|
fi
|
||||||
|
check "$f" "簡體字" "$SIMPLIFIED" E
|
||||||
|
check "$f" "亂碼" "$GARBLED" P
|
||||||
done
|
done
|
||||||
exit $hit
|
exit $hit
|
||||||
|
|||||||
Executable
+90
@@ -0,0 +1,90 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
# sync-domains.sh — 依 Gitea 正本 marketplace 把所有 domain 存取庫同步到本機。
|
||||||
|
#
|
||||||
|
# 用法: sync-domains.sh(不吃參數)
|
||||||
|
#
|
||||||
|
# 流程:
|
||||||
|
# 1. 透過 jsc-gitea/tools/gitea.sh 讀正本 marketplace
|
||||||
|
# (plugins/meta 的 .claude-plugin/marketplace.json),取得權威 domain 清單。
|
||||||
|
# 2. 本機缺少的 domain:用 gitea.sh clone-url plugins/{domain} 取網址後 clone。
|
||||||
|
# 3. 本機已有的 domain:git pull。工作區有未提交變更就跳過 pull,只在 stderr 提醒——
|
||||||
|
# 正在改的 repo 不該被自動 pull 覆蓋。
|
||||||
|
#
|
||||||
|
# 根目錄: 交給 tools/plugins-root.sh 推導(JSC_PLUGINS_ROOT -> 從 $PWD 往上找 ->
|
||||||
|
# 腳本位置上兩層 -> $HOME/plugins)。以 plugin 形式安裝時,「腳本位置上兩層」會落在
|
||||||
|
# plugin 快取目錄,單靠它一定推錯,所以推導規則抽成共用腳本。
|
||||||
|
# 存取庫目錄名: 先找 {root}/{domain},再找 {root}/jsc-{domain};都沒有才 clone 成 {root}/{domain}。
|
||||||
|
#
|
||||||
|
# 輸出: 一行一個 domain,格式 {domain}<TAB>{path}(stdout);警告與失敗說明走 stderr。
|
||||||
|
# 結束碼: 0=正本讀到、每個 domain 都在本機,而且每個既有存取庫都更新到最新
|
||||||
|
# 1=推導不出根目錄、讀不到正本 marketplace,或找不到 gitea.sh(不輸出任何 domain)
|
||||||
|
# 2=正本讀到,但有 domain 沒能取得或 clone 失敗(已輸出其餘 domain)
|
||||||
|
# 3=每個 domain 都在本機,但有存取庫沒更新到最新:工作區髒而跳過 pull,
|
||||||
|
# 或 pull 失敗。stderr 會逐一列出這些路徑。**exit 0 才代表「全部最新」**;
|
||||||
|
# 拿 3 當乾淨會讓後續步驟改在落後的檔案上。
|
||||||
|
# 同時發生時回較嚴重的那個:2 蓋過 3。
|
||||||
|
# 環境變數: JSC_PLUGINS_ROOT(根目錄)
|
||||||
|
# JSC_SYNC_DRY_RUN=1(只印出會做什麼,不動檔案;不執行 pull/clone,
|
||||||
|
# 所以也不因為「沒更新」回 3)
|
||||||
|
set -u
|
||||||
|
|
||||||
|
HERE=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
||||||
|
. "$HERE/plugins-root.sh"
|
||||||
|
DRY="${JSC_SYNC_DRY_RUN:-}"
|
||||||
|
|
||||||
|
ROOT=$(jsc_plugins_root) || exit 1
|
||||||
|
|
||||||
|
GITEA=""
|
||||||
|
for g in "$ROOT/gitea/tools/gitea.sh" "$ROOT/jsc-gitea/tools/gitea.sh"; do
|
||||||
|
[ -f "$g" ] && { GITEA="$g"; break; }
|
||||||
|
done
|
||||||
|
[ -n "$GITEA" ] || { echo "找不到 gitea.sh:請先取得 jsc-gitea 存取庫" >&2; exit 1; }
|
||||||
|
|
||||||
|
mkt=$(sh "$GITEA" api GET /repos/plugins/meta/raw/.claude-plugin/marketplace.json 2>/dev/null) || mkt=""
|
||||||
|
[ -n "$mkt" ] || { echo "讀不到正本 marketplace:檢查 GITEA_HOST、GITEA_TOKEN 或 tea 登入" >&2; exit 1; }
|
||||||
|
|
||||||
|
DOMAINS=$(printf '%s\n' "$mkt" | sed -n 's/.*"name": *"jsc-\([a-z0-9-]*\)".*/\1/p' | sort -u)
|
||||||
|
[ -n "$DOMAINS" ] || { echo "正本 marketplace 裡沒有 jsc-{domain} 條目" >&2; exit 1; }
|
||||||
|
|
||||||
|
repo_path() { # $1=domain;印出既有路徑(return 0)或預設路徑(return 1)
|
||||||
|
for d in "$ROOT/$1" "$ROOT/jsc-$1"; do
|
||||||
|
[ -d "$d" ] && { printf '%s' "$d"; return 0; }
|
||||||
|
done
|
||||||
|
printf '%s' "$ROOT/$1"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
rc=0
|
||||||
|
stale=0
|
||||||
|
for domain in $DOMAINS; do
|
||||||
|
if path=$(repo_path "$domain"); then
|
||||||
|
if [ -n "$(git -C "$path" status --porcelain 2>/dev/null)" ]; then
|
||||||
|
echo "工作區有未提交變更,跳過 pull,未更新到最新:$path" >&2
|
||||||
|
stale=1
|
||||||
|
elif [ "$DRY" = 1 ]; then
|
||||||
|
echo "[dry-run] git -C $path pull --ff-only" >&2
|
||||||
|
elif ! git -C "$path" pull --quiet --ff-only >/dev/null 2>&1; then
|
||||||
|
echo "pull 失敗,保留本機版本,未更新到最新:$path" >&2
|
||||||
|
stale=1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
url=$(sh "$GITEA" clone-url "plugins/$domain" 2>/dev/null) || url=""
|
||||||
|
if [ -z "$url" ]; then
|
||||||
|
echo "取不到 clone 網址,略過:plugins/$domain" >&2
|
||||||
|
rc=2
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
if [ "$DRY" = 1 ]; then
|
||||||
|
echo "[dry-run] git clone $url $path" >&2
|
||||||
|
elif ! git clone --quiet "$url" "$path" >/dev/null 2>&1; then
|
||||||
|
echo "clone 失敗:$url" >&2
|
||||||
|
rc=2
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
printf '%s\t%s\n' "$domain" "$path"
|
||||||
|
done
|
||||||
|
|
||||||
|
# 2(取不到或 clone 失敗)比 3(沒更新到最新)嚴重,優先回報。
|
||||||
|
[ "$rc" -eq 0 ] && [ "$stale" -eq 1 ] && rc=3
|
||||||
|
exit $rc
|
||||||
Executable
+127
@@ -0,0 +1,127 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
# sync-marketplace.sh — 把一個 plugin 條目寫進正本 marketplace,再同步到所有 domain 存取庫。
|
||||||
|
#
|
||||||
|
# 用法: sync-marketplace.sh <domain> <repo-url> <description>
|
||||||
|
# 例: sync-marketplace.sh doc https://gitea.jsc.idv.tw/plugins/doc.git "文件產出與同步"
|
||||||
|
#
|
||||||
|
# 行為:
|
||||||
|
# 1. 在 plugins/meta 的兩份正本(.claude-plugin/marketplace.json 與
|
||||||
|
# .agents/plugins/marketplace.json)插入或更新 jsc-{domain} 條目;已存在就覆寫網址與描述。
|
||||||
|
# 條目依 name 排序,格式維持兩格縮排、不轉義非 ASCII、結尾一個換行。
|
||||||
|
# 2. 兩份正本與所有副本都由同一份算好的內容複製過去,保證位元組完全一致。
|
||||||
|
# 3. 逐一複製到每個 domain 存取庫的相同兩個路徑(含新 domain 自己)。
|
||||||
|
# 4. 全部寫完後逐檔比對,有任何一份不一致就報錯。
|
||||||
|
#
|
||||||
|
# 依賴: **python3**(只用標準函式庫的 json 模組)。
|
||||||
|
# 本 repo 的腳本一律 shell 優先,這裡是唯一例外:條目的插入、排序與重新序列化要動 JSON,
|
||||||
|
# 純 shell 拼 JSON 會壞掉(縮排、逸出、非 ASCII 描述)。所以保留 python3。
|
||||||
|
# python3 不在 PATH 時:腳本不寫任何檔案,印出缺少 python3 的訊息,回 1。
|
||||||
|
# 呼叫端要先裝 python3 再重跑,不可改用 sed 手動改 marketplace。
|
||||||
|
#
|
||||||
|
# 根目錄: 交給 tools/plugins-root.sh 推導(JSC_PLUGINS_ROOT -> 從 $PWD 往上找 ->
|
||||||
|
# 腳本位置上兩層 -> $HOME/plugins)。以 plugin 形式安裝時,「腳本位置上兩層」會落在
|
||||||
|
# plugin 快取目錄,單靠它一定推錯,所以推導規則抽成共用腳本。
|
||||||
|
# 存取庫目錄名: 先找 {root}/{domain},再找 {root}/jsc-{domain}。
|
||||||
|
#
|
||||||
|
# 輸出: 一行一個實際寫入的檔案路徑(stdout);略過與失敗說明走 stderr。
|
||||||
|
# 結束碼: 0=全部寫入且逐檔一致 2=用法錯誤
|
||||||
|
# 1=推導不出根目錄、缺 python3、正本讀寫失敗、建不了暫存目錄,
|
||||||
|
# 或有檔案比對不一致
|
||||||
|
# 3=寫入成功,但有 domain 存取庫不在本機(先跑 sync-domains.sh 再重跑)
|
||||||
|
# 環境變數: JSC_PLUGINS_ROOT(根目錄,見 plugins-root.sh)
|
||||||
|
set -u
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo 'usage: sync-marketplace.sh <domain> <repo-url> <description>' >&2
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
|
||||||
|
[ "$#" -eq 3 ] || usage
|
||||||
|
DOMAIN=$1
|
||||||
|
URL=$2
|
||||||
|
DESC=$3
|
||||||
|
[ -n "$DOMAIN" ] && [ -n "$URL" ] && [ -n "$DESC" ] || usage
|
||||||
|
|
||||||
|
HERE=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
||||||
|
META=$(CDPATH= cd -- "$HERE/.." && pwd)
|
||||||
|
. "$HERE/plugins-root.sh"
|
||||||
|
ROOT=$(jsc_plugins_root) || exit 1
|
||||||
|
|
||||||
|
REL_CLAUDE='.claude-plugin/marketplace.json'
|
||||||
|
REL_AGENTS='.agents/plugins/marketplace.json'
|
||||||
|
CANON="$META/$REL_CLAUDE"
|
||||||
|
|
||||||
|
[ -f "$CANON" ] || { echo "找不到正本 marketplace:$CANON" >&2; exit 1; }
|
||||||
|
|
||||||
|
# 先擋掉缺 python3 的環境,才不會寫到一半才失敗。
|
||||||
|
command -v python3 >/dev/null 2>&1 || {
|
||||||
|
echo '找不到 python3:本腳本用 python3 的 json 模組改 marketplace 條目。請先安裝 python3 再重跑。' >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
WORKDIR=$(mktemp -d) || exit 1
|
||||||
|
trap 'rm -rf "$WORKDIR"' EXIT
|
||||||
|
NEW="$WORKDIR/marketplace.json"
|
||||||
|
|
||||||
|
# 條目的插入與更新交給 json 解析器;用 sed 拼 JSON 會壞掉。
|
||||||
|
JSC_MK_DOMAIN="$DOMAIN" JSC_MK_URL="$URL" JSC_MK_DESC="$DESC" \
|
||||||
|
JSC_MK_IN="$CANON" JSC_MK_OUT="$NEW" python3 - <<'PY' || { echo "更新正本內容失敗:$CANON" >&2; exit 1; }
|
||||||
|
import json, os
|
||||||
|
|
||||||
|
name = "jsc-" + os.environ["JSC_MK_DOMAIN"]
|
||||||
|
entry = {
|
||||||
|
"name": name,
|
||||||
|
"source": {"source": "url", "url": os.environ["JSC_MK_URL"]},
|
||||||
|
"description": os.environ["JSC_MK_DESC"],
|
||||||
|
}
|
||||||
|
with open(os.environ["JSC_MK_IN"], encoding="utf-8") as fh:
|
||||||
|
data = json.load(fh)
|
||||||
|
plugins = [p for p in data.get("plugins", []) if p.get("name") != name]
|
||||||
|
plugins.append(entry)
|
||||||
|
data["plugins"] = sorted(plugins, key=lambda p: p.get("name", ""))
|
||||||
|
with open(os.environ["JSC_MK_OUT"], "w", encoding="utf-8") as fh:
|
||||||
|
fh.write(json.dumps(data, indent=2, ensure_ascii=False) + "\n")
|
||||||
|
PY
|
||||||
|
|
||||||
|
rc=0
|
||||||
|
|
||||||
|
write_copy() { # $1=目標檔案
|
||||||
|
target=$1
|
||||||
|
dir=$(dirname "$target")
|
||||||
|
mkdir -p "$dir" 2>/dev/null || { echo "無法建立目錄:$dir" >&2; rc=1; return 1; }
|
||||||
|
cp "$NEW" "$target" 2>/dev/null || { echo "無法寫入:$target" >&2; rc=1; return 1; }
|
||||||
|
printf '%s\n' "$target"
|
||||||
|
}
|
||||||
|
|
||||||
|
# ---- 1. 兩份正本 ----
|
||||||
|
write_copy "$META/$REL_CLAUDE"
|
||||||
|
write_copy "$META/$REL_AGENTS"
|
||||||
|
|
||||||
|
# ---- 2. 每個 domain 存取庫的副本 ----
|
||||||
|
DOMAINS=$(sed -n 's/.*"name": *"jsc-\([a-z0-9-]*\)".*/\1/p' "$NEW" | sort -u)
|
||||||
|
for d in $DOMAINS; do
|
||||||
|
path=""
|
||||||
|
for cand in "$ROOT/$d" "$ROOT/jsc-$d"; do
|
||||||
|
[ -d "$cand" ] && { path="$cand"; break; }
|
||||||
|
done
|
||||||
|
if [ -z "$path" ]; then
|
||||||
|
echo "存取庫不在本機,略過:$d(先跑 sync-domains.sh)" >&2
|
||||||
|
[ "$rc" -eq 0 ] && rc=3
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
[ "$path" = "$META" ] && continue
|
||||||
|
write_copy "$path/$REL_CLAUDE"
|
||||||
|
write_copy "$path/$REL_AGENTS"
|
||||||
|
done
|
||||||
|
|
||||||
|
# ---- 3. 逐檔比對,確認位元組一致 ----
|
||||||
|
for d in "$META" $(for x in $DOMAINS; do
|
||||||
|
for cand in "$ROOT/$x" "$ROOT/jsc-$x"; do [ -d "$cand" ] && { echo "$cand"; break; }; done
|
||||||
|
done); do
|
||||||
|
for rel in "$REL_CLAUDE" "$REL_AGENTS"; do
|
||||||
|
[ -f "$d/$rel" ] || continue
|
||||||
|
cmp -s "$NEW" "$d/$rel" || { echo "內容不一致:$d/$rel" >&2; rc=1; }
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
exit $rc
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# sync-skill-manifest.sh — 同步 domain 的 README「Skills 目錄」區塊,並把該 domain 所有
|
# sync-skill-manifest.sh — 同步 domain 的 README「Skills 目錄」區塊,並把該 domain 所有
|
||||||
# plugin manifest 的 version 各 bump 一個 patch。
|
# plugin manifest 的 version 各 bump 一次,且 major 可超過 9;minor 與 patch 仍是單位數。
|
||||||
#
|
#
|
||||||
# 用法: sync-skill-manifest.sh <domain-path>
|
# 用法: sync-skill-manifest.sh <domain-path>
|
||||||
#
|
#
|
||||||
@@ -11,9 +11,16 @@
|
|||||||
#
|
#
|
||||||
# manifest: 依序找出 domain 下存在的 plugin.json、.claude-plugin/plugin.json、
|
# manifest: 依序找出 domain 下存在的 plugin.json、.claude-plugin/plugin.json、
|
||||||
# .codex-plugin/plugin.json,version 一律 bump 成同一個新值(以第一份找到的 manifest 版本為準,
|
# .codex-plugin/plugin.json,version 一律 bump 成同一個新值(以第一份找到的 manifest 版本為準,
|
||||||
# patch 位加一;major.minor 不變)。
|
# 右側數字加一,滿 9 就往左進位;major 不設上限,minor 與 patch 都不超過 9)。
|
||||||
#
|
#
|
||||||
# 輸出: 變更摘要——README 新增/移除的技能小節、各 manifest 的舊版本 -> 新版本。
|
# 輸出: 變更摘要——README 新增或移除的技能小節、各 manifest 的舊版本 -> 新版本(stdout);
|
||||||
|
# 失敗說明走 stderr。
|
||||||
|
# 結束碼: 0=README 區塊與三份 manifest 都已同步
|
||||||
|
# 1=domain 路徑不存在、缺 skills/、缺 README.md、README 缺 JSC-SKILLS 標記、
|
||||||
|
# 掃不到任何 SKILL.md、找不到 plugin manifest,或 manifest 讀不到 version 欄位
|
||||||
|
# 2=用法錯誤(本腳本只吃一個參數)
|
||||||
|
# 本腳本是 set -e:上列以外的指令失敗會直接中止,結束碼由該指令決定,
|
||||||
|
# 呼叫端把「不是 0、1、2」一律當執行環境故障處理,不得視為同步成功。
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
@@ -151,7 +158,20 @@ old=$(sed -n 's/.*"version": *"\([^"]*\)".*/\1/p' "$first" | head -1)
|
|||||||
major=$(printf '%s' "$old" | cut -d. -f1)
|
major=$(printf '%s' "$old" | cut -d. -f1)
|
||||||
minor=$(printf '%s' "$old" | cut -d. -f2)
|
minor=$(printf '%s' "$old" | cut -d. -f2)
|
||||||
patch=$(printf '%s' "$old" | cut -d. -f3)
|
patch=$(printf '%s' "$old" | cut -d. -f3)
|
||||||
new="$major.$minor.$((patch + 1))"
|
|
||||||
|
major=$((major + 0))
|
||||||
|
minor=$((minor + 0))
|
||||||
|
patch=$((patch + 1))
|
||||||
|
while [ "$patch" -gt 9 ]; do
|
||||||
|
patch=$((patch - 10))
|
||||||
|
minor=$((minor + 1))
|
||||||
|
done
|
||||||
|
while [ "$minor" -gt 9 ]; do
|
||||||
|
minor=$((minor - 10))
|
||||||
|
major=$((major + 1))
|
||||||
|
done
|
||||||
|
|
||||||
|
new="$major.$minor.$patch"
|
||||||
|
|
||||||
echo "== manifest version =="
|
echo "== manifest version =="
|
||||||
for m in $MANIFESTS; do
|
for m in $MANIFESTS; do
|
||||||
|
|||||||
Executable
+85
@@ -0,0 +1,85 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
# verify-skill-removed.sh — 刪除技能後,實地檢查各 CLI 的磁碟上有沒有殘留。
|
||||||
|
#
|
||||||
|
# 用法: verify-skill-removed.sh <domain> <skill-name>
|
||||||
|
#
|
||||||
|
# 行為: 先用 jsc-cli/tools/detect-clis.sh 找出已安裝的 CLI,再逐一 grep 該 CLI 的技能快取
|
||||||
|
# 與 hook 設定,找技能名稱字面與指令形式 /jsc-{domain}:{name}。
|
||||||
|
# 未安裝的 CLI 不檢查;設定位置不存在就跳過(安靜降級,不算殘留)。
|
||||||
|
#
|
||||||
|
# 檢查位置(每個 CLI 的技能快取與 hook 設定):
|
||||||
|
# claude — ~/.claude/plugins/、~/.claude/settings.json、~/.claude/settings.local.json
|
||||||
|
# codex — ${CODEX_HOME:-~/.codex}/(config.toml 的 notify、AGENTS.md、plugins/)
|
||||||
|
# copilot — ~/.config/copilot/
|
||||||
|
# antigravity — ~/.antigravity/、~/.config/antigravity/
|
||||||
|
# kiro — ~/.kiro/、工作目錄的 .kiro/hooks/
|
||||||
|
#
|
||||||
|
# 根目錄: 交給 tools/plugins-root.sh 推導(JSC_PLUGINS_ROOT -> 從 $PWD 往上找 ->
|
||||||
|
# 腳本位置上兩層 -> $HOME/plugins)。以 plugin 形式安裝時,「腳本位置上兩層」會落在
|
||||||
|
# plugin 快取目錄,單靠它一定推錯,所以推導規則抽成共用腳本。
|
||||||
|
#
|
||||||
|
# 輸出: 檢查過的位置一行一個(stderr),殘留一行一個 {file}:{line}:{內容}(stdout)。
|
||||||
|
# 沒有殘留會印「無殘留」到 stderr,區別於「什麼都沒檢查」。
|
||||||
|
# 結束碼: 0=沒有殘留 1=有殘留 2=用法錯誤
|
||||||
|
# 3=推導不出根目錄、找不到 detect-clis.sh、沒偵測到任何 CLI,
|
||||||
|
# 或找不到可檢查的位置(**不等於乾淨**)
|
||||||
|
# 環境變數: JSC_PLUGINS_ROOT(根目錄,見 plugins-root.sh)
|
||||||
|
set -u
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo 'usage: verify-skill-removed.sh <domain> <skill-name>' >&2
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
|
||||||
|
[ "$#" -eq 2 ] || usage
|
||||||
|
DOMAIN=$1
|
||||||
|
SKILL=$2
|
||||||
|
[ -n "$DOMAIN" ] && [ -n "$SKILL" ] || usage
|
||||||
|
|
||||||
|
HERE=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
||||||
|
. "$HERE/plugins-root.sh"
|
||||||
|
ROOT=$(jsc_plugins_root) || exit 3
|
||||||
|
|
||||||
|
DETECT=""
|
||||||
|
for d in "$ROOT/cli/tools/detect-clis.sh" "$ROOT/jsc-cli/tools/detect-clis.sh"; do
|
||||||
|
[ -f "$d" ] && { DETECT="$d"; break; }
|
||||||
|
done
|
||||||
|
[ -n "$DETECT" ] || { echo "找不到 detect-clis.sh:請先取得 jsc-cli 存取庫" >&2; exit 3; }
|
||||||
|
|
||||||
|
CLIS=$(sh "$DETECT" 2>/dev/null | cut -f1)
|
||||||
|
[ -n "$CLIS" ] || { echo "沒偵測到任何已安裝的 CLI,無處可查" >&2; exit 3; }
|
||||||
|
|
||||||
|
cli_paths() { # $1=CLI 代號;印出該 CLI 的技能快取與 hook 設定位置
|
||||||
|
case "$1" in
|
||||||
|
claude)
|
||||||
|
printf '%s\n' "$HOME/.claude/plugins" "$HOME/.claude/settings.json" \
|
||||||
|
"$HOME/.claude/settings.local.json" ;;
|
||||||
|
codex)
|
||||||
|
printf '%s\n' "${CODEX_HOME:-$HOME/.codex}" ;;
|
||||||
|
copilot)
|
||||||
|
printf '%s\n' "$HOME/.config/copilot" ;;
|
||||||
|
antigravity)
|
||||||
|
printf '%s\n' "$HOME/.antigravity" "$HOME/.config/antigravity" ;;
|
||||||
|
kiro)
|
||||||
|
printf '%s\n' "$HOME/.kiro" "./.kiro" ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
checked=0
|
||||||
|
hit=0
|
||||||
|
for cli in $CLIS; do
|
||||||
|
for p in $(cli_paths "$cli"); do
|
||||||
|
[ -e "$p" ] || continue
|
||||||
|
checked=$((checked + 1))
|
||||||
|
echo "檢查 $cli:$p" >&2
|
||||||
|
out=$(grep -rnI --exclude-dir=.git -e "$SKILL" -e "/jsc-${DOMAIN}:${SKILL}" "$p" 2>/dev/null)
|
||||||
|
if [ -n "$out" ]; then
|
||||||
|
printf '%s\n' "$out"
|
||||||
|
hit=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
[ "$checked" -gt 0 ] || { echo "偵測到 CLI,但沒有任何設定位置存在,無處可查" >&2; exit 3; }
|
||||||
|
[ "$hit" -eq 0 ] && echo "無殘留:已檢查 $checked 個位置" >&2
|
||||||
|
exit $hit
|
||||||
Reference in New Issue
Block a user