/**
 * generate-msg CLI types — Input spec and output result
 *
 * The Skill (Claude) analyzes the changes and passes its analysis to this CLI.
 * The CLI formalizes the commit message in conventional format.
 */

import { z } from 'zod';

export const FileAnalysisSchema = z.object({
  path: z.string(),
  status: z.enum(['added', 'modified', 'deleted', 'renamed']),
  summary: z.string(),
});

export const GenerateMsgSpecSchema = z.object({
  branch: z.string(),
  branchType: z.enum(['feature', 'release', 'hotfix', 'develop', 'main', 'other']),
  scope: z.string(),
  /** One-line summary of all changes (from Claude's analysis) */
  summary: z.string(),
  /** Per-file analysis (from Claude reading each file) */
  files: z.array(FileAnalysisSchema),
  /** Optional breaking change description */
  breaking: z.string().optional(),
});

export type GenerateMsgSpec = z.infer<typeof GenerateMsgSpecSchema>;

export const GenerateMsgResultSchema = z.object({
  success: z.boolean(),
  error: z.string().optional(),
  /** The formatted commit message (conventional commits + MD body) */
  message: z.string(),
});

export type GenerateMsgResult = z.infer<typeof GenerateMsgResultSchema>;
