Documentation
¶
Overview ¶
Package skillsync installs immutable, CLI-pinned Agent Skills bundles into supported harness directories. It owns no command framework or product policy: callers supply their identity, embedded bundle snapshots, targets, and any host-specific error mapping.
Index ¶
- Constants
- Variables
- func CompareVersions(a, b string) (int, error)
- func Compatible(current string, c Compatibility) bool
- func Digest(source fs.FS) (string, error)
- func DigestWithExecutables(source fs.FS, executablePaths []string) (string, error)
- func NormalizeExecutablePaths(source fs.FS, paths []string) ([]string, error)
- func ValidateDescriptor(d BundleDescriptor) error
- func ValidateTarget(dir string) (string, error)
- type Action
- type Bundle
- type BundleDescriptor
- type Change
- type Compatibility
- type Config
- type Identity
- type LegacyImport
- type Options
- type Outcome
- type PluginIdentity
- type Prepared
- type ReleaseResolver
- type ReleaseSource
- type Report
- type ResolvedBundle
- type Resolver
- type Skill
- type Source
- type Status
Constants ¶
const StateFileName = ".cli-helpers-skills-sync.json"
StateFileName is deliberately provider-neutral and stores only verified ownership/provenance, never mutable source content.
Variables ¶
var ( ErrInvalidConfig = errors.New("invalid skills sync configuration") ErrDigestMismatch = errors.New("bundle digest mismatch") ErrStateCorrupt = errors.New("skills sync state is corrupt") ErrRecoveryPending = errors.New("skills sync recovery is pending") ErrNoNewerCompatible = errors.New("no newer compatible bundle") ErrSearchIncomplete = errors.New("newer-compatible release search incomplete") )
Functions ¶
func CompareVersions ¶
CompareVersions compares two validated semantic versions.
func Compatible ¶
func Compatible(current string, c Compatibility) bool
Compatible reports whether a semantic CLI version satisfies compatibility.
func Digest ¶
Digest returns a deterministic SHA-256 of source bytes and executable mode. For embed.FS callers, use DigestWithExecutables with the source descriptor's explicit executable paths.
func DigestWithExecutables ¶
func NormalizeExecutablePaths ¶
NormalizeExecutablePaths returns the complete sorted executable manifest. It combines declared paths with executable modes carried by a local source filesystem, which embedding otherwise loses.
func ValidateDescriptor ¶
func ValidateDescriptor(d BundleDescriptor) error
ValidateDescriptor verifies provenance and descriptor-only fields before a remote adapter uses them for release selection. Content and executable-file existence are verified later by EmbeddedBundle.
func ValidateTarget ¶
ValidateTarget normalizes a target path and rejects symlinked or non- directory existing ancestors. It permits only the verified macOS /tmp and /var system aliases, returning their canonical path for callers that must deduplicate targets before writing them.
Types ¶
type Bundle ¶
type Bundle struct {
Plugin PluginIdentity
Source Source
FS fs.FS
ExecutablePaths []string
}
Bundle is an immutable source snapshot. Source is its sole provenance and version authority. ExecutablePaths preserves the executable bits that embed.FS cannot represent.
func EmbeddedBundle ¶
func EmbeddedBundle(d BundleDescriptor, content fs.FS) (Bundle, error)
EmbeddedBundle binds one canonical embedded tree to its immutable metadata.
type BundleDescriptor ¶
type BundleDescriptor struct {
Plugin PluginIdentity `json:"plugin"`
Source Source `json:"source"`
ExecutablePaths []string `json:"executable_paths,omitempty"`
}
BundleDescriptor is serializable build metadata. EmbeddedBundle is the common loader for go:embed snapshots, so hosts need not duplicate fs.Sub, source-provenance validation, or digest checks.
type Change ¶
type Change struct {
Plugin PluginIdentity `json:"plugin"`
Name string `json:"name"`
Action Action `json:"action"`
Outcome Outcome `json:"outcome,omitempty"`
Reason string `json:"reason,omitempty"`
}
type Compatibility ¶
type Compatibility struct {
MinCLI string `json:"min_cli,omitempty"`
MaxCLI string `json:"max_cli,omitempty"`
}
Compatibility limits the CLI versions a bundle can be installed by. Empty bounds are open; values use numeric dot-separated versions, optionally with a leading "v". Pre-release selection is intentionally host policy.
type Config ¶
Config declares the installed CLI and its offline matched snapshots. A development build may use an undetermined CurrentVersion only when its embedded matched bundles declare no compatibility bounds; it never selects a newer release by default.
type Identity ¶
Identity identifies the CLI that supplied a bundle. It is recorded as provenance only; plugin ownership always uses PluginIdentity.
type LegacyImport ¶
type LegacyImport struct {
MarkerFile string
Plugin PluginIdentity
}
LegacyImport enables only a host's explicit one-time marker migration. MarkerFile is relative to the target directory and Plugin is the identity that will own matching, verified legacy skills.
type Options ¶
type Options struct {
Dir string
DryRun bool
PreferNewerCompatible bool
Resolver Resolver
LockTimeout time.Duration
Legacy LegacyImport
}
Options supplies a target and controls whether Sync changes it. Resolver is reserved for explicit newer-compatible bundle selection; normal sync never calls it and therefore never requires network access.
type Outcome ¶
type Outcome string
Outcome tells callers whether a planned mutation reached durable ownership. Conflict and unchanged entries deliberately have no mutation outcome.
type PluginIdentity ¶
PluginIdentity is globally stable and deliberately separate from a skill directory name, which avoids flat-directory collisions between products.
func (PluginIdentity) String ¶
func (p PluginIdentity) String() string
type Prepared ¶
type Prepared struct {
// contains filtered or unexported fields
}
Prepared is one validated, immutable source selection. A host that syncs multiple harnesses prepares it once, then uses Sync for every target so an explicit newer-compatible resolver cannot select different releases midway through a command.
type ReleaseResolver ¶
type ReleaseResolver struct {
Source ReleaseSource
CurrentVersion string
}
ReleaseResolver is the standard explicit newer-compatible adapter. Put it in Options.Resolver at CLI wiring time; ordinary sync does not invoke it.
type ReleaseSource ¶
type ReleaseSource interface {
NewerCompatible(context.Context, Source, string) (BundleDescriptor, fs.FS, error)
}
ReleaseSource retrieves one newer source snapshot chosen against a CLI version. Implementations may read a signed release archive or a local cache; the shared resolver still validates its immutable descriptor and content digest before it reaches Sync.
type Report ¶
type Report struct {
Dir string `json:"dir"`
CLI Identity `json:"cli"`
CLIVersion string `json:"cli_version"`
DryRun bool `json:"dry_run"`
Bundles []ResolvedBundle `json:"bundles"`
Changes []Change `json:"changes"`
}
func Sync ¶
Sync validates all bundles before touching a target, then applies a plugin-scoped plan under a target lock. It defaults to the embedded bundle snapshots supplied in Config and never contacts a Resolver unless the caller explicitly selected PreferNewerCompatible.
func (Report) ChangesFor ¶
ChangesFor returns action-matched changes, optionally limited to exact mutation outcomes. It keeps renderers from mistaking restored work for a completed update.
type ResolvedBundle ¶
type ResolvedBundle struct {
Plugin PluginIdentity `json:"plugin"`
Source Source `json:"source"`
PriorCLIVersion string `json:"prior_cli_version,omitempty"`
}
type Resolver ¶
Resolver resolves an explicitly requested newer compatible bundle. It must return a complete, digest-pinned Bundle; Sync verifies it before planning.
type Skill ¶
type Skill struct{ Name, Digest string }
Skill is one valid skill directory in a bundle.
type Source ¶
type Source struct {
Repository string `json:"repository"`
Path string `json:"path"`
Revision string `json:"revision"`
Version string `json:"version"`
Digest string `json:"digest"`
Compatibility Compatibility `json:"compatibility,omitempty"`
}
Source is reproducible bundle provenance. Repository, Path, Revision, and Digest identify exact bytes; Version names the plugin release for people and plugin hosts. It is persisted with ownership state for diagnostics.
type Status ¶
type Status struct {
Installed bool `json:"installed"`
Plugins map[string]Source `json:"plugins"`
SupplierCLIVersions map[string]map[string]string `json:"supplier_cli_versions,omitempty"`
}
Status is the marker-only query hosts use for drift banners; it never walks installed skill trees or contacts a release source.
func ReadStatus ¶
ReadStatus reads only the small ownership marker. A missing marker is the normal not-yet-synced state, while corrupt state remains a safe error.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package cliui renders skillsync reports for any command framework.
|
Package cliui renders skillsync reports for any command framework. |
|
Package cobracmd exposes optional Cobra wiring for skillsync.
|
Package cobracmd exposes optional Cobra wiring for skillsync. |
|
Package githubrelease resolves explicitly requested newer-compatible bundles from published GitHub Release assets.
|
Package githubrelease resolves explicitly requested newer-compatible bundles from published GitHub Release assets. |
|
Package producer builds one immutable skillsync release snapshot from an already-checked-out local Git repository.
|
Package producer builds one immutable skillsync release snapshot from an already-checked-out local Git repository. |
|
Package reexec runs the newly installed CLI for a post-update skills sync.
|
Package reexec runs the newly installed CLI for a post-update skills sync. |
|
Package selfupdate connects the reusable skills refresh runner to the optional typed callback exposed by cli-helpers/selfupdate.
|
Package selfupdate connects the reusable skills refresh runner to the optional typed callback exposed by cli-helpers/selfupdate. |
|
Package snapshot encodes one verified skillsync bundle as a reproducible tar artifact and exposes the same descriptor/content pair for embedding.
|
Package snapshot encodes one verified skillsync bundle as a reproducible tar artifact and exposes the same descriptor/content pair for embedding. |