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

export const updateCommand = defineCommand({
  name: "update",
  description: "Refresh framework-managed resources (skills, workflows)",
  args: z.object({
    resources: arg(z.array(z.string()).default([]), {
      positional: true,
      description: "Resources to update (skills, workflows). Defaults to all.",
    }),
  }),
  run: (args) => {
    return executeCommand(() => runUpdate(process.cwd(), args.resources));
  },
});
