Expand description
Non-interactive draft core (roadmap f-1-1): the sequencing behind
kranz draft, hoisted out of the CLI so any surface (CLI, REST) can drive
a ticket through its planning conversation.
drive_draft owns the engine call order — write_state(Drafting) →
record_mission → planning_turn (seeded with the whole ticket) →
request_plan → branch on the result — and the terminal filesystem/queue
side effects (Ticket::append_needs_context,
Ticket::append_wrong_plan, approve_plan, queue::enqueue). It does
not print anything and does not touch the operator’s git checkout; both
stay with the caller.
Structs§
- Draft
Drive drive_draft’s return: the terminalDraftOutcomeplus the display payload a caller needs to reproduce the pre-hoist CLI output exactly — the seed reply (from the session-start turn) and, on the Approve path, the approvedPlan. The core itself never prints either; it only avoids dropping them.
Enums§
- Draft
Decision - What a
draftturn resolved to, given thePlanRequestand whether--yes(auto-approve+enqueue) was passed. Separating the decision from the I/O keeps the state-machine unit-testable without a backend. - Draft
Outcome - Terminal result of driving one ticket through a draft turn.
Functions§
- draft_
decision - Map a completed plan request + the
--yesflag to the next action. Pure: the caller performs the git/state side effects the decision names. - drive_
draft - Drive
ticketthrough one non-interactive draft turn against an already-constructedengine(holding its backend): seed the orchestrator with the whole ticket, demand the plan, and resolve viadraft_decision. - looks_
like_ plan_ json - Does a NotReady reply look like a COMPLETE plan the orchestrator chatted out as prose instead of returning through the plan channel? Matches the plan schema’s two distinctive top-level keys.
- split_
questions - Split the orchestrator’s “not ready” prose into individual questions: each non-empty line, with any leading bullet/number marker stripped. A reply with no line breaks becomes a single one-item list.