build(opencode): install OpenCode 2 from @opencode/cli #61

Merged
claudiomaradonna merged 2 commits from feat/opencode-2-pin into master 2026-10-29 15:19:37 +01:00
Collaborator

Why

Since the Agent Foundry upgrade (#60), the repository's OpenCode hooks,
the shell check and the main-checkout guard, are OpenCode 2 plugins. The
OpenCode image still installs opencode-ai unpinned, and that package
stops at 1.19.5, so every opencode container runs OpenCode 1. OpenCode
1 does not load V2 plugins, so agent edits there skip both hooks.
OpenCode 2 is published as @opencode/cli (2.2.1 today), by the same
maintainer through the same trusted publishing from
https://github.com/anomalyco/opencode. An exact @2.2.1 pin was
weighed and set aside: rebuilds already bring each client's latest
release, and an exact pin would need a manual bump each time.

What changed

The OpenCode image now installs @opencode/cli@2, so each install run
and each rebuild at launch brings the latest 2.x, never a 1.x or a 3.x
and never a prerelease. The image's user, directories, PATH, entrypoint
and OPENCODE_DISABLE_AUTOUPDATE are unchanged. docs/installation.md
says once, where it describes the install run, that OpenCode's latest
release stays within major version 2.

Breaking for OpenCode users: the next rebuild moves them from 1.19.5 to
2.x. OpenCode 2 reads its configuration from the same
~/.config/opencode.

How to verify

On real rootless Podman, from a checkout of the branch:

  1. make build-opencode, then podman run --rm --entrypoint opencode opencode-cli:latest --version
    prints a 2. version (master gives 1.19.5).
  2. make test-e2e and make smoke-images pass.

On the tip, Verify (make lint && .agents/hooks/shellcheck.sh repo && make test) passes: 348 tests, 0 failures. The extended unit test
test_opencode_stage_has_only_opencode_identity_and_install fails on
master at "missing OpenCode 2 CLI installation" and "unexpected OpenCode
1 package". The image was not built here, because no real Podman was
available.

Considerations

OpenCode 2 has not yet run in the image. These points are unconfirmed
until the real-Podman gate runs:

  • whether OPENCODE_DISABLE_AUTOUPDATE still has any effect, since V2
    documents an update config option instead;
  • V2's background service;
  • the CLI flags the docs use (run --auto, --session, auth,
    session list);
  • the --version output the installer's version tag reads;
  • the XDG state layout;
  • whether the hooks run.

Any change these call for comes as a separate change.

## Why Since the Agent Foundry upgrade (#60), the repository's OpenCode hooks, the shell check and the main-checkout guard, are OpenCode 2 plugins. The OpenCode image still installs `opencode-ai` unpinned, and that package stops at 1.19.5, so every `opencode` container runs OpenCode 1. OpenCode 1 does not load V2 plugins, so agent edits there skip both hooks. OpenCode 2 is published as `@opencode/cli` (2.2.1 today), by the same maintainer through the same trusted publishing from https://github.com/anomalyco/opencode. An exact `@2.2.1` pin was weighed and set aside: rebuilds already bring each client's latest release, and an exact pin would need a manual bump each time. ## What changed The OpenCode image now installs `@opencode/cli@2`, so each install run and each rebuild at launch brings the latest 2.x, never a 1.x or a 3.x and never a prerelease. The image's user, directories, PATH, entrypoint and `OPENCODE_DISABLE_AUTOUPDATE` are unchanged. `docs/installation.md` says once, where it describes the install run, that OpenCode's latest release stays within major version 2. Breaking for OpenCode users: the next rebuild moves them from 1.19.5 to 2.x. OpenCode 2 reads its configuration from the same `~/.config/opencode`. ## How to verify On real rootless Podman, from a checkout of the branch: 1. `make build-opencode`, then `podman run --rm --entrypoint opencode opencode-cli:latest --version` prints a `2.` version (master gives `1.19.5`). 2. `make test-e2e` and `make smoke-images` pass. On the tip, Verify (`make lint && .agents/hooks/shellcheck.sh repo && make test`) passes: 348 tests, 0 failures. The extended unit test `test_opencode_stage_has_only_opencode_identity_and_install` fails on master at "missing OpenCode 2 CLI installation" and "unexpected OpenCode 1 package". The image was not built here, because no real Podman was available. ## Considerations OpenCode 2 has not yet run in the image. These points are unconfirmed until the real-Podman gate runs: - whether `OPENCODE_DISABLE_AUTOUPDATE` still has any effect, since V2 documents an `update` config option instead; - V2's background service; - the CLI flags the docs use (`run --auto`, `--session`, `auth`, `session list`); - the `--version` output the installer's version tag reads; - the XDG state layout; - whether the hooks run. Any change these call for comes as a separate change.
OpenCode 2 is published as @opencode/cli; opencode-ai stops at 1.19.5,
which does not run the repository's OpenCode 2 hook plugins. Pin the
major so each rebuild takes the latest 2.x.
docs(install): say OpenCode rebuilds stay on major 2
All checks were successful
publish-images / publish (push) Successful in 37m23s
26956f742e
claudiomaradonna deleted branch feat/opencode-2-pin 2026-10-29 15:19:41 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
claudiomaradonna/azkaban!61
No description provided.