skilltally 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.
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/CHANGELOG.md +9 -0
- package/README.md +3 -2
- package/bin/track.mjs +168 -4
- package/gemini-extension.json +1 -1
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/skills/skilltally/SKILL.md +1 -1
- package/src/backfill/antigravity.mjs +85 -31
- package/src/backfill/claude.mjs +58 -5
- package/src/backfill/codex.mjs +56 -2
- package/src/backfill/gemini.mjs +66 -3
- package/src/backfill/index.mjs +7 -5
- package/src/core/config.mjs +2 -0
- package/src/core/detect.mjs +2 -0
- package/src/inventory/scan.mjs +3 -1
- package/src/report/aggregate.mjs +215 -1
- package/src/report/dashboard.mjs +64 -6
- package/src/report/format.mjs +53 -0
package/src/report/dashboard.mjs
CHANGED
|
@@ -116,7 +116,7 @@ export function generateDashboardHtml({
|
|
|
116
116
|
.brand-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
|
|
117
117
|
.top-links { display: flex; align-items: center; gap: 16px; }
|
|
118
118
|
|
|
119
|
-
/* Text link buttons (
|
|
119
|
+
/* Text link buttons (profile switcher pattern) */
|
|
120
120
|
.text-tab {
|
|
121
121
|
background: none; border: none; padding: 0; margin: 0;
|
|
122
122
|
font: inherit; font-size: 13px; font-weight: 400;
|
|
@@ -459,11 +459,25 @@ export function generateDashboardHtml({
|
|
|
459
459
|
};
|
|
460
460
|
const fmtCompact = (n) => {
|
|
461
461
|
const v = Number(n || 0);
|
|
462
|
+
if (v >= 1_000_000_000) return (v / 1_000_000_000).toFixed(1).replace(/\\.0$/, '') + 'B';
|
|
462
463
|
if (v >= 1_000_000) return (v / 1_000_000).toFixed(1).replace(/\\.0$/, '') + 'M';
|
|
463
|
-
if (v >= 10_000) return (v / 1_000).toFixed(1).replace(/\\.0$/, '') + 'K';
|
|
464
464
|
if (v >= 1_000) return (v / 1_000).toFixed(1).replace(/\\.0$/, '') + 'K';
|
|
465
465
|
return String(v);
|
|
466
466
|
};
|
|
467
|
+
const fmtDuration = (seconds) => {
|
|
468
|
+
const sec = Number(seconds || 0);
|
|
469
|
+
if (!Number.isFinite(sec) || sec <= 0) return '0s';
|
|
470
|
+
const rounded = Math.round(sec);
|
|
471
|
+
if (rounded < 60) return rounded + 's';
|
|
472
|
+
if (rounded < 3600) {
|
|
473
|
+
const m = Math.floor(rounded / 60);
|
|
474
|
+
const s = rounded % 60;
|
|
475
|
+
return s > 0 ? m + 'm ' + s + 's' : m + 'm';
|
|
476
|
+
}
|
|
477
|
+
const h = Math.floor(rounded / 3600);
|
|
478
|
+
const m = Math.floor((rounded % 3600) / 60);
|
|
479
|
+
return m > 0 ? h + 'h ' + m + 'm' : h + 'h';
|
|
480
|
+
};
|
|
467
481
|
|
|
468
482
|
const tooltip = document.getElementById('tooltip');
|
|
469
483
|
function showTip(evt, html) {
|
|
@@ -539,18 +553,20 @@ export function generateDashboardHtml({
|
|
|
539
553
|
}
|
|
540
554
|
}
|
|
541
555
|
|
|
542
|
-
// 1. 5-Metric Pill Strip
|
|
556
|
+
// 1. 5-Metric Pill Strip (Profile layout)
|
|
543
557
|
const totals = stats.totals || {};
|
|
544
558
|
const inv = stats.inventory || {};
|
|
545
559
|
const unused = stats.unused || {};
|
|
560
|
+
const tokStats = totals.tokens || {};
|
|
561
|
+
const durStats = totals.duration || {};
|
|
546
562
|
const enabledTok = inv.enabledEstTokens || 0;
|
|
547
563
|
const unusedTok = unused.totalEstTokens || 0;
|
|
548
564
|
const wastePct = enabledTok > 0 ? Math.round((unusedTok / enabledTok) * 100) : 0;
|
|
549
565
|
|
|
550
566
|
document.getElementById('kpi-strip').innerHTML = [
|
|
551
|
-
{ val: fmtCompact(
|
|
552
|
-
{ val: fmtCompact(
|
|
553
|
-
{ val:
|
|
567
|
+
{ val: fmtCompact(tokStats.lifetimeTokens || 0), lbl: 'Lifetime tokens' },
|
|
568
|
+
{ val: fmtCompact(tokStats.peakSessionTokens || 0), lbl: 'Peak tokens' },
|
|
569
|
+
{ val: fmtDuration(durStats.longestTaskSeconds || 0), lbl: 'Longest task' },
|
|
554
570
|
{ val: longestStreak + (longestStreak === 1 ? ' day' : ' days'), lbl: 'Longest streak' },
|
|
555
571
|
{ val: currentStreak + (currentStreak === 1 ? ' day' : ' days'), lbl: 'Current streak' }
|
|
556
572
|
].map((k) => \`
|
|
@@ -957,8 +973,16 @@ export function generateDashboardHtml({
|
|
|
957
973
|
const ins = stats.insights || {};
|
|
958
974
|
const projCands = ins.projectScopeCandidates || [];
|
|
959
975
|
const manualOnly = ins.manualOnlySkills || [];
|
|
976
|
+
const heavyBodies = ins.heavyBodySkills || [];
|
|
977
|
+
const slowestSkills = ins.slowestSkills || [];
|
|
978
|
+
const promptPatterns = ins.promptPatterns || [];
|
|
979
|
+
const cachePct = tokStats.total > 0 ? Math.round((tokStats.cacheHitRate || 0) * 100) + '%' : '—';
|
|
960
980
|
|
|
961
981
|
const overviewRows = [
|
|
982
|
+
['Prompt cache hit rate', cachePct],
|
|
983
|
+
['Active skill body tokens', '~' + fmtCompact(tokStats.activeBodyTokens || 0) + ' tok loaded'],
|
|
984
|
+
['Total time automated', fmtDuration(durStats.totalSeconds || 0)],
|
|
985
|
+
['Heavy SKILL.md bodies', heavyBodies.length + (heavyBodies.length === 1 ? ' skill' : ' skills')],
|
|
962
986
|
['Auto-discovery rate', autoPct + '% of runs'],
|
|
963
987
|
['Most active host', topHost ? \`\${topHost.name} · \${topHost.pct}%\` : '—'],
|
|
964
988
|
['Most used model', topModel ? \`\${topModel.name} · \${topModel.pct}%\` : '—'],
|
|
@@ -967,6 +991,7 @@ export function generateDashboardHtml({
|
|
|
967
991
|
['Single-project global skills', projCands.length + (projCands.length === 1 ? ' candidate' : ' candidates')],
|
|
968
992
|
['Manual-only skills', String(manualOnly.length)],
|
|
969
993
|
['Skills explored', String(inv.used || 0)],
|
|
994
|
+
['Total skills used', String(totals.events || 0)],
|
|
970
995
|
['Total skills installed', String(inv.enabled || 0)],
|
|
971
996
|
];
|
|
972
997
|
|
|
@@ -1059,6 +1084,39 @@ export function generateDashboardHtml({
|
|
|
1059
1084
|
</div>
|
|
1060
1085
|
\`);
|
|
1061
1086
|
}
|
|
1087
|
+
for (const h of heavyBodies.slice(0, 5)) {
|
|
1088
|
+
pruneRows.push(\`
|
|
1089
|
+
<div class="rec-row">
|
|
1090
|
+
<div>
|
|
1091
|
+
<div><strong>\${esc(h.skill)}</strong> · heavy SKILL.md body</div>
|
|
1092
|
+
<div class="rec-sub">Split ~\${h.body_tokens.toLocaleString()} tok into references/ (\${h.activations} act)</div>
|
|
1093
|
+
</div>
|
|
1094
|
+
<span class="brand-meta">~\${h.body_tokens.toLocaleString()} tok/read</span>
|
|
1095
|
+
</div>
|
|
1096
|
+
\`);
|
|
1097
|
+
}
|
|
1098
|
+
for (const s of slowestSkills.slice(0, 5)) {
|
|
1099
|
+
pruneRows.push(\`
|
|
1100
|
+
<div class="rec-row">
|
|
1101
|
+
<div>
|
|
1102
|
+
<div><strong>\${esc(s.skill)}</strong> · longest/slowest task</div>
|
|
1103
|
+
<div class="rec-sub">Avg \${fmtDuration(s.avg_duration_seconds)} across \${s.activations} activation(s)</div>
|
|
1104
|
+
</div>
|
|
1105
|
+
<span class="brand-meta">\${fmtDuration(s.total_duration_seconds)} total</span>
|
|
1106
|
+
</div>
|
|
1107
|
+
\`);
|
|
1108
|
+
}
|
|
1109
|
+
for (const p of promptPatterns.slice(0, 5)) {
|
|
1110
|
+
pruneRows.push(\`
|
|
1111
|
+
<div class="rec-row">
|
|
1112
|
+
<div>
|
|
1113
|
+
<div><strong>"\${esc(p.prompt)}"</strong></div>
|
|
1114
|
+
<div class="rec-sub">Triggered: \${esc(p.skills.join(', '))}</div>
|
|
1115
|
+
</div>
|
|
1116
|
+
<span class="brand-meta">\${p.count}x</span>
|
|
1117
|
+
</div>
|
|
1118
|
+
\`);
|
|
1119
|
+
}
|
|
1062
1120
|
document.getElementById('panel-pruning').innerHTML = pruneRows.length > 0
|
|
1063
1121
|
? pruneRows.join('')
|
|
1064
1122
|
: '<div class="brand-meta">No pruning or optimization candidates detected.</div>';
|
package/src/report/format.mjs
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { formatDurationCompact } from './aggregate.mjs';
|
|
2
|
+
|
|
1
3
|
function padRight(str, len) {
|
|
2
4
|
const s = String(str);
|
|
3
5
|
return s.length >= len ? s : s + ' '.repeat(len - s.length);
|
|
@@ -447,6 +449,57 @@ export function formatInsights(report) {
|
|
|
447
449
|
}
|
|
448
450
|
}
|
|
449
451
|
|
|
452
|
+
// 5. Token Telemetry, Cache Efficiency & Heavy SKILL.md Bodies
|
|
453
|
+
const tok = report.totals?.tokens || {};
|
|
454
|
+
const heavy = report.insights?.heavyBodySkills || [];
|
|
455
|
+
if (tok.total > 0 || tok.activeBodyTokens > 0 || heavy.length > 0) {
|
|
456
|
+
lines.push('');
|
|
457
|
+
lines.push('5. Token Telemetry & Heavy SKILL.md Bodies');
|
|
458
|
+
if (tok.total > 0) {
|
|
459
|
+
const cachePct = Math.round((tok.cacheHitRate || 0) * 100);
|
|
460
|
+
lines.push(
|
|
461
|
+
` recorded tokens: ${tok.total.toLocaleString()} (in: ${tok.input.toLocaleString()}, out: ${tok.output.toLocaleString()}, cache_read: ${tok.cacheRead.toLocaleString()}, cache hit: ${cachePct}%)`
|
|
462
|
+
);
|
|
463
|
+
}
|
|
464
|
+
if (tok.activeBodyTokens > 0) {
|
|
465
|
+
lines.push(` active skill body load: ~${tok.activeBodyTokens.toLocaleString()} tok across activations`);
|
|
466
|
+
}
|
|
467
|
+
if (heavy.length > 0) {
|
|
468
|
+
lines.push(' Heavy SKILL.md bodies (>=1,500 tok — consider splitting into references/):');
|
|
469
|
+
for (const h of heavy.slice(0, 6)) {
|
|
470
|
+
lines.push(
|
|
471
|
+
` ${h.skill} (${h.source}) — ~${h.body_tokens.toLocaleString()} tok/read (${h.activations} act)`
|
|
472
|
+
);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
// 6. Skill Execution Duration
|
|
478
|
+
const dur = report.totals?.duration || {};
|
|
479
|
+
const slowest = report.insights?.slowestSkills || [];
|
|
480
|
+
if (dur.totalSeconds > 0 || dur.longestTaskSeconds > 0 || slowest.length > 0) {
|
|
481
|
+
lines.push('');
|
|
482
|
+
lines.push('6. Skill Execution Duration');
|
|
483
|
+
lines.push(
|
|
484
|
+
` total time automated: ${formatDurationCompact(dur.totalSeconds)} · longest task: ${formatDurationCompact(dur.longestTaskSeconds)}`
|
|
485
|
+
);
|
|
486
|
+
for (const s of slowest.slice(0, 6)) {
|
|
487
|
+
lines.push(
|
|
488
|
+
` ${s.skill} — total ${formatDurationCompact(s.total_duration_seconds)} (avg ${formatDurationCompact(s.avg_duration_seconds)}, ${s.activations} act)`
|
|
489
|
+
);
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
// 7. Common Prompt Triggers (when store_prompts is enabled)
|
|
494
|
+
const prompts = report.insights?.promptPatterns || [];
|
|
495
|
+
if (prompts.length > 0) {
|
|
496
|
+
lines.push('');
|
|
497
|
+
lines.push('7. Common Prompt Triggers');
|
|
498
|
+
for (const p of prompts.slice(0, 8)) {
|
|
499
|
+
lines.push(` ${p.count}x "${p.prompt}" -> ${p.skills.join(', ')}`);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
|
|
450
503
|
return lines.join('\n');
|
|
451
504
|
}
|
|
452
505
|
|