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(metaharness): consume interactive flag before script dispatch

Rudy Celeklia6817bde5f9e
diff --git a/v3/@claude-flow/cli/__tests__/metaharness-dispatcher-global-flags.test.ts b/v3/@claude-flow/cli/__tests__/metaharness-dispatcher-global-flags.test.ts
new file mode 100644
index 0000000000..3eb1a4acf8
--- /dev/null
+++ b/v3/@claude-flow/cli/__tests__/metaharness-dispatcher-global-flags.test.ts
@@ -0,0 +1,47 @@
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+import { CommandParser } from '../src/parser.js';
+
+const { spawnSync } = vi.hoisted(() => ({ spawnSync: vi.fn(() => ({ status: 0 })) }));
+vi.mock('child_process', () => ({ spawnSync }));
+vi.mock('../src/output.js', () => ({ output: {} }));
+vi.mock('../src/services/harness-flywheel-runtime.js', () => ({ runFlywheelWorker: vi.fn() }));
+vi.mock('../src/services/flywheel-transaction.js', () => ({
+ listFlywheelReceipts: vi.fn(), promoteFlywheelCandidate: vi.fn(), readFlywheelTransactionState: vi.fn(),
+ resetSequentialEvidence: vi.fn(), verifyFlywheelLedger: vi.fn(),
+}));
+vi.mock('../src/services/policy-runtime.js', () => ({ evaluatePolicyRequest: vi.fn() }));
+import { metaharnessCommand } from '../src/commands/metaharness.js';
+
+beforeEach(() => spawnSync.mockClear());
+
+async function dispatchedArgs(argv: string[]) {
+ const parser = new CommandParser({ allowUnknownFlags: true });
+ parser.registerCommand(metaharnessCommand);
+ const parsed = parser.parse(['metaharness', ...argv]);
+ const result = await metaharnessCommand.action!({
+ args: parsed.positional, flags: parsed.flags, interactive: true,
+ } as never);
+ expect(result.success).toBe(true);
+ expect(spawnSync).toHaveBeenCalledOnce();
+ return (spawnSync.mock.calls[0] as unknown as [string, string[]])[1].slice(1);
+}
+
+describe('MetaHarness dispatcher with real parser defaults', () => {
+ it.each([
+ ['score', '--path', '.', '--format', 'json'],
+ ['similarity', '--a', '/tmp/a.json', '--b', '/tmp/b.json', '--format', 'json'],
+ ['drift-from-history', '--baseline-file', '/tmp/baseline.json', '--dry-run', '--format', 'json'],
+ ])('forwards %s options without CLI-only interactive defaults', async (...argv) => {
+ expect(await dispatchedArgs(argv)).toEqual(argv.slice(1));
+ });
+
+ it('consumes an explicit interactive flag while preserving plugin arguments', async () => {
+ expect(await dispatchedArgs(['score', '--interactive', '--path', '.', '--format', 'json']))
+ .toEqual(['--path', '.', '--format', 'json']);
+ });
+
+ it('still forwards unknown plugin flags so the script can reject mistakes', async () => {
+ expect(await dispatchedArgs(['score', '--definitely-unknown', '--format', 'json']))
+ .toContain('--definitely-unknown');
+ });
+});
diff --git a/v3/@claude-flow/cli/src/commands/metaharness.ts b/v3/@claude-flow/cli/src/commands/metaharness.ts
index 44c0380889..c13f83ee2b 100644
--- a/v3/@claude-flow/cli/src/commands/metaharness.ts
+++ b/v3/@claude-flow/cli/src/commands/metaharness.ts
@@ -288,6 +288,7 @@ export const metaharnessCommand: Command = {
'verbose', 'v',
'quiet', 'q',
'help', 'h',
+ 'interactive', 'i', // CLI-only default; plugin scripts are non-interactive
]);
// Parser normalizes kebab-case → camelCase (--per-dimension → perDimension).
// Plugin scripts expect kebab-case at argv, so we re-kebab here.