<commit_before>var path = require('path'),	
	colors = require('colors'),
	fs = require('fs'),
	wrench = require('wrench'),
	DOMParser = require("xmldom").DOMParser,
	U = require('../../utils'),
	_ = require("../../lib/alloy/underscore")._,
	logger = require('../../common/logger'),
	requires = require('./requires'),
	CompilerMakeFile = require('./CompilerMakeFile'),
	CU = require('./compilerUtils'),
	alloyRoot = path.join(__dirname,'..','..');

var outputPath,
	compilerMakeFile;

function compile(args, program) {
	var inputPath = args.length > 0 ? args[0] : U.resolveAppHome();
	var alloyCF = path.join(inputPath,'config','alloy.json');
	var generatedCFG = '';
	var alloyConfig = {};

	if (!path.existsSync(inputPath)) {
		U.die('inputPath "' + inputPath + '" does not exist');
	}	

	if (!program.outputPath)
	{
		var t = path.join(inputPath,'views','index.xml');
		if (path.existsSync(t))
		{
			outputPath = path.join(inputPath,'..');
		}
	}
	outputPath = outputPath ? outputPath : (program.outputPath || path.join(U.resolveAppHome(),".."));
	U.ensureDir(outputPath);

	// construct compiler config from alloy.json and the command line config parameters
	if (path.existsSync(alloyCF)) {
		alloyConfig = JSON.parse(fs.readFileSync(alloyCF, 'utf8'));
		logger.info("found alloy configuration at "+alloyCF.yellow);
	}
	if (program.config) {
		_.each(program.config.split(','), function(v) {
			var a = v.split('=');
			alloyConfig[a[0]]=a[1];
		});
	}
	alloyConfig.deploytype = alloyConfig.deploytype || 'development';
	alloyConfig.beautify = alloyConfig.beautify || alloyConfig.deploytype === 'development';

	//console.log(alloyConfig);

	// establish alloy app directories
	var viewsDir = path.join(inputPath,'views');<commit_msg>unlikely runtime error, but ensure the program.config is a string<commit_after>var path = require('path'),	
	colors = require('colors'),
	fs = require('fs'),
	wrench = require('wrench'),
	DOMParser = require("xmldom").DOMParser,
	U = require('../../utils'),
	_ = require("../../lib/alloy/underscore")._,
	logger = require('../../common/logger'),
	requires = require('./requires'),
	CompilerMakeFile = require('./CompilerMakeFile'),
	CU = require('./compilerUtils'),
	alloyRoot = path.join(__dirname,'..','..');

var outputPath,
	compilerMakeFile;

function compile(args, program) {
	var inputPath = args.length > 0 ? args[0] : U.resolveAppHome();
	var alloyCF = path.join(inputPath,'config','alloy.json');
	var generatedCFG = '';
	var alloyConfig = {};

	if (!path.existsSync(inputPath)) {
		U.die('inputPath "' + inputPath + '" does not exist');
	}	

	if (!program.outputPath)
	{
		var t = path.join(inputPath,'views','index.xml');
		if (path.existsSync(t))
		{
			outputPath = path.join(inputPath,'..');
		}
	}
	outputPath = outputPath ? outputPath : (program.outputPath || path.join(U.resolveAppHome(),".."));
	U.ensureDir(outputPath);

	// construct compiler config from alloy.json and the command line config parameters
	if (path.existsSync(alloyCF)) {
		alloyConfig = JSON.parse(fs.readFileSync(alloyCF, 'utf8'));
		logger.info("found alloy configuration at "+alloyCF.yellow);
	}
	if (program.config && _.isString(program.config)) {
		_.each(program.config.split(','), function(v) {
			var a = v.split('=');
			alloyConfig[a[0]]=a[1];
		});
	}
	alloyConfig.deploytype = alloyConfig.deploytype || 'development';
	alloyConfig.beautify = alloyConfig.beautify || alloyConfig.deploytype === 'development';

	//console.log(alloyConfig);

	// establish alloy app directories
	var viewsDir = path.join(inputPath,'views');
{'fraction_non_alphanumeric': 0.18841394825646793, 'fraction_numerical': 0.00281214848143982, 'mean_word_length': 4.619273301737756, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '5876141', 'n_tokens_mistral': 1239, 'n_tokens_neox': 1153, 'n_words': 227}