fix(opencode): address review feedback on the 2.2.5 pin

Document ocm 0.6.x as requiring OpenCode 2.2.5, matching its
@opencode/theme peer, and make the package compatibility test check
bounded peer ranges instead of treating them as one version.

Linked servers on another 2.x release keep the neutral version notice,
while a different major version is shown as unsupported again through
a shared version badge.

The Docker build now fails when the bundled OpenCode is below the
supported minimum, and the entrypoint falls back to the bundled version
as the floor when OPENCODE_MIN_VERSION is unset instead of discarding
every persisted binary.
This commit is contained in:
Chris Scott committed 2026-11-06 09:43:35 -05:00
1 parent 807c7cb896
commit bf7c6cdbac
10 files changed
+65 -24

No files matched your search

+4 -4
View File
@@ -10,7 +10,7 @@ to the local working tree.
| ocm | OpenCode Manager | Local OpenCode |
|---|---|---|
| 0.6.x | >= 0.19.0 | >= 2.2.3, < 3 |
| 0.6.x | >= 0.19.0 | >= 2.2.5, < 3 |
| 0.5.x | >= 0.19.0 | >= 2.2.0, < 3 |
| 0.4.x | >= 0.19.0 | >= 2.0.15, < 3 |
| 0.3.x | >= 0.19.0 | >= 2.0.15, < 3 |
@@ -26,8 +26,8 @@ Use ocm 0.2.x with OpenCode Manager < 0.19.0 and OpenCode 1.x, installed pinned
release.
From ocm 0.6.0, the TUI plugin is built against `@opencode/plugin` 2.2.5 and
OpenTUI 0.8, so it requires a local OpenCode >= 2.2.3. OpenCode 2.2.0 through
2.2.2 ship OpenTUI 0.7; stay on ocm 0.5.x with those builds. ocm 0.5.0 itself
OpenTUI 0.8 and declares an `@opencode/theme` peer of `>=2.2.5`, so it requires
a local OpenCode >= 2.2.5. Stay on ocm 0.5.x with an older 2.2.x. ocm 0.5.0 itself
is built against `@opencode/plugin` 2.2.1 and OpenTUI 0.7 and requires a local
OpenCode >= 2.2.0: OpenCode 2.2.0 refuses plugins built for OpenTUI 0.6, and
older OpenCode builds may refuse the 0.7 peers. Stay on ocm 0.4.x with a local
@@ -324,7 +324,7 @@ global installs); the plugin surface is TUI-only.
## Requirements
- macOS or Linux (Windows is unsupported)
- OpenCode >= 2.2.3 (same major, 2.x) available on `PATH` for the TUI plugin
- OpenCode >= 2.2.5 (same major, 2.x) available on `PATH` for the TUI plugin
- Node available on `PATH` (runs the `ocm` binary)
- OpenCode Manager >= 0.19.0
- `git` and `tar` (with gzip support, i.e. the `-z` flag) available on `PATH`
+14 -5
View File
@@ -45,15 +45,24 @@ function deriveMinorLineRange(version: string): string {
}
/**
* Asserts that an installed version satisfies a plugin peer declaration,
* accepting both an exact peer pin and an open `>=` floor.
* Asserts that an installed version satisfies a plugin peer declaration: an exact
* pin, or space-separated `>=`, `<=` and `<` bounds such as `>=0.8.0 <0.9.0`.
*/
function expectVersionSatisfiesPeer(version: string, peer: string): void {
if (peer.startsWith('>=')) {
expect(compareSemver(version, peer.slice(2).trim())).toBeGreaterThanOrEqual(0)
const comparators = peer.trim().split(/\s+/)
if (!comparators.every((comparator) => comparator.startsWith('>=') || comparator.startsWith('<'))) {
expect(version).toBe(peer)
return
}
expect(version).toBe(peer)
for (const comparator of comparators) {
if (comparator.startsWith('>=')) {
expect(compareSemver(version, comparator.slice(2))).toBeGreaterThanOrEqual(0)
} else if (comparator.startsWith('<=')) {
expect(compareSemver(version, comparator.slice(2))).toBeLessThanOrEqual(0)
} else {
expect(compareSemver(version, comparator.slice(1))).toBeLessThan(0)
}
}
}
const ocmManifest = readManifest(join(__dirname, '..', 'package.json'))