setup

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 9 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 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 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 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"`
}

Report contains the resolved launcher and ordered per-client effects.

func Run

func Run(opts Options) (Report, 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