import path from "node:path";
import { defineCommand, arg } from "politty";
import { z } from "zod";
import { executeCommand } from "../../../lib/command-result";
import { runAppGenerateSeed } from "./seed";

export const seedCommand = defineCommand({
  name: "seed",
  description: "Generate seed data from module defaults",
  args: z.object({
    path: arg(z.string(), {
      alias: "p",
      description: "Path to app directory",
    }),
  }),
  run: (args) => {
    return executeCommand(() => {
      const appPath = path.resolve(process.cwd(), args.path);
      return runAppGenerateSeed(appPath);
    });
  },
});
