"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.MergeRequestTemplate = void 0;
const commander_1 = require("commander");
const git_utils_1 = require("../utils/git.utils");
const fs_1 = __importDefault(require("fs"));
class MergeRequestTemplate {
    constructor() {
        this.GITLAB_MR_TEMPLATE_DIR = '.gitlab/merge_request_templates';
        this.DEFAULT_MR_TEMPLATE = 'default.md';
    }
    setup() {
        this.setupCreateMergeRequestTemplateCommand();
    }
    setupCreateMergeRequestTemplateCommand() {
        commander_1.program
            .command('merge-request-template')
            .description('Setup git commit-msg hook for conventional commits')
            .action(async () => {
            this.createMergeRequestTemplate();
        });
    }
    createMergeRequestTemplate() {
        if (git_utils_1.GitUtils.logErrorIfNotInGitProject())
            return;
        if (!fs_1.default.existsSync(this.GITLAB_MR_TEMPLATE_DIR)) {
            fs_1.default.mkdirSync(this.GITLAB_MR_TEMPLATE_DIR, { recursive: true });
        }
        if (!fs_1.default.existsSync(`${this.GITLAB_MR_TEMPLATE_DIR}/${this.DEFAULT_MR_TEMPLATE}`)) {
            fs_1.default.writeFileSync(`${this.GITLAB_MR_TEMPLATE_DIR}/${this.DEFAULT_MR_TEMPLATE}`, `### Checklists (The creator will check and the reviewer will review

- [ ] Update Docs
- [ ] Write Tests`);
        }
    }
}
exports.MergeRequestTemplate = MergeRequestTemplate;
//# sourceMappingURL=merge-request-template.js.map