config

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const EnvDefaultHarness = "BOID_DEFAULT_HARNESS"

EnvDefaultHarness is the environment variable that overrides the configured default harness.

Variables

View Source
var ErrDefaultHarnessNotSet = errors.New("default harness not set")

ErrDefaultHarnessNotSet is returned by DefaultHarness when no default harness has been configured via env var or config file.

Functions

func DefaultHarness added in v0.0.8

func DefaultHarness() (string, error)

DefaultHarness resolves the default harness identifier using:

  1. env var BOID_DEFAULT_HARNESS, if non-empty
  2. config file (~/.config/boid/config.yaml) default_harness key

It returns ErrDefaultHarnessNotSet when neither source supplies a value, so callers can branch on errors.Is(err, ErrDefaultHarnessNotSet) and prompt the user.

func SetDefaultHarness added in v0.0.8

func SetDefaultHarness(harness string) error

SetDefaultHarness persists harness as the default_harness in the user's config file (~/.config/boid/config.yaml). Existing keys are preserved by reading the raw YAML, mutating the default_harness key, and re-marshalling. The write is atomic: a sibling temp file is written and renamed into place.

func ValidateHarnessName added in v0.0.8

func ValidateHarnessName(s string) error

ValidateHarnessName returns an error if s is not a syntactically valid harness identifier. It does NOT verify the binary is installed.

Types

type Config

type Config struct {
	GC      GCConfig      `yaml:"gc"`
	Web     WebConfig     `yaml:"web"`
	Notify  NotifyConfig  `yaml:"notify"`
	Sandbox SandboxConfig `yaml:"sandbox"`
	TaskAsk TaskAskConfig `yaml:"task_ask"`
	Gateway GatewayConfig `yaml:"gateway"`

	// DefaultHarness is the harness identifier (claude, codex, opencode, ...)
	// used by sub-commands that need to launch an interactive agent without
	// a project-level harness context (e.g. `boid kit init`). Empty means
	// "ask the user on first use" — see DefaultHarness() for the resolver.
	DefaultHarness string `yaml:"default_harness"`
}

Config holds the global boid configuration.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default boid configuration.

func Load

func Load() (*Config, error)

Load reads the configuration from the default XDG path (~/.config/boid/config.yaml). If the file does not exist, the default configuration is returned without error.

func (*Config) UnmarshalYAML

func (c *Config) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements yaml.Unmarshaler for Config. It starts from DefaultConfig values so that unspecified fields retain defaults. Unknown legacy fields (state_machine.rework_limit) are silently ignored.

type ForgeConfig added in v0.0.11

type ForgeConfig struct {
	// Host is the upstream host as it appears in the gateway route path
	// (e.g. "github.com"). Optional for built-in ids; required otherwise.
	Host string `yaml:"host,omitempty"`
	// Forge selects the Basic-auth username convention
	// (gitgateway.ForgeGitHub / gitgateway.ForgeBitbucket). Optional for
	// built-in ids; required otherwise.
	Forge gitgateway.Forge `yaml:"forge,omitempty"`
	// SecretKey is a reference into the secret store
	// (internal/dispatcher/secret_store.go); never a plaintext token.
	// Optional for built-in ids (defaults below); required otherwise.
	SecretKey string `yaml:"secret_key,omitempty"`
}

ForgeConfig configures the git gateway's credential injection for a single forge id (the map key in GatewayConfig.Forges). Only the forge kind and a secret-store key reference are ever written here — the plaintext PAT itself lives in the secret store (`boid secret set <key> <value>`), never in config.yaml.

Built-in ids ("github", "bitbucket") default every field left empty here (see builtinForges): host, Basic-auth forge convention, and secret-store key all resolve without the user writing anything, so `gateway.forges: {github: {}}` — or omitting the id entirely, since DefaultConfig pre-populates both built-ins — is enough for `boid secret set github-pat <PAT>` to light up the gateway for github.com. Custom ids (e.g. "github-enterprise") must set Host explicitly, and Forge must name one of gitgateway's recognized conventions since that convention is not itself derivable from an arbitrary id.

type GCConfig

type GCConfig struct {
	Enabled   bool          `yaml:"-"`
	Interval  time.Duration `yaml:"-"`
	OlderThan time.Duration `yaml:"-"`
}

GCConfig holds garbage collection settings.

type GatewayConfig added in v0.0.10

type GatewayConfig struct {
	// Forges maps a forge id (e.g. "github", "bitbucket", or a custom id
	// like "github-enterprise") to its credential config. Built-in ids
	// "github" and "bitbucket" are pre-populated by DefaultConfig with
	// host/forge/secret_key defaults already filled in — see builtinForges.
	Forges map[string]ForgeConfig `yaml:"forges,omitempty"`
}

GatewayConfig configures the git gateway's per-forge credential injection (post-cutover §2: config surface を forges map に圧縮 + github/bitbucket を内蔵デフォルト化). Forges maps a forge id to its credential config; Config.UnmarshalYAML also accepts the deprecated pre-forges-map `gateway.hosts` list (docs/plans/git-gateway-cutover.md PR4's original schema) and folds it into this map, so GatewayConfig itself only ever needs to carry the one shape.

func (GatewayConfig) HostConfigs added in v0.0.11

func (g GatewayConfig) HostConfigs() []gitgateway.HostForgeConfig

HostConfigs resolves g.Forges into the flat gitgateway.HostForgeConfig list gitgateway.NewCredentialProvider consumes (internal/server/wire.go), applying built-in defaults per resolveForgeConfig. Entries are returned in id-sorted order for determinism.

INVARIANT: callers must only invoke this on a GatewayConfig that has already been validated by Config.UnmarshalYAML — that is the sole place gateway.forges entries are validated, so on a validated config every entry resolves successfully. A resolution failure here is defensive-only (a hand-built GatewayConfig that skipped validation) and is skipped silently rather than surfaced as an error, since HostConfigs has no error return and never should have one under the invariant.

type NotifyConfig

type NotifyConfig struct {
	Command []string `yaml:"command"`
}

NotifyConfig holds settings for agent-driven notifications.

type SandboxConfig

type SandboxConfig struct {
	AllowedDomains []string `yaml:"allowed_domains"`
}

SandboxConfig holds sandbox-related settings.

type TaskAskConfig added in v0.0.7

type TaskAskConfig struct {
	// DisconnectGrace is how long an awaiting task may sit with no live agent
	// parked (the agent's `boid task ask` was killed by a harness command-timeout
	// and disconnected) before the daemon reclaims it. The agent normally
	// re-asks within one command-timeout and re-attaches; the grace bounds the
	// case where it never returns.
	DisconnectGrace time.Duration `yaml:"-"`
}

TaskAskConfig holds settings for the blocking `boid task ask` Q&A RPC.

type WebConfig

type WebConfig struct {
	PublicURL string `yaml:"public_url"`
	HTTPAddr  string `yaml:"http_addr"`
}

WebConfig holds web UI settings.

Jump to

Keyboard shortcuts

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