agents

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package agents installs bundled mysql-cli skills into AI agents in each agent's native format. It is the Go port of scripts/install-skills.sh and depends only on the standard library; skill content is injected via fs.FS.

Index

Constants

View Source
const (
	Claude   = "claude"
	Cursor   = "cursor"
	Codex    = "codex"
	OpenCode = "opencode"
	Copilot  = "copilot"
	Windsurf = "windsurf"
	Aider    = "aider"
)

Agent name constants.

View Source
const (
	SelAuto = "auto"
	SelAll  = "all"
)

Selection constants for Run.

Variables

AllAgents is the canonical ordered list, matching install-skills.sh.

View Source
var ErrProjectOnly = errors.New("agent is project-only; pass --project-dir")

ErrProjectOnly indicates an agent is project-only and --project-dir was not set.

Functions

func Detect

func Detect(home, projectDir string) []string

Detect returns the agents present on the system, mirroring install-skills.sh detect_agents(). projectDir may be "".

func MergeInstructionFile

func MergeInstructionFile(existing, merged string) string

MergeInstructionFile returns instruction-file content after idempotently replacing the marked mysql-cli block with merged. Absent block => append. Properly idempotent (no whitespace accumulation; improves on the bash script).

func SkillBody

func SkillBody(content string) string

SkillBody returns the body of a SKILL.md: content after the second "---" frontmatter delimiter. Mirrors install-skills.sh skill_body().

func ValidAgent

func ValidAgent(name string) bool

ValidAgent reports whether name is a known agent.

Types

type InstallResult

type InstallResult struct {
	Agent    string   `json:"name"`
	Detected bool     `json:"detected"`
	Paths    []string `json:"paths"`
	Status   string   `json:"status"` // installed | skipped | error
	Error    string   `json:"error,omitempty"`
}

InstallResult is the outcome for one agent.

func Install

func Install(agent string, opts Options) InstallResult

Install installs all skills for one agent per opts.

func Run

func Run(sel string, opts Options) []InstallResult

Run resolves the agent selection and installs skills for each. For SelAuto, agents are detected via Detect; if none detected, defaults to Claude (matching install-skills.sh). Detected reflects actual presence.

type Options

type Options struct {
	Home       string   // user home dir
	ProjectDir string   // project root ("" = no project-level install)
	NoGlobal   bool     // skip global install
	DryRun     bool     // report paths without writing
	FS         fs.FS    // skills subtree (contains <name>/SKILL.md)
	Names      []string // skill names to install
}

Options controls install behavior.

Jump to

Keyboard shortcuts

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