/** * peers Command - the other agent sessions this one can talk to (Issue #2376) * * commandmate peers [--json] * * ## Why `ls` + `instances` was not enough * * The two ids `ask` needs live in two different commands and neither one knows * the caller. `ls` lists every worktree on the machine — including the dozen * belonging to repositories this session has nothing to do with — and * `instances` needs a worktree id per call. So working out "who can I ask?" was * a fan-out plus a filter the agent had to invent, and inventing it is what * produced the wrong `--instance` values this Issue exists to stop. * * This is that fan-out, done once, narrowed to the caller's own repository, with * the caller's own row marked `(you)` and a ready-to-run `ask` line against * every other row. The listing is the answer AND the example: the acceptance * criterion for this command is that a line pasted out of it works. * * Scoped to the repository rather than to everything because that is the unit a * delegation is about — sibling worktrees of one project, which is what * `/worktree-setup` produces — and because a global listing is what `ls` * already is. */ import { Command } from 'commander'; import type { WorktreeItem } from '../types/api-responses'; import { type SessionIdentity } from './whoami'; /** * The repository fields the list API sends and `WorktreeItem` does not declare. * * `src/cli/types/api-responses.ts` declares only the fields the CLI reads ("Only * the fields the CLI reads are declared"), and until this command nothing read * these two. Mirrored locally rather than widened there so the shared type keeps * meaning what its header says it means; both are optional because a row written * before the field existed, or by a non-sync path, carries neither. */ interface PeerWorktreeItem extends WorktreeItem { repositoryPath?: string; repositoryName?: string; } /** One session in the listing. */ interface PeerRow { worktreeId: string; instanceId: string; cliTool: string; alias: string; /** The worktree's aggregate STATUS word, as `commandmate ls` prints it. */ status: string; /** True for the session running this command. */ isSelf: boolean; /** The line to paste, or null for the caller's own row. */ ask: string | null; } /** * Build the listing. * * @param worktrees - Every worktree the server knows * @param identity - Who is asking * @param binary - The command name to spell the examples with */ export declare function buildPeerRows(worktrees: PeerWorktreeItem[], identity: SessionIdentity, binary: string): PeerRow[]; export declare function createPeersCommand(): Command; export {}; //# sourceMappingURL=peers.d.ts.map