config

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAmpCodeConfigPath added in v0.0.9

func GetAmpCodeConfigPath() (string, error)

GetAmpCodeConfigPath returns the path for the Amp settings file in Cursor

func GetAmpConfigPath added in v0.0.13

func GetAmpConfigPath() (string, error)

GetAmpConfigPath returns the path for the standalone Amp settings file

func GetCrushConfigPath added in v0.0.14

func GetCrushConfigPath() (string, error)

GetCrushConfigPath returns the first existing Crush config file, or the default if none exist

func GetCrushConfigPaths added in v0.0.14

func GetCrushConfigPaths() []string

GetCrushConfigPaths returns the priority-ordered list of Crush config file paths

func GetDefaultClaudeDesktopConfigPath added in v0.0.5

func GetDefaultClaudeDesktopConfigPath() (string, error)

GetDefaultClaudeDesktopConfigPath returns the default path for the Claude desktop configuration file

func GetDefaultProfilesPath added in v0.0.4

func GetDefaultProfilesPath() (string, error)

GetDefaultProfilesPath returns the default path for the profiles configuration file

func GetGlobalCursorMCPConfigPath added in v0.0.9

func GetGlobalCursorMCPConfigPath() (string, error)

GetGlobalCursorMCPConfigPath returns the path for the global Cursor MCP configuration file

func GetProfilesPath added in v0.0.4

func GetProfilesPath(configFile string) (string, error)

GetProfilesPath returns the profiles path from either the provided path or the default location

func GetProjectCursorMCPConfigPath added in v0.0.9

func GetProjectCursorMCPConfigPath(projectDir string) string

GetProjectCursorMCPConfigPath returns the path for the project-specific Cursor MCP configuration file

Types

type AmpCodeConfig added in v0.0.9

type AmpCodeConfig struct {
	AmpMCPServers map[string]AmpCodeMCPServer `json:"amp.mcpServers"`
	DisabledTools []string                    `json:"amp.tools.disable,omitempty"`
}

AmpCodeConfig represents the Amp configuration which contains MCP servers settings

type AmpCodeEditor added in v0.0.9

type AmpCodeEditor struct {
	// contains filtered or unexported fields
}

AmpCodeEditor manages the Amp user settings configuration

func NewAmpCodeEditor added in v0.0.9

func NewAmpCodeEditor(path string) (*AmpCodeEditor, error)

NewAmpCodeEditor creates a new editor for the AmpCode configuration

func (*AmpCodeEditor) AddMCPServer added in v0.0.9

func (e *AmpCodeEditor) AddMCPServer(server types.CommonServer, overwrite bool) error

AddMCPServer adds or updates a server configuration using the CommonServer struct.

func (*AmpCodeEditor) DisableMCPServer added in v0.0.9

func (e *AmpCodeEditor) DisableMCPServer(name string) error

DisableMCPServer disables an MCP server without removing its configuration

func (*AmpCodeEditor) EnableMCPServer added in v0.0.9

func (e *AmpCodeEditor) EnableMCPServer(name string) error

EnableMCPServer enables a previously disabled MCP server

func (*AmpCodeEditor) GetConfigPath added in v0.0.9

func (e *AmpCodeEditor) GetConfigPath() string

GetConfigPath returns the path to the configuration file

func (*AmpCodeEditor) GetServer added in v0.0.9

func (e *AmpCodeEditor) GetServer(name string) (types.CommonServer, bool, error)

GetServer retrieves a specific server configuration by name as CommonServer

func (*AmpCodeEditor) IsServerDisabled added in v0.0.9

func (e *AmpCodeEditor) IsServerDisabled(name string) (bool, error)

IsServerDisabled checks if a server is disabled

func (*AmpCodeEditor) ListDisabledServers added in v0.0.9

func (e *AmpCodeEditor) ListDisabledServers() ([]string, error)

ListDisabledServers returns a list of disabled server names

func (*AmpCodeEditor) ListServers added in v0.0.9

func (e *AmpCodeEditor) ListServers() (map[string]types.CommonServer, error)

ListServers returns a map of all configured servers as CommonServer

func (*AmpCodeEditor) RemoveMCPServer added in v0.0.9

func (e *AmpCodeEditor) RemoveMCPServer(name string) error

RemoveMCPServer removes an MCP server configuration

func (*AmpCodeEditor) Save added in v0.0.9

func (e *AmpCodeEditor) Save() error

Save writes the configuration to disk

type AmpCodeMCPServer added in v0.0.9

type AmpCodeMCPServer struct {
	Command  string            `json:"command,omitempty"`
	Args     []string          `json:"args,omitempty"`
	Env      map[string]string `json:"env,omitempty"`
	Disabled bool              `json:"disabled,omitempty"`
}

AmpCodeMCPServer represents a server configuration for Amp

type ClaudeDesktopConfig added in v0.0.5

type ClaudeDesktopConfig struct {
	MCPServers      map[string]MCPServer `json:"mcpServers"`
	DisabledServers map[string]MCPServer `json:"disabledServersConfig,omitempty"`
}

ClaudeDesktopConfig represents the configuration for the Claude desktop application

type ClaudeDesktopEditor added in v0.0.5

type ClaudeDesktopEditor struct {
	// contains filtered or unexported fields
}

ClaudeDesktopEditor manages the Claude desktop configuration

func NewClaudeDesktopEditor added in v0.0.5

func NewClaudeDesktopEditor(path string) (*ClaudeDesktopEditor, error)

NewClaudeDesktopEditor creates a new editor for the Claude desktop configuration

func (*ClaudeDesktopEditor) AddMCPServer added in v0.0.5

func (e *ClaudeDesktopEditor) AddMCPServer(server types.CommonServer, overwrite bool) error

AddMCPServer adds or updates a server configuration using the CommonServer struct.

func (*ClaudeDesktopEditor) AddMCPServerRaw added in v0.0.9

func (e *ClaudeDesktopEditor) AddMCPServerRaw(name string, command string, args []string, env map[string]string, overwrite bool) error

AddMCPServer adds or updates an MCP server configuration DEPRECATED: Use AddMCPServer with CommonServer instead.

func (*ClaudeDesktopEditor) DisableMCPServer added in v0.0.5

func (e *ClaudeDesktopEditor) DisableMCPServer(name string) error

DisableMCPServer disables an MCP server without removing its configuration

func (*ClaudeDesktopEditor) EnableMCPServer added in v0.0.5

func (e *ClaudeDesktopEditor) EnableMCPServer(name string) error

EnableMCPServer enables a previously disabled MCP server

func (*ClaudeDesktopEditor) GetConfigPath added in v0.0.5

func (e *ClaudeDesktopEditor) GetConfigPath() string

GetConfigPath returns the path to the configuration file

func (*ClaudeDesktopEditor) GetServer added in v0.0.9

func (e *ClaudeDesktopEditor) GetServer(name string) (types.CommonServer, bool, error)

GetServer retrieves a specific server configuration by name as CommonServer.

func (*ClaudeDesktopEditor) IsServerDisabled added in v0.0.5

func (e *ClaudeDesktopEditor) IsServerDisabled(name string) (bool, error)

IsServerDisabled checks if a server is in the disabled list.

func (*ClaudeDesktopEditor) ListDisabledServers added in v0.0.5

func (e *ClaudeDesktopEditor) ListDisabledServers() ([]string, error)

ListDisabledServers returns a list of disabled server names

func (*ClaudeDesktopEditor) ListServers added in v0.0.5

func (e *ClaudeDesktopEditor) ListServers() (map[string]types.CommonServer, error)

ListServers returns a map of all configured servers (enabled and disabled) as CommonServer.

func (*ClaudeDesktopEditor) ListServersRaw added in v0.0.9

func (e *ClaudeDesktopEditor) ListServersRaw() map[string]MCPServer

ListServers returns a list of configured MCP servers DEPRECATED: Use the new ListServers which returns map[string]CommonServer.

func (*ClaudeDesktopEditor) RemoveMCPServer added in v0.0.5

func (e *ClaudeDesktopEditor) RemoveMCPServer(name string) error

RemoveMCPServer removes an MCP server configuration from both enabled and disabled lists.

func (*ClaudeDesktopEditor) Save added in v0.0.5

func (e *ClaudeDesktopEditor) Save() error

Save writes the configuration to disk

type Config

type Config struct {
	Version        string              `yaml:"version"`
	DefaultProfile string              `yaml:"defaultProfile"`
	Profiles       map[string]*Profile `yaml:"profiles"`
}

Config represents the root configuration

func LoadFromFile

func LoadFromFile(path string) (*Config, error)

LoadFromFile loads a configuration from a YAML file

type ConfigEditor added in v0.0.4

type ConfigEditor struct {
	// contains filtered or unexported fields
}

func NewConfigEditor added in v0.0.4

func NewConfigEditor(path string) (*ConfigEditor, error)

func (*ConfigEditor) AddProfile added in v0.0.4

func (c *ConfigEditor) AddProfile(name, description string) error

func (*ConfigEditor) AddPromptDirectory added in v0.0.9

func (c *ConfigEditor) AddPromptDirectory(profile, path string, defaults map[string]interface{}) error

AddPromptDirectory adds a prompt directory to a profile

func (*ConfigEditor) AddPromptFile added in v0.0.9

func (c *ConfigEditor) AddPromptFile(profile, path string) error

AddPromptFile adds a prompt file to a profile

func (*ConfigEditor) AddToolDirectory added in v0.0.4

func (c *ConfigEditor) AddToolDirectory(profile, path string, defaults map[string]interface{}) error

func (*ConfigEditor) AddToolFile added in v0.0.4

func (c *ConfigEditor) AddToolFile(profile, path string) error

func (*ConfigEditor) DeleteNode added in v0.0.9

func (c *ConfigEditor) DeleteNode(parent *yaml.Node, key string) error

DeleteNode removes a node from a mapping node by its key

func (*ConfigEditor) DeleteProfile added in v0.0.9

func (c *ConfigEditor) DeleteProfile(name string) error

DeleteProfile removes a profile from the configuration

func (*ConfigEditor) DuplicateProfile added in v0.0.4

func (c *ConfigEditor) DuplicateProfile(source, target, description string) error

func (*ConfigEditor) GetDefaultProfile added in v0.0.4

func (c *ConfigEditor) GetDefaultProfile() (string, error)

func (*ConfigEditor) GetProfile added in v0.0.4

func (c *ConfigEditor) GetProfile(name string) (*yaml.Node, error)

func (*ConfigEditor) GetProfiles added in v0.0.4

func (c *ConfigEditor) GetProfiles() (map[string]string, error)

func (*ConfigEditor) Save added in v0.0.4

func (c *ConfigEditor) Save() error

func (*ConfigEditor) SetDefaultProfile added in v0.0.4

func (c *ConfigEditor) SetDefaultProfile(profile string) error

type CrushEditor added in v0.0.14

type CrushEditor struct {
	// contains filtered or unexported fields
}

CrushEditor implements ServerConfigEditor for Crush JSON configuration

func NewCrushEditor added in v0.0.14

func NewCrushEditor(filePath string) (*CrushEditor, error)

NewCrushEditor creates a new CrushEditor for the given file path

func (*CrushEditor) AddMCPServer added in v0.0.14

func (c *CrushEditor) AddMCPServer(server types.CommonServer, overwrite bool) error

AddMCPServer adds a new MCP server to the configuration

func (*CrushEditor) DisableMCPServer added in v0.0.14

func (c *CrushEditor) DisableMCPServer(name string) error

DisableMCPServer disables a server (no-op for Crush since there's no disabled concept)

func (*CrushEditor) EnableMCPServer added in v0.0.14

func (c *CrushEditor) EnableMCPServer(name string) error

EnableMCPServer enables a server (no-op for Crush since there's no disabled concept)

func (*CrushEditor) GetConfigPath added in v0.0.14

func (c *CrushEditor) GetConfigPath() string

GetConfigPath returns the path of the configuration file being managed

func (*CrushEditor) GetServer added in v0.0.14

func (c *CrushEditor) GetServer(name string) (types.CommonServer, bool, error)

GetServer retrieves a specific server by name

func (*CrushEditor) IsServerDisabled added in v0.0.14

func (c *CrushEditor) IsServerDisabled(name string) (bool, error)

IsServerDisabled checks if a server is disabled (Crush doesn't have disabled concept, always false)

func (*CrushEditor) ListDisabledServers added in v0.0.14

func (c *CrushEditor) ListDisabledServers() ([]string, error)

ListDisabledServers returns the names of disabled servers (always empty for Crush)

func (*CrushEditor) ListServers added in v0.0.14

func (c *CrushEditor) ListServers() (map[string]types.CommonServer, error)

ListServers returns all MCP entries as CommonServer objects

func (*CrushEditor) RemoveMCPServer added in v0.0.14

func (c *CrushEditor) RemoveMCPServer(name string) error

RemoveMCPServer removes an MCP server from the configuration

func (*CrushEditor) Save added in v0.0.14

func (c *CrushEditor) Save() error

Save writes the configuration to the file

type CrushMCPConfig added in v0.0.14

type CrushMCPConfig struct {
	MCP map[string]CrushMCPEntry `json:"mcp"`
}

CrushMCPConfig represents the structure of Crush's MCP configuration

type CrushMCPEntry added in v0.0.14

type CrushMCPEntry struct {
	Type    string            `json:"type"`
	URL     string            `json:"url,omitempty"`
	Command string            `json:"command,omitempty"`
	Args    []string          `json:"args,omitempty"`
	Env     map[string]string `json:"env,omitempty"`
	Headers map[string]string `json:"headers,omitempty"`
}

CrushMCPEntry represents an individual MCP entry in Crush configuration

type CursorMCPConfig added in v0.0.9

type CursorMCPConfig struct {
	MCPServers      map[string]CursorMCPServer `json:"mcpServers"`
	DisabledServers map[string]CursorMCPServer `json:"disabledServersConfig,omitempty"`
}

CursorMCPConfig represents the configuration for Cursor MCP

type CursorMCPEditor added in v0.0.9

type CursorMCPEditor struct {
	// contains filtered or unexported fields
}

CursorMCPEditor manages the Cursor MCP configuration

func NewCursorMCPEditor added in v0.0.9

func NewCursorMCPEditor(path string) (*CursorMCPEditor, error)

NewCursorMCPEditor creates a new editor for the Cursor MCP configuration

func (*CursorMCPEditor) AddMCPServer added in v0.0.9

func (e *CursorMCPEditor) AddMCPServer(server types.CommonServer, overwrite bool) error

AddMCPServer adds or updates a server configuration using the CommonServer struct.

func (*CursorMCPEditor) AddMCPServerSSE added in v0.0.9

func (e *CursorMCPEditor) AddMCPServerSSE(name string, url string, env map[string]string, overwrite bool) error

AddMCPServerSSE adds or updates an MCP server configuration (SSE format) DEPRECATED: Use AddMCPServer with CommonServer instead.

func (*CursorMCPEditor) AddMCPServerStdio added in v0.0.9

func (e *CursorMCPEditor) AddMCPServerStdio(name string, command string, args []string, env map[string]string, overwrite bool) error

AddMCPServer adds or updates an MCP server configuration (stdio format) DEPRECATED: Use AddMCPServer with CommonServer instead.

func (*CursorMCPEditor) DisableMCPServer added in v0.0.9

func (e *CursorMCPEditor) DisableMCPServer(name string) error

DisableMCPServer disables an MCP server without removing its configuration

func (*CursorMCPEditor) EnableMCPServer added in v0.0.9

func (e *CursorMCPEditor) EnableMCPServer(name string) error

EnableMCPServer enables a previously disabled MCP server

func (*CursorMCPEditor) GetConfigPath added in v0.0.9

func (e *CursorMCPEditor) GetConfigPath() string

GetConfigPath returns the path to the configuration file

func (*CursorMCPEditor) GetServer added in v0.0.9

func (e *CursorMCPEditor) GetServer(name string) (types.CommonServer, bool, error)

GetServer retrieves a specific server configuration by name as CommonServer.

func (*CursorMCPEditor) GetServerRaw added in v0.0.9

func (e *CursorMCPEditor) GetServerRaw(name string) (CursorMCPServer, error)

GetServer retrieves a server's configuration by name DEPRECATED: Use the new GetServer which returns CommonServer.

func (*CursorMCPEditor) IsServerDisabled added in v0.0.9

func (e *CursorMCPEditor) IsServerDisabled(name string) (bool, error)

IsServerDisabled checks if a server is in the disabled list.

func (*CursorMCPEditor) ListDisabledServers added in v0.0.9

func (e *CursorMCPEditor) ListDisabledServers() ([]string, error)

ListDisabledServers returns a list of disabled server names

func (*CursorMCPEditor) ListServers added in v0.0.9

func (e *CursorMCPEditor) ListServers() (map[string]types.CommonServer, error)

ListServers returns a map of all configured servers (enabled and disabled) as CommonServer.

func (*CursorMCPEditor) ListServersRaw added in v0.0.9

func (e *CursorMCPEditor) ListServersRaw() map[string]CursorMCPServer

ListServers returns a list of configured MCP servers DEPRECATED: Use the new ListServers which returns map[string]CommonServer.

func (*CursorMCPEditor) RemoveMCPServer added in v0.0.9

func (e *CursorMCPEditor) RemoveMCPServer(name string) error

RemoveMCPServer removes an MCP server configuration from both enabled and disabled lists.

func (*CursorMCPEditor) Save added in v0.0.9

func (e *CursorMCPEditor) Save() error

Save writes the configuration to disk

type CursorMCPServer added in v0.0.9

type CursorMCPServer struct {
	// For stdio format
	Command string            `json:"command,omitempty"`
	Args    []string          `json:"args,omitempty"`
	Env     map[string]string `json:"env,omitempty"`

	// For SSE format
	URL string `json:"url,omitempty"`
}

CursorMCPServer represents a server configuration for Cursor

type LayerParameters

type LayerParameters map[string]map[string]interface{}

LayerParameters maps layer names to their parameter settings

type MCPServer added in v0.0.5

type MCPServer struct {
	Command string            `json:"command"`
	Args    []string          `json:"args"`
	Env     map[string]string `json:"env,omitempty"`
}

MCPServer represents a server configuration

type ParameterFilter

type ParameterFilter map[string][]string

ParameterFilter maps layer names to lists of parameter names

type Profile

type Profile struct {
	Description string         `yaml:"description"`
	Tools       *ToolSources   `yaml:"tools"`
	Prompts     *PromptSources `yaml:"prompts"`
}

Profile represents a named configuration profile

type PromptSources

type PromptSources struct {
	Directories []SourceConfig `yaml:"directories,omitempty"`
	Files       []SourceConfig `yaml:"files,omitempty"`
	Pinocchio   *struct {
		Command      string   `yaml:"command"`
		Args         []string `yaml:"args,omitempty"`
		SourceConfig `yaml:",inline"`
	} `yaml:"pinocchio,omitempty"`
}

PromptSources configures where prompts are loaded from

type SourceConfig

type SourceConfig struct {
	Path      string          `yaml:"path"`
	Defaults  LayerParameters `yaml:"defaults,omitempty"`
	Overrides LayerParameters `yaml:"overrides,omitempty"`
	Blacklist ParameterFilter `yaml:"blacklist,omitempty"`
	Whitelist ParameterFilter `yaml:"whitelist,omitempty"`
}

Common source configuration for both tools and prompts

type ToolSources

type ToolSources struct {
	Directories      []SourceConfig `yaml:"directories,omitempty"`
	Files            []SourceConfig `yaml:"files,omitempty"`
	ExternalCommands []struct {
		Command      string   `yaml:"command"`
		Args         []string `yaml:"args,omitempty"`
		SourceConfig `yaml:",inline"`
	} `yaml:"external_commands,omitempty"`
}

ToolSources configures where tools are loaded from

Jump to

Keyboard shortcuts

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