config

package
v0.25.21 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 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 (
	// AgentTypeClaudeCode is the default agent type. Claude Code supports
	// bracketed paste, so it keeps the existing paste-based injection path.
	AgentTypeClaudeCode = "claude-code"
	// AgentTypeCodex uses typed injection and Enter submit by default.
	AgentTypeCodex = "codex"
	// AgentTypeGeneric is a non-Claude agent with conservative typed-input defaults.
	AgentTypeGeneric = "generic"
)
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 DefaultNoBracketedPaste added in v0.25.21

func DefaultNoBracketedPaste(agentType string) bool

DefaultNoBracketedPaste returns the agent-type default for text injection. Only Claude Code keeps bracketed paste enabled by default.

func DefaultSubmitKey added in v0.25.21

func DefaultSubmitKey(agentType string) string

DefaultSubmitKey returns the submit key implied by the agent type.

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 NormalizeAgentType added in v0.25.21

func NormalizeAgentType(agentType string) string

NormalizeAgentType returns the effective agent type, defaulting to claude-code when the config omits it.

func ValidAgentType added in v0.25.21

func ValidAgentType(agentType string) bool

ValidAgentType reports whether agentType is one of the supported config values.

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. Defaults to 127.0.0.1 if only port given (e.g., ":7391" becomes "127.0.0.1:7391"). Use "0.0.0.0:port" to bind all interfaces.
	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. If the config contains auth tokens and the file is group/world readable, a warning is printed to stderr.

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"`
	AgentType        string   `yaml:"agent_type,omitempty"` // "claude-code" (default), "codex", or "generic".
	Command          []string `yaml:"command,omitempty"`    // Override the agent command entirely (e.g. ["codex"]).
	ClaudeArgs       []string `yaml:"claude_args,omitempty"`
	NoBracketedPaste bool     `yaml:"no_bracketed_paste,omitempty"` // When true, use the non-bracketed injection path.
	SubmitKey        string   `yaml:"submit_key,omitempty"`         // "enter" (default) or "ctrl+enter".
}

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