Skip to content

Tracked Claude hooks infrastructure + line-ending normalization - #47

Merged
GodSpeed313 merged 1 commit into
mainfrom
tracked-claude-hooks
Jul 24, 2026
Merged

GodSpeed313 merged 1 commit into
mainfrom
tracked-claude-hooks

Conversation

@GodSpeed313

Copy link
Copy Markdown
Owner

What this is

The follow-up infrastructure PR scoped out of #46: Claude Code hooks move from unrecoverable local-only state to version-controlled project infrastructure (operator decision recorded in docs/scaffold_hooks_reconstruction_note.md, Resolution 2026-07-24 — "a laptop crash should not be able to erase process controls that matter to how Continuum is developed").

Structure (per the operator's specified pattern)

tools/claude-hooks/
  README.md              source-vs-installed boundary, install/verify usage
  hooks/                 canonical hook scripts + settings.template.json
  schemas/               stdin JSON contract each hook consumes + exit-code semantics
  install-hooks.ps1      Windows PowerShell 5.1; refuses to clobber customized settings without -Force
  verify-hooks.ps1       byte-identical install proof + functional smoke tests (-Full runs the real suite)

.claude/ stays local and generated — the .gitignore boundary PR #30 drew is preserved; only the hook design is tracked.

Real bug found and fixed during verification

verify-hooks.ps1's first run caught that PowerShell 5.1 pipes prepend a UTF-8 BOM to native-command stdin, which json.load rejects — so pre_bash_guard.py failed open (a guard silently not guarding). All three hooks now decode stdin as utf-8-sig, and the smoke test that caught it is a permanent part of the verifier. Verified: all checks PASS on this workstation (BOM-emitting host) and the guard still blocks under BOM-less bash pipes.

Line-ending normalization

.gitattributes (* text=auto) + renormalization of the only three CRLF blobs in HEAD (CLAUDE.md, README.md, TODO.md — stored CRLF since PR #44). This is what made git diff --check noisy on #46; it is now a permanently clean gate. *.md gets whitespace=-blank-at-eol because trailing double-space is meaningful Markdown (hard line break — README.md uses it), not accidental whitespace. The renormalization is line-ending-only; review the two doc files' content hunks and the tools/ additions.

Gates

  • pytest: 589 passed + 7 xfail at this commit
  • git diff --check --cached: clean (exit 0)
  • verify-hooks.ps1: all checks PASS
  • git status --short: exactly the intended files

🤖 Generated with Claude Code

Converts the Claude Code hooks from unrecoverable local-only state to
version-controlled project infrastructure, per operator decision
(docs/scaffold_hooks_reconstruction_note.md, Resolution 2026-07-24):
a laptop crash should not be able to erase process controls.

- tools/claude-hooks/hooks/ — canonical sources for the three hooks
  (pre-Bash destructive-command guard, post-Write/Edit targeted pytest,
  Stop-time full suite + Discord notify) plus settings.template.json.
- tools/claude-hooks/schemas/ — the stdin JSON contract each hook
  consumes, with exit-code semantics.
- install-hooks.ps1 / verify-hooks.ps1 — Windows PowerShell 5.1
  compatible; .claude/ stays local and generated (gitignored), the
  installer refuses to clobber a customized settings.json without
  -Force, and the verifier proves byte-identical installation plus
  functional smoke tests (guard blocks force-push, passes benign;
  post-edit hook no-ops out of scope; -Full runs the real suite).
- BOM hardening found by the verifier's first run: PowerShell 5.1
  pipes prepend a UTF-8 BOM to native stdin, which json.load rejects,
  so the guard failed OPEN. All hooks now decode stdin as utf-8-sig;
  the catching smoke test is part of verify-hooks.ps1.
- .gitattributes (* text=auto) + renormalization of the three CRLF
  blobs (CLAUDE.md, README.md, TODO.md — stored CRLF since PR #44),
  making git diff --check a clean gate; *.md exempts blank-at-eol
  since trailing double-space is meaningful Markdown (hard break).
- Scaffold-hooks reconstruction note closed with the resolution;
  TODO.md entry updated to point at the tracked sources.

Suite green at commit: 589 passed + 7 xfail. git diff --check: clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@GodSpeed313
GodSpeed313 merged commit 2a5597e into main Jul 24, 2026
2 checks passed
@GodSpeed313
GodSpeed313 deleted the tracked-claude-hooks branch August 2, 2026 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant