From ce8559dd18dfbc8d445f41526e8e981d9372fcbe Mon Sep 17 00:00:00 2001 From: rUv Date: Tue, 22 Jul 2025 20:03:00 +0000 Subject: [PATCH] fix: properly escape newline characters in settings.json template MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The settings.json template had single backslashes \n that were being interpreted as actual newlines, causing Claude CLI to report invalid JSON. Fixed by using double backslashes \\n for proper escaping. This ensures the hooks commands with tr '\\n' '\\0' are correctly preserved in the generated settings.json file. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- src/cli/simple-commands/init/templates/settings.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cli/simple-commands/init/templates/settings.json b/src/cli/simple-commands/init/templates/settings.json index 8a6221925d..c502635ede 100644 --- a/src/cli/simple-commands/init/templates/settings.json +++ b/src/cli/simple-commands/init/templates/settings.json @@ -40,7 +40,7 @@ "hooks": [ { "type": "command", - "command": "cat | jq -r '.tool_input.command // empty' | tr '\n' '\0' | xargs -0 -I {} npx claude-flow@alpha hooks pre-command --command '{}' --validate-safety true --prepare-resources true" + "command": "cat | jq -r '.tool_input.command // empty' | tr '\\n' '\\0' | xargs -0 -I {} npx claude-flow@alpha hooks pre-command --command '{}' --validate-safety true --prepare-resources true" } ] }, @@ -49,7 +49,7 @@ "hooks": [ { "type": "command", - "command": "cat | jq -r '.tool_input.file_path // .tool_input.path // empty' | tr '\n' '\0' | xargs -0 -I {} npx claude-flow@alpha hooks pre-edit --file '{}' --auto-assign-agents true --load-context true" + "command": "cat | jq -r '.tool_input.file_path // .tool_input.path // empty' | tr '\\n' '\\0' | xargs -0 -I {} npx claude-flow@alpha hooks pre-edit --file '{}' --auto-assign-agents true --load-context true" } ] } @@ -60,7 +60,7 @@ "hooks": [ { "type": "command", - "command": "cat | jq -r '.tool_input.command // empty' | tr '\n' '\0' | xargs -0 -I {} npx claude-flow@alpha hooks post-command --command '{}' --track-metrics true --store-results true" + "command": "cat | jq -r '.tool_input.command // empty' | tr '\\n' '\\0' | xargs -0 -I {} npx claude-flow@alpha hooks post-command --command '{}' --track-metrics true --store-results true" } ] }, @@ -69,7 +69,7 @@ "hooks": [ { "type": "command", - "command": "cat | jq -r '.tool_input.file_path // .tool_input.path // empty' | tr '\n' '\0' | xargs -0 -I {} npx claude-flow@alpha hooks post-edit --file '{}' --format true --update-memory true" + "command": "cat | jq -r '.tool_input.file_path // .tool_input.path // empty' | tr '\\n' '\\0' | xargs -0 -I {} npx claude-flow@alpha hooks post-edit --file '{}' --format true --update-memory true" } ] }