Skip to content

Commit c1fccd3

Browse files
committed
auto-coder: validate file presence before executing coding command
- Add a check to ensure files are added before executing the coding command - Return an error message if no files are added, guiding users to use the /add command first Signed-off-by: codiing-hui <wecoding@yeah.net>
1 parent 9c917fa commit c1fccd3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

internal/ui/coders/commands.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,10 @@ func (c *CommandExecutor) dropFiles(_ context.Context, _ ...string) error {
225225
}
226226

227227
func (c *CommandExecutor) coding(ctx context.Context, args ...string) error {
228+
if len(c.coder.absFileNames) == 0 {
229+
return errbook.New("No files added. Please use /add to add files first")
230+
}
231+
228232
addedFiles, err := c.getAddedFileContent()
229233
if err != nil {
230234
return err

0 commit comments

Comments
 (0)