Skip to content

Add workspace-wide cleanup: workspace cleanup CLI and /iflow-cleanup all (#392) - #396

Merged
jepegit merged 2 commits into
mainfrom
392-workspace-cleanup
Sep 26, 2026
Merged

jepegit merged 2 commits into
mainfrom
392-workspace-cleanup

Conversation

@jepegit

@jepegit jepegit commented Sep 26, 2026

Copy link
Copy Markdown
Owner

Closes #392

What

  • New 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 five agent local-branches buckets (shared classify_local_branches), linked worktrees, A1/A2 plan with recovery lines.
  • --apply = Phase A1 (switch, pull --ff-only only when even/ff_only, reachable worktree removes, git branch -d reachable). --yes-delete-squash-landed = Phase A2 (-d then -D on squash_landed / merged_pr_divergent, <name> <tip> <flag> reported). unique_work is never planned or deleted.
  • Refused and skipped (loop continues): dirty product-code tree, detached HEAD, missing origin, locked. .issueflows/-only dirt only blocks that member's switch/pull. A non-ff default is listed with its default-sync action and never pulled.
  • Skill / command: /iflow-cleanup all (or workspace) → one survey, one A1 confirm, one A2 confirm, optional one Phase B confirm for the whole workspace. Step 10 wording: "… unless invoked with all".
  • Docs: docs/cli.md, how-to/workspaces.md, how-to/after-squash-merge.md; design doc multi-repo-workspaces.md Phase 4c. Rendered scaffold refreshed (also clears the 0.5.15 stamp drift).
  • Version 0.5.16 → 0.5.17; HISTORY promoted.

Acceptance criteria

  • workspace cleanup --json buckets identical to agent local-branches per member (test_buckets_match_agent_local_branches_per_member)
  • /iflow-cleanup all ≤ 3 confirms, tip SHAs for every -D (skill text + applied.a2.deleted)
  • Non-ff member skipped for pull with default-sync action printed; others processed (test_non_ff_member_skips_pull_but_others_proceed, test_apply_never_pulls_non_ff_member)
  • unique_work never in any confirm (test_plan_never_lists_unique_work, test_apply_with_a2_flag_force_deletes_and_reports_tips)
  • Docs + step-10 sentence updated

How to test

uv run pytest tests/test_workspace_cleanup.py tests/test_agent_local_branches.py tests/test_templating.py -q
uv run issue-flow workspace cleanup <workspace-root>            # read-only table
uv run issue-flow workspace cleanup <workspace-root> --json     # payload

Full suite: 952 passed; ruff check + format clean.

jepegit and others added 2 commits September 26, 2026 22:37
…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>
@jepegit
jepegit merged commit cca5d6a into main Sep 26, 2026
4 checks passed
@jepegit
jepegit deleted the 392-workspace-cleanup branch September 26, 2026 20:56
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.

feat: workspace-wide cleanup (issue-flow workspace cleanup / /iflow-cleanup all)

1 participant