@monoes/cli 1.1.0 → 1.2.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.
|
@@ -655,6 +655,7 @@ const skillsCommand = {
|
|
|
655
655
|
mcp: false,
|
|
656
656
|
runtime: false,
|
|
657
657
|
claudeMd: false,
|
|
658
|
+
graphify: false,
|
|
658
659
|
},
|
|
659
660
|
skills: {
|
|
660
661
|
all: ctx.flags.all,
|
|
@@ -706,6 +707,7 @@ const hooksCommand = {
|
|
|
706
707
|
mcp: false,
|
|
707
708
|
runtime: false,
|
|
708
709
|
claudeMd: false,
|
|
710
|
+
graphify: false,
|
|
709
711
|
},
|
|
710
712
|
hooks: minimal
|
|
711
713
|
? {
|
|
@@ -283,6 +283,10 @@ export async function executeInit(options) {
|
|
|
283
283
|
}
|
|
284
284
|
// Count enabled hooks
|
|
285
285
|
result.summary.hooksEnabled = countEnabledHooks(options);
|
|
286
|
+
// Build knowledge graph in background (non-blocking)
|
|
287
|
+
if (options.components.graphify) {
|
|
288
|
+
await initKnowledgeGraph(targetDir, result);
|
|
289
|
+
}
|
|
286
290
|
}
|
|
287
291
|
catch (error) {
|
|
288
292
|
result.success = false;
|
|
@@ -290,6 +294,38 @@ export async function executeInit(options) {
|
|
|
290
294
|
}
|
|
291
295
|
return result;
|
|
292
296
|
}
|
|
297
|
+
/**
|
|
298
|
+
* Spawn a background process to build the @monobrain/graph knowledge graph.
|
|
299
|
+
* Fire-and-forget: init does not wait for the graph build to complete.
|
|
300
|
+
* Non-fatal: if @monobrain/graph is unavailable the step is simply skipped.
|
|
301
|
+
*/
|
|
302
|
+
async function initKnowledgeGraph(targetDir, result) {
|
|
303
|
+
try {
|
|
304
|
+
await import('@monoes/graph');
|
|
305
|
+
const outputDir = path.join(targetDir, '.monobrain', 'graph');
|
|
306
|
+
const { spawn } = await import('child_process');
|
|
307
|
+
const safePath = targetDir.replace(/'/g, "\\'");
|
|
308
|
+
const safeOut = outputDir.replace(/'/g, "\\'");
|
|
309
|
+
const script = `
|
|
310
|
+
import('@monoes/graph').then(({ buildGraph }) =>
|
|
311
|
+
buildGraph('${safePath}', { codeOnly: true, outputDir: '${safeOut}' })
|
|
312
|
+
).then(r => console.log('[graph] built: ' + r.analysis.stats.nodes + ' nodes'))
|
|
313
|
+
.catch(e => console.error('[graph] build failed:', e.message));
|
|
314
|
+
`;
|
|
315
|
+
const child = spawn(process.execPath, ['--input-type=module'], {
|
|
316
|
+
stdio: ['pipe', 'ignore', 'ignore'],
|
|
317
|
+
detached: true,
|
|
318
|
+
cwd: targetDir,
|
|
319
|
+
});
|
|
320
|
+
child.stdin?.write(script);
|
|
321
|
+
child.stdin?.end();
|
|
322
|
+
child.unref();
|
|
323
|
+
result.created.files.push('.monobrain/graph/ (knowledge graph building in background)');
|
|
324
|
+
}
|
|
325
|
+
catch (_err) {
|
|
326
|
+
result.skipped.push('knowledge graph: @monobrain/graph not available');
|
|
327
|
+
}
|
|
328
|
+
}
|
|
293
329
|
/**
|
|
294
330
|
* Merge new settings into existing settings.json
|
|
295
331
|
* Preserves user customizations while adding new features like Agent Teams
|
package/dist/src/init/types.js
CHANGED
|
@@ -56,6 +56,7 @@ export const DEFAULT_INIT_OPTIONS = {
|
|
|
56
56
|
mcp: true,
|
|
57
57
|
runtime: true,
|
|
58
58
|
claudeMd: true,
|
|
59
|
+
graphify: true,
|
|
59
60
|
},
|
|
60
61
|
hooks: {
|
|
61
62
|
preToolUse: true,
|
|
@@ -118,6 +119,7 @@ export const DEFAULT_INIT_OPTIONS = {
|
|
|
118
119
|
monobrain: true,
|
|
119
120
|
ruvSwarm: false,
|
|
120
121
|
flowNexus: false,
|
|
122
|
+
graphify: false,
|
|
121
123
|
autoStart: false,
|
|
122
124
|
port: 3000,
|
|
123
125
|
},
|
|
@@ -156,6 +158,7 @@ export const MINIMAL_INIT_OPTIONS = {
|
|
|
156
158
|
mcp: true,
|
|
157
159
|
runtime: true,
|
|
158
160
|
claudeMd: true,
|
|
161
|
+
graphify: false,
|
|
159
162
|
},
|
|
160
163
|
hooks: {
|
|
161
164
|
...DEFAULT_INIT_OPTIONS.hooks,
|
|
@@ -224,6 +227,7 @@ export const FULL_INIT_OPTIONS = {
|
|
|
224
227
|
mcp: true,
|
|
225
228
|
runtime: true,
|
|
226
229
|
claudeMd: true,
|
|
230
|
+
graphify: true,
|
|
227
231
|
},
|
|
228
232
|
skills: {
|
|
229
233
|
core: true,
|
|
@@ -247,6 +251,7 @@ export const FULL_INIT_OPTIONS = {
|
|
|
247
251
|
monobrain: true,
|
|
248
252
|
ruvSwarm: true,
|
|
249
253
|
flowNexus: true,
|
|
254
|
+
graphify: false,
|
|
250
255
|
autoStart: false,
|
|
251
256
|
port: 3000,
|
|
252
257
|
},
|