fix(init): quote cce binary path in SessionStart hook command - #146
Merged
Conversation
On Windows, cce init writes an unquoted backslash path into settings.local.json. Bash interprets unquoted backslashes as escape characters, collapsing the path and producing "command not found" on every session start. Reuse the existing _quote_hook_path helper (already used by the settings.json lifecycle hooks) to properly quote the path. This helper handles both POSIX (shlex.quote) and Windows (cmd-style double quotes) correctly.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes Windows session startup failures caused by an unquoted cce binary path written into .claude/settings.local.json by cce init, by reusing the existing cross-platform hook-path quoting helper.
Changes:
- Import and reuse
context_engine.memory.hook_installer._quote_hook_pathwhen generating theSessionStart“cce status” hook command. - Quote the resolved
ccebinary path before appendingstatus --onelineso Git Bash doesn’t treat backslashes as escapes.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fazleelahhee
approved these changes
Jul 28, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
src/context_engine/cli.py:429
- The idempotency check uses marker "cce status", but the command uses an absolute binary path (now also quoted), so the substring "cce status" typically won’t be present (e.g. ".../cce" or "cce.exe"), causing
cce initto append duplicate SessionStart hooks on subsequent runs (especially on Windows). Use a marker that matches the stable suffix of the hook command instead (e.g. "status --oneline").
session_hooks = hooks.setdefault("SessionStart", [])
if not _has_cce_hook(session_hooks, "cce status"):
session_hooks.append({
"matcher": "",
"hooks": [{"type": "command", "command": f"{_quote_hook_path(Path(cce_cmd))} status --oneline"}],
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
Fixes #145. On Windows,
cce initwrites an unquoted backslash path into.claude/settings.local.json:Claude Code runs hook commands through bash (Git Bash on Windows), which interprets unquoted backslashes as escape characters. The path collapses to
C:Usersfahmid.localbincce.exeand every session start fails with "command not found."The fix reuses the existing
_quote_hook_pathhelper fromhook_installer.py(already used by thesettings.jsonlifecycle hooks) to properly quote the path. This helper handles both POSIX (shlex.quote) and Windows (cmd-style double quotes).One-line change. Existing projects need to re-run
cce init --agent claude(or manually quote the path insettings.local.json) to pick up the fix.