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
- func DefaultAutoApprove(agentType string) bool
- func DefaultNoBracketedPaste(agentType string) bool
- func DefaultSubmitKey(agentType string) string
- func Discover(dir string) (string, error)
- func IsCodexLikeAgentType(agentType string) bool
- func NormalizeAgentType(agentType string) string
- func ValidAgentType(agentType string) bool
- func Validate(p *Project) error
- func Write(path string, p *Project) error
- type BeadsConfig
- type Project
- type Remote
- type Repo
- type ResourceConfig
- type RoleOverride
Constants ¶
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" // AgentTypeOpenCode uses the same raw-input defaults and readiness handling // as Codex. AgentTypeOpenCode = "opencode" // AgentTypeGeneric is a non-Claude agent with conservative typed-input defaults. AgentTypeGeneric = "generic" )
const DefaultMcpBind = "0.0.0.0"
DefaultMcpBind is the default bind address for the MCP server.
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 DefaultAutoApprove ¶ added in v0.25.23
DefaultAutoApprove returns the agent-type default for permission prompt auto-approval. Codex and OpenCode default on; all other agent types default off.
func DefaultNoBracketedPaste ¶ added in v0.25.21
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
DefaultSubmitKey returns the submit key implied by the agent type.
func Discover ¶
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 IsCodexLikeAgentType ¶ added in v0.25.22
IsCodexLikeAgentType reports whether agentType should use the Codex/OpenCode readiness and raw-send flow.
func NormalizeAgentType ¶ added in v0.25.21
NormalizeAgentType returns the effective agent type, defaulting to claude-code when the config omits it.
func ValidAgentType ¶ added in v0.25.21
ValidAgentType reports whether agentType is one of the supported config values.
Types ¶
type BeadsConfig ¶
type BeadsConfig struct {
Enabled *bool `yaml:"enabled,omitempty"` // nil = legacy (treat as enabled), false = disabled
Prefix string `yaml:"prefix,omitempty"`
}
BeadsConfig holds beads issue tracker settings.
func (BeadsConfig) IsEnabled ¶ added in v1.5.0
func (b BeadsConfig) IsEnabled() bool
IsEnabled returns whether beads integration is active. Nil (legacy configs without the field) is treated as enabled for backwards compatibility.
type Project ¶
type Project struct {
Name string `yaml:"project"`
Root string `yaml:"root"`
Repos []Repo `yaml:"repos,omitempty"`
Beads BeadsConfig `yaml:"beads,omitempty"`
Resource ResourceConfig `yaml:"resource,omitempty"`
Roles []string `yaml:"roles"`
ClaudeCommand []string `yaml:"claude_command,omitempty"`
ClaudeArgs []string `yaml:"claude_args,omitempty"`
RoleOverrides map[string]RoleOverride `yaml:"role_overrides,omitempty"`
// Web companion server fields.
WebPort *int `yaml:"web_port,omitempty"` // Web companion port. nil/0 = disabled, >0 = enabled.
// MCP server fields.
McpPort *int `yaml:"mcp_port,omitempty"` // MCP server port. Default 9200, nil uses default, 0 disables.
McpToken string `yaml:"mcp_token,omitempty"` // Bearer token. Auto-generated if empty. INITECH_MCP_TOKEN env var overrides.
McpBind string `yaml:"mcp_bind,omitempty"` // Bind address. Default "0.0.0.0".
// 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 ¶
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.
func (*Project) EffectiveMcpBind ¶ added in v1.1.0
EffectiveMcpBind returns the MCP bind address, defaulting to "0.0.0.0".
func (*Project) EffectiveMcpPort ¶ added in v1.1.0
EffectiveMcpPort returns the MCP server port from config. Returns 0 (disabled) when mcp_port is not set, or the explicit value when set.
func (*Project) EffectiveMcpToken ¶ added in v1.1.0
EffectiveMcpToken returns the MCP bearer token, checking the INITECH_MCP_TOKEN environment variable first, then the config value. Returns empty string if neither is set (caller should auto-generate).
func (*Project) EffectiveWebPort ¶ added in v1.5.10
EffectiveWebPort returns the web companion port from config. Returns 0 (disabled) when web_port is not set, or the explicit value when set.
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 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.
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", "opencode", or "generic".
Command []string `yaml:"command,omitempty"` // Override the agent command entirely (e.g. ["codex"]).
ClaudeArgs []string `yaml:"claude_args,omitempty"`
AutoApprove *bool `yaml:"auto_approve,omitempty"` // When true, auto-approve matching permission prompts.
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.