agent

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package agent defines the pluggable per-agent behavior gskill installs into, plus a registry of adapters. Concrete adapters (Claude Code, Codex, Cursor, Gemini CLI) live in sibling files and register themselves with a Registry.

Index

Constants

View Source
const DefaultID = "claude"

DefaultID is the agent used when none is specified on the command line and none is detected in the project. Installs default to Claude.

Variables

View Source
var ErrInvalidAgent = errors.New("invalid agent")

ErrInvalidAgent is returned when registering an agent with an empty ID.

Functions

This section is empty.

Types

type Agent

type Agent interface {
	// ID is the stable, lowercase identifier (e.g. "claude").
	ID() string
	// DisplayName is the human-facing name.
	DisplayName() string
	// Detect reports whether this agent is configured for the given project.
	Detect(ctx context.Context, projectRoot string) (bool, error)
	// ProjectSkillDir is the per-project directory skills install into.
	ProjectSkillDir(projectRoot string) string
	// GlobalSkillDir is the user-global directory skills install into.
	GlobalSkillDir(home string) string
	// SupportsSymlinks reports whether the agent tolerates symlinked skills.
	SupportsSymlinks() bool
	// ValidateInstallation checks that a skill installed at skillDir is usable
	// by the agent.
	ValidateInstallation(ctx context.Context, skillDir string) error
}

Agent is the behavior gskill needs from a target AI agent to detect it and place skills into its skill directory (FR-027, FR-031, SC-009).

func NewClaudeCode

func NewClaudeCode() Agent

NewClaudeCode returns the Claude adapter, which stores skills under .claude/skills/<name> (FR-027).

func NewCodex

func NewCodex() Agent

NewCodex returns the Codex adapter, which stores skills under .codex/skills/<name> (FR-027).

func NewCursor

func NewCursor() Agent

NewCursor returns the Cursor adapter, which stores skills under .cursor/skills/<name> (FR-031, SC-009).

func NewGeminiCLI

func NewGeminiCLI() Agent

NewGeminiCLI returns the Gemini CLI adapter, which stores skills under .gemini/skills/<name> (FR-031, SC-009).

type Registry

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

Registry holds the known agent adapters in registration order.

func NewDefaultRegistry

func NewDefaultRegistry() *Registry

NewDefaultRegistry returns a registry populated with the v1 built-in agent adapters in priority order.

func NewRegistry

func NewRegistry() *Registry

NewRegistry returns an empty registry.

func (*Registry) All

func (r *Registry) All() []Agent

All returns every registered agent in registration order.

func (*Registry) Detect

func (r *Registry) Detect(ctx context.Context, projectRoot string) ([]Agent, error)

Detect returns the registered agents that report being configured for projectRoot, preserving registration order.

func (*Registry) Get

func (r *Registry) Get(id string) (Agent, bool)

Get returns the agent with the given ID.

func (*Registry) Register

func (r *Registry) Register(a Agent) error

Register adds a to the registry. It errors on an empty ID or a duplicate.

Jump to

Keyboard shortcuts

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