import type { CliLogger } from '../utils/logger.js'; import type { Telemetry } from '../utils/telemetry.js'; import type { FrameworkDetectionResult } from './framework-detection.js'; import type { PackageManagerResult } from './package-manager-detection.js'; export interface CliCommand { name: string; label: string; hint: string; description: string; action: (context: CliContext) => Promise; subcommands?: CliCommand[]; hidden?: boolean; hiddenFromMenu?: boolean; /** Arguments and examples shown by command-specific help. */ usage?: string; examples?: string[]; flags?: CliFlag[]; } export type FlagType = 'boolean' | 'string' | 'special'; export interface CliFlag { names: string[]; description: string; type: FlagType; expectsValue: boolean; defaultValue?: string | boolean; } export interface ParsedArgs { commandName: string | undefined; commandArgs: string[]; parsedFlags: Record; } export interface PackageInfo { name: string; version: string; [key: string]: unknown; } export interface ErrorHandlers { handleError: (error: unknown, message: string) => never; handleCancel: (message?: string, context?: { command?: string; stage?: string; }) => never; } export interface ConfigManagement { loadConfig: () => Promise; requireConfig: () => Promise; getPathAliases: (configPath?: string) => Record | null; } export interface FileSystemUtils { getPackageInfo: () => PackageInfo; } export interface CliContext { logger: CliLogger; flags: ParsedArgs['parsedFlags']; commandName: string | undefined; commandArgs: string[]; cwd: string; error: ErrorHandlers; config: ConfigManagement; fs: FileSystemUtils; telemetry: Telemetry; confirm: (message: string, initialValue?: boolean) => Promise; projectRoot: string; framework: FrameworkDetectionResult; packageManager: PackageManagerResult; }