feat(npm): ship the rewrite as @aoagents/ao via optional-deps#252
Open
harshitsinghbhandari wants to merge 3 commits into
Open
feat(npm): ship the rewrite as @aoagents/ao via optional-deps#252harshitsinghbhandari wants to merge 3 commits into
harshitsinghbhandari wants to merge 3 commits into
Conversation
Package the Go daemon as the @aoagents/ao npm package (v0.10.0) using the esbuild/swc optionalDependencies pattern: one tiny per-platform sub-package (@aoagents/ao-<os>-<arch>) carries the prebuilt daemon plus os/cpu fields, and npm installs only the host match. - bin/ao.js launcher shim resolves the installed platform sub-package, execs its daemon, and forwards argv/stdio/exit code/signals. CLI verbs talk to the daemon over loopback as before. Clear error + exit 1 when no platform package is installed. - targets.mjs is the single source of truth for the platform matrix (darwin arm64+x64, linux x64+arm64, win32 x64+arm64); check.mjs enforces that the committed optionalDependencies stay in lockstep. - build.mjs cross-compiles (CGO disabled, pure-Go SQLite) and assembles every sub-package; pack.mjs produces tarballs; collect-release.mjs flattens binaries + SHA256SUMS for GitHub Releases. - repository/homepage/bugs repointed at aoagents/ReverbCode. - release.yml (on v* tag): cross-compile all targets, publish binaries to the GitHub Release, build npm sub-packages, verify with npm publish --dry-run. - npm-publish.yml: manual, dry-run by default; a real publish requires dry_run=false AND an NPM_TOKEN secret (neither wired by default). The Electron app is fetched from GitHub Releases during migration and is out of scope here. Verified locally: full-matrix cross-compile, npm pack, temp-prefix global install, and the host ao execing the Go daemon through start/status/stop. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
Contributor
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
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.
What
Builds the npm packaging machinery so the rewrite ships as
@aoagents/ao@0.10.0andaoruns the Go daemon. Implements the locked design from discussions #229 / #231: theoptionalDependencies(esbuild/swc) pattern.aolauncher shim (npm/bin/ao.js): resolves the installed@aoagents/ao-<os>-<arch>sub-package, locates its prebuilt daemon, and execs it, forwarding argv/stdio/exit code/signals. CLI verbs talk to the daemon over loopback exactly as today. Clear message + exit 1 when no matching platform package is installed (unsupported host, or--omit=optional).os/cpufields. npm installs only the host match. Nopostinstall, no install-time network call.@aoagents/ao@0.10.0:bin,optionalDependenciesfor all sub-packages, andrepository/homepage/bugsrepointed ataoagents/ReverbCode(legacy pointed at the old upstream).npm/targets.mjsfor the matrix (darwin arm64+x64, linux x64+arm64, win32 x64+arm64);scripts/check.mjsenforces that the committedoptionalDependenciesstay in lockstep.build.mjs(cross-compile, CGO disabled / pure-Go SQLite → builds every target from one host, stamps version via ldflags + assembles sub-packages),pack.mjs(tarballs),collect-release.mjs(flattened binaries +SHA256SUMSfor Releases)..github/workflows/release.yml, on av*tag): cross-compile every target, publish binaries to the GitHub Release, build the npm sub-packages from those binaries, verify withnpm publish --dry-run..github/workflows/npm-publish.yml): manualworkflow_dispatch, dry-run by default. A real publish requiresdry_run=falseand anNPM_TOKENsecret — neither wired by default, so publishing stays a deliberate human action. Sub-packages publish before the main package so itsoptionalDependenciesresolve.Scope
Only the Go daemon (~20 MB) ships via npm. The Electron app is fetched from GitHub Releases during migration and is out of scope here.
Verification (local)
node npm/scripts/build.mjs).npm packmain + host sub-package; installed both tarballs into a temp global prefix;ao versionexecs the host Go daemon and reports0.10.0.ao:start→status(ready) →stop.npm publish --dry-runsucceeds for main + sub-packages.cd backend && go build ./...(no Go source changed).🤖 Generated with Claude Code