Skip to content

Add branch and folder hygiene to issue-flow commands (#31)#38

Merged
jepegit merged 1 commit into
mainfrom
31-problems-with-branches-and-merging
Apr 19, 2026
Merged

Add branch and folder hygiene to issue-flow commands (#31)#38
jepegit merged 1 commit into
mainfrom
31-problems-with-branches-and-merging

Conversation

@jepegit
Copy link
Copy Markdown
Owner

@jepegit jepegit commented Apr 19, 2026

Summary

Addresses #31: issue branches ending up "several commits ahead of main" after squash-merges, and stale files piling up in .issueflows/01-current-issues/.

Extends the three existing slash commands (and matching skills / workspace rules / workflow doc) without adding any new commands:

  • /issue-start: non-destructive branch-status preflight (git fetch --prune, current branch, ahead/behind vs default, stale-branch warning) plus an auto-safe sweep that moves every issueNN_* group in 01-current-issues/ other than the focus issue to 03-solved-issues/ (if a status file contains - [x] Done) or 02-partly-solved-issues/.
  • /issue-close: replaces the old "branch reminder" with an explicit post-merge cleanup. Detects merge status via gh pr view; on merged, offers git switch <default> && git pull --ff-only && git fetch --prune and then asks once (one consolidated yes/no) before running git branch -d on every local branch already reachable from origin/<default>, including squash-merged ones detected via git cherry. -D is never used automatically. Step 4 now uses git pull --ff-only so unrelated history can't sneak in.
  • /issue-init: adds a branch-status preflight paragraph and an archived-issue guard — re-opening an issue already archived in 02- / 03- requires a second explicit confirmation.
  • Workflow doc: new "Branch and folder hygiene" subsection; per-command bullets updated; duplicated "Agent Skills (optional)" block removed.
  • Workspace rules: new "Branch hygiene" and "Folder hygiene for .issueflows/01-current-issues/" subsections so these habits stick outside the three commands.
  • Tests: 4 new regression assertions in tests/test_templating.py for the new headings; full suite 35 passed.

All behavior stays "auto-safe": file moves happen automatically based on the - [x] Done checkbox, but any destructive git action (branch delete, force ops) still requires an explicit confirmation.

Test plan

  • uv run pytest (35 passed, including 4 new regression tests)
  • uv run scripts/update_issueflow_setup.py re-renders 9 scaffold files without error
  • After merge, re-run /issue-close on a branch that points at this merged PR and verify the post-merge cleanup flow (switch to main, pull --ff-only, fetch --prune, single confirm before git branch -d) works end to end.

Closes #31

Made with Cursor

Issue #31 reported two recurring pain points: local issue branches end up
"several commits ahead of main" after squash-merged PRs, and
.issueflows/01-current-issues/ accumulates stale issue files.

Extend the three existing slash commands (and their matching skills) so the
assistant helps with both without introducing new commands:

- /issue-start now runs a non-destructive branch-status preflight
  (fetch --prune, current branch, ahead/behind vs default, stale-branch
  warning) and then auto-moves every issueNN_* group in 01-current-issues
  that is NOT the focus issue to 02-partly-solved-issues or 03-solved-issues
  based on whether a status file contains - [x] Done.
- /issue-close replaces the old "branch reminder" with an explicit
  post-merge cleanup: detect merge via gh pr view, offer
  git switch <default> && git pull --ff-only && git fetch --prune, then
  ask once (one consolidated yes/no) before git branch -d on every local
  branch already reachable from the default (squash-merged ones included).
  -D is never used automatically. Step 4 clarifies syncing via
  git pull --ff-only so unrelated history cannot sneak in silently.
- /issue-init gains a branch-status preflight paragraph and an
  archived-issue guard: re-opening an issue already sitting in 02-/03-
  requires an extra explicit confirmation.

Also update the workflow doc with a new "Branch and folder hygiene"
section, remove a duplicated "Agent Skills (optional)" block, and extend
the workspace rules with "Branch hygiene" and "Folder hygiene"
subsections. Re-rendered the project's own .cursor/ and docs/ scaffold
from the updated templates.

Added regression assertions in tests/test_templating.py for the new
headings. Full suite: 35 passed.

Closes #31

Made-with: Cursor
@jepegit jepegit linked an issue Apr 19, 2026 that may be closed by this pull request
@jepegit jepegit merged commit fc20b98 into main Apr 19, 2026
1 check 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.

problems with branches and merging

1 participant