/** * ls Command - List worktrees with status * Issue #518: [DR1-08] Factory pattern with createLsCommand() */ import { Command } from 'commander'; import type { WorktreeItem } from '../types/api-responses'; /** One entry of the per-CLI-tool status map the list API publishes. */ export type CliStatusEntry = NonNullable[string]; /** * One instance's Auto-Yes arming, as `GET /api/worktrees` sends it (Issue #2512). * * Mirrors: src/types/auto-yes.ts AutoYesInstanceSummary. * * A copy rather than an import: `tsconfig.cli.json` sets `"paths": {}`, so * nothing under `src/cli` can reach `@/types/auto-yes`. The copy is kept honest * by a bidirectional `AssertAssignable` in * `tests/unit/cli/commands/ls-auto-yes-2575.test.ts`, which `npx tsc --noEmit` * evaluates — the same guard #1843 uses for the suppression-reason union. * * Only ARMED instances appear in the map: the server folds expired and * turned-off states away as it reads them (`getEnabledAutoYesByWorktree`), so a * missing key means "not armed right now" and carries no reason. Why it stopped * lives in `commandmate capture --json`'s `autoYes.stopReason`. */ export type AutoYesInstanceWire = { enabled: boolean; expiresAt: number | null; }; /** * A list row with the two maps this command reads and `WorktreeItem` does not * declare (Issue #2575). * * `src/cli/types/api-responses.ts` declares only the fields the CLI reads, and * until this column nothing read either of these. Widened HERE rather than * there, on the precedent of `PeerWorktreeItem` in `peers.ts`: the shared mirror * keeps meaning what its header says, and a row from a server that predates * #2512 (no `autoYesByInstance`) or answered `?includeStatus=0` (no * `sessionStatusByInstance`) is still a valid row — hence both optional. * * `sessionStatusByInstance` is the UN-aggregated map. `sessionStatusByCli` next * to it is the logical-OR over every instance of a tool, which is the right * input for REASON (#1926) and the wrong one here: Auto-Yes is armed per * INSTANCE, so an aggregate cannot say whether it was `claude` or `claude-2` * that raised the wait. * * Exported so tests can assert against the wire shape rather than restate it. */ export interface LsWorktreeItem extends WorktreeItem { autoYesByInstance?: Record; sessionStatusByInstance?: Partial>; } /** * `MM:SS`, or `H:MM:SS` from an hour up — the Web UI countdown's format. * * A second spelling of `formatTimeRemaining` (`src/config/auto-yes-config.ts`) * on purpose, and the only duplication Issue #2575 accepts. That module imports * `@/config/tmux-pane-config`, and `tsconfig.cli.json` sets `"paths": {}`, so a * CLI module importing it compiles under lint / `tsc --noEmit` / vitest (all * three resolve `@/`) and breaks only at `npm run build:cli` — a trap worth * avoiding rather than walking into. The two are pinned to the same strings at * the boundaries by `ls-auto-yes-2575.test.ts`, so an operator reads the same * number in the browser and in the terminal. * * Takes a DURATION, not a deadline: the caller has already resolved `now` once * for the whole table, and passing the deadline here would re-read the clock per * row. Truncating means 0 < remaining < 1 s prints `00:00`, exactly as the * browser countdown does one tick before it flips to OFF. */ export declare function formatAutoYesRemaining(remainingMs: number): string; /** * Create the ls command. * [DR1-08] Factory pattern for addCommand() registration. */ export declare function createLsCommand(): Command; //# sourceMappingURL=ls.d.ts.map