npm answers with a placeholder version (0.0.0-stage) for about four minutes after `npm publish`. The first release ended the script in that window: a fresh install got the placeholder and loaded no extension, and the pi.dev/packages gallery returned 404. Poll the registry until the released version resolves, for at most ten minutes, so the script's exit means `pi install` works. Observed with pi-nous-portal 0.1.0, which became installable at 15:19:25 UTC and listed 8 models from a fresh agent dir.
5.6 KiB
Issue #3: Publish pi-nous-portal 0.1.0 to npm
Date: 2026-11-25 Type: issue Reference: #3
Goal
Make the extension installable with pi install npm:pi-nous-portal and listed on https://pi.dev/packages, with a repeatable local release. Grew out of the research in #2.
What Was Done
- Researched the gallery. It lists only npm packages that carry the
pi-packagekeyword, and a git source installs but never lists. Posted that as the resolution of #2 and closed it. - Settled the publishing decisions with Alexander: npm, unscoped
pi-nous-portal, Gitea asrepository, labelled unofficial, semver with av0.1.0tag, a localpublish.shinstead of CI. Recorded on #3. package.json: added"pi": { "extensions": ["./index.ts"] },repository,homepage,bugs,"files": ["index.ts", "CHANGELOG.md"], and "Unofficial, community-maintained" indescription.publish.sh: guards (clean tree,main,npm whoami),npm run check,npm pack --dry-run, changelog heading rename, commit, tag,npm publish,git push --follow-tags.README.md: the install section now leads withpi install npm:pi-nous-portal, a new Releasing section, and an edit pass for a plainer voice at Alexander's request.CHANGELOG.md: entry under Unreleased.AGENTS.md,docs/AGENTS.md,docs/adr/0003-forge-and-ci.md: release steps and the manifest rule recorded.
Verified before stopping: npm run check (25 tests pass), shellcheck, npm pack --dry-run (5 files: CHANGELOG.md, LICENSE, README.md, index.ts, package.json), the dirty-tree guard stops the script with exit 1, the changelog rename turns ## [Unreleased] into ## [0.1.0] - 2026-11-25 on a copy, and npm version patch --no-git-tag-version bumps a copy to 0.1.1.
Decisions & Rationale
| Decision | Rationale |
|---|---|
| Publish to npm, not a git source | The gallery indexes npm only. The issue asked "npm or git", and only npm reaches the destination. |
Keep the unscoped name pi-nous-portal |
Already in package.json, unused on npm, and it matches most gallery entries. A scope would have needed an npm org. |
publish.sh over CI |
Alexander asked for a script, not a pipeline. The instance has Actions enabled but no runner, and npm's trusted publishers exclude Gitea Actions, so CI would also have needed a bypass-2FA token. |
A pi.extensions manifest instead of moving index.ts |
Moving the file would touch tsconfig.json, the tests that load index.ts, and the symlink install. One manifest entry leaves all three alone. |
| Label the package unofficial | It carries Nous in its name and ships the public hermes-cli client id. The label keeps it from reading as a Nous product. |
| No new ADR | The release setup is reversible, and the no-CI decision is already 0003-forge-and-ci.md, which gained one sentence. |
Gotchas & Fixes
| Problem | Root Cause | Fix |
|---|---|---|
| A package install of the old tree would load no extension | pi 1.6.0's collectDefaultResources (core/package-manager.js) reads manifest[resourceType] or scans <packageRoot>/extensions/. A root index.ts is only found by the legacy ~/.pi/agent/extensions/ loader, which is why the symlink install works. |
Add "pi": { "extensions": ["./index.ts"] }. |
| The gallery would have shown no repo link | package.json had no repository field. |
Added repository, homepage and bugs. |
tests/, docs/ and tsconfig.json would have shipped |
No files whitelist, so npm fell back to .gitignore. |
"files": ["index.ts", "CHANGELOG.md"]. |
| I read "automated publishing" as CI and wrote a runner-and-token plan | An assumption that was never asked for. | Alexander corrected it. #3 now describes publish.sh. |
package.json ended up with two description keys |
The edit tool auto-relocated the line anchor to the wrong line and inserted instead of replacing. | Replaced both lines with one. JSON.parse takes the last key, so npm pack had hidden it. |
Files Changed
| File | Change Summary |
|---|---|
publish.sh |
New release script |
package.json |
pi manifest, files, repo links, description |
README.md |
Install and Releasing sections, edit pass |
CHANGELOG.md |
Unreleased entry for the npm package |
AGENTS.md |
Release command, manifest rule, release convention, log window |
docs/AGENTS.md |
ADR 0003 one-liner mentions publish.sh |
docs/adr/0003-forge-and-ci.md |
One sentence on the local release gate |
docs/devlog/INDEX.md |
Row for this log |
Open Items & Next Steps
- Run
./publish.sh. It prompts for the npm 2FA code. Not run in this session. - After the publish, check
pi -e npm:pi-nous-portalin a throwaway agent dir, then/login nous-portal. - Confirm the package shows up on https://pi.dev/packages.
- Close #3 once the listing is live.
Update, 2026-11-25 15:26 UTC
Published. ./publish.sh ran with the 2FA prompt, pushed release v0.1.0 (e534b27) and tag v0.1.0. npm answered with a placeholder version 0.0.0-stage for about four minutes ("Your package is being processed and may take a few minutes to become available"). A fresh-agent-dir install in that window listed no Nous models. At 15:19:25 UTC latest became 0.1.0, and pi -e npm:pi-nous-portal@0.1.0 --list-models in a fresh agent dir listed 8 nous-portal models with an empty stderr. publish.sh now waits until the registry serves the version. The pi.dev/packages gallery still returned 404 at 15:26 UTC, so issue #3 stays open until the listing is live.
Log written by write-log skill