nomnomtokens 0.3.0 → 0.4.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/README.md +5 -1
- package/dist/index.js +22 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/web/nitro.json +1 -1
- package/web/public/_nuxt/builds/latest.json +1 -1
- package/web/public/_nuxt/builds/meta/b80e2306-16ec-4868-89f8-b713594d0c00.json +1 -0
- package/web/server/chunks/nitro/nitro.mjs +107 -107
- package/web/public/_nuxt/builds/meta/e90c8a2d-9e50-4b58-8019-6b1bf4c8fc6d.json +0 -1
package/README.md
CHANGED
|
@@ -54,9 +54,13 @@ live updates.
|
|
|
54
54
|
The hook doubles as a real status line:
|
|
55
55
|
|
|
56
56
|
```
|
|
57
|
-
(^u^) $4.20 ctx 37% 5h 73% 7d 41% 138 lines
|
|
57
|
+
(^u^) $4.20 ctx 37% 5h 73% ·1h47m 7d 41% ·4d3h 138 lines
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
+
The countdown after each window is the time left until it resets: the
|
|
61
|
+
percentage tells you whether to slow down, the countdown tells you what slowing
|
|
62
|
+
down would cost. It is omitted when Claude Code sends no `resets_at`.
|
|
63
|
+
|
|
60
64
|
## Commands
|
|
61
65
|
|
|
62
66
|
| Command | Does |
|
package/dist/index.js
CHANGED
|
@@ -5952,6 +5952,21 @@ function duration(ms) {
|
|
|
5952
5952
|
if (ms < 1e3) return `${Math.round(ms)}ms`;
|
|
5953
5953
|
return `${(ms / 1e3).toFixed(1)}s`;
|
|
5954
5954
|
}
|
|
5955
|
+
function untilReset(ms, now = Date.now()) {
|
|
5956
|
+
if (ms === null || ms === void 0 || !Number.isFinite(ms)) return null;
|
|
5957
|
+
const delta = ms - now;
|
|
5958
|
+
if (delta <= 0) return "now";
|
|
5959
|
+
const minutes = Math.floor(delta / 6e4);
|
|
5960
|
+
if (minutes < 60) return `${Math.max(minutes, 1)}m`;
|
|
5961
|
+
const hours = Math.floor(minutes / 60);
|
|
5962
|
+
if (hours < 24) {
|
|
5963
|
+
const rest2 = minutes % 60;
|
|
5964
|
+
return rest2 === 0 ? `${hours}h` : `${hours}h${rest2}m`;
|
|
5965
|
+
}
|
|
5966
|
+
const days = Math.floor(hours / 24);
|
|
5967
|
+
const rest = hours % 24;
|
|
5968
|
+
return rest === 0 ? `${days}d` : `${days}d${rest}h`;
|
|
5969
|
+
}
|
|
5955
5970
|
var MASCOT = String.raw`
|
|
5956
5971
|
(\_/)
|
|
5957
5972
|
( o.o ) nom nom nom
|
|
@@ -7537,6 +7552,11 @@ var MOOD_FACE = {
|
|
|
7537
7552
|
stuffed: "(>_<)",
|
|
7538
7553
|
overstuffed: "(x_x)"
|
|
7539
7554
|
};
|
|
7555
|
+
function limitSegment(label, usedPct, resetsAtSeconds) {
|
|
7556
|
+
const resetsAt = typeof resetsAtSeconds === "number" && Number.isFinite(resetsAtSeconds) ? resetsAtSeconds * 1e3 : null;
|
|
7557
|
+
const left = untilReset(resetsAt);
|
|
7558
|
+
return `${label} ${Math.round(usedPct)}%${left ? ` \xB7${left}` : ""}`;
|
|
7559
|
+
}
|
|
7540
7560
|
async function readStdin() {
|
|
7541
7561
|
const chunks = [];
|
|
7542
7562
|
for await (const chunk of process.stdin) chunks.push(chunk);
|
|
@@ -7559,8 +7579,8 @@ async function statusline(opts = {}) {
|
|
|
7559
7579
|
parts.push(MOOD_FACE[moodFor(Math.max(fiveHour ?? 0, sevenDay ?? 0))] ?? "(^_^)");
|
|
7560
7580
|
if (cost !== null) parts.push(usd(cost));
|
|
7561
7581
|
if (ctx !== null) parts.push(`ctx ${Math.round(ctx)}%`);
|
|
7562
|
-
if (fiveHour !== null) parts.push(
|
|
7563
|
-
if (sevenDay !== null) parts.push(
|
|
7582
|
+
if (fiveHour !== null) parts.push(limitSegment("5h", fiveHour, limits2?.five_hour?.resets_at));
|
|
7583
|
+
if (sevenDay !== null) parts.push(limitSegment("7d", sevenDay, limits2?.seven_day?.resets_at));
|
|
7564
7584
|
const lines = (payload.cost?.total_lines_added ?? 0) + (payload.cost?.total_lines_removed ?? 0);
|
|
7565
7585
|
if (lines > 0) parts.push(`${compactNumber(lines)} lines`);
|
|
7566
7586
|
process.stdout.write(`${parts.join(" ")}
|