chore: fix homedir

This commit is contained in:
Kujtim Hoxha
2025-07-29 16:05:24 +02:00
parent 0fcad3ba02
commit 4eaa13a7fb
2 changed files with 9 additions and 1 deletions

View File

@@ -156,7 +156,7 @@ func ListDirectory(initialPath string, ignorePatterns []string, limit int) ([]st
return nil
})
if err != nil {
if err != nil && len(results) == 0 {
return nil, truncated, err
}

View File

@@ -121,6 +121,14 @@ func (l *lsTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error) {
searchPath = l.workingDir
}
if searchPath == "~" {
homeDir, err := os.UserHomeDir()
if err != nil {
return ToolResponse{}, fmt.Errorf("error resolving home directory: %w", err)
}
searchPath = homeDir
}
if !filepath.IsAbs(searchPath) {
searchPath = filepath.Join(l.workingDir, searchPath)
}