feat(publish): add the darwin-arm64 runtime package

Merged
KH
3mo ago
+262-22

Summary

Phase 2 of "package flows so it's frictionless." relayflowd-path.ts's attach-or-spawn resolution has always been able to find a @relayflows/runtime-<platform>-<arch> optional dependency (kernel/DAEMON-LIFECYCLE.md §3.1 step 3), but nothing published one for macOS — packages/runtime-linux-x64 was the only platform. A separate, pre-existing gap turned up while wiring this: nothing declared any runtime package as an actual dependency of the installed relayflows CLI, on any platform. npm install -g relayflows never fetched a relayflowd binary regardless of OS; it only ever worked from inside a source checkout with the kernel already built locally.

  • packages/runtime-darwin-arm64: mirrors runtime-linux-x64 (os/cpu-gated package.json, relayflowd + bun-compiled flows in bin/).
  • packages/relayflows/package.json now declares both runtime packages as optionalDependencies, pinned in lockstep with @relayflows/sdk. npm installs only the one matching os/cpu and silently skips the rest.
  • scripts/pack-release.mjs generalized from a runtime-linux-x64 special case to any runtime-<platform>-<arch> package. Its execution smoke test only runs when the host actually matches — packing/asserting a foreign-platform tarball (e.g. re-verifying runtime-darwin-arm64's tarball from the linux publish-packages job) checks shape only, since a foreign binary can't be executed there.
  • .github/workflows/publish.yml: new build-darwin-arm64 job on a macos-14 runner (native aarch64-apple-darwin, no cross-compile needed). It independently re-derives the same new_version by running version-packages.mjs against the same commit and the same workflow inputs as the linux build job — npm version <bump> is deterministic, so neither job depends on the other's output and they run in parallel. publish-packages downloads both build artifacts and publishes all five packages.

Test plan

  • node --test scripts/publish.test.mjs — including new coverage for the generalized runtime-package packing and the foreign-host skip path
  • Verified end to end, for real, on this machine (darwin-arm64): built the actual relayflowd release binary and the bun-compiled flows executable, ran pack-release.mjs runtime-darwin-arm64 against them, which packs, unpacks, and executes relayflowd --help and flows check testdata/hello-deterministic.flow.yaml — real Mach-O binaries, real output
  • relayflowd-path.ts's existing resolution tests (relayflowd-path.test.ts, daemon-lifecycle.test.ts) pass unmodified
  • The build-darwin-arm64 CI job itself is new and unexercised by any prior run — this PR's own checks will be its first real run on a macos-14 GitHub Actions runner

Not in scope

darwin-x64 (Intel) and Windows still fall through to relayflowd-path.ts's source-checkout/PATH resolution steps — no runtime package for either yet.

🤖 Generated with Claude Code

https://claude.ai/code/session_013Y8uLRUXqKSZsqeeUMNaS2


Summary by cubic

Adds a prebuilt darwin-arm64 runtime package and fixes relayflows never shipping a runtime binary: npm install -g relayflows previously only worked from a source checkout, on any OS. Linux and darwin-arm64 runtime packages are now os/cpu-gated optionalDependencies of relayflows, and the publish workflow builds the macOS runtime on native Apple Silicon in parallel with the Linux job.

  • pack-release.mjs now handles any runtime-<platform>-<arch> package, executing a real smoke only on a matching host; foreign-host repacks assert shape only.
  • Both runtime packages advance in lockstep with @relayflows/sdk, and the lockfile records both platform variants so npm ci elsewhere resolves its own.
  • The relayflows build step now installs the packed surface tarball alongside the SDK, since the SDK's transitive surface dependency would otherwise resolve from the registry and fail before anything is published.
  • Intel Macs and Windows still fall through to relayflowd-path.ts source-checkout/PATH resolution until their runtime packages exist.