Skip to content

fix: use cwd-based path resolution to handle Windows and Linux home paths (#42)#54

Merged
vtemian merged 2 commits intomainfrom
fix/remove-windows-file-paths
Feb 17, 2026
Merged

fix: use cwd-based path resolution to handle Windows and Linux home paths (#42)#54
vtemian merged 2 commits intomainfrom
fix/remove-windows-file-paths

Conversation

@vtemian
Copy link
Copy Markdown
Collaborator

@vtemian vtemian commented Feb 17, 2026

Summary

Replaces the fragile regex-based path stripping in the session pipeline with a createTransforms(workingDir) factory pattern. Instead of guessing how to strip a path prefix, the factory captures the cwd field from the JSONL stream and uses path.posix.relative to produce correct relative paths — regardless of whether the source was Windows (C:\Users\vlad\...) or a non-standard Linux home (/home/vlad/...).

Closes #42.

Changes

  • transforms.ts - Replaced standalone transform functions with createTransforms(workingDir) factory; uses path.posix.relative(workingDir, absPath) for all path normalization
  • pipeline.ts - Threads workingDir into the factory on stream initialization, sourced from the JSONL cwd field
  • index.ts - Updated public API to expose factory pattern
  • transforms.test.ts - Fully rewritten to cover Windows paths (C:\...), Linux home dirs, edge cases, and the factory contract
  • index.test.ts - New integration-level tests covering end-to-end path resolution through the pipeline

Claudebin Session

🔗 Session Link

Testing

  • Unit tests rewritten to cover Windows C:\Users\... paths, non-root Linux home dirs (/home/vlad/...), and paths outside the working directory
  • New index.test.ts integration tests exercise the full pipeline with realistic JSONL input
  • bun check and bun type-check pass locally

Checklist

  • bun check passes
  • bun type-check passes
  • Tested locally
  • Claudebin session link attached

vtemian and others added 2 commits February 17, 2026 13:52
Windows paths (C:\Users\...) were passing through unsanitized, leaking
usernames and directory structures. Normalize backslashes and strip
drive-letter prefixes before applying existing Unix path extraction.

Closes #42

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…lution

Replace standalone toRelativePath/sanitizeResult/transformToolUse/enhanceToolOutput
with createTransforms(workingDir) factory. Uses path.posix.relative against the
JSONL cwd field instead of regex guessing, properly handling Windows paths (C:\...)
and Linux /home/ dirs. Adds extractWorkingDir to scan JSONL for working directory.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vtemian vtemian merged commit 62c1434 into main Feb 17, 2026
2 checks passed
@vtemian vtemian deleted the fix/remove-windows-file-paths branch February 17, 2026 14:49
vtemian added a commit that referenced this pull request Feb 18, 2026
fix: use cwd-based path resolution to handle Windows and Linux home paths (#42)
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.

Remove Windows file paths from threads

1 participant