opencode, bun: new packages - #5639
Conversation
|
@aprozo instead of installing opencode from the binary releases we should look at building it from source archives. An example package that should be pretty close to this one is pi/package.py. |
|
Thanks a lot, @alecbcs , will do! |
Build dependency of opencode: its lockfile, catalog:/workspace: dependency protocols and single-file-executable build are bun-specific. Mirrors the package proposed upstream in spack/spack-packages#5639; drop this copy once that lands.
Upstream review of spack/spack-packages#5639 asked for a source build rather than the per-platform GitHub release binaries. Build the tagged source archive with bun (bun install + Bun.build compile), the way nixpkgs does.
|
@alecbcs, done but had to add bun as well |
|
@aprozo, great to have working opencode in spack, well done!" I'll merge and I assume you can use the provided bun to also build the other package from source?: PS, this got two review comments by Wouter, can you implement them? |
|
@aprozo, I enabled auto-merge, it depends on GitLab CI passing (it is one of the GitHup CI check steps visible in the PR) In case the GitLab CI pipeline wasn't started (e.g still saying "GitLab CI is disabled for draft PRs"), the direct ping start it would be to send @spackbot this message (just a PR comment with only this command without the quote):
Ah, saw the command despit the quote and is making an attempt to start it ;) (might not start now as the pipeline/workers are super-busy now), if not started by tomorrow, repeat the command again. |
|
I've started that pipeline for you! |
Adds opencode (anomalyco/opencode), an open-source AI coding agent CLI — useful on headless systems (farm nodes, CI debugging) where a graphical client is not available — together with the
bunpackage it needs to build.Built from the tagged source archive. opencode is a bun workspace: the lockfile is
bun.lock, dependencies use bun'scatalog:/workspace:protocols pluspatchedDependencies, and the build isBun.build({ compile: ... }), which links the sources against the bun runtime into a single executable — so npm cannot drive it. The build steps follow the nixpkgs derivation:bun installover the workspaces the CLI pulls in, thenbun --bun ./script/build.ts --single --skip-installinpackages/opencode.bunitself is installed from the upstream release archives, in the same shape as the existingdenopackage: bun is Zig plus a patched JavaScriptCore and needs an existing bun to bootstrap. It is a separate commit and can be split into its own PR if preferred.Dependencies, each confirmed by shimming the tool out of
PATHand re-running the build:bunandnode-jsat build time (the embedded web UI is built with vite, which runs on node),ripgrepat run time (otherwise opencode downloads anrgbinary into the user cache at first use).gitandnpmare not needed.Verified on linux-x86_64: clean
spack install opencode→bin/opencode,opencode --versionreports1.18.3. Companion to #5637; also exercised in the EIC eic-shell stack (eic/eic-spack#986).