-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcapability-matrix.html
More file actions
540 lines (477 loc) · 28.1 KB
/
capability-matrix.html
File metadata and controls
540 lines (477 loc) · 28.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Agent Capability Matrix - AgentBox</title>
<style>
:root {
--bg: #0a0a0f;
--surface: #12121a;
--surface2: #1a1a2e;
--border: #2a2a3e;
--text: #e0e0e8;
--muted: #8888aa;
--accent: #6c5ce7;
--accent2: #a29bfe;
--green: #00b894;
--yellow: #fdcb6e;
--red: #e17055;
--blue: #74b9ff;
--orange: #fab1a0;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }
.header { text-align: center; padding: 2rem 1rem; border-bottom: 1px solid var(--border); }
.header h1 { font-size: 2rem; margin-bottom: 0.5rem; }
.header h1 span { color: var(--accent2); }
.header p { color: var(--muted); max-width: 600px; margin: 0 auto; }
.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }
.tabs { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.tab { padding: 0.6rem 1.2rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; color: var(--muted); transition: all 0.2s; font-size: 0.9rem; }
.tab:hover { border-color: var(--accent); color: var(--text); }
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.panel { display: none; }
.panel.active { display: block; }
/* Matrix Grid */
.matrix-controls { display: flex; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; align-items: center; }
.matrix-controls select, .matrix-controls button {
padding: 0.5rem 1rem; background: var(--surface); border: 1px solid var(--border);
border-radius: 6px; color: var(--text); font-size: 0.85rem; cursor: pointer;
}
.matrix-controls button:hover { border-color: var(--accent); }
.btn-accent { background: var(--accent) !important; border-color: var(--accent) !important; color: #fff !important; }
.btn-accent:hover { opacity: 0.9; }
.matrix-grid { overflow-x: auto; }
.matrix-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.matrix-table th { background: var(--surface2); padding: 0.7rem; text-align: left; border: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; }
.matrix-table td { padding: 0.5rem; border: 1px solid var(--border); text-align: center; cursor: pointer; transition: all 0.15s; }
.matrix-table td:first-child { text-align: left; font-weight: 500; min-width: 180px; cursor: default; }
.matrix-table td.cell-none { background: var(--surface); }
.matrix-table td.cell-low { background: rgba(231,76,60,0.15); color: var(--red); }
.matrix-table td.cell-medium { background: rgba(253,203,110,0.15); color: var(--yellow); }
.matrix-table td.cell-high { background: rgba(0,184,148,0.15); color: var(--green); }
.matrix-table td.cell-full { background: rgba(108,92,231,0.2); color: var(--accent2); }
.matrix-table td:not(:first-child):hover { outline: 2px solid var(--accent); outline-offset: -2px; }
.matrix-table .cap-row { background: var(--surface); }
.level-labels { display: flex; gap: 1rem; margin: 0.75rem 0; font-size: 0.8rem; color: var(--muted); flex-wrap: wrap; }
.level-label { display: flex; align-items: center; gap: 0.3rem; }
.level-dot { width: 12px; height: 12px; border-radius: 3px; }
/* Gap Analysis */
.gap-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1.2rem; margin-bottom: 1rem; }
.gap-card h3 { font-size: 1rem; margin-bottom: 0.75rem; }
.gap-bar-container { margin-bottom: 0.6rem; }
.gap-bar-label { display: flex; justify-content: space-between; font-size: 0.8rem; margin-bottom: 0.3rem; }
.gap-bar-track { height: 8px; background: var(--surface2); border-radius: 4px; overflow: hidden; }
.gap-bar-fill { height: 100%; border-radius: 4px; transition: width 0.5s; }
.score-ring { width: 120px; height: 120px; margin: 0 auto; position: relative; }
.score-ring canvas { width: 120px; height: 120px; }
.score-ring .score-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); text-align: center; }
.score-ring .score-num { font-size: 1.8rem; font-weight: bold; }
.score-ring .score-label { font-size: 0.7rem; color: var(--muted); }
/* Priority */
.priority-list { list-style: none; }
.priority-item { display: flex; gap: 1rem; align-items: center; padding: 0.8rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 0.6rem; }
.priority-rank { font-size: 1.5rem; font-weight: bold; color: var(--accent2); min-width: 40px; text-align: center; }
.priority-info { flex: 1; }
.priority-info h4 { font-size: 0.95rem; margin-bottom: 0.2rem; }
.priority-info p { font-size: 0.8rem; color: var(--muted); }
.priority-score { font-size: 0.85rem; padding: 0.3rem 0.7rem; border-radius: 12px; font-weight: 600; }
.priority-critical { background: rgba(231,76,60,0.2); color: var(--red); }
.priority-high { background: rgba(253,203,110,0.2); color: var(--yellow); }
.priority-medium { background: rgba(0,184,148,0.2); color: var(--green); }
.priority-low { background: rgba(116,185,255,0.2); color: var(--blue); }
/* Recommendations */
.rec-card { background: var(--surface); border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; padding: 1rem 1.2rem; margin-bottom: 0.8rem; }
.rec-card .rec-type { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; color: var(--accent2); margin-bottom: 0.3rem; }
.rec-card h4 { font-size: 0.95rem; margin-bottom: 0.3rem; }
.rec-card p { font-size: 0.8rem; color: var(--muted); line-height: 1.5; }
/* Export */
.export-btns { display: flex; gap: 0.5rem; margin-top: 1rem; flex-wrap: wrap; }
.empty-state { text-align: center; padding: 3rem; color: var(--muted); }
.empty-state p { margin-bottom: 1rem; }
/* Presets */
.preset-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.preset-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1rem; cursor: pointer; transition: all 0.2s; }
.preset-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.preset-card h4 { font-size: 0.95rem; margin-bottom: 0.3rem; }
.preset-card p { font-size: 0.8rem; color: var(--muted); }
.preset-card .preset-tag { display: inline-block; font-size: 0.7rem; padding: 0.15rem 0.5rem; background: var(--surface2); border-radius: 10px; margin-top: 0.5rem; color: var(--accent2); }
@media (max-width: 768px) {
.header h1 { font-size: 1.5rem; }
.container { padding: 1rem; }
}
</style>
</head>
<body>
<div class="header">
<h1>🧩 Agent <span>Capability Matrix</span></h1>
<p>Map your business capabilities to agent types. Discover gaps, get autonomous prioritization, and receive implementation recommendations.</p>
</div>
<div class="container">
<div class="tabs">
<div class="tab active" data-tab="matrix">📊 Matrix</div>
<div class="tab" data-tab="gaps">🔍 Gap Analysis</div>
<div class="tab" data-tab="priorities">🎯 Priorities</div>
<div class="tab" data-tab="recommendations">💡 Recommendations</div>
<div class="tab" data-tab="export">📤 Export</div>
</div>
<!-- Matrix Panel -->
<div class="panel active" id="panel-matrix">
<div class="matrix-controls">
<select id="preset-select">
<option value="">Load preset...</option>
<option value="startup">🚀 Startup (lean)</option>
<option value="enterprise">🏢 Enterprise</option>
<option value="support">🎧 Support Center</option>
<option value="devops">⚙️ DevOps Team</option>
<option value="ecommerce">🛒 E-Commerce</option>
</select>
<button onclick="clearMatrix()">🗑️ Clear</button>
<button class="btn-accent" onclick="runAnalysis()">🔬 Analyze Gaps</button>
</div>
<div class="level-labels">
<span class="level-label"><span class="level-dot" style="background:var(--surface2)"></span> None</span>
<span class="level-label"><span class="level-dot" style="background:rgba(231,76,60,0.4)"></span> Low</span>
<span class="level-label"><span class="level-dot" style="background:rgba(253,203,110,0.4)"></span> Medium</span>
<span class="level-label"><span class="level-dot" style="background:rgba(0,184,148,0.4)"></span> High</span>
<span class="level-label"><span class="level-dot" style="background:rgba(108,92,231,0.4)"></span> Full</span>
<span style="color:var(--muted);font-size:0.8rem;margin-left:auto">Click cells to cycle coverage level</span>
</div>
<div class="matrix-grid">
<table class="matrix-table" id="matrix-table"></table>
</div>
</div>
<!-- Gap Analysis Panel -->
<div class="panel" id="panel-gaps">
<div id="gap-content">
<div class="empty-state"><p>Run the analysis first by clicking <strong>🔬 Analyze Gaps</strong> on the Matrix tab.</p></div>
</div>
</div>
<!-- Priorities Panel -->
<div class="panel" id="panel-priorities">
<div id="priority-content">
<div class="empty-state"><p>Run the analysis first.</p></div>
</div>
</div>
<!-- Recommendations Panel -->
<div class="panel" id="panel-recommendations">
<div id="rec-content">
<div class="empty-state"><p>Run the analysis first.</p></div>
</div>
</div>
<!-- Export Panel -->
<div class="panel" id="panel-export">
<div class="gap-card">
<h3>Export Your Capability Matrix</h3>
<p style="color:var(--muted);font-size:0.85rem;margin-bottom:1rem">Download your matrix data, gap analysis, and recommendations in multiple formats.</p>
<div class="export-btns">
<button class="btn-accent" onclick="exportJSON()">📋 JSON</button>
<button class="btn-accent" onclick="exportCSV()">📊 CSV</button>
<button class="btn-accent" onclick="exportMarkdown()">📝 Markdown</button>
</div>
</div>
</div>
</div>
<script>
// Data model
const CAPABILITIES = [
{ id: 'customer_support', name: 'Customer Support', category: 'Customer Facing', weight: 0.9 },
{ id: 'sales_outreach', name: 'Sales Outreach', category: 'Customer Facing', weight: 0.8 },
{ id: 'onboarding', name: 'User Onboarding', category: 'Customer Facing', weight: 0.85 },
{ id: 'content_gen', name: 'Content Generation', category: 'Marketing', weight: 0.7 },
{ id: 'seo_optimization', name: 'SEO Optimization', category: 'Marketing', weight: 0.6 },
{ id: 'social_media', name: 'Social Media Mgmt', category: 'Marketing', weight: 0.65 },
{ id: 'code_review', name: 'Code Review', category: 'Engineering', weight: 0.85 },
{ id: 'incident_response', name: 'Incident Response', category: 'Engineering', weight: 0.95 },
{ id: 'testing', name: 'Automated Testing', category: 'Engineering', weight: 0.8 },
{ id: 'data_analysis', name: 'Data Analysis', category: 'Analytics', weight: 0.75 },
{ id: 'reporting', name: 'Report Generation', category: 'Analytics', weight: 0.7 },
{ id: 'anomaly_detection', name: 'Anomaly Detection', category: 'Analytics', weight: 0.85 },
{ id: 'scheduling', name: 'Scheduling', category: 'Operations', weight: 0.6 },
{ id: 'document_processing', name: 'Document Processing', category: 'Operations', weight: 0.75 },
{ id: 'compliance', name: 'Compliance Monitoring', category: 'Operations', weight: 0.9 },
];
const AGENT_TYPES = [
{ id: 'conversational', name: 'Conversational', icon: '💬' },
{ id: 'task', name: 'Task Runner', icon: '⚡' },
{ id: 'analyst', name: 'Analyst', icon: '📊' },
{ id: 'monitor', name: 'Monitor', icon: '👁️' },
{ id: 'orchestrator', name: 'Orchestrator', icon: '🎭' },
{ id: 'creative', name: 'Creative', icon: '🎨' },
];
const LEVELS = ['none', 'low', 'medium', 'high', 'full'];
const LEVEL_LABELS = { none: '—', low: 'Low', medium: 'Med', high: 'High', full: 'Full' };
const LEVEL_SCORES = { none: 0, low: 0.25, medium: 0.5, high: 0.75, full: 1.0 };
// State: matrix[capId][agentId] = level
let matrix = {};
let analysisResult = null;
// Initialize
CAPABILITIES.forEach(c => {
matrix[c.id] = {};
AGENT_TYPES.forEach(a => { matrix[c.id][a.id] = 'none'; });
});
const PRESETS = {
startup: { customer_support: { conversational: 'high', task: 'medium' }, content_gen: { creative: 'high' }, code_review: { analyst: 'medium' }, data_analysis: { analyst: 'low' }, incident_response: { monitor: 'low' } },
enterprise: { customer_support: { conversational: 'full', task: 'high', orchestrator: 'medium' }, compliance: { monitor: 'high', analyst: 'high' }, incident_response: { monitor: 'full', orchestrator: 'high', task: 'high' }, data_analysis: { analyst: 'full' }, reporting: { analyst: 'high', creative: 'medium' }, document_processing: { task: 'high' }, code_review: { analyst: 'high' }, testing: { task: 'high' }, anomaly_detection: { monitor: 'high', analyst: 'medium' }, scheduling: { orchestrator: 'medium' }, onboarding: { conversational: 'high' }, sales_outreach: { conversational: 'medium', creative: 'low' } },
support: { customer_support: { conversational: 'full', task: 'high' }, onboarding: { conversational: 'high', creative: 'medium' }, reporting: { analyst: 'medium' }, scheduling: { orchestrator: 'low' }, anomaly_detection: { monitor: 'medium' } },
devops: { incident_response: { monitor: 'full', orchestrator: 'high', task: 'high' }, code_review: { analyst: 'high' }, testing: { task: 'full' }, anomaly_detection: { monitor: 'high', analyst: 'high' }, compliance: { monitor: 'medium' }, reporting: { analyst: 'medium' } },
ecommerce: { customer_support: { conversational: 'high', task: 'medium' }, sales_outreach: { conversational: 'high', creative: 'medium' }, content_gen: { creative: 'full' }, seo_optimization: { analyst: 'high', creative: 'medium' }, social_media: { creative: 'high', monitor: 'medium' }, data_analysis: { analyst: 'high' }, anomaly_detection: { monitor: 'high' }, onboarding: { conversational: 'medium' }, reporting: { analyst: 'medium' } },
};
function buildMatrix() {
const table = document.getElementById('matrix-table');
let html = '<thead><tr><th>Capability</th>';
AGENT_TYPES.forEach(a => { html += `<th>${a.icon} ${a.name}</th>`; });
html += '</tr></thead><tbody>';
let lastCat = '';
CAPABILITIES.forEach(cap => {
if (cap.category !== lastCat) {
html += `<tr class="cap-row"><td colspan="${AGENT_TYPES.length + 1}" style="color:var(--accent2);font-weight:600;font-size:0.8rem;padding:0.6rem">${cap.category}</td></tr>`;
lastCat = cap.category;
}
html += `<tr><td>${cap.name}</td>`;
AGENT_TYPES.forEach(a => {
const level = matrix[cap.id][a.id];
html += `<td class="cell-${level}" data-cap="${cap.id}" data-agent="${a.id}" onclick="cycleCell(this)">${LEVEL_LABELS[level]}</td>`;
});
html += '</tr>';
});
html += '</tbody>';
table.innerHTML = html;
}
function cycleCell(td) {
const capId = td.dataset.cap;
const agentId = td.dataset.agent;
const current = matrix[capId][agentId];
const idx = LEVELS.indexOf(current);
const next = LEVELS[(idx + 1) % LEVELS.length];
matrix[capId][agentId] = next;
td.className = `cell-${next}`;
td.textContent = LEVEL_LABELS[next];
}
function clearMatrix() {
CAPABILITIES.forEach(c => { AGENT_TYPES.forEach(a => { matrix[c.id][a.id] = 'none'; }); });
buildMatrix();
analysisResult = null;
}
function loadPreset(name) {
clearMatrix();
const preset = PRESETS[name];
if (!preset) return;
Object.entries(preset).forEach(([capId, agents]) => {
Object.entries(agents).forEach(([agentId, level]) => {
if (matrix[capId]) matrix[capId][agentId] = level;
});
});
buildMatrix();
}
// Analysis engine
function runAnalysis() {
const gaps = [];
const coverageByCapability = {};
const coverageByAgent = {};
let totalScore = 0, maxScore = 0;
CAPABILITIES.forEach(cap => {
let capScore = 0, capMax = 0;
AGENT_TYPES.forEach(agent => {
const score = LEVEL_SCORES[matrix[cap.id][agent.id]];
capScore += score;
capMax += 1;
if (!coverageByAgent[agent.id]) coverageByAgent[agent.id] = { score: 0, max: 0 };
coverageByAgent[agent.id].score += score;
coverageByAgent[agent.id].max += 1;
});
const coverage = capScore / capMax;
coverageByCapability[cap.id] = coverage;
totalScore += coverage * cap.weight;
maxScore += cap.weight;
if (coverage < 0.5) {
const gapSeverity = coverage < 0.1 ? 'critical' : coverage < 0.25 ? 'high' : 'medium';
const bestAgents = AGENT_TYPES
.map(a => ({ id: a.id, name: a.name, score: LEVEL_SCORES[matrix[cap.id][a.id]] }))
.sort((a, b) => b.score - a.score);
gaps.push({ cap, coverage, severity: gapSeverity, bestAgents });
}
});
const overallScore = maxScore > 0 ? (totalScore / maxScore) * 100 : 0;
// Priority scoring: weight * (1 - coverage) = impact of gap
const priorities = gaps
.map(g => ({ ...g, priorityScore: g.cap.weight * (1 - g.coverage) }))
.sort((a, b) => b.priorityScore - a.priorityScore);
// Recommendations
const recs = generateRecommendations(gaps, coverageByCapability, coverageByAgent, overallScore);
analysisResult = { gaps, coverageByCapability, coverageByAgent, overallScore, priorities, recs };
renderGaps();
renderPriorities();
renderRecommendations();
// Switch to gaps tab
document.querySelectorAll('.tab').forEach(t => t.classList.remove('active'));
document.querySelectorAll('.panel').forEach(p => p.classList.remove('active'));
document.querySelector('[data-tab="gaps"]').classList.add('active');
document.getElementById('panel-gaps').classList.add('active');
}
function generateRecommendations(gaps, capCov, agentCov, overall) {
const recs = [];
// Quick wins: capabilities with medium coverage that could be pushed to high
CAPABILITIES.forEach(cap => {
const cov = capCov[cap.id];
if (cov >= 0.3 && cov < 0.6) {
const weakAgents = AGENT_TYPES.filter(a => LEVEL_SCORES[matrix[cap.id][a.id]] > 0 && LEVEL_SCORES[matrix[cap.id][a.id]] < 0.75);
if (weakAgents.length > 0) {
recs.push({ type: 'Quick Win', title: `Level up ${cap.name}`, desc: `Upgrade ${weakAgents.map(a => a.name).join(', ')} agents from current level to High. This capability has partial coverage that can be quickly improved.` });
}
}
});
// Critical gaps
gaps.filter(g => g.severity === 'critical').forEach(g => {
recs.push({ type: 'Critical Gap', title: `Deploy agents for ${g.cap.name}`, desc: `This high-weight capability has near-zero agent coverage. Start with a ${g.bestAgents[0].score === 0 ? AGENT_TYPES[0].name : g.bestAgents[0].name} agent to establish baseline coverage.` });
});
// Underutilized agent types
AGENT_TYPES.forEach(a => {
const cov = agentCov[a.id];
if (cov && (cov.score / cov.max) < 0.15) {
recs.push({ type: 'Opportunity', title: `Expand ${a.name} agent usage`, desc: `${a.name} agents are underutilized across your capabilities. Consider deploying them for monitoring, automation, or analysis tasks they excel at.` });
}
});
// Overall maturity
if (overall < 30) {
recs.push({ type: 'Strategic', title: 'Focus on foundational agent deployment', desc: 'Your overall agent maturity is early-stage. Focus on 2-3 high-weight capabilities first rather than spreading thin across all areas.' });
} else if (overall > 70) {
recs.push({ type: 'Strategic', title: 'Consider agent orchestration', desc: 'Your coverage is strong. Focus on connecting agents via Orchestrator patterns to enable cross-capability autonomous workflows.' });
}
return recs;
}
function renderGaps() {
if (!analysisResult) return;
const { gaps, coverageByCapability, overallScore } = analysisResult;
let html = '<div style="display:grid;grid-template-columns:150px 1fr;gap:1.5rem;margin-bottom:1.5rem">';
// Score ring
html += '<div class="gap-card" style="display:flex;align-items:center;justify-content:center">';
html += `<div class="score-ring"><canvas id="score-canvas" width="120" height="120"></canvas><div class="score-text"><div class="score-num">${Math.round(overallScore)}</div><div class="score-label">Maturity</div></div></div>`;
html += '</div>';
// Coverage bars
html += '<div class="gap-card"><h3>Coverage by Capability</h3>';
CAPABILITIES.forEach(cap => {
const cov = coverageByCapability[cap.id];
const pct = Math.round(cov * 100);
const color = cov < 0.25 ? 'var(--red)' : cov < 0.5 ? 'var(--yellow)' : cov < 0.75 ? 'var(--green)' : 'var(--accent2)';
html += `<div class="gap-bar-container"><div class="gap-bar-label"><span>${cap.name}</span><span>${pct}%</span></div><div class="gap-bar-track"><div class="gap-bar-fill" style="width:${pct}%;background:${color}"></div></div></div>`;
});
html += '</div></div>';
if (gaps.length === 0) {
html += '<div class="gap-card"><h3>✅ No significant gaps detected</h3><p style="color:var(--muted)">All capabilities have at least 50% coverage.</p></div>';
} else {
html += `<div class="gap-card"><h3>⚠️ ${gaps.length} Gap${gaps.length > 1 ? 's' : ''} Detected</h3>`;
gaps.forEach(g => {
const pct = Math.round(g.coverage * 100);
html += `<div style="display:flex;align-items:center;gap:0.8rem;padding:0.5rem 0;border-bottom:1px solid var(--border)">`;
html += `<span class="priority-score priority-${g.severity}">${g.severity}</span>`;
html += `<span style="flex:1">${g.cap.name}</span>`;
html += `<span style="color:var(--muted)">${pct}% coverage</span>`;
html += `</div>`;
});
html += '</div>';
}
document.getElementById('gap-content').innerHTML = html;
// Draw ring
setTimeout(() => {
const canvas = document.getElementById('score-canvas');
if (!canvas) return;
const ctx = canvas.getContext('2d');
const cx = 60, cy = 60, r = 48;
ctx.lineWidth = 8;
ctx.lineCap = 'round';
ctx.strokeStyle = '#1a1a2e';
ctx.beginPath(); ctx.arc(cx, cy, r, 0, Math.PI * 2); ctx.stroke();
const color = overallScore < 30 ? '#e17055' : overallScore < 60 ? '#fdcb6e' : '#00b894';
ctx.strokeStyle = color;
ctx.beginPath(); ctx.arc(cx, cy, r, -Math.PI / 2, -Math.PI / 2 + (Math.PI * 2 * overallScore / 100)); ctx.stroke();
}, 50);
}
function renderPriorities() {
if (!analysisResult || analysisResult.priorities.length === 0) {
document.getElementById('priority-content').innerHTML = '<div class="gap-card"><h3>✅ No priority gaps</h3><p style="color:var(--muted)">Your coverage looks good across all capabilities.</p></div>';
return;
}
let html = '<div class="gap-card"><h3>🎯 Implementation Priority Queue</h3><p style="color:var(--muted);font-size:0.85rem;margin-bottom:1rem">Autonomously ranked by business impact × gap severity. Address top items first for maximum ROI.</p></div>';
html += '<ol class="priority-list">';
analysisResult.priorities.forEach((p, i) => {
const sevClass = p.severity === 'critical' ? 'priority-critical' : p.severity === 'high' ? 'priority-high' : 'priority-medium';
const suggestedAgent = p.bestAgents.find(a => a.score > 0) || { name: 'any' };
html += `<li class="priority-item"><div class="priority-rank">#${i + 1}</div><div class="priority-info"><h4>${p.cap.name}</h4><p>Coverage: ${Math.round(p.coverage * 100)}% · Weight: ${p.cap.weight} · Best start: ${suggestedAgent.name} agent</p></div><span class="priority-score ${sevClass}">${Math.round(p.priorityScore * 100)} impact</span></li>`;
});
html += '</ol>';
document.getElementById('priority-content').innerHTML = html;
}
function renderRecommendations() {
if (!analysisResult || analysisResult.recs.length === 0) {
document.getElementById('rec-content').innerHTML = '<div class="gap-card"><h3>No recommendations at this time</h3></div>';
return;
}
let html = '<div class="gap-card"><h3>💡 Autonomous Recommendations</h3><p style="color:var(--muted);font-size:0.85rem;margin-bottom:1rem">AI-generated action items based on your capability matrix analysis.</p></div>';
analysisResult.recs.forEach(r => {
html += `<div class="rec-card"><div class="rec-type">${r.type}</div><h4>${r.title}</h4><p>${r.desc}</p></div>`;
});
document.getElementById('rec-content').innerHTML = html;
}
// Export
function exportJSON() {
const data = { matrix, analysis: analysisResult, exportedAt: new Date().toISOString() };
download('capability-matrix.json', JSON.stringify(data, null, 2), 'application/json');
}
function exportCSV() {
let csv = 'Capability,Category,' + AGENT_TYPES.map(a => a.name).join(',') + ',Coverage\n';
CAPABILITIES.forEach(cap => {
const cov = analysisResult ? Math.round((analysisResult.coverageByCapability[cap.id] || 0) * 100) + '%' : 'N/A';
csv += `"${cap.name}","${cap.category}",` + AGENT_TYPES.map(a => matrix[cap.id][a.id]).join(',') + `,${cov}\n`;
});
download('capability-matrix.csv', csv, 'text/csv');
}
function exportMarkdown() {
let md = '# Agent Capability Matrix\n\n';
md += '| Capability | ' + AGENT_TYPES.map(a => a.name).join(' | ') + ' |\n';
md += '|---|' + AGENT_TYPES.map(() => '---').join('|') + '|\n';
CAPABILITIES.forEach(cap => {
md += `| ${cap.name} | ` + AGENT_TYPES.map(a => matrix[cap.id][a.id]).join(' | ') + ' |\n';
});
if (analysisResult) {
md += `\n## Overall Maturity: ${Math.round(analysisResult.overallScore)}%\n`;
if (analysisResult.priorities.length > 0) {
md += '\n## Priority Queue\n';
analysisResult.priorities.forEach((p, i) => {
md += `${i + 1}. **${p.cap.name}** — ${p.severity} (impact: ${Math.round(p.priorityScore * 100)})\n`;
});
}
if (analysisResult.recs.length > 0) {
md += '\n## Recommendations\n';
analysisResult.recs.forEach(r => { md += `- **[${r.type}] ${r.title}**: ${r.desc}\n`; });
}
}
download('capability-matrix.md', md, 'text/markdown');
}
function download(name, content, type) {
const blob = new Blob([content], { type });
const a = document.createElement('a');
a.href = URL.createObjectURL(blob);
a.download = name;
a.click();
URL.revokeObjectURL(a.href);
}
// Tab switching
document.querySelectorAll('.tab').forEach(tab => {
tab.addEventListener('click', () => {
document.querySelectorAll('.tab').forEach(t => t.classList.remove('active'));
document.querySelectorAll('.panel').forEach(p => p.classList.remove('active'));
tab.classList.add('active');
document.getElementById(`panel-${tab.dataset.tab}`).classList.add('active');
});
});
// Preset selector
document.getElementById('preset-select').addEventListener('change', function() {
if (this.value) { loadPreset(this.value); this.value = ''; }
});
// Build initial matrix
buildMatrix();
</script>
</body>
</html>