Files
nous-portal/docs/devlog/20261125-issue03-publish-pi-nous-portal-to-npm_log.md
AlexKucera b71363efb9 build: move release scripts and harden publish
publish.sh and test_npm_package.sh now live in scripts/ and cd to the
repo root, so they run from any directory. publish.sh polls npm until
the released version resolves: the first release ended inside the
registry's processing window, when a fresh install still gets the
0.0.0-stage placeholder. It also reopens an empty Unreleased section
after the rename and refuses an empty one before the version bump, so
a refused release leaves the tree clean.

test_npm_package.sh switches pi between the symlink checkout and
npm:pi-nous-portal. Only one may be installed: pi identifies npm
packages by name and local ones by path, so both register the provider
twice.
2026-11-25 16:51:36 +01:00

73 lines
5.9 KiB
Markdown

# Issue #3: Publish pi-nous-portal 0.1.0 to npm
> **Date:** 2026-11-25
> **Type:** issue
> **Reference:** https://git.babylondreams.de/AlexKucera/nous-portal/issues/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-package` keyword, 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 as `repository`, labelled unofficial, semver with a `v0.1.0` tag, a local `publish.sh` instead of CI. Recorded on #3.
- `package.json`: added `"pi": { "extensions": ["./index.ts"] }`, `repository`, `homepage`, `bugs`, `"files": ["index.ts", "CHANGELOG.md"]`, and "Unofficial, community-maintained" in `description`.
- `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 with `pi 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-portal` in 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.
Follow-up: the release tooling that came after this log (the npm wait, the dev/npm toggle script, the move to `scripts/`) is recorded in [20261125-release-scripts-npm-wait-toggle-and-move_log.md](20261125-release-scripts-npm-wait-toggle-and-move_log.md).
---
*Log written by write-log skill*