Consolidate hooks: language-universal support, 14 → 9 hooks - #16
Merged
Conversation
lang-review.sh (replaces go-review.sh + go-nil-return.sh + shell-compat.sh): - Detects language from file extension, runs appropriate checks - Go: error-path access, map races, nil-error returns, filepath traversal - TypeScript: empty catch blocks, any-type, unhandled promises - Rust: unwrap in non-test, let _ = discard, unsafe blocks - Python: bare except, pass-in-except, mutable default args - Shell: macOS portability (grep -P, sed -i, readlink -f, timeout, etc.) stop-gate.sh (replaces dirty-bit.sh + go-vet-stop.sh + old stop-gate.sh): - Phase 1: merge conflict detection - Phase 2: cross-domain test evidence (dirty-bit logic) - Phase 3: language-specific vet/lint (go vet, clippy, tsc, ruff) hooks.json: 14 entries → 9, per-edit processes 7 → 4 README: updated hook tables, repo structure, roadmap items checked off
lang-review.sh:
- Rewrite awk error-path scanner: proper brace depth tracking,
matched variable instead of broken END{exit 1} (Claude + Codex)
- Replace \s with [[:space:]] in awk regexes for POSIX compat (Codex)
stop-gate.sh:
- Fix GO_PKGS: strip module-relative prefix, add ./ prefix for
go test resolution (Claude critical)
- Skip cross-domain check when transcript is empty — prevents
false blocks when hook input lacks transcript field (Claude)
- Gate Go vet/test behind `command -v go` check (Codex)
- Add || true to TSC grep to prevent set -e abort (Codex)
- Non-race test failures no longer silently approved (Codex)
Both hooks now guarantee JSON output even on unexpected failures:
lang-review.sh:
- Remove set -e, add trap 'exit 0' ERR — hook exits cleanly on crash
- Guard jq calls with 2>/dev/null || true for malformed input
- Fix awk exit code masking: use && true || false pattern instead
of $? check that set -e would intercept
stop-gate.sh:
- Remove set -e, add trap that emits {"decision":"approve"} on ERR
- Guard jq/cat calls for empty/malformed input
- Stop hooks MUST return JSON — a crash with no output violates
the hook contract and hangs the harness
Found by silent-failure-hunter agent.
5uck1ess
added a commit
that referenced
this pull request
Apr 5, 2026
…te.sh Removed: dirty-bit.sh, go-nil-return.sh, go-review.sh, go-vet-stop.sh, shell-compat.sh. All were consolidated in PR #16 but the files were kept. None are registered in hooks.json. Updated README architecture diagram to reference current hook names.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
lang-review.sh— replacesgo-review.sh,go-nil-return.sh, andshell-compat.shwith a single language-aware hook. Detects language from file extension and runs the appropriate quality checks for Go, TypeScript, Rust, Python, and Shell.stop-gate.sh— replacesdirty-bit.sh,go-vet-stop.sh, and the oldstop-gate.shwith a consolidated quality gate. Handles merge conflict detection, cross-domain test evidence, and language-specific vet/lint (go vet, clippy, tsc, ruff).go-review.sh,go-nil-return.sh,go-vet-stop.sh,dirty-bit.sh,shell-compat.sh) remain in the repo for reference but are no longer registered.Test plan
bash -nsyntax validation.gofile → lang-review fires with Go checks.tsfile → lang-review fires with TS checks.shfile → lang-review catchesgrep -P