/** * `/team` — the command: the round's words, and the two doors onto the team. * * Two jobs, and each is a word a person types. `join` and `exit` are the membership doors, which * write — a bus request, the project's `team.teammates`, and an event the footer re-reads — and the * bare command and `who` print the round `round.ts` renders, reading the cards and the bus's records * and writing nothing. * * The doors stay in this module because the entry's registration budget counts the modules it * loads, and a door of its own would cost a start for one command's words. The round left it * because it is the half that has nothing to do with a door: the handler reaches it with an * `import()` that no turn but `/team`'s pays for. */ import type { ExtensionAPI, ExtensionCommandContext } from "@earendil-works/pi-coding-agent"; import { addTeammate, type AddTeammateResult } from "../../lib/workflow/config.ts"; import { cardRef, holds } from "../../lib/workflow/card.ts"; import { LEAD_ROUND } from "../../lib/workflow/round-text.ts"; import type { BoardSession } from "../../lib/workflow/session.ts"; import { createTeamJoin, createTeamLeave, type JoinResult, type TeamJoin, type TeamJoinInput, type TeamLeave, } from "../../lib/session-tool.ts"; import { isTeammate, labelKey, sessionNameOf } from "../../lib/session-label.ts"; import { formatJoined, formatLeft, formatNotJoined, formatNotLeft, formatStillOn, joinNote, type LeaveBlocker, } 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. * * `who` and `join` take a label, so the completer continues past either word; `help` prints * {@link TEAM_USAGE} instead of reading the board. */ export const TEAM_WORDS = ["who", "join", "exit", "help"] as const; /** The words that take a label, so a completion continues into one and the usage says so. */ const LABEL_WORDS = new Set(["who", "join"]); /** * What the command does, in the words a reader needs after a typo. * * One block, printed by `help` and after an unknown word: the warning used to be a sentence of its * own, and a sentence that named both other words drifted from the description above it. */ export const TEAM_USAGE = [ "team: the lead's round over the board's cards.", " /team the round: who holds what, and what needs a decision", " /team who [