Skip to content

install.sh / install.ps1 omit caveman-parse.js — standalone hook install exits 1 on every prompt #801

Description

@prpr289

The two standalone hook installers copy a file list that omits caveman-parse.js, which caveman-mode-tracker.js requires at module load. Anyone who installs hooks via install.sh / install.ps1 — rather than the plugin or cli/install.js — ends up with a UserPromptSubmit hook that exits 1 on every prompt.

Affected

src/hooks/install.ps1 L27:

$HookFiles = @("package.json", "caveman-config.js", "caveman-activate.js", "caveman-mode-tracker.js", "caveman-stats.js", "caveman-statusline.sh", "caveman-statusline.ps1", "cavecrew-model-overrides.js")

src/hooks/install.sh L40 has the same omission.

src/hooks/caveman-mode-tracker.js L10:

const { parseModeChange, INDEPENDENT_MODES } = require('./caveman-parse');

That is a top-level require, so it throws before the try/catch inside the stdin end handler. The "Hooks must always exit 0" guarantee in the L20-23 comment does not hold for this failure mode.

Reproduction

Copy exactly the 8 files install.ps1 lists into an empty directory, then:

echo '{"prompt":"hello","cwd":"C:/"}' | node caveman-mode-tracker.js
Error: Cannot find module './caveman-parse'
Require stack:
...

exit code 1.

Control: same directory with caveman-parse.js added, same command, exit code 0 and no output.

Environment: Windows 11, Node v24.15.0, repo at ec83e5b.

Not affected

cli/install.js L51 already lists caveman-parse.js, and the plugin path wires hooks from .claude-plugin/plugin.json against the repo tree. Both are fine — only the two shell installers are broken.

Secondary issue in the same files

install.ps1 L25 and install.sh L38 set the remote fallback base to .../main/hooks, but the hooks live under src/hooks/. There is no top-level hooks/ directory, so when either script runs outside a clone, every file in the copy loop 404s:

$ curl -sI https://raw.githubusercontent.com/JuliusBrussee/caveman/main/hooks/caveman-config.js
HTTP/2 404

Suggested fix

Add caveman-parse.js to both file lists, and point the fallback base at main/src/hooks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions