From ff61aced5d3c322ff05cf6cfef8c9cb1a07d1fc6 Mon Sep 17 00:00:00 2001 From: Jeffery Date: Mon, 17 Aug 2026 14:55:02 +0800 Subject: [PATCH] =?UTF-8?q?feat(spec-version-guard):=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=AA=A2=E6=9F=A5=20hook=20=E4=B8=A6?= =?UTF-8?q?=E5=9C=A8=2013=20=E5=80=8B=20skill=20=E6=AA=94=E9=A0=AD?= =?UTF-8?q?=E5=BC=95=E7=94=A8=E8=A6=8F=E7=AF=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 既有 PreToolUse 陣列(guard.mjs 人格隔離)之外新增第二個條目,沿用跨 plugin 腳本定位手法呼叫 shared 的 version-guard.mjs;13 個 persona-* skill 檔頭補上 spec-version-guard(persona-create 原分析誤判為清單空白,實際是項目符號格式, 已在既有清單最前補一行,不變動格式)。 Co-Authored-By: Claude Sonnet 5 --- hooks/hooks.json | 11 +++++++++++ skills/persona-anime/SKILL.md | 2 +- skills/persona-chat/SKILL.md | 2 +- skills/persona-create/SKILL.md | 1 + skills/persona-icon/SKILL.md | 2 +- skills/persona-invite/SKILL.md | 2 +- skills/persona-memory/SKILL.md | 2 +- skills/persona-relation/SKILL.md | 2 +- skills/persona-sleep/SKILL.md | 2 +- skills/persona-status/SKILL.md | 2 +- skills/persona-story/SKILL.md | 2 +- skills/persona-sync/SKILL.md | 2 +- skills/persona-therapist/SKILL.md | 2 +- skills/persona-transfer/SKILL.md | 2 +- 14 files changed, 24 insertions(+), 12 deletions(-) diff --git a/hooks/hooks.json b/hooks/hooks.json index 34d35b2..732b9f0 100644 --- a/hooks/hooks.json +++ b/hooks/hooks.json @@ -35,6 +35,17 @@ "statusMessage": "檢查人格隔離…" } ] + }, + { + "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-persona 版本…" + } + ] } ], "Stop": [ diff --git a/skills/persona-anime/SKILL.md b/skills/persona-anime/SKILL.md index ef2899d..0336196 100644 --- a/skills/persona-anime/SKILL.md +++ b/skills/persona-anime/SKILL.md @@ -15,7 +15,7 @@ description: 用「動漫作品名稱 + 角色名稱」快速建立人格:先 先載入 `/jsc-shared:spec-preflight` 並依其流程處理;載入不到即代表 shared plugin 未安裝, 依該 spec 詢問使用者是否安裝 `https://gitea.jsc.idv.tw/plugins/shared.git`,不安裝則中斷本 skill。 -本 skill 需要的規範:spec-output、spec-execution、spec-time-log、spec-script-path +本 skill 需要的規範:spec-version-guard、spec-output、spec-execution、spec-time-log、spec-script-path --- diff --git a/skills/persona-chat/SKILL.md b/skills/persona-chat/SKILL.md index bf89f83..a2f2f94 100644 --- a/skills/persona-chat/SKILL.md +++ b/skills/persona-chat/SKILL.md @@ -17,7 +17,7 @@ description: 載入一個人格並以人格化方式對話:取得該人格的 先載入 `/jsc-shared:spec-preflight` 並依其流程處理;載入不到即代表 shared plugin 未安裝, 依該 spec 詢問使用者是否安裝 `https://gitea.jsc.idv.tw/plugins/shared.git`,不安裝則中斷本 skill。 -本 skill 需要的規範:spec-output、spec-execution、spec-time-log、spec-script-path +本 skill 需要的規範:spec-version-guard、spec-output、spec-execution、spec-time-log、spec-script-path --- diff --git a/skills/persona-create/SKILL.md b/skills/persona-create/SKILL.md index cdf214c..dddeb22 100644 --- a/skills/persona-create/SKILL.md +++ b/skills/persona-create/SKILL.md @@ -16,6 +16,7 @@ description: 建立一個新的 AI 人格(persona),並以「與 OpenClaw 先載入 `/jsc-shared:spec-preflight` 並依其流程處理;載入不到即代表 shared plugin 未安裝, 依該 spec 詢問使用者是否安裝 `https://gitea.jsc.idv.tw/plugins/shared.git`,不安裝則中斷本 skill。 本 skill 需要的規範: +- spec-version-guard - spec-output - spec-execution - spec-time-log diff --git a/skills/persona-icon/SKILL.md b/skills/persona-icon/SKILL.md index 510b790..06e006e 100644 --- a/skills/persona-icon/SKILL.md +++ b/skills/persona-icon/SKILL.md @@ -13,7 +13,7 @@ description: 產生或更新人格的形象圖(icon.svg + icon.png):先找 先載入 `/jsc-shared:spec-preflight` 並依其流程處理;載入不到即代表 shared plugin 未安裝, 依該 spec 詢問使用者是否安裝 `https://gitea.jsc.idv.tw/plugins/shared.git`,不安裝則中斷本 skill。 -本 skill 需要的規範:spec-output、spec-execution、spec-time-log、spec-script-path +本 skill 需要的規範:spec-version-guard、spec-output、spec-execution、spec-time-log、spec-script-path **流程**:找高解析度官方圖 → 量測 → **去背** → 裁頭肩 → 合成 → 更新頭像與 Wiki。 diff --git a/skills/persona-invite/SKILL.md b/skills/persona-invite/SKILL.md index e8d3e1c..30ff87d 100644 --- a/skills/persona-invite/SKILL.md +++ b/skills/persona-invite/SKILL.md @@ -16,7 +16,7 @@ description: 邀請另一個人格透過 sub agent 加入當前對話,形成 先載入 `/jsc-shared:spec-preflight` 並依其流程處理;載入不到即代表 shared plugin 未安裝, 依該 spec 詢問使用者是否安裝 `https://gitea.jsc.idv.tw/plugins/shared.git`,不安裝則中斷本 skill。 -本 skill 需要的規範:`spec-output`、`spec-execution`、`spec-time-log`、`spec-script-path`、`spec-subagent` +本 skill 需要的規範:`spec-version-guard`、`spec-output`、`spec-execution`、`spec-time-log`、`spec-script-path`、`spec-subagent` --- diff --git a/skills/persona-memory/SKILL.md b/skills/persona-memory/SKILL.md index 86ba026..973cef3 100644 --- a/skills/persona-memory/SKILL.md +++ b/skills/persona-memory/SKILL.md @@ -15,7 +15,7 @@ description: 整理人格的記憶系統:把短期記憶固化為長期記憶 先載入 `/jsc-shared:spec-preflight` 並依其流程處理;載入不到即代表 shared plugin 未安裝, 依該 spec 詢問使用者是否安裝 `https://gitea.jsc.idv.tw/plugins/shared.git`,不安裝則中斷本 skill。 -本 skill 需要的規範:spec-output、spec-execution、spec-time-log、spec-script-path +本 skill 需要的規範:spec-version-guard、spec-output、spec-execution、spec-time-log、spec-script-path --- diff --git a/skills/persona-relation/SKILL.md b/skills/persona-relation/SKILL.md index 8e916cf..593862c 100644 --- a/skills/persona-relation/SKILL.md +++ b/skills/persona-relation/SKILL.md @@ -15,7 +15,7 @@ description: 維護人格的人際關係圖:新增或更新人物/人格/群 先載入 `/jsc-shared:spec-preflight` 並依其流程處理;載入不到即代表 shared plugin 未安裝, 依該 spec 詢問使用者是否安裝 `https://gitea.jsc.idv.tw/plugins/shared.git`,不安裝則中斷本 skill。 -本 skill 需要的規範:spec-output、spec-execution、spec-time-log、spec-script-path +本 skill 需要的規範:spec-version-guard、spec-output、spec-execution、spec-time-log、spec-script-path --- diff --git a/skills/persona-sleep/SKILL.md b/skills/persona-sleep/SKILL.md index b1ebc7a..05e62b4 100644 --- a/skills/persona-sleep/SKILL.md +++ b/skills/persona-sleep/SKILL.md @@ -13,7 +13,7 @@ description: 讓人格睡覺:把一天的活狀態收成能留下來的形狀 先載入 `/jsc-shared:spec-preflight` 並依其流程處理;載入不到即代表 shared plugin 未安裝, 依該 spec 詢問使用者是否安裝 `https://gitea.jsc.idv.tw/plugins/shared.git`,不安裝則中斷本 skill。 -本 skill 需要的規範:spec-output、spec-execution、spec-time-log、spec-script-path、spec-subagent、spec-gitea、spec-git-safety +本 skill 需要的規範:spec-version-guard、spec-output、spec-execution、spec-time-log、spec-script-path、spec-subagent、spec-gitea、spec-git-safety --- diff --git a/skills/persona-status/SKILL.md b/skills/persona-status/SKILL.md index 2cc5894..f14ce87 100644 --- a/skills/persona-status/SKILL.md +++ b/skills/persona-status/SKILL.md @@ -13,7 +13,7 @@ description: 查看與管理人格的載入狀態:列出所有人格、誰被 先載入 `/jsc-shared:spec-preflight` 並依其流程處理;載入不到即代表 shared plugin 未安裝, 依該 spec 詢問使用者是否安裝 `https://gitea.jsc.idv.tw/plugins/shared.git`,不安裝則中斷本 skill。 -本 skill 需要的規範:spec-output、spec-execution、spec-time-log、spec-script-path +本 skill 需要的規範:spec-version-guard、spec-output、spec-execution、spec-time-log、spec-script-path ## 鎖的規則(設計上的硬約束) diff --git a/skills/persona-story/SKILL.md b/skills/persona-story/SKILL.md index 974ee00..b44603b 100644 --- a/skills/persona-story/SKILL.md +++ b/skills/persona-story/SKILL.md @@ -17,7 +17,7 @@ description: 把小說(或漫畫、劇本、遊戲文本)匯入成一個既 先載入 `/jsc-shared:spec-preflight` 並依其流程處理;載入不到即代表 shared plugin 未安裝, 依該 spec 詢問使用者是否安裝 `https://gitea.jsc.idv.tw/plugins/shared.git`,不安裝則中斷本 skill。 -本 skill 需要的規範:spec-output、spec-execution、spec-time-log、spec-script-path +本 skill 需要的規範:spec-version-guard、spec-output、spec-execution、spec-time-log、spec-script-path --- diff --git a/skills/persona-sync/SKILL.md b/skills/persona-sync/SKILL.md index 5b6403c..aa0a37a 100644 --- a/skills/persona-sync/SKILL.md +++ b/skills/persona-sync/SKILL.md @@ -13,7 +13,7 @@ description: 人格編號與 Gitea 儲存:指派人格編號(英文名全大 先載入 `/jsc-shared:spec-preflight` 並依其流程處理;載入不到即代表 shared plugin 未安裝, 依該 spec 詢問使用者是否安裝 `https://gitea.jsc.idv.tw/plugins/shared.git`,不安裝則中斷本 skill。 -本 skill 需要的規範:spec-output、spec-execution、spec-time-log、spec-script-path、spec-gitea、spec-git-safety +本 skill 需要的規範:spec-version-guard、spec-output、spec-execution、spec-time-log、spec-script-path、spec-gitea、spec-git-safety --- diff --git a/skills/persona-therapist/SKILL.md b/skills/persona-therapist/SKILL.md index e863117..0c87e7b 100644 --- a/skills/persona-therapist/SKILL.md +++ b/skills/persona-therapist/SKILL.md @@ -18,7 +18,7 @@ description: 以專業心理醫生(溝通諮商)的第三方身分診斷一 先載入 `/jsc-shared:spec-preflight` 並依其流程處理;載入不到即代表 shared plugin 未安裝, 依該 spec 詢問使用者是否安裝 `https://gitea.jsc.idv.tw/plugins/shared.git`,不安裝則中斷本 skill。 -本 skill 需要的規範:spec-output、spec-execution、spec-time-log +本 skill 需要的規範:spec-version-guard、spec-output、spec-execution、spec-time-log --- diff --git a/skills/persona-transfer/SKILL.md b/skills/persona-transfer/SKILL.md index 07b497f..7e32294 100644 --- a/skills/persona-transfer/SKILL.md +++ b/skills/persona-transfer/SKILL.md @@ -20,7 +20,7 @@ bundle 是**單一 JSON 檔**(可 gzip),不依賴任何外部工具,複 先載入 `/jsc-shared:spec-preflight` 並依其流程處理;載入不到即代表 shared plugin 未安裝, 依該 spec 詢問使用者是否安裝 `https://gitea.jsc.idv.tw/plugins/shared.git`,不安裝則中斷本 skill。 -本 skill 需要的規範:`spec-output`、`spec-execution`、`spec-time-log`、`spec-script-path` +本 skill 需要的規範:`spec-version-guard`、`spec-output`、`spec-execution`、`spec-time-log`、`spec-script-path` ---