chore: auto-commit (4 archivos)

- integration_test.go
- main.go
- tool_search.go
- tool_proposal.go

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-14 00:28:22 +02:00
parent 71563d3afc
commit e69b6ab6de
4 changed files with 172 additions and 2 deletions
+65
View File
@@ -199,3 +199,68 @@ func min(a, b int) int {
}
return b
}
func TestIntegration_SearchByTag(t *testing.T) {
root := findRegistryRoot(t)
p := newPipePair()
stop := startServer(t, root, p)
defer stop()
br := bufio.NewReader(p.clientFromServer)
sendJSON(t, p.clientToServer, map[string]any{
"jsonrpc": "2.0", "id": 1, "method": "initialize",
"params": map[string]any{
"protocolVersion": "2025-06-18",
"capabilities": map[string]any{},
"clientInfo": map[string]any{"name": "test", "version": "0"},
},
})
_ = recvJSONUntilID(t, br, 1)
sendJSON(t, p.clientToServer, map[string]any{
"jsonrpc": "2.0", "method": "notifications/initialized",
})
// Single tag filter: 'notebook' must include the jupyter_* family.
sendJSON(t, p.clientToServer, map[string]any{
"jsonrpc": "2.0", "id": 2, "method": "tools/call",
"params": map[string]any{
"name": "fn_search",
"arguments": map[string]any{"query": "", "tag": "notebook", "limit": 20},
},
})
msg := recvJSONUntilID(t, br, 2)
text := msg["result"].(map[string]any)["content"].([]any)[0].(map[string]any)["text"].(string)
if !strings.Contains(text, "jupyter_discover_py_notebook") {
t.Errorf("tag=notebook should return jupyter_discover_py_notebook:\n%s", text[:min(800, len(text))])
}
// CSV tags: AND across — narrower result.
sendJSON(t, p.clientToServer, map[string]any{
"jsonrpc": "2.0", "id": 3, "method": "tools/call",
"params": map[string]any{
"name": "fn_search",
"arguments": map[string]any{"query": "", "tags": "notebook,jupyter", "limit": 20},
},
})
msg = recvJSONUntilID(t, br, 3)
text = msg["result"].(map[string]any)["content"].([]any)[0].(map[string]any)["text"].(string)
// Should still match jupyter_* since they have both tags (if tagged).
// If 'jupyter' tag does not exist this just returns 0 — accept either as valid.
_ = text
// Bogus tag: must return 0.
sendJSON(t, p.clientToServer, map[string]any{
"jsonrpc": "2.0", "id": 4, "method": "tools/call",
"params": map[string]any{
"name": "fn_search",
"arguments": map[string]any{"query": "", "tag": "this-tag-does-not-exist-xyz", "limit": 5},
},
})
msg = recvJSONUntilID(t, br, 4)
text = msg["result"].(map[string]any)["content"].([]any)[0].(map[string]any)["text"].(string)
if !strings.Contains(text, "\"count\": 0") {
t.Errorf("bogus tag should return count=0:\n%s", text[:min(400, len(text))])
}
}