/** * cli:scaffold-extension-search — validate.ts * * Zod validation returning the parsed spec WITH defaults applied (contextType, * tenantScoped, order) so the generator never sees an undefined optional. */ import { ExtensionSearchSpecSchema, type ValidationResult } from './types.js'; export function validate(raw: unknown): ValidationResult { const result = ExtensionSearchSpecSchema.safeParse(raw); if (result.success) { return { valid: true, errors: [], warnings: [], data: result.data }; } return { valid: false, errors: result.error.issues.map((i) => `${i.path.join('.') || '(root)'}: ${i.message}`), warnings: [], }; }