add

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadLocalSkillFiles

func ReadLocalSkillFiles(c Candidate) (map[string]string, error)

ReadLocalSkillFiles reads all files from a local skill directory and returns them as a map of "skills/<name>/<relative-path>" → content string. Used when uploading a local-only skill to a registry. Rejects symlinks and files larger than maxFileSize.

Types

type Adder

type Adder struct {
	Client *gh.Client
	Tools  []tools.Tool
	Emit   func(any)
}

Adder wires discovery and GitHub push together. Emits events via the Emit callback — the caller decides output format.

func (*Adder) Add

func (a *Adder) Add(ctx context.Context, targetRepo string, candidates []Candidate) error

Add pushes one or more skills to the target registry's scribe.yaml on GitHub in a single atomic commit. For each candidate: adds a source reference or uploads files + self-reference. Emits events throughout.

func (*Adder) AddPackageRef

func (a *Adder) AddPackageRef(ctx context.Context, targetRepo, packageRepo string) error

AddPackageRef fetches a package manifest from packageRepo and adds a package catalog entry to the target registry's scribe.yaml. The package's declared per-tool install commands (package.installs) are copied into the catalog entry; the global install field is used as a fallback if no per-tool commands are declared.

func (*Adder) DiscoverLocal

func (a *Adder) DiscoverLocal(st *state.State) ([]Candidate, error)

DiscoverLocal scans ~/.claude/skills/ and ~/.scribe/skills/ for skills on disk. Cross-references state for source info. Deduplicates by name (first seen wins).

func (*Adder) DiscoverRemote

func (a *Adder) DiscoverRemote(targetManifest *manifest.Manifest, otherManifests map[string]*manifest.Manifest) []Candidate

DiscoverRemote finds skills in other registries that are not in the target registry. Takes pre-fetched manifests to keep GitHub calls in the cmd layer.

type Candidate

type Candidate struct {
	Name           string // skill name (directory basename)
	Description    string // short description from SKILL.md
	RawDescription string // untruncated description from SKILL.md
	Origin         string // "local" or "registry:owner/repo"
	Package        string // parent package name if sub-skill (e.g. "gstack")
	Source         string // "github:owner/repo@ref" or empty for local-only
	Attribution    discovery.Source
	LocalPath      string // absolute path on disk, empty for remote-only
}

Candidate represents a skill that can be added to a registry.

func (Candidate) NeedsUpload

func (c Candidate) NeedsUpload() bool

NeedsUpload reports whether this candidate requires uploading files to the registry (as opposed to just adding a source reference to scribe.yaml).

type SkillAddErrorMsg

type SkillAddErrorMsg struct {
	Name string
	Err  error
}

SkillAddErrorMsg is sent when adding a skill fails.

type SkillAddedMsg

type SkillAddedMsg struct {
	Name     string
	Registry string
	Source   string
	Upload   bool
}

SkillAddedMsg is sent when a skill is successfully added to the registry.

type SkillAddingMsg

type SkillAddingMsg struct {
	Name   string
	Upload bool
}

SkillAddingMsg is sent when a skill push to GitHub begins.

Jump to

Keyboard shortcuts

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