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): clear progress rows without counting ANSI bytes

Rudy Celekli9d36584d0b79
diff --git a/tests/progress-line-clear.test.mjs b/tests/progress-line-clear.test.mjs
new file mode 100644
index 0000000000..82699a1101
--- /dev/null
+++ b/tests/progress-line-clear.test.mjs
@@ -0,0 +1,9 @@
+import test from 'node:test';
+import assert from 'node:assert/strict';
+import { OutputFormatter } from '../v3/@claude-flow/cli-core/src/output.ts';
+test('colored progress clears the terminal row without padding by ANSI byte length', () => {
+ const f = new OutputFormatter({ color: true }); f.supportsInteractiveOutput = () => true; const p = f.createProgress({ total: 2, width: 8, showETA: false });
+ const original = process.stdout.write; const writes = []; process.stdout.write = function(value) { writes.push(value); return true; };
+ try { p.update(1); p.update(2); } finally { process.stdout.write = original; }
+ assert.equal(writes[1], '\r\x1b[2K'); assert.equal(writes.length, 3);
+});
diff --git a/v3/@claude-flow/cli-core/src/output.ts b/v3/@claude-flow/cli-core/src/output.ts
index d9a0e4fbac..a0ddbcb749 100644
--- a/v3/@claude-flow/cli-core/src/output.ts
+++ b/v3/@claude-flow/cli-core/src/output.ts
@@ -547,7 +547,7 @@ export class Progress {
// Clear previous line and write new
if (this.lastRender) {
- process.stdout.write('\r' + ' '.repeat(this.lastRender.length) + '\r');
+ process.stdout.write('\r\x1b[2K');
}
process.stdout.write(output);