aiwf 0.3.21 → 0.3.23
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/package.json +3 -2
- package/src/cli/index.js +39 -336
- package/src/lib/installer.js +310 -90
- package/src/utils/messages.js +24 -0
- package/src/DEPENDENCY_MAP.md +0 -90
- package/src/cli/cache-cli.js +0 -459
- package/src/cli/checkpoint-cli.js +0 -417
- package/src/cli/language-cli.js +0 -286
- package/src/cli/sprint-cli.js +0 -287
- package/src/commands/ai-tool.js +0 -383
- package/src/commands/compress.js +0 -60
- package/src/commands/create-project.js +0 -160
- package/src/commands/evaluate.js +0 -459
- package/src/commands/persona.js +0 -309
- package/src/commands/sprint-task.js +0 -262
- package/src/commands/token.js +0 -312
- package/src/lib/ai-persona-manager.js +0 -711
- package/src/lib/cache-system.js +0 -332
- package/src/lib/context-engine.js +0 -568
- package/src/lib/github-integration.js +0 -402
- package/src/lib/memory-profiler.js +0 -471
- package/src/lib/metrics-collector.js +0 -885
- package/src/lib/offline-detector.js +0 -386
- package/src/lib/resource-loader-enhanced.js +0 -399
- package/src/lib/resource-loader.js +0 -250
- package/src/lib/resources/commands/ai-persona.js +0 -602
- package/src/lib/resources/commands/compress-context.js +0 -389
- package/src/lib/resources/commands/evaluate.js +0 -246
- package/src/lib/resources/commands/persona-context-apply.js +0 -562
- package/src/lib/resources/commands/token-tracking.js +0 -443
- package/src/lib/resources/config/commit-patterns.js +0 -103
- package/src/lib/resources/config/language.json +0 -6
- package/src/lib/resources/personas/PERSONA_INDEX.md +0 -57
- package/src/lib/resources/personas/analyst.json +0 -44
- package/src/lib/resources/personas/architect/best_practices.md +0 -136
- package/src/lib/resources/personas/architect/knowledge_base.md +0 -377
- package/src/lib/resources/personas/architect.json +0 -44
- package/src/lib/resources/personas/backend/best_practices.md +0 -766
- package/src/lib/resources/personas/backend/knowledge_base.md +0 -1070
- package/src/lib/resources/personas/data_analyst/best_practices.md +0 -594
- package/src/lib/resources/personas/data_analyst/knowledge_base.md +0 -1057
- package/src/lib/resources/personas/developer.json +0 -44
- package/src/lib/resources/personas/developer.md +0 -37
- package/src/lib/resources/personas/evaluation_criteria.json +0 -137
- package/src/lib/resources/personas/frontend/best_practices.md +0 -445
- package/src/lib/resources/personas/frontend/knowledge_base.md +0 -729
- package/src/lib/resources/personas/persona-index.json +0 -31
- package/src/lib/resources/personas/reviewer.json +0 -44
- package/src/lib/resources/personas/security/best_practices.md +0 -307
- package/src/lib/resources/personas/security/knowledge_base.md +0 -498
- package/src/lib/resources/personas/tester.json +0 -44
- package/src/lib/resources/templates/README.md +0 -78
- package/src/lib/resources/templates/api-server/config.json +0 -64
- package/src/lib/resources/templates/api-server/template/.aiwf/config.json +0 -56
- package/src/lib/resources/templates/api-server/template/.aiwf/feature-ledger.json +0 -42
- package/src/lib/resources/templates/api-server/template/.aiwf/personas/backend-engineer.json +0 -40
- package/src/lib/resources/templates/api-server/template/.aiwf/scripts/cli.js +0 -111
- package/src/lib/resources/templates/api-server/template/.env.example +0 -29
- package/src/lib/resources/templates/api-server/template/.eslintrc.json +0 -23
- package/src/lib/resources/templates/api-server/template/README.md +0 -171
- package/src/lib/resources/templates/api-server/template/jest.config.js +0 -26
- package/src/lib/resources/templates/api-server/template/nodemon.json +0 -9
- package/src/lib/resources/templates/api-server/template/package.json +0 -61
- package/src/lib/resources/templates/api-server/template/src/app.ts +0 -60
- package/src/lib/resources/templates/api-server/template/src/config/swagger.ts +0 -38
- package/src/lib/resources/templates/api-server/template/src/controllers/aiwfController.ts +0 -54
- package/src/lib/resources/templates/api-server/template/src/controllers/authController.ts +0 -128
- package/src/lib/resources/templates/api-server/template/src/controllers/statusController.ts +0 -28
- package/src/lib/resources/templates/api-server/template/src/index.ts +0 -28
- package/src/lib/resources/templates/api-server/template/src/middleware/aiwfMiddleware.ts +0 -50
- package/src/lib/resources/templates/api-server/template/src/middleware/authMiddleware.ts +0 -41
- package/src/lib/resources/templates/api-server/template/src/middleware/errorHandler.ts +0 -42
- package/src/lib/resources/templates/api-server/template/src/middleware/notFoundHandler.ts +0 -14
- package/src/lib/resources/templates/api-server/template/src/middleware/requestLogger.ts +0 -20
- package/src/lib/resources/templates/api-server/template/src/routes/aiwf.ts +0 -31
- package/src/lib/resources/templates/api-server/template/src/routes/index.ts +0 -13
- package/src/lib/resources/templates/api-server/template/src/routes/v1/index.ts +0 -67
- package/src/lib/resources/templates/api-server/template/src/utils/logger.ts +0 -37
- package/src/lib/resources/templates/api-server/template/tests/app.test.ts +0 -40
- package/src/lib/resources/templates/api-server/template/tsconfig.json +0 -43
- package/src/lib/resources/templates/npm-library/config.json +0 -61
- package/src/lib/resources/templates/npm-library/template/LICENSE +0 -21
- package/src/lib/resources/templates/npm-library/template/README.md +0 -201
- package/src/lib/resources/templates/npm-library/template/package.json +0 -78
- package/src/lib/resources/templates/web-app/config.json +0 -53
- package/src/lib/resources/templates/web-app/template/.aiwf/config.json +0 -54
- package/src/lib/resources/templates/web-app/template/.aiwf/feature-ledger.json +0 -37
- package/src/lib/resources/templates/web-app/template/.aiwf/personas/fullstack-developer.json +0 -40
- package/src/lib/resources/templates/web-app/template/.aiwf/scripts/cli.js +0 -110
- package/src/lib/resources/templates/web-app/template/.eslintrc.cjs +0 -20
- package/src/lib/resources/templates/web-app/template/README.md +0 -151
- package/src/lib/resources/templates/web-app/template/index.html +0 -14
- package/src/lib/resources/templates/web-app/template/package.json +0 -44
- package/src/lib/resources/templates/web-app/template/postcss.config.js +0 -6
- package/src/lib/resources/templates/web-app/template/public/vite.svg +0 -1
- package/src/lib/resources/templates/web-app/template/src/App.tsx +0 -21
- package/src/lib/resources/templates/web-app/template/src/components/Layout.tsx +0 -57
- package/src/lib/resources/templates/web-app/template/src/components/aiwf/ContextStatus.tsx +0 -107
- package/src/lib/resources/templates/web-app/template/src/components/aiwf/TokenUsage.tsx +0 -71
- package/src/lib/resources/templates/web-app/template/src/index.css +0 -60
- package/src/lib/resources/templates/web-app/template/src/main.tsx +0 -10
- package/src/lib/resources/templates/web-app/template/src/pages/AiwfDashboard.tsx +0 -57
- package/src/lib/resources/templates/web-app/template/src/pages/HomePage.tsx +0 -89
- package/src/lib/resources/templates/web-app/template/src/pages/NotFound.tsx +0 -25
- package/src/lib/resources/templates/web-app/template/src/stores/aiwfStore.ts +0 -126
- package/src/lib/resources/templates/web-app/template/src/types/global.d.ts +0 -9
- package/src/lib/resources/templates/web-app/template/src/vite-env.d.ts +0 -1
- package/src/lib/resources/templates/web-app/template/tailwind.config.js +0 -30
- package/src/lib/resources/templates/web-app/template/tsconfig.json +0 -37
- package/src/lib/resources/templates/web-app/template/tsconfig.node.json +0 -10
- package/src/lib/resources/templates/web-app/template/vite.config.ts +0 -23
- package/src/lib/resources/utils/background-monitor.js +0 -223
- package/src/lib/resources/utils/compression-metrics.js +0 -1031
- package/src/lib/resources/utils/compression-strategies.js +0 -557
- package/src/lib/resources/utils/content-normalizer.js +0 -455
- package/src/lib/resources/utils/context-compressor.js +0 -583
- package/src/lib/resources/utils/context-rule-parser.js +0 -180
- package/src/lib/resources/utils/context-token-monitor.js +0 -463
- package/src/lib/resources/utils/context-update-manager.js +0 -502
- package/src/lib/resources/utils/git-utils.js +0 -220
- package/src/lib/resources/utils/importance-classifier.js +0 -645
- package/src/lib/resources/utils/information-filter.js +0 -710
- package/src/lib/resources/utils/persona-aware-compressor.js +0 -598
- package/src/lib/resources/utils/prompt-injector.js +0 -242
- package/src/lib/resources/utils/simplified-evaluator.js +0 -119
- package/src/lib/resources/utils/text-summarizer.js +0 -492
- package/src/lib/resources/utils/token-counter.js +0 -177
- package/src/lib/resources/utils/token-monitor.js +0 -484
- package/src/lib/resources/utils/token-reporter.js +0 -452
- package/src/lib/resources/utils/token-storage.js +0 -433
- package/src/lib/resources/utils/token-tracker.js +0 -283
- package/src/lib/state/priority-calculator.js +0 -217
- package/src/lib/state/state-index.js +0 -155
- package/src/lib/state/task-scanner.js +0 -328
- package/src/lib/task-analyzer.js +0 -599
- package/src/lib/template-cache-system.js +0 -559
- package/src/lib/template-downloader.js +0 -467
- package/src/lib/template-version-manager.js +0 -491
- package/src/lib/token-optimizer.js +0 -517
- package/src/utils/engineering-guard.js +0 -399
package/src/commands/evaluate.js
DELETED
|
@@ -1,459 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* AIWF 평가 명령어
|
|
5
|
-
* AI 응답 품질 평가 및 개선
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { ResourceLoader } from '../lib/resource-loader.js';
|
|
9
|
-
import chalk from 'chalk';
|
|
10
|
-
import fs from 'fs-extra';
|
|
11
|
-
import path from 'path';
|
|
12
|
-
|
|
13
|
-
class EvaluateCommand {
|
|
14
|
-
constructor() {
|
|
15
|
-
this.resourceLoader = new ResourceLoader();
|
|
16
|
-
this.evaluationPath = path.join(process.cwd(), '.aiwf', 'evaluations');
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Evaluate 명령어 실행
|
|
21
|
-
*/
|
|
22
|
-
async execute(args) {
|
|
23
|
-
const [subcommand, ...restArgs] = args;
|
|
24
|
-
|
|
25
|
-
switch (subcommand) {
|
|
26
|
-
case 'response':
|
|
27
|
-
await this.evaluateResponse(restArgs);
|
|
28
|
-
break;
|
|
29
|
-
case 'code':
|
|
30
|
-
await this.evaluateCode(restArgs);
|
|
31
|
-
break;
|
|
32
|
-
case 'persona':
|
|
33
|
-
await this.evaluatePersona(restArgs);
|
|
34
|
-
break;
|
|
35
|
-
case 'report':
|
|
36
|
-
await this.generateReport();
|
|
37
|
-
break;
|
|
38
|
-
case 'criteria':
|
|
39
|
-
await this.showCriteria();
|
|
40
|
-
break;
|
|
41
|
-
default:
|
|
42
|
-
this.showHelp();
|
|
43
|
-
break;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* AI 응답 평가
|
|
49
|
-
*/
|
|
50
|
-
async evaluateResponse(args) {
|
|
51
|
-
const [responsePath] = args;
|
|
52
|
-
|
|
53
|
-
if (!responsePath) {
|
|
54
|
-
console.error(chalk.red('❌ 평가할 응답 파일 경로를 지정해주세요.'));
|
|
55
|
-
console.log(chalk.gray('사용법: aiwf evaluate response <파일경로>'));
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
try {
|
|
60
|
-
// 평가자 모듈 로드
|
|
61
|
-
const evaluatorModule = await this.resourceLoader.loadUtil('simplified-evaluator.js');
|
|
62
|
-
const SimplifiedEvaluator = evaluatorModule.SimplifiedEvaluator || evaluatorModule.default;
|
|
63
|
-
|
|
64
|
-
if (!SimplifiedEvaluator) {
|
|
65
|
-
throw new Error('SimplifiedEvaluator 모듈을 로드할 수 없습니다.');
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const evaluator = new SimplifiedEvaluator();
|
|
69
|
-
|
|
70
|
-
// 응답 내용 읽기
|
|
71
|
-
const content = await fs.readFile(responsePath, 'utf8');
|
|
72
|
-
|
|
73
|
-
console.log(chalk.cyan('🔍 AI 응답 평가 중...'));
|
|
74
|
-
|
|
75
|
-
// 평가 수행
|
|
76
|
-
const evaluation = await evaluator.evaluate(content, 'response');
|
|
77
|
-
|
|
78
|
-
// 결과 표시
|
|
79
|
-
this.displayEvaluation(evaluation);
|
|
80
|
-
|
|
81
|
-
// 평가 결과 저장
|
|
82
|
-
await this.saveEvaluation(evaluation, 'response', responsePath);
|
|
83
|
-
|
|
84
|
-
} catch (error) {
|
|
85
|
-
console.error(chalk.red('❌ 응답 평가 중 오류가 발생했습니다:'), error.message);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* 코드 품질 평가
|
|
91
|
-
*/
|
|
92
|
-
async evaluateCode(args) {
|
|
93
|
-
const [codePath] = args;
|
|
94
|
-
|
|
95
|
-
if (!codePath) {
|
|
96
|
-
console.error(chalk.red('❌ 평가할 코드 파일 경로를 지정해주세요.'));
|
|
97
|
-
console.log(chalk.gray('사용법: aiwf evaluate code <파일경로>'));
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
try {
|
|
102
|
-
const evaluatorModule = await this.resourceLoader.loadUtil('simplified-evaluator.js');
|
|
103
|
-
const SimplifiedEvaluator = evaluatorModule.SimplifiedEvaluator || evaluatorModule.default;
|
|
104
|
-
|
|
105
|
-
const evaluator = new SimplifiedEvaluator();
|
|
106
|
-
|
|
107
|
-
// 코드 내용 읽기
|
|
108
|
-
const code = await fs.readFile(codePath, 'utf8');
|
|
109
|
-
const language = path.extname(codePath).slice(1) || 'javascript';
|
|
110
|
-
|
|
111
|
-
console.log(chalk.cyan('🔍 코드 품질 평가 중...'));
|
|
112
|
-
|
|
113
|
-
// 평가 수행
|
|
114
|
-
const evaluation = await evaluator.evaluateCode(code, language);
|
|
115
|
-
|
|
116
|
-
// 결과 표시
|
|
117
|
-
this.displayCodeEvaluation(evaluation);
|
|
118
|
-
|
|
119
|
-
// 평가 결과 저장
|
|
120
|
-
await this.saveEvaluation(evaluation, 'code', codePath);
|
|
121
|
-
|
|
122
|
-
} catch (error) {
|
|
123
|
-
console.error(chalk.red('❌ 코드 평가 중 오류가 발생했습니다:'), error.message);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* 페르소나 적합성 평가
|
|
129
|
-
*/
|
|
130
|
-
async evaluatePersona(args) {
|
|
131
|
-
const [contentPath, personaName] = args;
|
|
132
|
-
|
|
133
|
-
if (!contentPath || !personaName) {
|
|
134
|
-
console.error(chalk.red('❌ 콘텐츠 경로와 페르소나 이름을 지정해주세요.'));
|
|
135
|
-
console.log(chalk.gray('사용법: aiwf evaluate persona <파일경로> <페르소나명>'));
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
try {
|
|
140
|
-
// 페르소나 인식 평가자 로드
|
|
141
|
-
const backgroundModule = await this.resourceLoader.loadUtil('background-monitor.js');
|
|
142
|
-
const BackgroundMonitor = backgroundModule.BackgroundMonitor || backgroundModule.default;
|
|
143
|
-
|
|
144
|
-
const monitor = new BackgroundMonitor();
|
|
145
|
-
|
|
146
|
-
// 콘텐츠 읽기
|
|
147
|
-
const content = await fs.readFile(contentPath, 'utf8');
|
|
148
|
-
|
|
149
|
-
console.log(chalk.cyan(`🎭 페르소나 적합성 평가 중 (${personaName})...`));
|
|
150
|
-
|
|
151
|
-
// 평가 수행
|
|
152
|
-
const result = await monitor.monitorResponse(content, personaName);
|
|
153
|
-
|
|
154
|
-
// 결과 표시
|
|
155
|
-
this.displayPersonaEvaluation(result, personaName);
|
|
156
|
-
|
|
157
|
-
// 평가 결과 저장
|
|
158
|
-
await this.saveEvaluation(result, 'persona', contentPath, { persona: personaName });
|
|
159
|
-
|
|
160
|
-
} catch (error) {
|
|
161
|
-
console.error(chalk.red('❌ 페르소나 평가 중 오류가 발생했습니다:'), error.message);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* 평가 리포트 생성
|
|
167
|
-
*/
|
|
168
|
-
async generateReport() {
|
|
169
|
-
try {
|
|
170
|
-
const evaluations = await this.loadAllEvaluations();
|
|
171
|
-
|
|
172
|
-
if (evaluations.length === 0) {
|
|
173
|
-
console.log(chalk.yellow('⚠️ 저장된 평가 결과가 없습니다.'));
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
console.log(chalk.cyan('📊 평가 리포트 생성 중...'));
|
|
178
|
-
|
|
179
|
-
const report = this.createReport(evaluations);
|
|
180
|
-
const reportPath = path.join(this.evaluationPath, 'reports', `evaluation-report-${Date.now()}.md`);
|
|
181
|
-
|
|
182
|
-
await fs.ensureDir(path.dirname(reportPath));
|
|
183
|
-
await fs.writeFile(reportPath, report);
|
|
184
|
-
|
|
185
|
-
console.log(chalk.green(`✅ 리포트가 생성되었습니다: ${reportPath}`));
|
|
186
|
-
|
|
187
|
-
// 요약 표시
|
|
188
|
-
const summary = this.createSummary(evaluations);
|
|
189
|
-
console.log(chalk.cyan('\n📈 평가 요약:'));
|
|
190
|
-
console.log(summary);
|
|
191
|
-
|
|
192
|
-
} catch (error) {
|
|
193
|
-
console.error(chalk.red('❌ 리포트 생성 중 오류가 발생했습니다:'), error.message);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* 평가 기준 표시
|
|
199
|
-
*/
|
|
200
|
-
async showCriteria() {
|
|
201
|
-
try {
|
|
202
|
-
const criteria = await this.resourceLoader.loadJSON('personas', 'evaluation_criteria.json');
|
|
203
|
-
|
|
204
|
-
console.log(chalk.cyan('📋 평가 기준'));
|
|
205
|
-
console.log(chalk.gray('-'.repeat(50)));
|
|
206
|
-
|
|
207
|
-
// 응답 평가 기준
|
|
208
|
-
console.log(chalk.bold('\n응답 평가 기준:'));
|
|
209
|
-
Object.entries(criteria.response || {}).forEach(([key, desc]) => {
|
|
210
|
-
console.log(` • ${chalk.yellow(key)}: ${desc}`);
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
// 코드 평가 기준
|
|
214
|
-
console.log(chalk.bold('\n코드 평가 기준:'));
|
|
215
|
-
Object.entries(criteria.code || {}).forEach(([key, desc]) => {
|
|
216
|
-
console.log(` • ${chalk.yellow(key)}: ${desc}`);
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
// 페르소나 평가 기준
|
|
220
|
-
console.log(chalk.bold('\n페르소나 평가 기준:'));
|
|
221
|
-
Object.entries(criteria.persona || {}).forEach(([key, desc]) => {
|
|
222
|
-
console.log(` • ${chalk.yellow(key)}: ${desc}`);
|
|
223
|
-
});
|
|
224
|
-
|
|
225
|
-
} catch (error) {
|
|
226
|
-
// 기본 기준 표시
|
|
227
|
-
console.log(chalk.cyan('📋 평가 기준'));
|
|
228
|
-
console.log(chalk.gray('-'.repeat(50)));
|
|
229
|
-
console.log('\n기본 평가 항목:');
|
|
230
|
-
console.log(' • 정확성: 요구사항을 정확히 충족하는가');
|
|
231
|
-
console.log(' • 명확성: 이해하기 쉽고 명확한가');
|
|
232
|
-
console.log(' • 완전성: 필요한 모든 정보를 포함하는가');
|
|
233
|
-
console.log(' • 일관성: 스타일과 접근법이 일관되는가');
|
|
234
|
-
console.log(' • 효율성: 최적화되고 효율적인가');
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
* 평가 결과 표시
|
|
240
|
-
*/
|
|
241
|
-
displayEvaluation(evaluation) {
|
|
242
|
-
console.log(chalk.cyan('\n📊 평가 결과'));
|
|
243
|
-
console.log(chalk.gray('-'.repeat(50)));
|
|
244
|
-
|
|
245
|
-
const score = evaluation.score || 0;
|
|
246
|
-
const scoreColor = score >= 80 ? 'green' : score >= 60 ? 'yellow' : 'red';
|
|
247
|
-
|
|
248
|
-
console.log(`전체 점수: ${chalk[scoreColor](`${score}/100`)}`);
|
|
249
|
-
|
|
250
|
-
if (evaluation.criteria) {
|
|
251
|
-
console.log('\n세부 평가:');
|
|
252
|
-
Object.entries(evaluation.criteria).forEach(([criterion, value]) => {
|
|
253
|
-
const itemScore = value.score || value;
|
|
254
|
-
const itemColor = itemScore >= 80 ? 'green' : itemScore >= 60 ? 'yellow' : 'red';
|
|
255
|
-
console.log(` • ${criterion}: ${chalk[itemColor](`${itemScore}/100`)}`);
|
|
256
|
-
if (value.feedback) {
|
|
257
|
-
console.log(` ${chalk.gray(value.feedback)}`);
|
|
258
|
-
}
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
if (evaluation.suggestions && evaluation.suggestions.length > 0) {
|
|
263
|
-
console.log('\n💡 개선 제안:');
|
|
264
|
-
evaluation.suggestions.forEach((suggestion, index) => {
|
|
265
|
-
console.log(` ${index + 1}. ${suggestion}`);
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* 코드 평가 결과 표시
|
|
272
|
-
*/
|
|
273
|
-
displayCodeEvaluation(evaluation) {
|
|
274
|
-
this.displayEvaluation(evaluation);
|
|
275
|
-
|
|
276
|
-
if (evaluation.issues && evaluation.issues.length > 0) {
|
|
277
|
-
console.log('\n⚠️ 발견된 문제:');
|
|
278
|
-
evaluation.issues.forEach((issue, index) => {
|
|
279
|
-
const severity = issue.severity || 'info';
|
|
280
|
-
const severityColor = severity === 'error' ? 'red' : severity === 'warning' ? 'yellow' : 'gray';
|
|
281
|
-
console.log(` ${index + 1}. [${chalk[severityColor](severity.toUpperCase())}] ${issue.message}`);
|
|
282
|
-
if (issue.line) {
|
|
283
|
-
console.log(` ${chalk.gray(`라인 ${issue.line}`)}`);
|
|
284
|
-
}
|
|
285
|
-
});
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
/**
|
|
290
|
-
* 페르소나 평가 결과 표시
|
|
291
|
-
*/
|
|
292
|
-
displayPersonaEvaluation(result, personaName) {
|
|
293
|
-
console.log(chalk.cyan(`\n🎭 페르소나 적합성 평가: ${personaName}`));
|
|
294
|
-
console.log(chalk.gray('-'.repeat(50)));
|
|
295
|
-
|
|
296
|
-
if (result.isAppropriate) {
|
|
297
|
-
console.log(chalk.green('✅ 페르소나에 적합한 응답입니다.'));
|
|
298
|
-
} else {
|
|
299
|
-
console.log(chalk.red('❌ 페르소나에 적합하지 않은 응답입니다.'));
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
if (result.confidence) {
|
|
303
|
-
const confColor = result.confidence >= 0.8 ? 'green' : result.confidence >= 0.6 ? 'yellow' : 'red';
|
|
304
|
-
console.log(`신뢰도: ${chalk[confColor](`${(result.confidence * 100).toFixed(0)}%`)}`);
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
if (result.feedback) {
|
|
308
|
-
console.log(`\n피드백:\n${result.feedback}`);
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
if (result.characteristics) {
|
|
312
|
-
console.log('\n발견된 특성:');
|
|
313
|
-
Object.entries(result.characteristics).forEach(([char, present]) => {
|
|
314
|
-
const icon = present ? '✅' : '❌';
|
|
315
|
-
console.log(` ${icon} ${char}`);
|
|
316
|
-
});
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
* 평가 결과 저장
|
|
322
|
-
*/
|
|
323
|
-
async saveEvaluation(evaluation, type, filePath, metadata = {}) {
|
|
324
|
-
const timestamp = new Date().toISOString();
|
|
325
|
-
const id = `eval-${type}-${Date.now()}`;
|
|
326
|
-
|
|
327
|
-
const data = {
|
|
328
|
-
id,
|
|
329
|
-
type,
|
|
330
|
-
timestamp,
|
|
331
|
-
filePath,
|
|
332
|
-
evaluation,
|
|
333
|
-
metadata
|
|
334
|
-
};
|
|
335
|
-
|
|
336
|
-
const savePath = path.join(this.evaluationPath, `${id}.json`);
|
|
337
|
-
await fs.ensureDir(this.evaluationPath);
|
|
338
|
-
await fs.writeJson(savePath, data, { spaces: 2 });
|
|
339
|
-
|
|
340
|
-
console.log(chalk.gray(`\n평가 결과 저장됨: ${savePath}`));
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
/**
|
|
344
|
-
* 모든 평가 결과 로드
|
|
345
|
-
*/
|
|
346
|
-
async loadAllEvaluations() {
|
|
347
|
-
const evaluations = [];
|
|
348
|
-
|
|
349
|
-
if (!fs.existsSync(this.evaluationPath)) {
|
|
350
|
-
return evaluations;
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
const files = await fs.readdir(this.evaluationPath);
|
|
354
|
-
for (const file of files) {
|
|
355
|
-
if (file.endsWith('.json') && file.startsWith('eval-')) {
|
|
356
|
-
try {
|
|
357
|
-
const data = await fs.readJson(path.join(this.evaluationPath, file));
|
|
358
|
-
evaluations.push(data);
|
|
359
|
-
} catch (error) {
|
|
360
|
-
// 잘못된 파일 무시
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
return evaluations.sort((a, b) => new Date(b.timestamp) - new Date(a.timestamp));
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
/**
|
|
369
|
-
* 평가 리포트 생성
|
|
370
|
-
*/
|
|
371
|
-
createReport(evaluations) {
|
|
372
|
-
const report = [];
|
|
373
|
-
|
|
374
|
-
report.push('# AIWF 평가 리포트');
|
|
375
|
-
report.push(`\n생성일: ${new Date().toISOString()}`);
|
|
376
|
-
report.push(`총 평가 수: ${evaluations.length}`);
|
|
377
|
-
|
|
378
|
-
// 타입별 통계
|
|
379
|
-
const byType = {};
|
|
380
|
-
evaluations.forEach(evaluation => {
|
|
381
|
-
byType[evaluation.type] = (byType[evaluation.type] || 0) + 1;
|
|
382
|
-
});
|
|
383
|
-
|
|
384
|
-
report.push('\n## 평가 유형별 통계');
|
|
385
|
-
Object.entries(byType).forEach(([type, count]) => {
|
|
386
|
-
report.push(`- ${type}: ${count}건`);
|
|
387
|
-
});
|
|
388
|
-
|
|
389
|
-
// 최근 평가 목록
|
|
390
|
-
report.push('\n## 최근 평가 (최대 10건)');
|
|
391
|
-
evaluations.slice(0, 10).forEach((evaluation, index) => {
|
|
392
|
-
const score = evaluation.evaluation.score || 0;
|
|
393
|
-
report.push(`\n### ${index + 1}. ${evaluation.type} 평가 - ${evaluation.filePath}`);
|
|
394
|
-
report.push(`- 시간: ${evaluation.timestamp}`);
|
|
395
|
-
report.push(`- 점수: ${score}/100`);
|
|
396
|
-
if (evaluation.evaluation.suggestions) {
|
|
397
|
-
report.push('- 제안사항:');
|
|
398
|
-
evaluation.evaluation.suggestions.forEach(s => report.push(` - ${s}`));
|
|
399
|
-
}
|
|
400
|
-
});
|
|
401
|
-
|
|
402
|
-
return report.join('\n');
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
/**
|
|
406
|
-
* 평가 요약 생성
|
|
407
|
-
*/
|
|
408
|
-
createSummary(evaluations) {
|
|
409
|
-
const totalScore = evaluations.reduce((sum, e) => sum + (e.evaluation.score || 0), 0);
|
|
410
|
-
const avgScore = evaluations.length > 0 ? totalScore / evaluations.length : 0;
|
|
411
|
-
|
|
412
|
-
const summary = [];
|
|
413
|
-
summary.push(`평균 점수: ${avgScore.toFixed(1)}/100`);
|
|
414
|
-
summary.push(`총 평가 수: ${evaluations.length}`);
|
|
415
|
-
|
|
416
|
-
// 타입별 평균
|
|
417
|
-
const typeScores = {};
|
|
418
|
-
const typeCounts = {};
|
|
419
|
-
|
|
420
|
-
evaluations.forEach(evaluation => {
|
|
421
|
-
const type = evaluation.type;
|
|
422
|
-
const score = evaluation.evaluation.score || 0;
|
|
423
|
-
typeScores[type] = (typeScores[type] || 0) + score;
|
|
424
|
-
typeCounts[type] = (typeCounts[type] || 0) + 1;
|
|
425
|
-
});
|
|
426
|
-
|
|
427
|
-
summary.push('\n타입별 평균 점수:');
|
|
428
|
-
Object.keys(typeScores).forEach(type => {
|
|
429
|
-
const avg = typeScores[type] / typeCounts[type];
|
|
430
|
-
summary.push(` - ${type}: ${avg.toFixed(1)}/100`);
|
|
431
|
-
});
|
|
432
|
-
|
|
433
|
-
return summary.join('\n');
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
/**
|
|
437
|
-
* 도움말 표시
|
|
438
|
-
*/
|
|
439
|
-
showHelp() {
|
|
440
|
-
console.log(chalk.cyan('🔍 AIWF 평가 도구'));
|
|
441
|
-
console.log(chalk.gray('-'.repeat(50)));
|
|
442
|
-
console.log('사용법: aiwf evaluate <명령어> [옵션]');
|
|
443
|
-
console.log('');
|
|
444
|
-
console.log('명령어:');
|
|
445
|
-
console.log(' response <파일> AI 응답 품질 평가');
|
|
446
|
-
console.log(' code <파일> 코드 품질 평가');
|
|
447
|
-
console.log(' persona <파일> <이름> 페르소나 적합성 평가');
|
|
448
|
-
console.log(' report 평가 리포트 생성');
|
|
449
|
-
console.log(' criteria 평가 기준 표시');
|
|
450
|
-
console.log('');
|
|
451
|
-
console.log('예시:');
|
|
452
|
-
console.log(' aiwf evaluate response response.md');
|
|
453
|
-
console.log(' aiwf evaluate code src/app.js');
|
|
454
|
-
console.log(' aiwf evaluate persona output.txt architect');
|
|
455
|
-
console.log(' aiwf evaluate report');
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
export default EvaluateCommand;
|