on main help sign in
remove old logs
9ae6af8Kujtim Hoxha
internal/llm/tools/edit.go+6−5
@@ -12,6 +12,7 @@ import (
12 "github.com/kujtimiihoxha/opencode/internal/config"
12 "github.com/kujtimiihoxha/opencode/internal/config"
13 "github.com/kujtimiihoxha/opencode/internal/diff"
13 "github.com/kujtimiihoxha/opencode/internal/diff"
14 "github.com/kujtimiihoxha/opencode/internal/history"
14 "github.com/kujtimiihoxha/opencode/internal/history"
15+ "github.com/kujtimiihoxha/opencode/internal/logging"
15 "github.com/kujtimiihoxha/opencode/internal/lsp"
16 "github.com/kujtimiihoxha/opencode/internal/lsp"
16 "github.com/kujtimiihoxha/opencode/internal/permission"
17 "github.com/kujtimiihoxha/opencode/internal/permission"
17)
18)
@@ -227,7 +228,7 @@ func (e *editTool) createNewFile(ctx context.Context, filePath, content string)
227 _, err = e.files.CreateVersion(ctx, sessionID, filePath, content)
228 _, err = e.files.CreateVersion(ctx, sessionID, filePath, content)
228 if err != nil {
229 if err != nil {
229 // Log error but don't fail the operation
230 // 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)
231 }
232 }
232
233
233 recordFileWrite(filePath)
234 recordFileWrite(filePath)
@@ -334,13 +335,13 @@ func (e *editTool) deleteContent(ctx context.Context, filePath, oldString string
334 // User Manually changed the content store an intermediate version
335 // User Manually changed the content store an intermediate version
335 _, err = e.files.CreateVersion(ctx, sessionID, filePath, oldContent)
336 _, err = e.files.CreateVersion(ctx, sessionID, filePath, oldContent)
336 if err != nil {
337 if err != nil {
337− fmt.Printf("Error creating file history version: %v\n", err)
338+ logging.Debug("Error creating file history version", "error", err)
338 }
339 }
339 }
340 }
340 // Store the new version
341 // Store the new version
341 _, err = e.files.CreateVersion(ctx, sessionID, filePath, "")
342 _, err = e.files.CreateVersion(ctx, sessionID, filePath, "")
342 if err != nil {
343 if err != nil {
343− fmt.Printf("Error creating file history version: %v\n", err)
344+ logging.Debug("Error creating file history version", "error", err)
344 }
345 }
345
346
346 recordFileWrite(filePath)
347 recordFileWrite(filePath)
@@ -448,13 +449,13 @@ func (e *editTool) replaceContent(ctx context.Context, filePath, oldString, newS
448 // User Manually changed the content store an intermediate version
449 // User Manually changed the content store an intermediate version
449 _, err = e.files.CreateVersion(ctx, sessionID, filePath, oldContent)
450 _, err = e.files.CreateVersion(ctx, sessionID, filePath, oldContent)
450 if err != nil {
451 if err != nil {
451− fmt.Printf("Error creating file history version: %v\n", err)
452+ logging.Debug("Error creating file history version", "error", err)
452 }
453 }
453 }
454 }
454 // Store the new version
455 // Store the new version
455 _, err = e.files.CreateVersion(ctx, sessionID, filePath, newContent)
456 _, err = e.files.CreateVersion(ctx, sessionID, filePath, newContent)
456 if err != nil {
457 if err != nil {
457− fmt.Printf("Error creating file history version: %v\n", err)
458+ logging.Debug("Error creating file history version", "error", err)
458 }
459 }
459
460
460 recordFileWrite(filePath)
461 recordFileWrite(filePath)
internal/llm/tools/patch.go+4−3
@@ -11,6 +11,7 @@ import (
11 "github.com/kujtimiihoxha/opencode/internal/config"
11 "github.com/kujtimiihoxha/opencode/internal/config"
12 "github.com/kujtimiihoxha/opencode/internal/diff"
12 "github.com/kujtimiihoxha/opencode/internal/diff"
13 "github.com/kujtimiihoxha/opencode/internal/history"
13 "github.com/kujtimiihoxha/opencode/internal/history"
14+ "github.com/kujtimiihoxha/opencode/internal/logging"
14 "github.com/kujtimiihoxha/opencode/internal/lsp"
15 "github.com/kujtimiihoxha/opencode/internal/lsp"
15 "github.com/kujtimiihoxha/opencode/internal/permission"
16 "github.com/kujtimiihoxha/opencode/internal/permission"
16)
17)
@@ -314,7 +315,7 @@ func (p *patchTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error
314 // If not adding a file, create history entry for existing file
315 // If not adding a file, create history entry for existing file
315 _, err = p.files.Create(ctx, sessionID, absPath, oldContent)
316 _, err = p.files.Create(ctx, sessionID, absPath, oldContent)
316 if err != nil {
317 if err != nil {
317− fmt.Printf("Error creating file history: %v\n", err)
318+ logging.Debug("Error creating file history", "error", err)
318 }
319 }
319 }
320 }
320
321
@@ -322,7 +323,7 @@ func (p *patchTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error
322 // User manually changed content, store intermediate version
323 // User manually changed content, store intermediate version
323 _, err = p.files.CreateVersion(ctx, sessionID, absPath, oldContent)
324 _, err = p.files.CreateVersion(ctx, sessionID, absPath, oldContent)
324 if err != nil {
325 if err != nil {
325− fmt.Printf("Error creating file history version: %v\n", err)
326+ logging.Debug("Error creating file history version", "error", err)
326 }
327 }
327 }
328 }
328
329
@@ -333,7 +334,7 @@ func (p *patchTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error
333 _, err = p.files.CreateVersion(ctx, sessionID, absPath, newContent)
334 _, err = p.files.CreateVersion(ctx, sessionID, absPath, newContent)
334 }
335 }
335 if err != nil {
336 if err != nil {
336− fmt.Printf("Error creating file history version: %v\n", err)
337+ logging.Debug("Error creating file history version", "error", err)
337 }
338 }
338
339
339 // Record file operations
340 // Record file operations
internal/llm/tools/write.go+3−2
@@ -11,6 +11,7 @@ import (
11 "github.com/kujtimiihoxha/opencode/internal/config"
11 "github.com/kujtimiihoxha/opencode/internal/config"
12 "github.com/kujtimiihoxha/opencode/internal/diff"
12 "github.com/kujtimiihoxha/opencode/internal/diff"
13 "github.com/kujtimiihoxha/opencode/internal/history"
13 "github.com/kujtimiihoxha/opencode/internal/history"
14+ "github.com/kujtimiihoxha/opencode/internal/logging"
14 "github.com/kujtimiihoxha/opencode/internal/lsp"
15 "github.com/kujtimiihoxha/opencode/internal/lsp"
15 "github.com/kujtimiihoxha/opencode/internal/permission"
16 "github.com/kujtimiihoxha/opencode/internal/permission"
16)
17)
@@ -192,13 +193,13 @@ func (w *writeTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error
192 // User Manually changed the content store an intermediate version
193 // User Manually changed the content store an intermediate version
193 _, err = w.files.CreateVersion(ctx, sessionID, filePath, oldContent)
194 _, err = w.files.CreateVersion(ctx, sessionID, filePath, oldContent)
194 if err != nil {
195 if err != nil {
195− fmt.Printf("Error creating file history version: %v\n", err)
196+ logging.Debug("Error creating file history version", "error", err)
196 }
197 }
197 }
198 }
198 // Store the new version
199 // Store the new version
199 _, err = w.files.CreateVersion(ctx, sessionID, filePath, params.Content)
200 _, err = w.files.CreateVersion(ctx, sessionID, filePath, params.Content)
200 if err != nil {
201 if err != nil {
201− fmt.Printf("Error creating file history version: %v\n", err)
202+ logging.Debug("Error creating file history version", "error", err)
202 }
203 }
203
204
204 recordFileWrite(filePath)
205 recordFileWrite(filePath)