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,386 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { EventEmitter } from 'events';
4
-
5
- /**
6
- * 오프라인 감지 및 네트워크 상태 관리
7
- * - 네트워크 연결 상태 실시간 모니터링
8
- * - 오프라인 모드 자동 전환
9
- * - 캐시 폴백 시스템 연동
10
- */
11
- class OfflineDetector extends EventEmitter {
12
- constructor(options = {}) {
13
- super();
14
-
15
- this.options = {
16
- // 네트워크 체크 설정
17
- checkInterval: options.checkInterval || 30000, // 30초
18
- timeout: options.timeout || 5000, // 5초
19
- retryCount: options.retryCount || 3,
20
- retryDelay: options.retryDelay || 1000, // 1초
21
-
22
- // 체크할 엔드포인트들
23
- checkUrls: options.checkUrls || [
24
- 'https://api.github.com/zen',
25
- 'https://httpbin.org/status/200',
26
- 'https://jsonplaceholder.typicode.com/posts/1'
27
- ],
28
-
29
- // 오프라인 모드 설정
30
- offlineMode: options.offlineMode || false,
31
- gracefulDegradation: options.gracefulDegradation !== false
32
- };
33
-
34
- this.state = {
35
- isOnline: null,
36
- lastOnlineTime: null,
37
- lastOfflineTime: null,
38
- consecutiveFailures: 0,
39
- checkInProgress: false
40
- };
41
-
42
- this.checkTimer = null;
43
- this.cache = null; // TemplateCache 인스턴스 연결
44
- }
45
-
46
- /**
47
- * 오프라인 감지기 시작
48
- */
49
- async start() {
50
- // 초기 상태 확인
51
- await this.checkConnectionStatus();
52
-
53
- // 주기적 체크 시작
54
- this.startPeriodicCheck();
55
-
56
- // 브라우저 환경에서 네트워크 이벤트 감지
57
- if (typeof window !== 'undefined') {
58
- window.addEventListener('online', () => this.handleOnlineEvent());
59
- window.addEventListener('offline', () => this.handleOfflineEvent());
60
- }
61
-
62
- console.log('Offline detector started');
63
- }
64
-
65
- /**
66
- * 오프라인 감지기 중지
67
- */
68
- stop() {
69
- if (this.checkTimer) {
70
- clearInterval(this.checkTimer);
71
- this.checkTimer = null;
72
- }
73
-
74
- if (typeof window !== 'undefined') {
75
- window.removeEventListener('online', this.handleOnlineEvent);
76
- window.removeEventListener('offline', this.handleOfflineEvent);
77
- }
78
-
79
- console.log('Offline detector stopped');
80
- }
81
-
82
- /**
83
- * 템플릿 캐시 연결
84
- */
85
- setCache(cache) {
86
- this.cache = cache;
87
- }
88
-
89
- /**
90
- * 현재 온라인 상태 확인
91
- */
92
- async isOnline() {
93
- if (this.options.offlineMode) {
94
- return false;
95
- }
96
-
97
- // 캐시된 상태가 있고 최근 체크라면 사용
98
- if (this.state.isOnline !== null && !this.shouldRecheck()) {
99
- return this.state.isOnline;
100
- }
101
-
102
- return await this.checkConnectionStatus();
103
- }
104
-
105
- /**
106
- * 재체크 필요 여부 확인
107
- */
108
- shouldRecheck() {
109
- const now = Date.now();
110
- const lastCheck = this.state.lastOnlineTime || this.state.lastOfflineTime;
111
-
112
- if (!lastCheck) return true;
113
-
114
- return now - lastCheck > this.options.checkInterval;
115
- }
116
-
117
- /**
118
- * 네트워크 연결 상태 확인
119
- */
120
- async checkConnectionStatus() {
121
- if (this.state.checkInProgress) {
122
- return this.state.isOnline;
123
- }
124
-
125
- this.state.checkInProgress = true;
126
-
127
- try {
128
- const isConnected = await this.performConnectivityCheck();
129
- await this.updateConnectionState(isConnected);
130
- return isConnected;
131
- } finally {
132
- this.state.checkInProgress = false;
133
- }
134
- }
135
-
136
- /**
137
- * 실제 연결 테스트 수행
138
- */
139
- async performConnectivityCheck() {
140
- const results = await Promise.allSettled(
141
- this.options.checkUrls.map(url => this.checkSingleUrl(url))
142
- );
143
-
144
- // 하나라도 성공하면 온라인
145
- return results.some(result => result.status === 'fulfilled' && result.value === true);
146
- }
147
-
148
- /**
149
- * 단일 URL 체크
150
- */
151
- async checkSingleUrl(url) {
152
- const controller = new AbortController();
153
- const timeoutId = setTimeout(() => controller.abort(), this.options.timeout);
154
-
155
- try {
156
- const response = await fetch(url, {
157
- method: 'HEAD',
158
- signal: controller.signal,
159
- headers: {
160
- 'User-Agent': 'aiwf-offline-detector/1.0.0'
161
- }
162
- });
163
-
164
- clearTimeout(timeoutId);
165
- return response.ok;
166
- } catch (error) {
167
- clearTimeout(timeoutId);
168
-
169
- if (error.name === 'AbortError') {
170
- console.warn(`Connection check timeout for ${url}`);
171
- } else {
172
- console.warn(`Connection check failed for ${url}:`, error.message);
173
- }
174
-
175
- return false;
176
- }
177
- }
178
-
179
- /**
180
- * 연결 상태 업데이트
181
- */
182
- async updateConnectionState(isConnected) {
183
- const wasOnline = this.state.isOnline;
184
- const now = Date.now();
185
-
186
- if (isConnected) {
187
- this.state.isOnline = true;
188
- this.state.lastOnlineTime = now;
189
- this.state.consecutiveFailures = 0;
190
-
191
- if (wasOnline === false) {
192
- this.emit('online', { timestamp: now });
193
- console.log('🟢 Network connection restored');
194
- }
195
- } else {
196
- this.state.isOnline = false;
197
- this.state.lastOfflineTime = now;
198
- this.state.consecutiveFailures++;
199
-
200
- if (wasOnline === true) {
201
- this.emit('offline', { timestamp: now });
202
- console.log('🔴 Network connection lost, switching to offline mode');
203
- }
204
- }
205
- }
206
-
207
- /**
208
- * 주기적 체크 시작
209
- */
210
- startPeriodicCheck() {
211
- if (this.checkTimer) {
212
- clearInterval(this.checkTimer);
213
- }
214
-
215
- this.checkTimer = setInterval(async () => {
216
- await this.checkConnectionStatus();
217
- }, this.options.checkInterval);
218
- }
219
-
220
- /**
221
- * 온라인 이벤트 처리
222
- */
223
- handleOnlineEvent() {
224
- console.log('Browser online event detected');
225
- this.checkConnectionStatus();
226
- }
227
-
228
- /**
229
- * 오프라인 이벤트 처리
230
- */
231
- handleOfflineEvent() {
232
- console.log('Browser offline event detected');
233
- this.updateConnectionState(false);
234
- }
235
-
236
- /**
237
- * 템플릿 캐시에서 가져오기 (오프라인 폴백)
238
- */
239
- async useCache(type, name, version = '1.0.0') {
240
- if (!this.cache) {
241
- throw new Error('Template cache not configured');
242
- }
243
-
244
- const template = await this.cache.getTemplate(type, name, version);
245
- if (!template) {
246
- throw new Error(`Template ${type}/${name}@${version} not available offline`);
247
- }
248
-
249
- return template;
250
- }
251
-
252
- /**
253
- * 템플릿 추출 (오프라인 모드)
254
- */
255
- async extractTemplate(type, name, targetPath, version = '1.0.0') {
256
- if (!this.cache) {
257
- throw new Error('Template cache not configured');
258
- }
259
-
260
- return await this.cache.extractToDirectory(type, name, targetPath, version);
261
- }
262
-
263
- /**
264
- * 오프라인 모드 강제 설정
265
- */
266
- setOfflineMode(offline = true) {
267
- this.options.offlineMode = offline;
268
-
269
- if (offline) {
270
- this.updateConnectionState(false);
271
- console.log('🔴 Offline mode manually enabled');
272
- } else {
273
- console.log('🟢 Offline mode disabled, checking connection...');
274
- this.checkConnectionStatus();
275
- }
276
- }
277
-
278
- /**
279
- * 연결 상태 정보 반환
280
- */
281
- getConnectionInfo() {
282
- return {
283
- isOnline: this.state.isOnline,
284
- lastOnlineTime: this.state.lastOnlineTime,
285
- lastOfflineTime: this.state.lastOfflineTime,
286
- consecutiveFailures: this.state.consecutiveFailures,
287
- offlineMode: this.options.offlineMode,
288
- uptime: this.state.lastOnlineTime ? Date.now() - this.state.lastOnlineTime : null,
289
- downtime: this.state.lastOfflineTime ? Date.now() - this.state.lastOfflineTime : null
290
- };
291
- }
292
-
293
- /**
294
- * 네트워크 상태 통계
295
- */
296
- getNetworkStats() {
297
- const info = this.getConnectionInfo();
298
-
299
- return {
300
- status: info.isOnline ? 'online' : 'offline',
301
- uptime: info.uptime ? this.formatDuration(info.uptime) : 'N/A',
302
- downtime: info.downtime ? this.formatDuration(info.downtime) : 'N/A',
303
- consecutiveFailures: info.consecutiveFailures,
304
- offlineMode: info.offlineMode,
305
- lastCheck: info.lastOnlineTime || info.lastOfflineTime
306
- };
307
- }
308
-
309
- /**
310
- * 지속 시간 포맷팅
311
- */
312
- formatDuration(ms) {
313
- const seconds = Math.floor(ms / 1000);
314
- const minutes = Math.floor(seconds / 60);
315
- const hours = Math.floor(minutes / 60);
316
- const days = Math.floor(hours / 24);
317
-
318
- if (days > 0) return `${days}d ${hours % 24}h`;
319
- if (hours > 0) return `${hours}h ${minutes % 60}m`;
320
- if (minutes > 0) return `${minutes}m ${seconds % 60}s`;
321
- return `${seconds}s`;
322
- }
323
-
324
- /**
325
- * 오프라인 사용 가능한 템플릿 확인
326
- */
327
- async getAvailableOfflineTemplates() {
328
- if (!this.cache) {
329
- return { 'ai-tools': {}, 'projects': {} };
330
- }
331
-
332
- return await this.cache.listTemplates();
333
- }
334
-
335
- /**
336
- * 오프라인 상태에서 템플릿 사용 가능 여부 확인
337
- */
338
- async isTemplateAvailableOffline(type, name, version = '1.0.0') {
339
- if (!this.cache) {
340
- return false;
341
- }
342
-
343
- const template = await this.cache.getTemplate(type, name, version);
344
- return template !== null;
345
- }
346
-
347
- /**
348
- * 오프라인 사용 권장 템플릿 사전 다운로드
349
- */
350
- async predownloadRecommendedTemplates() {
351
- const recommendations = [
352
- { type: 'ai-tools', name: 'claude-code' },
353
- { type: 'ai-tools', name: 'github-copilot' },
354
- { type: 'ai-tools', name: 'cursor' },
355
- { type: 'projects', name: 'web-app' },
356
- { type: 'projects', name: 'api-server' },
357
- { type: 'projects', name: 'npm-library' }
358
- ];
359
-
360
- const results = [];
361
-
362
- for (const { type, name } of recommendations) {
363
- try {
364
- const available = await this.isTemplateAvailableOffline(type, name);
365
- results.push({
366
- type,
367
- name,
368
- available,
369
- status: available ? 'cached' : 'not_cached'
370
- });
371
- } catch (error) {
372
- results.push({
373
- type,
374
- name,
375
- available: false,
376
- status: 'error',
377
- error: error.message
378
- });
379
- }
380
- }
381
-
382
- return results;
383
- }
384
- }
385
-
386
- export { OfflineDetector };