agentlytics 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +47 -18
- package/package.json +1 -1
- package/server.js +4 -0
package/index.js
CHANGED
|
@@ -139,10 +139,9 @@ if (!collectOnly && !fs.existsSync(publicIndex) && fs.existsSync(uiDir)) {
|
|
|
139
139
|
console.log(chalk.cyan(' ⟳ Building dashboard UI (first run)...'));
|
|
140
140
|
try {
|
|
141
141
|
const uiModules = path.join(uiDir, 'node_modules');
|
|
142
|
-
if (
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
142
|
+
if (fs.existsSync(uiModules)) fs.rmSync(uiModules, { recursive: true, force: true });
|
|
143
|
+
console.log(chalk.dim(' Installing UI dependencies...'));
|
|
144
|
+
execSync('npm install --no-audit --no-fund', { cwd: uiDir, stdio: 'pipe' });
|
|
146
145
|
console.log(chalk.dim(' Compiling frontend...'));
|
|
147
146
|
execSync('npm run build', { cwd: uiDir, stdio: 'pipe' });
|
|
148
147
|
console.log(chalk.green(' ✓ UI built successfully'));
|
|
@@ -278,20 +277,50 @@ const BOT_STYLES = [
|
|
|
278
277
|
process.exit(0);
|
|
279
278
|
}
|
|
280
279
|
|
|
281
|
-
// Start server
|
|
280
|
+
// Start server (kill stale agentlytics if port is busy)
|
|
282
281
|
const app = require('./server');
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
282
|
+
const http = require('http');
|
|
283
|
+
|
|
284
|
+
function tryListen() {
|
|
285
|
+
app.listen(PORT, () => {
|
|
286
|
+
const url = `http://localhost:${PORT}`;
|
|
287
|
+
console.log(chalk.green(` ✓ Dashboard ready at ${chalk.bold.white(url)}`));
|
|
288
|
+
console.log('');
|
|
289
|
+
console.log(chalk.dim(' Press Ctrl+C to stop\n'));
|
|
290
|
+
|
|
291
|
+
// Auto-open browser
|
|
292
|
+
const open = require('open');
|
|
293
|
+
open(url).catch(() => {});
|
|
294
|
+
}).on('error', (err) => {
|
|
295
|
+
if (err.code !== 'EADDRINUSE') throw err;
|
|
296
|
+
|
|
297
|
+
// Port in use — check if it's a previous agentlytics instance
|
|
298
|
+
const req = http.get(`http://localhost:${PORT}/api/ping`, { timeout: 2000 }, (res) => {
|
|
299
|
+
let body = '';
|
|
300
|
+
res.on('data', (d) => body += d);
|
|
301
|
+
res.on('end', () => {
|
|
302
|
+
try {
|
|
303
|
+
const data = JSON.parse(body);
|
|
304
|
+
if (data.app === 'agentlytics' && data.pid) {
|
|
305
|
+
console.log(chalk.yellow(` ⟳ Killing previous Agentlytics instance (PID ${data.pid})...`));
|
|
306
|
+
try { process.kill(data.pid, 'SIGTERM'); } catch {}
|
|
307
|
+
setTimeout(tryListen, 1000);
|
|
308
|
+
} else {
|
|
309
|
+
console.error(chalk.red(` ✖ Port ${PORT} is in use by another application.`));
|
|
310
|
+
process.exit(1);
|
|
311
|
+
}
|
|
312
|
+
} catch {
|
|
313
|
+
console.error(chalk.red(` ✖ Port ${PORT} is in use by another application.`));
|
|
314
|
+
process.exit(1);
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
});
|
|
318
|
+
req.on('error', () => {
|
|
319
|
+
console.error(chalk.red(` ✖ Port ${PORT} is in use but not responding. Kill the process manually or use PORT=<n> env.`));
|
|
320
|
+
process.exit(1);
|
|
321
|
+
});
|
|
322
|
+
});
|
|
323
|
+
}
|
|
292
324
|
|
|
293
|
-
|
|
294
|
-
const open = require('open');
|
|
295
|
-
open(url).catch(() => {});
|
|
296
|
-
});
|
|
325
|
+
tryListen();
|
|
297
326
|
})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentlytics",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Comprehensive analytics dashboard for AI coding agents — Cursor, Windsurf, Claude Code, VS Code Copilot, Zed, Antigravity, OpenCode, Command Code",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
package/server.js
CHANGED