🌊 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(hooks): quote-aware split for RUFLO_HOOK_CLI_OVERRIDE (#3344)
rUvcdc000fb418c
diff --git a/plugins/ruflo-core/scripts/ruflo-hook.cjs b/plugins/ruflo-core/scripts/ruflo-hook.cjsindex 2844529db2..28c1afc5dc 100644--- a/plugins/ruflo-core/scripts/ruflo-hook.cjs+++ b/plugins/ruflo-core/scripts/ruflo-hook.cjs@@ -227,16 +227,32 @@ function invokeHook(bin, binArgs, hookSubcommand, hookArgs, stdinData, options =}}+/**+ * Split a test-only CLI override string into argv, honouring double-quoted+ * tokens. A bare `.split(' ')` breaks the moment any token contains a space —+ * which `process.execPath` does on a standard Windows Node install+ * (`C:\Program Files\nodejs\node.exe`), splitting it into `C:\Program` (an+ * invalid command) plus stray trailing tokens. Only ever fed a string this+ * repo's own test harness built, never external/user input.+ */+function splitCliOverride(str) {+ const tokens = [];+ const re = /"([^"]*)"|(\S+)/g;+ let m;+ while ((m = re.exec(str)) !== null) tokens.push(m[1] !== undefined ? m[1] : m[2]);+ return tokens;+}+/** Best-effort: try ruflo, then claude-flow, then npx. Never throws. */function invokeCli(hookSubcommand, hookArgs, stdinData) {// Test-only escape hatch: point at a specific local build instead of the// commandExists() PATH probe (used by test-hooks.mjs and the plugin-hooks// real-command smoke so tests exercise the build under test, not whatever- // happens to be on the runner's PATH). Space-split — always a simple- // "node /abs/path/cli.js" invocation in practice, never quoted args.+ // happens to be on the runner's PATH). A token containing a space must be+ // double-quoted by the caller — see splitCliOverride() above.const override = process.env.RUFLO_HOOK_CLI_OVERRIDE;if (override) {- const [bin, ...binArgs] = override.split(' ').filter(Boolean);+ const [bin, ...binArgs] = splitCliOverride(override);invokeHook(bin, binArgs, hookSubcommand, hookArgs, stdinData);return;}diff --git a/plugins/ruflo-core/scripts/test-hooks.mjs b/plugins/ruflo-core/scripts/test-hooks.mjsindex 637ebde77d..a134620431 100644--- a/plugins/ruflo-core/scripts/test-hooks.mjs+++ b/plugins/ruflo-core/scripts/test-hooks.mjs@@ -138,7 +138,7 @@ const codexEnv = {PLUGIN_ROOT,PLUGIN_DATA: join(PLUGIN_ROOT, '.test-data'),},- cliOverride: `${process.execPath} ${HOOK_RECORDER}`,+ cliOverride: `"${process.execPath}" "${HOOK_RECORDER}"`,};run('Cursor PreToolUse (Bash) emits permission-allow JSON',@@ -285,7 +285,7 @@ run('Stop hook runs session-end without error',...process.env,CLAUDE_PLUGIN_ROOT: PLUGIN_ROOT,CLAUDE_PROJECT_DIR: PLUGIN_ROOT,- RUFLO_HOOK_CLI_OVERRIDE: `${process.execPath} ${HOOK_RECORDER}`,+ RUFLO_HOOK_CLI_OVERRIDE: `"${process.execPath}" "${HOOK_RECORDER}"`,RUFLO_HOOK_DEBUG_STDOUT: '1',RUFLO_HOOK_SKIP_NPX: '1',RUFLO_HOOK_DEDUP_DIR: dedupDir,