mirror of
https://github.com/imjasonh/cnotes
synced 2026-07-20 04:58:10 +00:00
Complete git notes implementation with clean code
- Fixed git commit detection for compound commands (using contains instead of prefix) - Fixed ToolResponse JSON parsing to extract stdout properly - Removed debug logging and test files - Git notes integration is now fully functional and ready for production use
This commit is contained in:
parent
6bb1d700f2
commit
ae18ff9ea3
10 changed files with 34 additions and 10 deletions
|
|
@ -2,6 +2,7 @@ package handlers
|
|||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"strings"
|
||||
|
|
@ -42,7 +43,19 @@ func AttachConversationToCommit(ctx context.Context, input hooks.HookInput) (hoo
|
|||
// Extract commit hash from tool response/result
|
||||
var gitOutput string
|
||||
if len(input.ToolResponse) > 0 {
|
||||
gitOutput = string(input.ToolResponse)
|
||||
// Parse the JSON response to extract stdout
|
||||
var toolResponse struct {
|
||||
Stdout string `json:"stdout"`
|
||||
Stderr string `json:"stderr"`
|
||||
Interrupted bool `json:"interrupted"`
|
||||
IsImage bool `json:"isImage"`
|
||||
}
|
||||
if err := json.Unmarshal(input.ToolResponse, &toolResponse); err == nil {
|
||||
gitOutput = toolResponse.Stdout
|
||||
} else {
|
||||
// Fallback to raw string if JSON parsing fails
|
||||
gitOutput = string(input.ToolResponse)
|
||||
}
|
||||
} else if len(input.ToolUseResult) > 0 {
|
||||
gitOutput = string(input.ToolUseResult)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue