/** * Parses and validates the deliverable-agnostic Contract Task grammar that * contract-first plans (produced by the `plan` task type) author for * `execute_plan` to consume. This grammar makes no assumption that the * deliverable is code: a task never names an implementation file, and a * deterministic check is optional, not mandatory. * * A Contract Task is a `### Task -:` heading section containing: * - a `**Output:**` line declaring the task's deliverable output (a path, * an artifact name, or free text — never final deliverable content); * - a `**Dependencies:**` line declaring what the task depends on (other * tasks, approved inputs, or "none"); * - the five literal Contract bullets, in this exact order and label text: * `Inputs / Request:`, `Outputs / Response:`, `Data mapping:`, `Errors:`, * `Behavior / invariants:`; * - an OPTIONAL `Checks (plan-authored` block containing zero or more * declared checks, each exactly one `Check:` line naming a destination * path, exactly one complete fenced source block, and exactly one `Run:` * command (a shell-metacharacter-free argv, safe for `execFile(cmd, * args[])` with `shell: false`). A task that declares no check produces * `acceptanceTests: []` — that is not an error; * - the exact closing line `**Plan boundary:** final deliverable content is * not in this plan.` * * This module owns parsing that shape into an immutable snapshot, validating * declared check destination paths are safe repository-relative paths beneath * one of the `ACCEPTED_CHECK_ROOTS` (not `tests/` alone — a Python project uses * `test/`, Java uses `src/test/java`, and a report whose check reconciles * figures against a ledger belongs under `checks/`), and materializing / * re-materializing the plan-authored check sources verbatim to disk. Only a task that declares a deterministic * check produces a materialized file and a scored command; a no-check task * is fully skipped by both. */ type ContractPlanErrorCode = 'unsupported-legacy-plan' | 'malformed-plan' | 'unsafe-test-path' | 'test-path-collision'; export declare class ContractPlanError extends Error { readonly code: ContractPlanErrorCode; constructor(code: ContractPlanErrorCode, message: string); } export interface PlanAcceptanceTest { readonly path: string; readonly source: string; readonly command: string; } interface ContractClauses { readonly inputsRequest: string; readonly outputsResponse: string; readonly dataMapping: string; readonly errors: string; readonly behaviorInvariants: string; } export interface ParsedContractTask { /** Stable identity parsed from the `### Task : …` heading (e.g. `I-1`). This is the key * the reviewer contract matches on — titles are prose and must never be load-bearing. */ readonly id: string; readonly title: string; /** The task's declared deliverable output (a path, an artifact name, or free text). Metadata * only — never final deliverable content. */ readonly output: string; /** What the task depends on (other tasks, approved inputs, or "none"). Metadata only. */ readonly dependencies: string; readonly contract: ContractClauses; readonly acceptanceTests: readonly PlanAcceptanceTest[]; } export interface ContractPlanSnapshot { readonly tasks: readonly ParsedContractTask[]; } /** * The plan FORMAT vocabulary — exported so the authoring prompts can be held to it. * * These literals are the contract between the generator (`skills/plan/*.md`, which tells a worker * what to write) and this validator (which decides whether what it wrote parses). They were stated * independently in three places — prompt, validator, and the test meant to protect them — so the * test compared its own literal to the prompt's and would have stayed green while a renamed * constant here silently stopped accepting every plan the prompt produces. That generator/validator * split is a defect this project has shipped before. */ export declare const CONTRACT_BULLET_LABELS: readonly ["Inputs / Request:", "Outputs / Response:", "Data mapping:", "Errors:", "Behavior / invariants:"]; export declare const OUTPUT_FIELD_LABEL = "**Output:**"; export declare const DEPENDENCIES_FIELD_LABEL = "**Dependencies:**"; export declare const CHECKS_HEADING_MARKER = "Checks (plan-authored"; export declare const PLAN_BOUNDARY_SENTINEL = "**Plan boundary:** final deliverable content is not in this plan."; export declare function parseContractPlan(markdown: string): ContractPlanSnapshot; export declare const ACCEPTED_CHECK_ROOTS: readonly ["tests", "test", "spec", "specs", "checks", "__tests__", "src/test"]; export declare function assertSafeAcceptanceTestPaths(snapshot: ContractPlanSnapshot, repositoryRoot: string): Promise; export declare function materializeAcceptanceTests(snapshot: ContractPlanSnapshot, repositoryRoot: string): Promise; export declare function rematerializeAcceptanceTests(snapshot: ContractPlanSnapshot, repositoryRoot: string): Promise; export {}; //# sourceMappingURL=contract-plan.d.ts.map