processor

package
v0.24.2 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package processor provides the main orchestration loop for ralphex execution.

Index

Constants

View Source
const (
	SignalCompleted  = status.Completed
	SignalFailed     = status.Failed
	SignalReviewDone = status.ReviewDone
	SignalCodexDone  = status.CodexDone
	SignalQuestion   = status.Question
	SignalPlanReady  = status.PlanReady
	SignalPlanDraft  = status.PlanDraft
)

signal constants are aliases to the shared status package for convenience within processor. all signal values are defined in pkg/status to avoid circular dependencies.

View Source
const DefaultIterationDelay = 2 * time.Second

DefaultIterationDelay is the pause between iterations to allow system to settle.

Variables

View Source
var ErrUserRejectedPlan = errors.New("user rejected plan")

ErrUserRejectedPlan is returned when user rejects the plan draft.

Functions

This section is empty.

Types

type Config

type Config struct {
	PlanFile              string         // path to plan file (required for full mode)
	PlanDescription       string         // plan description for interactive plan creation mode
	ProgressPath          string         // path to progress file
	Mode                  Mode           // execution mode
	MaxIterations         int            // maximum iterations for task phase
	MaxExternalIterations int            // override external review iteration limit (0 = auto)
	ReviewPatience        int            // terminate external review after N unchanged rounds (0 = disabled)
	Debug                 bool           // enable debug output
	NoColor               bool           // disable color output
	IterationDelayMs      int            // delay between iterations in milliseconds
	TaskRetryCount        int            // number of times to retry failed tasks
	CodexEnabled          bool           // whether codex review is enabled
	FinalizeEnabled       bool           // whether finalize step is enabled
	DefaultBranch         string         // default branch name (detected from repo)
	AppConfig             *config.Config // full application config (for executors and prompts)
}

Config holds runner configuration.

type Executor

type Executor interface {
	Run(ctx context.Context, prompt string) executor.Result
}

Executor runs CLI commands and returns results.

type Executors added in v0.23.0

type Executors struct {
	Claude Executor
	Codex  Executor
	Custom *executor.CustomExecutor
}

Executors groups the executor dependencies for the Runner.

type GitChecker added in v0.9.0

type GitChecker interface {
	HeadHash() (string, error)
	DiffFingerprint() (string, error)
}

GitChecker provides git state inspection for the review loop.

type InputCollector added in v0.4.0

type InputCollector interface {
	AskQuestion(ctx context.Context, question string, options []string) (string, error)
	AskDraftReview(ctx context.Context, question string, planContent string) (action string, feedback string, err error)
}

InputCollector provides interactive input collection for plan creation.

type Logger

type Logger interface {
	Print(format string, args ...any)
	PrintRaw(format string, args ...any)
	PrintSection(section status.Section)
	PrintAligned(text string)
	LogQuestion(question string, options []string)
	LogAnswer(answer string)
	LogDraftReview(action string, feedback string)
	Path() string
}

Logger provides logging functionality.

type Mode

type Mode string

Mode represents the execution mode.

const (
	ModeFull      Mode = "full"       // full execution: tasks + reviews + codex
	ModeReview    Mode = "review"     // skip tasks, run full review pipeline
	ModeCodexOnly Mode = "codex-only" // skip tasks and first review, run only codex loop
	ModeTasksOnly Mode = "tasks-only" // run only task phase, skip all reviews
	ModePlan      Mode = "plan"       // interactive plan creation mode
)

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

Runner orchestrates the execution loop.

func New

func New(cfg Config, log Logger, holder *status.PhaseHolder) *Runner

New creates a new Runner with the given configuration and shared phase holder. If codex is enabled but the binary is not found in PATH, it is automatically disabled with a warning.

func NewWithExecutors

func NewWithExecutors(cfg Config, log Logger, execs Executors, holder *status.PhaseHolder) *Runner

NewWithExecutors creates a new Runner with custom executors (for testing).

func (*Runner) Run

func (r *Runner) Run(ctx context.Context) error

Run executes the main loop based on configured mode.

func (*Runner) SetBreakCh added in v0.20.0

func (r *Runner) SetBreakCh(ch <-chan struct{})

SetBreakCh sets the break channel for manual termination of the external review loop. closing the channel causes the current executor run to be canceled and the loop to exit.

func (*Runner) SetGitChecker added in v0.9.0

func (r *Runner) SetGitChecker(g GitChecker)

SetGitChecker sets the git checker for no-commit detection in review loops.

func (*Runner) SetInputCollector added in v0.4.0

func (r *Runner) SetInputCollector(c InputCollector)

SetInputCollector sets the input collector for plan creation mode.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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