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,224 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Dashboard Server - Local web server for Auto-Learn Dashboard
4
+ *
5
+ * Part of FAANG-Grade Auto-Learn System Phase 4
6
+ *
7
+ * Serves:
8
+ * - Static dashboard HTML
9
+ * - API endpoints for data
10
+ *
11
+ * Usage:
12
+ * node dashboard_server.js --start
13
+ * node dashboard_server.js --port 3030
14
+ */
15
+
16
+ import fs from 'fs';
17
+ import path from 'path';
18
+ import http from 'http';
19
+ import { fileURLToPath } from 'url';
20
+
21
+ const __filename = fileURLToPath(import.meta.url);
22
+ const __dirname = path.dirname(__filename);
23
+
24
+ // Colors
25
+ const c = {
26
+ reset: '\x1b[0m',
27
+ red: '\x1b[31m',
28
+ green: '\x1b[32m',
29
+ yellow: '\x1b[33m',
30
+ cyan: '\x1b[36m',
31
+ gray: '\x1b[90m',
32
+ bold: '\x1b[1m'
33
+ };
34
+
35
+ // Find project root
36
+ function findProjectRoot() {
37
+ let current = process.cwd();
38
+ while (current !== path.dirname(current)) {
39
+ if (fs.existsSync(path.join(current, '.agent'))) {
40
+ return current;
41
+ }
42
+ current = path.dirname(current);
43
+ }
44
+ return process.cwd();
45
+ }
46
+
47
+ const projectRoot = findProjectRoot();
48
+ const knowledgePath = path.join(projectRoot, '.agent', 'knowledge');
49
+ const dashboardPath = path.join(__dirname, '..', 'dashboard');
50
+
51
+ // Load JSON files
52
+ function loadJson(filename) {
53
+ const filePath = path.join(knowledgePath, filename);
54
+ try {
55
+ if (fs.existsSync(filePath)) {
56
+ return JSON.parse(fs.readFileSync(filePath, 'utf8'));
57
+ }
58
+ } catch { }
59
+ return null;
60
+ }
61
+
62
+ // API handlers
63
+ const api = {
64
+ '/api/errors': () => {
65
+ const data = loadJson('detected-errors.json');
66
+ return data || { errors: [], totalErrors: 0 };
67
+ },
68
+
69
+ '/api/corrections': () => {
70
+ const data = loadJson('user-corrections.json');
71
+ return data || { corrections: [], totalCorrections: 0 };
72
+ },
73
+
74
+ '/api/lessons': () => {
75
+ const data = loadJson('lessons-learned.json');
76
+ return data || { lessons: [] };
77
+ },
78
+
79
+ '/api/patterns': () => {
80
+ const data = loadJson('patterns.json');
81
+ return data || { errors: {}, corrections: {}, highFrequency: [] };
82
+ },
83
+
84
+ '/api/summary': () => {
85
+ const errors = loadJson('detected-errors.json');
86
+ const corrections = loadJson('user-corrections.json');
87
+ const lessons = loadJson('lessons-learned.json');
88
+ const patterns = loadJson('patterns.json');
89
+
90
+ return {
91
+ errors: {
92
+ total: errors?.errors?.length || 0,
93
+ byType: patterns?.errors?.byType || {},
94
+ bySeverity: patterns?.errors?.bySeverity || {}
95
+ },
96
+ corrections: {
97
+ total: corrections?.corrections?.length || 0,
98
+ byCategory: patterns?.corrections?.byCategory || {}
99
+ },
100
+ lessons: lessons?.lessons?.length || 0,
101
+ highFrequency: patterns?.highFrequency || [],
102
+ lastUpdated: patterns?.analyzedAt || null
103
+ };
104
+ }
105
+ };
106
+
107
+ // MIME types
108
+ const mimeTypes = {
109
+ '.html': 'text/html',
110
+ '.css': 'text/css',
111
+ '.js': 'application/javascript',
112
+ '.json': 'application/json',
113
+ '.png': 'image/png',
114
+ '.jpg': 'image/jpeg',
115
+ '.svg': 'image/svg+xml'
116
+ };
117
+
118
+ // Create server
119
+ function createServer(port) {
120
+ const server = http.createServer((req, res) => {
121
+ const url = req.url.split('?')[0];
122
+
123
+ // CORS headers for local development
124
+ res.setHeader('Access-Control-Allow-Origin', '*');
125
+ res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
126
+ res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
127
+
128
+ // Handle API requests
129
+ if (url.startsWith('/api/')) {
130
+ const handler = api[url];
131
+ if (handler) {
132
+ res.setHeader('Content-Type', 'application/json');
133
+ res.writeHead(200);
134
+ res.end(JSON.stringify(handler()));
135
+ } else {
136
+ res.writeHead(404);
137
+ res.end(JSON.stringify({ error: 'Not found' }));
138
+ }
139
+ return;
140
+ }
141
+
142
+ // Serve static files
143
+ let filePath = url === '/' ? '/index.html' : url;
144
+ filePath = path.join(dashboardPath, filePath);
145
+
146
+ if (fs.existsSync(filePath)) {
147
+ const ext = path.extname(filePath);
148
+ const mimeType = mimeTypes[ext] || 'text/plain';
149
+
150
+ res.setHeader('Content-Type', mimeType);
151
+ res.writeHead(200);
152
+ res.end(fs.readFileSync(filePath));
153
+ } else {
154
+ res.writeHead(404);
155
+ res.end('Not found');
156
+ }
157
+ });
158
+
159
+ return server;
160
+ }
161
+
162
+ function startServer(port = 3030) {
163
+ const server = createServer(port);
164
+
165
+ server.listen(port, () => {
166
+ console.log(`${c.cyan}╔════════════════════════════════════════╗${c.reset}`);
167
+ console.log(`${c.cyan}║${c.reset} 🧠 Auto-Learn Dashboard Server ${c.cyan}║${c.reset}`);
168
+ console.log(`${c.cyan}╚════════════════════════════════════════╝${c.reset}\n`);
169
+ console.log(`${c.green}✓ Server running at:${c.reset}`);
170
+ console.log(` ${c.bold}http://localhost:${port}${c.reset}\n`);
171
+ console.log(`${c.gray}API Endpoints:${c.reset}`);
172
+ console.log(` GET /api/errors - Detected errors`);
173
+ console.log(` GET /api/corrections - User corrections`);
174
+ console.log(` GET /api/lessons - Lessons learned`);
175
+ console.log(` GET /api/patterns - Pattern analysis`);
176
+ console.log(` GET /api/summary - Dashboard summary\n`);
177
+ console.log(`${c.yellow}Press Ctrl+C to stop${c.reset}`);
178
+ });
179
+
180
+ server.on('error', (err) => {
181
+ if (err.code === 'EADDRINUSE') {
182
+ console.log(`${c.red}Error: Port ${port} is already in use${c.reset}`);
183
+ console.log(`${c.gray}Try: node dashboard_server.js --port ${port + 1}${c.reset}`);
184
+ } else {
185
+ console.error(`${c.red}Server error:${c.reset}`, err);
186
+ }
187
+ process.exit(1);
188
+ });
189
+
190
+ return server;
191
+ }
192
+
193
+ // Parse CLI args
194
+ const args = process.argv.slice(2);
195
+
196
+ if (args.includes('--start') || args.includes('-s') || args.length === 0 || args.includes('--port') || args.includes('-p')) {
197
+ let port = 3030;
198
+ const portIdx = args.findIndex(a => a === '--port' || a === '-p');
199
+ if (portIdx >= 0 && args[portIdx + 1]) {
200
+ port = parseInt(args[portIdx + 1], 10);
201
+ }
202
+ startServer(port);
203
+ } else if (args.includes('--help') || args.includes('-h')) {
204
+ console.log(`${c.cyan}dashboard_server - Auto-Learn Dashboard Web Server${c.reset}
205
+
206
+ ${c.bold}Usage:${c.reset}
207
+ node dashboard_server.js Start server (default port 3030)
208
+ node dashboard_server.js --port 8080 Start on custom port
209
+ node dashboard_server.js --help Show this help
210
+
211
+ ${c.bold}API Endpoints:${c.reset}
212
+ GET /api/errors - All detected errors
213
+ GET /api/corrections - All user corrections
214
+ GET /api/lessons - All lessons learned
215
+ GET /api/patterns - Pattern analysis results
216
+ GET /api/summary - Dashboard summary data
217
+
218
+ ${c.bold}Example:${c.reset}
219
+ node dashboard_server.js --port 3030
220
+ # Open http://localhost:3030 in browser
221
+ `);
222
+ }
223
+
224
+ export { createServer, startServer };