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-core): honor progress output controls and empty totals

Rudy Celekli7b718959bf4f
diff --git a/tests/output-progress-controls.test.mjs b/tests/output-progress-controls.test.mjs
new file mode 100644
index 0000000000..4ac6c33e0d
--- /dev/null
+++ b/tests/output-progress-controls.test.mjs
@@ -0,0 +1,12 @@
+import test from 'node:test';
+import assert from 'node:assert/strict';
+import { OutputFormatter } from '../v3/@claude-flow/cli-core/src/output.ts';
+test('zero-item work has a finite completed progress bar', () => {
+ const f = new OutputFormatter({ color: false }); assert.equal(f.progressBar(0, 0, 4), '[####] 100.0%');
+});
+test('showPercentage false suppresses the percentage suffix', () => {
+ const f = new OutputFormatter({ color: false }); const progress = f.createProgress({ total: 2, current: 1, width: 4, showPercentage: false, showETA: false });
+ const original = process.stdout.write; let captured = ''; process.stdout.write = function(value) { captured += value; return true; };
+ try { progress.render(); } finally { process.stdout.write = original; } assert.equal(captured, '[##--]');
+});
+test('default percentage output remains unchanged', () => { assert.equal(new OutputFormatter({ color: false }).progressBar(1, 2, 4), '[##--] 50.0%'); });
diff --git a/v3/@claude-flow/cli-core/src/output.ts b/v3/@claude-flow/cli-core/src/output.ts
index 9052a53923..31b9477d31 100644
--- a/v3/@claude-flow/cli-core/src/output.ts
+++ b/v3/@claude-flow/cli-core/src/output.ts
@@ -385,15 +385,15 @@ export class OutputFormatter {
return new Progress(this, options);
}
- progressBar(current: number, total: number, width: number = 40): string {
- const percent = Math.min(100, Math.max(0, (current / total) * 100));
+ progressBar(current: number, total: number, width: number = 40, showPercentage: boolean = true): string {
+ const percent = total === 0 ? 100 : Math.min(100, Math.max(0, (current / total) * 100));
const filled = Math.round((width * percent) / 100);
const empty = width - filled;
const bar = this.color('#'.repeat(filled), 'green') +
this.dim('-'.repeat(empty));
- return `[${bar}] ${percent.toFixed(1)}%`;
+ return `[${bar}]${showPercentage ? ` ${percent.toFixed(1)}%` : ''}`;
}
// ============================================
@@ -529,7 +529,7 @@ export class Progress {
}
render(): void {
- const bar = this.formatter.progressBar(this.current, this.total, this.width);
+ const bar = this.formatter.progressBar(this.current, this.total, this.width, this.showPercentage);
let output = bar;