Documentation
¶
Index ¶
- Constants
- func ExtractRepoPath(gitURL string) string
- func FormatCommandInfoJSON(info *CommandInfo) (string, error)
- func FormatTags(tags []string) string
- func GenerateConfigPreview(opts InitOptions, existingCommands interface{}) (string, error)
- func GetInstallCommand(repository string) string
- func InitPlugin(opts InitOptions) error
- func InitProject(opts InitOptions) error
- func InitProjectWithCommands(opts InitOptions, existingCommands interface{}) error
- func Install(_ context.Context, opts InstallOptions) (string, bool, error)
- func InstallFromConfig(ctx context.Context, projectPath string, force bool) error
- func ListCommands(projectPath string) ([]string, error)
- func LockFileExists(projectPath string) bool
- func NormalizeRepositoryURL(url string) string
- func ParseCommandSpec(spec string) (repo, version string)
- func ParseRepositorySpec(spec string) (repository, version string)
- func ParseTags(input string) []string
- func ProjectConfigExists(projectPath string) bool
- func ReadCommandContentPreview(commandName, baseDir string, filesystem fs.FileSystem, lines int) (string, int, error)
- func Remove(opts RemoveOptions) error
- func SaveProjectConfig(projectPath string, config *ProjectConfig) error
- func WriteClaudeSettings(claudeDir string, s *ClaudeSettings) error
- func WriteLockFile(path string, lockFile *LockFile) error
- type ClaudeSettings
- type CommandDetail
- type CommandInfo
- type ConfigCommand
- type InitOptions
- type InstallOptions
- type InstalledCommand
- type ListOptions
- type LockCommand
- type LockFile
- type LockPlugin
- type MarketplaceEntry
- type MarketplaceSource
- type ProjectConfig
- func (pc *ProjectConfig) GetConfigCommands() []ConfigCommand
- func (pc *ProjectConfig) MarshalJSON() ([]byte, error)
- func (pc *ProjectConfig) MarshalYAML() ([]byte, error)
- func (pc *ProjectConfig) UnmarshalJSON(data []byte) error
- func (pc *ProjectConfig) UnmarshalYAML(data []byte) error
- func (pc *ProjectConfig) Validate() error
- type RemoveOptions
- type SearchOptions
- type SearchResult
- type StructureInfo
- type SyncAnalysis
- type SyncError
- type SyncOptions
- type SyncResult
- type UpdateOptions
- type UpdateResult
Constants ¶
const ( // ConfigFileName is the default name for the configuration file ConfigFileName = "ccmd.yaml" // LockFileName is the default name for the lock file LockFileName = "ccmd-lock.yaml" )
Variables ¶
This section is empty.
Functions ¶
func ExtractRepoPath ¶
ExtractRepoPath extracts the owner/repo path from a Git URL
func FormatCommandInfoJSON ¶
func FormatCommandInfoJSON(info *CommandInfo) (string, error)
FormatCommandInfoJSON formats command info as indented JSON
func FormatTags ¶
FormatTags formats a slice of tags as comma-separated string
func GenerateConfigPreview ¶
func GenerateConfigPreview(opts InitOptions, existingCommands interface{}) (string, error)
GenerateConfigPreview generates a YAML preview of the configuration
func GetInstallCommand ¶
GetInstallCommand generates the install command for the repository
func InitPlugin ¶ added in v1.2.0
func InitPlugin(opts InitOptions) error
InitPlugin creates a new Claude Code plugin project with the given options.
func InitProject ¶
func InitProject(opts InitOptions) error
InitProject creates a new ccmd project with the given options
func InitProjectWithCommands ¶
func InitProjectWithCommands(opts InitOptions, existingCommands interface{}) error
InitProjectWithCommands creates a project with existing commands preserved
func InstallFromConfig ¶
InstallFromConfig installs all commands and plugins from project's ccmd.yaml
func ListCommands ¶
ListCommands returns a list of all command names
func LockFileExists ¶
LockFileExists checks if ccmd-lock.yaml exists in the project
func NormalizeRepositoryURL ¶
func ParseCommandSpec ¶
ParseCommandSpec parses a command specification (e.g., "owner/repo@version")
func ParseRepositorySpec ¶
func ProjectConfigExists ¶
ProjectConfigExists checks if ccmd.yaml exists in the project
func ReadCommandContentPreview ¶
func ReadCommandContentPreview(commandName, baseDir string, filesystem fs.FileSystem, lines int) (string, int, error)
ReadCommandContentPreview reads a preview of the command's index.md file
func SaveProjectConfig ¶
func SaveProjectConfig(projectPath string, config *ProjectConfig) error
SaveProjectConfig saves the project configuration to ccmd.yaml
func WriteClaudeSettings ¶ added in v1.2.0
func WriteClaudeSettings(claudeDir string, s *ClaudeSettings) error
WriteClaudeSettings writes the .claude/settings.json file.
func WriteLockFile ¶
WriteLockFile writes the lock file to disk
Types ¶
type ClaudeSettings ¶ added in v1.2.0
type ClaudeSettings struct {
EnabledPlugins map[string]bool `json:"enabledPlugins,omitempty"`
ExtraKnownMarketplaces map[string]MarketplaceEntry `json:"extraKnownMarketplaces,omitempty"`
}
ClaudeSettings represents the .claude/settings.json structure
func ReadClaudeSettings ¶ added in v1.2.0
func ReadClaudeSettings(claudeDir string) (*ClaudeSettings, error)
ReadClaudeSettings reads the .claude/settings.json file.
type CommandDetail ¶
type CommandDetail struct {
Name string
Version string
Description string
Author string
Repository string
UpdatedAt string
InstalledAt string
BrokenStructure bool
StructureError string
Type string // "command" or "plugin"
// Additional metadata from ccmd.yaml
Tags []string
License string
Homepage string
Entry string
Requires string
Resolved string
}
CommandDetail represents detailed information about an installed command or plugin
func GetCommandInfo ¶
func GetCommandInfo(name, projectPath string) (*CommandDetail, error)
GetCommandInfo returns detailed information about a specific command
func List ¶
func List(opts ListOptions) ([]CommandDetail, error)
List returns a list of all installed commands
type CommandInfo ¶
type CommandInfo struct {
Name string `json:"name"`
Version string `json:"version"`
Author string `json:"author"`
Description string `json:"description"`
Repository string `json:"repository"`
License string `json:"license,omitempty"`
Homepage string `json:"homepage,omitempty"`
Tags []string `json:"tags,omitempty"`
Entry string `json:"entry,omitempty"`
Source string `json:"source"`
InstalledAt string `json:"installed_at"`
UpdatedAt string `json:"updated_at"`
Metadata map[string]string `json:"metadata,omitempty"`
Structure StructureInfo `json:"structure"`
}
CommandInfo represents the structured information about a command
func GetCommandDetails ¶
func GetCommandDetails(commandName, projectPath string, filesystem fs.FileSystem) (*CommandInfo, error)
GetCommandDetails retrieves detailed information about an installed command
type ConfigCommand ¶
type ConfigCommand struct {
Repo string `yaml:"repo"`
Version string `yaml:"version,omitempty"`
Name string `yaml:"name,omitempty"`
}
ConfigCommand represents a command in the configuration
type InitOptions ¶
type InitOptions struct {
Name string
Version string
Description string
Author string
Repository string
Entry string
Tags []string
ProjectPath string
CommandMode bool // true for command mode, false for project mode
Plugin bool // true to initialize as a Claude Code plugin
}
InitOptions represents options for initializing a project
func InitDefaults ¶
func InitDefaults(projectPath string) InitOptions
InitDefaults returns default values for init based on current directory
func LoadExistingConfig ¶
func LoadExistingConfig(projectPath string) (InitOptions, interface{}, error)
LoadExistingConfig attempts to load existing ccmd.yaml and returns defaults
type InstallOptions ¶
type InstallOptions struct {
Repository string // Git repository URL or shorthand
Version string // Version/tag to install (optional)
Commit string // Specific commit to install (used when different from Version)
Name string // Override command name (optional)
Force bool // Force reinstall if already exists
}
InstallOptions represents options for installing a command
type InstalledCommand ¶
type InstalledCommand struct {
Name string
Version string
Description string
Author string
Repository string
Path string
}
InstalledCommand represents an installed command
type ListOptions ¶
type ListOptions struct {
ProjectPath string // Path to project root
}
ListOptions represents options for listing commands
type LockCommand ¶
type LockCommand struct {
Name string `yaml:"name"`
Version string `yaml:"version"`
Source string `yaml:"source"`
Resolved string `yaml:"resolved"`
Commit string `yaml:"commit"`
InstalledAt time.Time `yaml:"installed_at"`
UpdatedAt time.Time `yaml:"updated_at"`
}
LockCommand represents a command entry in the lock file
type LockFile ¶
type LockFile struct {
Version string `yaml:"version"`
LockfileVersion int `yaml:"lockfileVersion"`
Commands map[string]*LockCommand `yaml:"commands"`
Plugins map[string]*LockPlugin `yaml:"plugins,omitempty"`
}
LockFile represents the ccmd-lock.yaml structure
func ReadLockFile ¶
ReadLockFile reads and parses the ccmd-lock.yaml file
type LockPlugin ¶ added in v1.2.0
type LockPlugin struct {
Name string `yaml:"name"`
Version string `yaml:"version"`
Source string `yaml:"source"`
Resolved string `yaml:"resolved"`
Commit string `yaml:"commit"`
InstalledAt time.Time `yaml:"installed_at"`
UpdatedAt time.Time `yaml:"updated_at"`
}
LockPlugin represents a plugin entry in the lock file
type MarketplaceEntry ¶ added in v1.2.0
type MarketplaceEntry struct {
Source MarketplaceSource `json:"source"`
}
MarketplaceEntry represents an entry in extraKnownMarketplaces
type MarketplaceSource ¶ added in v1.2.0
type MarketplaceSource struct {
Source string `json:"source"`
Path string `json:"path,omitempty"`
Repo string `json:"repo,omitempty"`
URL string `json:"url,omitempty"`
}
MarketplaceSource represents the source configuration for a plugin marketplace
type ProjectConfig ¶
type ProjectConfig struct {
// Project metadata (when ccmd.yaml is for a command)
Name string `yaml:"name,omitempty" json:"name,omitempty"`
Version string `yaml:"version,omitempty" json:"version,omitempty"`
Description string `yaml:"description" json:"description"`
Author string `yaml:"author" json:"author"`
Repository string `yaml:"repository" json:"repository"`
Entry string `yaml:"entry,omitempty" json:"entry,omitempty"`
Tags []string `yaml:"tags,omitempty" json:"tags,omitempty"`
License string `yaml:"license,omitempty" json:"license,omitempty"`
Homepage string `yaml:"homepage,omitempty" json:"homepage,omitempty"`
// Type indicates whether this is a "plugin" or command (default)
Type string `yaml:"type,omitempty" json:"type,omitempty"`
// Commands list (when ccmd.yaml is for a project)
Commands []string `yaml:"commands,omitempty" json:"commands,omitempty"`
// Plugins list (when ccmd.yaml is for a project)
Plugins []string `yaml:"plugins,omitempty" json:"plugins,omitempty"`
}
ProjectConfig represents the ccmd.yaml configuration file
func LoadProjectConfig ¶
func LoadProjectConfig(projectPath string) (*ProjectConfig, error)
LoadProjectConfig loads the project configuration from ccmd.yaml
func (*ProjectConfig) GetConfigCommands ¶
func (pc *ProjectConfig) GetConfigCommands() []ConfigCommand
GetConfigCommands returns the commands from the configuration
func (*ProjectConfig) MarshalJSON ¶
func (pc *ProjectConfig) MarshalJSON() ([]byte, error)
MarshalJSON marshals ProjectConfig to JSON
func (*ProjectConfig) MarshalYAML ¶
func (pc *ProjectConfig) MarshalYAML() ([]byte, error)
MarshalYAML marshals ProjectConfig to YAML
func (*ProjectConfig) UnmarshalJSON ¶
func (pc *ProjectConfig) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals JSON data into ProjectConfig
func (*ProjectConfig) UnmarshalYAML ¶
func (pc *ProjectConfig) UnmarshalYAML(data []byte) error
UnmarshalYAML unmarshals YAML data into ProjectConfig
func (*ProjectConfig) Validate ¶
func (pc *ProjectConfig) Validate() error
Validate validates the project config when used as command metadata
type RemoveOptions ¶
RemoveOptions represents options for removing a command
type SearchOptions ¶
SearchOptions contains options for searching commands
type SearchResult ¶
type SearchResult struct {
Name string
Version string
Description string
Author string
Tags []string
Repository string
}
SearchResult represents a command found in the search
func Search ¶
func Search(opts SearchOptions) ([]SearchResult, error)
Search searches for installed commands based on the provided options
type StructureInfo ¶
type StructureInfo struct {
DirectoryExists bool `json:"directory_exists"`
MarkdownExists bool `json:"markdown_exists"`
HasCcmdYaml bool `json:"has_ccmd_yaml"`
HasIndexMd bool `json:"has_index_md"`
IsValid bool `json:"is_valid"`
Issues []string `json:"issues,omitempty"`
}
StructureInfo contains information about command structure integrity
type SyncAnalysis ¶
type SyncAnalysis struct {
ToInstall []ConfigCommand
ToRemove []string
InSync bool
}
SyncAnalysis represents the analysis of what needs to be synced
func AnalyzeSync ¶
func AnalyzeSync(projectPath string) (*SyncAnalysis, error)
AnalyzeSync analyzes what needs to be synced between config and installed commands
type SyncOptions ¶
SyncOptions represents options for syncing commands
type SyncResult ¶
SyncResult represents the result of a sync operation
func Sync ¶
func Sync(ctx context.Context, opts SyncOptions) (*SyncResult, error)
Sync synchronizes installed commands with the project configuration
type UpdateOptions ¶
type UpdateOptions struct {
Name string // Command name (empty for all)
All bool // Update all commands
CheckOnly bool // Only check for updates without installing
Force bool // Force update even if version appears current
}
UpdateOptions represents options for updating commands
type UpdateResult ¶
UpdateResult represents the result of an update operation
func Update ¶
func Update(ctx context.Context, opts UpdateOptions) (*UpdateResult, error)
Update updates one or more installed commands