on main help sign in
remove old logs
commit9ae6af8856ca6a13d575ec6a8989a5f6ee4297b1 authorKujtim Hoxha <kujtimii.h@gmail.com> dateMon 21 Apr 2025, 13:46 (2 years ago) parente7bb99b
3 files changed+13−10
internal/llm/tools/edit.go+6−5 internal/llm/tools/patch.go+4−3 internal/llm/tools/write.go+3−2
internal/llm/tools/edit.go+6−5
@@ -12,6 +12,7 @@ import (
1212 "github.com/kujtimiihoxha/opencode/internal/config"
1313 "github.com/kujtimiihoxha/opencode/internal/diff"
1414 "github.com/kujtimiihoxha/opencode/internal/history"
15+ "github.com/kujtimiihoxha/opencode/internal/logging"
1516 "github.com/kujtimiihoxha/opencode/internal/lsp"
1617 "github.com/kujtimiihoxha/opencode/internal/permission"
1718)
@@ -227,7 +228,7 @@ func (e *editTool) createNewFile(ctx context.Context, filePath, content string)
227228 _, err = e.files.CreateVersion(ctx, sessionID, filePath, content)
228229 if err != nil {
229230 // Log error but don't fail the operation
230− fmt.Printf("Error creating file history version: %v\n", err)
231+ logging.Debug("Error creating file history version", "error", err)
231232 }
232233
233234 recordFileWrite(filePath)
@@ -334,13 +335,13 @@ func (e *editTool) deleteContent(ctx context.Context, filePath, oldString string
334335 // User Manually changed the content store an intermediate version
335336 _, err = e.files.CreateVersion(ctx, sessionID, filePath, oldContent)
336337 if err != nil {
337− fmt.Printf("Error creating file history version: %v\n", err)
338+ logging.Debug("Error creating file history version", "error", err)
338339 }
339340 }
340341 // Store the new version
341342 _, err = e.files.CreateVersion(ctx, sessionID, filePath, "")
342343 if err != nil {
343− fmt.Printf("Error creating file history version: %v\n", err)
344+ logging.Debug("Error creating file history version", "error", err)
344345 }
345346
346347 recordFileWrite(filePath)
@@ -448,13 +449,13 @@ func (e *editTool) replaceContent(ctx context.Context, filePath, oldString, newS
448449 // User Manually changed the content store an intermediate version
449450 _, err = e.files.CreateVersion(ctx, sessionID, filePath, oldContent)
450451 if err != nil {
451− fmt.Printf("Error creating file history version: %v\n", err)
452+ logging.Debug("Error creating file history version", "error", err)
452453 }
453454 }
454455 // Store the new version
455456 _, err = e.files.CreateVersion(ctx, sessionID, filePath, newContent)
456457 if err != nil {
457− fmt.Printf("Error creating file history version: %v\n", err)
458+ logging.Debug("Error creating file history version", "error", err)
458459 }
459460
460461 recordFileWrite(filePath)
internal/llm/tools/patch.go+4−3
@@ -11,6 +11,7 @@ import (
1111 "github.com/kujtimiihoxha/opencode/internal/config"
1212 "github.com/kujtimiihoxha/opencode/internal/diff"
1313 "github.com/kujtimiihoxha/opencode/internal/history"
14+ "github.com/kujtimiihoxha/opencode/internal/logging"
1415 "github.com/kujtimiihoxha/opencode/internal/lsp"
1516 "github.com/kujtimiihoxha/opencode/internal/permission"
1617)
@@ -314,7 +315,7 @@ func (p *patchTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error
314315 // If not adding a file, create history entry for existing file
315316 _, err = p.files.Create(ctx, sessionID, absPath, oldContent)
316317 if err != nil {
317− fmt.Printf("Error creating file history: %v\n", err)
318+ logging.Debug("Error creating file history", "error", err)
318319 }
319320 }
320321
@@ -322,7 +323,7 @@ func (p *patchTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error
322323 // User manually changed content, store intermediate version
323324 _, err = p.files.CreateVersion(ctx, sessionID, absPath, oldContent)
324325 if err != nil {
325− fmt.Printf("Error creating file history version: %v\n", err)
326+ logging.Debug("Error creating file history version", "error", err)
326327 }
327328 }
328329
@@ -333,7 +334,7 @@ func (p *patchTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error
333334 _, err = p.files.CreateVersion(ctx, sessionID, absPath, newContent)
334335 }
335336 if err != nil {
336− fmt.Printf("Error creating file history version: %v\n", err)
337+ logging.Debug("Error creating file history version", "error", err)
337338 }
338339
339340 // Record file operations
internal/llm/tools/write.go+3−2
@@ -11,6 +11,7 @@ import (
1111 "github.com/kujtimiihoxha/opencode/internal/config"
1212 "github.com/kujtimiihoxha/opencode/internal/diff"
1313 "github.com/kujtimiihoxha/opencode/internal/history"
14+ "github.com/kujtimiihoxha/opencode/internal/logging"
1415 "github.com/kujtimiihoxha/opencode/internal/lsp"
1516 "github.com/kujtimiihoxha/opencode/internal/permission"
1617)
@@ -192,13 +193,13 @@ func (w *writeTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error
192193 // User Manually changed the content store an intermediate version
193194 _, err = w.files.CreateVersion(ctx, sessionID, filePath, oldContent)
194195 if err != nil {
195− fmt.Printf("Error creating file history version: %v\n", err)
196+ logging.Debug("Error creating file history version", "error", err)
196197 }
197198 }
198199 // Store the new version
199200 _, err = w.files.CreateVersion(ctx, sessionID, filePath, params.Content)
200201 if err != nil {
201− fmt.Printf("Error creating file history version: %v\n", err)
202+ logging.Debug("Error creating file history version", "error", err)
202203 }
203204
204205 recordFileWrite(filePath)