Skip to content

fix(context-timeline): cross-platform path encoding#550

Merged
davila7 merged 1 commit into
davila7:mainfrom
schizoidcock:fix/windows-path-encoding
Apr 28, 2026
Merged

fix(context-timeline): cross-platform path encoding#550
davila7 merged 1 commit into
davila7:mainfrom
schizoidcock:fix/windows-path-encoding

Conversation

@schizoidcock
Copy link
Copy Markdown
Contributor

@schizoidcock schizoidcock commented Apr 27, 2026

Summary

Fix _encode_cwd function to work on Windows and any other platform.

Problem

The original implementation only replaced / with -:

return cwd.replace("/", "-")

This fails on Windows where paths use \ as separator and include drive letters like D:.

Solution

Use regex to replace any non-alphanumeric character:

return re.sub(r"[^a-zA-Z0-9]", "-", os.path.normpath(os.path.abspath(cwd)))

Before/After

Platform Input Before After
Windows D:\Claude\mcx Lookup failed D--Claude-mcx
Unix /home/user/mcx -home-user-mcx -home-user-mcx

Test plan

  • Tested on Windows 11 with Claude Code
  • Verified the encoded path matches Claude Code project directory naming

Summary by cubic

Fix cross-platform path encoding in the context timeline so transcript lookup works on Windows and Unix. _encode_cwd now normalizes the path and replaces all non-alphanumeric characters with "-" to match Claude Code project naming.

  • Bug Fixes
    • Replaced slash-only logic with regex over normalized absolute path; Windows paths like D:... now encode correctly; Unix behavior unchanged.
    • Area: components (cli-tool/components/); updated hooks/monitoring/context-timeline.py.
    • No new components; catalog (docs/components.json) unchanged.
    • No new environment variables or secrets.

Written for commit 4ebeb08. Summary will update on new commits. Review in cubic

…okup

The `_encode_cwd` function only replaced `/` with `-`, which fails on
Windows where paths use `\` and include drive letters like `D:`.

Use regex to replace any non-alphanumeric character with `-`.
This handles all edge cases across platforms in a single expression.

Before: D:\Claude\mcx -> lookup failed
After:  D:\Claude\mcx -> D--Claude-mcx (matches Claude Code encoding)
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 27, 2026

@schizoidcock is attempting to deploy a commit to the Daniel Avila's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the review-pending Component PR awaiting maintainer review label Apr 27, 2026
@github-actions
Copy link
Copy Markdown
Contributor

👋 Thanks for contributing, @schizoidcock!

This PR touches cli-tool/components/** and has been marked review-pending.

What happens next

  1. 🤖 Automated security audit runs and posts results on this PR.
  2. 👀 Maintainer review — a human reviewer validates the component with the component-reviewer agent (format, naming, security, clarity).
  3. Merge — once approved, your PR is merged to main.
  4. 📦 Catalog regeneration — the component catalog is rebuilt automatically.
  5. 🚀 Live on aitmpl.com — your component appears on the website after deploy.

While you wait

  • Check the Security Audit comment below for any issues to fix.
  • Make sure your component follows the contribution guide.

This is an automated message. No action is required from you right now — a maintainer will review soon.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

@davila7 davila7 merged commit e11ff2e into davila7:main Apr 28, 2026
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review-pending Component PR awaiting maintainer review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants