"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.OpAddActionCommand = void 0;
const commander_1 = require("commander");
const chalk_1 = __importDefault(require("chalk"));
const OperationExecutor_1 = require("../services/OperationExecutor");
const core_1 = require("@myycontext/core");
exports.OpAddActionCommand = new commander_1.Command("op:add-action")
    .description("Generate a new server action or API route")
    .argument("<name>", "action name")
    .argument("<description>", "action description")
    .option("--type <type>", "action type: server-action | client-action | api-route", "server-action")
    .action(async (name, description, options) => {
    const executor = new OperationExecutor_1.OperationExecutor();
    const op = (0, core_1.createOperation)("add-action", `Create action: ${name}`, {
        name,
        description,
        type: options.type,
    });
    const result = await executor.execute(op);
    if (result.success) {
        console.log(chalk_1.default.green(`\n  ✓ Created ${options.type} "${name}" at ${result.outputPath}\n`));
    }
    else {
        console.error(chalk_1.default.red(`\n  ✗ Failed: ${result.error}\n`));
        process.exit(1);
    }
});
//# sourceMappingURL=op-add-action.js.map