Files
solution-erp/.claude/hooks/wal-flush.ps1
pqhuy1987 8b6df0a396
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 5m25s
[CLAUDE] Docs: S146 closeout — session-model 3 owner-decision + hook 4-path + H24 auto
Ap spec-apply-hub-s145-v2 (5 axis, governance-only: 0 prod-code, 0 migration).
Workflow S145 chet giua chung -> /tiep §4 relaunch-cat-gon wf_3d803740-41d 3/3 DONE.

Owner-decision @S146:
- session_ctx_kb = 64 TUONG-MINH (giu nguyen caveat ghost-wire: 0 reader)
- session-model: scaffold IDEMPOTENT (tach cap-SO vs tao-THU-MUC) · closed.md WIRE
  (session-end §6.3-bis) · V2 AUTO (go cong NGUOI, GIU cong NHIP 6/15/3)

Landed: C7 §N.8 predicate 4-ve · hook wal-flush.ps1 4 path (+.claude/sessions/)
· San-3 tin-hieu ⑤ + ORPHAN-L · D2 KIEM end-only · §L.c completeness-gate co RANG.
LIVE-VERIFY hook 4-path PASS repo THAT (da7ee8a). Session-model chay TRON VONG dau
tien: pause-S146 -> resume-S146 -> ORPHAN-L can so.

H24 force-fire (P=8 pause >= 1, luat auto moi): 2 vai + h24-audit -> 7 FLAG, va het:
- sweep-consent sot 6 site (h24-audit.md:4 = frontmatter description)
- closed.md wired-but-declared-unwired (ghost-wire CHIEU NGUOC)
- owner-decision [7] BI GHI DE do tai-dung slot-index -> mat uy-quyen push
3/3 vai lane-H24 garble #53: ghi-dia-SOM cuu tron, ghi-MUON mat trang.

So: orphan run-folder 3->0 · carry 14->20 (co tag [carry:*]) · +E-013 +E-014
error-ledger · +memory feedback_absence_looks_like_clean · .gitignore +lock file.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-23 00:16:37 +07:00

30 lines
1.7 KiB
PowerShell

# wal-flush.ps1 - WAL persist-only Stop hook (H22 S111). KHONG sinh noi dung, KHONG push, KHONG block.
# Fail-open MOI nhanh: exit 0 ke ca loi (Stop-hook exit!=0 co hanh vi rieng - CAM).
# Per-path add + CAND commit (X3: add/commit da-pathspec = all-or-nothing khi 1 path vang).
try {
$root = if ($env:CLAUDE_PROJECT_DIR) { $env:CLAUDE_PROJECT_DIR } else { "." }
Set-Location $root
# INTERLOCK rebase-state (S120 W0.3). Dang rebase/mid-surgery => HEAD co the DETACHED.
# Commit len detached HEAD = mo-coi commit khi `rebase --abort` => MAT VIEC (R3 fault-inject chung minh).
# Guard nay THU HEP hook, KHONG them hanh-vi: no chan hook TU-HUY chinh floor N.2 ma no phuc-vu
# (anh ky S119 fix#8b = TRONG KHUNG, khong can adap-request).
# !! Dat SAU Set-Location: dat truoc thi Test-Path soi nham CWD (hook chay tu thu-muc bat-ky).
if ((Test-Path ".git/rebase-merge") -or (Test-Path ".git/rebase-apply")) { exit 0 }
$paths = @(".claude/WAL.md", ".claude/agent-memory/", ".claude/workflows/runs/", ".claude/sessions/")
# 4 path (S146): +.claude/sessions/ = thu-muc phien-LOGIC (session-model, hub-form session-<N>).
# Floor canonical = engine PHAN N (N.2) - B1 con-tro, KHONG dien-giai lai luat o day.
# !! GIU $paths O DUNG DONG 13: nhieu doc trich-dan "wal-flush.ps1:13" (tiep.md :23, spec, memory).
# Chen dong TREN day = lao-hoa het cac trich-dan do (class acceptance-literal-tu-lao-hoa S121).
$cand = @()
foreach ($p in $paths) {
git add -- $p 2>$null
git diff --cached --quiet -- $p 2>$null
if ($LASTEXITCODE -ne 0) { $cand += $p }
}
if ($cand.Count -gt 0) {
$ts = Get-Date -Format "yyyyMMddTHHmm"
git commit -q -m "wal: flush $ts" -- $cand 2>$null | Out-Null
}
} catch { }
exit 0