Files
oh-my-claudecode/scripts/project-memory-precompact.mjs
Yeachan-Heo fb6828562c fix(hooks): improve Windows compatibility for hook scripts (#524)
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>
2026-02-11 00:36:22 +00:00

34 lines
706 B
JavaScript
Executable File

#!/usr/bin/env node
/**
* PreCompact Hook: Project Memory Preservation
* Ensures user directives and project context survive compaction
*/
import { processPreCompact } from '../dist/hooks/project-memory/pre-compact.js';
import { readStdin } from './lib/stdin.mjs';
/**
* Main hook execution
*/
async function main() {
try {
const input = await readStdin();
const data = JSON.parse(input);
// Process PreCompact
const result = await processPreCompact(data);
// Return result
console.log(JSON.stringify(result));
} catch (error) {
// Always continue on error
console.log(JSON.stringify({
continue: true,
suppressOutput: true,
}));
}
}
main();