cli

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package cli provides CLI-specific types and utilities for the aix command.

Index

Constants

This section is empty.

Variables

View Source
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

This section is empty.

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) error

	// UninstallSkill removes a skill by name.
	UninstallSkill(name string) error

	// ListSkills returns information about all installed skills.
	ListSkills() ([]SkillInfo, error)

	// GetSkill retrieves a skill by name.
	// Returns the platform-specific skill type.
	GetSkill(name string) (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) error

	// UninstallCommand removes a command by name.
	UninstallCommand(name string) error

	// ListCommands returns information about all installed commands.
	ListCommands() ([]CommandInfo, error)

	// GetCommand retrieves a command by name.
	// Returns the platform-specific command type.
	GetCommand(name string) (any, error)

	// MCP configuration
	MCPConfigPath() string
	AddMCP(server any) error
	RemoveMCP(name string) error
	ListMCP() ([]MCPInfo, error)
	GetMCP(name string) (any, error)
	EnableMCP(name string) error
	DisableMCP(name string) error

	// Agent configuration
	AgentDir() string
	InstallAgent(agent any) error
	UninstallAgent(name string) error
	ListAgents() ([]AgentInfo, error)
	GetAgent(name string) (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
}

Platform defines the interface that platform adapters must implement for CLI operations. This is the consumer interface used by CLI commands.

func NewPlatform

func NewPlatform(name string) (Platform, error)

func ResolvePlatforms

func ResolvePlatforms(names []string) ([]Platform, error)

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 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.

Directories

Path Synopsis
Package prompt provides interactive CLI prompts for user input.
Package prompt provides interactive CLI prompts for user input.

Jump to

Keyboard shortcuts

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