import { ConfigType } from '../project/config'; /** * Output format for CLI commands. */ type OutputFormat = 'text' | 'json' | 'yaml'; /** * Global CLI options available to all commands. */ interface GlobalOptions { /** Show help information */ help?: boolean; /** Show version information */ version?: boolean; /** Enable verbose output */ verbose?: boolean; /** Output as JSON (shorthand for --format json) */ json?: boolean; /** Disable colored output */ noColor?: boolean; } /** * Command execution result. */ interface CommandResult { /** Exit code (0 for success, non-zero for errors) */ exitCode: number; /** Output message */ output?: string; /** Error message */ error?: string; } /** * CLI command interface. */ interface Command { /** Command name */ name: string; /** Command description */ description: string; /** Execute command with parsed arguments */ execute(args: string[], globalOptions: GlobalOptions): CommandResult; /** Get help text for command */ getHelp(): string; } /** * CLI configuration. */ interface CliConfig { /** CLI name */ name: string; /** CLI version */ version: string; /** Available commands */ commands: Record; } /** * Options for the analyze CLI command. */ interface AnalyzeCommandOptions { /** Target directory path to analyze */ path?: string; /** Output format (json, table, etc.) */ format?: OutputFormat; /** Analysis depth level */ depth?: 'basic' | 'full' | 'deep'; /** Glob patterns to include */ include?: string[]; /** Glob patterns to exclude */ exclude?: string[]; } /** * Execute analyze command with given options. * * @param options - Configuration for the analyze operation * @returns Command execution result with exit code and output * * @example Basic analysis of current directory * ```typescript * const result = analyzeCommand({ depth: 'basic' }) * if (result.exitCode === 0) { * console.log(result.output) * // => "Project Type: Library\nWorkspace: NX Monorepo\n..." * } * ``` * * @example JSON output with filters * ```typescript * const result = analyzeCommand({ * path: './apps/frontend', * format: 'json', * depth: 'deep', * exclude: ['node_modules', 'dist'], * }) * // => { exitCode: 0, output: '{"type":"application",...}' } * ``` */ declare function analyzeCommand(options: AnalyzeCommandOptions): CommandResult; /** * Analyze command definition implementing Command interface. */ declare const analyzeCommandDef: Command; /** * Options for the config CLI command. */ interface ConfigCommandOptions { /** Target directory path to scan for configs */ path?: string; /** Filter by specific config type */ type?: ConfigType; /** Include file contents in output */ showContents?: boolean; /** Output format (json, table, etc.) */ format?: OutputFormat; } /** * Execute config command with given options. * * @param options - Configuration command options * @returns Command execution result with exit code and output * * @example Detect all configs in a project * ```typescript * const result = configCommand({ path: './my-project' }) * if (result.exitCode === 0) { * console.log(result.output) * // => "TypeScript: tsconfig.json\nLinting: eslint.config.js\n..." * } * ``` * * @example Filter by type with contents * ```typescript * const result = configCommand({ * path: './my-project', * type: 'tsconfig', * showContents: true, * format: 'json', * }) * // => { exitCode: 0, output: '[{"type":"tsconfig","path":"tsconfig.json",...}]' } * ``` */ declare function configCommand(options: ConfigCommandOptions): CommandResult; /** * Config command definition implementing Command interface. */ declare const configCommandDef: Command; /** * Options for the deps command. */ interface DepsCommandOptions { /** Path to the package.json file */ path?: string; /** Type of dependencies to list */ type?: 'production' | 'development' | 'peer' | 'optional' | 'all'; /** Output format for the results */ format?: OutputFormat; } /** * Execute deps command with given options. * * @param options - Parsed command options * @returns Command execution result with exit code and output * * @example List all dependencies * ```typescript * const result = depsCommand({ path: './my-project' }) * if (result.exitCode === 0) { * console.log(result.output) * // => "Dependencies\n============\nProduction (3):\n react ^18.2.0\n..." * } * ``` * * @example Filter to dev dependencies as JSON * ```typescript * const result = depsCommand({ * path: './my-project', * type: 'development', * format: 'json', * }) * // => { exitCode: 0, output: '{"devDependencies":{"typescript":"^5.0.0",...}}' } * ``` */ declare function depsCommand(options: DepsCommandOptions): CommandResult; /** * Deps command definition implementing Command interface. */ declare const depsCommandDef: Command; /** * Configuration options for the tree command. */ interface TreeCommandOptions { /** Root path to display tree from */ path?: string; /** Maximum directory depth to traverse */ depth?: number; /** Glob pattern to filter entries */ pattern?: string; /** Patterns to exclude from output */ ignore?: string[]; /** Show only directories */ dirsOnly?: boolean; /** Show only files */ filesOnly?: boolean; /** Display file sizes */ showSize?: boolean; /** Display modification dates */ showModified?: boolean; /** Output format (text, json, etc.) */ format?: OutputFormat; } /** * Execute tree command with given options. * * @param options - Configuration for the tree operation * @returns Command execution result with exit code and output * * @example Basic tree of current directory * ```typescript * const result = treeCommand({ depth: 2 }) * if (result.exitCode === 0) { * console.log(result.output) * // => "src/\n├── index.ts\n├── lib/\n│ └── utils.ts\n..." * } * ``` * * @example Directories only with metadata * ```typescript * const result = treeCommand({ * path: './project', * dirsOnly: true, * showSize: true, * ignore: ['node_modules', '.git'], * format: 'json', * }) * // => { exitCode: 0, output: '[{"name":"src","isDirectory":true,...}]' } * ``` */ declare function treeCommand(options: TreeCommandOptions): CommandResult; /** * Tree command definition implementing Command interface. */ declare const treeCommandDef: Command; /** * Run CLI with given command line arguments. * * @param args - Command line arguments (typically process.argv.slice(2)) * @returns Command result with exit code and optional output/error * * @example Running analysis via CLI * ```typescript * import { run } from '@hyperfrontend/project-scope' * * // Analyze current directory * const result = run(['analyze']) * * // Analyze specific project with JSON output * const result2 = run(['analyze', './my-project', '--format', 'json']) * * // Show dependency tree * const result3 = run(['deps', '--type', 'production']) * * process.exit(result.exitCode) * ``` */ declare function run(args: string[]): CommandResult; export { analyzeCommand, analyzeCommandDef, configCommand, configCommandDef, depsCommand, depsCommandDef, run, treeCommand, treeCommandDef }; export type { AnalyzeCommandOptions, CliConfig, Command, CommandResult, ConfigCommandOptions, DepsCommandOptions, GlobalOptions, OutputFormat, TreeCommandOptions };