Repository navigation
feat(cli): ship a standalone binary built as a Node 26 SEA - #76
Merged
Merged
Conversation
Stop building and publishing @codeworksh/tui-darwin-x64; the package is deprecated on npm. The launcher now reports darwin-x64 as unsupported instead of naming a package that no longer ships. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A host bundled into one file, like the standalone binary, has no effect
on disk for plugins to resolve to. It now publishes its modules through
Plugin.share on globalThis[Symbol.for("codework.v1.effect")] (and
codework.v1.plugin), and the plugin loader serves them as virtual modules
that load each one on first import. Unbundled hosts resolve as before.
scripts/shared.mjs generates that registry, with every public module's
export names, for the CLI bundle.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`vp run bundle` writes dist/sea: the whole CLI as one ESM file, entry src/sea.ts, beside the assets the binary embeds. Before the CLI starts, the entry unpacks them to a per-user cache keyed by their content hash, publishes the CLI's effect for plugins, and names the unpacked paths. Packages that load files from beside their own modules are unpacked as a real node_modules instead of bundled: just-bash (its sqlite3 worker and zstd and xz addons) and photon. The harness resolves them from CODEWORK_PACKAGES. node-liblzma is rebuilt with xz linked statically, so the binary needs no system liblzma. The image worker is bundled on its own, and a managed server re-spawns the binary itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`vp run sea` injects the bundle into the official Node 26.11.1 for this platform, checked against its pinned sha256, as a single executable application with every asset embedded, and signs it ad hoc on macOS. A SEA's main module has no import.meta.resolve and its own import() reaches only built-ins. The bundled entry now borrows a resolver through Plugin.lendResolve, and unpacked packages load through importModule. The bundle also defines __dirname and __filename, which npm's installer reads, so plugins install from git and the registry inside the binary. test/sea.test.ts runs the binary with no Node on PATH: it unpacks its assets, runs a plugin through the shared effect, runs sqlite3, zstd and xz in the virtual shell against live models, and installs and runs plugins from git and npm when CODEWORK_PLUGIN_LIVE=1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dev and main now build the binary for darwin-arm64, linux-arm64 and linux-x64, each on its own runner, run the offline binary test, and attach cli-<os>-<arch>.tar.gz to a GitHub Release: `devel`, one prerelease replaced on every dev push, or `cli-v<version>`, marked latest. canary stays npm-only, and npm never waits on the binary. The run computes its release id once (scripts/version.mjs) and every job uses it, so the binary reports the version npm publishes. The binary test's artifact no longer depends on the platform. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ships
codeworkas a standalone binary, so users no longer need Node installed. It is a Node 26 single executable application (SEA): official Node with the CLI bundled into it.How it works
vp run bundle): the whole CLI as one ESM file, entrysrc/sea.ts. Before the CLI starts, the entry unpacks the files that must exist on disk to a per-user cache ($TMPDIR/codework-node-<uid>/<hash>-<os>-<arch>, mode 0700, written atomically). It also gives plugins the CLI's owneffect.globalThis[Symbol.for("codework.v1.effect")](andcodework.v1.plugin). The plugin loader serves them as virtual modules that load each one lazily. Unbundled installs resolve exactly as before.node_modulesthat the harness resolves fromCODEWORK_PACKAGES. node-liblzma is rebuilt with xz linked statically, so no system liblzma is needed. just-bash'spythonandjs-execare not shipped, because the harness doesn't enable them.import.meta.resolve, and itsimport()reaches only built-ins. So resolution borrows a resolver (Plugin.lendResolve) and imports go throughimportModule. The bundle also defines__dirnameand__filenamefor npm's installer.vp run sea): Node 26.11.1 checked against a pinned sha256,--build-seawithmainFormat: "module", and ad-hoc signing on macOS.@codeworksh/tui-darwin-x64is deprecated on npm).Releases
publish.ymlbuilds the binary for darwin-arm64, linux-arm64 and linux-x64 ondevandmain, each on its own runner. Each row runs the offline binary test, and thereleasejob attachescli-<os>-<arch>.tar.gzto a GitHub Release:devel, one prerelease replaced on every push →releases/download/devel/cli-<os>-<arch>.tar.gzcli-v<version>, marked latest →releases/latest/download/cli-<os>-<arch>.tar.gznpm publishing doesn't wait on the binary. The run computes its release id once (
scripts/version.mjs), so the binary reports the same version npm publishes.Testing
packages/codework/test/sea.test.tsruns the real binary with no Node onPATH:Schema.Finitetool works, andsqlite3,tar --zstdandtar -Jrun in the virtual shell;CODEWORK_PLUGIN_LIVE=1: plugins install from the npm registry and from git (codework-tool-spacex v0.5.0 and codework-prompt-musk v0.4.0, both updated to the current SDK), and the spacex tool runs.All 4 pass locally on darwin-arm64.
vp checkand typecheck are clean.The workflow changes can only be proven on GitHub, so the first
devrun after merge is their real test. Things to watch:nodein/usr/bin, which the offline test asserts;ubuntu-24.04-arm.Not covered yet: the
codework.sh/installscript, and loading third-party sandbox drivers from the plugin store.🤖 Generated with Claude Code