Skip to content

feat: add npm wrapper to install and run the CLI via npx - #610

Merged
edenreich merged 2 commits into
mainfrom
feat/issue-568-npx-wrapper
Jun 6, 2026
Merged

edenreich merged 2 commits into
mainfrom
feat/issue-568-npx-wrapper

Conversation

@edenreich

@edenreich edenreich commented Jun 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #568. Adds an npm/npx wrapper so the CLI can be run with npx @inference-gateway/cli (Node >= 18) - no Go toolchain or manual download. Mirrors the approach already shipping in inference-gateway/adl-cli.

This repo ships raw release binaries (infer-<os>-<arch>) built by artifacts.yml, so the installer downloads the binary directly (no archive to extract) and verifies it against checksums.txt.

What's included

  • npm/ wrapper (zero runtime deps)
    • package.json - @inference-gateway/cli, bin infer, postinstall hook, os/cpu gates (linux/darwin, x64/arm64).
    • bin/install.js - downloads the matching infer-<os>-<arch> release asset, checksum-verifies against checksums.txt, caches it next to the script, chmod +x. Honors INFER_CLI_BASE_URL and INFER_CLI_SKIP_DOWNLOAD.
    • bin/run.js - locates/installs the binary, execs it, forwards args and exit code.
    • .gitignore - excludes the fetched binary and the publish-time README/LICENSE copies.
  • .releaserc.yaml - @semantic-release/npm (pkgRoot: npm); copies LICENSE/README into npm/ at release; commits npm/package.json so the version stays in sync; adds an "npm / npx" block to the release body.
  • .github/workflows/release.yml - id-token: write (OIDC), Node pinned to 24 (npm >= 11.5.1), @semantic-release/[email protected], passes NPM_TOKEN for the bootstrap publish.
  • README.md - new "Using npm/npx (Recommended)" install section with a "not recommended for production" caveat.
  • Taskfile.yml + .markdownlintignore - moved markdownlint ignores into a config file so they apply for task lint, pre-commit, and any direct/CI invocation; the npm/ publish copies are excluded.

artifacts.yml is unchanged - it already produces infer-{linux,darwin}-{amd64,arm64} + checksums.txt, exactly what the installer consumes.

Platforms

Linux + macOS on amd64/arm64 (matches adl-cli and this repo's release assets). armv7 and Windows (use WSL) are out of scope.

Manual prerequisites before the next release publishes to npm (org admin)

  1. Bootstrap: add a temporary NPM_TOKEN secret (npm automation token with publish rights to the @inference-gateway scope). The first release publishes @inference-gateway/cli using it.
  2. Switch to OIDC: after the first publish, configure a trusted publisher on npmjs.com for @inference-gateway/cli -> repo inference-gateway/cli, workflow .github/workflows/release.yml, then delete the NPM_TOKEN secret so subsequent releases publish via OIDC (same model as @inference-gateway/adl-cli).

Verification

  • install.js downloaded + checksum-verified infer-darwin-arm64 from v0.118.0; run.js ran it (infer v0.118.0, --help); re-run no-ops (cached); INFER_CLI_SKIP_DOWNLOAD skips.
  • npm pack --dry-run -> tarball = package.json + bin/{run,install}.js + README + LICENSE (native binary excluded).
  • markdownlint . and the full pre-commit lint pass.

Follow-up

Docs ticket filed: inference-gateway/docs#182 (document npx @inference-gateway/cli).

Publish the CLI to npm as @inference-gateway/cli so anyone with Node.js (>= 18) can run it via 'npx @inference-gateway/cli' without a Go toolchain or manual download.

The zero-dependency npm/ wrapper downloads the matching native release binary (infer-<os>-<arch>) on postinstall, checksum-verifies it against checksums.txt, caches it next to the script, and execs it. Publishing is wired into semantic-release (@semantic-release/npm, pkgRoot: npm) with npm/package.json committed back so the version stays in sync; release.yml gains id-token: write for npm OIDC trusted publishing, with a temporary NPM_TOKEN for the bootstrap publish. A .markdownlintignore excludes the publish-time npm/ copies.

Mirrors the approach already used in inference-gateway/adl-cli.
@edenreich
edenreich requested a review from a team as a code owner June 6, 2026 11:13
Comment thread .github/workflows/release.yml Resolved
@edenreich
edenreich merged commit 8f24fd5 into main Jun 6, 2026
@edenreich
edenreich deleted the feat/issue-568-npx-wrapper branch June 6, 2026 11:30
inference-gateway-releaser Bot pushed a commit that referenced this pull request Jun 6, 2026
## [0.119.0](v0.118.0...v0.119.0) (2026-06-06)

### 🚀 Features

* add npm wrapper to install and run the CLI via npx ([#610](#610)) ([8f24fd5](8f24fd5)), closes [inference-gateway/docs#182](inference-gateway/docs#182)
* **tools:** indentation-tolerant matching and stale-read detection for Edit/MultiEdit ([#608](#608)) ([14d7e98](14d7e98))

### 🐛 Bug Fixes

* **agent:** execute approved tools concurrently and freeze tickers on finish ([#609](#609)) ([a713306](a713306))

### 💄 Styles

* replace em dashes with hyphens ([91a3746](91a3746))

### 🧹 Maintenance

* **deps:** bump codex 0.133.0 -> 0.135.0 ([#607](#607)) ([86af5fb](86af5fb))
* enable skills by default ([9440593](9440593))
* regenerate config ([991cd77](991cd77))
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.119.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Add npx wrapper to install and run the CLI binary

1 participant