app

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package app is gskill's orchestration layer. It exposes use-case methods that the cli and tui views call, and is the only layer that drives the domain packages (resolver, installer, store, and the rest). Views never import the domain packages directly.

Index

Constants

View Source
const (
	ManifestName = "gskill.toml"
	LockName     = "gskill.lock"
)

Project file and directory names.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddRequest

type AddRequest struct {
	Root    string
	Source  string
	Version string
	Ref     string
	Commit  string
	Agents  []string
	Force   bool
	Scope   string
	Mode    string
}

AddRequest describes an `add` invocation.

type AddResult

type AddResult struct {
	Name        string
	ContentHash string
	Targets     map[string]string
	Warnings    []string
}

AddResult reports the outcome of an add.

type App

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

App holds the injected dependencies shared by every use-case. Business logic is added by sibling files (install.go, inspect.go, lifecycle.go, ...).

func New

func New(opts Options) *App

New builds an App from opts, filling in defaults for any nil dependency.

func (*App) Add

func (a *App) Add(ctx context.Context, req AddRequest) (AddResult, error)

Add resolves, installs, and records a new skill, updating the manifest and lockfile. It errors on an already-declared key unless Force is set (FR-047), and writes nothing when no target agent is available (FR-029).

func (*App) Agents

func (a *App) Agents() *agent.Registry

Agents returns the agent registry.

func (*App) Check

func (a *App) Check(_ context.Context, root string, failOnDrift bool) (CheckReport, error)

Check produces a fast, metadata-only drift report. With failOnDrift, any drift returns exit 7 (FR-016, FR-017).

func (*App) Config

func (a *App) Config() *config.Config

Config returns the resolved configuration.

func (*App) Diff

func (a *App) Diff(_ context.Context, root string) ([]DiffEntry, error)

Diff reports manifest/lock/disk differences per skill.

func (*App) Doctor

func (a *App) Doctor(ctx context.Context, root string) (DoctorReport, error)

Doctor checks the environment (git, detected agents) and reports declared requirements, warning on any that are unmet (FR-032). It never installs.

func (*App) Info

func (a *App) Info(_ context.Context, root, name string) (SkillInfo, error)

Info returns the full detail for one locked skill.

func (*App) Init

func (a *App) Init(_ context.Context, root string) (InitResult, error)

Init scaffolds the project: a gskill.toml manifest, a .gskill state dir, and a .gitignore hint (FR-001). It is idempotent.

func (*App) Install

func (a *App) Install(ctx context.Context, req InstallRequest) (InstallResult, error)

Install materializes every declared skill, additively and idempotently, updating the lockfile only when resolved content changes (FR-022).

func (*App) List

func (a *App) List(_ context.Context, root string) ([]ListedSkill, error)

List returns every declared/locked skill with its drift status.

func (*App) Lock

func (a *App) Lock(ctx context.Context, root string) (InstallResult, error)

Lock recomputes the lockfile from the manifest, honoring existing pins without bumping skills whose declaration is unchanged.

func (*App) Logger

func (a *App) Logger() *slog.Logger

Logger returns the structured logger.

func (*App) Outdated

func (a *App) Outdated(ctx context.Context, root string) (OutdatedReport, error)

Outdated reports available updates per locked skill (FR-009).

func (*App) Remove

func (a *App) Remove(ctx context.Context, root string, names []string) (RemoveResult, error)

Remove uninstalls the named skills from the manifest, lockfile, and every agent directory, then garbage-collects unreferenced store entries.

func (*App) Repair

func (a *App) Repair(ctx context.Context, root string) (RepairResult, error)

Repair re-materializes broken or modified installs from the store/cache without changing the lockfile, and cleans up orphaned staging left by an interrupted install (FR-024, SC-007).

func (*App) SkillMarkdown

func (a *App) SkillMarkdown(_ context.Context, root, name string) (string, error)

SkillMarkdown returns the installed SKILL.md content for a skill, read from its first available agent target (for the TUI preview).

func (*App) Sync

func (a *App) Sync(ctx context.Context, req SyncRequest) (SyncResult, error)

Sync makes disk exactly match the lockfile, reinstalling each locked skill. With Prune, agent skill directories not referenced by the lock are removed (FR-023).

func (*App) Update

func (a *App) Update(ctx context.Context, root string, names []string) (InstallResult, error)

Update re-resolves the named skills (or all when names is empty) to the newest version within their constraints and rewrites the lockfile (FR-009).

func (*App) Verify

func (a *App) Verify(_ context.Context, root string) (VerifyReport, error)

Verify re-hashes every installed skill against the lockfile, failing closed on the first mismatch (exit 6, FR-015).

type CheckReport

type CheckReport struct {
	Skills   []SkillCheck
	HasDrift bool
}

CheckReport aggregates a check run.

type DiffEntry

type DiffEntry struct {
	Name       string
	InManifest bool
	InLock     bool
	Status     string
}

DiffEntry reports how a skill differs across manifest, lock, and disk.

type DoctorReport

type DoctorReport struct {
	GitAvailable   bool
	DetectedAgents []string
	Requirements   []RequirementCheck
	Warnings       []string
}

DoctorReport is the result of `gskill doctor`.

type InitResult

type InitResult struct {
	ManifestPath string
	Created      []string
}

InitResult reports what Init created.

type InstallRequest

type InstallRequest struct {
	Root           string
	Scope          string
	Mode           string
	Frozen         bool
	Offline        bool
	NoCache        bool
	UpdateLockfile bool
}

InstallRequest describes an `install` invocation over the existing manifest.

type InstallResult

type InstallResult struct {
	Skills  []SkillChange
	Changed bool
}

InstallResult reports an install run.

type ListedSkill

type ListedSkill struct {
	Name    string
	Source  string
	Version string
	Status  string
	Agents  []string
}

ListedSkill is one row of `gskill list`.

type Options

type Options struct {
	Config *config.Config
	Logger *slog.Logger
	Agents *agent.Registry
	Git    git.Runner
}

Options configures New. Nil dependencies are replaced with safe defaults.

type OutdatedReport

type OutdatedReport struct {
	Skills       []OutdatedSkill
	AnyAvailable bool
}

OutdatedReport aggregates an outdated run.

type OutdatedSkill

type OutdatedSkill struct {
	Name      string
	Current   string
	Latest    string
	Available bool
}

OutdatedSkill reports one skill's update availability.

type RemoveResult

type RemoveResult struct {
	Removed    []string
	StoreGCed  int
	NotPresent []string
}

RemoveResult reports a remove run.

type RepairResult

type RepairResult struct {
	Repaired       []string
	StagingCleaned int
}

RepairResult reports a repair run.

type RequirementCheck

type RequirementCheck struct {
	Skill     string
	Kind      string // command | environment | skill | mcp
	Name      string
	Satisfied bool
	Checked   bool // false for kinds gskill cannot verify (e.g. mcp)
}

RequirementCheck is one declared requirement and whether the environment satisfies it. Requirements are recorded and surfaced only — gskill never resolves them transitively or auto-installs anything (FR-032).

type SkillChange

type SkillChange struct {
	Name        string
	ContentHash string
	Changed     bool
}

SkillChange records the per-skill outcome of an install.

type SkillCheck

type SkillCheck struct {
	Name   string
	Status string
}

SkillCheck is one skill's fast drift status.

type SkillInfo

type SkillInfo struct {
	Name        string
	Source      string
	Version     string
	Commit      string
	ContentHash string
	Description string
	License     string
	Requires    lockfile.Requires
	Agents      []string
	Targets     map[string]string
}

SkillInfo is the detail shown by `gskill info`.

type SkillVerify

type SkillVerify struct {
	Name     string
	OK       bool
	Expected string
	Actual   string
	Issue    string // ok | missing | mismatch
}

SkillVerify is one skill's integrity-verification outcome.

type SyncRequest

type SyncRequest struct {
	Root    string
	Prune   bool
	Offline bool
}

SyncRequest describes a `sync` invocation.

type SyncResult

type SyncResult struct {
	Reconciled []SkillChange
	Pruned     []string
}

SyncResult reports a sync run.

type VerifyReport

type VerifyReport struct {
	Skills []SkillVerify
	OK     bool
}

VerifyReport aggregates a verify run.

Jump to

Keyboard shortcuts

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