cli

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: Apache-2.0 Imports: 151 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cli implements the subcommands.

Index

Constants

This section is empty.

Variables

View Source
var Version = "dev"

Functions

func Defaults added in v0.2.0

func Defaults() config.Config

Defaults is the config a file overrides: config's defaults with the agent and the workspace managers this build picks.

func InstallPlugins added in v0.3.0

func InstallPlugins() error

InstallPlugins finds and installs the plugins, as installPlugins does, for the process's Envs. The command's main calls it once, before NewEnv and before anything reads the configuration or the profile.

func Run

func Run(ctx context.Context, e *Env, args []string) int

Types

type Advice

type Advice struct{ Name, Info, Fix string }

Advice is one doctor line about a manager: what it is, why, and the fix.

type Briefing

type Briefing interface {
	BriefReady(ctx context.Context, u unit.Unit) (intake.Readiness, error)
	OpenIntakes(ctx context.Context) ([]intake.Intake, error)
}

Briefing tells the sweep whether a round's brief is ready and which intakes are open.

type Env

type Env struct {
	Out io.Writer
	Err io.Writer
	// In is the standard input profile add reads its text from.
	In io.Reader

	Git gitx.Git
	// Files is what removals read of the file system; nil reads it directly.
	Files workspaces.Files
	// WS is every enabled workspace manager, in the configured order.
	WS *workspace.Set
	// Sh runs the auxiliary commands of doctor, app install and clone.
	Sh func(ctx context.Context, name string, args ...string) ([]byte, error)
	// Stdout runs a command for its standard output alone.
	Stdout func(ctx context.Context, name string, args ...string) ([]byte, error)

	LoadConfig func() (config.Config, error)
	// Languages are the system's preferred languages a serve shows its texts in when ui.locale is empty;
	// nil detects none, so texts read in English.
	Languages func() []string
	// IntentRecheck is how long the intent registry trusts the profile's stamp; zero rechecks on every read.
	IntentRecheck time.Duration
	// ViewDebounce is how long serve's view sinks gather wakes before they flush; zero is views.FlushDebounce.
	ViewDebounce time.Duration
	ConfigPath   string
	StateDir     string
	Home         string
	// HomeOverride is the session home a round by hand brings; nil reads
	// the caller's from Getenv.
	HomeOverride *string
	Now          func() time.Time
	Rec          Recorder
	// Rounds is the daemon's; a command line process has none.
	Rounds Rounds
	// Store, Turns and Views are the daemon's; a command line process has
	// none, and its rounds keep no turn.
	Store *inventory.Store

	Turns *turns.Service
	Views *views.Service
	// Briefing is the daemon's; nil sends every automatic round without
	// asking for its brief.
	Briefing Briefing

	// Socket is the daemon's; empty means no daemon is reachable.
	Socket string
	// Getenv reads the environment of the agent session that runs hook, turn
	// and instructions.
	Getenv func(string) string
	// Harness reads the hook payloads and the session identity of that session.
	Harness harness.Set
	// Executable is the binary the LaunchAgent runs.
	Executable string

	// The native menu bar and the process exit; tests replace them.
	NativeAvailable func() bool
	// RunNative runs the app's native loop; setup's host is nil when the app
	// shows no window of its own.
	RunNative  func(win config.Window, words *texts.Catalog, setup func(menubar.Tray, menubar.Notifier, window.Host))
	QuitNative func()
	Exit       func(code int)
	// Reexec replaces this process with Executable, same arguments.
	Reexec func() error
	// Agents are the supported agents by name.
	Agents map[string]turns.Agent
	// Usage reads the tokens of each agent's turns by name; a kind
	// without one has no usage.
	Usage map[string]coreusage.Reader
	// Homes are the configuration homes of each agent by name.
	Homes map[string]setup.HomeKind
	// Managers are the supported workspace managers by name; nil keeps WS
	// whatever the config selects.
	Managers map[string]ManagerEntry
	// contains filtered or unexported fields
}

Env groups dependencies so commands can be tested without touching the real environment.

func NewEnv

func NewEnv() *Env

func (*Env) ReadAhead

func (e *Env) ReadAhead(ctx context.Context, ref pr.Ref, full bool) context.Context

ReadAhead reads ref's basics and the viewer and returns ctx carrying them, with those read ahead before, for the action that takes the loop lock next. With full, an open pull request with a review workspace, the one a held round reads in full, is also read in full into the inventory.

type ManagerEntry

type ManagerEntry struct {
	// Display names the manager in messages, such as "Orca".
	Display string
	// Binary is the manager's executable, as doctor looks it up on PATH; "" for none.
	Binary string
	// Control are the command prefixes and ControlPaths the paths that drive
	// the manager: no session the loop starts may run or read them.
	Control      [][]string
	ControlPaths []string
	// SessionVar is the variable the manager sets, in its sessions' agent
	// process, to the handle of the process.
	SessionVar string
	// Session reads the identity the manager gives a session from its environment.
	Session harness.SessionEnv
	// Sink is the view sink whose columns the manager's workspace statuses
	// are, "" for none; Columns are its default columns by semantic status.
	Sink    string
	Columns map[string]string
	New     func() workspace.Manager
	// Ports are the processes and sinks on ws; reloads ws starts on its own run under
	// ctx, and its changes are noted in changes, which may be nil.
	Ports func(ctx context.Context, ws workspace.Manager, prs prrow.ReportedPRs, cfg config.Config, changes *change.Log) (managerSessions, []views.Sink, error)
	// Homes lists agent homes the manager keeps for kind under userHome.
	Homes func(userHome, kind string) []string
	// Available is nil when the manager is installed and this release can
	// drive it, else why not; nil Available is always available.
	Available func(ctx context.Context) error
	// Advice is what doctor tells about an available manager that it cannot check.
	Advice []Advice
}

ManagerEntry is what the loop runs on one workspace manager.

type Recorder

type Recorder interface {
	Record(ctx context.Context, ev dinv.Event) error
	// RecordUnit is Record for an event on any unit.
	RecordUnit(ctx context.Context, ev port.Event) error
	Overrides(ctx context.Context) (map[pr.Ref]dinv.Override, error)
	// FirstRoundBlocks maps each unit whose round is blocked to its
	// round_blocked event.
	FirstRoundBlocks(ctx context.Context) (map[unit.Unit]port.Event, error)
	KeepNextGuidance(ctx context.Context, ref pr.Ref, guidance string) error
	TakeNextGuidance(ctx context.Context, ref pr.Ref) (string, error)
	// OpenQuestions maps each pull request to the intents whose newest turn
	// is asked.
	OpenQuestions(books map[unit.Unit]dturn.Book) map[pr.Ref]map[string]bool
}

Recorder receives the loop's own events; nil records nothing.

type Rounds

type Rounds interface {
	coresweep.Rounds
	Save(ctx context.Context, st *round.Store) error
	AgentHome(ctx context.Context, ref pr.Ref) (string, error)
	SetPause(ctx context.Context, p round.Pause) error
}

Rounds is the round state's repository and the pause, in the daemon's store.

Source Files

Jump to

Keyboard shortcuts

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