From a856f56d7bf9ba94425da7d00d1dd63b6a58f7c5 Mon Sep 17 00:00:00 2001 From: Marcelo Terra Date: Sun, 8 Feb 2026 22:33:23 -0300 Subject: [PATCH] fix(windows): correct UNC/WSL path decoding in getAllSessions The previous cross-platform fix (PR #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 #6 fixes were merged to main but never published to npm. Fixes #27 Co-Authored-By: Claude Opus 4.6 --- CHANGELOG.md | 9 +++++++++ package.json | 2 +- src/core/ClaudeSessionParser.js | 9 +++++---- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 241fdea..ecdee1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -131,6 +131,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Maintains backward compatibility with existing functionality - All ccundo commands now work properly in directories containing underscores +## [1.1.2] - 2026-02-08 + +### Fixed +- **Windows session path decoding**: Fix `getAllSessions()` incorrectly decoding UNC/WSL paths (e.g. `--wsl-localhost-...` was decoded as `:\wsl\...` instead of `//wsl/...`) +- The `--` prefix is now only treated as a drive letter (`C:\`) when preceded by `[A-Z]`; otherwise it's treated as a UNC path prefix (`//`) + +### Note +- PR #6 cross-platform fix (os.homedir, Windows path encoding) was merged to main but never published to npm — this release includes those fixes plus the UNC path decode fix above + ## [Unreleased] ### Planned Features diff --git a/package.json b/package.json index b9d35ea..13b956f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ccundo", - "version": "1.1.1", + "version": "1.1.2", "description": "Intelligent undo for Claude Code sessions - Revert individual operations with cascading safety and detailed previews", "main": "index.js", "bin": { diff --git a/src/core/ClaudeSessionParser.js b/src/core/ClaudeSessionParser.js index 55aafad..3cf6327 100644 --- a/src/core/ClaudeSessionParser.js +++ b/src/core/ClaudeSessionParser.js @@ -208,12 +208,13 @@ export class ClaudeSessionParser { // Convert back to proper path - reverse the Claude encoding let projectPath = projectDir; - if (process.platform === 'win32') { - // Windows: C--Users-... → C:\Users\... - projectPath = projectPath.replace(/--/g, ':\\'); + if (process.platform === 'win32' && /^[A-Z]--/.test(projectDir)) { + // Windows drive path: C--Users-... → C:\Users\... + projectPath = projectPath.replace(/^([A-Z])--/, '$1:\\'); projectPath = projectPath.replace(/-/g, '\\'); } else { - // Linux/macOS: -home-... → /home/... + // Unix or UNC/WSL path: --wsl-... → //wsl/... or -home-... → /home/... + projectPath = projectPath.replace(/^--/, '//'); projectPath = projectPath.replace(/^-/, '/'); projectPath = projectPath.replace(/-/g, '/'); }