fix(workflow): wt-rm removes only the named worktree (was auto-sweeping merged ones)
The first wt-clean.sh removed every worktree whose branch was merged into origin/main — but long-lived branches (website, the ci line) are merged too, so it would have deleted their worktrees. Caught on review before any real use. Replace the auto-sweep with an explicit `wt-rm <branch>` that removes only the named worktree; safety comes from git's own refusals — it won't remove a dirty worktree (no --force) and deletes the local branch only when it's merged into origin/main, otherwise keeps it (and its unmerged commits). Update test-wt.sh to 15 checks (incl. "unnamed worktree untouched", primary refused, dirty refused, unmerged branch preserved) and the wt-clean references in ADR-0059 / CLAUDE.md / the README index.
This commit is contained in:
@@ -284,8 +284,10 @@ operational rules an agent must follow:
|
||||
chore/ refactor/ test/ ci/`) matching the commit type.
|
||||
- **One worktree per branch — never switch the primary checkout.** Start a
|
||||
branch with `scripts/wt-new.sh <branch>` (creates branch off `origin/main`
|
||||
+ a sibling `<repo>-worktree-<segment>` worktree); tidy merged ones with
|
||||
`scripts/wt-clean.sh`. This prevents the same-directory clobber hazard.
|
||||
+ a sibling `<repo>-worktree-<segment>` worktree); remove a finished one
|
||||
with `scripts/wt-rm.sh <branch>` (removes only the *named* worktree — it
|
||||
never scans or auto-removes, so long-lived branches like `website`/`ci`
|
||||
are never at risk). This prevents the same-directory clobber hazard.
|
||||
- **Reserve ADR numbers up front** the moment an ADR is known to be needed
|
||||
(branch start *or* mid-branch): `scripts/adr-reserve.sh <slug> "<title>"`
|
||||
atomically claims the next number against `main` (ledger
|
||||
|
||||
Reference in New Issue
Block a user