Conversation
Add a build-info codegen step that captures `git rev-parse --short HEAD` into a root-level build-info.json, read at runtime to decorate the version string (e.g. 0.6.0@e5c03c0) for --version, the chat header, and session metadata. Dev/local installs (symlinked global, tsx, node dist) were previously indistinguishable from published releases — both showed plain 0.6.0 — so there was no way to tell what was actually installed. The stamp file sits at the repo root, which is outside the npm `files` allowlist, so npm excludes it from the published tarball and releases still show plain 0.6.0. The update check keeps the clean base version via a new baseVersion prop, since the @-decorated form is not valid semver and would mis-parse in isNewer. Stamping happens at build time (build/dev/haze), so the version reflects the commit dist was built from — rebuild after switching branches for it to update. A missing or malformed stamp degrades to the plain version with no error. Co-Authored-By: Claude <noreply@anthropic.com>
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.
What
Adds a build-time codegen step that stamps the short git commit into a root-level
build-info.json, read at runtime to decorate the version string — e.g.haze --versionshows0.6.0@e5c03c0instead of a bare0.6.0.Why
Dev/local installs (symlinked global install,
tsx,node dist) were previously indistinguishable from published releases — both showed plain0.6.0— so there was no way to tell what was actually running. This makes the built-from commit visible at a glance.How
scripts/build-info.mjscapturesgit rev-parse --short HEAD(degrades tonullif git is unavailable) and writesbuild-info.jsonat the repo root.npm run build-inforuns the step; it's chained intodev,build, andhaze. Stamping happens at build time, so the version reflects the commitdistwas built from (rebuild after switching branches for it to update).src/cli/index.tsreads the stamp and decorates the version for--version, the chat header, and session metadata. A missing or malformed stamp degrades to the plain version with no error.filesallowlist, so npm excludes it from the published tarball and releases still show plain0.6.0.baseVersionprop, since the@-decorated form is not valid semver and would mis-parse inisNewer(e.g.0.6.0@e5c03c0would parse as release0.6.5030).build-info.jsonis gitignored (a build artifact, not source).formatVersion(base, commit)helper is pure and unit-tested.Verification
npm run typecheck— cleannpm test— 796 passed / 86 filesnpm run lint(eslint src/) — clean0.6.0@e2e1aa1; with the stamp absent (published-tarball simulation) it shows0.6.0.🤖 Generated with Claude Code