Documentation
¶
Overview ¶
Package processor manages the prompt execution lifecycle.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DirtyFileChecker ¶ added in v0.96.0
DirtyFileChecker counts dirty files in a git working tree.
func NewDirtyFileChecker ¶ added in v0.96.0
func NewDirtyFileChecker(repoDir string) DirtyFileChecker
NewDirtyFileChecker creates a DirtyFileChecker that runs git status on the host.
type GitLockChecker ¶ added in v0.102.0
type GitLockChecker interface {
Exists() bool
}
GitLockChecker checks whether .git/index.lock exists in the working tree.
func NewGitLockChecker ¶ added in v0.102.0
func NewGitLockChecker(repoDir string) GitLockChecker
NewGitLockChecker creates a GitLockChecker for the given repo directory.
type Processor ¶
type Processor interface {
Process(ctx context.Context) error
ProcessQueue(ctx context.Context) error
// ResumeExecuting resumes any prompts still in "executing" state on startup.
// Called once by the runner before the normal event loop begins.
// For each executing prompt, it reattaches to the running container and drives
// the prompt to completion through the normal post-execution flow.
ResumeExecuting(ctx context.Context) error
}
Processor processes queued prompts.
func NewProcessor ¶
func NewProcessor( queueDir string, completedDir string, logDir string, projectName string, exec executor.Executor, promptManager prompt.Manager, releaser git.Releaser, versionGetter version.Getter, ready <-chan struct{}, pr bool, workflow config.Workflow, brancher git.Brancher, prCreator git.PRCreator, cloner git.Cloner, worktreer git.Worktreer, prMerger git.PRMerger, autoMerge bool, autoRelease bool, autoReview bool, autoCompleter spec.AutoCompleter, specLister spec.Lister, validationCommand string, validationPrompt string, testCommand string, verificationGate bool, n notifier.Notifier, containerCounter executor.ContainerCounter, maxContainers int, additionalInstructions string, containerLock containerlock.ContainerLock, containerChecker executor.ContainerChecker, dirtyFileThreshold int, dirtyFileChecker DirtyFileChecker, gitLockChecker GitLockChecker, autoRetryLimit int, maxPromptDuration time.Duration, ) Processor
NewProcessor creates a new Processor.
type WorkflowDeps ¶ added in v0.119.0
type WorkflowDeps struct {
ProjectName string
PromptManager prompt.Manager
AutoCompleter spec.AutoCompleter
Releaser git.Releaser
VersionGetter version.Getter
Brancher git.Brancher
PRCreator git.PRCreator
Cloner git.Cloner
Worktreer git.Worktreer
PRMerger git.PRMerger
PR bool
AutoMerge bool
AutoReview bool
AutoRelease bool
}
WorkflowDeps holds all dependencies that WorkflowExecutor implementations may need. Factory functions populate only the fields required by the selected implementation; unused fields are nil and must not be dereferenced by implementations that do not need them.
type WorkflowExecutor ¶ added in v0.119.0
type WorkflowExecutor interface {
// Setup prepares the execution environment before the YOLO container runs.
// For clone/worktree: creates the isolated directory and chdirs into it.
// For branch: creates or switches to the feature branch in-place.
// For direct: no-op.
// Returns a wrapped error on failure; partial setup is cleaned up before returning.
Setup(ctx context.Context, baseName string, pf *prompt.PromptFile) error
// CleanupOnError undoes any environment setup performed by Setup when
// execution or post-execution fails. Idempotent — safe to call if Setup was
// not called or has already been cleaned up. No-op for direct and branch
// executors where no isolated directory exists.
CleanupOnError(ctx context.Context)
// Complete performs all post-execution git operations after the YOLO container
// exits successfully: commit, chdir back, cleanup isolation, push, optional PR
// creation/merge, and moving the prompt file to completedPath.
//
// gitCtx is a non-cancellable context (context.WithoutCancel) for git ops.
// ctx is the normal request context (used for prompt-manager calls and error wrapping).
// completedPath is the destination path — the prompt has NOT been moved yet when
// Complete is called; each implementation calls moveToCompleted internally.
Complete(
gitCtx context.Context,
ctx context.Context,
pf *prompt.PromptFile,
title, promptPath, completedPath string,
) error
// ReconstructState restores internal state for a prompt being resumed after a
// daemon restart. Returns canResume=false if the isolated directory no longer
// exists (caller resets the prompt to approved). Returns an error only for
// unexpected filesystem failures.
ReconstructState(
ctx context.Context,
baseName string,
pf *prompt.PromptFile,
) (canResume bool, err error)
}
WorkflowExecutor handles the git lifecycle for a single prompt execution. It encapsulates the pre-execution environment setup and post-execution git operations for one workflow variant (direct, branch, clone, or worktree).
Implementations are stateful: Setup stores paths and branches internally so that CleanupOnError and Complete can use them without the caller tracking workflowState.