monomind 1.10.27 → 1.10.28

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.
@@ -199,8 +199,7 @@ function _injectCompactGraphMap() {
199
199
  }
200
200
 
201
201
  // 2. Fill remaining slots (up to 8 total) with god nodes (high centrality).
202
- var slotsLeft = 8 - anchors.length;
203
- if (slotsLeft > 0) {
202
+ if (anchors.length < 8) {
204
203
  var gods = db.prepare(
205
204
  "SELECT n.name, n.label, n.file_path, " +
206
205
  "(SELECT COUNT(*) FROM edges WHERE source_id=n.id OR target_id=n.id) AS deg " +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monomind",
3
- "version": "1.10.27",
3
+ "version": "1.10.28",
4
4
  "description": "Monomind - Enterprise AI agent orchestration for Claude Code. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -2174,7 +2174,8 @@ function countEnabledHooks(options) {
2174
2174
  * Searches up to maxDepth directory levels below each search root.
2175
2175
  */
2176
2176
  export function findMonomindProjects(maxDepth = 3) {
2177
- const os = require('os');
2177
+ const esmReq = createRequire(import.meta.url);
2178
+ const os = esmReq('os');
2178
2179
  const home = os.homedir();
2179
2180
  const searchRoots = [
2180
2181
  path.join(home, 'Desktop'),
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monoes/monomindcli",
3
- "version": "1.10.27",
3
+ "version": "1.10.28",
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",
@@ -654,24 +654,44 @@ async function main() {
654
654
  mg.closeDb(db);
655
655
  process.exit(1);
656
656
  }
657
- const updateNode = db.prepare(`UPDATE nodes SET properties = ? WHERE id = ?`);
657
+ // Resolve each analysis item to a DB integer node id.
658
+ // graph.json nodes have id='file:<path>' (synthetic); the real PK is an integer.
659
+ // Accept: analysis.dbId (integer), analysis.filePath, or derive path from analysis.id.
660
+ const lookupByPath = db.prepare(`SELECT id, properties FROM nodes WHERE file_path=? OR file_path=? LIMIT 1`);
661
+ const lookupById = db.prepare(`SELECT id, properties FROM nodes WHERE id=? LIMIT 1`);
662
+ const updateNode = db.prepare(`UPDATE nodes SET properties = ? WHERE id = ?`);
658
663
  let written = 0;
659
664
  const tx = db.transaction(() => {
660
665
  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
- })();
666
+ if (!analysis) continue;
667
+ let nodeRow = null;
668
+ // 1. Prefer explicit integer dbId (added by newer graph.json emitter)
669
+ if (analysis.dbId != null) {
670
+ nodeRow = lookupById.get(analysis.dbId);
671
+ }
672
+ // 2. Fall back to filePath from graph.json node
673
+ if (!nodeRow && analysis.filePath) {
674
+ const rel = analysis.filePath.startsWith('/') ? relative(projectDir, analysis.filePath) : analysis.filePath;
675
+ nodeRow = lookupByPath.get(analysis.filePath, rel);
676
+ }
677
+ // 3. Derive path from synthetic id ('file:<path>')
678
+ if (!nodeRow && analysis.id && String(analysis.id).startsWith('file:')) {
679
+ const derivedPath = String(analysis.id).slice(5);
680
+ const rel = derivedPath.startsWith('/') ? relative(projectDir, derivedPath) : derivedPath;
681
+ nodeRow = lookupByPath.get(derivedPath, rel);
682
+ }
683
+ if (!nodeRow) continue;
684
+ const existing = (() => { try { return nodeRow.properties ? JSON.parse(nodeRow.properties) : {}; } catch { return {}; } })();
665
685
  const merged = {
666
686
  ...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 } : {}),
687
+ ...(analysis.fileSummary ? { summary: analysis.fileSummary } : {}),
688
+ ...(analysis.tags ? { tags: analysis.tags } : {}),
689
+ ...(analysis.complexity ? { complexity: analysis.complexity } : {}),
690
+ ...(analysis.functionSummaries ? { functionSummaries: analysis.functionSummaries } : {}),
691
+ ...(analysis.classSummaries ? { classSummaries: analysis.classSummaries } : {}),
672
692
  ua_analyzed_at: new Date().toISOString(),
673
693
  };
674
- updateNode.run(JSON.stringify(merged), analysis.id);
694
+ updateNode.run(JSON.stringify(merged), nodeRow.id);
675
695
  written++;
676
696
  }
677
697
  });
@@ -1001,6 +1021,7 @@ function buildGraphJson(dir, fileNodes, analysisMap, layers) {
1001
1021
  const a = analysisMap[n.file_path] || {};
1002
1022
  return {
1003
1023
  id: 'file:' + (n.file_path || n.name),
1024
+ dbId: n.id, // integer PK — use this in --import-analyses-stdin payloads
1004
1025
  type: 'file',
1005
1026
  name: n.name,
1006
1027
  filePath: n.file_path,