Documentation
¶
Overview ¶
Package start opens a task: its checkout, its workspace and its agent, prompted, or a PR picked up to continue.
Index ¶
- func AfterFromBody(ctx context.Context, tr stack.Tracker, main string, task ref.Ref) (string, []string, error)
- func AgentArgs(p agentctl.Profile, root storage.Root, worktree string) []string
- func ChecksParent(mode string, pick *hostops.Pickup) bool
- func FetchPickup(ctx context.Context, main string, pick *hostops.Pickup) error
- func MarkStarted(ctx context.Context, started func(context.Context, ref.Ref) error, ...) []string
- func PickedTask(prefix string, hostIssues bool, pick *hostops.Pickup, pr forge.PR, task string) (string, error)
- func PickupFor(ctx context.Context, t *target.Target, token string) (*hostops.Pickup, forge.PR, error)
- func PickupTask(prefix string, hostIssues bool, p forge.PR) string
- func RefusePull(p forge.PR) error
- func RefuseStalled(in StallCheck, ws *agentctl.Workspace, agent, root string) error
- func RefuseStartParent(ctx context.Context, in StartInput) error
- func SettleBundle(ctx context.Context, main string, task ref.Ref, existing string) (ref.Ref, error)
- func Start(ctx context.Context, w io.Writer, in StartInput) error
- func StartedMove(t *target.Target) func(context.Context, ref.Ref) error
- func SyncPickup(ctx context.Context, main, branch string, checkedOut bool) (string, error)
- type OpenedTask
- type StallCheck
- type StartInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AfterFromBody ¶
func AfterFromBody(ctx context.Context, tr stack.Tracker, main string, task ref.Ref) (string, []string, error)
AfterFromBody reads the task's body for an After: line. A body that cannot be read is a note, never a refusal: --after stays the explicit way.
func AgentArgs ¶
AgentArgs is the agent's command line: the profile's flags through its kind, and each task-file dir of the storage root when that root sits outside the worktree, so writing plans and findings there asks no permission.
func ChecksParent ¶
ChecksParent reports whether start refuses a parent: a PR pickup is someone else's branch, and talking an umbrella task through before splitting it is what --discuss is for.
func FetchPickup ¶
FetchPickup: a handover has not fetched the request's branch yet. A landed request's commit must be here before its worktree is made, and a closed request's head comes only through the host's own ref for it.
func MarkStarted ¶
func MarkStarted(ctx context.Context, started func(context.Context, ref.Ref) error, task ref.Ref) []string
MarkStarted moves every member to its started status. The worktree is the result, so a failure is a note, never a refusal.
func PickedTask ¶
func PickedTask(prefix string, hostIssues bool, pick *hostops.Pickup, pr forge.PR, task string) (string, error)
PickedTask is the task id for a picked-up PR: --task, else the one the PR names. A PR naming none exits with ui.ExitDeclined, which the start skill turns into a question; --task with no PR is a refusal.
func PickupFor ¶
func PickupFor(ctx context.Context, t *target.Target, token string) (*hostops.Pickup, forge.PR, error)
PickupFor is the PR the start argument names, or nil for a task id; a bare #n the host knows as no PR is a task id.
func PickupTask ¶
PickupTask prefers a closing keyword's issue (this repository's only) on a host-issues tracker, else an id in the body, title or branch, in that order.
func RefusePull ¶
func RefuseStalled ¶
func RefuseStalled(in StallCheck, ws *agentctl.Workspace, agent, root string) error
RefuseStalled stops a forward to an agent idle while its run says running: it sits on something f10 cannot see (a permission dialog, a question asked outside driven mode), and a prompt behind that would wait with it.
func RefuseStartParent ¶
func RefuseStartParent(ctx context.Context, in StartInput) error
RefuseStartParent stops a parent with unfinished subtasks before anything is created, since its agent would ship the whole umbrella on one branch. A task with a branch was started already and reopens.
func SettleBundle ¶
SettleBundle refuses what would split a task across two branches, a rider another branch ships or a branch reopened with other riders than typed, since riders are fixed at start; a task alone takes its branch's riders.
func Start ¶
Start runs the flow: the checkout and its agent, the prompt, the report. A workspace Herdr already showed keeps its agent, and nothing is prompted twice; one left with no agent gets its agent and its prompt.
func StartedMove ¶
StartedMove moves a task to tracker.status's started word, or is nil when none is declared.
Types ¶
type OpenedTask ¶
type OpenedTask struct {
Task ref.Ref // the task, with the riders its branch ships
Branch string
Path string
Ws agentctl.Opened
Dep *launch.Dependency
Plan string // the task's plan the worktree reads, or "" when none was saved or no agent was started
Fresh bool
Notes []string
// Profile is what the agent was started on, when fresh; a report names
// it when it is not the kind's default
Profile agentctl.Profile
// contains filtered or unexported fields
}
An OpenedTask is what OpenTask leaves behind; fresh says this call is to start the agent, which deliver does with its first prompt.
func OpenTask ¶
func OpenTask(ctx context.Context, in StartInput) (OpenedTask, error)
OpenTask runs everything start does short of starting and prompting the agent, which deliver does with the first text. Every lookup that can refuse runs before the first thing is created, the worktree; drive adopts main's plan too but prompts the agent itself, skill by skill.
func (*OpenedTask) Deliver ¶
Deliver sends text to the task's agent, starting it when its launch is pending: on its command line when the kind takes a first prompt, else typed right after. It names the agent that took the text, and typed says the text went through the input box, where its Enter can be lost.
type StallCheck ¶
A StallCheck is what RefuseStalled reads run state with: runs updated before since were written by an agent that is gone.
type StartInput ¶
type StartInput struct {
Main string // the main checkout: worktrees are its siblings
Driver *driver.Driver // nil without one
Task ref.Ref
Suffix string
Mode string
Flow runplan.ShipFlow // the flow ship runs; zero for default
FlowKept bool // drive records the flow and the pace itself, keeping what the branch has
Pace string // the --pace typed, recorded on the branch; "" records none
After string // task id whose branch is the base and whose plan is the contract, or ""
Base string // branch whose ref is the base, or ""
Storage storage.Root // the storage root every checkout shares
Title func(context.Context) (string, error) // the task's title, for the default branch's slug; nil when nothing answers
Notes []string // notes settled before the flow, printed beneath the report
// Profile is what the agent starts on, resolved; profileFlagged says a
// flag chose it, which wins over the profile the branch recorded
Profile agentctl.Profile
ProfileFlagged bool
Progress io.Writer // where a wait in progress is reported, or nil for nowhere
Pick *hostops.Pickup // the PR picked up, or nil for a task started by its id
Note string // the user's words after the id, for the agent before it waits, or ""
// Children is the task's subtasks, read to refuse a parent; nil skips the
// check (see ChecksParent)
Children func(ctx context.Context, task ref.Ref) ([]stack.ChildRow, error)
// Started moves a task to tracker.status's started word; nil when none
// is declared, or for a PR picked up, whose task someone else started
Started func(ctx context.Context, task ref.Ref) error
}
StartInput is everything start needs once the target is settled, so the flow can be tested without a checkout.