Skip to content
Development
Command

/clean

Remove the git worktrees review checked PR code out into. Each one is a full checkout on disk; nothing else is touched.

From plugin
open-pr
468 skills8 commands
> /plugin marketplace add TOMOSIA-VIETNAM/open-pr
> /plugin install open-pr@open-pr

Command definition

clean.md
argument-hint: "[--all | repo name...]"
description: Remove the git worktrees review checked PR code out into. Each one is a full checkout on disk; nothing else is touched.

> **CRITICAL:** `Read` `"${CLAUDE_PLUGIN_ROOT}"/core/guardrails.md` FIRST — shared rules, not repeated > here. `<op>` ≡ `sh "${CLAUDE_PLUGIN_ROOT}"/bin/open-pr.sh`. On top of those: > - Deletes ONLY directories under `<data>/*/worktrees/`. FORBIDDEN, in the same tree and > unrecoverable: `memory.md`, `memories/`, `templates/`, `ALWAYS_RULE.md`, `settings.json`, > `<data>/.git`, and any path outside `<data>/*/worktrees/`. > - FORBIDDEN: deleting anything before the user answers Step 3. > - Reads no PR and needs no vendor CLI. > > This CRITICAL block is the SOLE enforcement layer — no `allowed-tools` backs it (deliberate).

Step 1 — Find the worktrees

`<op> data-dir --all` → every `<data>`, where `/open-pr:review` puts every worktree; none ⇒ nothing to clean, STOP. FORBIDDEN: `cd`. Per `<data>`:

find "<data>" -mindepth 3 -maxdepth 3 -type d -path '*/worktrees/*' 2>&1

None → say there is nothing to clean, STOP.

Step 2 — Narrow, then size

`ARGUMENTS`: empty ⇒ this project only, below · `--all` ⇒ every worktree · repo names ⇒ worktrees whose `<repo>` segment it names, case-insensitive, any project.

Empty ⇒ `<scope>` = output of `git rev-parse --show-toplevel`, or `pwd -P` when that exits ≠ 0; keep a worktree when Step 4's `--git-common-dir` line minus `/.git` is `<scope>` or under `<scope>/` (pwd may hold several repos). That line failing ⇒ orphan, not kept.

0 kept ⇒ STOP: say how many other worktrees exist and that `--all` or a repo name reaches them.

Size what remains — never what was just dropped, since each is a full checkout and `du` walks all of it:

du -sh <each worktree>

Step 3 — Show what would go, then ask

ONE CHOICE per `core/guardrails.md`, EXACTLY 2 options. Its body lists every worktree by path with its size and the total ⇒ consent covers a list the user has read:

  • `Remove all N (Recommended)` — detail: the reclaimed total; review re-creates a worktree next run ⇒

only disk is lost, unless `/open-pr:fix` committed there and never pushed

  • `Keep them` — detail: nothing deleted

Subset wanted (free text, or a re-run naming those repos) ⇒ honour it, those only. `Keep them` ⇒ STOP.

Step 4 — Remove

Per worktree, in this order — a bare `rm -rf` leaves a stale worktree registration behind:

git -C "<worktree>" rev-parse --git-common-dir     # ABSOLUTE <repo>/.git; <repo> = that minus /.git
git -C "<repo>" worktree remove --force "<worktree>"

`--force`: the checkout is detached + holds untracked review scratch files.

That first command failing (repo moved/deleted) ⇒ registration already orphaned: `rm -rf "<worktree>"` instead.

Finish with `git -C "<repo>" worktree prune` per distinct repo — drops stale registrations.

Step 5 — Report

Per repo: how many worktrees went and how much disk came back. Then, once: `<data>` still holds this repo's memory and settings — only the checkouts were removed.

ARGUMENTS: $ARGUMENTS

Read more
@tomosia-vietnam
Ships withopen-pr

AI code review that lands on the PR, not in your terminal — GitHub, GitLab, Bitbucket. Learns each repo's conventions: 1 review, 1 fix commit, replies in thread. Claude Code · Cursor · Codex · Gemini CLI · Antigravity.

Stars on GitHub

Momentum

stars in total
46
Star history of TOMOSIA-VIETNAM/open-pr on GitHub, a chart by star-history.com

Other commands on open-pr.

release-now

release-now

Command

Create a git tag + GitHub Release for open-pr — an official release if standing on main, an RC if standing on a branch with an…

feedback

feedback

Command

Report a problem with the open-pr plugin itself, or ask for a change, on its public issue tracker. Reads no PR; writes nothing in…

fix

fix

Command

Act on the findings a review left on a PR — takes or declines each by severity, edits code at pwd to match the project, 1 commit,…

menubar

menubar

Command

Open or close the macOS menu bar item — reviews and fixes in progress, "Fix now", recent toasts and snooze for every watcher on…

review

review

Command

Review PRs against the conventions learned from each repo — 1 post per PR, findings tagged by severity, code left untouched.

upgrade

upgrade

Command

Bring every per-repo config in the data directory up to the schema this build expects. Takes no PR.

More commands from other plugins.

build
Auto-invoked

build

Command

Implement tasks incrementally — build, test, verify, commit. Add "auto" to run the whole plan in one approved pass.

@addyosmani@addyosmaniInstall Command