@monoes/cli 1.2.2 → 1.2.3
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.
|
@@ -138,10 +138,16 @@ export const graphifyBuildTool = {
|
|
|
138
138
|
return {
|
|
139
139
|
success: true,
|
|
140
140
|
graphPath: result.graphPath,
|
|
141
|
+
reportPath: result.reportPath,
|
|
141
142
|
filesProcessed: result.filesProcessed,
|
|
143
|
+
fromCache: result.fromCache,
|
|
142
144
|
nodes: result.analysis.stats.nodes,
|
|
143
145
|
edges: result.analysis.stats.edges,
|
|
144
|
-
|
|
146
|
+
communities: result.analysis.stats.communities,
|
|
147
|
+
graphQuality: result.graphQuality,
|
|
148
|
+
experimentStatus: result.experimentStatus,
|
|
149
|
+
corpusWarnings: result.corpusWarnings,
|
|
150
|
+
message: `[${result.experimentStatus}] Knowledge graph built — quality=${result.graphQuality.toFixed(4)} (${result.analysis.stats.nodes}n/${result.analysis.stats.edges}e/${result.analysis.stats.communities}c)`,
|
|
145
151
|
};
|
|
146
152
|
}
|
|
147
153
|
catch (err) {
|
|
@@ -1017,6 +1023,127 @@ export const graphifyWatchStopTool = {
|
|
|
1017
1023
|
}
|
|
1018
1024
|
},
|
|
1019
1025
|
};
|
|
1026
|
+
/**
|
|
1027
|
+
* Read the GRAPH_REPORT.md generated during the last build.
|
|
1028
|
+
*/
|
|
1029
|
+
export const graphifyReportTool = {
|
|
1030
|
+
name: 'graphify_report',
|
|
1031
|
+
description: 'Read the GRAPH_REPORT.md generated by the last graphify_build. ' +
|
|
1032
|
+
'Returns the full markdown audit trail: corpus check, god nodes, surprising connections, ' +
|
|
1033
|
+
'communities, ambiguous edges, knowledge gaps, and suggested questions.',
|
|
1034
|
+
category: 'graphify',
|
|
1035
|
+
tags: ['knowledge-graph', 'report', 'audit'],
|
|
1036
|
+
inputSchema: {
|
|
1037
|
+
type: 'object',
|
|
1038
|
+
properties: {
|
|
1039
|
+
path: {
|
|
1040
|
+
type: 'string',
|
|
1041
|
+
description: 'Project path (defaults to current project root)',
|
|
1042
|
+
},
|
|
1043
|
+
},
|
|
1044
|
+
},
|
|
1045
|
+
handler: async (params) => {
|
|
1046
|
+
const cwd = getProjectCwd();
|
|
1047
|
+
const targetPath = params.path || cwd;
|
|
1048
|
+
const reportPath = resolve(join(targetPath, '.monobrain', 'graph', 'GRAPH_REPORT.md'));
|
|
1049
|
+
if (!existsSync(reportPath)) {
|
|
1050
|
+
return {
|
|
1051
|
+
error: true,
|
|
1052
|
+
message: 'No report found. Run graphify_build first.',
|
|
1053
|
+
hint: `Expected: ${reportPath}`,
|
|
1054
|
+
};
|
|
1055
|
+
}
|
|
1056
|
+
try {
|
|
1057
|
+
const content = readFileSync(reportPath, 'utf-8');
|
|
1058
|
+
return { success: true, reportPath, content };
|
|
1059
|
+
}
|
|
1060
|
+
catch (err) {
|
|
1061
|
+
return { error: true, message: String(err) };
|
|
1062
|
+
}
|
|
1063
|
+
},
|
|
1064
|
+
};
|
|
1065
|
+
/**
|
|
1066
|
+
* Suggest questions the knowledge graph can answer about the codebase.
|
|
1067
|
+
*/
|
|
1068
|
+
export const graphifySuggestTool = {
|
|
1069
|
+
name: 'graphify_suggest',
|
|
1070
|
+
description: 'Return a prioritised list of questions this knowledge graph is uniquely ' +
|
|
1071
|
+
'positioned to answer — e.g. bridge nodes between subsystems, god nodes worth investigating, ' +
|
|
1072
|
+
'isolated components with no connections, and low-cohesion communities. ' +
|
|
1073
|
+
'Use after graphify_build to guide architectural analysis.',
|
|
1074
|
+
category: 'graphify',
|
|
1075
|
+
tags: ['knowledge-graph', 'questions', 'analysis'],
|
|
1076
|
+
inputSchema: {
|
|
1077
|
+
type: 'object',
|
|
1078
|
+
properties: {
|
|
1079
|
+
path: {
|
|
1080
|
+
type: 'string',
|
|
1081
|
+
description: 'Project path (defaults to current project root)',
|
|
1082
|
+
},
|
|
1083
|
+
},
|
|
1084
|
+
},
|
|
1085
|
+
handler: async (params) => {
|
|
1086
|
+
const cwd = getProjectCwd();
|
|
1087
|
+
const targetPath = params.path || cwd;
|
|
1088
|
+
if (!graphExists(targetPath)) {
|
|
1089
|
+
return { error: true, message: 'No graph found. Run graphify_build first.' };
|
|
1090
|
+
}
|
|
1091
|
+
try {
|
|
1092
|
+
const { loadGraph, suggestQuestions, buildAnalysis, buildGraphologyGraph } = await import('@monoes/graph');
|
|
1093
|
+
const graphPath = getGraphPath(targetPath);
|
|
1094
|
+
const outputDir = resolve(join(targetPath, '.monobrain', 'graph'));
|
|
1095
|
+
const raw = loadGraph(graphPath);
|
|
1096
|
+
const graph = buildGraphologyGraph({ nodes: raw.nodes, edges: raw.edges, hyperedges: [], filesProcessed: 0, fromCache: 0, errors: [] });
|
|
1097
|
+
const analysis = buildAnalysis(graph, outputDir);
|
|
1098
|
+
const questions = suggestQuestions(graph, analysis.communities);
|
|
1099
|
+
return { success: true, questions, total: questions.length };
|
|
1100
|
+
}
|
|
1101
|
+
catch (err) {
|
|
1102
|
+
return { error: true, message: String(err) };
|
|
1103
|
+
}
|
|
1104
|
+
},
|
|
1105
|
+
};
|
|
1106
|
+
/**
|
|
1107
|
+
* Run a corpus health check on the project files.
|
|
1108
|
+
*/
|
|
1109
|
+
export const graphifyHealthTool = {
|
|
1110
|
+
name: 'graphify_health',
|
|
1111
|
+
description: 'Run a corpus health check on the project directory — warns when the codebase ' +
|
|
1112
|
+
'is too small for graph analysis, too large to be useful, security-sensitive files were ' +
|
|
1113
|
+
'found, or when the doc-to-code ratio is skewed. Run before graphify_build to catch issues early.',
|
|
1114
|
+
category: 'graphify',
|
|
1115
|
+
tags: ['knowledge-graph', 'health', 'corpus'],
|
|
1116
|
+
inputSchema: {
|
|
1117
|
+
type: 'object',
|
|
1118
|
+
properties: {
|
|
1119
|
+
path: {
|
|
1120
|
+
type: 'string',
|
|
1121
|
+
description: 'Project path (defaults to current project root)',
|
|
1122
|
+
},
|
|
1123
|
+
},
|
|
1124
|
+
},
|
|
1125
|
+
handler: async (params) => {
|
|
1126
|
+
const cwd = getProjectCwd();
|
|
1127
|
+
const targetPath = params.path || cwd;
|
|
1128
|
+
try {
|
|
1129
|
+
const { collectFiles, corpusHealth } = await import('@monoes/graph');
|
|
1130
|
+
const files = collectFiles(targetPath);
|
|
1131
|
+
const warnings = corpusHealth(files);
|
|
1132
|
+
return {
|
|
1133
|
+
success: true,
|
|
1134
|
+
totalFiles: files.length,
|
|
1135
|
+
warnings,
|
|
1136
|
+
healthy: warnings.length === 0,
|
|
1137
|
+
message: warnings.length === 0
|
|
1138
|
+
? `Corpus looks healthy (${files.length} files).`
|
|
1139
|
+
: `${warnings.length} warning(s) found.`,
|
|
1140
|
+
};
|
|
1141
|
+
}
|
|
1142
|
+
catch (err) {
|
|
1143
|
+
return { error: true, message: String(err) };
|
|
1144
|
+
}
|
|
1145
|
+
},
|
|
1146
|
+
};
|
|
1020
1147
|
// ── Exports ───────────────────────────────────────────────────────────────────
|
|
1021
1148
|
export const graphifyTools = [
|
|
1022
1149
|
graphifyBuildTool,
|
|
@@ -1030,6 +1157,9 @@ export const graphifyTools = [
|
|
|
1030
1157
|
graphifyVisualizeTool,
|
|
1031
1158
|
graphifyWatchTool,
|
|
1032
1159
|
graphifyWatchStopTool,
|
|
1160
|
+
graphifyReportTool,
|
|
1161
|
+
graphifySuggestTool,
|
|
1162
|
+
graphifyHealthTool,
|
|
1033
1163
|
];
|
|
1034
1164
|
export default graphifyTools;
|
|
1035
1165
|
//# sourceMappingURL=graphify-tools.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monoes/cli",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Monobrain 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",
|