config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package config provides configuration types and path management.

Index

Constants

View Source
const (
	ReviewModeClaude  = "claude"
	ReviewModeCodex   = "codex"
	ReviewModeClaudex = "claudex"
)

ReviewMode constants.

View Source
const (
	AgentClaude = "claude"
	AgentCodex  = "codex"
)

Agent constants.

View Source
const (
	// DefaultBaseDir is the default base directory for agentpair data.
	DefaultBaseDir = ".agentpair"
	// RunsDir is the subdirectory for run data.
	RunsDir = "runs"
)

Variables

View Source
var ConfigFilenames = []string{"config.yaml", "config.yml", "config.json"}

ConfigFilenames are the supported config file names in order of preference.

Functions

func RepoIDFromPath

func RepoIDFromPath(path string) string

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

func (c *Config) IsSingleAgentMode() bool

IsSingleAgentMode returns true if running in single-agent mode.

func (*Config) PrimaryAgent

func (c *Config) PrimaryAgent() string

PrimaryAgent returns the name of the primary worker agent.

func (*Config) SecondaryAgent

func (c *Config) SecondaryAgent() string

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

func NewPaths() (*Paths, error)

NewPaths creates a new Paths instance with the default base directory (~/.agentpair).

func NewPathsWithBase

func NewPathsWithBase(baseDir string) *Paths

NewPathsWithBase creates a new Paths instance with a custom base directory.

func (*Paths) BaseDir

func (p *Paths) BaseDir() string

BaseDir returns the base directory path.

func (*Paths) BridgePath

func (p *Paths) BridgePath(repoPath string, runID int) string

BridgePath returns the path to the bridge.jsonl file for a run.

func (*Paths) EnsureRunDir

func (p *Paths) EnsureRunDir(repoPath string, runID int) error

EnsureRunDir creates the run directory if it doesn't exist.

func (*Paths) ManifestPath

func (p *Paths) ManifestPath(repoPath string, runID int) string

ManifestPath returns the path to the manifest.json file for a run.

func (*Paths) NextRunID

func (p *Paths) NextRunID(repoPath string) (int, error)

NextRunID returns the next available run ID for a repository.

func (*Paths) RepoDir

func (p *Paths) RepoDir(repoPath string) string

RepoDir returns the path to a repository's run directory. The repoPath is hashed to create a safe directory name.

func (*Paths) RunDir

func (p *Paths) RunDir(repoPath string, runID int) string

RunDir returns the path to a specific run's directory.

func (*Paths) RunsDir

func (p *Paths) RunsDir() string

RunsDir returns the path to the runs directory.

func (*Paths) TranscriptPath

func (p *Paths) TranscriptPath(repoPath string, runID int) string

TranscriptPath returns the path to the transcript.jsonl file for a run.

Jump to

Keyboard shortcuts

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