mirror of
https://github.com/lukaszraczylo/harness-sync.git
synced 2026-10-12 00:45:22 +00:00
- common/mcp.go: MCPStyle enum + BuildMCPMapStyled for claude/crush/opencode/zed dialects - common/jsonmerge.go: MergeJSONKeys (JSON-first, JSONC fallback) preserves user keys; fix: try plain json.Unmarshal before StripJSONComments to avoid mangling URLs with // - common/yamlmerge.go: MergeYAMLKeys for YAML configs (goose) - common/blocks.go: add ProvidersAsMap for opencode map-shaped provider key - claudecode: merge settings.json (preserves hooks/permissions/env); MCPClaudeStyle (no type field) - crush: fix mcp key (was mcpServers); MCPCrushStyle entries include type field; merge crush.json; fix import key mcp - kilo: drop providers key (kilo has none); MCPOpencodeStyle (local/remote); merge kilo.json - opencode: fix provider (singular map) + model (not default_model); MCPOpencodeStyle; merge jsonc; fix import key mcp - goose: new adapter — YAML merge, extensions map, splitProviderModel, import reconstructs MCP from extensions - cagent: new adapter — renders starter default.yaml, import returns empty - zed: new adapter — merge settings.json, context_servers (MCPZedStyle) + agent.default_model - docs: append Grounded harness schemas section to design spec
68 lines
1.5 KiB
Go
68 lines
1.5 KiB
Go
package goose
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
|
|
"gopkg.in/yaml.v3"
|
|
|
|
"github.com/lukaszraczylo/harness-sync/internal/adapter"
|
|
"github.com/lukaszraczylo/harness-sync/internal/canonical"
|
|
)
|
|
|
|
func importFrom(home string) (*adapter.ImportResult, error) {
|
|
cfgPath := filepath.Join(home, ".config", "goose", "config.yaml")
|
|
body, err := os.ReadFile(cfgPath)
|
|
if os.IsNotExist(err) {
|
|
return &adapter.ImportResult{}, nil
|
|
}
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
var raw map[string]any
|
|
if err := yaml.Unmarshal(body, &raw); err != nil {
|
|
return &adapter.ImportResult{}, nil
|
|
}
|
|
|
|
res := &adapter.ImportResult{}
|
|
|
|
// Reconstruct MCP servers from extensions entries with type: stdio.
|
|
if exts, ok := raw["extensions"]; ok {
|
|
if extMap, ok := exts.(map[string]any); ok {
|
|
for name, v := range extMap {
|
|
entry, ok := v.(map[string]any)
|
|
if !ok {
|
|
continue
|
|
}
|
|
t, _ := entry["type"].(string)
|
|
if t != "stdio" {
|
|
continue
|
|
}
|
|
s := canonical.MCPServer{Name: name}
|
|
if cmd, ok := entry["cmd"].(string); ok {
|
|
s.Command = cmd
|
|
}
|
|
if args, ok := entry["args"].([]any); ok {
|
|
for _, a := range args {
|
|
if str, ok := a.(string); ok {
|
|
s.Args = append(s.Args, str)
|
|
}
|
|
}
|
|
}
|
|
if envRaw, ok := entry["env"].(map[string]any); ok {
|
|
s.Env = make(map[string]string, len(envRaw))
|
|
for k, val := range envRaw {
|
|
if str, ok := val.(string); ok {
|
|
s.Env[k] = str
|
|
}
|
|
}
|
|
}
|
|
res.MCP = append(res.MCP, s)
|
|
}
|
|
}
|
|
}
|
|
|
|
return res, nil
|
|
}
|