mirror of
https://github.com/lukaszraczylo/harness-sync.git
synced 2026-10-13 00:48:30 +00:00
feat(opencode): adapter with opencode.jsonc render + AGENTS.md
This commit is contained in:
@@ -46,7 +46,7 @@ func TestCrushRenderProducesExpectedTargets(t *testing.T) {
|
||||
func TestCrushImportRoundtrip(t *testing.T) {
|
||||
home := t.TempDir()
|
||||
base := filepath.Join(home, ".config", "crush")
|
||||
require.NoError(t, os.MkdirAll(base, 0o755))
|
||||
require.NoError(t, os.MkdirAll(base, 0o750))
|
||||
|
||||
// Minimal crush.json
|
||||
cfg := map[string]any{
|
||||
@@ -55,7 +55,7 @@ func TestCrushImportRoundtrip(t *testing.T) {
|
||||
},
|
||||
}
|
||||
body, _ := json.Marshal(cfg)
|
||||
require.NoError(t, os.WriteFile(filepath.Join(base, "crush.json"), body, 0o644))
|
||||
require.NoError(t, os.WriteFile(filepath.Join(base, "crush.json"), body, 0o600))
|
||||
|
||||
ad := New(WithHome(home))
|
||||
res, err := ad.Import(home)
|
||||
|
||||
@@ -9,6 +9,18 @@ import (
|
||||
"github.com/lukaszraczylo/harness-sync/internal/canonical"
|
||||
)
|
||||
|
||||
type crushMCPEntry struct { //nolint:govet // fieldalignment: map+slice+3 strings irreducible
|
||||
Env map[string]string `json:"env"`
|
||||
Args []string `json:"args"`
|
||||
Command string `json:"command"`
|
||||
URL string `json:"url"`
|
||||
Transport string `json:"transport"`
|
||||
}
|
||||
|
||||
type crushConfig struct {
|
||||
MCPServers map[string]crushMCPEntry `json:"mcpServers"`
|
||||
}
|
||||
|
||||
func importFrom(home string) (*adapter.ImportResult, error) {
|
||||
cfgPath := filepath.Join(home, ".config", "crush", "crush.json")
|
||||
body, err := os.ReadFile(cfgPath)
|
||||
@@ -19,15 +31,7 @@ func importFrom(home string) (*adapter.ImportResult, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var doc struct {
|
||||
MCPServers map[string]struct {
|
||||
Command string `json:"command"`
|
||||
Args []string `json:"args"`
|
||||
URL string `json:"url"`
|
||||
Transport string `json:"transport"`
|
||||
Env map[string]string `json:"env"`
|
||||
} `json:"mcpServers"`
|
||||
}
|
||||
var doc crushConfig
|
||||
_ = json.Unmarshal(body, &doc)
|
||||
|
||||
res := &adapter.ImportResult{}
|
||||
|
||||
Reference in New Issue
Block a user