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
Contributor

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.

No files are deleted by the audit or these fixtures outside their temporary directories.


Note

Low Risk
Read-only audit script behavior fix with regression tests; no data deletion or auth changes.

Overview
Fixes worktree path handling in worktree-audit.sh when checkouts or transcript paths contain spaces.

Worktree listing: Replaces awk field splitting on git worktree list --porcelain with sed to strip the worktree prefix so the full path (including spaces) is used for the main worktree, the audit loop, and transcript slug lookup.

Transcript discovery: Uses rg -l -0 -F and xargs -0 stat so ripgrep output and filenames with spaces are not broken by whitespace splitting.

Adds worktree-audit.test.mjs with offline Git fixtures (spaced and unspaced paths) that assert the audited worktree path, merge/clean columns, and on macOS recent-chat bucket behavior.

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

Signed-off-by: Rudy Celekli <rudycelekli@users.noreply.github.com>
@rudycelekli
rudycelekli force-pushed the fix/pstack-audit-space-paths branch from 647e0f5 to 67c94fd Compare October 24, 2026 02:06
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