commands

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAssetNotFound = errors.New("asset not found")

ErrAssetNotFound is returned when no asset is found in the lock file

Functions

func IsMarketplaceReference added in v0.8.0

func IsMarketplaceReference(input string) bool

IsMarketplaceReference checks if input matches the plugin@marketplace pattern

func NewAddCommand

func NewAddCommand() *cobra.Command

NewAddCommand creates the add command

func NewConfigCommand

func NewConfigCommand() *cobra.Command

NewConfigCommand creates the config command

func NewInitCommand

func NewInitCommand() *cobra.Command

NewInitCommand creates the init command

func NewInstallCommand

func NewInstallCommand() *cobra.Command

NewInstallCommand creates the install command

func NewProfileCommand added in v0.7.0

func NewProfileCommand() *cobra.Command

NewProfileCommand creates the profile command with subcommands

func NewRemoveCommand

func NewRemoveCommand() *cobra.Command

NewRemoveCommand creates the remove command

func NewReportUsageCommand

func NewReportUsageCommand() *cobra.Command

NewReportUsageCommand creates the report-usage command

func NewServeCommand

func NewServeCommand() *cobra.Command

NewServeCommand creates the serve command

func NewUninstallCommand

func NewUninstallCommand() *cobra.Command

NewUninstallCommand creates the uninstall command

func NewUpdateCommand

func NewUpdateCommand() *cobra.Command

NewUpdateCommand creates the update command

func NewUpdateTemplatesCommand

func NewUpdateTemplatesCommand() *cobra.Command

NewUpdateTemplatesCommand creates the update-templates command (hidden)

func NewVaultCommand added in v0.6.0

func NewVaultCommand() *cobra.Command

NewVaultCommand creates a new vault command

func RunDefaultCommand

func RunDefaultCommand(cmd *cobra.Command, args []string) error

RunDefaultCommand runs the default command (install if lock file exists)

func ValidateMarketplaceReference added in v0.8.0

func ValidateMarketplaceReference(ref MarketplaceReference) error

ValidateMarketplaceReference validates that a marketplace reference doesn't contain path traversal characters

func WithPrompter

func WithPrompter(ctx context.Context, prompter Prompter) context.Context

WithPrompter returns a context with the given prompter (for testing)

Types

type AssetInfo

type AssetInfo struct {
	Name             string      `json:"name"`
	Version          string      `json:"version"`
	InstalledVersion string      `json:"installedVersion,omitempty"` // If different from Version
	Type             string      `json:"type"`
	Clients          []string    `json:"clients"`
	Status           AssetStatus `json:"status"`
}

type AssetStatus

type AssetStatus string

AssetStatus represents the installation status of an asset

const (
	StatusInstalled    AssetStatus = "installed"     // Installed and matches lock file
	StatusOutdated     AssetStatus = "outdated"      // Installed but different version
	StatusNotInstalled AssetStatus = "not_installed" // In lock file but not installed
	StatusOrphaned     AssetStatus = "orphaned"      // Installed but not in lock file
)

type AssetUninstallPlan

type AssetUninstallPlan struct {
	Name      string
	Version   string
	Type      asset.Type
	IsGlobal  bool
	Clients   []string // client IDs that have this installed
	LockEntry *lockfile.Asset
}

AssetUninstallPlan contains info needed to uninstall one asset

type ClientInfo

type ClientInfo struct {
	ID             string   `json:"id"`
	Name           string   `json:"name"`
	Installed      bool     `json:"installed"`
	Version        string   `json:"version,omitempty"`
	Directory      string   `json:"directory"`
	HooksInstalled bool     `json:"hooksInstalled"`
	Supports       []string `json:"supports"`
}

type ConfigInfo

type ConfigInfo struct {
	Path          string `json:"path"`
	Exists        bool   `json:"exists"`
	Profile       string `json:"profile,omitempty"`
	Type          string `json:"type,omitempty"`
	RepositoryURL string `json:"repositoryUrl,omitempty"`
	ServerURL     string `json:"serverUrl,omitempty"`
}

type ConfigOutput

type ConfigOutput struct {
	Version      VersionInfo   `json:"version"`
	Platform     PlatformInfo  `json:"platform"`
	Config       ConfigInfo    `json:"config"`
	Directories  DirectoryInfo `json:"directories"`
	Clients      []ClientInfo  `json:"clients"`
	CurrentScope *scope.Scope  `json:"currentScope,omitempty"`
	Assets       []ScopeAssets `json:"assets"`
	RecentLogs   []string      `json:"recentLogs"`
}

ConfigOutput represents the full config output for JSON serialization

type DirectoryInfo

type DirectoryInfo struct {
	Config         string `json:"config"`
	Cache          string `json:"cache"`
	Assets         string `json:"assets"`
	GitRepos       string `json:"gitRepos"`
	LockFiles      string `json:"lockFiles"`
	InstalledState string `json:"installedState"`
	LogFile        string `json:"logFile"`
}

type MarketplaceReference added in v0.8.0

type MarketplaceReference struct {
	PluginName  string
	Marketplace string
}

MarketplaceReference represents a parsed plugin@marketplace reference

func ParseMarketplaceReference added in v0.8.0

func ParseMarketplaceReference(input string) MarketplaceReference

ParseMarketplaceReference splits plugin@marketplace into its parts

type PlatformInfo

type PlatformInfo struct {
	OS         string `json:"os"`
	Arch       string `json:"arch"`
	WorkingDir string `json:"workingDir"`
}

type PostToolUseEvent

type PostToolUseEvent struct {
	ToolName  string         `json:"tool_name"`
	ToolInput map[string]any `json:"tool_input"`
}

PostToolUseEvent represents the JSON payload from Claude Code PostToolUse hook

type Prompter

type Prompter interface {
	Prompt(message string) (string, error)
	PromptWithDefault(message, defaultValue string) (string, error)
	Confirm(message string) (bool, error)
}

Prompter provides an interface for interactive prompts This abstraction allows for: 1. Easy testing via mocking 2. Future UI improvements (e.g., switching to a TUI library) without changing all call sites

type ScopeAssets

type ScopeAssets struct {
	Scope           string      `json:"scope"`
	TrackerPath     string      `json:"trackerPath"`
	LockFileVersion string      `json:"lockFileVersion,omitempty"`
	InstalledAt     string      `json:"installedAt,omitempty"`
	Assets          []AssetInfo `json:"assets"`
}

type StdPrompter

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

StdPrompter implements Prompter using standard I/O

func NewStdPrompter

func NewStdPrompter(in io.Reader, out io.Writer) *StdPrompter

NewStdPrompter creates a new standard I/O prompter

func (*StdPrompter) Confirm

func (p *StdPrompter) Confirm(message string) (bool, error)

Confirm asks a yes/no question

func (*StdPrompter) Prompt

func (p *StdPrompter) Prompt(message string) (string, error)

Prompt displays a prompt and reads user input

func (*StdPrompter) PromptWithDefault

func (p *StdPrompter) PromptWithDefault(message, defaultValue string) (string, error)

PromptWithDefault displays a prompt with a default value

type UninstallOptions

type UninstallOptions struct {
	All     bool
	Yes     bool
	DryRun  bool
	Verbose bool
}

UninstallOptions contains options for the uninstall command

type UninstallPlan

type UninstallPlan struct {
	Assets     []AssetUninstallPlan
	GitContext *gitutil.GitContext
	TargetBase string // tracking base for updating tracker
}

UninstallPlan contains the complete uninstall plan

type UninstallResult

type UninstallResult struct {
	AssetName string
	ClientID  string
	Success   bool
	Error     error
}

UninstallResult tracks what was uninstalled

type VersionInfo

type VersionInfo struct {
	Version string `json:"version"`
	Commit  string `json:"commit"`
	Date    string `json:"date"`
}

Jump to

Keyboard shortcuts

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