Skip to content

build(opencode): release-default vendoring + one-command fork dev loop - #128

Merged
jack-champagne merged 2 commits into
mainfrom
jack/build-dx-release-default
Jul 15, 2026
Merged

jack-champagne merged 2 commits into
mainfrom
jack/build-dx-release-default

Conversation

@jack-champagne

@jack-champagne jack-champagne commented Jul 9, 2026

Copy link
Copy Markdown
Member

Why

Making a change and seeing it in amicode was fragile in two ways:

  1. The diverged-clone trap. The lock was source: local pinned to an opencode ref. If your sibling ../opencode clone sat on any other ref, pnpm install / package / fetch:opencode hard-errored — and the people guaranteed to hit it are exactly those developing opencode.
  2. The channel footgun. Every amicode surface (home cards, v2 titlebar, draft flow) is gated at runtime on settings.general.newLayoutDesigns, whose default is VITE_OPENCODE_CHANNEL !== "prod". A binary built with OPENCODE_CHANNEL=latest compiles the features in but hides them — a feature-dead build that looks broken.

What changed

  • opencode.lock.json: source local → release. A plain pnpm install / package / F5 now downloads the pinned, features-ON release binary — no clone, no bun, no ref-alignment. CI is unchanged (it already used the release fallback). Entering source mode is now an explicit command, never a committed lock edit (committing local would force clone+bun on everyone and break fork-PR CI).
  • scripts/opencode_dev.mjs (pnpm opencode:build / opencode:pin):
    • opencode:build — rebuild the binary from ../opencode with OPENCODE_CHANNEL=dev (UI gate ON) and re-vendor it.
    • opencode:pin <tag> — adopt a cut release: download + sha256-verify both platform assets and rewrite the lock (automates the old manual bump).
  • scripts/assert_ui_gate.sh — shared UI-gate check, extracted from release.yml. Now called by both release.yml and ci.yml's vsix-gate, so a feature-dead binary reds a PR, not just a release (closing a real CI gap).
  • AGENTS.md — new "Changing opencode (the vendored fork)" section; dropped the stale testing-branch checkout and the source=local default description.

Scope note

The "fast source-run" inner loop is intentionally not shipped: opencode serve from source reverse-proxies the public app.opencode.ai (see the fork's AMICODE-PATCHES.md §4), so it can't show amicode's branded/gated surfaces. The reliable loop is the one-command rebuild (opencode:build). A true web-UI HMR path (opencode's own vite dev:web, needs amicode webview rewiring) is a possible fast-follow.

Testing

  • New unit tests (test/opencode_dev.test.ts): pinFromRelease (fake seam), gate script on/off/absent fixtures, committed-lock defaults to release.
  • Real end-to-end: opencode:pin v1.17.3-amicode.4 against the live private release (downloaded both assets, shas matched, lock rewritten identically); assert_ui_gate.sh against the real vendored binary → gate ON; boot smoke → [smoke] PASS.
  • Full extension suite: 447 pass, typecheck clean.

Companion doc PR: harmoniqs/opencode#15 (AMICODE-PATCHES.md §5).

🤖 Generated with Claude Code

jack-champagne and others added 2 commits July 9, 2026 12:48
Make `pnpm install` / `package` / F5 "just work" off the pinned, features-ON
opencode release — no clone, no bun, no ref-alignment. Entering source mode is
now an explicit command, never a committed lock edit.

- opencode.lock.json: source local → release (keep ref as provenance). Kills the
  diverged-clone hard-error for everyone not changing the fork; CI is unchanged
  (it already used the release fallback).
- scripts/opencode_dev.mjs (pnpm opencode:build / opencode:pin): rebuild the
  binary from ../opencode with OPENCODE_CHANNEL=dev and re-vendor it; adopt a cut
  release by downloading + sha256-verifying both assets and rewriting the lock.
- scripts/assert_ui_gate.sh: shared UI-gate check (newLayoutDesigns default ON).
  release.yml now calls it; ci.yml vsix-gate calls it too — a feature-dead binary
  reds a PR, not just a release.
- AGENTS.md: add "Changing opencode" section; drop the stale testing-branch checkout.

Tests: pinFromRelease (fake seam + live release), gate on/off/absent fixtures.
Full extension suite 447 pass, typecheck clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…-default

# Conflicts:
#	packages/extension/opencode.lock.json
@jack-champagne
jack-champagne merged commit 294029e into main Jul 15, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant