Documentation
¶
Overview ¶
Package cli provides CLI-specific types and utilities for the aix command.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnknownPlatform is returned when an unknown platform name is provided. ErrUnknownPlatform = errors.New("unknown platform") // ErrNoPlatformsAvailable is returned when no platforms are detected. ErrNoPlatformsAvailable = errors.New("no platforms available") )
Sentinel errors for platform operations.
Functions ¶
Types ¶
type AgentInfo ¶
type AgentInfo struct {
Name string
Description string
Source string // "local" or future: git URL
}
AgentInfo provides platform-agnostic agent information for display.
type CommandInfo ¶
type CommandInfo struct {
// Name is the command's identifier (used as /name in the interface).
Name string
// Description explains what the command does.
Description string
// Source indicates where the command came from: file path or "installed".
Source string
}
CommandInfo provides a simplified view of a command for CLI display. This is a platform-agnostic representation used for listing.
type MCPInfo ¶
type MCPInfo struct {
Name string
Transport string // "stdio" or "sse"
Command string // Executable path (stdio)
URL string // Endpoint (sse)
Disabled bool
Env map[string]string // Environment variables
}
MCPInfo provides platform-agnostic MCP server information for display.
type Platform ¶
type Platform interface {
// Name returns the platform identifier (e.g., "claude", "opencode").
Name() string
// DisplayName returns a human-readable platform name (e.g., "Claude Code").
DisplayName() string
// IsAvailable checks if the platform is installed on this system.
IsAvailable() bool
// SkillDir returns the skills directory for the platform.
SkillDir() string
// InstallSkill installs a skill to the platform.
// The skill parameter is platform-specific.
InstallSkill(skill any, scope Scope) error
// UninstallSkill removes a skill by name.
UninstallSkill(name string, scope Scope) error
// ListSkills returns information about all installed skills.
ListSkills(scope Scope) ([]SkillInfo, error)
// GetSkill retrieves a skill by name.
// Returns the platform-specific skill type.
GetSkill(name string, scope Scope) (any, error)
// CommandDir returns the commands directory for the platform.
CommandDir() string
// InstallCommand installs a slash command to the platform.
// The cmd parameter is platform-specific.
InstallCommand(cmd any, scope Scope) error
// UninstallCommand removes a command by name.
UninstallCommand(name string, scope Scope) error
// ListCommands returns information about all installed commands.
ListCommands(scope Scope) ([]CommandInfo, error)
// GetCommand retrieves a command by name.
// Returns the platform-specific command type.
GetCommand(name string, scope Scope) (any, error)
// MCP configuration
MCPConfigPath() string
AddMCP(server any, scope Scope) error
RemoveMCP(name string, scope Scope) error
ListMCP(scope Scope) ([]MCPInfo, error)
GetMCP(name string, scope Scope) (any, error)
EnableMCP(name string) error
DisableMCP(name string) error
// Agent configuration
AgentDir() string
InstallAgent(agent any, scope Scope) error
UninstallAgent(name string, scope Scope) error
ListAgents(scope Scope) ([]AgentInfo, error)
GetAgent(name string, scope Scope) (any, error)
// Backup configuration
// BackupPaths returns all config files/directories that should be backed up.
// This includes MCP config files and platform-specific directories (skills, commands, agents).
BackupPaths() []string
// IsLocalConfigIgnored checks if the local configuration is ignored by VCS.
IsLocalConfigIgnored() (bool, error)
}
Platform defines the interface that platform adapters must implement for CLI operations. This is the consumer interface used by CLI commands.
func NewPlatform ¶
func ResolvePlatforms ¶
ResolvePlatforms returns Platform instances for the given platform names. If names is empty, returns all detected/installed platforms. Returns an error if any platform name is invalid or if no platforms are available.
type Scope ¶ added in v0.7.0
type Scope int
Scope defines the configuration layer target (User, Project, Local, Managed).
const ( // ScopeDefault indicates that the platform should use its default behavior // (usually merged view for listing, or precedence-based for getting). ScopeDefault Scope = iota // ScopeUser targets the user's global home directory configuration. ScopeUser // ScopeProject targets the project/repository configuration (typically committed). ScopeProject // ScopeLocal targets local overrides within a project (typically gitignored). ScopeLocal // ScopeManaged targets system-level managed configuration. ScopeManaged )
func DetermineScope ¶ added in v0.7.0
DetermineScope resolves the configuration scope based on user request, environment context (Git), and interactivity.
Precedence: 1. Explicit request via flag (--scope) 2. Interactive prompt (if in repo and TTY available) 3. Project scope default (if in repo but no TTY) 4. User scope default (if not in repo)
func ParseScope ¶ added in v0.7.0
ParseScope converts a string to a Scope. Returns ScopeDefault if empty or invalid.
type SkillInfo ¶
type SkillInfo struct {
// Name is the skill's unique identifier.
Name string
// Description explains what the skill does.
Description string
// Source indicates where the skill came from: "local" or a git URL.
Source string
}
SkillInfo provides a simplified view of a skill for CLI display. This is a platform-agnostic representation used for listing.