managed

package
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MethodManagedFile   = "managed-file"
	MethodNativeCommand = "native-command"
	MethodPathProbe     = "path-probe"
)

Variables

View Source
var SupportedAgents = func() []Agent {
	result := make([]Agent, 0, len(adapters))
	for _, adapter := range adapters {
		result = append(result, adapter.Agent())
	}
	return result
}()

SupportedAgents preserves the existing setup/validation API while the adapters own operational behavior.

Functions

func WrapperFor

func WrapperFor(_ Agent) string

Types

type Adapter

type Adapter interface {
	Agent() Agent
	Capabilities() Capabilities
	Detect(context.Context, AdapterEnvironment) Detection
	Install(context.Context, adapterOperation) ([]targetFile, error)
	Remove(context.Context, adapterOperation) ([]targetFile, error)
	Diagnose(context.Context, diagnosticContext) Diagnosis
	Version(context.Context, AdapterEnvironment, Detection) ExecutableVersion
}

Adapter is the capability boundary for a supported coding agent. Install and Remove return mutation plans so Manager can preserve its transactional multi-agent write, backup, rollback, and ownership guarantees.

func AdapterByID

func AdapterByID(id string) (Adapter, bool)

type AdapterEnvironment

type AdapterEnvironment struct {
	Home        string
	LookPath    func(string) (string, error)
	Runner      CommandRunner
	Environment []string
	Timeout     time.Duration
}

func DefaultAdapterEnvironment

func DefaultAdapterEnvironment(home string) AdapterEnvironment

type Agent

type Agent struct {
	ID                   string `json:"id"`
	Name                 string `json:"name"`
	Executable           string `json:"executable"`
	UserPath             string `json:"user_path"`
	ProjectPath          string `json:"project_path"`
	DetectionPath        string `json:"detection_path"`
	SingleFile           bool   `json:"single_file"`
	DependsOnSharedSkill bool   `json:"-"`
}

Agent is the stable, user-visible identity and path contract for an integration. Operational behavior belongs to its Adapter.

func AgentByID

func AgentByID(id string) (Agent, bool)

func Detect

func Detect(home string) []Agent

func DetectWithEnvironment

func DetectWithEnvironment(ctx context.Context, environment AdapterEnvironment) []Agent

type Capabilities

type Capabilities struct {
	DetectMethod   string   `json:"detect_method"`
	InstallMethod  string   `json:"install_method"`
	RemoveMethod   string   `json:"remove_method"`
	DiagnoseMethod string   `json:"diagnose_method"`
	VersionMethod  string   `json:"version_method"`
	Scopes         []string `json:"scopes"`
}

Capabilities makes each adapter's mutation and inspection mechanisms explicit. NativeCommand is used only for the read-only version probe in the current catalog; installation and removal remain managed-file-backed.

type CommandRunner

type CommandRunner interface {
	Run(context.Context, string, []string, []string) ([]byte, error)
}

CommandRunner is the subprocess seam used by safe, side-effect-free adapter probes. Implementations receive argument arrays and an allowlisted environment; adapters never build shell command strings.

type Detection

type Detection struct {
	Detected       bool   `json:"detected"`
	ExecutablePath string `json:"executable_path,omitempty"`
	DetectedBy     string `json:"detected_by,omitempty"`
}

type Diagnosis

type Diagnosis struct {
	Agent                Agent             `json:"agent"`
	Capabilities         Capabilities      `json:"capabilities"`
	Detection            Detection         `json:"detection"`
	ExecutableVersion    ExecutableVersion `json:"executable_version"`
	Installed            bool              `json:"installed"`
	Status               string            `json:"status"`
	Method               string            `json:"method"`
	Scopes               []string          `json:"scopes,omitempty"`
	ExpectedVersion      string            `json:"expected_version"`
	InstalledVersion     string            `json:"installed_version,omitempty"`
	RegistrationID       string            `json:"registration_id,omitempty"`
	Files                []Integrity       `json:"files,omitempty"`
	RepairCommands       []string          `json:"repair_commands,omitempty"`
	ExecutableDiagnostic string            `json:"executable_diagnostic,omitempty"`
}

func (Diagnosis) Summary

func (d Diagnosis) Summary() string

type ExecRunner

type ExecRunner struct{}

func (ExecRunner) Run

func (ExecRunner) Run(ctx context.Context, executable string, args, environment []string) ([]byte, error)

type ExecutableVersion

type ExecutableVersion struct {
	Status string `json:"status"`
	Value  string `json:"value,omitempty"`
	Detail string `json:"detail,omitempty"`
}

type InstallOptions

type InstallOptions struct {
	Agents     []string
	Scope      string
	ProjectDir string
	Force      bool
}

type Integrity

type Integrity struct {
	Path             string `json:"path"`
	Status           string `json:"status"`
	Agent            string `json:"agent,omitempty"`
	Method           string `json:"method,omitempty"`
	Scope            string `json:"scope,omitempty"`
	InstalledVersion string `json:"installed_version,omitempty"`
	Expected         string `json:"expected_digest,omitempty"`
	Actual           string `json:"actual_digest,omitempty"`
}

type Manager

type Manager struct {
	Assets  fs.FS
	Config  *config.Store
	Home    string
	Now     func() time.Time
	Runtime AdapterEnvironment
}

func NewManager

func NewManager(assets fs.FS, cfg *config.Store, home string) *Manager

func (*Manager) Diagnose

func (m *Manager) Diagnose(ctx context.Context) ([]Diagnosis, error)

func (*Manager) DiagnoseAgents

func (m *Manager) DiagnoseAgents(ctx context.Context, selected []string) ([]Diagnosis, error)

func (*Manager) Install

func (m *Manager) Install(options InstallOptions) (Result, error)

func (*Manager) Integrity

func (m *Manager) Integrity() ([]Integrity, error)

func (*Manager) Remove

func (m *Manager) Remove(options InstallOptions) (Result, error)

type Result

type Result struct {
	Installed []string `json:"installed,omitempty"`
	Updated   []string `json:"updated,omitempty"`
	Unchanged []string `json:"unchanged,omitempty"`
	Removed   []string `json:"removed,omitempty"`
	Backups   []string `json:"backups,omitempty"`
}

func (Result) HumanText

func (r Result) HumanText() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL