docs(hooks-install): 更新四支 hook 的接線說明與文件

What:hooks-install SKILL.md 改寫接線表並加上逐 CLI 驗證欄;README 補上 sdlc-gate、tools 兩支腳本與 JSC_MODEL 變數說明;AGENTS.md 同步 domain 描述。
Why:新增 SDLC 模型鎖與 wrapper 方案後,安裝流程與環境變數契約已改變,文件必須與實作一致,否則接線技能會漏裝。
How:接線表改為三欄(CLI、接線、驗證),copilot 與 antigravity 改兩段式(jsc-wrap.sh 包裝+規則檔追加),codex 與 kiro 註明模型鎖降級為技能步驟檢查;每步補上完成判準。
Who:執行 hooks-install 技能的 AI 助理與維護 jsc-hooks domain 的開發者。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-24 11:36:54 +08:00
co-authored by Claude Fable 5
parent 8a95bd2b47
commit bdfb4619af
3 changed files with 28 additions and 18 deletions
+15 -14
View File
@@ -1,30 +1,31 @@
---
name: hooks-install
description: Wire jsc hooks (STE100 guard, session timer, skill usage logger) into every installed AI CLI. Detect CLIs via jsc-cli detect-clis.sh, then apply native hook config per CLI or fall back to instruction files. Use after installing or updating the jsc plugin set; not for writing new hooks.
description: 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 three hooks (`ste100-guard.sh`, `session-timer.sh`, `skill-usage.sh`) effective in every 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
1. Run `jsc-cli/tools/detect-clis.sh` to get the installed CLIs and their paths.
2. Wire each CLI per the table below (hooks first; degrade to an instruction file when the CLI has no hook system):
1. 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.
2. Wire each CLI per the table below. A row counts as done only when its verify check passes:
| CLI | Wiring |
| --- | --- |
| claude | the plugin loads `jsc-hooks/hooks/hooks.json` automatically on install; verify only: `claude plugin list` shows `jsc-hooks` and `/hooks` shows the registrations |
| codex | set `notify` in `~/.codex/config.toml` to `session-timer.sh mark` (with `JSC_CLI=codex`); append the STE100 rule to `~/.codex/AGENTS.md` (prompt fallback) |
| copilot | no hook system: append the STE100 rule to `~/.config/copilot/copilot-instructions.md` (prompt fallback) |
| antigravity | no public hook system: append the STE100 rule to the global rules file (prompt fallback) |
| kiro | create an agent hook under the workspace `.kiro/hooks/` that runs the matching script (with `JSC_CLI=kiro`) |
| CLI | Wiring | Verify |
| --- | --- | --- |
| claude | the plugin loads `jsc-hooks/hooks/hooks.json` automatically on install (all four hooks, `sdlc-gate.sh check` included); nothing to write | `claude plugin list` shows `jsc-hooks` and `/hooks` shows the registrations |
| codex | set `notify` in `~/.codex/config.toml` to `session-timer.sh mark` (with `JSC_CLI=codex`); append the STE100 rule block to `~/.codex/AGENTS.md` (prompt fallback) | `config.toml` contains the `notify` entry and `AGENTS.md` contains the block |
| copilot | (a) install the wrapper: add a shell alias or launcher that starts the CLI via `jsc-hooks/tools/jsc-wrap.sh copilot`, so session timing and usage backfill work — `tools/scan-logs.sh` runs automatically at wrapper exit; (b) keep appending the STE100 rule block to `~/.config/copilot/copilot-instructions.md` (prompt fallback for the language rules) | the alias resolves to `jsc-wrap.sh copilot` and the instruction file contains the block |
| antigravity | (a) install the wrapper: add a shell alias or launcher that starts the CLI via `jsc-hooks/tools/jsc-wrap.sh antigravity` — `tools/scan-logs.sh` runs automatically at wrapper exit; (b) keep appending the STE100 rule block to the global rules file (prompt fallback for the language rules) | the alias resolves to `jsc-wrap.sh antigravity` and the rules file contains the block |
| kiro | create an agent hook under the workspace `.kiro/hooks/` that runs the matching script (with `JSC_CLI=kiro`) | the hook file exists under `.kiro/hooks/` and names the script |
3. The appended rule text is always the exact output of `ste100-guard.sh` (a Traditional Chinese literal). Wrap it in `<!-- jsc-hooks -->` markers; on re-run, replace the whole block instead of appending again.
4. Report the wiring result for every CLI: succeeded, degraded to prompt, or the skip reason.
3. The appended rule text is always the exact output of `ste100-guard.sh` (a Traditional Chinese literal). Wrap it in `<!-- jsc-hooks -->` markers; on re-run, replace the whole block instead of appending again. Done when each touched instruction file contains exactly one `<!-- jsc-hooks -->` block.
4. Report the wiring result for every CLI. Done when every detected CLI has exactly one status: succeeded, degraded to prompt, or skipped with a reason.
## Notes
- The hook scripts accept both stdin JSON and environment variables (`JSC_CLI`, `JSC_SESSION_ID`, `JSC_SKILL`); a wrapper only needs to set the variables.
- The hook scripts accept both stdin JSON and environment variables (`JSC_CLI`, `JSC_SESSION_ID`, `JSC_SKILL`, `JSC_MODEL`); `jsc-wrap.sh` sets the first two itself.
- Data lands in `$JSC_HOME` (default `~/.jsc`), consumed by `jsc-log:worklog` and `jsc-log:stats`.