feat(doctor): add UI protocol freshness check

This commit is contained in:
meaningfool
2026-01-12 17:41:03 +01:00
committed by Peter Steinberger
parent 93ae3b8405
commit bfdbaa5ab6
2 changed files with 105 additions and 22 deletions

View File

@@ -66,6 +66,7 @@ import {
maybeMigrateLegacyConfigFile,
normalizeLegacyConfigValues,
} from "./doctor-legacy-config.js";
import { maybeRepairUiProtocolFreshness } from "./doctor-ui.js";
import { createDoctorPrompter, type DoctorOptions } from "./doctor-prompter.js";
import {
maybeRepairSandboxImages,
@@ -271,9 +272,9 @@ export async function doctorCommand(
options.nonInteractive === true
? true
: await prompter.confirm({
message: "Migrate legacy config entries now?",
initialValue: true,
});
message: "Migrate legacy config entries now?",
initialValue: true,
});
if (migrate) {
// Legacy migration (2026-01-02, commit: 16420e5b) — normalize per-provider allowlists; move WhatsApp gating into whatsapp.allowFrom.
const { config: migrated, changes } = migrateLegacyConfig(
@@ -326,9 +327,9 @@ export async function doctorCommand(
: options.nonInteractive === true
? false
: await prompter.confirmRepair({
message: "Generate and configure a gateway token now?",
initialValue: true,
});
message: "Generate and configure a gateway token now?",
initialValue: true,
});
if (shouldSetToken) {
const nextToken = randomToken();
cfg = {
@@ -354,9 +355,9 @@ export async function doctorCommand(
options.nonInteractive === true
? true
: await prompter.confirm({
message: "Migrate legacy state (sessions/agent/WhatsApp auth) now?",
initialValue: true,
});
message: "Migrate legacy state (sessions/agent/WhatsApp auth) now?",
initialValue: true,
});
if (migrate) {
const migrated = await runLegacyStateMigrations({
detected: legacyState,
@@ -478,13 +479,11 @@ export async function doctorCommand(
note(
[
`Eligible: ${skillsReport.skills.filter((s) => s.eligible).length}`,
`Missing requirements: ${
skillsReport.skills.filter(
(s) => !s.eligible && !s.disabled && !s.blockedByAllowlist,
).length
`Missing requirements: ${skillsReport.skills.filter(
(s) => !s.eligible && !s.disabled && !s.blockedByAllowlist,
).length
}`,
`Blocked by allowlist: ${
skillsReport.skills.filter((s) => s.blockedByAllowlist).length
`Blocked by allowlist: ${skillsReport.skills.filter((s) => s.blockedByAllowlist).length
}`,
].join("\n"),
"Skills status",
@@ -494,10 +493,10 @@ export async function doctorCommand(
config: cfg,
workspaceDir,
logger: {
info: () => {},
warn: () => {},
error: () => {},
debug: () => {},
info: () => { },
warn: () => { },
error: () => { },
debug: () => { },
},
});
if (pluginRegistry.plugins.length > 0) {
@@ -513,9 +512,9 @@ export async function doctorCommand(
`Errors: ${errored.length}`,
errored.length > 0
? `- ${errored
.slice(0, 10)
.map((p) => p.id)
.join("\n- ")}${errored.length > 10 ? "\n- ..." : ""}`
.slice(0, 10)
.map((p) => p.id)
.join("\n- ")}${errored.length > 10 ? "\n- ..." : ""}`
: null,
].filter((line): line is string => Boolean(line));