Skip to content

build(npm): add @pulseengine/rivet distribution#166

Merged
avrabe merged 1 commit intomainfrom
feat/npm-distribution
Apr 22, 2026
Merged

build(npm): add @pulseengine/rivet distribution#166
avrabe merged 1 commit intomainfrom
feat/npm-distribution

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented Apr 21, 2026

Summary

Adds the machinery to publish rivet as an npm package so it can be used
via npx @pulseengine/rivet and registered as a Claude Code MCP server
with claude mcp add rivet npx -y @pulseengine/rivet mcp.

  • npm/ — root package @pulseengine/rivet. Uses per-platform
    optionalDependencies; index.js resolves the current platform's
    package, run.js spawns the binary (stdin/stdout/stderr + signals
    forwarded), install.js is a no-op when the platform package
    resolved and falls back to downloading the archive from the GitHub
    Release otherwise.
  • platform-packages/{darwin-arm64,darwin-x64,linux-arm64,linux-x64,win32-x64}/
    — five per-platform packages. Each ships exactly one pre-built binary
    (gitignored in source, populated at publish time by the workflow).
  • .github/workflows/release-npm.yml — triggers on release: published
    (so it runs after the existing release.yml creates the GitHub Release
    and uploads the archives). Downloads the archives via
    gh release download, assembles each platform package, publishes all
    platform packages in parallel, then publishes the root package last so
    optionalDependencies resolve on the very first install.

Pattern mirrors pulseengine/template-mcp-server
and the live @pulseengine/timedate-mcp-server package.

Deviations from the template

  • Added linux-arm64. The template only ships linux-x64; rivet's
    existing release.yml already builds aarch64-unknown-linux-gnu via
    cross, so we publish that too.
  • Workflow is decoupled from release.yml. The template's workflow
    also builds binaries — we only download the ones release.yml already
    produced, which keeps the existing release flow unchanged.
  • execFileSync (no shell) for archive extraction in install.js
    instead of execSync string commands, to avoid any injection surface
    even though inputs are hardcoded.
  • License: Apache-2.0 (matches workspace Cargo.toml), not MIT
    like the template.

Availability check

  • @pulseengine/rivet — currently 404 on npmjs.org (available to claim).
  • @pulseengine scope is already owned (@pulseengine/timedate-mcp-server
    is live under maintainer avrabe / ralf_beier@me.com).

Required repo configuration — ACTION REQUIRED

The publish workflow is gated on a repository secret named NPM_TOKEN.

I checked /repos/pulseengine/rivet/actions/secrets and it is currently
empty — the repo admin must add an automation NPM_TOKEN before the
first tag push will actually publish to npm. Until then the workflow will
start and fail at the npm publish step; it will not damage anything.

Non-goals

  • Does not modify release.yml.
  • Does not publish anything. Publishing only happens on tag push
    (v*) after release.yml creates the release and NPM_TOKEN is set.

Test plan

  • Repo admin adds NPM_TOKEN secret (automation token from npmjs.com
    for the @pulseengine scope, publish permission).
  • (Optional) Dry-run via workflow_dispatch against an existing tag
    to watch the publish steps before next release.
  • First real tag push after merge publishes all six packages to npm.
  • npm view @pulseengine/rivet shows the new version.
  • npx @pulseengine/rivet --version prints the same string as
    cargo run -p rivet-cli -- --version.
  • claude mcp add rivet npx -y @pulseengine/rivet mcp registers
    successfully and claude mcp list shows the server.
  • Install on at least one Linux x64 and one macOS arm64 box to
    confirm optionalDependencies resolution.

@avrabe avrabe force-pushed the feat/npm-distribution branch from 414b74a to 87c935a Compare April 21, 2026 18:59
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Rivet Criterion Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.

Benchmark suite Current: 7f79e35 Previous: deeafeb Ratio
traceability_matrix/1000 58962 ns/iter (± 1194) 45303 ns/iter (± 1971) 1.30
query/10000 111090 ns/iter (± 2592) 92088 ns/iter (± 1491) 1.21

This comment was automatically generated by workflow using github-action-benchmark.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@avrabe avrabe force-pushed the feat/npm-distribution branch 8 times, most recently from 0bfab4e to 7f79e35 Compare April 22, 2026 04:21
Adds npm distribution machinery so rivet can be installed/run via
`npx @pulseengine/rivet` and registered with Claude Code as an MCP server.

Pattern follows pulseengine/template-mcp-server:
- Root package (`npm/`) uses per-platform optionalDependencies
  - index.js resolves the correct platform package for the current OS/arch
  - run.js spawns the resolved binary, forwarding argv/stdio/signals
  - install.js is idempotent: no-op when platform package resolved, else
    downloads the archive from the GitHub Release as a fallback
- Five platform packages under `platform-packages/` (darwin-arm64,
  darwin-x64, linux-arm64, linux-x64, win32-x64) — each ships a single
  pre-built binary at publish time (gitignored in source)
- `release-npm.yml` triggers on `release: published`, downloads the
  archives produced by `release.yml`, assembles + publishes each platform
  package, then publishes the root package last so optionalDependencies
  resolve on first install

Does not modify release.yml; consumes its artifacts via the release event.

Trace: skip
@avrabe avrabe force-pushed the feat/npm-distribution branch from 7f79e35 to 8b27400 Compare April 22, 2026 04:21
@avrabe avrabe merged commit 0dbf10c into main Apr 22, 2026
1 check passed
@avrabe avrabe deleted the feat/npm-distribution branch April 22, 2026 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant