/** * intakeDiablo runs the INTAKE phase that sits in front of `diablo run`: it * turns a fuzzy idea into tracked issues for both greenfield and brownfield * projects. Unlike `run` (autonomous, AFK), intake REQUIRES a human — a Socratic * grill-with-docs dialogue — so it runs interactive Pi sessions, and the two are * kept cleanly separated (distinct commands, distinct use-cases). * * Flow: grill → [optional] state-machine modeling → to-prd → human approval * checkpoint → to-issues. The state-machine step is offered after grilling (so * requirements are gathered) and before to-prd (so the modeled states flow into * the PRD); declining skips it cleanly with no artifact. The human approves the * PRD BEFORE it is decomposed; a decline stops cleanly after to-prd with no * issues written. The side-effecting steps (interactive Pi sessions) are * injected so this orchestration is unit-tested against fakes; main.ts wires the * real interactive sessions. */ import type { FsPort } from "../ports/fs.ts"; import type { PromptPort } from "../ports/prompt.ts"; /** Greenfield starts from an empty glossary; brownfield reads existing code + CONTEXT.md. */ export type IntakeMode = "greenfield" | "brownfield"; export interface GrillContext { feature: string; mode: IntakeMode; scratchDir: string; /** * Path to the state-machine artifact, set only when the user opted into the * modeling step. to-prd reads it as an input so the modeled states flow into * the PRD; undefined when the step was skipped. */ stateMachinePath?: string; } export interface IntakeDeps { fs: FsPort; prompt: PromptPort; /** Runs the interactive grill-with-docs session (real: an interactive Pi session). */ grill: (ctx: GrillContext) => Promise; /** * Models the feature's state machine (states, transitions, guards, events) * via the domain-modeling skill, writing the artifact at ctx.stateMachinePath. * Run only when the user opts in. */ modelStateMachine: (ctx: GrillContext) => Promise; /** Runs to-prd to author a PRD from the gathered requirements. */ toPrd: (ctx: GrillContext) => Promise; /** Runs to-issues to decompose the approved PRD into tracked issues. */ toIssues: (ctx: GrillContext) => Promise; } export interface IntakeConfig { feature: string; repoRoot: string; /** Where resulting issues land (.scratch//). */ scratchDir: string; } export interface IntakeResult { scratchDir: string; /** True when the PRD was approved and decomposed into issues. */ decomposed: boolean; } export declare function intakeDiablo(deps: IntakeDeps, config: IntakeConfig): Promise;