agents

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 6 Imported by: 1 module, 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 agents registers the git-stack MCP server with coding-agent CLIs. Each agent's own CLI is used (`claude mcp`, `codex mcp`); their config files are never edited directly.

Index

Constants

View Source
const ServerName = "git-stack"

ServerName is the MCP server name registered with every agent.

Variables

This section is empty.

Functions

func Available

func Available(ctx context.Context, r exec.Runner, a Agent) bool

Available reports whether the agent's CLI is on PATH.

Types

type Action

type Action int

Action is the outcome of Ensure.

const (
	ActionNone Action = iota
	ActionAdded
	ActionUnchanged
	ActionReplaced
)

func Ensure

func Ensure(ctx context.Context, a Agent, exe string) (Action, error)

Ensure makes the registration point at exe: it adds a missing server and re-adds one registered with a different path. It reports what it did.

func (Action) String

func (a Action) String() string

type Agent

type Agent interface {
	// Name is the human-readable agent name.
	Name() string
	// Binary is the CLI executable looked up on PATH.
	Binary() string
	// Get reads the current registration.
	Get(ctx context.Context) (Registration, error)
	// Add registers `exe mcp` at user scope.
	Add(ctx context.Context, exe string) error
	// Remove unregisters the server. A missing server is not an error.
	Remove(ctx context.Context) error
}

Agent is one coding-agent CLI.

func All

func All(r exec.Runner) []Agent

All returns every supported agent.

type Claude

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

Claude registers with Claude Code (`claude mcp`, user scope, stored in ~/.claude.json by the CLI itself).

func NewClaude

func NewClaude(r exec.Runner) *Claude

NewClaude returns the Claude Code agent.

func (*Claude) Add

func (c *Claude) Add(ctx context.Context, exe string) error

Add runs `claude mcp add --scope user git-stack -- <exe> mcp`. Flags go before the "--"; everything after it is our command line.

func (*Claude) Binary

func (c *Claude) Binary() string

func (*Claude) Get

func (c *Claude) Get(ctx context.Context) (Registration, error)

Get runs `claude mcp get git-stack`. Its output is human-readable; the command line is on a "Command:" line.

func (*Claude) Name

func (c *Claude) Name() string

func (*Claude) Remove

func (c *Claude) Remove(ctx context.Context) error

Remove runs `claude mcp remove --scope user git-stack`.

type Codex

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

Codex registers with OpenAI Codex (`codex mcp`, which writes [mcp_servers.git-stack] to ~/.codex/config.toml).

func NewCodex

func NewCodex(r exec.Runner) *Codex

NewCodex returns the Codex agent.

func (*Codex) Add

func (c *Codex) Add(ctx context.Context, exe string) error

Add runs `codex mcp add git-stack -- <exe> mcp`.

func (*Codex) Binary

func (c *Codex) Binary() string

func (*Codex) Get

func (c *Codex) Get(ctx context.Context) (Registration, error)

Get runs `codex mcp get git-stack --json`.

func (*Codex) Name

func (c *Codex) Name() string

func (*Codex) Remove

func (c *Codex) Remove(ctx context.Context) error

Remove runs `codex mcp remove git-stack`.

type Registration

type Registration struct {
	// Present is true when a server named ServerName exists.
	Present bool
	// Command is the registered executable path, when it could be read.
	Command string
}

Registration describes what an agent currently has for the server.

Jump to

Keyboard shortcuts

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