/**
 * audit-dev-wire / validate.ts — CLI arg validation.
 */
import { AuditDevWireArgsSchema, type ArgsValidationResult } from './types.js'

export function validateArgs(raw: unknown): ArgsValidationResult {
  const parsed = AuditDevWireArgsSchema.safeParse(raw)
  if (!parsed.success) {
    return {
      valid: false,
      args: null,
      errors: parsed.error.issues.map((i) => `${i.path.join('.') || '(root)'}: ${i.message}`),
    }
  }
  return { valid: true, args: parsed.data, errors: [] }
}
