agents

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package agents handles agent configuration loading and merging.

Index

Constants

This section is empty.

Variables

View Source
var KnownAgents = map[string]AgentDefinition{
	"pi": {
		Name:            "pi",
		DefaultGlobal:   "~/.pi/agent/skills",
		DefaultLocal:    ".pi/skills",
		DetectionPaths:  []string{"~/.pi/agent/skills"},
		DetectionMarker: ".pi",
	},
	"codex": {
		Name:            "codex",
		DefaultGlobal:   "~/.codex/skills",
		DefaultLocal:    ".codex/skills",
		DetectionPaths:  []string{"~/.codex/skills"},
		DetectionMarker: ".codex",
	},
	"claude": {
		Name:            "claude",
		DefaultGlobal:   "~/.claude/skills",
		DefaultLocal:    ".claude/skills",
		DetectionPaths:  []string{"~/.claude/skills"},
		DetectionMarker: ".claude",
	},
}

KnownAgents defines default paths for common agents.

Functions

func ContractPath

func ContractPath(path string) string

ContractPath replaces home directory with ~.

func DetectAgents

func DetectAgents() map[string]bool

DetectAgents scans the filesystem for known agents.

func ExpandPath

func ExpandPath(path string) string

ExpandPath expands ~ to home directory.

func GetSkillPaths

func GetSkillPaths(agentName string) (globalPath, localPath string, err error)

GetSkillPaths returns the global and local paths for an agent.

func SaveAgents

func SaveAgents(cfg *AgentsConfig, scope Scope) error

SaveAgents saves agent configuration to the appropriate scope.

func SelectAgents

func SelectAgents(agents []SelectableAgent) []string

SelectAgents displays an interactive checkbox selector for agents. Returns the list of agents the user selected.

Types

type Agent

type Agent struct {
	Name   string `toml:"name"`
	Global *Path  `toml:"global"`
	Local  *Path  `toml:"local"`
}

Agent represents a single agent's skill paths.

type AgentDefinition

type AgentDefinition struct {
	Name            string
	DefaultGlobal   string
	DefaultLocal    string
	DetectionPaths  []string
	DetectionMarker string
}

AgentDefinition defines how to detect and configure an agent.

type AgentsConfig

type AgentsConfig struct {
	Agents map[string]Agent `toml:"agents"`
}

AgentsConfig represents the agents.toml configuration.

func LoadAgents

func LoadAgents() (*AgentsConfig, error)

LoadAgents loads agent configuration, merging global and local.

type ErrAgentNotFound

type ErrAgentNotFound struct {
	Name string
}

ErrAgentNotFound indicates the requested agent is not configured.

func (*ErrAgentNotFound) Error

func (e *ErrAgentNotFound) Error() string

type ErrNotInProject

type ErrNotInProject struct{}

ErrNotInProject indicates the user is not in a git project.

func (*ErrNotInProject) Error

func (e *ErrNotInProject) Error() string

type Path

type Path struct {
	Value string `toml:"value"`
}

Path represents a skill directory path (absolute or relative).

type ResolvedSkill

type ResolvedSkill struct {
	Name     string
	Agent    string
	Scope    string
	Path     string
	Grimoire grimoire.Grimoire
}

ResolvedSkill represents a skill with its resolved paths.

func ResolveSkills

func ResolveSkills() ([]ResolvedSkill, error)

ResolveSkills returns all skills from all configured agents.

type Scope

type Scope int

Scope represents config scope.

const (
	ScopeGlobal Scope = iota
	ScopeLocal
)

type SelectableAgent

type SelectableAgent struct {
	Name          string
	DefaultGlobal string
	DefaultLocal  string
	Detected      bool // True if skill directory exists
	Selected      bool // Current selection state
	Configured    bool // True if already in config
}

SelectableAgent represents an agent that can be toggled in the selector.

Jump to

Keyboard shortcuts

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