mirror of
https://github.com/lukaszraczylo/harness-sync.git
synced 2026-10-14 00:57:49 +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:
@@ -31,32 +31,7 @@ func BuildMCPMapStyled(reg *canonical.MCPRegistry, style MCPStyle) map[string]an
|
||||
func mcpEntry(s canonical.MCPServer, style MCPStyle) map[string]any {
|
||||
e := map[string]any{}
|
||||
switch style {
|
||||
case MCPClaudeStyle:
|
||||
// Claude Code's actual entry shape uses "type" (not "transport").
|
||||
// Default to stdio when no URL is set.
|
||||
t := s.Transport
|
||||
if s.URL != "" {
|
||||
if t == "" {
|
||||
t = "http"
|
||||
}
|
||||
e["type"] = t
|
||||
e["url"] = s.URL
|
||||
} else {
|
||||
if t == "" {
|
||||
t = "stdio"
|
||||
}
|
||||
e["type"] = t
|
||||
if s.Command != "" {
|
||||
e["command"] = s.Command
|
||||
}
|
||||
if len(s.Args) > 0 {
|
||||
e["args"] = s.Args
|
||||
}
|
||||
if len(s.Env) > 0 {
|
||||
e["env"] = s.Env
|
||||
}
|
||||
}
|
||||
case MCPCrushStyle:
|
||||
case MCPClaudeStyle, MCPCrushStyle:
|
||||
if s.URL != "" {
|
||||
t := s.Transport
|
||||
if t == "" {
|
||||
@@ -65,7 +40,12 @@ func mcpEntry(s canonical.MCPServer, style MCPStyle) map[string]any {
|
||||
e["type"] = t
|
||||
e["url"] = s.URL
|
||||
} else {
|
||||
e["type"] = "stdio"
|
||||
// Claude honours Transport field; Crush always uses "stdio".
|
||||
t := "stdio"
|
||||
if style == MCPClaudeStyle && s.Transport != "" {
|
||||
t = s.Transport
|
||||
}
|
||||
e["type"] = t
|
||||
if s.Command != "" {
|
||||
e["command"] = s.Command
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user