chore: fix UBS hook stdin parsing and update beads
.claude/hooks/on-file-write.sh: - Fix hook to read Claude Code context from JSON stdin (FILE_PATH and CWD extracted via jq) instead of relying on environment variables - Scan only the changed file instead of the entire project directory, reducing hook execution from ~30s to <1s per save .beads/: - Sync issue tracker state Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
|||||||
bd-3qn6
|
bd-3hjh
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Ultimate Bug Scanner - Claude Code Hook
|
# Ultimate Bug Scanner - Claude Code Hook
|
||||||
# Runs on every file save for UBS-supported languages (JS/TS, Python, C/C++, Rust, Go, Java, Ruby)
|
# Runs on every file save for UBS-supported languages (JS/TS, Python, C/C++, Rust, Go, Java, Ruby)
|
||||||
|
# Claude Code hooks receive context as JSON on stdin.
|
||||||
|
|
||||||
|
INPUT=$(cat)
|
||||||
|
FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty')
|
||||||
|
CWD=$(echo "$INPUT" | jq -r '.cwd // empty')
|
||||||
|
|
||||||
if [[ "$FILE_PATH" =~ \.(js|jsx|ts|tsx|mjs|cjs|py|pyw|pyi|c|cc|cpp|cxx|h|hh|hpp|hxx|rs|go|java|rb)$ ]]; then
|
if [[ "$FILE_PATH" =~ \.(js|jsx|ts|tsx|mjs|cjs|py|pyw|pyi|c|cc|cpp|cxx|h|hh|hpp|hxx|rs|go|java|rb)$ ]]; then
|
||||||
echo "🔬 Running bug scanner..."
|
echo "🔬 Running bug scanner..."
|
||||||
@@ -8,5 +13,5 @@ if [[ "$FILE_PATH" =~ \.(js|jsx|ts|tsx|mjs|cjs|py|pyw|pyi|c|cc|cpp|cxx|h|hh|hpp|
|
|||||||
echo "⚠️ 'ubs' not found in PATH; install it before using this hook." >&2
|
echo "⚠️ 'ubs' not found in PATH; install it before using this hook." >&2
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
ubs "${PROJECT_DIR}" --ci 2>&1 | head -50
|
ubs "$FILE_PATH" --ci 2>&1 | head -50
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user