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(doctor): import MetaHarness modules via file URLs on Windows

Rudy Celeklic3b025a9d110
diff --git a/.github/workflows/v3-ci.yml b/.github/workflows/v3-ci.yml
index 896981f401..82b6dae95a 100644
--- a/.github/workflows/v3-ci.yml
+++ b/.github/workflows/v3-ci.yml
@@ -463,6 +463,11 @@ jobs:
working-directory: v3
run: pnpm install --frozen-lockfile
+ - name: Windows MetaHarness doctor regression (#3186)
+ if: matrix.os == 'windows-2022'
+ working-directory: v3/@claude-flow/cli
+ run: pnpm exec vitest run __tests__/doctor-metaharness-windows-3186.test.ts
+
- name: Build
working-directory: v3
run: pnpm build
diff --git a/v3/@claude-flow/cli/__tests__/doctor-metaharness-windows-3186.test.ts b/v3/@claude-flow/cli/__tests__/doctor-metaharness-windows-3186.test.ts
new file mode 100644
index 0000000000..8b72e32fd4
--- /dev/null
+++ b/v3/@claude-flow/cli/__tests__/doctor-metaharness-windows-3186.test.ts
@@ -0,0 +1,33 @@
+import { describe, expect, it } from 'vitest';
+import { pathToFileURL } from 'node:url';
+import { spawnSync } from 'node:child_process';
+import { doctorCommand } from '../src/commands/doctor.js';
+
+describe('doctor MetaHarness integration on Windows (#3186)', () => {
+ it('reproduces Node rejecting a raw Windows absolute path as an ESM specifier', async () => {
+ // Use a child Node process so Vitest cannot rewrite native import().
+ const probe = spawnSync(process.execPath, [
+ '--input-type=module', '-e',
+ 'try { await import(process.argv[1]) } catch (error) { process.stdout.write(error.code) }',
+ 'C:\\ruflo\\_similarity.mjs',
+ ], { encoding: 'utf8' });
+ expect(probe.status).toBe(0);
+ expect(probe.stdout).toBe('ERR_UNSUPPORTED_ESM_URL_SCHEME');
+ expect(pathToFileURL('C:\\ruflo\\_similarity.mjs').protocol).toBe('file:');
+ });
+
+ it('loads both plugin modules through the real doctor component', async () => {
+ const ctx = {
+ flags: { component: 'metaharness-integration' }, args: [], config: {},
+ } as unknown as Parameters<NonNullable<typeof doctorCommand.action>>[0];
+ const result = await doctorCommand.action!(ctx);
+ const data = result.data as { results: Array<{ name: string; status: string; message: string }> };
+
+ expect(data.results).toHaveLength(1);
+ expect(data.results[0]).toMatchObject({
+ name: 'MetaHarness integration (ADR-150)',
+ status: 'pass',
+ message: 'plugin scripts intact, _similarity.mjs + parseMcpScanText load, smoke OK',
+ });
+ });
+});
diff --git a/v3/@claude-flow/cli/src/commands/doctor.ts b/v3/@claude-flow/cli/src/commands/doctor.ts
index b9bb21cf19..356930492c 100644
--- a/v3/@claude-flow/cli/src/commands/doctor.ts
+++ b/v3/@claude-flow/cli/src/commands/doctor.ts
@@ -9,7 +9,7 @@ import type { Command, CommandContext, CommandResult } from '../types.js';
import { output } from '../output.js';
import { existsSync, readFileSync, statSync, openSync, readSync, closeSync } from 'fs';
import { join, dirname } from 'path';
-import { fileURLToPath } from 'url';
+import { fileURLToPath, pathToFileURL } from 'url';
import { createHash } from 'crypto';
import { execSync, exec, execFile } from 'child_process';
import { promisify } from 'util';
@@ -2109,7 +2109,7 @@ async function checkMetaharnessIntegration(): Promise<HealthCheck> {
// Runtime smoke: import the similarity module and exercise it
try {
const modPath = join(pluginDir, 'scripts', '_similarity.mjs');
- const mod = await import(modPath) as { similarity?: (a: unknown, b: unknown) => { overall?: number } };
+ const mod = await import(pathToFileURL(modPath).href) as { similarity?: (a: unknown, b: unknown) => { overall?: number } };
if (typeof mod.similarity !== 'function') {
return {
name: 'MetaHarness integration (ADR-150)',
@@ -2137,7 +2137,7 @@ async function checkMetaharnessIntegration(): Promise<HealthCheck> {
// parallelization primitives oia-audit depends on; if they're
// missing, oia-audit's import fails and the whole pipeline breaks.
const harnessPath = join(pluginDir, 'scripts', '_harness.mjs');
- const harnessMod = await import(harnessPath) as {
+ const harnessMod = await import(pathToFileURL(harnessPath).href) as {
parseMcpScanText?: (s: string) => unknown;
runHarnessAsync?: (args: string[]) => Promise<unknown>;
runMetaharnessAsync?: (args: string[]) => Promise<unknown>;