everything-claude-code-hooks · lens architecture · 2 open findings at severity must or above (plus f-0001 resolved upstream in #3775) · generated 2026-10-30T12:58:01.547Z
Work top to bottom. Ponder does not edit source - this plan is the handoff.
hooks.config_protectionscripts/hooks/config-protection.js
process.stdin.setEncoding("utf8"), process.stdin.on("data", ...), and process.stdin.on("end", ...) at module top level without guarding behind if (require.main === module) (unlike stop-format-typecheck.js and quality-gate.js). When tests/hooks/hook-input.test.js:10 requires config-protection.js with an open stdin descriptor, the process hangs after finishing all assertions because the leaked stdin data listener keeps the Node.js event loop alive. When required in-process before stdin closes, the top-level end listener also races the caller by writing raw stdin to stdout or calling process.exit(2).
Evidence: scripts/hooks/config-protection.js:215-243, scripts/hooks/post-edit-typecheck.js:17-105, tests/hooks/hook-input.test.js:10
Do: Wrap the CLI stdin fallback in both scripts/hooks/config-protection.js and scripts/hooks/post-edit-typecheck.js inside if (require.main === module), and verify in tests/hooks/config-protection.test.js and tests/hooks/post-edit-typecheck.test.js that process.stdin.listenerCount("data") and process.stdin.listenerCount("end") remain unchanged across require().hooks.post_edit_typecheckscripts/hooks/post-edit-typecheck.js
stop-format-typecheck.js:135-143 parses the leading file path from tsc --pretty false diagnostics (diagnosticMatchesFile), post-edit-typecheck.js:84-86 checks if (line.includes(candidate)) return true. When editing root index.ts (relPath = "index.ts"), line.includes("index.ts") matches diagnostics from src/index.ts(1,14): error TS2322 and other-index.ts. Conversely, on Windows where filePath, resolvedPath, and relPath use backslashes (src\index.ts) while tsc outputs forward slashes (src/index.ts(1,14)), line.includes(candidate) fails to match any candidate.
Evidence: scripts/hooks/post-edit-typecheck.js:79-89, scripts/hooks/stop-format-typecheck.js:135-143
Do: In scripts/hooks/post-edit-typecheck.js, extract diagnostic file headers via diagnosticMatchesFile(line, candidates), normalize \\ to / and strip leading ./, split output on /\r?\n/, export diagnosticMatchesFile, and add unit tests in tests/hooks/post-edit-typecheck.test.js.2 modules · 2 open findings (f-0001 MultiEdit resolved upstream in #3775) · effort 1xxs, 1xs
Generated by Ponder - AI that knows when to speak, and when to shut up.