mirror of
https://github.com/JuliusBrussee/caveman.git
synced 2026-08-11 13:21:09 +02:00
When ~/.claude/package.json (or any ancestor) contains "type": "module", Node treats every .js file under that tree as an ES module. The caveman hooks use require() and crash with: ReferenceError: require is not defined in ES module scope surfaced as: SessionStart:clear hook error / UserPromptSubmit hook error Failed with non-blocking status code: .../caveman-activate.js:9 This pins the hooks directory to CommonJS via a local package.json, so module resolution no longer depends on whatever the user's ~/.claude directory declares. Also wires the new file into install/uninstall scripts so standalone installs (curl | bash / Invoke-WebRequest) copy it into ~/.claude/hooks/ alongside the JS files. Addresses the ESM sub-case flagged in #167 (comment by mrx-arafat). Does not fix the Windows path-with-spaces expansion issues in #167/#78/#72 which have a separate root cause in plugin.json ${CLAUDE_PLUGIN_ROOT} quoting.
4 lines
25 B
JSON
4 lines
25 B
JSON
{
|
|
"type": "commonjs"
|
|
}
|