/** * * The 5 input envelopes feeding `aggregateVerdict()` have always been * heterogeneous (peaks-security-audit / peaks-perf-audit / karpathy / * peaks-mut / peaks-qa). v2.13.1 shipped precedence wiring without * touching the on-disk shapes. v2.13.2 introduced a discriminated-union * type projection `AnyEnvelope` and 5 pure parser functions. * * v2.13.3 dogfood bug #1: parseSecurity/Perf previously only supported * a JSON.parse path. The real v2.12.0 audit files at * `.peaks/_runtime//audit/security.md` and `audit/perf.md` are * YAML frontmatter + markdown body — NOT JSON. The fix preserves * the JSON.parse path (back-compat for unit tests + any consumer that * passed JSON explicitly) and adds a markdown fallback that extracts * `verdict:` from the frontmatter and parses `## Findings` bullets. * * Wave 5 file-size split: the `AnyEnvelope` projection, the security / * perf / karpathy parsers, the adapter and the section / bullet readers * moved verbatim to `./envelope-parsers.js` (re-exported below so * `./envelopes.js` stays the public path). The finding-carrying * markdown helpers stay here. The parent ↔ sibling cycle is safe under * `module: NodeNext` + `"type": "module"` (hoisted function * declarations + erased types, all resolved at call time). */ import { type KarpathyEnvelope, type MutEnvelope, type QaEnvelope } from './verdict-aggregator.js'; export { envelopesToAggregatorInput, parseKarpathyEnvelope, parsePerfEnvelope, parseSecurityEnvelope } from './envelope-parsers.js'; export type { AnyEnvelope } from './envelope-parsers.js'; export declare function parseKarpathyViolations(md: string): KarpathyEnvelope['violations']; /** * Mut envelope is JSON. Mirrors `loadMutReport`'s contract: missing * fields → null. The strict shape matches `MutReportJson` in * `services/mut/types.ts`. */ export declare function parseMutEnvelope(json: unknown): MutEnvelope | null; /** * QA test report is markdown under `qa/test-reports/.md`. * The verdict line is `verdict: pass | return-to-rd | blocked` and * optionally carries a `reportPath:` line. Anything else → null. */ export declare function parseQaEnvelope(md: string): QaEnvelope | null; type AuditEnvelopeGuard = (v: unknown) => v is T; /** * Parse a v2.12.0 audit markdown file: * --- * schemaVersion: 1 * verdict: warn * violationsCount: 1 * --- * ## Summary * Test security envelope for dogfood. * * ## Findings * - HIGH: hardcoded password in src/auth.ts:42 * * ## Verdict * verdict: warn * CRITICAL: 0 * * Strategy: * 1. Strip YAML frontmatter (`---\n...\n---\n`). The frontmatter * `verdict:` line is the source of truth — the body's `## Verdict` * block is corroborating. * 2. Pull `verdict` from frontmatter (regex, line-anchored). * 3. Parse `## Findings` bullets — accept 3 real v2.12.0 shapes: * a. `- [SEV] dim @ file:line — hint` (rendered by renderSecurityAuditArtifact) * b. `- HIGH: hint in file:line` (real dogfood fixture shape) * c. `- (none)` — empty * 4. Build a candidate envelope and run through the strict-shape * guard. Return null if the guard rejects (per the parser * contract: parsers never throw). */ export declare function parseAuditMarkdown(md: string, guard: AuditEnvelopeGuard): T | null; /** Parse a single finding bullet. Returns null on malformed input. */ export declare function parseFindingBullet(line: string): { dimension: string; severity: 'CRITICAL' | 'HIGH' | 'MED' | 'LOW'; file: string; line: number; hint: string; } | null; export declare function matchEnum(md: string, regex: RegExp): string | null;