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.
This commit is contained in:
1 parent
21ec8029c5
commit
b71363efb9
8 files changed
+146
-8
No files matched your search
@@ -65,6 +65,8 @@ Verified before stopping: `npm run check` (25 tests pass), `shellcheck`, `npm pa
|
||||
|
||||
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*
|
||||
@@ -0,0 +1,60 @@
|
||||
# Release scripts: npm wait, dev/npm toggle, scripts/ folder
|
||||
|
||||
> **Date:** 2026-11-25
|
||||
> **Type:** generic
|
||||
> **Reference:** follow-up to https://git.babylondreams.de/AlexKucera/nous-portal/issues/3
|
||||
|
||||
## Goal
|
||||
|
||||
Make the release script trustworthy after the first real publish, add a way to switch pi between this checkout and the published npm package, and keep both scripts runnable from any directory once they moved into `scripts/`.
|
||||
|
||||
## What Was Done
|
||||
|
||||
- `scripts/publish.sh` (moved from the repo root) waits until `npm view <name>@<version>` resolves, for at most ten minutes. Before the publish it opens a fresh `Unreleased` section and refuses an empty one. The guard runs before the version bump.
|
||||
- `scripts/test_npm_package.sh` is new. With no argument it toggles between the symlink checkout and `npm:pi-nous-portal`; `dev` or `npm` forces a side. It removes whichever install is not wanted, honors `PI_CODING_AGENT_DIR`, and prints how many `nous-portal` models the next pi start lists.
|
||||
- Both scripts `cd` to the repo root. `README.md` and `AGENTS.md` name the new paths.
|
||||
- `CHANGELOG.md` has an empty `Unreleased` section again, the state the script now leaves after each release.
|
||||
- Verified: the toggle matrix in a temporary agent dir, from three working directories. The whole release flow ran in a scratch repo with a stubbed `npm publish` and `npm view` and a local bare remote: a `patch` bump to 0.1.1, 25 tests, 5 files in the tarball, commit, tag and push. npm and Gitea were untouched.
|
||||
|
||||
## Decisions & Rationale
|
||||
|
||||
| Decision | Rationale |
|
||||
|----------|-----------|
|
||||
| Poll npm at the end of `publish.sh` | The first release ended inside the registry's processing window. The script's exit now means `pi install` works. Ten minutes caps a stuck registry. |
|
||||
| Reopen `Unreleased` in the script | Common Changelog keeps an `Unreleased` section. The first release consumed it, and the next release would have been refused until someone re-added it by hand. |
|
||||
| Refuse an empty `Unreleased`, before the bump | A release needs an entry, and a refused release must leave the tree clean. After the bump it would leave `package.json` modified. |
|
||||
| The toggle keeps exactly one install | pi identifies npm packages by name and local ones by path, so both at once load and register the provider twice. |
|
||||
| Honor `PI_CODING_AGENT_DIR` in the toggle | It lets the script be tested against a temporary agent dir without touching the real one. |
|
||||
| Plain `rm` on the symlink | `-r` or a trailing slash would delete the checkout. |
|
||||
| No `scripts/AGENTS.md` | Two scripts with no separate rules. The root `AGENTS.md` documents both. |
|
||||
| `git mv` for `publish.sh`, plain `mv` for the new script | The tracked file keeps its rename history. The other was never committed. |
|
||||
|
||||
## Gotchas & Fixes
|
||||
|
||||
| Problem | Root Cause | Fix |
|
||||
|---------|------------|-----|
|
||||
| The toggle created no symlink in a fresh agent dir and printed nothing after `pi remove` | `extensions/` does not exist there, `ln -s` failed, and `set -e` stopped the script. | `mkdir -p` on the link's directory. |
|
||||
| A scratch run of `publish.sh` was refused with "no Unreleased heading" | The first release had consumed the section. | The script reopens it, and the guard now asks for an entry. |
|
||||
| A refusal after the bump would leave `package.json` modified | The guard ran after `npm version`. | Guard moved above the bump. The rerun test shows the version unchanged, a clean tree and no publish. |
|
||||
| Both scripts would have broken after the move | `cd "$(dirname "$0")"` resolves to `scripts/`. | `cd "$(dirname "$0")/.."`, tested from three directories. |
|
||||
|
||||
## Files Changed
|
||||
|
||||
| File | Change Summary |
|
||||
|------|---------------|
|
||||
| `scripts/publish.sh` | Moved. npm wait, `Unreleased` reopen and guard. |
|
||||
| `scripts/test_npm_package.sh` | New dev/npm toggle |
|
||||
| `CHANGELOG.md` | Empty `Unreleased` section reopened |
|
||||
| `README.md`, `AGENTS.md` | New script paths |
|
||||
| `docs/devlog/INDEX.md`, `AGENTS.md` log window | Row for this log |
|
||||
| `docs/devlog/20261125-issue03-publish-pi-nous-portal-to-npm_log.md` | Follow-up paragraph replaced by a pointer to this log |
|
||||
|
||||
## Open Items & Next Steps
|
||||
|
||||
- [ ] The pi.dev/packages listing was still missing at the last check. Confirm it and close #3.
|
||||
- [ ] The npm wait and the changelog reopen have only run against stubs. The first real release that uses them confirms them.
|
||||
- [ ] The login flow through the installed npm package is untested.
|
||||
|
||||
---
|
||||
|
||||
*Log written by write-log skill*
|
||||
@@ -5,6 +5,7 @@ Complete history of session logs in this directory, newest first. One-line summa
|
||||
<!-- write-log: full-index -->
|
||||
| Date | Type | File | Summary |
|
||||
|------|------|------|---------|
|
||||
| 2026-11-25 | generic | [20261125-release-scripts-npm-wait-toggle-and-move_log.md](20261125-release-scripts-npm-wait-toggle-and-move_log.md) | publish.sh waits for npm and reopens Unreleased, dev/npm toggle script added, both moved to scripts/ |
|
||||
| 2026-11-25 | issue | [20261125-issue03-publish-pi-nous-portal-to-npm_log.md](20261125-issue03-publish-pi-nous-portal-to-npm_log.md) | npm package made publishable (manifest, `files`, repo links, `publish.sh`) and README edited, publish still pending |
|
||||
| 2026-11-25 | generic | [20261125-finish-audit-architecture-review-unit_log.md](20261125-finish-audit-architecture-review-unit_log.md) | Two-round finish audit of the carrier move and clock seam: two code nits and a test-hang guard fixed, then a docs-only round |
|
||||
| 2026-11-25 | generic | [20261125-architecture-review-tier-property-and-login-clock_log.md](20261125-architecture-review-tier-property-and-login-clock_log.md) | Architecture review: tier moves from a request header to a model property, `login` gains a clock seam, poll loop now tested |
|
||||
|
||||
Reference in new issue
Block a user