Help us shape the future of Go! Take the 2026 Go Developer Survey

runcmd

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package runcmd is `steerloop run`. Start at run.go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

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

Command is `steerloop run`. It implements cli.Command.

func New

func New(env cli.Environment) *Command

func (*Command) Run

func (c *Command) Run(ctx context.Context, args []string) int

Run reads top to bottom: parse, validate, build, execute.

type EventSink

type EventSink interface {
	Write(evt event.Event)
}

EventSink receives every event the loop emits. → cmd/steerloop/internal/render (people), steerloop/internal/eventlog (machines)

type InputReader added in v0.2.7

type InputReader interface {
	Read(ctx context.Context)
}

InputReader reads stdin into the lines steering applies. → cmd/steerloop/internal/stdin

type Options

type Options struct {
	bootstrap.Options
	// Output Options
	Output string
	// Steering/Loop Control Options
	ControlPath string // give the loop a stream of commands that arrive over time, same as if a person typed it at the terminal
}

Options is the `steerloop run` command line: the flags shared with chat, and the ones only a single run has.

func ParseOptions

func ParseOptions(args []string, stderr io.Writer) (Options, error)

ParseOptions reads flags into Options and reports its own errors to stderr.

func (Options) Validate

func (o Options) Validate() error

Validate is bootstrap.Options.Validate, plus the prompt and --output. It reports every problem at once, not just the first.

type Run

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

Run is one fully wired run, ready to execute. NewRun builds it.

func NewRun

func NewRun(ctx context.Context, env cli.Environment, opts Options) (*Run, error)

NewRun builds a Run from options. It is the only place that picks a concrete type for each interface run.go declares, so this function alone tells you which implementation runs.

func (*Run) Execute

func (r *Run) Execute(parent context.Context) int

Execute runs one turn. Exactly four goroutines take part, all started here:

  1. the loop itself — loop.Start; it closes events when it is done
  2. stdin lines — r.input.Read; blocks on stdin, so it can outlive the run (the process exits right after, so that is harmless)
  3. steering input — r.steering.Steer
  4. Ctrl-C handling — r.interrupts.Watch

cancel (deferred) ends 3 and 4 once the loop has finished.

type SteeringSource

type SteeringSource interface {
	Steer(ctx context.Context, loop *loop.Loop)
}

SteeringSource feeds a person's input into a running loop. → cmd/steerloop/internal/steering

Jump to

Keyboard shortcuts

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