Documentation
¶
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 BreakController
- type Config
- type Deps
- type ExecutionResult
- type Executor
- type ExternalReviewLogger
- type ExternalReviewOutcome
- type ExternalReviewPhase
- type ExternalReviewPhaseOpts
- type ExternalReviewPrompts
- type FinalizeLogger
- type FinalizePhase
- type FinalizePhaseOpts
- type FinalizePrompts
- type GitChecker
- type GitState
- type InputCollector
- type Locator
- type Logger
- type PlanCreationLogger
- type PlanCreationPhase
- type PlanCreationPhaseOpts
- type PlanCreationPrompts
- type Policy
- type QuestionPayload
- type ReviewLogger
- type ReviewPhase
- type ReviewPhaseOpts
- type ReviewPrompts
- type TaskLogger
- type TaskPhase
- type TaskPhaseOpts
- type TaskPrompts
Constants ¶
const ( SignalCompleted = status.Completed SignalFailed = status.Failed SignalReviewDone = status.ReviewDone SignalCodexDone = status.CodexDone SignalQuestion = status.Question SignalPlanReady = status.PlanReady SignalPlanDraft = status.PlanDraft )
Signal aliases mirror pkg/status values used by phase prompt contracts and parser helpers.
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 ErrUserAborted = errors.New("user aborted")
ErrUserAborted is returned when a user aborts task execution after a break signal.
var ErrUserRejectedPlan = errors.New("user rejected plan")
ErrUserRejectedPlan is returned when a user rejects a plan draft.
Functions ¶
func IsCodexDone ¶
IsCodexDone reports whether signal marks external review completion.
func IsPlanReady ¶
IsPlanReady reports whether signal marks plan creation completion.
func IsReviewDone ¶
IsReviewDone reports whether signal marks internal review completion.
func ParsePlanDraftPayload ¶
ParsePlanDraftPayload extracts plan content from output containing a PLAN_DRAFT signal.
Types ¶
type BreakController ¶
type BreakController struct {
// contains filtered or unexported fields
}
BreakController translates break-channel events into cancellable phase contexts.
func NewBreakController ¶
func NewBreakController(deps *Deps) *BreakController
NewBreakController creates a break controller backed by shared dependencies.
type Config ¶
type Config struct {
PlanDescription string
MaxIterations int
MaxExternalIterations int
ReviewPatience int
CodexEnabled bool
ExternalReviewToolSet bool
FinalizeEnabled bool
AppConfig *config.Config
}
Config contains the runner settings consumed by phase engines.
type Deps ¶
type Deps struct {
Git GitChecker
InputCollector InputCollector
BreakCh <-chan struct{}
PauseHandler func(ctx context.Context) bool
}
Deps holds late-bound dependencies shared by phase engines.
type ExecutionResult ¶
ExecutionResult is the execution output plus phase-level timeout metadata.
type ExternalReviewLogger ¶
type ExternalReviewLogger interface {
Logger
PrintSection(section status.Section)
PrintAligned(text string)
}
ExternalReviewLogger records external review phase progress and summaries.
type ExternalReviewOutcome ¶
type ExternalReviewOutcome struct {
HadFindings bool
}
ExternalReviewOutcome reports whether external review found issues.
type ExternalReviewPhase ¶
type ExternalReviewPhase struct {
// contains filtered or unexported fields
}
ExternalReviewPhase runs codex or custom external review loops.
func NewExternalReviewPhase ¶
func NewExternalReviewPhase(opts ExternalReviewPhaseOpts) *ExternalReviewPhase
NewExternalReviewPhase creates an external review phase engine.
func (*ExternalReviewPhase) Run ¶
func (p *ExternalReviewPhase) Run(ctx context.Context) (ExternalReviewOutcome, error)
Run executes the configured external review loop and reports whether fixes need post-review.
func (*ExternalReviewPhase) Tool ¶
func (p *ExternalReviewPhase) Tool() string
Tool returns the effective external review tool after config and back-compat rules.
type ExternalReviewPhaseOpts ¶
type ExternalReviewPhaseOpts struct {
Cfg Config
Log ExternalReviewLogger
External Executor
Custom *executor.CustomExecutor
Review Executor
Policy Policy
Prompts ExternalReviewPrompts
Breaks *BreakController
Git *GitState
PhaseHolder *status.PhaseHolder
IterationDelay time.Duration
}
ExternalReviewPhaseOpts contains dependencies for ExternalReviewPhase.
type ExternalReviewPrompts ¶
type ExternalReviewPrompts interface {
CodexReviewPrompt(isFirst bool, claudeResponse string) string
CodexEvaluationPrompt(codexOutput string) string
CustomReviewPrompt(isFirst bool, claudeResponse string) string
CustomEvaluationPrompt(customOutput string) string
}
ExternalReviewPrompts renders external review and evaluation prompts.
type FinalizeLogger ¶
FinalizeLogger records finalize phase progress.
type FinalizePhase ¶
type FinalizePhase struct {
// contains filtered or unexported fields
}
FinalizePhase runs the optional finalize step.
func NewFinalizePhase ¶
func NewFinalizePhase(opts FinalizePhaseOpts) *FinalizePhase
NewFinalizePhase creates a finalize phase engine.
type FinalizePhaseOpts ¶
type FinalizePhaseOpts struct {
Cfg Config
Log FinalizeLogger
Exec Executor
Policy Policy
Prompts FinalizePrompts
PhaseHolder *status.PhaseHolder
}
FinalizePhaseOpts contains dependencies for FinalizePhase.
type FinalizePrompts ¶
type FinalizePrompts interface {
FinalizePrompt() string
}
FinalizePrompts renders finalize prompts.
type GitChecker ¶
GitChecker reports git state used by review loops.
type GitState ¶
type GitState struct {
// contains filtered or unexported fields
}
GitState reads git state for review loops.
func NewGitState ¶
NewGitState creates a git state reader backed by shared dependencies.
type InputCollector ¶
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 collects user input for interactive plan creation.
type Locator ¶
type Locator interface {
Path() string
}
Locator resolves the current plan file path.
type PlanCreationLogger ¶
type PlanCreationLogger interface {
Logger
PrintRaw(format string, args ...any)
PrintSection(section status.Section)
LogQuestion(question string, options []string)
LogAnswer(answer string)
LogDraftReview(action string, feedback string)
}
PlanCreationLogger records interactive plan creation progress and Q&A history.
type PlanCreationPhase ¶
type PlanCreationPhase struct {
// contains filtered or unexported fields
}
PlanCreationPhase runs interactive plan creation.
func NewPlanCreationPhase ¶
func NewPlanCreationPhase(opts PlanCreationPhaseOpts) *PlanCreationPhase
NewPlanCreationPhase creates a plan creation phase engine.
type PlanCreationPhaseOpts ¶
type PlanCreationPhaseOpts struct {
Cfg Config
Log PlanCreationLogger
Exec Executor
Policy Policy
Prompts PlanCreationPrompts
Deps *Deps
PhaseHolder *status.PhaseHolder
IterationDelay time.Duration
}
PlanCreationPhaseOpts contains dependencies for PlanCreationPhase.
type PlanCreationPrompts ¶
type PlanCreationPrompts interface {
PlanPrompt() string
}
PlanCreationPrompts renders interactive plan creation prompts.
type Policy ¶
type Policy interface {
Run(ctx context.Context, run func(context.Context, string) executor.Result, prompt string, toolName string) ExecutionResult
HandlePatternMatchError(err error, tool string) error
Sleep(ctx context.Context, d time.Duration) error
}
Policy applies execution retry, timeout, and sleep behavior for phase engines.
type QuestionPayload ¶
type QuestionPayload struct {
Question string `json:"question"`
Options []string `json:"options"`
Context string `json:"context,omitempty"`
}
QuestionPayload represents a question signal from the plan creation phase.
func ParseQuestionPayload ¶
func ParseQuestionPayload(output string) (*QuestionPayload, error)
ParseQuestionPayload extracts a question payload from output containing a QUESTION signal.
type ReviewLogger ¶
ReviewLogger records internal review phase progress.
type ReviewPhase ¶
type ReviewPhase struct {
// contains filtered or unexported fields
}
ReviewPhase runs internal review passes.
func NewReviewPhase ¶
func NewReviewPhase(opts ReviewPhaseOpts) *ReviewPhase
NewReviewPhase creates an internal review phase engine.
type ReviewPhaseOpts ¶
type ReviewPhaseOpts struct {
Cfg Config
Log ReviewLogger
Exec Executor
Policy Policy
Prompts ReviewPrompts
Git *GitState
PhaseHolder *status.PhaseHolder
IterationDelay time.Duration
}
ReviewPhaseOpts contains dependencies for ReviewPhase.
type ReviewPrompts ¶
type ReviewPrompts interface {
FirstReviewPrompt() string
SecondReviewPrompt(prefix string) string
}
ReviewPrompts renders internal review prompts.
type TaskLogger ¶
type TaskLogger interface {
Logger
PrintRaw(format string, args ...any)
PrintSection(section status.Section)
}
TaskLogger records task phase progress.
type TaskPhase ¶
type TaskPhase struct {
// contains filtered or unexported fields
}
TaskPhase executes plan tasks until completion.
func NewTaskPhase ¶
func NewTaskPhase(opts TaskPhaseOpts) *TaskPhase
NewTaskPhase creates a task phase engine.
func (*TaskPhase) HasUncompletedTasks ¶
HasUncompletedTasks reports whether the current plan still has actionable unchecked task work.
func (*TaskPhase) NextPlanTaskPosition ¶
NextPlanTaskPosition returns the 1-indexed first uncompleted task position, or zero when unavailable.
func (*TaskPhase) Run ¶
Run executes one plan task per iteration until all actionable task checkboxes are complete.
func (*TaskPhase) ValidatePlanHasTasks ¶
ValidatePlanHasTasks rejects plan files without executable task sections.
type TaskPhaseOpts ¶
type TaskPhaseOpts struct {
Cfg Config
Log TaskLogger
Exec Executor
Policy Policy
Prompts TaskPrompts
Locator Locator
Deps *Deps
Breaks *BreakController
IterationDelay time.Duration
RetryCount int
}
TaskPhaseOpts contains dependencies for TaskPhase.
type TaskPrompts ¶
type TaskPrompts interface {
TaskPrompt() string
}
TaskPrompts renders task phase prompts.