ruvector 0.1.77 → 0.1.79

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/bin/cli.js CHANGED
@@ -6123,8 +6123,233 @@ workersCmd.command('cancel')
6123
6123
  }
6124
6124
  });
6125
6125
 
6126
+ // Custom Worker System (agentic-flow@alpha.39+)
6127
+ workersCmd.command('presets')
6128
+ .description('List available worker presets (quick-scan, deep-analysis, security-scan, etc.)')
6129
+ .action(async () => {
6130
+ try {
6131
+ await runAgenticFlow(['workers', 'presets']);
6132
+ } catch (e) {
6133
+ console.error(chalk.red('Presets list failed:'), e.message);
6134
+ }
6135
+ });
6136
+
6137
+ workersCmd.command('phases')
6138
+ .description('List available phase executors (24 phases: file-discovery, security-analysis, etc.)')
6139
+ .action(async () => {
6140
+ try {
6141
+ await runAgenticFlow(['workers', 'phases']);
6142
+ } catch (e) {
6143
+ console.error(chalk.red('Phases list failed:'), e.message);
6144
+ }
6145
+ });
6146
+
6147
+ workersCmd.command('create')
6148
+ .description('Create a custom worker from preset')
6149
+ .argument('<name>', 'Worker name')
6150
+ .option('--preset <preset>', 'Base preset (quick-scan, deep-analysis, security-scan, learning, api-docs, test-analysis)')
6151
+ .option('--triggers <triggers>', 'Comma-separated trigger keywords')
6152
+ .action(async (name, opts) => {
6153
+ try {
6154
+ const args = ['workers', 'create', name];
6155
+ if (opts.preset) args.push('--preset', opts.preset);
6156
+ if (opts.triggers) args.push('--triggers', opts.triggers);
6157
+ await runAgenticFlow(args);
6158
+ } catch (e) {
6159
+ console.error(chalk.red('Worker creation failed:'), e.message);
6160
+ }
6161
+ });
6162
+
6163
+ workersCmd.command('run')
6164
+ .description('Run a custom worker')
6165
+ .argument('<name>', 'Worker name')
6166
+ .option('--path <path>', 'Target path to analyze', '.')
6167
+ .action(async (name, opts) => {
6168
+ try {
6169
+ const args = ['workers', 'run', name];
6170
+ if (opts.path) args.push('--path', opts.path);
6171
+ await runAgenticFlow(args);
6172
+ } catch (e) {
6173
+ console.error(chalk.red('Worker run failed:'), e.message);
6174
+ }
6175
+ });
6176
+
6177
+ workersCmd.command('custom')
6178
+ .description('List registered custom workers')
6179
+ .action(async () => {
6180
+ try {
6181
+ await runAgenticFlow(['workers', 'custom']);
6182
+ } catch (e) {
6183
+ console.error(chalk.red('Custom workers list failed:'), e.message);
6184
+ }
6185
+ });
6186
+
6187
+ workersCmd.command('init-config')
6188
+ .description('Generate example workers.yaml config file')
6189
+ .option('--force', 'Overwrite existing config')
6190
+ .action(async (opts) => {
6191
+ try {
6192
+ const args = ['workers', 'init-config'];
6193
+ if (opts.force) args.push('--force');
6194
+ await runAgenticFlow(args);
6195
+ } catch (e) {
6196
+ console.error(chalk.red('Config init failed:'), e.message);
6197
+ }
6198
+ });
6199
+
6200
+ workersCmd.command('load-config')
6201
+ .description('Load custom workers from workers.yaml')
6202
+ .option('--file <file>', 'Config file path', 'workers.yaml')
6203
+ .action(async (opts) => {
6204
+ try {
6205
+ const args = ['workers', 'load-config'];
6206
+ if (opts.file !== 'workers.yaml') args.push('--file', opts.file);
6207
+ await runAgenticFlow(args);
6208
+ } catch (e) {
6209
+ console.error(chalk.red('Config load failed:'), e.message);
6210
+ }
6211
+ });
6212
+
6126
6213
  console.log && false; // Force registration
6127
6214
 
6215
+ // Native Workers command group - Deep ruvector integration (no agentic-flow delegation)
6216
+ const nativeCmd = program.command('native').description('Native workers with deep ONNX/VectorDB integration (no external deps)');
6217
+
6218
+ nativeCmd.command('run')
6219
+ .description('Run a native worker type')
6220
+ .argument('<type>', 'Worker type: security, analysis, learning')
6221
+ .option('--path <path>', 'Target path to analyze', '.')
6222
+ .option('--json', 'Output as JSON')
6223
+ .action(async (type, opts) => {
6224
+ try {
6225
+ const { createSecurityWorker, createAnalysisWorker, createLearningWorker } = require('../dist/workers/native-worker.js');
6226
+
6227
+ let worker;
6228
+ switch (type) {
6229
+ case 'security':
6230
+ worker = createSecurityWorker();
6231
+ break;
6232
+ case 'analysis':
6233
+ worker = createAnalysisWorker();
6234
+ break;
6235
+ case 'learning':
6236
+ worker = createLearningWorker();
6237
+ break;
6238
+ default:
6239
+ console.error(chalk.red(`Unknown worker type: ${type}`));
6240
+ console.log(chalk.dim('Available types: security, analysis, learning'));
6241
+ return;
6242
+ }
6243
+
6244
+ console.log(chalk.cyan(`\n🔧 Running native ${type} worker on ${opts.path}...\n`));
6245
+ const result = await worker.run(opts.path);
6246
+
6247
+ if (opts.json) {
6248
+ console.log(JSON.stringify(result, null, 2));
6249
+ } else {
6250
+ console.log(chalk.bold(`Worker: ${result.worker}`));
6251
+ console.log(chalk.dim(`Status: ${result.success ? chalk.green('✓ Success') : chalk.red('✗ Failed')}`));
6252
+ console.log(chalk.dim(`Time: ${result.totalTimeMs.toFixed(0)}ms\n`));
6253
+
6254
+ console.log(chalk.bold('Phases:'));
6255
+ for (const phase of result.phases) {
6256
+ const status = phase.success ? chalk.green('✓') : chalk.red('✗');
6257
+ console.log(` ${status} ${phase.phase} (${phase.timeMs.toFixed(0)}ms)`);
6258
+ if (phase.data) {
6259
+ const dataStr = JSON.stringify(phase.data);
6260
+ if (dataStr.length < 100) {
6261
+ console.log(chalk.dim(` ${dataStr}`));
6262
+ }
6263
+ }
6264
+ }
6265
+
6266
+ if (result.summary) {
6267
+ console.log(chalk.bold('\nSummary:'));
6268
+ console.log(` Files analyzed: ${result.summary.filesAnalyzed}`);
6269
+ console.log(` Patterns found: ${result.summary.patternsFound}`);
6270
+ console.log(` Embeddings: ${result.summary.embeddingsGenerated}`);
6271
+ console.log(` Vectors stored: ${result.summary.vectorsStored}`);
6272
+
6273
+ if (result.summary.findings.length > 0) {
6274
+ console.log(chalk.bold('\nFindings:'));
6275
+ const byType = { info: 0, warning: 0, error: 0, security: 0 };
6276
+ result.summary.findings.forEach(f => byType[f.type]++);
6277
+ if (byType.security > 0) console.log(chalk.red(` 🔒 Security: ${byType.security}`));
6278
+ if (byType.error > 0) console.log(chalk.red(` ❌ Errors: ${byType.error}`));
6279
+ if (byType.warning > 0) console.log(chalk.yellow(` ⚠️ Warnings: ${byType.warning}`));
6280
+ if (byType.info > 0) console.log(chalk.blue(` ℹ️ Info: ${byType.info}`));
6281
+
6282
+ // Show top findings
6283
+ console.log(chalk.dim('\nTop findings:'));
6284
+ result.summary.findings.slice(0, 5).forEach(f => {
6285
+ const icon = f.type === 'security' ? '🔒' : f.type === 'warning' ? '⚠️' : 'ℹ️';
6286
+ console.log(chalk.dim(` ${icon} ${f.message.slice(0, 60)}${f.file ? ` (${path.basename(f.file)})` : ''}`));
6287
+ });
6288
+ }
6289
+ }
6290
+ }
6291
+ } catch (e) {
6292
+ console.error(chalk.red('Native worker failed:'), e.message);
6293
+ if (e.stack) console.error(chalk.dim(e.stack));
6294
+ }
6295
+ });
6296
+
6297
+ nativeCmd.command('benchmark')
6298
+ .description('Run performance benchmark suite')
6299
+ .option('--path <path>', 'Target path for worker benchmarks', '.')
6300
+ .option('--embeddings-only', 'Only benchmark embeddings')
6301
+ .option('--workers-only', 'Only benchmark workers')
6302
+ .action(async (opts) => {
6303
+ try {
6304
+ const benchmark = require('../dist/workers/benchmark.js');
6305
+
6306
+ if (opts.embeddingsOnly) {
6307
+ console.log(chalk.cyan('\n📊 Benchmarking ONNX Embeddings...\n'));
6308
+ const results = await benchmark.benchmarkEmbeddings(10);
6309
+ console.log(benchmark.formatBenchmarkResults(results));
6310
+ } else if (opts.workersOnly) {
6311
+ console.log(chalk.cyan('\n🔧 Benchmarking Native Workers...\n'));
6312
+ const results = await benchmark.benchmarkWorkers(opts.path);
6313
+ console.log(benchmark.formatBenchmarkResults(results));
6314
+ } else {
6315
+ await benchmark.runFullBenchmark(opts.path);
6316
+ }
6317
+ } catch (e) {
6318
+ console.error(chalk.red('Benchmark failed:'), e.message);
6319
+ if (e.stack) console.error(chalk.dim(e.stack));
6320
+ }
6321
+ });
6322
+
6323
+ nativeCmd.command('list')
6324
+ .description('List available native worker types')
6325
+ .action(() => {
6326
+ console.log(chalk.cyan('\n🔧 Native Worker Types\n'));
6327
+ console.log(chalk.bold('security'));
6328
+ console.log(chalk.dim(' Security vulnerability scanner'));
6329
+ console.log(chalk.dim(' Phases: file-discovery → security-scan → summarization'));
6330
+ console.log(chalk.dim(' No ONNX/VectorDB required\n'));
6331
+
6332
+ console.log(chalk.bold('analysis'));
6333
+ console.log(chalk.dim(' Full code analysis with embeddings'));
6334
+ console.log(chalk.dim(' Phases: file-discovery → pattern-extraction → embedding-generation'));
6335
+ console.log(chalk.dim(' → vector-storage → complexity-analysis → summarization'));
6336
+ console.log(chalk.dim(' Requires: ONNX embedder, VectorDB\n'));
6337
+
6338
+ console.log(chalk.bold('learning'));
6339
+ console.log(chalk.dim(' Pattern learning with vector storage'));
6340
+ console.log(chalk.dim(' Phases: file-discovery → pattern-extraction → embedding-generation'));
6341
+ console.log(chalk.dim(' → vector-storage → summarization'));
6342
+ console.log(chalk.dim(' Requires: ONNX embedder, VectorDB, Intelligence memory\n'));
6343
+
6344
+ console.log(chalk.bold('Available Phases:'));
6345
+ const phases = [
6346
+ 'file-discovery', 'pattern-extraction', 'embedding-generation',
6347
+ 'vector-storage', 'similarity-search', 'security-scan',
6348
+ 'complexity-analysis', 'summarization'
6349
+ ];
6350
+ phases.forEach(p => console.log(chalk.dim(` • ${p}`)));
6351
+ });
6352
+
6128
6353
  // MCP Server command
6129
6354
  const mcpCmd = program.command('mcp').description('MCP (Model Context Protocol) server for Claude Code integration');
6130
6355
 
package/bin/mcp-server.js CHANGED
@@ -970,6 +970,81 @@ const TOOLS = [
970
970
  properties: {},
971
971
  required: []
972
972
  }
973
+ },
974
+ // Custom Worker System (agentic-flow@alpha.39+)
975
+ {
976
+ name: 'workers_presets',
977
+ description: 'List available worker presets (quick-scan, deep-analysis, security-scan, learning, api-docs, test-analysis)',
978
+ inputSchema: {
979
+ type: 'object',
980
+ properties: {},
981
+ required: []
982
+ }
983
+ },
984
+ {
985
+ name: 'workers_phases',
986
+ description: 'List available phase executors (24 phases including file-discovery, security-analysis, pattern-extraction)',
987
+ inputSchema: {
988
+ type: 'object',
989
+ properties: {},
990
+ required: []
991
+ }
992
+ },
993
+ {
994
+ name: 'workers_create',
995
+ description: 'Create a custom worker from preset with composable phases',
996
+ inputSchema: {
997
+ type: 'object',
998
+ properties: {
999
+ name: { type: 'string', description: 'Worker name' },
1000
+ preset: { type: 'string', description: 'Base preset (quick-scan, deep-analysis, security-scan, learning, api-docs, test-analysis)' },
1001
+ triggers: { type: 'string', description: 'Comma-separated trigger keywords' }
1002
+ },
1003
+ required: ['name']
1004
+ }
1005
+ },
1006
+ {
1007
+ name: 'workers_run',
1008
+ description: 'Run a custom worker on target path',
1009
+ inputSchema: {
1010
+ type: 'object',
1011
+ properties: {
1012
+ name: { type: 'string', description: 'Worker name' },
1013
+ path: { type: 'string', description: 'Target path to analyze (default: .)' }
1014
+ },
1015
+ required: ['name']
1016
+ }
1017
+ },
1018
+ {
1019
+ name: 'workers_custom',
1020
+ description: 'List registered custom workers',
1021
+ inputSchema: {
1022
+ type: 'object',
1023
+ properties: {},
1024
+ required: []
1025
+ }
1026
+ },
1027
+ {
1028
+ name: 'workers_init_config',
1029
+ description: 'Generate example workers.yaml config file',
1030
+ inputSchema: {
1031
+ type: 'object',
1032
+ properties: {
1033
+ force: { type: 'boolean', description: 'Overwrite existing config' }
1034
+ },
1035
+ required: []
1036
+ }
1037
+ },
1038
+ {
1039
+ name: 'workers_load_config',
1040
+ description: 'Load custom workers from workers.yaml config file',
1041
+ inputSchema: {
1042
+ type: 'object',
1043
+ properties: {
1044
+ file: { type: 'string', description: 'Config file path (default: workers.yaml)' }
1045
+ },
1046
+ required: []
1047
+ }
973
1048
  }
974
1049
  ];
975
1050
 
@@ -2237,6 +2312,162 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
2237
2312
  }
2238
2313
  }
2239
2314
 
2315
+ // Custom Worker System handlers (agentic-flow@alpha.39+)
2316
+ case 'workers_presets': {
2317
+ try {
2318
+ const result = execSync('npx agentic-flow@alpha workers presets', {
2319
+ encoding: 'utf-8',
2320
+ timeout: 15000,
2321
+ stdio: ['pipe', 'pipe', 'pipe']
2322
+ });
2323
+ return { content: [{ type: 'text', text: JSON.stringify({
2324
+ success: true,
2325
+ presets: result.trim()
2326
+ }, null, 2) }] };
2327
+ } catch (e) {
2328
+ return { content: [{ type: 'text', text: JSON.stringify({
2329
+ success: true,
2330
+ presets: ['quick-scan', 'deep-analysis', 'security-scan', 'learning', 'api-docs', 'test-analysis'],
2331
+ note: 'Hardcoded fallback - install agentic-flow@alpha for full support'
2332
+ }, null, 2) }] };
2333
+ }
2334
+ }
2335
+
2336
+ case 'workers_phases': {
2337
+ try {
2338
+ const result = execSync('npx agentic-flow@alpha workers phases', {
2339
+ encoding: 'utf-8',
2340
+ timeout: 15000,
2341
+ stdio: ['pipe', 'pipe', 'pipe']
2342
+ });
2343
+ return { content: [{ type: 'text', text: JSON.stringify({
2344
+ success: true,
2345
+ phases: result.trim()
2346
+ }, null, 2) }] };
2347
+ } catch (e) {
2348
+ return { content: [{ type: 'text', text: JSON.stringify({
2349
+ success: true,
2350
+ phases: ['file-discovery', 'static-analysis', 'security-analysis', 'pattern-extraction', 'dependency-analysis', 'complexity-analysis', 'test-coverage', 'api-extraction', 'secret-detection', 'report-generation'],
2351
+ note: 'Partial list - install agentic-flow@alpha for all 24 phases'
2352
+ }, null, 2) }] };
2353
+ }
2354
+ }
2355
+
2356
+ case 'workers_create': {
2357
+ const name = args.name;
2358
+ const preset = args.preset || 'quick-scan';
2359
+ const triggers = args.triggers;
2360
+ try {
2361
+ let cmd = `npx agentic-flow@alpha workers create "${name}" --preset ${preset}`;
2362
+ if (triggers) cmd += ` --triggers "${triggers}"`;
2363
+ const result = execSync(cmd, {
2364
+ encoding: 'utf-8',
2365
+ timeout: 30000,
2366
+ stdio: ['pipe', 'pipe', 'pipe']
2367
+ });
2368
+ return { content: [{ type: 'text', text: JSON.stringify({
2369
+ success: true,
2370
+ message: `Worker '${name}' created with preset '${preset}'`,
2371
+ output: result.trim()
2372
+ }, null, 2) }] };
2373
+ } catch (e) {
2374
+ return { content: [{ type: 'text', text: JSON.stringify({
2375
+ success: false,
2376
+ error: 'Worker creation failed',
2377
+ message: e.message
2378
+ }, null, 2) }] };
2379
+ }
2380
+ }
2381
+
2382
+ case 'workers_run': {
2383
+ const name = args.name;
2384
+ const targetPath = args.path || '.';
2385
+ try {
2386
+ const result = execSync(`npx agentic-flow@alpha workers run "${name}" --path "${targetPath}"`, {
2387
+ encoding: 'utf-8',
2388
+ timeout: 120000,
2389
+ stdio: ['pipe', 'pipe', 'pipe']
2390
+ });
2391
+ return { content: [{ type: 'text', text: JSON.stringify({
2392
+ success: true,
2393
+ worker: name,
2394
+ path: targetPath,
2395
+ output: result.trim()
2396
+ }, null, 2) }] };
2397
+ } catch (e) {
2398
+ return { content: [{ type: 'text', text: JSON.stringify({
2399
+ success: false,
2400
+ error: `Worker '${name}' execution failed`,
2401
+ message: e.message
2402
+ }, null, 2) }] };
2403
+ }
2404
+ }
2405
+
2406
+ case 'workers_custom': {
2407
+ try {
2408
+ const result = execSync('npx agentic-flow@alpha workers custom', {
2409
+ encoding: 'utf-8',
2410
+ timeout: 15000,
2411
+ stdio: ['pipe', 'pipe', 'pipe']
2412
+ });
2413
+ return { content: [{ type: 'text', text: JSON.stringify({
2414
+ success: true,
2415
+ workers: result.trim()
2416
+ }, null, 2) }] };
2417
+ } catch (e) {
2418
+ return { content: [{ type: 'text', text: JSON.stringify({
2419
+ success: true,
2420
+ workers: [],
2421
+ note: 'No custom workers registered'
2422
+ }, null, 2) }] };
2423
+ }
2424
+ }
2425
+
2426
+ case 'workers_init_config': {
2427
+ try {
2428
+ let cmd = 'npx agentic-flow@alpha workers init-config';
2429
+ if (args.force) cmd += ' --force';
2430
+ const result = execSync(cmd, {
2431
+ encoding: 'utf-8',
2432
+ timeout: 15000,
2433
+ stdio: ['pipe', 'pipe', 'pipe']
2434
+ });
2435
+ return { content: [{ type: 'text', text: JSON.stringify({
2436
+ success: true,
2437
+ message: 'workers.yaml config file created',
2438
+ output: result.trim()
2439
+ }, null, 2) }] };
2440
+ } catch (e) {
2441
+ return { content: [{ type: 'text', text: JSON.stringify({
2442
+ success: false,
2443
+ error: 'Config init failed',
2444
+ message: e.message
2445
+ }, null, 2) }] };
2446
+ }
2447
+ }
2448
+
2449
+ case 'workers_load_config': {
2450
+ const configFile = args.file || 'workers.yaml';
2451
+ try {
2452
+ const result = execSync(`npx agentic-flow@alpha workers load-config --file "${configFile}"`, {
2453
+ encoding: 'utf-8',
2454
+ timeout: 30000,
2455
+ stdio: ['pipe', 'pipe', 'pipe']
2456
+ });
2457
+ return { content: [{ type: 'text', text: JSON.stringify({
2458
+ success: true,
2459
+ file: configFile,
2460
+ output: result.trim()
2461
+ }, null, 2) }] };
2462
+ } catch (e) {
2463
+ return { content: [{ type: 'text', text: JSON.stringify({
2464
+ success: false,
2465
+ error: `Config load failed from '${configFile}'`,
2466
+ message: e.message
2467
+ }, null, 2) }] };
2468
+ }
2469
+ }
2470
+
2240
2471
  default:
2241
2472
  return {
2242
2473
  content: [{
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Worker Benchmark Suite for RuVector
3
+ *
4
+ * Measures performance of:
5
+ * - ONNX embedding generation (single vs batch)
6
+ * - Vector storage and search
7
+ * - Phase execution times
8
+ * - Worker end-to-end throughput
9
+ */
10
+ import { BenchmarkResult } from './types';
11
+ /**
12
+ * Benchmark ONNX embedding generation
13
+ */
14
+ export declare function benchmarkEmbeddings(iterations?: number): Promise<BenchmarkResult[]>;
15
+ /**
16
+ * Benchmark worker execution
17
+ */
18
+ export declare function benchmarkWorkers(targetPath?: string): Promise<BenchmarkResult[]>;
19
+ /**
20
+ * Benchmark individual phases
21
+ */
22
+ export declare function benchmarkPhases(targetPath?: string): Promise<BenchmarkResult[]>;
23
+ /**
24
+ * Format benchmark results as table
25
+ */
26
+ export declare function formatBenchmarkResults(results: BenchmarkResult[]): string;
27
+ /**
28
+ * Run full benchmark suite
29
+ */
30
+ export declare function runFullBenchmark(targetPath?: string): Promise<{
31
+ embeddings: BenchmarkResult[];
32
+ phases: BenchmarkResult[];
33
+ workers: BenchmarkResult[];
34
+ summary: string;
35
+ }>;
36
+ declare const _default: {
37
+ benchmarkEmbeddings: typeof benchmarkEmbeddings;
38
+ benchmarkWorkers: typeof benchmarkWorkers;
39
+ benchmarkPhases: typeof benchmarkPhases;
40
+ runFullBenchmark: typeof runFullBenchmark;
41
+ formatBenchmarkResults: typeof formatBenchmarkResults;
42
+ };
43
+ export default _default;
44
+ //# sourceMappingURL=benchmark.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"benchmark.d.ts","sourceRoot":"","sources":["../../src/workers/benchmark.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AA4C1C;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,UAAU,GAAE,MAAW,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAwE7F;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,UAAU,GAAE,MAAY,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CA4B3F;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,UAAU,GAAE,MAAY,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAsD1F;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,MAAM,CAwBzE;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,UAAU,GAAE,MAAY,GAAG,OAAO,CAAC;IACxE,UAAU,EAAE,eAAe,EAAE,CAAC;IAC9B,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC,CAyCD;;;;;;;;AAED,wBAME"}