/** * Core validation operations - business logic extracted from validate-engine.ts. * * These are pure business logic functions that throw on failure and return * data directly (no EngineResult wrapper). The engine layer wraps these * in try/catch to produce EngineResult. * * @task T4786 * @epic T4654 */ import { type RuleViolation } from './validation-rules.js'; /** Compliance entry stored in COMPLIANCE.jsonl */ export interface ComplianceEntry { timestamp: string; taskId: string; protocol: string; result: 'pass' | 'fail' | 'partial'; violations?: Array<{ code: string; message: string; severity: 'error' | 'warning'; }>; linkedTask?: string; agent?: string; } /** Coherence issue found during graph validation. */ export interface CoherenceIssue { type: string; taskId: string; message: string; severity: 'error' | 'warning' | 'info'; } export interface ValidateCheckDetail { check: string; status: 'ok' | 'error' | 'warning'; message: string; } export interface ValidateReportResult { valid: boolean; schemaVersion: string; errors: number; warnings: number; details: ValidateCheckDetail[]; } /** * Run comprehensive validation report on tasks database — checks business rules, * dependencies, checksums, data integrity, and schema compliance. * @task T4795 */ export declare function coreValidateReport(projectRoot: string): Promise; import { type RepairAction } from '../repair.js'; /** Result from validate + fix operation. */ export interface ValidateAndFixResult extends ValidateReportResult { repairsApplied: number; repairs: RepairAction[]; } /** * Run validation report, then apply data repairs for fixable issues. * Calls runAllRepairs() from src/core/repair.ts (same repairs used by `upgrade`). * @task T4795 */ export declare function coreValidateAndFix(projectRoot: string, dryRun?: boolean): Promise; /** * Validate data against a schema type. * * For SQLite-backed types (todo, archive, sessions, log), queries rows * directly from SQLite and validates with drizzle-zod schemas. * For config type, uses AJV against the JSON schema file. * If raw `data` is provided, validates directly with AJV (backward compat). * * @task T4786 */ export declare function coreValidateSchema(type: string, data: unknown | undefined, projectRoot: string): Promise<{ type: string; valid: boolean; errors: unknown[]; errorCount: number; }>; /** * Validate a single task against anti-hallucination rules. * @task T4786 */ export declare function coreValidateTask(taskId: string, projectRoot: string): Promise<{ taskId: string; valid: boolean; violations: RuleViolation[]; errorCount: number; warningCount: number; }>; /** * Check basic protocol compliance for a task. * @task T4786 */ export declare function coreValidateProtocol(taskId: string, protocolType: string | undefined, projectRoot: string): Promise<{ taskId: string; protocolType: string; compliant: boolean; violations: Array<{ code: string; message: string; severity: string; }>; }>; /** * Validate manifest JSONL entries for required fields. * @task T4786 */ export declare function coreValidateManifest(projectRoot: string): { valid: boolean; totalEntries: number; validEntries: number; invalidEntries: number; errors: Array<{ line: number; entryId: string; errors: string[]; }>; message?: string; }; /** * Validate an output file for required sections. * @task T4786 */ export declare function coreValidateOutput(filePath: string, taskId: string | undefined, projectRoot: string): { filePath: string; valid: boolean; issues: Array<{ code: string; message: string; severity: string; }>; fileSize: number; lineCount: number; }; /** * Get aggregated compliance metrics. * @task T4786 */ export declare function coreComplianceSummary(projectRoot: string): { total: number; pass: number; fail: number; partial: number; passRate: number; byProtocol: Record; }; /** * List compliance violations. * @task T4786 */ export declare function coreComplianceViolations(limit: number | undefined, projectRoot: string): { violations: Array<{ timestamp: string; taskId: string; protocol: string; result: string; violations?: ComplianceEntry['violations']; }>; total: number; }; /** * Record a compliance check result to COMPLIANCE.jsonl. * @task T4786 */ export declare function coreComplianceRecord(taskId: string, result: string, protocol: string | undefined, violations: Array<{ code: string; message: string; severity: 'error' | 'warning'; }> | undefined, projectRoot: string): { recorded: boolean; taskId: string; result: string; protocol: string; }; /** * Check test suite availability. * @task T4786 */ export declare function coreTestStatus(projectRoot: string): { batsTests: { available: boolean; directory: string | null; }; dispatchTests: { available: boolean; directory: string | null; }; message: string; }; /** * Cross-validate task graph for consistency. * @task T4786 */ export declare function coreCoherenceCheck(projectRoot: string): Promise<{ coherent: boolean; issues: CoherenceIssue[]; }>; /** * Execute the project's test suite via subprocess. * * Project-agnostic per T1534 / ADR-061: the runner is resolved from * `.cleo/project-context.json` (`testing.command`) with per-`primaryType` * fallbacks (vitest → pytest → cargo test → go test, …). Pre-T1534 this * function shelled out to `npx vitest run`, which silently failed on * non-Node projects. * * `params.scope` is appended to the resolved command verbatim. `params.pattern` * is forwarded as a vitest-style `--testNamePattern` only when the resolved * canonical tool is `test` AND the binary recognises that flag — for other * runners we omit it (callers should use scope/glob instead). * * @task T4786 * @task T1534 * @adr ADR-061 */ export declare function coreTestRun(params: { scope?: string; pattern?: string; parallel?: boolean; } | undefined, projectRoot: string): { ran: boolean; runner?: string; output?: unknown; exitCode?: number; stdout?: string; stderr?: string; passed?: boolean; message?: string; }; /** * Batch validate all tasks against schema and rules. * @task T4786 */ export declare function coreBatchValidate(projectRoot: string): Promise<{ totalTasks: number; validTasks: number; invalidTasks: number; totalErrors: number; totalWarnings: number; results: Array<{ taskId: string; valid: boolean; errorCount: number; warningCount: number; violations: RuleViolation[]; }>; }>; /** * Get test coverage metrics. * @task T4786 */ export declare function coreTestCoverage(projectRoot: string): { available: boolean; message?: string; [key: string]: unknown; }; //# sourceMappingURL=validate-ops.d.ts.map