config

package
v0.23.39 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package config owns the initech.yaml schema. It reads, parses, validates, and exposes the Project type that all other packages consume.

Config discovery order: explicit --config flag, ./initech.yaml in the current directory, then walk upward to find initech.yaml (like .git discovery). The first match wins.

This package does not know about git, scaffold, or roles. It only knows how to turn a YAML file into a validated Go struct.

Index

Constants

View Source
const DefaultPressureThreshold = 85

DefaultPressureThreshold is the RSS percentage above which agents may be auto-suspended. Used when PressureThreshold is zero (unset).

Variables

This section is empty.

Functions

func Discover

func Discover(dir string) (string, error)

Discover finds an initech.yaml file by walking upward from dir. Returns the absolute path to the config file, or an error if none is found.

func Validate

func Validate(p *Project) error

Validate checks that the project config is internally consistent. Returns nil if valid, or an error describing the first problem found.

func Write

func Write(path string, p *Project) error

Write serializes a Project to YAML and writes it to the given path.

Types

type BeadsConfig

type BeadsConfig struct {
	Prefix string `yaml:"prefix,omitempty"`
}

BeadsConfig holds beads issue tracker settings.

type Project

type Project struct {
	Name          string                  `yaml:"project"`
	Root          string                  `yaml:"root"`
	Repos         []Repo                  `yaml:"repos,omitempty"`
	Env           map[string]string       `yaml:"env,omitempty"`
	Beads         BeadsConfig             `yaml:"beads,omitempty"`
	Resource      ResourceConfig          `yaml:"resource,omitempty"`
	Roles         []string                `yaml:"roles"`
	Grid          []string                `yaml:"grid,omitempty"`
	ClaudeCommand []string                `yaml:"claude_command,omitempty"`
	ClaudeArgs    []string                `yaml:"claude_args,omitempty"`
	RoleOverrides map[string]RoleOverride `yaml:"role_overrides,omitempty"`

	// Cross-machine coordination fields.
	PeerName string            `yaml:"peer_name,omitempty"` // This instance's identity (e.g., "workbench").
	Mode     string            `yaml:"mode,omitempty"`      // "" (default TUI) or "headless" (daemon).
	Listen   string            `yaml:"listen,omitempty"`    // TCP listen addr for headless mode (e.g., ":7391").
	Token    string            `yaml:"token,omitempty"`     // Shared auth token.
	Remotes  map[string]Remote `yaml:"remotes,omitempty"`   // Named remote peers.
}

Project is the top-level config read from initech.yaml.

func Load

func Load(path string) (*Project, error)

Load reads, parses, and validates an initech.yaml file from the given path. It expands ~ in the root field to the user's home directory.

type Remote added in v0.23.17

type Remote struct {
	Addr  string `yaml:"addr"`            // host:port of the remote peer.
	Token string `yaml:"token,omitempty"` // Auth token for this remote (overrides project-level token).
}

Remote describes a remote initech peer for cross-machine coordination.

type Repo

type Repo struct {
	URL  string `yaml:"url"`
	Name string `yaml:"name"`
}

Repo is a code repository that agents get as a git submodule.

type ResourceConfig

type ResourceConfig struct {
	AutoSuspend       bool `yaml:"auto_suspend,omitempty"`
	PressureThreshold int  `yaml:"pressure_threshold,omitempty"` // RSS percentage (0-100). Default: 85.
}

ResourceConfig holds resource management settings. When AutoSuspend is true, the TUI runs a memory monitor and can auto-suspend/resume agents under memory pressure. When absent or false, all resource management is dormant.

func (ResourceConfig) EffectivePressureThreshold

func (rc ResourceConfig) EffectivePressureThreshold() int

EffectivePressureThreshold returns the pressure threshold to use, applying the default when the configured value is zero.

type RoleOverride

type RoleOverride struct {
	TechStack  string   `yaml:"tech_stack,omitempty"`
	BuildCmd   string   `yaml:"build_cmd,omitempty"`
	TestCmd    string   `yaml:"test_cmd,omitempty"`
	Dir        string   `yaml:"dir,omitempty"`
	RepoName   string   `yaml:"repo_name,omitempty"`
	ClaudeArgs []string `yaml:"claude_args,omitempty"`
}

RoleOverride lets a project customize per-role settings beyond catalog defaults.

Jump to

Keyboard shortcuts

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