Files
hooks/skills/hooks-install/SKILL.md
T
2026-08-21 13:08:43 +08:00

31 lines
1.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
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.
---
# hooks-install — 將 jsc hooks 接線到所有已安裝的 CLI
目標:讓三支 hook(`ste100-guard.sh`、`session-timer.sh`、`skill-usage.sh`)在每個 CLI 生效。
細節流程**必須以 sub agent 執行**,主 agent 只回報結果摘要。
## 步驟
1. 執行 `jsc-cli/tools/detect-clis.sh` 取得已安裝的 CLI 與路徑。
2. 對每個 CLI 依下表接線(hook 優先,無 hook 系統就降級為規則檔):
| CLI | 接線方式 |
| --- | --- |
| claude | plugin 安裝時自動載入 `jsc-hooks/hooks/hooks.json`,只需驗證:`claude plugin list` 有 `jsc-hooks` 且 `/hooks` 顯示已註冊 |
| codex | `~/.codex/config.toml` 設定 `notify` 指向 `session-timer.sh mark`(帶 `JSC_CLI=codex`);STE100 規則追加到 `~/.codex/AGENTS.md`(prompt 降級) |
| copilot | 無 hook 系統:STE100 規則追加到 `~/.config/copilot/copilot-instructions.md`(prompt 降級) |
| antigravity | 無公開 hook 系統:STE100 規則追加到全域 rules 檔(prompt 降級) |
| kiro | 於工作區 `.kiro/hooks/` 建立 agent hook,觸發時執行對應腳本(帶 `JSC_CLI=kiro`) |
3. 規則檔追加內容一律使用 `ste100-guard.sh` 的輸出文字,且以 `<!-- jsc-hooks -->` 標記包住,重複執行時整段取代不重複追加。
4. 回報每個 CLI 的接線結果(成功 / 降級為 prompt / 跳過原因)。
## 注意
- Hook 腳本同時接受 stdin JSON 與環境變數(`JSC_CLI`、`JSC_SESSION_ID`、`JSC_SKILL`),wrapper 只需設環境變數。
- 資料落在 `$JSC_HOME`(預設 `~/.jsc`),供 `jsc-log:worklog` 與 `jsc-log:stats` 取用。