ContextStudioWizard/lib/core.sh
Karamelmar 7c9b61bfce 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>
2026-03-09 21:20:25 +01:00

32 lines
1.2 KiB
Bash

#!/usr/bin/env bash
# core.sh — manage the global context-studio-core installation
CS_CORE_REPO="git@github.com:KlausUllrich/context-studio-core.git"
CS_HOME="${CS_HOME:-$HOME/.context-studio}"
CS_CORE_DIR="$CS_HOME/core"
setup_core() {
header "Context Studio Core"
if [[ -d "$CS_CORE_DIR/.git" ]]; then
success "Core installed at $CS_CORE_DIR"
ask_yn _update "Pull latest updates?" "n"
if [[ "$_update" == "y" ]]; then
spin "Updating core..." git -C "$CS_CORE_DIR" pull --ff-only \
|| warn "Pull failed — continuing with current version."
success "Core updated"
fi
return 0
fi
info "Cloning context-studio-core → $CS_CORE_DIR"
mkdir -p "$CS_HOME"
_WIZARD_CORE_CLONED=true
spin "Cloning context-studio-core..." \
git clone "$CS_CORE_REPO" "$CS_CORE_DIR" \
|| die "Failed to clone context-studio-core. Check your SSH key and network."
spin "Installing core dependencies (npm install)..." \
bash -c "cd '$CS_CORE_DIR' && npm install" \
|| die "npm install failed for context-studio-core."
success "Core installed at $CS_CORE_DIR"
}