provider

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: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnrichTreeSkillEntry

func EnrichTreeSkillEntry(entry manifest.Entry, content []byte) (manifest.Entry, error)

EnrichTreeSkillEntry applies SKILL.md frontmatter metadata to a tree-scan entry while preserving source and path fields used for install and lock pins.

func ParseMarketplace

func ParseMarketplace(data []byte, owner, repo string) ([]manifest.Entry, error)

ParseMarketplace parses a marketplace.json byte slice and returns catalog entries. Each plugin's skills are flattened into individual entries with Group set to the plugin name.

func ScanTreeForSkills

func ScanTreeForSkills(tree []TreeEntry, owner, repo string) []manifest.Entry

ScanTreeForSkills finds all SKILL.md files in a tree listing and returns catalog entries for each. The skill name is derived from the parent directory. A root-level SKILL.md uses the repo name.

func ScopedPath

func ScopedPath(scope, rel string) string

ScopedPath resolves rel under scope without double-prefixing paths that already include the scope.

Types

type CompositeProvider

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

CompositeProvider dispatches SourceSpec-aware calls to the matching backend.

func NewCompositeProvider

func NewCompositeProvider(github *GitHubProvider) *CompositeProvider

func (*CompositeProvider) Discover

func (p *CompositeProvider) Discover(ctx context.Context, repo string) (*DiscoverResult, error)

func (*CompositeProvider) DiscoverSource

func (p *CompositeProvider) DiscoverSource(ctx context.Context, spec source.SourceSpec) (*DiscoverResult, error)

func (*CompositeProvider) Fetch

func (p *CompositeProvider) Fetch(ctx context.Context, entry manifest.Entry) ([]File, error)

func (*CompositeProvider) FetchSource

func (p *CompositeProvider) FetchSource(ctx context.Context, spec source.SourceSpec, entry manifest.Entry) ([]File, error)

type DiscoverResult

type DiscoverResult struct {
	Entries   []manifest.Entry
	Kits      []KitFile
	KitErrors KitFetchErrors
	IsTeam    bool // true if discovery found a scribe.yaml/toml with a team section
	Manifest  *manifest.Manifest
}

DiscoverResult holds the output of a Discover call.

type File

type File = tools.SkillFile

File is a single file within a downloaded skill directory. Re-exported from tools for caller clarity.

type FilesystemProvider

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

FilesystemProvider discovers and fetches skills from a directory tree.

func NewFilesystemProvider

func NewFilesystemProvider() *FilesystemProvider

func (*FilesystemProvider) Discover

func (p *FilesystemProvider) Discover(ctx context.Context, repo string) (*DiscoverResult, error)

func (*FilesystemProvider) DiscoverSource

func (p *FilesystemProvider) DiscoverSource(ctx context.Context, spec source.SourceSpec) (*DiscoverResult, error)

func (*FilesystemProvider) Fetch

func (p *FilesystemProvider) Fetch(ctx context.Context, entry manifest.Entry) ([]File, error)

func (*FilesystemProvider) FetchSource

func (p *FilesystemProvider) FetchSource(ctx context.Context, spec source.SourceSpec, entry manifest.Entry) ([]File, error)

type GitHubClient

type GitHubClient interface {
	FetchFile(ctx context.Context, owner, repo, path, ref string) ([]byte, error)
	FetchDirectory(ctx context.Context, owner, repo, dirPath, ref string) ([]tools.SkillFile, error)
	LatestCommitSHA(ctx context.Context, owner, repo, branch string) (string, error)
	GetTree(ctx context.Context, owner, repo, ref string) ([]TreeEntry, error)
	HasPushAccess(ctx context.Context, owner, repo string) (bool, error)
}

GitHubClient abstracts the GitHub API operations needed by the provider.

func WrapGitHubClient

func WrapGitHubClient(c *gh.Client) GitHubClient

WrapGitHubClient returns a GitHubClient backed by a real github.Client.

type GitHubProvider

type GitHubProvider struct {
	OnWarning func(msg string) // optional callback for non-fatal warnings
	// contains filtered or unexported fields
}

GitHubProvider discovers and fetches skills from GitHub repositories.

func NewGitHubProvider

func NewGitHubProvider(client GitHubClient) *GitHubProvider

NewGitHubProvider creates a GitHubProvider wrapping the given client.

func (*GitHubProvider) Discover

func (p *GitHubProvider) Discover(ctx context.Context, repo string) (*DiscoverResult, error)

Discover probes the repo using a fallback chain and returns all discovered entries.

func (*GitHubProvider) DiscoverSource

func (p *GitHubProvider) DiscoverSource(ctx context.Context, spec source.SourceSpec) (*DiscoverResult, error)

DiscoverSource probes a GitHub source using the same fallback chain as Discover, scoped to SourceSpec.Path when configured.

func (*GitHubProvider) Fetch

func (p *GitHubProvider) Fetch(ctx context.Context, entry manifest.Entry) ([]File, error)

Fetch downloads all files for a catalog entry from the source repo.

func (*GitHubProvider) FetchSource

func (p *GitHubProvider) FetchSource(ctx context.Context, spec source.SourceSpec, entry manifest.Entry) ([]File, error)

FetchSource downloads an entry from a GitHub source, resolving paths relative to the source scope unless the entry already includes that scope.

type GitProvider

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

GitProvider discovers and fetches skills from arbitrary git repositories by cloning into a temporary directory per operation.

func NewGitProvider

func NewGitProvider() *GitProvider

func (*GitProvider) Discover

func (p *GitProvider) Discover(ctx context.Context, repo string) (*DiscoverResult, error)

func (*GitProvider) DiscoverSource

func (p *GitProvider) DiscoverSource(ctx context.Context, spec source.SourceSpec) (*DiscoverResult, error)

func (*GitProvider) Fetch

func (p *GitProvider) Fetch(ctx context.Context, entry manifest.Entry) ([]File, error)

func (*GitProvider) FetchSource

func (p *GitProvider) FetchSource(ctx context.Context, spec source.SourceSpec, entry manifest.Entry) ([]File, error)

type KitFetchError

type KitFetchError struct {
	Name string
	Path string
	Err  error
}

KitFetchError records one non-fatal kit fetch/pre-parse failure.

func (KitFetchError) Error

func (e KitFetchError) Error() string

func (KitFetchError) Unwrap

func (e KitFetchError) Unwrap() error

type KitFetchErrors

type KitFetchErrors []KitFetchError

KitFetchErrors is a typed partial-error list returned alongside fetched kits.

func (KitFetchErrors) Error

func (e KitFetchErrors) Error() string

type KitFile

type KitFile struct {
	Name string
	Path string
	Body []byte
	Ref  string
}

KitFile is a registry-published kit body fetched during discovery.

type Provider

type Provider interface {
	// Discover probes a repository and returns all discoverable catalog entries.
	// The repo argument is "owner/repo" format.
	Discover(ctx context.Context, repo string) (*DiscoverResult, error)

	// Fetch downloads all files for a single catalog entry.
	// Returns skill files ready to be written to the canonical store.
	Fetch(ctx context.Context, entry manifest.Entry) ([]File, error)
}

Provider abstracts how skills are discovered and fetched from a repository. Different repo formats (scribe.yaml, marketplace.json, bare SKILL.md trees) are handled transparently behind this interface.

type SourceProvider

type SourceProvider interface {
	DiscoverSource(ctx context.Context, spec source.SourceSpec) (*DiscoverResult, error)
	FetchSource(ctx context.Context, spec source.SourceSpec, entry manifest.Entry) ([]File, error)
}

SourceProvider is the transitional SourceSpec-aware provider API. Provider remains stable so existing tests and callers can keep using repo strings.

type TreeEntry

type TreeEntry struct {
	Path string
	Type string // "blob" or "tree"
	SHA  string
}

TreeEntry mirrors github.TreeEntry so the provider package doesn't import github directly.

Jump to

Keyboard shortcuts

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