Skip to content

fix(config): add migration 008 to fix backslash paths in installed hooks - #551

Open
oleksii-hryshyn wants to merge 1 commit into
codemie-ai:mainfrom
oleksii-hryshyn:EPMCDME-14762_migration-008-fix-windows-hook-slashes
Open

fix(config): add migration 008 to fix backslash paths in installed hooks#551
oleksii-hryshyn wants to merge 1 commit into
codemie-ai:mainfrom
oleksii-hryshyn:EPMCDME-14762_migration-008-fix-windows-hook-slashes

Conversation

@oleksii-hryshyn

Copy link
Copy Markdown
Contributor

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 \X sequences as escape codes, so C:\Users\...\codemie.cmd becomes C:Users...codemie.cmd at runtime, causing every hook to fail with command not found.

Changes

  • src/utils/hook-command.ts: export new fixCommandTreeSlashes(node) that walks the hooks tree and applies toForwardSlash() to any command field containing a backslash
  • src/migrations/008-fix-windows-hook-path-slashes.migration.ts: new one-shot migration that reads both Claude and Gemini hooks.json, calls fixCommandTreeSlashes, and writes back only if something changed; returns { success: false } on write failure so transient errors are retried
  • src/migrations/index.ts: registers migration 008

Why a migration instead of relying on codemie install claude

Migration 006 already ran and is marked applied for affected users, so it will not re-run. Even if it did, rewriteHooksCommandTree only rewrites commands starting with codemie — not already-absolute backslash paths. And the plugin version was not bumped in the fix release, so installer.install() sees already_exists and skips localizeInstalledHooks.

Testing

  • Build passes (npm run build) ✅
  • Lint clean, typecheck clean, secrets scan clean ✅ (all pre-commit hooks passed)
  • Manual: on a Windows machine with a backslash-path hooks.json, first codemie run after update applies the migration and hooks execute correctly

Checklist

  • Code follows project standards
  • CI is green (npm run ci)
  • No merge conflicts with main

Refs: EPMCDME-14762

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
@8nevil8

8nevil8 commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

we should update plugin version and bring hooks there. it suppose to replace existing hooks. migration is not applicable here

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants