Documentation
¶
Overview ¶
Package config provides the single source of truth for arc CLI and server settings. Settings are stored in TOML format at ~/.arc/config.toml.
Package config provides configuration loading, validation, and template expansion for the arc CLI. Template variables use {name} syntax and are expanded by ExpandPlansDir before any path is used at runtime.
Package config provides configuration loading, validation, and template expansion. Validate checks all fields and returns a ValidationError that describes every invalid field so callers can surface them together.
Index ¶
- Constants
- Variables
- func DefaultPath() string
- func ExpandPlansDir(tmpl string, vars map[string]string, cwd string) (string, error)
- func LegacyJSONPath() string
- func RequiresRestart() []string
- func SanitizeSlug(s string) string
- func Save(path string, cfg *Config) error
- func Validate(cfg *Config) error
- type CLIConfig
- type Config
- type PlansConfig
- type ServerConfig
- type Store
- type UpdatesConfig
- type ValidationError
Constants ¶
const DefaultServerPort = 7432
DefaultServerPort is the built-in default port for the arc server.
Variables ¶
var ValidChannels = []string{"stable", "rc", "nightly"}
ValidChannels lists the allowed values for updates.channel.
Functions ¶
func ExpandPlansDir ¶
ExpandPlansDir substitutes {vars}, expands leading ~, returns an absolute dir (relative resolved against cwd). Unknown {placeholder} or empty substitution => error.
func LegacyJSONPath ¶
func LegacyJSONPath() string
LegacyJSONPath returns ~/.arc/cli-config.json (the pre-TOML location).
func RequiresRestart ¶
func RequiresRestart() []string
RequiresRestart returns dotted keys whose changes don't take effect in a running arc-server until the server restarts. Used by the API + web UI to surface a "requires restart" warning.
func SanitizeSlug ¶
SanitizeSlug lowercases s, replaces runs of non [a-z0-9] with '-', trims '-'. "" if nothing survives.
Types ¶
type CLIConfig ¶
type CLIConfig struct {
Server string `toml:"server" json:"server"`
}
CLIConfig holds settings the arc CLI uses to reach the server.
type Config ¶
type Config struct {
CLI CLIConfig `toml:"cli" json:"cli"`
Server ServerConfig `toml:"server" json:"server"`
Updates UpdatesConfig `toml:"updates" json:"updates"`
Plans PlansConfig `toml:"plans" json:"plans"`
}
Config is the full arc configuration document.
func Load ¶
Load reads the TOML config from path. If path is missing but the legacy cli-config.json exists in the same directory, Load migrates JSON → TOML, renames the legacy file to *.bak, and prints a one-line stderr notice. If neither exists, Load writes Default() to path and returns it. Missing fields are filled from Default(). The returned Config is validated; an invalid file returns a non-nil error.
type PlansConfig ¶
type PlansConfig struct {
Dir string `toml:"dir" json:"dir"`
}
PlansConfig holds settings for design-spec plan files.
type ServerConfig ¶
type ServerConfig struct {
Port int `toml:"port" json:"port"`
DBPath string `toml:"db_path" json:"db_path"`
}
ServerConfig holds settings the arc server uses for its own runtime.
func (ServerConfig) ResolvedDBPath ¶
func (s ServerConfig) ResolvedDBPath() string
ResolvedDBPath returns DBPath with a leading ~ expanded to the user's home directory. Use this when you need a real filesystem path (e.g., opening the SQLite database). Do NOT call this before writing DBPath back to TOML — the raw value (which may contain ~) should be stored as-is for portability.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store wraps an atomically-swappable *Config. The arc server holds one Store and reads through Load() so that a future Reload() can hot-swap without mutating consumers. Callers must treat the returned *Config as read-only.
type UpdatesConfig ¶
type UpdatesConfig struct {
Channel string `toml:"channel" json:"channel"`
}
UpdatesConfig holds update-channel settings for `arc self`.
type ValidationError ¶
ValidationError maps dotted-key to error message.
func (ValidationError) Error ¶
func (v ValidationError) Error() string
Error returns a sorted, semicolon-separated list of all validation failures.