/** * Shared CLI command builder utility for AIReady tool commands. * Provides a generic `defineToolCommand` function to reduce boilerplate * across individual tool command definitions. */ import chalk from 'chalk'; import { Command } from 'commander'; import { printTerminalHeader, type ToolScoringOutput } from '@aiready/core'; import { type BaseCommandOptions, type ToolActionConfig, } from '../scan-helpers'; import { renderSubSection, renderToolScoreFooter, renderToolHeader, renderSafetyRating, } from '../../utils/terminal-renderers'; export type { BaseCommandOptions, ToolActionConfig, ToolScoringOutput }; /** * Common CLI options shared by all tool commands */ export interface CommonToolOptions extends BaseCommandOptions { /** File patterns to include (comma-separated) */ include?: string; /** File patterns to exclude (comma-separated) */ exclude?: string; /** Output format: console, json */ output?: string; /** Output file path (for json) */ outputFile?: string; /** Calculate and display AI Readiness Score (0-100) */ score?: boolean; } /** * Configuration for defining a tool command */ export interface ToolCommandConfig< TOptions extends CommonToolOptions = CommonToolOptions, > { /** Command name (e.g., 'context', 'patterns') */ name: string; /** Command description */ description: string; /** Tool name for internal use (e.g., 'context-analyzer', 'pattern-detect') */ toolName: string; /** Display label (e.g., 'Context analysis') */ label: string; /** Emoji for display (e.g., '🧩') */ emoji: string; /** Additional command-specific options to register */ options?: CommandOption[]; /** Help text to append after built-in help */ helpText?: string; /** Tool action configuration for executeToolAction */ actionConfig: Omit< ToolActionConfig, 'toolName' | 'label' | 'emoji' >; /** Custom action handler (optional, overrides default actionConfig-based handler) */ customAction?: (directory: string, options: TOptions) => Promise; } /** * Command option definition */ export interface CommandOption { /** Option flags (e.g., '--max-depth ') */ flags: string; /** Option description */ description: string; /** Default value */ defaultValue?: string; } /** * Generic function to define a tool command on a commander program. * Reduces boilerplate by handling common options and action setup. * * @param program - Commander program instance * @param config - Tool command configuration */ export declare function defineToolCommand< TOptions extends CommonToolOptions = CommonToolOptions, >(program: Command, config: ToolCommandConfig): void; export { renderSubSection, renderToolScoreFooter, renderToolHeader, renderSafetyRating, printTerminalHeader, chalk, }; //# sourceMappingURL=command-builder.d.ts.map