commands

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: Apache-2.0 Imports: 61 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultCloudSignupURL = "https://app.skills.new/relay/connect"

DefaultCloudSignupURL is the skills.new page that walks a user through “sx cloud connect“ in a browser. Environment override: “SX_CLOUD_URL“.

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

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 NewAuditCommand

func NewAuditCommand() *cobra.Command

NewAuditCommand creates the `sx audit` command.

func NewBotCommand

func NewBotCommand() *cobra.Command

NewBotCommand creates the `sx bot` command tree, mirroring `sx team`. Bots are non-human service identities that consume assets — see docs/bots.md for the full lifecycle and resolution rules.

func NewClientsCommand

func NewClientsCommand() *cobra.Command

NewClientsCommand creates the clients command

func NewCloudCommand

func NewCloudCommand() *cobra.Command

NewCloudCommand creates the “sx cloud“ parent command. Subcommands are “connect“, “attach“, “serve“, “status“, and “revoke“.

func NewCollectionCommand

func NewCollectionCommand() *cobra.Command

NewCollectionCommand returns the `sx collection` command group. Collections are created and managed in the desktop app; the CLI surface is read-only for now.

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 NewOrgCommand

func NewOrgCommand() *cobra.Command

NewOrgCommand returns `sx org` (vault-level governance).

func NewProfileCommand

func NewProfileCommand() *cobra.Command

NewProfileCommand creates the profile command with subcommands

func NewRemoveCommand

func NewRemoveCommand() *cobra.Command

NewRemoveCommand creates the remove command (deprecated: use 'sx vault remove')

func NewReportUsageCommand

func NewReportUsageCommand() *cobra.Command

NewReportUsageCommand creates the report-usage command

func NewRoleCommand

func NewRoleCommand() *cobra.Command

NewRoleCommand creates the role command with subcommands

func NewSelfUninstallCommand

func NewSelfUninstallCommand() *cobra.Command

NewSelfUninstallCommand creates the self-uninstall command.

func NewServeCommand

func NewServeCommand() *cobra.Command

NewServeCommand creates the serve command

func NewStatsCommand

func NewStatsCommand() *cobra.Command

NewStatsCommand creates the `sx stats` command.

func NewTeamCommand

func NewTeamCommand() *cobra.Command

NewTeamCommand creates the `sx team` command tree.

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

func NewVaultCommand() *cobra.Command

NewVaultCommand creates a new vault command

func PrintClientsSection

func PrintClientsSection(out *ui.Output, clientInfos []ClientInfo)

PrintClientsSection outputs styled client information to the given writer. Used by both 'sx clients' and 'sx config' commands.

func PrintClientsSectionWriter

func PrintClientsSectionWriter(w io.Writer, clientInfos []ClientInfo)

PrintClientsSectionWriter outputs styled client information to the given io.Writer. Used for compatibility with existing code that uses io.Writer.

func RunDefaultCommand

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

RunDefaultCommand runs `sx install` when the current directory is already configured for a vault, and otherwise shows help. "Configured" means the sx config file resolves — not that any lock file exists in the working directory, because in the current layout the per-user lock lives in the cache directory, not the project.

func ValidateMarketplaceReference

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
	Repository string   // Empty for global scope
	Path       string   // Path within repo (if path-scoped)
	Profile    string   // Profile that installed it; empty means default
	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"`
	Enabled        bool     `json:"enabled"`
	ForceEnabled   bool     `json:"forceEnabled,omitempty"`  // explicitly force-enabled in config
	ForceDisabled  bool     `json:"forceDisabled,omitempty"` // explicitly force-disabled in config
	Version        string   `json:"version,omitempty"`
	Directory      string   `json:"directory"`
	HooksInstalled bool     `json:"hooksInstalled"`
	Supports       []string `json:"supports"`
}

type ClientsOutput

type ClientsOutput struct {
	Clients []ClientInfo `json:"clients"`
}

ClientsOutput represents the output for the clients command

type CodexNotifyEvent

type CodexNotifyEvent struct {
	Type                 string   `json:"type"`
	TurnID               string   `json:"turn-id"`
	InputMessages        []string `json:"input-messages"`
	LastAssistantMessage string   `json:"last-assistant-message"`
}

CodexNotifyEvent represents the JSON payload from Codex notify hook

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 CopilotPostToolUseEvent

type CopilotPostToolUseEvent struct {
	ToolName string         `json:"toolName"`
	ToolArgs map[string]any `json:"toolArgs"`
}

CopilotPostToolUseEvent represents the JSON payload from GitHub Copilot postToolUse hook

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 KiroPostToolUseEvent

type KiroPostToolUseEvent struct {
	ToolName   string `json:"toolName"`
	ToolResult string `json:"toolResult"`
}

KiroPostToolUseEvent represents the JSON payload from Kiro postToolUse hook

type MarketplaceReference

type MarketplaceReference struct {
	PluginName  string
	Marketplace string
}

MarketplaceReference represents a parsed plugin@marketplace reference

func ParseMarketplaceReference

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 Section

type Section = utils.MarkdownSection

Section is an alias for utils.MarkdownSection for convenience

type SelfUninstallOptions

type SelfUninstallOptions struct {
	Yes        bool
	DryRun     bool
	KeepAssets bool
	Force      bool
	Verbose    bool
	// contains filtered or unexported fields
}

SelfUninstallOptions controls the self-uninstall flow.

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
	ClientsFlag string
}

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
	Repository string // Empty for global scope
	Path       string // Path within repo (if path-scoped)
	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