import { defineCommand, arg } from "politty";
import { z } from "zod";
import { executeCommand } from "../../lib/command-result";
import { runModuleInit } from "./init";

export const initCommand = defineCommand({
  name: "init",
  description: "Bootstrap a new module with directory structure and README",
  args: z.object({
    name: arg(z.string(), {
      positional: true,
      description: "Module name",
    }),
    dir: arg(z.string(), {
      positional: true,
      description: "Parent directory where the module will be created",
    }),
  }),
  run: (args) => {
    return executeCommand(() => runModuleInit(args.name, args.dir, process.cwd()));
  },
});
