Repository navigation
Commit 0e83773
fix: embed altimate-core in standalone binary and rename to altimate (match npm primary)
The curl install at the repo root produced a binary that crashed on first
run with `Cannot find module '@altimateai/altimate-core'`. Root cause:
script/build.ts marked altimate-core as `external` (NAPI native modules
can't live inside Bun's single-file bunfs), and the release archive
shipped only the raw Bun binary — no companion node_modules, no
NODE_PATH-aware wrapper. The CI smoke tests hid the bug by pre-setting
NODE_PATH against the developer checkout before invoking the binary.
The fix has two halves:
1. Self-contained binary (build-level fix)
- Drop `@altimateai/altimate-core` from requiredExternals.
- In the per-target build loop, stage a copy of the loader package and
replace its NAPI-RS dispatcher with a one-line shim:
module.exports = require('./altimate-core.<platform>.node')
Co-locate the target's `.node` file. Add a Bun.build onResolve plugin
that redirects `@altimateai/altimate-core` to the staged shim. Bun
statically sees a single require() and embeds that one .node into
bunfs. Result: ~192 MB self-contained binary, no companion files.
- Ensure every altimate-core NAPI prebuild is installed before the
target loop via `bun install --os=* --cpu=*`.
- Drop targets without an altimate-core prebuild from allTargets:
linux-*-musl and win32-arm64. release.yml's build matrix updated to
match. Re-add if/when altimate-core publishes those prebuilds.
- CI smoke tests now run the binary with NODE_PATH explicitly cleared
(`env -u NODE_PATH ...`). This turns the smoke test into a real
regression guard for the curl-install class of bug.
2. Rename the curl-install binary altimate-code → altimate
The npm package already exposes `altimate` as the primary bin and
`altimate-code` as the alias (see packages/opencode/package.json bin
block, and the postinstall banner). The curl install was the odd one
out, installing only `altimate-code`. Align it with the npm contract:
the standalone install puts `altimate` on $PATH. Drop the alias from
the curl-install path — users who want `altimate-code` get it from
npm or Homebrew.
- `install`: APP=altimate (was altimate-code). Cascades to archive
filename `altimate-<target>.{zip,tar.gz}`, INSTALL_DIR
`~/.altimate/bin`, `mv $tmp_dir/altimate $INSTALL_DIR`, and every
log line / tmp-basename / check_version reference. Final
getting-started block matches upstream opencode's shape
(cd <project> / altimate). Branding-only diff against
anomalyco/opencode's install is now 6 non-branding lines: the
file-marker line, 4 ASCII banner lines (removed), and one cosmetic
getting-started line.
- `script/build.ts`: archive step renames `@altimateai/altimate-code-<target>`
→ `altimate-<target>` and packs exactly one file (the renamed
`altimate` binary), not the sourcemaps and not the `altimate-code`
alias. The `altimate-code` copy stays inside the platform package
dir because the npm wrapper (`packages/opencode/bin/altimate`)
looks for `bin/altimate-code` to locate the platform binary —
that flow is unchanged.
- `script/publish.ts`: Homebrew + AUR formula URLs and the sha256sum
paths swap to the new `altimate-<target>` archive names. The brew
formula still installs the binary as `altimate` and creates the
`altimate-code` alias inside the Cellar — Homebrew users keep both
names.
- Tests (`branding.test.ts`, `brew-formula.test.ts`,
`smoke-test-binary.test.ts`) updated to match the new binary name
and archive prefix. Things that intentionally did NOT change:
GitHub repo URL `AltimateAI/altimate-code`, npm package name
`altimate-code`, the npm wrapper package's `bin` block.
Verification on darwin-arm64:
$ ls packages/opencode/dist/*.zip
altimate-darwin-arm64.zip # was altimate-code-darwin-arm64.zip
$ unzip -l packages/opencode/dist/altimate-darwin-arm64.zip
192306704 altimate # single file, no altimate-code
# Regression test: NODE_PATH unset, from /tmp
$ cd /tmp && env -u NODE_PATH .../bin/altimate --version
0.0.0-test
# E2E install via --binary
$ HOME=$SCRATCH bash ./install --binary .../bin/altimate
$ ls $SCRATCH/.altimate/bin
altimate
$ env -u NODE_PATH $SCRATCH/.altimate/bin/altimate --version
0.0.0-test
# Install diff vs upstream opencode — non-branding lines
$ diff -u <(curl -s https://raw.githubusercontent.com/anomalyco/opencode/dev/install) install \
| grep -E '^[-+]' | grep -vE 'opencode|altimate|anomalyco|AltimateAI|OpenCode|Altimate'
--- /tmp/upstream-install ...
-echo -e "${MUTED} ${NC} ▄ "
-echo -e "${MUTED}█▀▀█ █▀▀█ █▀▀█ █▀▀▄ ${NC}█▀▀▀ █▀▀█ █▀▀█ █▀▀█"
-echo -e "${MUTED}█░░█ █░░█ █▀▀▀ █░░█ ${NC}█░░░ █░░█ █░░█ █▀▀▀"
-echo -e "${MUTED}▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀ ▀ ${NC}▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀"
+echo -e "${MUTED}To start:${NC}"
# → file marker + ASCII banner removal + cosmetic "To start:" line.
$ bun test --timeout 60000 test/branding/ test/install/
400 pass / 0 fail
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>1 parent c859b57 commit 0e83773
7 files changed
Lines changed: 252 additions & 110 deletions
File tree
- .github/workflows
- packages/opencode
- script
- test
- branding
- install
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
63 | 65 | | |
64 | 66 | | |
65 | 67 | | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
75 | 73 | | |
76 | 74 | | |
77 | 75 | | |
| |||
113 | 111 | | |
114 | 112 | | |
115 | 113 | | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| |||
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
265 | | - | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
266 | 268 | | |
267 | 269 | | |
268 | 270 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| |||
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
222 | | - | |
223 | | - | |
| 222 | + | |
| 223 | + | |
224 | 224 | | |
225 | 225 | | |
226 | | - | |
| 226 | + | |
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
| |||
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
278 | | - | |
| 278 | + | |
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
| |||
325 | 325 | | |
326 | 326 | | |
327 | 327 | | |
328 | | - | |
329 | | - | |
| 328 | + | |
| 329 | + | |
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
| |||
340 | 340 | | |
341 | 341 | | |
342 | 342 | | |
343 | | - | |
344 | | - | |
| 343 | + | |
| 344 | + | |
345 | 345 | | |
346 | 346 | | |
347 | 347 | | |
348 | 348 | | |
349 | | - | |
350 | | - | |
351 | | - | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
352 | 352 | | |
353 | 353 | | |
354 | 354 | | |
| |||
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
369 | | - | |
| 369 | + | |
370 | 370 | | |
371 | | - | |
| 371 | + | |
372 | 372 | | |
373 | 373 | | |
374 | 374 | | |
| |||
448 | 448 | | |
449 | 449 | | |
450 | 450 | | |
451 | | - | |
452 | | - | |
| 451 | + | |
| 452 | + | |
453 | 453 | | |
454 | 454 | | |
455 | 455 | | |
| |||
0 commit comments