#!/usr/bin/env bash # Lane worktrees for the Dev โ†’ QA โ†’ lead loop (docs/loop.md). # # tools/lane.sh new create ../mwb-lanes/ on branch lane/ from main # tools/lane.sh list show live lanes # tools/lane.sh done remove the worktree (branch is kept until the lead deletes it) # # One worktree per lane, never two agents in one tree (CLAUDE.md, # Parallel lanes). The lead merges lane/ into main with --no-ff # after QA verdict and review, then runs `done`. set -euo pipefail root=$(cd "$(dirname "$0")/.." && pwd) lanes="$(dirname "$root")/mwb-lanes" cmd="${1:-}"; name="${2:-}" case "$cmd" in new) [ -n "$name" ] || { echo "usage: $0 new " >&2; exit 2; } [ -d "$root/docs/features/$name" ] || { echo "no docs/features/$name โ€” write the brief first (docs/loop.md ยง2)" >&2; exit 2; } mkdir -p "$lanes" git -C "$root" worktree add -b "lane/$name" "$lanes/$name" main echo "lane ready: $lanes/$name (branch lane/$name)" ;; list) git -C "$root" worktree list ;; done) [ -n "$name" ] || { echo "usage: $0 done " >&2; exit 2; } git -C "$root" worktree remove "$lanes/$name" echo "removed $lanes/$name; branch lane/$name kept" ;; *) echo "usage: $0 new | list | done " >&2; exit 2 ;; esac