mirror of
https://fastgit.cc/github.com/Yeachan-Heo/oh-my-claudecode
synced 2026-04-30 22:01:58 +08:00
Use pathToFileURL for dynamic imports instead of raw file paths, which fixes "hook error" on Windows where backslash paths break ESM imports. Add suppressOutput: true to empty hook responses to mitigate the known Claude Code "hook error" display bug (#10936). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
35 lines
1.0 KiB
JavaScript
Executable File
35 lines
1.0 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
import { createRequire } from 'module';
|
|
const require = createRequire(import.meta.url);
|
|
import { readStdin } from './lib/stdin.mjs';
|
|
|
|
async function main() {
|
|
const action = process.argv[2]; // 'start' or 'stop'
|
|
|
|
// Read stdin (timeout-protected, see issue #240/#459)
|
|
const input = await readStdin();
|
|
|
|
try {
|
|
const data = JSON.parse(input);
|
|
const { processSubagentStart, processSubagentStop } = await import('../dist/hooks/subagent-tracker/index.js');
|
|
|
|
let result;
|
|
if (action === 'start') {
|
|
result = await processSubagentStart(data);
|
|
} else if (action === 'stop') {
|
|
result = await processSubagentStop(data);
|
|
} else {
|
|
console.error(`[subagent-tracker] Unknown action: ${action}`);
|
|
console.log(JSON.stringify({ continue: true, suppressOutput: true }));
|
|
return;
|
|
}
|
|
|
|
console.log(JSON.stringify(result));
|
|
} catch (error) {
|
|
console.error('[subagent-tracker] Error:', error.message);
|
|
console.log(JSON.stringify({ continue: true, suppressOutput: true }));
|
|
}
|
|
}
|
|
|
|
main();
|