Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions DIVERGENCES.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ future `packages/codev-*`) never conflict and are not tracked here.
| --- | --- | --- | --- |
| `packages/core/src/global.ts` | `const app = "opencode"` → `"codev-code"` | Config/data/cache/state dirs under `~/.config/codev-code` etc. | Keep ours (the one constant); take upstream's surrounding changes. |
| `packages/opencode/src/index.ts` | `scriptName("opencode")` → `"codev"`; `show()` prefix check `"opencode "` → `"codev "` | Help/usage text shows the real user-facing command (the `codev` hub forwards unknown commands to this binary). The `show()` check must always match the scriptName. | Keep our two strings; take upstream's surrounding changes. |
| `packages/opencode/package.json` | bin key `opencode` → `codev-code` (shim path `./bin/opencode` unchanged) | Installed binary is named `codev-code`. | Keep our bin key; take upstream's other fields. |
| `packages/opencode/package.json` | bin key `opencode` → `codev-code` (shim path `./bin/opencode` unchanged); added `release` script | Installed binary is named `codev-code`; `bun run release` wraps build+publish (script/release.ts is a fork-only file). | Keep our bin key + release line; take upstream's other fields. |
| `bun.lock` | Mirrors the bin key rename above | Lockfile records workspace bin mappings. | Regenerate with `bun install`; never hand-merge. |
| `packages/opencode/script/build.ts` | Platform packages' `package.json` name `codev-code-<platform>` (dist dir names unchanged — the bun compile target derives from them) | npm publishing under the fork's names. | Keep our `name:` line; take upstream's surrounding changes. |
| `packages/opencode/script/publish.ts` | `PUBLISH_NAME = "codev-code"` const; published-name→dir map; main pkg name + bin key; env-guarded exit before the Docker/AUR/Homebrew section | npm-only publishing under the fork's names (unscoped, public on npmjs); upstream's other channels target anomalyco infra. | Keep our names + early exit; take upstream's npm-section changes above the exit. |
Expand All @@ -32,8 +32,8 @@ future `packages/codev-*`) never conflict and are not tracked here.
upgrade command before distributing outside the team.
- **Publishing**: npm packages publish as `codev-code` / `codev-code-<platform>` — unscoped,
therefore PUBLIC on npmjs (like `codev-ai`). Local-only for now (no CI workflow), run from
`packages/opencode` with npm publish auth in place:
`OPENCODE_VERSION=<x.y.z> OPENCODE_CHANNEL=latest bun run script/build.ts && bun run script/publish.ts`.
`packages/opencode` with npm publish auth in place: `bun run release <version>` (wraps
build.ts + publish.ts; `--skip-build` publishes an existing same-version dist/).
Docker/AUR/Homebrew/GitHub-release channels are upstream-only and disabled. The binary
inside platform packages is still named `opencode` (cosmetic).
- **UI branding**: TUI logo (`UI.logo()`), desktop/web app names and assets — all still
Expand Down
1 change: 1 addition & 0 deletions packages/opencode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"bench:test": "bun run script/bench-test-suite.ts",
"profile:test": "bun run script/profile-test-files.ts",
"build": "bun run script/build.ts",
"release": "bun run script/release.ts",
"dev": "bun run --conditions=browser ./src/index.ts",
"dev:temporary": "bun run --conditions=browser ./src/temporary.ts"
},
Expand Down
36 changes: 36 additions & 0 deletions packages/opencode/script/release.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env bun
import { $ } from "bun"

// Local release wrapper (fork-only file): `bun run release <version> [channel]`.
// Equivalent to running build.ts then publish.ts with OPENCODE_VERSION and
// OPENCODE_CHANNEL set — one value flows into the compiled binaries'
// --version output and all generated package.json manifests. Channel is the
// npm dist-tag and defaults to `latest`; pass e.g. `beta` for pre-releases.
//
// `--skip-build` publishes an existing dist/. The build stamps the version
// into the binaries, so only skip when dist/ was built with the SAME version.
const skipBuild = process.argv.includes("--skip-build")
const args = process.argv.slice(2).filter((a) => a !== "--skip-build")
const version = args[0]
const channel = args[1] ?? "latest"

if (!version || !/^\d+\.\d+\.\d+(-[\w.]+)?$/.test(version)) {
console.error("Usage: bun run release <version> [channel] [--skip-build]")
console.error(" e.g. bun run release 0.1.0")
process.exit(1)
}

// Fail fast on auth before a 15+ minute build. With 2FA-on-publish npm may
// still prompt per published package (13 of them); a granular token
// (`npm config set //registry.npmjs.org/:_authToken <token>`) avoids that.
if ((await $`npm whoami`.nothrow().quiet()).exitCode !== 0) {
console.error("Not logged in to npm. Run `npm login` (or configure an auth token) first.")
process.exit(1)
}

const env = { ...process.env, OPENCODE_VERSION: version, OPENCODE_CHANNEL: channel }
if (!skipBuild) await $`bun ${import.meta.dirname}/build.ts`.env(env)
await $`bun ${import.meta.dirname}/publish.ts`.env(env)

console.log(`\nReleased codev-code@${version} (dist-tag: ${channel})`)
console.log(`Verify: npm view codev-code@${version} && npm install -g codev-code`)
Loading