build: wait for npm to serve a released version

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.
This commit is contained in:
AlexKucera committed 2026-11-25 16:27:42 +01:00
1 parent e534b27f94
commit 21ec8029c5
4 files changed
+18 -2

No files matched your search

+1 -1
View File
@@ -26,7 +26,7 @@
- **`pi -p` and `--list-models` never fetch live catalogs** (`allowModelNetwork` is hard-coded `false`). That is why the provider ships `BASELINE`; interactive startup overlays the live list. - **`pi -p` and `--list-models` never fetch live catalogs** (`allowModelNetwork` is hard-coded `false`). That is why the provider ships `BASELINE`; interactive startup overlays the live list.
- **Tests load `index.ts` through jiti with the host packages aliased to `tests/stubs/pi-ai.mjs`.** Alias keys are longest-prefix first, so `pi-ai/compat` must precede `pi-ai` or the bare key swallows the subpath. - **Tests load `index.ts` through jiti with the host packages aliased to `tests/stubs/pi-ai.mjs`.** Alias keys are longest-prefix first, so `pi-ai/compat` must precede `pi-ai` or the bare key swallows the subpath.
- **Never blanket-inject `tags.user` into request bodies.** As of 2026-11-25 Nous free and discounted models return 500 when that field is present, and only `upstage/solar-mini4:free` requires it. `solar-mini4:free` is therefore left out of `BASELINE` on purpose. - **Never blanket-inject `tags.user` into request bodies.** As of 2026-11-25 Nous free and discounted models return 500 when that field is present, and only `upstage/solar-mini4:free` requires it. `solar-mini4:free` is therefore left out of `BASELINE` on purpose.
- **Releases are local, through `publish.sh`.** No CI and no npm token: `npm publish` prompts for the 2FA code. The script renames the changelog's `## [Unreleased]` heading to the released version, so new entries always go under `## [Unreleased]`. - **Releases are local, through `publish.sh`.** No CI and no npm token: `npm publish` prompts for the 2FA code. The script renames the changelog's `## [Unreleased]` heading to the released version, so new entries always go under `## [Unreleased]`. npm answers with a placeholder version (`0.0.0-stage`) for about four minutes after the publish; a fresh install in that window loads no models, and the script waits until the real version resolves. The pi.dev/packages gallery lags further behind.
## Catalog tiers ## Catalog tiers
+1 -1
View File
@@ -73,7 +73,7 @@ Typechecking needs a local pi install. The `paths` in `tsconfig.json` point `@ea
./publish.sh patch # bump first; minor and major work too ./publish.sh patch # bump first; minor and major work too
``` ```
The script runs the checks, shows the tarball contents, moves the `Unreleased` section of the changelog under the new version, commits, tags, publishes to npm, and pushes. npm asks for your 2FA code during the publish. You need `npm login` with publish rights to the package first. The script runs the checks, shows the tarball contents, moves the `Unreleased` section of the changelog under the new version, commits, tags, publishes to npm, and pushes. npm asks for your 2FA code during the publish. npm then takes a few minutes to serve the new version, and the script waits until it resolves. You need `npm login` with publish rights to the package first.
## License ## License
@@ -61,6 +61,10 @@ Verified before stopping: `npm run check` (25 tests pass), `shellcheck`, `npm pa
- [ ] Confirm the package shows up on https://pi.dev/packages. - [ ] Confirm the package shows up on https://pi.dev/packages.
- [ ] Close #3 once the listing is live. - [ ] 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* *Log written by write-log skill*
+12
View File
@@ -19,6 +19,7 @@ if [ -n "$bump" ]; then
npm version "$bump" --no-git-tag-version npm version "$bump" --no-git-tag-version
fi fi
version=$(node -p "require('./package.json').version") version=$(node -p "require('./package.json').version")
name=$(node -p "require('./package.json').name")
grep -qx '## \[Unreleased\]' CHANGELOG.md || { echo "CHANGELOG.md has no '## [Unreleased]' heading" >&2; exit 1; } grep -qx '## \[Unreleased\]' CHANGELOG.md || { echo "CHANGELOG.md has no '## [Unreleased]' heading" >&2; exit 1; }
@@ -32,3 +33,14 @@ git commit -am "release v$version"
git tag -a "v$version" -m "v$version" git tag -a "v$version" -m "v$version"
npm publish npm publish
git push origin main --follow-tags git push origin main --follow-tags
# npm answers with a placeholder for a few minutes before the version resolves.
tries=0
until [ "$(npm view "$name@$version" version 2>/dev/null | tr -d "[:space:]'")" = "$version" ]; do
tries=$((tries + 1))
if [ "$tries" -ge 40 ]; then
echo "npm still has not served $name@$version after 10 minutes. Check https://www.npmjs.com/package/$name" >&2
break
fi
sleep 15
done