/** * `/team` — the lead's round, printed. * * The Team tab is the same round with a mouse; a lead reading a TUI should not have to * open a browser to see what needs a decision, so the command prints the rollup the * tool returns, the work a dead owner left behind, and one line saying who is live. It * reads the cards and the bus's records and writes nothing: acting on the round is * `team`'s tool (`assign`, `reclaim`) or `board`'s. */ import type { ExtensionAPI, ExtensionCommandContext } from "@earendil-works/pi-coding-agent"; import { type Card, cardRef } from "../../lib/board/card.ts"; import { buildRound } from "../../lib/board/round.ts"; import { formatRound, plural } from "../../lib/board/round-text.ts"; import type { BoardSession } from "../../lib/board/session.ts"; import { createTeamJoin, type JoinResult, type TeamJoin } from "../../lib/session-tool.ts"; import { readRoster, type RosterSession, rosterStateOf } from "../../lib/session-roster.ts"; import { formatJoined, formatNotJoined } from "./format.ts"; /** The command's name, which is also the word a user types. */ export const TEAM_COMMAND = "team"; /** The words the command accepts besides the round itself. */ export const TEAM_WORDS = ["join"] as const; /** How many lines a round may print before it says how many it left out. */ export const MAX_ROUND_LINES = 10; export function registerCommands(pi: ExtensionAPI, session: BoardSession, deps: { team?: TeamJoin } = {}): void { const team = deps.team ?? createTeamJoin(pi); pi.registerCommand(TEAM_COMMAND, { description: "The lead's round: who holds what, and what needs a decision; `/team join [