b6cc829f53
Phase 0 proven by hand (N=3) across multiple rooms. - scripts/gui-launch.sh: open a desktop Terminal via osascript so claude runs in the GUI session (login Keychain + real TTY), avoiding a long-lived token (D11). - scripts/launch-claude.sh: name the session `claude -n "<repo> - <topic>"` so Remote Control's phone conversation index is readable. - .env.example: bot credential schema (real .env stays gitignored). - AGENTS.md / ROADMAP.md: D11, Phase 0 results, Phase 1 carry-overs.
38 lines
1.5 KiB
Bash
Executable File
38 lines
1.5 KiB
Bash
Executable File
#!/bin/zsh -l
|
|
# launch-claude.sh — the Mac-side environment seam for matrix-bridge (decision D4).
|
|
#
|
|
# Invoked over SSH by the bot: launch-claude.sh <repo_dir> <prompt...>
|
|
# Runs as a LOGIN shell (-l) on purpose: a non-interactive SSH shell otherwise gets a
|
|
# minimal env that loads neither ~/.zprofile nor ~/.zshrc, so PATH/credentials are missing
|
|
# and `claude` isn't found. Keep ALL Mac-environment knowledge here, not in the bot.
|
|
#
|
|
# FIRST DRAFT — validate by hand in Phase 0 (see AGENTS.md "Current state") before any bot
|
|
# code calls it. Watch for the keychain/credential caveat on the very first remote launch.
|
|
|
|
repo_dir="$1"
|
|
shift
|
|
prompt="$*"
|
|
|
|
if [[ -z "$repo_dir" || -z "$prompt" ]]; then
|
|
print -u2 "usage: launch-claude.sh <repo_dir> <prompt>"
|
|
exit 2
|
|
fi
|
|
|
|
# Fail loud on a bad directory — never launch Claude in the wrong place.
|
|
cd "$repo_dir" || { print -u2 "launch-claude: no such repo dir: $repo_dir"; exit 1; }
|
|
|
|
# Name the session "<repo> - <topic>" so it's identifiable in Remote Control's
|
|
# conversation index on the phone. Topic defaults to a trimmed slice of the message;
|
|
# the Phase-1 bot can override it with a curated topic via $MB_SESSION_NAME.
|
|
repo_name="${${repo_dir%/}:t}"
|
|
if [[ -n "$MB_SESSION_NAME" ]]; then
|
|
session_name="$MB_SESSION_NAME"
|
|
else
|
|
topic="${prompt//$'\n'/ }" # collapse newlines to keep the name one line
|
|
topic="${topic[1,60]}" # cap length for a tidy index entry
|
|
[[ ${#prompt} -gt 60 ]] && topic="${topic}…"
|
|
session_name="${repo_name} - ${topic}"
|
|
fi
|
|
|
|
exec claude -n "$session_name" "$prompt"
|