diff --git a/bin/claude-rc b/bin/claude-rc index 7adaf00..08feff2 100755 --- a/bin/claude-rc +++ b/bin/claude-rc @@ -68,7 +68,12 @@ case "$cmd" in # 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}" + # --permission-mode sets the mode for spawned sessions; bypassPermissions + # so phone/web sessions run without permission prompts (override with + # CLAUDE_RC_PERM=default|acceptEdits|plan|...). + exec claude rc --name "$name" \ + --spawn "${CLAUDE_RC_SPAWN:-worktree}" \ + --permission-mode "${CLAUDE_RC_PERM:-bypassPermissions}" ;; list|ls) printf '%-16s %-10s %s\n' NAME STATE DIR diff --git a/bin/crc b/bin/crc index 37b5d17..b993ab5 100755 --- a/bin/crc +++ b/bin/crc @@ -23,7 +23,10 @@ # is omitted, $PWD is mirrored to the same path under the remote's $HOME. # # Options: -# --spawn worktree | same-dir | session (default: worktree) +# --spawn worktree | same-dir | session (default: worktree) +# --perm permission mode for spawned sessions: +# bypassPermissions | default | acceptEdits | plan | dontAsk | auto +# (default: bypassPermissions) # # Env: CRC_HOST default host when none given (default: apricot.lan) set -eu @@ -31,12 +34,13 @@ set -eu host=${CRC_HOST:-apricot.lan} action=launch # launch | stop | status | log spawn=worktree +perm=bypassPermissions have_host=0 dir_set=0 dir='' rc_args='' -usage() { sed -n '2,29p' "$0" | sed 's/^# \{0,1\}//'; } +usage() { sed -n '2,31p' "$0" | sed 's/^# \{0,1\}//'; } while [ $# -gt 0 ]; do case "$1" in @@ -45,6 +49,7 @@ while [ $# -gt 0 ]; do --status) action=status; shift ;; --log) action=log; shift ;; --spawn) [ $# -ge 2 ] || { echo "crc: --spawn needs a value" >&2; exit 2; }; spawn=$2; shift 2 ;; + --perm|--permission-mode) [ $# -ge 2 ] || { echo "crc: $1 needs a value" >&2; exit 2; }; perm=$2; shift 2 ;; --) shift; rc_args=$*; break ;; -*) echo "crc: unknown option: $1" >&2; exit 2 ;; *) @@ -91,6 +96,7 @@ NAME=$(printf %q "$name") REL=$(printf %q "$rel") ABS=$(printf %q "$abs") SPAWN=$(printf %q "$spawn") +PERM=$(printf %q "$perm") ACTION=$(printf %q "$action") RC_ARGS=$(printf %q "$rc_args") @@ -129,7 +135,7 @@ case "\$ACTION" in else cd "\$DIR" 2>/dev/null || { echo "crc: directory not found: \$DIR" >&2; exit 1; } : > "\$LOG" - nohup claude rc --name "\$NAME" --spawn "\$SPAWN" \$RC_ARGS >"\$LOG" 2>&1 & + nohup claude rc --name "\$NAME" --spawn "\$SPAWN" --permission-mode "\$PERM" \$RC_ARGS >"\$LOG" 2>&1 & echo \$! > "\$PIDF" i=0; while [ \$i -lt 20 ] && [ -z "\$(envid)" ] && alive; do sleep 1; i=\$((i+1)); done fi