import { type SectionExtract } from './scenarios.js'; import { type Spec } from './schema.js'; export interface ParseSpecOptions { filename?: string; } export interface ParseIssue { message: string; line?: number; code: string; } export declare class SpecParseError extends Error { readonly issues: ParseIssue[]; constructor(issues: ParseIssue[]); } /** * Parse a complete spec document. Throws SpecParseError when the document is * structurally unreadable, when the YAML cannot be parsed, or when the * frontmatter does not satisfy the schema. * * Use the lower-level primitives (`splitFrontmatter`, `findSection`, * `parseScenarios`, `SpecFrontmatterSchema.safeParse`) when partial recovery * is needed — that's what `lintSpec` does to aggregate every error in one pass. */ export declare function parseSpec(source: string, opts?: ParseSpecOptions): Spec; /** * v0.0.10 — A `## Definition of Done` bullet, classified for `dodPhase` * dispatch. `kind: 'shell'` bullets are run via Bash from the run's cwd; * `kind: 'judge'` bullets are dispatched to the harness judge client. */ export type DodBullet = { kind: 'shell'; command: string; line: number; raw: string; } | { kind: 'judge'; criterion: string; line: number; raw: string; }; /** * v0.0.10 — Parse the `## Definition of Done` section into classified * bullets. Returns `[]` when the section is absent. Each `- ` (or `* `) * top-level bullet becomes one `DodBullet`. Classification rules: * * - Exactly ONE backtick-wrapped token AND its first word is in the locked * allowlist (or starts with `./` / `../`) → `kind: 'shell'`, `command` * is the inner text. * - Multiple backtick-wrapped tokens → `kind: 'judge'` (ambiguous). * - Zero backticks → `kind: 'judge'` (plain prose). * - Single backtick whose first word is NOT allowlisted → `kind: 'judge'` * (conservative; prevents accidental shell injection from prose). * * `line` is 1-indexed within the spec's full source — derived from * `section.headingLine` so a `findSection(spec.body, ...)` walked source * line-numbers up to v0.0.10's caller (validatePhase / dodPhase) and * `findSection(spec.raw.source, ...)` indexes from the source's true * top. The DoD section is parsed against whatever input `findSection` * was given. */ export declare function parseDodBullets(section: SectionExtract | null): DodBullet[]; //# sourceMappingURL=parser.d.ts.map