toolsrv: fix Registry.discover() to use .meta files

The Registry had its own discover() method that still required
'ollie:prompt' in file content — the old header-based check that was
removed from DiscoverTools(). This caused tool_load to fail for ALL
tools (not just Go binaries) since .meta is now the sole metadata source.

Fix: delegate to DiscoverTools() which correctly scans .meta files.
This commit is contained in:
Ollie Agent 2026-07-30 22:50:49 +02:00
parent 46a990cd42
commit 5a84e8b326
1 changed files with 4 additions and 21 deletions

View File

@ -3,9 +3,7 @@ package toolsrv
import (
"fmt"
"os"
"path/filepath"
"sort"
"strings"
"sync"
)
@ -30,25 +28,10 @@ func NewRegistry() (*Registry, error) {
// discover scans the tools directory and returns all valid tool infos.
func (r *Registry) discover() map[string]ToolInfo {
dir := ToolsPath()
entries, err := os.ReadDir(dir)
if err != nil {
return nil
}
tools := make(map[string]ToolInfo)
for _, e := range entries {
if e.IsDir() || e.Name() == "idx" || e.Name()[0] == '.' {
continue
}
data, err := os.ReadFile(filepath.Join(dir, e.Name()))
if err != nil {
continue
}
script := string(data)
if !strings.Contains(script, "ollie:prompt") {
continue
}
tools[e.Name()] = ParseToolInfo(e.Name(), script)
infos := DiscoverTools()
tools := make(map[string]ToolInfo, len(infos))
for _, info := range infos {
tools[info.Name] = info
}
return tools
}