/** * `cleo done --plan` — the read-only evidence planner. * * {@link deriveTaskEvidence} answers, for one task, "what would `cleo done` * record, and what stops it?" without executing a tool or a typed gate and * without writing a row, an audit line or a cache entry: * * - the implemented change set and where it came from ({@link deriveTaskChangeSet}); * - the gates the verification policy requires and whether each has passed; * - the tool runs those gates need, resolved through the ADR-061 resolver, * and whether each already has a fresh cached result for the current tree; * - which acceptance criteria map to evidence deterministically — a stored * passing typed gate, or every repo path the criterion names being in the * change set by exact repo-relative path — and which need `--satisfies`; * - the ordered blockers, each with one runnable next step; * - the exact commands, spelled as today's `cleo verify` / `cleo complete` * verbs, so every one is runnable before `cleo done` records anything. * * The planned atom strings are the same strings the existing validators * receive; the planner adds no validation path of its own. * * Spec: `verify-streamlined-design` §3.1, §3.2, §7 step 1. * * @task T12623 */ import type { DonePlan, VerificationGate } from '@cleocode/contracts'; import { type EngineResult } from '../engine-result.js'; import { type ChangeSetDeps } from './change-set.js'; /** Options for {@link deriveTaskEvidence}. */ export interface DeriveTaskEvidenceOptions { /** CLEO store root. Defaults to the resolved project root. */ projectRoot?: string; /** Invocation directory; locates the caller's worktree. Defaults to `process.cwd()`. */ cwd?: string; /** Criteria the agent asserts (`--satisfies AC1,AC3`), or `'all'`. */ satisfies?: readonly string[] | 'all'; /** Explicit PR (`--pr `). */ prNumber?: number; /** * Explicit commit (`--commit `, T13799): work already on the default * branch that no PR or branch cites; verified by the change-set derivation. */ commit?: string; /** Injectable change-set I/O (tests). */ deps?: ChangeSetDeps; /** Evidence preview (tests inject; defaults to the write's own validators). */ previewEvidence?: DoneEvidencePreview; /** * Queue for the `test` slot while resolving the affected scope. `cleo done` * does (it runs the tests next); `--plan` never waits and reports * `scope pending: …` instead (T12656 review; T13133: the machine budget in * use, or memory pressure). */ waitForTestSlot?: boolean; /** * The typed gates run in this `cleo done` (`--run-typed`), so a gate with no * current pass is not yet a blocker (T13655). */ runTyped?: boolean; /** `--no-integrate`: the plan shows the worktree integration as skipped (T14053). */ noIntegrate?: boolean; } /** * Validate a derived multi-gate write without writing it: the same validators * `cleo done` records through (T12672). */ export type DoneEvidencePreview = (storeRoot: string, taskId: string, gateEvidence: Partial>) => Promise<{ ok: true; } | { ok: false; code: string; message: string; fix?: string; }>; /** * POSIX single-quote a shell word (bare when it is already safe). * * @param word - Word to quote. * @returns A string the shell reads back as exactly `word`. */ export declare function shellQuote(word: string): string; /** * Plan the evidence `cleo done` would record for a task. Read-only: executes * no tool or typed gate and writes nothing. * * @param taskId - Task to plan. * @param opts - Store root, invocation directory, `--satisfies`, `--pr`. * @returns The plan: change set, gates, tool runs, AC mapping, ordered * blockers and the runnable commands. * @throws CleoError(NOT_FOUND) for an unknown task; CleoError(VALIDATION_ERROR) * for a `--satisfies` alias the task does not have. * @example * ```ts * const plan = await deriveTaskEvidence('T123', { satisfies: ['AC2'] }); * for (const cmd of plan.commands) console.log(cmd); * ``` * @task T12623 */ export declare function deriveTaskEvidence(taskId: string, opts?: DeriveTaskEvidenceOptions): Promise; /** * {@link deriveTaskEvidence} as an {@link EngineResult}, for the CLI handler: * a `CleoError` (unknown task, bad `--satisfies`) becomes a typed failure * instead of a throw, so the handler stays a thin renderer. * * @param taskId - Task to plan. * @param opts - Same options as {@link deriveTaskEvidence}. * @returns The plan, or the refusal with its exit code and fix. * @example * ```ts * const result = await planTaskDone('T123', { satisfies: 'all' }); * if (result.success) console.log(result.data.commands); * ``` * @task T12623 */ export declare function planTaskDone(taskId: string, opts?: DeriveTaskEvidenceOptions): Promise>; /** * Parse the `--satisfies` / `--pr` / `--commit` CLI flags shared by * `cleo done` and `cleo verify --auto` into planner options. * * @param satisfies - Raw `--satisfies` value (`AC1,AC3` or `all`), if given. * @param pr - Raw `--pr` value, if given. * @param commit - Raw `--commit` value, if given (T13799). * @returns The options, or the refusal text for an invalid PR number or commit. * @example * ```ts * parseDoneOptions('AC1,AC3', '42'); // { ok: true, options: { satisfies: ['AC1','AC3'], prNumber: 42 } } * ``` * @task T12625 */ export declare function parseDoneOptions(satisfies: unknown, pr: unknown, commit?: unknown): { ok: true; options: Pick; } | { ok: false; message: string; }; //# sourceMappingURL=done-plan.d.ts.map