<commit_before>import commandLineArgs from 'command-line-args';

import {startClient} from './lib/client';

const cli = commandLineArgs([
    {
        name: 'dir',
        alias: 'd',
        type: String
    }
]);
const options = cli.parse();

const filesById = {};

startClient(filesById, options.dir);<commit_msg>Client generate and save/read clientkey<commit_after>import fs from 'fs';
import path from 'path';
import commandLineArgs from 'command-line-args';
import uuid from 'node-uuid';

import {startClient} from './lib/client';

const CLIENT_KEYFILE = '.clientkey';

const cli = commandLineArgs([
    {
        name: 'dir',
        alias: 'd',
        type: String
    }
]);
const options = cli.parse();
const filesById = {};

const keyPath = path.join(options.dir, CLIENT_KEYFILE);
let key;



fs.stat(keyPath, (err, stats) => {
    if (err === null && stats.isFile()) {
        key = fs.readFileSync(keyPath, 'utf8');
    } else {
        key = uuid.v4();
        const file = fs.writeFileSync(keyPath, key);
    }

    startClient(filesById, options.dir);
});
{'fraction_non_alphanumeric': 0.15205223880597016, 'fraction_numerical': 0.0018656716417910447, 'mean_word_length': 3.1750972762645913, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '881181', 'n_tokens_mistral': 350, 'n_tokens_neox': 346, 'n_words': 89}