Skip to content

Remove the clean subcommand from v1.0.0#35

Merged
leogdion merged 2 commits into
v1.0.0-integrationfrom
remove-clean
Jul 25, 2026
Merged

Remove the clean subcommand from v1.0.0#35
leogdion merged 2 commits into
v1.0.0-integrationfrom
remove-clean

Conversation

@leogdion

@leogdion leogdion commented Jul 25, 2026

Copy link
Copy Markdown
Member

Merge order: 1 of 6, into v1.0.0-integration. Merge this first — it rewrites
regions of git-trees, README.md, AGENTS.md, and ci.yml that the other
five PRs also touch.

Closes #17.

What

clean is the only destructive subcommand, the only one carrying open
correctness bugs, and the only one whose destructive path has never run in CI.
Per #17, it is pulled from v1.0.0 rather than fixed under tag pressure.

File Change
git-trees delete cmd_clean and its section, the clean) dispatch arm, the usage entry, the header-comment line
README.md drop from quickstart and the "Why" bullets; replace the command section with Removing worktrees (the by-hand equivalent); update Known limitations
AGENTS.md "Report before destroy" → "Nothing destructive"; drop the clean test-checklist item
.github/workflows/ci.yml replace the fresh-not-merged assertion with one that clean is unknown and unadvertised

_default_branch and _path_for stay — add and list still use them.

The regression note stays

AGENTS.md regression 2 (git branch --merged flags branches with no commits
of their own) is kept and annotated. No code relies on it now, but it is the
reason the rev-list --count guard has to come back with clean, and losing
the note is how the bug returns.

Follow-up

#34 carries #17's Part 2 (TREES_RM configurable removal command) and Part 3
(all six historical clean bugs) plus acceptance criteria. Nothing there is
implementable while the command is absent, so it tracks the reintroduction.

Verified

  • bash -n git-trees and shellcheck -s bash git-trees clean
  • Against a file:// fixture: git trees clean exits 1 with an unknown-command
    error; help has zero clean mentions; list --json still parses
  • Both AGENTS.md regressions re-checked: add feature-x → upstream
    origin/feature-x; add brandnew → upstream origin/brandnew, not origin/main
  • grep -rn clean README.md AGENTS.md git-trees returns only intentional uses
    (the clean/dirty state in list, the new docs section, the Reintroduce clean with a configurable removal command #34 pointers)

Conflicts to expect

None with PR 2 (disjoint hunks). PR 4 edits the README quickstart this PR also
touches; PR 5 rewrites the ci.yml smoke block.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Breaking Changes

    • Removed the git trees clean command from the CLI.
    • clean is no longer listed in help or recognized as a valid command.
  • Documentation

    • Updated cleanup guidance to use standard Git worktree and branch removal commands.
    • Clarified that automated cleanup is no longer available.
  • Tests

    • Updated smoke tests to verify that clean is rejected and omitted from help output.

`clean` was the only destructive subcommand, the only one carrying open
correctness bugs, and the only one whose `--apply` path had never run in CI.
Ship 1.0.0 without it rather than ship a half-tested destroyer.

Removes `cmd_clean`, its dispatch arm, its `usage` and header-comment entries,
the README command section, and the "Report before destroy" constraint. CI now
asserts `clean` is an unknown command and that `help` no longer advertises it.

`AGENTS.md` regression 2 (`git branch --merged` flags branches with no commits
of their own) is kept and annotated: no code relies on it today, but losing the
note is how the bug returns when `clean` does.

The README gains a "Removing worktrees" section with the by-hand equivalent.

Closes #17. The `TREES_RM` design and the full `clean` bug history are
preserved in #34, which tracks bringing the command back.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5c026c9e-aed5-4b03-b060-47db50ddbfdf

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The clean CLI implementation, dispatch, and help text were removed. README and contributor guidance now document manual worktree cleanup and future destructive-operation constraints. CI verifies that clean is rejected and omitted from help output.

Changes

Clean command removal

Layer / File(s) Summary
Remove clean CLI behavior
git-trees
Deletes cmd_clean, its usage entry, and its dispatch case.
Update cleanup documentation
README.md, AGENTS.md
Removes clean usage, documents manual worktree removal, and preserves safety guidance for future destructive operations.
Validate command removal
.github/workflows/ci.yml
Checks that clean fails as an unknown command and is absent from help output.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

  • Issue 34: Related to the removed clean command and its documentation and CI coverage, while focusing on its later reintroduction.

Possibly related PRs

  • brightdigit/git-trees#9: Modifies the same clean implementation with worktree-path parsing and deletion safeguards.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR removes clean, updates docs and CI, and preserves the historical safety note required by #17.
Out of Scope Changes check ✅ Passed The changes stay focused on removing clean and updating the related docs, guidance, and CI.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: removing the clean subcommand from v1.0.0.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch remove-clean

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/ci.yml:
- Around line 89-94: Update the CI checks for the script invocation around the
`clean` command to capture its stderr, require a nonzero exit status, and assert
that the output contains the expected unknown-command diagnostic rather than
accepting any failure. Also tighten the help-output grep to match `clean` as a
whole word while preserving the existing assertion that it is not advertised.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a4f9a4b2-c388-47df-bfa3-ea1e0c4ce3e0

📥 Commits

Reviewing files that changed from the base of the PR and between 86d6058 and 432ffef.

📒 Files selected for processing (4)
  • .github/workflows/ci.yml
  • AGENTS.md
  • README.md
  • git-trees
💤 Files with no reviewable changes (1)
  • git-trees

Comment thread .github/workflows/ci.yml Outdated
Comment on lines +89 to +94
# `clean` was removed before v1.0.0 (#17); it must not be dispatchable.
if bash "$T" clean >/dev/null 2>&1; then
echo "FAIL: clean should be an unknown command"; exit 1
fi
if bash "$T" help 2>&1 | grep -q clean; then
echo "FAIL: help still advertises clean"; exit 1

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Assert that clean is unknown, not merely unsuccessful.

The current check passes for any nonzero exit, including a recognized clean command that fails for an unrelated reason. Capture stderr and assert the expected unknown-command diagnostic; retain the nonzero-status check as well. Consider matching clean as a whole word in help output.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/ci.yml around lines 89 - 94, Update the CI checks for the
script invocation around the `clean` command to capture its stderr, require a
nonzero exit status, and assert that the output contains the expected
unknown-command diagnostic rather than accepting any failure. Also tighten the
help-output grep to match `clean` as a whole word while preserving the existing
assertion that it is not advertised.

Comment thread README.md Outdated
Comment on lines +146 to +161
## Removing worktrees

Reports by default; `--apply` executes. Three passes:
There is no `clean` subcommand in 1.0.0. Remove a worktree and its branch by
hand:

- **gone** — branches whose upstream is deleted (`[gone]`)
- **merged** — branches merged into the default branch, *excluding* those with
no commits of their own (a branch freshly cut from `main` is technically
merged but isn't finished work)
- **older-than** — worktrees whose directory mtime exceeds N days
```bash
git worktree remove <path>
git branch -d <branch> # -d refuses unmerged work; escalate to -D yourself
git worktree prune
```

`--gone` and `--merged` are mutually exclusive selectors; passing neither runs
both. Uses `git branch -d` (safe) and tells you when to escalate to `-D`. Never
removes the repo root or your current directory.
A `clean` command shipped in pre-release versions and was pulled before 1.0.0 —
it was the only destructive subcommand, it carried open correctness bugs, and its
`--apply` path had never run in CI. It will return once it is fully tested and
its removal step is routable to a trash can rather than being unrecoverable. See
[the reintroduction issue](https://github.com/brightdigit/git-trees/issues/34).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

we don't need to mention that there was a subcommand. This will be for the first release

1.0.0 is the first release, so the README has no prior version to refer back
to. The paragraph explaining that a `clean` command once existed and why it was
pulled reads as history to a reader who has none. Removed, along with the
"No `clean` subcommand" phrasing in Known limitations, which implied one was
expected. The manual `git worktree remove` recipe stays — that part is useful.

The rationale is not lost: it lives in AGENTS.md and issue #34.

CI only checked that `clean` exited nonzero, which a dispatched-but-broken
`clean` would also satisfy. Assert the "unknown command 'clean'" diagnostic
instead, and match `clean` as a whole word in the help output so the legitimate
"clean/dirty" text cannot trip it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@leogdion

Copy link
Copy Markdown
Member Author

we don't need to mention that there was a subcommand. This will be for the first release

Agreed — dropped in 2ff08f3. The "A clean command shipped in pre-release versions…" paragraph is gone, and the Known-limitations line no longer reads as if one was expected ("No clean subcommand" → "Removing stale worktrees and branches is manual; nothing here deletes"). The manual git worktree remove recipe stays, since that part is useful on its own. Rationale isn't lost — it's in AGENTS.md and #34.

Same archaeology was in PR #40's CHANGELOG at two spots; cleaned up there too, along with the now-orphaned [#17] / [#34] link definitions.

Also took the CodeRabbit point on ci.yml: the old check passed for any nonzero exit, which a dispatched-but-broken clean would satisfy. It now asserts the unknown command 'clean' diagnostic, and greps help output for clean as a whole word so the legitimate "clean/dirty" text can't trip it.

@leogdion
leogdion merged commit 17a21e1 into v1.0.0-integration Jul 25, 2026
4 checks passed
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.

Pull clean from v1.0.0, and gate its return on a configurable removal command

1 participant