Skip to content

opencode, bun: new packages - #5639

Merged
bernhardkaindl merged 2 commits into
spack:developfrom
aprozo:add-opencode
Aug 13, 2026
Merged

opencode, bun: new packages#5639
bernhardkaindl merged 2 commits into
spack:developfrom
aprozo:add-opencode

Conversation

@aprozo

@aprozo aprozo commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

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 bun package it needs to build.

Built from the tagged source archive. opencode is a bun workspace: the lockfile is bun.lock, dependencies use bun's catalog: / workspace: protocols plus patchedDependencies, and the build is Bun.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 install over the workspaces the CLI pulls in, then bun --bun ./script/build.ts --single --skip-install in packages/opencode.

bun itself is installed from the upstream release archives, in the same shape as the existing deno package: 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 PATH and re-running the build: bun and node-js at build time (the embedded web UI is built with vite, which runs on node), ripgrep at run time (otherwise opencode downloads an rg binary into the user cache at first use). git and npm are not needed.

Verified on linux-x86_64: clean spack install opencodebin/opencode, opencode --version reports 1.18.3. Companion to #5637; also exercised in the EIC eic-shell stack (eic/eic-spack#986).

@spackbot-triage spackbot-triage Bot added new-package Additions of new packages to the Spack ecosystem new-version Modifications to packages' `depends_on()` directives maintainers Modifications to a package's `maintainers()` directive licenses Modifications to a package's `license()` directive labels Jul 17, 2026
@alecbcs

alecbcs commented Jul 17, 2026

Copy link
Copy Markdown
Member

@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.

@aprozo

aprozo commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

Thanks a lot, @alecbcs , will do!

@spackbot-triage spackbot-triage Bot added the dependencies Modifications with a `depends_on()` directive label Jul 28, 2026
aprozo added a commit to eic/eic-spack that referenced this pull request Jul 28, 2026
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.
aprozo added a commit to eic/eic-spack that referenced this pull request Jul 28, 2026
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.
@aprozo aprozo changed the title opencode: new package opencode, bun: new packages Jul 28, 2026
@aprozo

aprozo commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

@alecbcs, done but had to add bun as well

@bernhardkaindl

bernhardkaindl commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

@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?
You already created a url_for_version for this PR, you can use it again to implement Wouter's suggestion:

@bernhardkaindl
bernhardkaindl marked this pull request as ready for review August 13, 2026 18:03
@bernhardkaindl
bernhardkaindl enabled auto-merge (squash) August 13, 2026 18:04
@bernhardkaindl

bernhardkaindl commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

@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):

@spackbot run pipeline

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.

@spackbot-app

spackbot-app Bot commented Aug 13, 2026

Copy link
Copy Markdown

I've started that pipeline for you!

@bernhardkaindl
bernhardkaindl merged commit 55be3f7 into spack:develop Aug 13, 2026
17 checks passed
@aprozo
aprozo deleted the add-opencode branch August 31, 2026 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Modifications with a `depends_on()` directive licenses Modifications to a package's `license()` directive maintainers Modifications to a package's `maintainers()` directive new-package Additions of new packages to the Spack ecosystem new-version Modifications to packages' `depends_on()` directives

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants