Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

fix(cli): Implement --verbose and --quiet global options

rUv25be10685da9
diff --git a/v3/@claude-flow/cli/src/index.ts b/v3/@claude-flow/cli/src/index.ts
index d72459c305..3f68ca3a7c 100644
--- a/v3/@claude-flow/cli/src/index.ts
+++ b/v3/@claude-flow/cli/src/index.ts
@@ -78,6 +78,21 @@ export class CLI {
this.output.setColorEnabled(false);
}
+ // Set verbosity level based on flags
+ if (flags.quiet) {
+ this.output.setVerbosity('quiet');
+ } else if (flags.verbose) {
+ this.output.setVerbosity(process.env.DEBUG ? 'debug' : 'verbose');
+ }
+
+ // Verbose mode: show parsed arguments
+ if (this.output.isVerbose()) {
+ this.output.printDebug(`Command: ${commandPath.join(' ') || '(none)'}`);
+ this.output.printDebug(`Positional: [${positional.join(', ')}]`);
+ this.output.printDebug(`Flags: ${JSON.stringify(Object.fromEntries(Object.entries(flags).filter(([k]) => k !== '_')))}`);
+ this.output.printDebug(`CWD: ${process.cwd()}`);
+ }
+
// No command - show help
if (commandPath.length === 0 || flags.help || flags.h) {
if (commandPath.length > 0) {
@@ -176,8 +191,17 @@ export class CLI {
// Execute command
if (targetCommand.action) {
+ if (this.output.isVerbose()) {
+ this.output.printDebug(`Executing: ${targetCommand.name}`);
+ }
+
+ const startTime = Date.now();
const result = await targetCommand.action(ctx);
+ if (this.output.isVerbose()) {
+ this.output.printDebug(`Completed in ${Date.now() - startTime}ms`);
+ }
+
if (result && !result.success) {
process.exit(result.exitCode || 1);
}
@@ -379,7 +403,7 @@ export * from './types.js';
export { CommandParser, commandParser } from './parser.js';
// Output
-export { OutputFormatter, output, Progress, Spinner } from './output.js';
+export { OutputFormatter, output, Progress, Spinner, type VerbosityLevel } from './output.js';
// Prompt
export * from './prompt.js';
diff --git a/v3/@claude-flow/cli/src/output.ts b/v3/@claude-flow/cli/src/output.ts
index eda3f458e5..c129af6942 100644
--- a/v3/@claude-flow/cli/src/output.ts
+++ b/v3/@claude-flow/cli/src/output.ts
@@ -50,15 +50,46 @@ const COLORS = {
type ColorName = keyof typeof COLORS;
+export type VerbosityLevel = 'quiet' | 'normal' | 'verbose' | 'debug';
+
export class OutputFormatter {
private colorEnabled: boolean;
private outputStream: NodeJS.WriteStream;
private errorStream: NodeJS.WriteStream;
+ private verbosity: VerbosityLevel;
- constructor(options: { color?: boolean } = {}) {
+ constructor(options: { color?: boolean; verbosity?: VerbosityLevel } = {}) {
this.colorEnabled = options.color ?? this.supportsColor();
this.outputStream = process.stdout;
this.errorStream = process.stderr;
+ this.verbosity = options.verbosity ?? 'normal';
+ }
+
+ /**
+ * Set verbosity level
+ * - quiet: Only errors and direct results
+ * - normal: Errors, warnings, info, and results
+ * - verbose: All of normal + debug messages
+ * - debug: All output including trace
+ */
+ setVerbosity(level: VerbosityLevel): void {
+ this.verbosity = level;
+ }
+
+ getVerbosity(): VerbosityLevel {
+ return this.verbosity;
+ }
+
+ isQuiet(): boolean {
+ return this.verbosity === 'quiet';
+ }
+
+ isVerbose(): boolean {
+ return this.verbosity === 'verbose' || this.verbosity === 'debug';
+ }
+
+ isDebug(): boolean {
+ return this.verbosity === 'debug';
}
private supportsColor(): boolean {
@@ -136,11 +167,13 @@ export class OutputFormatter {
// ============================================
printSuccess(message: string): void {
+ // Success always shows (result output)
const icon = this.color('[OK]', 'green', 'bold');
this.writeln(`${icon} ${message}`);
}
printError(message: string, details?: string): void {
+ // Errors always show
const icon = this.color('[ERROR]', 'red', 'bold');
this.writeErrorln(`${icon} ${message}`);
if (details) {
@@ -149,20 +182,33 @@ export class OutputFormatter {
}
printWarning(message: string): void {
+ // Warnings suppressed in quiet mode
+ if (this.verbosity === 'quiet') return;
const icon = this.color('[WARN]', 'yellow', 'bold');
this.writeln(`${icon} ${message}`);
}
printInfo(message: string): void {
+ // Info suppressed in quiet mode
+ if (this.verbosity === 'quiet') return;
const icon = this.color('[INFO]', 'blue', 'bold');
this.writeln(`${icon} ${message}`);
}
printDebug(message: string): void {
+ // Debug only shows in verbose/debug mode
+ if (this.verbosity !== 'verbose' && this.verbosity !== 'debug') return;
const icon = this.color('[DEBUG]', 'gray');
this.writeln(`${icon} ${this.dim(message)}`);
}
+ printTrace(message: string): void {
+ // Trace only shows in debug mode
+ if (this.verbosity !== 'debug') return;
+ const icon = this.color('[TRACE]', 'gray', 'dim');
+ this.writeln(`${icon} ${this.dim(message)}`);
+ }
+
// ============================================
// Table Formatting
// ============================================