UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

65 lines (64 loc) • 3.11 kB
import { r as defaultRuntime } from "../runtime-B-SLYP-m.mjs"; import { t as enableConsoleCapture } from "../console-BkI11Tqj.mjs"; import { Jn as string, Lt as boolean, Nt as array, Pn as number, qn as strictObject, xn as literal } from "../schemas-Cy6abvsu.mjs"; import { a as resolveUpdateRehearsalRoot } from "../update-rehearsal-paths-Dr1MbUA_.mjs"; import { a as withCliCommandCleanup, o as withCliProcessScope } from "../runtime-cleanup-scope-DuOL68nJ.mjs"; import { a as withConsoleLogsRoutedToStderrForJson } from "../json-output-mode-DSme4Xvd.mjs"; import { r as runCliDisposer, t as closeCliResources } from "../runtime-cleanup-BKu6ZJ6-.mjs"; import { i as runCliWithExitFinalization } from "../one-shot-exit-DkbGSQD5.mjs"; import { t as readByteStreamWithLimit } from "../read-byte-stream-with-limit-BjmaH2Xs.mjs"; import { t as scrubDoctorErrorMessage } from "../doctor-error-message-BWgd1c6H.mjs"; //#region src/commands/doctor-lint-options.ts const DoctorLintCliOptionsSchema = strictObject({ json: boolean().optional(), severityMin: string().optional(), skipIds: array(string()).readonly().optional(), onlyIds: array(string()).readonly().optional(), allowExec: boolean().optional(), deep: boolean().optional(), includeAllChecks: boolean().optional(), updateReadiness: literal("post-plugin").optional() }); /** Private CLI→worker stdin handoff: the later worker shares the CLI's validation-command budget anchor. */ const DoctorLintWorkerInputSchema = strictObject({ options: DoctorLintCliOptionsSchema, commandStartedAtMs: number().int().optional() }); //#endregion //#region src/commands/doctor-lint.worker.ts async function runDoctorLintWorker() { if (!resolveUpdateRehearsalRoot(process.env)) throw new Error("Doctor lint worker requires an isolated update rehearsal."); const e = await readByteStreamWithLimit(process.stdin, { maxBytes: 1048576, onOverflow: () => /* @__PURE__ */ new Error("Doctor lint worker input exceeded its limit.") }); const { options: t, commandStartedAtMs: n } = DoctorLintWorkerInputSchema.parse(JSON.parse(e.toString("utf8"))); if (t.json !== true) throw new Error("Doctor lint worker requires JSON output."); enableConsoleCapture(); await withCliProcessScope(() => withCliCommandCleanup(false, async (e) => { let r; try { const { preparePostgresPoolForUpdate: e } = await import("../pool-BXFHpO5Y.mjs"); await e("openclaw doctor --fix"); const { runDoctorLintCliInProcess: i } = await import("../doctor-lint-runner-DwesKvJu.mjs"); r = await i(defaultRuntime, t, { commandStartedAtMs: n }); } finally { await closeCliResources(e); const t = e?.pluginResources; if (t) await runCliDisposer("plugin-registration-resources", () => t.release()); } process.exitCode = r; })); } withConsoleLogsRoutedToStderrForJson(process.argv, () => runCliWithExitFinalization({ run: runDoctorLintWorker, onError: (e) => { process.stderr.write(`Doctor lint worker failed: ${scrubDoctorErrorMessage(e)}\n`); process.exitCode = 2; } }), { machineOutput: true, retainRoutingUntilProcessExit: true }); //#endregion export {};