Skip to content

fix: decode dots and dashes in encoded project paths#14

Open
alex-reilly-dd wants to merge 2 commits intovtemian:mainfrom
alex-reilly-dd:fix/decode-dots-in-paths
Open

fix: decode dots and dashes in encoded project paths#14
alex-reilly-dd wants to merge 2 commits intovtemian:mainfrom
alex-reilly-dd:fix/decode-dots-in-paths

Conversation

@alex-reilly-dd
Copy link

@alex-reilly-dd alex-reilly-dd commented Mar 6, 2026

Summary

  • Fix path decoding that incorrectly turned dotted usernames (e.g., alex.reilly) into path separators (alex/reilly)
  • Replace the old decoder with a filesystem-aware greedy algorithm that resolves ambiguous - characters by checking candidate paths against the filesystem
  • Handle hidden directories (.claude), literal dashes (memory-daemon), and dotted names correctly
  • Fix the encoder to also replace . with - to match Claude Code's actual encoding behavior

Problem

Claude Code encodes folder paths by replacing /, ., and keeping literal - all as -. The old decoder assumed -- was a literal dash and - was always /, which broke paths containing dots (e.g., usernames like alex.reillyalex/reilly).

Test plan

  • uv run claude-notes list-projects shows correct paths with dots, hidden dirs, and literal dashes
  • uv run claude-notes show ~ --format html works correctly with the new encoding
  • make test passes
  • uv run ruff check passes

🤖 Generated with Claude Code


Summary by cubic

Fix decoding of Claude Code–encoded project paths so dotted names, hidden dirs, and literal dashes (including consecutive “--”) resolve correctly. Replaces the decoder with a filesystem-aware greedy algorithm and updates the encoder to replace '.' with '-' for consistency.

  • Bug Fixes
    • Correctly decodes dotted usernames (e.g., alex.reilly), hidden dirs (.claude), and names with literal dashes (memory-daemon); resolves consecutive “--” as either “/.” or a literal “-” when the filesystem matches.
    • Uses filesystem checks to choose whether each “-” is “/”, “.”, or a literal “-”; falls back to simple “-”→separator decoding on Windows.
    • Aligns encoder with Claude Code by converting both “/” and “.” to “-” while leaving literal “-” unchanged.

Written for commit 3616860. Summary will update on new commits.

Claude Code encodes folder paths by replacing '/', '.', and literal '-'
all as '-', making the encoding lossy. The previous decoder assumed '--'
meant a literal dash and single '-' meant '/', which incorrectly turned
dotted usernames like 'alex.reilly' into 'alex/reilly'.

Replace the decoder with a filesystem-aware greedy algorithm that splits
on every '-' and checks candidate path prefixes against the filesystem
to resolve whether each dash represents '/', '.', or a literal '-'.
Also handles hidden directories (e.g., .claude) and fixes the encoder
to replace dots with dashes to match Claude Code's actual behavior.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@alex-reilly-dd alex-reilly-dd marked this pull request as ready for review March 6, 2026 21:18
Copy link

@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.

1 issue found across 2 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/claude_notes/cli.py">

<violation number="1" location="src/claude_notes/cli.py:101">
P2: Decoder discards empty fragments from consecutive dashes, so paths containing literal "--" (e.g., "foo--bar") cannot be reconstructed even if they exist on disk.</violation>
</file>

Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Add one-off context when rerunning by tagging @cubic-dev-ai with guidance or docs links (including llms.txt)
  • Ask questions if you need clarification on any suggestion

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

When two dashes appear consecutively ('--') in an encoded path, also try
the literal '-' interpretation (e.g., 'foo--bar' → 'foo-bar') in addition
to the '/.' interpretation for hidden directories. Without this, paths
containing literal dashes like 'memory-daemon' could not be reconstructed
when preceded by another encoded separator.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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