@theihtisham/agent-shadow-brain 1.1.0 → 1.2.0

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 (62) hide show
  1. package/README.md +73 -237
  2. package/dist/brain/auto-update.d.ts +9 -0
  3. package/dist/brain/auto-update.d.ts.map +1 -0
  4. package/dist/brain/auto-update.js +59 -0
  5. package/dist/brain/auto-update.js.map +1 -0
  6. package/dist/brain/code-metrics.d.ts +18 -0
  7. package/dist/brain/code-metrics.d.ts.map +1 -0
  8. package/dist/brain/code-metrics.js +224 -0
  9. package/dist/brain/code-metrics.js.map +1 -0
  10. package/dist/brain/custom-rules.d.ts +14 -0
  11. package/dist/brain/custom-rules.d.ts.map +1 -0
  12. package/dist/brain/custom-rules.js +108 -0
  13. package/dist/brain/custom-rules.js.map +1 -0
  14. package/dist/brain/framework-presets.d.ts +34 -0
  15. package/dist/brain/framework-presets.d.ts.map +1 -0
  16. package/dist/brain/framework-presets.js +556 -0
  17. package/dist/brain/framework-presets.js.map +1 -0
  18. package/dist/brain/health-score.d.ts +42 -0
  19. package/dist/brain/health-score.d.ts.map +1 -0
  20. package/dist/brain/health-score.js +257 -0
  21. package/dist/brain/health-score.js.map +1 -0
  22. package/dist/brain/notifier.d.ts +26 -0
  23. package/dist/brain/notifier.d.ts.map +1 -0
  24. package/dist/brain/notifier.js +151 -0
  25. package/dist/brain/notifier.js.map +1 -0
  26. package/dist/brain/orchestrator.d.ts +64 -1
  27. package/dist/brain/orchestrator.d.ts.map +1 -1
  28. package/dist/brain/orchestrator.js +239 -3
  29. package/dist/brain/orchestrator.js.map +1 -1
  30. package/dist/brain/pr-generator.d.ts +19 -0
  31. package/dist/brain/pr-generator.d.ts.map +1 -0
  32. package/dist/brain/pr-generator.js +199 -0
  33. package/dist/brain/pr-generator.js.map +1 -0
  34. package/dist/brain/project-config.d.ts +14 -0
  35. package/dist/brain/project-config.d.ts.map +1 -0
  36. package/dist/brain/project-config.js +121 -0
  37. package/dist/brain/project-config.js.map +1 -0
  38. package/dist/brain/report-generator.d.ts +20 -0
  39. package/dist/brain/report-generator.d.ts.map +1 -0
  40. package/dist/brain/report-generator.js +386 -0
  41. package/dist/brain/report-generator.js.map +1 -0
  42. package/dist/brain/smart-fix.d.ts +24 -0
  43. package/dist/brain/smart-fix.d.ts.map +1 -0
  44. package/dist/brain/smart-fix.js +276 -0
  45. package/dist/brain/smart-fix.js.map +1 -0
  46. package/dist/brain/vuln-scanner.d.ts +16 -0
  47. package/dist/brain/vuln-scanner.d.ts.map +1 -0
  48. package/dist/brain/vuln-scanner.js +279 -0
  49. package/dist/brain/vuln-scanner.js.map +1 -0
  50. package/dist/cli.js +560 -57
  51. package/dist/cli.js.map +1 -1
  52. package/dist/dashboard/server.d.ts +22 -0
  53. package/dist/dashboard/server.d.ts.map +1 -0
  54. package/dist/dashboard/server.js +502 -0
  55. package/dist/dashboard/server.js.map +1 -0
  56. package/dist/index.d.ts +19 -1
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.js +19 -1
  59. package/dist/index.js.map +1 -1
  60. package/dist/types.d.ts +92 -0
  61. package/dist/types.d.ts.map +1 -1
  62. package/package.json +88 -77
@@ -0,0 +1,502 @@
1
+ // src/dashboard/server.ts — Real-time Web Dashboard with WebSocket
2
+ // Serves an embedded HTML UI + pushes live events from Orchestrator
3
+ import * as http from 'http';
4
+ import { WebSocketServer, WebSocket } from 'ws';
5
+ // ── Embedded HTML Client ──────────────────────────────────────────────────────
6
+ const HTML_CLIENT = `<!DOCTYPE html>
7
+ <html lang="en">
8
+ <head>
9
+ <meta charset="UTF-8">
10
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
11
+ <title>🧠 Shadow Brain Dashboard</title>
12
+ <style>
13
+ :root {
14
+ --bg: #0d1117; --bg2: #161b22; --bg3: #21262d;
15
+ --border: #30363d; --text: #e6edf3; --text2: #8b949e;
16
+ --green: #3fb950; --yellow: #d29922; --red: #f85149;
17
+ --blue: #58a6ff; --purple: #bc8cff; --orange: #ffa657;
18
+ --cyan: #39d353;
19
+ }
20
+ * { box-sizing: border-box; margin: 0; padding: 0; }
21
+ body { background: var(--bg); color: var(--text); font-family: 'Segoe UI', system-ui, monospace; font-size: 14px; height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
22
+ header { background: var(--bg2); border-bottom: 1px solid var(--border); padding: 12px 20px; display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
23
+ header h1 { font-size: 18px; font-weight: 700; letter-spacing: -0.5px; }
24
+ header h1 span { color: var(--blue); }
25
+ .status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); transition: background .3s; }
26
+ .status-dot.connected { background: var(--green); animation: pulse 2s infinite; }
27
+ @keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }
28
+ .badge { background: var(--bg3); border: 1px solid var(--border); border-radius: 12px; padding: 2px 10px; font-size: 12px; color: var(--text2); }
29
+ .badge.score { color: var(--green); border-color: var(--green); }
30
+ .badge.grade { font-weight: 700; }
31
+ .badge.grade.A { color: var(--green); border-color: var(--green); }
32
+ .badge.grade.B { color: var(--yellow); border-color: var(--yellow); }
33
+ .badge.grade.C { color: var(--orange); border-color: var(--orange); }
34
+ .badge.grade.D,.badge.grade.F { color: var(--red); border-color: var(--red); }
35
+ .trend { font-size: 16px; }
36
+ .trend.improving { color: var(--green); }
37
+ .trend.declining { color: var(--red); }
38
+ .trend.stable { color: var(--text2); }
39
+ .layout { display: grid; grid-template-columns: 340px 1fr; grid-template-rows: 1fr 1fr; gap: 1px; background: var(--border); flex: 1; overflow: hidden; }
40
+ .panel { background: var(--bg); overflow: hidden; display: flex; flex-direction: column; }
41
+ .panel-header { background: var(--bg2); padding: 8px 14px; font-size: 12px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: .08em; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
42
+ .panel-body { flex: 1; overflow-y: auto; padding: 10px; }
43
+ .panel-body::-webkit-scrollbar { width: 4px; } .panel-body::-webkit-scrollbar-thumb { background: var(--border); }
44
+ /* Health panel */
45
+ .health-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
46
+ .health-big { grid-column: 1/-1; text-align: center; padding: 16px; background: var(--bg2); border-radius: 8px; border: 1px solid var(--border); }
47
+ .health-big .num { font-size: 56px; font-weight: 900; line-height: 1; }
48
+ .health-big .label { font-size: 12px; color: var(--text2); margin-top: 4px; }
49
+ .dim { background: var(--bg2); border: 1px solid var(--border); border-radius: 6px; padding: 10px; }
50
+ .dim .name { font-size: 11px; color: var(--text2); margin-bottom: 6px; }
51
+ .dim .bar-wrap { background: var(--bg3); border-radius: 3px; height: 6px; overflow: hidden; margin-bottom: 4px; }
52
+ .dim .bar-fill { height: 100%; border-radius: 3px; transition: width .6s ease; }
53
+ .dim .score-val { font-size: 13px; font-weight: 700; }
54
+ /* Insights */
55
+ .insight { background: var(--bg2); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; margin-bottom: 8px; border-left: 3px solid var(--border); animation: fadeIn .3s ease; }
56
+ @keyframes fadeIn { from{opacity:0;transform:translateY(-4px)} to{opacity:1;transform:none} }
57
+ .insight.critical { border-left-color: var(--red); }
58
+ .insight.high { border-left-color: var(--orange); }
59
+ .insight.medium { border-left-color: var(--yellow); }
60
+ .insight.low { border-left-color: var(--text2); }
61
+ .insight-title { font-weight: 600; font-size: 13px; margin-bottom: 3px; }
62
+ .insight-meta { font-size: 11px; color: var(--text2); display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 5px; }
63
+ .insight-content { font-size: 12px; color: var(--text2); line-height: 1.5; }
64
+ .tag { background: var(--bg3); border-radius: 10px; padding: 1px 7px; font-size: 10px; }
65
+ .tag.critical { background: rgba(248,81,73,.15); color: var(--red); }
66
+ .tag.high { background: rgba(255,166,87,.15); color: var(--orange); }
67
+ .tag.medium { background: rgba(210,153,34,.15); color: var(--yellow); }
68
+ .tag.security { background: rgba(248,81,73,.12); color: var(--red); }
69
+ .tag.performance { background: rgba(57,211,83,.12); color: var(--cyan); }
70
+ .tag.quality { background: rgba(88,166,255,.12); color: var(--blue); }
71
+ /* Fixes */
72
+ .fix { background: var(--bg2); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; margin-bottom: 8px; animation: fadeIn .3s ease; }
73
+ .fix-title { font-weight: 600; font-size: 13px; margin-bottom: 6px; }
74
+ .fix-file { font-size: 11px; color: var(--text2); margin-bottom: 8px; }
75
+ .code-block { background: var(--bg3); border: 1px solid var(--border); border-radius: 4px; padding: 8px 10px; font-family: 'Cascadia Code', 'Fira Code', monospace; font-size: 11px; line-height: 1.6; overflow-x: auto; }
76
+ .code-before { border-left: 3px solid var(--red); }
77
+ .code-after { border-left: 3px solid var(--green); }
78
+ .fix-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 4px; }
79
+ .fix-label.before { color: var(--red); }
80
+ .fix-label.after { color: var(--green); }
81
+ .fix-explanation { font-size: 11px; color: var(--text2); margin-top: 8px; line-height: 1.5; }
82
+ /* Log */
83
+ .log-entry { font-family: monospace; font-size: 12px; padding: 3px 0; border-bottom: 1px solid var(--bg2); display: flex; gap: 10px; }
84
+ .log-time { color: var(--text2); flex-shrink: 0; }
85
+ .log-msg { flex: 1; word-break: break-all; }
86
+ .log-msg.info { color: var(--blue); }
87
+ .log-msg.success { color: var(--green); }
88
+ .log-msg.warning { color: var(--yellow); }
89
+ .log-msg.error { color: var(--red); }
90
+ /* Empty state */
91
+ .empty { text-align: center; color: var(--text2); padding: 40px 20px; font-size: 13px; }
92
+ .empty .icon { font-size: 32px; margin-bottom: 10px; }
93
+ .spinner { display: inline-block; animation: spin 1s linear infinite; }
94
+ @keyframes spin { to { transform: rotate(360deg); } }
95
+ .panel-count { background: var(--bg3); border-radius: 10px; padding: 1px 7px; font-size: 11px; color: var(--text2); }
96
+ </style>
97
+ </head>
98
+ <body>
99
+ <header>
100
+ <div class="status-dot" id="statusDot"></div>
101
+ <h1>🧠 <span>Shadow</span>Brain</h1>
102
+ <span class="badge" id="badgeScore">—/100</span>
103
+ <span class="badge grade" id="badgeGrade">—</span>
104
+ <span class="trend" id="badgeTrend" title="Trend">→</span>
105
+ <span class="badge" id="badgeAgents">No agents</span>
106
+ <span style="flex:1"></span>
107
+ <span class="badge" id="badgeProject" style="font-size:11px;max-width:300px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">Connecting…</span>
108
+ </header>
109
+
110
+ <div class="layout">
111
+ <!-- Top-left: Health Score -->
112
+ <div class="panel" style="grid-row: 1">
113
+ <div class="panel-header">⬟ Health Score</div>
114
+ <div class="panel-body" id="healthPanel">
115
+ <div class="empty"><div class="icon"><span class="spinner">⟳</span></div>Waiting for analysis…</div>
116
+ </div>
117
+ </div>
118
+
119
+ <!-- Top-right: Insights stream -->
120
+ <div class="panel" style="grid-row: 1">
121
+ <div class="panel-header">
122
+ 💡 Live Insights
123
+ <span class="panel-count" id="insightCount">0</span>
124
+ </div>
125
+ <div class="panel-body" id="insightsPanel">
126
+ <div class="empty"><div class="icon">💡</div>Insights will appear here…</div>
127
+ </div>
128
+ </div>
129
+
130
+ <!-- Bottom-left: Smart Fixes -->
131
+ <div class="panel" style="grid-row: 2">
132
+ <div class="panel-header">
133
+ 🔧 Smart Fixes
134
+ <span class="panel-count" id="fixCount">0</span>
135
+ </div>
136
+ <div class="panel-body" id="fixesPanel">
137
+ <div class="empty"><div class="icon">🔧</div>Fix suggestions will appear here…</div>
138
+ </div>
139
+ </div>
140
+
141
+ <!-- Bottom-right: Activity Log -->
142
+ <div class="panel" style="grid-row: 2">
143
+ <div class="panel-header">📋 Activity Log</div>
144
+ <div class="panel-body" id="logPanel"></div>
145
+ </div>
146
+ </div>
147
+
148
+ <script>
149
+ const MAX_INSIGHTS = 50;
150
+ const MAX_LOG = 100;
151
+ let insightCount = 0;
152
+ let fixCount = 0;
153
+ let allInsights = [];
154
+
155
+ const statusDot = document.getElementById('statusDot');
156
+ const badgeScore = document.getElementById('badgeScore');
157
+ const badgeGrade = document.getElementById('badgeGrade');
158
+ const badgeTrend = document.getElementById('badgeTrend');
159
+ const badgeAgents = document.getElementById('badgeAgents');
160
+ const badgeProject = document.getElementById('badgeProject');
161
+ const healthPanel = document.getElementById('healthPanel');
162
+ const insightsPanel = document.getElementById('insightsPanel');
163
+ const fixesPanel = document.getElementById('fixesPanel');
164
+ const logPanel = document.getElementById('logPanel');
165
+ const insightCountEl = document.getElementById('insightCount');
166
+ const fixCountEl = document.getElementById('fixCount');
167
+
168
+ function ts() {
169
+ return new Date().toLocaleTimeString('en-US', { hour12: false });
170
+ }
171
+
172
+ function log(msg, type = 'info') {
173
+ const el = document.createElement('div');
174
+ el.className = 'log-entry';
175
+ el.innerHTML = \`<span class="log-time">\${ts()}</span><span class="log-msg \${type}">\${escapeHtml(msg)}</span>\`;
176
+ if (logPanel.children.length >= MAX_LOG) logPanel.removeChild(logPanel.lastChild);
177
+ logPanel.insertBefore(el, logPanel.firstChild);
178
+ }
179
+
180
+ function escapeHtml(s) {
181
+ return String(s).replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;');
182
+ }
183
+
184
+ function scoreColor(v) {
185
+ if (v >= 85) return '#3fb950';
186
+ if (v >= 70) return '#d29922';
187
+ if (v >= 50) return '#ffa657';
188
+ return '#f85149';
189
+ }
190
+
191
+ function renderHealth(score) {
192
+ if (!score) return;
193
+ const col = scoreColor(score.overall);
194
+ const trendIcon = score.trend === 'improving' ? '↑' : score.trend === 'declining' ? '↓' : '→';
195
+ badgeScore.textContent = score.overall + '/100';
196
+ badgeScore.style.color = col;
197
+ badgeScore.style.borderColor = col;
198
+ badgeGrade.textContent = score.grade;
199
+ const gradeClass = score.grade.replace('+','').charAt(0);
200
+ badgeGrade.className = \`badge grade \${gradeClass}\`;
201
+ badgeTrend.textContent = trendIcon;
202
+ badgeTrend.className = \`trend \${score.trend}\`;
203
+
204
+ const dimsHtml = score.dimensions.map(d => {
205
+ const c = scoreColor(d.score);
206
+ const det = d.details.map(x => \`<div style="font-size:10px;color:var(--text2);margin-top:2px">• \${escapeHtml(x)}</div>\`).join('');
207
+ return \`<div class="dim">
208
+ <div class="name">\${escapeHtml(d.name)}</div>
209
+ <div class="bar-wrap"><div class="bar-fill" style="width:\${d.score}%;background:\${c}"></div></div>
210
+ <div class="score-val" style="color:\${c}">\${d.score}%</div>
211
+ \${det}
212
+ </div>\`;
213
+ }).join('');
214
+
215
+ const topIssues = score.topIssues.length > 0
216
+ ? \`<div style="margin-top:10px;padding:8px;background:var(--bg2);border-radius:6px;border:1px solid var(--border)">
217
+ <div style="font-size:11px;color:var(--red);font-weight:700;margin-bottom:6px">🔥 Top Issues</div>
218
+ \${score.topIssues.map(i => \`<div style="font-size:11px;color:var(--text2);margin-bottom:3px">• \${escapeHtml(i)}</div>\`).join('')}
219
+ </div>\`
220
+ : '';
221
+
222
+ healthPanel.innerHTML = \`
223
+ <div class="health-big">
224
+ <div class="num" style="color:\${col}">\${score.overall}</div>
225
+ <div class="label">Health Score / 100 — Grade \${score.grade} \${trendIcon}</div>
226
+ </div>
227
+ <div class="health-grid">\${dimsHtml}</div>
228
+ \${topIssues}
229
+ \`;
230
+ }
231
+
232
+ function priorityTag(p) {
233
+ return \`<span class="tag \${p}">\${p.toUpperCase()}</span>\`;
234
+ }
235
+
236
+ function typeTag(t) {
237
+ const colors = { warning: '#f85149', suggestion: '#58a6ff', review: '#bc8cff', insight: '#39d353' };
238
+ return \`<span class="tag" style="color:\${colors[t]||'#8b949e'}">\${t}</span>\`;
239
+ }
240
+
241
+ function renderInsight(insight) {
242
+ const files = (insight.files || []).map(f => \`<code style="font-size:10px;background:var(--bg3);padding:1px 5px;border-radius:3px">\${escapeHtml(f)}</code>\`).join(' ');
243
+ return \`<div class="insight \${insight.priority}">
244
+ <div class="insight-title">\${escapeHtml(insight.title)}</div>
245
+ <div class="insight-meta">
246
+ \${priorityTag(insight.priority)}
247
+ \${typeTag(insight.type)}
248
+ \${files}
249
+ </div>
250
+ <div class="insight-content">\${escapeHtml(insight.content)}</div>
251
+ </div>\`;
252
+ }
253
+
254
+ function addInsights(insights) {
255
+ if (!insights || insights.length === 0) return;
256
+ if (insightsPanel.querySelector('.empty')) insightsPanel.innerHTML = '';
257
+ allInsights = [...insights, ...allInsights].slice(0, MAX_INSIGHTS);
258
+ insightsPanel.innerHTML = allInsights.map(renderInsight).join('');
259
+ insightCount += insights.length;
260
+ insightCountEl.textContent = insightCount;
261
+ log(\`\${insights.length} new insight(s) received\`, 'success');
262
+ }
263
+
264
+ function catTag(c) {
265
+ return \`<span class="tag \${c}">\${c.toUpperCase()}</span>\`;
266
+ }
267
+
268
+ function renderFix(fix) {
269
+ return \`<div class="fix">
270
+ <div class="fix-title">\${escapeHtml(fix.issue)}</div>
271
+ <div class="fix-file">📄 \${escapeHtml(fix.file)} &nbsp; \${catTag(fix.category)} &nbsp; <span class="tag">\${fix.confidence} confidence</span></div>
272
+ <div class="fix-label before">Before</div>
273
+ <pre class="code-block code-before">\${escapeHtml(fix.before)}</pre>
274
+ <div class="fix-label after" style="margin-top:8px">After</div>
275
+ <pre class="code-block code-after">\${escapeHtml(fix.after)}</pre>
276
+ <div class="fix-explanation">💡 \${escapeHtml(fix.explanation)}</div>
277
+ </div>\`;
278
+ }
279
+
280
+ function renderFixes(fixes) {
281
+ if (!fixes || fixes.length === 0) return;
282
+ if (fixesPanel.querySelector('.empty')) fixesPanel.innerHTML = '';
283
+ fixesPanel.innerHTML = fixes.map(renderFix).join('');
284
+ fixCount = fixes.length;
285
+ fixCountEl.textContent = fixCount;
286
+ log(\`\${fixes.length} smart fix suggestion(s) available\`, 'info');
287
+ }
288
+
289
+ function connect() {
290
+ const proto = location.protocol === 'https:' ? 'wss:' : 'ws:';
291
+ const ws = new WebSocket(\`\${proto}//\${location.host}\`);
292
+
293
+ ws.onopen = () => {
294
+ statusDot.classList.add('connected');
295
+ log('Connected to Shadow Brain', 'success');
296
+ };
297
+
298
+ ws.onclose = () => {
299
+ statusDot.classList.remove('connected');
300
+ log('Disconnected — reconnecting in 3s…', 'warning');
301
+ setTimeout(connect, 3000);
302
+ };
303
+
304
+ ws.onerror = () => {
305
+ log('WebSocket error', 'error');
306
+ };
307
+
308
+ ws.onmessage = (ev) => {
309
+ let msg;
310
+ try { msg = JSON.parse(ev.data); } catch { return; }
311
+
312
+ switch (msg.type) {
313
+ case 'init':
314
+ badgeProject.textContent = msg.projectDir || '';
315
+ if (msg.agents && msg.agents.length > 0) {
316
+ badgeAgents.textContent = msg.agents.join(', ');
317
+ }
318
+ log(\`Project: \${msg.projectDir}\`, 'info');
319
+ break;
320
+ case 'agents-detected':
321
+ if (msg.agents && msg.agents.length > 0) {
322
+ badgeAgents.textContent = msg.agents.join(', ');
323
+ log(\`Agents: \${msg.agents.join(', ')}\`, 'info');
324
+ }
325
+ break;
326
+ case 'analysis-start':
327
+ log(\`Analysis started — \${msg.changeCount} change(s)\`, 'info');
328
+ break;
329
+ case 'insights':
330
+ addInsights(msg.insights);
331
+ break;
332
+ case 'health-score':
333
+ renderHealth(msg.score);
334
+ break;
335
+ case 'fixes':
336
+ renderFixes(msg.fixes);
337
+ break;
338
+ case 'injection':
339
+ if (msg.success) log(\`Injected → \${msg.adapter}: \${msg.insightTitle}\`, 'success');
340
+ break;
341
+ case 'info':
342
+ log(msg.message, 'info');
343
+ break;
344
+ case 'error':
345
+ log(\`Error: \${msg.error}\`, 'error');
346
+ break;
347
+ }
348
+ };
349
+ }
350
+
351
+ connect();
352
+ </script>
353
+ </body>
354
+ </html>`;
355
+ // ── Dashboard Server ──────────────────────────────────────────────────────────
356
+ export class DashboardServer {
357
+ constructor(orchestrator, options = {}) {
358
+ this.clients = new Set();
359
+ this.orchestrator = orchestrator;
360
+ this.options = {
361
+ port: options.port ?? 7341,
362
+ host: options.host ?? 'localhost',
363
+ openBrowser: options.openBrowser ?? false,
364
+ };
365
+ // HTTP server — serves the embedded HTML client
366
+ this.server = http.createServer((req, res) => {
367
+ if (req.url === '/' || req.url === '/index.html') {
368
+ res.writeHead(200, {
369
+ 'Content-Type': 'text/html; charset=utf-8',
370
+ 'Cache-Control': 'no-cache',
371
+ });
372
+ res.end(HTML_CLIENT);
373
+ }
374
+ else if (req.url === '/api/status') {
375
+ res.writeHead(200, { 'Content-Type': 'application/json' });
376
+ res.end(JSON.stringify(this.orchestrator.getStatus(), null, 2));
377
+ }
378
+ else if (req.url === '/api/health') {
379
+ const h = this.orchestrator.getLastHealthScore();
380
+ res.writeHead(200, { 'Content-Type': 'application/json' });
381
+ res.end(JSON.stringify(h, null, 2));
382
+ }
383
+ else if (req.url === '/api/fixes') {
384
+ res.writeHead(200, { 'Content-Type': 'application/json' });
385
+ res.end(JSON.stringify(this.orchestrator.getLastFixes(), null, 2));
386
+ }
387
+ else {
388
+ res.writeHead(404);
389
+ res.end('Not found');
390
+ }
391
+ });
392
+ // WebSocket server on the same HTTP server
393
+ this.wss = new WebSocketServer({ server: this.server });
394
+ this.setupWebSocket();
395
+ this.subscribeToOrchestrator();
396
+ }
397
+ setupWebSocket() {
398
+ this.wss.on('connection', (ws) => {
399
+ this.clients.add(ws);
400
+ // Send init state immediately
401
+ const status = this.orchestrator.getStatus();
402
+ this.send(ws, {
403
+ type: 'init',
404
+ projectDir: status.projectDir,
405
+ agents: status.agents,
406
+ personality: status.personality,
407
+ provider: status.provider,
408
+ model: status.model,
409
+ });
410
+ // Send cached health score if available
411
+ const health = this.orchestrator.getLastHealthScore();
412
+ if (health) {
413
+ this.send(ws, { type: 'health-score', score: health });
414
+ }
415
+ // Send cached fixes if available
416
+ const fixes = this.orchestrator.getLastFixes();
417
+ if (fixes.length > 0) {
418
+ this.send(ws, { type: 'fixes', fixes });
419
+ }
420
+ ws.on('close', () => {
421
+ this.clients.delete(ws);
422
+ });
423
+ ws.on('error', () => {
424
+ this.clients.delete(ws);
425
+ });
426
+ });
427
+ }
428
+ subscribeToOrchestrator() {
429
+ this.orchestrator.on('agents-detected', ({ adapters }) => {
430
+ this.broadcast({
431
+ type: 'agents-detected',
432
+ agents: adapters.map((a) => `${a.displayName} (${a.name})`),
433
+ });
434
+ });
435
+ this.orchestrator.on('analysis-start', ({ changeCount }) => {
436
+ this.broadcast({ type: 'analysis-start', changeCount });
437
+ });
438
+ this.orchestrator.on('insights', ({ insights }) => {
439
+ this.broadcast({ type: 'insights', insights });
440
+ });
441
+ this.orchestrator.on('health-score', ({ score }) => {
442
+ this.broadcast({ type: 'health-score', score });
443
+ });
444
+ this.orchestrator.on('fixes', ({ fixes }) => {
445
+ this.broadcast({ type: 'fixes', fixes });
446
+ });
447
+ this.orchestrator.on('injection', ({ adapter, insight, success }) => {
448
+ this.broadcast({
449
+ type: 'injection',
450
+ adapter,
451
+ insightTitle: insight?.title || '',
452
+ success,
453
+ });
454
+ });
455
+ this.orchestrator.on('info', (message) => {
456
+ this.broadcast({ type: 'info', message });
457
+ });
458
+ this.orchestrator.on('error', ({ error }) => {
459
+ this.broadcast({ type: 'error', error: String(error?.message || error) });
460
+ });
461
+ }
462
+ send(ws, data) {
463
+ if (ws.readyState === WebSocket.OPEN) {
464
+ ws.send(JSON.stringify(data));
465
+ }
466
+ }
467
+ broadcast(data) {
468
+ const msg = JSON.stringify(data);
469
+ for (const client of this.clients) {
470
+ if (client.readyState === WebSocket.OPEN) {
471
+ client.send(msg);
472
+ }
473
+ }
474
+ }
475
+ async start() {
476
+ return new Promise((resolve, reject) => {
477
+ this.server.on('error', reject);
478
+ this.server.listen(this.options.port, this.options.host, () => {
479
+ const url = `http://${this.options.host}:${this.options.port}`;
480
+ resolve(url);
481
+ });
482
+ });
483
+ }
484
+ async stop() {
485
+ return new Promise((resolve) => {
486
+ for (const client of this.clients) {
487
+ try {
488
+ client.close();
489
+ }
490
+ catch { /* ignore */ }
491
+ }
492
+ this.clients.clear();
493
+ this.wss.close(() => {
494
+ this.server.close(() => resolve());
495
+ });
496
+ });
497
+ }
498
+ get port() {
499
+ return this.options.port;
500
+ }
501
+ }
502
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/dashboard/server.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,oEAAoE;AAEpE,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAG7B,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAYhD,iFAAiF;AACjF,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA4VZ,CAAC;AAET,iFAAiF;AACjF,MAAM,OAAO,eAAe;IAO1B,YAAY,YAA0B,EAAE,UAA4B,EAAE;QAJ9D,YAAO,GAAmB,IAAI,GAAG,EAAE,CAAC;QAK1C,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,OAAO,GAAG;YACb,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,IAAI;YAC1B,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,WAAW;YACjC,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,KAAK;SAC1C,CAAC;QAEF,gDAAgD;QAChD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;YAC3C,IAAI,GAAG,CAAC,GAAG,KAA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AAC,CAAC,CAAC;IACL,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IAC3B,CAAC;CACF"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type { AgentTool, AgentAdapter, AgentPaths, AgentMemory, AgentActivity, BrainInsight, BrainConfig, LLMProvider, BrainPersonality, FileChange, ProjectContext, BrainSession, } from './types.js';
1
+ export type { AgentTool, AgentAdapter, AgentPaths, AgentMemory, AgentActivity, BrainInsight, BrainConfig, LLMProvider, BrainPersonality, FileChange, ProjectContext, BrainSession, CustomRule, ProjectConfig, CodeMetrics, PRDescription, CommitMessage, VulnResult, NotificationPayload, ProjectFileChange, } from './types.js';
2
2
  export { createAdapter, detectRunningAgents } from './adapters/index.js';
3
3
  export { ClaudeCodeAdapter } from './adapters/claude-code.js';
4
4
  export { KiloCodeAdapter } from './adapters/kilo-code.js';
@@ -11,6 +11,24 @@ export { Analyzer, PromptBuilder } from './brain/analyzer.js';
11
11
  export { ProjectContextBuilder } from './brain/project-context.js';
12
12
  export { PatternMemory } from './brain/pattern-memory.js';
13
13
  export { Orchestrator } from './brain/orchestrator.js';
14
+ export { HealthScoreEngine } from './brain/health-score.js';
15
+ export type { HealthScore, HealthDimension, HealthHistory } from './brain/health-score.js';
16
+ export { SmartFixEngine } from './brain/smart-fix.js';
17
+ export type { FixSuggestion } from './brain/smart-fix.js';
18
+ export { ReportGenerator } from './brain/report-generator.js';
19
+ export type { ReportOptions } from './brain/report-generator.js';
20
+ export { detectFramework, applyFrameworkRules } from './brain/framework-presets.js';
21
+ export { CustomRulesEngine } from './brain/custom-rules.js';
22
+ export { PRGenerator } from './brain/pr-generator.js';
23
+ export { Notifier } from './brain/notifier.js';
24
+ export type { NotifyConfig } from './brain/notifier.js';
25
+ export { CodeMetricsEngine } from './brain/code-metrics.js';
26
+ export { ProjectConfigLoader } from './brain/project-config.js';
27
+ export { VulnScanner } from './brain/vuln-scanner.js';
28
+ export { checkForUpdate, formatUpdateNotice } from './brain/auto-update.js';
29
+ export type { UpdateCheck } from './brain/auto-update.js';
30
+ export { DashboardServer } from './dashboard/server.js';
31
+ export type { DashboardOptions } from './dashboard/server.js';
14
32
  export { FileWatcher } from './watchers/file-watcher.js';
15
33
  export { GitWatcher } from './watchers/git-watcher.js';
16
34
  export type { GitState, GitCommit } from './watchers/git-watcher.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,YAAY,EACV,SAAS,EACT,YAAY,EACZ,UAAU,EACV,WAAW,EACX,aAAa,EACb,YAAY,EACZ,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,YAAY,GACb,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAGzD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGvD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,UAAU,E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cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,YAAY,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,YAAY,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAGjE,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAGpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,YAAY,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAG1D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,YAAY,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAG9D,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC"}
package/dist/index.js CHANGED
@@ -7,12 +7,30 @@ export { ClineAdapter } from './adapters/cline.js';
7
7
  export { OpenCodeAdapter } from './adapters/opencode.js';
8
8
  export { CodexAdapter } from './adapters/codex.js';
9
9
  export { BaseAdapter } from './adapters/base-adapter.js';
10
- // Brain
10
+ // Brain — Core
11
11
  export { LLMClient, LLMError } from './brain/llm-client.js';
12
12
  export { Analyzer, PromptBuilder } from './brain/analyzer.js';
13
13
  export { ProjectContextBuilder } from './brain/project-context.js';
14
14
  export { PatternMemory } from './brain/pattern-memory.js';
15
15
  export { Orchestrator } from './brain/orchestrator.js';
16
+ // Brain — Health Score
17
+ export { HealthScoreEngine } from './brain/health-score.js';
18
+ // Brain — Smart Fix Engine
19
+ export { SmartFixEngine } from './brain/smart-fix.js';
20
+ // Brain — Report Generator
21
+ export { ReportGenerator } from './brain/report-generator.js';
22
+ // Brain — Framework Presets
23
+ export { detectFramework, applyFrameworkRules } from './brain/framework-presets.js';
24
+ // Brain — v1.2.0 Modules
25
+ export { CustomRulesEngine } from './brain/custom-rules.js';
26
+ export { PRGenerator } from './brain/pr-generator.js';
27
+ export { Notifier } from './brain/notifier.js';
28
+ export { CodeMetricsEngine } from './brain/code-metrics.js';
29
+ export { ProjectConfigLoader } from './brain/project-config.js';
30
+ export { VulnScanner } from './brain/vuln-scanner.js';
31
+ export { checkForUpdate, formatUpdateNotice } from './brain/auto-update.js';
32
+ // Dashboard
33
+ export { DashboardServer } from './dashboard/server.js';
16
34
  // Watchers
17
35
  export { FileWatcher } from './watchers/file-watcher.js';
18
36
  export { GitWatcher } from './watchers/git-watcher.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yEAAyE;AAkBzE,WAAW;AACX,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAA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