Documentation
¶
Overview ¶
Package factoryplan backs the planning screen with factory: the plan and its comments in factory's V3 API (Store), and the long-lived factory session that plans it (Agent).
Index ¶
- Variables
- type Agent
- type Store
- func (s *Store) AddComment(ctx context.Context, quote, body string) (plan.Comment, error)
- func (s *Store) AddressComments(ctx context.Context) error
- func (s *Store) Approve(ctx context.Context, session string) error
- func (s *Store) ApproveDesign(ctx context.Context) error
- func (s *Store) Comments(ctx context.Context) ([]plan.Comment, error)
- func (s *Store) Create(ctx context.Context, message string) error
- func (s *Store) DeleteComment(ctx context.Context, id string) error
- func (s *Store) EditComment(ctx context.Context, id, body string) error
- func (s *Store) Flow(ctx context.Context) (plan.Flow, error)
- func (s *Store) Holder(ctx context.Context) (string, error)
- func (s *Store) ID() string
- func (s *Store) ResolveComment(ctx context.Context, id string) error
- func (s *Store) ResolveConflicts(ctx context.Context) error
- func (s *Store) SetText(ctx context.Context, text string) error
- func (s *Store) State(ctx context.Context) (string, error)
- func (s *Store) Text(ctx context.Context) (string, error)
Constants ¶
This section is empty.
Variables ¶
var ErrDesignApproved = errors.New("the plan's design is approved already: approve the plan with ctrl+s")
ErrDesignApproved is returned by ApproveDesign for a plan whose flow offers to approve the plan but not its design: the design is approved already.
var ErrNoUnits = errors.New("the plan has no units yet: approve its design with ctrl+s, so chunk writes them")
ErrNoUnits is returned by Approve for a plan in plan.ReadyState whose design, not the plan, is what waits for approval, as plan.StageOf decides.
var ErrNotReady = errors.New("the plan is not ready yet: wait for its review to pass")
ErrNotReady is returned by Approve for a plan whose review has not passed: factory has not moved it to plan.ReadyState.
var ErrQuestionsOpen = errors.New("the plan has open questions: answer 3. Open Questions in comments, then send them")
ErrQuestionsOpen is returned by Approve and ApproveDesign for a plan whose flow offers neither approval, as plan.StageOf decides: its 3. Open Questions wait for answers in comments, sent before either is approved.
var ErrStopped = errors.New("the planning session has been stopped")
ErrStopped is returned by a Send after Stop.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent is a plan.Agent over a long-lived factory.Agent. The session starts on the first Send, since claude needs a message to start on, and is resumed by the next Send if it ends without being stopped.
func NewAgent ¶
NewAgent is the planning session for store's plan, in cfg.Dir, which lives as long as ctx. The caller must Stop it.
func (*Agent) CheckStart ¶
CheckStart has check run before the session starts or resumes, refusing to start it when check fails, so a plan can be opened and read before what planning needs is in place. It must be called before the first Send.
func (*Agent) Send ¶
Send delivers message to the session, starting it on the first message and resuming it if it has ended. A message tells the agent to claim the plan when it is the first since the plan was created, or the agent has since lost its claim: factory frees the claims of a session that ends, and an agent can release its plan, after which the daemon hands it no tasks.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a plan.Store backed by factory's V3 plan and comment API, addressed by the plan's ID, which Create sets.
func NewStore ¶
NewStore is the store for plan id in factory, or for a plan Create makes when id is "".
func (*Store) AddComment ¶
func (*Store) AddressComments ¶
AddressComments sends the plan's flow factory's address-comments event, which moves it out of a Human state at its next poll.
func (*Store) Approve ¶
Approve approves the plan for factory to build, once its review has passed, with the approve-for-building event. The planning session, session, may not edit files, so its claim is released first, for a build session to claim the plan instead. The state and text are read from factory, not the screen's copy, so a plan that moved after the screen last polled is still refused.
func (*Store) ApproveDesign ¶
ApproveDesign sends the plan's flow factory's approve-for-units event, which approves its design. A flow that does not list the event now is refused without sending it: with ErrDesignApproved when it lists approve-for-building instead, and with ErrQuestionsOpen when it lists neither. A plan with no flow yet sends it.
func (*Store) Flow ¶
Flow is the plan's flow as factory has it now; empty before the plan is created or has a flow.
func (*Store) Holder ¶
Holder is the factory session holding the plan's claim, as its flow references it, or "" when none does or the plan has not been created.
func (*Store) ResolveConflicts ¶
ResolveConflicts sends the plan's flow factory's resolve-conflicts event, which hands a plan whose PR conflicts back to the agent to rebase.