/** * Protocol validators for all 9 CLEO protocols. * Validates manifest entries and outputs against protocol requirements. * * @task T4499 * @epic T4498 */ import { ExitCode } from '@cleocode/contracts'; /** Protocol violation entry. */ export interface ProtocolViolation { requirement: string; severity: 'error' | 'warning'; message: string; fix: string; } /** Protocol validation result. */ export interface ProtocolValidationResult { valid: boolean; protocol: string; violations: ProtocolViolation[]; score: number; } /** Manifest entry structure for validation. */ export interface ManifestEntryInput { id?: string; file?: string; title?: string; date?: string; status?: string; agent_type?: string; topics?: string[]; key_findings?: string[]; actionable?: boolean; needs_followup?: string[]; linked_tasks?: string[]; sources?: string[]; } /** * All supported protocol types. * * The canonical set covers all 9 RCASD-IVTR pipeline stages plus the 3 * cross-cutting protocols that compose with specific stages: * * - Pipeline stages: research, consensus, architecture-decision, * specification, decomposition, implementation, validation, testing, release * - Cross-cutting: contribution (at implementation), * artifact-publish (at release), provenance (at release) * * @task T260 — unify pipeline stages and cross-cutting protocols */ export declare const PROTOCOL_TYPES: readonly ["research", "consensus", "architecture-decision", "specification", "decomposition", "implementation", "contribution", "validation", "testing", "release", "artifact-publish", "provenance"]; export type ProtocolType = (typeof PROTOCOL_TYPES)[number]; /** * Map protocol types to exit codes. * * Pipeline protocols use the 60-67 orchestrator range. Cross-cutting * protocols with dedicated ranges (artifact-publish 85-89, provenance 90-94) * use their own codes. Architecture-decision uses 84 PROVENANCE_REQUIRED * because every ADR MUST be generated from an accepted Consensus verdict * (ADR-001) — the provenance chain is the whole point. * * @task T260 */ export declare const PROTOCOL_EXIT_CODES: Record; /** @task T4499 */ export declare function validateResearchProtocol(entry: ManifestEntryInput, options?: { strict?: boolean; hasCodeChanges?: boolean; }): ProtocolValidationResult; export interface VotingMatrix { options: Array<{ name: string; confidence: number; rationale?: string; }>; threshold?: number; } /** @task T4499 */ export declare function validateConsensusProtocol(entry: ManifestEntryInput, votingMatrix?: VotingMatrix): ProtocolValidationResult; /** @task T4499 */ export declare function validateSpecificationProtocol(entry: ManifestEntryInput, specContent?: string): ProtocolValidationResult; /** @task T4499 */ export declare function validateDecompositionProtocol(entry: ManifestEntryInput, options?: { siblingCount?: number; descriptionClarity?: boolean; maxSiblings?: number; maxDepth?: number; }): ProtocolValidationResult; /** @task T4499 */ export declare function validateImplementationProtocol(entry: ManifestEntryInput, options?: { hasTaskTags?: boolean; }): ProtocolValidationResult; /** @task T4499 */ export declare function validateContributionProtocol(entry: ManifestEntryInput, options?: { hasContributionTags?: boolean; }): ProtocolValidationResult; /** @task T4499 */ export declare function validateReleaseProtocol(entry: ManifestEntryInput, options?: { version?: string; hasChangelog?: boolean; }): ProtocolValidationResult; /** @task T4499 */ export declare function validateArtifactPublishProtocol(entry: ManifestEntryInput, options?: { artifactType?: string; buildPassed?: boolean; }): ProtocolValidationResult; /** @task T4499 */ export declare function validateProvenanceProtocol(entry: ManifestEntryInput, options?: { hasAttestation?: boolean; hasSbom?: boolean; }): ProtocolValidationResult; /** * ADR lifecycle status values. * @task T260 */ export type AdrStatus = 'proposed' | 'accepted' | 'superseded' | 'deprecated'; /** Architecture decision options for validator. */ export interface ArchitectureDecisionOptions { /** Content of the ADR markdown document, used to verify required sections. */ adrContent?: string; /** Current status of the decision record. */ status?: AdrStatus; /** Whether a human-in-the-loop review has been completed (ADR-003). */ hitlReviewed?: boolean; /** Whether downstream artifacts are flagged for review after supersession. */ downstreamFlagged?: boolean; /** Whether the record is persisted in the canonical SQLite decisions table. */ persistedInDb?: boolean; } /** * Validate an Architecture Decision Record manifest entry. * * Enforces the 8 MUST requirements from `architecture-decision.md`: * ADR-001 (consensus provenance), ADR-002 (manifest link), ADR-003 (HITL), * ADR-004 (required sections), ADR-005 (cascade on supersession), * ADR-006 (SQLite persistence), ADR-007 (agent_type), ADR-008 (spec block). * * ADR-005, ADR-006, and ADR-008 require runtime state the caller must * provide via options — this validator checks the options and never * performs side-effectful I/O. * * @task T260 */ export declare function validateArchitectureDecisionProtocol(entry: ManifestEntryInput & { consensus_manifest_id?: string; }, options?: ArchitectureDecisionOptions): ProtocolValidationResult; /** Validation-stage options for validator. */ export interface ValidationStageOptions { /** Whether static analysis / type check passed (VALID-001). */ specMatchConfirmed?: boolean; /** Whether the existing test suite ran successfully (VALID-002). */ testSuitePassed?: boolean; /** Whether upstream protocol compliance checks passed (VALID-003). */ protocolComplianceChecked?: boolean; } /** * Validate a manifest entry against the validation stage protocol. * * Enforces VALID-001..007 from `validation.md`. The validation stage runs * static analysis, type checking, and pre-test quality gates. This validator * verifies the manifest entry captures a real validation run; runtime gate * enforcement happens in the lifecycle state machine, not here. * * @task T260 */ export declare function validateValidationProtocol(entry: ManifestEntryInput, options?: ValidationStageOptions): ProtocolValidationResult; /** * Project-agnostic test framework identifiers. * * The testing protocol is deliberately framework-neutral. Whichever * framework the project uses, the protocol only cares that tests run * autonomously via a framework adapter and loop until the spec is met. * * @task T260 */ export type TestFramework = 'vitest' | 'jest' | 'mocha' | 'pytest' | 'unittest' | 'go-test' | 'cargo-test' | 'rspec' | 'phpunit' | 'bats' | 'other'; /** Testing-stage options for validator. */ export interface TestingOptions { /** Detected or declared test framework for the current worktree. */ framework?: TestFramework; /** Total number of tests executed. */ testsRun?: number; /** Number of tests that passed. */ testsPassed?: number; /** Number of tests that failed. */ testsFailed?: number; /** Coverage percentage achieved (0-100). */ coveragePercent?: number; /** Minimum coverage threshold from project config. */ coverageThreshold?: number; /** Whether the implementation→validate→test loop converged (spec met). */ ivtLoopConverged?: boolean; /** Number of IVT loop iterations until convergence. */ ivtLoopIterations?: number; } /** * Validate a manifest entry against the testing protocol. * * This validator is **project-agnostic**: it makes no assumption about the * underlying test framework. It enforces the invariant that tests ran via * a detected framework, achieved 100% pass rate, and (if an IVT loop was * used) converged before the stage completes. * * Enforces TEST-001..007 from the post-2026-04 rewrite of `testing.md`. * * @task T260 */ export declare function validateTestingProtocol(entry: ManifestEntryInput, options?: TestingOptions): ProtocolValidationResult; /** * Validate a manifest entry against a specific protocol. * Throws CleoError with appropriate exit code on strict failure. * @task T4499 */ export declare function validateProtocol(protocol: ProtocolType, entry: ManifestEntryInput, options?: Record, strict?: boolean): ProtocolValidationResult; //# sourceMappingURL=protocol-validators.d.ts.map