<commit_before>#!/usr/bin/env ts-node

import * as Path from 'path'
import * as Fs from 'fs'

import * as Ajv from 'ajv'

function handleError(error: any) {
  console.error(error)
  process.exit(-1)
}

const repositoryRoot = Path.dirname(__dirname)
const changelogPath = Path.join(repositoryRoot, 'changelog.json')

const changelog = Fs.readFileSync(changelogPath)

try {
  JSON.parse(changelog.toString())
} catch {
  handleError(
    'The contents of changelog.json are not valid JSON. Please check the file contents and address this.'
  )
}

const schema = {
  $schema: 'http://json-schema.org/draft-07/schema#',
  type: 'object',
  properties: {<commit_msg>work with the object, not just the text<commit_after>#!/usr/bin/env ts-node

import * as Path from 'path'
import * as Fs from 'fs'

import * as Ajv from 'ajv'

function handleError(error: any) {
  console.error(error)
  process.exit(-1)
}

const repositoryRoot = Path.dirname(__dirname)
const changelogPath = Path.join(repositoryRoot, 'changelog.json')

const changelog = Fs.readFileSync(changelogPath, 'utf8')

let changelogObj = null

try {
  changelogObj = JSON.parse(changelog)
} catch {
  handleError(
    'The contents of changelog.json are not valid JSON. Please check the file contents and address this.'
  )
}

const schema = {
  $schema: 'http://json-schema.org/draft-07/schema#',
  type: 'object',
  properties: {
{'fraction_non_alphanumeric': 0.12490974729241877, 'fraction_numerical': 0.005054151624548736, 'mean_word_length': 4.269961977186312, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4305200', 'n_tokens_mistral': 481, 'n_tokens_neox': 474, 'n_words': 130}