agentsqripts
Version:
Comprehensive static code analysis toolkit for identifying technical debt, security vulnerabilities, performance issues, and code quality problems
44 lines (39 loc) • 855 B
JavaScript
/**
* @file Common process helpers
* @description Shared utilities for process handling
*/
/**
* Exit process with code based on issues
* @param {boolean} hasIssues - Whether issues were found
*/
function exitWithCode(hasIssues) {
process.exit(hasIssues ? 1 : 0);
}
/**
* Exit process based on severity count
* @param {number} count - Count of severe issues
*/
function exitOnSeverity(count) {
process.exit(count > 0 ? 1 : 0);
}
/**
* Handle uncaught errors
* @param {Error} error - Error object
*/
function handleUncaughtError(error) {
console.error('Uncaught error:', error);
process.exit(1);
}
/**
* Get process arguments
* @returns {Array} Command line arguments
*/
function getProcessArgs() {
return process.argv.slice(2);
}
module.exports = {
exitWithCode,
exitOnSeverity,
handleUncaughtError,
getProcessArgs
};