#!/bin/bash # .claude/hooks/stop-check-sync.sh # arcrun Stop hook # # 職責:session 結束前檢查 code 變動是否有對應的 SDD / tasks.md 更新 # 退出 code:不 block,只警告 set -o pipefail # 檢查 docs/3-specs 下本次 session 是否有變動 SPECS_DIFF=$(git -C "$(pwd)" status --porcelain -- 'docs/3-specs/' 2>/dev/null | head -20) CODE_DIFF=$(git -C "$(pwd)" status --porcelain -- '*.go' '*.ts' '*.tsx' '*.py' 'cypher-executor/' 'registry/' 'cli/' 2>/dev/null | head -20) if [[ -n "$CODE_DIFF" && -z "$SPECS_DIFF" ]]; then cat >&2 </dev/null 2>&1; then LAG="$(cd console-ui && node scripts/verify-live.mjs --offline-lag 2>/dev/null)" if [ -n "$LAG" ]; then cat >&2 </dev/null | head -5) if [[ -n "$TASKS_DIFF" ]]; then cat >&2 <