executor

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package executor provides CLI execution for Claude and Codex tools.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClaudeExecutor

type ClaudeExecutor struct {
	Command       string            // command to execute, defaults to "claude"
	Args          string            // additional arguments (space-separated), defaults to standard args
	OutputHandler func(text string) // called for each text chunk, can be nil
	Debug         bool              // enable debug output
	// contains filtered or unexported fields
}

ClaudeExecutor runs claude CLI commands with streaming JSON parsing.

func (*ClaudeExecutor) Run

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

Run executes claude CLI with the given prompt and parses streaming JSON output.

type CodexExecutor

type CodexExecutor struct {
	Command         string            // command to execute, defaults to "codex"
	Model           string            // model to use, defaults to gpt-5.2-codex
	ReasoningEffort string            // reasoning effort level, defaults to "xhigh"
	TimeoutMs       int               // stream idle timeout in ms, defaults to 3600000
	Sandbox         string            // sandbox mode, defaults to "read-only"
	ProjectDoc      string            // path to project documentation file
	OutputHandler   func(text string) // called for each filtered output line in real-time
	Debug           bool              // enable debug output
	// contains filtered or unexported fields
}

CodexExecutor runs codex CLI commands and filters output.

func (*CodexExecutor) Run

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

Run executes codex CLI with the given prompt and returns filtered output. stderr is streamed line-by-line to OutputHandler for progress indication. stdout is captured entirely as the final response (returned in Result.Output).

type CodexRunner

type CodexRunner interface {
	Run(ctx context.Context, name string, args ...string) (streams CodexStreams, wait func() error, err error)
}

CodexRunner abstracts command execution for codex. Returns both stderr (streaming progress) and stdout (final response).

type CodexStreams

type CodexStreams struct {
	Stderr io.Reader
	Stdout io.Reader
}

CodexStreams holds both stderr and stdout from codex command.

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 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