add-skill-kit 3.2.3 → 3.2.5

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 (126) hide show
  1. package/README.md +1 -1
  2. package/bin/lib/commands/help.js +0 -4
  3. package/bin/lib/commands/install.js +90 -9
  4. package/bin/lib/ui.js +1 -1
  5. package/lib/agent-cli/__tests__/adaptive_engine.test.js +190 -0
  6. package/lib/agent-cli/__tests__/integration/cross_script.test.js +222 -0
  7. package/lib/agent-cli/__tests__/integration/full_cycle.test.js +230 -0
  8. package/lib/agent-cli/__tests__/pattern_analyzer.test.js +173 -0
  9. package/lib/agent-cli/__tests__/pre_execution_check.test.js +167 -0
  10. package/lib/agent-cli/__tests__/skill_injector.test.js +191 -0
  11. package/lib/agent-cli/bin/agent.js +191 -0
  12. package/lib/agent-cli/dashboard/dashboard_server.js +340 -0
  13. package/lib/agent-cli/dashboard/index.html +538 -0
  14. package/lib/agent-cli/lib/audit.js +154 -0
  15. package/lib/agent-cli/lib/audit.test.js +100 -0
  16. package/lib/agent-cli/lib/auto-learn.js +319 -0
  17. package/lib/agent-cli/lib/auto_preview.py +148 -0
  18. package/lib/agent-cli/lib/backup.js +138 -0
  19. package/lib/agent-cli/lib/backup.test.js +78 -0
  20. package/lib/agent-cli/lib/checklist.py +222 -0
  21. package/lib/agent-cli/lib/cognitive-lesson.js +476 -0
  22. package/lib/agent-cli/lib/completion.js +149 -0
  23. package/lib/agent-cli/lib/config.js +35 -0
  24. package/lib/agent-cli/lib/eslint-fix.js +238 -0
  25. package/lib/agent-cli/lib/evolution-signal.js +215 -0
  26. package/lib/agent-cli/lib/export.js +86 -0
  27. package/lib/agent-cli/lib/export.test.js +65 -0
  28. package/lib/agent-cli/lib/fix.js +337 -0
  29. package/lib/agent-cli/lib/fix.test.js +80 -0
  30. package/lib/agent-cli/lib/gemini-export.js +83 -0
  31. package/lib/agent-cli/lib/generate-registry.js +42 -0
  32. package/lib/agent-cli/lib/hooks/install-hooks.js +152 -0
  33. package/lib/agent-cli/lib/hooks/lint-learn.js +172 -0
  34. package/lib/agent-cli/lib/ignore.js +116 -0
  35. package/lib/agent-cli/lib/ignore.test.js +58 -0
  36. package/lib/agent-cli/lib/init.js +124 -0
  37. package/lib/agent-cli/lib/learn.js +255 -0
  38. package/lib/agent-cli/lib/learn.test.js +70 -0
  39. package/lib/agent-cli/lib/migrate-to-v4.js +322 -0
  40. package/lib/agent-cli/lib/proposals.js +199 -0
  41. package/lib/agent-cli/lib/proposals.test.js +56 -0
  42. package/lib/agent-cli/lib/recall.js +820 -0
  43. package/lib/agent-cli/lib/recall.test.js +107 -0
  44. package/lib/agent-cli/lib/selfevolution-bridge.js +167 -0
  45. package/lib/agent-cli/lib/session_manager.py +120 -0
  46. package/lib/agent-cli/lib/settings.js +227 -0
  47. package/lib/agent-cli/lib/skill-learn.js +296 -0
  48. package/lib/agent-cli/lib/stats.js +132 -0
  49. package/lib/agent-cli/lib/stats.test.js +94 -0
  50. package/lib/agent-cli/lib/types.js +33 -0
  51. package/lib/agent-cli/lib/ui/audit-ui.js +146 -0
  52. package/lib/agent-cli/lib/ui/backup-ui.js +107 -0
  53. package/lib/agent-cli/lib/ui/clack-helpers.js +317 -0
  54. package/lib/agent-cli/lib/ui/common.js +83 -0
  55. package/lib/agent-cli/lib/ui/completion-ui.js +126 -0
  56. package/lib/agent-cli/lib/ui/custom-select.js +69 -0
  57. package/lib/agent-cli/lib/ui/dashboard-ui.js +222 -0
  58. package/lib/agent-cli/lib/ui/evolution-signals-ui.js +107 -0
  59. package/lib/agent-cli/lib/ui/export-ui.js +94 -0
  60. package/lib/agent-cli/lib/ui/fix-all-ui.js +191 -0
  61. package/lib/agent-cli/lib/ui/help-ui.js +49 -0
  62. package/lib/agent-cli/lib/ui/index.js +199 -0
  63. package/lib/agent-cli/lib/ui/init-ui.js +56 -0
  64. package/lib/agent-cli/lib/ui/knowledge-ui.js +55 -0
  65. package/lib/agent-cli/lib/ui/learn-ui.js +706 -0
  66. package/lib/agent-cli/lib/ui/lessons-ui.js +148 -0
  67. package/lib/agent-cli/lib/ui/pretty.js +145 -0
  68. package/lib/agent-cli/lib/ui/proposals-ui.js +99 -0
  69. package/lib/agent-cli/lib/ui/recall-ui.js +342 -0
  70. package/lib/agent-cli/lib/ui/routing-demo.js +79 -0
  71. package/lib/agent-cli/lib/ui/routing-ui.js +325 -0
  72. package/lib/agent-cli/lib/ui/settings-ui.js +381 -0
  73. package/lib/agent-cli/lib/ui/stats-ui.js +123 -0
  74. package/lib/agent-cli/lib/ui/watch-ui.js +236 -0
  75. package/lib/agent-cli/lib/verify_all.py +327 -0
  76. package/lib/agent-cli/lib/watcher.js +181 -0
  77. package/lib/agent-cli/lib/watcher.test.js +85 -0
  78. package/lib/agent-cli/package.json +51 -0
  79. package/lib/agent-cli/scripts/adaptive_engine.js +381 -0
  80. package/lib/agent-cli/scripts/dashboard_server.js +224 -0
  81. package/lib/agent-cli/scripts/error_sensor.js +565 -0
  82. package/lib/agent-cli/scripts/learn_from_failure.js +225 -0
  83. package/lib/agent-cli/scripts/pattern_analyzer.js +781 -0
  84. package/lib/agent-cli/scripts/pre_execution_check.js +623 -0
  85. package/lib/agent-cli/scripts/rule_sharing.js +374 -0
  86. package/lib/agent-cli/scripts/skill_injector.js +387 -0
  87. package/lib/agent-cli/scripts/success_sensor.js +500 -0
  88. package/lib/agent-cli/scripts/user_correction_sensor.js +426 -0
  89. package/lib/agent-cli/services/auto-learn-service.js +247 -0
  90. package/lib/agent-cli/src/MIGRATION.md +418 -0
  91. package/lib/agent-cli/src/README.md +367 -0
  92. package/lib/agent-cli/src/core/evolution/evolution-signal.js +42 -0
  93. package/lib/agent-cli/src/core/evolution/index.js +17 -0
  94. package/lib/agent-cli/src/core/evolution/review-gate.js +40 -0
  95. package/lib/agent-cli/src/core/evolution/signal-detector.js +137 -0
  96. package/lib/agent-cli/src/core/evolution/signal-queue.js +79 -0
  97. package/lib/agent-cli/src/core/evolution/threshold-checker.js +79 -0
  98. package/lib/agent-cli/src/core/index.js +15 -0
  99. package/lib/agent-cli/src/core/learning/cognitive-enhancer.js +282 -0
  100. package/lib/agent-cli/src/core/learning/index.js +12 -0
  101. package/lib/agent-cli/src/core/learning/lesson-synthesizer.js +83 -0
  102. package/lib/agent-cli/src/core/scanning/index.js +14 -0
  103. package/lib/agent-cli/src/data/index.js +13 -0
  104. package/lib/agent-cli/src/data/repositories/index.js +8 -0
  105. package/lib/agent-cli/src/data/repositories/lesson-repository.js +130 -0
  106. package/lib/agent-cli/src/data/repositories/signal-repository.js +119 -0
  107. package/lib/agent-cli/src/data/storage/index.js +8 -0
  108. package/lib/agent-cli/src/data/storage/json-storage.js +64 -0
  109. package/lib/agent-cli/src/data/storage/yaml-storage.js +66 -0
  110. package/lib/agent-cli/src/infrastructure/index.js +13 -0
  111. package/lib/agent-cli/src/presentation/formatters/skill-formatter.js +232 -0
  112. package/lib/agent-cli/src/services/export-service.js +162 -0
  113. package/lib/agent-cli/src/services/index.js +13 -0
  114. package/lib/agent-cli/src/services/learning-service.js +99 -0
  115. package/lib/agent-cli/types/index.d.ts +343 -0
  116. package/lib/agent-cli/utils/benchmark.js +269 -0
  117. package/lib/agent-cli/utils/logger.js +303 -0
  118. package/lib/agent-cli/utils/ml_patterns.js +300 -0
  119. package/lib/agent-cli/utils/recovery.js +312 -0
  120. package/lib/agent-cli/utils/telemetry.js +290 -0
  121. package/lib/agentskillskit-cli/README.md +21 -0
  122. package/{node_modules/agentskillskit-cli/bin → lib/agentskillskit-cli}/ag-smart.js +15 -15
  123. package/lib/agentskillskit-cli/package.json +51 -0
  124. package/package.json +19 -9
  125. /package/bin/{cli.js → kit.js} +0 -0
  126. /package/{node_modules/agentskillskit-cli → lib/agent-cli}/README.md +0 -0
@@ -0,0 +1,538 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>Auto-Learn Dashboard</title>
8
+ <style>
9
+ * {
10
+ margin: 0;
11
+ padding: 0;
12
+ box-sizing: border-box;
13
+ }
14
+
15
+ body {
16
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
17
+ background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
18
+ min-height: 100vh;
19
+ color: #e0e0e0;
20
+ }
21
+
22
+ .container {
23
+ max-width: 1400px;
24
+ margin: 0 auto;
25
+ padding: 20px;
26
+ }
27
+
28
+ header {
29
+ display: flex;
30
+ justify-content: space-between;
31
+ align-items: center;
32
+ padding: 20px 0;
33
+ border-bottom: 1px solid rgba(255, 255, 255, 0.1);
34
+ margin-bottom: 30px;
35
+ }
36
+
37
+ h1 {
38
+ font-size: 24px;
39
+ font-weight: 600;
40
+ display: flex;
41
+ align-items: center;
42
+ gap: 10px;
43
+ }
44
+
45
+ h1 span {
46
+ background: linear-gradient(135deg, #00d9ff, #00ff88);
47
+ -webkit-background-clip: text;
48
+ background-clip: text;
49
+ -webkit-text-fill-color: transparent;
50
+ }
51
+
52
+ .status-badge {
53
+ padding: 6px 12px;
54
+ border-radius: 20px;
55
+ font-size: 12px;
56
+ font-weight: 600;
57
+ }
58
+
59
+ .status-active {
60
+ background: rgba(0, 255, 136, 0.2);
61
+ color: #00ff88;
62
+ }
63
+
64
+ .grid {
65
+ display: grid;
66
+ grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
67
+ gap: 20px;
68
+ margin-bottom: 30px;
69
+ }
70
+
71
+ .card {
72
+ background: rgba(255, 255, 255, 0.05);
73
+ border-radius: 16px;
74
+ padding: 24px;
75
+ border: 1px solid rgba(255, 255, 255, 0.1);
76
+ backdrop-filter: blur(10px);
77
+ }
78
+
79
+ .card h2 {
80
+ font-size: 14px;
81
+ text-transform: uppercase;
82
+ letter-spacing: 1px;
83
+ color: #888;
84
+ margin-bottom: 16px;
85
+ }
86
+
87
+ .metric {
88
+ font-size: 48px;
89
+ font-weight: 700;
90
+ background: linear-gradient(135deg, #00d9ff, #00ff88);
91
+ -webkit-background-clip: text;
92
+ background-clip: text;
93
+ -webkit-text-fill-color: transparent;
94
+ }
95
+
96
+ .metric-label {
97
+ font-size: 14px;
98
+ color: #888;
99
+ margin-top: 8px;
100
+ }
101
+
102
+ .chart-container {
103
+ height: 200px;
104
+ margin-top: 20px;
105
+ }
106
+
107
+ .bar-chart {
108
+ display: flex;
109
+ align-items: flex-end;
110
+ gap: 8px;
111
+ height: 150px;
112
+ padding-top: 20px;
113
+ }
114
+
115
+ .bar {
116
+ flex: 1;
117
+ background: linear-gradient(180deg, #00d9ff, #0066ff);
118
+ border-radius: 4px 4px 0 0;
119
+ min-height: 10px;
120
+ transition: height 0.3s ease;
121
+ position: relative;
122
+ }
123
+
124
+ .bar:hover {
125
+ opacity: 0.8;
126
+ }
127
+
128
+ .bar-label {
129
+ position: absolute;
130
+ bottom: -25px;
131
+ left: 50%;
132
+ transform: translateX(-50%);
133
+ font-size: 10px;
134
+ color: #888;
135
+ white-space: nowrap;
136
+ }
137
+
138
+ .list {
139
+ list-style: none;
140
+ }
141
+
142
+ .list li {
143
+ display: flex;
144
+ justify-content: space-between;
145
+ align-items: center;
146
+ padding: 12px 0;
147
+ border-bottom: 1px solid rgba(255, 255, 255, 0.05);
148
+ }
149
+
150
+ .list li:last-child {
151
+ border-bottom: none;
152
+ }
153
+
154
+ .severity {
155
+ padding: 4px 8px;
156
+ border-radius: 4px;
157
+ font-size: 11px;
158
+ font-weight: 600;
159
+ }
160
+
161
+ .severity-critical {
162
+ background: rgba(255, 68, 68, 0.2);
163
+ color: #ff4444;
164
+ }
165
+
166
+ .severity-high {
167
+ background: rgba(255, 187, 0, 0.2);
168
+ color: #ffbb00;
169
+ }
170
+
171
+ .severity-medium {
172
+ background: rgba(0, 136, 255, 0.2);
173
+ color: #0088ff;
174
+ }
175
+
176
+ .severity-low {
177
+ background: rgba(136, 136, 136, 0.2);
178
+ color: #888;
179
+ }
180
+
181
+ .progress-bar {
182
+ height: 8px;
183
+ background: rgba(255, 255, 255, 0.1);
184
+ border-radius: 4px;
185
+ overflow: hidden;
186
+ margin-top: 12px;
187
+ }
188
+
189
+ .progress-fill {
190
+ height: 100%;
191
+ background: linear-gradient(90deg, #00d9ff, #00ff88);
192
+ border-radius: 4px;
193
+ transition: width 0.5s ease;
194
+ }
195
+
196
+ .actions {
197
+ display: flex;
198
+ gap: 10px;
199
+ margin-top: 20px;
200
+ }
201
+
202
+ button {
203
+ padding: 10px 20px;
204
+ border: none;
205
+ border-radius: 8px;
206
+ cursor: pointer;
207
+ font-weight: 600;
208
+ transition: all 0.2s ease;
209
+ }
210
+
211
+ .btn-primary {
212
+ background: linear-gradient(135deg, #00d9ff, #00ff88);
213
+ color: #1a1a2e;
214
+ }
215
+
216
+ .btn-primary:hover {
217
+ transform: translateY(-2px);
218
+ box-shadow: 0 4px 20px rgba(0, 217, 255, 0.3);
219
+ }
220
+
221
+ .btn-secondary {
222
+ background: rgba(255, 255, 255, 0.1);
223
+ color: #fff;
224
+ }
225
+
226
+ .btn-secondary:hover {
227
+ background: rgba(255, 255, 255, 0.2);
228
+ }
229
+
230
+ .insights {
231
+ background: linear-gradient(135deg, rgba(0, 217, 255, 0.1), rgba(0, 255, 136, 0.1));
232
+ border: 1px solid rgba(0, 217, 255, 0.3);
233
+ }
234
+
235
+ .insight-item {
236
+ display: flex;
237
+ gap: 12px;
238
+ padding: 16px 0;
239
+ border-bottom: 1px solid rgba(255, 255, 255, 0.05);
240
+ }
241
+
242
+ .insight-item:last-child {
243
+ border-bottom: none;
244
+ }
245
+
246
+ .insight-icon {
247
+ font-size: 24px;
248
+ }
249
+
250
+ .insight-content h3 {
251
+ font-size: 14px;
252
+ font-weight: 600;
253
+ margin-bottom: 4px;
254
+ }
255
+
256
+ .insight-content p {
257
+ font-size: 13px;
258
+ color: #888;
259
+ }
260
+
261
+ .footer {
262
+ text-align: center;
263
+ padding: 40px 0;
264
+ color: #666;
265
+ font-size: 13px;
266
+ }
267
+
268
+ @media (max-width: 768px) {
269
+ .grid {
270
+ grid-template-columns: 1fr;
271
+ }
272
+
273
+ .metric {
274
+ font-size: 36px;
275
+ }
276
+ }
277
+ </style>
278
+ </head>
279
+
280
+ <body>
281
+ <div class="container">
282
+ <header>
283
+ <h1>🧠 <span>Auto-Learn</span> Dashboard</h1>
284
+ <span class="status-badge status-active">⚡ Agent Skill Kit</span>
285
+ </header>
286
+
287
+ <!-- Metrics -->
288
+ <div class="grid">
289
+ <div class="card">
290
+ <h2>Total Errors Detected</h2>
291
+ <div class="metric" id="totalErrors">0</div>
292
+ <div class="metric-label">From error_sensor.js</div>
293
+ </div>
294
+
295
+ <div class="card">
296
+ <h2>User Corrections</h2>
297
+ <div class="metric" id="totalCorrections">0</div>
298
+ <div class="metric-label">From user_correction_sensor.js</div>
299
+ </div>
300
+
301
+ <div class="card">
302
+ <h2>Lessons Learned</h2>
303
+ <div class="metric" id="totalLessons">0</div>
304
+ <div class="metric-label">Active prevention rules</div>
305
+ </div>
306
+
307
+ <div class="card">
308
+ <h2>Pattern Match Score</h2>
309
+ <div class="metric" id="patternScore">0%</div>
310
+ <div class="metric-label">Repeat error prevention</div>
311
+ <div class="progress-bar">
312
+ <div class="progress-fill" id="progressFill" style="width: 0%"></div>
313
+ </div>
314
+ </div>
315
+ </div>
316
+
317
+ <!-- Charts -->
318
+ <div class="grid">
319
+ <div class="card">
320
+ <h2>Error Types Distribution</h2>
321
+ <div class="bar-chart" id="errorChart">
322
+ <!-- Bars will be added dynamically -->
323
+ </div>
324
+ </div>
325
+
326
+ <div class="card">
327
+ <h2>Correction Categories</h2>
328
+ <div class="bar-chart" id="correctionChart">
329
+ <!-- Bars will be added dynamically -->
330
+ </div>
331
+ </div>
332
+ </div>
333
+
334
+ <!-- Rules & Insights -->
335
+ <div class="grid">
336
+ <div class="card">
337
+ <h2>Recent High-Frequency Patterns</h2>
338
+ <ul class="list" id="patternList">
339
+ <li>
340
+ <span>No patterns detected yet</span>
341
+ <span class="severity severity-low">PENDING</span>
342
+ </li>
343
+ </ul>
344
+ <div class="actions">
345
+ <button class="btn-secondary" onclick="refreshData()">↻ Refresh</button>
346
+ </div>
347
+ </div>
348
+
349
+ <div class="card insights">
350
+ <h2>💡 AI Insights</h2>
351
+ <div id="insightsList">
352
+ <div class="insight-item">
353
+ <span class="insight-icon">📊</span>
354
+ <div class="insight-content">
355
+ <h3>Run sensors first</h3>
356
+ <p>Execute error_sensor.js and user_correction_sensor.js to collect data</p>
357
+ </div>
358
+ </div>
359
+ <div class="insight-item">
360
+ <span class="insight-icon">🔍</span>
361
+ <div class="insight-content">
362
+ <h3>Analyze patterns</h3>
363
+ <p>Run pattern_analyzer.js to identify high-frequency issues</p>
364
+ </div>
365
+ </div>
366
+ <div class="insight-item">
367
+ <span class="insight-icon">🛡️</span>
368
+ <div class="insight-content">
369
+ <h3>Enable prevention</h3>
370
+ <p>Use pre_execution_check.js before writing code</p>
371
+ </div>
372
+ </div>
373
+ </div>
374
+ </div>
375
+ </div>
376
+
377
+ <!-- Quick Actions -->
378
+ <div class="card">
379
+ <h2>Quick Commands</h2>
380
+ <div
381
+ style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-top: 16px;">
382
+ <div
383
+ style="background: rgba(0,0,0,0.2); padding: 16px; border-radius: 8px; font-family: monospace; font-size: 13px;">
384
+ <div style="color: #888; margin-bottom: 8px;">Scan for errors:</div>
385
+ <code style="color: #00d9ff;">node error_sensor.js --scan all</code>
386
+ </div>
387
+ <div
388
+ style="background: rgba(0,0,0,0.2); padding: 16px; border-radius: 8px; font-family: monospace; font-size: 13px;">
389
+ <div style="color: #888; margin-bottom: 8px;">Detect corrections:</div>
390
+ <code style="color: #00d9ff;">node user_correction_sensor.js --scan</code>
391
+ </div>
392
+ <div
393
+ style="background: rgba(0,0,0,0.2); padding: 16px; border-radius: 8px; font-family: monospace; font-size: 13px;">
394
+ <div style="color: #888; margin-bottom: 8px;">Analyze patterns:</div>
395
+ <code style="color: #00d9ff;">node pattern_analyzer.js --analyze</code>
396
+ </div>
397
+ <div
398
+ style="background: rgba(0,0,0,0.2); padding: 16px; border-radius: 8px; font-family: monospace; font-size: 13px;">
399
+ <div style="color: #888; margin-bottom: 8px;">Generate rules:</div>
400
+ <code style="color: #00d9ff;">node pattern_analyzer.js --rules</code>
401
+ </div>
402
+ </div>
403
+
404
+ <!-- Help Guide -->
405
+ <div class="card" id="helpSection">
406
+ <h2>📖 Help & Quick Guide</h2>
407
+ <div
408
+ style="display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-top: 16px;">
409
+ <div class="insight-item" style="border: none; padding: 0;">
410
+ <span class="insight-icon">🧠</span>
411
+ <div class="insight-content">
412
+ <h3>What is Auto-Learn?</h3>
413
+ <p>An AI system that learns from your coding mistakes and prevents them in the future.</p>
414
+ </div>
415
+ </div>
416
+ <div class="insight-item" style="border: none; padding: 0;">
417
+ <span class="insight-icon">🔄</span>
418
+ <div class="insight-content">
419
+ <h3>How it works</h3>
420
+ <p>Error → Lesson → Pattern → Rule → Prevention</p>
421
+ </div>
422
+ </div>
423
+ <div class="insight-item" style="border: none; padding: 0;">
424
+ <span class="insight-icon">⚡</span>
425
+ <div class="insight-content">
426
+ <h3>CLI Commands</h3>
427
+ <p><code style="color: #00d9ff;">agent auto-learn --scan</code></p>
428
+ </div>
429
+ </div>
430
+ <div class="insight-item" style="border: none; padding: 0;">
431
+ <span class="insight-icon">⚙️</span>
432
+ <div class="insight-content">
433
+ <h3>Settings</h3>
434
+ <p><code style="color: #00d9ff;">agent</code> → Settings → Auto-Learning</p>
435
+ </div>
436
+ </div>
437
+ </div>
438
+ <div style="margin-top: 20px; padding: 16px; background: rgba(0,217,255,0.1); border-radius: 8px;">
439
+ <h3 style="margin-bottom: 12px; font-size: 14px;">🚀 Getting Started</h3>
440
+ <ol style="margin-left: 20px; line-height: 1.8; color: #aaa;">
441
+ <li>Run <code style="color: #00d9ff;">agent auto-learn --scan</code> to detect errors</li>
442
+ <li>Run <code style="color: #00d9ff;">agent auto-learn --analyze</code> to find patterns</li>
443
+ <li>Toggle <strong>Auto-Learning: ON</strong> in Settings</li>
444
+ <li>The system will now prevent repeat errors!</li>
445
+ </ol>
446
+ </div>
447
+ </div>
448
+
449
+ <footer>
450
+ Auto-Learn Dashboard • ⚡ Agent Skill Kit • Built with ❤️
451
+ </footer>
452
+ </div>
453
+
454
+ <script>
455
+ // Sample data - In production, this would load from JSON files
456
+ const sampleData = {
457
+ errors: {
458
+ total: 24,
459
+ byType: {
460
+ 'test': 8,
461
+ 'build': 6,
462
+ 'lint': 7,
463
+ 'pattern': 3
464
+ }
465
+ },
466
+ corrections: {
467
+ total: 15,
468
+ byCategory: {
469
+ 'imports': 5,
470
+ 'types': 4,
471
+ 'null-safety': 3,
472
+ 'async': 2,
473
+ 'other': 1
474
+ }
475
+ },
476
+ lessons: 7,
477
+ patterns: [
478
+ { name: 'import_path_fix', count: 5, severity: 'HIGH' },
479
+ { name: 'type_annotation_fix', count: 4, severity: 'HIGH' },
480
+ { name: 'null_check_added', count: 3, severity: 'MEDIUM' }
481
+ ]
482
+ };
483
+
484
+ function updateMetrics(data) {
485
+ document.getElementById('totalErrors').textContent = data.errors.total;
486
+ document.getElementById('totalCorrections').textContent = data.corrections.total;
487
+ document.getElementById('totalLessons').textContent = data.lessons;
488
+
489
+ const score = Math.min(95, data.lessons * 10 + 25);
490
+ document.getElementById('patternScore').textContent = score + '%';
491
+ document.getElementById('progressFill').style.width = score + '%';
492
+ }
493
+
494
+ function renderBarChart(containerId, data, color = '#00d9ff') {
495
+ const container = document.getElementById(containerId);
496
+ container.innerHTML = '';
497
+
498
+ const maxValue = Math.max(...Object.values(data));
499
+
500
+ for (const [label, value] of Object.entries(data)) {
501
+ const height = (value / maxValue) * 130 + 10;
502
+ const bar = document.createElement('div');
503
+ bar.className = 'bar';
504
+ bar.style.height = height + 'px';
505
+ bar.innerHTML = `<span class="bar-label">${label}</span>`;
506
+ bar.title = `${label}: ${value}`;
507
+ container.appendChild(bar);
508
+ }
509
+ }
510
+
511
+ function renderPatterns(patterns) {
512
+ const container = document.getElementById('patternList');
513
+ container.innerHTML = '';
514
+
515
+ for (const pattern of patterns) {
516
+ const li = document.createElement('li');
517
+ li.innerHTML = `
518
+ <span>${pattern.name} (${pattern.count}x)</span>
519
+ <span class="severity severity-${pattern.severity.toLowerCase()}">${pattern.severity}</span>
520
+ `;
521
+ container.appendChild(li);
522
+ }
523
+ }
524
+
525
+ function refreshData() {
526
+ // Simulate loading
527
+ updateMetrics(sampleData);
528
+ renderBarChart('errorChart', sampleData.errors.byType);
529
+ renderBarChart('correctionChart', sampleData.corrections.byCategory);
530
+ renderPatterns(sampleData.patterns);
531
+ }
532
+
533
+ // Initialize
534
+ refreshData();
535
+ </script>
536
+ </body>
537
+
538
+ </html>
@@ -0,0 +1,154 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Smart Audit Script (Production-Ready)
4
+ *
5
+ * The "Judge" - Orchestrates all compliance checks:
6
+ * 1. Memory Recall (Past Mistakes)
7
+ * 2. Constitution Checks (Governance)
8
+ * 3. Real-time Analysis
9
+ *
10
+ * Usage: agent audit [directory]
11
+ */
12
+
13
+ import fs from "fs";
14
+ import path from "path";
15
+ import { fileURLToPath } from "url";
16
+ import { scanDirectory, loadKnowledge, saveKnowledge, printResults } from "./recall.js";
17
+ import { AGENT_DIR, VERSION } from "./config.js";
18
+ import * as p from "@clack/prompts";
19
+ import pc from "picocolors";
20
+
21
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
22
+
23
+ // ============================================================================
24
+ // AUDIT CONFIGURATION
25
+ // ============================================================================
26
+
27
+ const SCAN_EXTENSIONS = [".js", ".ts", ".tsx", ".jsx", ".mjs"];
28
+
29
+ // ============================================================================
30
+ // GOVERNANCE CHECKS
31
+ // ============================================================================
32
+
33
+ /**
34
+ * Check if governance files exist
35
+ * @param {string} projectRoot
36
+ * @returns {{ passed: boolean, details: string[] }}
37
+ */
38
+ function checkGovernance(projectRoot) {
39
+ const details = [];
40
+ let passed = true;
41
+
42
+ const governanceFiles = [
43
+ { path: path.join(projectRoot, ".agent", "GEMINI.md"), name: "GEMINI.md" },
44
+ { path: path.join(projectRoot, ".agent", "ARCHITECTURE.md"), name: "ARCHITECTURE.md" }
45
+ ];
46
+
47
+ governanceFiles.forEach(file => {
48
+ if (fs.existsSync(file.path)) {
49
+ details.push(`${pc.green("✓")} ${file.name} found`);
50
+ } else {
51
+ details.push(`${pc.yellow("⚠")} ${file.name} not found (optional)`);
52
+ }
53
+ });
54
+
55
+ // Check for skills
56
+ const skillsDir = path.join(projectRoot, ".agent", "skills");
57
+ if (fs.existsSync(skillsDir)) {
58
+ const skills = fs.readdirSync(skillsDir).filter(f =>
59
+ fs.statSync(path.join(skillsDir, f)).isDirectory()
60
+ );
61
+ details.push(`${pc.green("✓")} ${skills.length} skill(s) loaded`);
62
+ }
63
+
64
+ return { passed, details };
65
+ }
66
+
67
+ // ============================================================================
68
+ // MAIN AUDIT
69
+ // ============================================================================
70
+
71
+ /**
72
+ * Run full audit on a project
73
+ * @param {string} projectRoot
74
+ */
75
+ async function runAudit(projectRoot) {
76
+ p.intro(pc.cyan(`⚖️ SMART AUDIT v${VERSION}`));
77
+
78
+ let exitCode = 0;
79
+ const startTime = Date.now();
80
+
81
+ // Phase 1: Memory Recall
82
+ const s1 = p.spinner();
83
+ s1.start("Phase 1: Memory Recall");
84
+
85
+ const db = loadKnowledge();
86
+
87
+ if (db.lessons.length === 0) {
88
+ s1.stop("Phase 1: No lessons learned yet");
89
+ } else {
90
+ const { results } = scanDirectory(projectRoot, db, SCAN_EXTENSIONS);
91
+
92
+ if (results.length > 0) {
93
+ const stats = printResults(results);
94
+ saveKnowledge(db);
95
+
96
+ if (stats.errors > 0) {
97
+ exitCode = 1;
98
+ }
99
+ s1.stop(`Phase 1: Found ${stats.total} violation(s)`);
100
+ } else {
101
+ s1.stop("Phase 1: No violations found");
102
+ }
103
+ }
104
+
105
+ // Phase 2: Governance
106
+ const s2 = p.spinner();
107
+ s2.start("Phase 2: Governance Check");
108
+
109
+ const govResult = checkGovernance(projectRoot);
110
+ s2.stop("Phase 2: Governance checked");
111
+
112
+ p.note(govResult.details.join("\n"), pc.dim("Governance"));
113
+
114
+ // Phase 3: Summary
115
+ const duration = ((Date.now() - startTime) / 1000).toFixed(2);
116
+ const totalHits = db.lessons.reduce((sum, l) => sum + (l.hitCount || 0), 0);
117
+
118
+ const summaryLines = [
119
+ `⏱️ Completed in ${duration}s`,
120
+ `📊 Lessons in memory: ${db.lessons.length}`,
121
+ `🎯 Total pattern hits: ${totalHits}`
122
+ ];
123
+ p.note(summaryLines.join("\n"), pc.dim("Summary"));
124
+
125
+ if (exitCode === 0) {
126
+ p.outro(pc.green("✅ AUDIT PASSED: Code is smart and compliant"));
127
+ } else {
128
+ p.outro(pc.red("❌ AUDIT FAILED: Please fix ERROR violations"));
129
+ }
130
+
131
+ process.exit(exitCode);
132
+ }
133
+
134
+ // ============================================================================
135
+ // CLI
136
+ // ============================================================================
137
+
138
+ const args = process.argv.slice(2);
139
+ const projectRoot = args[0] || process.cwd();
140
+
141
+ if (args.includes("--help")) {
142
+ console.log(`
143
+ ⚖️ Smart Audit - Compliance Checker
144
+
145
+ Usage:
146
+ agent audit [directory]
147
+
148
+ Options:
149
+ --help Show this help
150
+ `);
151
+ process.exit(0);
152
+ }
153
+
154
+ runAudit(projectRoot);