<commit_before>#! /usr/bin/env node
'use strict';

const program = require('commander');
const inquirer = require('inquirer');
const Revision = require('../lib/utils/revision');
const createTag = require('../lib/git/tag');

program
  .option('-r --revision [revision]', 'the revision to use (default: PROJECT_REVISION)')
  .option('-y --yes', 'automatic yes to prompt', false)
  .parse(process.argv);

const tag = async (program) => {
  const options = program.opts();
  const revision = options.revision || Revision.get(Revision.REVISION_TYPE_ENV);
  const autoYes = options.yes;

  if (autoYes) {
    await createTag(revision);
    return;
  }

  const question = {
    type: 'confirm',
    name: 'tag',
    message: `Do you really want to create a new git tag for revision ${revision}?`,
    default: false
  };

  const answers = await inquirer.prompt([question]);

  if (!answers.tag) {
    process.exit(1);
  }

  await createTag(revision);
};

tag(program);
<commit_msg>feat(tag): option to add prefix to version<commit_after>#! /usr/bin/env node
'use strict';

const program = require('commander');
const inquirer = require('inquirer');
const Revision = require('../lib/utils/revision');
const createTag = require('../lib/git/tag');

program
  .option('-r --revision [revision]', 'the revision to use (default: PROJECT_REVISION)')
  .option('-p --prefix [prefix]', 'the prefix to add to the version number')
  .option('-y --yes', 'automatic yes to prompt', false)
  .parse(process.argv);

const tag = async (program) => {
  const options = program.opts();
  const revision = options.revision || Revision.get(Revision.REVISION_TYPE_ENV);
  const prefix = options.prefix || '';
  const autoYes = options.yes;
  const newTag = `${prefix}${revision}`;

  if (autoYes) {
    await createTag(newTag);
    return;
  }

  const question = {
    type: 'confirm',
    name: 'tag',
    message: `Do you really want to create a new git tag ${newTag}?`,
    default: false
  };

  const answers = await inquirer.prompt([question]);

  if (!answers.tag) {
    process.exit(1);
  }

  await createTag(newTag);
};

tag(program);

{'fraction_non_alphanumeric': 0.1617161716171617, 'fraction_numerical': 0.000942951438000943, 'mean_word_length': 3.811791383219955, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5867892', 'n_tokens_mistral': 707, 'n_tokens_neox': 688, 'n_words': 193}