@caius_kong/ccusage-dashboard 0.2.12 → 0.2.13
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 +6 -5
- package/bin/ccusage-ui.js +10 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -50,16 +50,17 @@ for you to open.
|
|
|
50
50
|
npx @caius_kong/ccusage-dashboard --port 9000 # change port
|
|
51
51
|
npx @caius_kong/ccusage-dashboard --budget 500 # monthly budget cap (default $300)
|
|
52
52
|
npx @caius_kong/ccusage-dashboard --no-warm # skip background warm-up
|
|
53
|
-
npx @caius_kong/ccusage-dashboard --
|
|
54
|
-
npx @caius_kong/ccusage-dashboard --stop # stop
|
|
53
|
+
npx @caius_kong/ccusage-dashboard --foreground # run attached to this terminal (Ctrl+C stops it)
|
|
54
|
+
npx @caius_kong/ccusage-dashboard --stop # stop the background instance
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
Once started, the launcher prints the dashboard URL — open it in your browser
|
|
58
58
|
(no browser is auto-launched).
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
By default the dashboard runs **in the background**: after printing its URL the
|
|
61
|
+
launcher exits and the server keeps running, so you can close the terminal. Use
|
|
62
|
+
`--stop` to shut it down; running it again reuses the already-running instance.
|
|
63
|
+
`--foreground` keeps it attached to the terminal instead (Ctrl+C to stop).
|
|
63
64
|
|
|
64
65
|
## What it shows
|
|
65
66
|
|
package/bin/ccusage-ui.js
CHANGED
|
@@ -7,15 +7,13 @@
|
|
|
7
7
|
* ccusage for all numbers, so the dashboard always matches ccusage.
|
|
8
8
|
*
|
|
9
9
|
* Modes:
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* already up on the port, it reuses it instead of
|
|
16
|
-
* starting a second one.
|
|
10
|
+
* default — start the server detached in the background, print
|
|
11
|
+
* the URL, and exit immediately. The server keeps running
|
|
12
|
+
* after this terminal closes. If a server is already up on
|
|
13
|
+
* the port, it reuses it instead of starting a second one.
|
|
14
|
+
* --foreground — run the server attached to this terminal (Ctrl+C stops it).
|
|
17
15
|
*
|
|
18
|
-
* Stop a
|
|
16
|
+
* Stop a background instance with: npx @caius_kong/ccusage-dashboard --stop
|
|
19
17
|
*/
|
|
20
18
|
'use strict';
|
|
21
19
|
|
|
@@ -63,11 +61,12 @@ function argValue(name, fallback) {
|
|
|
63
61
|
const host = argValue('--host', '127.0.0.1');
|
|
64
62
|
const port = parseInt(argValue('--port', '8799'), 10);
|
|
65
63
|
const url = `http://${host}:${port}`;
|
|
66
|
-
const wantDaemon = rawArgs.includes('--
|
|
64
|
+
const wantDaemon = !rawArgs.includes('--foreground'); // background by default
|
|
67
65
|
const wantStop = rawArgs.includes('--stop');
|
|
66
|
+
const wantForeground = rawArgs.includes('--foreground');
|
|
68
67
|
|
|
69
68
|
// Filter launcher-only flags before forwarding to server.py.
|
|
70
|
-
const serverArgs = rawArgs.filter((a) => !['--daemon', '--stop'].includes(a));
|
|
69
|
+
const serverArgs = rawArgs.filter((a) => !['--daemon', '--stop', '--foreground'].includes(a));
|
|
71
70
|
|
|
72
71
|
// --- daemon pid file (per host:port) ----------------------------------------
|
|
73
72
|
function pidFile() {
|
|
@@ -104,7 +103,7 @@ function printBanner() {
|
|
|
104
103
|
console.log(` Open it manually: ${url}`);
|
|
105
104
|
console.log(line);
|
|
106
105
|
if (wantDaemon) {
|
|
107
|
-
console.log(` (background
|
|
106
|
+
console.log(` (background — stop with: npx @caius_kong/ccusage-dashboard --stop)`);
|
|
108
107
|
console.log('');
|
|
109
108
|
}
|
|
110
109
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@caius_kong/ccusage-dashboard",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.13",
|
|
4
4
|
"description": "One-command local dashboard for ccusage: today/week/month/custom cost by model, 30-day trend, monthly budget alert. Numbers straight from ccusage.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "commonjs",
|