@viren/claude-code-dashboard 0.0.1
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.
- package/LICENSE +21 -0
- package/README.md +195 -0
- package/generate-dashboard.mjs +637 -0
- package/package.json +42 -0
- package/src/analysis.mjs +262 -0
- package/src/cli.mjs +135 -0
- package/src/constants.mjs +150 -0
- package/src/discovery.mjs +46 -0
- package/src/freshness.mjs +35 -0
- package/src/helpers.mjs +42 -0
- package/src/html-template.mjs +744 -0
- package/src/markdown.mjs +142 -0
- package/src/mcp.mjs +86 -0
- package/src/render.mjs +264 -0
- package/src/skills.mjs +135 -0
- package/src/templates.mjs +221 -0
- package/src/usage.mjs +60 -0
- package/src/watch.mjs +54 -0
|
@@ -0,0 +1,744 @@
|
|
|
1
|
+
import { esc, formatTokens } from "./helpers.mjs";
|
|
2
|
+
import { QUICK_REFERENCE } from "./constants.mjs";
|
|
3
|
+
import {
|
|
4
|
+
renderCmd,
|
|
5
|
+
renderRule,
|
|
6
|
+
renderSkill,
|
|
7
|
+
renderRepoCard,
|
|
8
|
+
groupSkillsByCategory,
|
|
9
|
+
healthScoreColor,
|
|
10
|
+
} from "./render.mjs";
|
|
11
|
+
|
|
12
|
+
export function generateDashboardHtml({
|
|
13
|
+
configured,
|
|
14
|
+
unconfigured,
|
|
15
|
+
globalCmds,
|
|
16
|
+
globalRules,
|
|
17
|
+
globalSkills,
|
|
18
|
+
chains,
|
|
19
|
+
mcpSummary,
|
|
20
|
+
mcpPromotions,
|
|
21
|
+
formerMcpServers,
|
|
22
|
+
consolidationGroups,
|
|
23
|
+
usageAnalytics,
|
|
24
|
+
ccusageData,
|
|
25
|
+
statsCache,
|
|
26
|
+
timestamp,
|
|
27
|
+
coveragePct,
|
|
28
|
+
totalRepos,
|
|
29
|
+
configuredCount,
|
|
30
|
+
unconfiguredCount,
|
|
31
|
+
totalRepoCmds,
|
|
32
|
+
avgHealth,
|
|
33
|
+
driftCount,
|
|
34
|
+
mcpCount,
|
|
35
|
+
scanScope,
|
|
36
|
+
}) {
|
|
37
|
+
return `<!DOCTYPE html>
|
|
38
|
+
<html lang="en">
|
|
39
|
+
<head>
|
|
40
|
+
<meta charset="utf-8">
|
|
41
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
42
|
+
<title>Claude Code Dashboard</title>
|
|
43
|
+
<style>
|
|
44
|
+
:root {
|
|
45
|
+
--bg: #0a0a0a; --surface: #111; --surface2: #1a1a1a; --border: #262626;
|
|
46
|
+
--text: #e5e5e5; --text-dim: #777; --accent: #c4956a; --accent-dim: #8b6a4a;
|
|
47
|
+
--green: #4ade80; --blue: #60a5fa; --purple: #a78bfa; --yellow: #fbbf24;
|
|
48
|
+
--red: #f87171;
|
|
49
|
+
}
|
|
50
|
+
[data-theme="light"] {
|
|
51
|
+
--bg: #f5f5f5; --surface: #fff; --surface2: #f0f0f0; --border: #e0e0e0;
|
|
52
|
+
--text: #1a1a1a; --text-dim: #666; --accent: #9b6b47; --accent-dim: #b8956e;
|
|
53
|
+
--green: #16a34a; --blue: #2563eb; --purple: #7c3aed; --yellow: #ca8a04;
|
|
54
|
+
--red: #dc2626;
|
|
55
|
+
}
|
|
56
|
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
57
|
+
body {
|
|
58
|
+
font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
|
|
59
|
+
background: var(--bg); color: var(--text);
|
|
60
|
+
padding: 2.5rem 2rem; line-height: 1.5; max-width: 1200px; margin: 0 auto;
|
|
61
|
+
}
|
|
62
|
+
code, .cmd-name { font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace; }
|
|
63
|
+
h1 { font-size: 1.4rem; font-weight: 600; color: var(--accent); margin-bottom: .2rem; }
|
|
64
|
+
.sub { color: var(--text-dim); font-size: .78rem; margin-bottom: 1.5rem; }
|
|
65
|
+
kbd { background: var(--surface2); border: 1px solid var(--border); border-radius: 3px; padding: .05rem .3rem; font-size: .7rem; font-family: inherit; }
|
|
66
|
+
|
|
67
|
+
.top-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-bottom: 1.25rem; }
|
|
68
|
+
@media (max-width: 900px) { .top-grid { grid-template-columns: 1fr; } }
|
|
69
|
+
|
|
70
|
+
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1.25rem; overflow: hidden; }
|
|
71
|
+
.card.full { grid-column: 1 / -1; }
|
|
72
|
+
.card h2 { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); margin-bottom: .75rem; display: flex; align-items: center; gap: .5rem; }
|
|
73
|
+
.card h2 .n { background: var(--surface2); border: 1px solid var(--border); border-radius: 4px; padding: .05rem .35rem; font-size: .65rem; color: var(--accent); }
|
|
74
|
+
|
|
75
|
+
.cmd-row, details.cmd-detail > summary { display: flex; align-items: baseline; padding: .35rem .25rem; gap: .75rem; border-bottom: 1px solid var(--border); font-size: .82rem; }
|
|
76
|
+
.cmd-row:last-child, details.cmd-detail:last-child:not([open]) > summary { border-bottom: none; }
|
|
77
|
+
.cmd-name { font-weight: 600; color: var(--green); white-space: nowrap; font-size: .8rem; flex-shrink: 0; }
|
|
78
|
+
.cmd-desc { color: var(--text-dim); font-size: .75rem; text-align: right; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
79
|
+
|
|
80
|
+
details.cmd-detail { border-bottom: 1px solid var(--border); }
|
|
81
|
+
details.cmd-detail:last-child { border-bottom: none; }
|
|
82
|
+
details.cmd-detail > summary { cursor: pointer; list-style: none; border-radius: 4px; transition: background .1s; }
|
|
83
|
+
details.cmd-detail[open] > summary, details.cmd-detail > summary:hover { background: var(--surface2); }
|
|
84
|
+
details.cmd-detail > summary::-webkit-details-marker { display: none; }
|
|
85
|
+
.detail-body { padding: .6rem .5rem .6rem 1rem; background: var(--surface2); border-radius: 0 0 6px 6px; margin-bottom: .15rem; }
|
|
86
|
+
.detail-section { color: var(--blue); font-size: .72rem; font-weight: 600; margin-top: .35rem; }
|
|
87
|
+
.detail-section:first-child { margin-top: 0; }
|
|
88
|
+
.detail-step, .detail-key { font-size: .7rem; padding: .1rem 0 .1rem .9rem; position: relative; }
|
|
89
|
+
.detail-step { color: var(--text); }
|
|
90
|
+
.detail-step::before { content: "\\2192"; position: absolute; left: 0; color: var(--accent-dim); font-size: .65rem; }
|
|
91
|
+
.detail-key { color: var(--yellow); }
|
|
92
|
+
.detail-key::before { content: "\\2022"; position: absolute; left: .15rem; color: var(--accent-dim); }
|
|
93
|
+
|
|
94
|
+
.label { color: var(--text-dim); font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin: .85rem 0 .35rem; }
|
|
95
|
+
.label:first-child { margin-top: 0; }
|
|
96
|
+
|
|
97
|
+
.agent-section { border-bottom: 1px solid var(--border); }
|
|
98
|
+
.agent-section:last-child { border-bottom: none; }
|
|
99
|
+
.agent-section > summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; padding: .3rem .25rem; font-size: .78rem; font-weight: 500; color: var(--text); border-radius: 4px; transition: background .1s; }
|
|
100
|
+
.agent-section > summary::-webkit-details-marker { display: none; }
|
|
101
|
+
.agent-section > summary:hover, .agent-section[open] > summary { background: var(--surface2); }
|
|
102
|
+
.agent-section[open] > summary { color: var(--blue); }
|
|
103
|
+
.agent-section-preview { padding: .3rem .4rem .5rem 1rem; background: var(--surface2); border-radius: 0 0 4px 4px; margin-bottom: .1rem; }
|
|
104
|
+
.agent-section-preview .line { color: var(--text-dim); font-size: .68rem; line-height: 1.5; padding: .05rem 0; }
|
|
105
|
+
|
|
106
|
+
.chain { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .65rem .75rem; background: var(--surface2); border-radius: 6px; margin-top: .4rem; }
|
|
107
|
+
.chain:first-child { margin-top: 0; }
|
|
108
|
+
.chain-node { background: var(--surface); border: 1px solid var(--accent-dim); border-radius: 5px; padding: .25rem .55rem; font-size: .75rem; font-weight: 500; color: var(--accent); }
|
|
109
|
+
.chain-arrow { color: var(--text-dim); font-size: .85rem; }
|
|
110
|
+
|
|
111
|
+
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .65rem; margin-bottom: 1.5rem; }
|
|
112
|
+
.stat { text-align: center; padding: .65rem .5rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
|
|
113
|
+
.stat b { display: block; font-size: 1.4rem; color: var(--accent); }
|
|
114
|
+
.stat span { font-size: .6rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em; }
|
|
115
|
+
.stat.coverage b { color: ${coveragePct >= 70 ? "var(--green)" : coveragePct >= 40 ? "var(--yellow)" : "var(--red)"}; }
|
|
116
|
+
|
|
117
|
+
.search-bar { margin-bottom: 1rem; position: relative; }
|
|
118
|
+
.search-bar input {
|
|
119
|
+
width: 100%; padding: .6rem .9rem; padding-right: 4rem; font-size: .82rem;
|
|
120
|
+
background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
|
|
121
|
+
color: var(--text); outline: none; transition: border-color .15s; font-family: inherit;
|
|
122
|
+
}
|
|
123
|
+
.search-bar input::placeholder { color: var(--text-dim); }
|
|
124
|
+
.search-bar input:focus { border-color: var(--accent-dim); }
|
|
125
|
+
.search-hint { position: absolute; right: .75rem; top: 50%; transform: translateY(-50%); pointer-events: none; }
|
|
126
|
+
|
|
127
|
+
.repo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin-bottom: 1.25rem; }
|
|
128
|
+
@media (max-width: 1000px) { .repo-grid { grid-template-columns: 1fr 1fr; } }
|
|
129
|
+
@media (max-width: 600px) { .repo-grid { grid-template-columns: 1fr; } }
|
|
130
|
+
|
|
131
|
+
.repo-card {
|
|
132
|
+
background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
|
|
133
|
+
overflow: hidden; transition: border-color .15s;
|
|
134
|
+
}
|
|
135
|
+
.repo-card[open] { grid-column: 1 / -1; border-color: var(--accent-dim); }
|
|
136
|
+
.repo-card > summary {
|
|
137
|
+
cursor: pointer; list-style: none; padding: .85rem 1rem;
|
|
138
|
+
display: flex; flex-direction: column; gap: .3rem;
|
|
139
|
+
}
|
|
140
|
+
.repo-card > summary::-webkit-details-marker { display: none; }
|
|
141
|
+
.repo-card > summary:hover { background: var(--surface2); }
|
|
142
|
+
.repo-header { display: flex; align-items: center; justify-content: space-between; }
|
|
143
|
+
.repo-card .repo-name {
|
|
144
|
+
font-size: .88rem; font-weight: 600; color: var(--text);
|
|
145
|
+
display: flex; align-items: center; gap: .4rem;
|
|
146
|
+
}
|
|
147
|
+
.repo-card .repo-preview {
|
|
148
|
+
font-size: .7rem; color: var(--text-dim); line-height: 1.4;
|
|
149
|
+
display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
|
|
150
|
+
}
|
|
151
|
+
.repo-card .badges { display: flex; gap: .3rem; margin-top: .2rem; flex-wrap: wrap; }
|
|
152
|
+
.badge {
|
|
153
|
+
font-size: .58rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
|
|
154
|
+
padding: .12rem .4rem; border-radius: 3px; border: 1px solid;
|
|
155
|
+
}
|
|
156
|
+
.badge.cmds { color: var(--green); border-color: #4ade8033; background: #4ade8010; }
|
|
157
|
+
.badge.rules { color: var(--purple); border-color: #a78bfa33; background: #a78bfa10; }
|
|
158
|
+
.badge.agent { color: var(--blue); border-color: #60a5fa33; background: #60a5fa10; }
|
|
159
|
+
.badge.skills { color: var(--yellow); border-color: #fbbf2433; background: #fbbf2410; }
|
|
160
|
+
.badge.source { font-size: .5rem; padding: .08rem .3rem; margin-left: .4rem; text-transform: none; letter-spacing: .02em; flex-shrink: 0; }
|
|
161
|
+
.badge.source.superpowers { color: var(--purple); border-color: #a78bfa33; background: #a78bfa10; }
|
|
162
|
+
.badge.source.skillssh { color: var(--blue); border-color: #60a5fa33; background: #60a5fa10; }
|
|
163
|
+
.badge.source.custom { color: var(--text-dim); border-color: var(--border); background: var(--surface2); }
|
|
164
|
+
.skill-name { color: var(--yellow) !important; }
|
|
165
|
+
.skill-category { margin-top: .75rem; }
|
|
166
|
+
.skill-category:first-child { margin-top: 0; }
|
|
167
|
+
.skill-category-label { font-size: .6rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); padding: .3rem 0; margin-bottom: .25rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: .4rem; }
|
|
168
|
+
.skill-category-label .cat-n { font-size: .55rem; color: var(--accent-dim); }
|
|
169
|
+
|
|
170
|
+
.mcp-row { display: flex; align-items: center; gap: .5rem; padding: .3rem .25rem; border-bottom: 1px solid var(--border); font-size: .8rem; flex-wrap: wrap; }
|
|
171
|
+
.mcp-row:last-child { border-bottom: none; }
|
|
172
|
+
.mcp-row.mcp-disabled { opacity: .5; }
|
|
173
|
+
.mcp-disabled-hint { font-size: .6rem; color: var(--red); opacity: .8; }
|
|
174
|
+
.mcp-name { font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace; font-weight: 600; color: var(--text); font-size: .78rem; }
|
|
175
|
+
.mcp-projects { font-size: .65rem; color: var(--text-dim); margin-left: auto; }
|
|
176
|
+
.badge.mcp-global { color: var(--green); border-color: #4ade8033; background: #4ade8010; }
|
|
177
|
+
.badge.mcp-project { color: var(--blue); border-color: #60a5fa33; background: #60a5fa10; }
|
|
178
|
+
.badge.mcp-type { color: var(--text-dim); border-color: var(--border); background: var(--surface2); text-transform: none; font-size: .5rem; }
|
|
179
|
+
.mcp-promote { font-size: .72rem; color: var(--text-dim); padding: .4rem .5rem; background: rgba(251,191,36,.05); border: 1px solid rgba(251,191,36,.15); border-radius: 6px; margin-top: .3rem; }
|
|
180
|
+
.mcp-promote .mcp-name { color: var(--yellow); }
|
|
181
|
+
.mcp-promote code { font-size: .65rem; color: var(--accent); }
|
|
182
|
+
.mcp-former { opacity: .4; }
|
|
183
|
+
.badge.mcp-former-badge { color: var(--text-dim); border-color: var(--border); background: var(--surface2); font-style: italic; }
|
|
184
|
+
|
|
185
|
+
.usage-bar-row { display: flex; align-items: center; gap: .5rem; padding: .25rem 0; font-size: .75rem; }
|
|
186
|
+
.usage-bar-label { width: 100px; flex-shrink: 0; color: var(--text); font-weight: 500; font-size: .72rem; }
|
|
187
|
+
.usage-bar-track { flex: 1; height: 8px; background: var(--surface2); border-radius: 4px; overflow: hidden; }
|
|
188
|
+
.usage-bar-fill { height: 100%; border-radius: 4px; transition: width .3s; }
|
|
189
|
+
.usage-bar-tool { background: linear-gradient(90deg, var(--blue), var(--green)); }
|
|
190
|
+
.usage-bar-lang { background: linear-gradient(90deg, var(--green), var(--accent)); }
|
|
191
|
+
.usage-bar-error { background: linear-gradient(90deg, var(--red), var(--yellow)); }
|
|
192
|
+
.usage-bar-count { font-size: .65rem; color: var(--text-dim); min-width: 40px; text-align: right; font-variant-numeric: tabular-nums; }
|
|
193
|
+
|
|
194
|
+
.heatmap { display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; }
|
|
195
|
+
.heatmap-cell { aspect-ratio: 1; border-radius: 2px; background: var(--surface2); min-width: 6px; min-height: 6px; }
|
|
196
|
+
.heatmap-cell.l1 { background: #0e4429; }
|
|
197
|
+
.heatmap-cell.l2 { background: #006d32; }
|
|
198
|
+
.heatmap-cell.l3 { background: #26a641; }
|
|
199
|
+
.heatmap-cell.l4 { background: #39d353; }
|
|
200
|
+
[data-theme="light"] .heatmap-cell.l1 { background: #9be9a8; }
|
|
201
|
+
[data-theme="light"] .heatmap-cell.l2 { background: #40c463; }
|
|
202
|
+
[data-theme="light"] .heatmap-cell.l3 { background: #30a14e; }
|
|
203
|
+
[data-theme="light"] .heatmap-cell.l4 { background: #216e39; }
|
|
204
|
+
|
|
205
|
+
.heatmap-months { display: flex; font-size: .5rem; color: var(--text-dim); margin-bottom: .2rem; }
|
|
206
|
+
.heatmap-month { flex: 1; }
|
|
207
|
+
|
|
208
|
+
.peak-hours { display: flex; align-items: flex-end; gap: 2px; height: 40px; }
|
|
209
|
+
.peak-bar { flex: 1; background: var(--purple); border-radius: 2px 2px 0 0; min-width: 4px; opacity: .7; }
|
|
210
|
+
.peak-labels { display: flex; gap: 2px; font-size: .45rem; color: var(--text-dim); }
|
|
211
|
+
.peak-label { flex: 1; text-align: center; min-width: 4px; }
|
|
212
|
+
|
|
213
|
+
.model-row { display: flex; justify-content: space-between; padding: .2rem 0; font-size: .72rem; border-bottom: 1px solid var(--border); }
|
|
214
|
+
.model-row:last-child { border-bottom: none; }
|
|
215
|
+
.model-name { color: var(--text); font-weight: 500; }
|
|
216
|
+
.model-tokens { color: var(--text-dim); font-variant-numeric: tabular-nums; }
|
|
217
|
+
.token-breakdown { margin-top: .25rem; }
|
|
218
|
+
.tb-row { display: flex; justify-content: space-between; padding: .15rem 0; font-size: .68rem; }
|
|
219
|
+
.tb-label { color: var(--text-dim); }
|
|
220
|
+
.tb-val { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 500; }
|
|
221
|
+
|
|
222
|
+
.health-bar { height: 4px; background: var(--surface2); border-radius: 2px; margin: .4rem 0 .5rem; position: relative; overflow: hidden; }
|
|
223
|
+
.health-fill { height: 100%; border-radius: 2px; transition: width .3s; }
|
|
224
|
+
.health-label { position: absolute; right: 0; top: -14px; font-size: .55rem; color: var(--text-dim); }
|
|
225
|
+
.badge.stack { color: var(--accent); border-color: var(--accent-dim); background: rgba(196,149,106,.08); text-transform: none; }
|
|
226
|
+
.drift { font-size: .58rem; margin-left: .4rem; font-weight: 600; }
|
|
227
|
+
.drift-low { color: var(--text-dim); }
|
|
228
|
+
.drift-medium { color: var(--yellow); }
|
|
229
|
+
.drift-high { color: var(--red); }
|
|
230
|
+
.quick-wins { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .5rem; }
|
|
231
|
+
.quick-win { font-size: .6rem; padding: .15rem .4rem; border-radius: 3px; background: rgba(251,191,36,.08); border: 1px solid rgba(251,191,36,.2); color: var(--yellow); }
|
|
232
|
+
.matched-skills { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .5rem; }
|
|
233
|
+
.matched-skill { font-size: .6rem; padding: .12rem .4rem; border-radius: 3px; background: rgba(251,191,36,.08); border: 1px solid rgba(251,191,36,.2); color: var(--yellow); font-family: 'SF Mono', monospace; }
|
|
234
|
+
.consolidation-hint { padding: .45rem .6rem; background: var(--surface2); border-radius: 6px; margin-top: .4rem; display: flex; align-items: baseline; gap: .5rem; }
|
|
235
|
+
.consolidation-hint:first-child { margin-top: 0; }
|
|
236
|
+
.consolidation-stack { font-size: .7rem; font-weight: 600; color: var(--accent); white-space: nowrap; }
|
|
237
|
+
.consolidation-text { font-size: .7rem; color: var(--text-dim); }
|
|
238
|
+
|
|
239
|
+
.unconfigured-item .stack-tag { font-size: .5rem; color: var(--accent-dim); margin-left: .3rem; }
|
|
240
|
+
|
|
241
|
+
.freshness-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; }
|
|
242
|
+
.freshness-dot.fresh { background: var(--green); }
|
|
243
|
+
.freshness-dot.aging { background: var(--yellow); }
|
|
244
|
+
.freshness-dot.stale { background: var(--red); }
|
|
245
|
+
|
|
246
|
+
.repo-body { padding: 0 1rem 1rem; }
|
|
247
|
+
.repo-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; padding-bottom: .4rem; border-bottom: 1px solid var(--border); }
|
|
248
|
+
.repo-path { font-size: .68rem; color: var(--text-dim); font-family: 'SF Mono', monospace; }
|
|
249
|
+
.freshness { font-size: .65rem; font-weight: 500; }
|
|
250
|
+
.freshness.fresh { color: var(--green); }
|
|
251
|
+
.freshness.aging { color: var(--yellow); }
|
|
252
|
+
.freshness.stale { color: var(--red); }
|
|
253
|
+
.repo-desc { color: var(--text-dim); font-size: .75rem; line-height: 1.45; margin-bottom: .75rem; padding-bottom: .6rem; border-bottom: 1px solid var(--border); }
|
|
254
|
+
|
|
255
|
+
.unconfigured-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; }
|
|
256
|
+
@media (max-width: 900px) { .unconfigured-grid { grid-template-columns: repeat(2, 1fr); } }
|
|
257
|
+
.unconfigured-item { font-size: .72rem; padding: .3rem .5rem; border-radius: 4px; background: var(--surface2); color: var(--text-dim); }
|
|
258
|
+
.unconfigured-item .upath { font-size: .6rem; color: #555; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
259
|
+
.suggestion-hints { display: flex; flex-wrap: wrap; gap: .2rem; margin-top: .25rem; }
|
|
260
|
+
.suggestion-hint { font-size: .5rem; padding: .08rem .3rem; border-radius: 2px; background: rgba(96,165,250,.08); border: 1px solid rgba(96,165,250,.15); color: var(--blue); }
|
|
261
|
+
|
|
262
|
+
.ts { text-align: center; color: var(--text-dim); font-size: .65rem; margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--border); }
|
|
263
|
+
|
|
264
|
+
.theme-toggle {
|
|
265
|
+
position: fixed; top: 1rem; right: 1rem; z-index: 100;
|
|
266
|
+
background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
|
|
267
|
+
padding: .4rem .6rem; cursor: pointer; color: var(--text-dim); font-size: .75rem;
|
|
268
|
+
transition: background .15s, border-color .15s;
|
|
269
|
+
}
|
|
270
|
+
.theme-toggle:hover { border-color: var(--accent-dim); }
|
|
271
|
+
.theme-icon::before { content: "\\263E"; }
|
|
272
|
+
[data-theme="light"] .theme-icon::before { content: "\\2600"; }
|
|
273
|
+
|
|
274
|
+
.ref-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
|
|
275
|
+
@media (max-width: 700px) { .ref-grid { grid-template-columns: 1fr; } }
|
|
276
|
+
.ref-row { display: flex; align-items: baseline; gap: .5rem; padding: .2rem 0; font-size: .72rem; }
|
|
277
|
+
.ref-cmd { font-size: .7rem; color: var(--green); white-space: nowrap; min-width: 100px; }
|
|
278
|
+
.ref-key { min-width: 90px; font-size: .65rem; }
|
|
279
|
+
.ref-desc { color: var(--text-dim); font-size: .68rem; }
|
|
280
|
+
|
|
281
|
+
details.skill-category > summary { cursor: pointer; list-style: none; }
|
|
282
|
+
details.skill-category > summary::-webkit-details-marker { display: none; }
|
|
283
|
+
details.skill-category > summary:hover { color: var(--accent); }
|
|
284
|
+
details.skill-category[open] > summary { color: var(--blue); }
|
|
285
|
+
|
|
286
|
+
.group-controls { display: flex; align-items: center; gap: .5rem; margin-bottom: 1rem; }
|
|
287
|
+
.group-label { font-size: .7rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em; }
|
|
288
|
+
.group-select { font-size: .75rem; padding: .3rem .5rem; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 6px; outline: none; font-family: inherit; }
|
|
289
|
+
.group-select:focus { border-color: var(--accent-dim); }
|
|
290
|
+
.group-heading { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); padding: .5rem 0 .25rem; margin-top: .75rem; border-bottom: 1px solid var(--border); grid-column: 1 / -1; }
|
|
291
|
+
|
|
292
|
+
.repo-card[open] .repo-preview { display: none; }
|
|
293
|
+
details.cmd-detail[open] .cmd-desc { white-space: normal; text-overflow: unset; overflow: visible; }
|
|
294
|
+
</style>
|
|
295
|
+
</head>
|
|
296
|
+
<body>
|
|
297
|
+
<h1>claude code dashboard</h1>
|
|
298
|
+
<button id="theme-toggle" class="theme-toggle" title="Toggle light/dark mode" aria-label="Toggle theme"><span class="theme-icon"></span></button>
|
|
299
|
+
<p class="sub">generated ${timestamp} · run <code>claude-code-dashboard</code> to refresh · click to expand</p>
|
|
300
|
+
|
|
301
|
+
<div class="stats">
|
|
302
|
+
<div class="stat coverage"><b>${coveragePct}%</b><span>Coverage (${configuredCount}/${totalRepos})</span></div>
|
|
303
|
+
<div class="stat" style="${avgHealth >= 70 ? "border-color:#4ade8033" : avgHealth >= 40 ? "border-color:#fbbf2433" : "border-color:#f8717133"}"><b style="color:${healthScoreColor(avgHealth)}">${avgHealth}</b><span>Avg Health</span></div>
|
|
304
|
+
<div class="stat"><b>${globalCmds.length}</b><span>Global Commands</span></div>
|
|
305
|
+
<div class="stat"><b>${globalSkills.length}</b><span>Skills</span></div>
|
|
306
|
+
<div class="stat"><b>${totalRepoCmds}</b><span>Repo Commands</span></div>
|
|
307
|
+
${mcpCount > 0 ? `<div class="stat"><b>${mcpCount}</b><span>MCP Servers</span></div>` : ""}
|
|
308
|
+
${driftCount > 0 ? `<div class="stat" style="border-color:#f8717133"><b style="color:var(--red)">${driftCount}</b><span>Drifting Repos</span></div>` : ""}
|
|
309
|
+
${ccusageData ? `<div class="stat" style="border-color:#4ade8033"><b style="color:var(--green)">$${Math.round(Number(ccusageData.totals.totalCost) || 0).toLocaleString()}</b><span>Total Spent</span></div>` : ""}
|
|
310
|
+
${ccusageData ? `<div class="stat"><b>${formatTokens(ccusageData.totals.totalTokens).replace(" tokens", "")}</b><span>Total Tokens</span></div>` : ""}
|
|
311
|
+
${usageAnalytics.heavySessions > 0 ? `<div class="stat"><b>${usageAnalytics.heavySessions}</b><span>Heavy Sessions</span></div>` : ""}
|
|
312
|
+
</div>
|
|
313
|
+
|
|
314
|
+
<div class="top-grid">
|
|
315
|
+
<div class="card">
|
|
316
|
+
<h2>Global Commands <span class="n">${globalCmds.length}</span></h2>
|
|
317
|
+
${globalCmds.map((c) => renderCmd(c)).join("\n ")}
|
|
318
|
+
</div>
|
|
319
|
+
<div class="card">
|
|
320
|
+
<h2>Global Rules <span class="n">${globalRules.length}</span></h2>
|
|
321
|
+
${globalRules.map((r) => renderRule(r)).join("\n ")}
|
|
322
|
+
</div>
|
|
323
|
+
${
|
|
324
|
+
globalSkills.length
|
|
325
|
+
? (() => {
|
|
326
|
+
const groups = groupSkillsByCategory(globalSkills);
|
|
327
|
+
const categoryHtml = Object.entries(groups)
|
|
328
|
+
.map(
|
|
329
|
+
([cat, skills], idx) =>
|
|
330
|
+
`<details class="skill-category"${idx === 0 ? " open" : ""}>` +
|
|
331
|
+
`<summary class="skill-category-label">${esc(cat)} <span class="cat-n">${skills.length}</span></summary>` +
|
|
332
|
+
skills.map((s) => renderSkill(s)).join("\n ") +
|
|
333
|
+
`</details>`,
|
|
334
|
+
)
|
|
335
|
+
.join("\n ");
|
|
336
|
+
return `<div class="card full">
|
|
337
|
+
<h2>Skills <span class="n">${globalSkills.length}</span></h2>
|
|
338
|
+
${categoryHtml}
|
|
339
|
+
</div>`;
|
|
340
|
+
})()
|
|
341
|
+
: ""
|
|
342
|
+
}
|
|
343
|
+
${
|
|
344
|
+
mcpSummary.length
|
|
345
|
+
? (() => {
|
|
346
|
+
const rows = mcpSummary
|
|
347
|
+
.map((s) => {
|
|
348
|
+
const disabledClass = s.disabledIn > 0 ? " mcp-disabled" : "";
|
|
349
|
+
const disabledHint =
|
|
350
|
+
s.disabledIn > 0
|
|
351
|
+
? `<span class="mcp-disabled-hint">disabled in ${s.disabledIn} project${s.disabledIn > 1 ? "s" : ""}</span>`
|
|
352
|
+
: "";
|
|
353
|
+
const scopeBadge = s.userLevel
|
|
354
|
+
? `<span class="badge mcp-global">global</span>`
|
|
355
|
+
: `<span class="badge mcp-project">project</span>`;
|
|
356
|
+
const typeBadge = `<span class="badge mcp-type">${esc(s.type)}</span>`;
|
|
357
|
+
const projects = s.projects.length
|
|
358
|
+
? `<span class="mcp-projects">${s.projects.map((p) => esc(p)).join(", ")}</span>`
|
|
359
|
+
: "";
|
|
360
|
+
return `<div class="mcp-row${disabledClass}"><span class="mcp-name">${esc(s.name)}</span>${scopeBadge}${typeBadge}${disabledHint}${projects}</div>`;
|
|
361
|
+
})
|
|
362
|
+
.join("\n ");
|
|
363
|
+
const promoteHtml = mcpPromotions.length
|
|
364
|
+
? mcpPromotions
|
|
365
|
+
.map(
|
|
366
|
+
(p) =>
|
|
367
|
+
`<div class="mcp-promote"><span class="mcp-name">${esc(p.name)}</span> installed in ${p.projects.length} projects → add to <code>~/.claude/mcp_config.json</code></div>`,
|
|
368
|
+
)
|
|
369
|
+
.join("\n ")
|
|
370
|
+
: "";
|
|
371
|
+
const formerHtml = formerMcpServers.length
|
|
372
|
+
? `<div class="label" style="margin-top:.75rem">Formerly Installed</div>
|
|
373
|
+
${formerMcpServers.map((name) => `<div class="mcp-row mcp-former"><span class="mcp-name">${esc(name)}</span><span class="badge mcp-former-badge">removed</span></div>`).join("\n ")}`
|
|
374
|
+
: "";
|
|
375
|
+
return `<div class="card full">
|
|
376
|
+
<h2>MCP Servers <span class="n">${mcpSummary.length}</span></h2>
|
|
377
|
+
${rows}
|
|
378
|
+
${promoteHtml}
|
|
379
|
+
${formerHtml}
|
|
380
|
+
</div>`;
|
|
381
|
+
})()
|
|
382
|
+
: ""
|
|
383
|
+
}
|
|
384
|
+
${
|
|
385
|
+
usageAnalytics.topTools.length
|
|
386
|
+
? (() => {
|
|
387
|
+
const maxCount = usageAnalytics.topTools[0].count;
|
|
388
|
+
const rows = usageAnalytics.topTools
|
|
389
|
+
.map((t) => {
|
|
390
|
+
const pct = maxCount > 0 ? Math.round((t.count / maxCount) * 100) : 0;
|
|
391
|
+
return `<div class="usage-bar-row"><span class="usage-bar-label">${esc(t.name)}</span><div class="usage-bar-track"><div class="usage-bar-fill usage-bar-tool" style="width:${pct}%"></div></div><span class="usage-bar-count">${t.count.toLocaleString()}</span></div>`;
|
|
392
|
+
})
|
|
393
|
+
.join("\n ");
|
|
394
|
+
return `<div class="card">
|
|
395
|
+
<h2>Top Tools Used <span class="n">${usageAnalytics.topTools.length}</span></h2>
|
|
396
|
+
${rows}
|
|
397
|
+
</div>`;
|
|
398
|
+
})()
|
|
399
|
+
: ""
|
|
400
|
+
}
|
|
401
|
+
${
|
|
402
|
+
usageAnalytics.topLanguages.length
|
|
403
|
+
? (() => {
|
|
404
|
+
const maxCount = usageAnalytics.topLanguages[0].count;
|
|
405
|
+
const rows = usageAnalytics.topLanguages
|
|
406
|
+
.map((l) => {
|
|
407
|
+
const pct = maxCount > 0 ? Math.round((l.count / maxCount) * 100) : 0;
|
|
408
|
+
return `<div class="usage-bar-row"><span class="usage-bar-label">${esc(l.name)}</span><div class="usage-bar-track"><div class="usage-bar-fill usage-bar-lang" style="width:${pct}%"></div></div><span class="usage-bar-count">${l.count.toLocaleString()}</span></div>`;
|
|
409
|
+
})
|
|
410
|
+
.join("\n ");
|
|
411
|
+
return `<div class="card">
|
|
412
|
+
<h2>Languages <span class="n">${usageAnalytics.topLanguages.length}</span></h2>
|
|
413
|
+
${rows}
|
|
414
|
+
</div>`;
|
|
415
|
+
})()
|
|
416
|
+
: ""
|
|
417
|
+
}
|
|
418
|
+
${
|
|
419
|
+
usageAnalytics.errorCategories.length
|
|
420
|
+
? (() => {
|
|
421
|
+
const maxCount = usageAnalytics.errorCategories[0].count;
|
|
422
|
+
const rows = usageAnalytics.errorCategories
|
|
423
|
+
.map((e) => {
|
|
424
|
+
const pct = maxCount > 0 ? Math.round((e.count / maxCount) * 100) : 0;
|
|
425
|
+
return `<div class="usage-bar-row"><span class="usage-bar-label">${esc(e.name)}</span><div class="usage-bar-track"><div class="usage-bar-fill usage-bar-error" style="width:${pct}%"></div></div><span class="usage-bar-count">${e.count.toLocaleString()}</span></div>`;
|
|
426
|
+
})
|
|
427
|
+
.join("\n ");
|
|
428
|
+
return `<div class="card">
|
|
429
|
+
<h2>Top Errors <span class="n">${usageAnalytics.errorCategories.length}</span></h2>
|
|
430
|
+
${rows}
|
|
431
|
+
</div>`;
|
|
432
|
+
})()
|
|
433
|
+
: ""
|
|
434
|
+
}
|
|
435
|
+
${(() => {
|
|
436
|
+
const dailyActivity = statsCache.dailyActivity || [];
|
|
437
|
+
const hourCounts = statsCache.hourCounts || {};
|
|
438
|
+
const modelUsage = statsCache.modelUsage || {};
|
|
439
|
+
const hasActivity = dailyActivity.length > 0;
|
|
440
|
+
const hasHours = Object.keys(hourCounts).length > 0;
|
|
441
|
+
const hasModels = Object.keys(modelUsage).length > 0;
|
|
442
|
+
|
|
443
|
+
if (!hasActivity && !hasHours && !hasModels && !ccusageData) return "";
|
|
444
|
+
|
|
445
|
+
let content = "";
|
|
446
|
+
|
|
447
|
+
// Activity heatmap
|
|
448
|
+
if (hasActivity) {
|
|
449
|
+
const dateMap = new Map(dailyActivity.map((d) => [d.date, d.messageCount || 0]));
|
|
450
|
+
const dates = dailyActivity.map((d) => d.date).sort();
|
|
451
|
+
const lastDate = new Date(dates[dates.length - 1]);
|
|
452
|
+
const earliest = new Date(lastDate);
|
|
453
|
+
earliest.setDate(earliest.getDate() - 364);
|
|
454
|
+
const firstDate = new Date(dates[0]) < earliest ? earliest : new Date(dates[0]);
|
|
455
|
+
|
|
456
|
+
const nonZero = dailyActivity
|
|
457
|
+
.map((d) => d.messageCount || 0)
|
|
458
|
+
.filter((n) => n > 0)
|
|
459
|
+
.sort((a, b) => a - b);
|
|
460
|
+
const q1 = nonZero[Math.floor(nonZero.length * 0.25)] || 1;
|
|
461
|
+
const q2 = nonZero[Math.floor(nonZero.length * 0.5)] || 2;
|
|
462
|
+
const q3 = nonZero[Math.floor(nonZero.length * 0.75)] || 3;
|
|
463
|
+
|
|
464
|
+
function level(count) {
|
|
465
|
+
if (count === 0) return "";
|
|
466
|
+
if (count <= q1) return " l1";
|
|
467
|
+
if (count <= q2) return " l2";
|
|
468
|
+
if (count <= q3) return " l3";
|
|
469
|
+
return " l4";
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
const start = new Date(firstDate);
|
|
473
|
+
start.setUTCDate(start.getUTCDate() - start.getUTCDay());
|
|
474
|
+
|
|
475
|
+
const months = [];
|
|
476
|
+
let lastMonth = -1;
|
|
477
|
+
const cursor1 = new Date(start);
|
|
478
|
+
let weekIdx = 0;
|
|
479
|
+
while (cursor1 <= lastDate) {
|
|
480
|
+
if (cursor1.getUTCDay() === 0) {
|
|
481
|
+
const m = cursor1.getUTCMonth();
|
|
482
|
+
if (m !== lastMonth) {
|
|
483
|
+
months.push({
|
|
484
|
+
name: cursor1.toLocaleString("en", { month: "short", timeZone: "UTC" }),
|
|
485
|
+
week: weekIdx,
|
|
486
|
+
});
|
|
487
|
+
lastMonth = m;
|
|
488
|
+
}
|
|
489
|
+
weekIdx++;
|
|
490
|
+
}
|
|
491
|
+
cursor1.setUTCDate(cursor1.getUTCDate() + 1);
|
|
492
|
+
}
|
|
493
|
+
const totalWeeks = weekIdx;
|
|
494
|
+
const monthLabels = months
|
|
495
|
+
.map((m) => {
|
|
496
|
+
const left = totalWeeks > 0 ? Math.round((m.week / totalWeeks) * 100) : 0;
|
|
497
|
+
return `<span class="heatmap-month" style="position:absolute;left:${left}%">${m.name}</span>`;
|
|
498
|
+
})
|
|
499
|
+
.join("");
|
|
500
|
+
|
|
501
|
+
let cells = "";
|
|
502
|
+
const cursor2 = new Date(start);
|
|
503
|
+
while (cursor2 <= lastDate) {
|
|
504
|
+
const key = cursor2.toISOString().slice(0, 10);
|
|
505
|
+
const count = dateMap.get(key) || 0;
|
|
506
|
+
cells += `<div class="heatmap-cell${level(count)}" title="${esc(key)}: ${count} messages"></div>`;
|
|
507
|
+
cursor2.setUTCDate(cursor2.getUTCDate() + 1);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
content += `<div class="label">Activity</div>
|
|
511
|
+
<div style="position:relative;margin-bottom:.5rem">
|
|
512
|
+
<div class="heatmap-months" style="position:relative;height:.8rem">${monthLabels}</div>
|
|
513
|
+
<div style="overflow-x:auto"><div class="heatmap">${cells}</div></div>
|
|
514
|
+
</div>`;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
// Peak hours
|
|
518
|
+
if (hasHours) {
|
|
519
|
+
const maxHour = Math.max(...Object.values(hourCounts), 1);
|
|
520
|
+
let bars = "";
|
|
521
|
+
let labels = "";
|
|
522
|
+
for (let h = 0; h < 24; h++) {
|
|
523
|
+
const count = hourCounts[String(h)] || 0;
|
|
524
|
+
const pct = Math.round((count / maxHour) * 100);
|
|
525
|
+
bars += `<div class="peak-bar" style="height:${Math.max(pct, 2)}%" title="${esc(String(h))}:00 — ${count} messages"></div>`;
|
|
526
|
+
labels += `<div class="peak-label">${h % 6 === 0 ? h : ""}</div>`;
|
|
527
|
+
}
|
|
528
|
+
content += `<div class="label" style="margin-top:.75rem">Peak Hours</div>
|
|
529
|
+
<div class="peak-hours">${bars}</div>
|
|
530
|
+
<div class="peak-labels">${labels}</div>`;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
// Model usage
|
|
534
|
+
if (ccusageData) {
|
|
535
|
+
const modelCosts = {};
|
|
536
|
+
for (const day of ccusageData.daily) {
|
|
537
|
+
for (const mb of day.modelBreakdowns || []) {
|
|
538
|
+
if (!modelCosts[mb.modelName]) modelCosts[mb.modelName] = { cost: 0, tokens: 0 };
|
|
539
|
+
modelCosts[mb.modelName].cost += mb.cost || 0;
|
|
540
|
+
modelCosts[mb.modelName].tokens +=
|
|
541
|
+
(mb.inputTokens || 0) +
|
|
542
|
+
(mb.outputTokens || 0) +
|
|
543
|
+
(mb.cacheCreationTokens || 0) +
|
|
544
|
+
(mb.cacheReadTokens || 0);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
const modelRows = Object.entries(modelCosts)
|
|
548
|
+
.sort((a, b) => b[1].cost - a[1].cost)
|
|
549
|
+
.map(
|
|
550
|
+
([name, data]) =>
|
|
551
|
+
`<div class="model-row"><span class="model-name">${esc(name)}</span><span class="model-tokens">$${Math.round(data.cost).toLocaleString()} · ${formatTokens(data.tokens)}</span></div>`,
|
|
552
|
+
)
|
|
553
|
+
.join("\n ");
|
|
554
|
+
|
|
555
|
+
const t = ccusageData.totals;
|
|
556
|
+
const breakdownHtml = `<div class="token-breakdown">
|
|
557
|
+
<div class="tb-row"><span class="tb-label">Cache Read</span><span class="tb-val">${formatTokens(t.cacheReadTokens)}</span></div>
|
|
558
|
+
<div class="tb-row"><span class="tb-label">Cache Creation</span><span class="tb-val">${formatTokens(t.cacheCreationTokens)}</span></div>
|
|
559
|
+
<div class="tb-row"><span class="tb-label">Output</span><span class="tb-val">${formatTokens(t.outputTokens)}</span></div>
|
|
560
|
+
<div class="tb-row"><span class="tb-label">Input</span><span class="tb-val">${formatTokens(t.inputTokens)}</span></div>
|
|
561
|
+
</div>`;
|
|
562
|
+
|
|
563
|
+
content += `<div class="label" style="margin-top:.75rem">Model Usage (via ccusage)</div>
|
|
564
|
+
${modelRows}
|
|
565
|
+
<div class="label" style="margin-top:.75rem">Token Breakdown</div>
|
|
566
|
+
${breakdownHtml}`;
|
|
567
|
+
} else if (hasModels) {
|
|
568
|
+
const modelRows = Object.entries(modelUsage)
|
|
569
|
+
.map(([name, usage]) => {
|
|
570
|
+
const total = (usage.inputTokens || 0) + (usage.outputTokens || 0);
|
|
571
|
+
return { name, total };
|
|
572
|
+
})
|
|
573
|
+
.sort((a, b) => b.total - a.total)
|
|
574
|
+
.map(
|
|
575
|
+
(m) =>
|
|
576
|
+
`<div class="model-row"><span class="model-name">${esc(m.name)}</span><span class="model-tokens">${formatTokens(m.total)}</span></div>`,
|
|
577
|
+
)
|
|
578
|
+
.join("\n ");
|
|
579
|
+
content += `<div class="label" style="margin-top:.75rem">Model Usage (partial — install ccusage for full data)</div>
|
|
580
|
+
${modelRows}`;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
return `<div class="card full">
|
|
584
|
+
<h2>Activity</h2>
|
|
585
|
+
${content}
|
|
586
|
+
</div>`;
|
|
587
|
+
})()}
|
|
588
|
+
<details class="card full">
|
|
589
|
+
<summary style="cursor:pointer;list-style:none"><h2 style="margin:0">Quick Reference</h2></summary>
|
|
590
|
+
<div style="margin-top:.75rem">
|
|
591
|
+
<div class="ref-grid">
|
|
592
|
+
<div class="ref-col">
|
|
593
|
+
<div class="label">Essential Commands</div>
|
|
594
|
+
${QUICK_REFERENCE.essentialCommands.map((c) => `<div class="ref-row"><code class="ref-cmd">${esc(c.cmd)}</code><span class="ref-desc">${esc(c.desc)}</span></div>`).join("\n ")}
|
|
595
|
+
</div>
|
|
596
|
+
<div class="ref-col">
|
|
597
|
+
<div class="label">Built-in Tools</div>
|
|
598
|
+
${QUICK_REFERENCE.tools.map((t) => `<div class="ref-row"><code class="ref-cmd">${esc(t.name)}</code><span class="ref-desc">${esc(t.desc)}</span></div>`).join("\n ")}
|
|
599
|
+
<div class="label" style="margin-top:.75rem">Keyboard Shortcuts</div>
|
|
600
|
+
${QUICK_REFERENCE.shortcuts.map((s) => `<div class="ref-row"><kbd class="ref-key">${esc(s.keys)}</kbd><span class="ref-desc">${esc(s.desc)}</span></div>`).join("\n ")}
|
|
601
|
+
</div>
|
|
602
|
+
</div>
|
|
603
|
+
</div>
|
|
604
|
+
</details>
|
|
605
|
+
${
|
|
606
|
+
chains.length
|
|
607
|
+
? `<div class="card full">
|
|
608
|
+
<h2>Dependency Chains</h2>
|
|
609
|
+
${chains.map((c) => `<div class="chain">${c.nodes.map((n, i) => `<span class="chain-node">${esc(n.trim())}</span>${i < c.nodes.length - 1 ? `<span class="chain-arrow">${c.arrow}</span>` : ""}`).join("")}</div>`).join("\n ")}
|
|
610
|
+
</div>`
|
|
611
|
+
: ""
|
|
612
|
+
}
|
|
613
|
+
</div>
|
|
614
|
+
|
|
615
|
+
${
|
|
616
|
+
consolidationGroups.length
|
|
617
|
+
? `<div class="card full" style="margin-bottom:1.25rem">
|
|
618
|
+
<h2>Consolidation Opportunities <span class="n">${consolidationGroups.length}</span></h2>
|
|
619
|
+
${consolidationGroups.map((g) => `<div class="consolidation-hint"><span class="consolidation-stack">${esc(g.stack)}</span> <span class="consolidation-text">${esc(g.suggestion)}</span></div>`).join("\n ")}
|
|
620
|
+
</div>`
|
|
621
|
+
: ""
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
<div class="search-bar">
|
|
625
|
+
<input type="text" id="search" placeholder="search repos..." autocomplete="off">
|
|
626
|
+
<span class="search-hint"><kbd>/</kbd></span>
|
|
627
|
+
</div>
|
|
628
|
+
<div class="group-controls">
|
|
629
|
+
<label class="group-label">Group by:</label>
|
|
630
|
+
<select id="group-by" class="group-select">
|
|
631
|
+
<option value="none">None</option>
|
|
632
|
+
<option value="stack">Tech Stack</option>
|
|
633
|
+
<option value="parent">Parent Directory</option>
|
|
634
|
+
</select>
|
|
635
|
+
</div>
|
|
636
|
+
|
|
637
|
+
<div class="repo-grid" id="repo-grid">
|
|
638
|
+
${configured.map((r) => renderRepoCard(r)).join("\n")}
|
|
639
|
+
</div>
|
|
640
|
+
|
|
641
|
+
${
|
|
642
|
+
unconfigured.length
|
|
643
|
+
? `<details class="card" style="margin-bottom:1.25rem">
|
|
644
|
+
<summary style="cursor:pointer;list-style:none"><h2 style="margin:0">Unconfigured Repos <span class="n">${unconfiguredCount}</span></h2></summary>
|
|
645
|
+
<div style="margin-top:.75rem">
|
|
646
|
+
<div class="unconfigured-grid">
|
|
647
|
+
${unconfigured
|
|
648
|
+
.map((r) => {
|
|
649
|
+
const stackTag =
|
|
650
|
+
r.techStack && r.techStack.length
|
|
651
|
+
? `<span class="stack-tag">${esc(r.techStack.join(", "))}</span>`
|
|
652
|
+
: "";
|
|
653
|
+
const suggestionsHtml =
|
|
654
|
+
r.suggestions && r.suggestions.length
|
|
655
|
+
? `<div class="suggestion-hints">${r.suggestions.map((s) => `<span class="suggestion-hint">${esc(s)}</span>`).join("")}</div>`
|
|
656
|
+
: "";
|
|
657
|
+
return `<div class="unconfigured-item">${esc(r.name)}${stackTag}<span class="upath">${esc(r.shortPath)}</span>${suggestionsHtml}</div>`;
|
|
658
|
+
})
|
|
659
|
+
.join("\n ")}
|
|
660
|
+
</div>
|
|
661
|
+
</div>
|
|
662
|
+
</details>`
|
|
663
|
+
: ""
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
<div class="ts">found ${totalRepos} repos · ${configuredCount} configured · ${unconfiguredCount} unconfigured · scanned ${scanScope} · ${timestamp}</div>
|
|
667
|
+
|
|
668
|
+
<script>
|
|
669
|
+
const input = document.getElementById('search');
|
|
670
|
+
const hint = document.querySelector('.search-hint');
|
|
671
|
+
|
|
672
|
+
input.addEventListener('input', function(e) {
|
|
673
|
+
const q = e.target.value.toLowerCase();
|
|
674
|
+
hint.style.display = q ? 'none' : '';
|
|
675
|
+
document.querySelectorAll('.repo-card').forEach(function(card) {
|
|
676
|
+
const name = card.dataset.name.toLowerCase();
|
|
677
|
+
const path = (card.dataset.path || '').toLowerCase();
|
|
678
|
+
const text = card.textContent.toLowerCase();
|
|
679
|
+
card.style.display = (q === '' || name.includes(q) || path.includes(q) || text.includes(q)) ? '' : 'none';
|
|
680
|
+
});
|
|
681
|
+
});
|
|
682
|
+
|
|
683
|
+
document.addEventListener('keydown', function(e) {
|
|
684
|
+
if (e.key === '/' && document.activeElement !== input) {
|
|
685
|
+
e.preventDefault();
|
|
686
|
+
input.focus();
|
|
687
|
+
}
|
|
688
|
+
if (e.key === 'Escape' && document.activeElement === input) {
|
|
689
|
+
input.value = '';
|
|
690
|
+
input.dispatchEvent(new Event('input'));
|
|
691
|
+
input.blur();
|
|
692
|
+
}
|
|
693
|
+
});
|
|
694
|
+
|
|
695
|
+
var toggle = document.getElementById('theme-toggle');
|
|
696
|
+
var saved = localStorage.getItem('ccd-theme');
|
|
697
|
+
if (saved) document.documentElement.setAttribute('data-theme', saved);
|
|
698
|
+
else if (window.matchMedia('(prefers-color-scheme: light)').matches) {
|
|
699
|
+
document.documentElement.setAttribute('data-theme', 'light');
|
|
700
|
+
}
|
|
701
|
+
toggle.addEventListener('click', function() {
|
|
702
|
+
var current = document.documentElement.getAttribute('data-theme');
|
|
703
|
+
var next = current === 'light' ? 'dark' : 'light';
|
|
704
|
+
document.documentElement.setAttribute('data-theme', next);
|
|
705
|
+
localStorage.setItem('ccd-theme', next);
|
|
706
|
+
});
|
|
707
|
+
|
|
708
|
+
var groupSelect = document.getElementById('group-by');
|
|
709
|
+
groupSelect.addEventListener('change', function() {
|
|
710
|
+
var mode = this.value;
|
|
711
|
+
var grid = document.getElementById('repo-grid');
|
|
712
|
+
grid.querySelectorAll('.group-heading').forEach(function(h) { h.remove(); });
|
|
713
|
+
var cards = Array.from(grid.querySelectorAll('.repo-card'));
|
|
714
|
+
if (mode === 'none') {
|
|
715
|
+
cards.forEach(function(c) { grid.appendChild(c); });
|
|
716
|
+
return;
|
|
717
|
+
}
|
|
718
|
+
var groups = {};
|
|
719
|
+
cards.forEach(function(card) {
|
|
720
|
+
if (mode === 'stack') {
|
|
721
|
+
var stacks = (card.dataset.stack || 'undetected').split(',');
|
|
722
|
+
stacks.forEach(function(s) {
|
|
723
|
+
var key = s.trim() || 'undetected';
|
|
724
|
+
if (!groups[key]) groups[key] = [];
|
|
725
|
+
groups[key].push(card);
|
|
726
|
+
});
|
|
727
|
+
} else {
|
|
728
|
+
var key = card.dataset.parent || '~/';
|
|
729
|
+
if (!groups[key]) groups[key] = [];
|
|
730
|
+
groups[key].push(card);
|
|
731
|
+
}
|
|
732
|
+
});
|
|
733
|
+
Object.keys(groups).sort().forEach(function(key) {
|
|
734
|
+
var h = document.createElement('div');
|
|
735
|
+
h.className = 'group-heading';
|
|
736
|
+
h.textContent = key || '(none)';
|
|
737
|
+
grid.appendChild(h);
|
|
738
|
+
groups[key].forEach(function(card) { grid.appendChild(card); });
|
|
739
|
+
});
|
|
740
|
+
});
|
|
741
|
+
</script>
|
|
742
|
+
</body>
|
|
743
|
+
</html>`;
|
|
744
|
+
}
|