@monoes/monomindcli 1.10.25 → 1.10.27

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monoes/monomindcli",
3
- "version": "1.10.25",
3
+ "version": "1.10.27",
4
4
  "type": "module",
5
5
  "description": "Monomind CLI - Enterprise AI agent orchestration with 60+ specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
6
6
  "main": "dist/src/index.js",
@@ -112,4 +112,4 @@
112
112
  "access": "public",
113
113
  "tag": "latest"
114
114
  }
115
- }
115
+ }
@@ -48,11 +48,12 @@ const dbPathArg = argVal('db') ? resolve(argVal('db')) : join(projectDir,
48
48
  const outputArg = argVal('output')? resolve(argVal('output')) : join(projectDir, '.understand', 'knowledge-graph.json');
49
49
  const batchSize = parseInt(argVal('batch-size') || '5', 10);
50
50
  const maxFiles = parseInt(argVal('max-files') || '0', 10);
51
- const dryRun = hasFlag('dry-run');
52
- const noLlm = hasFlag('no-llm');
53
- const layersOnly = hasFlag('layers-only');
54
- const incremental = hasFlag('incremental');
55
- const onboard = hasFlag('onboard');
51
+ const dryRun = hasFlag('dry-run');
52
+ const noLlm = hasFlag('no-llm');
53
+ const layersOnly = hasFlag('layers-only');
54
+ const incremental = hasFlag('incremental');
55
+ const importAnalysesStdin = hasFlag('import-analyses-stdin');
56
+ const onboard = hasFlag('onboard');
56
57
  const onboardOut = argVal('onboard-out') ? resolve(argVal('onboard-out')) : join(projectDir, 'ONBOARDING.md');
57
58
 
58
59
  // ── Resolve @monoes/monograph for DB access ──────────────────────────────────
@@ -629,6 +630,59 @@ async function main() {
629
630
  try { db.prepare(`ALTER TABLE nodes ADD COLUMN properties TEXT`).run(); } catch {}
630
631
  try { db.prepare(`CREATE TABLE IF NOT EXISTS communities (id INTEGER PRIMARY KEY, label TEXT, size INTEGER NOT NULL DEFAULT 0, cohesion_score REAL NOT NULL DEFAULT 0.0)`).run(); } catch {}
631
632
 
633
+ // ── Import analyses from stdin (slash-command write-back path) ───────────
634
+ // When Claude Code's /monomind:understand has collected per-file summaries
635
+ // through the active session, it pipes them back via:
636
+ // echo "$ANALYSES_JSON" | node understand-analyze.mjs --import-analyses-stdin
637
+ // The JSON shape: { "analyses": [{ "id": <nodeId>, "fileSummary": "...", "tags": [...], ... }] }
638
+ if (importAnalysesStdin) {
639
+ const stdinText = await new Promise((resolve) => {
640
+ let buf = '';
641
+ process.stdin.setEncoding('utf-8');
642
+ process.stdin.on('data', c => { buf += c; });
643
+ process.stdin.on('end', () => resolve(buf));
644
+ process.stdin.on('error', () => resolve(buf));
645
+ // Bail out after 30 s so the slash command never hangs
646
+ setTimeout(() => resolve(buf), 30000);
647
+ process.stdin.resume();
648
+ });
649
+ let parsed = null;
650
+ try { parsed = JSON.parse(stdinText); } catch {}
651
+ const analyses = (parsed && Array.isArray(parsed.analyses)) ? parsed.analyses : [];
652
+ if (analyses.length === 0) {
653
+ console.error('[understand] --import-analyses-stdin: no analyses found in stdin JSON');
654
+ mg.closeDb(db);
655
+ process.exit(1);
656
+ }
657
+ const updateNode = db.prepare(`UPDATE nodes SET properties = ? WHERE id = ?`);
658
+ let written = 0;
659
+ const tx = db.transaction(() => {
660
+ for (const analysis of analyses) {
661
+ if (!analysis || !analysis.id) continue;
662
+ const existing = (() => {
663
+ try { const row = db.prepare('SELECT properties FROM nodes WHERE id=?').get(analysis.id); return row?.properties ? JSON.parse(row.properties) : {}; } catch { return {}; }
664
+ })();
665
+ const merged = {
666
+ ...existing,
667
+ ...(analysis.fileSummary ? { summary: analysis.fileSummary } : {}),
668
+ ...(analysis.tags ? { tags: analysis.tags } : {}),
669
+ ...(analysis.complexity ? { complexity: analysis.complexity } : {}),
670
+ ...(analysis.functionSummaries ? { functionSummaries: analysis.functionSummaries } : {}),
671
+ ...(analysis.classSummaries ? { classSummaries: analysis.classSummaries } : {}),
672
+ ua_analyzed_at: new Date().toISOString(),
673
+ };
674
+ updateNode.run(JSON.stringify(merged), analysis.id);
675
+ written++;
676
+ }
677
+ });
678
+ tx();
679
+ // Rebuild FTS so summaries are immediately searchable
680
+ try { db.prepare(`INSERT INTO nodes_fts(nodes_fts) VALUES('rebuild')`).run(); } catch {}
681
+ mg.closeDb(db);
682
+ console.log(`[understand] Imported ${written} analyses from stdin. FTS rebuilt.`);
683
+ return;
684
+ }
685
+
632
686
  // ── Load all file nodes ──────────────────────────────────────────────────
633
687
  let fileNodes = db.prepare(`SELECT id, name, file_path, properties FROM nodes WHERE label = 'File' AND file_path IS NOT NULL`).all();
634
688
  console.log(`[understand] Found ${fileNodes.length} file nodes in DB`);