Skip to content

fix: encode colons and dots in session-context project path#130

Merged
rhuanbarreto merged 1 commit into
mainfrom
fix/session-context-path-encoding
Mar 21, 2026
Merged

fix: encode colons and dots in session-context project path#130
rhuanbarreto merged 1 commit into
mainfrom
fix/session-context-path-encoding

Conversation

@rhuanbarreto

Copy link
Copy Markdown
Contributor

Summary

  • encodeProjectPath() only replaced \ and / with -, but Claude Code and Cursor also replace : and . when creating project session directories under ~/.claude/projects/
  • On Windows, session-context claude-code would look for E:-archgate-cli-.claude-worktrees-x instead of the actual E--archgate-cli--claude-worktrees-x, causing "No session files found"
  • Added : and . to the replacement set to match the editor's encoding, and documented the full character mapping in JSDoc

Test plan

  • Existing encodeProjectPath tests updated — Windows path now expects C--Users-user-project (colon replaced)
  • New test: dots replaced (/home/user/.config/project-home-user--config-project)
  • New test: exact Windows worktree path (E:\archgate\cli\.claude\worktrees\fancy-prancing-sedgewick) encodes correctly
  • Test fixtures in session-context.test.ts and session-context-cursor.test.ts use the updated encoding
  • bun run validate passes (457 tests, 21/21 ADR checks)

`encodeProjectPath` only replaced `\` and `/` with `-`, but Claude Code
and Cursor also replace `:` and `.`. On Windows, this caused
`session-context claude-code` to look up a directory like
`E:-archgate-cli-.claude-worktrees-x` instead of the actual
`E--archgate-cli--claude-worktrees-x`, resulting in "No session files
found".

Add `:` and `.` to the replacement set and update tests to cover the
exact Windows worktree scenario that was failing.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying archgate-cli with  Cloudflare Pages  Cloudflare Pages

Latest commit: 37ae0d5
Status: ✅  Deploy successful!
Preview URL: https://1ceaf85e.archgate-cli.pages.dev
Branch Preview URL: https://fix-session-context-path-enc.archgate-cli.pages.dev

View logs

@rhuanbarreto rhuanbarreto merged commit 262a172 into main Mar 21, 2026
8 checks passed
@rhuanbarreto rhuanbarreto deleted the fix/session-context-path-encoding branch March 21, 2026 23:13
@github-actions github-actions Bot mentioned this pull request Mar 21, 2026
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.

1 participant