Documentation
¶
Index ¶
- func DefaultCacheDir() string
- func DefaultConfigDir() string
- func FindProjectConfig(dir string) (string, bool)
- func HasProjectConfig() bool
- type AutoUpdateConfig
- type Config
- func (c *Config) ActiveServers() []*mcp.Server
- func (c *Config) CacheDir() string
- func (c *Config) CommandsForScope(scope Scope) []*command.Command
- func (c *Config) GetServerScope(name string) Scope
- func (c *Config) LocalResourceDir() string
- func (c *Config) Merge(other *Config) *Config
- func (c *Config) ProjectDir() string
- func (c *Config) ReloadResources() error
- func (c *Config) RulesForScope(scope Scope) []*rule.Rule
- func (c *Config) Save() error
- func (c *Config) SaveScoped(scope Scope) error
- func (c *Config) SaveTo(path string) error
- func (c *Config) ServersForScope(scope Scope) []*mcp.Server
- func (c *Config) SkillsForScope(scope Scope) []*skill.Skill
- type Scope
- type Settings
- type ToolConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultCacheDir ¶
func DefaultCacheDir() string
DefaultCacheDir returns the default cache directory
func DefaultConfigDir ¶
func DefaultConfigDir() string
DefaultConfigDir returns the default configuration directory
func FindProjectConfig ¶
FindProjectConfig walks up from dir looking for .agentctl.json
func HasProjectConfig ¶
func HasProjectConfig() bool
HasProjectConfig checks if current directory has a project config
Types ¶
type AutoUpdateConfig ¶
type AutoUpdateConfig struct {
Enabled bool `json:"enabled"`
Interval string `json:"interval,omitempty"` // e.g., "24h"
Servers map[string]string `json:"servers,omitempty"` // "auto" or "notify" per server
}
AutoUpdateConfig configures automatic update behavior
type Config ¶
type Config struct {
Version string `json:"version"`
Servers map[string]*mcp.Server `json:"servers,omitempty"`
Commands []string `json:"commands,omitempty"` // Command names to include
Rules []string `json:"rules,omitempty"` // Rule names to include
Skills []string `json:"skills,omitempty"` // Skill names to include
Disabled []string `json:"disabled,omitempty"` // Resources to disable
Profile string `json:"profile,omitempty"` // Active profile (for project configs)
Settings Settings `json:"settings,omitempty"`
// Loaded resources (not serialized)
LoadedCommands []*command.Command `json:"-"`
LoadedRules []*rule.Rule `json:"-"`
LoadedSkills []*skill.Skill `json:"-"`
// Path info (not serialized)
Path string `json:"-"` // Path to config file
ConfigDir string `json:"-"` // Config directory
ProjectPath string `json:"-"` // Path to project config (if loaded from project)
}
Config represents the main agentctl configuration
func InitProjectConfig ¶
InitProjectConfig creates a .agentctl.json in the given directory
func LoadProjectConfig ¶
LoadProjectConfig loads a project-local configuration and merges with global
func LoadScoped ¶
LoadScoped loads configuration for a specific scope only
func LoadWithProject ¶
LoadWithProject loads global config merged with any project config in cwd
func (*Config) ActiveServers ¶
ActiveServers returns the list of non-disabled servers
func (*Config) CommandsForScope ¶
CommandsForScope returns commands that belong to a specific scope
func (*Config) GetServerScope ¶
GetServerScope returns the scope of a specific server
func (*Config) LocalResourceDir ¶
LocalResourceDir returns the local resource directory path for the project
func (*Config) Merge ¶
Merge merges another config into this one (other takes precedence) Servers from the base config are marked as "global", servers from other are marked as "local"
func (*Config) ProjectDir ¶
ProjectDir returns the project directory if a project config is loaded
func (*Config) ReloadResources ¶
ReloadResources reloads all resources from disk (global and local) This should be called after creating, editing, or deleting resources
func (*Config) RulesForScope ¶
RulesForScope returns rules that belong to a specific scope
func (*Config) SaveScoped ¶
SaveScoped saves the configuration to the appropriate location based on scope
func (*Config) ServersForScope ¶
ServersForScope returns servers that belong to a specific scope
type Scope ¶
type Scope string
Scope represents the configuration scope (local/project vs global/user)
const ( // ScopeLocal represents project-specific configuration (.agentctl.json) ScopeLocal Scope = "local" // ScopeGlobal represents user-wide configuration (~/.config/agentctl/agentctl.json) ScopeGlobal Scope = "global" // ScopeAll represents both scopes (used for sync operations) ScopeAll Scope = "all" )
func ParseScope ¶
ParseScope parses a string into a Scope value Accepts aliases: "project" for "local", "user" for "global"
func (Scope) Description ¶
Description returns a human-readable description of the scope
func (Scope) ShortString ¶
ShortString returns a short indicator for display (e.g., [G] or [L])
type Settings ¶
type Settings struct {
DefaultProfile string `json:"defaultProfile,omitempty"`
AutoUpdate AutoUpdateConfig `json:"autoUpdate,omitempty"`
Tools map[string]ToolConfig `json:"tools,omitempty"`
}
Settings contains global settings
type ToolConfig ¶
type ToolConfig struct {
Enabled bool `json:"enabled"`
Overrides map[string]any `json:"overrides,omitempty"`
}
ToolConfig configures a specific tool