setup

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AgentNameForIDE

func AgentNameForIDE(ide string) (string, error)

AgentNameForIDE maps a productize runtime IDE name to the setup agent name.

func InstallBundledReusableAgents

func InstallBundledReusableAgents(
	cfg ReusableAgentInstallConfig,
) ([]ReusableAgentSuccessItem, []ReusableAgentFailureItem, error)

InstallBundledReusableAgents installs every bundled reusable agent into the selected setup scope.

func InstallReusableAgents

InstallReusableAgents installs the provided reusable agents into the selected setup scope.

func InstallSelectedSkills

func InstallSelectedSkills(
	options ResolverOptions,
	skills []Skill,
	agentNames []string,
	global bool,
	mode InstallMode,
) ([]SuccessItem, []FailureItem, error)

InstallSelectedSkills installs an explicit skill selection for the requested agents.

func SkillCatalogTier

func SkillCatalogTier(name string) string

SkillCatalogTier returns the public catalog tier for a bundled/setup skill.

func WriteSkillsCatalog

func WriteSkillsCatalog(options ResolverOptions, global bool, skills []Skill) (string, error)

WriteSkillsCatalog writes a local Productize skill catalog for the selected setup scope and returns the path that was written.

Types

type Agent

type Agent struct {
	Name           string
	DisplayName    string
	ProjectRootDir string
	GlobalRootDir  string
	Universal      bool
	Detected       bool
}

Agent describes one supported agent/editor destination.

func DetectInstalledAgents

func DetectInstalledAgents(options ResolverOptions) ([]Agent, error)

func SelectAgents

func SelectAgents(all []Agent, names []string) ([]Agent, error)

func SupportedAgents

func SupportedAgents(options ResolverOptions) ([]Agent, error)

type AssetOrigin

type AssetOrigin string

AssetOrigin identifies where one setup asset originates.

const (
	// AssetOriginBundled identifies first-party setup assets shipped with Productize.
	AssetOriginBundled AssetOrigin = "bundled"
	// AssetOriginExtension identifies setup assets shipped by an enabled extension.
	AssetOriginExtension AssetOrigin = "extension"
)

type AssetRef

type AssetRef struct {
	Origin          AssetOrigin
	Name            string
	ExtensionName   string
	ExtensionSource string
	ManifestPath    string
	ResolvedPath    string
}

AssetRef captures the source metadata needed to explain one effective-setup conflict.

type CatalogAssetKind

type CatalogAssetKind string

CatalogAssetKind identifies the setup asset family participating in conflict resolution.

const (
	// CatalogAssetKindSkill identifies skill assets.
	CatalogAssetKindSkill CatalogAssetKind = "skill"
	// CatalogAssetKindReusableAgent identifies reusable-agent assets.
	CatalogAssetKindReusableAgent CatalogAssetKind = "reusable-agent"
)

type CatalogConflict

type CatalogConflict struct {
	Kind       CatalogAssetKind
	Name       string
	Resolution CatalogConflictResolution
	Winner     AssetRef
	Ignored    AssetRef
}

CatalogConflict records one ignored setup asset and the winner that shadowed it.

type CatalogConflictResolution

type CatalogConflictResolution string

CatalogConflictResolution describes why one setup asset won over another.

const (
	// CatalogConflictCoreWins indicates a bundled core asset shadowed an extension asset.
	CatalogConflictCoreWins CatalogConflictResolution = "core-wins"
	// CatalogConflictExtensionPrecedence indicates one extension asset shadowed another by precedence.
	CatalogConflictExtensionPrecedence CatalogConflictResolution = "extension-precedence"
)

type EffectiveCatalog

type EffectiveCatalog struct {
	Skills         []Skill
	ReusableAgents []ReusableAgent
	Conflicts      []CatalogConflict
}

EffectiveCatalog summarizes the setup assets eligible for installation after conflict resolution.

func BuildEffectiveCatalog

func BuildEffectiveCatalog(
	bundledSkills []Skill,
	extensionSkills []Skill,
	bundledReusableAgents []ReusableAgent,
	extensionReusableAgents []ReusableAgent,
) EffectiveCatalog

BuildEffectiveCatalog merges bundled and extension setup assets into one effective install catalog.

type ExtensionFailureItem

type ExtensionFailureItem struct {
	Pack SkillPackSource
	FailureItem
}

ExtensionFailureItem captures one failed extension skill installation mapping.

type ExtensionInstallConfig

type ExtensionInstallConfig struct {
	ResolverOptions

	Packs      []SkillPackSource
	AgentNames []string
	Global     bool
	Mode       InstallMode
}

ExtensionInstallConfig describes one extension-skill installation run.

type ExtensionPreviewItem

type ExtensionPreviewItem struct {
	Pack SkillPackSource
	PreviewItem
}

ExtensionPreviewItem describes the on-disk plan for one extension skill/agent install pair.

type ExtensionResult

type ExtensionResult struct {
	Global     bool
	Mode       InstallMode
	Successful []ExtensionSuccessItem
	Failed     []ExtensionFailureItem
}

ExtensionResult summarizes one extension-skill installation run.

func InstallExtensionSkillPacks

func InstallExtensionSkillPacks(cfg ExtensionInstallConfig) (*ExtensionResult, error)

InstallExtensionSkillPacks materializes enabled extension skill packs for the selected agents.

type ExtensionReusableAgentSource

type ExtensionReusableAgentSource struct {
	ExtensionName   string
	ExtensionSource string
	ManifestPath    string
	Pattern         string
	ResolvedPath    string
	SourceFS        fs.FS
	SourceDir       string
}

ExtensionReusableAgentSource captures one declarative reusable-agent source resolved during extension discovery.

type ExtensionSuccessItem

type ExtensionSuccessItem struct {
	Pack SkillPackSource
	SuccessItem
}

ExtensionSuccessItem captures one successful extension skill installation mapping.

type ExtensionVerifiedSkill

type ExtensionVerifiedSkill struct {
	Pack SkillPackSource
	VerifiedSkill
}

ExtensionVerifiedSkill captures the verification result for one extension skill pack.

type ExtensionVerifyConfig

type ExtensionVerifyConfig struct {
	ResolverOptions

	Packs     []SkillPackSource
	AgentName string
	ScopeHint InstallScope
}

ExtensionVerifyConfig describes one extension-skill verification run.

type ExtensionVerifyResult

type ExtensionVerifyResult struct {
	Agent  Agent
	Scope  InstallScope
	Mode   InstallMode
	Skills []ExtensionVerifiedSkill
}

ExtensionVerifyResult summarizes one extension-skill verification run.

func VerifyExtensionSkillPacks

func VerifyExtensionSkillPacks(cfg ExtensionVerifyConfig) (ExtensionVerifyResult, error)

VerifyExtensionSkillPacks checks whether declared extension skill packs are installed and current.

func (ExtensionVerifyResult) DriftedSkillNames

func (r ExtensionVerifyResult) DriftedSkillNames() []string

DriftedSkillNames returns every drifted extension skill name in sorted order.

func (ExtensionVerifyResult) HasDrift

func (r ExtensionVerifyResult) HasDrift() bool

HasDrift reports whether any extension skill differs from its declared source.

func (ExtensionVerifyResult) HasMissing

func (r ExtensionVerifyResult) HasMissing() bool

HasMissing reports whether any extension skill is missing.

func (ExtensionVerifyResult) MissingSkillNames

func (r ExtensionVerifyResult) MissingSkillNames() []string

MissingSkillNames returns every missing extension skill name in sorted order.

type FailureItem

type FailureItem struct {
	Skill Skill
	Agent Agent
	Path  string
	Mode  InstallMode
	Error string
}

FailureItem captures one failed installation mapping.

type InstallConfig

type InstallConfig struct {
	Bundle fs.FS

	ResolverOptions

	SkillNames []string
	AgentNames []string
	Global     bool
	Mode       InstallMode
}

InstallConfig describes one bundled-skill installation run.

type InstallMode

type InstallMode string

InstallMode determines how bundled skills are materialized for agents.

const (
	// InstallModeSymlink installs a canonical copy and symlinks agent paths to it.
	InstallModeSymlink InstallMode = "symlink"
	// InstallModeCopy copies the bundled skill into each target agent path.
	InstallModeCopy InstallMode = "copy"
)

type InstallScope

type InstallScope string

InstallScope identifies whether a skill installation is project-local or global.

const (
	// InstallScopeUnknown indicates that no existing installation scope could be resolved.
	InstallScopeUnknown InstallScope = "unknown"
	// InstallScopeProject identifies a project-local installation.
	InstallScopeProject InstallScope = "project"
	// InstallScopeGlobal identifies a global installation.
	InstallScopeGlobal InstallScope = "global"
)

type PreviewItem

type PreviewItem struct {
	Skill         Skill
	Agent         Agent
	CanonicalPath string
	TargetPath    string
	WillOverwrite bool
}

PreviewItem describes the on-disk plan for one skill/agent install pair.

func Preview

func Preview(cfg InstallConfig) ([]PreviewItem, error)

Preview resolves selected bundled skills and agents to on-disk install targets.

func PreviewBundledSkillInstall

func PreviewBundledSkillInstall(cfg InstallConfig) ([]PreviewItem, error)

PreviewBundledSkillInstall resolves the on-disk install plan for bundled skills.

func PreviewSelectedSkills

func PreviewSelectedSkills(
	options ResolverOptions,
	skills []Skill,
	agentNames []string,
	global bool,
	mode InstallMode,
) ([]PreviewItem, error)

PreviewSelectedSkills resolves the on-disk install plan for an explicit skill selection.

type ResolverOptions

type ResolverOptions struct {
	CWD             string
	HomeDir         string
	XDGConfigHome   string
	CodeXHome       string
	ClaudeConfigDir string
}

ResolverOptions configures environment-sensitive path resolution.

type Result

type Result struct {
	Global     bool
	Mode       InstallMode
	Successful []SuccessItem
	Failed     []FailureItem

	ReusableAgentsSuccessful []ReusableAgentSuccessItem
	ReusableAgentsFailed     []ReusableAgentFailureItem
}

Result summarizes one bundled-skill installation run.

func Install

func Install(cfg InstallConfig) (*Result, error)

Install materializes bundled skills for the selected agents.

func InstallBundledSetupAssets

func InstallBundledSetupAssets(cfg InstallConfig) (*Result, error)

InstallBundledSetupAssets materializes bundled skills and any bundled reusable agents.

func InstallBundledSkills

func InstallBundledSkills(cfg InstallConfig) (*Result, error)

InstallBundledSkills materializes bundled public skills for the selected agents.

type ReusableAgent

type ReusableAgent struct {
	Name        string
	Title       string
	Description string
	Directory   string
	Origin      AssetOrigin

	ExtensionName   string
	ExtensionSource string
	ManifestPath    string
	ResolvedPath    string
	SourceFS        fs.FS
	SourceDir       string
}

ReusableAgent describes one reusable agent available for setup-managed installation.

func ListBundledReusableAgents

func ListBundledReusableAgents() ([]ReusableAgent, error)

ListBundledReusableAgents returns the reusable agents bundled into the productize binary.

func ListExtensionReusableAgents

func ListExtensionReusableAgents(sources []ExtensionReusableAgentSource) ([]ReusableAgent, error)

ListExtensionReusableAgents enumerates reusable agents declared by enabled extensions.

func ListReusableAgents

func ListReusableAgents(bundle fs.FS) ([]ReusableAgent, error)

ListReusableAgents enumerates bundled reusable agents from the provided bundle.

type ReusableAgentFailureItem

type ReusableAgentFailureItem struct {
	ReusableAgent ReusableAgent
	Path          string
	Error         string
}

ReusableAgentFailureItem captures one failed bundled reusable-agent installation.

type ReusableAgentInstallConfig

type ReusableAgentInstallConfig struct {
	ResolverOptions

	ReusableAgents []ReusableAgent
	Global         bool
}

ReusableAgentInstallConfig describes one reusable-agent install or preview run.

type ReusableAgentPreviewItem

type ReusableAgentPreviewItem struct {
	ReusableAgent ReusableAgent
	TargetPath    string
	WillOverwrite bool
}

ReusableAgentPreviewItem describes the on-disk plan for one bundled reusable agent.

func PreviewBundledReusableAgentInstall

func PreviewBundledReusableAgentInstall(cfg ReusableAgentInstallConfig) ([]ReusableAgentPreviewItem, error)

PreviewBundledReusableAgentInstall resolves the on-disk install plan for bundled reusable agents.

func PreviewReusableAgentInstall

func PreviewReusableAgentInstall(cfg ReusableAgentInstallConfig) ([]ReusableAgentPreviewItem, error)

PreviewReusableAgentInstall resolves the on-disk install plan for reusable agents.

type ReusableAgentSuccessItem

type ReusableAgentSuccessItem struct {
	ReusableAgent ReusableAgent
	Path          string
}

ReusableAgentSuccessItem captures one successful bundled reusable-agent installation.

type ReusableAgentVerifyConfig

type ReusableAgentVerifyConfig struct {
	ResolverOptions

	ReusableAgents []ReusableAgent
	ScopeHint      InstallScope
}

ReusableAgentVerifyConfig describes one reusable-agent verification run.

type ReusableAgentVerifyResult

type ReusableAgentVerifyResult struct {
	Scope  InstallScope
	Agents []VerifiedReusableAgent
}

ReusableAgentVerifyResult summarizes one reusable-agent verification run.

func VerifyReusableAgents

func VerifyReusableAgents(cfg ReusableAgentVerifyConfig) (ReusableAgentVerifyResult, error)

VerifyReusableAgents checks whether reusable agents are installed and current.

func (ReusableAgentVerifyResult) DriftedReusableAgentNames

func (r ReusableAgentVerifyResult) DriftedReusableAgentNames() []string

DriftedReusableAgentNames returns every drifted reusable-agent name in sorted order.

func (ReusableAgentVerifyResult) HasDrift

func (r ReusableAgentVerifyResult) HasDrift() bool

HasDrift reports whether any reusable agent differs from its source.

func (ReusableAgentVerifyResult) HasMissing

func (r ReusableAgentVerifyResult) HasMissing() bool

HasMissing reports whether any reusable agent is missing.

func (ReusableAgentVerifyResult) MissingReusableAgentNames

func (r ReusableAgentVerifyResult) MissingReusableAgentNames() []string

MissingReusableAgentNames returns every missing reusable-agent name in sorted order.

type Skill

type Skill struct {
	Name        string
	Description string
	Directory   string
	Origin      AssetOrigin

	ExtensionName   string
	ExtensionSource string
	ManifestPath    string
	ResolvedPath    string
	SourceFS        fs.FS
	SourceDir       string
}

Skill describes one bundled skill available for installation.

func ListBundledSkills

func ListBundledSkills() ([]Skill, error)

ListBundledSkills returns the public skills bundled into the productize binary.

func ListExtensionSkills

func ListExtensionSkills(packs []SkillPackSource) ([]Skill, error)

ListExtensionSkills enumerates installable skill assets declared by enabled extensions.

func ListSkills

func ListSkills(bundle fs.FS) ([]Skill, error)

ListSkills enumerates bundled public skills from the provided bundle.

func SelectSkills

func SelectSkills(all []Skill, names []string) ([]Skill, error)

SelectSkills filters a discovered catalog to the requested bundled skill names.

type SkillDrift

type SkillDrift struct {
	MissingFiles []string
	ExtraFiles   []string
	ChangedFiles []string
	Reason       string
}

SkillDrift describes how an installed skill differs from the bundled version.

type SkillPackSource

type SkillPackSource struct {
	ExtensionName   string
	ExtensionSource string
	ManifestPath    string
	Pattern         string
	ResolvedPath    string
	SourceFS        fs.FS
	SourceDir       string
}

SkillPackSource captures one declarative skill-pack source resolved during extension discovery.

func ExtensionSkillPackSources

func ExtensionSkillPackSources(skills []Skill) []SkillPackSource

ExtensionSkillPackSources converts effective extension skills back into declarative skill-pack sources.

type SkillsCatalogEntry

type SkillsCatalogEntry struct {
	Name        string      `json:"name"`
	Description string      `json:"description,omitempty"`
	Directory   string      `json:"directory"`
	Tier        string      `json:"tier"`
	Origin      AssetOrigin `json:"origin"`
}

SkillsCatalogEntry is the machine-readable setup catalog written alongside installed skills so workflow/gate skills can discover the bundled catalog.

type SuccessItem

type SuccessItem struct {
	Skill         Skill
	Agent         Agent
	Path          string
	CanonicalPath string
	Mode          InstallMode
	SymlinkFailed bool
}

SuccessItem captures one successful installation mapping.

type VerifiedReusableAgent

type VerifiedReusableAgent struct {
	ReusableAgent ReusableAgent
	TargetPath    string
	ResolvedPath  string
	State         VerifyState
	Drift         SkillDrift
}

VerifiedReusableAgent captures the verification result for one reusable agent.

type VerifiedSkill

type VerifiedSkill struct {
	Skill         Skill
	CanonicalPath string
	TargetPath    string
	ResolvedPath  string
	State         VerifyState
	Drift         SkillDrift
}

VerifiedSkill captures the verification result for one skill.

type VerifyConfig

type VerifyConfig struct {
	Bundle fs.FS

	ResolverOptions

	AgentName  string
	SkillNames []string
}

VerifyConfig describes one bundled-skill verification run.

type VerifyResult

type VerifyResult struct {
	Agent  Agent
	Scope  InstallScope
	Mode   InstallMode
	Skills []VerifiedSkill
}

VerifyResult summarizes one bundled-skill verification run.

func Verify

func Verify(cfg VerifyConfig) (VerifyResult, error)

Verify checks whether the selected bundled skills are installed and current for one agent.

func VerifyBundledSkills

func VerifyBundledSkills(cfg VerifyConfig) (VerifyResult, error)

VerifyBundledSkills checks whether bundled public skills are installed and current.

func (VerifyResult) DriftedSkillNames

func (r VerifyResult) DriftedSkillNames() []string

DriftedSkillNames returns every drifted skill name in sorted order.

func (VerifyResult) HasDrift

func (r VerifyResult) HasDrift() bool

HasDrift reports whether any installed skill differs from the bundled version.

func (VerifyResult) HasMissing

func (r VerifyResult) HasMissing() bool

HasMissing reports whether any skill is missing.

func (VerifyResult) MissingSkillNames

func (r VerifyResult) MissingSkillNames() []string

MissingSkillNames returns every missing skill name in sorted order.

type VerifyState

type VerifyState string

VerifyState describes the verification status for one installed skill.

const (
	// VerifyStateCurrent indicates the installed skill matches the bundled version.
	VerifyStateCurrent VerifyState = "current"
	// VerifyStateMissing indicates the installed skill is missing from the selected scope.
	VerifyStateMissing VerifyState = "missing"
	// VerifyStateDrifted indicates the installed skill differs from the bundled version.
	VerifyStateDrifted VerifyState = "drifted"
)

Jump to

Keyboard shortcuts

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