skillref

package
v1.0.89 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package skillref models structured references into the binary-embedded skill tree. It deliberately does not render prose: callers decide which complete help/recovery fragment to keep once a reference resolves.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidRemap = errors.New("invalid skill reference remap")

ErrInvalidRemap identifies malformed, conflicting, or dangling explicit reference mappings. Callers classify it as an invalid SkillsOverlay.

Functions

func ValidSkillName

func ValidSkillName(name string) bool

ValidSkillName reports whether name can identify a top-level skill directory. Keep this rule aligned with the skill-tree manifest validator.

Types

type Mapping

type Mapping struct {
	From Ref
	To   Ref
}

Mapping is one parsed remap. A source without Path remaps the whole skill name; a source with Path is an exact-reference override.

type Ref

type Ref struct {
	Skill string
	Path  string
}

Ref is one exact canonical or runtime skill reference. Path is relative to the named skill; an empty Path denotes the skill's SKILL.md.

func Parse

func Parse(raw string) (Ref, error)

Parse parses the "name[/relative/path]" form accepted by `skills read`.

func (Ref) StatPath

func (r Ref) StatPath() string

StatPath returns the path whose existence makes the reference readable.

func (Ref) String

func (r Ref) String() string

String returns the canonical "name[/relative/path]" form.

type Resolver

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

Resolver is an immutable, build-local projection from canonical references to the composed runtime skill tree. Underlying skill files remain live, in line with the skill manifest contract, so Resolve verifies availability at read/help-render time as well as validating explicit targets at construction.

func New

func New(content fs.FS, mappings []Mapping) (*Resolver, error)

New validates mappings against content and returns an immutable resolver.

Explicit targets are build-integrity declarations and must exist. In contrast, an unmapped canonical reference may be absent: presenters then omit the complete guidance fragment that owns it.

func (*Resolver) Resolve

func (r *Resolver) Resolve(canonical Ref) (target Ref, ok bool)

Resolve projects canonical through the exact-reference map first, then the whole-skill map, and finally identity. It returns ok=false when the projected target is not currently readable.

func (*Resolver) ResolveString

func (r *Resolver) ResolveString(canonical string) (string, bool)

ResolveString is a convenience boundary for metadata that stores references in their canonical string form.

Jump to

Keyboard shortcuts

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