agent/cmd/mcp/util.go
Snider e90a84eaa0 feat: merge go-agent + go-agentic + php-devops into unified agent repo
Combines three repositories into a single workspace:
- go-agent → pkg/orchestrator (Clotho), pkg/jobrunner, pkg/loop, cmd/
- go-agentic → pkg/lifecycle (allowance, sessions, plans, dispatch)
- php-devops → repos.yaml, setup.sh, scripts/, .core/

Module path: forge.lthn.ai/core/agent

All packages build, all tests pass.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-06 15:23:00 +00:00

56 lines
934 B
Go

package main
import (
"encoding/json"
"errors"
"os"
"path/filepath"
)
const marketplacePath = ".claude-plugin/marketplace.json"
func findRepoRoot() (string, error) {
cwd, err := os.Getwd()
if err != nil {
return "", err
}
path := cwd
for {
candidate := filepath.Join(path, marketplacePath)
if _, err := os.Stat(candidate); err == nil {
return path, nil
}
parent := filepath.Dir(path)
if parent == path {
break
}
path = parent
}
return "", errors.New("repository root not found")
}
func readJSONFile(path string, target any) error {
data, err := os.ReadFile(path)
if err != nil {
return err
}
return json.Unmarshal(data, target)
}
func readJSONMap(path string) (map[string]any, error) {
data, err := os.ReadFile(path)
if err != nil {
return nil, err
}
var payload map[string]any
if err := json.Unmarshal(data, &payload); err != nil {
return nil, err
}
return payload, nil
}