cli

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: MIT Imports: 30 Imported by: 0

Documentation

Overview

Package cli implements the command-line interface for programmator.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute() error

Execute runs the root command.

func Run

func Run(ctx context.Context, sourceID, workingDir string, cfg RunConfig) (*loop.Result, error)

Run creates a loop, wires callbacks to a Writer, and runs synchronously. It handles signal-based shutdown and guarantees footer cleanup on exit.

func SetVersionInfo

func SetVersionInfo(v, c, d string)

SetVersionInfo sets the version information for the CLI.

Types

type Collector

type Collector interface {
	// AskQuestion presents a question with options and returns the selected answer.
	AskQuestion(ctx context.Context, question string, options []string) (string, error)
}

Collector provides interactive input collection for plan creation.

type RunConfig

type RunConfig struct {
	SafetyConfig      safety.Config
	ReviewConfig      review.Config
	PromptBuilder     *prompt.Builder
	TicketCommand     string
	GitWorkflowConfig loop.GitWorkflowConfig
	ExecutorConfig    executor.Config
	Out               io.Writer // output writer (default: os.Stdout)
	IsTTY             bool
	TermWidth         int
	TermHeight        int
}

RunConfig holds all configuration needed to run the loop.

type TerminalCollector

type TerminalCollector struct {
	// contains filtered or unexported fields
}

TerminalCollector implements Collector using fzf (if available) or numbered selection fallback.

func NewTerminalCollector

func NewTerminalCollector() *TerminalCollector

NewTerminalCollector creates a new TerminalCollector with default stdin/stdout.

func NewTerminalCollectorWithIO

func NewTerminalCollectorWithIO(stdin io.Reader, stdout io.Writer) *TerminalCollector

NewTerminalCollectorWithIO creates a TerminalCollector with custom I/O (for testing).

func (*TerminalCollector) AskQuestion

func (c *TerminalCollector) AskQuestion(ctx context.Context, question string, options []string) (string, error)

AskQuestion presents options using fzf if available, otherwise falls back to numbered selection.

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

Writer prints events to stdout and redraws a sticky footer in TTY mode. In non-TTY mode, it prints plain text without ANSI escapes or footer.

In TTY mode, Writer uses inline Bubble Tea mode (no alt screen): - content is printed above the program via tea.Printf/tea.Println - View() renders sticky footer at the bottom - terminal scrollback remains standard.

func NewWriter

func NewWriter(out io.Writer, isTTY bool, width, height int) *Writer

NewWriter creates a Writer. If width is <= 0, defaults to 80.

func (*Writer) ClearFooter

func (w *Writer) ClearFooter()

ClearFooter clears the footer overlay.

func (*Writer) SetClaudeConfigDir added in v1.1.0

func (w *Writer) SetClaudeConfigDir(dir string)

SetClaudeConfigDir sets a non-default Claude config directory to display in the footer.

func (*Writer) SetExecutorName added in v1.1.0

func (w *Writer) SetExecutorName(name string)

SetExecutorName sets the executor label used in footer status (e.g. claude, pi).

func (*Writer) SetProcessStats

func (w *Writer) SetProcessStats(pid int, memKB int64)

SetProcessStats updates the PID field used by the footer.

func (*Writer) UpdateFooter

func (w *Writer) UpdateFooter(state *safety.State, item *domain.WorkItem, cfg safety.Config)

UpdateFooter redraws the sticky footer with current state.

func (*Writer) WriteEvent

func (w *Writer) WriteEvent(ev event.Event)

WriteEvent prints a single event to the output stream.

Jump to

Keyboard shortcuts

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