Skip to content

Commit 6532979

Browse files
committed
update
1 parent 9445ef3 commit 6532979

File tree

3 files changed

+23
-20
lines changed

3 files changed

+23
-20
lines changed

.claude/hooks/claude_agentic_hook.sh

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,10 @@ process_file_write() {
115115
create_trace_entry "Write" "$tool_input"
116116
fi
117117

118-
# For file writes, attribute all lines in the file (since it's newly created/modified)
118+
# For file writes, only attribute the new content, not the entire file
119119
if [ "$ENABLE_ATTRIBUTION" = "true" ] && [ -f "$file_path" ] && [ -n "$content" ]; then
120-
total_lines=$(wc -l < "$file_path")
121-
if [ "$total_lines" -gt 0 ]; then
122-
log "info" "Attributing all $total_lines lines in new file $file_path"
123-
for ((line=1; line<=total_lines; line++)); do
124-
"$GIT_AGENTIC_CMD" attr "$file_path" "$line" ai --agent="$CLAUDE_AGENT_ID" 2>/dev/null || true
125-
done
126-
fi
120+
# Only attribute lines that actually contain the new content
121+
find_new_content_lines "$file_path" "$content"
127122
fi
128123
}
129124

@@ -211,18 +206,8 @@ find_new_content_lines() {
211206
fi
212207
done
213208
else
214-
# Fallback: attribute last few lines if content matching fails
215-
total_lines=$(wc -l < "$file_path")
216-
if [ "$total_lines" -gt 0 ]; then
217-
lines_to_attribute=3 # Attribute last 3 lines as fallback
218-
start_line=$((total_lines - lines_to_attribute + 1))
219-
[ "$start_line" -lt 1 ] && start_line=1
220-
221-
log "debug" "Fallback: Attributing lines $start_line-$total_lines"
222-
for ((line=start_line; line<=total_lines; line++)); do
223-
"$GIT_AGENTIC_CMD" attr "$file_path" "$line" ai --agent="$CLAUDE_AGENT_ID" 2>/dev/null || true
224-
done
225-
fi
209+
# If content matching fails, don't attribute anything - be conservative
210+
log "debug" "Content matching failed for $file_path, not attributing any lines"
226211
fi
227212
}
228213

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"commit": "9445ef3095015baa42a3b46d3816031e7d386858",
3+
"timestamp": "2025-09-27T15:46:11.702496",
4+
"format": "enhanced",
5+
"trace": [
6+
{
7+
"type": "tool_call",
8+
"tool": "Edit",
9+
"args": {
10+
"file_path": "test_integration.py",
11+
"old_string": "def test():",
12+
"new_string": "def test():\n return \"Claude test passed!\""
13+
},
14+
"timestamp": "2025-09-27T22:46:11.3NZ"
15+
}
16+
]
17+
}

src/extension.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Codegen IDE
12
import * as vscode from 'vscode';
23
import { AgentRunsProvider } from './providers/AgentRunsProvider';
34
import { AuthManager } from './auth/AuthManager';

0 commit comments

Comments
 (0)