@puberty-labs/refuctor
Version:
AI-powered, snark-fueled technical debt cleansing suite with automatic snarky language detection that turns code cleanup into a darkly humorous financial metaphor.
62 lines (50 loc) ⢠1.74 kB
JavaScript
/**
* Standalone Dashboard Starter
* Allows dashboard to run independently in any project
*/
const DashboardServer = require('./dashboard-server');
const path = require('path');
// Get configuration from environment or command line
const port = process.env.REFUCTOR_PORT || process.argv[2] || 1947;
const projectPath = process.env.REFUCTOR_PROJECT_PATH || process.cwd();
const noBrowser = process.env.REFUCTOR_NO_BROWSER === 'true';
console.log('š Starting Refuctor Dashboard Server...');
console.log(`š Project: ${projectPath}`);
console.log(`š Port: ${port}`);
async function startDashboard() {
try {
const server = new DashboardServer({
port: parseInt(port),
projectPath: projectPath
});
await server.start();
console.log('š Dashboard started successfully!');
console.log(`š URL: http://localhost:${port}`);
if (!noBrowser) {
try {
const open = await import('open');
await open.default(`http://localhost:${port}`);
console.log('š Opening in browser...');
} catch (error) {
console.log('ā¹ļø Open http://localhost:' + port + ' in your browser');
}
}
// Keep process running
process.stdin.resume();
// Handle graceful shutdown
process.on('SIGINT', async () => {
console.log('\nš Shutting down dashboard...');
await server.stop();
console.log('ā
Dashboard stopped');
process.exit(0);
});
} catch (error) {
console.error('š„ Failed to start dashboard:', error.message);
if (error.code === 'EADDRINUSE') {
console.error(`Port ${port} is already in use.`);
}
process.exit(1);
}
}
startDashboard();