Skip to content

fix(windows): correct UNC/WSL path decoding + bump to 1.1.2#28

Open
marceloterra1983 wants to merge 1 commit intoRonitSachdev:mainfrom
marceloterra1983:fix/windows-path-resolution
Open

fix(windows): correct UNC/WSL path decoding + bump to 1.1.2#28
marceloterra1983 wants to merge 1 commit intoRonitSachdev:mainfrom
marceloterra1983:fix/windows-path-resolution

Conversation

@marceloterra1983
Copy link

Summary

  • Fix getAllSessions() incorrectly decoding UNC/WSL paths on Windows (e.g. --wsl-localhost-... was decoded as :\wsl\... instead of //wsl/...)
  • Bump version to 1.1.2 since PR feature: cross-platform compatibility #6 cross-platform fixes were merged to main but never published to npm

Problem

The cross-platform fix from PR #6 treated all -- sequences as drive letter separators (C:\), which broke UNC/WSL paths:

Input:    --wsl-localhost-Ubuntu-home-marce-Projetos-TradingSystem
Before:   :\wsl\localhost\Ubuntu\home\marce\Projetos\TradingSystem  ❌
After:    //wsl/localhost/Ubuntu/home/marce/Projetos/TradingSystem  ✅

Fix

Now -- is only decoded as a drive letter when preceded by [A-Z] (e.g. C--Users). Otherwise it falls through to the Unix/UNC branch which correctly handles // prefixes.

// Before
if (process.platform === 'win32') {
  projectPath = projectPath.replace(/--/g, ':\');  // breaks --wsl-...

// After  
if (process.platform === 'win32' && /^[A-Z]--/.test(projectDir)) {
  projectPath = projectPath.replace(/^([A-Z])--/, '$1:\');  // only C--...

Additional note

PR #6 (os.homedir(), Windows path encoding) was merged to main but v1.1.1 on npm still has the old process.env.HOME code. This PR bumps to 1.1.2 so those fixes can be published too.

Closes #27

Test plan

  • Tested ccundo list on Windows 11 from C:\Users\marce — lists operations correctly
  • Tested ccundo sessions — Windows paths show as C:\Users\marce, WSL paths show as //wsl/localhost/...
  • Tested getCurrentProjectDir() — encodes C:\Users\marce as C--Users-marce matching Claude Code's format

🤖 Generated with Claude Code

The previous cross-platform fix (PR RonitSachdev#6) treated all `--` sequences as
drive letter separators (`C:\`), which broke UNC/WSL paths like
`--wsl-localhost-Ubuntu-...` (decoded as `:\wsl\...` instead of
`//wsl/...`).

Now `--` is only decoded as a drive letter when preceded by `[A-Z]`.
Otherwise it's treated as a UNC prefix (`//`).

Also bumps version to 1.1.2 since PR RonitSachdev#6 fixes were merged to main
but never published to npm.

Fixes RonitSachdev#27

Co-Authored-By: Claude Opus 4.6 <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.

Bug: ClaudeSessionParser fails on Windows - 3 path resolution issues

1 participant