import type { Blueprint } from '@seamapi/blueprint'; export interface CommandFlag { /** Long form without the leading `--`, or `null` for short-only flags. */ long: string | null; /** Short form without the leading `-`, or `null` when there is none. */ short: string | null; description: string; /** Known values for the flag, used to complete and document its argument. */ values: string[]; /** Whether the flag is followed by a value. */ takesValue: boolean; isRequired: boolean; } /** * Whether a command is part of the CLI itself or calls a Seam API endpoint. */ export type CommandKind = 'cli' | 'api'; /** * A value written after the command rather than behind a flag, e.g., the URL * in `seam select endpoint `. At most one, always required: it is the * one thing the command is about. */ export interface CommandPositional { /** Name shown in the usage line, without the angle brackets. */ name: string; description: string; } export interface CommandDefinition { path: string[]; kind: CommandKind; /** One line naming what the command does. */ title: string; /** Longer prose about the command, empty when there is none to add. */ description: string; flags: CommandFlag[]; /** The value the command takes after its path, when it takes one. */ positional?: CommandPositional; } export interface Subcommand { name: string; /** 'api' when the name holds any command that calls the Seam API. */ kind: CommandKind; description: string; } export interface CommandGroup { /** Command path completed by this group, empty for `seam` itself. */ path: string[]; subcommands: Subcommand[]; } export interface CommandSpec { /** Every invocable command, sorted by command path. */ commands: CommandDefinition[]; /** Every incomplete command path, sorted by command path. */ groups: CommandGroup[]; /** Flags accepted regardless of the command. */ globalFlags: CommandFlag[]; } export declare const globalFlags: CommandFlag[]; export declare const flagTokens: (flag: CommandFlag) => string[]; /** * Derive the command spec from the API schema, merged with the commands * the CLI declares itself (see `commands/registry.ts`, the single source of * those declarations). */ export declare const getCommandSpec: (blueprint: Blueprint, localCommands?: CommandDefinition[]) => CommandSpec; export declare const findCommand: (spec: CommandSpec, path: string[]) => CommandDefinition | undefined; export declare const findGroup: (spec: CommandSpec, path: string[]) => CommandGroup | undefined; export declare const isSamePath: (a: string[], b: string[]) => boolean; export declare const stringFlag: (long: string, description: string) => CommandFlag;