A local-first multi-agent app development platform, built on PenguinHarness
penguin version reports which build is running
- Date: 2026-08-20
- Type: feature
- Scope:
cli,core,server,docs,ci - PR: #382
Added penguin version, which prints the running build's identity as one line — v0.2.3 for a release, and git describe --tags --dirty output such as v0.2.3-14-g9e8f7d6-dirty for a build made from a checkout. -v, --version prints that same line. penguin version --json prints the full record, and GET /api/version serves that same record, so the two cannot report different things about one install.
The record's harness half names what a hot update pushed to the machine, read from that data root's HMR store. A pushed bundle lands outside any checkout, so its revision reaches the target twice over: inlined into the artifact at build time, and recorded beside it in harness.json.
Details
- Core gained
buildInfo(), the single producer of theBuildInforecord:version,describe,channel(releaseorsource),buildDate,commit,branch,dirty, and aruntimeblock naming the Node version, platform and architecture. The CLI and the version route render it and add nothing of their own. - A release carries its identity in constants: the release workflow already stamped
VERSIONandBUILD_DATE, and now stampsBUILD_COMMITwith the tag's commit sha fromGITHUB_SHA. Both stamping jobs — release artifacts and npm publish — stamp it, so the two channels report the same commit. Tags cut before the constant existed, and replays outside Actions, are stamped as far as they can be and report the rest as unstamped rather than failing. - Every other build has its git position — description, commit, branch, dirty flag — inlined into the artifact by the bundler that produced it, from one shared
scripts/build-git-stamp.mjswired into core, cli and desktop's tsup configs and intoscripts/deploy.mjs's esbuild. A built artifact carries no path back to its origin: a bundle pushed into<root>/hmr/store/sits outside any checkout, and the working directory would answer about the user's own repository. The stamp holds nothing that varies between two builds of identical source, so the HMR store's content addressing still collapses a re-push of unchanged code onto one entry. - The inlined stamp wins over asking git at run time, because it describes the code that is executing rather than whatever the surrounding tree has moved on to: a stale
dist/in a checkout ten commits further along reports the revision it was built at. - An installed penguin never runs git; it reads those constants. Asking git is the fallback for an un-bundled run —
tsx,vitest,pnpm dev— and asks only about the checkout the running module sits in, located by walking up from its own directory for a directory holding both.gitandpnpm-workspace.yaml. Starting from the module rather than the working directory is what makespenguin versionreport the harness's revision when it is run inside another repository; requiring the workspace marker is what keeps an install that merely sits under an unrelated repository — a home directory that is itself a dotfiles repo — from reporting that repository's commits. A linked worktree, where.gitis a file, is recognized. dirtyis null rather than false for a release: the workflow stamps its constants into the tree before building, so cleanliness is not a property of a release artifact.scripts/test-installer.shreplays the workflow's stamping block against fixtures covering a stamped commit, a run with noGITHUB_SHA, and a tag whose source predates the constant.
Harness provenance
scripts/deploy.mjsnow sends thesourcethe upgrade protocol already carried, filling it from its own checkout:revisionis spelled exactly asdescribe,-dirtyincluded, because a deploy from an uncommitted tree is ordinary and the sha alone would name code that never existed. A push from outside a git checkout carries nosourcerather than a fabricated one.HmrHost.persistVersioncommits thatsourcetoharness.jsonalongside apushedAttimestamp, so provenance travels with the version it describes. The upgrade route acceptssourceonly when both halves are non-empty strings — it now outlives the request, and a malformed record would outlive the push that sent it.readHarnessInfoinhmr/manifest.tsreads it back defensively, degrading to null fields rather than throwing: the command a user runs to find out what is wrong must not be the one that breaks. Versions committed before provenance existed report their bundle pointers with a nullsource.- The
harnessfield describes the data root's store, not the reporting process.penguinruns the packaged CLI whilepenguin-hmrruns the store's, so a non-nullharnessdoes not by itself mean the command printing it is the pushed code. versionReport()— a new@prismshadow/penguin-server/version-reportentry point — joins core'sbuildInfo()with that reader, and both the CLI and the version route render it. Neither layer can produce the other half: core knows the artifact and nothing about data roots, the store knows the root and nothing about the process reading it.
Compatibility
GET /api/version gained fields and removed none; version and buildDate keep their meanings, so existing clients are unaffected. VersionResponse became an alias of core's VersionReport, which is a widening for any TypeScript consumer that reads the two original fields.
harness.json gained two optional fields. Older records read back with source and pushedAt null and are never rewritten; nothing re-pushes on their behalf, so a root keeps reporting a null provenance until its next hot update. No migration is needed and none is performed.