config

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertCommandToTool

func ConvertCommandToTool(desc *cmds.CommandDescription) (protocol.Tool, error)

func GetDefaultProfilesPath added in v0.0.4

func GetDefaultProfilesPath() (string, error)

GetDefaultProfilesPath returns the default path for the profiles 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

Types

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) 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) 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 ConfigPromptProvider

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

ConfigPromptProvider implements pkg.PromptProvider interface

func NewConfigPromptProvider

func NewConfigPromptProvider(config *Config, profile string) (*ConfigPromptProvider, error)

func (*ConfigPromptProvider) GetPrompt

func (p *ConfigPromptProvider) GetPrompt(name string, arguments map[string]string) (*protocol.PromptMessage, error)

GetPrompt implements pkg.PromptProvider interface

func (*ConfigPromptProvider) ListPrompts

func (p *ConfigPromptProvider) ListPrompts(cursor string) ([]protocol.Prompt, string, error)

ListPrompts implements pkg.PromptProvider interface

type ConfigToolProvider

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

ConfigToolProvider implements pkg.ToolProvider interface

func NewConfigToolProvider

func NewConfigToolProvider(options ...ConfigToolProviderOption) (*ConfigToolProvider, error)

NewConfigToolProvider creates a new ConfigToolProvider with the given options

func (*ConfigToolProvider) CallTool

func (p *ConfigToolProvider) CallTool(ctx context.Context, name string, arguments map[string]interface{}) (*protocol.ToolResult, error)

CallTool implements pkg.ToolProvider interface

func (*ConfigToolProvider) ListTools

func (p *ConfigToolProvider) ListTools(cursor string) ([]protocol.Tool, string, error)

ListTools implements pkg.ToolProvider interface

type ConfigToolProviderOption

type ConfigToolProviderOption func(*ConfigToolProvider) error

func WithConfig

func WithConfig(config *Config, profile string) ConfigToolProviderOption

func WithDebug

func WithDebug(debug bool) ConfigToolProviderOption

func WithDirectories

func WithDirectories(directories []repositories.Directory) ConfigToolProviderOption

func WithTracingDir

func WithTracingDir(dir string) ConfigToolProviderOption

type LayerParameters

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

LayerParameters maps layer names to their parameter settings

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