vibe-coding-mcp 2.3.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.
- package/README.md +179 -0
- package/dist/__tests__/collectCodeContext.test.d.ts +2 -0
- package/dist/__tests__/collectCodeContext.test.d.ts.map +1 -0
- package/dist/__tests__/collectCodeContext.test.js +139 -0
- package/dist/__tests__/collectCodeContext.test.js.map +1 -0
- package/dist/__tests__/createSessionLog.test.d.ts +2 -0
- package/dist/__tests__/createSessionLog.test.d.ts.map +1 -0
- package/dist/__tests__/createSessionLog.test.js +130 -0
- package/dist/__tests__/createSessionLog.test.js.map +1 -0
- package/dist/__tests__/generateDevDocument.test.d.ts +2 -0
- package/dist/__tests__/generateDevDocument.test.d.ts.map +1 -0
- package/dist/__tests__/generateDevDocument.test.js +174 -0
- package/dist/__tests__/generateDevDocument.test.js.map +1 -0
- package/dist/__tests__/normalizeForPlatform.test.d.ts +2 -0
- package/dist/__tests__/normalizeForPlatform.test.d.ts.map +1 -0
- package/dist/__tests__/normalizeForPlatform.test.js +171 -0
- package/dist/__tests__/normalizeForPlatform.test.js.map +1 -0
- package/dist/__tests__/publishDocument.test.d.ts +2 -0
- package/dist/__tests__/publishDocument.test.d.ts.map +1 -0
- package/dist/__tests__/publishDocument.test.js +93 -0
- package/dist/__tests__/publishDocument.test.js.map +1 -0
- package/dist/__tests__/summarizeDesignDecisions.test.d.ts +2 -0
- package/dist/__tests__/summarizeDesignDecisions.test.d.ts.map +1 -0
- package/dist/__tests__/summarizeDesignDecisions.test.js +158 -0
- package/dist/__tests__/summarizeDesignDecisions.test.js.map +1 -0
- package/dist/core/cache.d.ts +39 -0
- package/dist/core/cache.d.ts.map +1 -0
- package/dist/core/cache.js +112 -0
- package/dist/core/cache.js.map +1 -0
- package/dist/core/config.d.ts +30 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +90 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/errors.d.ts +52 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +99 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/logger.d.ts +57 -0
- package/dist/core/logger.d.ts.map +1 -0
- package/dist/core/logger.js +114 -0
- package/dist/core/logger.js.map +1 -0
- package/dist/core/schemas.d.ts +690 -0
- package/dist/core/schemas.d.ts.map +1 -0
- package/dist/core/schemas.js +136 -0
- package/dist/core/schemas.js.map +1 -0
- package/dist/core/security.d.ts +28 -0
- package/dist/core/security.d.ts.map +1 -0
- package/dist/core/security.js +103 -0
- package/dist/core/security.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +168 -0
- package/dist/index.js.map +1 -0
- package/dist/platforms/confluence.d.ts +13 -0
- package/dist/platforms/confluence.d.ts.map +1 -0
- package/dist/platforms/confluence.js +178 -0
- package/dist/platforms/confluence.js.map +1 -0
- package/dist/platforms/discord.d.ts +54 -0
- package/dist/platforms/discord.d.ts.map +1 -0
- package/dist/platforms/discord.js +176 -0
- package/dist/platforms/discord.js.map +1 -0
- package/dist/platforms/github-wiki.d.ts +3 -0
- package/dist/platforms/github-wiki.d.ts.map +1 -0
- package/dist/platforms/github-wiki.js +120 -0
- package/dist/platforms/github-wiki.js.map +1 -0
- package/dist/platforms/notion.d.ts +3 -0
- package/dist/platforms/notion.d.ts.map +1 -0
- package/dist/platforms/notion.js +205 -0
- package/dist/platforms/notion.js.map +1 -0
- package/dist/platforms/obsidian.d.ts +3 -0
- package/dist/platforms/obsidian.d.ts.map +1 -0
- package/dist/platforms/obsidian.js +43 -0
- package/dist/platforms/obsidian.js.map +1 -0
- package/dist/platforms/slack.d.ts +21 -0
- package/dist/platforms/slack.d.ts.map +1 -0
- package/dist/platforms/slack.js +217 -0
- package/dist/platforms/slack.js.map +1 -0
- package/dist/stdio.d.ts +6 -0
- package/dist/stdio.d.ts.map +1 -0
- package/dist/stdio.js +98 -0
- package/dist/stdio.js.map +1 -0
- package/dist/tools/analyzeCode.d.ts +65 -0
- package/dist/tools/analyzeCode.d.ts.map +1 -0
- package/dist/tools/analyzeCode.js +113 -0
- package/dist/tools/analyzeCode.js.map +1 -0
- package/dist/tools/collectCodeContext.d.ts +86 -0
- package/dist/tools/collectCodeContext.d.ts.map +1 -0
- package/dist/tools/collectCodeContext.js +275 -0
- package/dist/tools/collectCodeContext.js.map +1 -0
- package/dist/tools/createSessionLog.d.ts +79 -0
- package/dist/tools/createSessionLog.d.ts.map +1 -0
- package/dist/tools/createSessionLog.js +160 -0
- package/dist/tools/createSessionLog.js.map +1 -0
- package/dist/tools/generateDevDocument.d.ts +216 -0
- package/dist/tools/generateDevDocument.d.ts.map +1 -0
- package/dist/tools/generateDevDocument.js +659 -0
- package/dist/tools/generateDevDocument.js.map +1 -0
- package/dist/tools/normalizeForPlatform.d.ts +95 -0
- package/dist/tools/normalizeForPlatform.d.ts.map +1 -0
- package/dist/tools/normalizeForPlatform.js +340 -0
- package/dist/tools/normalizeForPlatform.js.map +1 -0
- package/dist/tools/publishDocument.d.ts +60 -0
- package/dist/tools/publishDocument.d.ts.map +1 -0
- package/dist/tools/publishDocument.js +117 -0
- package/dist/tools/publishDocument.js.map +1 -0
- package/dist/tools/summarizeDesignDecisions.d.ts +82 -0
- package/dist/tools/summarizeDesignDecisions.d.ts.map +1 -0
- package/dist/tools/summarizeDesignDecisions.js +361 -0
- package/dist/tools/summarizeDesignDecisions.js.map +1 -0
- package/dist/types/index.d.ts +63 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/astParser.d.ts +55 -0
- package/dist/utils/astParser.d.ts.map +1 -0
- package/dist/utils/astParser.js +333 -0
- package/dist/utils/astParser.js.map +1 -0
- package/dist/utils/i18n.d.ts +67 -0
- package/dist/utils/i18n.d.ts.map +1 -0
- package/dist/utils/i18n.js +193 -0
- package/dist/utils/i18n.js.map +1 -0
- package/dist/utils/markdown.d.ts +9 -0
- package/dist/utils/markdown.d.ts.map +1 -0
- package/dist/utils/markdown.js +99 -0
- package/dist/utils/markdown.js.map +1 -0
- package/dist/utils/mermaidGenerator.d.ts +69 -0
- package/dist/utils/mermaidGenerator.d.ts.map +1 -0
- package/dist/utils/mermaidGenerator.js +315 -0
- package/dist/utils/mermaidGenerator.js.map +1 -0
- package/package.json +66 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AST 기반 코드 분석 유틸리티
|
|
3
|
+
* 함수, 클래스, 의존성을 자동으로 추출
|
|
4
|
+
*/
|
|
5
|
+
export interface FunctionInfo {
|
|
6
|
+
name: string;
|
|
7
|
+
params: string[];
|
|
8
|
+
returnType?: string;
|
|
9
|
+
async: boolean;
|
|
10
|
+
exported: boolean;
|
|
11
|
+
lineNumber?: number;
|
|
12
|
+
docstring?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ClassInfo {
|
|
15
|
+
name: string;
|
|
16
|
+
methods: FunctionInfo[];
|
|
17
|
+
properties: PropertyInfo[];
|
|
18
|
+
extends?: string;
|
|
19
|
+
implements?: string[];
|
|
20
|
+
exported: boolean;
|
|
21
|
+
lineNumber?: number;
|
|
22
|
+
docstring?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface PropertyInfo {
|
|
25
|
+
name: string;
|
|
26
|
+
type?: string;
|
|
27
|
+
visibility: 'public' | 'private' | 'protected';
|
|
28
|
+
static: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface ImportInfo {
|
|
31
|
+
source: string;
|
|
32
|
+
imports: string[];
|
|
33
|
+
isDefault: boolean;
|
|
34
|
+
isNamespace: boolean;
|
|
35
|
+
}
|
|
36
|
+
export interface ExportInfo {
|
|
37
|
+
name: string;
|
|
38
|
+
type: 'function' | 'class' | 'variable' | 'type' | 'interface';
|
|
39
|
+
isDefault: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface CodeAnalysis {
|
|
42
|
+
language: string;
|
|
43
|
+
functions: FunctionInfo[];
|
|
44
|
+
classes: ClassInfo[];
|
|
45
|
+
imports: ImportInfo[];
|
|
46
|
+
exports: ExportInfo[];
|
|
47
|
+
dependencies: string[];
|
|
48
|
+
complexity: number;
|
|
49
|
+
lineCount: number;
|
|
50
|
+
}
|
|
51
|
+
export declare function analyzeTypeScript(code: string): CodeAnalysis;
|
|
52
|
+
export declare function analyzePython(code: string): CodeAnalysis;
|
|
53
|
+
export declare function analyzeGo(code: string): CodeAnalysis;
|
|
54
|
+
export declare const analyzeCode: (args_0: string, args_1: string | undefined) => CodeAnalysis;
|
|
55
|
+
//# sourceMappingURL=astParser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"astParser.d.ts","sourceRoot":"","sources":["../../src/utils/astParser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,UAAU,EAAE,YAAY,EAAE,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,QAAQ,GAAG,SAAS,GAAG,WAAW,CAAC;IAC/C,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,UAAU,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,GAAG,WAAW,CAAC;IAC/D,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,YAAY,EAAE,CAAC;IAC1B,OAAO,EAAE,SAAS,EAAE,CAAC;IACrB,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAGD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAkI5D;AAGD,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAkFxD;AAGD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAqFpD;AAwDD,eAAO,MAAM,WAAW,8DAGvB,CAAC"}
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AST 기반 코드 분석 유틸리티
|
|
3
|
+
* 함수, 클래스, 의존성을 자동으로 추출
|
|
4
|
+
*/
|
|
5
|
+
import { memoize, hashCode } from '../core/cache.js';
|
|
6
|
+
// TypeScript/JavaScript 분석
|
|
7
|
+
export function analyzeTypeScript(code) {
|
|
8
|
+
const functions = [];
|
|
9
|
+
const classes = [];
|
|
10
|
+
const imports = [];
|
|
11
|
+
const exports = [];
|
|
12
|
+
const dependencies = [];
|
|
13
|
+
const lines = code.split('\n');
|
|
14
|
+
// Import 분석
|
|
15
|
+
const importRegex = /import\s+(?:(\w+)\s*,?\s*)?(?:\{([^}]+)\})?\s*(?:from\s+)?['"]([^'"]+)['"]/g;
|
|
16
|
+
const importTypeRegex = /import\s+type\s+\{([^}]+)\}\s+from\s+['"]([^'"]+)['"]/g;
|
|
17
|
+
let match;
|
|
18
|
+
while ((match = importRegex.exec(code)) !== null) {
|
|
19
|
+
const defaultImport = match[1];
|
|
20
|
+
const namedImports = match[2]?.split(',').map(s => s.trim().split(' as ')[0].trim()).filter(Boolean) || [];
|
|
21
|
+
const source = match[3];
|
|
22
|
+
imports.push({
|
|
23
|
+
source,
|
|
24
|
+
imports: defaultImport ? [defaultImport, ...namedImports] : namedImports,
|
|
25
|
+
isDefault: !!defaultImport,
|
|
26
|
+
isNamespace: false
|
|
27
|
+
});
|
|
28
|
+
if (!source.startsWith('.') && !source.startsWith('@/')) {
|
|
29
|
+
dependencies.push(source.split('/')[0]);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
// 함수 분석
|
|
33
|
+
const functionRegex = /(?:(export)\s+)?(?:(async)\s+)?function\s+(\w+)\s*(?:<[^>]+>)?\s*\(([^)]*)\)(?:\s*:\s*([^\s{]+))?\s*\{/g;
|
|
34
|
+
const arrowFunctionRegex = /(?:(export)\s+)?(?:const|let|var)\s+(\w+)\s*(?::\s*[^=]+)?\s*=\s*(?:(async)\s+)?\([^)]*\)\s*(?::\s*([^\s=]+))?\s*=>/g;
|
|
35
|
+
while ((match = functionRegex.exec(code)) !== null) {
|
|
36
|
+
const lineNumber = code.substring(0, match.index).split('\n').length;
|
|
37
|
+
functions.push({
|
|
38
|
+
name: match[3],
|
|
39
|
+
params: match[4].split(',').map(p => p.trim().split(':')[0].trim()).filter(Boolean),
|
|
40
|
+
returnType: match[5],
|
|
41
|
+
async: !!match[2],
|
|
42
|
+
exported: !!match[1],
|
|
43
|
+
lineNumber
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
while ((match = arrowFunctionRegex.exec(code)) !== null) {
|
|
47
|
+
const lineNumber = code.substring(0, match.index).split('\n').length;
|
|
48
|
+
functions.push({
|
|
49
|
+
name: match[2],
|
|
50
|
+
params: [],
|
|
51
|
+
returnType: match[4],
|
|
52
|
+
async: !!match[3],
|
|
53
|
+
exported: !!match[1],
|
|
54
|
+
lineNumber
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
// 클래스 분석
|
|
58
|
+
const classRegex = /(?:(export)\s+)?class\s+(\w+)(?:\s+extends\s+(\w+))?(?:\s+implements\s+([^{]+))?\s*\{/g;
|
|
59
|
+
while ((match = classRegex.exec(code)) !== null) {
|
|
60
|
+
const className = match[2];
|
|
61
|
+
const lineNumber = code.substring(0, match.index).split('\n').length;
|
|
62
|
+
// 클래스 본문 추출
|
|
63
|
+
const classStart = match.index + match[0].length;
|
|
64
|
+
let braceCount = 1;
|
|
65
|
+
let classEnd = classStart;
|
|
66
|
+
for (let i = classStart; i < code.length && braceCount > 0; i++) {
|
|
67
|
+
if (code[i] === '{')
|
|
68
|
+
braceCount++;
|
|
69
|
+
if (code[i] === '}')
|
|
70
|
+
braceCount--;
|
|
71
|
+
classEnd = i;
|
|
72
|
+
}
|
|
73
|
+
const classBody = code.substring(classStart, classEnd);
|
|
74
|
+
const methods = [];
|
|
75
|
+
const properties = [];
|
|
76
|
+
// 메서드 추출
|
|
77
|
+
const methodRegex = /(?:(public|private|protected)\s+)?(?:(static)\s+)?(?:(async)\s+)?(\w+)\s*\([^)]*\)/g;
|
|
78
|
+
let methodMatch;
|
|
79
|
+
while ((methodMatch = methodRegex.exec(classBody)) !== null) {
|
|
80
|
+
if (!['constructor', 'if', 'for', 'while', 'switch'].includes(methodMatch[4])) {
|
|
81
|
+
methods.push({
|
|
82
|
+
name: methodMatch[4],
|
|
83
|
+
params: [],
|
|
84
|
+
async: !!methodMatch[3],
|
|
85
|
+
exported: false,
|
|
86
|
+
lineNumber: lineNumber + classBody.substring(0, methodMatch.index).split('\n').length
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
classes.push({
|
|
91
|
+
name: className,
|
|
92
|
+
methods,
|
|
93
|
+
properties,
|
|
94
|
+
extends: match[3],
|
|
95
|
+
implements: match[4]?.split(',').map(s => s.trim()),
|
|
96
|
+
exported: !!match[1],
|
|
97
|
+
lineNumber
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
// Export 분석
|
|
101
|
+
const exportRegex = /export\s+(?:(default)\s+)?(?:const|let|var|function|class|type|interface)\s+(\w+)/g;
|
|
102
|
+
while ((match = exportRegex.exec(code)) !== null) {
|
|
103
|
+
const exportType = code.substring(match.index).match(/export\s+(?:default\s+)?(const|let|var|function|class|type|interface)/)?.[1];
|
|
104
|
+
exports.push({
|
|
105
|
+
name: match[2],
|
|
106
|
+
type: exportType || 'variable',
|
|
107
|
+
isDefault: !!match[1]
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
// 복잡도 계산 (간단한 휴리스틱)
|
|
111
|
+
const complexity = calculateComplexity(code);
|
|
112
|
+
return {
|
|
113
|
+
language: 'typescript',
|
|
114
|
+
functions,
|
|
115
|
+
classes,
|
|
116
|
+
imports,
|
|
117
|
+
exports,
|
|
118
|
+
dependencies: [...new Set(dependencies)],
|
|
119
|
+
complexity,
|
|
120
|
+
lineCount: lines.length
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
// Python 분석
|
|
124
|
+
export function analyzePython(code) {
|
|
125
|
+
const functions = [];
|
|
126
|
+
const classes = [];
|
|
127
|
+
const imports = [];
|
|
128
|
+
const exports = [];
|
|
129
|
+
const dependencies = [];
|
|
130
|
+
const lines = code.split('\n');
|
|
131
|
+
// Import 분석
|
|
132
|
+
const importRegex = /^(?:from\s+(\S+)\s+)?import\s+(.+)$/gm;
|
|
133
|
+
let match;
|
|
134
|
+
while ((match = importRegex.exec(code)) !== null) {
|
|
135
|
+
const source = match[1] || match[2].split(',')[0].trim().split(' as ')[0];
|
|
136
|
+
const importNames = match[2].split(',').map(s => s.trim().split(' as ')[0].trim());
|
|
137
|
+
imports.push({
|
|
138
|
+
source,
|
|
139
|
+
imports: importNames,
|
|
140
|
+
isDefault: !match[1],
|
|
141
|
+
isNamespace: false
|
|
142
|
+
});
|
|
143
|
+
const pkgName = source.split('.')[0];
|
|
144
|
+
if (!pkgName.startsWith('.')) {
|
|
145
|
+
dependencies.push(pkgName);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
// 함수 분석
|
|
149
|
+
const functionRegex = /^(\s*)(?:(async)\s+)?def\s+(\w+)\s*\(([^)]*)\)(?:\s*->\s*(\S+))?:/gm;
|
|
150
|
+
while ((match = functionRegex.exec(code)) !== null) {
|
|
151
|
+
const indent = match[1].length;
|
|
152
|
+
const lineNumber = code.substring(0, match.index).split('\n').length;
|
|
153
|
+
// 독스트링 추출
|
|
154
|
+
const afterDef = code.substring(match.index + match[0].length);
|
|
155
|
+
const docstringMatch = afterDef.match(/^\s*[']{3}([\s\S]*?)[']{3}|^\s*["]{3}([\s\S]*?)["]{3}/);
|
|
156
|
+
functions.push({
|
|
157
|
+
name: match[3],
|
|
158
|
+
params: match[4].split(',').map(p => p.trim().split(':')[0].split('=')[0].trim()).filter(Boolean),
|
|
159
|
+
returnType: match[5],
|
|
160
|
+
async: !!match[2],
|
|
161
|
+
exported: indent === 0 && !match[3].startsWith('_'),
|
|
162
|
+
lineNumber,
|
|
163
|
+
docstring: docstringMatch?.[1] || docstringMatch?.[2]
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
// 클래스 분석
|
|
167
|
+
const classRegex = /^class\s+(\w+)(?:\(([^)]*)\))?:/gm;
|
|
168
|
+
while ((match = classRegex.exec(code)) !== null) {
|
|
169
|
+
const className = match[1];
|
|
170
|
+
const lineNumber = code.substring(0, match.index).split('\n').length;
|
|
171
|
+
const parentClasses = match[2]?.split(',').map(s => s.trim()) || [];
|
|
172
|
+
classes.push({
|
|
173
|
+
name: className,
|
|
174
|
+
methods: [],
|
|
175
|
+
properties: [],
|
|
176
|
+
extends: parentClasses[0],
|
|
177
|
+
implements: parentClasses.slice(1),
|
|
178
|
+
exported: !className.startsWith('_'),
|
|
179
|
+
lineNumber
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
const complexity = calculateComplexity(code);
|
|
183
|
+
return {
|
|
184
|
+
language: 'python',
|
|
185
|
+
functions,
|
|
186
|
+
classes,
|
|
187
|
+
imports,
|
|
188
|
+
exports,
|
|
189
|
+
dependencies: [...new Set(dependencies)],
|
|
190
|
+
complexity,
|
|
191
|
+
lineCount: lines.length
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
// Go 분석
|
|
195
|
+
export function analyzeGo(code) {
|
|
196
|
+
const functions = [];
|
|
197
|
+
const classes = [];
|
|
198
|
+
const imports = [];
|
|
199
|
+
const exports = [];
|
|
200
|
+
const dependencies = [];
|
|
201
|
+
const lines = code.split('\n');
|
|
202
|
+
// Import 분석
|
|
203
|
+
const singleImportRegex = /import\s+"([^"]+)"/g;
|
|
204
|
+
const multiImportRegex = /import\s+\(([\s\S]*?)\)/g;
|
|
205
|
+
let match;
|
|
206
|
+
while ((match = singleImportRegex.exec(code)) !== null) {
|
|
207
|
+
imports.push({
|
|
208
|
+
source: match[1],
|
|
209
|
+
imports: [match[1].split('/').pop() || match[1]],
|
|
210
|
+
isDefault: false,
|
|
211
|
+
isNamespace: false
|
|
212
|
+
});
|
|
213
|
+
dependencies.push(match[1].split('/')[0]);
|
|
214
|
+
}
|
|
215
|
+
while ((match = multiImportRegex.exec(code)) !== null) {
|
|
216
|
+
const importBlock = match[1];
|
|
217
|
+
const importLines = importBlock.match(/"([^"]+)"/g) || [];
|
|
218
|
+
for (const imp of importLines) {
|
|
219
|
+
const source = imp.replace(/"/g, '');
|
|
220
|
+
imports.push({
|
|
221
|
+
source,
|
|
222
|
+
imports: [source.split('/').pop() || source],
|
|
223
|
+
isDefault: false,
|
|
224
|
+
isNamespace: false
|
|
225
|
+
});
|
|
226
|
+
dependencies.push(source.split('/')[0]);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
// 함수 분석
|
|
230
|
+
const functionRegex = /func\s+(?:\((\w+)\s+\*?(\w+)\)\s+)?(\w+)\s*\(([^)]*)\)(?:\s*\(([^)]*)\)|\s*(\w+))?\s*\{/g;
|
|
231
|
+
while ((match = functionRegex.exec(code)) !== null) {
|
|
232
|
+
const lineNumber = code.substring(0, match.index).split('\n').length;
|
|
233
|
+
const isMethod = !!match[1];
|
|
234
|
+
const funcName = match[3];
|
|
235
|
+
functions.push({
|
|
236
|
+
name: funcName,
|
|
237
|
+
params: match[4].split(',').map(p => p.trim().split(' ')[0]).filter(Boolean),
|
|
238
|
+
returnType: match[5] || match[6],
|
|
239
|
+
async: false,
|
|
240
|
+
exported: funcName[0] === funcName[0].toUpperCase(),
|
|
241
|
+
lineNumber
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
// Struct 분석 (Go의 클래스 역할)
|
|
245
|
+
const structRegex = /type\s+(\w+)\s+struct\s*\{/g;
|
|
246
|
+
while ((match = structRegex.exec(code)) !== null) {
|
|
247
|
+
const structName = match[1];
|
|
248
|
+
const lineNumber = code.substring(0, match.index).split('\n').length;
|
|
249
|
+
classes.push({
|
|
250
|
+
name: structName,
|
|
251
|
+
methods: [],
|
|
252
|
+
properties: [],
|
|
253
|
+
exported: structName[0] === structName[0].toUpperCase(),
|
|
254
|
+
lineNumber
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
const complexity = calculateComplexity(code);
|
|
258
|
+
return {
|
|
259
|
+
language: 'go',
|
|
260
|
+
functions,
|
|
261
|
+
classes,
|
|
262
|
+
imports,
|
|
263
|
+
exports,
|
|
264
|
+
dependencies: [...new Set(dependencies)],
|
|
265
|
+
complexity,
|
|
266
|
+
lineCount: lines.length
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
// 복잡도 계산 (Cyclomatic Complexity 근사)
|
|
270
|
+
function calculateComplexity(code) {
|
|
271
|
+
let complexity = 1;
|
|
272
|
+
// 조건문/반복문 카운트
|
|
273
|
+
const patterns = [
|
|
274
|
+
/\bif\b/g,
|
|
275
|
+
/\belse\s+if\b/g,
|
|
276
|
+
/\bfor\b/g,
|
|
277
|
+
/\bwhile\b/g,
|
|
278
|
+
/\bcase\b/g,
|
|
279
|
+
/\bcatch\b/g,
|
|
280
|
+
/\?\s*.*\s*:/g, // 삼항 연산자
|
|
281
|
+
/&&/g,
|
|
282
|
+
/\|\|/g
|
|
283
|
+
];
|
|
284
|
+
for (const pattern of patterns) {
|
|
285
|
+
const matches = code.match(pattern);
|
|
286
|
+
if (matches) {
|
|
287
|
+
complexity += matches.length;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return complexity;
|
|
291
|
+
}
|
|
292
|
+
// 언어 감지 및 분석 (내부 구현)
|
|
293
|
+
function analyzeCodeInternal(code, language) {
|
|
294
|
+
const detectedLanguage = language || detectLanguageForAnalysis(code);
|
|
295
|
+
switch (detectedLanguage) {
|
|
296
|
+
case 'typescript':
|
|
297
|
+
case 'javascript':
|
|
298
|
+
return analyzeTypeScript(code);
|
|
299
|
+
case 'python':
|
|
300
|
+
return analyzePython(code);
|
|
301
|
+
case 'go':
|
|
302
|
+
return analyzeGo(code);
|
|
303
|
+
default:
|
|
304
|
+
return {
|
|
305
|
+
language: detectedLanguage,
|
|
306
|
+
functions: [],
|
|
307
|
+
classes: [],
|
|
308
|
+
imports: [],
|
|
309
|
+
exports: [],
|
|
310
|
+
dependencies: [],
|
|
311
|
+
complexity: calculateComplexity(code),
|
|
312
|
+
lineCount: code.split('\n').length
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
// Memoized 버전 (캐시된 분석 결과 재사용)
|
|
317
|
+
export const analyzeCode = memoize(analyzeCodeInternal, (code, language) => `${language || 'auto'}:${hashCode(code)}`);
|
|
318
|
+
function detectLanguageForAnalysis(code) {
|
|
319
|
+
if (/^import\s+.*from\s+['"]|:\s*(string|number|boolean)\b/.test(code)) {
|
|
320
|
+
return 'typescript';
|
|
321
|
+
}
|
|
322
|
+
if (/^def\s+\w+|^class\s+\w+.*:$/m.test(code)) {
|
|
323
|
+
return 'python';
|
|
324
|
+
}
|
|
325
|
+
if (/^package\s+\w+|^func\s+/.test(code)) {
|
|
326
|
+
return 'go';
|
|
327
|
+
}
|
|
328
|
+
if (/^const\s+|^let\s+|^function\s+/.test(code)) {
|
|
329
|
+
return 'javascript';
|
|
330
|
+
}
|
|
331
|
+
return 'unknown';
|
|
332
|
+
}
|
|
333
|
+
//# sourceMappingURL=astParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"astParser.js","sourceRoot":"","sources":["../../src/utils/astParser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAsDrD,2BAA2B;AAC3B,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,MAAM,SAAS,GAAmB,EAAE,CAAC;IACrC,MAAM,OAAO,GAAgB,EAAE,CAAC;IAChC,MAAM,OAAO,GAAiB,EAAE,CAAC;IACjC,MAAM,OAAO,GAAiB,EAAE,CAAC;IACjC,MAAM,YAAY,GAAa,EAAE,CAAC;IAClC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAE/B,YAAY;IACZ,MAAM,WAAW,GAAG,6EAA6E,CAAC;IAClG,MAAM,eAAe,GAAG,wDAAwD,CAAC;IAEjF,IAAI,KAAK,CAAC;IACV,OAAO,CAAC,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI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IAAI,CAAC;IACd,CAAC;IACD,IAAI,gCAAgC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAChD,OAAO,YAAY,CAAC;IACtB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 다국어 지원 유틸리티
|
|
3
|
+
* 한국어/영어 문서 동시 생성 지원
|
|
4
|
+
*/
|
|
5
|
+
export type Language = 'ko' | 'en';
|
|
6
|
+
export interface TranslationStrings {
|
|
7
|
+
overview: string;
|
|
8
|
+
features: string;
|
|
9
|
+
installation: string;
|
|
10
|
+
usage: string;
|
|
11
|
+
api: string;
|
|
12
|
+
configuration: string;
|
|
13
|
+
examples: string;
|
|
14
|
+
contributing: string;
|
|
15
|
+
license: string;
|
|
16
|
+
changelog: string;
|
|
17
|
+
version: string;
|
|
18
|
+
author: string;
|
|
19
|
+
description: string;
|
|
20
|
+
parameters: string;
|
|
21
|
+
returns: string;
|
|
22
|
+
type: string;
|
|
23
|
+
required: string;
|
|
24
|
+
optional: string;
|
|
25
|
+
default: string;
|
|
26
|
+
example: string;
|
|
27
|
+
note: string;
|
|
28
|
+
warning: string;
|
|
29
|
+
tip: string;
|
|
30
|
+
install: string;
|
|
31
|
+
run: string;
|
|
32
|
+
build: string;
|
|
33
|
+
test: string;
|
|
34
|
+
deploy: string;
|
|
35
|
+
breaking: string;
|
|
36
|
+
added: string;
|
|
37
|
+
changed: string;
|
|
38
|
+
deprecated: string;
|
|
39
|
+
removed: string;
|
|
40
|
+
fixed: string;
|
|
41
|
+
security: string;
|
|
42
|
+
readme: string;
|
|
43
|
+
tutorial: string;
|
|
44
|
+
apiReference: string;
|
|
45
|
+
designDoc: string;
|
|
46
|
+
generatedOn: string;
|
|
47
|
+
lastUpdated: string;
|
|
48
|
+
tableOfContents: string;
|
|
49
|
+
gettingStarted: string;
|
|
50
|
+
prerequisites: string;
|
|
51
|
+
quickStart: string;
|
|
52
|
+
}
|
|
53
|
+
export declare function setLanguage(lang: Language): void;
|
|
54
|
+
export declare function getLanguage(): Language;
|
|
55
|
+
export declare function t(key: keyof TranslationStrings, lang?: Language): string;
|
|
56
|
+
export declare function tBilingual(key: keyof TranslationStrings): {
|
|
57
|
+
ko: string;
|
|
58
|
+
en: string;
|
|
59
|
+
};
|
|
60
|
+
export declare function formatDate(date: Date, lang?: Language): string;
|
|
61
|
+
export declare function translateCodeComment(comment: string, targetLang: Language): string;
|
|
62
|
+
export declare function translateMarkdownHeaders(markdown: string, lang: Language): string;
|
|
63
|
+
export declare function generateBilingualDocument(generator: (lang: Language) => string): {
|
|
64
|
+
ko: string;
|
|
65
|
+
en: string;
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=i18n.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/utils/i18n.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG,IAAI,CAAC;AAEnC,MAAM,WAAW,kBAAkB;IAEjC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAGlB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM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