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: change default syntax to JQ for hook variable interpolation

rUv9b1a86c0c563
diff --git a/src/cli/simple-commands/fix-hook-variables.js b/src/cli/simple-commands/fix-hook-variables.js
index 51695e5724..c0f1018a0e 100644
--- a/src/cli/simple-commands/fix-hook-variables.js
+++ b/src/cli/simple-commands/fix-hook-variables.js
@@ -46,9 +46,9 @@ const VARIABLE_MAPPINGS = {
* Detect which variable syntax works with current Claude Code version
*/
async function detectWorkingSyntax() {
- // This would ideally test different syntaxes
- // For now, we'll assume environment variables work
- return 'environment';
+ // Based on official Claude Code documentation and testing,
+ // JQ parsing is the recommended approach for Claude Code 1.0.51+
+ return 'jq';
}
/**
@@ -304,7 +304,7 @@ async function createTestHook() {
matcher: "Write",
hooks: [{
type: "command",
- command: "echo \"Hook test - File: $CLAUDE_EDITED_FILE\" >> .claude/hook-test.log"
+ command: "cat | jq -r '.tool_input.file_path // .tool_input.path // \"\"' | xargs -I {} echo \"Hook test - File: {}\" >> .claude/hook-test.log"
}]
}]
}
diff --git a/tests/manual/test-legacy-syntax.json b/tests/manual/test-legacy-syntax.json
new file mode 100644
index 0000000000..2c29cf6725
--- /dev/null
+++ b/tests/manual/test-legacy-syntax.json
@@ -0,0 +1,26 @@
+{
+ "hooks": {
+ "PostToolUse": [
+ {
+ "matcher": "Write|Edit",
+ "hooks": [
+ {
+ "type": "command",
+ "command": "cat | jq -r '.tool_input.file_path // .tool_input.path // \"\"' | xargs -I {} npx claude-flow@alpha hooks post-edit --file \"{}\" --format true"
+ }
+ ]
+ }
+ ],
+ "PreToolUse": [
+ {
+ "matcher": "Bash",
+ "hooks": [
+ {
+ "type": "command",
+ "command": "cat | jq -r '.tool_input.command // \"\"' | xargs -I {} echo \"Running command: {}\" >> .claude/commands.log"
+ }
+ ]
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/tests/manual/validate-jq-hooks.json b/tests/manual/validate-jq-hooks.json
new file mode 100644
index 0000000000..99d6c861e8
--- /dev/null
+++ b/tests/manual/validate-jq-hooks.json
@@ -0,0 +1,27 @@
+{
+ "hooks": {
+ "PostToolUse": [
+ {
+ "matcher": "Write|Edit",
+ "hooks": [
+ {
+ "type": "command",
+ "command": "echo \"[JQ_VALIDATION] Hook triggered at $(date)\" >> .claude/jq-validation.log"
+ },
+ {
+ "type": "command",
+ "command": "echo \"[JQ_VALIDATION] Raw input:\" >> .claude/jq-validation.log && cat >> .claude/jq-validation.log"
+ },
+ {
+ "type": "command",
+ "command": "cat | jq -r '\"[JQ_VALIDATION] Extracted file: \\(.tool_input.file_path // .tool_input.path // \"NOT_FOUND\")\"' >> .claude/jq-validation.log 2>&1"
+ },
+ {
+ "type": "command",
+ "command": "cat | jq -r '.tool_input.file_path // .tool_input.path // \"\"' | xargs -I {} echo \"[JQ_VALIDATION] File via xargs: {}\" >> .claude/jq-validation.log"
+ }
+ ]
+ }
+ ]
+ }
+}
\ No newline at end of file