Documentation
¶
Overview ¶
Package auto implements the automatic execution mode runner
Index ¶
- type ClaudeExecutor
- type Config
- type IssueInfo
- type Runner
- func (r *Runner) AddTask(issueNumber int, title string)
- func (r *Runner) AddTasks(issues []IssueInfo)
- func (r *Runner) CompletedCount() int
- func (r *Runner) FailedCount() int
- func (r *Runner) Pause()
- func (r *Runner) PendingCount() int
- func (r *Runner) Reset()
- func (r *Runner) Resume()
- func (r *Runner) Run(ctx context.Context) error
- func (r *Runner) SetOnAllComplete(fn func(tasks []*Task))
- func (r *Runner) SetOnTaskComplete(fn func(task *Task))
- func (r *Runner) SetOnTaskStart(fn func(task *Task))
- func (r *Runner) State() RunnerState
- func (r *Runner) Stop()
- func (r *Runner) Summary() string
- func (r *Runner) Tasks() []*Task
- type RunnerState
- type StubExecutor
- type Task
- type TaskExecutor
- type TaskState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClaudeExecutor ¶ added in v0.9.0
type ClaudeExecutor struct {
// WorkDir is the repository working directory
WorkDir string
// ClaudeMDDir is the directory containing CLAUDE.md for the executor
ClaudeMDDir string
// Model is the Claude model to use (optional)
Model agent.Model
}
ClaudeExecutor executes tasks using Claude CLI via agent.Runner
func NewClaudeExecutor ¶ added in v0.9.0
func NewClaudeExecutor(workDir, claudeMDDir string) *ClaudeExecutor
NewClaudeExecutor creates a new ClaudeExecutor
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner manages the automatic execution of approved tasks
func NewRunner ¶
func NewRunner(executor TaskExecutor, cfg Config) *Runner
NewRunner creates a new auto mode runner
func (*Runner) CompletedCount ¶
CompletedCount returns the number of completed tasks
func (*Runner) FailedCount ¶
FailedCount returns the number of failed tasks
func (*Runner) PendingCount ¶
PendingCount returns the number of pending tasks
func (*Runner) Run ¶
Run starts executing all pending tasks Blocks until all tasks are done or context is cancelled
func (*Runner) SetOnAllComplete ¶
SetOnAllComplete sets the callback for when all tasks are done
func (*Runner) SetOnTaskComplete ¶
SetOnTaskComplete sets the callback for when a task completes
func (*Runner) SetOnTaskStart ¶
SetOnTaskStart sets the callback for when a task starts
type RunnerState ¶
type RunnerState string
RunnerState represents the state of the runner
const ( // RunnerStateIdle means the runner is not running RunnerStateIdle RunnerState = "idle" // RunnerStateRunning means the runner is executing tasks RunnerStateRunning RunnerState = "running" // RunnerStatePaused means the runner is paused RunnerStatePaused RunnerState = "paused" // RunnerStateCompleted means all tasks are done RunnerStateCompleted RunnerState = "completed" )
type StubExecutor ¶
type StubExecutor struct {
// SimulatedDuration is how long each task "takes" to execute
SimulatedDuration time.Duration
// NextPRNumber is the next PR number to return (incremented after each call)
NextPRNumber int
// FailIssues is a list of issue numbers that should fail
FailIssues map[int]error
// Logger for output
Logger *log.Logger
}
StubExecutor is a stub implementation of TaskExecutor for testing It simulates task execution by logging and returning a mock PR number
func NewStubExecutor ¶
func NewStubExecutor() *StubExecutor
NewStubExecutor creates a new stub executor
func (*StubExecutor) ClearFailures ¶
func (e *StubExecutor) ClearFailures()
ClearFailures removes all configured failures
func (*StubExecutor) SetFailure ¶
func (e *StubExecutor) SetFailure(issueNumber int, err error)
SetFailure configures an issue to fail with the given error
type Task ¶
type Task struct {
IssueNumber int
Title string
State TaskState
StartedAt time.Time
CompletedAt time.Time
Error error
PRNumber int // PR number created after completion
}
Task represents a task to be executed
type TaskExecutor ¶
type TaskExecutor interface {
// Execute runs the task implementation
// Returns the PR number on success, or an error on failure
Execute(ctx context.Context, issueNumber int, title string) (prNumber int, err error)
}
TaskExecutor is the interface for executing tasks Implementations can be stubs or actual Claude agent integrations
type TaskState ¶
type TaskState string
TaskState represents the state of a task
const ( // TaskStatePending means the task is waiting to be executed TaskStatePending TaskState = "pending" // TaskStateRunning means the task is currently being executed TaskStateRunning TaskState = "running" // TaskStateCompleted means the task finished successfully TaskStateCompleted TaskState = "completed" // TaskStateFailed means the task failed TaskStateFailed TaskState = "failed" )