Add workspace-wide cleanup: workspace cleanup CLI and /iflow-cleanup all (#392) - #396
Merged
Merged
Conversation
…w-cleanup all` (#392) A day of epic work across several workspace members left dozens of squash-landed branches, and the only way to prune them was to run the full `/iflow-cleanup` skill once per repo, each with its own A1 and A2 confirm. `issue-flow workspace cleanup` now surveys every scaffolded member in one pass. It reuses the `agent local-branches` classifier (extracted as the console-free `classify_local_branches`, so per-member buckets are identical by construction), records the `default-sync` classification, lists linked worktrees, and computes a Phase A1 / A2 plan. It is classify-only by default; `--apply` runs A1 (switch to default, `pull --ff-only` only when fast-forwardable, remove reachable worktrees, `git branch -d` on `reachable`) and `--apply --yes-delete-squash-landed` adds A2 (`-d` then `-D` on `squash_landed` / `merged_pr_divergent`, every deletion reported with its tip SHA). Members with a dirty product-code tree, detached HEAD, missing `origin`, or a lock are skipped and reported while the loop continues; a member whose default cannot fast-forward is listed with its `default-sync` action and never pulled; `unique_work` branches are never planned or deleted. `--extra-root` includes a scaffolded repo outside the registry. The cleanup skill and command gain a workspace mode behind the `all` / `workspace` token: one CLI survey, one A1 confirm, one A2 confirm, and an optional Phase B confirm for the whole workspace. Step 10 now says "do not loop automatically unless invoked with `all`". Docs (`cli.md`, the workspaces and after-squash-merge how-tos) and the multi-repo design doc (Phase 4c) describe the new path. The rendered scaffold in this repo is refreshed, which also clears the 0.5.15 skill-stamp drift. Bumps the version to 0.5.17 and promotes the unreleased changelog entries. Co-authored-by: Cursor <cursoragent@cursor.com>
…en CI renders Rich help with colour (#392) Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #392
What
issue-flow workspace cleanup [--json] [--dry-run] [--no-fetch] [--apply] [--yes-delete-squash-landed] [--extra-root …]. Classify-only by default; per member: refuse-to-loop gate,git fetch --prune,default-sync, the fiveagent local-branchesbuckets (sharedclassify_local_branches), linked worktrees, A1/A2 plan with recovery lines.--apply= Phase A1 (switch,pull --ff-onlyonly wheneven/ff_only, reachable worktree removes,git branch -dreachable).--yes-delete-squash-landed= Phase A2 (-dthen-Donsquash_landed/merged_pr_divergent,<name> <tip> <flag>reported).unique_workis never planned or deleted.origin, locked..issueflows/-only dirt only blocks that member's switch/pull. A non-ff default is listed with itsdefault-syncaction and never pulled./iflow-cleanup all(orworkspace) → one survey, one A1 confirm, one A2 confirm, optional one Phase B confirm for the whole workspace. Step 10 wording: "… unless invoked withall".docs/cli.md,how-to/workspaces.md,how-to/after-squash-merge.md; design docmulti-repo-workspaces.mdPhase 4c. Rendered scaffold refreshed (also clears the 0.5.15 stamp drift).Acceptance criteria
workspace cleanup --jsonbuckets identical toagent local-branchesper member (test_buckets_match_agent_local_branches_per_member)/iflow-cleanup all≤ 3 confirms, tip SHAs for every-D(skill text +applied.a2.deleted)default-syncaction printed; others processed (test_non_ff_member_skips_pull_but_others_proceed,test_apply_never_pulls_non_ff_member)unique_worknever in any confirm (test_plan_never_lists_unique_work,test_apply_with_a2_flag_force_deletes_and_reports_tips)How to test
Full suite: 952 passed; ruff check + format clean.