Repository navigation
fix: install/uninstall-hooks merge per event, keep foreign hooks (GIT-120) - #55
Merged
1 commit merged intoSep 23, 2026
Merged
1 commit merged into
1 commit merged into
Conversation
…ooks (GIT-120) install-hooks replaced settings.hooks wholesale and uninstall-hooks deleted the key, so users' own hooks were lost. Both now work per event and per command: only commands gitmem installed are replaced or removed, a matcher group keeps its other commands, events install-hooks does not manage stay untouched, the file is backed up before every write, and the output lists what changed. An unparseable file is no longer overwritten "fresh". gitmem detection matches gitmem's script paths instead of any "gitmem" substring, which made a foreign hook under a gitmem-named directory look like an existing install. Tests: new CLI e2e (9) with foreign hooks present, wired into CI. Two cli-fresh-install assertions that pinned the old wipe are updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Sep 23, 2026
neoneye
pushed a commit
to agent-memory-atlas-archive/gitmem-dev--gitmem
that referenced
this pull request
Sep 24, 2026
…ig + hooks (GIT-115) init seeded <cwd>/.gitmem while the server reads ~/.gitmem (GIT-91), so a fresh install had no starter lessons and was told its store was "NOT being read". The wizard and init-scars now seed learnings, threads, collections and the closing payload + template into the root the server reads (GITMEM_DIR, then GITMEM_HOME/.gitmem, then ~/.gitmem). The repo's .gitmem/ keeps only config.json (project name) and the hook scripts. - A repo .gitmem/ with only config.json and hooks, or only what an older init seeded, is not a stranded store. Real records (a user's learning, thread or decision) now count, which main did not check at all. - The SessionStart hook reads the repo's project name without jq (node). - uninstall removes the repo's config.json and hooks; the shared store is kept unless --all or the user says delete. Hook removal and the wizard's hook merge use the GIT-120 module (bin/hooks-merge.js, identical to gitmem-dev#55). - telemetry commands use the server's root. Tests: fresh-install e2e in a clean HOME (9, all fail on main), unit +5, hook suite +1. cli-fresh-install made hermetic (scratch HOME) and repaired; both e2e files wired into CI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GIT-120: install-hooks and uninstall-hooks keep foreign hooks
Just upgrade the package. Nothing to change on your database. No store involvement.
What was wrong
install-hooksreplacedsettings.hookswholesale, anduninstall-hooksdeleted the key. Every hook a user or another tool had configured was lost.gitmemsubstring. A foreign hook such asbash ~/code/gitmem-notes/lint.shmade main skip the install entirely.settings.jsonwas replaced with a fresh file.install-hooksalso replacedhookswholesale.Fix (
bin/hooks-merge.js, used bybin/gitmem.js)gitmem initinstalls..gitmem/hooks/*.sh,gitmem-mcp/hooks/scripts/*.sh, legacygitmem-hooks).<file>.gitmem-backup-<timestamp>before each write. The output lists the change per event and the backup path.hooksvalue of the wrong shape, exits 1 with "Nothing was changed"..claude/settings.jsonand Cursor.cursor/hooks.json.Evidence
New CLI e2e
tests/e2e/git-120-hooks-merge.test.tsruns the real CLI in a scratch repo with foreign hooks. It is wired into CI next to the GIT-89 step.tsc clean. Unit 1357, unchanged.
Old-behaviour tests changed
tests/e2e/cli-fresh-install.test.tspinned the wipe:echo oldhook to survive.hooksundefined. It now expects onlyecho oldto remain.Two other tests in that file fail on main and on this branch alike: "gitmem init creates .gitmem/ with starter scars" and "session-close-check.sh ceremony wording". That file is not in CI yet; wiring it is part of GIT-115.
Not changed, flagged
bin/init-wizard.jsandbin/uninstall.jsstill match hooks by a baregitmemsubstring and drop whole matcher groups. That can remove a foreign command that shares a group. They are left for GIT-115, which reworks the wizard.install-hooksinstalls no UserPromptSubmit hook, butgitmem initdoes. The two hook sets differ.uninstall-hooksstill clears/tmp/gitmem-hooks-*machine-wide. That is existing behaviour, and the e2e exercises it.🤖 Generated with Claude Code