Files
ruflo/v3/@claude-flow/cli
rUvandClaude Sonnet 4 3d4813240d checkpoint: File edit:
🚀 Generated with [Claude Code](https://claude.com/claude-code)
📊 V3 Development Progress Checkpoint

Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
2026-01-05 19:40:01 +00:00
..
2026-01-05 04:58:56 +00:00
2026-01-04 17:40:48 +00:00
2026-01-04 20:41:12 +00:00
2026-01-05 19:40:01 +00:00
2026-01-04 17:40:48 +00:00
2026-01-05 05:09:11 +00:00
2026-01-05 19:12:36 +00:00

@claude-flow/cli

npm version npm downloads License: MIT TypeScript Node.js

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';

License

MIT