<commit_before>const { exec } = require('child_process');

function tfHistory(req, res) {
    exec('tf.exe history $/syngo.net/modules/foundations/pcp/v5 /collection:https://tfs.healthcare.siemens.com:8090/tfs/IKM.TPC.Projects /noprompt /recursive /stopafter:20', (err, stdout, stderr) => {
        if (err) {
            console.error(err);
            return;
        }
        //res.send(stdout);
        //res.json({ foo: 'bar' })
        res.send({ result: stdout });
    });
}

module.exports = { tfHistory };<commit_msg>history API provides structured response<commit_after>const { exec } = require('child_process');

function tfHistory(req, res) {
    exec('tf.exe history $/syngo.net/modules/foundations/pcp/v5 /collection:https://tfs.healthcare.siemens.com:8090/tfs/IKM.TPC.Projects /noprompt /recursive /stopafter:20', (err, stdout, stderr) => {
        if (err) {
            console.error(err);
            return;
        }
        var items = [];
        var lines = stdout.split("\n");
        console.log(`${lines.length} line(s)`);
        for (var i = 0; i < lines.length; i++) {
            var line = lines[i];
            var cols = /(\d+)\s+(\w+,*\s*\w+)\.*\s+([\d-\.]+)\s+(.*)\s*#/g.exec(line);
            if (cols && cols.length>1){
                var item ={
                    cs: cols[1],
                    submitter: cols[2],
                    date: cols[3],
                    comment: cols[4]
                };
            
                items.push(item);
                console.log(item);
            }
        }
        console.log(items.length);
        res.send(JSON.stringify(items));
    });
}

module.exports = { tfHistory };
{'fraction_non_alphanumeric': 0.17492537313432835, 'fraction_numerical': 0.011940298507462687, 'mean_word_length': 1.8026755852842808, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 6, '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': '7420748', 'n_tokens_mistral': 572, 'n_tokens_neox': 547, 'n_words': 92}