為什麼:
`skills/hooks-install/SKILL.md` 原本直接內嵌各 CLI(codex/copilot/antigravity/kiro)的詳細佈線步驟,包含逐步設定檔修改、wrapper alias 安裝、以及 `<!-- jsc-hooks -->` 標記區塊的冪等替換邏輯,違反 jsc-meta:skill-check 稽核準則中「確定性程序邏輯應由腳本執行,不應留給子代理每次自行解讀 prose」的要求。
做了什麼:
新增腳本 `tools/wire-cli.sh {cli}`,將原本內嵌於 SKILL.md 的佈線邏輯全數抽出,並支援冪等執行(標記區塊替換、可安全重跑),輸出機器可讀的 `status=wired|degraded|skipped reason=...` 首行訊息與對應結束碼(0=wired、1=degraded、2=bad usage、3=skipped)。改寫 `skills/hooks-install/SKILL.md`,改為依偵測到的 CLI 呼叫此腳本,並讀取其 status/結束碼判斷結果,不再自行內含佈線步驟。同步更新 `README.md`:在工具表新增 `tools/wire-cli.sh` 說明列,並改寫 hooks-install skill 的描述段落,反映新的腳本驅動流程與 `status=` 回報慣例。三份外掛清單 `plugin.json`、`.claude-plugin/plugin.json`、`.codex-plugin/plugin.json` 版本號自 0.0.3 升級為 0.0.4,對應此行為變更。
怎麼做:
建立獨立腳本承載原本的 CLI 佈線程序邏輯,改造 SKILL.md 為呼叫腳本並解讀其標準化輸出,同步更新文件與版本號。
影響範圍:
`skills/hooks-install/SKILL.md`、`README.md`、`plugin.json`、`.claude-plugin/plugin.json`、`.codex-plugin/plugin.json`、新增檔案 `tools/wire-cli.sh`;影響 hooks-install skill 的執行流程與所有安裝 jsc-hooks 外掛的 CLI 佈線行為。
2.8 KiB
2.8 KiB
name, description
| name | description |
|---|---|
| hooks-install | Wire jsc hooks (STE100 guard, session timer, skill usage logger, SDLC model gate) into every installed AI CLI. Detect CLIs via jsc-cli detect-clis.sh, then apply native hook config, the jsc-wrap.sh launcher, or an instruction-file fallback per CLI. Use after installing or updating the jsc plugin set; not for writing new hooks. |
hooks-install — wire jsc hooks into every installed CLI
Goal: make the four hooks (ste100-guard.sh, session-timer.sh, skill-usage.sh, sdlc-gate.sh) effective in every CLI.
Claude wiring is automatic via hooks.json. On codex and kiro the SDLC gate degrades to the skill-step check only; the lock file still works because the SDLC skills call sdlc-gate.sh lock directly.
The detailed flow MUST run as a sub agent; the main agent only reports the summary.
Steps
- Run
jsc-cli/tools/detect-clis.sh. Done when you hold the list of installed CLIs; when the list is empty, report that and stop. - For each installed CLI, run
tools/wire-cli.sh {cli}. The script performs the config edit, wrapper alias install, or hook file creation for that CLI, and replaces its<!-- jsc-hooks -->(or# jsc-hooks) marker block idempotently — reruns never duplicate content. Read its exit code and first output line (status=wired|degraded|skipped reason=...), then confirm against the table below:
| CLI | Exit / status | Verify |
|---|---|---|
| claude | status=wired (exit 0) — hooks.json auto-wires everything, nothing to write |
claude plugin list shows jsc-hooks and /hooks shows the registrations |
| codex | status=degraded (exit 1) — notify + AGENTS.md prompt fallback |
~/.codex/config.toml contains the notify entry and AGENTS.md contains the block |
| copilot | status=wired (exit 0) when the CLI is detected, status=skipped (exit 3) otherwise |
the alias resolves to jsc-wrap.sh copilot and copilot-instructions.md contains the block |
| antigravity | status=wired (exit 0) when the CLI is detected, status=skipped (exit 3) otherwise |
the alias resolves to jsc-wrap.sh antigravity and the rules file contains the block |
| kiro | status=degraded (exit 1) |
the hook file exists under .kiro/hooks/ and names the script |
A row counts as done only when its verify check passes. Exit 2 means bad usage (wrong CLI name), not a wiring outcome.
3. Report the exact status= line tools/wire-cli.sh printed for each CLI; do not reinterpret or recompute the outcome by hand. Done when every detected CLI has exactly one reported status: wired, degraded, or skipped with a reason.
Notes
- The hook scripts accept both stdin JSON and environment variables (
JSC_CLI,JSC_SESSION_ID,JSC_SKILL,JSC_MODEL);jsc-wrap.shsets the first two itself. - Data lands in
$JSC_HOME(default~/.jsc), consumed byjsc-log:worklogandjsc-log:stats.