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(cli): escape embedded quotes in .claude/settings.json's hook commands (#3888)

Nicholas Ruestb1917b4b488c
diff --git a/v3/@claude-flow/cli/.claude/settings.json b/v3/@claude-flow/cli/.claude/settings.json
index e0201d750d..0d8068b560 100644
--- a/v3/@claude-flow/cli/.claude/settings.json
+++ b/v3/@claude-flow/cli/.claude/settings.json
@@ -11,7 +11,7 @@
"hooks": [
{
"type": "command",
- "command": "node "$CLAUDE_PROJECT_DIR/.claude/helpers/hook-handler.cjs" pre-bash",
+ "command": "node \"$CLAUDE_PROJECT_DIR/.claude/helpers/hook-handler.cjs\" pre-bash",
"timeout": 5000
}
]
@@ -23,7 +23,7 @@
"hooks": [
{
"type": "command",
- "command": "node "$CLAUDE_PROJECT_DIR/.claude/helpers/hook-handler.cjs" post-edit",
+ "command": "node \"$CLAUDE_PROJECT_DIR/.claude/helpers/hook-handler.cjs\" post-edit",
"timeout": 10000
}
]
@@ -34,7 +34,7 @@
"hooks": [
{
"type": "command",
- "command": "node "$CLAUDE_PROJECT_DIR/.claude/helpers/hook-handler.cjs" route",
+ "command": "node \"$CLAUDE_PROJECT_DIR/.claude/helpers/hook-handler.cjs\" route",
"timeout": 10000
}
]
@@ -46,13 +46,13 @@
"hooks": [
{
"type": "command",
- "command": "node "$CLAUDE_PROJECT_DIR/.claude/helpers/hook-handler.cjs" session-restore",
+ "command": "node \"$CLAUDE_PROJECT_DIR/.claude/helpers/hook-handler.cjs\" session-restore",
"timeout": 15000,
"continueOnError": true
},
{
"type": "command",
- "command": "node "$CLAUDE_PROJECT_DIR/.claude/helpers/auto-memory-hook.mjs" import",
+ "command": "node \"$CLAUDE_PROJECT_DIR/.claude/helpers/auto-memory-hook.mjs\" import",
"timeout": 8000,
"continueOnError": true
}
@@ -64,7 +64,7 @@
"hooks": [
{
"type": "command",
- "command": "node "$CLAUDE_PROJECT_DIR/.claude/helpers/hook-handler.cjs" session-end",
+ "command": "node \"$CLAUDE_PROJECT_DIR/.claude/helpers/hook-handler.cjs\" session-end",
"timeout": 10000,
"continueOnError": true
}
@@ -76,7 +76,7 @@
"hooks": [
{
"type": "command",
- "command": "node "$CLAUDE_PROJECT_DIR/.claude/helpers/hook-handler.cjs" status",
+ "command": "node \"$CLAUDE_PROJECT_DIR/.claude/helpers/hook-handler.cjs\" status",
"timeout": 3000,
"continueOnError": true
}
@@ -88,7 +88,7 @@
"hooks": [
{
"type": "command",
- "command": "node "$CLAUDE_PROJECT_DIR/.claude/helpers/auto-memory-hook.mjs" sync",
+ "command": "node \"$CLAUDE_PROJECT_DIR/.claude/helpers/auto-memory-hook.mjs\" sync",
"timeout": 10000,
"continueOnError": true
}
@@ -98,7 +98,7 @@
},
"statusLine": {
"type": "command",
- "command": "node "$CLAUDE_PROJECT_DIR/.claude/helpers/statusline.cjs"",
+ "command": "node \"$CLAUDE_PROJECT_DIR/.claude/helpers/statusline.cjs\"",
"refreshMs": 5000,
"enabled": true
},
diff --git a/v3/@claude-flow/cli/__tests__/settings-json-template-valid-3888.test.ts b/v3/@claude-flow/cli/__tests__/settings-json-template-valid-3888.test.ts
new file mode 100644
index 0000000000..4d79fc3451
--- /dev/null
+++ b/v3/@claude-flow/cli/__tests__/settings-json-template-valid-3888.test.ts
@@ -0,0 +1,20 @@
+/** #3888: .claude/settings.json template must be valid JSON. */
+import { describe, expect, it } from 'vitest';
+import { readFileSync } from 'node:fs';
+import { join } from 'node:path';
+
+const SETTINGS_PATH = join(__dirname, '..', '.claude', 'settings.json');
+
+describe('#3888 settings.json template', () => {
+ it('parses as valid JSON', () => {
+ const raw = readFileSync(SETTINGS_PATH, 'utf8');
+ expect(() => JSON.parse(raw)).not.toThrow();
+ });
+
+ it('preserves shell-level quoting around $CLAUDE_PROJECT_DIR after JSON parsing', () => {
+ const settings = JSON.parse(readFileSync(SETTINGS_PATH, 'utf8'));
+ const command = settings.hooks.PreToolUse[0].hooks[0].command as string;
+ expect(command).toContain('"$CLAUDE_PROJECT_DIR');
+ expect(command).toBe('node "$CLAUDE_PROJECT_DIR/.claude/helpers/hook-handler.cjs" pre-bash');
+ });
+});