Show the build's version and commit in Settings

vite.config.ts stamps the package version, git commit and build time
into the bundle as __BUILD__, and the Settings sidebar shows
"v0.1.0 · <short sha>" (full sha and build time on hover). The Docker
build has no git binary, so the commit is read from .git/HEAD and the
refs directly; .dockerignore now lets just those files through.
GIT_COMMIT in the environment overrides detection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GaoZtJQZwLXkEgWs8twCia
This commit is contained in:
agent 2026-09-27 20:08:19 +00:00
parent 2e52f1be2c
commit 3ac278835b
4 changed files with 52 additions and 1 deletions

3
src/app.d.ts vendored
View file

@ -1,6 +1,9 @@
// See https://svelte.dev/docs/kit/types#app.d.ts
declare global {
namespace App {}
/** Stamped in by vite.config.ts at build time. */
const __BUILD__: { version: string; commit: string; dirty: boolean; time: string };
}
export {};

View file

@ -8,6 +8,7 @@
type Tab = 'appearance' | 'input' | 'sync';
let tab = $state<Tab>('appearance');
const s = settings.data;
const build = __BUILD__;
let testing = $state(false);
let testResult = $state<{ ok: boolean; text: string } | null>(null);
@ -55,6 +56,9 @@
<button class:active={tab === 'appearance'} onclick={() => (tab = 'appearance')}>Appearance</button>
<button class:active={tab === 'input'} onclick={() => (tab = 'input')}>Pen &amp; touch</button>
<button class:active={tab === 'sync'} onclick={() => (tab = 'sync')}>Sync</button>
<div class="build" title={`Commit ${build.commit}\nBuilt ${new Date(build.time).toLocaleString()}`}>
v{build.version} · {build.commit.slice(0, 7)}{build.dirty ? '-dirty' : ''}
</div>
</nav>
<section>
<button class="icon-btn close" title="Close" onclick={close}><XIcon size={18} /></button>
@ -187,6 +191,14 @@
color: var(--faint);
padding: 0 10px 8px;
}
.build {
margin-top: auto;
padding: 0 10px;
font-family: var(--mono-font);
font-size: 11px;
color: var(--faint);
user-select: text;
}
nav button {
text-align: left;
border: 0;