"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.OpAddTestCommand = 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.OpAddTestCommand = new commander_1.Command("op:add-test")
    .description("Add a test to a file")
    .argument("<file>", "test file path")
    .argument("<test-name>", "test description/name")
    .option("--content <content>", "test content override")
    .action(async (file, testName, options) => {
    const executor = new OperationExecutor_1.OperationExecutor();
    const op = (0, core_1.createOperation)("add-test", `Add test: ${testName}`, {
        file,
        testName,
        content: options.content || `describe("${testName}", () => { it("should work", () => { expect(true).toBe(true); }); });`,
    });
    const result = await executor.execute(op);
    if (result.success) {
        console.log(chalk_1.default.green(`\n  ✓ Added test "${testName}" to ${file}\n`));
    }
    else {
        console.error(chalk_1.default.red(`\n  ✗ Failed: ${result.error}\n`));
        process.exit(1);
    }
});
//# sourceMappingURL=op-add-test.js.map