Skip to content

feat: rustc-style --version with git commit and build date#509

Merged
cs01 merged 1 commit intomainfrom
version-info-string
Apr 14, 2026
Merged

feat: rustc-style --version with git commit and build date#509
cs01 merged 1 commit intomainfrom
version-info-string

Conversation

@cs01
Copy link
Copy Markdown
Owner

@cs01 cs01 commented Apr 14, 2026

Summary

Makes chad --version useful for bug reports — prints git commit and build date embedded in the version string, rustc-style as a single hyphenated token:

$ chad --version
chad 0.3.0-beta-437cdd99-2026-04-14

Previously chad 0.2.0-beta, which tells you nothing about which build someone is actually running.

Also bumps version 0.2.0-beta0.3.0-beta.

How it works

scripts/gen-version.js (the existing prebuild hook) now shells out to git rev-parse --short HEAD and bakes a single VERSION constant of the form <semver>-<sha>-<date> into src/version.ts. If git isn't available (e.g., building from a release tarball), the sha falls back to "unknown".

Kept the single VERSION export — zero touches to src/*.ts, just content changes in the generated src/version.ts.

Test plan

  • node dist/chad-node.js --versionchad 0.3.0-beta-<sha>-<date>
  • ./.build/chad --version (native compiler) → same
  • npm run verify passes — full tests + stage 0/1/2 self-hosting

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 14, 2026

Benchmark Results (Linux x86-64)

Benchmark C ChadScript Go Node Place
Binary Trees 1.271s 1.555s 2.923s 1.339s 🥉
Cold Start 0.8ms 0.6ms 0.9ms 25.1ms 🥇
Fibonacci 0.725s 0.722s 1.429s 2.831s 🥇
File I/O 0.089s 0.090s 0.089s 0.315s 🥉
JSON Parse/Stringify 0.003s 0.005s 0.017s 0.015s 🥈
Matrix Multiply 0.433s 0.431s 0.456s 0.466s 🥇
Monte Carlo Pi 0.400s 0.381s 0.405s 1.473s 🥇
N-Body Simulation 1.455s 1.855s 1.945s 2.296s 🥈
Quicksort 0.170s 0.216s 0.182s 0.247s 🥉
SQLite 0.309s 0.330s 0.412s 🥈
Sieve of Eratosthenes 0.026s 0.040s 0.036s 0.053s 🥉
String Manipulation 0.008s 0.017s 0.017s 0.038s 🥉

CLI Tool Benchmarks

Benchmark ChadScript grep node xxd Place
Hex Dump 0.441s 1.130s 0.072s 🥈
Recursive Grep 0.010s 0.006s 0.096s 🥈

@cs01 cs01 force-pushed the version-info-string branch from a7e1f70 to 0d57698 Compare April 14, 2026 04:15
@cs01 cs01 merged commit 17b544c into main Apr 14, 2026
11 checks passed
@cs01 cs01 deleted the version-info-string branch April 14, 2026 05:29
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