Skip to content

fix(pstack): protect untracked and ignored worktree files - #459

Open
dajiaohuang wants to merge 3 commits into
cursor:mainfrom
dajiaohuang:fix/pstack-worktree-cleanup-safety
Open

dajiaohuang wants to merge 3 commits into
cursor:mainfrom
dajiaohuang:fix/pstack-worktree-cleanup-safety

Conversation

@dajiaohuang

@dajiaohuang dajiaohuang commented Sep 29, 2026 •

Copy link
Copy Markdown

Summary

  • Count tracked, untracked, and ignored worktree paths as held WIP.
  • Remove the guidance to force-remove worktrees or delete leftover directories.

Fixes #449.

Validation

  • Bash syntax check passed.
  • Synthetic Git worktree with one untracked file and one ignored directory reported wip:2 and hold-wip.
  • git diff --check passed.

Note

Medium Risk
Updates the human-gated worktree deletion playbook and audit lever; the changes are conservative but mistakes here could still block cleanup or mis-classify dirty state.

Overview
Worktree cleanup no longer treats untracked or ignored files as disposable “scratch.” The audit script now runs git status with --untracked-files=all and --ignored=matching, and any non-clean worktree is labeled wip:N (line count) instead of splitting tracked vs scratch.

The worktree-cleanup playbook steps 4–5 were rewritten to match: show tracked diffs and list untracked/ignored paths, default to keeping any wip worktree until the user explicitly approves every path removal, and prune with git worktree remove only (no --force, no rm -rf, no prune to override Git refusals), with a status preflight right before each removal.

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

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.

Reviewed by Cursor Bugbot for commit a17c461. Configure here.

Comment thread pstack/skills/poteto-mode/playbooks/worktree-cleanup.md Outdated
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.

pstack: worktree-cleanup treats untracked and ignored files as disposable (--force, rm -rf)

1 participant