Skip to content

fix: stop hook errors in projects that do not have kenkeep installed - #153

Merged
e0ipso merged 5 commits into
mainfrom
feature/70--guard-hook-commands-missing-scripts
Nov 29, 2026
Merged

e0ipso merged 5 commits into
mainfrom
feature/70--guard-hook-commands-missing-scripts

Conversation

@e0ipso

@e0ipso e0ipso commented Nov 29, 2026

Copy link
Copy Markdown
Owner

What changed

Before this change, every Claude Code, Codex or Cursor event printed a "Cannot find module" stack trace in a project that has kenkeep's hook settings but not its hook scripts. That happens in three cases:

  • kenkeep was set up in the home directory, which is how the error in the issue started.
  • A teammate cloned the repository and did not run setup yet.
  • Someone deleted kenkeep's folder by hand.

Now each hook first checks that its script exists. If the script is missing, the hook does nothing and prints nothing. If the script exists, the hook runs as before. Copilot hooks already worked this way.

Setup now prints a warning when you run it in your home directory, because settings there can apply to every project. Setup still finishes.

An upgrade replaces old kenkeep hook entries with the new form and keeps hooks you added yourself. The installation guide now says two things. Hooks stay quiet until a teammate runs setup. Hook settings that an older kenkeep committed still show the error until a maintainer runs the upgrade and commits the result.

Closes #152

How to test

  1. In a new git repository, run kenkeep init for Claude Code, Codex and Cursor. Start a session in one of them. Capture works as before, and kenkeep doctor passes.
  2. Delete the installed hook scripts in the .ai/kenkeep/hooks folder. Start a session again. No error appears. kenkeep doctor reports the missing scripts.
  3. Run kenkeep init again. kenkeep doctor passes again.
  4. Make an empty folder that is not a git repository. Set your home directory to that folder and run kenkeep init --harnesses claude from it. A warning about the home directory appears, and setup finishes.

e0ipso and others added 5 commits November 29, 2026 07:35
Codex now finds kenkeep-owned hook commands by path marker, the same
as Claude and Cursor, so upgrades replace guarded and unguarded forms
without duplicates. init warns when the root is the home directory,
where .claude/settings.json is Claude Code's user-scope settings.

Refs #152

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude, Codex and Cursor hook commands now run node only when the hook
script exists, and exit 0 with no output otherwise, the same as
Copilot. This removes the MODULE_NOT_FOUND trace in projects that have
the registrations but not the scripts. Codex and Cursor wrap the guard
in sh -c, because Codex runs hooks through $SHELL, which may not be
POSIX, and Cursor does not document its shell.

Fixes #152

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The init warning now names the required --harnesses option and does
not claim Claude settings were written for other harnesses. The
installation docs say that host configs committed by an older kenkeep
still error until a maintainer runs init --upgrade.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@e0ipso
e0ipso merged commit d857db7 into main Nov 29, 2026
1 check passed
github-actions Bot pushed a commit that referenced this pull request Nov 29, 2026
## [1.20.1](v1.20.0...v1.20.1) (2026-11-29)

### Bug Fixes

* stop hook errors in projects that do not have kenkeep installed ([#153](#153)) ([d857db7](d857db7)), closes [#152](#152)
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.20.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Kenkeep when not using it for all projects

1 participant