mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-06-30 19:00:57 +08:00
* fix(hooks): guard doc-file-warning stdin listeners behind require.main doc-file-warning.js registered process.stdin data/end listeners at module scope while also exporting run(). run-with-flags.js require()s any hook that exports run() for its in-process fast path, so importing this hook attached stray stdin listeners to the dispatcher process, corrupting the PreToolUse stdout JSON contract. This is the exact failure run-with-flags' own SAFETY comment warns about, and 24 sibling hooks already guard against it. - Move the stdin entrypoint into main() and gate it behind require.main === module - pre-write-doc-warn.js now calls main() explicitly instead of relying on the import side effect - Add regression tests: require() attaches no stdin listeners, run()/main() stay exported, and the pre-write-doc-warn shim still warns * docs(hooks): add JSDoc for doc-file-warning main() entrypoint Satisfies the docstring-coverage pre-merge check; documents the stdin entrypoint and why it must not run on require().
11 lines
308 B
JavaScript
11 lines
308 B
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Backward-compatible doc warning hook entrypoint.
|
|
* Kept for consumers that still reference pre-write-doc-warn.js directly.
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
// doc-file-warning.js guards its stdin entrypoint behind require.main; call main() explicitly.
|
|
require('./doc-file-warning.js').main();
|