Commit graph

19 commits

Author SHA1 Message Date
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
ab7b777ced Add handover doc, update README with Option B architecture
README: rewritten to reflect actual Option B architecture (Electron on
host, agents in container), correct start.sh usage, bin/claude routing,
and portability. Remove outdated manual docker run instructions.

HANDOVER.md: documents all fixes made this session, what is unverified,
what still needs testing (claude-code check, localhost:null, network),
and key architecture facts for the next session.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 13:45:37 +01:00
16c0053d68 Fix: bin/claude fallback workdir when cwd is outside mounted project
When CS Core's A2A server process (cwd = ~/.context-studio/core) runs
'claude --version' to check requirements, bin/claude passed --workdir $PWD
to podman exec. But the core dir is not mounted in the container, so
podman fails → check reports claude-code missing → server exits code 1.

Fix: if $PWD is not under $PROJECT_DIR (the only mounted path), fall back
to $PROJECT_DIR as the container workdir.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 13:43:30 +01:00
0028ef4262 Fix: run container as host user, let Electron manage A2A servers
Two fixes:
1. Add --user $(id -u):$(id -g) and -e HOME to container run so Claude
   Code doesn't run as root (--dangerously-skip-permissions is rejected
   by claude when running as root/sudo).

2. Remove redundant `node start.js --ui-mode=headless` from start.sh.
   The Electron app already manages server startup via server-management.js
   (lock file check → spawn headless servers → wait for health). Running
   a second server process causes port conflicts and double-start noise.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 13:34:42 +01:00
b73b2ca7d8 Fix: launch Electron UI separately after A2A servers start
CS Core's start.js only starts A2A servers in electron mode — it does
NOT launch the Electron app itself (it says 'Electron app started
separately'). Switch to --ui-mode=headless for the background servers,
then explicitly launch electron from app/node_modules/.bin/electron.
Wait for registry /health before opening UI. Shut down servers when
Electron window is closed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 13:24:38 +01:00
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
0b48d9bd21 Create ~/.anthropic before container start if it doesn't exist
Podman refuses to bind-mount a path that doesn't exist on the host.
On a fresh machine ~/.anthropic won't exist until claude is first run.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 13:10:15 +01:00
699087f08c Redesign wizard UI with gum (charmbracelet)
- Bootstrap gum automatically on first run (Arch/Debian/RHEL/Fedora/SUSE)
- utils.sh: replace all bash color helpers with gum equivalents
  - gum input for text prompts (with value pre-fill for defaults)
  - gum choose for selection menus
  - gum confirm for yes/no
  - gum spin for long-running operations
  - gum style/log for output (catppuccin mocha palette)
  - gum style for banners and summary box
- core.sh: spinner on git clone/pull
- workflow.sh: spinner on git clone
- prereqs.sh: spinner on package installs
- wizard.sh: double-border welcome banner, rounded summary box,
  success banner with next-steps panel

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 13:02:42 +01:00
8a82d27dae Add update.sh to generated project scripts
Updates three things:
1. Context Studio Core — git pull on ~/.context-studio/core
2. Claude Code — npm install -g @anthropic-ai/claude-code in container
3. OS packages — apt-get update + upgrade in container

If container is not running, in-container steps are skipped with a warning.
Offers optional full image rebuild (--pull --no-cache) for a clean slate.
Warns that in-container updates are ephemeral without a rebuild.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 12:54:59 +01:00
6aa4c22d9e Fix race condition: wait for container ready before launching CS Core
podman run -d returns before the container process is running.
CS Core's claude-code check immediately calls our wrapper, which
found the container not yet running and exited 1 — causing the
"claude-code not found" error.

Add a poll loop (10 x 0.5s) that waits for State.Running=true
before setting PATH and launching CS Core.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 12:42:59 +01:00
120fc913f4 Warn user that first start.sh run builds the image and takes time
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 12:34:08 +01:00
dcc7a2aed7 Implement Option B: CS Core on host, agents inside container
- New lib/container.sh generates three files per project:
  - bin/claude: wrapper that routes every claude call into the
    agents container via `podman/docker exec --workdir $PWD`
  - start.sh: builds image if missing, starts detached container
    with project mounted at same absolute path as host, prepends
    bin/ to PATH, then launches CS Core on the host
  - stop.sh: stops and removes the agents container

- Container mounts project at identical host path so CS Core's
  working directory paths resolve correctly inside the container
- TTY detection in wrapper: uses -it when stdin is a terminal,
  -i otherwise (node-pty compatibility)
- Container stopped automatically when CS Core exits

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 12:29:38 +01:00
48011dd915 Show prominent cd command after wizard completes
- Print green "Enter your project now: cd <path>" at the top of next steps
- Add "(must be inside the project folder)" note to CLI option

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 12:18:30 +01:00
af065f0def Auto-detect existing projects directory, default to ~/Projects
Checks ~/Projects, ~/projects, ~/Dev, ~/Workspace, ~/Code, ~/src etc.
Uses the first one that exists; falls back to ~/Projects if none found.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 12:13:37 +01:00
431e5493fc Fix set -e bug causing silent exit after valid input
- Replace all `[[ condition ]] && die` with `if/fi` — the && pattern
  exits silently when the condition is false under set -e
- Removed -e from set flags (kept -uo pipefail), all error paths are
  now explicit
- Declare `input` as local in ask/ask_yn/ask_choice to prevent leakage
- Use `read -r input || true` to handle EOF safely
- Fix ask_choice arithmetic to avoid (()) triggering exit on false

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 12:11:31 +01:00
452a603cdf Add auto-install for missing prerequisites
- New lib/prereqs.sh: detects distro (Arch, Debian/Ubuntu, RHEL/Fedora,
  openSUSE) and installs git + podman/docker if missing
- Podman preferred over docker; user chooses if neither present
- Docker install also enables systemd service and adds user to docker group
- README updated: prereqs table now shows auto-install support

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 12:05:08 +01:00
8d089c05a2 Polish README with icons and symbols
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 11:56:13 +01:00
09ff27be92 Add Context Studio Wizard — project scaffolding CLI
- wizard.sh: interactive bash wizard that scaffolds new CS projects
- lib/: utils, core install, project structure, workflow generation
- templates/: Dockerfile, devcontainer.json, agent presets (minimal/standard), system.json, roles, hook rules
- README: setup, usage, mobility workflow

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 11:49:04 +01:00
cd5b28919c Initial commit 2026-03-02 10:46:56 +01:00