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:
Eli 2026-03-09 21:20:25 +01:00
commit 7c9b61bfce
7 changed files with 325 additions and 80 deletions

View file

@ -155,10 +155,56 @@ confirm_summary() {
if [[ "$_ok" != "y" ]]; then die "Aborted."; fi
}
# ── Cleanup state tracking ────────────────────────────────────────────────
_WIZARD_CORE_CLONED=false
_WIZARD_PROJECT_CREATED=false
wizard_cleanup() {
local removed=false
if [[ "$_WIZARD_PROJECT_CREATED" == "true" && -n "${PROJECT_DIR:-}" && -d "$PROJECT_DIR" ]]; then
rm -rf "$PROJECT_DIR"
gum style --foreground "$C_GREEN" " ✓ Removed $PROJECT_DIR"
removed=true
fi
if [[ "$_WIZARD_CORE_CLONED" == "true" && -d "$CS_CORE_DIR" ]]; then
rm -rf "$CS_CORE_DIR"
gum style --foreground "$C_GREEN" " ✓ Removed $CS_CORE_DIR"
removed=true
fi
if [[ "$removed" == "false" ]]; then
gum style --foreground "$C_SURFACE" " Nothing to revert."
fi
}
handle_sigint() {
trap '' INT # block further Ctrl+C while dialog is open
echo ""
if gum confirm \
--affirmative "Yes, quit" \
--negative "No, continue" \
--default=No \
--prompt.foreground "$C_YELLOW" \
--selected.background "$C_RED" \
--selected.foreground "$C_BASE" \
--unselected.foreground "$C_TEXT" \
" Abort setup and revert changes?"; then
echo ""
gum style --foreground "$C_YELLOW" --bold " Reverting changes..."
wizard_cleanup
echo ""
gum style --foreground "$C_RED" --bold " Setup aborted."
echo ""
exit 130
fi
trap 'handle_sigint' INT # re-arm after "No, continue"
}
# ── Build ─────────────────────────────────────────────────────────────────
build_project() {
header "Building Project"
_WIZARD_PROJECT_CREATED=true
local slug
slug="$(slugify "$PROJECT_NAME")"
@ -230,6 +276,7 @@ print_next_steps() {
# ── Main ──────────────────────────────────────────────────────────────────
main() {
trap 'handle_sigint' INT
show_banner
check_prerequisites
setup_core
@ -238,6 +285,7 @@ main() {
confirm_summary
build_project
print_next_steps
trap - INT
}
main "$@"