@monoes/monomindcli 2.0.2 → 2.1.0
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/commands/mastermind/runorg.md +4 -0
- package/.claude/helpers/control-start.cjs +50 -5
- package/.claude/helpers/event-logger.cjs +109 -6
- package/.claude/helpers/graphify-freshen.cjs +19 -17
- package/.claude/helpers/handlers/agent-start-handler.cjs +60 -28
- package/.claude/helpers/handlers/capture-handler.cjs +75 -18
- package/.claude/helpers/handlers/edit-handler.cjs +27 -9
- package/.claude/helpers/handlers/gates-handler.cjs +16 -7
- package/.claude/helpers/handlers/loops-status-handler.cjs +1 -1
- package/.claude/helpers/handlers/route-handler.cjs +4 -4
- package/.claude/helpers/handlers/session-handler.cjs +40 -22
- package/.claude/helpers/handlers/session-restore-handler.cjs +0 -12
- package/.claude/helpers/handlers/task-handler.cjs +53 -22
- package/.claude/helpers/hook-handler.cjs +54 -4
- package/.claude/helpers/intelligence.cjs +94 -15
- package/.claude/helpers/session.cjs +6 -1
- package/.claude/helpers/statusline.cjs +10 -10
- package/.claude/helpers/token-tracker.cjs +3 -3
- package/.claude/helpers/utils/agent-registrations.cjs +41 -0
- package/.claude/helpers/utils/fs-helpers.cjs +183 -0
- package/.claude/helpers/utils/micro-agents.cjs +10 -6
- package/.claude/helpers/utils/telemetry.cjs +35 -19
- package/bin/cli.js +10 -1
- package/dist/src/commands/agent-ops.d.ts.map +1 -1
- package/dist/src/commands/agent-ops.js +9 -15
- package/dist/src/commands/agent-ops.js.map +1 -1
- package/dist/src/commands/cleanup.d.ts.map +1 -1
- package/dist/src/commands/cleanup.js +20 -4
- package/dist/src/commands/cleanup.js.map +1 -1
- package/dist/src/commands/completions.d.ts.map +1 -1
- package/dist/src/commands/completions.js +66 -261
- package/dist/src/commands/completions.js.map +1 -1
- package/dist/src/commands/doctor.d.ts.map +1 -1
- package/dist/src/commands/doctor.js +7 -2
- package/dist/src/commands/doctor.js.map +1 -1
- package/dist/src/commands/hooks-workers.d.ts.map +1 -1
- package/dist/src/commands/hooks-workers.js +7 -0
- package/dist/src/commands/hooks-workers.js.map +1 -1
- package/dist/src/commands/index.d.ts.map +1 -1
- package/dist/src/commands/index.js +3 -0
- package/dist/src/commands/index.js.map +1 -1
- package/dist/src/commands/mcp.d.ts.map +1 -1
- package/dist/src/commands/mcp.js +11 -6
- package/dist/src/commands/mcp.js.map +1 -1
- package/dist/src/commands/memory-admin.d.ts.map +1 -1
- package/dist/src/commands/memory-admin.js +12 -6
- package/dist/src/commands/memory-admin.js.map +1 -1
- package/dist/src/commands/memory-transfer.d.ts.map +1 -1
- package/dist/src/commands/memory-transfer.js +6 -13
- package/dist/src/commands/memory-transfer.js.map +1 -1
- package/dist/src/commands/monograph.js +3 -3
- package/dist/src/commands/monograph.js.map +1 -1
- package/dist/src/commands/org.d.ts +3 -1
- package/dist/src/commands/org.d.ts.map +1 -1
- package/dist/src/commands/org.js +306 -129
- package/dist/src/commands/org.js.map +1 -1
- package/dist/src/commands/start.d.ts.map +1 -1
- package/dist/src/commands/start.js +142 -37
- package/dist/src/commands/start.js.map +1 -1
- package/dist/src/commands/tokens.d.ts.map +1 -1
- package/dist/src/commands/tokens.js +21 -3
- package/dist/src/commands/tokens.js.map +1 -1
- package/dist/src/config-adapter.d.ts.map +1 -1
- package/dist/src/config-adapter.js +37 -17
- package/dist/src/config-adapter.js.map +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +64 -28
- package/dist/src/index.js.map +1 -1
- package/dist/src/init/claudemd-generator.d.ts.map +1 -1
- package/dist/src/init/claudemd-generator.js +44 -11
- package/dist/src/init/claudemd-generator.js.map +1 -1
- package/dist/src/init/executor.d.ts.map +1 -1
- package/dist/src/init/executor.js +63 -49
- package/dist/src/init/executor.js.map +1 -1
- package/dist/src/mcp-client.d.ts +8 -3
- package/dist/src/mcp-client.d.ts.map +1 -1
- package/dist/src/mcp-client.js +37 -3
- package/dist/src/mcp-client.js.map +1 -1
- package/dist/src/mcp-server.d.ts.map +1 -1
- package/dist/src/mcp-server.js +8 -2
- package/dist/src/mcp-server.js.map +1 -1
- package/dist/src/mcp-tools/agent-tools.d.ts +20 -0
- package/dist/src/mcp-tools/agent-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/agent-tools.js +10 -5
- package/dist/src/mcp-tools/agent-tools.js.map +1 -1
- package/dist/src/mcp-tools/github-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/github-tools.js +30 -8
- package/dist/src/mcp-tools/github-tools.js.map +1 -1
- package/dist/src/mcp-tools/graphify-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/graphify-tools.js +11 -2
- package/dist/src/mcp-tools/graphify-tools.js.map +1 -1
- package/dist/src/mcp-tools/hive-mind-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/hive-mind-tools.js +51 -34
- package/dist/src/mcp-tools/hive-mind-tools.js.map +1 -1
- package/dist/src/mcp-tools/knowledge-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/knowledge-tools.js +9 -1
- package/dist/src/mcp-tools/knowledge-tools.js.map +1 -1
- package/dist/src/mcp-tools/monograph-compat.d.ts.map +1 -1
- package/dist/src/mcp-tools/monograph-compat.js +56 -14
- package/dist/src/mcp-tools/monograph-compat.js.map +1 -1
- package/dist/src/mcp-tools/monograph-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/monograph-tools.js +65 -43
- package/dist/src/mcp-tools/monograph-tools.js.map +1 -1
- package/dist/src/mcp-tools/swarm-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/swarm-tools.js +6 -4
- package/dist/src/mcp-tools/swarm-tools.js.map +1 -1
- package/dist/src/mcp-tools/system-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/system-tools.js +4 -4
- package/dist/src/mcp-tools/system-tools.js.map +1 -1
- package/dist/src/mcp-tools/types.d.ts +20 -0
- package/dist/src/mcp-tools/types.d.ts.map +1 -1
- package/dist/src/mcp-tools/types.js +36 -1
- package/dist/src/mcp-tools/types.js.map +1 -1
- package/dist/src/memory/hnsw-operations.d.ts +13 -1
- package/dist/src/memory/hnsw-operations.d.ts.map +1 -1
- package/dist/src/memory/hnsw-operations.js +66 -14
- package/dist/src/memory/hnsw-operations.js.map +1 -1
- package/dist/src/memory/intelligence.d.ts.map +1 -1
- package/dist/src/memory/intelligence.js +99 -3
- package/dist/src/memory/intelligence.js.map +1 -1
- package/dist/src/memory/memory-bridge.d.ts +7 -0
- package/dist/src/memory/memory-bridge.d.ts.map +1 -1
- package/dist/src/memory/memory-bridge.js +20 -0
- package/dist/src/memory/memory-bridge.js.map +1 -1
- package/dist/src/orgrt/broker.d.ts +24 -0
- package/dist/src/orgrt/broker.d.ts.map +1 -0
- package/dist/src/orgrt/broker.js +68 -0
- package/dist/src/orgrt/broker.js.map +1 -0
- package/dist/src/orgrt/daemon.d.ts +30 -0
- package/dist/src/orgrt/daemon.d.ts.map +1 -1
- package/dist/src/orgrt/daemon.js +96 -7
- package/dist/src/orgrt/daemon.js.map +1 -1
- package/dist/src/orgrt/forwarder.d.ts +10 -5
- package/dist/src/orgrt/forwarder.d.ts.map +1 -1
- package/dist/src/orgrt/forwarder.js +105 -8
- package/dist/src/orgrt/forwarder.js.map +1 -1
- package/dist/src/orgrt/live.html +56 -0
- package/dist/src/orgrt/provider.d.ts.map +1 -1
- package/dist/src/orgrt/provider.js +1 -0
- package/dist/src/orgrt/provider.js.map +1 -1
- package/dist/src/orgrt/scheduler.d.ts +13 -0
- package/dist/src/orgrt/scheduler.d.ts.map +1 -0
- package/dist/src/orgrt/scheduler.js +48 -0
- package/dist/src/orgrt/scheduler.js.map +1 -0
- package/dist/src/orgrt/server.d.ts +8 -0
- package/dist/src/orgrt/server.d.ts.map +1 -0
- package/dist/src/orgrt/server.js +72 -0
- package/dist/src/orgrt/server.js.map +1 -0
- package/dist/src/orgrt/test-loop.d.ts +12 -0
- package/dist/src/orgrt/test-loop.d.ts.map +1 -0
- package/dist/src/orgrt/test-loop.js +108 -0
- package/dist/src/orgrt/test-loop.js.map +1 -0
- package/dist/src/output.d.ts.map +1 -1
- package/dist/src/output.js +12 -5
- package/dist/src/output.js.map +1 -1
- package/dist/src/parser.d.ts +32 -0
- package/dist/src/parser.d.ts.map +1 -1
- package/dist/src/parser.js +130 -5
- package/dist/src/parser.js.map +1 -1
- package/dist/src/routing/embed-worker.js +13 -1
- package/dist/src/routing/embed-worker.js.map +1 -1
- package/dist/src/routing/route-layer-factory.d.ts.map +1 -1
- package/dist/src/routing/route-layer-factory.js +31 -0
- package/dist/src/routing/route-layer-factory.js.map +1 -1
- package/dist/src/services/config-file-manager.d.ts +21 -0
- package/dist/src/services/config-file-manager.d.ts.map +1 -1
- package/dist/src/services/config-file-manager.js +60 -7
- package/dist/src/services/config-file-manager.js.map +1 -1
- package/dist/src/services/crash-reporter.d.ts.map +1 -1
- package/dist/src/services/crash-reporter.js +2 -1
- package/dist/src/services/crash-reporter.js.map +1 -1
- package/dist/src/ui/dashboard.html +40 -40
- package/dist/src/ui/orgs.html +110 -11
- package/dist/src/ui/server.mjs +304 -133
- package/dist/src/utils/input-guards.d.ts +9 -0
- package/dist/src/utils/input-guards.d.ts.map +1 -1
- package/dist/src/utils/input-guards.js +39 -5
- package/dist/src/utils/input-guards.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -2
|
@@ -19,23 +19,36 @@ function _isValidDb(p) {
|
|
|
19
19
|
return false;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Resolve the monograph DB path for a given repo root (defaults to project cwd).
|
|
24
|
+
* Falls back to searching up to the git root when the DB isn't directly under
|
|
25
|
+
* `<cwd>/.monomind` — e.g. when called from a subdirectory of the repo. Only
|
|
26
|
+
* the no-arg (project cwd) form is cached; explicit `repoPath` overrides are
|
|
27
|
+
* cheap one-off lookups (staleness checks with a user-supplied path) so caching
|
|
28
|
+
* them isn't worth the invalidation complexity.
|
|
29
|
+
*/
|
|
30
|
+
function getDbPath(repoPathOverride) {
|
|
31
|
+
const cwd = repoPathOverride ?? getProjectCwd();
|
|
32
|
+
const useCache = repoPathOverride === undefined;
|
|
24
33
|
// Invalidate cache when project root changes (e.g. MONOMIND_CWD set after initialize)
|
|
25
|
-
if (_cachedDbPath && _cachedCwd === cwd)
|
|
34
|
+
if (useCache && _cachedDbPath && _cachedCwd === cwd)
|
|
26
35
|
return _cachedDbPath;
|
|
27
|
-
|
|
28
|
-
|
|
36
|
+
if (useCache) {
|
|
37
|
+
_cachedCwd = cwd;
|
|
38
|
+
_cachedDbPath = undefined;
|
|
39
|
+
}
|
|
29
40
|
const direct = join(cwd, '.monomind', 'monograph.db');
|
|
30
41
|
if (_isValidDb(direct)) {
|
|
31
|
-
|
|
42
|
+
if (useCache)
|
|
43
|
+
_cachedDbPath = direct;
|
|
32
44
|
return direct;
|
|
33
45
|
}
|
|
34
46
|
try {
|
|
35
47
|
const root = execSync('git rev-parse --show-toplevel', { cwd, encoding: 'utf8' }).trim();
|
|
36
48
|
const candidate = join(root, '.monomind', 'monograph.db');
|
|
37
49
|
if (_isValidDb(candidate)) {
|
|
38
|
-
|
|
50
|
+
if (useCache)
|
|
51
|
+
_cachedDbPath = candidate;
|
|
39
52
|
return candidate;
|
|
40
53
|
}
|
|
41
54
|
}
|
|
@@ -46,13 +59,6 @@ function getDbPath() {
|
|
|
46
59
|
function text(t) {
|
|
47
60
|
return { content: [{ type: 'text', text: t }] };
|
|
48
61
|
}
|
|
49
|
-
function ensureDbExists() {
|
|
50
|
-
const p = getDbPath();
|
|
51
|
-
if (!_isValidDb(p)) {
|
|
52
|
-
throw new Error(`Monograph index not built yet. Run monograph_build first (path: ${p}).`);
|
|
53
|
-
}
|
|
54
|
-
return p;
|
|
55
|
-
}
|
|
56
62
|
// ── Active watcher registry ──────────────────────────────────────────────────
|
|
57
63
|
const _activeWatchers = new Map();
|
|
58
64
|
function applyPprRerank(db, seedNodes, damping, maxResults) {
|
|
@@ -577,9 +583,13 @@ function taskRelevance(task, nodeText) {
|
|
|
577
583
|
return taskTerms.filter(t => txt.includes(t)).length / taskTerms.length;
|
|
578
584
|
}
|
|
579
585
|
// ── monograph_visualize ───────────────────────────────────────────────────────
|
|
586
|
+
// Columns needed to render/export the graph — deliberately excludes `embedding`,
|
|
587
|
+
// which can be several KB per node (384D vectors) and would otherwise bloat
|
|
588
|
+
// tool-result payloads and written files by many MB.
|
|
589
|
+
const NODE_RENDER_COLUMNS = 'id, label, name, norm_label, file_path, start_line, end_line, community_id, is_exported, language, properties';
|
|
580
590
|
const monographVisualizeTool = {
|
|
581
591
|
name: 'monograph_visualize',
|
|
582
|
-
description: 'Render the knowledge graph as HTML (default), SVG, or JSON.',
|
|
592
|
+
description: 'Render the knowledge graph as HTML (default), SVG, or JSON. Writes output to a file under .monomind/visualize/ and returns the file path (output can be multi-MB at the max node count, too large to return inline).',
|
|
583
593
|
inputSchema: {
|
|
584
594
|
type: 'object',
|
|
585
595
|
properties: {
|
|
@@ -589,6 +599,7 @@ const monographVisualizeTool = {
|
|
|
589
599
|
},
|
|
590
600
|
handler: async (input) => {
|
|
591
601
|
const { openDb, closeDb, toJson, toHtml, toSvg } = await import('@monoes/monograph');
|
|
602
|
+
const { writeFileSync, mkdirSync } = await import('fs');
|
|
592
603
|
const db = openDb(getDbPath());
|
|
593
604
|
try {
|
|
594
605
|
// Cap maxNodes: passed to SQL LIMIT clause for both nodes (n) and edges
|
|
@@ -598,7 +609,7 @@ const monographVisualizeTool = {
|
|
|
598
609
|
const limit = Number.isFinite(rawMaxNodes) && rawMaxNodes > 0
|
|
599
610
|
? Math.min(Math.floor(rawMaxNodes), MAX_EXPORT_NODES)
|
|
600
611
|
: 500;
|
|
601
|
-
const nodes = db.prepare(
|
|
612
|
+
const nodes = db.prepare(`SELECT ${NODE_RENDER_COLUMNS} FROM nodes LIMIT ?`).all(limit);
|
|
602
613
|
// Only include edges where both endpoints are in the visible node set
|
|
603
614
|
const edges = db.prepare(`
|
|
604
615
|
SELECT e.* FROM edges e
|
|
@@ -607,11 +618,15 @@ const monographVisualizeTool = {
|
|
|
607
618
|
LIMIT ?
|
|
608
619
|
`).all(limit, limit, limit * 3);
|
|
609
620
|
const fmt = input.format ?? 'html';
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
621
|
+
const rendered = fmt === 'json' ? toJson(nodes, edges)
|
|
622
|
+
: fmt === 'svg' ? toSvg(nodes, edges)
|
|
623
|
+
: toHtml(nodes, edges);
|
|
624
|
+
const ext = fmt === 'json' ? 'json' : fmt === 'svg' ? 'svg' : 'html';
|
|
625
|
+
const outDir = resolve(join(getProjectCwd(), '.monomind', 'visualize'));
|
|
626
|
+
mkdirSync(outDir, { recursive: true });
|
|
627
|
+
const outPath = join(outDir, `graph-${Date.now()}.${ext}`);
|
|
628
|
+
writeFileSync(outPath, rendered);
|
|
629
|
+
return text(`Visualization written to ${outPath} (${nodes.length} nodes, ${edges.length} edges)${ext === 'html' ? '\nNote: HTML uses the vis-network CDN script and requires network access to render.' : ''}`);
|
|
615
630
|
}
|
|
616
631
|
finally {
|
|
617
632
|
closeDb(db);
|
|
@@ -700,7 +715,8 @@ const monographReportTool = {
|
|
|
700
715
|
return `${i + 1}. **${n.name}** (${n.label}) — degree ${n.degree}${loc ? ` \`${loc}\`` : ''}`;
|
|
701
716
|
}),
|
|
702
717
|
].join('\n');
|
|
703
|
-
const
|
|
718
|
+
const rawOutPath = input.path ?? join(getProjectCwd(), '.monomind', 'GRAPH_REPORT.md');
|
|
719
|
+
const outPath = resolve(getProjectCwd(), rawOutPath);
|
|
704
720
|
const allowedRoot = resolve(getProjectCwd());
|
|
705
721
|
if (outPath !== allowedRoot && !outPath.startsWith(allowedRoot + sep)) {
|
|
706
722
|
return text(`Error: path must be within the project directory (${allowedRoot})`);
|
|
@@ -725,7 +741,10 @@ let _buildInProgress = false;
|
|
|
725
741
|
async function computeCommitsBehind(repoPath) {
|
|
726
742
|
const { openDb, closeDb } = await import('@monoes/monograph');
|
|
727
743
|
const { execSync } = await import('child_process');
|
|
728
|
-
const
|
|
744
|
+
const dbPath = getDbPath(repoPath);
|
|
745
|
+
if (!_isValidDb(dbPath))
|
|
746
|
+
return null;
|
|
747
|
+
const db = openDb(dbPath, { fileMustExist: true });
|
|
729
748
|
try {
|
|
730
749
|
const meta = db.prepare("SELECT value FROM index_meta WHERE key = 'last_commit_hash'").get() ?? db.prepare("SELECT value FROM index_meta WHERE key = 'lastCommit'").get();
|
|
731
750
|
const lastCommit = meta?.value ?? null;
|
|
@@ -929,11 +948,13 @@ const monographExportTool = {
|
|
|
929
948
|
const { writeFileSync, mkdirSync } = await import('fs');
|
|
930
949
|
const db = openDb(getDbPath());
|
|
931
950
|
try {
|
|
932
|
-
|
|
951
|
+
// Exclude `embedding` — a several-KB-per-node vector column that would
|
|
952
|
+
// otherwise bloat exported files by many MB for no rendering benefit.
|
|
953
|
+
const nodes = db.prepare(`SELECT ${NODE_RENDER_COLUMNS} FROM nodes`).all();
|
|
933
954
|
const edges = db.prepare('SELECT * FROM edges').all();
|
|
934
955
|
const fmt = input.format;
|
|
935
956
|
const requestedOut = input.outputPath ?? join(getProjectCwd(), '.monomind', 'export');
|
|
936
|
-
const outDir = resolve(requestedOut);
|
|
957
|
+
const outDir = resolve(getProjectCwd(), requestedOut);
|
|
937
958
|
const allowedRoot = resolve(getProjectCwd());
|
|
938
959
|
if (outDir !== allowedRoot && !outDir.startsWith(allowedRoot + sep)) {
|
|
939
960
|
return text(`Error: outputPath must be within the project directory (${allowedRoot})`);
|
|
@@ -1072,8 +1093,10 @@ const monographImpactTool = {
|
|
|
1072
1093
|
const impactPath = typeof rawImpactPath === 'string' && rawImpactPath.length > MAX_IMPACT_PATH_LEN
|
|
1073
1094
|
? rawImpactPath.slice(0, MAX_IMPACT_PATH_LEN) : rawImpactPath;
|
|
1074
1095
|
const rawDepth = input.depth;
|
|
1075
|
-
const depth =
|
|
1076
|
-
?
|
|
1096
|
+
const depth = rawDepth === undefined
|
|
1097
|
+
? undefined
|
|
1098
|
+
: (typeof rawDepth === 'number' && Number.isFinite(rawDepth) && rawDepth > 0
|
|
1099
|
+
? Math.min(Math.floor(rawDepth), 6) : 3);
|
|
1077
1100
|
const result = getMonographImpact(db, {
|
|
1078
1101
|
name: impactName,
|
|
1079
1102
|
filePath: impactPath,
|
|
@@ -1737,10 +1760,10 @@ const monographInstallSkillsTool = {
|
|
|
1737
1760
|
return text(`Invalid platform "${platform}". Must be one of: ${validPlatforms.join(', ')}`);
|
|
1738
1761
|
}
|
|
1739
1762
|
// Load community data from graph
|
|
1740
|
-
const dbPath =
|
|
1763
|
+
const dbPath = getDbPath(repoPath);
|
|
1741
1764
|
let db;
|
|
1742
1765
|
try {
|
|
1743
|
-
db = openDb(dbPath);
|
|
1766
|
+
db = openDb(dbPath, { fileMustExist: true });
|
|
1744
1767
|
}
|
|
1745
1768
|
catch {
|
|
1746
1769
|
return text('Graph not built yet. Run monograph_build first.');
|
|
@@ -1846,21 +1869,19 @@ const monographListReposTool = {
|
|
|
1846
1869
|
// ── monograph_group_contracts ─────────────────────────────────────────────────
|
|
1847
1870
|
const monographGroupContractsTool = {
|
|
1848
1871
|
name: 'monograph_group_contracts',
|
|
1849
|
-
description: 'List public API contracts (exported symbols, interfaces, and types) for all groups defined in .
|
|
1872
|
+
description: 'List public API contracts (exported symbols, interfaces, and types) for all groups defined in group.yaml.',
|
|
1850
1873
|
inputSchema: {
|
|
1851
1874
|
type: 'object',
|
|
1852
1875
|
properties: {
|
|
1853
|
-
|
|
1876
|
+
configPath: { type: 'string', description: 'Path to group.yaml (defaults to group.yaml in project cwd)' },
|
|
1854
1877
|
},
|
|
1855
1878
|
},
|
|
1856
1879
|
handler: async (input) => {
|
|
1857
1880
|
const { getGroupContracts } = await import('./monograph-compat.js');
|
|
1858
|
-
const
|
|
1859
|
-
const repoPath = input.repoPath ?? getProjectCwd();
|
|
1860
|
-
const configPath = join(repoPath, '.monograph', 'groups.json');
|
|
1881
|
+
const configPath = input.configPath ?? join(getProjectCwd(), 'group.yaml');
|
|
1861
1882
|
const contracts = await getGroupContracts(configPath);
|
|
1862
1883
|
if (contracts.length === 0)
|
|
1863
|
-
return text(
|
|
1884
|
+
return text(`No contracts found. Ensure groups are defined in ${configPath}.`);
|
|
1864
1885
|
const lines = contracts.map(c => `[${c.groupName}] ${c.symbol} — ${c.filePath}:${c.line}`);
|
|
1865
1886
|
return text(lines.join('\n'));
|
|
1866
1887
|
},
|
|
@@ -1872,14 +1893,12 @@ const monographGroupStatusTool = {
|
|
|
1872
1893
|
inputSchema: {
|
|
1873
1894
|
type: 'object',
|
|
1874
1895
|
properties: {
|
|
1875
|
-
|
|
1896
|
+
configPath: { type: 'string', description: 'Path to group.yaml (defaults to group.yaml in project cwd)' },
|
|
1876
1897
|
},
|
|
1877
1898
|
},
|
|
1878
1899
|
handler: async (input) => {
|
|
1879
1900
|
const { getGroupStatus } = await import('./monograph-compat.js');
|
|
1880
|
-
const
|
|
1881
|
-
const repoPath = input.repoPath ?? getProjectCwd();
|
|
1882
|
-
const configPath = join(repoPath, '.monograph', 'groups.json');
|
|
1901
|
+
const configPath = input.configPath ?? join(getProjectCwd(), 'group.yaml');
|
|
1883
1902
|
const status = await getGroupStatus(configPath);
|
|
1884
1903
|
const lines = [`Groups: ${status.totalGroups} (${status.indexedGroups} indexed, ${status.stalledGroups} stalled)`];
|
|
1885
1904
|
for (const g of status.groups) {
|
|
@@ -1954,10 +1973,10 @@ const monographDeadCodeTool = {
|
|
|
1954
1973
|
const repoPath = input.path ?? getProjectCwd();
|
|
1955
1974
|
const cats = input.categories ?? ['dead-functions', 'orphan-files', 'stale-dist'];
|
|
1956
1975
|
const result = {};
|
|
1957
|
-
const dbPath =
|
|
1976
|
+
const dbPath = getDbPath(repoPath);
|
|
1958
1977
|
let db = null;
|
|
1959
1978
|
try {
|
|
1960
|
-
db = openDb(dbPath);
|
|
1979
|
+
db = openDb(dbPath, { fileMustExist: true });
|
|
1961
1980
|
}
|
|
1962
1981
|
catch {
|
|
1963
1982
|
return text(JSON.stringify({ error: 'No monograph index found. Run monograph_build first.' }));
|
|
@@ -1997,9 +2016,12 @@ const monographDeadCodeTool = {
|
|
|
1997
2016
|
FROM nodes n
|
|
1998
2017
|
WHERE n.label = 'File'
|
|
1999
2018
|
AND (SELECT COUNT(*) FROM edges e WHERE e.target_id = n.id AND e.relation = 'IMPORTS') = 0
|
|
2000
|
-
AND n.file_path NOT LIKE '
|
|
2019
|
+
AND n.file_path NOT LIKE '%/test/%'
|
|
2020
|
+
AND n.file_path NOT LIKE '%/tests/%'
|
|
2021
|
+
AND n.file_path NOT LIKE '%.test.%'
|
|
2001
2022
|
AND n.file_path NOT LIKE '%__tests__%'
|
|
2002
|
-
AND n.file_path NOT LIKE '
|
|
2023
|
+
AND n.file_path NOT LIKE '%/spec/%'
|
|
2024
|
+
AND n.file_path NOT LIKE '%.spec.%'
|
|
2003
2025
|
AND n.file_path NOT LIKE '%/index.%'
|
|
2004
2026
|
AND n.file_path NOT LIKE 'bin/%'
|
|
2005
2027
|
AND n.file_path NOT LIKE 'scripts/%'
|