/** * cli:validate-page — validate.ts * * Read-only Zod validation of CLI input. Disk reads happen in execute.ts. */ import { ValidatePageInputSchema, type ValidationResult, } from './types.js' export function validate(raw: unknown): ValidationResult { const result = ValidatePageInputSchema.safeParse(raw) if (!result.success) { return { valid: false, errors: result.error.issues.map((i) => `[${i.path.join('.')}] ${i.message}`), warnings: [], } } if (!result.data.pageFile.endsWith('.tsx')) { return { valid: false, errors: [`pageFile must end in .tsx (got: ${result.data.pageFile})`], warnings: [], } } return { valid: true, errors: [], warnings: [], spec: result.data } }