agentic-qe 1.0.4 → 1.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.
Files changed (197) hide show
  1. package/.claude/agents/qe-quality-analyzer.md +405 -0
  2. package/CHANGELOG.md +109 -0
  3. package/CONTRIBUTING.md +51 -0
  4. package/README.md +690 -134
  5. package/bin/aqe +90 -938
  6. package/dist/adapters/MemoryStoreAdapter.d.ts.map +1 -1
  7. package/dist/adapters/MemoryStoreAdapter.js +6 -0
  8. package/dist/adapters/MemoryStoreAdapter.js.map +1 -1
  9. package/dist/agents/CoverageAnalyzerAgent.d.ts +58 -3
  10. package/dist/agents/CoverageAnalyzerAgent.d.ts.map +1 -1
  11. package/dist/agents/CoverageAnalyzerAgent.js +316 -48
  12. package/dist/agents/CoverageAnalyzerAgent.js.map +1 -1
  13. package/dist/agents/FlakyTestHunterAgent.d.ts +48 -4
  14. package/dist/agents/FlakyTestHunterAgent.d.ts.map +1 -1
  15. package/dist/agents/FlakyTestHunterAgent.js +217 -10
  16. package/dist/agents/FlakyTestHunterAgent.js.map +1 -1
  17. package/dist/agents/LearningAgent.d.ts +75 -0
  18. package/dist/agents/LearningAgent.d.ts.map +1 -0
  19. package/dist/agents/LearningAgent.js +177 -0
  20. package/dist/agents/LearningAgent.js.map +1 -0
  21. package/dist/agents/TestGeneratorAgent.d.ts +42 -2
  22. package/dist/agents/TestGeneratorAgent.d.ts.map +1 -1
  23. package/dist/agents/TestGeneratorAgent.js +232 -13
  24. package/dist/agents/TestGeneratorAgent.js.map +1 -1
  25. package/dist/cli/commands/improve/index.d.ts +70 -0
  26. package/dist/cli/commands/improve/index.d.ts.map +1 -0
  27. package/dist/cli/commands/improve/index.js +530 -0
  28. package/dist/cli/commands/improve/index.js.map +1 -0
  29. package/dist/cli/commands/init.d.ts +34 -0
  30. package/dist/cli/commands/init.d.ts.map +1 -1
  31. package/dist/cli/commands/init.js +875 -42
  32. package/dist/cli/commands/init.js.map +1 -1
  33. package/dist/cli/commands/learn/index.d.ts +68 -0
  34. package/dist/cli/commands/learn/index.d.ts.map +1 -0
  35. package/dist/cli/commands/learn/index.js +431 -0
  36. package/dist/cli/commands/learn/index.js.map +1 -0
  37. package/dist/cli/commands/patterns/index.d.ts +75 -0
  38. package/dist/cli/commands/patterns/index.d.ts.map +1 -0
  39. package/dist/cli/commands/patterns/index.js +502 -0
  40. package/dist/cli/commands/patterns/index.js.map +1 -0
  41. package/dist/cli/commands/routing/index.d.ts +95 -0
  42. package/dist/cli/commands/routing/index.d.ts.map +1 -0
  43. package/dist/cli/commands/routing/index.js +399 -0
  44. package/dist/cli/commands/routing/index.js.map +1 -0
  45. package/dist/cli/index.js +455 -8
  46. package/dist/cli/index.js.map +1 -1
  47. package/dist/core/memory/SwarmMemoryManager.d.ts +5 -0
  48. package/dist/core/memory/SwarmMemoryManager.d.ts.map +1 -1
  49. package/dist/core/memory/SwarmMemoryManager.js +7 -0
  50. package/dist/core/memory/SwarmMemoryManager.js.map +1 -1
  51. package/dist/core/routing/AdaptiveModelRouter.d.ts +86 -0
  52. package/dist/core/routing/AdaptiveModelRouter.d.ts.map +1 -0
  53. package/dist/core/routing/AdaptiveModelRouter.js +264 -0
  54. package/dist/core/routing/AdaptiveModelRouter.js.map +1 -0
  55. package/dist/core/routing/ComplexityAnalyzer.d.ts +49 -0
  56. package/dist/core/routing/ComplexityAnalyzer.d.ts.map +1 -0
  57. package/dist/core/routing/ComplexityAnalyzer.js +182 -0
  58. package/dist/core/routing/ComplexityAnalyzer.js.map +1 -0
  59. package/dist/core/routing/CostTracker.d.ts +55 -0
  60. package/dist/core/routing/CostTracker.d.ts.map +1 -0
  61. package/dist/core/routing/CostTracker.js +210 -0
  62. package/dist/core/routing/CostTracker.js.map +1 -0
  63. package/dist/core/routing/FleetManagerIntegration.d.ts +68 -0
  64. package/dist/core/routing/FleetManagerIntegration.d.ts.map +1 -0
  65. package/dist/core/routing/FleetManagerIntegration.js +170 -0
  66. package/dist/core/routing/FleetManagerIntegration.js.map +1 -0
  67. package/dist/core/routing/ModelRules.d.ts +38 -0
  68. package/dist/core/routing/ModelRules.d.ts.map +1 -0
  69. package/dist/core/routing/ModelRules.js +170 -0
  70. package/dist/core/routing/ModelRules.js.map +1 -0
  71. package/dist/core/routing/QETask.d.ts +12 -0
  72. package/dist/core/routing/QETask.d.ts.map +1 -0
  73. package/dist/core/routing/QETask.js +21 -0
  74. package/dist/core/routing/QETask.js.map +1 -0
  75. package/dist/core/routing/index.d.ts +19 -0
  76. package/dist/core/routing/index.d.ts.map +1 -0
  77. package/dist/core/routing/index.js +50 -0
  78. package/dist/core/routing/index.js.map +1 -0
  79. package/dist/core/routing/types.d.ts +136 -0
  80. package/dist/core/routing/types.d.ts.map +1 -0
  81. package/dist/core/routing/types.js +28 -0
  82. package/dist/core/routing/types.js.map +1 -0
  83. package/dist/index.d.ts +10 -0
  84. package/dist/index.d.ts.map +1 -1
  85. package/dist/index.js +10 -0
  86. package/dist/index.js.map +1 -1
  87. package/dist/learning/FlakyFixRecommendations.d.ts +40 -0
  88. package/dist/learning/FlakyFixRecommendations.d.ts.map +1 -0
  89. package/dist/learning/FlakyFixRecommendations.js +247 -0
  90. package/dist/learning/FlakyFixRecommendations.js.map +1 -0
  91. package/dist/learning/FlakyPredictionModel.d.ts +57 -0
  92. package/dist/learning/FlakyPredictionModel.d.ts.map +1 -0
  93. package/dist/learning/FlakyPredictionModel.js +289 -0
  94. package/dist/learning/FlakyPredictionModel.js.map +1 -0
  95. package/dist/learning/FlakyTestDetector.d.ts +46 -0
  96. package/dist/learning/FlakyTestDetector.d.ts.map +1 -0
  97. package/dist/learning/FlakyTestDetector.js +215 -0
  98. package/dist/learning/FlakyTestDetector.js.map +1 -0
  99. package/dist/learning/ImprovementLoop.d.ts +119 -0
  100. package/dist/learning/ImprovementLoop.d.ts.map +1 -0
  101. package/dist/learning/ImprovementLoop.js +353 -0
  102. package/dist/learning/ImprovementLoop.js.map +1 -0
  103. package/dist/learning/LearningEngine.d.ts +144 -0
  104. package/dist/learning/LearningEngine.d.ts.map +1 -0
  105. package/dist/learning/LearningEngine.js +531 -0
  106. package/dist/learning/LearningEngine.js.map +1 -0
  107. package/dist/learning/PerformanceTracker.d.ts +118 -0
  108. package/dist/learning/PerformanceTracker.d.ts.map +1 -0
  109. package/dist/learning/PerformanceTracker.js +376 -0
  110. package/dist/learning/PerformanceTracker.js.map +1 -0
  111. package/dist/learning/StatisticalAnalysis.d.ts +47 -0
  112. package/dist/learning/StatisticalAnalysis.d.ts.map +1 -0
  113. package/dist/learning/StatisticalAnalysis.js +170 -0
  114. package/dist/learning/StatisticalAnalysis.js.map +1 -0
  115. package/dist/learning/SwarmIntegration.d.ts +107 -0
  116. package/dist/learning/SwarmIntegration.d.ts.map +1 -0
  117. package/dist/learning/SwarmIntegration.js +191 -0
  118. package/dist/learning/SwarmIntegration.js.map +1 -0
  119. package/dist/learning/index.d.ts +10 -0
  120. package/dist/learning/index.d.ts.map +1 -0
  121. package/dist/learning/index.js +16 -0
  122. package/dist/learning/index.js.map +1 -0
  123. package/dist/learning/types.d.ts +288 -0
  124. package/dist/learning/types.d.ts.map +1 -0
  125. package/dist/learning/types.js +9 -0
  126. package/dist/learning/types.js.map +1 -0
  127. package/dist/mcp/handlers/phase2/Phase2Tools.d.ts +175 -0
  128. package/dist/mcp/handlers/phase2/Phase2Tools.d.ts.map +1 -0
  129. package/dist/mcp/handlers/phase2/Phase2Tools.js +693 -0
  130. package/dist/mcp/handlers/phase2/Phase2Tools.js.map +1 -0
  131. package/dist/mcp/server.d.ts.map +1 -1
  132. package/dist/mcp/server.js +171 -9
  133. package/dist/mcp/server.js.map +1 -1
  134. package/dist/mcp/streaming/CoverageAnalyzeStreamHandler.d.ts +112 -0
  135. package/dist/mcp/streaming/CoverageAnalyzeStreamHandler.d.ts.map +1 -0
  136. package/dist/mcp/streaming/CoverageAnalyzeStreamHandler.js +341 -0
  137. package/dist/mcp/streaming/CoverageAnalyzeStreamHandler.js.map +1 -0
  138. package/dist/mcp/streaming/StreamingMCPTool.d.ts +80 -0
  139. package/dist/mcp/streaming/StreamingMCPTool.d.ts.map +1 -0
  140. package/dist/mcp/streaming/StreamingMCPTool.js +276 -0
  141. package/dist/mcp/streaming/StreamingMCPTool.js.map +1 -0
  142. package/dist/mcp/streaming/TestExecuteStreamHandler.d.ts +73 -0
  143. package/dist/mcp/streaming/TestExecuteStreamHandler.d.ts.map +1 -0
  144. package/dist/mcp/streaming/TestExecuteStreamHandler.js +436 -0
  145. package/dist/mcp/streaming/TestExecuteStreamHandler.js.map +1 -0
  146. package/dist/mcp/streaming/index.d.ts +14 -0
  147. package/dist/mcp/streaming/index.d.ts.map +1 -0
  148. package/dist/mcp/streaming/index.js +30 -0
  149. package/dist/mcp/streaming/index.js.map +1 -0
  150. package/dist/mcp/streaming/types.d.ts +117 -0
  151. package/dist/mcp/streaming/types.d.ts.map +1 -0
  152. package/dist/mcp/streaming/types.js +88 -0
  153. package/dist/mcp/streaming/types.js.map +1 -0
  154. package/dist/mcp/tools.d.ts +18 -1
  155. package/dist/mcp/tools.d.ts.map +1 -1
  156. package/dist/mcp/tools.js +123 -1
  157. package/dist/mcp/tools.js.map +1 -1
  158. package/dist/reasoning/CodeSignatureGenerator.d.ts +98 -0
  159. package/dist/reasoning/CodeSignatureGenerator.d.ts.map +1 -0
  160. package/dist/reasoning/CodeSignatureGenerator.js +427 -0
  161. package/dist/reasoning/CodeSignatureGenerator.js.map +1 -0
  162. package/dist/reasoning/PatternClassifier.d.ts +98 -0
  163. package/dist/reasoning/PatternClassifier.d.ts.map +1 -0
  164. package/dist/reasoning/PatternClassifier.js +345 -0
  165. package/dist/reasoning/PatternClassifier.js.map +1 -0
  166. package/dist/reasoning/PatternExtractor.d.ts +131 -0
  167. package/dist/reasoning/PatternExtractor.d.ts.map +1 -0
  168. package/dist/reasoning/PatternExtractor.js +539 -0
  169. package/dist/reasoning/PatternExtractor.js.map +1 -0
  170. package/dist/reasoning/PatternMemoryIntegration.d.ts +102 -0
  171. package/dist/reasoning/PatternMemoryIntegration.d.ts.map +1 -0
  172. package/dist/reasoning/PatternMemoryIntegration.js +336 -0
  173. package/dist/reasoning/PatternMemoryIntegration.js.map +1 -0
  174. package/dist/reasoning/QEReasoningBank.d.ts +121 -0
  175. package/dist/reasoning/QEReasoningBank.d.ts.map +1 -0
  176. package/dist/reasoning/QEReasoningBank.js +235 -0
  177. package/dist/reasoning/QEReasoningBank.js.map +1 -0
  178. package/dist/reasoning/TestTemplateCreator.d.ts +95 -0
  179. package/dist/reasoning/TestTemplateCreator.d.ts.map +1 -0
  180. package/dist/reasoning/TestTemplateCreator.js +535 -0
  181. package/dist/reasoning/TestTemplateCreator.js.map +1 -0
  182. package/dist/reasoning/index.d.ts +10 -0
  183. package/dist/reasoning/index.d.ts.map +1 -0
  184. package/dist/reasoning/index.js +31 -0
  185. package/dist/reasoning/index.js.map +1 -0
  186. package/dist/reasoning/types.d.ts +717 -0
  187. package/dist/reasoning/types.d.ts.map +1 -0
  188. package/dist/reasoning/types.js +57 -0
  189. package/dist/reasoning/types.js.map +1 -0
  190. package/dist/types/index.d.ts +20 -1
  191. package/dist/types/index.d.ts.map +1 -1
  192. package/dist/types/index.js.map +1 -1
  193. package/dist/types/pattern.types.d.ts +364 -0
  194. package/dist/types/pattern.types.d.ts.map +1 -0
  195. package/dist/types/pattern.types.js +60 -0
  196. package/dist/types/pattern.types.js.map +1 -0
  197. package/package.json +25 -3
@@ -0,0 +1,717 @@
1
+ /**
2
+ * Type Definitions for QE ReasoningBank (v1.1.0)
3
+ *
4
+ * Comprehensive TypeScript interfaces for test pattern storage,
5
+ * retrieval, and cross-project sharing.
6
+ *
7
+ * @module reasoning/types
8
+ */
9
+ /**
10
+ * Pattern classification types
11
+ */
12
+ export type PatternType = 'edge-case' | 'integration' | 'boundary' | 'error-handling' | 'unit' | 'e2e' | 'performance' | 'security' | 'accessibility' | 'regression';
13
+ /**
14
+ * Supported testing frameworks
15
+ */
16
+ export type Framework = 'jest' | 'mocha' | 'cypress' | 'vitest' | 'playwright' | 'ava' | 'tape' | 'jasmine' | 'qunit';
17
+ /**
18
+ * Supported languages
19
+ */
20
+ export type Language = 'typescript' | 'javascript' | 'tsx' | 'jsx';
21
+ /**
22
+ * Pattern quality trend
23
+ */
24
+ export type PatternTrend = 'rising' | 'stable' | 'declining';
25
+ /**
26
+ * Structured representation of code to be tested
27
+ *
28
+ * @example
29
+ * ```typescript
30
+ * const signature: CodeSignature = {
31
+ * functionName: 'calculateTotal',
32
+ * parameters: [
33
+ * { name: 'items', type: 'Item[]', optional: false },
34
+ * { name: 'taxRate', type: 'number', optional: true }
35
+ * ],
36
+ * returnType: 'number',
37
+ * imports: [
38
+ * { module: './types', identifiers: ['Item'] }
39
+ * ],
40
+ * dependencies: [],
41
+ * complexity: {
42
+ * cyclomaticComplexity: 5,
43
+ * cognitiveComplexity: 3
44
+ * },
45
+ * testStructure: {
46
+ * describeBlocks: 1,
47
+ * itBlocks: 6,
48
+ * hooks: ['beforeEach', 'afterEach']
49
+ * }
50
+ * };
51
+ * ```
52
+ */
53
+ export interface CodeSignature {
54
+ /**
55
+ * Function or class name being tested
56
+ */
57
+ functionName?: string;
58
+ /**
59
+ * Function parameters with types
60
+ */
61
+ parameters: ParameterSignature[];
62
+ /**
63
+ * Return type of the function
64
+ */
65
+ returnType?: string;
66
+ /**
67
+ * Import statements required
68
+ */
69
+ imports: ImportSignature[];
70
+ /**
71
+ * External package dependencies
72
+ */
73
+ dependencies: string[];
74
+ /**
75
+ * Code complexity metrics
76
+ */
77
+ complexity: ComplexityMetrics;
78
+ /**
79
+ * Test structure information
80
+ */
81
+ testStructure: TestStructure;
82
+ /**
83
+ * Optional class information (for class testing)
84
+ */
85
+ classInfo?: ClassSignature;
86
+ }
87
+ /**
88
+ * Function parameter signature
89
+ */
90
+ export interface ParameterSignature {
91
+ name: string;
92
+ type: string;
93
+ optional: boolean;
94
+ defaultValue?: string;
95
+ }
96
+ /**
97
+ * Import statement signature
98
+ */
99
+ export interface ImportSignature {
100
+ module: string;
101
+ identifiers: string[];
102
+ isDefault?: boolean;
103
+ namespace?: string;
104
+ }
105
+ /**
106
+ * Code complexity metrics
107
+ */
108
+ export interface ComplexityMetrics {
109
+ /**
110
+ * Cyclomatic complexity (control flow complexity)
111
+ */
112
+ cyclomaticComplexity: number;
113
+ /**
114
+ * Cognitive complexity (human readability complexity)
115
+ */
116
+ cognitiveComplexity: number;
117
+ /**
118
+ * Lines of code
119
+ */
120
+ linesOfCode?: number;
121
+ /**
122
+ * Number of branches (if/else, switch, etc.)
123
+ */
124
+ branchCount?: number;
125
+ }
126
+ /**
127
+ * Test structure metadata
128
+ */
129
+ export interface TestStructure {
130
+ /**
131
+ * Number of describe/suite blocks
132
+ */
133
+ describeBlocks: number;
134
+ /**
135
+ * Number of it/test blocks
136
+ */
137
+ itBlocks: number;
138
+ /**
139
+ * Lifecycle hooks used
140
+ */
141
+ hooks: TestHook[];
142
+ /**
143
+ * Assertion types used
144
+ */
145
+ assertionTypes?: string[];
146
+ }
147
+ /**
148
+ * Test lifecycle hooks
149
+ */
150
+ export type TestHook = 'beforeAll' | 'beforeEach' | 'afterEach' | 'afterAll';
151
+ /**
152
+ * Class signature (for class testing)
153
+ */
154
+ export interface ClassSignature {
155
+ className: string;
156
+ methods: MethodSignature[];
157
+ properties: PropertySignature[];
158
+ extends?: string;
159
+ implements?: string[];
160
+ }
161
+ /**
162
+ * Method signature within a class
163
+ */
164
+ export interface MethodSignature {
165
+ name: string;
166
+ parameters: ParameterSignature[];
167
+ returnType?: string;
168
+ isStatic: boolean;
169
+ isPrivate: boolean;
170
+ isAsync: boolean;
171
+ }
172
+ /**
173
+ * Property signature within a class
174
+ */
175
+ export interface PropertySignature {
176
+ name: string;
177
+ type: string;
178
+ isPrivate: boolean;
179
+ isReadonly: boolean;
180
+ }
181
+ /**
182
+ * Reusable test template with placeholders
183
+ *
184
+ * @example
185
+ * ```typescript
186
+ * const template: TestTemplate = {
187
+ * templateId: 'unit-calculation-basic',
188
+ * code: `
189
+ * describe('{{functionName}}', () => {
190
+ * it('should calculate {{expectedBehavior}}', () => {
191
+ * const result = {{functionName}}({{inputParams}});
192
+ * expect(result).{{assertion}}({{expectedValue}});
193
+ * });
194
+ * });
195
+ * `,
196
+ * placeholders: [
197
+ * { name: 'functionName', type: 'identifier', description: 'Function under test' },
198
+ * { name: 'expectedBehavior', type: 'value', description: 'What the test validates' },
199
+ * { name: 'inputParams', type: 'value', description: 'Input parameters' },
200
+ * { name: 'assertion', type: 'identifier', description: 'Assertion method' },
201
+ * { name: 'expectedValue', type: 'value', description: 'Expected result' }
202
+ * ],
203
+ * assertions: [
204
+ * { type: 'toEqual', template: 'expect({{actual}}).toEqual({{expected}})' }
205
+ * ]
206
+ * };
207
+ * ```
208
+ */
209
+ export interface TestTemplate {
210
+ /**
211
+ * Unique template identifier
212
+ */
213
+ templateId: string;
214
+ /**
215
+ * Template code with {{placeholders}}
216
+ */
217
+ code: string;
218
+ /**
219
+ * Placeholder definitions
220
+ */
221
+ placeholders: TemplatePlaceholder[];
222
+ /**
223
+ * Assertion templates
224
+ */
225
+ assertions: AssertionTemplate[];
226
+ /**
227
+ * Setup/teardown code (optional)
228
+ */
229
+ setup?: SetupTeardown;
230
+ /**
231
+ * Template metadata
232
+ */
233
+ metadata?: {
234
+ description?: string;
235
+ tags?: string[];
236
+ version?: string;
237
+ };
238
+ }
239
+ /**
240
+ * Template placeholder definition
241
+ */
242
+ export interface TemplatePlaceholder {
243
+ name: string;
244
+ type: PlaceholderType;
245
+ description: string;
246
+ defaultValue?: string;
247
+ validationRules?: ValidationRule[];
248
+ required?: boolean;
249
+ }
250
+ /**
251
+ * Placeholder types
252
+ */
253
+ export type PlaceholderType = 'identifier' | 'value' | 'type' | 'import' | 'expression';
254
+ /**
255
+ * Validation rule for placeholders
256
+ */
257
+ export interface ValidationRule {
258
+ type: 'regex' | 'length' | 'custom';
259
+ rule: string;
260
+ errorMessage?: string;
261
+ }
262
+ /**
263
+ * Assertion template
264
+ */
265
+ export interface AssertionTemplate {
266
+ type: AssertionType;
267
+ template: string;
268
+ description?: string;
269
+ }
270
+ /**
271
+ * Common assertion types
272
+ */
273
+ export type AssertionType = 'toBe' | 'toEqual' | 'toThrow' | 'toContain' | 'toBeGreaterThan' | 'toBeLessThan' | 'toBeNull' | 'toBeUndefined' | 'toBeTruthy' | 'toBeFalsy' | 'toHaveBeenCalled' | 'toHaveBeenCalledWith' | 'custom';
274
+ /**
275
+ * Setup and teardown code
276
+ */
277
+ export interface SetupTeardown {
278
+ beforeEach?: string;
279
+ afterEach?: string;
280
+ beforeAll?: string;
281
+ afterAll?: string;
282
+ }
283
+ /**
284
+ * Comprehensive pattern metadata
285
+ *
286
+ * @example
287
+ * ```typescript
288
+ * const metadata: PatternMetadata = {
289
+ * name: 'Error handling with custom error types',
290
+ * description: 'Test pattern for validating custom error types and messages',
291
+ * tags: ['error-handling', 'typescript', 'custom-errors'],
292
+ * language: 'typescript',
293
+ * sourceProject: 'user-service',
294
+ * version: '1.0.0',
295
+ * quality: {
296
+ * coverage: 0.95,
297
+ * maintainability: 0.88,
298
+ * reliability: 0.92
299
+ * },
300
+ * usage: {
301
+ * totalUses: 47,
302
+ * successRate: 0.94,
303
+ * avgExecutionTime: 23.5
304
+ * }
305
+ * };
306
+ * ```
307
+ */
308
+ export interface PatternMetadata {
309
+ /**
310
+ * Pattern name (human-readable)
311
+ */
312
+ name: string;
313
+ /**
314
+ * Detailed description
315
+ */
316
+ description: string;
317
+ /**
318
+ * Searchable tags
319
+ */
320
+ tags: string[];
321
+ /**
322
+ * Programming language
323
+ */
324
+ language: Language;
325
+ /**
326
+ * Source file path (optional)
327
+ */
328
+ sourceFile?: string;
329
+ /**
330
+ * Source project (optional)
331
+ */
332
+ sourceProject?: string;
333
+ /**
334
+ * Pattern author (optional)
335
+ */
336
+ author?: string;
337
+ /**
338
+ * Semantic version
339
+ */
340
+ version: string;
341
+ /**
342
+ * Quality metrics
343
+ */
344
+ quality: QualityMetrics;
345
+ /**
346
+ * Usage statistics
347
+ */
348
+ usage: UsageMetrics;
349
+ /**
350
+ * Code examples (optional)
351
+ */
352
+ examples?: CodeExample[];
353
+ }
354
+ /**
355
+ * Pattern quality metrics
356
+ */
357
+ export interface QualityMetrics {
358
+ /**
359
+ * Code coverage (0.0 - 1.0)
360
+ */
361
+ coverage: number;
362
+ /**
363
+ * Maintainability index (0.0 - 1.0)
364
+ */
365
+ maintainability: number;
366
+ /**
367
+ * Reliability score (0.0 - 1.0)
368
+ */
369
+ reliability: number;
370
+ }
371
+ /**
372
+ * Pattern usage metrics
373
+ */
374
+ export interface UsageMetrics {
375
+ /**
376
+ * Total number of times pattern was used
377
+ */
378
+ totalUses: number;
379
+ /**
380
+ * Success rate (0.0 - 1.0)
381
+ */
382
+ successRate: number;
383
+ /**
384
+ * Average execution time (milliseconds)
385
+ */
386
+ avgExecutionTime: number;
387
+ }
388
+ /**
389
+ * Code example
390
+ */
391
+ export interface CodeExample {
392
+ code: string;
393
+ description: string;
394
+ language?: Language;
395
+ }
396
+ /**
397
+ * Complete test pattern with all components
398
+ */
399
+ export interface TestPattern {
400
+ /**
401
+ * Unique pattern identifier (UUID)
402
+ */
403
+ id: string;
404
+ /**
405
+ * Pattern classification
406
+ */
407
+ patternType: PatternType;
408
+ /**
409
+ * Testing framework
410
+ */
411
+ framework: Framework;
412
+ /**
413
+ * Code signature
414
+ */
415
+ codeSignature: CodeSignature;
416
+ /**
417
+ * Test template
418
+ */
419
+ testTemplate: TestTemplate;
420
+ /**
421
+ * Pattern metadata
422
+ */
423
+ metadata: PatternMetadata;
424
+ /**
425
+ * Creation timestamp
426
+ */
427
+ createdAt?: Date;
428
+ /**
429
+ * Last update timestamp
430
+ */
431
+ updatedAt?: Date;
432
+ }
433
+ /**
434
+ * Pattern search query
435
+ */
436
+ export interface PatternQuery {
437
+ /**
438
+ * Code signature to match (partial match supported)
439
+ */
440
+ codeSignature?: Partial<CodeSignature>;
441
+ /**
442
+ * Framework filter
443
+ */
444
+ framework?: Framework;
445
+ /**
446
+ * Pattern type filter
447
+ */
448
+ patternType?: PatternType;
449
+ /**
450
+ * Tag search
451
+ */
452
+ tags?: string[];
453
+ /**
454
+ * Minimum similarity threshold (0.0 - 1.0)
455
+ */
456
+ minSimilarity?: number;
457
+ /**
458
+ * Full-text search query
459
+ */
460
+ searchText?: string;
461
+ /**
462
+ * Result limit
463
+ */
464
+ limit?: number;
465
+ /**
466
+ * Result offset (pagination)
467
+ */
468
+ offset?: number;
469
+ /**
470
+ * Sort order
471
+ */
472
+ sortBy?: 'similarity' | 'usage' | 'quality' | 'recent';
473
+ /**
474
+ * Sort direction
475
+ */
476
+ sortOrder?: 'asc' | 'desc';
477
+ }
478
+ /**
479
+ * Pattern match result with similarity score
480
+ */
481
+ export interface PatternMatch {
482
+ /**
483
+ * Matched pattern
484
+ */
485
+ pattern: TestPattern;
486
+ /**
487
+ * Overall similarity score (0.0 - 1.0)
488
+ */
489
+ similarityScore: number;
490
+ /**
491
+ * Detailed match breakdown
492
+ */
493
+ matchDetails: MatchDetails;
494
+ /**
495
+ * Match rank
496
+ */
497
+ rank?: number;
498
+ }
499
+ /**
500
+ * Detailed similarity breakdown
501
+ */
502
+ export interface MatchDetails {
503
+ /**
504
+ * Code structure similarity (0.0 - 1.0)
505
+ */
506
+ structureSimilarity: number;
507
+ /**
508
+ * Identifier/naming similarity (0.0 - 1.0)
509
+ */
510
+ identifierSimilarity: number;
511
+ /**
512
+ * Metadata similarity (0.0 - 1.0)
513
+ */
514
+ metadataSimilarity: number;
515
+ /**
516
+ * Usage-based scoring (0.0 - 1.0)
517
+ */
518
+ usageScore: number;
519
+ /**
520
+ * Matching components
521
+ */
522
+ matchingComponents?: {
523
+ parametersMatch: boolean;
524
+ returnTypeMatch: boolean;
525
+ complexityMatch: boolean;
526
+ frameworkMatch: boolean;
527
+ };
528
+ }
529
+ /**
530
+ * Pattern extraction options
531
+ */
532
+ export interface ExtractionOptions {
533
+ /**
534
+ * Test files to extract from (glob patterns)
535
+ */
536
+ testFiles: string[];
537
+ /**
538
+ * Testing framework
539
+ */
540
+ framework: Framework;
541
+ /**
542
+ * Project identifier
543
+ */
544
+ projectId: string;
545
+ /**
546
+ * Minimum quality threshold (0.0 - 1.0)
547
+ */
548
+ minQuality?: number;
549
+ /**
550
+ * Patterns to exclude (regex)
551
+ */
552
+ excludePatterns?: string[];
553
+ /**
554
+ * Extract only specific pattern types
555
+ */
556
+ patternTypes?: PatternType[];
557
+ /**
558
+ * Enable pattern deduplication
559
+ */
560
+ deduplicate?: boolean;
561
+ }
562
+ /**
563
+ * Framework transformation rules
564
+ */
565
+ export interface TransformationRules {
566
+ /**
567
+ * Import statement mappings
568
+ * @example { '@testing-library/react': '@testing-library/vue' }
569
+ */
570
+ importMappings?: Record<string, string>;
571
+ /**
572
+ * Identifier name mappings
573
+ * @example { 'describe': 'suite', 'it': 'test' }
574
+ */
575
+ identifierMappings?: Record<string, string>;
576
+ /**
577
+ * Assertion method mappings
578
+ * @example { 'toBe': 'toStrictEqual' }
579
+ */
580
+ assertionMappings?: Record<string, string>;
581
+ /**
582
+ * Custom transformation function
583
+ */
584
+ customTransformations?: Array<{
585
+ pattern: string;
586
+ replacement: string;
587
+ description?: string;
588
+ }>;
589
+ }
590
+ /**
591
+ * Cross-project mapping
592
+ */
593
+ export interface CrossProjectMapping {
594
+ id: number;
595
+ patternId: string;
596
+ sourceFramework: Framework;
597
+ targetFramework: Framework;
598
+ transformationRules: TransformationRules;
599
+ compatibilityScore: number;
600
+ projectCount: number;
601
+ successRate: number;
602
+ }
603
+ /**
604
+ * Pattern usage statistics
605
+ */
606
+ export interface PatternStats {
607
+ patternId: string;
608
+ totalUses: number;
609
+ successRate: number;
610
+ avgCoverageGain: number;
611
+ projectCount: number;
612
+ lastUsed: Date;
613
+ trend: PatternTrend;
614
+ }
615
+ /**
616
+ * Usage update result
617
+ */
618
+ export interface UsageResult {
619
+ success: boolean;
620
+ coverageGain?: number;
621
+ executionTime?: number;
622
+ errors?: string[];
623
+ }
624
+ /**
625
+ * Pattern filter for export/analytics
626
+ */
627
+ export interface PatternFilter {
628
+ framework?: Framework;
629
+ patternType?: PatternType;
630
+ projectId?: string;
631
+ minQuality?: number;
632
+ dateRange?: {
633
+ start: Date;
634
+ end: Date;
635
+ };
636
+ }
637
+ /**
638
+ * Cleanup options
639
+ */
640
+ export interface CleanupOptions {
641
+ /**
642
+ * Delete patterns older than this date
643
+ */
644
+ olderThan?: Date;
645
+ /**
646
+ * Minimum usage count to keep
647
+ */
648
+ minUsage?: number;
649
+ /**
650
+ * Minimum quality score to keep
651
+ */
652
+ minQuality?: number;
653
+ /**
654
+ * Dry run (don't actually delete)
655
+ */
656
+ dryRun?: boolean;
657
+ }
658
+ /**
659
+ * ReasoningBank initialization options
660
+ */
661
+ export interface ReasoningBankConfig {
662
+ /**
663
+ * SQLite database file path
664
+ */
665
+ databasePath: string;
666
+ /**
667
+ * LRU cache size (number of patterns)
668
+ */
669
+ cacheSize?: number;
670
+ /**
671
+ * Cache TTL (milliseconds)
672
+ */
673
+ cacheTTL?: number;
674
+ /**
675
+ * Enable ML-powered pattern matching
676
+ */
677
+ enableMLMatching?: boolean;
678
+ /**
679
+ * Similarity algorithm
680
+ */
681
+ similarityAlgorithm?: 'hybrid-tfidf' | 'cosine' | 'jaccard' | 'ml';
682
+ /**
683
+ * Enable auto-extraction on test execution
684
+ */
685
+ autoExtract?: boolean;
686
+ /**
687
+ * Pattern quality threshold for auto-storage
688
+ */
689
+ autoStoreQualityThreshold?: number;
690
+ }
691
+ /**
692
+ * ReasoningBank specific errors
693
+ */
694
+ export declare class ReasoningBankError extends Error {
695
+ code: string;
696
+ details?: Record<string, unknown> | undefined;
697
+ constructor(message: string, code: string, details?: Record<string, unknown> | undefined);
698
+ }
699
+ /**
700
+ * Pattern validation error
701
+ */
702
+ export declare class PatternValidationError extends ReasoningBankError {
703
+ constructor(message: string, details?: Record<string, unknown>);
704
+ }
705
+ /**
706
+ * Pattern not found error
707
+ */
708
+ export declare class PatternNotFoundError extends ReasoningBankError {
709
+ constructor(patternId: string);
710
+ }
711
+ /**
712
+ * Similarity computation error
713
+ */
714
+ export declare class SimilarityComputationError extends ReasoningBankError {
715
+ constructor(message: string, details?: Record<string, unknown>);
716
+ }
717
+ //# sourceMappingURL=types.d.ts.map