config

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package config loads the daemon's declarative defaults from a user-authored ~/.config/herrscher/config.json. The daemon only ever READS this file (it never rewrites it), so it is safe to comment and hand-edit — unlike state.json, which the daemon rewrites atomically on every /set.

Secrets never live here: gateway tokens/channel ids and any owner token material stay in the 0600 env file. config.json carries only non-secret knobs and declarative runtime defaults.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultPath

func DefaultPath() string

DefaultPath returns where the daemon looks for config.json. It sits beside state.json: under $HERRSCHER_STATE_DIR if set, else ~/.config/herrscher.

func Template

func Template(cmd, healthAddr string) string

Template returns a commented config.json scaffold. cmd pre-fills the "cmd" value (from `herrscher service install --cmd …`); empty leaves it "" so the daemon falls back to the built-in "claude" default. healthAddr pre-fills the "healthAddr" value (the install --health-addr default).

Types

type Config

type Config struct {
	// Daemon knobs (precedence: explicit flag > env > this > built-in default).
	Cmd           string `json:"cmd"`           // base bridged command for new sessions
	HealthAddr    string `json:"healthAddr"`    // serve --health-addr ("" disables)
	StatusChannel string `json:"statusChannel"` // self-updating status embed channel
	Instance      string `json:"instance"`      // per-daemon instance slug
	Owner         string `json:"owner"`         // owner id; per-daemon instance-id fallback
	// Stale threshold for `session clean`: sessions inactive longer than this
	// many days are reported as stale. 0 disables stale detection. Unset (zero)
	// means the built-in default (14) is applied by the caller.
	SessionMaxIdleDays int `json:"sessionMaxIdleDays,omitempty"`

	// Declarative runtime defaults (precedence: live state.json > this > empty).
	Home      *HomeRef `json:"home"`      // session home category/forum
	Workspace string   `json:"workspace"` // workspace root holding projects
	Source    string   `json:"source"`    // herrscher source checkout for /service update

	Skills *SkillsConfig `json:"skills,omitempty"`
}

Config is the parsed config.json. Every field is optional; an absent field falls through to the next source in the precedence chain (env / built-in default for knobs, live state.json for the declarative runtime fields).

func Load

func Load(path string) (Config, error)

Load reads and parses config.json. A missing file yields a zero Config and no error (config.json is entirely optional). Full-line // comments are stripped before parsing so the file can be commented.

type HomeRef

type HomeRef struct {
	ID   string `json:"id"`
	Type string `json:"type"` // "category" | "forum"
}

HomeRef mirrors state.HomeRef so config.json can declare the session home without this low-level package importing state.

type SkillsConfig

type SkillsConfig struct {
	Enabled *bool    `json:"enabled,omitempty"`
	Roots   []string `json:"roots,omitempty"`
}

SkillsConfig configures cross-backend skill injection. A nil pointer, or a nil Enabled, means the feature is on. Roots are extra skill roots appended after the built-in workspace and global (~/.claude/skills) defaults.

Jump to

Keyboard shortcuts

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