Fix end-to-end startup: project registration, credentials, trust dialog, ready marker
- start.sh: auto-register project in ~/.config/context-studio/projects/ before launching Electron — without this acquireProjectLock() silently skips writing the lock file, waitForServers() never finds the registry port, all agent ports stay null (localhost:null errors) - start.sh: mount all known Claude Code credential locations into container (~/.claude/.credentials.json, ~/.claude.json, $CLAUDE_CONFIG_DIR variants) not just ~/.anthropic which was empty on this system - bin/claude: create /tmp/cs-ready-<agentId> on host after 3s delay so CS Core's CLI ready marker poll resolves instead of timing out after 10s - workflow.sh: add hasTrustDialogAccepted:true to all agent settings.json so claude goes straight to priming without the folder trust dialog - prereqs.sh: add ensure_api_key() — checks all credential locations, prompts with masked input if none found, offers to save to shell profile - wizard.sh: trap SIGINT for graceful abort — gum confirm popup, reverts created project dir and cloned core dir, leaves installed packages untouched - core.sh: set _WIZARD_CORE_CLONED=true before clone for cleanup tracking - electron-config.js: increase serverStartupTimeout 30s→90s (config file in core/config/, not source — safe to edit) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
ab7b777ced
commit
7c9b61bfce
7 changed files with 325 additions and 80 deletions
|
|
@ -98,8 +98,73 @@ _install_docker() {
|
|||
warn "Added $USER to docker group — log out and back in for it to take effect."
|
||||
}
|
||||
|
||||
ensure_api_key() {
|
||||
if [[ -n "${ANTHROPIC_API_KEY:-}" ]]; then
|
||||
success "ANTHROPIC_API_KEY is set"
|
||||
return
|
||||
fi
|
||||
|
||||
# Resolve config dir — CLAUDE_CONFIG_DIR overrides default ~/.claude
|
||||
local claude_dir="${CLAUDE_CONFIG_DIR:-$HOME/.claude}"
|
||||
|
||||
local creds_file=""
|
||||
if [[ -f "$claude_dir/.credentials.json" ]]; then creds_file="$claude_dir/.credentials.json"
|
||||
elif [[ -f "$HOME/.claude.json" ]]; then creds_file="$HOME/.claude.json"
|
||||
elif [[ -f "$claude_dir/.claude.json" ]]; then creds_file="$claude_dir/.claude.json"
|
||||
elif [[ -f "$HOME/.anthropic/.credentials.json" ]]; then creds_file="$HOME/.anthropic/.credentials.json"
|
||||
fi
|
||||
|
||||
if [[ -n "$creds_file" ]]; then
|
||||
success "Anthropic credentials found ($creds_file)"
|
||||
return
|
||||
fi
|
||||
|
||||
warn "ANTHROPIC_API_KEY is not set."
|
||||
echo ""
|
||||
gum style --foreground "$C_SKY" --margin "0 4" \
|
||||
"Claude Code needs an Anthropic API key to run inside the container." \
|
||||
"Get one at: https://console.anthropic.com/settings/api-keys"
|
||||
echo ""
|
||||
|
||||
local key
|
||||
key=$(gum input \
|
||||
--password \
|
||||
--placeholder "sk-ant-..." \
|
||||
--prompt " › " \
|
||||
--prompt.foreground "$C_MAUVE" \
|
||||
--cursor.foreground "$C_MAUVE" \
|
||||
--header " Anthropic API key" \
|
||||
--header.foreground "$C_SKY" \
|
||||
--width 70) || true
|
||||
|
||||
if [[ -z "$key" ]]; then
|
||||
warn "No API key entered — set ANTHROPIC_API_KEY before running ./start.sh"
|
||||
return
|
||||
fi
|
||||
|
||||
export ANTHROPIC_API_KEY="$key"
|
||||
success "ANTHROPIC_API_KEY set for this session"
|
||||
|
||||
ask_yn _save "Save to shell profile (~/.zshrc / ~/.bashrc)?" "y"
|
||||
if [[ "$_save" == "y" ]]; then
|
||||
local profile
|
||||
if [[ "$SHELL" == */zsh ]]; then
|
||||
profile="$HOME/.zshrc"
|
||||
else
|
||||
profile="$HOME/.bashrc"
|
||||
fi
|
||||
if grep -q "ANTHROPIC_API_KEY" "$profile" 2>/dev/null; then
|
||||
warn "ANTHROPIC_API_KEY already in $profile — not adding again."
|
||||
else
|
||||
printf '\nexport ANTHROPIC_API_KEY="%s"\n' "$key" >> "$profile"
|
||||
success "Saved to $profile"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
check_prerequisites() {
|
||||
header "Prerequisites"
|
||||
ensure_git
|
||||
ensure_container_runtime
|
||||
ensure_api_key
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue