Skip to content

Fix stop-gate infinite loop on large TS projects + README rewrite - #35

Merged
5uck1ess merged 3 commits into
mainfrom
fix/stop-gate-ts-loop-and-readme
Apr 9, 2026
Merged

Fix stop-gate infinite loop on large TS projects + README rewrite#35
5uck1ess merged 3 commits into
mainfrom
fix/stop-gate-ts-loop-and-readme

Conversation

@5uck1ess

@5uck1ess 5uck1ess commented Apr 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • stop-gate.sh: Fixed infinite loop where the TypeScript phase ran tsc --noEmit against the entire project, blocking on pre-existing errors in untouched files. Now filters output to only changed files via grep -F, matching the pattern the Python/ruff phase already uses.
  • README.md: Rewritten from 567 to 323 lines. Install instructions consolidated into one numbered section at the top with copy-pasteable commands.

The bug

In repos with many pre-existing TS errors (e.g., 757), the stop-gate hook would:

  1. Run npx tsc --noEmit on the whole project
  2. Show 5 errors (from untouched files)
  3. Claude fixes those 5
  4. 5 more pre-existing errors appear
  5. Infinite loop — the agent can never finish

The Python/ruff phase already had the right pattern — filter errors to $CHANGED_FILES. The TS phase was missing this.

Test plan

  • bash -n hooks/stop-gate.sh — syntax valid
  • Verified grep -F -f <(changed files) correctly filters tsc output to only changed files
  • Pre-existing errors in untouched files no longer appear in filtered output
  • README renders correctly with all install commands

5uck1ess added 3 commits April 9, 2026 16:55
stop-gate.sh: The TypeScript phase ran `npx tsc --noEmit` against the
entire project but did not filter output to changed files. In repos with
hundreds of pre-existing TS errors, this blocked every Stop event with
5 errors at a time — Claude fixed those, then 5 more appeared, forever.

Fix: filter tsc error output through `grep -F` against $CHANGED_FILES,
matching the pattern the Python/ruff phase already uses. Pre-existing
errors in untouched files no longer block the agent.

README.md: Rewritten from 567 to 323 lines. Install instructions are
now a single numbered section at the top (was scattered across 3
places). Each plugin install is a copy-pasteable command. Removed the
ASCII art diagram, empty presets section, and roadmap changelog.
Tri-review consensus (Claude + Codex + Gemini):
- grep -F substring matching caused false positives (button.tsx matching
  icon-button.tsx). Now extracts path before "(" and uses grep -Fx for
  exact line matching.
- tsc exit code was silently discarded by || true. Restored TSC_EXIT
  check so tsc crashes (OOM, missing tsconfig) don't silently pass.
- Replaced echo with printf to avoid -e/-n flag interpretation.
- Consistent [ ] brackets matching surrounding code sections.
- Add tr -d '\r' to path extraction in stop-gate.sh TypeScript phase.
  Windows/cross-platform tsc output may include carriage returns that
  break grep -Fx exact matching.
- Update README test count: 141 tests across 6 packages (was "100+
  across 5").
@5uck1ess
5uck1ess merged commit ab27e9a into main Apr 9, 2026
3 checks passed
@5uck1ess
5uck1ess deleted the fix/stop-gate-ts-loop-and-readme branch April 9, 2026 21:05
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