skillsdoc

package
v0.50.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const HeadMatterSpec = "YAML front-matter delimited by '---' with required keys: name, version, description, requires.bins[]"

HeadMatterSpec is the exact YAML front-matter schema we expect at the top of each *.SKILL.md file.

The front-matter MUST be the first thing in the file and MUST be delimited by two lines containing only "---".

Required keys:

  • name: string (unique skill name; recommended to match file base name)
  • version: string (semver-like, eg "0.1.0")
  • description: string (one-line summary)
  • requires: bins: [string] (CLI binaries required; for now always includes "ivcap")

Example:

--- name: ivcap-job-create version: 0.1.0 description: Create an IVCAP job from a service. requires:

bins: ["ivcap"]

---

Variables

This section is empty.

Functions

func Tokenize added in v0.50.1

func Tokenize(text string) []string

Tokenize lower-cases text and splits it on anything that is not a letter or digit, so "ivcap-job-create" becomes ["ivcap" "job" "create"]. No stemming or stop-word removal is done: BM25's IDF already discounts common words.

Types

type HeadMatter

type HeadMatter struct {
	Name        string   `yaml:"name" json:"name"`
	Version     string   `yaml:"version" json:"version"`
	Description string   `yaml:"description" json:"description"`
	Requires    Requires `yaml:"requires" json:"requires"`
}

type Requires

type Requires struct {
	Bins []string `yaml:"bins" json:"bins"`
}

type SearchResult added in v0.50.1

type SearchResult struct {
	Doc   *SkillDoc
	Score float64
}

SearchResult is a skill doc together with its BM25 relevance score.

func Search(docs []*SkillDoc, query string) []SearchResult

Search ranks docs against query using BM25 and returns only docs that match at least one query term, best first. Ties are broken by skill name so the output is deterministic. An empty query (or one without any searchable terms) returns no results.

The corpus is small and fixed (embedded in the binary), so the index is simply built on every call.

type SkillDoc

type SkillDoc struct {
	HeadMatter

	// Path is a stable, repo-like path, eg "skills/ivcap-job-create.SKILL.md".
	Path string `json:"path" yaml:"path"`

	// SHA256 is the hex digest of the full file content (including front-matter).
	SHA256 string `json:"sha256" yaml:"sha256"`

	// Content is the full SKILL.md content (including front-matter).
	Content string `json:"content,omitempty" yaml:"content,omitempty"`
}

func FindByName

func FindByName(docs []*SkillDoc, name string) *SkillDoc

func LoadAllSkillDocs

func LoadAllSkillDocs(fsys fs.FS) ([]*SkillDoc, error)

func ParseSkillDoc

func ParseSkillDoc(path string, content []byte) (*SkillDoc, error)

Jump to

Keyboard shortcuts

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