config

package
v0.4.9 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package config provides configuration file support for JVS.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InvalidateCache

func InvalidateCache(repoRoot string)

InvalidateCache clears the cached config for a repository.

func Keys

func Keys() []string

Keys returns all valid configuration keys.

func Save

func Save(repoRoot string, cfg *Config) error

Save writes configuration to .jvs/config.yaml.

Types

type Config

type Config struct {
	// DefaultEngine is the default snapshot engine to use.
	DefaultEngine model.EngineType `yaml:"default_engine,omitempty"`

	// DefaultTags are tags automatically added to each snapshot.
	DefaultTags []string `yaml:"default_tags,omitempty"`

	// OutputFormat is the default output format (text or json).
	OutputFormat string `yaml:"output_format,omitempty"`

	// ProgressEnabled enables progress bars by default.
	ProgressEnabled *bool `yaml:"progress_enabled,omitempty"`

	// Retention preserves legacy YAML compatibility for internal GC policy
	// conversion. The v0 public CLI does not expose retention configuration.
	Retention *RetentionPolicy `yaml:"retention,omitempty"`
}

Config represents the JVS configuration.

func Default

func Default() *Config

Default returns the default configuration.

func Load

func Load(repoRoot string) (*Config, error)

Load loads configuration from .jvs/config.yaml. Returns default config if file doesn't exist. The returned Config must not be modified; use Save() for changes.

func (*Config) Get

func (c *Config) Get(key string) (string, error)

Get gets a configuration value by key as a string.

func (*Config) GetDefaultEngine

func (c *Config) GetDefaultEngine() model.EngineType

GetDefaultEngine returns the default engine, or empty string if not set.

func (*Config) GetDefaultTags

func (c *Config) GetDefaultTags() []string

GetDefaultTags returns the default tags.

func (*Config) GetOutputFormat

func (c *Config) GetOutputFormat() string

GetOutputFormat returns the output format, or empty string if not set.

func (*Config) GetProgressEnabled

func (c *Config) GetProgressEnabled() *bool

GetProgressEnabled returns whether progress is enabled. Returns nil if not configured (auto-detect based on terminal).

func (*Config) GetRetentionPolicy

func (c *Config) GetRetentionPolicy() model.RetentionPolicy

GetRetentionPolicy returns the legacy retention config as a model.RetentionPolicy.

func (*Config) Set

func (c *Config) Set(key, value string) error

Set sets a configuration value by key.

type RetentionPolicy

type RetentionPolicy struct {
	// Keep is the minimum number of snapshots to keep.
	Keep int `yaml:"keep,omitempty"`

	// Within is the minimum age before snapshots can be pruned (e.g., "24h", "168h").
	Within string `yaml:"within,omitempty"`
}

RetentionPolicy is a legacy config shape for optional internal GC retention. Unset or invalid values fall back to model.DefaultRetentionPolicy().

Jump to

Keyboard shortcuts

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