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.
- package/README.md +45 -1
- package/dist/mcp.js +263 -0
- package/dist/mcp.js.map +1 -1
- package/dist/providers/llm-provider.d.ts +60 -25
- package/dist/providers/llm-provider.d.ts.map +1 -1
- package/dist/providers/llm-provider.js +154 -73
- package/dist/providers/llm-provider.js.map +1 -1
- package/dist/server.js +3 -3
- package/dist/server.js.map +1 -1
- package/dist/tools/context.js.map +1 -1
- package/dist/tools/critique.d.ts.map +1 -1
- package/dist/tools/critique.js +4 -3
- package/dist/tools/critique.js.map +1 -1
- package/dist/tools/debug.d.ts +101 -0
- package/dist/tools/debug.d.ts.map +1 -0
- package/dist/tools/debug.js +712 -0
- package/dist/tools/debug.js.map +1 -0
- package/dist/tools/decompose.d.ts.map +1 -1
- package/dist/tools/decompose.js +40 -28
- package/dist/tools/decompose.js.map +1 -1
- package/dist/tools/docs.d.ts +94 -0
- package/dist/tools/docs.d.ts.map +1 -0
- package/dist/tools/docs.js +508 -0
- package/dist/tools/docs.js.map +1 -0
- package/dist/tools/explain.d.ts +82 -0
- package/dist/tools/explain.d.ts.map +1 -0
- package/dist/tools/explain.js +543 -0
- package/dist/tools/explain.js.map +1 -0
- package/dist/tools/intent.d.ts.map +1 -1
- package/dist/tools/intent.js +33 -20
- package/dist/tools/intent.js.map +1 -1
- package/dist/tools/optimize.d.ts.map +1 -1
- package/dist/tools/optimize.js +18 -3
- package/dist/tools/optimize.js.map +1 -1
- package/dist/tools/security.d.ts +45 -0
- package/dist/tools/security.d.ts.map +1 -0
- package/dist/tools/security.js +417 -0
- package/dist/tools/security.js.map +1 -0
- package/dist/tools/testgen.d.ts +52 -0
- package/dist/tools/testgen.d.ts.map +1 -0
- package/dist/tools/testgen.js +413 -0
- package/dist/tools/testgen.js.map +1 -0
- package/dist/tools/think.d.ts +187 -0
- package/dist/tools/think.d.ts.map +1 -0
- package/dist/tools/think.js +432 -0
- package/dist/tools/think.js.map +1 -0
- package/dist/tools/variants.d.ts.map +1 -1
- package/dist/tools/variants.js +41 -29
- package/dist/tools/variants.js.map +1 -1
- package/dist/types.d.ts +77 -20
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +21 -0
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +108 -12
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +302 -68
- package/dist/utils.js.map +1 -1
- package/package.json +2 -3
|
@@ -0,0 +1,508 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Atlas Server - Documentation Generation Tool
|
|
3
|
+
*
|
|
4
|
+
* Automatic documentation generation:
|
|
5
|
+
* - JSDoc/TSDoc comments
|
|
6
|
+
* - Python docstrings
|
|
7
|
+
* - README generation
|
|
8
|
+
* - API documentation
|
|
9
|
+
* - Inline code comments
|
|
10
|
+
* - Changelog generation
|
|
11
|
+
*/
|
|
12
|
+
import { getActiveProvider, isNoLLMMode } from '../providers/index.js';
|
|
13
|
+
import { logger } from '../utils.js';
|
|
14
|
+
// ============================================================================
|
|
15
|
+
// Documentation Generation
|
|
16
|
+
// ============================================================================
|
|
17
|
+
/**
|
|
18
|
+
* Generate documentation for code
|
|
19
|
+
*/
|
|
20
|
+
export async function generateDocumentation(code, options = {}) {
|
|
21
|
+
const { style = 'auto', format = 'markdown', includeExamples = true, includeTypes = true, verbose = false, language, } = options;
|
|
22
|
+
logger.debug({ style, format, codeLength: code.length }, 'Starting documentation generation');
|
|
23
|
+
// Detect language and style
|
|
24
|
+
const detectedLanguage = language ?? detectLanguage(code);
|
|
25
|
+
const detectedStyle = style === 'auto' ? detectDocStyle(detectedLanguage) : style;
|
|
26
|
+
// Analyze code structure
|
|
27
|
+
const codeAnalysis = analyzeCodeStructure(code, detectedLanguage);
|
|
28
|
+
// Generate documentation
|
|
29
|
+
let documentedCode;
|
|
30
|
+
let documentation;
|
|
31
|
+
if (!isNoLLMMode()) {
|
|
32
|
+
try {
|
|
33
|
+
const aiResult = await generateDocsWithAI(code, {
|
|
34
|
+
language: detectedLanguage,
|
|
35
|
+
style: detectedStyle,
|
|
36
|
+
includeExamples,
|
|
37
|
+
includeTypes,
|
|
38
|
+
verbose,
|
|
39
|
+
codeAnalysis,
|
|
40
|
+
});
|
|
41
|
+
documentedCode = aiResult.documentedCode;
|
|
42
|
+
documentation = aiResult.documentation;
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
logger.warn({ error }, 'AI documentation generation failed, using heuristic generation');
|
|
46
|
+
const heuristicResult = generateHeuristicDocs(code, detectedLanguage, detectedStyle, codeAnalysis);
|
|
47
|
+
documentedCode = heuristicResult.documentedCode;
|
|
48
|
+
documentation = heuristicResult.documentation;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
const heuristicResult = generateHeuristicDocs(code, detectedLanguage, detectedStyle, codeAnalysis);
|
|
53
|
+
documentedCode = heuristicResult.documentedCode;
|
|
54
|
+
documentation = heuristicResult.documentation;
|
|
55
|
+
}
|
|
56
|
+
// Generate additional documentation artifacts
|
|
57
|
+
const readme = generateReadme(documentation, detectedLanguage);
|
|
58
|
+
const api = format === 'markdown' ? generateApiDocs(documentation) : undefined;
|
|
59
|
+
// Calculate stats
|
|
60
|
+
const stats = calculateDocStats(codeAnalysis, documentation);
|
|
61
|
+
return {
|
|
62
|
+
documentedCode,
|
|
63
|
+
documentation,
|
|
64
|
+
readme,
|
|
65
|
+
api,
|
|
66
|
+
stats,
|
|
67
|
+
generatedAt: new Date().toISOString(),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function analyzeCodeStructure(code, language) {
|
|
71
|
+
const analysis = {
|
|
72
|
+
functions: [],
|
|
73
|
+
classes: [],
|
|
74
|
+
types: [],
|
|
75
|
+
exports: [],
|
|
76
|
+
};
|
|
77
|
+
const lines = code.split('\n');
|
|
78
|
+
if (['typescript', 'javascript'].includes(language.toLowerCase())) {
|
|
79
|
+
// Parse functions
|
|
80
|
+
const funcRegex = /(?:export\s+)?(?:async\s+)?function\s+(\w+)\s*(<[^>]+>)?\s*\(([^)]*)\)(?:\s*:\s*([^{]+))?/g;
|
|
81
|
+
let match;
|
|
82
|
+
while ((match = funcRegex.exec(code)) !== null) {
|
|
83
|
+
const lineNumber = code.substring(0, match.index).split('\n').length;
|
|
84
|
+
const params = parseParams(match[3] ?? '');
|
|
85
|
+
analysis.functions.push({
|
|
86
|
+
name: match[1],
|
|
87
|
+
params,
|
|
88
|
+
returnType: match[4]?.trim(),
|
|
89
|
+
isAsync: match[0].includes('async'),
|
|
90
|
+
isExported: match[0].startsWith('export'),
|
|
91
|
+
lineNumber,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
// Parse arrow functions
|
|
95
|
+
const arrowRegex = /(?:export\s+)?(?:const|let)\s+(\w+)\s*(?::\s*[^=]+)?\s*=\s*(?:async\s+)?(?:<[^>]+>)?\s*\(([^)]*)\)(?:\s*:\s*([^=]+))?\s*=>/g;
|
|
96
|
+
while ((match = arrowRegex.exec(code)) !== null) {
|
|
97
|
+
const lineNumber = code.substring(0, match.index).split('\n').length;
|
|
98
|
+
const params = parseParams(match[2] ?? '');
|
|
99
|
+
analysis.functions.push({
|
|
100
|
+
name: match[1],
|
|
101
|
+
params,
|
|
102
|
+
returnType: match[3]?.trim(),
|
|
103
|
+
isAsync: match[0].includes('async'),
|
|
104
|
+
isExported: match[0].startsWith('export'),
|
|
105
|
+
lineNumber,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
// Parse classes
|
|
109
|
+
const classRegex = /(?:export\s+)?class\s+(\w+)(?:\s+extends\s+\w+)?(?:\s+implements\s+[^{]+)?\s*\{/g;
|
|
110
|
+
while ((match = classRegex.exec(code)) !== null) {
|
|
111
|
+
const lineNumber = code.substring(0, match.index).split('\n').length;
|
|
112
|
+
analysis.classes.push({
|
|
113
|
+
name: match[1],
|
|
114
|
+
methods: [],
|
|
115
|
+
properties: [],
|
|
116
|
+
isExported: match[0].startsWith('export'),
|
|
117
|
+
lineNumber,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
// Parse interfaces and types
|
|
121
|
+
const typeRegex = /(?:export\s+)?(?:(interface|type)\s+(\w+)|enum\s+(\w+))/g;
|
|
122
|
+
while ((match = typeRegex.exec(code)) !== null) {
|
|
123
|
+
const lineNumber = code.substring(0, match.index).split('\n').length;
|
|
124
|
+
const kind = match[1];
|
|
125
|
+
const name = match[2] ?? match[3];
|
|
126
|
+
analysis.types.push({
|
|
127
|
+
name,
|
|
128
|
+
kind: kind ?? 'enum',
|
|
129
|
+
lineNumber,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
else if (language.toLowerCase() === 'python') {
|
|
134
|
+
// Parse Python functions
|
|
135
|
+
const pyFuncRegex = /(?:async\s+)?def\s+(\w+)\s*\(([^)]*)\)(?:\s*->\s*([^:]+))?:/g;
|
|
136
|
+
let match;
|
|
137
|
+
while ((match = pyFuncRegex.exec(code)) !== null) {
|
|
138
|
+
const lineNumber = code.substring(0, match.index).split('\n').length;
|
|
139
|
+
const params = parsePythonParams(match[2] ?? '');
|
|
140
|
+
analysis.functions.push({
|
|
141
|
+
name: match[1],
|
|
142
|
+
params,
|
|
143
|
+
returnType: match[3]?.trim(),
|
|
144
|
+
isAsync: match[0].includes('async'),
|
|
145
|
+
isExported: !match[1].startsWith('_'),
|
|
146
|
+
lineNumber,
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
// Parse Python classes
|
|
150
|
+
const pyClassRegex = /class\s+(\w+)(?:\([^)]*\))?:/g;
|
|
151
|
+
while ((match = pyClassRegex.exec(code)) !== null) {
|
|
152
|
+
const lineNumber = code.substring(0, match.index).split('\n').length;
|
|
153
|
+
analysis.classes.push({
|
|
154
|
+
name: match[1],
|
|
155
|
+
methods: [],
|
|
156
|
+
properties: [],
|
|
157
|
+
isExported: !match[1].startsWith('_'),
|
|
158
|
+
lineNumber,
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return analysis;
|
|
163
|
+
}
|
|
164
|
+
function parseParams(paramString) {
|
|
165
|
+
if (!paramString.trim())
|
|
166
|
+
return [];
|
|
167
|
+
return paramString.split(',').map(p => {
|
|
168
|
+
const trimmed = p.trim();
|
|
169
|
+
const optional = trimmed.includes('?') || trimmed.includes('=');
|
|
170
|
+
const [nameType] = trimmed.split('=');
|
|
171
|
+
const [name, type] = (nameType ?? '').split(':').map(s => s.replace('?', '').trim());
|
|
172
|
+
return {
|
|
173
|
+
name: name ?? '',
|
|
174
|
+
type,
|
|
175
|
+
optional,
|
|
176
|
+
};
|
|
177
|
+
}).filter(p => p.name);
|
|
178
|
+
}
|
|
179
|
+
function parsePythonParams(paramString) {
|
|
180
|
+
if (!paramString.trim())
|
|
181
|
+
return [];
|
|
182
|
+
const result = [];
|
|
183
|
+
for (const p of paramString.split(',')) {
|
|
184
|
+
const trimmed = p.trim();
|
|
185
|
+
if (trimmed === 'self' || trimmed === 'cls' || !trimmed)
|
|
186
|
+
continue;
|
|
187
|
+
const optional = trimmed.includes('=');
|
|
188
|
+
const [nameType] = trimmed.split('=');
|
|
189
|
+
const [name, type] = (nameType ?? '').split(':').map(s => s.trim());
|
|
190
|
+
if (name) {
|
|
191
|
+
result.push({
|
|
192
|
+
name,
|
|
193
|
+
type: type || undefined,
|
|
194
|
+
optional,
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return result;
|
|
199
|
+
}
|
|
200
|
+
// ============================================================================
|
|
201
|
+
// AI Documentation Generation
|
|
202
|
+
// ============================================================================
|
|
203
|
+
async function generateDocsWithAI(code, options) {
|
|
204
|
+
const provider = await getActiveProvider();
|
|
205
|
+
const prompt = `Generate comprehensive documentation for this code.
|
|
206
|
+
|
|
207
|
+
## Code
|
|
208
|
+
\`\`\`${options.language}
|
|
209
|
+
${code}
|
|
210
|
+
\`\`\`
|
|
211
|
+
|
|
212
|
+
## Requirements
|
|
213
|
+
- Documentation style: ${options.style}
|
|
214
|
+
- Language: ${options.language}
|
|
215
|
+
- Include examples: ${options.includeExamples}
|
|
216
|
+
- Include types: ${options.includeTypes}
|
|
217
|
+
${options.verbose ? '- Generate verbose, detailed documentation' : '- Keep documentation concise'}
|
|
218
|
+
|
|
219
|
+
## Functions to Document
|
|
220
|
+
${options.codeAnalysis.functions.map(f => `- ${f.name}(${f.params.map(p => p.name).join(', ')})`).join('\n')}
|
|
221
|
+
|
|
222
|
+
## Output Format
|
|
223
|
+
{
|
|
224
|
+
"documentedCode": "The complete code with documentation comments added",
|
|
225
|
+
"documentation": {
|
|
226
|
+
"name": "module name",
|
|
227
|
+
"description": "module description",
|
|
228
|
+
"exports": ["exported items"],
|
|
229
|
+
"functions": [
|
|
230
|
+
{
|
|
231
|
+
"name": "function name",
|
|
232
|
+
"description": "what it does",
|
|
233
|
+
"params": [{"name": "param", "type": "type", "description": "desc", "optional": false}],
|
|
234
|
+
"returns": {"type": "return type", "description": "what it returns"},
|
|
235
|
+
"throws": ["error conditions"],
|
|
236
|
+
"examples": ["example usage"]
|
|
237
|
+
}
|
|
238
|
+
],
|
|
239
|
+
"classes": [],
|
|
240
|
+
"types": []
|
|
241
|
+
}
|
|
242
|
+
}`;
|
|
243
|
+
const response = await provider.completeJson(prompt, {
|
|
244
|
+
systemPrompt: 'You are a technical writer. Generate clear, accurate documentation. Include practical examples. Return valid JSON only.',
|
|
245
|
+
temperature: 0.3,
|
|
246
|
+
maxTokens: 4096,
|
|
247
|
+
});
|
|
248
|
+
if (response.data) {
|
|
249
|
+
return response.data;
|
|
250
|
+
}
|
|
251
|
+
throw new Error('Failed to generate documentation with AI');
|
|
252
|
+
}
|
|
253
|
+
// ============================================================================
|
|
254
|
+
// Heuristic Documentation Generation
|
|
255
|
+
// ============================================================================
|
|
256
|
+
function generateHeuristicDocs(code, language, style, analysis) {
|
|
257
|
+
const lines = code.split('\n');
|
|
258
|
+
const documentedLines = [];
|
|
259
|
+
const documentation = {
|
|
260
|
+
name: analysis.moduleName ?? 'module',
|
|
261
|
+
description: 'Module documentation',
|
|
262
|
+
exports: [],
|
|
263
|
+
functions: [],
|
|
264
|
+
classes: [],
|
|
265
|
+
types: [],
|
|
266
|
+
};
|
|
267
|
+
// Track which lines have been processed
|
|
268
|
+
const processedLines = new Set();
|
|
269
|
+
// Add function documentation
|
|
270
|
+
for (const func of analysis.functions) {
|
|
271
|
+
const doc = generateFunctionDoc(func, style, language);
|
|
272
|
+
documentation.functions.push(doc.functionDoc);
|
|
273
|
+
// Insert doc comment before the function
|
|
274
|
+
processedLines.add(func.lineNumber);
|
|
275
|
+
}
|
|
276
|
+
// Rebuild code with documentation
|
|
277
|
+
let currentLine = 1;
|
|
278
|
+
for (const func of analysis.functions.sort((a, b) => a.lineNumber - b.lineNumber)) {
|
|
279
|
+
// Add lines before this function
|
|
280
|
+
while (currentLine < func.lineNumber) {
|
|
281
|
+
documentedLines.push(lines[currentLine - 1] ?? '');
|
|
282
|
+
currentLine++;
|
|
283
|
+
}
|
|
284
|
+
// Add documentation comment
|
|
285
|
+
const docComment = formatDocComment(generateFunctionDoc(func, style, language).comment, style, language);
|
|
286
|
+
documentedLines.push(docComment);
|
|
287
|
+
documentedLines.push(lines[currentLine - 1] ?? '');
|
|
288
|
+
currentLine++;
|
|
289
|
+
}
|
|
290
|
+
// Add remaining lines
|
|
291
|
+
while (currentLine <= lines.length) {
|
|
292
|
+
documentedLines.push(lines[currentLine - 1] ?? '');
|
|
293
|
+
currentLine++;
|
|
294
|
+
}
|
|
295
|
+
return {
|
|
296
|
+
documentedCode: documentedLines.join('\n'),
|
|
297
|
+
documentation,
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
function generateFunctionDoc(func, style, language) {
|
|
301
|
+
const description = generateDescription(func.name);
|
|
302
|
+
const params = func.params.map(p => ({
|
|
303
|
+
name: p.name,
|
|
304
|
+
type: p.type ?? 'any',
|
|
305
|
+
description: `The ${p.name} parameter`,
|
|
306
|
+
optional: p.optional,
|
|
307
|
+
}));
|
|
308
|
+
const functionDoc = {
|
|
309
|
+
name: func.name,
|
|
310
|
+
description,
|
|
311
|
+
params,
|
|
312
|
+
returns: {
|
|
313
|
+
type: func.returnType ?? 'void',
|
|
314
|
+
description: func.returnType ? `Returns ${func.returnType}` : 'No return value',
|
|
315
|
+
},
|
|
316
|
+
examples: [`${func.name}(${func.params.map(p => `/* ${p.name} */`).join(', ')})`],
|
|
317
|
+
};
|
|
318
|
+
let comment = '';
|
|
319
|
+
if (['jsdoc', 'tsdoc'].includes(style) || language === 'typescript' || language === 'javascript') {
|
|
320
|
+
comment = `/**\n * ${description}\n`;
|
|
321
|
+
for (const param of params) {
|
|
322
|
+
comment += ` * @param {${param.type}} ${param.optional ? '[' + param.name + ']' : param.name} - ${param.description}\n`;
|
|
323
|
+
}
|
|
324
|
+
comment += ` * @returns {${functionDoc.returns.type}} ${functionDoc.returns.description}\n`;
|
|
325
|
+
comment += ` */`;
|
|
326
|
+
}
|
|
327
|
+
else if (style === 'pydoc' || language === 'python') {
|
|
328
|
+
comment = ` """\n ${description}\n\n Args:\n`;
|
|
329
|
+
for (const param of params) {
|
|
330
|
+
comment += ` ${param.name} (${param.type}): ${param.description}\n`;
|
|
331
|
+
}
|
|
332
|
+
comment += `\n Returns:\n ${functionDoc.returns.type}: ${functionDoc.returns.description}\n """`;
|
|
333
|
+
}
|
|
334
|
+
return { comment, functionDoc };
|
|
335
|
+
}
|
|
336
|
+
function generateDescription(name) {
|
|
337
|
+
// Convert camelCase/snake_case to readable description
|
|
338
|
+
const words = name
|
|
339
|
+
.replace(/([A-Z])/g, ' $1')
|
|
340
|
+
.replace(/_/g, ' ')
|
|
341
|
+
.toLowerCase()
|
|
342
|
+
.trim()
|
|
343
|
+
.split(' ');
|
|
344
|
+
if (words[0] === 'get') {
|
|
345
|
+
return `Gets the ${words.slice(1).join(' ')}.`;
|
|
346
|
+
}
|
|
347
|
+
if (words[0] === 'set') {
|
|
348
|
+
return `Sets the ${words.slice(1).join(' ')}.`;
|
|
349
|
+
}
|
|
350
|
+
if (words[0] === 'is' || words[0] === 'has' || words[0] === 'can') {
|
|
351
|
+
return `Checks if ${words.slice(1).join(' ')}.`;
|
|
352
|
+
}
|
|
353
|
+
if (words[0] === 'create' || words[0] === 'build' || words[0] === 'make') {
|
|
354
|
+
return `Creates a new ${words.slice(1).join(' ')}.`;
|
|
355
|
+
}
|
|
356
|
+
if (words[0] === 'update') {
|
|
357
|
+
return `Updates the ${words.slice(1).join(' ')}.`;
|
|
358
|
+
}
|
|
359
|
+
if (words[0] === 'delete' || words[0] === 'remove') {
|
|
360
|
+
return `Removes the ${words.slice(1).join(' ')}.`;
|
|
361
|
+
}
|
|
362
|
+
if (words[0] === 'find' || words[0] === 'search') {
|
|
363
|
+
return `Finds ${words.slice(1).join(' ')}.`;
|
|
364
|
+
}
|
|
365
|
+
if (words[0] === 'validate' || words[0] === 'check') {
|
|
366
|
+
return `Validates the ${words.slice(1).join(' ')}.`;
|
|
367
|
+
}
|
|
368
|
+
if (words[0] === 'parse') {
|
|
369
|
+
return `Parses the ${words.slice(1).join(' ')}.`;
|
|
370
|
+
}
|
|
371
|
+
if (words[0] === 'format') {
|
|
372
|
+
return `Formats the ${words.slice(1).join(' ')}.`;
|
|
373
|
+
}
|
|
374
|
+
if (words[0] === 'convert') {
|
|
375
|
+
return `Converts ${words.slice(1).join(' ')}.`;
|
|
376
|
+
}
|
|
377
|
+
if (words[0] === 'calculate' || words[0] === 'compute') {
|
|
378
|
+
return `Calculates the ${words.slice(1).join(' ')}.`;
|
|
379
|
+
}
|
|
380
|
+
if (words[0] === 'handle') {
|
|
381
|
+
return `Handles ${words.slice(1).join(' ')}.`;
|
|
382
|
+
}
|
|
383
|
+
if (words[0] === 'process') {
|
|
384
|
+
return `Processes ${words.slice(1).join(' ')}.`;
|
|
385
|
+
}
|
|
386
|
+
if (words[0] === 'load') {
|
|
387
|
+
return `Loads ${words.slice(1).join(' ')}.`;
|
|
388
|
+
}
|
|
389
|
+
if (words[0] === 'save') {
|
|
390
|
+
return `Saves ${words.slice(1).join(' ')}.`;
|
|
391
|
+
}
|
|
392
|
+
if (words[0] === 'init' || words[0] === 'initialize') {
|
|
393
|
+
return `Initializes ${words.slice(1).join(' ') || 'the component'}.`;
|
|
394
|
+
}
|
|
395
|
+
return `Performs ${words.join(' ')} operation.`;
|
|
396
|
+
}
|
|
397
|
+
function formatDocComment(comment, style, language) {
|
|
398
|
+
return comment;
|
|
399
|
+
}
|
|
400
|
+
// ============================================================================
|
|
401
|
+
// README Generation
|
|
402
|
+
// ============================================================================
|
|
403
|
+
function generateReadme(doc, language) {
|
|
404
|
+
let readme = `# ${doc.name}\n\n`;
|
|
405
|
+
readme += `${doc.description}\n\n`;
|
|
406
|
+
if (doc.functions.length > 0) {
|
|
407
|
+
readme += `## Functions\n\n`;
|
|
408
|
+
for (const func of doc.functions) {
|
|
409
|
+
readme += `### \`${func.name}\`\n\n`;
|
|
410
|
+
readme += `${func.description}\n\n`;
|
|
411
|
+
if (func.params.length > 0) {
|
|
412
|
+
readme += `**Parameters:**\n\n`;
|
|
413
|
+
readme += `| Name | Type | Description |\n`;
|
|
414
|
+
readme += `|------|------|-------------|\n`;
|
|
415
|
+
for (const param of func.params) {
|
|
416
|
+
readme += `| ${param.name} | \`${param.type}\` | ${param.description} |\n`;
|
|
417
|
+
}
|
|
418
|
+
readme += `\n`;
|
|
419
|
+
}
|
|
420
|
+
readme += `**Returns:** \`${func.returns.type}\` - ${func.returns.description}\n\n`;
|
|
421
|
+
if (func.examples && func.examples.length > 0) {
|
|
422
|
+
readme += `**Example:**\n\n`;
|
|
423
|
+
readme += `\`\`\`${language}\n${func.examples[0]}\n\`\`\`\n\n`;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
if (doc.classes.length > 0) {
|
|
428
|
+
readme += `## Classes\n\n`;
|
|
429
|
+
for (const cls of doc.classes) {
|
|
430
|
+
readme += `### \`${cls.name}\`\n\n`;
|
|
431
|
+
readme += `${cls.description}\n\n`;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
return readme;
|
|
435
|
+
}
|
|
436
|
+
// ============================================================================
|
|
437
|
+
// API Documentation Generation
|
|
438
|
+
// ============================================================================
|
|
439
|
+
function generateApiDocs(doc) {
|
|
440
|
+
let api = `# API Reference\n\n`;
|
|
441
|
+
api += `## Module: ${doc.name}\n\n`;
|
|
442
|
+
api += `${doc.description}\n\n`;
|
|
443
|
+
if (doc.exports.length > 0) {
|
|
444
|
+
api += `### Exports\n\n`;
|
|
445
|
+
api += doc.exports.map(e => `- \`${e}\``).join('\n');
|
|
446
|
+
api += `\n\n`;
|
|
447
|
+
}
|
|
448
|
+
if (doc.functions.length > 0) {
|
|
449
|
+
api += `### Functions\n\n`;
|
|
450
|
+
for (const func of doc.functions) {
|
|
451
|
+
const paramTypes = func.params.map(p => `${p.name}: ${p.type}`).join(', ');
|
|
452
|
+
api += `#### \`${func.name}(${paramTypes}): ${func.returns.type}\`\n\n`;
|
|
453
|
+
api += `${func.description}\n\n`;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
return api;
|
|
457
|
+
}
|
|
458
|
+
// ============================================================================
|
|
459
|
+
// Helper Functions
|
|
460
|
+
// ============================================================================
|
|
461
|
+
function detectLanguage(code) {
|
|
462
|
+
if (code.includes('interface ') || code.includes(': string') || code.includes(': number')) {
|
|
463
|
+
return 'typescript';
|
|
464
|
+
}
|
|
465
|
+
if (code.includes('def ') && code.includes(':') && !code.includes('function ')) {
|
|
466
|
+
return 'python';
|
|
467
|
+
}
|
|
468
|
+
if (code.includes('func ') && code.includes('package ')) {
|
|
469
|
+
return 'go';
|
|
470
|
+
}
|
|
471
|
+
if (code.includes('fn ') && code.includes('->')) {
|
|
472
|
+
return 'rust';
|
|
473
|
+
}
|
|
474
|
+
return 'javascript';
|
|
475
|
+
}
|
|
476
|
+
function detectDocStyle(language) {
|
|
477
|
+
switch (language.toLowerCase()) {
|
|
478
|
+
case 'typescript':
|
|
479
|
+
return 'tsdoc';
|
|
480
|
+
case 'javascript':
|
|
481
|
+
return 'jsdoc';
|
|
482
|
+
case 'python':
|
|
483
|
+
return 'pydoc';
|
|
484
|
+
case 'go':
|
|
485
|
+
return 'godoc';
|
|
486
|
+
case 'rust':
|
|
487
|
+
return 'rustdoc';
|
|
488
|
+
default:
|
|
489
|
+
return 'jsdoc';
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
function calculateDocStats(analysis, doc) {
|
|
493
|
+
const totalFunctions = analysis.functions.length;
|
|
494
|
+
const documentedFunctions = doc.functions.length;
|
|
495
|
+
const totalClasses = analysis.classes.length;
|
|
496
|
+
const documentedClasses = doc.classes.length;
|
|
497
|
+
const total = totalFunctions + totalClasses;
|
|
498
|
+
const documented = documentedFunctions + documentedClasses;
|
|
499
|
+
const coverage = total > 0 ? Math.round((documented / total) * 100) : 100;
|
|
500
|
+
return {
|
|
501
|
+
totalFunctions,
|
|
502
|
+
documentedFunctions,
|
|
503
|
+
totalClasses,
|
|
504
|
+
documentedClasses,
|
|
505
|
+
coverage,
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
//# sourceMappingURL=docs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs.js","sourceRoot":"","sources":["../../src/tools/docs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AA+FrC,+EAA+E;AAC/E,2BAA2B;AAC3B,+EAA+E;AAE/E;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,IAAY,EACZ,UAAgC,EAAE;IAElC,MAAM,EACJ,KAAK,GAAG,MAAM,EACd,MAAM,GAAG,UAAU,EACnB,eAAe,GA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OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAS,cAAc,CAAC,QAAgB;IACtC,QAAQ,QAAQ,CAAC,WAAW,EAAE,EAAE,CAAC;QAC/B,KAAK,YAAY;YACf,OAAO,OAAO,CAAC;QACjB,KAAK,YAAY;YACf,OAAO,OAAO,CAAC;QACjB,KAAK,QAAQ;YACX,OAAO,OAAO,CAAC;QACjB,KAAK,IAAI;YACP,OAAO,OAAO,CAAC;QACjB,KAAK,MAAM;YACT,OAAO,SAAS,CAAC;QACnB;YACE,OAAO,OAAO,CAAC;IACnB,CAAC;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,QAAsB,EAAE,GAAc;IAC/D,MAAM,cAAc,GAAG,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC;IACjD,MAAM,mBAAmB,GAAG,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC;IACjD,MAAM,YAAY,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC;IAC7C,MAAM,iBAAiB,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC;IAE7C,MAAM,KAAK,GAAG,cAAc,GAAG,YAAY,CAAC;IAC5C,MAAM,UAAU,GAAG,mBAAmB,GAAG,iBAAiB,CAAC;IAC3D,MAAM,QAAQ,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,UAAU,GAAG,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAE1E,OAAO;QACL,cAAc;QACd,mBAAmB;QACnB,YAAY;QACZ,iBAAiB;QACjB,QAAQ;KACT,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Atlas Server - Code Explanation Tool
|
|
3
|
+
*
|
|
4
|
+
* Intelligent code explanation capabilities:
|
|
5
|
+
* - Line-by-line explanation
|
|
6
|
+
* - Algorithm analysis
|
|
7
|
+
* - Complexity analysis (Big O)
|
|
8
|
+
* - Design pattern identification
|
|
9
|
+
* - Dependency explanation
|
|
10
|
+
* - Beginner-friendly mode
|
|
11
|
+
*/
|
|
12
|
+
export type ExplanationLevel = 'beginner' | 'intermediate' | 'expert';
|
|
13
|
+
export type ExplanationType = 'overview' | 'detailed' | 'line-by-line' | 'algorithm';
|
|
14
|
+
export interface ExplanationOptions {
|
|
15
|
+
level?: ExplanationLevel;
|
|
16
|
+
type?: ExplanationType;
|
|
17
|
+
language?: string;
|
|
18
|
+
focusArea?: string;
|
|
19
|
+
includeComplexity?: boolean;
|
|
20
|
+
includePatterns?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface CodeExplanation {
|
|
23
|
+
summary: string;
|
|
24
|
+
purpose: string;
|
|
25
|
+
howItWorks: string;
|
|
26
|
+
sections: ExplanationSection[];
|
|
27
|
+
complexity?: ComplexityAnalysis;
|
|
28
|
+
patterns?: DesignPattern[];
|
|
29
|
+
dependencies?: DependencyInfo[];
|
|
30
|
+
suggestions?: string[];
|
|
31
|
+
glossary?: GlossaryTerm[];
|
|
32
|
+
}
|
|
33
|
+
export interface ExplanationSection {
|
|
34
|
+
title: string;
|
|
35
|
+
lineRange: {
|
|
36
|
+
start: number;
|
|
37
|
+
end: number;
|
|
38
|
+
};
|
|
39
|
+
code: string;
|
|
40
|
+
explanation: string;
|
|
41
|
+
keyPoints: string[];
|
|
42
|
+
}
|
|
43
|
+
export interface ComplexityAnalysis {
|
|
44
|
+
time: string;
|
|
45
|
+
space: string;
|
|
46
|
+
explanation: string;
|
|
47
|
+
bestCase?: string;
|
|
48
|
+
worstCase?: string;
|
|
49
|
+
averageCase?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface DesignPattern {
|
|
52
|
+
name: string;
|
|
53
|
+
type: 'creational' | 'structural' | 'behavioral' | 'architectural';
|
|
54
|
+
description: string;
|
|
55
|
+
locationHint: string;
|
|
56
|
+
}
|
|
57
|
+
export interface DependencyInfo {
|
|
58
|
+
name: string;
|
|
59
|
+
type: 'import' | 'external' | 'internal';
|
|
60
|
+
purpose: string;
|
|
61
|
+
required: boolean;
|
|
62
|
+
}
|
|
63
|
+
export interface GlossaryTerm {
|
|
64
|
+
term: string;
|
|
65
|
+
definition: string;
|
|
66
|
+
example?: string;
|
|
67
|
+
}
|
|
68
|
+
export interface ExplanationResult {
|
|
69
|
+
explanation: CodeExplanation;
|
|
70
|
+
metadata: {
|
|
71
|
+
level: ExplanationLevel;
|
|
72
|
+
type: ExplanationType;
|
|
73
|
+
language: string;
|
|
74
|
+
lineCount: number;
|
|
75
|
+
};
|
|
76
|
+
generatedAt: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Generate an explanation for the given code
|
|
80
|
+
*/
|
|
81
|
+
export declare function explainCode(code: string, options?: ExplanationOptions): Promise<ExplanationResult>;
|
|
82
|
+
//# sourceMappingURL=explain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"explain.d.ts","sourceRoot":"","sources":["../../src/tools/explain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AASH,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,cAAc,GAAG,QAAQ,CAAC;AACtE,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,UAAU,GAAG,cAAc,GAAG,WAAW,CAAC;AAErF,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,kBAAkB,EAAE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