Documentation
¶
Overview ¶
Package config handles configuration loading and management.
Index ¶
- Constants
- Variables
- func CreateDefaultConfig() error
- func EnsureGlobalDirExists() error
- func GetAgentSkillsDir(agent AgentType, global bool) (string, error)
- func GetAllAgentSkillsDirs() []string
- func GetGlobalConfigDir() string
- func GetGlobalConfigPath() string
- func GetGlobalLockPath() string
- func GetGlobalSkillsDir() string
- func GetSkillsDirByScope(global bool) string
- func GetSupportedAgentNames() []string
- func IsValidAgent(name string) bool
- func SetOffline(offline bool)
- type AgentConfig
- type AgentType
- type Config
- func (c *Config) AddSkill(skillName string)
- func (c *Config) AddSkillInfo(info SkillInfo)
- func (c *Config) GetActiveSkillsDirs(projectDir string) []string
- func (c *Config) GetEnabledSkillsDirs() []string
- func (c *Config) GetEnabledToolTargets() []ToolTarget
- func (c *Config) GetSkillInfo(name string) *SkillInfo
- func (c *Config) GetSkillsDir() string
- func (c *Config) GetToolTargetByName(name string) *ToolTarget
- func (c *Config) GetToolTargets() []ToolTarget
- func (c *Config) ParseToolTargetFlags(targetFlags string) []string
- func (c *Config) RemoveSkill(skillName string)
- func (c *Config) RemoveSkillInfo(skillName string)
- func (c *Config) Save() error
- func (c *Config) SaveByScope(global bool) error
- func (c *Config) SaveGlobal() error
- type LockEntry
- type LockFile
- type Repo
- type SkillInfo
- type ToolTarget
Constants ¶
const DefaultSkillsDir = ".agent/skills"
DefaultSkillsDir is the default directory to install skills
const GlobalConfigDirName = ".ask"
GlobalConfigDirName is the name of the global config directory Global installation paths
const GlobalConfigFileName = "config.yaml"
GlobalConfigFileName is the name of the global config file
const GlobalLockFileName = "ask.lock"
GlobalLockFileName is the name of the global lock file
const GlobalSkillsDirName = "skills"
GlobalSkillsDirName is the name of the global skills directory
const LockFileName = "ask.lock"
LockFileName is the name of the lock file
Variables ¶
var OfflineMode bool
OfflineMode indicates if the application is running in offline mode
var OptionalRepos = []Repo{
{
Name: "community",
Type: "topic",
URL: "agent-skill OR topic:agent-skills",
},
}
OptionalRepos returns a list of optional repositories that are not enabled by default
var SupportedAgents = map[AgentType]AgentConfig{ AgentClaude: { Name: "Claude", ProjectDir: ".claude/skills", GlobalDir: ".claude/skills", Aliases: []string{"claude-code"}, }, AgentCursor: { Name: "Cursor", ProjectDir: ".cursor/skills", GlobalDir: ".cursor/skills", Aliases: []string{}, }, AgentCodex: { Name: "Codex", ProjectDir: ".codex/skills", GlobalDir: ".codex/skills", Aliases: []string{"openai-codex"}, }, AgentOpenCode: { Name: "OpenCode", ProjectDir: ".opencode/skills", GlobalDir: ".config/opencode/skills", Aliases: []string{}, }, AgentAntigravity: { Name: "Antigravity", ProjectDir: ".agent/skills", GlobalDir: ".gemini/antigravity/skills", Aliases: []string{"gemini-antigravity"}, }, AgentGemini: { Name: "Gemini CLI", ProjectDir: ".gemini/skills", GlobalDir: ".gemini/skills", Aliases: []string{"gemini-cli"}, }, AgentCopilot: { Name: "GitHub Copilot", ProjectDir: ".github/skills", GlobalDir: ".copilot/skills", Aliases: []string{"github-copilot"}, }, AgentWindsurf: { Name: "Windsurf", ProjectDir: ".windsurf/skills", GlobalDir: ".codeium/windsurf/skills", Aliases: []string{}, }, AgentAmp: { Name: "Amp", ProjectDir: ".agents/skills", GlobalDir: ".config/agents/skills", Aliases: []string{}, }, AgentGoose: { Name: "Goose", ProjectDir: ".goose/skills", GlobalDir: ".config/goose/skills", Aliases: []string{}, }, AgentKilo: { Name: "Kilo", ProjectDir: ".kilocode/skills", GlobalDir: ".kilocode/skills", Aliases: []string{"kilocode"}, }, AgentKiro: { Name: "Kiro", ProjectDir: ".kiro/skills", GlobalDir: ".kiro/skills", Aliases: []string{"kiro-cli"}, }, AgentRoo: { Name: "Roo", ProjectDir: ".roo/skills", GlobalDir: ".roo/skills", Aliases: []string{}, }, AgentTrae: { Name: "Trae", ProjectDir: ".trae/skills", GlobalDir: ".trae/skills", Aliases: []string{}, }, AgentDroid: { Name: "Droid", ProjectDir: ".factory/skills", GlobalDir: ".factory/skills", Aliases: []string{}, }, AgentClawdBot: { Name: "ClawdBot", ProjectDir: "skills", GlobalDir: ".clawdbot/skills", Aliases: []string{}, }, AgentNeovate: { Name: "Neovate", ProjectDir: ".neovate/skills", GlobalDir: ".neovate/skills", Aliases: []string{}, }, AgentCodeBuddy: { Name: "CodeBuddy", ProjectDir: ".codebuddy/skills", GlobalDir: ".codebuddy/skills", Aliases: []string{}, }, }
SupportedAgents maps agent types to their configurations
Functions ¶
func CreateDefaultConfig ¶
func CreateDefaultConfig() error
CreateDefaultConfig creates a new ask.yaml in the current directory
func EnsureGlobalDirExists ¶ added in v0.6.0
func EnsureGlobalDirExists() error
EnsureGlobalDirExists creates the global config directory if it doesn't exist
func GetAgentSkillsDir ¶ added in v0.6.0
GetAgentSkillsDir returns the skills directory for a specific agent If global is true, returns the user-level directory (e.g., ~/.claude/skills) Otherwise returns the project-level directory (e.g., .claude/skills)
func GetAllAgentSkillsDirs ¶ added in v0.6.0
func GetAllAgentSkillsDirs() []string
GetAllAgentSkillsDirs returns all possible skill directories for discovery Returns both project-level and global directories for all supported agents
func GetGlobalConfigDir ¶ added in v0.6.0
func GetGlobalConfigDir() string
GetGlobalConfigDir returns the global config directory path (~/.ask)
func GetGlobalConfigPath ¶ added in v0.6.0
func GetGlobalConfigPath() string
GetGlobalConfigPath returns the global config file path (~/.ask/config.yaml)
func GetGlobalLockPath ¶ added in v0.6.0
func GetGlobalLockPath() string
GetGlobalLockPath returns the global lock file path (~/.ask/ask.lock)
func GetGlobalSkillsDir ¶ added in v0.6.0
func GetGlobalSkillsDir() string
GetGlobalSkillsDir returns the global skills directory path (~/.ask/skills)
func GetSkillsDirByScope ¶ added in v0.6.0
GetSkillsDirByScope returns the skills directory based on global flag
func GetSupportedAgentNames ¶ added in v0.6.0
func GetSupportedAgentNames() []string
GetSupportedAgentNames returns a list of all supported agent type names
func IsValidAgent ¶ added in v0.6.0
IsValidAgent checks if the given agent name is supported
Types ¶
type AgentConfig ¶ added in v0.6.0
type AgentConfig struct {
Name string // Display name
ProjectDir string // Project-level skills directory (e.g., ".claude/skills")
GlobalDir string // User-level skills directory (e.g., "~/.claude/skills")
Aliases []string // Alternative names for this agent
}
AgentConfig holds directory paths for an agent
type AgentType ¶ added in v0.6.0
type AgentType string
AgentType represents a supported AI coding agent
const ( // AgentClaude represents the Claude agent AgentClaude AgentType = "claude" // AgentCursor represents the Cursor agent AgentCursor AgentType = "cursor" // AgentCodex represents the OpenAI Codex agent AgentCodex AgentType = "codex" // AgentOpenCode represents the OpenCode agent AgentOpenCode AgentType = "opencode" // AgentAntigravity represents the Antigravity agent AgentAntigravity AgentType = "antigravity" // AgentGemini represents the Gemini CLI agent AgentGemini AgentType = "gemini" // AgentCopilot represents the GitHub Copilot agent AgentCopilot AgentType = "copilot" // AgentWindsurf represents the Windsurf agent AgentWindsurf AgentType = "windsurf" // AgentAmp represents the Amp agent AgentAmp AgentType = "amp" // AgentGoose represents the Goose agent AgentGoose AgentType = "goose" // AgentKilo represents the Kilo agent AgentKilo AgentType = "kilo" // AgentKiro represents the Kiro agent AgentKiro AgentType = "kiro" // AgentRoo represents the Roo agent AgentRoo AgentType = "roo" // AgentTrae represents the Trae agent AgentTrae AgentType = "trae" // AgentDroid represents the Droid agent AgentDroid AgentType = "droid" // AgentClawdBot represents the ClawdBot agent AgentClawdBot AgentType = "clawdbot" // AgentNeovate represents the Neovate agent AgentNeovate AgentType = "neovate" // AgentCodeBuddy represents the CodeBuddy agent AgentCodeBuddy AgentType = "codebuddy" )
func ResolveAgentType ¶ added in v0.6.0
ResolveAgentType resolves an agent name (including aliases) to its AgentType
type Config ¶
type Config struct {
Version string `yaml:"version"`
SkillsDir string `yaml:"skills_dir,omitempty"` // Skills installation directory (default: .agent/skills)
ToolTargets []ToolTarget `yaml:"tool_targets,omitempty"` // Target AI tools for skill installation
Skills []string `yaml:"skills,omitempty"` // Legacy: simple list of skill names
SkillsInfo []SkillInfo `yaml:"skills_info,omitempty"` // New: skills with metadata
Repos []Repo `yaml:"repos,omitempty"`
LastProjectRoot string `yaml:"last_project_root,omitempty"` // Last used project root (global only)
}
Config represents the structure of ask.yaml
func LoadConfig ¶
LoadConfig loads the current ask.yaml configuration
func LoadConfigByScope ¶ added in v0.6.0
LoadConfigByScope loads config based on global flag
func LoadGlobalConfig ¶ added in v0.6.0
LoadGlobalConfig loads the global config file (~/.ask/config.yaml)
func (*Config) AddSkillInfo ¶
AddSkillInfo adds a skill with metadata to the configuration
func (*Config) GetActiveSkillsDirs ¶ added in v0.6.0
GetActiveSkillsDirs returns skill directories that exist or should be created If specific tool directories exist, only those are returned; otherwise returns all enabled
func (*Config) GetEnabledSkillsDirs ¶ added in v0.6.0
GetEnabledSkillsDirs returns all enabled skill directories
func (*Config) GetEnabledToolTargets ¶ added in v0.6.0
func (c *Config) GetEnabledToolTargets() []ToolTarget
GetEnabledToolTargets returns only the enabled tool targets
func (*Config) GetSkillInfo ¶
GetSkillInfo returns skill info by name
func (*Config) GetSkillsDir ¶ added in v0.2.0
GetSkillsDir returns the skills directory, using default if not set
func (*Config) GetToolTargetByName ¶ added in v0.6.0
func (c *Config) GetToolTargetByName(name string) *ToolTarget
GetToolTargetByName returns a tool target by name
func (*Config) GetToolTargets ¶ added in v0.6.0
func (c *Config) GetToolTargets() []ToolTarget
GetToolTargets returns the configured tool targets, or defaults if none configured
func (*Config) ParseToolTargetFlags ¶ added in v0.6.0
ParseToolTargetFlags parses a comma-separated list of tool names into directories
func (*Config) RemoveSkill ¶
RemoveSkill removes a skill from the configuration
func (*Config) RemoveSkillInfo ¶ added in v0.2.0
RemoveSkillInfo removes skill metadata from the configuration
func (*Config) SaveByScope ¶ added in v0.6.0
SaveByScope saves config based on global flag
func (*Config) SaveGlobal ¶ added in v0.6.0
SaveGlobal saves the configuration to the global config file (~/.ask/config.yaml)
type LockEntry ¶ added in v0.2.0
type LockEntry struct {
Name string `yaml:"name"`
Source string `yaml:"source,omitempty"`
URL string `yaml:"url"`
Commit string `yaml:"commit,omitempty"`
Version string `yaml:"version,omitempty"`
InstalledAt time.Time `yaml:"installed_at"`
}
LockEntry represents a locked skill version
type LockFile ¶ added in v0.2.0
LockFile represents the ask.lock file structure
func LoadGlobalLockFile ¶ added in v0.6.0
LoadGlobalLockFile loads the global lock file (~/.ask/ask.lock)
func LoadLockFile ¶ added in v0.2.0
LoadLockFile loads the ask.lock file
func LoadLockFileByScope ¶ added in v0.6.0
LoadLockFileByScope loads lock file based on global flag
func (*LockFile) RemoveEntry ¶ added in v0.2.0
RemoveEntry removes a lock entry by name
func (*LockFile) SaveByScope ¶ added in v0.6.0
SaveByScope saves lock file based on global flag
func (*LockFile) SaveGlobal ¶ added in v0.6.0
SaveGlobal saves the lock file to the global location (~/.ask/ask.lock)
type Repo ¶ added in v0.2.0
type Repo struct {
Name string `yaml:"name"`
Type string `yaml:"type"` // "topic" or "dir"
URL string `yaml:"url"` // GitHub topic or "owner/repo/path"
}
Repo represents a skill repository
type SkillInfo ¶
type SkillInfo struct {
Name string `yaml:"name"`
Description string `yaml:"description,omitempty"`
URL string `yaml:"url,omitempty"`
}
SkillInfo represents an installed skill with metadata
type ToolTarget ¶ added in v0.6.0
type ToolTarget struct {
Name string `yaml:"name" json:"name"`
SkillsDir string `yaml:"skills_dir" json:"skills_dir"`
Enabled bool `yaml:"enabled" json:"enabled"`
}
ToolTarget represents a supported AI coding tool
func DefaultToolTargets ¶ added in v0.6.0
func DefaultToolTargets() []ToolTarget
DefaultToolTargets returns the supported AI coding tools
func DetectExistingToolDirs ¶ added in v0.6.0
func DetectExistingToolDirs(projectDir string) []ToolTarget
DetectExistingToolDirs detects which AI tool directories already exist in the project