output.zig

40.3 KB · raw

1// output.zig — the only file that writes to stdout2// All ANSI codes live here. No raw escape sequences elsewhere.3const std = @import("std");4const types = @import("types.zig");5const nina_version = @import("version.zig");6const Io = std.Io;78// Color constants — all ANSI codes live here only9const PINK = "\x1b[38;2;255;183;197m";10const BOLD = "\x1b[1m";11const GREEN = "\x1b[32m";12const YELLOW = "\x1b[33m";13const RED = "\x1b[31m";14const CYAN = "\x1b[36m";15const DIM = "\x1b[2m";16const RESET = "\x1b[0m";1718// kaomoji constants — all kaomoji defined here, never inlined elsewhere. Rare19// and earned: each marks one genuine moment and never repeats in one output20// block. They are plain text, not ANSI, so they survive pipes and NO_COLOR.21const KAO_FACE = "(˶ᵔ ᵕ ᵔ˶)  "; // hello — her face22const KAO_COZY = "(っ˘ω˘ς)  "; // apply start23const KAO_EXCITED = "╰(*°▽°*)╯  "; // apply success after a failure this session24const KAO_GENTLE = "( ˘ᵕ˘ )  "; // back done25const KAO_CONTENT = "( ´ ∀ ` )  "; // clean freed26const KAO_HAPPY = "( ´ ▽ ` )  "; // doctor all clear / mood all good27const KAO_SLEEPY = "(˘ω˘ )  "; // try / develop exit28const KAO_READY = "( •̀ᴗ•́ )  "; // update start29const KAO_SAD = "(;ω;)  "; // network or ssh errors only — never user typos3031// Exported for TUI use (search.zig references these to avoid \x1b in that file)32pub const C_PINK = PINK;33pub const C_BOLD = BOLD;34pub const C_GREEN = GREEN;35pub const C_YELLOW = YELLOW;36pub const C_RED = RED;37pub const C_CYAN = CYAN;38pub const C_DIM = DIM;39pub const C_RESET = RESET;40pub const C_CLEAR_EOL = "\x1b[K";41pub const C_CURSOR_UP_FMT = "\x1b[{d}A";4243// Precomputed prefix strings44const HDR_C = PINK ++ ":: " ++ RESET;45const HDR_P = ":: ";46const STEP_C = "   " ++ DIM ++ "-> " ++ RESET;47const STEP_P = "   -> ";48const TEACH_C = "   " ++ DIM ++ "= " ++ RESET;49const TEACH_P = "   = ";50const ERR_C = PINK ++ ":: " ++ RED ++ "error:" ++ RESET ++ " ";51const ERR_P = ":: error: ";52const WARN_C = PINK ++ ":: " ++ YELLOW ++ "warning:" ++ RESET ++ " ";53const WARN_P = ":: warning: ";5455var _fw: Io.File.Writer = undefined;56var _w: *Io.Writer = undefined;57var color_enabled: bool = true;58var teach_enabled: bool = false;5960pub fn init(writer: *Io.Writer, io: std.Io, environ: *const std.process.Environ.Map, color_config: bool) void {61    _w = writer;62    color_enabled = color_config and63        (std.Io.File.stdout().isTty(io) catch false) and64        !environ.contains("NO_COLOR");65}6667pub fn setTeach(enabled: bool) void {68    teach_enabled = enabled;69}7071pub fn flush() void {72    _w.flush() catch {};73}7475// Whether ANSI color is active (tty + config + no NO_COLOR). Callers spawning76// child processes that colorize their own output use this to gate the child.77pub fn colorEnabled() bool {78    return color_enabled;79}8081fn c(code: []const u8) []const u8 {82    return if (color_enabled) code else "";83}8485fn hdr() []const u8 {86    return if (color_enabled) HDR_C else HDR_P;87}8889fn step() []const u8 {90    return if (color_enabled) STEP_C else STEP_P;91}9293fn teach_pfx() []const u8 {94    return if (color_enabled) TEACH_C else TEACH_P;95}9697// Raw write — used by TUI98pub fn raw(bytes: []const u8) void {99    _w.writeAll(bytes) catch {};100}101102// Formatted print — used by TUI for in-place rendering103pub fn p(comptime fmt: []const u8, args: anytype) void {104    _w.print(fmt, args) catch {};105}106107pub fn cursorUp(n: usize) void {108    if (n > 0) p("\x1b[{d}A", .{n});109}110111pub fn clearLine() void {112    p("\r\x1b[K", .{});113}114115// --- Error and warning output ---116117pub fn printError(message: []const u8, detail: ?[]const u8, suggestion: ?[]const u8) void {118    p("{s}{s}\n", .{ if (color_enabled) ERR_C else ERR_P, message });119    if (detail) |d| p("   {s}{s}{s}\n", .{ c(DIM), d, c(RESET) });120    // Actionable suggestion in cyan — the next step should catch the eye.121    if (suggestion) |s| p("   {s}-> {s}{s}\n", .{ c(CYAN), s, c(RESET) });122}123124// Like printError, but for genuine system failures (network/ssh/search). The sad125// kaomoji signals "this is on the machine, not on you" — never used for typos or126// not-found errors, which go through printError.127pub fn printSystemError(message: []const u8, detail: ?[]const u8, suggestion: ?[]const u8) void {128    p("{s}{s}{s}\n", .{ KAO_SAD, if (color_enabled) ERR_C else ERR_P, message });129    if (detail) |d| p("   {s}{s}{s}\n", .{ c(DIM), d, c(RESET) });130    if (suggestion) |s| p("   {s}-> {s}{s}\n", .{ c(CYAN), s, c(RESET) });131}132133pub fn printWarning(message: []const u8) void {134    p("{s}{s}\n", .{ if (color_enabled) WARN_C else WARN_P, message });135}136137// One-time dim note when ~/.nina.conf is migrated to the XDG config path.138pub fn configMigrated(path: []const u8) void {139    p("{s}{s}config migrated to {s}{s}\n", .{ step(), c(DIM), path, c(RESET) });140}141142pub fn printTeach(cmd: []const u8) void {143    if (teach_enabled) p("{s}{s}{s}\n", .{ teach_pfx(), cmd, c(RESET) });144}145146pub fn printSubstep(comptime fmt: []const u8, args: anytype) void {147    p("{s}", .{step()});148    p(fmt, args);149    p("\n", .{});150}151152// --- Confirmation prompt (returns true = yes) ---153154pub fn confirm(prompt: []const u8) bool {155    p("   {s}continue? [Y/n]  ", .{prompt});156    flush();157    var buf: [64]u8 = undefined;158    var i: usize = 0;159    while (i < buf.len) {160        const n = std.posix.read(std.posix.STDIN_FILENO, buf[i .. i + 1]) catch break;161        if (n == 0) break;162        if (buf[i] == '\n') break;163        i += 1;164    }165    const input = std.mem.trim(u8, buf[0..i], " \t");166    if (input.len == 0) return true;167    return input[0] != 'n' and input[0] != 'N';168}169170// Like confirm, but defaults to NO on an empty answer — for prompts that touch171// system files, where a stray Enter should never trigger the action.172pub fn confirmDefaultNo(question: []const u8) bool {173    p("   {s} [y/N]  ", .{question});174    flush();175    var buf: [64]u8 = undefined;176    var i: usize = 0;177    while (i < buf.len) {178        const n = std.posix.read(std.posix.STDIN_FILENO, buf[i .. i + 1]) catch break;179        if (n == 0) break;180        if (buf[i] == '\n') break;181        i += 1;182    }183    const input = std.mem.trim(u8, buf[0..i], " \t");184    if (input.len == 0) return false;185    return input[0] == 'y' or input[0] == 'Y';186}187188// --- Apply / rebuild ---189190pub fn applyStart(machine: []const u8) void {191    p("{s}{s}rebuilding {s}...\n", .{ KAO_COZY, hdr(), machine });192}193194// after_failure: true only when the previous apply this session failed and this195// one succeeded — the one moment that earns the excited kaomoji. Routine196// successes show no kaomoji.197pub fn applyDone(gen: u32, elapsed_ms: u64, after_failure: bool) void {198    const face = if (after_failure) KAO_EXCITED else "";199    const secs = @as(f64, @floatFromInt(elapsed_ms)) / 1000.0;200    if (elapsed_ms >= 1000) {201        p("{s}{s}generation {s}{d}{s}  {s}[{d:.1}s]{s}\n", .{ face, hdr(), c(BOLD), gen, c(RESET), c(DIM), secs, c(RESET) });202    } else {203        p("{s}{s}generation {s}{d}{s}\n", .{ face, hdr(), c(BOLD), gen, c(RESET) });204    }205}206207pub fn applyFailed(translated: []const u8) void {208    p("{s}build failed\n", .{if (color_enabled) ERR_C else ERR_P});209    if (translated.len > 0) p("   {s}{s}{s}\n", .{ c(DIM), translated, c(RESET) });210    p("   {s}-> nina doctor{s}\n", .{ c(DIM), c(RESET) });211}212213pub fn applyDry(machine: []const u8) void {214    p("{s}dry run  {s}\n", .{ hdr(), machine });215}216217pub fn applyDryDone() void {218    p("{s}no changes applied\n", .{hdr()});219}220221// --- Check ---222223pub fn checkStart(machine: []const u8) void {224    p("{s}checking {s}...\n", .{ hdr(), machine });225}226227pub fn checkOk() void {228    p("{s}{s}ok{s}\n", .{ hdr(), c(GREEN), c(RESET) });229}230231pub fn checkFailed(msg: []const u8) void {232    p("{s}config invalid\n", .{if (color_enabled) ERR_C else ERR_P});233    if (msg.len > 0) p("   {s}{s}{s}\n", .{ c(DIM), msg, c(RESET) });234}235236// --- Back / go ---237238pub fn backStart(machine: []const u8, from: u32, to: u32) void {239    p("{s}rolling back  {s}  gen {d} -> gen {d}\n", .{ hdr(), machine, from, to });240}241242pub fn goStart(machine: []const u8, current: u32, target: u32) void {243    p("{s}switching  {s}  gen {d} -> gen {d}\n", .{ hdr(), machine, current, target });244}245246pub fn generationDone(n: u32) void {247    p("{s}done  gen {s}{d}{s}\n", .{ hdr(), c(BOLD), n, c(RESET) });248}249250// `back` has nothing older to roll back to. This is a clean stop, not a build251// failure — the rollback would otherwise surface nixos-rebuild's confusing252// 'no profile version older than the current' as a fake build error.253pub fn alreadyOldest() void {254    p("{s}already at the oldest generation\n", .{if (color_enabled) ERR_C else ERR_P});255}256257// Like generationDone but for `back` specifically — a successful rollback earns258// the gentle kaomoji. `go` keeps the plain generationDone line.259pub fn backDone(n: u32) void {260    p("{s}{s}done  gen {s}{d}{s}\n", .{ KAO_GENTLE, hdr(), c(BOLD), n, c(RESET) });261}262263// --- History ---264265pub fn historyHeader(machine: []const u8) void {266    p("{s}generations  {s}\n\n", .{ hdr(), machine });267}268269pub fn historyRow(gen: types.GenerationInfo) void {270    if (gen.current) {271        p("   {s}{d}{s}   {s}   {s}   {s}current{s}\n", .{ c(BOLD), gen.number, c(RESET), gen.date, gen.time, c(BOLD), c(RESET) });272    } else {273        p("   {s}{d}   {s}   {s}{s}\n", .{ c(DIM), gen.number, gen.date, gen.time, c(RESET) });274    }275}276277// --- Clean ---278279pub fn cleanStart(machine: []const u8, keep: u32, total: u32) void {280    p("{s}cleaning  {s}  keeping {d} of {d}\n", .{ hdr(), machine, keep, total });281}282283// Fewer generations than the keep limit — there's nothing to collect. Avoids the284// nonsensical 'keeping 5 of 1'.285pub fn cleanNothing(machine: []const u8, total: u32) void {286    p("{s}cleaning  {s}\n\n", .{ hdr(), machine });287    p("   only {d} generation{s} — nothing to remove.\n", .{ total, if (total == 1) "" else "s" });288}289290pub fn cleanDone() void {291    p("{s}{s}done\n", .{ KAO_CONTENT, hdr() });292}293294// --- Status ---295296pub fn statusHeader() void {297    p("{s}status\n\n", .{hdr()});298}299300pub fn statusRow(machine: []const u8, gen: u32, time: []const u8, size: []const u8, ok: bool) void {301    if (ok) {302        p("   {s}{s}{s}   gen {s}{d}{s}   {s}{s}   {s}{s}\n", .{ c(DIM), machine, c(RESET), c(BOLD), gen, c(RESET), c(DIM), time, size, c(RESET) });303    } else {304        p("   {s}{s}   {s}unreachable{s}\n", .{ c(RED), machine, "", c(RESET) });305    }306}307308// Dim Home Manager generation line, indented under the machine row. Only shown309// when standalone HM is detected; absent otherwise so the layout is unchanged.310pub fn statusHomeRow(gen: u32, detail: []const u8) void {311    if (detail.len > 0) {312        p("   {s}         hm  gen {d}   {s}{s}\n", .{ c(DIM), gen, detail, c(RESET) });313    } else {314        p("   {s}         hm  gen {d}{s}\n", .{ c(DIM), gen, c(RESET) });315    }316}317318// --- Diff ---319320pub fn diffHeader(a: u32, b: u32, machine: []const u8) void {321    p("{s}gen {d} -> gen {d}  {s}\n\n", .{ hdr(), a, b, machine });322}323324pub fn diffRow(entry: types.DiffEntry) void {325    switch (entry.op) {326        .add => p("   {s}+{s} {s}   {s}\n", .{ c(GREEN), c(RESET), entry.package, entry.new_version orelse "" }),327        .remove => p("   {s}-{s} {s}   {s}\n", .{ c(RED), c(RESET), entry.package, entry.old_version orelse "" }),328        .change => p("   {s}^{s} {s}   {s} -> {s}\n", .{ c(CYAN), c(RESET), entry.package, entry.old_version orelse "", entry.new_version orelse "" }),329    }330}331332// --- Doctor ---333334pub fn doctorHeader(machine: []const u8) void {335    p("{s}diagnosing  {s}\n\n", .{ hdr(), machine });336}337338pub fn doctorRow(check: types.DoctorCheck) void {339    const status_str = switch (check.status) {340        .ok => if (color_enabled) GREEN ++ "ok" ++ RESET else "ok",341        .warn => if (color_enabled) YELLOW ++ "warn" ++ RESET else "warn",342        .fail => if (color_enabled) RED ++ "fail" ++ RESET else "fail",343    };344    const note_str = check.note orelse "";345    p("   {s:<16}  {s}   {s}\n", .{ check.name, status_str, note_str });346}347348pub fn doctorSummary(warnings: u32, failures: u32) void {349    if (failures > 0) {350        p("{s}{d} problems\n", .{ hdr(), failures });351    } else if (warnings > 0) {352        p("{s}{d} warnings\n", .{ hdr(), warnings });353    } else {354        p("{s}{s}{s}all good{s}\n", .{ KAO_HAPPY, hdr(), c(GREEN), c(RESET) });355    }356}357358// --- Update ---359360pub fn updateStart(machine: []const u8) void {361    p("{s}updating channels  {s}\n\n", .{ hdr(), machine });362}363364pub fn updateChannel(name: []const u8, old: ?[]const u8, new: ?[]const u8) void {365    if (old != null and new != null and !std.mem.eql(u8, old.?, new.?)) {366        p("   {s}   {s} -> {s}\n", .{ name, old.?, new.? });367    } else {368        p("   {s}   {s}no change{s}\n", .{ name, c(DIM), c(RESET) });369    }370}371372pub fn updateDone() void {373    p("\n{s}done\n", .{hdr()});374}375376// --- Upgrade ---377378pub fn upgradeStart(machine: []const u8) void {379    p("{s}upgrading  {s}\n", .{ hdr(), machine });380}381382// --- Log ---383384pub fn logHeader(machine: []const u8) void {385    p("{s}history  {s}\n\n", .{ hdr(), machine });386}387388pub fn logRow(date: []const u8, time: []const u8, action: []const u8, detail: []const u8) void {389    p("   {s}{s}  {s}{s}   {s:<16}  {s}\n", .{ c(DIM), date, time, c(RESET), action, detail });390}391392// --- Edit ---393394pub fn editOpen(path: []const u8, editor: []const u8) void {395    p("{s}opening {s}\n", .{ hdr(), path });396    printSubstep("{s}", .{editor});397    p("\n   {s}run nina check to validate before applying{s}\n", .{ c(DIM), c(RESET) });398}399400// --- Fmt ---401402pub fn fmtStart(path: []const u8) void {403    p("{s}formatting  {s}\n", .{ hdr(), path });404}405406pub fn fmtDone() void {407    p("{s}done\n", .{hdr()});408}409410pub fn fmtNeedsFormat() void {411    p("{s}needs formatting  {s}run nina fmt to fix{s}\n", .{ hdr(), c(DIM), c(RESET) });412}413414// --- Repl ---415416pub fn replStart() void {417    p("{s}nix repl  {s}nixpkgs loaded{s}  :q to exit\n", .{ hdr(), c(DIM), c(RESET) });418}419420// --- Develop ---421422pub fn developStart(pkgs: []const []const u8) void {423    p("{s}entering dev shell\n\n   ", .{hdr()});424    for (pkgs, 0..) |pkg, i| {425        if (i > 0) p("  ", .{});426        p("{s}", .{pkg});427    }428    p("\n\n   {s}-> press Ctrl+C or type 'exit' to return{s}\n\n", .{ c(DIM), c(RESET) });429}430431pub fn developDone() void {432    p("{s}{s}back\n", .{ KAO_SLEEPY, hdr() });433}434435// --- Info ---436437pub fn infoHeader(machine: []const u8) void {438    p("{s}{s}\n\n", .{ hdr(), machine });439}440441pub fn infoRow(key: []const u8, val: []const u8) void {442    p("   {s:<12}  {s}\n", .{ key, val });443}444445// --- Boot ---446447pub fn bootHeader(machine: []const u8) void {448    p("{s}boot entries  {s}\n\n", .{ hdr(), machine });449}450451pub fn bootEntry(entry: types.BootEntry, idx: usize) void {452    if (entry.current) {453        p("   {s}> {s}{s}{s}\n", .{ c(BOLD), entry.title, if (entry.date) |d| std.fmt.allocPrint(std.heap.page_allocator, "   {s}", .{d}) catch "   " else "", c(RESET) });454    } else {455        p("   {s}  {s}{s}{s}\n", .{ c(DIM), entry.title, if (entry.date) |d| std.fmt.allocPrint(std.heap.page_allocator, "   {s}", .{d}) catch "   " else "", c(RESET) });456    }457    _ = idx;458}459460// --- Service ---461462pub fn serviceListHeader(machine: []const u8) void {463    p("{s}services  {s}\n\n", .{ hdr(), machine });464}465466pub fn serviceRow(svc: types.ServiceInfo) void {467    const state_str = switch (svc.state) {468        .active => if (color_enabled) GREEN ++ "active" ++ RESET else "active",469        .failed => if (color_enabled) RED ++ "failed" ++ RESET else "failed",470        .inactive => "inactive",471        .unknown => "unknown",472    };473    const uptime = svc.uptime orelse "";474    p("   {s:<24}  {s:<14}  {s}\n", .{ svc.name, state_str, uptime });475}476477pub fn serviceVerb(verb: []const u8, name: []const u8, machine: []const u8) void {478    p("{s}{s} {s}  {s}\n", .{ hdr(), verb, name, machine });479}480481pub fn serviceDone() void {482    p("{s}done\n", .{hdr()});483}484485pub fn serviceLogsHeader(name: []const u8, n: u32, machine: []const u8) void {486    p("{s}{s}  last {d} lines  {s}\n\n", .{ hdr(), name, n, machine });487}488489// --- Store ---490491pub fn storeInfo(info: types.StoreInfo) void {492    p("{s}store\n\n", .{hdr()});493    p("   {s:<16}  {s}\n", .{ "total", info.total_size });494    p("   {s:<16}  {d} paths\n", .{ "live", info.live_paths });495    p("   {s:<16}  {s}{d} paths{s}   {s}run nina clean{s}\n", .{ "reclaimable", c(DIM), info.reclaimable_paths, c(RESET), c(CYAN), c(RESET) });496}497498// --- Channel ---499500pub fn channelListHeader(machine: []const u8) void {501    p("{s}channels  {s}\n\n", .{ hdr(), machine });502}503504pub fn channelRow(ch: types.ChannelInfo) void {505    p("   {s:<16}  {s}\n", .{ ch.name, ch.url });506}507508// --- Flake ---509510pub fn flakeUpdateStart() void {511    p("{s}updating inputs\n\n", .{hdr()});512}513514pub fn flakeInput(input: types.FlakeInput) void {515    if (input.changed) {516        const old = if (input.old_rev) |r| r[0..@min(7, r.len)] else "?";517        const new = if (input.new_rev) |r| r[0..@min(7, r.len)] else "?";518        p("   {s:<20}  {s} -> {s}\n", .{ input.name, old, new });519    } else {520        p("   {s:<20}  {s}no change{s}\n", .{ input.name, c(DIM), c(RESET) });521    }522}523524pub fn flakeLockWritten() void {525    p("\n{s}flake.lock written\n", .{hdr()});526}527528pub fn flakeValid() void {529    p("{s}{s}valid{s}\n", .{ hdr(), c(GREEN), c(RESET) });530}531532pub fn flakeCheckStart() void {533    p("{s}checking flake\n", .{hdr()});534}535536// --- Profile ---537538pub fn profileListHeader() void {539    p("{s}profile packages\n\n", .{hdr()});540}541542pub fn profileRow(attr: []const u8, pkg_version: []const u8, description: []const u8) void {543    p("   {s:<24}  {s:<12}  {s}\n", .{ attr, pkg_version, description });544}545546// --- Install / Remove / Try ---547548// Typo help for install: the query matched nothing, so suggest the closest real549// package name (pink) and let the caller confirm.550pub fn didYouMean(query: []const u8, suggestion: []const u8) void {551    p("{s}{s}'{s}' not found{s}  —  did you mean {s}{s}{s}?\n", .{ hdr(), c(DIM), query, c(RESET), c(PINK), suggestion, c(RESET) });552}553554pub fn installStart(pkg: []const u8, path: types.InstallPath) void {555    const path_str = switch (path) {556        .profile => "profile",557        .system => "system",558    };559    p("{s}installing {s}{s}{s}  {s}\n", .{ hdr(), c(PINK), pkg, c(RESET), path_str });560}561562pub fn installDone(pkg: []const u8) void {563    p("{s}{s}{s}{s} installed  {s}available now{s}\n", .{ hdr(), c(PINK), pkg, c(RESET), c(DIM), c(RESET) });564}565566pub fn removeStart(pkg: []const u8) void {567    p("{s}removing {s}{s}{s}\n", .{ hdr(), c(PINK), pkg, c(RESET) });568}569570// Plain-language health summary. No kaomoji, no hearts — just the facts.571pub fn mood(machine: []const u8, state: []const u8, gen: u32, age: []const u8, size: []const u8) void {572    const healthy = std.mem.eql(u8, state, "running");573    const verdict = if (healthy) "all good" else state;574    const color = if (healthy) GREEN else YELLOW;575    const face = if (healthy) KAO_HAPPY else "";576    p("{s}{s}{s}  {s}{s}{s}\n", .{ face, hdr(), machine, c(color), verdict, c(RESET) });577    if (age.len > 0 or size.len > 0) {578        p("   generation {d}, last applied {s}, {s} system closure\n", .{ gen, age, size });579    } else {580        p("   generation {d}\n", .{gen});581    }582}583584pub fn installEditorPrompt(pkg: []const u8, config_path: []const u8, line: u32, editor: []const u8) void {585    p("{s}opening {s}  add {s}{s}{s} to systemPackages\n", .{ hdr(), config_path, c(PINK), pkg, c(RESET) });586    const cmd = std.fmt.allocPrint(std.heap.page_allocator, "{s} {s} +{d}", .{ editor, config_path, line }) catch editor;587    printSubstep("{s}", .{cmd});588    p("\n   {s}save and close when done{s}\n\n", .{ c(DIM), c(RESET) });589}590591pub fn installSelectPrompt(pkg: []const u8, pkg_version: []const u8) void {592    p("{s}{s}{s}{s}  {s}\n\n", .{ hdr(), c(PINK), pkg, c(RESET), pkg_version });593    p("   [i] profile install    {s}instant  no rebuild{s}\n", .{ c(DIM), c(RESET) });594    p("   [s] system install     {s}opens editor  requires apply{s}\n", .{ c(DIM), c(RESET) });595    p("   [t] try now            {s}exits when done{s}\n\n", .{ c(DIM), c(RESET) });596    p("   > ", .{});597    flush();598}599600pub fn tryStart(pkg: []const u8) void {601    p("{s}trying {s}{s}{s}  exit when done\n", .{ hdr(), c(PINK), pkg, c(RESET) });602}603604pub fn tryExitHint() void {605    p("   {s}-> press Ctrl+C or type 'exit' to return{s}\n", .{ c(DIM), c(RESET) });606}607608pub fn tryDone() void {609    p("{s}{s}back\n", .{ KAO_SLEEPY, hdr() });610}611612// --- List ---613614pub fn listHeader(machine: []const u8) void {615    p("{s}packages  {s}\n\n", .{ hdr(), machine });616}617618pub fn listSection(title: []const u8) void {619    p("   {s}{s}{s}\n", .{ c(DIM), title, c(RESET) });620}621622// Padded name so the version column lines up into a clean two-column table.623pub fn listPkg(name: []const u8, pkg_version: []const u8) void {624    p("   {s}{s:<16}{s}  {s}{s}{s}\n", .{ c(PINK), name, c(RESET), c(DIM), pkg_version, c(RESET) });625}626627pub fn blankLine() void {628    p("\n", .{});629}630631// --- Hello ---632633pub fn hello(machines: []const types.Machine) void {634    p("{s}{s}nina\n\n", .{ KAO_FACE, hdr() });635    for (machines) |m| {636        const kind = if (m.local) "local" else "ssh";637        const detail = if (m.local) "default" else m.host orelse "";638        p("   {s}{s}{s}   {s}   {s}\n", .{ c(DIM), m.name, c(RESET), kind, detail });639    }640    p("\n", .{});641    const quick = [_][2][]const u8{642        .{ "apply", "rebuild and switch" },643        .{ "search <q>", "find packages" },644        .{ "install <pkg>", "add to profile or system" },645        .{ "status", "machine health" },646        .{ "back", "roll back one generation" },647        .{ "home apply", "apply home config" },648        .{ "home back", "roll back home config" },649        .{ "home history", "list home generations" },650    };651    for (quick) |cmd| {652        p("   {s:<16}  {s}{s}{s}\n", .{ cmd[0], c(DIM), cmd[1], c(RESET) });653    }654    p("\n", .{});655}656657// --- Help ---658659pub fn help() void {660    p("{s}nina  {s}NixOS Intuitive Navigation Assistant by Asha Software{s}\n\n", .{ hdr(), c(DIM), c(RESET) });661    const cmds = [_][2][]const u8{662        .{ "apply", "rebuild and switch" },663        .{ "back", "roll back one generation" },664        .{ "go <n>", "switch to generation n" },665        .{ "history", "list all generations" },666        .{ "clean", "remove old generations" },667        .{ "search <q>", "find packages" },668        .{ "install <pkg>", "add to profile or system" },669        .{ "remove <pkg>", "remove from profile or system" },670        .{ "try <pkg>", "test without installing" },671        .{ "list", "show installed packages" },672        .{ "edit", "open configuration.nix" },673        .{ "check", "validate config" },674        .{ "diff", "changes between generations" },675        .{ "status", "machine health" },676        .{ "update", "refresh channels" },677        .{ "upgrade", "update and rebuild" },678        .{ "log", "operation history" },679        .{ "doctor", "diagnose issues" },680        .{ "mood", "plain-language health" },681        .{ "develop", "enter dev shell" },682        .{ "flake", "flake management" },683        .{ "build", "build a package" },684        .{ "run", "run without installing" },685        .{ "service", "manage services" },686        .{ "store", "nix store tools" },687        .{ "channel", "manage channels" },688        .{ "profile", "user profile packages" },689        .{ "home", "home manager subcommands" },690        .{ "info", "system information" },691        .{ "boot", "boot entries" },692        .{ "fmt", "format configuration.nix" },693        .{ "repl", "nix repl with nixpkgs" },694        .{ "option <q>", "search nixos options" },695        .{ "pkg", "inspect packages" },696        .{ "why <pkg>", "what pulled a package in" },697        .{ "pin", "pin flake inputs" },698        .{ "hash", "compute nix hash" },699        .{ "fetch", "fetch and hash a url" },700        .{ "goodbye", "uninstall nina" },701        .{ "hello", "list machines" },702        .{ "help", "this message" },703    };704    for (cmds) |cmd| {705        p("   {s:<18}  {s}{s}{s}\n", .{ cmd[0], c(DIM), cmd[1], c(RESET) });706    }707    p("\n   {s}flags: --on <machine>  --dry  --check  --no-apply  --last <n>  --all  --json{s}\n", .{ c(DIM), c(RESET) });708}709710// Render a grouped command's subcommand list, shown when the group is invoked711// with no subcommand or an explicit `help`. Rows are {invocation, description}.712pub fn subcommandHelp(group: []const u8, rows: []const [2][]const u8, footer: ?[]const u8) void {713    p("{s}{s} subcommands\n\n", .{ hdr(), group });714    for (rows) |row| {715        p("   {s:<16}  {s}{s}{s}\n", .{ row[0], c(DIM), row[1], c(RESET) });716    }717    if (footer) |f| p("\n   {s}{s}{s}\n", .{ c(DIM), f, c(RESET) });718    p("\n   nina {s} help  {s}for this message{s}\n", .{ group, c(DIM), c(RESET) });719}720721pub fn version() void {722    p("{s}nina  v{s}  zig 0.16  zero dependencies\n", .{ hdr(), nina_version.VERSION });723}724725// --- Search (text output before TUI) ---726727pub fn searchResult(pkg: types.NixPackage) void {728    p("   {s}{s}{s}   {s}{s}{s}   {s}\n", .{ c(PINK), pkg.pname, c(RESET), c(DIM), pkg.version, c(RESET), pkg.description });729}730731pub fn searchHeader(query: []const u8, count: usize) void {732    p("{s}search nixpkgs {s}  {s}{d} results{s}\n\n", .{ hdr(), query, c(DIM), count, c(RESET) });733}734735// --- Gen commands ---736737pub fn genCurrent(n: u32) void {738    p("{d}\n", .{n});739}740741pub fn done() void {742    p("{s}done\n", .{hdr()});743}744745pub fn runStart(pkg: []const u8) void {746    p("{s}running {s}{s}{s}\n", .{ hdr(), c(PINK), pkg, c(RESET) });747}748749pub fn buildStart(attr: []const u8) void {750    p("{s}building {s}\n", .{ hdr(), attr });751}752753pub fn buildDone() void {754    p("{s}done\n", .{hdr()});755}756757// --- Self-update (nina update) ---758759pub fn updateSelfStart() void {760    p("{s}{s}checking for updates\n", .{ KAO_READY, hdr() });761}762763pub fn updateSelfCurrent(ver: []const u8) void {764    p("{s}{s}nina {s} is up to date{s}\n", .{ hdr(), c(GREEN), ver, c(RESET) });765}766767pub fn updateSelfAvailable(current: []const u8, latest: []const u8) void {768    p("{s}update available\n", .{hdr()});769    p("{s}current  {s}{s}{s}\n", .{ step(), c(DIM), current, c(RESET) });770    p("{s}latest   {s}{s}{s}{s}\n", .{ step(), c(BOLD), c(GREEN), latest, c(RESET) });771}772773fn releaseNotesHeading(line: []const u8) []const u8 {774    var i: usize = 0;775    while (i < line.len and line[i] == '#') : (i += 1) {}776    return std.mem.trim(u8, line[i..], " \t");777}778779fn releaseNotesBullet(line: []const u8) ?[]const u8 {780    if (line.len < 2) return null;781    const marker = line[0];782    if ((marker == '-' or marker == '*' or marker == '+') and line[1] == ' ') return line[2..];783    if (std.ascii.isDigit(marker)) {784        var i: usize = 1;785        while (i < line.len and std.ascii.isDigit(line[i])) : (i += 1) {}786        if (i + 1 < line.len and line[i] == '.' and line[i + 1] == ' ') return line[i + 2 ..];787    }788    return null;789}790791pub fn updateSelfReleaseNotes(notes: []const u8) void {792    const trimmed = std.mem.trim(u8, notes, " \t\r\n");793    if (trimmed.len == 0) return;794795    p("{s}changelog\n", .{hdr()});796    var lines = std.mem.splitScalar(u8, trimmed, '\n');797    while (lines.next()) |raw_line| {798        const line = if (raw_line.len > 0 and raw_line[raw_line.len - 1] == '\r') raw_line[0 .. raw_line.len - 1] else raw_line;799        const text = std.mem.trim(u8, line, " \t");800        if (text.len == 0) {801            p("\n", .{});802            continue;803        }804        if (text[0] == '#') {805            const title = releaseNotesHeading(text);806            if (title.len == 0) continue;807            p("   {s}{s}{s}{s}\n", .{ c(BOLD), c(CYAN), title, c(RESET) });808            continue;809        }810        if (releaseNotesBullet(text)) |item| {811            p("   {s}- {s}{s}\n", .{ c(CYAN), item, c(RESET) });812            continue;813        }814        p("   {s}\n", .{text});815    }816}817818pub fn updateSelfDownloading(ver: []const u8, platform: []const u8) void {819    p("{s}downloading nina {s} for {s}\n", .{ step(), ver, platform });820}821822pub fn updateSelfVerifying() void {823    p("{s}verifying checksum\n", .{step()});824}825826pub fn updateSelfInstalling(install_path: []const u8) void {827    p("{s}installing to {s}\n", .{ step(), install_path });828}829830pub fn updateSelfDone(old_ver: []const u8, new_ver: []const u8) void {831    p("{s}updated  {s} {s}→{s} {s}\n", .{ hdr(), old_ver, c(DIM), c(RESET), new_ver });832}833834pub fn updateSelfNoPlatform(platform: []const u8) void {835    p("{s}no pre-built binary for {s}\n", .{ hdr(), platform });836    p("{s}check kepr.uk/nina/releases for available platforms\n", .{step()});837}838839pub fn updateSelfNetworkError() void {840    p("{s}{s}\n", .{ if (color_enabled) WARN_C else WARN_P, "could not reach kepr.uk — check your connection" });841}842843pub fn updateSelfChecksumFailed() void {844    p("{s}checksum mismatch — download may be corrupt\n", .{if (color_enabled) ERR_C else ERR_P});845    p("{s}try again or download manually from kepr.uk/nina/releases\n", .{step()});846}847848pub fn updateSelfNixManaged(new_ver: []const u8) void {849    p("{s}upgrading to {s}{s}{s} via nix profile\n", .{ step(), c(BOLD), new_ver, c(RESET) });850}851852pub fn updateSelfNixFailed() void {853    p("{s}nix profile upgrade failed\n", .{if (color_enabled) ERR_C else ERR_P});854    p("{s}try manually: nix profile upgrade '.*nina.*'\n", .{step()});855}856857pub fn updateSelfNotInProfile() void {858    p("{s}nina is in the nix store but not found as a profile element\n", .{hdr()});859    p("{s}reinstall via 'nix profile add' to enable self-update\n", .{step()});860}861862// --- Goodbye / uninstall ---863864pub fn goodbyeStart() void {865    p("{s}uninstalling nina\n", .{hdr()});866}867868pub fn goodbyeFile(path: []const u8) void {869    p("{s}will remove {s}\n", .{ step(), path });870}871872pub fn goodbyeNix() void {873    p("{s}will remove nina from nix profile\n", .{step()});874    p("{s}command: nix profile remove nina\n", .{step()});875}876877pub fn goodbyeDone() void {878    p("{s}goodbye! see kepr.uk/nina to reinstall\n", .{hdr()});879}880881pub fn goodbyeFailed(msg: []const u8) void {882    p("{s}{s}\n", .{ if (color_enabled) ERR_C else ERR_P, msg });883}884885// --- Setup ---886887pub fn setupCheck() void {888    p("{s}checking nix features\n", .{hdr()});889}890891pub fn setupFeatures(nix_command: bool, flakes: bool) void {892    p("{s}nix-command  {s}{s}{s}\n", .{893        step(),894        if (nix_command) c(GREEN) else "",895        if (nix_command) "enabled" else "not enabled",896        if (nix_command) c(RESET) else "",897    });898    p("{s}flakes       {s}{s}{s}\n", .{899        step(),900        if (flakes) c(GREEN) else "",901        if (flakes) "enabled" else "not enabled",902        if (flakes) c(RESET) else "",903    });904}905906pub fn setupAllSet() void {907    p("{s}all set\n", .{hdr()});908}909910// Printed once, before the first search, when the nixpkgs registry still points911// at a remote URL. Flush so it lands before `nix registry pin` and any results.912pub fn pinningRegistry() void {913    p("{s}pinning nixpkgs for fast local search...\n", .{hdr()});914    flush();915}916917// --- Plain (non-tty) search rendering ---918// Color-gated equivalents of the raw-ANSI TUI widget, for piped/scripted search.919// Using the gated header + c() keeps ANSI out of non-tty output (NO_COLOR / pipes).920921pub fn searchPlainHeader(mode_str: []const u8, query: []const u8, count: u64) void {922    p("{s}search {s} {s}  {s}{d} results{s}\n", .{ hdr(), mode_str, query, c(DIM), count, c(RESET) });923}924925pub fn searchPlainNoResults() void {926    p("   no results\n", .{});927}928929pub fn searchPlainPackage(pname: []const u8, pkg_version: []const u8, description: []const u8, unfree: bool) void {930    if (unfree) {931        p("   {s}   {s}{s}{s}   {s}unfree{s}   {s}\n", .{ pname, c(CYAN), pkg_version, c(RESET), c(YELLOW), c(RESET), description });932    } else {933        p("   {s}   {s}{s}{s}   {s}\n", .{ pname, c(CYAN), pkg_version, c(RESET), description });934    }935}936937pub fn searchPlainOption(name: []const u8, type_str: []const u8) void {938    p("   {s}   {s}{s}{s}\n", .{ name, c(DIM), type_str, c(RESET) });939}940941pub fn searchEmptyQuery() void {942    p("{s}search needs a query  {s}e.g. nina search firefox{s}\n", .{ hdr(), c(DIM), c(RESET) });943}944945pub fn setupEnabling() void {946    p("{s}enabling experimental features\n", .{hdr()});947}948949pub fn setupDone(path: []const u8) void {950    p("{s}wrote {s}\n", .{ step(), path });951    p("{s}done  open a new shell to pick up the change\n", .{hdr()});952}953954// --- NixOS setup (declarative configuration.nix) ---955956pub fn setupNixosOffer(features_line: []const u8, conf_path: []const u8) void {957    p("{s}on NixOS these go in your system config\n", .{hdr()});958    p("   nina can add this line to {s}{s}{s}:\n\n", .{ c(DIM), conf_path, c(RESET) });959    p("       {s}{s}{s}\n\n", .{ c(CYAN), features_line, c(RESET) });960}961962pub fn setupNixosWrote(conf_path: []const u8) void {963    p("{s}added the line to {s}  {s}(backup: {s}.nina-bak){s}\n", .{ step(), conf_path, c(DIM), conf_path, c(RESET) });964    p("{s}now run {s}sudo nixos-rebuild switch{s} — then nina's ready\n", .{ hdr(), c(BOLD), c(RESET) });965}966967pub fn setupNixosManual(features_line: []const u8, conf_path: []const u8) void {968    p("{s}no problem — add this line inside the {s}{{ }}{s} in {s}:\n\n", .{ hdr(), c(DIM), c(RESET), conf_path });969    p("       {s}{s}{s}\n\n", .{ c(CYAN), features_line, c(RESET) });970    p("   then run {s}sudo nixos-rebuild switch{s} — then nina's ready\n", .{ c(BOLD), c(RESET) });971}972973pub fn setupNixosNeedsRebuild(conf_path: []const u8) void {974    p("{s}already declared in {s}\n", .{ hdr(), conf_path });975    p("   just run {s}sudo nixos-rebuild switch{s} to activate it\n", .{ c(BOLD), c(RESET) });976}977978pub fn pinDone(input: []const u8, commit: []const u8) void {979    p("{s}pinned {s} -> {s}\n", .{ hdr(), input, commit });980}981982pub fn unpinDone(input: []const u8) void {983    p("{s}unpinned {s}\n", .{ hdr(), input });984}985986pub fn hashResult(hash: []const u8) void {987    p("{s}\n", .{hash});988}989990pub fn fetchResult(hash: []const u8, url: []const u8) void {991    _ = url;992    p("{s}\n", .{hash});993}994995pub fn storeRepairStart() void {996    p("{s}repairing store\n", .{hdr()});997}998999pub fn storeVerifyStart() void {1000    p("{s}verifying store\n", .{hdr()});1001}10021003pub fn storeGcDone(freed: []const u8) void {1004    p("{s}freed {s}\n", .{ hdr(), freed });1005}10061007pub fn storePath(path: []const u8) void {1008    p("{s}\n", .{path});1009}10101011pub fn pkgResult(key: []const u8, val: []const u8) void {1012    p("   {s:<16}  {s}\n", .{ key, val });1013}10141015pub fn channelDone() void {1016    p("{s}done\n", .{hdr()});1017}10181019pub fn flakeShowHeader(name: []const u8) void {1020    p("{s}{s}\n\n", .{ hdr(), name });1021}10221023pub fn flakeShowEntry(kind: []const u8, name: []const u8, desc: []const u8) void {1024    p("   {s:<12}  {s:<24}  {s}\n", .{ kind, name, desc });1025}10261027// --- Home Manager ---10281029pub fn homeNotInstalled() void {1030    p("{s}home manager not detected  {s}nothing to do{s}\n", .{ hdr(), c(DIM), c(RESET) });1031}10321033// HM is a NixOS/flake module — rebuilt by nixos-rebuild, not the standalone CLI.1034pub fn homeModuleManaged() void {1035    p("{s}home manager is managed by your system config\n", .{hdr()});1036    p("   {s}-> run {s}nina apply{s}{s} to rebuild both together{s}\n", .{ c(CYAN), c(BOLD), c(RESET), c(CYAN), c(RESET) });1037}10381039pub fn homeApplyStart(machine: []const u8) void {1040    p("{s}{s}applying home config  {s}\n", .{ KAO_COZY, hdr(), machine });1041}10421043pub fn homeApplyDone(gen: u32, elapsed_ms: u64) void {1044    const secs = @as(f64, @floatFromInt(elapsed_ms)) / 1000.0;1045    // gen 0 means the post-switch generation re-read failed — the switch itself1046    // succeeded, so report success without a misleading "generation 0".1047    if (gen == 0) {1048        if (elapsed_ms >= 1000) {1049            p("{s}done  {s}[{d:.1}s]{s}\n", .{ hdr(), c(DIM), secs, c(RESET) });1050        } else {1051            p("{s}done\n", .{hdr()});1052        }1053        return;1054    }1055    if (elapsed_ms >= 1000) {1056        p("{s}generation {s}{d}{s}  {s}[{d:.1}s]{s}\n", .{ hdr(), c(BOLD), gen, c(RESET), c(DIM), secs, c(RESET) });1057    } else {1058        p("{s}generation {s}{d}{s}\n", .{ hdr(), c(BOLD), gen, c(RESET) });1059    }1060}10611062// `home` was invoked against a remote machine. Detection + flake-ref are1063// local-only, so we don't act on a remote — point the user at the local run.1064pub fn homeLocalOnly(machine: []const u8) void {1065    p("{s}home manager commands run on the local machine only\n", .{hdr()});1066    p("   {s}-> '{s}' is remote; run nina home on that machine directly{s}\n", .{ c(DIM), machine, c(RESET) });1067}10681069pub fn homeApplyDry(machine: []const u8) void {1070    p("{s}home dry run  {s}\n", .{ hdr(), machine });1071}10721073pub fn homeApplyDryDone() void {1074    p("{s}{s}ok{s}  no changes applied\n", .{ hdr(), c(GREEN), c(RESET) });1075}10761077pub fn homeBackStart(machine: []const u8, from: u32, to: u32) void {1078    p("{s}rolling back home config  {s}  gen {d} -> gen {d}\n", .{ hdr(), machine, from, to });1079}10801081pub fn homeBackDone(n: u32) void {1082    p("{s}{s}done  gen {s}{d}{s}\n", .{ KAO_GENTLE, hdr(), c(BOLD), n, c(RESET) });1083}10841085pub fn homeHistoryHeader(machine: []const u8) void {1086    p("{s}home generations  {s}\n\n", .{ hdr(), machine });1087}10881089pub fn homeHistoryRow(number: u32, date: []const u8, time: []const u8, current: bool) void {1090    if (current) {1091        p("   {s}{d}{s}   {s}   {s}   {s}current{s}\n", .{ c(BOLD), number, c(RESET), date, time, c(BOLD), c(RESET) });1092    } else {1093        p("   {s}{d}   {s}   {s}{s}\n", .{ c(DIM), number, date, time, c(RESET) });1094    }1095}10961097pub fn homeEditOpen(path: []const u8, editor: []const u8) void {1098    p("{s}opening {s}\n", .{ hdr(), path });1099    printSubstep("{s}", .{editor});1100}11011102pub fn homeCheckStart(machine: []const u8) void {1103    p("{s}checking home config  {s}\n", .{ hdr(), machine });1104}11051106pub fn homeCheckOk() void {1107    p("{s}{s}ok{s}\n", .{ hdr(), c(GREEN), c(RESET) });1108}11091110pub fn homeDiffHeader(a: u32, b: u32, machine: []const u8) void {1111    p("{s}home gen {d} -> gen {d}  {s}\n\n", .{ hdr(), a, b, machine });1112}11131114pub fn homeNothingToDiff() void {1115    p("{s}only one home generation — nothing to diff yet\n", .{hdr()});1116}11171118pub fn homePackagesHeader(machine: []const u8) void {1119    p("{s}home packages  {s}\n\n", .{ hdr(), machine });1120}11211122// --- First-run wizard ---11231124pub fn firstRunBanner() void {1125    p("{s}{s}nina \u{2014} first run\n\n", .{ KAO_FACE, hdr() });1126}11271128pub fn firstRunNoConfig() void {1129    p("   no config found. let me get set up.\n\n", .{});1130}11311132// Print a prompt line and read the user's answer. Returns the default if the1133// user presses Enter without typing anything. buf must be at least 256 bytes.1134// Returns a slice into buf (or default if empty input).1135pub fn firstRunPrompt(label: []const u8, default: []const u8, buf: []u8) []const u8 {1136    p("   {s:<14} {s}> {s}", .{ label, c(DIM), c(RESET) });1137    flush();1138    var i: usize = 0;1139    while (i < buf.len - 1) {1140        const n = std.posix.read(std.posix.STDIN_FILENO, buf[i .. i + 1]) catch break;1141        if (n == 0) break;1142        if (buf[i] == '\n') break;1143        i += 1;1144    }1145    const input = std.mem.trim(u8, buf[0..i], " \t\r");1146    if (input.len == 0) {1147        // Echo the default so the output shows what was chosen1148        p("{s}{s}{s}\n", .{ c(DIM), default, c(RESET) });1149        flush();1150        return default;1151    }1152    return input;1153}11541155pub fn firstRunScanning() void {1156    p("\n   {s}:: scanning for config...{s}\n", .{ c(DIM), c(RESET) });1157}11581159// Report what the scan found at /etc/nixos, noting flake vs channel.1160pub fn firstRunDetected(path: []const u8, is_flake: bool) void {1161    const kind = if (is_flake) "flake-based system" else "channel-based system";1162    p("   {s}-> found {s}{s}   {s}({s}){s}\n\n", .{ c(CYAN), path, c(RESET), c(DIM), kind, c(RESET) });1163}11641165pub fn firstRunNoneFound() void {1166    p("   {s}-> nothing found at /etc/nixos{s}\n\n", .{ c(DIM), c(RESET) });1167}11681169// Prompt with a pre-filled default shown in brackets. Empty input accepts the1170// default. When `detected` and a default is present, note that enter confirms.1171pub fn firstRunPromptDefault(label: []const u8, default: []const u8, detected: bool, buf: []u8) []const u8 {1172    if (default.len > 0) {1173        p("   {s:<14} {s}[{s}]{s} > ", .{ label, c(DIM), default, c(RESET) });1174        if (detected) p("{s}enter to confirm{s} ", .{ c(DIM), c(RESET) });1175    } else {1176        p("   {s:<14} {s}> {s}", .{ label, c(DIM), c(RESET) });1177    }1178    flush();1179    var i: usize = 0;1180    while (i < buf.len - 1) {1181        const n = std.posix.read(std.posix.STDIN_FILENO, buf[i .. i + 1]) catch break;1182        if (n == 0) break;1183        if (buf[i] == '\n') break;1184        i += 1;1185    }1186    const input = std.mem.trim(u8, buf[0..i], " \t\r");1187    if (input.len == 0) {1188        p("{s}{s}{s}\n", .{ c(DIM), default, c(RESET) });1189        flush();1190        return default;1191    }1192    return input;1193}11941195// Shown before channel operations on a flake-managed system, where nix-channel1196// commands generally don't apply.1197pub fn flakeChannelNote() void {1198    p("{s}{s}note: flake-based system — use {s}nina flake update{s}{s} to update inputs{s}\n", .{ hdr(), c(DIM), c(CYAN), c(RESET), c(DIM), c(RESET) });1199}12001201pub fn firstRunWritten(path: []const u8) void {1202    p("\n   {s}written to {s}{s}\n\n", .{ c(DIM), path, c(RESET) });1203}12041205pub fn firstRunSkipped() void {1206    p("\n   {s}skipping setup in non-interactive mode{s}\n", .{ c(DIM), c(RESET) });1207}