mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-23 21:59:14 +09:00
🚀 Generated with [Claude Code](https://claude.com/claude-code) 📊 V3 Development Progress Checkpoint Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
@claude-flow/cli
Modern CLI module for Claude Flow V3 - command parsing, interactive prompts, and beautiful output formatting.
Features
- Advanced Argument Parsing - Full support for flags, options, subcommands, and positional arguments
- Interactive Prompts - Rich interactive mode with confirmations, selections, and input validation
- Beautiful Output - Colored output, tables, progress bars, and multiple format options (text, JSON, table)
- Type-Safe - Full TypeScript support with comprehensive type definitions
- Global Options - Built-in support for
--help,--version,--verbose,--quiet, and more - Auto-Completion - Shell completion support for commands and options
- Migration Tools - Built-in V2 to V3 migration commands
Installation
npm install @claude-flow/cli
Quick Start
import { CommandParser, Output, prompt } from '@claude-flow/cli';
// Create a parser instance
const parser = new CommandParser();
// Register a command
parser.registerCommand({
name: 'swarm',
description: 'Manage swarm operations',
options: [
{
name: 'topology',
short: 't',
description: 'Swarm topology type',
type: 'string',
choices: ['mesh', 'hierarchical', 'ring'],
default: 'mesh'
}
],
subcommands: [
{ name: 'init', description: 'Initialize a new swarm' },
{ name: 'status', description: 'Show swarm status' }
]
});
// Parse arguments
const result = parser.parse(process.argv.slice(2));
// Output formatting
const output = new Output();
output.success('Swarm initialized successfully!');
output.table([
{ agent: 'queen', status: 'running' },
{ agent: 'worker-1', status: 'idle' }
]);
API Reference
CommandParser
const parser = new CommandParser(options?: ParserOptions);
// Register commands
parser.registerCommand(command: Command);
// Parse arguments
const result = parser.parse(args: string[]): ParseResult;
// Validate flags
const errors = parser.validateFlags(flags: ParsedFlags, command?: Command): string[];
// Get all registered commands
const commands = parser.getAllCommands(): Command[];
Output Formatting
import { Output } from '@claude-flow/cli';
const output = new Output({ color: true, format: 'text' });
// Message types
output.success('Operation completed');
output.error('Something went wrong');
output.warning('Proceed with caution');
output.info('FYI: This is informational');
output.debug('Debug details');
// Structured output
output.table(data, columns);
output.json(object);
output.list(items);
// Progress indication
output.spinner('Loading...');
output.progress(current, total);
Interactive Prompts
import { prompt } from '@claude-flow/cli';
// Text input
const name = await prompt.text('Enter your name:');
// Selection
const choice = await prompt.select('Choose option:', ['A', 'B', 'C']);
// Confirmation
const confirmed = await prompt.confirm('Continue?');
// Password (hidden input)
const password = await prompt.password('Enter password:');
// Multi-select
const selections = await prompt.multiSelect('Select features:', features);
Global Options
All commands support these global options:
| Option | Short | Description |
|---|---|---|
--help |
-h |
Show help information |
--version |
-V |
Show version number |
--verbose |
-v |
Enable verbose output |
--quiet |
-q |
Suppress non-essential output |
--config |
-c |
Path to configuration file |
--format |
-f |
Output format (text, json, table) |
--no-color |
- | Disable colored output |
--interactive |
-i |
Enable interactive mode |
Built-in Commands
# Migration from V2 to V3
claude-flow migrate --from v2 --dry-run
# Help and version
claude-flow --help
claude-flow --version
# Verbose output
claude-flow swarm status --verbose
TypeScript Types
import type {
Command,
CommandOption,
ParseResult,
ParsedFlags,
CommandContext,
V3Config
} from '@claude-flow/cli';
Related Packages
- @claude-flow/shared - Shared types and utilities
- @claude-flow/swarm - Swarm coordination module
License
MIT