/** * cli:roslyn-validator — validate.ts * Validation structurelle (Zod) + verification que le repertoire existe * Ne fait PAS d'analyse de fichiers .cs — c'est le role d'execute.ts */ import { existsSync, statSync } from 'node:fs' import { RoslynInputSchema, type RoslynInput, type ValidationResult } from './types' export function validate(raw: unknown): ValidationResult { const blockers: string[] = [] const warnings: string[] = [] // ─── Validation structurelle (Zod) ─── const parsed = RoslynInputSchema.safeParse(raw) if (!parsed.success) { for (const issue of parsed.error.issues) { blockers.push(`[${issue.path.join('.')}] ${issue.message}`) } return { valid: false, blockers, warnings } } const data = parsed.data // ─── Verification que le repertoire source existe ─── if (!existsSync(data.src)) { blockers.push(`Source directory not found: ${data.src}`) return { valid: false, blockers, warnings } } // ─── Verification que c'est un repertoire ─── const stat = statSync(data.src) if (!stat.isDirectory()) { blockers.push(`Source path is not a directory: ${data.src}`) return { valid: false, blockers, warnings } } return { valid: true, data, blockers, warnings, } }