Skip to content

refactor(hooks): extract gate detection into invocable-command lib (U5a — PR3) - #46

Merged
dralgorhythm merged 1 commit into
mainfrom
claude/hardening-pr3-gates-extract
Jul 24, 2026
Merged

refactor(hooks): extract gate detection into invocable-command lib (U5a — PR3)#46
dralgorhythm merged 1 commit into
mainfrom
claude/hardening-pr3-gates-extract

Conversation

@dralgorhythm

Copy link
Copy Markdown
Owner

Summary

U5a (PR3, gates lane 1 of 3) from plan_framework_hardening.md: pure-structure extraction of gate detection into an invocable-command library. Zero behavior change — the prerequisite for PR4's blocking enforcement (U5b) and PR5's default task gate (U5c), which branch from main after this merges.

What changed

  • New .claude/hooks/gate-lib.sh (108 LOC): gate_lib_detect(dir) fills parallel GATE_LABELS/GATE_COMMANDS arrays with runnable per-stack gate commands (TS/JS pnpm/npm-aware, Python uv-aware, Go, Rust) — today's inline block produced display labels only.
  • pre-commit-verification.sh: sources the lib (BASH_SOURCE-relative, CWD-independent) and reconstructs its advisory output from the lib — byte-identical: old-vs-new stdout diffed empty across five fixture contexts (TS/pnpm, TS/npm, Python, Go, Rust); the untouched baseline harness case also passes.
  • Lib commands proven invocable: the detected pnpm test in scripts/fixtures/failing-project executes and returns the fixture's deliberate nonzero.

Provenance

  • Author: worker-builder (sonnet) via /swarm-execute, refactoring focus (Two Hats: structure only); orchestrator re-ran all gates independently on the lane tip.
  • Gates: test-hooks.sh ALL GREEN (no skips); check-invariants.sh ALL GREEN; CI-equivalent shellcheck clean; bash -n clean.

Risk tier

low — behavior-identity is the acceptance criterion and is byte-diff proven; no wiring, docs, or settings changes (deliberately deferred to U5b/U5c).

Test plan

  • Old-vs-new advisory stdout byte-identical across five stack fixtures
  • Baseline harness case for this hook passes unedited
  • Lib-derived command smoke-executed in the failing fixture (nonzero as designed)

🤖 Generated with Claude Code

@dralgorhythm
dralgorhythm merged commit c1e2ed5 into main Jul 24, 2026
5 checks passed
@dralgorhythm
dralgorhythm deleted the claude/hardening-pr3-gates-extract branch July 24, 2026 16:19
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