opencode-statboard 2.9.5 → 2.10.4
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/fix-port-final.js +86 -0
- package/fix-port-final10.js +79 -0
- package/fix-port-final11.js +79 -0
- package/fix-port-final12.js +79 -0
- package/fix-port-final13.js +79 -0
- package/fix-port-final14.js +79 -0
- package/fix-port-final15.js +79 -0
- package/fix-port-final16.js +79 -0
- package/fix-port-final17.js +79 -0
- package/fix-port-final18.js +79 -0
- package/fix-port-final19.js +79 -0
- package/fix-port-final2.js +79 -0
- package/fix-port-final20.js +79 -0
- package/fix-port-final21.js +79 -0
- package/fix-port-final22.js +79 -0
- package/fix-port-final23.js +79 -0
- package/fix-port-final3.js +79 -0
- package/fix-port-final5.js +79 -0
- package/fix-port-final7.js +79 -0
- package/fix-port-final8.js +79 -0
- package/fix-port-final9.js +79 -0
- package/fix-port-v2.js +58 -0
- package/fix-port-v3.js +79 -0
- package/fix-port.js +32 -0
- package/package.json +11 -5
- package/public/index.html +72 -13
- package/server.js +9 -20
- package/tui-dashboard.js +615 -0
package/public/index.html
CHANGED
|
@@ -92,18 +92,37 @@
|
|
|
92
92
|
.trend-wrap > div { flex: 1; min-width: 300px; }
|
|
93
93
|
.trend-wrap #costSection { min-width: 240px; }
|
|
94
94
|
.heatmap-wrap { display: flex; flex-direction: column; gap: 8px; }
|
|
95
|
-
.heatmap-months { display: flex; gap: 2px; padding-left:
|
|
95
|
+
.heatmap-months { display: flex; gap: 2px; padding-left: 28px; font-size: 11px; color: var(--muted); }
|
|
96
96
|
.heatmap-months span { flex: 1; text-align: left; overflow: visible; white-space: nowrap; }
|
|
97
97
|
.heatmap-grid { display: flex; gap: 2px; }
|
|
98
98
|
.heatmap-grid .hm-week { display: flex; flex-direction: column; gap: 2px; }
|
|
99
|
-
.hm-cell { width:
|
|
99
|
+
.hm-cell { width: 14px; height: 14px; border-radius: 2px; background: var(--card2); border: 1px solid var(--border); box-sizing: border-box; }
|
|
100
|
+
/* Heatmap color scale: 10 levels from cool to hot */
|
|
100
101
|
.hm-cell.hm-0 { background: var(--card2); }
|
|
101
|
-
.hm-cell.hm-1 { background:
|
|
102
|
-
.hm-cell.hm-2 { background:
|
|
103
|
-
.hm-cell.hm-
|
|
104
|
-
.hm-cell.hm-
|
|
105
|
-
.
|
|
106
|
-
.
|
|
102
|
+
.hm-cell.hm-1 { background: #0d47a1; } /* Deep blue */
|
|
103
|
+
.hm-cell.hm-2 { background: #1565c0; }
|
|
104
|
+
.hm-cell.hm-2 { background: #1976d2; }
|
|
105
|
+
.hm-cell.hm-3 { background: #1e88e5; }
|
|
106
|
+
.hm-cell.hm-4 { background: #2196f3; }
|
|
107
|
+
.hm-cell.hm-5 { background: #64b5f6; }
|
|
108
|
+
.hm-cell.hm-6 { background: #90caf9; }
|
|
109
|
+
.hm-cell.hm-7 { background: #bbdefb; }
|
|
110
|
+
.hm-cell.hm-8 { background: #e3f2fd; }
|
|
111
|
+
.hm-cell.hm-9 { background: #fff3e0; }
|
|
112
|
+
.hm-cell.hm-10 { background: #ffe0b2; }
|
|
113
|
+
.hm-cell.hm-11 { background: #ffcc80; }
|
|
114
|
+
.hm-cell.hm-12 { background: #ffb74d; }
|
|
115
|
+
.hm-cell.hm-13 { background: #ffa726; }
|
|
116
|
+
.hm-cell.hm-14 { background: #ff9800; }
|
|
117
|
+
.hm-cell.hm-15 { background: #fb8c00; }
|
|
118
|
+
.hm-cell.hm-16 { background: #f57c00; }
|
|
119
|
+
.hm-cell.hm-17 { background: #ef6c00; }
|
|
120
|
+
.hm-cell.hm-18 { background: #e65100; }
|
|
121
|
+
.hm-cell.hm-19 { background: #d84315; }
|
|
122
|
+
.hm-cell.hm-20 { background: #c62828; }
|
|
123
|
+
.hm-cell.hm-21 { background: #b71c1c; }
|
|
124
|
+
.heatmap-legend { display: flex; gap: 4px; align-items: center; font-size: 11px; color: var(--muted); flex-wrap: wrap; }
|
|
125
|
+
.heatmap-legend .hm-cell { width: 12px; height: 12px; }
|
|
107
126
|
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-bottom: 12px; flex-wrap: wrap; }
|
|
108
127
|
.legend span { display: flex; align-items: center; gap: 6px; }
|
|
109
128
|
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
|
|
@@ -244,10 +263,16 @@
|
|
|
244
263
|
<div class="heatmap-legend">
|
|
245
264
|
<span data-i18n="less">Less</span>
|
|
246
265
|
<span class="hm-cell hm-0"></span>
|
|
247
|
-
<span class="hm-cell hm-1"></span>
|
|
248
266
|
<span class="hm-cell hm-2"></span>
|
|
249
|
-
<span class="hm-cell hm-3"></span>
|
|
250
267
|
<span class="hm-cell hm-4"></span>
|
|
268
|
+
<span class="hm-cell hm-6"></span>
|
|
269
|
+
<span class="hm-cell hm-8"></span>
|
|
270
|
+
<span class="hm-cell hm-10"></span>
|
|
271
|
+
<span class="hm-cell hm-12"></span>
|
|
272
|
+
<span class="hm-cell hm-14"></span>
|
|
273
|
+
<span class="hm-cell hm-16"></span>
|
|
274
|
+
<span class="hm-cell hm-18"></span>
|
|
275
|
+
<span class="hm-cell hm-20"></span>
|
|
251
276
|
<span data-i18n="more">More</span>
|
|
252
277
|
</div>
|
|
253
278
|
</div>
|
|
@@ -821,9 +846,27 @@ function renderHeatmap(data) {
|
|
|
821
846
|
const levelOf = (v) => {
|
|
822
847
|
if (!v || v <= 0) return 0;
|
|
823
848
|
const r = v / max;
|
|
824
|
-
|
|
825
|
-
if (r >= 0.
|
|
826
|
-
if (r >= 0.
|
|
849
|
+
// 20 levels for smooth gradient
|
|
850
|
+
if (r >= 0.95) return 20;
|
|
851
|
+
if (r >= 0.90) return 19;
|
|
852
|
+
if (r >= 0.85) return 18;
|
|
853
|
+
if (r >= 0.80) return 17;
|
|
854
|
+
if (r >= 0.75) return 16;
|
|
855
|
+
if (r >= 0.70) return 15;
|
|
856
|
+
if (r >= 0.65) return 14;
|
|
857
|
+
if (r >= 0.60) return 13;
|
|
858
|
+
if (r >= 0.55) return 12;
|
|
859
|
+
if (r >= 0.50) return 11;
|
|
860
|
+
if (r >= 0.45) return 10;
|
|
861
|
+
if (r >= 0.40) return 9;
|
|
862
|
+
if (r >= 0.35) return 9;
|
|
863
|
+
if (r >= 0.30) return 8;
|
|
864
|
+
if (r >= 0.25) return 7;
|
|
865
|
+
if (r >= 0.20) return 6;
|
|
866
|
+
if (r >= 0.15) return 5;
|
|
867
|
+
if (r >= 0.10) return 4;
|
|
868
|
+
if (r >= 0.05) return 3;
|
|
869
|
+
if (r >= 0.02) return 2;
|
|
827
870
|
return 1;
|
|
828
871
|
};
|
|
829
872
|
grid.innerHTML = weeks.map((w) => '<div class="hm-week">' +
|
|
@@ -924,6 +967,7 @@ async function poll() {
|
|
|
924
967
|
const time = new Date().toLocaleTimeString(lang === 'zh-TW' ? 'zh-TW' : 'en', { hour12: false });
|
|
925
968
|
lastUpdatedText = t('lastUpdated') + ' ' + time + ' (' + t('dataAgo') + ' ' + ago + 's)';
|
|
926
969
|
$('updated').textContent = lastUpdatedText;
|
|
970
|
+
refreshCurrentReport(); // auto-refresh report panels
|
|
927
971
|
return j;
|
|
928
972
|
} catch (e) {
|
|
929
973
|
$('updated').textContent = t('connFail') + ': ' + e.message;
|
|
@@ -932,6 +976,21 @@ async function poll() {
|
|
|
932
976
|
}
|
|
933
977
|
}
|
|
934
978
|
|
|
979
|
+
// Auto-refresh the current scope report when poll succeeds (so all panels stay fresh)
|
|
980
|
+
// Debounced to avoid hammering the API if poll runs frequently
|
|
981
|
+
let reportRefreshDebounce = null;
|
|
982
|
+
async function refreshCurrentReport() {
|
|
983
|
+
if (reportRefreshDebounce) clearTimeout(reportRefreshDebounce);
|
|
984
|
+
reportRefreshDebounce = setTimeout(async () => {
|
|
985
|
+
if (window.__lastReport) {
|
|
986
|
+
try {
|
|
987
|
+
const r = await loadReport(scopeDays);
|
|
988
|
+
if (r) renderReport(r);
|
|
989
|
+
} catch (_) {}
|
|
990
|
+
}
|
|
991
|
+
}, 500); // debounce 500ms
|
|
992
|
+
}
|
|
993
|
+
|
|
935
994
|
let reportLoading = false;
|
|
936
995
|
let reportRetry = 0;
|
|
937
996
|
const MAX_REPORT_RETRIES = 12;
|
package/server.js
CHANGED
|
@@ -1535,33 +1535,22 @@ setInterval(() => {
|
|
|
1535
1535
|
try { autoBackupIfDue(); } catch (_) {}
|
|
1536
1536
|
}, CACHE_CLEANUP_MS);
|
|
1537
1537
|
|
|
1538
|
-
function
|
|
1539
|
-
return new Promise((resolve) => {
|
|
1540
|
-
server.
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
server.removeAllListeners('error');
|
|
1544
|
-
if (port < (maxPort || port + 5)) {
|
|
1545
|
-
resolve(tryListen(port + 1, maxPort));
|
|
1546
|
-
} else {
|
|
1547
|
-
console.error(`all ports ${PORT}-${maxPort || PORT + 5} in use`);
|
|
1548
|
-
process.exit(1);
|
|
1549
|
-
}
|
|
1550
|
-
} else {
|
|
1551
|
-
console.error(e);
|
|
1552
|
-
process.exit(1);
|
|
1553
|
-
}
|
|
1538
|
+
async function startServer() {
|
|
1539
|
+
return new Promise((resolve, reject) => {
|
|
1540
|
+
server.listen(PORT, '127.0.0.1', () => {
|
|
1541
|
+
console.log('opencode stats dashboard: http://127.0.0.1:' + PORT);
|
|
1542
|
+
resolve(PORT);
|
|
1554
1543
|
});
|
|
1555
|
-
server.
|
|
1556
|
-
console.
|
|
1557
|
-
|
|
1544
|
+
server.once('error', (e) => {
|
|
1545
|
+
console.error('Server error:', e.message);
|
|
1546
|
+
process.exit(1);
|
|
1558
1547
|
});
|
|
1559
1548
|
});
|
|
1560
1549
|
}
|
|
1561
1550
|
|
|
1562
1551
|
(async () => {
|
|
1563
1552
|
try {
|
|
1564
|
-
|
|
1553
|
+
await startServer();
|
|
1565
1554
|
// Serve the persisted bundle + tool counts IMMEDIATELY. Nothing on this
|
|
1566
1555
|
// path touches the live DB, so the first request answers in milliseconds
|
|
1567
1556
|
// instead of waiting out a 3-29s scan.
|