Skip to content

fix(build): include commit short SHA in version string for traceability#1723

Merged
wqymi merged 4 commits into
mainfrom
fix/version-include-sha
Jul 14, 2026
Merged

fix(build): include commit short SHA in version string for traceability#1723
wqymi merged 4 commits into
mainfrom
fix/version-include-sha

Conversation

@wqymi

@wqymi wqymi commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Preview version strings now include the git short SHA for precise code traceability
  • Format: 0.0.0-<channel>-<timestamp>-<shortsha> (e.g. 0.0.0-main-202607141224-a1b2c3d)
  • Falls back to MIMOCODE_COMMIT_SHA env var when git is unavailable (CI/non-repo builds)

Changes

  • packages/script/src/index.ts: Added SHORT_SHA via git rev-parse --short HEAD with env var fallback; appended to preview version string

Verification

  • Local test output: 0.0.0-fix/version-include-sha-202607141237-f17e98b (SHA included)
  • Env var fallback test: 0.0.0-main-202607141237-abc1234 (works without git)
  • Typecheck: pre-existing errors only, no regressions from this change

wqymi added 4 commits July 14, 2026 20:38
Preview version strings now include the git short SHA (e.g. 0.0.0-main-202607141224-a1b2c3d).
Falls back to MIMOCODE_COMMIT_SHA env var when git is unavailable (CI/non-repo builds).
Simplify version format from 0.0.0-<channel>-<timestamp>-<sha> to
0.0.0-<channel>-<sha>. The timestamp is redundant (files have mtime,
git commits have dates) and makes the version too long for narrow UI.
The SHA is what actually maps to code.

Also changes fallback from empty string to 'unknown' for graceful
degradation when neither git nor env fallback is available.
… 'unknown'

When both git and MIMOCODE_COMMIT_SHA env are unavailable, the version
string now produces '0.0.0-<channel>' without any SHA segment, instead
of appending '-unknown'.
…ring

When no git SHA is available (no git repo and no MIMOCODE_COMMIT_SHA env),
the version string now appends a YYYYMMDDHHmm timestamp instead of omitting
the identifier segment entirely. SHA remains the preferred identifier when
available (0.0.0-<channel>-<sha>); timestamp is the fallback only.
@wqymi wqymi merged commit eac311e into main Jul 14, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant