feat/lang-guard-traditional-chinese-encoding #28
@@ -28,6 +28,10 @@
|
|||||||
{
|
{
|
||||||
"type": "command",
|
"type": "command",
|
||||||
"command": "sh \"${CLAUDE_PLUGIN_ROOT}/hooks/comment-scope.sh\" prompt"
|
"command": "sh \"${CLAUDE_PLUGIN_ROOT}/hooks/comment-scope.sh\" prompt"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "command",
|
||||||
|
"command": "sh \"${CLAUDE_PLUGIN_ROOT}/hooks/lang-guard.sh\" prompt"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -83,6 +87,10 @@
|
|||||||
{
|
{
|
||||||
"type": "command",
|
"type": "command",
|
||||||
"command": "sh \"${CLAUDE_PLUGIN_ROOT}/hooks/comment-scope.sh\""
|
"command": "sh \"${CLAUDE_PLUGIN_ROOT}/hooks/comment-scope.sh\""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "command",
|
||||||
|
"command": "sh \"${CLAUDE_PLUGIN_ROOT}/hooks/lang-guard.sh\""
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
# Claude: UserPromptSubmit 的 stdout 會成為額外 context。
|
# Claude: UserPromptSubmit 的 stdout 會成為額外 context。
|
||||||
# 其他 CLI: 由 hooks-install 以各自的規則檔(AGENTS.md 等)落地,本腳本仍可被 wrapper 呼叫。
|
# 其他 CLI: 由 hooks-install 以各自的規則檔(AGENTS.md 等)落地,本腳本仍可被 wrapper 呼叫。
|
||||||
# 完整規則的唯一來源:jsc-meta 的 references/ste100.md。
|
# 完整規則的唯一來源:jsc-meta 的 references/ste100.md。
|
||||||
echo "[jsc] 輸出規則:STE100 繁體中文,擬人台灣感。短句、一句一指令、主動語態、術語一致;台灣用語(預設、支援、相容、資訊);全形標點;去 AI 味(不用「總的來說」「首先/其次/最後」開場收尾套路、不諂媚);直接講重點,UTF-8 無亂碼。完整規則見 jsc-meta 的 references/ste100.md。"
|
echo "[jsc] 輸出規則:STE100 繁體中文,擬人台灣感。適用範圍是所有非程式碼輸出——程式碼註解、commit 訊息、PR 描述、wiki 頁、對使用者的回報、README 與各種文件都算。短句、一句一指令、主動語態、術語一致;台灣用語(預設、支援、相容、資訊);全形標點;去 AI 味(不用「總的來說」「首先/其次/最後」開場收尾套路、不諂媚);直接講重點。一律 UTF-8 無亂碼、無簡體字,檔案不加 BOM。完整規則見 jsc-meta 的 references/ste100.md。"
|
||||||
echo "[jsc] 送出前自我檢查,命中任一項就先改再送出:1)簡體字(例:应、为、这、说、后、发);2)句尾用半形標點(. , ! ?),應為全形(。,!?);3)套路句(「總的來說」「綜上所述」「首先…其次…最後」);4)中文並列用半形「/」,應改頓號「、」;5)諂媚開場(「好問題」「當然可以」)。"
|
echo "[jsc] 送出前自我檢查,命中任一項就先改再送出:1)簡體字(例:应、为、这、说、后、发);2)句尾用半形標點(. , ! ?),應為全形(。,!?);3)套路句(「總的來說」「綜上所述」「首先…其次…最後」);4)中文並列用半形「/」,應改頓號「、」;5)諂媚開場(「好問題」「當然可以」)。"
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
+5
-1
@@ -3,7 +3,8 @@
|
|||||||
# 用法: jsc-wrap.sh {cli} [args...]
|
# 用法: jsc-wrap.sh {cli} [args...]
|
||||||
# 行為: 匯出 JSC_CLI 與 JSC_SESSION_ID → session-timer start → 執行 CLI →
|
# 行為: 匯出 JSC_CLI 與 JSC_SESSION_ID → session-timer start → 執行 CLI →
|
||||||
# 結束後 session-timer mark、以 scan-logs.sh 回填用量、以 comment-scope.sh sweep
|
# 結束後 session-timer mark、以 scan-logs.sh 回填用量、以 comment-scope.sh sweep
|
||||||
# 掃一次整個工作區的註解範圍,最後回傳 CLI 的結束碼。
|
# 掃一次整個工作區的註解範圍,再以 lang-guard.sh sweep 掃一次繁中與編碼,
|
||||||
|
# 最後回傳 CLI 的結束碼。
|
||||||
# 注意: JSC_CLI 存的是 CLI 代號(antigravity、kiro),實際執行的是 cli_bin 對應的
|
# 注意: JSC_CLI 存的是 CLI 代號(antigravity、kiro),實際執行的是 cli_bin 對應的
|
||||||
# 執行檔(agy、kiro-cli)。直接拿代號當指令跑會 127,因為沒有這兩個執行檔。
|
# 執行檔(agy、kiro-cli)。直接拿代號當指令跑會 127,因為沒有這兩個執行檔。
|
||||||
HERE=$(cd "$(dirname "$0")" && pwd)
|
HERE=$(cd "$(dirname "$0")" && pwd)
|
||||||
@@ -32,4 +33,7 @@ sh "$HERE/scan-logs.sh" --cli "$cli" --session "$JSC_SESSION_ID" </dev/null || t
|
|||||||
# 警告只走 sweep 自己的 stderr,包裝器一律原樣回傳 $rc——包裝器改掉結束碼,呼叫端的
|
# 警告只走 sweep 自己的 stderr,包裝器一律原樣回傳 $rc——包裝器改掉結束碼,呼叫端的
|
||||||
# `cmd && next` 就會誤判,註解檢查不該有這種副作用。
|
# `cmd && next` 就會誤判,註解檢查不該有這種副作用。
|
||||||
sh "$HOOKS/comment-scope.sh" sweep </dev/null || true
|
sh "$HOOKS/comment-scope.sh" sweep </dev/null || true
|
||||||
|
# 繁中與編碼收尾掃描:同一個理由、同一種寫法。`|| true` 一樣不可省,lang-guard.sh 掃到
|
||||||
|
# 簡體字或亂碼也會 exit 2,接住它才不會蓋掉底下要回傳的 CLI 結束碼。
|
||||||
|
sh "$HOOKS/lang-guard.sh" sweep </dev/null || true
|
||||||
exit "$rc"
|
exit "$rc"
|
||||||
|
|||||||
+115
-48
@@ -3,7 +3,7 @@
|
|||||||
# 用法:
|
# 用法:
|
||||||
# wire-cli.sh {claude|codex|copilot|antigravity|kiro} 接線
|
# wire-cli.sh {claude|codex|copilot|antigravity|kiro} 接線
|
||||||
# wire-cli.sh purge {claude|codex|copilot|antigravity|kiro} 備份後移除該 CLI 的所有 hook
|
# wire-cli.sh purge {claude|codex|copilot|antigravity|kiro} 備份後移除該 CLI 的所有 hook
|
||||||
# wire-cli.sh smoke {claude|codex|copilot|antigravity|kiro} 跑一輪六支 hook,驗執行期
|
# wire-cli.sh smoke {claude|codex|copilot|antigravity|kiro} 跑一輪七支 hook,驗執行期
|
||||||
# wire-cli.sh status {claude|codex|copilot|antigravity|kiro} 唯讀盤點接線現況,不寫檔也不執行 hook
|
# wire-cli.sh status {claude|codex|copilot|antigravity|kiro} 唯讀盤點接線現況,不寫檔也不執行 hook
|
||||||
#
|
#
|
||||||
# purge 移除的是「所有 hook」,含非 jsc 的第三方項目。安裝一律先 purge 再接線:混著別人的
|
# purge 移除的是「所有 hook」,含非 jsc 的第三方項目。安裝一律先 purge 再接線:混著別人的
|
||||||
@@ -14,37 +14,42 @@
|
|||||||
# 跑起來不出錯(缺 node、路徑錯、權限不足都只在真的執行時才現形)。
|
# 跑起來不出錯(缺 node、路徑錯、權限不足都只在真的執行時才現形)。
|
||||||
#
|
#
|
||||||
# 接線行為(依 CLI 而定,皆為冪等:重跑只取代既有的 jsc-hooks 標記段落,不會重複疊加):
|
# 接線行為(依 CLI 而定,皆為冪等:重跑只取代既有的 jsc-hooks 標記段落,不會重複疊加):
|
||||||
# claude — 什麼都不用寫,hooks.json 已自動接線六支 hook
|
# claude — 什麼都不用寫,hooks.json 已自動接線七支 hook
|
||||||
# codex — 在 shell rc 檔加上 codex 別名,轉呼叫 tools/jsc-wrap.sh codex(開始計時,
|
# codex — 在 shell rc 檔加上 codex 別名,轉呼叫 tools/jsc-wrap.sh codex(開始計時,
|
||||||
# 結束時收尾掃一次註解範圍);在 config.toml 設 notify(每輪補
|
# 結束時收尾掃一次註解範圍與繁中編碼);在 config.toml 設 notify(每輪補
|
||||||
# session-timer.sh start 再 mark,最後 comment-scope.sh sweep 掃整個工作區,
|
# session-timer.sh start 再 mark,最後 comment-scope.sh sweep 與
|
||||||
# JSC_CLI=codex);在 AGENTS.md 附加 STE100 與註解範圍規則段落(prompt 降級)
|
# lang-guard.sh sweep 掃整個工作區,JSC_CLI=codex);在 AGENTS.md 附加
|
||||||
|
# STE100、註解範圍與繁中編碼規則段落(prompt 降級)
|
||||||
# copilot — 在 shell rc 檔加上 copilot 別名,轉呼叫 tools/jsc-wrap.sh copilot(結束時
|
# copilot — 在 shell rc 檔加上 copilot 別名,轉呼叫 tools/jsc-wrap.sh copilot(結束時
|
||||||
# 收尾掃一次註解範圍);在 copilot-instructions.md 附加 STE100 與註解範圍規則段落
|
# 收尾掃一次註解範圍與繁中編碼);在 copilot-instructions.md 附加 STE100、
|
||||||
|
# 註解範圍與繁中編碼規則段落
|
||||||
# antigravity — 在 shell rc 檔加上 agy 別名,轉呼叫 tools/jsc-wrap.sh antigravity(同樣收尾
|
# antigravity — 在 shell rc 檔加上 agy 別名,轉呼叫 tools/jsc-wrap.sh antigravity(同樣收尾
|
||||||
# 掃一次);在全域規則檔附加 STE100 與註解範圍規則段落
|
# 掃一次);在全域規則檔附加 STE100、註解範圍與繁中編碼規則段落
|
||||||
# kiro — 在工作區 .kiro/hooks/ 下建立 jsc-hooks.json(每輪 mark 加 STE100
|
# kiro — 在工作區 .kiro/hooks/ 下建立 jsc-hooks.json(每輪 mark 加 STE100、
|
||||||
# 與註解範圍規則,再 comment-scope.sh sweep 掃整個工作區)與
|
# 註解範圍與繁中編碼規則,再 comment-scope.sh sweep 與 lang-guard.sh sweep
|
||||||
# jsc-hooks-session-start.json(sessionStart 開始計時),皆帶 JSC_CLI=kiro
|
# 掃整個工作區)與 jsc-hooks-session-start.json(sessionStart 開始計時),
|
||||||
|
# 皆帶 JSC_CLI=kiro
|
||||||
#
|
#
|
||||||
# 覆蓋範圍要據實回報,不得暗示每個 CLI 都有保護:
|
# 覆蓋範圍要據實回報,不得暗示每個 CLI 都有保護:
|
||||||
# claude 六支 hook 全接,回報 wired
|
# claude 七支 hook 全接,回報 wired
|
||||||
# codex、copilot、antigravity、kiro 只有別名、notify 或規則檔,接不上 PreToolUse、PostToolUse
|
# codex、copilot、antigravity、kiro 只有別名、notify 或規則檔,接不上 PreToolUse、PostToolUse
|
||||||
# 與 UserPromptSubmit,版本前置檢查與 SDLC 模型鎖都沒接上,
|
# 與 UserPromptSubmit,版本前置檢查與 SDLC 模型鎖都沒接上,
|
||||||
# 一律回報 degraded 並在 reason 講明
|
# 一律回報 degraded 並在 reason 講明
|
||||||
#
|
#
|
||||||
# 註解範圍掃描每個 CLI 的時機都不同,回報時不得寫成五支一樣:
|
# 註解範圍與繁中編碼掃描每個 CLI 的時機都不同(兩支腳本接在同一批位置),回報時不得寫成五支一樣:
|
||||||
# claude 掛在 PostToolUse,寫完哪個檔就掃哪個,逐檔即時
|
# claude 掛在 PostToolUse,寫完哪個檔就掃哪個,逐檔即時
|
||||||
# codex 掛在每輪結束的 notify,掃整個 git 工作區這輪改過的檔(sweep)
|
# codex 掛在每輪結束的 notify,掃整個 git 工作區這輪改過的檔(sweep)
|
||||||
# kiro 掛在 userPromptSubmit,掃整個 git 工作區,掃到的是上一輪寫的檔
|
# kiro 掛在 userPromptSubmit,掃整個 git 工作區,掃到的是上一輪寫的檔
|
||||||
# copilot、antigravity 沒有任何逐輪事件,只有工作階段結束時由 jsc-wrap.sh 收尾掃一次
|
# copilot、antigravity 沒有任何逐輪事件,只有工作階段結束時由 jsc-wrap.sh 收尾掃一次
|
||||||
# 時機晚一點、涵蓋範圍一樣:sweep 看的是 git diff,那一輪寫過的檔一個都不會漏。真正的差別
|
# 時機晚一點、涵蓋範圍一樣:sweep 看的是 git diff,那一輪寫過的檔一個都不會漏。真正的差別
|
||||||
# 在回饋速度——claude 當下就叫,其他四個要等到該輪或該階段結束。
|
# 在回饋速度——claude 當下就叫,其他四個要等到該輪或該階段結束。lang-guard.sh 的三種模式
|
||||||
|
# 一律跟著 comment-scope.sh 接在同一批位置,兩支的掃描時機表完全一致。
|
||||||
# 所有 jsc 標記段落都採整段重寫,重跑等同先移除舊內容再重裝
|
# 所有 jsc 標記段落都採整段重寫,重跑等同先移除舊內容再重裝
|
||||||
#
|
#
|
||||||
# 寫入後自我驗證,通過才回報成功:每個寫過的檔案重新讀一次,確認標記段落存在且落在
|
# 寫入後自我驗證,通過才回報成功:每個寫過的檔案重新讀一次,確認標記段落存在且落在
|
||||||
# 正確位置(codex 的 notify 必須是根層鍵,不能被歸進前一張表;kiro 的 JSON 必須成對
|
# 正確位置(codex 的 notify 必須是根層鍵,不能被歸進前一張表;kiro 的 JSON 必須成對
|
||||||
# 且 on、run 在最上層),內容也要涵蓋這次該接上的每一支腳本(含 comment-scope.sh sweep)。
|
# 且 on、run 在最上層),內容也要涵蓋這次該接上的每一支腳本(含 comment-scope.sh sweep
|
||||||
|
# 與 lang-guard.sh sweep)。
|
||||||
# 腳本說寫好了卻寫錯位置或少接一支,是最難查的失敗,所以驗證放在腳本裡。
|
# 腳本說寫好了卻寫錯位置或少接一支,是最難查的失敗,所以驗證放在腳本裡。
|
||||||
#
|
#
|
||||||
# 輸出: 第一行固定為 `status=... reason=...`(可供程式判讀),其後為人類可讀的繁中說明。
|
# 輸出: 第一行固定為 `status=... reason=...`(可供程式判讀),其後為人類可讀的繁中說明。
|
||||||
@@ -91,9 +96,12 @@ ste100_text() { sh "$HOOKS/ste100-guard.sh" 2>/dev/null | sed '/^exit /d'; }
|
|||||||
# 規則正文不在這裡抄一份:抄了就會跟腳本各自漂移,兩邊講的規則對不起來。
|
# 規則正文不在這裡抄一份:抄了就會跟腳本各自漂移,兩邊講的規則對不起來。
|
||||||
comment_scope_text() { sh "$HOOKS/comment-scope.sh" prompt 2>/dev/null | sed '/^exit /d'; }
|
comment_scope_text() { sh "$HOOKS/comment-scope.sh" prompt 2>/dev/null | sed '/^exit /d'; }
|
||||||
|
|
||||||
# 寫進規則檔的完整段落:語言規則加註解範圍規則,共用同一組 jsc-hooks 標記。
|
# 繁中與編碼規則段落的唯一來源:lang-guard.sh prompt 的實際輸出。理由同上,不在這裡抄一份。
|
||||||
# 兩段合在一個標記段落裡,purge 與重跑接線都是整段處理,不必各自再記一組標記。
|
lang_guard_text() { sh "$HOOKS/lang-guard.sh" prompt 2>/dev/null | sed '/^exit /d'; }
|
||||||
rules_text() { ste100_text; comment_scope_text; }
|
|
||||||
|
# 寫進規則檔的完整段落:語言規則加註解範圍規則加繁中編碼規則,共用同一組 jsc-hooks 標記。
|
||||||
|
# 三段合在一個標記段落裡,purge 與重跑接線都是整段處理,不必各自再記一組標記。
|
||||||
|
rules_text() { ste100_text; comment_scope_text; lang_guard_text; }
|
||||||
|
|
||||||
# 驗證:規則檔真的收到註解範圍那一段了嗎。比對字串取自腳本的第一行實際輸出,
|
# 驗證:規則檔真的收到註解範圍那一段了嗎。比對字串取自腳本的第一行實際輸出,
|
||||||
# 不是另外抄一句關鍵字——抄的關鍵字改腳本時不會跟著改,驗證就會永遠通過。
|
# 不是另外抄一句關鍵字——抄的關鍵字改腳本時不會跟著改,驗證就會永遠通過。
|
||||||
@@ -104,6 +112,14 @@ has_comment_scope() {
|
|||||||
grep -qF "$_first" "$1" 2>/dev/null
|
grep -qF "$_first" "$1" 2>/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 驗證:規則檔真的收到繁中與編碼那一段了嗎。同樣取腳本的第一行實際輸出來比對,理由同上。
|
||||||
|
# $1=檔案
|
||||||
|
has_lang_guard() {
|
||||||
|
_first=$(lang_guard_text | head -n1)
|
||||||
|
[ -n "$_first" ] || return 1
|
||||||
|
grep -qF "$_first" "$1" 2>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
# 以標記整段取代(冪等);標記不存在就在檔尾新增;檔案不存在就建立。
|
# 以標記整段取代(冪等);標記不存在就在檔尾新增;檔案不存在就建立。
|
||||||
# 適用 markdown 規則檔與 shell rc 檔:這兩種檔案沒有「區段」概念,附在檔尾就對了。
|
# 適用 markdown 規則檔與 shell rc 檔:這兩種檔案沒有「區段」概念,附在檔尾就對了。
|
||||||
# $1=檔案 $2=開頭標記行 $3=結尾標記行 $4=標記之間要寫入的內容
|
# $1=檔案 $2=開頭標記行 $3=結尾標記行 $4=標記之間要寫入的內容
|
||||||
@@ -616,8 +632,8 @@ if [ "$action" = smoke ]; then
|
|||||||
_h="$1"; _s="${2:-}"
|
_h="$1"; _s="${2:-}"
|
||||||
# 技能名一律清空:冒煙要驗的是「沒有技能情境時腳本跑得完」。留著繼承來的 JSC_SKILL,
|
# 技能名一律清空:冒煙要驗的是「沒有技能情境時腳本跑得完」。留著繼承來的 JSC_SKILL,
|
||||||
# sdlc-gate.sh wp-check skill 會拿它當真實呼叫判定,有未結清 PR 時就誤報成執行期錯誤。
|
# sdlc-gate.sh wp-check skill 會拿它當真實呼叫判定,有未結清 PR 時就誤報成執行期錯誤。
|
||||||
# JSC_CHANGED_FILE 同理清空:留著繼承來的檔名,comment-scope.sh 會真的去掃那個檔,
|
# JSC_CHANGED_FILE 同理清空:留著繼承來的檔名,comment-scope.sh 與 lang-guard.sh 會真的
|
||||||
# 掃到違規註解就 exit 2,冒煙測試變成看環境臉色,測不出腳本本身跑不跑得完。
|
# 去掃那個檔,掃到違規就 exit 2,冒煙測試變成看環境臉色,測不出腳本本身跑不跑得完。
|
||||||
_out=$(printf '{}' | JSC_CLI="$cli" JSC_SKILL="" SKILL="" JSC_CHANGED_FILE="" \
|
_out=$(printf '{}' | JSC_CLI="$cli" JSC_SKILL="" SKILL="" JSC_CHANGED_FILE="" \
|
||||||
sh "$HOOKS/$_h" $_s 2>&1); _rc=$?
|
sh "$HOOKS/$_h" $_s 2>&1); _rc=$?
|
||||||
if [ "$_rc" -eq 0 ]; then
|
if [ "$_rc" -eq 0 ]; then
|
||||||
@@ -632,6 +648,10 @@ if [ "$action" = smoke ]; then
|
|||||||
# 無參數模式冒煙時取不到檔名,正常會走 exit 0;sweep 則看工作區乾不乾淨——工作區剛好
|
# 無參數模式冒煙時取不到檔名,正常會走 exit 0;sweep 則看工作區乾不乾淨——工作區剛好
|
||||||
# 有違規註解就回 2。那是 hook 正常工作,不是 hook 壞掉,不能因此判定接線失敗。
|
# 有違規註解就回 2。那是 hook 正常工作,不是 hook 壞掉,不能因此判定接線失敗。
|
||||||
printf '[jsc] %s%s:exit 2,掃到違規註解並發出警告,屬設計行為,不算錯誤。\n' "$_h" "${_s:+ $_s}" >> "$smoke_out"
|
printf '[jsc] %s%s:exit 2,掃到違規註解並發出警告,屬設計行為,不算錯誤。\n' "$_h" "${_s:+ $_s}" >> "$smoke_out"
|
||||||
|
elif [ "$_h" = lang-guard.sh ] && [ "$_rc" -eq 2 ]; then
|
||||||
|
# 沿用同一條例外:lang-guard.sh 掃描模式的 exit 2 是「掃到簡體字、亂碼或編碼問題」的
|
||||||
|
# 設計行為。sweep 一樣看工作區乾不乾淨,髒工作區本來就會回 2,不是 hook 壞掉。
|
||||||
|
printf '[jsc] %s%s:exit 2,掃到簡體字或亂碼並發出警告,屬設計行為,不算錯誤。\n' "$_h" "${_s:+ $_s}" >> "$smoke_out"
|
||||||
else
|
else
|
||||||
smoke_fails=$((smoke_fails + 1))
|
smoke_fails=$((smoke_fails + 1))
|
||||||
printf '[jsc] %s%s:exit %s,執行期出錯:%s\n' "$_h" "${_s:+ $_s}" "$_rc" \
|
printf '[jsc] %s%s:exit %s,執行期出錯:%s\n' "$_h" "${_s:+ $_s}" "$_rc" \
|
||||||
@@ -655,9 +675,14 @@ if [ "$action" = smoke ]; then
|
|||||||
smoke_one comment-scope.sh prompt
|
smoke_one comment-scope.sh prompt
|
||||||
smoke_one comment-scope.sh
|
smoke_one comment-scope.sh
|
||||||
smoke_one comment-scope.sh sweep
|
smoke_one comment-scope.sh sweep
|
||||||
|
# lang-guard.sh 同樣有三個接在不同事件的模式,三個都要驗,判定理由與 comment-scope.sh 相同:
|
||||||
|
# prompt 一律 exit 0,無參數模式取不到檔名時安靜 exit 0,sweep 在髒工作區回 2 由白名單放行。
|
||||||
|
smoke_one lang-guard.sh prompt
|
||||||
|
smoke_one lang-guard.sh
|
||||||
|
smoke_one lang-guard.sh sweep
|
||||||
|
|
||||||
if [ "$smoke_fails" -eq 0 ]; then
|
if [ "$smoke_fails" -eq 0 ]; then
|
||||||
printf 'status=ok reason=%s\n' "六支 hook 的每個接線模式都跑得完,沒有執行期錯誤"
|
printf 'status=ok reason=%s\n' "七支 hook 的每個接線模式都跑得完,沒有執行期錯誤"
|
||||||
cat "$smoke_out"; rm -f "$smoke_out"; exit 0
|
cat "$smoke_out"; rm -f "$smoke_out"; exit 0
|
||||||
fi
|
fi
|
||||||
printf 'status=failed reason=%s\n' "$smoke_fails 支 hook 有執行期錯誤"
|
printf 'status=failed reason=%s\n' "$smoke_fails 支 hook 有執行期錯誤"
|
||||||
@@ -694,6 +719,13 @@ if [ "$action" = status ]; then
|
|||||||
else st_item "$1" "$2" missing; fi
|
else st_item "$1" "$2" missing; fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 繁中與編碼規則寫進規則檔了嗎。同樣與 STE100 共用標記段落,所以要單獨比對內容:
|
||||||
|
# 標記在、內容卻是舊版沒有這一段時,這一項才看得出來缺了。$1=項目名 $2=檔案
|
||||||
|
st_lang_guard() {
|
||||||
|
if [ -f "$2" ] && has_lang_guard "$2"; then st_item "$1" "$2" present
|
||||||
|
else st_item "$1" "$2" missing; fi
|
||||||
|
}
|
||||||
|
|
||||||
# 別名段落只要任何一個既有 rc 檔帶有標記就算接上。$1=項目名 $2=標記名
|
# 別名段落只要任何一個既有 rc 檔帶有標記就算接上。$1=項目名 $2=標記名
|
||||||
st_rc_alias() {
|
st_rc_alias() {
|
||||||
for _rc in "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.config/fish/config.fish"; do
|
for _rc in "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.config/fish/config.fish"; do
|
||||||
@@ -707,11 +739,14 @@ if [ "$action" = status ]; then
|
|||||||
claude)
|
claude)
|
||||||
if [ -f "$HOOKS/hooks.json" ]; then st_item hooks.json "$HOOKS/hooks.json" present
|
if [ -f "$HOOKS/hooks.json" ]; then st_item hooks.json "$HOOKS/hooks.json" present
|
||||||
else st_item hooks.json "$HOOKS/hooks.json" missing; fi
|
else st_item hooks.json "$HOOKS/hooks.json" missing; fi
|
||||||
# 六支 hook 全靠這一個檔宣告,只看檔案在不在會漏掉「檔在、某支沒接進去」。
|
# 七支 hook 全靠這一個檔宣告,只看檔案在不在會漏掉「檔在、某支沒接進去」。
|
||||||
# 最後加進來的 comment-scope.sh 是最可能漏的一支,所以單獨列一項。
|
# 後來才加進來的 comment-scope.sh 與 lang-guard.sh 是最可能漏的兩支,所以各列一項。
|
||||||
if [ -f "$HOOKS/hooks.json" ] && grep -qF 'comment-scope.sh' "$HOOKS/hooks.json" 2>/dev/null
|
if [ -f "$HOOKS/hooks.json" ] && grep -qF 'comment-scope.sh' "$HOOKS/hooks.json" 2>/dev/null
|
||||||
then st_item comment-scope "$HOOKS/hooks.json" present
|
then st_item comment-scope "$HOOKS/hooks.json" present
|
||||||
else st_item comment-scope "$HOOKS/hooks.json" missing; fi ;;
|
else st_item comment-scope "$HOOKS/hooks.json" missing; fi
|
||||||
|
if [ -f "$HOOKS/hooks.json" ] && grep -qF 'lang-guard.sh' "$HOOKS/hooks.json" 2>/dev/null
|
||||||
|
then st_item lang-guard "$HOOKS/hooks.json" present
|
||||||
|
else st_item lang-guard "$HOOKS/hooks.json" missing; fi ;;
|
||||||
|
|
||||||
codex)
|
codex)
|
||||||
config="${CODEX_HOME:-$HOME/.codex}/config.toml"
|
config="${CODEX_HOME:-$HOME/.codex}/config.toml"
|
||||||
@@ -729,22 +764,32 @@ if [ "$action" = status ]; then
|
|||||||
else
|
else
|
||||||
st_item notify-sweep "$config" missing
|
st_item notify-sweep "$config" missing
|
||||||
fi
|
fi
|
||||||
|
# 兩支 sweep 各算一項:只驗其中一支會讓「舊版只接了註解範圍」看起來像接線完整
|
||||||
|
if [ -f "$config" ] && grep -qF 'lang-guard.sh' "$config" 2>/dev/null &&
|
||||||
|
grep -qF 'sweep' "$config" 2>/dev/null; then
|
||||||
|
st_item notify-lang-sweep "$config" present
|
||||||
|
else
|
||||||
|
st_item notify-lang-sweep "$config" missing
|
||||||
|
fi
|
||||||
st_rc_alias alias jsc-hooks:codex
|
st_rc_alias alias jsc-hooks:codex
|
||||||
st_block ste100 "${CODEX_HOME:-$HOME/.codex}/AGENTS.md" "<!-- jsc-hooks -->"
|
st_block ste100 "${CODEX_HOME:-$HOME/.codex}/AGENTS.md" "<!-- jsc-hooks -->"
|
||||||
st_comment_scope comment-scope "${CODEX_HOME:-$HOME/.codex}/AGENTS.md"
|
st_comment_scope comment-scope "${CODEX_HOME:-$HOME/.codex}/AGENTS.md"
|
||||||
st_degrade="STE100 降級為 prompt 檔,SDLC 模型鎖降級為技能步驟檢查,無 pre-tool hook 可接版本前置檢查,註解範圍改為每輪結束掃整個工作區,不是逐檔即時" ;;
|
st_lang_guard lang-guard "${CODEX_HOME:-$HOME/.codex}/AGENTS.md"
|
||||||
|
st_degrade="STE100 降級為 prompt 檔,SDLC 模型鎖降級為技能步驟檢查,無 pre-tool hook 可接版本前置檢查,註解範圍與繁中編碼改為每輪結束掃整個工作區,不是逐檔即時" ;;
|
||||||
|
|
||||||
copilot)
|
copilot)
|
||||||
st_rc_alias alias jsc-hooks:copilot
|
st_rc_alias alias jsc-hooks:copilot
|
||||||
st_block ste100 "${JSC_COPILOT_INSTRUCTIONS:-$HOME/.config/copilot/copilot-instructions.md}" "<!-- jsc-hooks -->"
|
st_block ste100 "${JSC_COPILOT_INSTRUCTIONS:-$HOME/.config/copilot/copilot-instructions.md}" "<!-- jsc-hooks -->"
|
||||||
st_comment_scope comment-scope "${JSC_COPILOT_INSTRUCTIONS:-$HOME/.config/copilot/copilot-instructions.md}"
|
st_comment_scope comment-scope "${JSC_COPILOT_INSTRUCTIONS:-$HOME/.config/copilot/copilot-instructions.md}"
|
||||||
st_degrade="STE100 降級為 prompt 檔,SDLC 模型鎖降級為技能步驟檢查,無 pre-tool hook 可接版本前置檢查,註解範圍只在工作階段結束時掃一次整個工作區" ;;
|
st_lang_guard lang-guard "${JSC_COPILOT_INSTRUCTIONS:-$HOME/.config/copilot/copilot-instructions.md}"
|
||||||
|
st_degrade="STE100 降級為 prompt 檔,SDLC 模型鎖降級為技能步驟檢查,無 pre-tool hook 可接版本前置檢查,註解範圍與繁中編碼只在工作階段結束時掃一次整個工作區" ;;
|
||||||
|
|
||||||
antigravity)
|
antigravity)
|
||||||
st_rc_alias alias jsc-hooks:antigravity
|
st_rc_alias alias jsc-hooks:antigravity
|
||||||
st_block ste100 "${JSC_ANTIGRAVITY_RULES:-$HOME/.antigravity/AGENTS.md}" "<!-- jsc-hooks -->"
|
st_block ste100 "${JSC_ANTIGRAVITY_RULES:-$HOME/.antigravity/AGENTS.md}" "<!-- jsc-hooks -->"
|
||||||
st_comment_scope comment-scope "${JSC_ANTIGRAVITY_RULES:-$HOME/.antigravity/AGENTS.md}"
|
st_comment_scope comment-scope "${JSC_ANTIGRAVITY_RULES:-$HOME/.antigravity/AGENTS.md}"
|
||||||
st_degrade="STE100 降級為 prompt 檔,SDLC 模型鎖降級為技能步驟檢查,無 pre-tool hook 可接版本前置檢查,註解範圍只在工作階段結束時掃一次整個工作區" ;;
|
st_lang_guard lang-guard "${JSC_ANTIGRAVITY_RULES:-$HOME/.antigravity/AGENTS.md}"
|
||||||
|
st_degrade="STE100 降級為 prompt 檔,SDLC 模型鎖降級為技能步驟檢查,無 pre-tool hook 可接版本前置檢查,註解範圍與繁中編碼只在工作階段結束時掃一次整個工作區" ;;
|
||||||
|
|
||||||
kiro)
|
kiro)
|
||||||
# kiro 的 hook 檔綁在工作區,這裡看的一律是目前工作目錄底下那一份
|
# kiro 的 hook 檔綁在工作區,這裡看的一律是目前工作目錄底下那一份
|
||||||
@@ -762,7 +807,16 @@ if [ "$action" = status ]; then
|
|||||||
grep -qF 'comment-scope.sh\" sweep' ./.kiro/hooks/jsc-hooks.json 2>/dev/null
|
grep -qF 'comment-scope.sh\" sweep' ./.kiro/hooks/jsc-hooks.json 2>/dev/null
|
||||||
then st_item comment-scope-sweep ./.kiro/hooks/jsc-hooks.json present
|
then st_item comment-scope-sweep ./.kiro/hooks/jsc-hooks.json present
|
||||||
else st_item comment-scope-sweep ./.kiro/hooks/jsc-hooks.json missing; fi
|
else st_item comment-scope-sweep ./.kiro/hooks/jsc-hooks.json missing; fi
|
||||||
st_degrade="SDLC 模型鎖降級為技能步驟檢查,無 pre-tool hook 可接版本前置檢查,註解範圍改為每輪提示送出時掃整個工作區,不是逐檔即時" ;;
|
# lang-guard.sh 的兩個模式同理各算一項
|
||||||
|
if [ -f ./.kiro/hooks/jsc-hooks.json ] &&
|
||||||
|
grep -qF 'lang-guard.sh\" prompt' ./.kiro/hooks/jsc-hooks.json 2>/dev/null
|
||||||
|
then st_item lang-guard ./.kiro/hooks/jsc-hooks.json present
|
||||||
|
else st_item lang-guard ./.kiro/hooks/jsc-hooks.json missing; fi
|
||||||
|
if [ -f ./.kiro/hooks/jsc-hooks.json ] &&
|
||||||
|
grep -qF 'lang-guard.sh\" sweep' ./.kiro/hooks/jsc-hooks.json 2>/dev/null
|
||||||
|
then st_item lang-guard-sweep ./.kiro/hooks/jsc-hooks.json present
|
||||||
|
else st_item lang-guard-sweep ./.kiro/hooks/jsc-hooks.json missing; fi
|
||||||
|
st_degrade="SDLC 模型鎖降級為技能步驟檢查,無 pre-tool hook 可接版本前置檢查,註解範圍與繁中編碼改為每輪提示送出時掃整個工作區,不是逐檔即時" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ "$st_missing" -gt 0 ]; then
|
if [ "$st_missing" -gt 0 ]; then
|
||||||
@@ -773,7 +827,7 @@ if [ "$action" = status ]; then
|
|||||||
printf 'status=degraded reason=%s\n' "$st_degrade"
|
printf 'status=degraded reason=%s\n' "$st_degrade"
|
||||||
cat "$st_items"; rm -f "$st_items"; exit 1
|
cat "$st_items"; rm -f "$st_items"; exit 1
|
||||||
fi
|
fi
|
||||||
printf 'status=wired reason=%s\n' "hooks.json 自動接線全部六支 hook"
|
printf 'status=wired reason=%s\n' "hooks.json 自動接線全部七支 hook"
|
||||||
cat "$st_items"; rm -f "$st_items"; exit 0
|
cat "$st_items"; rm -f "$st_items"; exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -784,9 +838,11 @@ case "$cli" in
|
|||||||
[ -f "$HOOKS/hooks.json" ] || fail "找不到 $HOOKS/hooks.json,claude 接不到任何 hook"
|
[ -f "$HOOKS/hooks.json" ] || fail "找不到 $HOOKS/hooks.json,claude 接不到任何 hook"
|
||||||
grep -qF 'comment-scope.sh' "$HOOKS/hooks.json" 2>/dev/null \
|
grep -qF 'comment-scope.sh' "$HOOKS/hooks.json" 2>/dev/null \
|
||||||
|| fail "$HOOKS/hooks.json 沒有接上 comment-scope.sh,註解範圍檢查不會生效"
|
|| fail "$HOOKS/hooks.json 沒有接上 comment-scope.sh,註解範圍檢查不會生效"
|
||||||
|
grep -qF 'lang-guard.sh' "$HOOKS/hooks.json" 2>/dev/null \
|
||||||
|
|| fail "$HOOKS/hooks.json 沒有接上 lang-guard.sh,繁中與編碼檢查不會生效"
|
||||||
printf 'status=wired reason=%s\n' "hooks.json 自動接線"
|
printf 'status=wired reason=%s\n' "hooks.json 自動接線"
|
||||||
echo "[jsc] claude:由 hooks/hooks.json 自動接線全部六支 hook,無需寫入設定。"
|
echo "[jsc] claude:由 hooks/hooks.json 自動接線全部七支 hook,無需寫入設定。"
|
||||||
echo "[jsc] claude:只有 claude 有 post-tool hook,comment-scope.sh 的逐檔即時掃描只在這裡接得上;其他四個 CLI 改用 sweep 掃整個工作區,時機晚一輪或晚到工作階段結束。"
|
echo "[jsc] claude:只有 claude 有 post-tool hook,comment-scope.sh 與 lang-guard.sh 的逐檔即時掃描只在這裡接得上;其他四個 CLI 改用 sweep 掃整個工作區,時機晚一輪或晚到工作階段結束。"
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
|
||||||
codex)
|
codex)
|
||||||
@@ -805,7 +861,8 @@ case "$cli" in
|
|||||||
# 寫過的檔一個都不會漏。
|
# 寫過的檔一個都不會漏。
|
||||||
timer="sh '$HOOKS/session-timer.sh'"
|
timer="sh '$HOOKS/session-timer.sh'"
|
||||||
scope="sh '$HOOKS/comment-scope.sh'"
|
scope="sh '$HOOKS/comment-scope.sh'"
|
||||||
notify_line="notify = [\"env\", \"JSC_CLI=codex\", \"sh\", \"-c\", \"$timer start </dev/null; $timer mark </dev/null; $scope sweep </dev/null\"]"
|
lang="sh '$HOOKS/lang-guard.sh'"
|
||||||
|
notify_line="notify = [\"env\", \"JSC_CLI=codex\", \"sh\", \"-c\", \"$timer start </dev/null; $timer mark </dev/null; $scope sweep </dev/null; $lang sweep </dev/null\"]"
|
||||||
alias_line="alias $bin='sh \"$HERE/jsc-wrap.sh\" codex'"
|
alias_line="alias $bin='sh \"$HERE/jsc-wrap.sh\" codex'"
|
||||||
replace_block_toml "$config" "# jsc-hooks" "# /jsc-hooks" "$notify_line" \
|
replace_block_toml "$config" "# jsc-hooks" "# /jsc-hooks" "$notify_line" \
|
||||||
|| fail "無法寫入 $config"
|
|| fail "無法寫入 $config"
|
||||||
@@ -814,19 +871,22 @@ case "$cli" in
|
|||||||
|| fail "$config 的 notify 沒有落在根層(被歸進某張表,codex 讀不到,hook 會靜靜失效)"
|
|| fail "$config 的 notify 沒有落在根層(被歸進某張表,codex 讀不到,hook 會靜靜失效)"
|
||||||
grep -qF "$scope sweep" "$config" 2>/dev/null \
|
grep -qF "$scope sweep" "$config" 2>/dev/null \
|
||||||
|| fail "$config 的 notify 沒有接到 comment-scope.sh sweep,codex 每輪結束不會掃註解範圍"
|
|| fail "$config 的 notify 沒有接到 comment-scope.sh sweep,codex 每輪結束不會掃註解範圍"
|
||||||
|
grep -qF "$lang sweep" "$config" 2>/dev/null \
|
||||||
|
|| fail "$config 的 notify 沒有接到 lang-guard.sh sweep,codex 每輪結束不會掃簡體字與亂碼"
|
||||||
write_alias_rc "jsc-hooks:codex" "$alias_line" || fail "無法把 $bin 別名寫進 shell rc 檔"
|
write_alias_rc "jsc-hooks:codex" "$alias_line" || fail "無法把 $bin 別名寫進 shell rc 檔"
|
||||||
replace_block "$agents" "<!-- jsc-hooks -->" "<!-- /jsc-hooks -->" "$(rules_text)" \
|
replace_block "$agents" "<!-- jsc-hooks -->" "<!-- /jsc-hooks -->" "$(rules_text)" \
|
||||||
|| fail "無法寫入 $agents"
|
|| fail "無法寫入 $agents"
|
||||||
has_block "$agents" "<!-- jsc-hooks -->" || fail "$agents 寫入後讀不到 jsc-hooks 標記段落"
|
has_block "$agents" "<!-- jsc-hooks -->" || fail "$agents 寫入後讀不到 jsc-hooks 標記段落"
|
||||||
has_comment_scope "$agents" || fail "$agents 寫入後讀不到註解範圍規則"
|
has_comment_scope "$agents" || fail "$agents 寫入後讀不到註解範圍規則"
|
||||||
printf 'status=degraded reason=%s\n' "STE100 降級為 prompt 檔,SDLC 模型鎖降級為技能步驟檢查,無 pre-tool hook 可接版本前置檢查,註解範圍改為每輪結束掃整個工作區,不是逐檔即時"
|
has_lang_guard "$agents" || fail "$agents 寫入後讀不到繁中與編碼規則"
|
||||||
|
printf 'status=degraded reason=%s\n' "STE100 降級為 prompt 檔,SDLC 模型鎖降級為技能步驟檢查,無 pre-tool hook 可接版本前置檢查,註解範圍與繁中編碼改為每輪結束掃整個工作區,不是逐檔即時"
|
||||||
echo "[jsc] codex:已在 shell rc 加上 $bin 別名,轉呼叫 tools/jsc-wrap.sh codex,啟動當下開始計時。"
|
echo "[jsc] codex:已在 shell rc 加上 $bin 別名,轉呼叫 tools/jsc-wrap.sh codex,啟動當下開始計時。"
|
||||||
echo "[jsc] codex:別名要開新的 shell 或重新 source rc 檔才生效。"
|
echo "[jsc] codex:別名要開新的 shell 或重新 source rc 檔才生效。"
|
||||||
echo "[jsc] codex:已設定 $config 的 notify(根層鍵,已驗證),每輪補 session-timer.sh start 再 mark,最後跑 comment-scope.sh sweep。"
|
echo "[jsc] codex:已設定 $config 的 notify(根層鍵,已驗證),每輪補 session-timer.sh start 再 mark,最後跑 comment-scope.sh sweep 與 lang-guard.sh sweep。"
|
||||||
echo "[jsc] codex:已在 $agents 寫入 STE100 與註解範圍規則段落(prompt 降級)。"
|
echo "[jsc] codex:已在 $agents 寫入 STE100、註解範圍與繁中編碼規則段落(prompt 降級)。"
|
||||||
echo "[jsc] codex:SDLC 模型鎖降級為技能步驟檢查,鎖檔仍由 sdlc-gate.sh lock 寫入。"
|
echo "[jsc] codex:SDLC 模型鎖降級為技能步驟檢查,鎖檔仍由 sdlc-gate.sh lock 寫入。"
|
||||||
echo "[jsc] codex:版本前置檢查接不上(codex 沒有 pre-tool hook),改由 /jsc-cli:deploy 定期更新。"
|
echo "[jsc] codex:版本前置檢查接不上(codex 沒有 pre-tool hook),改由 /jsc-cli:deploy 定期更新。"
|
||||||
echo "[jsc] codex:註解範圍除了規則提示,每輪結束會由 notify 掃一次整個 git 工作區(codex 沒有 post-tool hook,接不到逐檔即時掃描),回饋比 claude 晚一輪。"
|
echo "[jsc] codex:註解範圍與繁中編碼除了規則提示,每輪結束會由 notify 各掃一次整個 git 工作區(codex 沒有 post-tool hook,接不到逐檔即時掃描),回饋比 claude 晚一輪。"
|
||||||
exit 1 ;;
|
exit 1 ;;
|
||||||
|
|
||||||
copilot)
|
copilot)
|
||||||
@@ -839,13 +899,14 @@ case "$cli" in
|
|||||||
|| fail "無法寫入 $instr"
|
|| fail "無法寫入 $instr"
|
||||||
has_block "$instr" "<!-- jsc-hooks -->" || fail "$instr 寫入後讀不到 jsc-hooks 標記段落"
|
has_block "$instr" "<!-- jsc-hooks -->" || fail "$instr 寫入後讀不到 jsc-hooks 標記段落"
|
||||||
has_comment_scope "$instr" || fail "$instr 寫入後讀不到註解範圍規則"
|
has_comment_scope "$instr" || fail "$instr 寫入後讀不到註解範圍規則"
|
||||||
printf 'status=degraded reason=%s\n' "STE100 降級為 prompt 檔,SDLC 模型鎖降級為技能步驟檢查,無 pre-tool hook 可接版本前置檢查,註解範圍只在工作階段結束時掃一次整個工作區"
|
has_lang_guard "$instr" || fail "$instr 寫入後讀不到繁中與編碼規則"
|
||||||
|
printf 'status=degraded reason=%s\n' "STE100 降級為 prompt 檔,SDLC 模型鎖降級為技能步驟檢查,無 pre-tool hook 可接版本前置檢查,註解範圍與繁中編碼只在工作階段結束時掃一次整個工作區"
|
||||||
echo "[jsc] copilot:已在 shell rc 加上 $bin 別名,轉呼叫 tools/jsc-wrap.sh copilot。"
|
echo "[jsc] copilot:已在 shell rc 加上 $bin 別名,轉呼叫 tools/jsc-wrap.sh copilot。"
|
||||||
echo "[jsc] copilot:已在 $instr 寫入 STE100 與註解範圍規則段落(prompt 降級)。"
|
echo "[jsc] copilot:已在 $instr 寫入 STE100、註解範圍與繁中編碼規則段落(prompt 降級)。"
|
||||||
echo "[jsc] copilot:別名要開新的 shell 或重新 source rc 檔才生效。"
|
echo "[jsc] copilot:別名要開新的 shell 或重新 source rc 檔才生效。"
|
||||||
echo "[jsc] copilot:SDLC 模型鎖降級為技能步驟檢查,鎖檔仍由 sdlc-gate.sh lock 寫入。"
|
echo "[jsc] copilot:SDLC 模型鎖降級為技能步驟檢查,鎖檔仍由 sdlc-gate.sh lock 寫入。"
|
||||||
echo "[jsc] copilot:版本前置檢查接不上(copilot 沒有 pre-tool hook),改由 /jsc-cli:deploy 定期更新。"
|
echo "[jsc] copilot:版本前置檢查接不上(copilot 沒有 pre-tool hook),改由 /jsc-cli:deploy 定期更新。"
|
||||||
echo "[jsc] copilot:註解範圍除了規則提示,工作階段結束時由 jsc-wrap.sh 收尾掃一次整個 git 工作區(copilot 連逐輪事件都沒有),回饋要等到離開 CLI 才看得到。"
|
echo "[jsc] copilot:註解範圍與繁中編碼除了規則提示,工作階段結束時由 jsc-wrap.sh 收尾各掃一次整個 git 工作區(copilot 連逐輪事件都沒有),回饋要等到離開 CLI 才看得到。"
|
||||||
exit 1 ;;
|
exit 1 ;;
|
||||||
|
|
||||||
antigravity)
|
antigravity)
|
||||||
@@ -858,13 +919,14 @@ case "$cli" in
|
|||||||
|| fail "無法寫入 $rules"
|
|| fail "無法寫入 $rules"
|
||||||
has_block "$rules" "<!-- jsc-hooks -->" || fail "$rules 寫入後讀不到 jsc-hooks 標記段落"
|
has_block "$rules" "<!-- jsc-hooks -->" || fail "$rules 寫入後讀不到 jsc-hooks 標記段落"
|
||||||
has_comment_scope "$rules" || fail "$rules 寫入後讀不到註解範圍規則"
|
has_comment_scope "$rules" || fail "$rules 寫入後讀不到註解範圍規則"
|
||||||
printf 'status=degraded reason=%s\n' "STE100 降級為 prompt 檔,SDLC 模型鎖降級為技能步驟檢查,無 pre-tool hook 可接版本前置檢查,註解範圍只在工作階段結束時掃一次整個工作區"
|
has_lang_guard "$rules" || fail "$rules 寫入後讀不到繁中與編碼規則"
|
||||||
|
printf 'status=degraded reason=%s\n' "STE100 降級為 prompt 檔,SDLC 模型鎖降級為技能步驟檢查,無 pre-tool hook 可接版本前置檢查,註解範圍與繁中編碼只在工作階段結束時掃一次整個工作區"
|
||||||
echo "[jsc] antigravity:已在 shell rc 加上 $bin 別名,轉呼叫 tools/jsc-wrap.sh antigravity。"
|
echo "[jsc] antigravity:已在 shell rc 加上 $bin 別名,轉呼叫 tools/jsc-wrap.sh antigravity。"
|
||||||
echo "[jsc] antigravity:已在 $rules 寫入 STE100 與註解範圍規則段落(prompt 降級)。"
|
echo "[jsc] antigravity:已在 $rules 寫入 STE100、註解範圍與繁中編碼規則段落(prompt 降級)。"
|
||||||
echo "[jsc] antigravity:別名要開新的 shell 或重新 source rc 檔才生效。"
|
echo "[jsc] antigravity:別名要開新的 shell 或重新 source rc 檔才生效。"
|
||||||
echo "[jsc] antigravity:SDLC 模型鎖降級為技能步驟檢查,鎖檔仍由 sdlc-gate.sh lock 寫入。"
|
echo "[jsc] antigravity:SDLC 模型鎖降級為技能步驟檢查,鎖檔仍由 sdlc-gate.sh lock 寫入。"
|
||||||
echo "[jsc] antigravity:版本前置檢查接不上(antigravity 沒有 pre-tool hook),改由 /jsc-cli:deploy 定期更新。"
|
echo "[jsc] antigravity:版本前置檢查接不上(antigravity 沒有 pre-tool hook),改由 /jsc-cli:deploy 定期更新。"
|
||||||
echo "[jsc] antigravity:註解範圍除了規則提示,工作階段結束時由 jsc-wrap.sh 收尾掃一次整個 git 工作區(antigravity 連逐輪事件都沒有),回饋要等到離開 CLI 才看得到。"
|
echo "[jsc] antigravity:註解範圍與繁中編碼除了規則提示,工作階段結束時由 jsc-wrap.sh 收尾各掃一次整個 git 工作區(antigravity 連逐輪事件都沒有),回饋要等到離開 CLI 才看得到。"
|
||||||
exit 1 ;;
|
exit 1 ;;
|
||||||
|
|
||||||
kiro)
|
kiro)
|
||||||
@@ -885,16 +947,16 @@ case "$cli" in
|
|||||||
"run": "sh \\"$HOOKS/session-timer.sh\\" restart </dev/null"
|
"run": "sh \\"$HOOKS/session-timer.sh\\" restart </dev/null"
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
# userPromptSubmit 那一輪的 run 最後再掛 comment-scope.sh sweep:kiro 沒有 post-tool hook,
|
# userPromptSubmit 那一輪的 run 最後再掛 comment-scope.sh sweep 與 lang-guard.sh sweep:
|
||||||
# 拿不到「剛剛寫了哪個檔」,只能改掃整個 git 工作區的 diff。掃到的是上一輪寫的檔——
|
# kiro 沒有 post-tool hook,拿不到「剛剛寫了哪個檔」,只能改掃整個 git 工作區的 diff。
|
||||||
# 提示送出時,上一輪的寫入早就落地了,時機合理。
|
# 掃到的是上一輪寫的檔——提示送出時,上一輪的寫入早就落地了,時機合理。
|
||||||
cat > "$hookfile" 2>/dev/null <<EOF || fail "無法寫入 $hookfile"
|
cat > "$hookfile" 2>/dev/null <<EOF || fail "無法寫入 $hookfile"
|
||||||
{
|
{
|
||||||
"name": "jsc-hooks",
|
"name": "jsc-hooks",
|
||||||
"description": "jsc session timer + STE100 guard + comment scope bridge (auto-generated by jsc-hooks:hooks-install, do not edit by hand)",
|
"description": "jsc session timer + STE100 guard + comment scope + language guard bridge (auto-generated by jsc-hooks:hooks-install, do not edit by hand)",
|
||||||
"on": ["sessionEnd", "userPromptSubmit"],
|
"on": ["sessionEnd", "userPromptSubmit"],
|
||||||
"env": { "JSC_CLI": "kiro" },
|
"env": { "JSC_CLI": "kiro" },
|
||||||
"run": "sh \\"$HOOKS/session-timer.sh\\" mark </dev/null; sh \\"$HOOKS/ste100-guard.sh\\" </dev/null; sh \\"$HOOKS/comment-scope.sh\\" prompt </dev/null; sh \\"$HOOKS/comment-scope.sh\\" sweep </dev/null"
|
"run": "sh \\"$HOOKS/session-timer.sh\\" mark </dev/null; sh \\"$HOOKS/ste100-guard.sh\\" </dev/null; sh \\"$HOOKS/comment-scope.sh\\" prompt </dev/null; sh \\"$HOOKS/comment-scope.sh\\" sweep </dev/null; sh \\"$HOOKS/lang-guard.sh\\" prompt </dev/null; sh \\"$HOOKS/lang-guard.sh\\" sweep </dev/null"
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
for f in "$startfile" "$hookfile"; do
|
for f in "$startfile" "$hookfile"; do
|
||||||
@@ -911,10 +973,15 @@ EOF
|
|||||||
|| fail "$hookfile 的 run 沒有接到 comment-scope.sh prompt,每輪不會注入註解範圍規則"
|
|| fail "$hookfile 的 run 沒有接到 comment-scope.sh prompt,每輪不會注入註解範圍規則"
|
||||||
grep -qF 'comment-scope.sh\" sweep' "$hookfile" 2>/dev/null \
|
grep -qF 'comment-scope.sh\" sweep' "$hookfile" 2>/dev/null \
|
||||||
|| fail "$hookfile 的 run 沒有接到 comment-scope.sh sweep,kiro 每輪不會掃註解範圍"
|
|| fail "$hookfile 的 run 沒有接到 comment-scope.sh sweep,kiro 每輪不會掃註解範圍"
|
||||||
printf 'status=degraded reason=%s\n' "SDLC 模型鎖降級為技能步驟檢查,無 pre-tool hook 可接版本前置檢查,註解範圍改為每輪提示送出時掃整個工作區,不是逐檔即時"
|
grep -qF 'lang-guard.sh' "$hookfile" 2>/dev/null || fail "$hookfile 的 run 沒有接到 lang-guard.sh"
|
||||||
|
grep -qF 'lang-guard.sh\" prompt' "$hookfile" 2>/dev/null \
|
||||||
|
|| fail "$hookfile 的 run 沒有接到 lang-guard.sh prompt,每輪不會注入繁中與編碼規則"
|
||||||
|
grep -qF 'lang-guard.sh\" sweep' "$hookfile" 2>/dev/null \
|
||||||
|
|| fail "$hookfile 的 run 沒有接到 lang-guard.sh sweep,kiro 每輪不會掃簡體字與亂碼"
|
||||||
|
printf 'status=degraded reason=%s\n' "SDLC 模型鎖降級為技能步驟檢查,無 pre-tool hook 可接版本前置檢查,註解範圍與繁中編碼改為每輪提示送出時掃整個工作區,不是逐檔即時"
|
||||||
echo "[jsc] kiro:已建立 $startfile(sessionStart 開始計時)與 $hookfile(JSC_CLI=kiro),兩份都已驗證。"
|
echo "[jsc] kiro:已建立 $startfile(sessionStart 開始計時)與 $hookfile(JSC_CLI=kiro),兩份都已驗證。"
|
||||||
echo "[jsc] kiro:SDLC 模型鎖降級為技能步驟檢查,鎖檔仍由 sdlc-gate.sh lock 寫入。"
|
echo "[jsc] kiro:SDLC 模型鎖降級為技能步驟檢查,鎖檔仍由 sdlc-gate.sh lock 寫入。"
|
||||||
echo "[jsc] kiro:版本前置檢查接不上(kiro 沒有 pre-tool hook),改由 /jsc-cli:deploy 定期更新。"
|
echo "[jsc] kiro:版本前置檢查接不上(kiro 沒有 pre-tool hook),改由 /jsc-cli:deploy 定期更新。"
|
||||||
echo "[jsc] kiro:註解範圍除了規則提示,每輪提示送出時會掃一次整個 git 工作區(kiro 沒有 post-tool hook),掃到的是上一輪寫的檔。"
|
echo "[jsc] kiro:註解範圍與繁中編碼除了規則提示,每輪提示送出時會各掃一次整個 git 工作區(kiro 沒有 post-tool hook),掃到的是上一輪寫的檔。"
|
||||||
exit 1 ;;
|
exit 1 ;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
Reference in New Issue
Block a user