@monoes/monomindcli 1.10.32 → 1.10.34

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.
@@ -429,6 +429,40 @@ export async function startServer({ port = 4242, projectDir, openBrowser = true
429
429
  return;
430
430
  }
431
431
 
432
+ // ------------------------------------------------------- GET /api/projects
433
+ if (req.method === 'GET' && url === '/api/projects') {
434
+ try {
435
+ const projectsBase = path.join(os.homedir(), '.claude', 'projects');
436
+ let slugDirs = [];
437
+ try { slugDirs = fs.readdirSync(projectsBase, { withFileTypes: true }).filter(e => e.isDirectory()).map(e => e.name); } catch {}
438
+ const projects = slugDirs.map(slug => {
439
+ const projDir = path.join(projectsBase, slug);
440
+ // convert slug back to path: replace leading - and then each - that was /
441
+ const projPath = slug.replace(/-/g, '/');
442
+ const name = slug.split('-').filter(Boolean).pop() || slug;
443
+ let sessionCount = 0; let lastActivity = 0; let memoryCount = 0;
444
+ try {
445
+ const files = fs.readdirSync(projDir).filter(f => f.endsWith('.jsonl'));
446
+ sessionCount = files.length;
447
+ for (const f of files) {
448
+ try { const st = fs.statSync(path.join(projDir, f)); if (st.mtimeMs > lastActivity) lastActivity = st.mtimeMs; } catch {}
449
+ }
450
+ } catch {}
451
+ try {
452
+ const memDir = path.join(projDir, 'memory');
453
+ memoryCount = fs.readdirSync(memDir).filter(f => f.endsWith('.md') && f !== 'MEMORY.md').length;
454
+ } catch {}
455
+ return { slug, path: projPath, name, sessionCount, memoryCount, lastActivity: lastActivity || null };
456
+ }).filter(p => p.sessionCount > 0).sort((a, b) => (b.lastActivity || 0) - (a.lastActivity || 0));
457
+ res.writeHead(200, { 'Content-Type': 'application/json', 'Access-Control-Allow-Origin': '*', 'Cache-Control': 'no-cache' });
458
+ res.end(JSON.stringify({ projects }));
459
+ } catch (err) {
460
+ res.writeHead(500, { 'Content-Type': 'application/json' });
461
+ res.end(JSON.stringify({ error: err.message }));
462
+ }
463
+ return;
464
+ }
465
+
432
466
  // ------------------------------------------------------- GET /api/palace
433
467
  if (req.method === 'GET' && url === '/api/palace') {
434
468
  try {