Documentation
¶
Overview ¶
Package agentsetup contains helpers for detecting and configuring AI coding agent integrations.
Index ¶
- Constants
- func DefaultProviders() map[string]Provider
- func RunCommand(ctx context.Context, name string, args ...string) error
- func SupportedProviderIDs(providers map[string]Provider) string
- type ClaudeProvider
- type CodexProvider
- type GrokProvider
- type HomeDirFunc
- type LookPathFunc
- type ManualProvider
- type OpenclawProvider
- type Plan
- type PluginStatus
- type Provider
- func NewClaudeProvider(scanner Scanner, runCommand RunCommandFunc) Provider
- func NewCodexProvider(scanner Scanner, runCommand RunCommandFunc) Provider
- func NewCursorProvider(scanner Scanner) Provider
- func NewGrokProvider(scanner Scanner, runCommand RunCommandFunc) Provider
- func NewKiroProvider(scanner Scanner) Provider
- func NewManualProvider(scanner Scanner, client, binaryName, displayName, manualInstruction string) Provider
- func NewOpenclawProvider(scanner Scanner, runCommand RunCommandFunc) Provider
- type ProviderConfig
- type ReadDirFunc
- type ReadFileFunc
- type RunCommandFunc
- type RunOutputFunc
- type Scanner
- type StatFunc
- type Status
- type WorkDirFunc
Constants ¶
const ( ClientClaudeCode = "claude-code" ClaudeBinaryName = "claude" TargetClaudePlugin = "stripe@claude-plugins-official" ClaudeMarketplace = "claude-plugins-official" ClaudeDisplayName = "Claude Code" )
const ( ClientCodex = "codex" CodexBinaryName = "codex" CodexPluginName = "stripe" CodexDisplayName = "Codex CLI" )
const ( // Cursor requires the user to run a slash command from inside the agent to install the Stripe plugin. ClientCursor = "cursor" CursorBinaryName = "cursor" CursorDisplayName = "Cursor" CursorManualInstruction = "run /add-plugin stripe inside Cursor" )
const ( ClientGrok = "grok" GrokBinaryName = "grok" GrokPluginName = "stripe" GrokDisplayName = "Grok" )
const ( // Kiro requires the user to add the Stripe plugin manually via the website ClientKiro = "kiro" KiroBinaryName = "kiro-cli" KiroDisplayName = "Kiro" KiroManualInstruction = "add plugin by visiting https://kiro.dev/launch/powers/add/?name=stripe" )
const ( ClientOpenclaw = "openclaw" OpenclawBinaryName = "openclaw" OpenclawPluginName = "stripe" OpenclawDisplayName = "OpenClaw" )
const ( StatusNotDetected = "not_detected" StatusInstalled = "installed" StatusMissing = "missing" StatusUnknown = "unknown" StatusError = "error" ActionNone = "none" ActionInstall = "install" ActionReinstall = "reinstall" // ActionManual means setup cannot be automated and the user must perform a // step themselves (e.g. Cursor plugins are installed from inside Cursor). ActionManual = "manual" )
Variables ¶
This section is empty.
Functions ¶
func DefaultProviders ¶
DefaultProviders returns production setup providers keyed by client id.
func RunCommand ¶
RunCommand runs a command silently. Plugin installs run behind a spinner, so streaming subprocess stdio to the terminal would interleave with our animation. On failure, return a single line from the subprocess output.
func SupportedProviderIDs ¶
Types ¶
type ClaudeProvider ¶
type ClaudeProvider struct {
ProviderConfig
}
ClaudeProvider detects and configures the Stripe plugin for Claude Code.
func (ClaudeProvider) Apply ¶
Apply installs the Stripe Claude Code plugin. On failure it silently refreshes the official marketplace and retries once.
func (ClaudeProvider) Detect ¶
func (p ClaudeProvider) Detect() Status
func (ClaudeProvider) ID ¶
func (p ClaudeProvider) ID() string
type CodexProvider ¶
type CodexProvider struct {
ProviderConfig
}
CodexProvider detects and installs the Stripe plugin for Codex CLI.
Detection selects the first available supported marketplace, and installation runs `codex plugin add stripe@<marketplace>` using that selection.
func (CodexProvider) Detect ¶
func (p CodexProvider) Detect() Status
func (CodexProvider) ID ¶
func (p CodexProvider) ID() string
type GrokProvider ¶ added in v1.52.0
type GrokProvider struct {
ProviderConfig
}
GrokProvider detects and installs the Stripe plugin for Grok Build (xAI).
func (GrokProvider) Apply ¶ added in v1.52.0
Apply installs (or updates) the Stripe Grok plugin. Unlike Codex's `plugin add` (see codex.go), `grok plugin install`/`update` exit non-zero on failure and 0 on success, so the exit code can be trusted without a post-install re-check.
func (GrokProvider) Detect ¶ added in v1.52.0
func (p GrokProvider) Detect() Status
func (GrokProvider) ID ¶ added in v1.52.0
func (p GrokProvider) ID() string
type HomeDirFunc ¶
HomeDirFunc matches os.UserHomeDir and exists to make status parsing testable.
type LookPathFunc ¶
LookPathFunc matches exec.LookPath and exists to make detection testable.
type ManualProvider ¶ added in v1.53.1
type ManualProvider struct {
ProviderConfig
ManualInstruction string
}
func (ManualProvider) Detect ¶ added in v1.53.1
func (p ManualProvider) Detect() Status
func (ManualProvider) ID ¶ added in v1.53.1
func (p ManualProvider) ID() string
type OpenclawProvider ¶ added in v1.53.1
type OpenclawProvider struct {
ProviderConfig
}
OpenclawProvider detects and installs the Stripe plugin for Openclaw.
func (OpenclawProvider) Apply ¶ added in v1.53.1
Apply runs each command in the plan in order. The install step is already the last entry in plan.Commands (see Plan), so there is nothing left to run after this loop.
func (OpenclawProvider) Detect ¶ added in v1.53.1
func (p OpenclawProvider) Detect() Status
func (OpenclawProvider) ID ¶ added in v1.53.1
func (p OpenclawProvider) ID() string
func (OpenclawProvider) Plan ¶ added in v1.53.1
func (p OpenclawProvider) Plan(status Status, force bool) Plan
Plan for Openclaw, installing and updating the plugin requires either cloning or pulling the repo beforehand, however installing the plugin after uses the same command `openclaw plugins install`.
type Plan ¶
type Plan struct {
Action string `json:"action"`
// Commands holds the commands to run based on the Action
Commands [][]string `json:"commands,omitempty"`
// Manual holds the instruction shown for ActionManual plans.
Manual string `json:"manual,omitempty"`
}
Plan describes the next setup action for a provider.
type PluginStatus ¶
type PluginStatus struct {
Installed bool `json:"installed"`
ID string `json:"id,omitempty"`
Version string `json:"version,omitempty"`
Scope string `json:"scope,omitempty"`
Project string `json:"project_path,omitempty"`
StatePath string `json:"state_path,omitempty"`
}
PluginStatus is the plugin-specific part of a client setup status.
type Provider ¶
type Provider interface {
ID() string
Detect() Status
Plan(Status, bool) Plan
Apply(context.Context, io.Writer, Plan) error
}
Provider detects and configures Stripe tooling for one AI coding client.
func NewClaudeProvider ¶
func NewClaudeProvider(scanner Scanner, runCommand RunCommandFunc) Provider
NewClaudeProvider returns a Claude Code setup provider.
func NewCodexProvider ¶
func NewCodexProvider(scanner Scanner, runCommand RunCommandFunc) Provider
NewCodexProvider returns a Codex CLI setup provider.
func NewCursorProvider ¶
func NewGrokProvider ¶ added in v1.52.0
func NewGrokProvider(scanner Scanner, runCommand RunCommandFunc) Provider
NewGrokProvider returns a Grok Build setup provider.
func NewKiroProvider ¶ added in v1.53.1
func NewManualProvider ¶ added in v1.53.1
func NewManualProvider(scanner Scanner, client, binaryName, displayName, manualInstruction string) Provider
NewManualProvider returns a setup provider for a client whose plugin must be installed manually; these clients have no CLI installer to run.
func NewOpenclawProvider ¶ added in v1.53.1
func NewOpenclawProvider(scanner Scanner, runCommand RunCommandFunc) Provider
NewOpenclawProvider returns a Openclaw setup provider.
type ProviderConfig ¶ added in v1.52.1
type ProviderConfig struct {
Scanner Scanner
Client string
BinaryName string
DisplayName string
RunCommand RunCommandFunc
RunOutput RunOutputFunc
}
ProviderConfig holds the configuration for a provider.
type ReadDirFunc ¶
ReadDirFunc matches os.ReadDir and exists to make directory listing testable.
type ReadFileFunc ¶
ReadFileFunc matches os.ReadFile and exists to make status parsing testable.
type RunCommandFunc ¶
RunCommandFunc runs a command. The production implementation captures output silently and returns a concise error on failure.
type RunOutputFunc ¶
RunOutputFunc runs a command and returns its standard output. It exists so Codex detection (which shells out to `codex plugin list --json`) is testable.
type Scanner ¶
type Scanner struct {
LookPath LookPathFunc
ReadFile ReadFileFunc
HomeDir HomeDirFunc
WorkDir WorkDirFunc
ReadDir ReadDirFunc
Stat StatFunc
}
Scanner scans local agent installations without mutating them.
func DefaultScanner ¶
func DefaultScanner() Scanner
DefaultScanner returns a Scanner backed by the real OS.
type Status ¶
type Status struct {
Client string `json:"client"`
DisplayName string `json:"display_name"`
Detected bool `json:"detected"`
ExecutablePath string `json:"executable_path,omitempty"`
Plugin PluginStatus `json:"plugin"`
Status string `json:"status"`
Error string `json:"error,omitempty"`
}
Status is the read-only setup status for one AI coding client.
type WorkDirFunc ¶
WorkDirFunc matches os.Getwd and exists to make local plugin scope testable.