feat(cli): Add --spawn flag to enable headless operation in claude-rc and default to worktree spawn mode

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
autocommit 2026-06-06 20:54:27 -07:00
parent ea2bf79ed5
commit 3442ed9607

View file

@ -64,7 +64,11 @@ case "$cmd" in
dir=$(reg_dir "$name")
[ -n "$dir" ] || { echo "claude-rc: '$name' not in $REG" >&2; exit 1; }
cd "$dir" || { echo "claude-rc: dir missing: $dir" >&2; exit 1; }
exec claude rc --name "$name"
# --spawn is mandatory for headless operation: without it `claude rc`
# prompts "Choose [1/2]" for spawn mode and blocks forever. Default to
# worktree (isolated session per spawn — safe for concurrent agents);
# override per-instance with CLAUDE_RC_SPAWN=same-dir|session.
exec claude rc --name "$name" --spawn "${CLAUDE_RC_SPAWN:-worktree}"
;;
list|ls)
printf '%-16s %-10s %s\n' NAME STATE DIR