@@ -30,6 +30,7 @@ import {
3030 type TextChunk ,
3131} from "@opentui/core"
3232import { BoxRenderable , TextRenderable } from "@opentui/core"
33+ import pkg from "../../package.json" with { type : "json" }
3334
3435import { MARK_LARGE , MARK_MID , MARK_SMALL , type MarkGrid } from "./mark-shape.js"
3536import { renderMark } from "./mark-anim.js"
@@ -49,6 +50,9 @@ const MARK_GAP_ROWS = 1
4950/** Columns of air between the mark's right edge and the hint block. */
5051export const LANDING_HERO_GAP = 3
5152
53+ /** The running build, read from `package.json` so it cannot drift from what shipped. */
54+ export const LANDING_VERSION = `v${ pkg . version } `
55+
5256/**
5357 * The two doors off the landing screen. Every other key lives behind one of
5458 * them, so this list never grows.
@@ -62,9 +66,9 @@ export const LANDING_HINTS: readonly {
6266]
6367
6468/** Columns the hint block needs, its longest line deciding. */
65- export const LANDING_HINT_WIDTH = LANDING_HINTS . reduce (
66- ( widest , hint ) => Math . max ( widest , hint . key . length + 1 + hint . rest . length ) ,
67- 0 ,
69+ export const LANDING_HINT_WIDTH = Math . max (
70+ LANDING_HINTS . reduce ( ( widest , hint ) => Math . max ( widest , hint . key . length + 1 + hint . rest . length ) , 0 ) ,
71+ LANDING_VERSION . length ,
6872)
6973
7074/** Largest first: the landing takes the best-reading mark its zone can seat. */
@@ -343,6 +347,14 @@ function createHintBlock(ctx: CliRenderer): BoxRenderable {
343347 } ) ,
344348 )
345349 } )
350+ block . add (
351+ new TextRenderable ( ctx , {
352+ id : "shell-landing-version" ,
353+ height : 1 ,
354+ content : LANDING_VERSION ,
355+ fg : UI . textFaint ,
356+ } ) ,
357+ )
346358 return block
347359}
348360
@@ -352,7 +364,7 @@ function createHintBlock(ctx: CliRenderer): BoxRenderable {
352364 */
353365export function fitLandingMark ( above : LandingAbove , grid : MarkGrid | null ) : void {
354366 above . grid = grid
355- const rows = grid ?. rows ?? LANDING_HINTS . length
367+ const rows = grid ?. rows ?? LANDING_HINTS . length + 1
356368 above . hero . height = rows
357369 above . markColumn . visible = grid !== null
358370 above . markColumn . width = grid ?. cols ?? 0
0 commit comments