feat(worktree): onboard creator by default in worktree_prepare.sh (Issue #68)

This commit is contained in:
Godopu committed 2026-10-28 15:04:51 +00:00
1 parent 3fd2416a30
commit c0e9f5c8a5
5 files changed
+77 -10

No files matched your search

@@ -6,17 +6,17 @@
# Usage:
# worktree_prepare.sh --path <WT> --branch <name> [--base <ref>] [--submodules]
# [--creator-agent <agent> [--session <name>] [--role <role>]
# [--herdr-session <s>] [--herdr-workspace <w>] [--onboard]] [--dry-run]
# [--herdr-session <s>] [--herdr-workspace <w>] [--no-onboard]] [--dry-run]
#
# Steps: git worktree (idempotent) -> the worktree's own .venv (control root
# interpreter + requirements*.txt) -> /.venv and .pytest_cache/ in the shared info/exclude -> submodules only with
# --submodules (a failed init is rolled back: it would otherwise leave a
# modules/ trace that makes a plain `git worktree remove` refuse) -> optional
# creator session registered in the control root's .mam -> summary with BASE=.
# creator session (onboarded unless --no-onboard) registered in the control root's .mam -> summary with BASE=.
#
# Exit codes: 0 ok, 1 git / submodule / create failure, 2 usage or path rule,
# 3 refused to protect existing content (nothing changed); 44/45 are create's
# (onboarding error / timeout; session and worktree kept, Issue #50).
# (onboarding error / timeout - onboarding is the default, --no-onboard skips it; session and worktree kept, Issue #50).
set -euo pipefail
_script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
@@ -27,7 +27,7 @@ usage() {
}
WT=""; BRANCH=""; BASE_REF=""; SUBMODULES=0; DRY_RUN=0
CREATOR_AGENT=""; SESSION=""; ROLE="creator"; HS=""; HW=""; ONBOARD=0
CREATOR_AGENT=""; SESSION=""; ROLE="creator"; HS=""; HW=""; ONBOARD=1
while [ $# -gt 0 ]; do
case "$1" in
--path) WT="${2:-}"; shift 2 ;;
@@ -39,7 +39,8 @@ while [ $# -gt 0 ]; do
--role) ROLE="${2:-}"; shift 2 ;;
--herdr-session) HS="${2:-}"; shift 2 ;;
--herdr-workspace) HW="${2:-}"; shift 2 ;;
--onboard) ONBOARD=1; shift ;;
--onboard) ONBOARD=1; shift ;; # the default; still accepted
--no-onboard) ONBOARD=0; shift ;;
--dry-run) DRY_RUN=1; shift ;;
-h|--help) usage; exit 0 ;;
*) echo "ERROR: unknown arg: $1" >&2; usage >&2; exit 2 ;;