Documentation
¶
Overview ¶
Package processor provides the main orchestration loop for ralphex execution.
Index ¶
- Constants
- Variables
- func IsCodexDone(signal string) bool
- func IsPlanReady(signal string) bool
- func IsReviewDone(signal string) bool
- func ParsePlanDraftPayload(output string) (string, error)
- type Config
- type Executor
- type GitChecker
- type InputCollector
- type Logger
- type Mode
- type QuestionPayload
- type Runner
Constants ¶
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.
const DefaultIterationDelay = 2 * time.Second
DefaultIterationDelay is the pause between iterations to allow system to settle.
Variables ¶
var ErrNoPlanDraftSignal = errors.New("no plan draft signal found")
ErrNoPlanDraftSignal indicates no plan draft signal was found in output
var ErrNoQuestionSignal = errors.New("no question signal found")
ErrNoQuestionSignal indicates no question signal was found in output
var ErrUserRejectedPlan = errors.New("user rejected plan")
ErrUserRejectedPlan is returned when user rejects the plan draft.
Functions ¶
func IsCodexDone ¶
IsCodexDone returns true if signal indicates codex phase is complete.
func IsPlanReady ¶ added in v0.4.0
IsPlanReady returns true if signal indicates plan creation is complete.
func IsReviewDone ¶
IsReviewDone returns true if signal indicates review phase is complete.
func ParsePlanDraftPayload ¶ added in v0.6.0
ParsePlanDraftPayload extracts plan content from output containing PLAN_DRAFT signal. returns ErrNoPlanDraftSignal if no plan draft signal is found. returns other error if signal is found but content is malformed.
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)
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 GitChecker ¶ added in v0.9.0
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 QuestionPayload ¶ added in v0.4.0
type QuestionPayload struct {
Question string `json:"question"`
Options []string `json:"options"`
Context string `json:"context,omitempty"`
}
QuestionPayload represents a question signal from Claude during plan creation
func ParseQuestionPayload ¶ added in v0.4.0
func ParseQuestionPayload(output string) (*QuestionPayload, error)
ParseQuestionPayload extracts a QuestionPayload from output containing QUESTION signal. returns ErrNoQuestionSignal if no question signal is found. returns other error if signal is found but JSON is malformed.
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, claude, codex Executor, custom *executor.CustomExecutor, holder *status.PhaseHolder) *Runner
NewWithExecutors creates a new Runner with custom executors (for testing).
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.