Skip to content

feat(npm): newt-agent npm installer — @gilamonster shim (newt + newt-mcp-server) [draft]#1222

Draft
hartsock wants to merge 2 commits into
mainfrom
feat/npm-shim
Draft

feat(npm): newt-agent npm installer — @gilamonster shim (newt + newt-mcp-server) [draft]#1222
hartsock wants to merge 2 commits into
mainfrom
feat/npm-shim

Conversation

@hartsock

Copy link
Copy Markdown
Member

⚠️ Draft — newt-agent npm installer (newt-agent#1221)

Ports the scrybe reference shim so npm users can npm i -g newt-agent (→ newt) or npm i -g @gilamonster/newt-mcp-server — no Rust toolchain, no pip. Draft: direction is settled; remaining polish is checklisted below.

What's here

  • npm/ — a name-derived shim: one generic bin/run.cjs + lib/binary.cjs serves every @gilamonster/<bin> because each derives its binary name + platform-package names from its own package name.
    • newt/@gilamonster/newt, newt-mcp-server/@gilamonster/newt-mcp-server, newt-agent/ → unscoped umbrella (npm i -g newt-agent).
    • scripts/build-platform-package.mjs (generic wrap) + sync-versions.mjs (exact version pins).
    • test/resolve.test.mjs — node:test, 5/5, including a real resolve+exec happy-path.
    • platforms.json3 targets matching build-binaries (darwin-arm64, linux-x64, win32-x64).
    • .gitignore — re-includes *.cjs/*.mjs/package.json (the repo root blanket-ignores them to stay JS-free).
  • release.yml jobs — held back (not in this branch yet). build-npm (per-platform: build → wrap → publish) + publish-npm-meta (shims + umbrella), OIDC, tag-only, idempotent publish. See Release wiring below.

⚙️ Release wiring — needs a workflow-scoped push

The release.yml changes are written and validated but not in this branch: the agent's push credential lacks GitHub's workflow scope, which is required to modify .github/workflows/. The change is sitting in the working tree of the local checkout — a maintainer completes it with:

cd ~/workspaces/newt-agent
git add .github/workflows/release.yml
git commit -m "ci(release): npm build-npm + publish-npm-meta jobs (OIDC)"
git push --no-verify          # your auth has workflow scope

(Also saved as a patch at scratchpad/release-npm-jobs.patch — 119 lines — if the working-tree copy is gone.)

Scope decisions — please sanity-check

  1. Ships newt + newt-mcp-server only — the two binaries build-binaries actually produces (-p newt-agent -p newt-mcp-server). The reserved @gilamonster/newt-mcp-data and @gilamonster/newt-provider-openai names are not shipped here; wire them in once those binaries are added to the release build.
  2. OIDC, not a token. You configured trusted publishers on all 21 packages (→ release.yml), so these jobs use OIDC (id-token: write + npm ≥ 11.5.1). ⚠️ This diverges from the PyPI/crates jobs, which deliberately use account-scoped tokens to avoid per-project registration. If the 21 configs feel heavy in hindsight, we can switch npm to a single @gilamonster granular token and drop them.

Verified locally

npm test → 5/5 (manifest integrity · name-derived resolver · resolve+exec happy-path). release.yml YAML parses.

Remaining before ready-for-review

  • test-npm job in ci.yml (+ pre-push hook parity)
  • Version-skew assert (git tag == crate version), like scrybe
  • Consider reusing build-binaries artifacts instead of rebuilding the binaries
  • darwin-x64 / linux-arm64 if build-binaries gains them
  • Wire newt-mcp-data / newt-provider-openai if/when shippable
  • Adversarial cross-platform review (as done on scrybe#151)

Ref: newt-agent#1221 · reference impl: hartsock/scrybe#151

🤖 Generated with Claude Code

hartsock and others added 2 commits July 15, 2026 18:59
…gilamonster

Port of the scrybe reference shim (newt-agent#1221): deliver the newt and
newt-mcp-server Rust binaries to npm users the uv/esbuild way, with a
name-derived resolver so ONE generic resolver serves every @gilamonster/<bin>.

npm/:
- newt/, newt-mcp-server/  @gilamonster/<bin> shims. bin/run.cjs + lib/binary.cjs
  are generic — each derives its binary + platform packages from its own name.
- newt-agent/              unscoped umbrella -> newt
- scripts/                 build-platform-package.mjs (generic) + sync-versions.mjs
- test/resolve.test.mjs    node:test: manifest + resolver + happy-path exec (5/5)
- platforms.json           3 targets matching build-binaries (darwin-arm64, linux-x64, win32-x64)
- .gitignore               re-include *.cjs/*.mjs/package.json (repo root ignores them)

The release.yml build-npm + publish-npm-meta jobs (OIDC, tag-only) are held as a
separate patch — a workflow-scoped push is needed for .github/workflows/. See PR.

DRAFT.

Co-Authored-By: Claude Opus 4.8 (gnuc agent) <noreply@anthropic.com>
hartsock added a commit that referenced this pull request Jul 17, 2026
* gh skill: draft PRs are a hard stop — never merge, never un-draft

WHAT: Add an explicit rule to the gh bundled skill's Pull Requests
section — a draft PR is a 'do NOT merge yet' signal; never merge it and
never mark it ready (gh pr ready) unless a human names that PR by number.
A blanket 'merge on green' / 'merge my PRs' instruction must skip drafts
and say so, never promote them. Includes the isDraft check commands.

WHY: A 'merge on green' sweep nearly promoted a deliberately-drafted PR
(#1222, held for a release gate). Draft is the mechanism authors use to
keep exactly that from happening; the skill must encode that drafts are
untouchable so the accident can't recur.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* ROADMAP: npm installer = Step 11.4, first npm release is 0.8.0 (PR #1222 held in draft)

WHAT: Record the npm installer (@gilamonster shim, PR #1222) as roadmap
Step 11.4 with an explicit release decision: the first npm publish ships
with 0.8.0, not before. Note that PR #1222 is kept in draft AS the hold
mechanism and links it so the intent survives even if branch
feat/npm-shim is closed/deleted by accident.

WHY: The 'hold npm until 0.8.0' intent was not written down anywhere —
it lived only as the draft state of a PR, which evaporates if the branch
is closed. The roadmap is the durable home for a release-gating decision.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: hartsock <hartsock@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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