feat: bake version into binary and display in UI sidebar

- Inject VERSION via ldflags (-X main=web.Version=) and git short SHA
- Add /api/version endpoint returning {version, commit}
- Display version in Layout sidebar footer (v0.1.6 · 8cfd405)
- Add AGENTS.md section documenting SemVer policy and bump-before-push rule
- Bump VERSION 0.1.5 -> 0.1.6 in Makefile
This commit is contained in:
2026-07-05 23:07:20 -04:00
parent 8cfd405ffc
commit ac07499e8d
8 changed files with 65 additions and 4 deletions
+21
View File
@@ -52,3 +52,24 @@ cd web && npm run dev # Vite on :5173, proxies /api to :8080
```
Requires `web/node_modules` (run `cd web && npm install` first).
## Releasing / Versioning
The project follows **SemVer**: `MAJOR.MINOR.PATCH`.
- **PATCH** (`0.1.5 → 0.1.6`): bug fixes, no API changes.
- **MINOR** (`0.1.x → 0.2.0`): new features, backward-compatible.
- **MAJOR** (`0.x → 1.0`): breaking changes.
**Bump before commit/push.** Update `VERSION?=` in the `Makefile` before staging any
release-worthy changes. The value is baked into the binary at build time via
`-ldflags -X github.com/darroyo/nasctl/internal/web.Version=$(VERSION)` and surfaced
in the UI sidebar footer and `GET /api/version`.
The short git SHA is also injected automatically via
`-X github.com/darroyo/nasctl/internal/web.Commit=$(shell git rev-parse --short HEAD)`.
Override at build time: `make build VERSION=0.2.0-rc1`.
When reviewing staged changes, always confirm the version bump matches the
nature of the change (patch vs minor vs major).