Documentation
¶
Index ¶
- func EnsureConfigExists() error
- func FilepathOr[T any](key string, value *T) error
- func HasEnvVars(content string) bool
- func HasScriptArgs(content string) bool
- func LoadSystemPrompt(input string) (string, error)
- func SetConfigPath(path string)
- type AdaptiveColor
- type ArgsSubstituter
- type Config
- type EnvSubstituter
- type MCPServerConfig
- type MarkdownTheme
- type Theme
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureConfigExists ¶ added in v0.14.0
func EnsureConfigExists() error
EnsureConfigExists checks if a config file exists and creates a default one if not
func FilepathOr ¶ added in v0.30.0
func HasEnvVars ¶ added in v0.19.0
HasEnvVars checks if content contains environment variable patterns
func HasScriptArgs ¶ added in v0.19.0
HasScriptArgs checks if content contains script argument patterns
func LoadSystemPrompt ¶
LoadSystemPrompt loads system prompt from file or returns the string directly
func SetConfigPath ¶ added in v0.30.0
func SetConfigPath(path string)
Types ¶
type AdaptiveColor ¶ added in v0.30.0
type ArgsSubstituter ¶ added in v0.19.0
type ArgsSubstituter struct {
// contains filtered or unexported fields
}
ArgsSubstituter handles script argument substitution
func NewArgsSubstituter ¶ added in v0.19.0
func NewArgsSubstituter(args map[string]string) *ArgsSubstituter
NewArgsSubstituter creates a new args substituter with the given arguments
func (*ArgsSubstituter) SubstituteArgs ¶ added in v0.19.0
func (a *ArgsSubstituter) SubstituteArgs(content string) (string, error)
SubstituteArgs replaces ${VAR} and ${VAR:-default} patterns with script arguments
type Config ¶
type Config struct {
MCPServers map[string]MCPServerConfig `json:"mcpServers" yaml:"mcpServers"`
Model string `json:"model,omitempty" yaml:"model,omitempty"`
MaxSteps int `json:"max-steps,omitempty" yaml:"max-steps,omitempty"`
Debug bool `json:"debug,omitempty" yaml:"debug,omitempty"`
Compact bool `json:"compact,omitempty" yaml:"compact,omitempty"`
SystemPrompt string `json:"system-prompt,omitempty" yaml:"system-prompt,omitempty"`
ProviderAPIKey string `json:"provider-api-key,omitempty" yaml:"provider-api-key,omitempty"`
ProviderURL string `json:"provider-url,omitempty" yaml:"provider-url,omitempty"`
Prompt string `json:"prompt,omitempty" yaml:"prompt,omitempty"`
NoExit bool `json:"no-exit,omitempty" yaml:"no-exit,omitempty"`
Stream *bool `json:"stream,omitempty" yaml:"stream,omitempty"`
Theme any `json:"theme" yaml:"theme"`
MarkdownTheme any `json:"markdown-theme" yaml:"markdown-theme"`
// Model generation parameters
MaxTokens int `json:"max-tokens,omitempty" yaml:"max-tokens,omitempty"`
Temperature *float32 `json:"temperature,omitempty" yaml:"temperature,omitempty"`
TopP *float32 `json:"top-p,omitempty" yaml:"top-p,omitempty"`
TopK *int32 `json:"top-k,omitempty" yaml:"top-k,omitempty"`
StopSequences []string `json:"stop-sequences,omitempty" yaml:"stop-sequences,omitempty"`
// TLS configuration
TLSSkipVerify bool `json:"tls-skip-verify,omitempty" yaml:"tls-skip-verify,omitempty"`
}
Config represents the application configuration
func LoadAndValidateConfig ¶ added in v0.19.0
LoadAndValidateConfig loads config from viper and validates it
func MergeConfigs ¶ added in v0.19.0
MergeConfigs merges script frontmatter config with base config
type EnvSubstituter ¶ added in v0.19.0
type EnvSubstituter struct{}
EnvSubstituter handles environment variable substitution
func (*EnvSubstituter) SubstituteEnvVars ¶ added in v0.19.0
func (e *EnvSubstituter) SubstituteEnvVars(content string) (string, error)
SubstituteEnvVars replaces ${env://VAR} and ${env://VAR:-default} patterns with environment variables
type MCPServerConfig ¶
type MCPServerConfig struct {
Type string `json:"type"`
Command []string `json:"command,omitempty"`
Environment map[string]string `json:"environment,omitempty"`
URL string `json:"url,omitempty"`
Name string `json:"name,omitempty"` // For builtin servers
Options map[string]any `json:"options,omitempty"` // For builtin servers
AllowedTools []string `json:"allowedTools,omitempty" yaml:"allowedTools,omitempty"`
ExcludedTools []string `json:"excludedTools,omitempty" yaml:"excludedTools,omitempty"`
// Legacy fields for backward compatibility
Transport string `json:"transport,omitempty"`
Args []string `json:"args,omitempty"`
Env map[string]any `json:"env,omitempty"`
Headers []string `json:"headers,omitempty"`
}
MCPServerConfig represents configuration for an MCP server
func (*MCPServerConfig) GetTransportType ¶ added in v0.15.0
func (s *MCPServerConfig) GetTransportType() string
GetTransportType returns the transport type for the server config
func (*MCPServerConfig) UnmarshalJSON ¶ added in v0.16.0
func (s *MCPServerConfig) UnmarshalJSON(data []byte) error
UnmarshalJSON handles both new and legacy config formats
type MarkdownTheme ¶ added in v0.30.0
type MarkdownTheme struct {
Text AdaptiveColor `json:"text" yaml:"text"`
Muted AdaptiveColor `json:"muted" yaml:"muted"`
Heading AdaptiveColor `json:"heading" yaml:"heading"`
Emph AdaptiveColor `json:"emph" yaml:"emph"`
Strong AdaptiveColor `json:"strong" yaml:"strong"`
Link AdaptiveColor `json:"link" yaml:"link"`
Code AdaptiveColor `json:"code" yaml:"code"`
Error AdaptiveColor `json:"error" yaml:"error"`
Keyword AdaptiveColor `json:"keyword" yaml:"keyword"`
String AdaptiveColor `json:"string" yaml:"string"`
Number AdaptiveColor `json:"number" yaml:"number"`
Comment AdaptiveColor `json:"comment" yaml:"comment"`
}
type Theme ¶ added in v0.30.0
type Theme struct {
Primary AdaptiveColor `json:"primary" yaml:"primary"`
Secondary AdaptiveColor `json:"secondary" yaml:"secondary"`
Success AdaptiveColor `json:"success" yaml:"success"`
Warning AdaptiveColor `json:"warning" yaml:"warning"`
Error AdaptiveColor `json:"error" yaml:"error"`
Info AdaptiveColor `json:"info" yaml:"info"`
Text AdaptiveColor `json:"text" yaml:"text"`
Muted AdaptiveColor `json:"muted" yaml:"muted"`
VeryMuted AdaptiveColor `json:"very-muted" yaml:"very-muted"`
Background AdaptiveColor `json:"background" yaml:"background"`
Border AdaptiveColor `json:"border" yaml:"border"`
MutedBorder AdaptiveColor `json:"muted-border" yaml:"muted-border"`
System AdaptiveColor `json:"system" yaml:"system"`
Tool AdaptiveColor `json:"tool" yaml:"tool"`
Accent AdaptiveColor `json:"accent" yaml:"accent"`
Highlight AdaptiveColor `json:"highlight" yaml:"highlight"`
}