Skip to content

fix(pstack): preserve worktree paths containing spaces - #660

Open
rudycelekli wants to merge 1 commit into
cursor:mainfrom
rudycelekli:fix/pstack-audit-space-paths
Open

rudycelekli wants to merge 1 commit into
cursor:mainfrom
rudycelekli:fix/pstack-audit-space-paths

Conversation

@rudycelekli

@rudycelekli rudycelekli commented Oct 16, 2026 •

Copy link
Copy Markdown

Problem

The worktree cleanup audit splits Git's porcelain paths at whitespace. A checkout such as feature checkout is audited as feature, losing its commit and dirty-state information. A spaced main checkout also points the transcript lookup at the wrong directory; spaced transcript filenames are split by xargs.

Change

Strip the worktree prefix without splitting the rest of the path, and pass literal, NUL-delimited transcript filenames from ripgrep to stat. Regenerate the Claude Code harness from the canonical pstack source.

Verification

  • Offline local Git fixtures: baseline 1 control passes and the spaced-path regression fails; changed source passes both cases. On macOS the fixtures also verify recent transcript discovery, including a spaced filename.
  • node --test pstack/skills/poteto-mode/scripts/worktree-audit.test.mjs: 2 pass.
  • bash -n, harness generation/check, and git diff --check pass.

AI assistance: Codex implementation and local verification. No files are deleted by the audit or these fixtures outside their temporary directories.


Note

Low Risk
Read-only audit script parsing and test-only fixtures; no production auth or data paths.

Overview
Fixes worktree-audit so Git porcelain paths and transcript filenames with spaces are not broken by whitespace splitting.

Worktree listing now strips the worktree prefix with sed instead of awk field splitting, for both the main worktree and the audit loop—so checkouts like feature checkout keep full paths for merge/dirty/remote checks and transcript slug resolution.

Transcript discovery uses ripgrep with fixed-string, NUL-delimited output (-0 -F) and xargs -0 stat, so spaced worktree paths and spaced transcript filenames are passed through intact.

Adds offline Node tests (worktree-audit.test.mjs) that exercise paths with and without spaces, stubbing gh/origin, and on macOS assert recent-chat bucket behavior.

Reviewed by Cursor Bugbot for commit 647e0f5. Bugbot is set up for automated code reviews on this repo. Configure here.

Signed-off-by: Rudy Celekli <rudycelekli@users.noreply.github.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