Files
nous-portal/docs/devlog/20261125-issue03-publish-pi-nous-portal-to-npm_log.md
T
AlexKucera 1af3a1360e feat: make the package installable from npm
pi loads a package's extensions through the `pi` manifest or an
`extensions/` directory, so a root index.ts loaded nothing as a
package. Add "pi": { "extensions": ["./index.ts"] }, a files
whitelist that keeps tests and docs out of the tarball, and the
repository links the pi.dev/packages gallery shows.

Add publish.sh for releases: checks, tarball preview, changelog
heading, commit, tag, npm publish, push. No CI (ADR 0003).

Lead the README with pi install npm:pi-nous-portal, document the
release script, and label the package unofficial and
community-maintained. The README also gets a plainer voice.

The publish itself is still pending. Refs #3
2026-11-25 16:15:15 +01:00

67 lines
4.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.
---
*Log written by write-log skill*