c35b8c5bbfb7

doctor: add home manager check — when HM is detected, doctor appends a 'home manager' row with note 'standalone gen <n>' (or 'module'), status ok; gated on detection so the table is unchanged on machines without home-manager; homeDoctorNote builds the caller-owned note string; build+tests green

time
2026-06-10 01:29 UTC · 4 months ago
machine
koh2
agent
claude-opus-4-8
session
flake + home manager support
parent
e0aef3b8a987
1 file src/commands.zig+27 −0
src/commands.zig+27 −0
@@ -260,7 +260,34 @@260260         if (ch.status == .warn) warnings += 1;261261         if (ch.status == .fail) failures += 1;262262     }263+264+    // Home Manager row only when present — absent on a machine without HM, so265+    // doctor's table is unchanged there.266+    const hm_mode = exec.detectHomeManager(ctx.gpa, ctx.io, ctx.environ);267+    if (hm_mode != .none) {268+        const note = homeDoctorNote(ctx, hm_mode);269+        defer ctx.gpa.free(note);270+        output.doctorRow(.{ .name = "home manager", .status = .ok, .note = note });271+    }272+263273     output.doctorSummary(warnings, failures);274+}275+276+// "standalone  gen 765" / "module" — the note shown in doctor's home manager row.277+// Caller owns the returned slice.278+fn homeDoctorNote(ctx: Ctx, mode: exec.HomeManagerMode) []const u8 {279+    const label = switch (mode) {280+        .standalone => "standalone",281+        .module => "module",282+        .none => "",283+    };284+    if (mode == .standalone) {285+        const gen = homeCurrentGen(ctx);286+        if (gen != 0)287+            return std.fmt.allocPrint(ctx.gpa, "{s}  gen {d}", .{ label, gen }) catch288+                (ctx.gpa.dupe(u8, label) catch "");289+    }290+    return ctx.gpa.dupe(u8, label) catch "";264291 }265292 266293 // nina update — kepr self-update for the nina binary itself.

view file