executor

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package executor provides CLI execution for Copilot and custom review tools.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandRunner

type CommandRunner interface {
	Run(ctx context.Context, name string, args ...string) (output io.Reader, wait func() error, err error)
}

CommandRunner abstracts command execution for testing. Returns an io.Reader for streaming output and a wait function for completion.

type CopilotExecutor

type CopilotExecutor struct {
	Command       string            // command to execute, defaults to "copilot"
	Args          string            // additional arguments (space-separated)
	CodingModel   string            // model for coding/task phases
	ReviewModel   string            // model for external review phases
	ErrorPatterns []string          // patterns to detect in output (e.g., rate limit messages)
	LimitPatterns []string          // patterns to detect rate limits (checked before error patterns)
	OutputHandler func(text string) // called for each text chunk, can be nil
	// contains filtered or unexported fields
}

CopilotExecutor runs GitHub Copilot CLI commands with JSONL output parsing.

func (*CopilotExecutor) Run

func (e *CopilotExecutor) Run(ctx context.Context, prompt string) Result

Run executes copilot CLI with the CodingModel for task/review phases.

func (*CopilotExecutor) RunReview

func (e *CopilotExecutor) RunReview(ctx context.Context, prompt string) Result

RunReview executes copilot CLI with the ReviewModel for external review phases.

type CustomExecutor

type CustomExecutor struct {
	Script        string            // path to the custom review script
	OutputHandler func(text string) // called for each output line, can be nil
	ErrorPatterns []string          // patterns to detect in output (e.g., rate limit messages)
	LimitPatterns []string          // patterns to detect rate limits (checked before error patterns)
	// contains filtered or unexported fields
}

CustomExecutor runs custom review scripts and streams output.

func (*CustomExecutor) Run

func (e *CustomExecutor) Run(ctx context.Context, promptContent string) Result

Run executes the custom review script with the prompt content written to a temp file. The script receives the path to the prompt file as its single argument. Output is streamed line-by-line to OutputHandler.

func (*CustomExecutor) SetRunner

func (e *CustomExecutor) SetRunner(r CustomRunner)

SetRunner sets the custom runner for testing purposes.

type CustomRunner

type CustomRunner interface {
	Run(ctx context.Context, script, promptFile string) (stdout io.Reader, wait func() error, err error)
}

CustomRunner abstracts command execution for custom review scripts. Returns stdout reader and a wait function for completion.

type LimitPatternError

type LimitPatternError struct {
	Pattern string // the pattern that matched
	HelpCmd string // command to run for more information
}

LimitPatternError is returned when a configured rate limit pattern is detected in output. when wait-on-limit is configured, the caller retries instead of exiting.

func (*LimitPatternError) Error

func (e *LimitPatternError) Error() string

type PatternMatchError

type PatternMatchError struct {
	Pattern string // the pattern that matched
	HelpCmd string // command to run for more information
}

PatternMatchError is returned when a configured error pattern is detected in output.

func (*PatternMatchError) Error

func (e *PatternMatchError) Error() string

type Result

type Result struct {
	Output string // accumulated text output
	Signal string // detected signal (COMPLETED, FAILED, etc.) or empty
	Error  error  // execution error if any
}

Result holds execution result with output and detected signal.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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