Skip to content

Commit 9ad4f01

Browse files
AlexMikhalevclaude
andcommitted
Merge main into feat/claude-analyzer-haystack-integration
- Resolved conflicts in crate rename (claude-log-analyzer -> terraphim-session-analyzer) - Updated terraphim_middleware to use renamed crate - Took main branch versions for workflow files and Cargo.lock - Resolved dependency version conflicts - Fixed duplicate ai-assistant feature key in Cargo.toml - Fixed duplicate AiAssistant match arm in indexer Co-Authored-By: Terraphim AI <noreply@anthropic.com>
2 parents ddb0fae + 47bf1eb commit 9ad4f01

374 files changed

Lines changed: 62941 additions & 3487 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/hooks/git_safety_guard.sh

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/bin/bash
2+
#
3+
# PreToolUse hook that blocks destructive git and filesystem commands.
4+
# Uses terraphim-agent guard command for pattern matching.
5+
#
6+
# Blocks: git checkout --, git reset --hard, rm -rf, git push --force, etc.
7+
# Allows: git checkout -b, rm -rf /tmp/, git push --force-with-lease, etc.
8+
#
9+
# Installation: Add to .claude/settings.local.json under hooks.PreToolUse
10+
#
11+
12+
set -e
13+
14+
# Read JSON input from stdin
15+
INPUT=$(cat)
16+
17+
# Extract tool name and command using jq
18+
TOOL_NAME=$(echo "$INPUT" | jq -r '.tool_name // empty')
19+
COMMAND=$(echo "$INPUT" | jq -r '.tool_input.command // empty')
20+
21+
# Only process Bash commands
22+
[ "$TOOL_NAME" != "Bash" ] && exit 0
23+
[ -z "$COMMAND" ] && exit 0
24+
25+
# Discover terraphim-agent
26+
AGENT=""
27+
if command -v terraphim-agent >/dev/null 2>&1; then
28+
AGENT="terraphim-agent"
29+
elif [ -x "./target/release/terraphim-agent" ]; then
30+
AGENT="./target/release/terraphim-agent"
31+
elif [ -x "./target/debug/terraphim-agent" ]; then
32+
AGENT="./target/debug/terraphim-agent"
33+
elif [ -x "$HOME/.cargo/bin/terraphim-agent" ]; then
34+
AGENT="$HOME/.cargo/bin/terraphim-agent"
35+
fi
36+
37+
# If no agent found, pass through unchanged (fail-open)
38+
[ -z "$AGENT" ] && exit 0
39+
40+
# Check command against guard patterns
41+
RESULT=$("$AGENT" guard --json <<< "$COMMAND" 2>/dev/null) || exit 0
42+
43+
# Parse decision
44+
DECISION=$(echo "$RESULT" | jq -r '.decision // empty')
45+
46+
# If blocked, output deny decision for Claude Code
47+
if [ "$DECISION" = "block" ]; then
48+
REASON=$(echo "$RESULT" | jq -r '.reason // "Command blocked by git_safety_guard"')
49+
50+
cat <<EOF
51+
{
52+
"hookSpecificOutput": {
53+
"hookEventName": "PreToolUse",
54+
"permissionDecision": "deny",
55+
"permissionDecisionReason": "BLOCKED by git_safety_guard\n\nReason: $REASON\n\nCommand: $COMMAND\n\nIf this operation is truly needed, ask the user for explicit permission and have them run the command manually."
56+
}
57+
}
58+
EOF
59+
fi
60+
61+
# If allowed, no output (Claude Code proceeds normally)
62+
exit 0

.codebuff/agents/.agents/examples/01-basic-diff-reviewer.js

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.codebuff/agents/.agents/examples/02-intermediate-git-committer.js

Lines changed: 59 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.codebuff/agents/.agents/examples/03-advanced-file-explorer.js

Lines changed: 67 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.codebuff/agents/.agents/my-custom-agent.js

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)