config

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterServeFlags

func RegisterServeFlags(fs *flag.FlagSet)

RegisterServeFlags registers serve-command flags on fs. The caller must call fs.Parse before passing fs to Load.

func ResolveDataDir

func ResolveDataDir() (string, error)

ResolveDataDir returns the effective data directory by applying defaults and environment overrides, without reading any files. Use this to determine where migration should target before calling Load or LoadMinimal.

Types

type Config

type Config struct {
	Host         string         `json:"host"`
	Port         int            `json:"port"`
	NoBrowser    bool           `json:"no_browser"`
	DataDir      string         `json:"data_dir"`
	DBPath       string         `json:"-"`
	CursorSecret string         `json:"cursor_secret"`
	GithubToken  string         `json:"github_token,omitempty"`
	Terminal     TerminalConfig `json:"terminal,omitempty"`
	WriteTimeout time.Duration  `json:"-"`

	// AgentDirs maps each AgentType to its configured
	// directories. Single-dir agents store a one-element
	// slice; unconfigured agents use nil.
	AgentDirs map[parser.AgentType][]string `json:"-"`

	ResultContentBlockedCategories []string `json:"result_content_blocked_categories,omitempty"`
	// contains filtered or unexported fields
}

Config holds all application configuration.

func Default

func Default() (Config, error)

Default returns a Config with default values.

func Load

func Load(fs *flag.FlagSet) (Config, error)

Load builds a Config by layering: defaults < config file < env < flags. The provided FlagSet must already be parsed by the caller. Only flags that were explicitly set override the lower layers.

func LoadMinimal

func LoadMinimal() (Config, error)

LoadMinimal builds a Config from defaults, env, and config file, without parsing CLI flags. Use this for subcommands that manage their own flag sets.

func (*Config) IsUserConfigured added in v0.10.0

func (c *Config) IsUserConfigured(
	agent parser.AgentType,
) bool

IsUserConfigured reports whether the agent's directories were explicitly set by the user (via env var or config file) rather than populated from defaults.

func (*Config) ResolveDirs added in v0.10.0

func (c *Config) ResolveDirs(
	agent parser.AgentType,
) []string

ResolveDirs returns the effective directories for an agent.

func (*Config) SaveGithubToken

func (c *Config) SaveGithubToken(token string) error

SaveGithubToken persists the GitHub token to the config file.

func (*Config) SaveTerminalConfig added in v0.12.0

func (c *Config) SaveTerminalConfig(tc TerminalConfig) error

SaveTerminalConfig persists terminal settings to the config file.

type TerminalConfig added in v0.12.0

type TerminalConfig struct {
	// Mode: "auto" (detect terminal), "custom" (use CustomBin),
	// or "clipboard" (never launch, always copy).
	Mode string `json:"mode"`
	// CustomBin is the terminal binary path (used when Mode == "custom").
	CustomBin string `json:"custom_bin,omitempty"`
	// CustomArgs is a template for terminal args. Use {cmd} as
	// placeholder for the resume command (e.g. "-- bash -c {cmd}").
	CustomArgs string `json:"custom_args,omitempty"`
}

TerminalConfig holds terminal launch preferences.

Jump to

Keyboard shortcuts

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