Skip to content

Commit 9e22c40

Browse files
committed
feat: align V2 beta release channels
1 parent 467722c commit 9e22c40

23 files changed

Lines changed: 129 additions & 465 deletions

File tree

‎.github/workflows/beta.yml‎

Lines changed: 0 additions & 37 deletions
This file was deleted.

‎.github/workflows/publish.yml‎

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
- ci
88
- dev
99
- beta
10+
- v2
1011
- fix/npm-native-binary-install
1112
- snapshot-*
1213
workflow_dispatch:
@@ -32,7 +33,7 @@ permissions:
3233
packages: write
3334

3435
env:
35-
OPENCODE_CHANNEL: ${{ (github.ref_name == 'v2' && 'next') || '' }}
36+
OPENCODE_CHANNEL: ${{ (github.ref_name == 'v2' && 'dev') || '' }}
3637

3738
jobs:
3839
version:
@@ -45,6 +46,13 @@ jobs:
4546

4647
- uses: ./.github/actions/setup-bun
4748

49+
- name: Deploy update service
50+
if: github.ref_name == 'v2' || github.ref_name == 'beta'
51+
working-directory: packages/updates
52+
run: bun run deploy
53+
env:
54+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
55+
4856
- name: Setup git committer
4957
id: committer
5058
uses: ./.github/actions/setup-git-committer
@@ -74,7 +82,7 @@ jobs:
7482
build-cli:
7583
needs: version
7684
runs-on: blacksmith-4vcpu-ubuntu-2404
77-
if: github.repository == 'anomalyco/opencode' && github.ref_name != 'beta'
85+
if: github.repository == 'anomalyco/opencode'
7886
steps:
7987
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
8088
with:
@@ -188,7 +196,7 @@ jobs:
188196

189197
build-node-cli:
190198
needs: version
191-
if: github.repository == 'anomalyco/opencode' && github.ref_name != 'beta'
199+
if: github.repository == 'anomalyco/opencode'
192200
strategy:
193201
fail-fast: false
194202
matrix:
@@ -338,6 +346,7 @@ jobs:
338346
build-electron:
339347
needs:
340348
- version
349+
- sign-cli-macos
341350
if: github.repository == 'anomalyco/opencode' && github.ref_name != 'v2'
342351
continue-on-error: false
343352
env:
@@ -376,6 +385,12 @@ jobs:
376385
steps:
377386
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
378387

388+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
389+
if: github.ref_name == 'beta'
390+
with:
391+
name: opencode-preview-cli
392+
path: packages/cli/dist
393+
379394
- uses: apple-actions/import-codesign-certs@8f3fb608891dd2244cdab3d69cd68c0d37a7fe93 # v2.0.0
380395
if: runner.os == 'macOS'
381396
with:
@@ -434,6 +449,7 @@ jobs:
434449
OPENCODE_VERSION: ${{ needs.version.outputs.version }}
435450
OPENCODE_CHANNEL: ${{ (github.ref_name == 'beta' && 'beta') || 'prod' }}
436451
OPENCODE_CLI_TARGET: ${{ matrix.settings.target }}
452+
OPENCODE_CLI_DIST: ${{ (github.ref_name == 'beta' && format('{0}/packages/cli/dist', github.workspace)) || '' }}
437453

438454
- name: Build
439455
run: bun run build
@@ -572,13 +588,11 @@ jobs:
572588
path: packages/opencode/dist
573589

574590
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
575-
if: github.ref_name != 'beta'
576591
with:
577592
name: opencode-preview-cli
578593
path: packages/cli/dist
579594

580595
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
581-
if: github.ref_name != 'beta'
582596
with:
583597
pattern: opencode-node-cli-*
584598
path: packages/cli/dist/node

‎AGENTS.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
- Run `bun run dev:live` from a development worktree to test its TUI against the currently elected `opencode2` background server and live sessions.
1111
- Pass a directory after the script when needed, for example `bun run dev:live /path/to/project`.
12-
- The script discovers the server with `opencode2 service status`, injects its private local credential from `opencode2 service get password`, and uses the `next` TUI storage channel so tabs and other client-local state match the installed client.
12+
- The script discovers the server with `opencode2 service status`, injects its private local credential from `opencode2 service get password`, and uses the `dev` TUI storage channel so tabs and other client-local state match the installed client.
1313
- Prefer `dev:live` over plain `bun run dev` for this workflow. An implicit managed-service connection may replace the live server when the worktree client version differs; explicit `--server` warns and continues without replacing it.
1414

1515
## V2 TUI Stories

‎install‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ Usage: install.sh [options]
1515
1616
Options:
1717
-h, --help Display this help message
18-
-v, --version <version> Install a specific version (e.g., 0.0.0-next-17236)
18+
-v, --version <version> Install a specific version (e.g., 0.0.0-beta-17236)
1919
-b, --binary <path> Install from a local binary instead of downloading
2020
--no-modify-path Don't modify shell config files (.zshrc, .bashrc, etc.)
2121
2222
Examples:
2323
curl -fsSL https://raw.githubusercontent.com/anomalyco/opencode/v2/install | bash
24-
curl -fsSL https://raw.githubusercontent.com/anomalyco/opencode/v2/install | bash -s -- --version 0.0.0-next-17236
24+
curl -fsSL https://raw.githubusercontent.com/anomalyco/opencode/v2/install | bash -s -- --version 0.0.0-beta-17236
2525
./install --binary /path/to/opencode2
2626
EOF
2727
}
@@ -166,7 +166,7 @@ else
166166
fi
167167

168168
if [ -z "$requested_version" ]; then
169-
metadata=$(curl -fsSL https://registry.npmjs.org/@opencode-ai%2fcli/next || true)
169+
metadata=$(curl -fsSL https://registry.npmjs.org/@opencode-ai%2fcli/beta || true)
170170
specific_version=$(echo "$metadata" | sed -n 's/.*"version":"\([^"]*\)".*/\1/p')
171171

172172
if [ -z "$specific_version" ]; then

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"packageManager": "[email protected]",
99
"scripts": {
1010
"dev": "bun run --cwd packages/cli --conditions=browser src/index.ts",
11-
"dev:live": "OPENCODE_TUI_CHANNEL=next OPENCODE_PASSWORD=\"$(opencode2 service get password)\" bun run dev --server \"$(opencode2 service status)\"",
11+
"dev:live": "OPENCODE_TUI_CHANNEL=dev OPENCODE_PASSWORD=\"$(opencode2 service get password)\" bun run dev --server \"$(opencode2 service status)\"",
1212
"dev:desktop": "bun --cwd packages/desktop dev",
1313
"dev:web": "bun --cwd packages/app dev",
1414
"dev:console": "ulimit -n 10240 2>/dev/null; bun run --cwd packages/console/app dev",

‎packages/cli/script/publish.ts‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,13 @@ async function published(name: string, version: string) {
1414

1515
async function publish(dir: string, name: string, version: string) {
1616
if (process.platform !== "win32") await $`chmod -R 755 .`.cwd(dir)
17-
if (await published(name, version)) return console.log(`already published ${name}@${version}`)
18-
await $`bun pm pack`.cwd(dir)
19-
await $`npm publish *.tgz --access public --tag ${Script.channel}`.cwd(dir)
17+
const exists = await published(name, version)
18+
if (exists) console.log(`already published ${name}@${version}`)
19+
if (!exists) {
20+
await $`bun pm pack`.cwd(dir)
21+
await $`npm publish *.tgz --access public --tag ${Script.channel}`.cwd(dir)
22+
}
23+
if (Script.channel === "beta") await $`npm dist-tag add ${`${name}@${version}`} next`
2024
}
2125

2226
async function publishDistribution(input: { root: string; name: string; binary: string; packagePrefix: string }) {

‎packages/cli/src/server-process.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ const processEffect = Effect.fnUntraced(function* (options: Options) {
8484
database: {
8585
path:
8686
process.env.OPENCODE_DB ??
87-
(["latest", "beta", "next", "prod"].includes(OPENCODE_CHANNEL) ||
87+
(["latest", "dev", "beta", "next", "prod"].includes(OPENCODE_CHANNEL) ||
8888
process.env.OPENCODE_DISABLE_CHANNEL_DB === "1" ||
8989
process.env.OPENCODE_DISABLE_CHANNEL_DB === "true"
9090
? "opencode.db"

‎packages/cli/src/services/service-config.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ const decodeInfo = Schema.decodeUnknownEffect(Schema.fromJsonString(Info))
2525
const decodeRegistration = Schema.decodeUnknownEffect(Schema.fromJsonString(Service.Info))
2626

2727
export function filename(channel = OPENCODE_CHANNEL) {
28-
if (channel === "latest" || channel === "next") return "service.json"
28+
if (channel === "latest" || channel === "dev" || channel === "beta" || channel === "next") return "service.json"
2929
return `service-${channel.replace(/[^a-zA-Z0-9._-]/g, "-")}.json`
3030
}
3131

3232
export function defaultPort(channel = OPENCODE_CHANNEL) {
33-
if (channel === "latest" || channel === "next") return 0xc0de
33+
if (channel === "latest" || channel === "dev" || channel === "beta" || channel === "next") return 0xc0de
3434
if (channel === "local") return 0xc0df
3535
return 10_000 + (Number.parseInt(Hash.fast(channel).slice(0, 8), 16) % 50_000)
3636
}

‎packages/cli/src/services/updater.test.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ describe("updater", () => {
3535
test("accepts strict release version variants", () => {
3636
expect(action("v1.2.3", " 1.2.4\n", true)).toBe("upgrade")
3737
expect(action("1.2.3-alpha.1", "1.2.3-alpha.2", true)).toBe("upgrade")
38-
expect(action("0.0.0-next-17403", "0.0.0-next-17403.2", true)).toBe("upgrade")
38+
expect(action("0.0.0-dev-17403", "0.0.0-dev-17403.2", true)).toBe("upgrade")
39+
expect(action("0.0.0-next-17403", "0.0.0-beta-17404", true)).toBe("upgrade")
3940
expect(action("1.2.3+old", "1.2.3+new", true)).toBe("none")
4041
expect(action("v1.2.3+old", "1.2.3", true)).toBe("none")
4142
})

‎packages/cli/test/service.test.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import { ServiceConfig } from "../src/services/service-config"
1111

1212
test("managed service ports are stable per installation channel", () => {
1313
expect(ServiceConfig.defaultPort("latest")).toBe(0xc0de)
14+
expect(ServiceConfig.defaultPort("dev")).toBe(0xc0de)
15+
expect(ServiceConfig.defaultPort("beta")).toBe(0xc0de)
1416
expect(ServiceConfig.defaultPort("next")).toBe(0xc0de)
1517
expect(ServiceConfig.defaultPort("local")).toBe(0xc0df)
1618
expect(ServiceConfig.defaultPort("preview-a")).toBe(ServiceConfig.defaultPort("preview-a"))
@@ -37,6 +39,8 @@ test("local channel stores service config with the local service filename", asyn
3739

3840
test("service filenames share release channels and identify preview channels", () => {
3941
expect(ServiceConfig.filename("latest")).toBe("service.json")
42+
expect(ServiceConfig.filename("dev")).toBe("service.json")
43+
expect(ServiceConfig.filename("beta")).toBe("service.json")
4044
expect(ServiceConfig.filename("next")).toBe("service.json")
4145
expect(ServiceConfig.filename("local")).toBe("service-local.json")
4246
expect(ServiceConfig.filename("preview-a")).toBe("service-preview-a.json")

0 commit comments

Comments
 (0)