Repository navigation
fix(parser): use Claude cwd for Windows project paths - #228
ozymandiashh wants to merge 1 commit into
Conversation
|
Superseded by #245, which carries your original commit forward and adds a review fix on top: Bug found: when a slug contained both cwd-bearing and no-cwd sessions, your scanProjectDirs created two ProjectSummary entries sharing the same dirName (one cwd-keyed, one slug-keyed). They later merged in Fix: added a consolidation step at the end of Tests added:
Closing in favor of #245. Thanks for the patch — the cwd-from-JSONL approach was the right call. |
Reads the canonical cwd already stored inside Claude session JSONL files and uses it as the project path, then groups sessions by a normalized path key (case + slash insensitive) so Windows projects no longer split into 3+ rows on case/slash variants. Falls back to the legacy slug-derived path when cwd is missing. Closes #217. Supersedes #228 with a fix that preserves the canonical cwd even when mixed with slug-only sessions in the same directory. Original implementation by @ozymandiashh.
Summary
Claude Code stores project sessions under sanitized directory slugs. On Windows that slug is lossy: a real path like
C:\AI_LAB\OPENCLAWcan appear as a directory such asc--AI-LAB-OPENCLAW. CodeBurn was trying to reconstruct the project path from that slug by replacing every-with/, which turns the example intoc//AI/LAB/OPENCLAWand can split one real project into multiple rows when casing or slash style differs.This PR makes the Claude parser use the canonical
cwdalready present inside the JSONL session data. That preserves the real Windows path, keeps underscores and drive letters intact, and groups case/slash variants of the same cwd into one project rollup.What changed
cwdfrom each Claude JSONL session and carry it alongside the parsed session summary.cwdasprojectPathfor Claude project rollups instead of reconstructing paths from directory slugs.C:\AI_LAB\OPENCLAW,c:\AI_LAB\OPENCLAW, andc:/AI_LAB/OPENCLAW/collapse into one project.cwd.Closes #217.
Why this is safe
The change is limited to Claude project rollup grouping. It does not change token parsing, pricing, date filtering, classification, or non-Claude providers. Existing sessions without
cwdkeep the old behavior.Validation
npx tsc --noEmitnpx vitest run tests/parser-claude-cwd.test.ts tests/security/prototype-pollution.test.ts tests/parser-filter.test.ts tests/date-range-filter.test.tsnpx vitest runnpm run build