quotacap 0.0.17 → 0.0.18
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/dist/format/table.js
CHANGED
|
@@ -28,15 +28,15 @@ export function renderQuotasTable(quotas, advisories = []) {
|
|
|
28
28
|
: null;
|
|
29
29
|
if (!rate)
|
|
30
30
|
return "—";
|
|
31
|
-
//
|
|
32
|
-
//
|
|
31
|
+
// Verdict against the ideal rate: outside the +-20% band the cell says
|
|
32
|
+
// (fast)/(slow); inside it a single-width check mark.
|
|
33
33
|
const value = a?.burnMeasured ? a.burnRate : q.periodStart ? (q.usedPct ?? 0) / Math.max(0.1, (Date.now() - new Date(q.periodStart).getTime()) / 86400000) : null;
|
|
34
34
|
const ideal = a?.idealRate;
|
|
35
35
|
if (ideal != null && value != null) {
|
|
36
|
-
if (value > ideal)
|
|
37
|
-
return `${rate}
|
|
36
|
+
if (value > ideal * 1.2)
|
|
37
|
+
return `${rate} (fast)`;
|
|
38
38
|
if (value < ideal * 0.8)
|
|
39
|
-
return `${rate}
|
|
39
|
+
return `${rate} (slow)`;
|
|
40
40
|
return `${rate} ✔`;
|
|
41
41
|
}
|
|
42
42
|
return rate;
|
package/dist/src/format/table.js
CHANGED
|
@@ -28,15 +28,15 @@ export function renderQuotasTable(quotas, advisories = []) {
|
|
|
28
28
|
: null;
|
|
29
29
|
if (!rate)
|
|
30
30
|
return "—";
|
|
31
|
-
//
|
|
32
|
-
//
|
|
31
|
+
// Verdict against the ideal rate: outside the +-20% band the cell says
|
|
32
|
+
// (fast)/(slow); inside it a single-width check mark.
|
|
33
33
|
const value = a?.burnMeasured ? a.burnRate : q.periodStart ? (q.usedPct ?? 0) / Math.max(0.1, (Date.now() - new Date(q.periodStart).getTime()) / 86400000) : null;
|
|
34
34
|
const ideal = a?.idealRate;
|
|
35
35
|
if (ideal != null && value != null) {
|
|
36
|
-
if (value > ideal)
|
|
37
|
-
return `${rate}
|
|
36
|
+
if (value > ideal * 1.2)
|
|
37
|
+
return `${rate} (fast)`;
|
|
38
38
|
if (value < ideal * 0.8)
|
|
39
|
-
return `${rate}
|
|
39
|
+
return `${rate} (slow)`;
|
|
40
40
|
return `${rate} ✔`;
|
|
41
41
|
}
|
|
42
42
|
return rate;
|
package/dist/src/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// generated by scripts/build-embed.mjs — do not edit
|
|
2
|
-
export const VERSION = "0.0.
|
|
2
|
+
export const VERSION = "0.0.18";
|
|
@@ -12,7 +12,7 @@ describe("format table", () => {
|
|
|
12
12
|
];
|
|
13
13
|
const table = renderQuotasTable(quotas, advisories);
|
|
14
14
|
expect(table).toMatch(/\| Provider \| Used \| Left \| Resets \| Days left \| Ideal daily burn \| Burn rate \| Waste if unused \|/);
|
|
15
|
-
expect(table).toMatch(/\| kimi \| 16% \| 84% \|.*\| 3.0 \| 28%\/day \| 40.0%\/day
|
|
15
|
+
expect(table).toMatch(/\| kimi \| 16% \| 84% \|.*\| 3.0 \| 28%\/day \| 40.0%\/day \(fast\) \| 78% \|/);
|
|
16
16
|
expect(table).toMatch(/\| claude \| 37% \| 63% \|.*\| 5.5 \| 12%\/day \| — \| 53% \|/);
|
|
17
17
|
});
|
|
18
18
|
it("renders quota-only rows with placeholders when no advisories exist", () => {
|
|
@@ -36,7 +36,7 @@ describe("format table", () => {
|
|
|
36
36
|
{ provider: "kimi", wastePct: 78.0, daysLeft: 2.9, idealRate: 29.0, burnRate: 2, burnMeasured: false, status: "on track" },
|
|
37
37
|
];
|
|
38
38
|
const table = renderQuotasTable(quotas, advisories);
|
|
39
|
-
expect(table).toMatch(/4.0%\/day avg
|
|
39
|
+
expect(table).toMatch(/4.0%\/day avg \(slow\)/);
|
|
40
40
|
});
|
|
41
41
|
it("prefers the measured burn over the period average", () => {
|
|
42
42
|
const now = Date.now();
|
|
@@ -47,10 +47,10 @@ describe("format table", () => {
|
|
|
47
47
|
{ provider: "claude", wastePct: 0, daysLeft: 5.4, idealRate: 10.0, burnRate: 25.3, burnMeasured: true, status: "at risk" },
|
|
48
48
|
];
|
|
49
49
|
const table = renderQuotasTable(quotas, advisories);
|
|
50
|
-
expect(table).toMatch(/\| 25.3%\/day
|
|
50
|
+
expect(table).toMatch(/\| 25.3%\/day \(fast\) \|/);
|
|
51
51
|
expect(table).not.toMatch(/avg/);
|
|
52
52
|
});
|
|
53
|
-
it("marks on-pace burn with a check and
|
|
53
|
+
it("marks on-pace burn with a check, slow and fast with words", () => {
|
|
54
54
|
const now = Date.now();
|
|
55
55
|
const quotas = [
|
|
56
56
|
{ provider: "claude", usedPct: 45, resetsAt: "2026-09-03T21:00:00+10:00", periodStart: new Date(now - 2 * 86400000).toISOString() },
|
|
@@ -59,7 +59,8 @@ describe("format table", () => {
|
|
|
59
59
|
{ provider: "claude", wastePct: 0, daysLeft: 5.4, idealRate: 10.0, burnRate, burnMeasured: true, status: "on track" },
|
|
60
60
|
]);
|
|
61
61
|
expect(mk(9.5)).toMatch(/9.5%\/day ✔/);
|
|
62
|
-
expect(mk(3.0)).toMatch(/3.0%\/day
|
|
62
|
+
expect(mk(3.0)).toMatch(/3.0%\/day \(slow\)/);
|
|
63
|
+
expect(mk(13.0)).toMatch(/13.0%\/day \(fast\)/);
|
|
63
64
|
});
|
|
64
65
|
it("keeps every internal pipe aligned — no two-cell glyphs outside the last column", () => {
|
|
65
66
|
const quotas = [
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// generated by scripts/build-embed.mjs — do not edit
|
|
2
|
-
export const VERSION = "0.0.
|
|
2
|
+
export const VERSION = "0.0.18";
|