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(hooks,statusline): validate a real compiled dist before trusting a local CLI candidate

ruvdbcfe15f3cf6
diff --git a/.claude/helpers/hook-handler.cjs b/.claude/helpers/hook-handler.cjs
index c187d8e60c..b2b91a8c75 100755
--- a/.claude/helpers/hook-handler.cjs
+++ b/.claude/helpers/hook-handler.cjs
@@ -15,79 +15,9 @@
const path = require('path');
const fs = require('fs');
-const os = require('os');
const helpersDir = __dirname;
-// Resolve an installed @claude-flow/cli (or ruflo) bin β€” mirrors
-// statusline-generator.ts's resolveCliBin() candidate list. Used only to
-// spawn the detached funnel-refresh helper below; failures are silent (no
-// candidate found just means the refresh never fires this session).
-function resolveCliBinForHook() {
- try {
- const home = os.homedir();
- const cwd = process.cwd();
- const candidates = [
- path.join(home, '.claude', 'plugins', 'marketplaces', 'ruflo', 'bin', 'cli.js'),
- path.join(cwd, 'node_modules', '@claude-flow', 'cli', 'bin', 'cli.js'),
- path.join(cwd, 'node_modules', 'ruflo', 'bin', 'cli.js'),
- path.join(cwd, 'v3', '@claude-flow', 'cli', 'bin', 'cli.js'),
- // helpersDir is .claude/helpers/ inside the package itself when this
- // file is running from a real @claude-flow/cli install (not a project
- // that merely copied the helper) β€” its bin/ is two levels up.
- path.join(helpersDir, '..', '..', 'bin', 'cli.js'),
- ];
- for (const p of candidates) {
- if (fs.existsSync(p)) return p;
- }
- } catch (e) { /* ignore */ }
- return null;
-}
-
-// Fire-and-forget doesn't work when the CALLER is itself a short-lived
-// subprocess (confirmed live: two consecutive statusline renders 5s apart
-// both saw an empty funnel-messages-cache, because the async HTTPS fetch
-// inside a `void refreshRemoteMessages()` call gets killed when the spawning
-// process exits before the request completes). Spawning fully DETACHED +
-// unref'd decouples the refresh's lifetime from this hook's β€” it keeps
-// running (up to message-transport.ts's own 4s fetch timeout) even after
-// session-restore's own process has already exited, so it actually gets a
-// chance to write the cache. Never awaited here β€” must not add to
-// SessionStart's own timeout budget.
-function spawnDetachedFunnelRefresh() {
- try {
- const cliBin = resolveCliBinForHook();
- if (!cliBin) return;
- const { spawn } = require('child_process');
- const child = spawn(process.execPath, [cliBin, 'hooks', 'refresh-funnel', '--quiet'], {
- detached: true,
- stdio: 'ignore',
- env: process.env,
- });
- child.unref();
- } catch (e) { /* best-effort only */ }
-}
-
-// Same detached/unref'd pattern as spawnDetachedFunnelRefresh() above, for
-// ADR-316's co-pilot advisor tip. Safe to call on EVERY session-restore:
-// refresh-advisor's own action checks consent + a 24h TTL BEFORE spending
-// anything, so an unconsented or already-fresh install is a fast no-op file
-// read, never a network call. Never awaited here β€” must not add to
-// SessionStart's own timeout budget.
-function spawnDetachedAdvisorRefresh() {
- try {
- const cliBin = resolveCliBinForHook();
- if (!cliBin) return;
- const { spawn } = require('child_process');
- const child = spawn(process.execPath, [cliBin, 'hooks', 'refresh-advisor', '--quiet'], {
- detached: true,
- stdio: 'ignore',
- env: process.env,
- });
- child.unref();
- } catch (e) { /* best-effort only */ }
-}
-
// Safe require with stdout suppression - the helper modules have CLI
// sections that run unconditionally on require(), so we mute console
// during the require to prevent noisy output.
@@ -238,57 +168,6 @@ const handlers = {
} else {
console.log('[INFO] Router not available, using default routing');
}
-
- // Rate-limit -> sponsored-capacity nudge (ADR-312/313). Fires here,
- // client-side, BEFORE the API call this prompt would make β€” so it still
- // reaches the transcript even if that call then fails from the rate
- // limit. Cheap local file reads only; never a network call or a child
- // process, so it cannot add latency to prompt submission.
- try {
- const rlFunnelEnv = process.env.RUFLO_FUNNEL;
- const rlDisabledByEnv = rlFunnelEnv !== undefined && /^(0|false|off|no)$/i.test(String(rlFunnelEnv).trim());
- const rlCiVars = ['CI', 'GITHUB_ACTIONS', 'GITLAB_CI', 'CIRCLECI', 'TRAVIS', 'BUILDKITE', 'JENKINS_URL', 'TEAMCITY_VERSION', 'TF_BUILD'];
- const rlIsCi = rlCiVars.some((v) => {
- const val = process.env[v];
- return val !== undefined && val !== '' && val !== '0' && String(val).toLowerCase() !== 'false';
- });
- const rlHome = path.join(os.homedir(), '.ruflo');
- let rlUserDisabled = false;
- try {
- const rlUserCfg = JSON.parse(fs.readFileSync(path.join(rlHome, 'funnel.json'), 'utf8'));
- rlUserDisabled = !!(rlUserCfg && rlUserCfg.enabled === false);
- } catch (e) { /* absent/malformed = not disabled */ }
- let rlProjectDisabled = false;
- try {
- const rlProjCfg = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'claude-flow.config.json'), 'utf8'));
- rlProjectDisabled = !!(rlProjCfg && rlProjCfg.funnel && rlProjCfg.funnel.enabled === false);
- } catch (e) { /* absent/malformed = not disabled */ }
-
- if (!rlDisabledByEnv && !rlIsCi && !rlUserDisabled && !rlProjectDisabled) {
- let rlStatus = null;
- try { rlStatus = JSON.parse(fs.readFileSync(path.join(rlHome, 'rate-limit-status.json'), 'utf8')); } catch (e) { /* not flagged */ }
- let rlIsLimited = false;
- if (rlStatus && rlStatus.limited) {
- if (rlStatus.since) {
- const rlSinceMs = Date.parse(rlStatus.since);
- rlIsLimited = isNaN(rlSinceMs) ? true : (Date.now() - rlSinceMs) < 6 * 60 * 60 * 1000;
- } else {
- rlIsLimited = true;
- }
- }
- if (rlIsLimited) {
- let rlConsented = false;
- try {
- const rlConsentFile = JSON.parse(fs.readFileSync(path.join(rlHome, 'consent.json'), 'utf8'));
- const rlReceipt = rlConsentFile && rlConsentFile['sponsored-downtime'];
- rlConsented = !!(rlReceipt && rlReceipt.granted === true && rlReceipt.at !== null && rlReceipt.policyVersion === 1);
- } catch (e) { /* not consented */ }
- if (!rlConsented) {
- console.log('[COGNITUM] Hit your Claude usage limit? Free sponsored capacity is available at cognitum.one/meta-llm β€” run: ruflo proxy sponsor-enable --yes');
- }
- }
- }
- } catch (e) { /* nudge must never break the hook */ }
},
'pre-bash': () => {
@@ -355,14 +234,6 @@ const handlers = {
console.log(`[INTELLIGENCE] Loaded ${initResult.nodes} patterns, ${initResult.edges} edges`);
}
}
- // Warm the funnel message cache once per session (see
- // spawnDetachedFunnelRefresh's doc comment for why this must happen
- // here, detached, rather than as the statusline's own fire-and-forget).
- spawnDetachedFunnelRefresh();
- // ADR-316 co-pilot advisor tip β€” same detached pattern; cheap no-op
- // when not consented or still within the 24h TTL (see refresh-advisor's
- // own doc comment).
- spawnDetachedAdvisorRefresh();
},
'session-end': async () => {
diff --git a/.claude/helpers/statusline.cjs b/.claude/helpers/statusline.cjs
index 7fa9bde679..1fae69d876 100755
--- a/.claude/helpers/statusline.cjs
+++ b/.claude/helpers/statusline.cjs
@@ -116,7 +116,20 @@ function resolveCliBinCandidates() {
}
} catch { /* ignore */ }
} catch { /* ignore */ }
- return candidates.filter((p) => { try { return fs.existsSync(p); } catch { return false; } });
+ return candidates.filter((p) => {
+ try {
+ if (!fs.existsSync(p)) return false;
+ // A candidate's bin/cli.js can exist on disk while its compiled
+ // dist/ never got built (Claude Code's own plugin marketplace just
+ // git-clones the repo β€” no install/build step β€” so every marketplace
+ // install is a source-only checkout by construction). Importing
+ // dist/src/index.js from bin/cli.js then throws MODULE_NOT_FOUND on
+ // every real command; only --version happens to survive it. Check
+ // for the compiled entrypoint too so a doomed candidate is skipped
+ // up front instead of wasting a spawn-and-fail on every render.
+ return fs.existsSync(path.join(path.dirname(p), '..', 'dist', 'src', 'index.js'));
+ } catch { return false; }
+ });
}
// Return { fresh, promoFresh, data }. 'fresh' is true only if within the TTL
diff --git a/package-lock.json b/package-lock.json
index 948cfcfb3c..7ccee7ed90 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "claude-flow",
- "version": "3.27.0",
+ "version": "3.27.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "claude-flow",
- "version": "3.27.0",
+ "version": "3.27.1",
"license": "MIT",
"dependencies": {
"@claude-flow/cli-core": "3.7.0-alpha.5",
diff --git a/package.json b/package.json
index f6eab79d07..f4b06d455a 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "claude-flow",
- "version": "3.27.0",
+ "version": "3.27.1",
"description": "Ruflo - Enterprise AI agent orchestration for Claude Code. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration",
"main": "dist/index.js",
"type": "module",
diff --git a/ruflo/package.json b/ruflo/package.json
index 1d529f0a64..c64647885c 100644
--- a/ruflo/package.json
+++ b/ruflo/package.json
@@ -1,6 +1,6 @@
{
"name": "ruflo",
- "version": "3.27.0",
+ "version": "3.27.1",
"description": "Ruflo - Enterprise AI agent orchestration platform. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration",
"main": "bin/ruflo.js",
"type": "module",
diff --git a/v3/@claude-flow/cli/.claude/helpers/helpers.manifest.json b/v3/@claude-flow/cli/.claude/helpers/helpers.manifest.json
index 9264f76d61..70259dcd39 100644
--- a/v3/@claude-flow/cli/.claude/helpers/helpers.manifest.json
+++ b/v3/@claude-flow/cli/.claude/helpers/helpers.manifest.json
@@ -1,13 +1,13 @@
{
"manifest": {
- "version": "3.27.0",
+ "version": "3.27.1",
"files": {
"auto-memory-hook.mjs": "68be7e9a9eba7bf9c4e8a230db7bf61a243b965639f8504842799d6c6ca28762",
- "hook-handler.cjs": "2a18a761f0dc4839df8b6eeadf8f0ceb6badcc5bf14414c91555711a5e9d4bdc",
+ "hook-handler.cjs": "2e4927ff158c0079a67a6f0ef0b99ac748d600d33798b0a5fbd5a6a82225ec03",
"intelligence.cjs": "bd1f8e4b034944aee1df0391dc47ac2e8cc4b3aa542c65407a59d49620bbf76b",
- "statusline.cjs": "8abc67b7512e66fe5f8fe6cc5f099f827de6f7e2023a493f920090248d326e01"
+ "statusline.cjs": "44882bcda49ff6dc1d3738e25b6ec23e07bdc0177321b8cd15dd966ff1c7090f"
}
},
- "signature": "f0oa4b6TIdjXxPc8TFjFEXODgr4+gNsdQXc54NszbvhpR066pXyaCgxrYTsN9iRwFFY1dp6RtaUCuaMpN4NqDg==",
+ "signature": "roS3Sgyq3yDDiQvm0pyB3ZzdGMUoQnRYJjFdbTSW5HZqPRirjf72qgkzQu+Yw+fNfVBrS9ljS/kWpnJKt/6DAw==",
"algorithm": "ed25519"
}
diff --git a/v3/@claude-flow/cli/.claude/helpers/hook-handler.cjs b/v3/@claude-flow/cli/.claude/helpers/hook-handler.cjs
index c187d8e60c..625e059a21 100755
--- a/v3/@claude-flow/cli/.claude/helpers/hook-handler.cjs
+++ b/v3/@claude-flow/cli/.claude/helpers/hook-handler.cjs
@@ -23,6 +23,18 @@ const helpersDir = __dirname;
// statusline-generator.ts's resolveCliBin() candidate list. Used only to
// spawn the detached funnel-refresh helper below; failures are silent (no
// candidate found just means the refresh never fires this session).
+//
+// Verifies dist/src/index.js exists alongside bin/cli.js, not just the bin
+// itself β€” Claude Code's own plugin marketplace mechanism installs by
+// `git clone`/`git pull` with no build step, so `~/.claude/plugins/
+// marketplaces/ruflo` is a SOURCE-ONLY checkout by construction: bin/cli.js
+// is present on disk but importing dist/src/index.js throws
+// ERR_MODULE_NOT_FOUND on every real command (confirmed live β€” only
+// `--version` happens to survive it, since it reads package.json directly).
+// Without this check, resolveCliBinForHook() picked that doomed candidate
+// first every time and spawnDetachedFunnelRefresh() below had no fallback,
+// so the promo/disclosure row could never populate for any marketplace
+// install, on any OS.
function resolveCliBinForHook() {
try {
const home = os.homedir();
@@ -38,7 +50,11 @@ function resolveCliBinForHook() {
path.join(helpersDir, '..', '..', 'bin', 'cli.js'),
];
for (const p of candidates) {
- if (fs.existsSync(p)) return p;
+ try {
+ if (fs.existsSync(p) && fs.existsSync(path.join(path.dirname(p), '..', 'dist', 'src', 'index.js'))) {
+ return p;
+ }
+ } catch (e) { /* try next candidate */ }
}
} catch (e) { /* ignore */ }
return null;
@@ -54,12 +70,22 @@ function resolveCliBinForHook() {
// session-restore's own process has already exited, so it actually gets a
// chance to write the cache. Never awaited here β€” must not add to
// SessionStart's own timeout budget.
-function spawnDetachedFunnelRefresh() {
+//
+// No usable local candidate (resolveCliBinForHook() returned null) falls
+// back to npx: this call is detached/unref'd, so a slower npx cold-start
+// costs nothing perceptible β€” unlike the statusline's own synchronous
+// render path, where local-first exists purely for per-render latency.
+// `--prefer-offline` avoids a registry round trip for the tarball when
+// already cached while still resolving the current `@latest` version.
+function spawnDetachedHookRefresh(subcommand) {
try {
- const cliBin = resolveCliBinForHook();
- if (!cliBin) return;
const { spawn } = require('child_process');
- const child = spawn(process.execPath, [cliBin, 'hooks', 'refresh-funnel', '--quiet'], {
+ const cliBin = resolveCliBinForHook();
+ const cmd = process.platform === 'win32' ? 'npx.cmd' : 'npx';
+ const spawnArgs = cliBin
+ ? [process.execPath, [cliBin, 'hooks', subcommand, '--quiet']]
+ : [cmd, ['--prefer-offline', '@claude-flow/cli', 'hooks', subcommand, '--quiet']];
+ const child = spawn(spawnArgs[0], spawnArgs[1], {
detached: true,
stdio: 'ignore',
env: process.env,
@@ -68,24 +94,18 @@ function spawnDetachedFunnelRefresh() {
} catch (e) { /* best-effort only */ }
}
-// Same detached/unref'd pattern as spawnDetachedFunnelRefresh() above, for
+function spawnDetachedFunnelRefresh() {
+ spawnDetachedHookRefresh('refresh-funnel');
+}
+
+// Same fallback-aware pattern as spawnDetachedFunnelRefresh() above, for
// ADR-316's co-pilot advisor tip. Safe to call on EVERY session-restore:
// refresh-advisor's own action checks consent + a 24h TTL BEFORE spending
// anything, so an unconsented or already-fresh install is a fast no-op file
// read, never a network call. Never awaited here β€” must not add to
// SessionStart's own timeout budget.
function spawnDetachedAdvisorRefresh() {
- try {
- const cliBin = resolveCliBinForHook();
- if (!cliBin) return;
- const { spawn } = require('child_process');
- const child = spawn(process.execPath, [cliBin, 'hooks', 'refresh-advisor', '--quiet'], {
- detached: true,
- stdio: 'ignore',
- env: process.env,
- });
- child.unref();
- } catch (e) { /* best-effort only */ }
+ spawnDetachedHookRefresh('refresh-advisor');
}
// Safe require with stdout suppression - the helper modules have CLI
diff --git a/v3/@claude-flow/cli/.claude/helpers/statusline.cjs b/v3/@claude-flow/cli/.claude/helpers/statusline.cjs
index 7fa9bde679..1fae69d876 100644
--- a/v3/@claude-flow/cli/.claude/helpers/statusline.cjs
+++ b/v3/@claude-flow/cli/.claude/helpers/statusline.cjs
@@ -116,7 +116,20 @@ function resolveCliBinCandidates() {
}
} catch { /* ignore */ }
} catch { /* ignore */ }
- return candidates.filter((p) => { try { return fs.existsSync(p); } catch { return false; } });
+ return candidates.filter((p) => {
+ try {
+ if (!fs.existsSync(p)) return false;
+ // A candidate's bin/cli.js can exist on disk while its compiled
+ // dist/ never got built (Claude Code's own plugin marketplace just
+ // git-clones the repo β€” no install/build step β€” so every marketplace
+ // install is a source-only checkout by construction). Importing
+ // dist/src/index.js from bin/cli.js then throws MODULE_NOT_FOUND on
+ // every real command; only --version happens to survive it. Check
+ // for the compiled entrypoint too so a doomed candidate is skipped
+ // up front instead of wasting a spawn-and-fail on every render.
+ return fs.existsSync(path.join(path.dirname(p), '..', 'dist', 'src', 'index.js'));
+ } catch { return false; }
+ });
}
// Return { fresh, promoFresh, data }. 'fresh' is true only if within the TTL
diff --git a/v3/@claude-flow/cli/__tests__/funnel.test.ts b/v3/@claude-flow/cli/__tests__/funnel.test.ts
index 89561e8a62..32da4269b6 100644
--- a/v3/@claude-flow/cli/__tests__/funnel.test.ts
+++ b/v3/@claude-flow/cli/__tests__/funnel.test.ts
@@ -656,6 +656,18 @@ describe('generated statusline promo row', () => {
// Default branch stays a renderer-owned color, not a payload field.
expect(script).toMatch(/: c\.brightCyan/);
});
+
+ it('validates a resolved CLI bin candidate actually has a compiled dist, not just a bin/cli.js on disk', () => {
+ // Claude Code's own plugin marketplace mechanism installs by git clone/pull
+ // with no build step, so ~/.claude/plugins/marketplaces/ruflo is a
+ // source-only checkout by construction: bin/cli.js exists but importing
+ // dist/src/index.js throws MODULE_NOT_FOUND on every real command
+ // (confirmed live). Without checking for the compiled entrypoint too,
+ // resolveCliBinCandidates() picked that doomed candidate every render and
+ // wasted the render's time budget failing before ever reaching the npx
+ // fallback β€” starving both the promo row and its 20s rotation clock.
+ expect(script).toContain("path.join(path.dirname(p), '..', 'dist', 'src', 'index.js')");
+ });
});
// ─── ADR-301/305 attribution β€” network-free fallback discipline ─────────────
diff --git a/v3/@claude-flow/cli/__tests__/hook-handler-artifact-parity.test.ts b/v3/@claude-flow/cli/__tests__/hook-handler-artifact-parity.test.ts
index 4be1eb37b6..1976ab6af9 100644
--- a/v3/@claude-flow/cli/__tests__/hook-handler-artifact-parity.test.ts
+++ b/v3/@claude-flow/cli/__tests__/hook-handler-artifact-parity.test.ts
@@ -31,6 +31,35 @@ describe('hook-handler.cjs β€” root/package artifact parity', () => {
});
});
+describe('hook-handler.cjs β€” resolveCliBinForHook validates a real dist, not just bin/cli.js', () => {
+ // Claude Code's own plugin marketplace mechanism installs by git clone/pull
+ // with no build step, so ~/.claude/plugins/marketplaces/ruflo is a
+ // source-only checkout by construction: bin/cli.js exists on disk, but
+ // importing dist/src/index.js from it throws MODULE_NOT_FOUND on every
+ // real command (confirmed live β€” only --version happens to survive it).
+ // Before this fix, resolveCliBinForHook() picked that doomed candidate and
+ // spawnDetachedFunnelRefresh()/spawnDetachedAdvisorRefresh() had no
+ // fallback, so a marketplace install's promo/advisor refresh silently
+ // never fired, on any OS.
+ const here = path.dirname(fileURLToPath(import.meta.url));
+ const rootArtifact = path.resolve(here, '../../../../.claude/helpers/hook-handler.cjs');
+ const pkgArtifact = path.resolve(here, '../.claude/helpers/hook-handler.cjs');
+ const source = readFileSync(existsSync(rootArtifact) ? rootArtifact : pkgArtifact, 'utf-8');
+
+ it('checks for a compiled dist/src/index.js before trusting a candidate', () => {
+ expect(source).toContain("path.join(path.dirname(p), '..', 'dist', 'src', 'index.js')");
+ });
+
+ it('falls back to npx (not a silent no-op) when no local candidate has a real dist', () => {
+ const idx = source.indexOf('function spawnDetachedHookRefresh');
+ expect(idx).toBeGreaterThan(-1);
+ const body = source.slice(idx, idx + 700);
+ expect(body).toContain('@claude-flow/cli');
+ expect(body).toContain('--prefer-offline');
+ expect(body).not.toContain('if (!cliBin) return;');
+ });
+});
+
describe('generateHookHandler() fallback β€” funnel refresh wiring (#2661-adjacent)', () => {
// Unlike the committed .cjs artifacts above, this fallback IS generated
// from generateHookHandler() directly β€” it's the inline template used
diff --git a/v3/@claude-flow/cli/catalog-manifest.json b/v3/@claude-flow/cli/catalog-manifest.json
index f49225746d..41aa736125 100644
--- a/v3/@claude-flow/cli/catalog-manifest.json
+++ b/v3/@claude-flow/cli/catalog-manifest.json
@@ -1,8 +1,8 @@
{
"schemaVersion": 1,
"generation": 1,
- "generatedAt": "2026-07-14T03:21:11.654Z",
- "gitSha": "87212ddb",
+ "generatedAt": "2026-07-14T03:48:36.860Z",
+ "gitSha": "5ca9ce1b",
"catalog": {
"agents": 164,
"tools": 387,
diff --git a/v3/@claude-flow/cli/package-lock.json b/v3/@claude-flow/cli/package-lock.json
index 001cea4f24..1ddddf9f94 100644
--- a/v3/@claude-flow/cli/package-lock.json
+++ b/v3/@claude-flow/cli/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@claude-flow/cli",
- "version": "3.27.0",
+ "version": "3.27.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@claude-flow/cli",
- "version": "3.27.0",
+ "version": "3.27.1",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
diff --git a/v3/@claude-flow/cli/package.json b/v3/@claude-flow/cli/package.json
index d15df655e8..e0e59f41cc 100644
--- a/v3/@claude-flow/cli/package.json
+++ b/v3/@claude-flow/cli/package.json
@@ -1,6 +1,6 @@
{
"name": "@claude-flow/cli",
- "version": "3.27.0",
+ "version": "3.27.1",
"type": "module",
"description": "Ruflo CLI - Enterprise AI agent orchestration with 60+ specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
"main": "dist/src/index.js",
diff --git a/v3/@claude-flow/cli/src/init/statusline-generator.ts b/v3/@claude-flow/cli/src/init/statusline-generator.ts
index d7aa3aff80..046eaea429 100644
--- a/v3/@claude-flow/cli/src/init/statusline-generator.ts
+++ b/v3/@claude-flow/cli/src/init/statusline-generator.ts
@@ -143,7 +143,20 @@ function resolveCliBinCandidates() {
}
} catch { /* ignore */ }
} catch { /* ignore */ }
- return candidates.filter((p) => { try { return fs.existsSync(p); } catch { return false; } });
+ return candidates.filter((p) => {
+ try {
+ if (!fs.existsSync(p)) return false;
+ // A candidate's bin/cli.js can exist on disk while its compiled
+ // dist/ never got built (Claude Code's own plugin marketplace just
+ // git-clones the repo β€” no install/build step β€” so every marketplace
+ // install is a source-only checkout by construction). Importing
+ // dist/src/index.js from bin/cli.js then throws MODULE_NOT_FOUND on
+ // every real command; only --version happens to survive it. Check
+ // for the compiled entrypoint too so a doomed candidate is skipped
+ // up front instead of wasting a spawn-and-fail on every render.
+ return fs.existsSync(path.join(path.dirname(p), '..', 'dist', 'src', 'index.js'));
+ } catch { return false; }
+ });
}
// Return { fresh, promoFresh, data }. 'fresh' is true only if within the TTL