<commit_before>const readFileSync = require('fs').readFileSync;
const execSync = require('child_process').execSync;
const validateSemver = require('semver').valid;

const isSemverValid = version => validateSemver(version) !== null;

/* VERSION */
const pkg = JSON.parse(readFileSync('./package.json'));
const version = pkg.version;
if (!isSemverValid(version)) {
  throw new Error(`Unexpected version: ${version}`);
}

/* AUTHORS */
execSync('git --no-pager log --reverse --format="%aN <%aE>" | sort -fub > AUTHORS'
         + ' && git add AUTHORS && git commit -m "update AUTHORS" AUTHORS || true', { stdio: 'inherit' });

/* CHANGELOG */
execSync(`echo "### v${version}\\n" > \\#temp_changelog`, { stdio: 'inherit' });

let repository = pkg.repository;
if (repository) {
  repository = repository.replace(/^<EMAIL>:(.*)\.git$/, '$1');
}

// Initial commit: diff against an empty tree object
execSync('git log `git describe --abbrev=0 &> /dev/null && git rev-list --tags --max-count=1 || echo "4b825dc642cb6eb9a060e54bf8d69288fbee4904"`..HEAD  --reverse'
         + ` --pretty=format:"- [\\\`%h\\\`](https://github.com/${repository}/commit/%H) %s (%an)"`
         + '>> \\#temp_changelog', { stdio: 'inherit' });

execSync('$EDITOR \\#temp_changelog', { stdio: 'inherit' });
execSync('echo "\\n" >> \\#temp_changelog', { stdio: 'inherit' });
try {
  execSync('cat CHANGELOG.md >> \\#temp_changelog', { stdio: 'inherit' });
} catch (err) {}
execSync('cat \\#temp_changelog | sed -e :a -e \'/^\\n*$/{$d;N;};/\\n$/ba\' > CHANGELOG.md', { stdio: 'inherit' });
execSync('rm \\#temp_changelog', { stdio: 'inherit' });
execSync('git add CHANGELOG.md');<commit_msg>update authors also uses karma message<commit_after>const readFileSync = require('fs').readFileSync;
const execSync = require('child_process').execSync;
const validateSemver = require('semver').valid;

const isSemverValid = version => validateSemver(version) !== null;

/* VERSION */
const pkg = JSON.parse(readFileSync('./package.json'));
const version = pkg.version;
if (!isSemverValid(version)) {
  throw new Error(`Unexpected version: ${version}`);
}

/* AUTHORS */
execSync('git --no-pager log --reverse --format="%aN <%aE>" | sort -fub > AUTHORS'
         + ' && git add AUTHORS && git commit -m "chore(authors): update AUTHORS" AUTHORS || true', { stdio: 'inherit' });

/* CHANGELOG */
execSync(`echo "### v${version}\\n" > \\#temp_changelog`, { stdio: 'inherit' });

let repository = pkg.repository;
if (repository) {
  repository = repository.replace(/^<EMAIL>:(.*)\.git$/, '$1');
}

// Initial commit: diff against an empty tree object
execSync('git log `git describe --abbrev=0 &> /dev/null && git rev-list --tags --max-count=1 || echo "4b825dc642cb6eb9a060e54bf8d69288fbee4904"`..HEAD  --reverse'
         + ` --pretty=format:"- [\\\`%h\\\`](https://github.com/${repository}/commit/%H) %s (%an)"`
         + '>> \\#temp_changelog', { stdio: 'inherit' });

execSync('$EDITOR \\#temp_changelog', { stdio: 'inherit' });
execSync('echo "\\n" >> \\#temp_changelog', { stdio: 'inherit' });
try {
  execSync('cat CHANGELOG.md >> \\#temp_changelog', { stdio: 'inherit' });
} catch (err) {}
execSync('cat \\#temp_changelog | sed -e :a -e \'/^\\n*$/{$d;N;};/\\n$/ba\' > CHANGELOG.md', { stdio: 'inherit' });
execSync('rm \\#temp_changelog', { stdio: 'inherit' });
execSync('git add CHANGELOG.md');
{'fraction_non_alphanumeric': 0.2249031873696753, 'fraction_numerical': 0.0160857908847185, 'mean_word_length': 4.190108191653787, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 29, 'https://': 2, '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': '5056589', 'n_tokens_mistral': 1227, 'n_tokens_neox': 1183, 'n_words': 257}