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.
Files changed (140) hide show
  1. package/package.json +3 -2
  2. package/src/cli/index.js +39 -336
  3. package/src/lib/installer.js +310 -90
  4. package/src/utils/messages.js +24 -0
  5. package/src/DEPENDENCY_MAP.md +0 -90
  6. package/src/cli/cache-cli.js +0 -459
  7. package/src/cli/checkpoint-cli.js +0 -417
  8. package/src/cli/language-cli.js +0 -286
  9. package/src/cli/sprint-cli.js +0 -287
  10. package/src/commands/ai-tool.js +0 -383
  11. package/src/commands/compress.js +0 -60
  12. package/src/commands/create-project.js +0 -160
  13. package/src/commands/evaluate.js +0 -459
  14. package/src/commands/persona.js +0 -309
  15. package/src/commands/sprint-task.js +0 -262
  16. package/src/commands/token.js +0 -312
  17. package/src/lib/ai-persona-manager.js +0 -711
  18. package/src/lib/cache-system.js +0 -332
  19. package/src/lib/context-engine.js +0 -568
  20. package/src/lib/github-integration.js +0 -402
  21. package/src/lib/memory-profiler.js +0 -471
  22. package/src/lib/metrics-collector.js +0 -885
  23. package/src/lib/offline-detector.js +0 -386
  24. package/src/lib/resource-loader-enhanced.js +0 -399
  25. package/src/lib/resource-loader.js +0 -250
  26. package/src/lib/resources/commands/ai-persona.js +0 -602
  27. package/src/lib/resources/commands/compress-context.js +0 -389
  28. package/src/lib/resources/commands/evaluate.js +0 -246
  29. package/src/lib/resources/commands/persona-context-apply.js +0 -562
  30. package/src/lib/resources/commands/token-tracking.js +0 -443
  31. package/src/lib/resources/config/commit-patterns.js +0 -103
  32. package/src/lib/resources/config/language.json +0 -6
  33. package/src/lib/resources/personas/PERSONA_INDEX.md +0 -57
  34. package/src/lib/resources/personas/analyst.json +0 -44
  35. package/src/lib/resources/personas/architect/best_practices.md +0 -136
  36. package/src/lib/resources/personas/architect/knowledge_base.md +0 -377
  37. package/src/lib/resources/personas/architect.json +0 -44
  38. package/src/lib/resources/personas/backend/best_practices.md +0 -766
  39. package/src/lib/resources/personas/backend/knowledge_base.md +0 -1070
  40. package/src/lib/resources/personas/data_analyst/best_practices.md +0 -594
  41. package/src/lib/resources/personas/data_analyst/knowledge_base.md +0 -1057
  42. package/src/lib/resources/personas/developer.json +0 -44
  43. package/src/lib/resources/personas/developer.md +0 -37
  44. package/src/lib/resources/personas/evaluation_criteria.json +0 -137
  45. package/src/lib/resources/personas/frontend/best_practices.md +0 -445
  46. package/src/lib/resources/personas/frontend/knowledge_base.md +0 -729
  47. package/src/lib/resources/personas/persona-index.json +0 -31
  48. package/src/lib/resources/personas/reviewer.json +0 -44
  49. package/src/lib/resources/personas/security/best_practices.md +0 -307
  50. package/src/lib/resources/personas/security/knowledge_base.md +0 -498
  51. package/src/lib/resources/personas/tester.json +0 -44
  52. package/src/lib/resources/templates/README.md +0 -78
  53. package/src/lib/resources/templates/api-server/config.json +0 -64
  54. package/src/lib/resources/templates/api-server/template/.aiwf/config.json +0 -56
  55. package/src/lib/resources/templates/api-server/template/.aiwf/feature-ledger.json +0 -42
  56. package/src/lib/resources/templates/api-server/template/.aiwf/personas/backend-engineer.json +0 -40
  57. package/src/lib/resources/templates/api-server/template/.aiwf/scripts/cli.js +0 -111
  58. package/src/lib/resources/templates/api-server/template/.env.example +0 -29
  59. package/src/lib/resources/templates/api-server/template/.eslintrc.json +0 -23
  60. package/src/lib/resources/templates/api-server/template/README.md +0 -171
  61. package/src/lib/resources/templates/api-server/template/jest.config.js +0 -26
  62. package/src/lib/resources/templates/api-server/template/nodemon.json +0 -9
  63. package/src/lib/resources/templates/api-server/template/package.json +0 -61
  64. package/src/lib/resources/templates/api-server/template/src/app.ts +0 -60
  65. package/src/lib/resources/templates/api-server/template/src/config/swagger.ts +0 -38
  66. package/src/lib/resources/templates/api-server/template/src/controllers/aiwfController.ts +0 -54
  67. package/src/lib/resources/templates/api-server/template/src/controllers/authController.ts +0 -128
  68. package/src/lib/resources/templates/api-server/template/src/controllers/statusController.ts +0 -28
  69. package/src/lib/resources/templates/api-server/template/src/index.ts +0 -28
  70. package/src/lib/resources/templates/api-server/template/src/middleware/aiwfMiddleware.ts +0 -50
  71. package/src/lib/resources/templates/api-server/template/src/middleware/authMiddleware.ts +0 -41
  72. package/src/lib/resources/templates/api-server/template/src/middleware/errorHandler.ts +0 -42
  73. package/src/lib/resources/templates/api-server/template/src/middleware/notFoundHandler.ts +0 -14
  74. package/src/lib/resources/templates/api-server/template/src/middleware/requestLogger.ts +0 -20
  75. package/src/lib/resources/templates/api-server/template/src/routes/aiwf.ts +0 -31
  76. package/src/lib/resources/templates/api-server/template/src/routes/index.ts +0 -13
  77. package/src/lib/resources/templates/api-server/template/src/routes/v1/index.ts +0 -67
  78. package/src/lib/resources/templates/api-server/template/src/utils/logger.ts +0 -37
  79. package/src/lib/resources/templates/api-server/template/tests/app.test.ts +0 -40
  80. package/src/lib/resources/templates/api-server/template/tsconfig.json +0 -43
  81. package/src/lib/resources/templates/npm-library/config.json +0 -61
  82. package/src/lib/resources/templates/npm-library/template/LICENSE +0 -21
  83. package/src/lib/resources/templates/npm-library/template/README.md +0 -201
  84. package/src/lib/resources/templates/npm-library/template/package.json +0 -78
  85. package/src/lib/resources/templates/web-app/config.json +0 -53
  86. package/src/lib/resources/templates/web-app/template/.aiwf/config.json +0 -54
  87. package/src/lib/resources/templates/web-app/template/.aiwf/feature-ledger.json +0 -37
  88. package/src/lib/resources/templates/web-app/template/.aiwf/personas/fullstack-developer.json +0 -40
  89. package/src/lib/resources/templates/web-app/template/.aiwf/scripts/cli.js +0 -110
  90. package/src/lib/resources/templates/web-app/template/.eslintrc.cjs +0 -20
  91. package/src/lib/resources/templates/web-app/template/README.md +0 -151
  92. package/src/lib/resources/templates/web-app/template/index.html +0 -14
  93. package/src/lib/resources/templates/web-app/template/package.json +0 -44
  94. package/src/lib/resources/templates/web-app/template/postcss.config.js +0 -6
  95. package/src/lib/resources/templates/web-app/template/public/vite.svg +0 -1
  96. package/src/lib/resources/templates/web-app/template/src/App.tsx +0 -21
  97. package/src/lib/resources/templates/web-app/template/src/components/Layout.tsx +0 -57
  98. package/src/lib/resources/templates/web-app/template/src/components/aiwf/ContextStatus.tsx +0 -107
  99. package/src/lib/resources/templates/web-app/template/src/components/aiwf/TokenUsage.tsx +0 -71
  100. package/src/lib/resources/templates/web-app/template/src/index.css +0 -60
  101. package/src/lib/resources/templates/web-app/template/src/main.tsx +0 -10
  102. package/src/lib/resources/templates/web-app/template/src/pages/AiwfDashboard.tsx +0 -57
  103. package/src/lib/resources/templates/web-app/template/src/pages/HomePage.tsx +0 -89
  104. package/src/lib/resources/templates/web-app/template/src/pages/NotFound.tsx +0 -25
  105. package/src/lib/resources/templates/web-app/template/src/stores/aiwfStore.ts +0 -126
  106. package/src/lib/resources/templates/web-app/template/src/types/global.d.ts +0 -9
  107. package/src/lib/resources/templates/web-app/template/src/vite-env.d.ts +0 -1
  108. package/src/lib/resources/templates/web-app/template/tailwind.config.js +0 -30
  109. package/src/lib/resources/templates/web-app/template/tsconfig.json +0 -37
  110. package/src/lib/resources/templates/web-app/template/tsconfig.node.json +0 -10
  111. package/src/lib/resources/templates/web-app/template/vite.config.ts +0 -23
  112. package/src/lib/resources/utils/background-monitor.js +0 -223
  113. package/src/lib/resources/utils/compression-metrics.js +0 -1031
  114. package/src/lib/resources/utils/compression-strategies.js +0 -557
  115. package/src/lib/resources/utils/content-normalizer.js +0 -455
  116. package/src/lib/resources/utils/context-compressor.js +0 -583
  117. package/src/lib/resources/utils/context-rule-parser.js +0 -180
  118. package/src/lib/resources/utils/context-token-monitor.js +0 -463
  119. package/src/lib/resources/utils/context-update-manager.js +0 -502
  120. package/src/lib/resources/utils/git-utils.js +0 -220
  121. package/src/lib/resources/utils/importance-classifier.js +0 -645
  122. package/src/lib/resources/utils/information-filter.js +0 -710
  123. package/src/lib/resources/utils/persona-aware-compressor.js +0 -598
  124. package/src/lib/resources/utils/prompt-injector.js +0 -242
  125. package/src/lib/resources/utils/simplified-evaluator.js +0 -119
  126. package/src/lib/resources/utils/text-summarizer.js +0 -492
  127. package/src/lib/resources/utils/token-counter.js +0 -177
  128. package/src/lib/resources/utils/token-monitor.js +0 -484
  129. package/src/lib/resources/utils/token-reporter.js +0 -452
  130. package/src/lib/resources/utils/token-storage.js +0 -433
  131. package/src/lib/resources/utils/token-tracker.js +0 -283
  132. package/src/lib/state/priority-calculator.js +0 -217
  133. package/src/lib/state/state-index.js +0 -155
  134. package/src/lib/state/task-scanner.js +0 -328
  135. package/src/lib/task-analyzer.js +0 -599
  136. package/src/lib/template-cache-system.js +0 -559
  137. package/src/lib/template-downloader.js +0 -467
  138. package/src/lib/template-version-manager.js +0 -491
  139. package/src/lib/token-optimizer.js +0 -517
  140. package/src/utils/engineering-guard.js +0 -399
@@ -1,399 +0,0 @@
1
- /**
2
- * Engineering Guard - 오버엔지니어링 방지 가드
3
- *
4
- * @usage YOLO 모드 전용 - 동적 import로 사용됨
5
- * @used_by /claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_yolo.md
6
- * @phase 프로젝트 복잡도 모니터링 (5단계)
7
- * @warning 삭제 금지 - YOLO 시스템 핵심 구성 요소
8
- *
9
- * YOLO 모드에서 과도한 복잡성을 방지하는 유틸리티
10
- * - 초기 복잡도 측정
11
- * - 사전 체크 및 실시간 모니터링
12
- * - 태스크 완료 후 검증
13
- * - 최종 보고서 생성
14
- */
15
-
16
- import fs from 'fs/promises';
17
- import path from 'path';
18
- import yaml from 'js-yaml';
19
-
20
- export class EngineeringGuard {
21
- constructor(configPath = null) {
22
- this.config = null;
23
- this.violations = [];
24
- this.warnings = [];
25
-
26
- if (configPath) {
27
- this.loadConfig(configPath);
28
- }
29
- }
30
-
31
- /**
32
- * 설정 파일 로드
33
- */
34
- async loadConfig(configPath) {
35
- try {
36
- const content = await fs.readFile(configPath, 'utf-8');
37
- const yoloConfig = yaml.load(content);
38
- this.config = yoloConfig.overengineering_prevention || {};
39
- } catch (error) {
40
- // 기본 설정 사용
41
- this.config = {
42
- max_file_lines: 300,
43
- max_function_lines: 50,
44
- max_nesting_depth: 4,
45
- max_abstraction_layers: 3,
46
- limit_design_patterns: true,
47
- no_future_proofing: true
48
- };
49
- }
50
- }
51
-
52
- /**
53
- * 파일 복잡도 검사
54
- */
55
- async checkFileComplexity(filePath) {
56
- try {
57
- const content = await fs.readFile(filePath, 'utf-8');
58
- const lines = content.split('\n');
59
-
60
- // 파일 크기 검사
61
- if (lines.length > this.config.max_file_lines) {
62
- this.violations.push({
63
- type: 'file_too_large',
64
- file: filePath,
65
- lines: lines.length,
66
- limit: this.config.max_file_lines,
67
- severity: 'high'
68
- });
69
- }
70
-
71
- // 함수 크기 검사 (간단한 휴리스틱)
72
- const functions = this.extractFunctions(content);
73
- for (const func of functions) {
74
- if (func.lines > this.config.max_function_lines) {
75
- this.violations.push({
76
- type: 'function_too_large',
77
- file: filePath,
78
- function: func.name,
79
- lines: func.lines,
80
- limit: this.config.max_function_lines,
81
- severity: 'medium'
82
- });
83
- }
84
- }
85
-
86
- // 중첩 깊이 검사
87
- const maxNesting = this.calculateMaxNesting(content);
88
- if (maxNesting > this.config.max_nesting_depth) {
89
- this.violations.push({
90
- type: 'excessive_nesting',
91
- file: filePath,
92
- depth: maxNesting,
93
- limit: this.config.max_nesting_depth,
94
- severity: 'medium'
95
- });
96
- }
97
-
98
- // 디자인 패턴 과용 검사
99
- if (this.config.limit_design_patterns) {
100
- const patterns = this.detectDesignPatterns(content);
101
- if (patterns.length > 2) {
102
- this.warnings.push({
103
- type: 'too_many_patterns',
104
- file: filePath,
105
- patterns: patterns,
106
- message: '단순한 해결책을 고려하세요'
107
- });
108
- }
109
- }
110
-
111
- // 미래 대비 코드 검사
112
- if (this.config.no_future_proofing) {
113
- const futureProofing = this.detectFutureProofing(content);
114
- if (futureProofing.length > 0) {
115
- this.warnings.push({
116
- type: 'future_proofing',
117
- file: filePath,
118
- instances: futureProofing,
119
- message: 'YAGNI (You Ain\'t Gonna Need It) 원칙을 따르세요'
120
- });
121
- }
122
- }
123
-
124
- } catch (error) {
125
- // 파일 읽기 실패는 무시
126
- }
127
- }
128
-
129
- /**
130
- * 함수 추출 (간단한 패턴 매칭)
131
- */
132
- extractFunctions(content) {
133
- const functions = [];
134
- const lines = content.split('\n');
135
-
136
- // JavaScript/TypeScript 함수 패턴
137
- const functionPatterns = [
138
- /^(?:export\s+)?(?:async\s+)?function\s+(\w+)/,
139
- /^(?:export\s+)?const\s+(\w+)\s*=\s*(?:async\s+)?(?:\([^)]*\)|[^=]+)\s*=>/,
140
- /^\s*(\w+)\s*\([^)]*\)\s*\{/,
141
- /^\s*(?:async\s+)?(\w+)\s*:\s*(?:async\s+)?(?:\([^)]*\)|[^=]+)\s*=>/
142
- ];
143
-
144
- let currentFunction = null;
145
- let braceCount = 0;
146
-
147
- lines.forEach((line, index) => {
148
- // 함수 시작 감지
149
- if (!currentFunction) {
150
- for (const pattern of functionPatterns) {
151
- const match = line.match(pattern);
152
- if (match) {
153
- currentFunction = {
154
- name: match[1],
155
- startLine: index,
156
- lines: 0
157
- };
158
- braceCount = 0;
159
- break;
160
- }
161
- }
162
- }
163
-
164
- // 중괄호 카운트
165
- if (currentFunction) {
166
- braceCount += (line.match(/\{/g) || []).length;
167
- braceCount -= (line.match(/\}/g) || []).length;
168
-
169
- // 함수 끝 감지
170
- if (braceCount === 0 && line.includes('}')) {
171
- currentFunction.lines = index - currentFunction.startLine + 1;
172
- functions.push(currentFunction);
173
- currentFunction = null;
174
- }
175
- }
176
- });
177
-
178
- return functions;
179
- }
180
-
181
- /**
182
- * 최대 중첩 깊이 계산
183
- */
184
- calculateMaxNesting(content) {
185
- const lines = content.split('\n');
186
- let maxDepth = 0;
187
- let currentDepth = 0;
188
-
189
- lines.forEach(line => {
190
- // 들여쓰기 기반 간단한 계산
191
- const indent = line.match(/^(\s*)/)[1].length;
192
- const depth = Math.floor(indent / 2); // 2 spaces = 1 level
193
-
194
- // 중괄호 기반 계산도 추가
195
- currentDepth += (line.match(/\{/g) || []).length;
196
- currentDepth -= (line.match(/\}/g) || []).length;
197
-
198
- maxDepth = Math.max(maxDepth, Math.max(depth, currentDepth));
199
- });
200
-
201
- return maxDepth;
202
- }
203
-
204
- /**
205
- * 디자인 패턴 감지
206
- */
207
- detectDesignPatterns(content) {
208
- const patterns = [];
209
-
210
- // 일반적인 패턴 키워드
211
- const patternKeywords = {
212
- 'Factory': /class\s+\w*Factory|createFactory|factory\s*:/i,
213
- 'Singleton': /getInstance|singleton|private\s+constructor/i,
214
- 'Observer': /subscribe|unsubscribe|notify|observer|listeners/i,
215
- 'Strategy': /strategy|setStrategy|executeStrategy/i,
216
- 'Decorator': /decorator|@\w+|wrapped|enhance/i,
217
- 'Adapter': /adapter|adapt|wrapper/i,
218
- 'Proxy': /proxy|handler|intercept/i
219
- };
220
-
221
- for (const [pattern, regex] of Object.entries(patternKeywords)) {
222
- if (regex.test(content)) {
223
- patterns.push(pattern);
224
- }
225
- }
226
-
227
- return patterns;
228
- }
229
-
230
- /**
231
- * 미래 대비 코드 감지
232
- */
233
- detectFutureProofing(content) {
234
- const instances = [];
235
-
236
- // 미래 대비 코드 패턴
237
- const futurePatterns = [
238
- { pattern: /TODO:?\s*(?:future|later|someday|eventually)/gi, type: 'future_todo' },
239
- { pattern: /FIXME:?\s*(?:when|if|after)/gi, type: 'conditional_fixme' },
240
- { pattern: /\/\/\s*(?:Will|Might|Could)\s+(?:be|need|require)/gi, type: 'speculative_comment' },
241
- { pattern: /reserved|future[Uu]se|placeholder|notImplemented/g, type: 'reserved_code' },
242
- { pattern: /version\s*[><=]+\s*['"]?\d+\.\d+/g, type: 'version_check' },
243
- { pattern: /deprecated.*future/gi, type: 'future_deprecation' }
244
- ];
245
-
246
- const lines = content.split('\n');
247
- lines.forEach((line, index) => {
248
- for (const { pattern, type } of futurePatterns) {
249
- const matches = line.match(pattern);
250
- if (matches) {
251
- instances.push({
252
- type,
253
- line: index + 1,
254
- content: line.trim(),
255
- matches
256
- });
257
- }
258
- }
259
- });
260
-
261
- return instances;
262
- }
263
-
264
- /**
265
- * 프로젝트 전체 검사
266
- */
267
- async checkProject(projectPath, filePatterns = ['**/*.js', '**/*.ts', '**/*.jsx', '**/*.tsx']) {
268
- this.violations = [];
269
- this.warnings = [];
270
-
271
- // 간단한 파일 목록 수집 (실제로는 glob 패턴 사용 필요)
272
- const checkDir = async (dir) => {
273
- const entries = await fs.readdir(dir, { withFileTypes: true });
274
-
275
- for (const entry of entries) {
276
- const fullPath = path.join(dir, entry.name);
277
-
278
- if (entry.isDirectory() && !entry.name.startsWith('.') && entry.name !== 'node_modules') {
279
- await checkDir(fullPath);
280
- } else if (entry.isFile()) {
281
- const ext = path.extname(entry.name);
282
- if (['.js', '.ts', '.jsx', '.tsx'].includes(ext)) {
283
- await this.checkFileComplexity(fullPath);
284
- }
285
- }
286
- }
287
- };
288
-
289
- await checkDir(projectPath);
290
-
291
- return this.generateReport();
292
- }
293
-
294
- /**
295
- * 검사 결과 리포트 생성
296
- */
297
- generateReport() {
298
- const report = {
299
- passed: this.violations.length === 0,
300
- violations: this.violations,
301
- warnings: this.warnings,
302
- summary: {
303
- total_violations: this.violations.length,
304
- high_severity: this.violations.filter(v => v.severity === 'high').length,
305
- medium_severity: this.violations.filter(v => v.severity === 'medium').length,
306
- warnings: this.warnings.length
307
- },
308
- recommendations: []
309
- };
310
-
311
- // 권장사항 생성
312
- if (report.summary.high_severity > 0) {
313
- report.recommendations.push('큰 파일을 작은 모듈로 분할하세요');
314
- }
315
-
316
- if (this.violations.some(v => v.type === 'function_too_large')) {
317
- report.recommendations.push('긴 함수를 더 작은 단위로 리팩토링하세요');
318
- }
319
-
320
- if (this.violations.some(v => v.type === 'excessive_nesting')) {
321
- report.recommendations.push('조기 반환(early return)을 사용하여 중첩을 줄이세요');
322
- }
323
-
324
- if (this.warnings.some(w => w.type === 'too_many_patterns')) {
325
- report.recommendations.push('필요한 경우가 아니면 단순한 해결책을 선택하세요');
326
- }
327
-
328
- if (this.warnings.some(w => w.type === 'future_proofing')) {
329
- report.recommendations.push('현재 요구사항에만 집중하세요 (YAGNI)');
330
- }
331
-
332
- return report;
333
- }
334
-
335
- /**
336
- * 실시간 피드백 제공
337
- */
338
- async provideFeedback(filePath, content = null) {
339
- if (!content) {
340
- content = await fs.readFile(filePath, 'utf-8');
341
- }
342
-
343
- const feedback = [];
344
- const lines = content.split('\n');
345
-
346
- // 즉각적인 피드백 규칙
347
- if (lines.length > this.config.max_file_lines * 0.8) {
348
- feedback.push({
349
- level: 'warning',
350
- message: `파일이 너무 커지고 있습니다 (${lines.length}/${this.config.max_file_lines} 줄). 분할을 고려하세요.`
351
- });
352
- }
353
-
354
- // 복잡한 조건문 감지
355
- const complexConditions = content.match(/if\s*\([^)]{50,}\)/g);
356
- if (complexConditions && complexConditions.length > 0) {
357
- feedback.push({
358
- level: 'suggestion',
359
- message: '복잡한 조건문을 별도의 함수로 추출하는 것을 고려하세요.'
360
- });
361
- }
362
-
363
- // 과도한 주석 감지
364
- const commentLines = lines.filter(line => line.trim().startsWith('//')).length;
365
- const codeLines = lines.filter(line => line.trim() && !line.trim().startsWith('//')).length;
366
- if (commentLines > codeLines * 0.5) {
367
- feedback.push({
368
- level: 'info',
369
- message: '코드보다 주석이 많습니다. 코드 자체가 문서가 되도록 리팩토링을 고려하세요.'
370
- });
371
- }
372
-
373
- return feedback;
374
- }
375
- }
376
-
377
- // 싱글톤 인스턴스
378
- let guardInstance = null;
379
-
380
- /**
381
- * EngineeringGuard 인스턴스 가져오기
382
- */
383
- export function getEngineeringGuard(configPath = null) {
384
- if (!guardInstance) {
385
- guardInstance = new EngineeringGuard(configPath);
386
- }
387
- return guardInstance;
388
- }
389
-
390
- /**
391
- * 빠른 검사 헬퍼 함수
392
- */
393
- export async function quickCheck(filePath) {
394
- const guard = getEngineeringGuard();
395
- await guard.checkFileComplexity(filePath);
396
- return guard.generateReport();
397
- }
398
-
399
- export default EngineeringGuard;