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
+6
View File
@@ -65,6 +65,11 @@ export interface SystemStatus {
services: ServiceStatus[];
}
export interface VersionInfo {
version: string;
commit: string;
}
export class ApiError extends Error {
status: number;
constructor(status: number, message: string) {
@@ -104,6 +109,7 @@ export const api = {
apply: () => request<{ results: { module: string; applied: boolean; error?: string }[] }>("POST", "/apply"),
applyLog: () => request<{ entries: ApplyLogEntry[] }>("GET", "/apply/log"),
systemStatus: () => request<SystemStatus>("GET", "/system/status"),
version: () => request<VersionInfo>("GET", "/version"),
// samba
listShares: () => request<{ shares: SambaShare[] | null }>("GET", "/samba/shares/"),
+10 -1
View File
@@ -1,5 +1,6 @@
import { useEffect, useState } from "react";
import { NavLink, Outlet, useNavigate } from "react-router-dom";
import { api } from "../api";
import { api, VersionInfo } from "../api";
import DirtyBanner from "./DirtyBanner";
const navItems = [
@@ -13,6 +14,11 @@ const navItems = [
export default function Layout({ username, onLogout }: { username: string; onLogout: () => void }) {
const navigate = useNavigate();
const [version, setVersion] = useState<VersionInfo | null>(null);
useEffect(() => {
api.version().then(setVersion).catch(() => {});
}, []);
async function handleLogout() {
await api.logout();
@@ -47,6 +53,9 @@ export default function Layout({ username, onLogout }: { username: string; onLog
<button className="btn-ghost w-full" onClick={handleLogout}>
Cerrar sesión
</button>
<div className="mt-2 border-t border-slate-800 pt-2 text-center font-mono text-xs text-slate-600">
v{version?.version ?? "dev"}{version?.commit && ` · ${version.commit}`}
</div>
</div>
</aside>
<main className="flex-1">