feat(spec-version-guard): 新增版本檢查 hook 並在 9 個 skill 檔頭引用規範

新建 hooks/hooks.json,PreToolUse 沿用跨 plugin 腳本定位手法呼叫 shared 的
version-guard.mjs(判定仍固定讀自己的 plugin.json,只是腳本檔借用 shared 的);
action-composite/action-docker/action-node/image/issues/nuget/review-resolve/
sync/target 九個 skill 檔頭補上 spec-version-guard。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-17 14:54:07 +08:00
co-authored by Claude Sonnet 5
parent 85a4128f5e
commit 766142c3ba
10 changed files with 26 additions and 9 deletions
+17
View File
@@ -0,0 +1,17 @@
{
"hooks": {
"PreToolUse": [
{
"matcher": "Read|Write|Edit|MultiEdit|NotebookEdit|Glob|Grep|LS|Bash",
"hooks": [
{
"type": "command",
"command": "own='shared'; plug='jsc-shared'; rel='scripts/version-guard.mjs'; for base in \"$HOME/.claude/plugins/cache\" \"$HOME/.codex/plugins/cache\" \"$HOME/.copilot/installed-plugins\"; do for dir in \"$base/$own/$plug\" \"$base\"; do s=$(find \"$dir\" -path \"*/$plug/*/$rel\" -type f 2>/dev/null | sort -V | tail -n 1); if [ -n \"$s\" ]; then exec node --use-system-ca \"$s\"; fi; done; done; ts=$(TZ='Asia/Taipei' date +'%Y/%m/%d %H:%M:%S'); echo \"[$ts][版本檢查][ERR]: 找不到 jsc-shared 的 version-guard.mjs,fail-closed 阻擋。\" >&2; printf '{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"deny\",\"permissionDecisionReason\":\"找不到 jsc-shared 的 version-guard.mjs,fail-closed 阻擋\"}}\\n'; exit 0",
"timeout": 15,
"statusMessage": "檢查 jsc-code 版本…"
}
]
}
]
}
}