tokentracker-cli 0.2.23 → 0.2.24
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/package.json +1 -1
- package/src/commands/init.js +2 -6
- package/src/commands/serve.js +12 -0
package/package.json
CHANGED
package/src/commands/init.js
CHANGED
|
@@ -233,13 +233,9 @@ function renderLocalSuccess() {
|
|
|
233
233
|
[
|
|
234
234
|
"",
|
|
235
235
|
`${BOLD}Setup complete!${RESET}`,
|
|
236
|
-
DIVIDER,
|
|
237
|
-
"",
|
|
238
|
-
" View your dashboard:",
|
|
239
|
-
` ${CYAN}npx tokentracker${RESET}`,
|
|
240
236
|
"",
|
|
241
|
-
" Token data
|
|
242
|
-
"
|
|
237
|
+
" Token data will be collected automatically via hooks.",
|
|
238
|
+
" Launching dashboard...",
|
|
243
239
|
"",
|
|
244
240
|
].join("\n"),
|
|
245
241
|
);
|
package/src/commands/serve.js
CHANGED
|
@@ -14,6 +14,18 @@ const DEFAULT_PORT = 7890;
|
|
|
14
14
|
async function cmdServe(argv) {
|
|
15
15
|
const opts = parseArgs(argv);
|
|
16
16
|
|
|
17
|
+
// 0. First-time setup: if tracker dir doesn't exist, run init first
|
|
18
|
+
const { trackerDir } = await resolveTrackerPaths();
|
|
19
|
+
if (!fssync.existsSync(path.join(trackerDir, "cursors.json"))) {
|
|
20
|
+
process.stdout.write("First time? Setting up Token Tracker...\n\n");
|
|
21
|
+
try {
|
|
22
|
+
const { cmdInit } = require("./init");
|
|
23
|
+
await cmdInit(["--yes"]);
|
|
24
|
+
} catch (e) {
|
|
25
|
+
process.stdout.write(`Init warning: ${e?.message || e}\n`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
17
29
|
// 1. Optional sync
|
|
18
30
|
if (opts.sync) {
|
|
19
31
|
process.stdout.write("Syncing local data...\n");
|