manifest

package
v1.5.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const EntryTypePackage = "package"

EntryTypePackage is the type value for package catalog entries.

View Source
const KitNamePattern = `^[a-zA-Z0-9._-]+$`

KitNamePattern is the local-safe name shape for registry-published kit refs and kit body names. Keep in sync with internal/kit.

View Source
const LegacyManifestFilename = "scribe.toml"

LegacyManifestFilename is the old TOML-based manifest filename.

View Source
const ManifestFilename = "scribe.yaml"

ManifestFilename is the conventional name for a scribe manifest file.

Variables

This section is empty.

Functions

func NormalizeGitHubRepo

func NormalizeGitHubRepo(s string) (string, error)

NormalizeGitHubRepo returns owner/repo for either a plain owner/repo string or a github.com repository URL. Tree/blob URLs are accepted and normalized to the containing repository; subdirectory-scoped sources need a richer source schema and are intentionally not represented here.

func ParseOwnerRepo

func ParseOwnerRepo(s string) (owner, repo string, err error)

ParseOwnerRepo splits an "owner/repo" string and validates it.

func ScaffoldPackageManifest

func ScaffoldPackageManifest(meta PackageMeta, skills []Skill) ([]byte, error)

ScaffoldPackageManifest builds a parseable package manifest for a new skill package.

func ValidatePackageName

func ValidatePackageName(name string) error

ValidatePackageName checks whether name is suitable for a package manifest.

Types

type Entry

type Entry struct {
	Name        string            `yaml:"name"`
	Source      string            `yaml:"source,omitempty"`
	Path        string            `yaml:"path,omitempty"`
	Type        string            `yaml:"type,omitempty"`
	Install     string            `yaml:"install,omitempty"`  // global fallback install command
	Update      string            `yaml:"update,omitempty"`   // global fallback update command
	Installs    map[string]string `yaml:"installs,omitempty"` // per-tool install commands; override Install
	Updates     map[string]string `yaml:"updates,omitempty"`  // per-tool update commands; override Update
	Author      string            `yaml:"author,omitempty"`
	Description string            `yaml:"description,omitempty"`
	Timeout     int               `yaml:"timeout,omitempty"`
	Group       string            `yaml:"-"` // display-only, set by marketplace discovery
}

Entry represents one item in the catalog list.

func (Entry) InstallFor

func (e Entry) InstallFor(toolName string) string

InstallFor returns the install command for toolName. Per-tool commands take precedence over the global Install fallback.

func (Entry) IsPackage

func (e Entry) IsPackage() bool

IsPackage reports whether this entry is a package-type entry.

func (Entry) Maintainer

func (e Entry) Maintainer() string

Maintainer returns the entry's author.

func (Entry) UpdateFor

func (e Entry) UpdateFor(toolName string) string

UpdateFor returns the update command for toolName. Per-tool commands take precedence over the global Update fallback.

type FileFetcher

type FileFetcher interface {
	FetchFile(ctx context.Context, owner, repo, path, ref string) ([]byte, error)
}

FileFetcher abstracts fetching a single file from a remote repository.

type KitEntry

type KitEntry struct {
	Name        string `yaml:"name"`
	Path        string `yaml:"path,omitempty"`
	Description string `yaml:"description,omitempty"`
	Author      string `yaml:"author,omitempty"`
}

KitEntry represents one registry-published kit advertised by the manifest.

func (KitEntry) PathOrDefault

func (e KitEntry) PathOrDefault() string

PathOrDefault returns the kit body path for this entry.

type LegacyConverter

type LegacyConverter func(data []byte) (*Manifest, error)

LegacyConverter converts raw legacy TOML bytes into a Manifest. Supplied by the caller to avoid an import cycle with the migrate package.

type Manifest

type Manifest struct {
	APIVersion string     `yaml:"apiVersion"`
	Kind       string     `yaml:"kind"`
	Team       *Team      `yaml:"team,omitempty"`
	Package    *Package   `yaml:"package,omitempty"`
	Catalog    []Entry    `yaml:"catalog"`
	Kits       []KitEntry `yaml:"kits,omitempty"`
	Targets    *Targets   `yaml:"targets,omitempty"`
}

Manifest represents a parsed scribe.yaml. A file with team: is a registry; package: is a skill package.

func FetchWithFallback

func FetchWithFallback(ctx context.Context, f FileFetcher, owner, repo string, convert LegacyConverter) (*Manifest, bool, error)

FetchWithFallback fetches and parses a manifest, trying scribe.yaml first then falling back to legacy scribe.toml with automatic conversion. Returns (manifest, isLegacy, error).

func Parse

func Parse(data []byte) (*Manifest, error)

Parse parses scribe.yaml content from a byte slice.

func (*Manifest) Encode

func (m *Manifest) Encode() ([]byte, error)

Encode serializes the manifest to YAML bytes.

func (*Manifest) FindByName

func (m *Manifest) FindByName(name string) *Entry

FindByName returns the first catalog entry with the given name, or nil.

func (*Manifest) IsPackage

func (m *Manifest) IsPackage() bool

IsPackage reports whether this manifest describes a skill package.

func (*Manifest) IsRegistry

func (m *Manifest) IsRegistry() bool

IsRegistry reports whether this manifest describes a team registry.

func (*Manifest) Validate

func (m *Manifest) Validate() error

Validate checks invariants on a parsed manifest.

type Package

type Package struct {
	Name        string            `yaml:"name"`
	Version     string            `yaml:"version"`
	Description string            `yaml:"description,omitempty"`
	License     string            `yaml:"license,omitempty"`
	Authors     []string          `yaml:"authors,omitempty"`
	Repository  string            `yaml:"repository,omitempty"`
	Installs    map[string]string `yaml:"installs,omitempty"` // per-tool install commands
	Updates     map[string]string `yaml:"updates,omitempty"`  // per-tool update commands
}

type PackageMeta

type PackageMeta struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Author      string `json:"author"`
}

PackageMeta contains the package-level fields collected by scribe init.

type Skill

type Skill struct {
	Name string `json:"name"`
	Path string `json:"path"`
}

Skill describes a local skill directory to include in a package manifest.

type Source

type Source struct {
	Host  string // always "github" for now
	Owner string
	Repo  string
	Ref   string // tag or branch name
}

Source is a parsed skill source reference. Format: "github:owner/repo@ref" Ref can be a semver tag (v1.2.3), a non-semver tag (v0.12.9.0), or a branch (main).

func ParseSource

func ParseSource(raw string) (Source, error)

ParseSource parses a source string like "github:owner/repo@ref".

func (Source) IsBranch

func (s Source) IsBranch() bool

IsBranch reports whether the ref looks like a branch name rather than a version tag. Tags follow semver-ish conventions (start with "v" and contain dots).

func (Source) String

func (s Source) String() string

String reassembles the source into its canonical string form.

type Targets

type Targets struct {
	Default []string `yaml:"default"`
}

type Team

type Team struct {
	Name        string `yaml:"name"`
	Description string `yaml:"description,omitempty"`
}

Jump to

Keyboard shortcuts

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