kitup

package module
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InstallUX = InstallUXText{
	SkillUse:              "skill",
	SkillShort:            "Manage bundled Agent Skill",
	InstallUse:            "install",
	InstallShort:          "Install bundled Agent Skill",
	ScopeFlag:             "Install scope: user or project",
	AgentFlag:             "Target agent id. Repeat for multiple agents. Use '*' for all.",
	DryRunFlag:            "Show install plan without writing",
	YesFlag:               "Skip prompts and accept policy-selected targets",
	ForceFlag:             "Overwrite unsafe target conflicts",
	SelectScope:           "Select install scope:",
	ScopePrompt:           "Scope (user/project)",
	InvalidScopeSelection: "Invalid scope selection.",
	SelectAgents:          "Select agents:",
	AgentsPrompt:          "Agents (numbers, ids, comma-separated, empty cancels)",
	InvalidAgentSelection: "Invalid agent selection.",
	Proceed:               "Proceed? [y/N] ",
	InstallSummary:        "Install summary:",
	ErrorPrefix:           "kitup:",
	Canceled:              "Installation canceled.",
	SelectionError:        "Agent selection failed.",
	Conflict:              "Installation has conflicts.",
	Failed:                "Installation failed.",
	InvalidFlags:          "Invalid install flags.",
}

Functions

func ComputeBundleContentHash

func ComputeBundleContentHash(bundle SkillBundle) (string, error)

func InstallFlagError

func InstallFlagError(errs []map[string]any) error

func InstallWorkflowError

func InstallWorkflowError(report InstallWorkflowReport) error

Types

type AgentSelector

type AgentSelector struct {
	Kind string
	IDs  []string
}

func AgentSelectorFromFlags

func AgentSelectorFromFlags(values []string) (AgentSelector, []map[string]any)

func AllAgents

func AllAgents() AgentSelector

func AutoAgents

func AutoAgents() AgentSelector

func ExplicitAgents

func ExplicitAgents(ids ...string) AgentSelector

type BaseOptions

type BaseOptions struct {
	Home      string
	CWD       string
	HostsFile string
}

type GitHubBundleOptions

type GitHubBundleOptions struct {
	Owner string
	Repo  string
	Path  string
	Ref   string
}

type Host

type Host struct {
	ID               string   `json:"id"`
	DisplayName      string   `json:"displayName"`
	Aliases          []string `json:"aliases,omitempty"`
	ProjectSkillsDir []string `json:"projectSkillsDirs"`
	UserSkillsDir    []string `json:"userSkillsDirs"`
	Detect           []string `json:"detect"`
	Status           string   `json:"status"`
	Notes            []string `json:"notes,omitempty"`
}

func DetectHosts

func DetectHosts(opts BaseOptions, scope Scope) ([]Host, error)

func LoadHostSpec

func LoadHostSpec(hostsFile string) ([]Host, error)

func ResolveHosts

func ResolveHosts(agents AgentSelector, hosts []Host) ([]Host, []map[string]any)

type InstallFlagValues

type InstallFlagValues struct {
	Scope    string
	ScopeSet bool
	Agents   []string
	Yes      bool
	DryRun   bool
	Force    bool
}

type InstallOptions

type InstallOptions struct {
	BaseOptions
	AppID       string
	SkillBundle SkillBundle
	Scope       Scope
	Agents      AgentSelector
	Force       bool
}

type InstallReport

type InstallReport struct {
	Installed []TargetResult `json:"installed"`
	Updated   []TargetResult `json:"updated"`
	Skipped   []TargetStatus `json:"skipped"`
	Conflicts []TargetStatus `json:"conflicts"`
	Errors    []ReportError  `json:"errors"`
}

func InstallBundledSkill

func InstallBundledSkill(opts InstallOptions) (InstallReport, error)

func PlanBundledSkill

func PlanBundledSkill(opts InstallOptions) (InstallReport, error)

func UpdateBundledSkill

func UpdateBundledSkill(opts InstallOptions) (InstallReport, error)

type InstallSelection

type InstallSelection struct {
	Action            string           `json:"action"`
	SelectedHostIDs   []string         `json:"selectedHostIds"`
	CandidateHostIDs  []string         `json:"candidateHostIds"`
	DetectedHostIDs   []string         `json:"detectedHostIds"`
	NeedsConfirmation bool             `json:"needsConfirmation"`
	Errors            []map[string]any `json:"errors"`
}

func ResolveInstallSelection

func ResolveInstallSelection(opts InstallSelectionOptions) (InstallSelection, error)

type InstallSelectionOptions

type InstallSelectionOptions struct {
	BaseOptions
	Scope        Scope
	Agents       AgentSelector
	Yes          bool
	StdinTTY     bool
	CurrentAgent string
}

type InstallUXText

type InstallUXText struct {
	SkillUse              string
	SkillShort            string
	InstallUse            string
	InstallShort          string
	ScopeFlag             string
	AgentFlag             string
	DryRunFlag            string
	YesFlag               string
	ForceFlag             string
	SelectScope           string
	ScopePrompt           string
	InvalidScopeSelection string
	SelectAgents          string
	AgentsPrompt          string
	InvalidAgentSelection string
	Proceed               string
	InstallSummary        string
	ErrorPrefix           string
	Canceled              string
	SelectionError        string
	Conflict              string
	Failed                string
	InvalidFlags          string
}

type InstallWorkflowExit

type InstallWorkflowExit struct {
	OK      bool   `json:"ok"`
	Code    string `json:"code"`
	Message string `json:"message"`
}

func ClassifyInstallWorkflowExit

func ClassifyInstallWorkflowExit(report InstallWorkflowReport) InstallWorkflowExit

type InstallWorkflowOptions

type InstallWorkflowOptions struct {
	InstallOptions
	Yes          bool
	DryRun       bool
	StdinTTY     bool
	CurrentAgent string
	DefaultScope Scope
	ScopeSet     bool
	PromptScope  bool
	In           io.Reader
	Out          io.Writer
	Err          io.Writer
}

type InstallWorkflowReport

type InstallWorkflowReport struct {
	Selection InstallSelection `json:"selection"`
	Scope     Scope            `json:"scope"`
	Plan      InstallReport    `json:"plan"`
	Report    InstallReport    `json:"report"`
	Canceled  bool             `json:"canceled"`
	DryRun    bool             `json:"dryRun"`
}

func RunBundledSkillInstall

func RunBundledSkillInstall(opts InstallWorkflowOptions) (InstallWorkflowReport, error)

type ParsedInstallFlags

type ParsedInstallFlags struct {
	Scope    Scope
	ScopeSet bool
	Agents   AgentSelector
	Yes      bool
	DryRun   bool
	Force    bool
	Errors   []map[string]any
}

func ParseInstallFlags

func ParseInstallFlags(flags InstallFlagValues) ParsedInstallFlags

type ReportError

type ReportError struct {
	Agent     string `json:"agent,omitempty"`
	Flag      string `json:"flag,omitempty"`
	HostID    string `json:"hostId,omitempty"`
	Reason    string `json:"reason"`
	Scope     Scope  `json:"scope,omitempty"`
	SkillName string `json:"skillName,omitempty"`
	Value     string `json:"value,omitempty"`
}

type Scope

type Scope string
const (
	UserScope    Scope = "user"
	ProjectScope Scope = "project"
)

func ParseScopeFlag

func ParseScopeFlag(value string) (Scope, []map[string]any)

type SkillBundle

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

func DirectoryBundle

func DirectoryBundle(dir string) SkillBundle

func FSBundle

func FSBundle(fsys fs.FS, root string) SkillBundle

func FilesBundle

func FilesBundle(files []SkillFile) SkillBundle

func GitHubBundle

func GitHubBundle(opts GitHubBundleOptions) SkillBundle

type SkillFile

type SkillFile struct {
	Path     string
	Contents []byte
	Mode     fs.FileMode
}

type SkillInfo

type SkillInfo struct {
	Valid       bool   `json:"valid"`
	SkillName   string `json:"skillName,omitempty"`
	Description string `json:"description,omitempty"`
	ErrorCode   string `json:"errorCode,omitempty"`
}

func ValidateSkillBundle

func ValidateSkillBundle(bundle SkillBundle) SkillInfo

type TargetGroup

type TargetGroup struct {
	HostIDs   []string
	SkillName string
	TargetDir string
}

func ResolveInstallTargets

func ResolveInstallTargets(opts BaseOptions, agents AgentSelector, scope Scope, skillName string) ([]TargetGroup, []map[string]any, []string, error)

type TargetResult

type TargetResult struct {
	HostID    string   `json:"hostId,omitempty"`
	HostIDs   []string `json:"hostIds,omitempty"`
	SkillName string   `json:"skillName"`
	TargetDir string   `json:"targetDir"`
}

type TargetStatus

type TargetStatus struct {
	TargetResult
	Reason string `json:"reason"`
}

type UninstallOptions

type UninstallOptions struct {
	BaseOptions
	AppID     string
	SkillName string
	Scope     Scope
	Agents    AgentSelector
}

type UninstallReport

type UninstallReport struct {
	Removed   []TargetResult `json:"removed"`
	Skipped   []TargetStatus `json:"skipped"`
	Conflicts []TargetStatus `json:"conflicts"`
	Errors    []ReportError  `json:"errors"`
}

func UninstallBundledSkill

func UninstallBundledSkill(opts UninstallOptions) (UninstallReport, error)

Jump to

Keyboard shortcuts

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