fix(pstack): protect untracked and ignored worktree files

DA
3d ago
+7-7

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]
Low Risk
Documentation and read-only audit script changes only; deletion behavior is stricter and safer for local worktrees, with no production runtime impact.

Overview
Tightens worktree cleanup so untracked and ignored paths are never treated as disposable scratch.

The audit script now runs git status with --untracked-files=all and --ignored=matching, labels any dirty worktree as wip:N (line count of all paths), and drops the old scratch bucket. The playbook adds an explicit ownership/safety framing and rewrites steps 4–5: default to holding any wip worktree, require per-path user approval before removal, use non-force git worktree remove only after a fresh status preflight, and forbid rm -rf or git worktree prune to override Git refusals.

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