Documentation
¶
Overview ¶
Package cli implements the subcommands.
Index ¶
- Variables
- func Defaults() config.Config
- func InstallPlugins() error
- func Run(ctx context.Context, e *Env, args []string) int
- type Advice
- type Briefing
- type Env
- type ManagerEntry
- type Recorder
- type Rounds
- type TestDaemon
- func (d *TestDaemon) Action(ctx context.Context, u unit.Unit, action string) (json.RawMessage, error)
- func (d *TestDaemon) Book(t testing.TB, u unit.Unit) dturn.Book
- func (d *TestDaemon) Client() *client.Client
- func (d *TestDaemon) EndTurn(t testing.TB, s TestSession, req api.TurnEndRequest) api.TurnEnded
- func (d *TestDaemon) Launched(t testing.TB, u unit.Unit) TestSession
- func (d *TestDaemon) Send(ctx context.Context) error
- func (d *TestDaemon) Start(t testing.TB, u unit.Unit, intent string) TestSession
- func (d *TestDaemon) Sweep(ctx context.Context) error
- type TestOptions
- type TestSession
Constants ¶
This section is empty.
Variables ¶
var Version = "dev"
Functions ¶
func Defaults ¶ added in v0.2.0
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.
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)
// Clipboard puts text on the clipboard; nil uses the system's.
Clipboard func(text string) 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
// ReinstallPlugins installs the plugins' vocabulary again once install
// placed the release's, which the process read before it; nil skips it.
ReinstallPlugins func() error
// 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 (*Env) ReadAhead ¶
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.
type TestDaemon ¶ added in v0.5.0
type TestDaemon struct {
// contains filtered or unexported fields
}
TestDaemon is a daemon serve composed over a temporary home, with no collector, sweep loop or sender of its own: a test runs them with Sweep and Send.
func ServeForTest ¶ added in v0.5.0
func ServeForTest(t testing.TB, o TestOptions) *TestDaemon
ServeForTest serves, until t ends, the daemon's composition root over a store in a temporary directory, the plugins' publishers replaced by o.Publishers, and returns it.
func (*TestDaemon) Action ¶ added in v0.5.0
func (d *TestDaemon) Action(ctx context.Context, u unit.Unit, action string) (json.RawMessage, error)
Action runs action of u's plugin, running in the test daemon, as the host calls it, such as a read that keeps u in the store as the plugin's ingestion does.
func (*TestDaemon) Client ¶ added in v0.5.0
func (d *TestDaemon) Client() *client.Client
Client is the daemon's client, as a person's clients speak to it.
func (*TestDaemon) EndTurn ¶ added in v0.5.0
func (d *TestDaemon) EndTurn(t testing.TB, s TestSession, req api.TurnEndRequest) api.TurnEnded
EndTurn records the end of s's turn, as the agent's turn_end call does.
func (*TestDaemon) Launched ¶ added in v0.5.0
func (d *TestDaemon) Launched(t testing.TB, u unit.Unit) TestSession
Launched is the session the daemon last launched a turn of u in, as its workspace manager typed the turn's prompt there: the handle the scripted agent calls the daemon with, and u's newest turn.
func (*TestDaemon) Send ¶ added in v0.5.0
func (d *TestDaemon) Send(ctx context.Context) error
Send sends the approved drafts once, as the daemon's sender does.
func (*TestDaemon) Start ¶ added in v0.5.0
func (d *TestDaemon) Start(t testing.TB, u unit.Unit, intent string) TestSession
Start is a turn of intent on u that a new agent session started by hand, as a session asking for a round does.
type TestOptions ¶ added in v0.5.0
type TestOptions struct {
// Publishers stand, by provider, for the Publisher of the plugin module serve builds, pinned to their turns
// as serve pins a plugin's; one that is a port.Basis reads its units' live basis.
Publishers map[unit.ProviderID]port.Effects
// Now is the daemon's clock; nil is a fixed instant.
Now func() time.Time
// Config edits the default configuration the daemon serves.
Config func(*config.Config)
// Repos are the repositories the test daemon's workspace manager holds, which a resumed or a new round's
// workspace checks out; ProjectsDir is the configuration's projects_dir, a temporary one when empty.
Repos []wsdomain.Repo
ProjectsDir string
// Git runs the test daemon's git; nil runs none, and every git call fails.
Git gitx.Runner
// Plugins run, by plugin id, as serve runs that bundled plugin's process, such as the GitHub plugin over a
// fake GitHub; a plugin left out does not run.
Plugins map[string]src.Source
}
TestOptions are what ServeForTest puts in place of the outside world in the daemon serve composes.
type TestSession ¶ added in v0.5.0
TestSession is an agent session that runs a turn: the handle it calls the daemon with, and the turn's id.
Source Files
¶
- actions.go
- address.go
- adopt.go
- agents.go
- ahead.go
- appmode.go
- automation.go
- brief_facts.go
- brief_intent.go
- briefinput.go
- builtins.go
- builtins_effects.go
- bundle.go
- classify.go
- classify_with.go
- cli.go
- config_cmd.go
- doctor.go
- doctor_disk.go
- doctor_load_view.go
- doctor_plugins.go
- doctor_repo.go
- doctor_repo_view.go
- doctor_restricted.go
- doctor_store.go
- doctor_view.go
- draft_cmd.go
- eval.go
- eval_correlation.go
- explore.go
- facts.go
- fold.go
- forge.go
- hand.go
- help.go
- help_topics.go
- init.go
- init_config.go
- init_profile.go
- init_prompt.go
- init_slack.go
- init_suggest.go
- install.go
- installhomes.go
- instructions.go
- intake.go
- intent_cmd.go
- launcher.go
- loopevents.go
- mcpkey.go
- module.go
- nativehost.go
- nudge.go
- outbox.go
- outbox_kinds.go
- outbox_policy.go
- outbox_view.go
- pause.go
- placement.go
- plan.go
- plan_unit.go
- plugin_run.go
- plugin_tools.go
- plugincli.go
- prfacts.go
- probe.go
- profile_cmd.go
- profile_view.go
- records.go
- remove.go
- review.go
- root.go
- round.go
- roundreason.go
- rounds.go
- roundstate.go
- runs.go
- serve.go
- serve_agentdrafts.go
- serve_cards.go
- serve_chat.go
- serve_ended.go
- serve_gates.go
- serve_github.go
- serve_headless.go
- serve_hosted.go
- serve_items.go
- serve_links.go
- serve_memory.go
- serve_merge.go
- serve_messages.go
- serve_outbox.go
- serve_payloads.go
- serve_placement.go
- serve_plugin_actions.go
- serve_plugins.go
- serve_projects.go
- serve_proposals.go
- serve_reported.go
- serve_slack.go
- serve_tasks.go
- serve_turnledger.go
- serve_ui.go
- serve_views.go
- servefortest.go
- skill.go
- slack.go
- sources.go
- startblocks.go
- startheld.go
- status.go
- step_draftpropose.go
- step_draftpropose_hold.go
- step_draftpropose_people.go
- step_draftpropose_text.go
- step_draftpropose_where.go
- step_effectsapply.go
- step_gateopen.go
- step_itemsresolve.go
- step_taskset.go
- step_taskverb.go
- steps.go
- stepstart.go
- stepstart_unit.go
- store.go
- storecmd.go
- storedfacts.go
- sweepinputs.go
- targets.go
- targets_plugins.go
- task_cmd.go
- task_results.go
- taskturn.go
- timings.go
- trust.go
- trustgates.go
- try.go
- tui.go
- turn.go
- turnitems.go
- turnshow.go
- uninstall.go
- unitturn.go
- upgrade.go
- wire.go
- wire_briefs.go
- wire_capabilities.go
- wire_dims.go
- wire_drafts.go
- wire_prose.go
- wire_subjects.go
- wire_turnstart.go
- wire_workflows.go
- workflows_cmd.go