ruvector 0.1.79 → 0.1.81

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.
Files changed (34) hide show
  1. package/bin/cli.js +171 -0
  2. package/dist/analysis/complexity.d.ts +52 -0
  3. package/dist/analysis/complexity.d.ts.map +1 -0
  4. package/dist/analysis/complexity.js +146 -0
  5. package/dist/analysis/index.d.ts +15 -0
  6. package/dist/analysis/index.d.ts.map +1 -0
  7. package/dist/analysis/index.js +38 -0
  8. package/dist/analysis/patterns.d.ts +71 -0
  9. package/dist/analysis/patterns.d.ts.map +1 -0
  10. package/dist/analysis/patterns.js +243 -0
  11. package/dist/analysis/security.d.ts +51 -0
  12. package/dist/analysis/security.d.ts.map +1 -0
  13. package/dist/analysis/security.js +139 -0
  14. package/dist/core/index.d.ts +1 -0
  15. package/dist/core/index.d.ts.map +1 -1
  16. package/dist/core/index.js +2 -0
  17. package/dist/core/intelligence-engine.d.ts +21 -0
  18. package/dist/core/intelligence-engine.d.ts.map +1 -1
  19. package/dist/core/intelligence-engine.js +71 -0
  20. package/dist/core/parallel-workers.d.ts +2 -8
  21. package/dist/core/parallel-workers.d.ts.map +1 -1
  22. package/dist/workers/native-worker.d.ts +3 -3
  23. package/dist/workers/native-worker.d.ts.map +1 -1
  24. package/dist/workers/native-worker.js +45 -87
  25. package/package.json +1 -1
  26. package/.agentic-flow/intelligence.db +0 -0
  27. package/.agentic-flow/vectors.db +0 -0
  28. package/.agentic-flow/workers.db +0 -0
  29. package/.claude-flow/metrics/agent-metrics.json +0 -1
  30. package/.claude-flow/metrics/performance.json +0 -87
  31. package/.claude-flow/metrics/task-metrics.json +0 -10
  32. package/.ruvector/intelligence.json +0 -5289
  33. package/.ruvector/workers/code-analyzer.db +0 -0
  34. package/ruvector.db +0 -0
package/bin/cli.js CHANGED
@@ -2808,6 +2808,95 @@ hooksCmd.command('init')
2808
2808
  console.log(chalk.blue(' ✓ Environment variables configured (v2.1 with multi-algorithm learning)'));
2809
2809
  }
2810
2810
 
2811
+ // Workers configuration (native ruvector workers + agentic-flow integration)
2812
+ if (!opts.minimal) {
2813
+ settings.workers = settings.workers || {
2814
+ enabled: true,
2815
+ parallel: true,
2816
+ maxConcurrent: 10,
2817
+ native: {
2818
+ enabled: true,
2819
+ types: ['security', 'analysis', 'learning'],
2820
+ defaultTimeout: 120000
2821
+ },
2822
+ triggers: {
2823
+ ultralearn: { priority: 'high', agents: ['researcher', 'coder'] },
2824
+ optimize: { priority: 'high', agents: ['performance-analyzer'] },
2825
+ audit: { priority: 'critical', agents: ['security-analyst', 'tester'] },
2826
+ map: { priority: 'medium', agents: ['architect'] },
2827
+ security: { priority: 'critical', agents: ['security-analyst'] },
2828
+ benchmark: { priority: 'low', agents: ['performance-analyzer'] },
2829
+ document: { priority: 'medium', agents: ['documenter'] },
2830
+ refactor: { priority: 'medium', agents: ['coder', 'reviewer'] },
2831
+ testgaps: { priority: 'high', agents: ['tester'] },
2832
+ deepdive: { priority: 'low', agents: ['researcher'] },
2833
+ predict: { priority: 'medium', agents: ['analyst'] },
2834
+ consolidate: { priority: 'low', agents: ['architect'] }
2835
+ }
2836
+ };
2837
+ console.log(chalk.blue(' ✓ Workers configured (native + 12 triggers)'));
2838
+ }
2839
+
2840
+ // Performance configuration with benchmark thresholds
2841
+ if (!opts.minimal) {
2842
+ settings.performance = settings.performance || {
2843
+ modelCache: {
2844
+ enabled: true,
2845
+ maxSizeMB: 512,
2846
+ ttlMinutes: 60
2847
+ },
2848
+ benchmarkThresholds: {
2849
+ triggerDetection: { p95: 5 }, // <5ms
2850
+ workerRegistry: { p95: 10 }, // <10ms
2851
+ agentSelection: { p95: 1 }, // <1ms
2852
+ memoryKeyGen: { p95: 0.1 }, // <0.1ms
2853
+ concurrent10: { p95: 1000 }, // <1000ms
2854
+ singleEmbedding: { p95: 500 }, // <500ms (WASM)
2855
+ batchEmbedding16: { p95: 8000 } // <8000ms (WASM)
2856
+ },
2857
+ optimizations: {
2858
+ parallelDispatch: true,
2859
+ batchEmbeddings: true,
2860
+ cacheEmbeddings: true,
2861
+ simd: true
2862
+ }
2863
+ };
2864
+ console.log(chalk.blue(' ✓ Performance thresholds configured'));
2865
+ }
2866
+
2867
+ // Agent presets configuration
2868
+ if (!opts.minimal) {
2869
+ settings.agents = settings.agents || {
2870
+ presets: {
2871
+ 'quick-scan': {
2872
+ phases: ['file-discovery', 'summarization'],
2873
+ timeout: 30000
2874
+ },
2875
+ 'deep-analysis': {
2876
+ phases: ['file-discovery', 'pattern-extraction', 'embedding-generation', 'complexity-analysis', 'summarization'],
2877
+ timeout: 120000,
2878
+ capabilities: { onnxEmbeddings: true, vectorDb: true }
2879
+ },
2880
+ 'security-scan': {
2881
+ phases: ['file-discovery', 'security-scan', 'summarization'],
2882
+ timeout: 60000
2883
+ },
2884
+ 'learning': {
2885
+ phases: ['file-discovery', 'pattern-extraction', 'embedding-generation', 'vector-storage', 'summarization'],
2886
+ timeout: 180000,
2887
+ capabilities: { onnxEmbeddings: true, vectorDb: true, intelligenceMemory: true }
2888
+ }
2889
+ },
2890
+ capabilities: {
2891
+ onnxEmbeddings: true,
2892
+ vectorDb: true,
2893
+ intelligenceMemory: true,
2894
+ parallelProcessing: true
2895
+ }
2896
+ };
2897
+ console.log(chalk.blue(' ✓ Agent presets configured (4 presets)'));
2898
+ }
2899
+
2811
2900
  // Permissions based on detected project type (unless --minimal or --no-permissions)
2812
2901
  if (!opts.minimal && opts.permissions !== false) {
2813
2902
  settings.permissions = settings.permissions || {};
@@ -6350,6 +6439,88 @@ nativeCmd.command('list')
6350
6439
  phases.forEach(p => console.log(chalk.dim(` • ${p}`)));
6351
6440
  });
6352
6441
 
6442
+ nativeCmd.command('compare')
6443
+ .description('Compare ruvector native vs agentic-flow workers')
6444
+ .option('--path <path>', 'Target path for benchmarks', '.')
6445
+ .option('--iterations <n>', 'Number of iterations', '5')
6446
+ .action(async (opts) => {
6447
+ const iterations = parseInt(opts.iterations) || 5;
6448
+ console.log(chalk.cyan('\n╔════════════════════════════════════════════════════════════════╗'));
6449
+ console.log(chalk.cyan('║ Worker System Comparison Benchmark ║'));
6450
+ console.log(chalk.cyan('╚════════════════════════════════════════════════════════════════╝\n'));
6451
+
6452
+ try {
6453
+ const { performance } = require('perf_hooks');
6454
+ const benchmark = require('../dist/workers/benchmark.js');
6455
+ const { createSecurityWorker, createAnalysisWorker } = require('../dist/workers/native-worker.js');
6456
+
6457
+ // Test 1: Native Security Worker
6458
+ console.log(chalk.yellow('1. Native Security Worker'));
6459
+ const securityTimes = [];
6460
+ const securityWorker = createSecurityWorker();
6461
+ for (let i = 0; i < iterations; i++) {
6462
+ const start = performance.now();
6463
+ await securityWorker.run(opts.path);
6464
+ securityTimes.push(performance.now() - start);
6465
+ }
6466
+ const secAvg = securityTimes.reduce((a, b) => a + b) / securityTimes.length;
6467
+ console.log(chalk.dim(` Avg: ${secAvg.toFixed(1)}ms (${iterations} runs)`));
6468
+
6469
+ // Test 2: Native Analysis Worker
6470
+ console.log(chalk.yellow('\n2. Native Analysis Worker (ONNX + VectorDB)'));
6471
+ const analysisTimes = [];
6472
+ const analysisWorker = createAnalysisWorker();
6473
+ for (let i = 0; i < Math.min(iterations, 3); i++) {
6474
+ const start = performance.now();
6475
+ await analysisWorker.run(opts.path);
6476
+ analysisTimes.push(performance.now() - start);
6477
+ }
6478
+ const anaAvg = analysisTimes.reduce((a, b) => a + b) / analysisTimes.length;
6479
+ console.log(chalk.dim(` Avg: ${anaAvg.toFixed(1)}ms (${Math.min(iterations, 3)} runs)`));
6480
+
6481
+ // Test 3: agentic-flow workers (if available)
6482
+ let agenticAvailable = false;
6483
+ let agenticSecAvg = 0;
6484
+ let agenticAnaAvg = 0;
6485
+ try {
6486
+ const agentic = require('agentic-flow');
6487
+ agenticAvailable = true;
6488
+
6489
+ console.log(chalk.yellow('\n3. agentic-flow Security Worker'));
6490
+ // Note: Would need actual agentic-flow integration here
6491
+ console.log(chalk.dim(' (Integration pending - use agentic-flow CLI directly)'));
6492
+
6493
+ } catch (e) {
6494
+ console.log(chalk.yellow('\n3. agentic-flow Workers'));
6495
+ console.log(chalk.dim(' Not installed (npm i agentic-flow@alpha)'));
6496
+ }
6497
+
6498
+ // Summary
6499
+ console.log(chalk.cyan('\n═══════════════════════════════════════════════════════════════'));
6500
+ console.log(chalk.bold('Summary'));
6501
+ console.log(chalk.cyan('═══════════════════════════════════════════════════════════════'));
6502
+ console.log(chalk.white('\nNative RuVector Workers:'));
6503
+ console.log(chalk.dim(` Security scan: ${secAvg.toFixed(1)}ms avg`));
6504
+ console.log(chalk.dim(` Full analysis: ${anaAvg.toFixed(1)}ms avg`));
6505
+
6506
+ if (agenticAvailable) {
6507
+ console.log(chalk.white('\nagentic-flow Workers:'));
6508
+ console.log(chalk.dim(' Security scan: (run: agentic-flow workers native security)'));
6509
+ console.log(chalk.dim(' Full analysis: (run: agentic-flow workers native analysis)'));
6510
+ }
6511
+
6512
+ console.log(chalk.white('\nArchitecture Benefits:'));
6513
+ console.log(chalk.dim(' • Shared ONNX model cache (memory efficient)'));
6514
+ console.log(chalk.dim(' • 7 native phases with deep integration'));
6515
+ console.log(chalk.dim(' • SIMD-accelerated WASM embeddings'));
6516
+ console.log(chalk.dim(' • HNSW vector indexing (150x faster search)'));
6517
+ console.log('');
6518
+ } catch (e) {
6519
+ console.error(chalk.red('Comparison failed:'), e.message);
6520
+ if (opts.verbose) console.error(chalk.dim(e.stack));
6521
+ }
6522
+ });
6523
+
6353
6524
  // MCP Server command
6354
6525
  const mcpCmd = program.command('mcp').description('MCP (Model Context Protocol) server for Claude Code integration');
6355
6526
 
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Complexity Analysis Module - Consolidated code complexity metrics
3
+ *
4
+ * Single source of truth for cyclomatic complexity and code metrics.
5
+ * Used by native-worker.ts and parallel-workers.ts
6
+ */
7
+ export interface ComplexityResult {
8
+ file: string;
9
+ lines: number;
10
+ nonEmptyLines: number;
11
+ cyclomaticComplexity: number;
12
+ functions: number;
13
+ avgFunctionSize: number;
14
+ maxFunctionComplexity?: number;
15
+ }
16
+ export interface ComplexityThresholds {
17
+ complexity: number;
18
+ functions: number;
19
+ lines: number;
20
+ avgSize: number;
21
+ }
22
+ export declare const DEFAULT_THRESHOLDS: ComplexityThresholds;
23
+ /**
24
+ * Analyze complexity of a single file
25
+ */
26
+ export declare function analyzeFile(filePath: string, content?: string): ComplexityResult;
27
+ /**
28
+ * Analyze complexity of multiple files
29
+ */
30
+ export declare function analyzeFiles(files: string[], maxFiles?: number): ComplexityResult[];
31
+ /**
32
+ * Check if complexity exceeds thresholds
33
+ */
34
+ export declare function exceedsThresholds(result: ComplexityResult, thresholds?: ComplexityThresholds): boolean;
35
+ /**
36
+ * Get complexity rating
37
+ */
38
+ export declare function getComplexityRating(complexity: number): 'low' | 'medium' | 'high' | 'critical';
39
+ /**
40
+ * Filter files exceeding thresholds
41
+ */
42
+ export declare function filterComplex(results: ComplexityResult[], thresholds?: ComplexityThresholds): ComplexityResult[];
43
+ declare const _default: {
44
+ DEFAULT_THRESHOLDS: ComplexityThresholds;
45
+ analyzeFile: typeof analyzeFile;
46
+ analyzeFiles: typeof analyzeFiles;
47
+ exceedsThresholds: typeof exceedsThresholds;
48
+ getComplexityRating: typeof getComplexityRating;
49
+ filterComplex: typeof filterComplex;
50
+ };
51
+ export default _default;
52
+ //# sourceMappingURL=complexity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"complexity.d.ts","sourceRoot":"","sources":["../../src/analysis/complexity.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,kBAAkB,EAAE,oBAKhC,CAAC;AAEF;;GAEG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAsDhF;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,QAAQ,GAAE,MAAY,GAAG,gBAAgB,EAAE,CAExF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,gBAAgB,EACxB,UAAU,GAAE,oBAAyC,GACpD,OAAO,CAOT;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAK9F;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,gBAAgB,EAAE,EAC3B,UAAU,GAAE,oBAAyC,GACpD,gBAAgB,EAAE,CAEpB;;;;;;;;;AAED,wBAOE"}
@@ -0,0 +1,146 @@
1
+ "use strict";
2
+ /**
3
+ * Complexity Analysis Module - Consolidated code complexity metrics
4
+ *
5
+ * Single source of truth for cyclomatic complexity and code metrics.
6
+ * Used by native-worker.ts and parallel-workers.ts
7
+ */
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
21
+ }) : function(o, v) {
22
+ o["default"] = v;
23
+ });
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.DEFAULT_THRESHOLDS = void 0;
43
+ exports.analyzeFile = analyzeFile;
44
+ exports.analyzeFiles = analyzeFiles;
45
+ exports.exceedsThresholds = exceedsThresholds;
46
+ exports.getComplexityRating = getComplexityRating;
47
+ exports.filterComplex = filterComplex;
48
+ const fs = __importStar(require("fs"));
49
+ exports.DEFAULT_THRESHOLDS = {
50
+ complexity: 10,
51
+ functions: 30,
52
+ lines: 500,
53
+ avgSize: 50,
54
+ };
55
+ /**
56
+ * Analyze complexity of a single file
57
+ */
58
+ function analyzeFile(filePath, content) {
59
+ try {
60
+ const fileContent = content ?? (fs.existsSync(filePath) ? fs.readFileSync(filePath, 'utf-8') : '');
61
+ if (!fileContent) {
62
+ return { file: filePath, lines: 0, nonEmptyLines: 0, cyclomaticComplexity: 1, functions: 0, avgFunctionSize: 0 };
63
+ }
64
+ const lines = fileContent.split('\n');
65
+ const nonEmptyLines = lines.filter(l => l.trim().length > 0).length;
66
+ // Count branching statements for cyclomatic complexity
67
+ const branches = (fileContent.match(/\bif\b/g)?.length || 0) +
68
+ (fileContent.match(/\belse\b/g)?.length || 0) +
69
+ (fileContent.match(/\bfor\b/g)?.length || 0) +
70
+ (fileContent.match(/\bwhile\b/g)?.length || 0) +
71
+ (fileContent.match(/\bswitch\b/g)?.length || 0) +
72
+ (fileContent.match(/\bcase\b/g)?.length || 0) +
73
+ (fileContent.match(/\bcatch\b/g)?.length || 0) +
74
+ (fileContent.match(/\?\?/g)?.length || 0) +
75
+ (fileContent.match(/&&/g)?.length || 0) +
76
+ (fileContent.match(/\|\|/g)?.length || 0) +
77
+ (fileContent.match(/\?[^:]/g)?.length || 0); // Ternary
78
+ const cyclomaticComplexity = branches + 1;
79
+ // Count functions
80
+ const functionPatterns = [
81
+ /function\s+\w+/g,
82
+ /\w+\s*=\s*(?:async\s*)?\(/g,
83
+ /\w+\s*:\s*(?:async\s*)?\(/g,
84
+ /(?:async\s+)?(?:public|private|protected)?\s+\w+\s*\([^)]*\)\s*[:{]/g,
85
+ ];
86
+ let functions = 0;
87
+ for (const pattern of functionPatterns) {
88
+ functions += (fileContent.match(pattern) || []).length;
89
+ }
90
+ // Deduplicate by rough estimate
91
+ functions = Math.ceil(functions / 2);
92
+ const avgFunctionSize = functions > 0 ? Math.round(nonEmptyLines / functions) : nonEmptyLines;
93
+ return {
94
+ file: filePath,
95
+ lines: lines.length,
96
+ nonEmptyLines,
97
+ cyclomaticComplexity,
98
+ functions,
99
+ avgFunctionSize,
100
+ };
101
+ }
102
+ catch {
103
+ return { file: filePath, lines: 0, nonEmptyLines: 0, cyclomaticComplexity: 1, functions: 0, avgFunctionSize: 0 };
104
+ }
105
+ }
106
+ /**
107
+ * Analyze complexity of multiple files
108
+ */
109
+ function analyzeFiles(files, maxFiles = 100) {
110
+ return files.slice(0, maxFiles).map(f => analyzeFile(f));
111
+ }
112
+ /**
113
+ * Check if complexity exceeds thresholds
114
+ */
115
+ function exceedsThresholds(result, thresholds = exports.DEFAULT_THRESHOLDS) {
116
+ return (result.cyclomaticComplexity > thresholds.complexity ||
117
+ result.functions > thresholds.functions ||
118
+ result.lines > thresholds.lines ||
119
+ result.avgFunctionSize > thresholds.avgSize);
120
+ }
121
+ /**
122
+ * Get complexity rating
123
+ */
124
+ function getComplexityRating(complexity) {
125
+ if (complexity <= 5)
126
+ return 'low';
127
+ if (complexity <= 10)
128
+ return 'medium';
129
+ if (complexity <= 20)
130
+ return 'high';
131
+ return 'critical';
132
+ }
133
+ /**
134
+ * Filter files exceeding thresholds
135
+ */
136
+ function filterComplex(results, thresholds = exports.DEFAULT_THRESHOLDS) {
137
+ return results.filter(r => exceedsThresholds(r, thresholds));
138
+ }
139
+ exports.default = {
140
+ DEFAULT_THRESHOLDS: exports.DEFAULT_THRESHOLDS,
141
+ analyzeFile,
142
+ analyzeFiles,
143
+ exceedsThresholds,
144
+ getComplexityRating,
145
+ filterComplex,
146
+ };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Analysis Module - Consolidated code analysis utilities
3
+ *
4
+ * Single source of truth for:
5
+ * - Security scanning
6
+ * - Complexity analysis
7
+ * - Pattern extraction
8
+ */
9
+ export * from './security';
10
+ export * from './complexity';
11
+ export * from './patterns';
12
+ export { default as security } from './security';
13
+ export { default as complexity } from './complexity';
14
+ export { default as patterns } from './patterns';
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/analysis/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAG3B,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ /**
3
+ * Analysis Module - Consolidated code analysis utilities
4
+ *
5
+ * Single source of truth for:
6
+ * - Security scanning
7
+ * - Complexity analysis
8
+ * - Pattern extraction
9
+ */
10
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ var desc = Object.getOwnPropertyDescriptor(m, k);
13
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
14
+ desc = { enumerable: true, get: function() { return m[k]; } };
15
+ }
16
+ Object.defineProperty(o, k2, desc);
17
+ }) : (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ o[k2] = m[k];
20
+ }));
21
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
22
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
23
+ };
24
+ var __importDefault = (this && this.__importDefault) || function (mod) {
25
+ return (mod && mod.__esModule) ? mod : { "default": mod };
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.patterns = exports.complexity = exports.security = void 0;
29
+ __exportStar(require("./security"), exports);
30
+ __exportStar(require("./complexity"), exports);
31
+ __exportStar(require("./patterns"), exports);
32
+ // Re-export defaults for convenience
33
+ var security_1 = require("./security");
34
+ Object.defineProperty(exports, "security", { enumerable: true, get: function () { return __importDefault(security_1).default; } });
35
+ var complexity_1 = require("./complexity");
36
+ Object.defineProperty(exports, "complexity", { enumerable: true, get: function () { return __importDefault(complexity_1).default; } });
37
+ var patterns_1 = require("./patterns");
38
+ Object.defineProperty(exports, "patterns", { enumerable: true, get: function () { return __importDefault(patterns_1).default; } });
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Pattern Extraction Module - Consolidated code pattern detection
3
+ *
4
+ * Single source of truth for extracting functions, imports, exports, etc.
5
+ * Used by native-worker.ts and parallel-workers.ts
6
+ */
7
+ export interface PatternMatch {
8
+ type: 'function' | 'class' | 'import' | 'export' | 'todo' | 'variable' | 'type';
9
+ match: string;
10
+ file: string;
11
+ line?: number;
12
+ }
13
+ export interface FilePatterns {
14
+ file: string;
15
+ language: string;
16
+ functions: string[];
17
+ classes: string[];
18
+ imports: string[];
19
+ exports: string[];
20
+ todos: string[];
21
+ variables: string[];
22
+ }
23
+ /**
24
+ * Detect language from file extension
25
+ */
26
+ export declare function detectLanguage(file: string): string;
27
+ /**
28
+ * Extract function names from content
29
+ */
30
+ export declare function extractFunctions(content: string): string[];
31
+ /**
32
+ * Extract class names from content
33
+ */
34
+ export declare function extractClasses(content: string): string[];
35
+ /**
36
+ * Extract import statements from content
37
+ */
38
+ export declare function extractImports(content: string): string[];
39
+ /**
40
+ * Extract export statements from content
41
+ */
42
+ export declare function extractExports(content: string): string[];
43
+ /**
44
+ * Extract TODO/FIXME comments from content
45
+ */
46
+ export declare function extractTodos(content: string): string[];
47
+ /**
48
+ * Extract all patterns from a file
49
+ */
50
+ export declare function extractAllPatterns(filePath: string, content?: string): FilePatterns;
51
+ /**
52
+ * Extract patterns from multiple files
53
+ */
54
+ export declare function extractFromFiles(files: string[], maxFiles?: number): FilePatterns[];
55
+ /**
56
+ * Convert FilePatterns to PatternMatch array (for native-worker compatibility)
57
+ */
58
+ export declare function toPatternMatches(patterns: FilePatterns): PatternMatch[];
59
+ declare const _default: {
60
+ detectLanguage: typeof detectLanguage;
61
+ extractFunctions: typeof extractFunctions;
62
+ extractClasses: typeof extractClasses;
63
+ extractImports: typeof extractImports;
64
+ extractExports: typeof extractExports;
65
+ extractTodos: typeof extractTodos;
66
+ extractAllPatterns: typeof extractAllPatterns;
67
+ extractFromFiles: typeof extractFromFiles;
68
+ toPatternMatches: typeof toPatternMatches;
69
+ };
70
+ export default _default;
71
+ //# sourceMappingURL=patterns.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"patterns.d.ts","sourceRoot":"","sources":["../../src/analysis/patterns.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC;IAChF,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAUnD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CA2B1D;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAmBxD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAmBxD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAuBxD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAUtD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,YAAY,CA0BnF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,QAAQ,GAAE,MAAY,GAAG,YAAY,EAAE,CAExF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,YAAY,GAAG,YAAY,EAAE,CAoBvE;;;;;;;;;;;;AAED,wBAUE"}