From add73bdb51eeb493ee894cd1f9aef1e8ff625223 Mon Sep 17 00:00:00 2001 From: Cameron Date: Thu, 12 Feb 2026 18:49:20 -0800 Subject: [PATCH] feat: show version and commit hash in startup banner (#293) --- src/core/banner.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/core/banner.ts b/src/core/banner.ts index 1503307..9e6e91f 100644 --- a/src/core/banner.ts +++ b/src/core/banner.ts @@ -2,6 +2,30 @@ * Startup banner with LETTABOT block text and loom ASCII art. */ +import { execSync } from 'node:child_process'; +import { createRequire } from 'node:module'; + +const require = createRequire(import.meta.url); + +/** Read version from package.json and git commit hash. */ +function getVersionString(): string { + let version = 'unknown'; + try { + const pkg = require('../../package.json'); + version = pkg.version || version; + } catch {} + + let commit = ''; + try { + commit = execSync('git rev-parse --short HEAD', { + encoding: 'utf-8', + stdio: ['ignore', 'pipe', 'ignore'], + }).trim(); + } catch {} + + return commit ? `v${version} (${commit})` : `v${version}`; +} + interface BannerAgent { name: string; agentId?: string | null; @@ -81,7 +105,9 @@ export function printStartupBanner(agents: BannerAgent[]): void { } // Status lines + const versionStr = getVersionString(); console.log(''); + console.log(` Version: ${versionStr}`); for (const agent of agents) { const ch = agent.channels.length > 0 ? agent.channels.join(', ') : 'none'; if (agent.agentId) {