/** * `start` — start the installed herdr-fleet.service when present, then run the dispatch loop in the background and wait for /healthz. * * Moved out of cli.ts's switch by the per-verb module split (#462); * only the case wrapper, the injected `ctx` lookups and the imports * changed from the original bodies. */ import type { CommandContext } from "./context.ts"; import { startHerdrFleet } from "../fleet.ts"; import { startDaemon } from "../lifecycle.ts"; export async function startCommand(ctx: CommandContext): Promise { const project = ctx.projectFlag; const herdr = startHerdrFleet(project); const rec = await startDaemon({ port: ctx.portFlag(), project }); process.stdout.write( `started — pid ${rec.pid}, /healthz on :${rec.port}` + `${rec.project === undefined ? "" : `, project ${rec.project}`}\n` + `herdr ${herdr.kind === "active" ? `active (${herdr.unit})${herdr.recoveryReleased ? "; recovery pin cleared" : ""}` : `unmanaged (${herdr.reason})`}\n` + `log ${rec.logFile}\n`, ); }