Make PromptKit version visible: session banner + CLI update check#249
Merged
Alan-Jowett merged 4 commits intomainfrom May 6, 2026
Merged
Make PromptKit version visible: session banner + CLI update check#249Alan-Jowett merged 4 commits intomainfrom
Alan-Jowett merged 4 commits intomainfrom
Conversation
Add an instruction to bootstrap.md step 1 so the composition engine emits a one-line 'PromptKit v<version> loaded.' banner after reading manifest.yaml. The version is read from the top-level 'version:' field; a 'version unknown' fallback is used if the field is missing or unreadable, and no version is ever fabricated. This applies to both manual loads and the 'promptkit interactive' (npx) flow, since the CLI stages the same bootstrap.md and manifest.yaml into a temp dir before instructing the LLM to read bootstrap.md. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a version-identifying banner to PromptKit’s bootstrap flow so every interactive session immediately reports which PromptKit release is loaded, improving provenance for debugging and support.
Changes:
- Update
bootstrap.md“How to Begin” step 1 to instruct the engine to readmanifest.yaml.versionand emit a one-line “PromptKit vX loaded.” banner (with an “unknown” fallback). - Re-announce the version when
bootstrap.mdormanifest.yamlis re-read later in the session.
Adds a best-effort daily update check to 'promptkit interactive'. The CLI queries https://registry.npmjs.org/<pkg>/latest (built-in https, ~1500ms timeout), caches the result in ~/.promptkit/update-check.json for 24h, and prints a boxed banner before spawning the LLM when a newer version exists. No new runtime dependencies. Suppressed by NO_UPDATE_NOTIFIER=1, CI, non-TTY stdout, --no-update-check, and for non-interactive subcommands (list/search/show/--version). Network, cache, and parse failures are silently swallowed and never surface to the user. Adds cli/tests/update-check.test.js with unit coverage for parseVersion, isNewer, formatBanner, and suppressionReason (no network I/O). Updates cli/tests/cli.test.js harness to copy the new lib/update-check.js into the temp CLI root. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
… add cache tests - fetchLatest: add overall setTimeout that destroys the request so the 1500ms cap is a true deadline (not just socket-inactivity). - fetchLatest + checkForUpdate: validate 'latest' with parseVersion before caching or returning, so an unparseable registry response can never poison the 24h cache. - checkForUpdate: dispatch readCache/writeCache/fetchLatest through module.exports._internals so tests can stub them. - Add tests for cache TTL hit, expired-cache refetch, pkg-name mismatch, unparseable cached value, and unparseable fetched value. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Alan-Jowett
approved these changes
May 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #248.
Closes #250.
This PR adds two small, complementary pieces of version visibility to PromptKit.
1. Announce the loaded PromptKit version (#248)
One surgical edit to
bootstrap.mdstep 1 ofHow to Begin. After readingmanifest.yaml, the composition engine now reads the top-levelversion:field and emits a banner before any other output. If the field is missing or unreadable, a(version unknown)fallback is emitted — no version is ever fabricated. The engine re-announces wheneverbootstrap.mdormanifest.yamlis re-read.All three entry-point skills (
/promptkit,/bootstrap,/boot) and thepromptkit interactive(npx) flow converge onbootstrap.md, so this one edit covers every activation path — manual load, slash command, and CLI.New session-start output
Against the current repo (
manifest.yamlhasversion: "0.6.1"), the first line of any new session is:If
manifest.yamlever ships without a readableversion:field, the engine emits instead:2. Notify users when a newer CLI version is available (#250)
Adds a best-effort update check to
promptkit interactive. Follows the standard pattern used bynpm,yarn,vercel, andgh, but implemented with no new runtime dependencies (pure built-inhttps).Behavior
Queries
https://registry.npmjs.org/@alan-jowett/promptkit/latestwith a hard ~1500 ms wall-clock deadline (overallsetTimeoutthat destroys the request — not just socket-inactivity).Compares
json.versionagainstpackage.json.versionwith simplemajor.minor.patchordering (strips a leadingv, ignores prerelease/build suffix). Values that don't parse as semver are dropped — never cached, never returned.On newer version, prints a boxed banner before spawning the LLM CLI:
Caches the result in
~/.promptkit/update-check.jsonfor 24 h; subsequent launches skip the network but still show the banner if a newer version is cached. Cached values are re-validated withparseVersionon read, so a poisoned cache entry is treated as a miss and refetched.Network, DNS, timeout, HTTP-non-200, malformed-JSON, and cache I/O failures are all swallowed — the check is strictly best-effort and can never block or break the CLI.
Response body is capped at 64 KB to defend against a misbehaving registry.
Opt-out / non-interactive safety
NO_UPDATE_NOTIFIER=1— suppresses the check.CIenv var set — suppresses.stdoutis not a TTY (piped/scripted usage) — suppresses.--no-update-checkflag — suppresses.list,search,show,--version) never run the check, keeping machine-readable output clean.Surface area
cli/lib/update-check.js— new module. Pure functions (parseVersion,isNewer,formatBanner,suppressionReason) plus the one network function (fetchLatest) behindcheckForUpdate.checkForUpdatedispatchesreadCache/writeCache/fetchLatestthrough_internalsso tests can stub them without filesystem or network I/O.cli/bin/cli.js—interactiveaction becomesasync, callscheckForUpdateinside a try/catch beforelaunchInteractive, gated by the new--no-update-checkflag.cli/tests/update-check.test.js— new unit tests covering version parsing/comparison/banner/suppression, plus the cache/TTL branch (fresh hit, expired refetch, pkg-name mismatch, unparseable cached value treated as miss, unparseable fetched value not cached, hard-deadline behavior). No network I/O in tests.cli/tests/cli.test.js— test harness extended to copylib/update-check.jsinto its temp CLI root.cli/package.json—testscript adds the new test file. No new dependencies.Test status
npm testincli/passes 72/73. The one remaining failure (TC-CLI-082/083 gh-copilot spawned with originalCwd and --add-dir for staging dirinlaunch.test.js:335) also fails onmainand is unrelated to this change — it is a pre-existing flaky/environmental test.python tests/validate-manifest.py— OK.Version-source consistency
manifest.yaml.version(what the in-session banner reads) andcli/package.json.version(whatpromptkit --versionand the update check read) are already kept aligned percli/specs/design.mdv0.6.1, so all three user-visible version surfaces report the same number for any published release. A follow-up to enforce this intests/validate-manifest.pyis captured in #248.Files changed
bootstrap.md(+10 lines)cli/bin/cli.js(+18 / -1)cli/lib/update-check.js(new, 197 lines)cli/package.json(+1 / -1 — test script)cli/tests/cli.test.js(+6 lines — harness)cli/tests/update-check.test.js(new, 329 lines)No persona, protocol, template, format, or taxonomy content touched.