ContextStudioWizard/lib/core.sh
Karamelmar 3a7dfb6b1a Fix Electron not opening: run npm install on core + check DISPLAY
- core.sh: run npm install after cloning (downloads Electron binary
  into app/node_modules — required for the UI to launch)
- start.sh template: check if app/node_modules exists and run
  npm install on first start if missing
- start.sh template: warn if DISPLAY/WAYLAND_DISPLAY not set

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 13:13:15 +01:00

31 lines
1.1 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"
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"
}