activo 0.4.4 → 0.5.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 +203 -1
- package/data/2026-03-04_20-54.json +181 -0
- package/data/2026-03-04_20-56.json +181 -0
- package/data/apex-rulesets/egov.yaml +469 -0
- package/data/apex-rulesets/modernize.yaml +687 -0
- package/data/apex-rulesets/quality.yaml +1677 -0
- package/data/apex-rulesets/rule-schema.yaml +587 -0
- package/data/apex-rulesets/secure.yaml +1688 -0
- package/data/apex-rulesets/spring.yaml +455 -0
- package/data/apex-rulesets/sql-format.yaml +99 -0
- package/data/apex-rulesets/sql-oracle.yaml +281 -0
- package/data/apex-rulesets/sql.yaml +1660 -0
- package/dist/cli/headless.d.ts.map +1 -1
- package/dist/cli/headless.js +32 -10
- package/dist/cli/headless.js.map +1 -1
- package/dist/cli/index.js +31 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/core/agent.d.ts +3 -3
- package/dist/core/agent.d.ts.map +1 -1
- package/dist/core/agent.js +203 -384
- package/dist/core/agent.js.map +1 -1
- package/dist/core/commands.d.ts +2 -1
- package/dist/core/commands.d.ts.map +1 -1
- package/dist/core/commands.js +61 -9
- package/dist/core/commands.js.map +1 -1
- package/dist/core/config.d.ts +14 -0
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +41 -4
- package/dist/core/config.js.map +1 -1
- package/dist/core/conversation.d.ts +2 -2
- package/dist/core/conversation.d.ts.map +1 -1
- package/dist/core/conversation.js.map +1 -1
- package/dist/core/intentRouter.d.ts +43 -0
- package/dist/core/intentRouter.d.ts.map +1 -0
- package/dist/core/intentRouter.js +804 -0
- package/dist/core/intentRouter.js.map +1 -0
- package/dist/core/llm/anthropic.d.ts +24 -0
- package/dist/core/llm/anthropic.d.ts.map +1 -0
- package/dist/core/llm/anthropic.js +226 -0
- package/dist/core/llm/anthropic.js.map +1 -0
- package/dist/core/llm/ollama.d.ts +5 -14
- package/dist/core/llm/ollama.d.ts.map +1 -1
- package/dist/core/llm/ollama.js +3 -0
- package/dist/core/llm/ollama.js.map +1 -1
- package/dist/core/llm/types.d.ts +22 -0
- package/dist/core/llm/types.d.ts.map +1 -0
- package/dist/core/llm/types.js +2 -0
- package/dist/core/llm/types.js.map +1 -0
- package/dist/core/mcp/client.d.ts +6 -0
- package/dist/core/mcp/client.d.ts.map +1 -1
- package/dist/core/mcp/client.js +16 -0
- package/dist/core/mcp/client.js.map +1 -1
- package/dist/core/mcp/init.d.ts +12 -0
- package/dist/core/mcp/init.d.ts.map +1 -0
- package/dist/core/mcp/init.js +55 -0
- package/dist/core/mcp/init.js.map +1 -0
- package/dist/core/mcp/logger.d.ts +14 -0
- package/dist/core/mcp/logger.d.ts.map +1 -0
- package/dist/core/mcp/logger.js +50 -0
- package/dist/core/mcp/logger.js.map +1 -0
- package/dist/core/tools/analyzePatterns.d.ts +3 -0
- package/dist/core/tools/analyzePatterns.d.ts.map +1 -0
- package/dist/core/tools/analyzePatterns.js +293 -0
- package/dist/core/tools/analyzePatterns.js.map +1 -0
- package/dist/core/tools/apexPaths.d.ts +14 -0
- package/dist/core/tools/apexPaths.d.ts.map +1 -0
- package/dist/core/tools/apexPaths.js +54 -0
- package/dist/core/tools/apexPaths.js.map +1 -0
- package/dist/core/tools/apexUtils.d.ts +36 -0
- package/dist/core/tools/apexUtils.d.ts.map +1 -0
- package/dist/core/tools/apexUtils.js +83 -0
- package/dist/core/tools/apexUtils.js.map +1 -0
- package/dist/core/tools/explainIssue.d.ts +3 -0
- package/dist/core/tools/explainIssue.d.ts.map +1 -0
- package/dist/core/tools/explainIssue.js +181 -0
- package/dist/core/tools/explainIssue.js.map +1 -0
- package/dist/core/tools/fixGen.d.ts +3 -0
- package/dist/core/tools/fixGen.d.ts.map +1 -0
- package/dist/core/tools/fixGen.js +338 -0
- package/dist/core/tools/fixGen.js.map +1 -0
- package/dist/core/tools/generateImprovements.d.ts +21 -0
- package/dist/core/tools/generateImprovements.d.ts.map +1 -0
- package/dist/core/tools/generateImprovements.js +602 -0
- package/dist/core/tools/generateImprovements.js.map +1 -0
- package/dist/core/tools/generateReport.d.ts +3 -0
- package/dist/core/tools/generateReport.d.ts.map +1 -0
- package/dist/core/tools/generateReport.js +315 -0
- package/dist/core/tools/generateReport.js.map +1 -0
- package/dist/core/tools/index.d.ts +7 -0
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +62 -23
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/recommendProfile.d.ts +3 -0
- package/dist/core/tools/recommendProfile.d.ts.map +1 -0
- package/dist/core/tools/recommendProfile.js +334 -0
- package/dist/core/tools/recommendProfile.js.map +1 -0
- package/dist/core/tools/ruleGen.d.ts +3 -0
- package/dist/core/tools/ruleGen.d.ts.map +1 -0
- package/dist/core/tools/ruleGen.js +1103 -0
- package/dist/core/tools/ruleGen.js.map +1 -0
- package/dist/core/tools/standards.d.ts.map +1 -1
- package/dist/core/tools/standards.js +7 -3
- package/dist/core/tools/standards.js.map +1 -1
- package/dist/ui/App.d.ts.map +1 -1
- package/dist/ui/App.js +86 -35
- package/dist/ui/App.js.map +1 -1
- package/dist/ui/components/InputBox.d.ts +1 -3
- package/dist/ui/components/InputBox.d.ts.map +1 -1
- package/dist/ui/components/InputBox.js +146 -5
- package/dist/ui/components/InputBox.js.map +1 -1
- package/dist/ui/components/MessageList.d.ts +3 -1
- package/dist/ui/components/MessageList.d.ts.map +1 -1
- package/dist/ui/components/MessageList.js +13 -7
- package/dist/ui/components/MessageList.js.map +1 -1
- package/dist/ui/components/StatusBar.d.ts +1 -1
- package/dist/ui/components/StatusBar.d.ts.map +1 -1
- package/dist/ui/components/StatusBar.js +3 -2
- package/dist/ui/components/StatusBar.js.map +1 -1
- package/dist/ui/components/ToolStatus.d.ts +3 -1
- package/dist/ui/components/ToolStatus.d.ts.map +1 -1
- package/dist/ui/components/ToolStatus.js +19 -4
- package/dist/ui/components/ToolStatus.js.map +1 -1
- package/package.json +7 -1
- package/demo.gif +0 -0
- package/demo.tape +0 -53
- package/screenshot.png +0 -0
- package/src/cli/banner.ts +0 -38
- package/src/cli/headless.ts +0 -63
- package/src/cli/index.ts +0 -57
- package/src/core/agent.ts +0 -711
- package/src/core/commands.ts +0 -118
- package/src/core/config.ts +0 -98
- package/src/core/conversation.ts +0 -235
- package/src/core/llm/ollama.ts +0 -351
- package/src/core/mcp/client.ts +0 -143
- package/src/core/tools/analyzeAll.ts +0 -482
- package/src/core/tools/ast.ts +0 -826
- package/src/core/tools/builtIn.ts +0 -221
- package/src/core/tools/cache.ts +0 -570
- package/src/core/tools/cssAnalysis.ts +0 -324
- package/src/core/tools/dependencyAnalysis.ts +0 -363
- package/src/core/tools/embeddings.ts +0 -746
- package/src/core/tools/frontendAst.ts +0 -802
- package/src/core/tools/htmlAnalysis.ts +0 -466
- package/src/core/tools/index.ts +0 -160
- package/src/core/tools/javaAst.ts +0 -1030
- package/src/core/tools/javaQuality.integration.test.ts +0 -537
- package/src/core/tools/memory.ts +0 -655
- package/src/core/tools/mybatisAnalysis.ts +0 -322
- package/src/core/tools/openapiAnalysis.ts +0 -431
- package/src/core/tools/pythonAnalysis.ts +0 -477
- package/src/core/tools/sqlAnalysis.ts +0 -298
- package/src/core/tools/standards.test.ts +0 -186
- package/src/core/tools/standards.ts +0 -889
- package/src/core/tools/types.ts +0 -38
- package/src/ui/App.tsx +0 -334
- package/src/ui/components/InputBox.tsx +0 -37
- package/src/ui/components/MessageList.tsx +0 -80
- package/src/ui/components/StatusBar.tsx +0 -36
- package/src/ui/components/ToolStatus.tsx +0 -38
- package/tsconfig.json +0 -21
|
@@ -1,466 +0,0 @@
|
|
|
1
|
-
import { Tool, ToolResult } from "./types.js";
|
|
2
|
-
import * as fs from "fs";
|
|
3
|
-
import * as path from "path";
|
|
4
|
-
|
|
5
|
-
interface HtmlElement {
|
|
6
|
-
tag: string;
|
|
7
|
-
line: number;
|
|
8
|
-
issues: string[];
|
|
9
|
-
attributes?: string[];
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
interface HtmlAnalysisResult {
|
|
13
|
-
file: string;
|
|
14
|
-
type: "html" | "jsp" | "vue" | "template";
|
|
15
|
-
elements: HtmlElement[];
|
|
16
|
-
meta: {
|
|
17
|
-
title: boolean;
|
|
18
|
-
description: boolean;
|
|
19
|
-
viewport: boolean;
|
|
20
|
-
charset: boolean;
|
|
21
|
-
lang: boolean;
|
|
22
|
-
};
|
|
23
|
-
accessibility: {
|
|
24
|
-
missingAlt: number;
|
|
25
|
-
missingLabel: number;
|
|
26
|
-
missingAriaLabel: number;
|
|
27
|
-
emptyLinks: number;
|
|
28
|
-
emptyButtons: number;
|
|
29
|
-
};
|
|
30
|
-
semantic: {
|
|
31
|
-
hasHeader: boolean;
|
|
32
|
-
hasNav: boolean;
|
|
33
|
-
hasMain: boolean;
|
|
34
|
-
hasFooter: boolean;
|
|
35
|
-
hasArticle: boolean;
|
|
36
|
-
divCount: number;
|
|
37
|
-
};
|
|
38
|
-
issues: string[];
|
|
39
|
-
summary: {
|
|
40
|
-
totalElements: number;
|
|
41
|
-
elementsWithIssues: number;
|
|
42
|
-
a11yScore: number;
|
|
43
|
-
seoScore: number;
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// HTML/JSP/Vue 분석
|
|
48
|
-
function analyzeHtmlFile(filePath: string): HtmlAnalysisResult {
|
|
49
|
-
const content = fs.readFileSync(filePath, "utf-8");
|
|
50
|
-
const lines = content.split("\n");
|
|
51
|
-
const ext = path.extname(filePath).toLowerCase();
|
|
52
|
-
|
|
53
|
-
let type: "html" | "jsp" | "vue" | "template";
|
|
54
|
-
if (ext === ".jsp") type = "jsp";
|
|
55
|
-
else if (ext === ".vue") type = "vue";
|
|
56
|
-
else if (ext === ".ejs" || ext === ".hbs" || ext === ".pug") type = "template";
|
|
57
|
-
else type = "html";
|
|
58
|
-
|
|
59
|
-
const elements: HtmlElement[] = [];
|
|
60
|
-
const issues: string[] = [];
|
|
61
|
-
|
|
62
|
-
// Meta 태그 검사
|
|
63
|
-
const meta = {
|
|
64
|
-
title: /<title[^>]*>[^<]+<\/title>/i.test(content),
|
|
65
|
-
description: /<meta[^>]*name=["']description["'][^>]*>/i.test(content),
|
|
66
|
-
viewport: /<meta[^>]*name=["']viewport["'][^>]*>/i.test(content),
|
|
67
|
-
charset: /<meta[^>]*charset=/i.test(content) || /charset=/i.test(content),
|
|
68
|
-
lang: /<html[^>]*lang=/i.test(content),
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
// 접근성 검사
|
|
72
|
-
const accessibility = {
|
|
73
|
-
missingAlt: 0,
|
|
74
|
-
missingLabel: 0,
|
|
75
|
-
missingAriaLabel: 0,
|
|
76
|
-
emptyLinks: 0,
|
|
77
|
-
emptyButtons: 0,
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
// 시맨틱 태그 검사
|
|
81
|
-
const semantic = {
|
|
82
|
-
hasHeader: /<header[\s>]/i.test(content),
|
|
83
|
-
hasNav: /<nav[\s>]/i.test(content),
|
|
84
|
-
hasMain: /<main[\s>]/i.test(content),
|
|
85
|
-
hasFooter: /<footer[\s>]/i.test(content),
|
|
86
|
-
hasArticle: /<article[\s>]/i.test(content),
|
|
87
|
-
divCount: (content.match(/<div[\s>]/gi) || []).length,
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
// Deprecated 태그 목록
|
|
91
|
-
const deprecatedTags = [
|
|
92
|
-
"font", "center", "marquee", "blink", "strike", "big", "tt",
|
|
93
|
-
"frame", "frameset", "noframes", "applet", "basefont", "dir", "isindex",
|
|
94
|
-
];
|
|
95
|
-
|
|
96
|
-
// 인라인 스타일/이벤트 핸들러
|
|
97
|
-
const inlineStyles = (content.match(/style=["'][^"']+["']/gi) || []).length;
|
|
98
|
-
const inlineEvents = (content.match(/on\w+=["'][^"']+["']/gi) || []).length;
|
|
99
|
-
|
|
100
|
-
// 라인 번호 찾기 함수
|
|
101
|
-
const findLineNumber = (index: number): number => {
|
|
102
|
-
let lineNum = 1;
|
|
103
|
-
for (let i = 0; i < index && i < content.length; i++) {
|
|
104
|
-
if (content[i] === "\n") lineNum++;
|
|
105
|
-
}
|
|
106
|
-
return lineNum;
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
// img 태그 검사
|
|
110
|
-
const imgRegex = /<img([^>]*)>/gi;
|
|
111
|
-
let match;
|
|
112
|
-
while ((match = imgRegex.exec(content)) !== null) {
|
|
113
|
-
const attrs = match[1];
|
|
114
|
-
const elementIssues: string[] = [];
|
|
115
|
-
|
|
116
|
-
if (!/alt=/i.test(attrs)) {
|
|
117
|
-
elementIssues.push("alt 속성 누락");
|
|
118
|
-
accessibility.missingAlt++;
|
|
119
|
-
} else if (/alt=["']\s*["']/i.test(attrs)) {
|
|
120
|
-
elementIssues.push("alt 속성 비어있음");
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
if (!/loading=/i.test(attrs)) {
|
|
124
|
-
elementIssues.push("loading 속성 권장 (lazy)");
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if (elementIssues.length > 0) {
|
|
128
|
-
elements.push({
|
|
129
|
-
tag: "img",
|
|
130
|
-
line: findLineNumber(match.index),
|
|
131
|
-
issues: elementIssues,
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// a 태그 검사
|
|
137
|
-
const aRegex = /<a([^>]*)>([^<]*)<\/a>/gi;
|
|
138
|
-
while ((match = aRegex.exec(content)) !== null) {
|
|
139
|
-
const attrs = match[1];
|
|
140
|
-
const text = match[2].trim();
|
|
141
|
-
const elementIssues: string[] = [];
|
|
142
|
-
|
|
143
|
-
if (!text && !/aria-label=/i.test(attrs)) {
|
|
144
|
-
elementIssues.push("빈 링크 텍스트");
|
|
145
|
-
accessibility.emptyLinks++;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
if (/target=["']_blank["']/i.test(attrs) && !/rel=["'][^"']*noopener/i.test(attrs)) {
|
|
149
|
-
elementIssues.push("target=_blank에 rel=noopener 권장");
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
if (/href=["']#["']/i.test(attrs)) {
|
|
153
|
-
elementIssues.push("href='#' - 실제 링크 또는 button 사용 권장");
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
if (elementIssues.length > 0) {
|
|
157
|
-
elements.push({
|
|
158
|
-
tag: "a",
|
|
159
|
-
line: findLineNumber(match.index),
|
|
160
|
-
issues: elementIssues,
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// button 태그 검사
|
|
166
|
-
const buttonRegex = /<button([^>]*)>([^<]*)<\/button>/gi;
|
|
167
|
-
while ((match = buttonRegex.exec(content)) !== null) {
|
|
168
|
-
const attrs = match[1];
|
|
169
|
-
const text = match[2].trim();
|
|
170
|
-
const elementIssues: string[] = [];
|
|
171
|
-
|
|
172
|
-
if (!text && !/aria-label=/i.test(attrs)) {
|
|
173
|
-
elementIssues.push("빈 버튼 텍스트");
|
|
174
|
-
accessibility.emptyButtons++;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
if (!/type=/i.test(attrs)) {
|
|
178
|
-
elementIssues.push("type 속성 권장 (button/submit)");
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
if (elementIssues.length > 0) {
|
|
182
|
-
elements.push({
|
|
183
|
-
tag: "button",
|
|
184
|
-
line: findLineNumber(match.index),
|
|
185
|
-
issues: elementIssues,
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
// input 태그 검사
|
|
191
|
-
const inputRegex = /<input([^>]*)>/gi;
|
|
192
|
-
while ((match = inputRegex.exec(content)) !== null) {
|
|
193
|
-
const attrs = match[1];
|
|
194
|
-
const elementIssues: string[] = [];
|
|
195
|
-
|
|
196
|
-
// label 연결 검사 (id가 있어야 label for 가능)
|
|
197
|
-
const idMatch = attrs.match(/id=["']([^"']+)["']/i);
|
|
198
|
-
if (idMatch) {
|
|
199
|
-
const inputId = idMatch[1];
|
|
200
|
-
if (!new RegExp(`<label[^>]*for=["']${inputId}["']`, "i").test(content)) {
|
|
201
|
-
if (!/aria-label=/i.test(attrs) && !/placeholder=/i.test(attrs)) {
|
|
202
|
-
elementIssues.push("label 또는 aria-label 권장");
|
|
203
|
-
accessibility.missingLabel++;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
} else if (!/aria-label=/i.test(attrs)) {
|
|
207
|
-
// id 없으면 aria-label 필요
|
|
208
|
-
if (!/type=["'](?:hidden|submit|button|reset)["']/i.test(attrs)) {
|
|
209
|
-
elementIssues.push("id 또는 aria-label 권장");
|
|
210
|
-
accessibility.missingLabel++;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
// autocomplete 검사
|
|
215
|
-
if (/type=["'](?:password|email|tel|text)["']/i.test(attrs) && !/autocomplete=/i.test(attrs)) {
|
|
216
|
-
elementIssues.push("autocomplete 속성 권장");
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
if (elementIssues.length > 0) {
|
|
220
|
-
elements.push({
|
|
221
|
-
tag: "input",
|
|
222
|
-
line: findLineNumber(match.index),
|
|
223
|
-
issues: elementIssues,
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
// form 태그 검사
|
|
229
|
-
const formRegex = /<form([^>]*)>/gi;
|
|
230
|
-
while ((match = formRegex.exec(content)) !== null) {
|
|
231
|
-
const attrs = match[1];
|
|
232
|
-
const elementIssues: string[] = [];
|
|
233
|
-
|
|
234
|
-
if (!/action=/i.test(attrs)) {
|
|
235
|
-
elementIssues.push("action 속성 누락");
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
if (!/method=/i.test(attrs)) {
|
|
239
|
-
elementIssues.push("method 속성 권장");
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
if (elementIssues.length > 0) {
|
|
243
|
-
elements.push({
|
|
244
|
-
tag: "form",
|
|
245
|
-
line: findLineNumber(match.index),
|
|
246
|
-
issues: elementIssues,
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
// table 태그 검사
|
|
252
|
-
const tableRegex = /<table([^>]*)>/gi;
|
|
253
|
-
while ((match = tableRegex.exec(content)) !== null) {
|
|
254
|
-
const tableStart = match.index;
|
|
255
|
-
const tableEnd = content.indexOf("</table>", tableStart);
|
|
256
|
-
const tableContent = content.substring(tableStart, tableEnd);
|
|
257
|
-
const elementIssues: string[] = [];
|
|
258
|
-
|
|
259
|
-
if (!/<caption/i.test(tableContent)) {
|
|
260
|
-
elementIssues.push("caption 권장 (테이블 설명)");
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
if (!/<th[\s>]/i.test(tableContent)) {
|
|
264
|
-
elementIssues.push("th 요소 권장 (헤더 셀)");
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
if (elementIssues.length > 0) {
|
|
268
|
-
elements.push({
|
|
269
|
-
tag: "table",
|
|
270
|
-
line: findLineNumber(match.index),
|
|
271
|
-
issues: elementIssues,
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
// deprecated 태그 검사
|
|
277
|
-
deprecatedTags.forEach((tag) => {
|
|
278
|
-
const tagRegex = new RegExp(`<${tag}[\\s>]`, "gi");
|
|
279
|
-
let tagMatch;
|
|
280
|
-
while ((tagMatch = tagRegex.exec(content)) !== null) {
|
|
281
|
-
elements.push({
|
|
282
|
-
tag,
|
|
283
|
-
line: findLineNumber(tagMatch.index),
|
|
284
|
-
issues: [`deprecated 태그 - 사용 금지`],
|
|
285
|
-
});
|
|
286
|
-
}
|
|
287
|
-
});
|
|
288
|
-
|
|
289
|
-
// iframe 검사
|
|
290
|
-
const iframeRegex = /<iframe([^>]*)>/gi;
|
|
291
|
-
while ((match = iframeRegex.exec(content)) !== null) {
|
|
292
|
-
const attrs = match[1];
|
|
293
|
-
const elementIssues: string[] = [];
|
|
294
|
-
|
|
295
|
-
if (!/title=/i.test(attrs)) {
|
|
296
|
-
elementIssues.push("title 속성 권장 (접근성)");
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
if (!/sandbox=/i.test(attrs)) {
|
|
300
|
-
elementIssues.push("sandbox 속성 권장 (보안)");
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
if (elementIssues.length > 0) {
|
|
304
|
-
elements.push({
|
|
305
|
-
tag: "iframe",
|
|
306
|
-
line: findLineNumber(match.index),
|
|
307
|
-
issues: elementIssues,
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
// 전체 이슈 수집
|
|
313
|
-
if (!meta.title) issues.push("title 태그 누락 (SEO)");
|
|
314
|
-
if (!meta.description) issues.push("meta description 누락 (SEO)");
|
|
315
|
-
if (!meta.viewport) issues.push("viewport 설정 누락 (반응형)");
|
|
316
|
-
if (!meta.charset) issues.push("charset 설정 누락");
|
|
317
|
-
if (!meta.lang) issues.push("html lang 속성 누락 (접근성)");
|
|
318
|
-
|
|
319
|
-
if (!semantic.hasMain) issues.push("main 요소 없음 (시맨틱)");
|
|
320
|
-
if (semantic.divCount > 30) issues.push(`div 요소 ${semantic.divCount}개 - 시맨틱 태그 권장`);
|
|
321
|
-
|
|
322
|
-
if (inlineStyles > 5) issues.push(`인라인 스타일 ${inlineStyles}개 - CSS 클래스 권장`);
|
|
323
|
-
if (inlineEvents > 3) issues.push(`인라인 이벤트 ${inlineEvents}개 - JS 분리 권장`);
|
|
324
|
-
|
|
325
|
-
// 점수 계산
|
|
326
|
-
const a11yMaxPoints = 5;
|
|
327
|
-
let a11yPoints = a11yMaxPoints;
|
|
328
|
-
if (accessibility.missingAlt > 0) a11yPoints -= 1;
|
|
329
|
-
if (accessibility.missingLabel > 0) a11yPoints -= 1;
|
|
330
|
-
if (accessibility.emptyLinks > 0) a11yPoints -= 1;
|
|
331
|
-
if (accessibility.emptyButtons > 0) a11yPoints -= 1;
|
|
332
|
-
if (!meta.lang) a11yPoints -= 1;
|
|
333
|
-
const a11yScore = Math.max(0, Math.round((a11yPoints / a11yMaxPoints) * 100));
|
|
334
|
-
|
|
335
|
-
const seoMaxPoints = 5;
|
|
336
|
-
let seoPoints = seoMaxPoints;
|
|
337
|
-
if (!meta.title) seoPoints -= 1;
|
|
338
|
-
if (!meta.description) seoPoints -= 1;
|
|
339
|
-
if (!meta.viewport) seoPoints -= 1;
|
|
340
|
-
if (!semantic.hasMain) seoPoints -= 1;
|
|
341
|
-
if (!semantic.hasHeader && !semantic.hasNav) seoPoints -= 1;
|
|
342
|
-
const seoScore = Math.max(0, Math.round((seoPoints / seoMaxPoints) * 100));
|
|
343
|
-
|
|
344
|
-
return {
|
|
345
|
-
file: filePath,
|
|
346
|
-
type,
|
|
347
|
-
elements,
|
|
348
|
-
meta,
|
|
349
|
-
accessibility,
|
|
350
|
-
semantic,
|
|
351
|
-
issues,
|
|
352
|
-
summary: {
|
|
353
|
-
totalElements: elements.length,
|
|
354
|
-
elementsWithIssues: elements.filter((e) => e.issues.length > 0).length,
|
|
355
|
-
a11yScore,
|
|
356
|
-
seoScore,
|
|
357
|
-
},
|
|
358
|
-
};
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
// 도구 정의
|
|
362
|
-
export const htmlTools: Tool[] = [
|
|
363
|
-
{
|
|
364
|
-
name: "html_check",
|
|
365
|
-
description:
|
|
366
|
-
"HTML/JSP/Vue 파일을 분석합니다. 접근성(a11y), SEO 메타태그, 시맨틱 태그, deprecated 태그, 폼 요소 등을 검사합니다.",
|
|
367
|
-
parameters: {
|
|
368
|
-
type: "object",
|
|
369
|
-
properties: {
|
|
370
|
-
path: {
|
|
371
|
-
type: "string",
|
|
372
|
-
description: "분석할 HTML/JSP/Vue 파일 또는 디렉토리 경로",
|
|
373
|
-
},
|
|
374
|
-
recursive: {
|
|
375
|
-
type: "boolean",
|
|
376
|
-
description: "디렉토리인 경우 하위 폴더 포함 여부 (기본: true)",
|
|
377
|
-
},
|
|
378
|
-
},
|
|
379
|
-
required: ["path"],
|
|
380
|
-
},
|
|
381
|
-
handler: async (args: Record<string, unknown>): Promise<ToolResult> => {
|
|
382
|
-
const targetPath = args.path as string;
|
|
383
|
-
const recursive = args.recursive !== false;
|
|
384
|
-
|
|
385
|
-
if (!fs.existsSync(targetPath)) {
|
|
386
|
-
return {
|
|
387
|
-
success: false,
|
|
388
|
-
content: "",
|
|
389
|
-
error: `경로를 찾을 수 없습니다: ${targetPath}`,
|
|
390
|
-
};
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
const results: HtmlAnalysisResult[] = [];
|
|
394
|
-
const stats = fs.statSync(targetPath);
|
|
395
|
-
const htmlExtensions = [".html", ".htm", ".jsp", ".vue", ".ejs", ".hbs"];
|
|
396
|
-
|
|
397
|
-
if (stats.isFile()) {
|
|
398
|
-
const ext = path.extname(targetPath).toLowerCase();
|
|
399
|
-
if (htmlExtensions.includes(ext)) {
|
|
400
|
-
results.push(analyzeHtmlFile(targetPath));
|
|
401
|
-
}
|
|
402
|
-
} else if (stats.isDirectory()) {
|
|
403
|
-
const walkDir = (dir: string) => {
|
|
404
|
-
const files = fs.readdirSync(dir);
|
|
405
|
-
for (const file of files) {
|
|
406
|
-
const filePath = path.join(dir, file);
|
|
407
|
-
const fileStat = fs.statSync(filePath);
|
|
408
|
-
if (fileStat.isDirectory() && recursive) {
|
|
409
|
-
if (!file.startsWith(".") && file !== "node_modules" && file !== "target" && file !== "build") {
|
|
410
|
-
walkDir(filePath);
|
|
411
|
-
}
|
|
412
|
-
} else {
|
|
413
|
-
const ext = path.extname(file).toLowerCase();
|
|
414
|
-
if (htmlExtensions.includes(ext)) {
|
|
415
|
-
results.push(analyzeHtmlFile(filePath));
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
};
|
|
420
|
-
walkDir(targetPath);
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
// 전체 통계
|
|
424
|
-
const avgA11y = results.length > 0
|
|
425
|
-
? Math.round(results.reduce((sum, r) => sum + r.summary.a11yScore, 0) / results.length)
|
|
426
|
-
: 0;
|
|
427
|
-
const avgSeo = results.length > 0
|
|
428
|
-
? Math.round(results.reduce((sum, r) => sum + r.summary.seoScore, 0) / results.length)
|
|
429
|
-
: 0;
|
|
430
|
-
|
|
431
|
-
const totalA11y = {
|
|
432
|
-
missingAlt: results.reduce((sum, r) => sum + r.accessibility.missingAlt, 0),
|
|
433
|
-
missingLabel: results.reduce((sum, r) => sum + r.accessibility.missingLabel, 0),
|
|
434
|
-
emptyLinks: results.reduce((sum, r) => sum + r.accessibility.emptyLinks, 0),
|
|
435
|
-
emptyButtons: results.reduce((sum, r) => sum + r.accessibility.emptyButtons, 0),
|
|
436
|
-
};
|
|
437
|
-
|
|
438
|
-
const output = {
|
|
439
|
-
analyzedFiles: results.length,
|
|
440
|
-
averageA11yScore: avgA11y,
|
|
441
|
-
averageSeoScore: avgSeo,
|
|
442
|
-
totalAccessibilityIssues: totalA11y,
|
|
443
|
-
files: results.map((r) => ({
|
|
444
|
-
file: r.file,
|
|
445
|
-
type: r.type,
|
|
446
|
-
a11yScore: r.summary.a11yScore,
|
|
447
|
-
seoScore: r.summary.seoScore,
|
|
448
|
-
meta: r.meta,
|
|
449
|
-
semantic: r.semantic,
|
|
450
|
-
accessibility: r.accessibility,
|
|
451
|
-
pageIssues: r.issues,
|
|
452
|
-
elementIssues: r.elements.map((e) => ({
|
|
453
|
-
tag: e.tag,
|
|
454
|
-
line: e.line,
|
|
455
|
-
issues: e.issues,
|
|
456
|
-
})),
|
|
457
|
-
})),
|
|
458
|
-
};
|
|
459
|
-
|
|
460
|
-
return {
|
|
461
|
-
success: true,
|
|
462
|
-
content: JSON.stringify(output, null, 2),
|
|
463
|
-
};
|
|
464
|
-
},
|
|
465
|
-
},
|
|
466
|
-
];
|
package/src/core/tools/index.ts
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import { Tool, ToolCall, ToolResult } from "./types.js";
|
|
2
|
-
import { builtInTools } from "./builtIn.js";
|
|
3
|
-
import { standardsTools } from "./standards.js";
|
|
4
|
-
import { cacheTools } from "./cache.js";
|
|
5
|
-
import { astTools } from "./ast.js";
|
|
6
|
-
import { embeddingTools } from "./embeddings.js";
|
|
7
|
-
import { memoryTools } from "./memory.js";
|
|
8
|
-
import { javaTools } from "./javaAst.js";
|
|
9
|
-
import { frontendTools } from "./frontendAst.js";
|
|
10
|
-
import { sqlTools } from "./sqlAnalysis.js";
|
|
11
|
-
import { mybatisTools } from "./mybatisAnalysis.js";
|
|
12
|
-
import { cssTools } from "./cssAnalysis.js";
|
|
13
|
-
import { htmlTools } from "./htmlAnalysis.js";
|
|
14
|
-
import { dependencyTools } from "./dependencyAnalysis.js";
|
|
15
|
-
import { openapiTools } from "./openapiAnalysis.js";
|
|
16
|
-
import { pythonTools } from "./pythonAnalysis.js";
|
|
17
|
-
import { analyzeAllTools } from "./analyzeAll.js";
|
|
18
|
-
|
|
19
|
-
export * from "./types.js";
|
|
20
|
-
export * from "./builtIn.js";
|
|
21
|
-
export * from "./standards.js";
|
|
22
|
-
export * from "./cache.js";
|
|
23
|
-
export * from "./ast.js";
|
|
24
|
-
export * from "./embeddings.js";
|
|
25
|
-
export * from "./memory.js";
|
|
26
|
-
export * from "./javaAst.js";
|
|
27
|
-
export * from "./frontendAst.js";
|
|
28
|
-
export * from "./sqlAnalysis.js";
|
|
29
|
-
export * from "./mybatisAnalysis.js";
|
|
30
|
-
export * from "./cssAnalysis.js";
|
|
31
|
-
export * from "./htmlAnalysis.js";
|
|
32
|
-
export * from "./dependencyAnalysis.js";
|
|
33
|
-
export * from "./openapiAnalysis.js";
|
|
34
|
-
export * from "./pythonAnalysis.js";
|
|
35
|
-
export * from "./analyzeAll.js";
|
|
36
|
-
|
|
37
|
-
// All available tools
|
|
38
|
-
export function getAllTools(): Tool[] {
|
|
39
|
-
return [...builtInTools, ...standardsTools, ...cacheTools, ...astTools, ...embeddingTools, ...memoryTools, ...javaTools, ...frontendTools, ...sqlTools, ...mybatisTools, ...cssTools, ...htmlTools, ...dependencyTools, ...openapiTools, ...pythonTools, ...analyzeAllTools];
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Get tool by name
|
|
43
|
-
export function getTool(name: string): Tool | undefined {
|
|
44
|
-
return getAllTools().find((t) => t.name === name);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// Execute a tool call
|
|
48
|
-
export async function executeTool(toolCall: ToolCall): Promise<ToolResult> {
|
|
49
|
-
const tool = getTool(toolCall.name);
|
|
50
|
-
|
|
51
|
-
if (!tool) {
|
|
52
|
-
return {
|
|
53
|
-
success: false,
|
|
54
|
-
content: "",
|
|
55
|
-
error: `Unknown tool: ${toolCall.name}`,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
try {
|
|
60
|
-
return await tool.handler(toolCall.arguments);
|
|
61
|
-
} catch (error) {
|
|
62
|
-
return {
|
|
63
|
-
success: false,
|
|
64
|
-
content: "",
|
|
65
|
-
error: `Tool execution error: ${error}`,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Get tool definitions for LLM
|
|
71
|
-
export function getToolDefinitions(): Array<{
|
|
72
|
-
name: string;
|
|
73
|
-
description: string;
|
|
74
|
-
parameters: Tool["parameters"];
|
|
75
|
-
}> {
|
|
76
|
-
return getAllTools().map((t) => ({
|
|
77
|
-
name: t.name,
|
|
78
|
-
description: t.description,
|
|
79
|
-
parameters: t.parameters,
|
|
80
|
-
}));
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// Tool category mapping for selective loading
|
|
84
|
-
const TOOL_CATEGORIES: Record<string, string[]> = {
|
|
85
|
-
core: ["analyze_all", "read_file", "list_directory", "grep_search", "glob_search"],
|
|
86
|
-
java: ["java_analyze", "java_complexity", "spring_check"],
|
|
87
|
-
frontend_js: ["ast_analyze", "get_call_graph", "find_symbol_usage", "complexity_report"],
|
|
88
|
-
react: ["react_check"],
|
|
89
|
-
vue: ["vue_check"],
|
|
90
|
-
jquery: ["jquery_check"],
|
|
91
|
-
sql: ["sql_check"],
|
|
92
|
-
mybatis: ["mybatis_check"],
|
|
93
|
-
css: ["css_check"],
|
|
94
|
-
html: ["html_check"],
|
|
95
|
-
python: ["python_check"],
|
|
96
|
-
dependency: ["dependency_check"],
|
|
97
|
-
openapi: ["openapi_check"],
|
|
98
|
-
standards: ["import_hwp_standards", "import_pdf_standards", "index_standards", "search_standards", "check_quality_rag", "list_standards", "check_code_quality"],
|
|
99
|
-
cache: ["summarize_file", "get_file_outline", "get_cached_summary", "list_cache", "clear_cache", "batch_summarize"],
|
|
100
|
-
embeddings: ["index_codebase", "semantic_search", "find_similar_code", "embeddings_status", "clear_embeddings"],
|
|
101
|
-
memory: ["init_project_memory", "add_key_file", "add_note", "add_fact", "save_conversation", "get_project_context", "search_memory", "clear_memory"],
|
|
102
|
-
file_write: ["write_file", "run_command"],
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
// Keyword-to-category mapping
|
|
106
|
-
const KEYWORD_CATEGORIES: Array<{ keywords: string[]; categories: string[] }> = [
|
|
107
|
-
{ keywords: ["java", "spring", ".java", "controller", "service", "repository", "entity"], categories: ["java"] },
|
|
108
|
-
{ keywords: ["react", "jsx", "tsx", "hook", "usestate", "useeffect", "component"], categories: ["react", "frontend_js"] },
|
|
109
|
-
{ keywords: ["vue", ".vue", "vuex", "composition"], categories: ["vue", "frontend_js"] },
|
|
110
|
-
{ keywords: ["jquery", "$.", "$("], categories: ["jquery", "frontend_js"] },
|
|
111
|
-
{ keywords: ["javascript", "typescript", "js", "ts", "ast", "복잡도", "complexity"], categories: ["frontend_js"] },
|
|
112
|
-
{ keywords: ["sql", "query", "쿼리", "select", "insert", "update", "delete"], categories: ["sql"] },
|
|
113
|
-
{ keywords: ["mybatis", "mapper", "xml"], categories: ["mybatis"] },
|
|
114
|
-
{ keywords: ["css", "scss", "less", "style", "스타일"], categories: ["css"] },
|
|
115
|
-
{ keywords: ["html", "jsp", "접근성", "a11y", "seo"], categories: ["html"] },
|
|
116
|
-
{ keywords: ["python", ".py", "django", "flask", "fastapi"], categories: ["python"] },
|
|
117
|
-
{ keywords: ["dependency", "의존성", "package.json", "pom.xml", "gradle", "취약점"], categories: ["dependency"] },
|
|
118
|
-
{ keywords: ["openapi", "swagger", "api 스펙", "api spec"], categories: ["openapi"] },
|
|
119
|
-
{ keywords: ["표준", "standard", "hwp", "pdf", "rag", "품질기준"], categories: ["standards"] },
|
|
120
|
-
{ keywords: ["캐시", "cache", "요약", "summarize", "outline"], categories: ["cache"] },
|
|
121
|
-
{ keywords: ["임베딩", "embedding", "벡터", "vector", "semantic", "의미검색", "인덱싱"], categories: ["embeddings"] },
|
|
122
|
-
{ keywords: ["메모리", "memory", "컨텍스트", "context", "기억", "노트"], categories: ["memory"] },
|
|
123
|
-
{ keywords: ["write", "쓰기", "실행", "run", "command", "명령"], categories: ["file_write"] },
|
|
124
|
-
];
|
|
125
|
-
|
|
126
|
-
// Select relevant tools based on user message (max ~15 tools)
|
|
127
|
-
export function selectTools(userMessage: string): Tool[] {
|
|
128
|
-
const msg = userMessage.toLowerCase();
|
|
129
|
-
const allTools = getAllTools();
|
|
130
|
-
const selectedNames = new Set<string>();
|
|
131
|
-
|
|
132
|
-
// Always include core tools
|
|
133
|
-
for (const name of TOOL_CATEGORIES.core) {
|
|
134
|
-
selectedNames.add(name);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// Match keywords to categories
|
|
138
|
-
for (const { keywords, categories } of KEYWORD_CATEGORIES) {
|
|
139
|
-
if (keywords.some((kw) => msg.includes(kw))) {
|
|
140
|
-
for (const cat of categories) {
|
|
141
|
-
const names = TOOL_CATEGORIES[cat];
|
|
142
|
-
if (names) {
|
|
143
|
-
for (const name of names) {
|
|
144
|
-
selectedNames.add(name);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// If "분석", "analyze", "check", "전체" → add analyze_all (already in core)
|
|
152
|
-
// If very broad request or no specific match, add common analysis tools
|
|
153
|
-
if (selectedNames.size <= TOOL_CATEGORIES.core.length) {
|
|
154
|
-
// No specific category matched - add analyze_all + common ones
|
|
155
|
-
for (const name of TOOL_CATEGORIES.java) selectedNames.add(name);
|
|
156
|
-
for (const name of TOOL_CATEGORIES.frontend_js) selectedNames.add(name);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return allTools.filter((t) => selectedNames.has(t.name));
|
|
160
|
-
}
|