integrations

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package integrations manages the local configuration and skill files owned by Kivgraph for supported MCP clients. It deliberately keeps each client's schema behind this package so the CLI only deals in targets and scopes.

Index

Constants

View Source
const (
	TargetClaudeCode    = "claude-code"
	TargetClaudeDesktop = "claude-desktop"
	TargetCodex         = "codex"
	TargetOpenCode      = "opencode"
	TargetOhMyPi        = "oh-my-pi"

	ScopeUser    = "user"
	ScopeProject = "project"
)

Variables

View Source
var ErrEndpointNeedsUserScope = errors.New("an endpoint entry carries a token, so it is written only in user scope")

ErrEndpointNeedsUserScope reports an attempt to write a daemon's token into a file that lives in the repository.

View Source
var ErrIncompleteEndpoint = errors.New("an endpoint needs both a url and a token")

ErrIncompleteEndpoint reports an endpoint missing one of its two halves.

Functions

This section is empty.

Types

type Action

type Action string
const (
	ActionInstall Action = "install"
	ActionRemove  Action = "remove"
	ActionStatus  Action = "status"
)

type Endpoint added in v0.6.0

type Endpoint struct {
	// URL is the streamable HTTP endpoint a client connects to.
	URL string
	// Token goes into the entry as an `Authorization: Bearer` header. It is
	// written literally, because no client reads a token out of a file for us,
	// and that is why an endpoint entry refuses project scope: a project file
	// is committed.
	Token string
}

Endpoint is a running daemon's HTTP endpoint.

When it is set, a plan points clients at that url instead of telling each one to spawn `serve`. That is the difference the daemon was built for, and this is the transport it is reachable over. At the load a real editor produces -- most often none at all: 48 of 51 servers in a real event log were asked nothing -- N clients spawning `serve` cost `10 MB` of private pages each against a slope indistinguishable from zero on one daemon, `10`-`13` against `77`-`81 MB` at eight clients. Answering questions is what costs now: `39 MB` per client at 8 calls, `60`-`62` against `323`-`330` at eight. The peak is the widest gap: `179`-`186` against `26`-`29 MB`, because eight editors starting at once pay eight processes. Measured in `benchmarks/daemon-cost`, after ADR 0067 moved the graph read to the first query that needs it.

The two transports are indistinguishable: `9,8`-`10,6 MB` per client over HTTP against `10,0`-`10,7` over the socket. HTTP costs more only under sustained traffic, and no real session produces it.

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager applies integration plans for one local user and one project.

func New

func New(options Options) (Manager, error)

New validates and resolves the local roots used by an integration manager.

func (Manager) DetectMCPTargets

func (manager Manager) DetectMCPTargets(scope Scope) ([]TargetDetection, error)

DetectMCPTargets returns every MCP target supported by the requested scope, marking the targets whose local configuration or installation markers exist.

func (Manager) DetectSkillTargets

func (manager Manager) DetectSkillTargets(scope Scope) ([]TargetDetection, error)

DetectSkillTargets returns every local skill target supported by the requested scope, marking the targets whose local installation markers exist.

func (Manager) InstallMCP

func (manager Manager) InstallMCP(target Target, scope Scope, dryRun, force bool) (Plan, error)

InstallMCP registers the local MCP server, or returns an idempotent plan if the exact Kivgraph-managed entry already exists.

func (Manager) InstallSkill

func (manager Manager) InstallSkill(target Target, scope Scope, dryRun, force bool) (Plan, error)

InstallSkill copies the canonical embedded skill to a client-native path.

func (Manager) RemoveMCP

func (manager Manager) RemoveMCP(target Target, scope Scope, dryRun, force bool) (Plan, error)

RemoveMCP removes only an exact Kivgraph-managed MCP entry. An incompatible entry requires force, even when the target name is the same.

func (Manager) RemoveSkill

func (manager Manager) RemoveSkill(target Target, scope Scope, dryRun, force bool) (Plan, error)

RemoveSkill removes only the exact canonical skill installed by Kivgraph.

func (Manager) StatusMCP

func (manager Manager) StatusMCP(target Target, scope Scope) (Plan, error)

StatusMCP inspects one target without changing its file.

func (Manager) StatusSkill

func (manager Manager) StatusSkill(target Target, scope Scope) (Plan, error)

StatusSkill inspects one client-native skill path.

type Options

type Options struct {
	HomeDir    string
	ProjectDir string
	Executable string
	GOOS       string
	// Endpoint, when set, makes plans point at a running daemon over HTTP
	// rather than at this executable over stdio.
	Endpoint Endpoint
}

Options identifies the filesystem roots used by a Manager. HomeDir and ProjectDir are injectable to make safety checks testable without touching a real client configuration.

type Plan

type Plan struct {
	Action  Action
	Target  Target
	Scope   Scope
	Path    string
	Status  string
	Changed bool
	DryRun  bool
	Detail  string
}

Plan describes an inspected or applied integration operation.

type Scope

type Scope string

type Target

type Target string

func KnownTargets added in v0.3.6

func KnownTargets() []Target

KnownTargets is the vocabulary of clients this package can register, in the order detection reports them. It is a function rather than a slice so no caller can reorder or truncate the list for the next one.

type TargetDetection

type TargetDetection struct {
	Target   Target
	Detected bool
}

TargetDetection reports whether a supported client appears to be installed in the requested scope.

Jump to

Keyboard shortcuts

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