config

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package config handles configuration loading and management.

Index

Constants

View Source
const DefaultSkillsDir = ".agent/skills"

DefaultSkillsDir is the default directory to install skills

View Source
const GlobalConfigDirName = ".ask"

GlobalConfigDirName is the name of the global config directory Global installation paths

View Source
const GlobalConfigFileName = "config.yaml"

GlobalConfigFileName is the name of the global config file

View Source
const GlobalLockFileName = "ask.lock"

GlobalLockFileName is the name of the global lock file

View Source
const GlobalSkillsDirName = "skills"

GlobalSkillsDirName is the name of the global skills directory

View Source
const LockFileName = "ask.lock"

LockFileName is the name of the lock file

Variables

View Source
var OfflineMode bool

OfflineMode indicates if the application is running in offline mode

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

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

func GetAgentSkillsDir(agent AgentType, global bool) (string, error)

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

func GetSkillsDirByScope(global bool) string

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

func IsValidAgent(name string) bool

IsValidAgent checks if the given agent name is supported

func SetOffline added in v1.5.0

func SetOffline(offline bool)

SetOffline sets the offline mode

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

func ResolveAgentType(name string) (AgentType, bool)

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 DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the default configuration

func LoadConfig

func LoadConfig() (*Config, error)

LoadConfig loads the current ask.yaml configuration

func LoadConfigByScope added in v0.6.0

func LoadConfigByScope(global bool) (*Config, error)

LoadConfigByScope loads config based on global flag

func LoadGlobalConfig added in v0.6.0

func LoadGlobalConfig() (*Config, error)

LoadGlobalConfig loads the global config file (~/.ask/config.yaml)

func (*Config) AddSkill

func (c *Config) AddSkill(skillName string)

AddSkill adds a skill to the configuration if it doesn't exist

func (*Config) AddSkillInfo

func (c *Config) AddSkillInfo(info SkillInfo)

AddSkillInfo adds a skill with metadata to the configuration

func (*Config) GetActiveSkillsDirs added in v0.6.0

func (c *Config) GetActiveSkillsDirs(projectDir string) []string

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

func (c *Config) GetEnabledSkillsDirs() []string

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

func (c *Config) GetSkillInfo(name string) *SkillInfo

GetSkillInfo returns skill info by name

func (*Config) GetSkillsDir added in v0.2.0

func (c *Config) GetSkillsDir() string

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

func (c *Config) ParseToolTargetFlags(targetFlags string) []string

ParseToolTargetFlags parses a comma-separated list of tool names into directories

func (*Config) RemoveSkill

func (c *Config) RemoveSkill(skillName string)

RemoveSkill removes a skill from the configuration

func (*Config) RemoveSkillInfo added in v0.2.0

func (c *Config) RemoveSkillInfo(skillName string)

RemoveSkillInfo removes skill metadata from the configuration

func (*Config) Save

func (c *Config) Save() error

Save saves the configuration to ask.yaml

func (*Config) SaveByScope added in v0.6.0

func (c *Config) SaveByScope(global bool) error

SaveByScope saves config based on global flag

func (*Config) SaveGlobal added in v0.6.0

func (c *Config) SaveGlobal() error

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

type LockFile struct {
	Version int         `yaml:"version"`
	Skills  []LockEntry `yaml:"skills"`
}

LockFile represents the ask.lock file structure

func LoadGlobalLockFile added in v0.6.0

func LoadGlobalLockFile() (*LockFile, error)

LoadGlobalLockFile loads the global lock file (~/.ask/ask.lock)

func LoadLockFile added in v0.2.0

func LoadLockFile() (*LockFile, error)

LoadLockFile loads the ask.lock file

func LoadLockFileByScope added in v0.6.0

func LoadLockFileByScope(global bool) (*LockFile, error)

LoadLockFileByScope loads lock file based on global flag

func (*LockFile) AddEntry added in v0.2.0

func (l *LockFile) AddEntry(entry LockEntry)

AddEntry adds or updates a lock entry

func (*LockFile) GetEntry added in v0.2.0

func (l *LockFile) GetEntry(name string) *LockEntry

GetEntry gets a lock entry by name

func (*LockFile) RemoveEntry added in v0.2.0

func (l *LockFile) RemoveEntry(name string)

RemoveEntry removes a lock entry by name

func (*LockFile) Save added in v0.2.0

func (l *LockFile) Save() error

Save saves the lock file to disk

func (*LockFile) SaveByScope added in v0.6.0

func (l *LockFile) SaveByScope(global bool) error

SaveByScope saves lock file based on global flag

func (*LockFile) SaveGlobal added in v0.6.0

func (l *LockFile) SaveGlobal() error

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

Jump to

Keyboard shortcuts

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