🌊 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
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
fix(helpers): never interpolate a shell-active install-root path; run the delegation smoke from a helper root
r72d895a81df2
diff --git a/.claude/helpers/statusline.cjs b/.claude/helpers/statusline.cjsindex ccb9b1e8e1..0026ff702e 100755--- a/.claude/helpers/statusline.cjs+++ b/.claude/helpers/statusline.cjs@@ -237,10 +237,15 @@ function getStatuslineData() {// intelligence and an empty promo row (the memo cache that keeps the row// populated across CLI hiccups is only ever written from a SUCCESSFUL// delegation, so it could never get seeded on Windows either).+ // These command lines go through a shell, so a path the shell would interpret+ // (a quote, $, backtick, %, !, newline, or a backslash on POSIX) is never+ // interpolated: the directory name is chosen by whoever made the checkout.+ const shellSafe = (p) => !/["`$%!\r\n]/.test(p) && (process.platform === 'win32' || !p.includes('\\'));const cmds = resolveCliBinCandidates()+ .filter((bin) => shellSafe(bin) && shellSafe(process.execPath)).map((bin) => '"' + process.execPath + '" "' + bin + '" hooks statusline --json')// --prefix: npx resolves the package from HELPER_ROOT, not the project.- .concat(['npx --prefer-offline --prefix "' + HELPER_ROOT + '" @claude-flow/cli hooks statusline --json']);+ .concat(shellSafe(HELPER_ROOT) ? ['npx --prefer-offline --prefix "' + HELPER_ROOT + '" @claude-flow/cli hooks statusline --json'] : []);for (const cmd of cmds) {try {const raw = execSync(diff --git a/scripts/smoke-statusline-generator-delegation.mjs b/scripts/smoke-statusline-generator-delegation.mjsindex 378db61087..be1703ab65 100644--- a/scripts/smoke-statusline-generator-delegation.mjs+++ b/scripts/smoke-statusline-generator-delegation.mjs@@ -19,7 +19,7 @@*/import { execSync, execFileSync } from 'node:child_process';-import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs';+import { existsSync, readFileSync, writeFileSync, mkdirSync, mkdtempSync, symlinkSync } from 'node:fs';import { resolve, join } from 'node:path';import { tmpdir, homedir } from 'node:os';@@ -32,7 +32,15 @@ const GENERATOR_DIST = join(REPO_ROOT, 'v3/@claude-flow/cli/dist/src/init/status// the generator just needs to still be reading it. This constant is the// source-of-truth helper used by the static-source contract below.const HELPER_SRC = join(REPO_ROOT, 'v3/@claude-flow/cli/.claude/helpers/statusline.cjs');-const CJS_PATH = join(tmpdir(), 'ruflo-smoke-statusline.cjs');+// The statusline resolves the CLI from its OWN install root (<helpers dir>/../..),+// never from the cwd (the opened project; see helper-cli-resolution-trust). So the+// generated helper is written into a throwaway helper root whose+// v3/@claude-flow/cli is the repo's built CLI.+const SMOKE_ROOT = mkdtempSync(join(tmpdir(), 'ruflo-smoke-statusline-'));+mkdirSync(join(SMOKE_ROOT, '.claude', 'helpers'), { recursive: true });+mkdirSync(join(SMOKE_ROOT, 'v3', '@claude-flow'), { recursive: true });+symlinkSync(join(REPO_ROOT, 'v3/@claude-flow/cli'), join(SMOKE_ROOT, 'v3', '@claude-flow', 'cli'), 'dir');+const CJS_PATH = join(SMOKE_ROOT, '.claude', 'helpers', 'statusline.cjs');let passed = 0;let failed = 0;diff --git a/v3/@claude-flow/cli/.claude/helpers/statusline.cjs b/v3/@claude-flow/cli/.claude/helpers/statusline.cjsindex fee96fbb5b..811b304d97 100755--- a/v3/@claude-flow/cli/.claude/helpers/statusline.cjs+++ b/v3/@claude-flow/cli/.claude/helpers/statusline.cjs@@ -241,10 +241,15 @@ function getStatuslineData() {// intelligence and an empty promo row (the memo cache that keeps the row// populated across CLI hiccups is only ever written from a SUCCESSFUL// delegation, so it could never get seeded on Windows either).+ // These command lines go through a shell, so a path the shell would interpret+ // (a quote, $, backtick, %, !, newline, or a backslash on POSIX) is never+ // interpolated: the directory name is chosen by whoever made the checkout.+ const shellSafe = (p) => !/["`$%!\r\n]/.test(p) && (process.platform === 'win32' || !p.includes('\\'));const cmds = resolveCliBinCandidates()+ .filter((bin) => shellSafe(bin) && shellSafe(process.execPath)).map((bin) => '"' + process.execPath + '" "' + bin + '" hooks statusline --json')// --prefix: npx resolves the package from HELPER_ROOT, not the project.- .concat(['npx --prefer-offline --prefix "' + HELPER_ROOT + '" @claude-flow/cli hooks statusline --json']);+ .concat(shellSafe(HELPER_ROOT) ? ['npx --prefer-offline --prefix "' + HELPER_ROOT + '" @claude-flow/cli hooks statusline --json'] : []);for (const cmd of cmds) {try {const raw = execSync(diff --git a/v3/@claude-flow/cli/__tests__/helper-cli-resolution-trust.test.ts b/v3/@claude-flow/cli/__tests__/helper-cli-resolution-trust.test.tsindex ce96d751b0..1b841c8873 100644--- a/v3/@claude-flow/cli/__tests__/helper-cli-resolution-trust.test.ts+++ b/v3/@claude-flow/cli/__tests__/helper-cli-resolution-trust.test.ts@@ -117,6 +117,24 @@ describe('statusline.cjs resolves the CLI from its install root', () => {render(helper, home, project, emptyBin);expect(existsSync(marker)).toBe(true);});++ it('never interpolates a shell-active install-root path into the delegation command', () => {+ const root = realpathSync(mkdtempSync(join(tmpdir(), 'ruflo-cli-trust-')));+ tempRoots.push(root);+ const home = join(root, 'home');+ const injected = join(root, 'injected');+ // The checkout's directory name is chosen by whoever made it.+ const project = join(root, `p$(/usr/bin/touch ${injected})`);+ const emptyBin = join(root, 'empty-bin');+ mkdirSync(emptyBin);+ mkdirSync(home, { recursive: true });+ plantCli(join(project, 'node_modules', '@claude-flow', 'cli'), join(root, 'cli-ran'));+ const helper = join(project, '.claude', 'helpers', 'statusline.cjs');+ mkdirSync(dirname(helper), { recursive: true });+ copyFileSync(source, helper);+ render(helper, home, project, emptyBin);+ expect(existsSync(injected)).toBe(false);+ });});type Shim = {