<commit_before>var
	fs = require('fs')
	, path = require('path')
	, util = require('util')
	, events = require('events')
	, argv = require(path.resolve(__dirname, 'app', 'argv'))
	, client = require(path.resolve(__dirname, 'app', 'client'))
	, config = require(path.resolve(__dirname, 'app', 'config'))
	, logger = require(path.resolve(__dirname, 'lib', 'logger'))
	, app = new events.EventEmitter()
	, log = new logger(argv)
	, creds = {}
;

logger.default = log;
app.log = log;

app.on('error', function(err) {

	log.error(err);
	
	/**
	 * Do more stuff with errors.
	 * err should include .stack,
	 * which we could pipe to the cloud
	 * at some point, it would be useful!
	 */
});

var ninja = new client(argv, creds, app);

config(ninja, app);

/**
 * Note about apps (event emitters):
 * 
 * We can instantiate multiple apps to
 * allow our modules to be namespaced/sandboxed
 * if we so desire. This allows us to provide 
 * isolation without any additional infrastructure
 */
<commit_msg>Exit if unable to create ninja.<commit_after>var
	fs = require('fs')
	, path = require('path')
	, util = require('util')
	, events = require('events')
	, argv = require(path.resolve(__dirname, 'app', 'argv'))
	, client = require(path.resolve(__dirname, 'app', 'client'))
	, config = require(path.resolve(__dirname, 'app', 'config'))
	, logger = require(path.resolve(__dirname, 'lib', 'logger'))
	, app = new events.EventEmitter()
	, log = new logger(argv)
	, creds = {}
;

logger.default = log;
app.log = log;

app.on('error', function(err) {

	log.error(err);
	
	/**
	 * Do more stuff with errors.
	 * err should include .stack,
	 * which we could pipe to the cloud
	 * at some point, it would be useful!
	 */
});

var ninja = new client(argv, creds, app);

if((!ninja) || !ninja.credentials.id) {

	log.error("Unable to create ninja client.");
	process.exit(1);
}

config(ninja, app);

/**
 * Note about apps (event emitters):
 * 
 * We can instantiate multiple apps to
 * allow our modules to be namespaced/sandboxed
 * if we so desire. This allows us to provide 
 * isolation without any additional infrastructure
 */

{'fraction_non_alphanumeric': 0.1558073654390935, 'fraction_numerical': 0.00047214353163361664, 'mean_word_length': 3.962529274004684, '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': '5776186', 'n_tokens_mistral': 706, 'n_tokens_neox': 676, 'n_words': 215}