lmcli

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigDir

func ConfigDir() string

func DataDir

func DataDir() string

func Fatal

func Fatal(format string, args ...any)

func InitErrorLog

func InitErrorLog()

InitErrorLog opens (or creates) the error log file. Safe to call multiple times — subsequent calls are no-ops.

func LogError

func LogError(err error, operation string)

LogError appends a timestamped JSON entry to the error log. If the log file is not initialized, it attempts to initialize it.

func Warn

func Warn(format string, args ...any)

Types

type AgentConfig

type AgentConfig struct {
	Name         string   `yaml:"name"`
	SystemPrompt string   `yaml:"systemPrompt"`
	Tools        []string `yaml:"tools"`
}

type ChromaConfig

type ChromaConfig struct {
	Style     *string `yaml:"style" default:"onedark"`
	Formatter *string `yaml:"formatter" default:"terminal16m"`
}

type Config

type Config struct {
	Defaults      *DefaultsConfig        `yaml:"defaults"`
	Conversations *ConversationsConfig   `yaml:"conversations"`
	Chroma        *ChromaConfig          `yaml:"chroma"`
	Agents        []*AgentConfig         `yaml:"agents"`
	Providers     []*ProviderConfig      `yaml:"providers"`
	Tools         []*ToolConfig          `yaml:"tools"`
	Sandbox       *sandbox.SandboxConfig `yaml:"sandbox"`
	TUI           *TUIConfig             `yaml:"tui"`
}

func LoadProjectConfig added in v0.7.0

func LoadProjectConfig() (*Config, error)

LoadProjectConfig loads a project-level .lmcli.yaml from the current working directory. Returns nil, nil if the file does not exist.

func NewConfig

func NewConfig(configFile string) (*Config, error)

func (*Config) HideHelpHint

func (c *Config) HideHelpHint() bool

func (*Config) MergeProject added in v0.7.0

func (c *Config) MergeProject(project *Config) error

MergeProject merges project-level configuration into the main config. Merges agent definitions, tool definitions, and sandbox configuration. Agents and tools from the project config must have names that do not conflict with existing ones. Sandbox config uses field-level merging: scalar fields override, slice fields append.

type Context

type Context struct {
	// global app configuration - read-only after startup
	Config        Config
	Providers     []api.Provider
	Agents        []api.Agent
	Conversations conversation.Repo
	Chroma        render.ChromaHighlighter
}

func NewContext

func NewContext() (*Context, error)

func (*Context) DefaultReasoningEffort

func (c *Context) DefaultReasoningEffort() api.ReasoningEffort

func (*Context) GetAgent

func (c *Context) GetAgent(name string) *api.Agent

func (*Context) GetAgents

func (c *Context) GetAgents() (agents []string)

func (*Context) GetAllModels

func (c *Context) GetAllModels() (models []string)

GetAllModels returns a string slice of *all* models: - All models are returned with the @provider suffix - Models with a unique name before the @provider are added without the suffix

func (*Context) GetCodeAgentName

func (c *Context) GetCodeAgentName() string

GetCodeAgentName returns the default code agent name from config. Returns empty string if no code agent is configured.

func (*Context) GetDefaultModel

func (c *Context) GetDefaultModel() (*api.Model, error)

func (*Context) LookupModel

func (c *Context) LookupModel(model string, providerName string) (*api.Model, error)

LookupModel resolves a model string (optionally with @provider suffix) to a runtime Model. The providerName parameter takes precedence over any @ suffix in the model string.

type ConversationsConfig

type ConversationsConfig struct {
	TitleGeneration *GenerationConfig `yaml:"titleGeneration,omitempty"`
}

type DefaultsConfig

type DefaultsConfig struct {
	Model       *string  `yaml:"model" default:""`
	MaxTokens   *int     `yaml:"maxTokens" default:"32768"`
	Temperature *float32 `yaml:"temperature" default:"0.8"`
	Effort      *string  `yaml:"effort" default:"medium"`
	Agent       string   `yaml:"agent,omitempty"`
	CodeAgent   *string  `yaml:"codeAgent,omitempty" default:"code"`
	Permission  *string  `yaml:"permission" default:"none"`
}

type GenerationConfig added in v0.7.0

type GenerationConfig struct {
	Model     *string `yaml:"model,omitempty"`
	MaxTokens *int    `yaml:"maxTokens,omitempty"`
	Effort    *string `yaml:"effort,omitempty"`
	Agent     string  `yaml:"agent,omitempty"`
}

GenerationConfig holds generation parameters that can be specified for specific tasks like title generation.

type ModelConfig

type ModelConfig struct {
	Name        string   `yaml:"name"`
	MaxTokens   *int     `yaml:"maxTokens,omitempty"`
	Temperature *float32 `yaml:"temperature,omitempty"`
}

ModelConfig represents a single model in a provider's configuration. It supports both shorthand (string) and expanded (map) YAML forms:

func (*ModelConfig) UnmarshalYAML

func (m *ModelConfig) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements custom YAML unmarshaling for ModelEntry, supporting both string shorthand and full map forms.

type ProviderConfig

type ProviderConfig struct {
	Name    string            `yaml:"name,omitempty"`
	Display string            `yaml:"display,omitempty"`
	Kind    string            `yaml:"kind"`
	Style   string            `yaml:"style,omitempty"`
	BaseURL string            `yaml:"baseUrl,omitempty"`
	APIKey  string            `yaml:"apiKey,omitempty"`
	Headers map[string]string `yaml:"headers,omitempty"`
	Models  []ModelConfig     `yaml:"models"`
}

type TUIConfig

type TUIConfig struct {
	HideHelpHint bool `yaml:"hideHelpHint"`
}

type ToolConfig added in v0.7.0

type ToolConfig struct {
	Name        string              `yaml:"name"`
	Description string              `yaml:"description,omitempty"`
	Path        string              `yaml:"path,omitempty"`
	Permission  string              `yaml:"permission,omitempty"` // read, write, exec
	Environment []ToolEnvVar        `yaml:"environment,omitempty"`
	Parameters  []api.ToolParameter `yaml:"parameters,omitempty"`
	Config      map[string]any      `yaml:"config,omitempty"`
}

type ToolEnvVar added in v0.7.0

type ToolEnvVar struct {
	Name  string `yaml:"name"`
	Value string `yaml:"value"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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