<commit_before>if (typeof path === "undefined")
var path = require('path');
const fs = require('mz/fs');
const kxapi = require('./js/kxapiPromise.js');
const minuteGenerator = require('./js/minuteGenerator.js');
const pjson = require('./package.json');

const config = {
	profile: {
		default: {
			fileName: {
				str: "{NAME}_minutes_{DATE}.html",
			},
			description: {
				str: "{NAME} minutes {DATE}"
			},
			generator: "html",
			options: {
				comment: "{DATE} {NAME}> {MESSAGE}",
				eol: "\n"
			}
		}
	}
};

const getTopicAndComments = idx => Promise.all([
	kxapi.getTopics([idx]),
	kxapi.getRefs(idx),
	kxapi.getShared(idx)
])
	.then(([topics, comments, shared]) => Promise.all([
		topics[0],
		shared ? shared.shared : [],
		comments.sort((a, b) =>
			new Date(a.creationDate) - new Date(b.creationDate)),
		kxapi.getUsers(Array.from(comments.map(e => e.author[0])
			.reduce((acc, cur) => (acc.add(cur), acc), new Set([topics[0].author[0]]))))
	]))
	.then(([topic, shared, comments, users]) => ({topic, shared, comments,
		users: users.reduce((acc, cur) => (acc[cur.profileIdx] = cur, acc), {})}));

const writeKeeexShare = (data, str) => {
	const filePath = path.join(config.defaultPath, data.fileName);
	const opt = {
		targetFolder: config.defaultPath,
		timestamp: false,<commit_msg>add agreements<commit_after>if (typeof path === "undefined")
var path = require('path');
const fs = require('mz/fs');
const kxapi = require('./js/kxapiPromise.js');
const minuteGenerator = require('./js/minuteGenerator.js');
const pjson = require('./package.json');

const config = {
	profile: {
		default: {
			fileName: {
				str: "{NAME}_minutes_{DATE}.html",
			},
			description: {
				str: "{NAME} minutes {DATE}"
			},
			generator: "html",
			options: {
				comment: "{DATE} {NAME}> {MESSAGE}",
				eol: "\n"
			}
		}
	}
};

const getTopicAndComments = idx => Promise.all([
	kxapi.getTopics([idx]),
	kxapi.getShared(idx),
	kxapi.getRefs(idx),
	kxapi.getAgreements(idx)
])
	.then(([topics, shared, comments, agreements]) => Promise.all([
		topics,
		shared,
		comments.concat(agreements.filter(e => e))
	]))
	.then(([topics, shared, comments]) => Promise.all([
		topics[0],
		shared ? shared.shared : [],
		comments.sort((a, b) =>
			new Date(a.creationDate) - new Date(b.creationDate)),
		kxapi.getUsers(Array.from(comments.map(e => e.author[0])
			.reduce((acc, cur) => (acc.add(cur), acc), new Set([topics[0].author[0]]))))
	]))
	.then(([topic, shared, comments, users]) => ({topic, shared, comments,
		users: users.reduce((acc, cur) => (acc[cur.profileIdx] = cur, acc), {})}));

const writeKeeexShare = (data, str) => {
	const filePath = path.join(config.defaultPath, data.fileName);
	const opt = {
		targetFolder: config.defaultPath,
		timestamp: false,
{'fraction_non_alphanumeric': 0.20563787495482472, 'fraction_numerical': 0.0028912179255511385, 'mean_word_length': 4.272380952380952, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, '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': '1301828', 'n_tokens_mistral': 1072, 'n_tokens_neox': 986, 'n_words': 200}