Skip to content

Commit f41614c

Browse files
committed
refactor(adk/skill): use LsInfo to check skill file existence instead of error string matching
1 parent 5548f92 commit f41614c

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

adk/middlewares/skill/filesystem_backend.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,19 @@ func (b *filesystemBackend) list(ctx context.Context) ([]Skill, error) {
101101
}
102102

103103
skillPath := filepath.Join(entry.Path, skillFileName)
104+
105+
infos, err := b.backend.LsInfo(ctx, &filesystem.LsInfoRequest{
106+
Path: skillPath,
107+
})
108+
if err != nil {
109+
return nil, fmt.Errorf("failed to check skill file: %w", err)
110+
}
111+
if len(infos) == 0 {
112+
continue
113+
}
114+
104115
skill, err := b.loadSkillFromFile(ctx, skillPath)
105116
if err != nil {
106-
if strings.Contains(err.Error(), "failed to read file") {
107-
continue
108-
}
109117
return nil, fmt.Errorf("failed to load skill from %s: %w", skillPath, err)
110118
}
111119

0 commit comments

Comments
 (0)