Skip to content

Commit 07cf516

Browse files
committed
feat: auto add modify file to load context
1 parent 83c5f6c commit 07cf516

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

internal/ui/coders/commands.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,31 @@ func (c *CommandExecutor) coding(ctx context.Context, args ...string) error {
342342
}
343343
}
344344

345+
// Check for modified/new files and prompt to save to context
346+
modifiedFiles, err := c.editor.GetModifiedFiles(ctx)
347+
if err != nil {
348+
return err
349+
}
350+
351+
for _, file := range modifiedFiles {
352+
// Check if file is already in loaded contexts
353+
found := false
354+
for _, lc := range c.coder.loadedContexts {
355+
if lc.FilePath == file {
356+
found = true
357+
break
358+
}
359+
}
360+
361+
if !found {
362+
if console.WaitForUserConfirm(console.Yes, fmt.Sprintf("Do you want to add modified file %s to context?", file)) {
363+
if err := c.add(ctx, file); err != nil {
364+
console.RenderError(err, "Failed to add file %s to context", file)
365+
}
366+
}
367+
}
368+
}
369+
345370
return nil
346371
}
347372

0 commit comments

Comments
 (0)