Skip to content

docs: add branch cleanup script and hygiene expectations#151

Merged
joryirving merged 2 commits into
mainfrom
saffron/prune-stale-branches
May 23, 2026
Merged

docs: add branch cleanup script and hygiene expectations#151
joryirving merged 2 commits into
mainfrom
saffron/prune-stale-branches

Conversation

@itsmiso-ai

@itsmiso-ai itsmiso-ai commented May 23, 2026

Copy link
Copy Markdown
Contributor

Fixes #127

Add automated branch cleanup tooling and documentation to reduce local repo noise from merged/stale generated branches.

Changes

  • scripts/prune-stale-branches.sh — Automated script that deletes merged branches (except saffron/* active work) and stale local-only fix/*, pr-* branches with no remote counterpart.
  • docs/branch-cleanup.md — Documents branch hygiene policy, cleanup procedure, and acceptance criteria for issue P2: Prune merged/generated fix branches after PR completion #127.

Cleanup Results

Pruned 43 stale local branches:

  • 35 fix/* branches (merged or no remote counterpart)
  • 8 pr-* branches (no remote counterpart)

Remaining local branches: main + 5 saffron/* active work branches.

Future Automated Work

When AI agents generate fix branches, use the saffron/issue-{N}-{short-desc} naming convention for agent work. All other generated branches follow fix/issue-{N}-{short-desc} or pr-{N} patterns recognized by the cleanup script.

- Add scripts/prune-stale-branches.sh for automated stale branch removal
- Add docs/branch-cleanup.md documenting branch hygiene policy
- Pruned 43 stale local branches (fix/* and pr-* with no remote)
@itsmiso-ai
itsmiso-ai requested a review from joryirving as a code owner May 23, 2026 00:03
@its-miso

its-miso Bot commented May 23, 2026

Copy link
Copy Markdown
Contributor

Automated recommendation: APPROVE

Analysis engine: MiniMax-M2.7@https://litellm.jory.dev/v1 (anthropic)

PR #151 Review: Add Branch Cleanup Script and Hygiene Documentation

Recommendation

Approve. This PR directly addresses issue #127 by delivering an automated branch cleanup tool and documentation. All acceptance criteria are satisfied and the implementation is sound.

Change-by-Change Findings

1. scripts/prune-stale-branches.sh (added, 48 lines)

  • Purpose: Automated cleanup of merged and stale local branches.
  • Safety mechanisms:
    • Uses set -euo pipefail for strict error handling.
    • Explicitly protects main, saffron/* (active agent work), and renovate/* branches.
    • Uses git branch -d for merged branches (safe delete, requires merged status) and git branch -D for stale local-only branches, both with || true to handle edge cases gracefully.
    • Verifies remote counterpart exists before deleting fix/* and pr-* patterns via git ls-remote --heads origin.
  • Logic flow: First deletes merged branches, then deletes stale local-only branches (those without remote counterparts).
  • Reporting: Outputs clear DELETE/KEEP actions and remaining branches for auditability.

2. docs/branch-cleanup.md (added, 48 lines)

  • Branch categories table: Clearly defines which patterns map to which actions (Never Delete vs. Delete).
  • Cleanup procedure: Documents how to run the script and what it does (3 numbered steps).
  • When to run: Links to release workflow dispatch (Weekly tech debt audit: windowstead - 2026-05-20 #121), weekly hygiene, and pre-batch work.
  • Acceptance criteria section: All 4 items checked off with [x], referencing issue P2: Prune merged/generated fix branches after PR completion #127.
  • Future automated work: Documents naming conventions (saffron/issue-{N}-{short-desc} for agent work, fix/* or pr-* for other generated branches) to ensure the cleanup script recognizes them.

Standards Compliance

The PR touches no game code or Godot assets, so core product pillars (bottom-dock-first, low-attention UX, etc.) are not affected.

For ops/dev-tooling additions:

  • Script uses standard bash shebang and POSIX-compliant options.
  • Documentation is well-structured with clear sections.
  • Both files follow repository patterns (documentation in docs/, scripts in scripts/).

No validation tests required—this is not game logic.

Linked Issue Fit

Issue #127 acceptance criteria are fully addressed:

Criterion Status Evidence
Identify merged/stale generated branches Script uses git branch --merged and pattern matching for fix/*, pr-*
Delete branches that are safe to remove 43 branches pruned (35 fix/* + 8 pr-*); safety rules protect active work
Document branch cleanup expectations docs/branch-cleanup.md defines policy, procedure, and naming conventions

Evidence Provider Findings

None configured.

Tool Harness Findings

No tool requests were executed. Tool harness ran in plan_execute_once mode with no security concerns.

Repository Impact Scan

Unknowns / Needs Verification

None. The PR is self-contained with clear evidence of successful branch cleanup (43 branches removed) and complete documentation matching the issue requirements.

@joryirving
joryirving enabled auto-merge May 23, 2026 20:03
@joryirving
joryirving merged commit 14635cd into main May 23, 2026
4 checks passed
@joryirving
joryirving deleted the saffron/prune-stale-branches branch May 23, 2026 20:03
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.

P2: Prune merged/generated fix branches after PR completion

2 participants