/** * `board` — the live keyboard-driven fleet board, or a one-shot --json snapshot of the same lanes. * * 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 { boardJson, boardSnapshotOnce, runBoard } from "../board.ts"; export async function boardCommand(ctx: CommandContext): Promise { const project = ctx.projectFlag; // Headless one-shot mode: `--json` asks for it explicitly, and a // non-interactive stdin or stdout (pipe, redirect, cron, script) cannot // host the key-driven board anyway. The TTY throw inside runBoard stays // as a backstop for direct callers. if (ctx.argv.includes("--json") || !process.stdout.isTTY || !process.stdin.isTTY) { process.stdout.write(`${boardJson(await boardSnapshotOnce(project))}\n`); return; } await runBoard(project); }