codemap
codemap copied to clipboard
hooks: UserPromptSubmit nags config-setup in non-git dirs (e.g. $HOME); add a root allowlist
What happens
codemap 4.6.0, when Claude Code starts in a directory that isn't a git repo (for example $HOME):
- The SessionStart hook says it's skipping:
📍 Not a git repository - skipping project context. - The UserPromptSubmit hook still runs on every prompt anyway. Each time it emits the intent/skills comments,
check-depssuggestions, and this blocking line:
🛑 Codemap setup is not finished. Before continuing the user's task: run `codemap skill show config-setup`, tune .codemap/config.json, rerun `codemap .`, then proceed.
This tells the agent to create .codemap/config.json in a directory that is not a project. In $HOME it means writing config into the home directory. The agent has to ignore the same instruction on every turn of the session.
Expected
If codemap has decided a directory isn't a project, every hook should stay quiet for that session, not just SessionStart.
Proposal
- Gate the prompt hooks the same way SessionStart is gated. When there is no git repo and no
.codemap/config.json, emit nothing: no 🛑, no suggestions. - Add an allowlist (and optionally a denylist) of roots in user-level config, for example
~/.config/codemap/config.json:
Hooks only fire inside allowed roots. A denied path such as{ "roots": { "allow": ["~/code", "~/work"], "deny": ["~", "/tmp"] } }$HOMEitself never triggers setup nags, even if someone runsgit initthere. - Make the config-setup 🛑 advisory outside a repo. It should never be phrased as a blocking "before continuing the user's task" instruction when there's no project to configure.
Repro
cd ~ # not a git repo
claude # with codemap hooks installed
# SessionStart: "Not a git repository - skipping project context"
# send any prompt -> UserPromptSubmit emits the config-setup 🛑