You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(isolation): detect squash-merged and PR-merged branches in cleanup (#1027)
* Fix: detect squash-merged and PR-merged branches in isolation cleanup (#1026)
`isolation cleanup --merged` only used `git branch --merged`, which misses
squash-merged branches because the resulting commit has a different SHA.
Bulk cleanup of task worktrees required a manual `gh pr list` per branch.
Changes:
- Add `isPatchEquivalent()` to `@archon/git` using `git cherry` to detect
squash-merged branches
- Add `getPrState()` to `@archon/isolation` for `gh`-based PR state lookup
with per-invocation caching; soft-fails on missing gh / non-GitHub remotes
- `cleanupMergedWorktrees()` now unions three signals (ancestry, patch
equivalence, PR state); skips with a clear reason when PR is OPEN
- Add `--include-closed` flag to `archon isolation cleanup --merged` to
also remove worktrees whose PRs were closed without merging
- Tests for all new code paths
Fixes#1026
* fix: address review findings for squash-merge cleanup PR
- branch.ts: add 'bad revision' to isPatchEquivalent expected errors
so manually-deleted branches return false instead of throwing
- pr-state.ts: add repoPath context to warn/debug log calls;
capture ghStdout before try block to include in warn log for
parse failures
- pr-state.test.ts: remove redundant beforeEach reset (setupGhResponse
already resets); add tests for non-ENOENT gh error and malformed JSON
- cleanup-service.test.ts: add test for isPatchEquivalent unexpected
throw → skipped with 'merge check failed' reason
- isolation-operations.test.ts: add test for includeClosed: true
forwarding through cleanupMergedEnvironments
- docs: add --include-closed to all five affected docs (CLAUDE.md,
reference/cli.md, book/isolation.md, book/quick-reference.md,
getting-started/overview.md)
- cli-internals.md: add isolation cleanup --merged flow diagram
* simplify: remove redundant assignments and verbose filter in new code
0 commit comments