/** * `cleo goal draft` — write a goal/v1 contract draft from tasks' acceptance * criteria, for a goal runtime (CLEO Goal) to execute. * * Each criterion maps to goal criteria that `prove` it (by its canonical * uuid), never weaker than the gate: * - a typed gate goal/v1 expresses exactly → host checks (`command` with the * gate's own executable, cwd, env and deadline; `file` / `contains`); * - any other typed gate → the gate itself, `cleo verify --run --req`; * - `manual` gates → `human` checks; * - free text, and a gate with neither form → `verifier` checks; * - `advisory: true` → `essential: false`. * * Invariants are the project's resolved lint and typecheck commands; the * budget follows the task size; `.cleo/` is protected. Drafting never starts * a run: it writes the one file and refuses to overwrite an existing one. * * @epic T13791 * @task T13793 */ import type { AcRow, GoalContract, Task } from '@cleocode/contracts'; import { type EngineResult } from '../engine-result.js'; /** One task and its stored criterion rows, the input of {@link buildGoalDraft}. */ export interface GoalDraftTask { /** The task. */ task: Pick; /** Its criterion rows (any order). */ rows: readonly Pick[]; } /** Result of {@link draftGoal}. */ export interface GoalDraftResult { /** Goal slug (the contract id and directory name). */ slug: string; /** Absolute path of the written `goal.yaml`. */ path: string; /** The drafted contract. */ contract: GoalContract; } /** CLEO Goal ids: a kebab-case slug that equals the goal directory name. */ export declare const GOAL_ID: RegExp; /** * Goal slug from the task ids: whole ids only, at most 64 characters. * * @param ids - Task ids; the first names the goal. * @returns The slug `cleo goal draft` writes the goal under. */ export declare function goalSlug(ids: readonly string[]): string; /** * Build a goal/v1 contract from tasks' acceptance criteria. Pure. * * @param tasks - The tasks the goal serves, first is the primary. * @param invariantCommands - Resolved lint/typecheck command lines. * @param opts - Project root (gate cwd and commands resolve against it) and an explicit goal id. * @returns The contract; every criterion `proves` the AC it came from. * @example * ```ts * const contract = buildGoalDraft([{ task, rows }], ['pnpm biome check .'], { root }); * ``` */ export declare function buildGoalDraft(tasks: readonly GoalDraftTask[], invariantCommands: readonly string[], opts: { root: string; id?: string; }): GoalContract; /** * Render a contract as `goal.yaml` text in CLEO Goal's YAML spelling (budget * `wall` as minutes, e.g. `"180m"`). Lines never fold, so a command stays one line. * * @param contract - The contract. * @returns YAML text. */ export declare function renderGoalYaml(contract: GoalContract): string; /** * Draft a goal for tasks and write it, refusing to overwrite an existing file. * * @param taskIds - Task ids; the first names the goal. * @param opts - Project root and an explicit output path. * @returns The written path and contract, or the refusal. * @example * ```ts * const r = await draftGoal(['T123'], {}); * if (r.success) console.log(r.data.path); // .opencode/goals/t123/goal.yaml * ``` */ export declare function draftGoal(taskIds: readonly string[], opts?: { projectRoot?: string; out?: string; }): Promise>; //# sourceMappingURL=draft.d.ts.map