Documentation
¶
Overview ¶
Package config provides configuration types and path management.
Index ¶
- Constants
- Variables
- func RepoIDFromPath(path string) string
- func SaveConfigFile(cfg *FileConfig) error
- func SaveConfigToPath(path string, cfg *FileConfig) error
- type Config
- type FileConfig
- type Paths
- func (p *Paths) BaseDir() string
- func (p *Paths) BridgePath(repoPath string, runID int) string
- func (p *Paths) EnsureRunDir(repoPath string, runID int) error
- func (p *Paths) ManifestPath(repoPath string, runID int) string
- func (p *Paths) NextRunID(repoPath string) (int, error)
- func (p *Paths) RepoDir(repoPath string) string
- func (p *Paths) RunDir(repoPath string, runID int) string
- func (p *Paths) RunsDir() string
- func (p *Paths) TranscriptPath(repoPath string, runID int) string
Constants ¶
const ( ReviewModeClaude = "claude" ReviewModeCodex = "codex" ReviewModeClaudex = "claudex" )
ReviewMode constants.
const ( AgentClaude = "claude" AgentCodex = "codex" )
Agent constants.
const ( // DefaultBaseDir is the default base directory for agentpair data. DefaultBaseDir = ".agentpair" // RunsDir is the subdirectory for run data. RunsDir = "runs" )
Variables ¶
var ConfigFilenames = []string{"config.yaml", "config.yml", "config.json"}
ConfigFilenames are the supported config file names in order of preference.
Functions ¶
func RepoIDFromPath ¶
RepoIDFromPath returns the hashed repo ID for a path.
func SaveConfigFile ¶
func SaveConfigFile(cfg *FileConfig) error
SaveConfigFile saves configuration to the default config file location.
func SaveConfigToPath ¶
func SaveConfigToPath(path string, cfg *FileConfig) error
SaveConfigToPath saves configuration to a specific file path.
Types ¶
type Config ¶
type Config struct {
// Prompt is the initial task prompt.
Prompt string
// Agent specifies the primary worker agent ("claude" or "codex").
Agent string
// MaxIterations is the maximum number of loop iterations.
MaxIterations int
// Proof specifies the proof requirements (e.g., "run tests").
Proof string
// ReviewMode specifies who reviews: "claude", "codex", or "claudex".
ReviewMode string
// DoneSignal is the custom done signal to look for.
DoneSignal string
// UseTmux enables tmux side-by-side panes.
UseTmux bool
// UseWorktree enables git worktree isolation.
UseWorktree bool
// ClaudeOnly runs Claude in single-agent mode.
ClaudeOnly bool
// CodexOnly runs Codex in single-agent mode.
CodexOnly bool
// RunID is the run ID to resume.
RunID int
// SessionID is the session ID to resume.
SessionID string
// RepoPath is the path to the repository.
RepoPath string
// Verbose enables verbose output.
Verbose bool
// Timeout is the maximum time for the entire run.
Timeout time.Duration
}
Config holds the runtime configuration for agentpair.
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a Config with default values.
func (*Config) IsSingleAgentMode ¶
IsSingleAgentMode returns true if running in single-agent mode.
func (*Config) PrimaryAgent ¶
PrimaryAgent returns the name of the primary worker agent.
func (*Config) SecondaryAgent ¶
SecondaryAgent returns the name of the secondary/reviewer agent.
type FileConfig ¶
type FileConfig struct {
// Agent specifies the primary worker agent ("claude" or "codex").
Agent string `json:"agent,omitempty" yaml:"agent,omitempty"`
// MaxIterations is the maximum number of loop iterations.
MaxIterations int `json:"max_iterations,omitempty" yaml:"max_iterations,omitempty"`
// Proof specifies the proof requirements (e.g., "run tests").
Proof string `json:"proof,omitempty" yaml:"proof,omitempty"`
// ReviewMode specifies who reviews: "claude", "codex", or "claudex".
ReviewMode string `json:"review_mode,omitempty" yaml:"review_mode,omitempty"`
// DoneSignal is the custom done signal to look for.
DoneSignal string `json:"done_signal,omitempty" yaml:"done_signal,omitempty"`
// UseTmux enables tmux side-by-side panes.
UseTmux bool `json:"use_tmux,omitempty" yaml:"use_tmux,omitempty"`
// UseWorktree enables git worktree isolation.
UseWorktree bool `json:"use_worktree,omitempty" yaml:"use_worktree,omitempty"`
// Verbose enables verbose output.
Verbose bool `json:"verbose,omitempty" yaml:"verbose,omitempty"`
// Timeout is the maximum time for the entire run (as duration string).
Timeout string `json:"timeout,omitempty" yaml:"timeout,omitempty"`
}
FileConfig represents configuration that can be loaded from a file. This is a subset of Config that makes sense to persist.
func LoadConfigFile ¶
func LoadConfigFile() (*FileConfig, error)
LoadConfigFile loads configuration from the default config file location. Returns nil if no config file exists.
func LoadConfigFromPath ¶
func LoadConfigFromPath(path string) (*FileConfig, error)
LoadConfigFromPath loads configuration from a specific file path.
func (*FileConfig) Apply ¶
func (fc *FileConfig) Apply(c *Config)
Apply applies file config values to a Config, only overriding non-zero values.
type Paths ¶
type Paths struct {
// contains filtered or unexported fields
}
Paths manages file paths for agentpair data storage.
func NewPaths ¶
NewPaths creates a new Paths instance with the default base directory (~/.agentpair).
func NewPathsWithBase ¶
NewPathsWithBase creates a new Paths instance with a custom base directory.
func (*Paths) BridgePath ¶
BridgePath returns the path to the bridge.jsonl file for a run.
func (*Paths) EnsureRunDir ¶
EnsureRunDir creates the run directory if it doesn't exist.
func (*Paths) ManifestPath ¶
ManifestPath returns the path to the manifest.json file for a run.
func (*Paths) RepoDir ¶
RepoDir returns the path to a repository's run directory. The repoPath is hashed to create a safe directory name.