@monoes/monomindcli 1.10.26 → 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.
- package/.claude/helpers/hook-handler.cjs +126 -17
- package/dist/src/commands/init.d.ts.map +1 -1
- package/dist/src/commands/init.js +48 -1
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/init/executor.d.ts +6 -0
- package/dist/src/init/executor.d.ts.map +1 -1
- package/dist/src/init/executor.js +61 -0
- package/dist/src/init/executor.js.map +1 -1
- package/dist/src/init/index.d.ts +1 -1
- package/dist/src/init/index.d.ts.map +1 -1
- package/dist/src/init/index.js +1 -1
- package/dist/src/init/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/scripts/understand-analyze.mjs +80 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monoes/monomindcli",
|
|
3
|
-
"version": "1.10.
|
|
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",
|
|
@@ -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
|
|
52
|
-
const noLlm
|
|
53
|
-
const layersOnly
|
|
54
|
-
const incremental
|
|
55
|
-
const
|
|
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,79 @@ 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
|
+
// 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 = ?`);
|
|
663
|
+
let written = 0;
|
|
664
|
+
const tx = db.transaction(() => {
|
|
665
|
+
for (const analysis of analyses) {
|
|
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 {}; } })();
|
|
685
|
+
const merged = {
|
|
686
|
+
...existing,
|
|
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 } : {}),
|
|
692
|
+
ua_analyzed_at: new Date().toISOString(),
|
|
693
|
+
};
|
|
694
|
+
updateNode.run(JSON.stringify(merged), nodeRow.id);
|
|
695
|
+
written++;
|
|
696
|
+
}
|
|
697
|
+
});
|
|
698
|
+
tx();
|
|
699
|
+
// Rebuild FTS so summaries are immediately searchable
|
|
700
|
+
try { db.prepare(`INSERT INTO nodes_fts(nodes_fts) VALUES('rebuild')`).run(); } catch {}
|
|
701
|
+
mg.closeDb(db);
|
|
702
|
+
console.log(`[understand] Imported ${written} analyses from stdin. FTS rebuilt.`);
|
|
703
|
+
return;
|
|
704
|
+
}
|
|
705
|
+
|
|
632
706
|
// ── Load all file nodes ──────────────────────────────────────────────────
|
|
633
707
|
let fileNodes = db.prepare(`SELECT id, name, file_path, properties FROM nodes WHERE label = 'File' AND file_path IS NOT NULL`).all();
|
|
634
708
|
console.log(`[understand] Found ${fileNodes.length} file nodes in DB`);
|
|
@@ -947,6 +1021,7 @@ function buildGraphJson(dir, fileNodes, analysisMap, layers) {
|
|
|
947
1021
|
const a = analysisMap[n.file_path] || {};
|
|
948
1022
|
return {
|
|
949
1023
|
id: 'file:' + (n.file_path || n.name),
|
|
1024
|
+
dbId: n.id, // integer PK — use this in --import-analyses-stdin payloads
|
|
950
1025
|
type: 'file',
|
|
951
1026
|
name: n.name,
|
|
952
1027
|
filePath: n.file_path,
|