Documentation
¶
Index ¶
- func NewChiAPI() (chi.Router, huma.API)
- func ParseFrontmatter(content string) (map[string]interface{}, string, error)
- func RegisterRoutes(api huma.API, router chi.Router, store *Store, storage platform.Storage, ...)
- func Unpack(r io.Reader, destDir string) error
- type Alias
- type FileEntry
- type ListOptions
- type Skill
- type SpecValidation
- type Store
- func (s *Store) BulkSetReview(ctx context.Context, names []string, reviewedBy string) (int, error)
- func (s *Store) ClearReview(ctx context.Context, name string) error
- func (s *Store) Create(ctx context.Context, name, displayName, description, content string, ...) (*Skill, error)
- func (s *Store) CreateAlias(ctx context.Context, alias, canonical string) error
- func (s *Store) CreateVersion(ctx context.Context, skillID, archivePath, checksum, changelog string, ...) (*Version, error)
- func (s *Store) Delete(ctx context.Context, name string) error
- func (s *Store) DeleteAlias(ctx context.Context, alias string) error
- func (s *Store) GetByName(ctx context.Context, name string) (*Skill, error)
- func (s *Store) GetVersion(ctx context.Context, skillName string, version int) (*Version, error)
- func (s *Store) List(ctx context.Context, opts ListOptions) ([]Skill, int, error)
- func (s *Store) ListAliases(ctx context.Context, canonical string) ([]Alias, error)
- func (s *Store) ListVersions(ctx context.Context, skillName string) ([]Version, error)
- func (s *Store) Merge(ctx context.Context, sourceName, targetName string) (*Skill, error)
- func (s *Store) ResolveAlias(ctx context.Context, name string) (string, error)
- func (s *Store) Search(ctx context.Context, query string, limit int) ([]Skill, error)
- func (s *Store) SetReview(ctx context.Context, name, reviewedBy string) error
- func (s *Store) UpdateSpecFields(ctx context.Context, ...) error
- type Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewChiAPI ¶
NewChiAPI creates a new Chi router and Huma API suitable for production and tests. Returns both so callers can mount additional middleware on the router or serve it directly.
func ParseFrontmatter ¶
ParseFrontmatter parses YAML frontmatter from content delimited by "---\n" blocks. It returns the frontmatter as a map, the body (content after the closing delimiter), and any error.
If no frontmatter is found (content does not start with "---\n"), it returns nil, content, nil.
func RegisterRoutes ¶
func RegisterRoutes(api huma.API, router chi.Router, store *Store, storage platform.Storage, ext ...*scan.ExternalScanner)
RegisterRoutes wires up all skill-related HTTP endpoints onto the provided Huma API and Chi router. The router is needed for the two raw-response routes (download + scan) that stream bytes rather than returning JSON.
Types ¶
type ListOptions ¶ added in v0.7.0
ListOptions holds optional filter parameters for List.
type Skill ¶
type Skill struct {
ID string `json:"id"`
Name string `json:"name"`
DisplayName string `json:"display_name,omitempty"`
Description string `json:"description"`
Content string `json:"content,omitempty"`
LatestVersion int `json:"latest_version"`
Frontmatter json.RawMessage `json:"frontmatter"`
Author string `json:"author"`
License string `json:"license"`
Compatibility string `json:"compatibility"`
Tags []string `json:"tags"`
SpecCompliance string `json:"spec_compliance"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
ReviewedAt *time.Time `json:"reviewed_at"`
ReviewedBy string `json:"reviewed_by"`
}
Skill represents a skill entry in the registry.
type SpecValidation ¶ added in v0.7.0
type SpecValidation struct {
Compliance string
Author string
License string
Compat string
Tags []string
DisplayName string
Warnings []string
}
SpecValidation holds the result of validating a skill's frontmatter against the Agent Skills spec format.
func ValidateSpec ¶ added in v0.7.0
func ValidateSpec(fm map[string]interface{}, skillName string) *SpecValidation
ValidateSpec extracts spec-defined metadata from parsed frontmatter and computes a compliance level ("full", "partial", or "none").
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store handles Postgres persistence for skills and their versions.
func (*Store) BulkSetReview ¶
BulkSetReview marks multiple skills as reviewed in a single UPDATE. Returns the number of rows actually updated.
func (*Store) ClearReview ¶
ClearReview removes the review mark from a skill.
func (*Store) Create ¶
func (s *Store) Create(ctx context.Context, name, displayName, description, content string, frontmatter json.RawMessage) (*Skill, error)
Create inserts a new skill row and returns the created record.
func (*Store) CreateAlias ¶
func (*Store) CreateVersion ¶
func (s *Store) CreateVersion( ctx context.Context, skillID, archivePath, checksum, changelog string, description, content string, frontmatter json.RawMessage, manifest []FileEntry, scanResult json.RawMessage, publishedBy string, ) (*Version, error)
CreateVersion increments latest_version on the parent skill, updates its description/content/frontmatter, and inserts a new skill_versions row, all within a single transaction.
func (*Store) GetByName ¶
GetByName retrieves a skill by its unique name. Returns nil, nil when not found.
func (*Store) GetVersion ¶
GetVersion retrieves a specific version of a skill. Returns nil, nil if not found.
func (*Store) List ¶
List returns a paginated slice of skills along with the total row count. Filters are applied when the corresponding ListOptions fields are non-empty.
func (*Store) ListAliases ¶
func (*Store) ListVersions ¶
ListVersions returns all versions for a skill ordered by version DESC.
func (*Store) ResolveAlias ¶
func (*Store) Search ¶
Search returns skills matching the given query using a combination of Postgres full-text search (websearch_to_tsquery + ts_rank on search_vector) and pg_trgm fuzzy name matching (similarity()). Results are returned where either FTS matches OR name similarity exceeds 0.2, ordered by FTS rank then trigram rank. Limit caps the number of returned results.
type Version ¶
type Version struct {
ID string `json:"id"`
SkillID string `json:"skill_id"`
Version int `json:"version"`
ArchivePath string `json:"-"`
Checksum string `json:"checksum"`
Changelog string `json:"changelog"`
Frontmatter json.RawMessage `json:"frontmatter"`
FileManifest []FileEntry `json:"file_manifest"`
ScanResult json.RawMessage `json:"scan_result,omitempty"`
PublishedBy string `json:"published_by"`
CreatedAt time.Time `json:"created_at"`
}
Version represents a specific published version of a skill.