F7 phone-home + branding triage: rename to bcode/.bcode/bcode.sh, disable self-upgrade

Merged
AL
7mo ago
+157-126

What

Medium-depth pass at ROADMAP F7 — phone-home / branding triage. Targets the visible-to-end-user "opencode" leaks surfaced by the v0.0.1 binary smoke (PROGRESS.md item 33). Easy items only; deeper sweep deferred and tracked in EXCEPTIONS.md.

Changes (6 files, +110/-7)

  • packages/opencode/src/global/index.ts — XDG app name opencode → bcode. One-time migrateLegacy() copies ~/.config/opencode/ → ~/.config/bcode/ (and same for data + state) on first launch when the new dir doesn't exist and the old does. Cache is regenerated, not migrated. Legacy directory left in place as rollback.
  • packages/shared/src/global.ts — Same XDG app name change in the parallel Effect-service Global. No migration logic here — the packages/opencode startup path runs migration once for both.
  • packages/opencode/src/server/routes/control/index.ts — OpenAPI info.title/info.description: "opencode" → "bcode".
  • packages/app/index.html — <title>OpenCode</title> → <title>BrowserCode</title>. (Embedded web UI; rebuilds on every binary build.)
  • packages/opencode/src/config/config.ts — Background @opencode-ai/plugin@<our-version> install: log.warn(...) on failure → log.debug(...). The fetch is expected to fail in BrowserCode binaries (we publish under non-@opencode-ai/plugin versions that don't exist on npm). Demoting keeps stderr clean without losing the diagnostic.
  • packages/opencode/src/index.ts — Startup log message Log.Default.info("opencode", ...) → "bcode". Visible in ~/.local/share/bcode/log/.
  • EXCEPTIONS.md (new) — ROADMAP F2 deliverable. Lists every Yellow-zone modification BrowserCode makes to upstream (rebrand, banner, A4/A5/A7, C0, this F7 pass) and a "deliberately NOT changed" section explaining what's deferred (33 theme $schema URLs, provider HTTP-Referer, TUI upsells, opencode.ai/install, opencode.db filename, etc.) with rationale per row.

Deliberately NOT changed (Yellow-zone candidates skipped this pass)

These either need product calls, would cause large diffs, or are dead code paths in compiled binaries. Tracked per-row in EXCEPTIONS.md "Deliberately NOT changed" section:

  • 33 theme *.json files with $schema: https://opencode.ai/theme.json (metadata-only, large diff).
  • provider.ts HTTP-Referer: https://opencode.ai/ (sent to LLM providers; closer to Red than Yellow).
  • TUI upsell dialogs (opencode.ai/zen, /go, /auth, /docs) (need BrowserCode equivalents).
  • installation/index.ts https://opencode.ai/install (needs bcode.sh/install to land first — ROADMAP A1+C4).
  • app.opencode.ai proxy fallback in server/routes/ui.ts (dead path in compiled binaries).
  • opencode.db data file + .opencode/ project subdir (ROADMAP G1).
  • All OPENCODE_* env vars, @opencode/... Effect service IDs, x-opencode-* headers (Red zone).

Verification

  • Filtered typecheck: bun run typecheck → 5/5 pass.
  • Single-target compile: OPENCODE_VERSION=0.0.2-f7 bun run --cwd packages/opencode build -- --single → bcode --version prints 0.0.2-f7. Build's smoke test passes.
  • Migration logic verified live on this Sprite. Pre-existing ~/.config/opencode/, ~/.local/share/opencode/, ~/.local/state/opencode/ were copied to the new bcode/ paths on first startup. Identical sizes, legacy intact for rollback.
  • End-to-end browser drive: cleared ~/.cache/bcode/harness/, ran bcode run --model anthropic/claude-haiku-4-5 ... against headless Chrome over CDP. Harness extracted (un-versioned cache from C8 confirmed working), browser_execute invoked, goto_url("https://example.com") + page_info() returned the page title.
  • OpenAPI title: curl http://localhost:13579/doc → {"title":"bcode","description":"bcode api","version":"0.0.3"}.
  • Web UI title: curl http://localhost:13579/ → <title>BrowserCode</title>.
  • Plugin install warn: demoted to debug; stderr clean during smoke runs.
  • Startup log identifier: ~/.local/share/bcode/log/<latest>.log first line now ends with ... bcode not ... opencode.

After merge: cut v0.0.2 GitHub Release with this + C8 (un-versioned harness cache, already on main).