mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-05-06 16:31:08 +00:00
24 agent scripts (codex, opencode, kilocode, openclaw across 6 clouds) used `source ~/.zshrc && <agent>` which loads env vars indirectly via a hook. This fails silently when .zshrc has errors or the hook install was non-fatal, causing agents to launch without OPENROUTER_API_KEY. Change to `source ~/.spawnrc 2>/dev/null; source ~/.zshrc 2>/dev/null; <agent>` which loads env vars directly (matching claude/zeroclaw pattern) and tolerates .zshrc failures without blocking the agent. Agent: code-health Co-authored-by: B <6723574+louisgv@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
25 lines
794 B
Bash
Executable file
25 lines
794 B
Bash
Executable file
#!/bin/bash
|
|
set -eo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" 2>/dev/null && pwd)"
|
|
# shellcheck source=aws/lib/common.sh
|
|
if [[ -f "${SCRIPT_DIR}/lib/common.sh" ]]; then
|
|
source "${SCRIPT_DIR}/lib/common.sh"
|
|
else
|
|
eval "$(curl -fsSL https://raw.githubusercontent.com/OpenRouterTeam/spawn/main/aws/lib/common.sh)"
|
|
fi
|
|
|
|
log_info "Codex CLI on AWS Lightsail"
|
|
echo ""
|
|
|
|
agent_install() { install_agent "Codex CLI" "npm install -g @openai/codex@0.94.0" cloud_run; }
|
|
agent_env_vars() {
|
|
generate_env_config \
|
|
"OPENROUTER_API_KEY=${OPENROUTER_API_KEY}"
|
|
}
|
|
agent_configure() {
|
|
setup_codex_config "${OPENROUTER_API_KEY}" cloud_upload cloud_run
|
|
}
|
|
agent_launch_cmd() { echo 'source ~/.spawnrc 2>/dev/null; source ~/.zshrc 2>/dev/null; codex'; }
|
|
|
|
spawn_agent "Codex CLI"
|