session-end-closeout.sh bash
48 lines 1.1 KB
Raw
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1 docs: MuseHub-first before ISR #74 — staging solidify NEXT Human 6 hours ago
1 #!/bin/sh
2 # sessionEnd hook — governance-sync dry-run summary + CURRENT NEXT (§LT.4.5, fail-open).
3
4 find_ok() {
5 if [ -n "$OVERSEER_OK" ] && [ -x "$OVERSEER_OK" ]; then
6 printf '%s\n' "$OVERSEER_OK"
7 return 0
8 fi
9 if [ -x "./cli/ok" ]; then
10 printf '%s\n' "./cli/ok"
11 return 0
12 fi
13 if command -v ok >/dev/null 2>&1; then
14 printf '%s\n' "ok"
15 return 0
16 fi
17 return 1
18 }
19
20 OK=$(find_ok) || {
21 printf '%s\n' '{"followup_message":"ok CLI not found"}'
22 exit 0
23 }
24
25 DRY=$("$OK" governance-sync --dry-run 2>&1) || DRY="$DRY"
26 NEXT=$("$OK" next 2>&1) || NEXT="$NEXT"
27
28 export LT_HOOK_DRY="$DRY"
29 export LT_HOOK_NEXT="$NEXT"
30
31 if command -v python3 >/dev/null 2>&1; then
32 python3 - <<'PY' || true
33 import json
34 import os
35
36 dry = os.environ.get("LT_HOOK_DRY", "").strip()
37 nxt = os.environ.get("LT_HOOK_NEXT", "").strip()
38 summary = dry.splitlines()[0] if dry else "governance-sync dry-run complete"
39 body = summary
40 if nxt:
41 body = f"{summary}\n\n{nxt}"
42 print(json.dumps({"followup_message": body}))
43 PY
44 else
45 printf '%s\n' '{"followup_message":"governance-sync dry-run (python3 unavailable)"}'
46 fi
47
48 exit 0
File History 1 commit
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1 docs: MuseHub-first before ISR #74 — staging solidify NEXT Human 6 hours ago