mirror of
https://github.com/lukaszraczylo/harness-sync.git
synced 2026-10-12 00:45:22 +00:00
refactor: remove dead code, deduplicate defaultHome, simplify mcpEntry + kilo render
Dead code removed: - BuildProviders, buildModels, ProviderEntry (no production callers) - ZedLanguageModels (shadowed by adapter-local version, wrong schema) - GatewayProviderID deprecated constant (zero references) - Corresponding dead tests for BuildProviders Deduplication: - Extract common.DefaultHome() to internal/adapter/common/home.go - All 7 adapters call common.DefaultHome() instead of local copies (-49 lines) Simplification: - mcp.go: merge MCPClaudeStyle/MCPCrushStyle branches (identical URL path, one-line difference in stdio path) — clearer intent, fewer lines - kilo.go: extract opencode.jsonc merge to mergeOpenCodeJSONC() helper, Render() drops from 92 to ~55 lines - goose.go: strings.IndexByte → strings.Cut in splitProviderModel
This commit is contained in:
@@ -9,32 +9,6 @@ import (
|
||||
"github.com/lukaszraczylo/harness-sync/internal/canonical"
|
||||
)
|
||||
|
||||
func TestBuildProvidersGatewayFirst(t *testing.T) {
|
||||
p := &canonical.Profile{
|
||||
Gateway: canonical.Gateway{URL: "https://gw", Token: "t", DefaultModel: "x"},
|
||||
Models: []canonical.Model{{ID: "m1", Alias: "a1"}},
|
||||
Upstreams: []canonical.Upstream{
|
||||
{Name: "anthropic", APIKey: "k", BaseURL: "https://api.anthropic.com"},
|
||||
},
|
||||
}
|
||||
out := BuildProviders(p)
|
||||
require.Len(t, out, 2)
|
||||
assert.Equal(t, "hs-gw", out[0]["id"])
|
||||
assert.Equal(t, "anthropic", out[1]["id"])
|
||||
assert.NotNil(t, out[0]["models"])
|
||||
}
|
||||
|
||||
func TestBuildProvidersNoGateway(t *testing.T) {
|
||||
p := &canonical.Profile{
|
||||
Upstreams: []canonical.Upstream{
|
||||
{Name: "anthropic", APIKey: "k"},
|
||||
},
|
||||
}
|
||||
out := BuildProviders(p)
|
||||
require.Len(t, out, 1)
|
||||
assert.Equal(t, "anthropic", out[0]["id"])
|
||||
}
|
||||
|
||||
func TestBuildMCPMap(t *testing.T) {
|
||||
reg := &canonical.MCPRegistry{Servers: []canonical.MCPServer{
|
||||
{Name: "filepuff", Command: "/bin/x", Transport: "stdio"},
|
||||
|
||||
Reference in New Issue
Block a user