setup

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package setup owns local coding-client detection and MCP registration.

Index

Constants

This section is empty.

Variables

View Source
var AllClients = []Client{Codex, Claude}

AllClients lists supported adapters in deterministic application order.

Functions

func CheckRegistration

func CheckRegistration(client Client, home string) (bool, string, error)

CheckRegistration reports whether the selected client has a GitContribute MCP entry without changing its configuration.

func CodexSkillInstalled added in v0.8.0

func CodexSkillInstalled(home string) (bool, string, error)

CodexSkillInstalled reports whether the managed discovery skill is current.

func CodexSkillPath added in v0.8.0

func CodexSkillPath(home string) string

CodexSkillPath returns the managed discovery skill path for a home directory.

func ResolveNPMVersion

func ResolveNPMVersion(version string) (string, error)

ResolveNPMVersion returns a registry-safe package version for CLI installation and private runtime directory names. It removes one release-tag "v" prefix and maps empty or development versions to the explicit "latest" tag.

Types

type ActivationRollbackError added in v0.9.0

type ActivationRollbackError struct {
	Cause    error
	Rollback error
}

ActivationRollbackError reports an activation failure whose rollback could not safely restore every registration.

func (*ActivationRollbackError) Error added in v0.9.0

func (e *ActivationRollbackError) Error() string

func (*ActivationRollbackError) Unwrap added in v0.9.0

func (e *ActivationRollbackError) Unwrap() []error

Unwrap exposes both the activation and rollback failures.

type Client

type Client string

Client identifies a supported coding-agent configuration adapter.

const (
	Codex  Client = "codex"
	Claude Client = "claude"
)

func Detect

func Detect(home string) []Client

Detect returns supported coding clients whose configuration directories are present under home. Detection performs no writes.

type CodexSkillResult added in v0.8.0

type CodexSkillResult struct {
	Path   string `json:"path,omitempty"`
	Status string `json:"status"`
	Error  string `json:"error,omitempty"`
}

CodexSkillResult reports the managed discovery-skill effect.

type Launcher

type Launcher struct {
	Command string   `json:"command"`
	Args    []string `json:"args"`
}

Launcher is the exact process command stored in a coding client's MCP configuration.

func ResolveLauncher

func ResolveLauncher(opts Options) (Launcher, error)

ResolveLauncher returns a durable absolute MCP command. The setup application must first install an ephemeral package-runner executable into a stable product-owned location and pass that path explicitly.

type Operation

type Operation string

Operation identifies whether client-owned MCP entries are configured or removed.

const (
	Configure Operation = "setup"
	Remove    Operation = "remove"
)

type Options

type Options struct {
	Operation  Operation
	Clients    []Client
	All        bool
	DryRun     bool
	Home       string
	Executable string
}

Options controls coding-client MCP registration.

type Report

type Report struct {
	Operation  Operation        `json:"operation"`
	DryRun     bool             `json:"dry_run"`
	Launcher   Launcher         `json:"launcher"`
	Results    []Result         `json:"results"`
	CodexSkill CodexSkillResult `json:"codex_skill,omitempty"`
}

func ActivateExisting added in v0.9.0

func ActivateExisting(ctx context.Context, opts Options) (Report, error)

ActivateExisting updates a set of existing GitContribute registrations as one rollback-safe operation. It never creates a new client registration or changes the optional Codex discovery skill. If activation or verification is interrupted, every selected client configuration is restored.

func ActivateExistingAndVerify added in v0.9.0

func ActivateExistingAndVerify(ctx context.Context, opts Options, verify func() error) (_ Report, returnErr error)

ActivateExistingAndVerify keeps the registration snapshots until verify succeeds, allowing callers to include executable and schema checks in the same rollback boundary.

func Run

func Run(opts Options) (_ Report, returnErr error)

Run validates every selected client, resolves one shared launcher, and then applies or plans each client-owned registration. Dry-run mode performs no writes. Per-client parse/write failures are returned in Report.Results so independent clients can be reported together.

type Result

type Result struct {
	Client Client `json:"client"`
	Path   string `json:"path"`
	Status string `json:"status"`
	Error  string `json:"error,omitempty"`
}

Result describes the registration effect for one coding client.

Jump to

Keyboard shortcuts

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