What:依 jsc-meta:skill-check 的稽核結果修正技能與工具——補上每個步驟的可檢核完成條件、 把留在內文的標準輸入輸出流程下放 tools/、修正查表與退碼路由造成的誤判。 Why:稽核發現這些缺失會讓技能在實際執行時走錯分支或靜默通過。 完成條件缺漏是最常被違反的一項;退碼誤判與查表錯誤則會讓良性狀況被當成失敗。 How:逐項對照 references/guidelines.md 的審核檢查清單修正,新增的工具都有 documented exit codes,並以真實執行驗證每條路徑。 Who:jsc-meta:skill-check 例行稽核(2026-08-25)。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
29 lines
1.2 KiB
Bash
Executable File
29 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env sh
|
|
# jsc-wrap.sh — 無 hook 系統 CLI 的包裝啟動器(例:copilot、antigravity)。
|
|
# 用法: jsc-wrap.sh {cli} [args...]
|
|
# 行為: 匯出 JSC_CLI 與 JSC_SESSION_ID → session-timer start → 執行 CLI →
|
|
# 結束後 session-timer mark 並以 scan-logs.sh 回填用量,最後回傳 CLI 的結束碼。
|
|
# 注意: JSC_CLI 存的是 CLI 代號(antigravity、kiro),實際執行的是 cli_bin 對應的
|
|
# 執行檔(agy、kiro-cli)。直接拿代號當指令跑會 127,因為沒有這兩個執行檔。
|
|
HERE=$(cd "$(dirname "$0")" && pwd)
|
|
HOOKS="$HERE/../hooks"
|
|
. "$HOOKS/lib.sh"
|
|
cli="${1:-}"
|
|
if [ -z "$cli" ]; then
|
|
echo "用法:jsc-wrap.sh {cli} [args...]" >&2
|
|
exit 2
|
|
fi
|
|
shift
|
|
bin=$(cli_bin "$cli")
|
|
JSC_CLI="$cli"
|
|
# 未提供 session id 就自動產生({cli}-時間戳-PID),讓計時與用量共用同一個 session
|
|
[ -n "${JSC_SESSION_ID:-}" ] || JSC_SESSION_ID="$cli-$(date +%Y%m%d%H%M%S)-$$"
|
|
export JSC_CLI JSC_SESSION_ID
|
|
sh "$HOOKS/session-timer.sh" start </dev/null
|
|
"$bin" "$@"
|
|
rc=$?
|
|
# 收尾:補記結束時間,並從原生日誌回填技能用量
|
|
sh "$HOOKS/session-timer.sh" mark </dev/null
|
|
sh "$HERE/scan-logs.sh" --cli "$cli" --session "$JSC_SESSION_ID" </dev/null || true
|
|
exit "$rc"
|