Documentation
¶
Index ¶
- func FindConfigFile(startDir string) (string, error)
- func FindEcosystemConfig(startDir string) string
- func GenerateSchema() ([]byte, error)
- type Config
- func Load(path string) (*Config, error)
- func LoadDefault() (*Config, error)
- func LoadFrom(startDir string) (*Config, error)
- func LoadFromBytes(data []byte) (*Config, error)
- func LoadFromTOMLBytes(data []byte) (*Config, error)
- func LoadFromWithLogger(startDir string, logger *logrus.Logger) (*Config, error)
- func LoadWithOverrides(baseFile string) (*Config, error)
- type ConfigSource
- type ContextConfig
- type ExplicitProject
- type GlobalNotebookConfig
- type GroveConfig
- type GroveSourceConfig
- type HookCommand
- type HooksConfig
- type LayeredConfig
- type NoteTypeConfig
- type Notebook
- type NotebookRules
- type NotebooksConfig
- type NvimEmbedConfig
- type OverrideSource
- type SchemaValidator
- type SearchPathConfig
- type TUIConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindConfigFile ¶
FindConfigFile searches for grove configuration files with the following precedence: 1. Current directory up to filesystem root 2. Git repository root (if in a git repo) 3. XDG config directory (~/.config/grove/grove.yml)
func FindEcosystemConfig ¶
FindEcosystemConfig searches upward from the given directory for a grove.yml that has a 'workspaces' field (indicating it's an ecosystem config)
func GenerateSchema ¶
GenerateSchema generates the base JSON Schema for the core Grove configuration. It reflects the Config struct from types.go but excludes the 'Extensions' field, which will be handled by schema composition.
Types ¶
type Config ¶
type Config struct {
Name string `yaml:"name,omitempty" toml:"name,omitempty" jsonschema:"description=Name of the project or ecosystem"`
Version string `yaml:"version" toml:"version" jsonschema:"description=Configuration version (e.g. 1.0)"`
Workspaces []string `` /* 138-byte string literal not displayed */
BuildCmd string `yaml:"build_cmd,omitempty" toml:"build_cmd,omitempty" jsonschema:"description=Custom build command (default: make build)"`
BuildAfter []string `` /* 126-byte string literal not displayed */
Notebooks *NotebooksConfig `yaml:"notebooks,omitempty" toml:"notebooks,omitempty" jsonschema:"description=Notebook configuration"`
TUI *TUIConfig `yaml:"tui,omitempty" toml:"tui,omitempty" jsonschema:"description=TUI appearance and behavior settings"`
Context *ContextConfig `yaml:"context,omitempty" toml:"context,omitempty" jsonschema:"description=Configuration for the cx (context) tool"`
Groves map[string]GroveSourceConfig `` /* 127-byte string literal not displayed */
SearchPaths map[string]SearchPathConfig `yaml:"search_paths,omitempty" toml:"search_paths,omitempty" jsonschema:"description=DEPRECATED: Use groves instead"`
ExplicitProjects []ExplicitProject `` /* 141-byte string literal not displayed */
// Extensions captures all other top-level keys for extensibility.
Extensions map[string]interface{} `yaml:",inline" toml:"-" jsonschema:"-"`
}
Config represents the grove.yml configuration
func LoadDefault ¶
LoadDefault finds and loads the configuration with hierarchical merging: 1. Global config (~/.config/grove/grove.yml) - base layer 2. Project config (grove.yml) - overrides global 3. Local override (grove.override.yml) - overrides all
func LoadFrom ¶
LoadFrom loads configuration with hierarchical merging starting from the given directory
func LoadFromBytes ¶
LoadFromBytes parses configuration from byte array
func LoadFromTOMLBytes ¶
LoadFromTOMLBytes parses configuration from TOML byte array
func LoadFromWithLogger ¶
LoadFromWithLogger loads configuration with hierarchical merging and logging
func LoadWithOverrides ¶
LoadWithOverrides loads configuration with override files
func (*Config) SetDefaults ¶
func (c *Config) SetDefaults()
SetDefaults sets default values for configuration
func (*Config) UnmarshalExtension ¶
UnmarshalExtension decodes a specific extension's configuration from the loaded grove.yml into the provided target struct. The target must be a pointer. This provides a type-safe way for extensions to access their custom configuration sections.
Example:
var flowCfg myapp.FlowConfig
err := coreCfg.UnmarshalExtension("flow", &flowCfg)
type ConfigSource ¶
type ConfigSource string
ConfigSource identifies the origin of a configuration value.
const ( SourceDefault ConfigSource = "default" SourceGlobal ConfigSource = "global" SourceGlobalOverride ConfigSource = "global-override" SourceEnvOverlay ConfigSource = "env-overlay" // GROVE_CONFIG_OVERLAY SourceEcosystem ConfigSource = "ecosystem" SourceProject ConfigSource = "project" SourceOverride ConfigSource = "override" SourceUnknown ConfigSource = "unknown" )
type ContextConfig ¶
type ContextConfig struct {
ReposDir *string `` /* 173-byte string literal not displayed */
}
ContextConfig holds configuration for the grove-context (cx) tool.
type ExplicitProject ¶
type ExplicitProject struct {
Path string `yaml:"path" toml:"path" jsonschema:"description=Absolute path to the project directory"`
Name string `yaml:"name,omitempty" toml:"name,omitempty" jsonschema:"description=Display name for the project"`
Description string `yaml:"description,omitempty" toml:"description,omitempty" jsonschema:"description=Human-readable description of this project"`
Enabled bool `yaml:"enabled" toml:"enabled" jsonschema:"description=Whether this project is enabled"`
}
ExplicitProject defines a specific project to include regardless of discovery.
type GlobalNotebookConfig ¶
type GlobalNotebookConfig struct {
RootDir string `yaml:"root_dir" toml:"root_dir" jsonschema:"description=Absolute path to the global notebook root directory"`
}
GlobalNotebookConfig defines the configuration for the system-wide global notebook.
type GroveConfig ¶
type GroveConfig struct {
// Configuration structure will be defined based on requirements
Version string `yaml:"version"`
}
func LoadGroveConfig ¶
func LoadGroveConfig() (*GroveConfig, error)
type GroveSourceConfig ¶
type GroveSourceConfig struct {
Path string `yaml:"path" toml:"path" jsonschema:"description=Absolute path to the grove root directory"`
Enabled *bool `yaml:"enabled,omitempty" toml:"enabled,omitempty" jsonschema:"description=Whether this grove is enabled (default: true)"`
Description string `yaml:"description,omitempty" toml:"description,omitempty" jsonschema:"description=Human-readable description of this grove"`
Notebook string `` /* 131-byte string literal not displayed */
}
GroveSourceConfig defines the configuration for a single grove source.
type HookCommand ¶
type HookCommand struct {
Name string `yaml:"name" toml:"name" jsonschema:"description=Name of the hook command"`
Command string `yaml:"command" toml:"command" jsonschema:"description=Shell command to execute"`
RunIf string `` /* 146-byte string literal not displayed */
}
HookCommand defines a command to be executed for a hook.
type HooksConfig ¶
type HooksConfig struct {
OnStop []HookCommand `yaml:"on_stop,omitempty" toml:"on_stop,omitempty" jsonschema:"description=Commands to run when a session stops"`
}
HooksConfig groups all hook-related settings.
type LayeredConfig ¶
type LayeredConfig struct {
Default *Config // Config with only default values applied.
Global *Config // Raw config from the global file.
GlobalOverride *OverrideSource // Raw config from the global override file.
EnvOverlay *OverrideSource // Raw config from GROVE_CONFIG_OVERLAY env var.
Ecosystem *Config // Raw config from the ecosystem file (if workspace is in an ecosystem).
Project *Config // Raw config from the project file.
Overrides []OverrideSource // Raw configs from override files, in order of application.
Final *Config // The fully merged and validated config.
FilePaths map[ConfigSource]string // Maps sources to their file paths.
}
LayeredConfig holds the raw configuration from each source file, as well as the final merged configuration, for analysis purposes.
func LoadLayered ¶
func LoadLayered(startDir string) (*LayeredConfig, error)
LoadLayered finds and loads all configuration layers (global, project, overrides) without merging them, for analysis purposes. It also computes the final merged config.
type NoteTypeConfig ¶
type NoteTypeConfig struct {
Description string `` /* 127-byte string literal not displayed */
TemplatePath string `` /* 131-byte string literal not displayed */
FilenameFormat string `` /* 145-byte string literal not displayed */
Icon string `yaml:"icon,omitempty" toml:"icon,omitempty" jsonschema:"description=Icon for TUI display (nerd font icon)"`
IconColor string `yaml:"icon_color,omitempty" toml:"icon_color,omitempty" jsonschema:"description=Lipgloss color for the icon in the TUI"`
DefaultExpand bool `` /* 141-byte string literal not displayed */
SortOrder int `` /* 131-byte string literal not displayed */
}
NoteTypeConfig defines the configuration for a single, user-defined note type.
type Notebook ¶
type Notebook struct {
RootDir string `yaml:"root_dir" toml:"root_dir" jsonschema:"description=Absolute path to the notebook root (enables Centralized Mode)"`
NotesPathTemplate string `` /* 132-byte string literal not displayed */
PlansPathTemplate string `` /* 132-byte string literal not displayed */
ChatsPathTemplate string `` /* 132-byte string literal not displayed */
TemplatesPathTemplate string `` /* 144-byte string literal not displayed */
RecipesPathTemplate string `` /* 138-byte string literal not displayed */
InProgressPathTemplate string `` /* 146-byte string literal not displayed */
CompletedPathTemplate string `` /* 140-byte string literal not displayed */
PromptsPathTemplate string `` /* 138-byte string literal not displayed */
Types map[string]*NoteTypeConfig `yaml:"types,omitempty" toml:"types,omitempty" jsonschema:"description=Map of note type name to configuration"`
Sync interface{} `yaml:"sync,omitempty" toml:"sync,omitempty" jsonschema:"description=Synchronization configuration for this notebook"`
}
Notebook defines the configuration for a single, named notebook system.
type NotebookRules ¶
type NotebookRules struct {
Default string `yaml:"default,omitempty" toml:"default,omitempty" jsonschema:"description=Name of the default notebook to use"`
Global *GlobalNotebookConfig `yaml:"global,omitempty" toml:"global,omitempty" jsonschema:"description=Configuration for the system-wide global notebook"`
}
NotebookRules defines the usage rules for notebooks.
type NotebooksConfig ¶
type NotebooksConfig struct {
Definitions map[string]*Notebook `` /* 129-byte string literal not displayed */
Rules *NotebookRules `` /* 131-byte string literal not displayed */
}
NotebooksConfig groups all notebook-related settings.
type NvimEmbedConfig ¶
type NvimEmbedConfig struct {
UserConfig bool `` /* 127-byte string literal not displayed */
}
NvimEmbedConfig holds settings for the embedded Neovim component.
type OverrideSource ¶
OverrideSource holds a raw configuration from an override file and its path.
type SchemaValidator ¶
type SchemaValidator struct {
// contains filtered or unexported fields
}
SchemaValidator validates configuration against the embedded JSON Schema. This is a wrapper around schema.Validator to maintain backward compatibility with existing code that uses config.SchemaValidator.
func NewSchemaValidator ¶
func NewSchemaValidator() (*SchemaValidator, error)
NewSchemaValidator creates a new schema validator, loading the embedded schema.
func (*SchemaValidator) Validate ¶
func (v *SchemaValidator) Validate(configData interface{}) error
Validate validates configuration data against the schema.
type SearchPathConfig ¶
type SearchPathConfig struct {
Path string `yaml:"path" toml:"path"`
Enabled bool `yaml:"enabled" toml:"enabled"`
Description string `yaml:"description,omitempty" toml:"description,omitempty"`
}
SearchPathConfig defines the configuration for a single search path. DEPRECATED: Use GroveSourceConfig instead.
type TUIConfig ¶
type TUIConfig struct {
Icons string `yaml:"icons,omitempty" toml:"icons,omitempty" jsonschema:"description=Icon set to use: nerd or ascii,enum=nerd,enum=ascii"`
Theme string `` /* 155-byte string literal not displayed */
NvimEmbed *NvimEmbedConfig `yaml:"nvim_embed,omitempty" toml:"nvim_embed,omitempty" jsonschema:"description=Embedded Neovim configuration"`
}
TUIConfig holds TUI-specific settings.