poteto-mode worktree cleanup: untracked files are labelled "scratch, safe to drop", and paths with spaces are truncated
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 65/100
Research direction
Start by reading scripts/worktree-audit.sh and playbooks/worktree-cleanup.md, then reproduce both defects: a merged-branch worktree with an untracked new-provider-parser.ts, and a worktree path containing a space. The audit needs to hold non-ignored untracked files instead of calling them scratch, parse git worktree list --porcelain -z so full paths survive, and mark failed git inspections as unknown rather than clean. Update the playbook wording and add tests for untracked-only, spaced-path, and git-failure cases; done when those tests pass and the audit no longer labels such work safe.
Written by the indexing model from the issue text.
Description
Found against pstack 0.15.34 at cursor/plugins 519d36aa98955bf680db01bcde5fdfba686dc901 (harness/pstack/claude-code/skills/poteto-mode/). Line numbers refer to that commit.
scripts/worktree-audit.sh, together with playbooks/worktree-cleanup.md, can lead an agent to delete work that
exists nowhere in git. There are two defects.
A. Untracked files are classed as disposable.
worktree-audit.sh:93-97: a worktree whosegit status --porcelainhas only??lines becomesscratch:N. The
bucket logic (:125) then rates itsafewhen the branch is merged or has a PR.worktree-cleanup.md:6says "scratch:Nis untracked throwaway, safe to drop", and step 7 runs
git worktree remove --force <path>.
Being untracked doesn't make a file disposable. A new source file that hasn't been git added yet is the most common
form of unfinished work.
Repro:
- Create a worktree on a branch that is already merged (or has a merged PR).
- Add an untracked
new-provider-parser.tswith unfinished code. - Run the audit. The row is
scratch:1, bucketsafe. - Follow the playbook. The worktree is force-removed and the file is lost, without the decision the playbook requires
for tracked WIP.
B. Path parsing and failed inspection.
worktree-audit.sh:31and:80useawk '{print $2}'ongit worktree list --porcelain, which drops everything
after the first space. A worktree at/tmp/my worktrees/branch-oneis read as/tmp/my.:93:git -C "$wt" status --porcelain 2>/dev/null. When$wtis wrong or git fails, the output is empty and the
row is reported asclean, so a failed inspection looks safe.:115-116: transcript matching passes the path torg -eas a regex (.and+match other paths), and
xargs statsplits filenames on whitespace.
Repro (parsing):
Input: worktree /tmp/my worktrees/branch-one
Output: /tmp/my
Suggested fix:
- Treat untracked files that aren't ignored as WIP (
hold-wip), the same as tracked edits. Only drop them after the
user has confirmed them by name, or after they have been preserved (stash with-u, or copied out). Change the
playbook text to match. - Parse
git worktree list --porcelain -z(NUL-delimited) and keep the full path. - When
rev-parse,logorstatusfails, make the rowunknown/ held, neverclean. - Use
rg -F(fixed strings) for the transcript match, andrg -l0 … | xargs -0 stat. - Add tests for a worktree with only untracked files, a path with a space, and a git failure.
- Dominant language
- TypeScript
- Stars
- 18.2k
- Forks
- 2k
- Avg merge
- 3h 56m
- Merged PRs (30d)
- 96
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from cursor/plugins
-
pstack: interrogate asks the user, which worker.md forbids for delegates that reach itPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
cursor/plugins#1272 · 1 comment ·
Maintainers usually reply within 1 day
-
poteto-mode: multi-phase-plan Merge placeholder still appends every PR to a base-branch stackPossibly taken @mangeshraut712 claimed this 15 days ago. Open
Difficulty 1/5 Under an hour Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
typescript-best-practices: schema example uses z.string().uuid(), deprecated in Zod 4Possibly taken @mangeshraut712 claimed this 14 days ago. Open
Difficulty 1/5 Under an hour Newbie friendliness 88/100
cursor/plugins#1165 · 1 comment ·
Maintainers usually reply within 1 day
-
statechart: relative-symlink launcher test fails on macOS because /var is a symlinkPossibly taken @lnuxe claimed this 3 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
cursor/plugins#1164 · 2 comments ·
Maintainers usually reply within 1 day
-
pstack docs/harness/claude-code.md: transcript slug replaces every non-alphanumeric character, not only / and .Possibly taken @isTuhin claimed this 9 days ago. Open
Difficulty 1/5 1-3 hours Newbie friendliness 82/100
cursor/plugins#1155 · 2 comments ·
Maintainers usually reply within 1 day
Similar issues
-
infra needs-triage
Difficulty 2/5 Under an hour Newbie friendliness 82/100
LucasSantana-Dev/Lucky#3331 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
kOaDT/oss-oopssec-store#381 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
nocobase/nocobase#11669 · 1 comment ·
Maintainers usually reply within 1 day
-
iOS: Clear Context (/clear) and model picker fallback use negative agent check instead of isClaudeOpen
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Area: API Bug Difficulty: Low Priority: Low
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
DouglasNeuroInformatics/OpenDataCapture#1937 ·
Maintainers usually reply within 1 day