fix(config): add migration 008 to fix backslash paths in installed hooks - #551
Open
oleksii-hryshyn wants to merge 1 commit into
Conversation
Migration 006 wrote absolute Windows paths with backslashes into hooks.json. Bash (Git Bash / WSL) consumes \X as escape sequences, so C:\Users\...\codemie.cmd silently became C:Users...codemie.cmd and every hook fired with `command not found`. Migration 008 walks both Claude and Gemini hooks.json files and applies toForwardSlash() to any command field that still contains a backslash, healing existing installs without requiring a reinstall. The helper fixCommandTreeSlashes() is exported from hook-command.ts so it can be reused if other paths surface the same issue. Refs: EPMCDME-14762
Collaborator
|
we should update plugin version and bring hooks there. it suppose to replace existing hooks. migration is not applicable here |
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.
Summary
Migration 008 heals already-installed Claude and Gemini hooks.json files that contain Windows backslash paths written by migration 006. Bash (Git Bash / WSL) silently consumes
\Xsequences as escape codes, soC:\Users\...\codemie.cmdbecomesC:Users...codemie.cmdat runtime, causing every hook to fail withcommand not found.Changes
src/utils/hook-command.ts: export newfixCommandTreeSlashes(node)that walks the hooks tree and appliestoForwardSlash()to anycommandfield containing a backslashsrc/migrations/008-fix-windows-hook-path-slashes.migration.ts: new one-shot migration that reads both Claude and Gemini hooks.json, callsfixCommandTreeSlashes, and writes back only if something changed; returns{ success: false }on write failure so transient errors are retriedsrc/migrations/index.ts: registers migration 008Why a migration instead of relying on
codemie install claudeMigration 006 already ran and is marked applied for affected users, so it will not re-run. Even if it did,
rewriteHooksCommandTreeonly rewrites commands starting withcodemie— not already-absolute backslash paths. And the plugin version was not bumped in the fix release, soinstaller.install()seesalready_existsand skipslocalizeInstalledHooks.Testing
npm run build) ✅codemierun after update applies the migration and hooks execute correctlyChecklist
npm run ci)mainRefs: EPMCDME-14762