atlas-pipeline-mcp 1.0.16 → 1.0.18

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 (58) hide show
  1. package/README.md +45 -1
  2. package/dist/mcp.js +263 -0
  3. package/dist/mcp.js.map +1 -1
  4. package/dist/providers/llm-provider.d.ts +60 -25
  5. package/dist/providers/llm-provider.d.ts.map +1 -1
  6. package/dist/providers/llm-provider.js +154 -73
  7. package/dist/providers/llm-provider.js.map +1 -1
  8. package/dist/server.js +3 -3
  9. package/dist/server.js.map +1 -1
  10. package/dist/tools/context.js.map +1 -1
  11. package/dist/tools/critique.d.ts.map +1 -1
  12. package/dist/tools/critique.js +4 -3
  13. package/dist/tools/critique.js.map +1 -1
  14. package/dist/tools/debug.d.ts +101 -0
  15. package/dist/tools/debug.d.ts.map +1 -0
  16. package/dist/tools/debug.js +712 -0
  17. package/dist/tools/debug.js.map +1 -0
  18. package/dist/tools/decompose.d.ts.map +1 -1
  19. package/dist/tools/decompose.js +40 -28
  20. package/dist/tools/decompose.js.map +1 -1
  21. package/dist/tools/docs.d.ts +94 -0
  22. package/dist/tools/docs.d.ts.map +1 -0
  23. package/dist/tools/docs.js +508 -0
  24. package/dist/tools/docs.js.map +1 -0
  25. package/dist/tools/explain.d.ts +82 -0
  26. package/dist/tools/explain.d.ts.map +1 -0
  27. package/dist/tools/explain.js +543 -0
  28. package/dist/tools/explain.js.map +1 -0
  29. package/dist/tools/intent.d.ts.map +1 -1
  30. package/dist/tools/intent.js +33 -20
  31. package/dist/tools/intent.js.map +1 -1
  32. package/dist/tools/optimize.d.ts.map +1 -1
  33. package/dist/tools/optimize.js +18 -3
  34. package/dist/tools/optimize.js.map +1 -1
  35. package/dist/tools/security.d.ts +45 -0
  36. package/dist/tools/security.d.ts.map +1 -0
  37. package/dist/tools/security.js +417 -0
  38. package/dist/tools/security.js.map +1 -0
  39. package/dist/tools/testgen.d.ts +52 -0
  40. package/dist/tools/testgen.d.ts.map +1 -0
  41. package/dist/tools/testgen.js +413 -0
  42. package/dist/tools/testgen.js.map +1 -0
  43. package/dist/tools/think.d.ts +187 -0
  44. package/dist/tools/think.d.ts.map +1 -0
  45. package/dist/tools/think.js +432 -0
  46. package/dist/tools/think.js.map +1 -0
  47. package/dist/tools/variants.d.ts.map +1 -1
  48. package/dist/tools/variants.js +41 -29
  49. package/dist/tools/variants.js.map +1 -1
  50. package/dist/types.d.ts +77 -20
  51. package/dist/types.d.ts.map +1 -1
  52. package/dist/types.js +21 -0
  53. package/dist/types.js.map +1 -1
  54. package/dist/utils.d.ts +108 -12
  55. package/dist/utils.d.ts.map +1 -1
  56. package/dist/utils.js +302 -68
  57. package/dist/utils.js.map +1 -1
  58. package/package.json +2 -3
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Atlas Server - Test Generation Tool
3
+ *
4
+ * Automatic test generation capabilities:
5
+ * - Unit test generation
6
+ * - Integration test generation
7
+ * - Test case extraction from code
8
+ * - Mock/stub generation
9
+ * - Edge case identification
10
+ * - Coverage suggestions
11
+ */
12
+ export type TestFramework = 'jest' | 'vitest' | 'mocha' | 'pytest' | 'unittest' | 'go_test' | 'rspec' | 'auto';
13
+ export type TestType = 'unit' | 'integration' | 'e2e' | 'snapshot' | 'property';
14
+ export interface TestCase {
15
+ name: string;
16
+ description: string;
17
+ type: TestType;
18
+ input: string;
19
+ expectedOutput: string;
20
+ edgeCase: boolean;
21
+ }
22
+ export interface GeneratedTest {
23
+ code: string;
24
+ framework: TestFramework;
25
+ testCases: TestCase[];
26
+ imports: string[];
27
+ mocks: string[];
28
+ setupCode?: string;
29
+ teardownCode?: string;
30
+ }
31
+ export interface TestGenerationResult {
32
+ tests: GeneratedTest;
33
+ coverage: CoverageSuggestion;
34
+ recommendations: string[];
35
+ generatedAt: string;
36
+ }
37
+ export interface CoverageSuggestion {
38
+ estimatedCoverage: number;
39
+ uncoveredPaths: string[];
40
+ suggestedAdditionalTests: string[];
41
+ }
42
+ /**
43
+ * Generate tests for the given code
44
+ */
45
+ export declare function generateTests(code: string, options?: {
46
+ language?: string;
47
+ framework?: TestFramework;
48
+ testType?: TestType;
49
+ functionName?: string;
50
+ context?: string;
51
+ }): Promise<TestGenerationResult>;
52
+ //# sourceMappingURL=testgen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testgen.d.ts","sourceRoot":"","sources":["../../src/tools/testgen.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AASH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAE/G,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,aAAa,GAAG,KAAK,GAAG,UAAU,GAAG,UAAU,CAAC;AAEhF,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,aAAa,CAAC;IACzB,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,kBAAkB;IACjC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,wBAAwB,EAAE,MAAM,EAAE,CAAC;CACpC;AAMD;;GAEG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE;IACP,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;CACb,GACL,OAAO,CAAC,oBAAoB,CAAC,CAgE/B"}
@@ -0,0 +1,413 @@
1
+ /**
2
+ * Atlas Server - Test Generation Tool
3
+ *
4
+ * Automatic test generation capabilities:
5
+ * - Unit test generation
6
+ * - Integration test generation
7
+ * - Test case extraction from code
8
+ * - Mock/stub generation
9
+ * - Edge case identification
10
+ * - Coverage suggestions
11
+ */
12
+ import { getActiveProvider, isNoLLMMode } from '../providers/index.js';
13
+ import { logger } from '../utils.js';
14
+ // ============================================================================
15
+ // Test Generation
16
+ // ============================================================================
17
+ /**
18
+ * Generate tests for the given code
19
+ */
20
+ export async function generateTests(code, options = {}) {
21
+ const { language, framework = 'auto', testType = 'unit', functionName, context } = options;
22
+ logger.debug({ language, framework, testType }, 'Starting test generation');
23
+ // Detect language and framework if not provided
24
+ const detectedLanguage = language ?? detectLanguage(code);
25
+ const detectedFramework = framework === 'auto' ? detectFramework(detectedLanguage) : framework;
26
+ // Extract function signatures and analyze code structure
27
+ const codeAnalysis = analyzeCodeForTesting(code, detectedLanguage);
28
+ // Generate test cases
29
+ let testCases;
30
+ let generatedCode;
31
+ let mocks = [];
32
+ let imports = [];
33
+ if (!isNoLLMMode()) {
34
+ try {
35
+ const aiResult = await generateTestsWithAI(code, {
36
+ language: detectedLanguage,
37
+ framework: detectedFramework,
38
+ testType,
39
+ functionName,
40
+ context,
41
+ codeAnalysis,
42
+ });
43
+ testCases = aiResult.testCases;
44
+ generatedCode = aiResult.code;
45
+ mocks = aiResult.mocks;
46
+ imports = aiResult.imports;
47
+ }
48
+ catch (error) {
49
+ logger.warn({ error }, 'AI test generation failed, using heuristic generation');
50
+ const heuristicResult = generateHeuristicTests(code, detectedLanguage, detectedFramework, codeAnalysis);
51
+ testCases = heuristicResult.testCases;
52
+ generatedCode = heuristicResult.code;
53
+ imports = heuristicResult.imports;
54
+ }
55
+ }
56
+ else {
57
+ const heuristicResult = generateHeuristicTests(code, detectedLanguage, detectedFramework, codeAnalysis);
58
+ testCases = heuristicResult.testCases;
59
+ generatedCode = heuristicResult.code;
60
+ imports = heuristicResult.imports;
61
+ }
62
+ // Generate coverage suggestions
63
+ const coverage = generateCoverageSuggestions(code, testCases, codeAnalysis);
64
+ // Generate recommendations
65
+ const recommendations = generateTestRecommendations(testCases, coverage, detectedFramework);
66
+ return {
67
+ tests: {
68
+ code: generatedCode,
69
+ framework: detectedFramework,
70
+ testCases,
71
+ imports,
72
+ mocks,
73
+ },
74
+ coverage,
75
+ recommendations,
76
+ generatedAt: new Date().toISOString(),
77
+ };
78
+ }
79
+ function analyzeCodeForTesting(code, language) {
80
+ const analysis = {
81
+ functions: [],
82
+ classes: [],
83
+ exports: [],
84
+ dependencies: [],
85
+ hasAsync: false,
86
+ hasCallbacks: false,
87
+ };
88
+ // Detect functions based on language
89
+ if (['typescript', 'javascript'].includes(language.toLowerCase())) {
90
+ // Function declarations
91
+ const funcRegex = /(?:export\s+)?(?:async\s+)?function\s+(\w+)\s*\(([^)]*)\)(?:\s*:\s*([^{]+))?/g;
92
+ let match;
93
+ while ((match = funcRegex.exec(code)) !== null) {
94
+ analysis.functions.push({
95
+ name: match[1],
96
+ params: match[2] ? match[2].split(',').map(p => p.trim()) : [],
97
+ returnType: match[3]?.trim(),
98
+ isAsync: code.slice(Math.max(0, match.index - 10), match.index).includes('async'),
99
+ isExported: code.slice(Math.max(0, match.index - 10), match.index).includes('export'),
100
+ });
101
+ }
102
+ // Arrow functions
103
+ const arrowRegex = /(?:export\s+)?(?:const|let|var)\s+(\w+)\s*=\s*(?:async\s+)?\([^)]*\)\s*(?::\s*[^=]+)?\s*=>/g;
104
+ while ((match = arrowRegex.exec(code)) !== null) {
105
+ const funcStart = match.index;
106
+ const isAsync = code.slice(funcStart, funcStart + 50).includes('async');
107
+ analysis.functions.push({
108
+ name: match[1],
109
+ params: [],
110
+ isAsync,
111
+ isExported: code.slice(Math.max(0, funcStart - 10), funcStart).includes('export'),
112
+ });
113
+ }
114
+ // Classes
115
+ const classRegex = /(?:export\s+)?class\s+(\w+)/g;
116
+ while ((match = classRegex.exec(code)) !== null) {
117
+ analysis.classes.push(match[1]);
118
+ }
119
+ // Check for async/callbacks
120
+ analysis.hasAsync = /async\s+|await\s+|\.then\s*\(|Promise/g.test(code);
121
+ analysis.hasCallbacks = /callback|cb\s*\(|done\s*\(/g.test(code);
122
+ // Dependencies (imports)
123
+ const importRegex = /import\s+.*\s+from\s+['"]([^'"]+)['"]/g;
124
+ while ((match = importRegex.exec(code)) !== null) {
125
+ analysis.dependencies.push(match[1]);
126
+ }
127
+ }
128
+ else if (language.toLowerCase() === 'python') {
129
+ // Python function detection
130
+ const pyFuncRegex = /(?:async\s+)?def\s+(\w+)\s*\(([^)]*)\)/g;
131
+ let match;
132
+ while ((match = pyFuncRegex.exec(code)) !== null) {
133
+ analysis.functions.push({
134
+ name: match[1],
135
+ params: match[2] ? match[2].split(',').map(p => p.trim().split(':')[0].trim()) : [],
136
+ isAsync: code.slice(Math.max(0, match.index - 10), match.index).includes('async'),
137
+ isExported: true, // Python doesn't have explicit exports
138
+ });
139
+ }
140
+ // Python classes
141
+ const pyClassRegex = /class\s+(\w+)/g;
142
+ while ((match = pyClassRegex.exec(code)) !== null) {
143
+ analysis.classes.push(match[1]);
144
+ }
145
+ analysis.hasAsync = /async\s+def|await\s+/g.test(code);
146
+ }
147
+ return analysis;
148
+ }
149
+ // ============================================================================
150
+ // AI Test Generation
151
+ // ============================================================================
152
+ async function generateTestsWithAI(code, options) {
153
+ const provider = await getActiveProvider();
154
+ const prompt = `Generate comprehensive ${options.testType} tests for this code.
155
+
156
+ ## Code to Test
157
+ \`\`\`${options.language}
158
+ ${code}
159
+ \`\`\`
160
+
161
+ ## Requirements
162
+ - Framework: ${options.framework}
163
+ - Language: ${options.language}
164
+ - Test Type: ${options.testType}
165
+ ${options.functionName ? `- Focus on function: ${options.functionName}` : ''}
166
+ ${options.context ? `- Context: ${options.context}` : ''}
167
+
168
+ ## Functions Found
169
+ ${options.codeAnalysis.functions.map(f => `- ${f.name}(${f.params.join(', ')})`).join('\n')}
170
+
171
+ ## Generate Tests That Cover:
172
+ 1. Happy path scenarios
173
+ 2. Edge cases (null, undefined, empty, boundary values)
174
+ 3. Error handling
175
+ 4. Async behavior (if applicable)
176
+
177
+ ## Output Format
178
+ {
179
+ "code": "Complete test file code",
180
+ "testCases": [
181
+ {
182
+ "name": "test name",
183
+ "description": "what it tests",
184
+ "type": "unit|integration|e2e",
185
+ "input": "input description",
186
+ "expectedOutput": "expected output",
187
+ "edgeCase": true/false
188
+ }
189
+ ],
190
+ "mocks": ["mock descriptions"],
191
+ "imports": ["required imports"]
192
+ }`;
193
+ const response = await provider.completeJson(prompt, {
194
+ systemPrompt: 'You are an expert test engineer. Generate comprehensive, well-structured tests with good coverage. Return valid JSON only.',
195
+ temperature: 0.3,
196
+ maxTokens: 4096,
197
+ });
198
+ if (response.data) {
199
+ return response.data;
200
+ }
201
+ throw new Error('Failed to generate tests with AI');
202
+ }
203
+ // ============================================================================
204
+ // Heuristic Test Generation
205
+ // ============================================================================
206
+ function generateHeuristicTests(code, language, framework, analysis) {
207
+ const testCases = [];
208
+ const imports = [];
209
+ let testCode = '';
210
+ if (['typescript', 'javascript'].includes(language.toLowerCase())) {
211
+ // Generate Jest/Vitest style tests
212
+ const isVitest = framework === 'vitest';
213
+ imports.push(isVitest
214
+ ? `import { describe, it, expect, beforeEach, afterEach } from 'vitest';`
215
+ : `import { describe, it, expect, beforeEach, afterEach } from '@jest/globals';`);
216
+ testCode = `${imports.join('\n')}
217
+ // Import the module to test
218
+ // import { ${analysis.functions.map(f => f.name).join(', ')} } from './module';
219
+
220
+ `;
221
+ for (const func of analysis.functions) {
222
+ testCode += `describe('${func.name}', () => {\n`;
223
+ // Happy path test
224
+ testCode += ` it('should work correctly with valid input', ${func.isAsync ? 'async ' : ''}() => {\n`;
225
+ testCode += ` // Arrange\n`;
226
+ testCode += ` const input = ${generateSampleInput(func.params)};\n`;
227
+ testCode += ` \n`;
228
+ testCode += ` // Act\n`;
229
+ testCode += ` const result = ${func.isAsync ? 'await ' : ''}${func.name}(${func.params.length > 0 ? 'input' : ''});\n`;
230
+ testCode += ` \n`;
231
+ testCode += ` // Assert\n`;
232
+ testCode += ` expect(result).toBeDefined();\n`;
233
+ testCode += ` });\n\n`;
234
+ testCases.push({
235
+ name: `${func.name} - happy path`,
236
+ description: 'Tests basic functionality with valid input',
237
+ type: 'unit',
238
+ input: 'valid input',
239
+ expectedOutput: 'expected result',
240
+ edgeCase: false,
241
+ });
242
+ // Edge case: empty input
243
+ if (func.params.length > 0) {
244
+ testCode += ` it('should handle empty/null input gracefully', ${func.isAsync ? 'async ' : ''}() => {\n`;
245
+ testCode += ` // Test with null/undefined/empty values\n`;
246
+ testCode += ` expect(() => ${func.name}(null)).toThrow();\n`;
247
+ testCode += ` });\n\n`;
248
+ testCases.push({
249
+ name: `${func.name} - null input`,
250
+ description: 'Tests behavior with null/undefined input',
251
+ type: 'unit',
252
+ input: 'null/undefined',
253
+ expectedOutput: 'should throw or handle gracefully',
254
+ edgeCase: true,
255
+ });
256
+ }
257
+ // Error handling test
258
+ testCode += ` it('should handle errors correctly', ${func.isAsync ? 'async ' : ''}() => {\n`;
259
+ testCode += ` // Test error scenarios\n`;
260
+ testCode += ` // Add specific error test cases here\n`;
261
+ testCode += ` });\n`;
262
+ testCases.push({
263
+ name: `${func.name} - error handling`,
264
+ description: 'Tests error handling behavior',
265
+ type: 'unit',
266
+ input: 'invalid input',
267
+ expectedOutput: 'error or error message',
268
+ edgeCase: true,
269
+ });
270
+ testCode += `});\n\n`;
271
+ }
272
+ }
273
+ else if (language.toLowerCase() === 'python') {
274
+ // Generate pytest style tests
275
+ imports.push('import pytest');
276
+ testCode = `${imports.join('\n')}
277
+ # Import the module to test
278
+ # from module import ${analysis.functions.map(f => f.name).join(', ')}
279
+
280
+ `;
281
+ for (const func of analysis.functions) {
282
+ testCode += `class Test${capitalize(func.name)}:\n`;
283
+ // Happy path
284
+ testCode += ` def test_${func.name}_with_valid_input(self):\n`;
285
+ testCode += ` """Test ${func.name} with valid input."""\n`;
286
+ testCode += ` # Arrange\n`;
287
+ testCode += ` # input_data = ...\n`;
288
+ testCode += ` \n`;
289
+ testCode += ` # Act\n`;
290
+ testCode += ` # result = ${func.name}(input_data)\n`;
291
+ testCode += ` \n`;
292
+ testCode += ` # Assert\n`;
293
+ testCode += ` # assert result is not None\n`;
294
+ testCode += ` pass\n\n`;
295
+ testCases.push({
296
+ name: `test_${func.name}_with_valid_input`,
297
+ description: 'Tests basic functionality with valid input',
298
+ type: 'unit',
299
+ input: 'valid input',
300
+ expectedOutput: 'expected result',
301
+ edgeCase: false,
302
+ });
303
+ // Edge case
304
+ testCode += ` def test_${func.name}_with_none_input(self):\n`;
305
+ testCode += ` """Test ${func.name} with None input."""\n`;
306
+ testCode += ` with pytest.raises((TypeError, ValueError)):\n`;
307
+ testCode += ` ${func.name}(None)\n\n`;
308
+ testCases.push({
309
+ name: `test_${func.name}_with_none_input`,
310
+ description: 'Tests behavior with None input',
311
+ type: 'unit',
312
+ input: 'None',
313
+ expectedOutput: 'raises exception',
314
+ edgeCase: true,
315
+ });
316
+ }
317
+ }
318
+ else {
319
+ // Generic test template
320
+ testCode = `// Test file for ${language}\n// Add your test cases here\n`;
321
+ }
322
+ return { code: testCode, testCases, imports };
323
+ }
324
+ // ============================================================================
325
+ // Helper Functions
326
+ // ============================================================================
327
+ function detectLanguage(code) {
328
+ if (code.includes('interface ') || code.includes(': string') || code.includes(': number')) {
329
+ return 'typescript';
330
+ }
331
+ if (code.includes('function ') || code.includes('=>') || code.includes('const ')) {
332
+ return 'javascript';
333
+ }
334
+ if (code.includes('def ') && code.includes(':')) {
335
+ return 'python';
336
+ }
337
+ if (code.includes('func ') && code.includes('package ')) {
338
+ return 'go';
339
+ }
340
+ return 'javascript';
341
+ }
342
+ function detectFramework(language) {
343
+ switch (language.toLowerCase()) {
344
+ case 'typescript':
345
+ case 'javascript':
346
+ return 'vitest';
347
+ case 'python':
348
+ return 'pytest';
349
+ case 'go':
350
+ return 'go_test';
351
+ case 'ruby':
352
+ return 'rspec';
353
+ default:
354
+ return 'jest';
355
+ }
356
+ }
357
+ function generateSampleInput(params) {
358
+ if (params.length === 0)
359
+ return '{}';
360
+ if (params.length === 1)
361
+ return `'test-value'`;
362
+ return `{ ${params.map(p => `${p.split(':')[0].trim()}: 'value'`).join(', ')} }`;
363
+ }
364
+ function capitalize(str) {
365
+ return str.charAt(0).toUpperCase() + str.slice(1);
366
+ }
367
+ function generateCoverageSuggestions(code, testCases, analysis) {
368
+ const totalFunctions = analysis.functions.length;
369
+ const testedFunctions = new Set(testCases.map(tc => tc.name.split(' ')[0])).size;
370
+ const estimatedCoverage = totalFunctions > 0
371
+ ? Math.round((testedFunctions / totalFunctions) * 70) // Assume 70% max from generated tests
372
+ : 50;
373
+ const uncoveredPaths = [];
374
+ const suggestedAdditionalTests = [];
375
+ // Check for untested scenarios
376
+ if (analysis.hasAsync && !testCases.some(tc => tc.description.includes('async'))) {
377
+ suggestedAdditionalTests.push('Add tests for async error handling and timeout scenarios');
378
+ }
379
+ if (analysis.hasCallbacks && !testCases.some(tc => tc.description.includes('callback'))) {
380
+ suggestedAdditionalTests.push('Add tests for callback error scenarios');
381
+ }
382
+ // Suggest edge cases
383
+ suggestedAdditionalTests.push('Add boundary value tests (min/max values)');
384
+ suggestedAdditionalTests.push('Add performance/load tests for critical paths');
385
+ suggestedAdditionalTests.push('Add integration tests with external dependencies');
386
+ return {
387
+ estimatedCoverage,
388
+ uncoveredPaths,
389
+ suggestedAdditionalTests,
390
+ };
391
+ }
392
+ function generateTestRecommendations(testCases, coverage, framework) {
393
+ const recommendations = [];
394
+ // Coverage recommendations
395
+ if (coverage.estimatedCoverage < 80) {
396
+ recommendations.push(`Aim for at least 80% code coverage (currently estimated at ${coverage.estimatedCoverage}%)`);
397
+ }
398
+ // Edge case recommendations
399
+ const edgeCaseCount = testCases.filter(tc => tc.edgeCase).length;
400
+ if (edgeCaseCount < 3) {
401
+ recommendations.push('Add more edge case tests (boundary values, null checks, error scenarios)');
402
+ }
403
+ // Framework-specific recommendations
404
+ if (framework === 'jest' || framework === 'vitest') {
405
+ recommendations.push('Consider using snapshot testing for UI components');
406
+ recommendations.push('Use beforeEach/afterEach for proper test isolation');
407
+ }
408
+ // General recommendations
409
+ recommendations.push('Run tests with coverage reporting enabled');
410
+ recommendations.push('Add CI/CD integration to run tests on every commit');
411
+ return recommendations;
412
+ }
413
+ //# sourceMappingURL=testgen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testgen.js","sourceRoot":"","sources":["../../src/tools/testgen.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AA0CrC,+EAA+E;AAC/E,kBAAkB;AAClB,+EAA+E;AAE/E;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,IAAY,EACZ,UAMI,EAAE;IAEN,MAAM,EAAE,QAAQ,EAAE,SAAS,GAAG,MAAM,EAAE,QAAQ,GAAG,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAE3F,MAAM,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,0BAA0B,CAAC,CAAC;IAE5E,gDAAgD;IACh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CAAC,CAAC;QAC1E,eAAe,CAAC,IAAI,CAAC,oDAAoD,CAAC,CAAC;IAC7E,CAAC;IAED,0BAA0B;IAC1B,eAAe,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC;IAClE,eAAe,CAAC,IAAI,CAAC,oDAAoD,CAAC,CAAC;IAE3E,OAAO,eAAe,CAAC;AACzB,CAAC"}
@@ -0,0 +1,187 @@
1
+ /**
2
+ * Atlas Server - Advanced Sequential Thinking Tool
3
+ *
4
+ * Enhanced reasoning capabilities beyond basic sequential thinking:
5
+ * - Dynamic thought branching with merge support
6
+ * - Hypothesis generation and verification
7
+ * - Confidence scoring and uncertainty tracking
8
+ * - Automatic insight extraction
9
+ * - Deadend detection and smart backtracking
10
+ * - AI-enhanced reasoning when LLM available
11
+ * - Thought summarization and compression
12
+ * - Memory of key conclusions
13
+ */
14
+ export interface ThoughtInput {
15
+ thought: string;
16
+ thoughtNumber: number;
17
+ totalThoughts: number;
18
+ nextThoughtNeeded: boolean;
19
+ isRevision?: boolean;
20
+ revisesThought?: number;
21
+ branchFromThought?: number;
22
+ branchId?: string;
23
+ mergeBranches?: string[];
24
+ thoughtType?: ThoughtType;
25
+ confidence?: number;
26
+ hypothesis?: string;
27
+ verificationResult?: 'confirmed' | 'refuted' | 'partial' | 'inconclusive';
28
+ isDeadEnd?: boolean;
29
+ keyInsight?: string;
30
+ needsMoreThoughts?: boolean;
31
+ problemContext?: string;
32
+ constraints?: string[];
33
+ }
34
+ export type ThoughtType = 'analysis' | 'hypothesis' | 'verification' | 'revision' | 'synthesis' | 'conclusion' | 'question' | 'exploration' | 'backtrack' | 'insight';
35
+ export interface ThoughtRecord extends ThoughtInput {
36
+ timestamp: string;
37
+ aiEnhancement?: string;
38
+ extractedInsights: string[];
39
+ confidenceHistory: number[];
40
+ }
41
+ export interface Branch {
42
+ id: string;
43
+ name?: string;
44
+ parentThought: number;
45
+ thoughts: ThoughtRecord[];
46
+ status: 'active' | 'merged' | 'abandoned' | 'deadend';
47
+ hypothesis?: string;
48
+ conclusion?: string;
49
+ }
50
+ export interface ThinkingSession {
51
+ id: string;
52
+ startTime: string;
53
+ problem: string;
54
+ thoughts: ThoughtRecord[];
55
+ branches: Record<string, Branch>;
56
+ currentBranch: string | null;
57
+ hypotheses: Hypothesis[];
58
+ keyInsights: string[];
59
+ deadEnds: DeadEnd[];
60
+ conclusion?: Conclusion;
61
+ overallConfidence: number;
62
+ }
63
+ export interface Hypothesis {
64
+ id: string;
65
+ statement: string;
66
+ proposedAt: number;
67
+ status: 'proposed' | 'testing' | 'confirmed' | 'refuted' | 'partial';
68
+ evidence: Evidence[];
69
+ confidence: number;
70
+ }
71
+ export interface Evidence {
72
+ thoughtNumber: number;
73
+ type: 'supports' | 'refutes' | 'neutral';
74
+ description: string;
75
+ weight: number;
76
+ }
77
+ export interface DeadEnd {
78
+ thoughtNumber: number;
79
+ reason: string;
80
+ lessonsLearned: string[];
81
+ backtrackTo: number;
82
+ }
83
+ export interface Conclusion {
84
+ answer: string;
85
+ confidence: number;
86
+ supportingThoughts: number[];
87
+ alternativeConsidered: string[];
88
+ caveats: string[];
89
+ }
90
+ export interface ThinkingResult {
91
+ thoughtNumber: number;
92
+ totalThoughts: number;
93
+ nextThoughtNeeded: boolean;
94
+ currentBranch: string | null;
95
+ branches: string[];
96
+ thoughtHistoryLength: number;
97
+ currentConfidence: number;
98
+ activeHypotheses: number;
99
+ keyInsightsCount: number;
100
+ deadEndsEncountered: number;
101
+ aiSuggestion?: string;
102
+ recommendedNextStep?: string;
103
+ progressSummary: string;
104
+ conclusion?: Conclusion;
105
+ }
106
+ export declare class AdvancedThinkingServer {
107
+ private sessions;
108
+ private currentSession;
109
+ constructor();
110
+ /**
111
+ * Start a new thinking session
112
+ */
113
+ startSession(problem: string, sessionId?: string): string;
114
+ /**
115
+ * Process a thought and return the result
116
+ */
117
+ processThought(input: ThoughtInput): Promise<ThinkingResult>;
118
+ /**
119
+ * Extract insights from thought text
120
+ */
121
+ private extractInsights;
122
+ /**
123
+ * Handle branching logic
124
+ */
125
+ private handleBranching;
126
+ /**
127
+ * Handle merging of branches
128
+ */
129
+ private handleMerge;
130
+ /**
131
+ * Add a new hypothesis
132
+ */
133
+ private addHypothesis;
134
+ /**
135
+ * Update hypothesis status based on verification
136
+ */
137
+ private updateHypothesisStatus;
138
+ /**
139
+ * Record a dead end
140
+ */
141
+ private recordDeadEnd;
142
+ /**
143
+ * Find the best point to backtrack to
144
+ */
145
+ private findBacktrackPoint;
146
+ /**
147
+ * Calculate overall confidence
148
+ */
149
+ private calculateOverallConfidence;
150
+ /**
151
+ * Get AI enhancement for the current thinking
152
+ */
153
+ private getAIEnhancement;
154
+ /**
155
+ * Generate a progress summary
156
+ */
157
+ private generateProgressSummary;
158
+ /**
159
+ * Generate final conclusion
160
+ */
161
+ private generateConclusion;
162
+ /**
163
+ * Get current session
164
+ */
165
+ getSession(): ThinkingSession | null;
166
+ /**
167
+ * Reset the server
168
+ */
169
+ reset(): void;
170
+ }
171
+ /**
172
+ * Process a thought using the advanced thinking server
173
+ */
174
+ export declare function processThought(input: ThoughtInput): Promise<ThinkingResult>;
175
+ /**
176
+ * Start a new thinking session
177
+ */
178
+ export declare function startSession(problem: string): string;
179
+ /**
180
+ * Reset the thinking server
181
+ */
182
+ export declare function resetThinking(): void;
183
+ /**
184
+ * Get the current session
185
+ */
186
+ export declare function getCurrentSession(): ThinkingSession | null;
187
+ //# sourceMappingURL=think.d.ts.map