skill

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package skill locates, installs, and updates the agent skills embedded in the repolens binary.

Index

Constants

View Source
const (
	// WarnModified is returned when a provenance copy has a locally edited body.
	WarnModified = "locally modified; use --force to overwrite"
	// WarnForeign is returned when a same-name file has no repolens provenance.
	WarnForeign = "existing skill has no repolens provenance; use --force to overwrite"
	// WarnUnbundled is returned when a provenance copy names a skill no longer shipped.
	WarnUnbundled = "skill is no longer bundled; left in place"
)

Variables

This section is empty.

Functions

func KnownTargetKeys

func KnownTargetKeys() []string

KnownTargetKeys returns the install target keys in table order.

Types

type Action

type Action int

Action is what Install or Update did (or would do, for DryRun).

const (
	ActionCreated Action = iota
	ActionUpdated
	ActionSkipped
)

func (Action) String

func (a Action) String() string

type Installed

type Installed struct {
	Path    string
	Target  Target
	Name    string
	Version string
	State   State
}

Installed is one copy of a skill found on disk.

func Scan

func Scan(root, version string) ([]Installed, error)

Scan finds installed copies under all known project and personal targets. version is the current binary version, used to classify current vs outdated.

type Options

type Options struct {
	Force  bool
	DryRun bool
}

Options controls write behaviour for Install and Update.

type Result

type Result struct {
	Path    string
	Action  Action
	State   State // state found before writing
	Warning string
}

Result is one target's outcome.

func Install

func Install(s Skill, t Target, version string, opts Options) (Result, error)

Install writes s into t, injecting provenance for version.

func Update

func Update(root, version string, opts Options) ([]Result, error)

Update rewrites provenance copies under root that are outdated relative to version. Copies whose body was edited locally are skipped unless Force is set.

type Scope

type Scope int

Scope is whether a target lives in the project or the user profile.

const (
	ScopeProject Scope = iota
	ScopeGlobal
)

func (Scope) String

func (s Scope) String() string

type Skill

type Skill struct {
	Name        string // directory name, equal to the front matter name
	Alias       string // short name, Name without the "repolens-" prefix
	Description string
	Content     []byte // SKILL.md as embedded, without provenance
}

Skill is a skill shipped inside the binary.

func Builtin

func Builtin() ([]Skill, error)

Builtin returns every skill embedded in the binary, sorted by name.

func Lookup

func Lookup(name string) (Skill, bool, error)

Lookup returns the bundled skill matching name or its short alias.

type State

type State int

State is the classification of a skill copy on disk.

const (
	StateAbsent State = iota
	StateCurrent
	StateOutdated
	StateModified
	StateForeign
)

func (State) String

func (s State) String() string

type Target

type Target struct {
	Key      string
	Dir      string // absolute
	Scope    Scope
	Detected bool
}

Target is a directory an agent product scans for skills.

func Detect

func Detect(root string, scope Scope) ([]Target, error)

Detect returns the targets in scope whose detection signal is present.

func ResolveTargets

func ResolveTargets(root string, scope Scope, keys []string) ([]Target, error)

ResolveTargets maps keys to targets in the given scope. Unknown keys return an error that lists the legal values.

func Targets

func Targets(root string, scope Scope) ([]Target, error)

Targets returns every known install target for scope. Project-scope detection signals are evaluated against root; global-scope directories and their detection signals are both resolved from the user home directory, so --global picks the agent products the user actually installed rather than whatever the current repository happens to configure.

Jump to

Keyboard shortcuts

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