@jeffreyjyz/opencode-command-code 0.1.6 → 0.1.7
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/index.js +3 -2
- package/dist/usage.d.ts +2 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -474,10 +474,11 @@ function money(v) {
|
|
|
474
474
|
return `$${v.toFixed(2)}`;
|
|
475
475
|
}
|
|
476
476
|
function compact(n) {
|
|
477
|
+
const round1 = (v) => Math.round(v * 10) / 10;
|
|
477
478
|
if (n >= 1e6)
|
|
478
|
-
return `${(n / 1e6).toFixed(1)}M`;
|
|
479
|
+
return `${round1(n / 1e6).toFixed(1)}M`;
|
|
479
480
|
if (n >= 1000)
|
|
480
|
-
return `${(n / 1000).toFixed(1)}K`;
|
|
481
|
+
return `${round1(n / 1000).toFixed(1)}K`;
|
|
481
482
|
return `${n}`;
|
|
482
483
|
}
|
|
483
484
|
function bar(used, cap) {
|
package/dist/usage.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { type Window } from "./api";
|
|
|
2
2
|
export declare const FIVE_HOUR_SECS: number;
|
|
3
3
|
export declare const WEEKLY_SECS: number;
|
|
4
4
|
export declare function money(v: number): string;
|
|
5
|
+
/** Mirrors cmduse_core::compact. `toFixed` alone disagreed with Rust's `{:.1}`
|
|
6
|
+
* at `.x5` ties; round half-away-from-zero explicitly so both ports match. */
|
|
5
7
|
export declare function compact(n: number): string;
|
|
6
8
|
export declare function bar(used: number, cap: number): string;
|
|
7
9
|
export declare function pctStr(used: number, cap: number): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jeffreyjyz/opencode-command-code",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Command Code provider + usage dashboard for opencode: two providers (Anthropic wire for Claude, OpenAI wire for everything else) against api.commandcode.ai, live model list, plan gating, /cmd-usage.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|