diff options
| author | Kujtim Hoxha <[email protected]> | 2025-04-14 14:09:17 +0200 |
|---|---|---|
| committer | Kujtim Hoxha <[email protected]> | 2025-04-21 13:41:27 +0200 |
| commit | 0130bde1edabb81d82dbce9d2d562966d2dee133 (patch) | |
| tree | 351436a114f790205460575ba15226ab35d6a1fc /internal/llm/tools/write.go | |
| parent | 0b3e5f5bd42a02c2a15b394b3768e517dc43f39c (diff) | |
| download | opencode-0130bde1edabb81d82dbce9d2d562966d2dee133.tar.gz opencode-0130bde1edabb81d82dbce9d2d562966d2dee133.zip | |
remove node dependency and implement diff format
Diffstat (limited to 'internal/llm/tools/write.go')
| -rw-r--r-- | internal/llm/tools/write.go | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/internal/llm/tools/write.go b/internal/llm/tools/write.go index 8318f2851..ef2ca01f4 100644 --- a/internal/llm/tools/write.go +++ b/internal/llm/tools/write.go @@ -9,7 +9,7 @@ import ( "time" "github.com/kujtimiihoxha/termai/internal/config" - "github.com/kujtimiihoxha/termai/internal/git" + "github.com/kujtimiihoxha/termai/internal/diff" "github.com/kujtimiihoxha/termai/internal/lsp" "github.com/kujtimiihoxha/termai/internal/permission" ) @@ -149,14 +149,13 @@ func (w *writeTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error if sessionID == "" || messageID == "" { return ToolResponse{}, fmt.Errorf("session_id and message_id are required") } - diff, stats, err := git.GenerateGitDiffWithStats( - removeWorkingDirectoryPrefix(filePath), + + diff, additions, removals := diff.GenerateDiff( oldContent, params.Content, + filePath, + filePath, ) - if err != nil { - return ToolResponse{}, fmt.Errorf("error generating diff: %w", err) - } p := w.permissions.Request( permission.CreatePermissionRequest{ Path: filePath, @@ -188,8 +187,8 @@ func (w *writeTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error return WithResponseMetadata(NewTextResponse(result), WriteResponseMetadata{ Diff: diff, - Additions: stats.Additions, - Removals: stats.Removals, + Additions: additions, + Removals: removals, }, ), nil } |
