vibestats 1.3.12 → 1.3.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/dist/index.js +86 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3207,6 +3207,23 @@ async function inspectClaudeUsage(claudeDir = getClaudeDir2()) {
|
|
|
3207
3207
|
// src/cli-intent.ts
|
|
3208
3208
|
var COMMANDS = /* @__PURE__ */ new Set(["usage", "limits", "limit", "pace"]);
|
|
3209
3209
|
var SCOPES = /* @__PURE__ */ new Set(["claude", "codex", "all", "combined"]);
|
|
3210
|
+
var USAGE_COMMAND_FLAGS = /* @__PURE__ */ new Set([
|
|
3211
|
+
"activity",
|
|
3212
|
+
"compact",
|
|
3213
|
+
"daily",
|
|
3214
|
+
"days",
|
|
3215
|
+
"last",
|
|
3216
|
+
"metric",
|
|
3217
|
+
"model",
|
|
3218
|
+
"monthly",
|
|
3219
|
+
"project",
|
|
3220
|
+
"sessions",
|
|
3221
|
+
"share",
|
|
3222
|
+
"since",
|
|
3223
|
+
"total",
|
|
3224
|
+
"until",
|
|
3225
|
+
"wrapped"
|
|
3226
|
+
]);
|
|
3210
3227
|
var BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
|
|
3211
3228
|
"activity",
|
|
3212
3229
|
"claude",
|
|
@@ -3289,10 +3306,53 @@ function parseRawFlags(argv) {
|
|
|
3289
3306
|
}
|
|
3290
3307
|
return parsed;
|
|
3291
3308
|
}
|
|
3309
|
+
function collectPositionals(argv) {
|
|
3310
|
+
const positionals = [];
|
|
3311
|
+
for (let index = 0; index < argv.length; index++) {
|
|
3312
|
+
const arg = argv[index];
|
|
3313
|
+
if (!arg) continue;
|
|
3314
|
+
if (arg.startsWith("--")) {
|
|
3315
|
+
const [key] = arg.slice(2).split("=", 2);
|
|
3316
|
+
if (key && VALUE_FLAGS.has(key) && !arg.includes("=")) {
|
|
3317
|
+
index++;
|
|
3318
|
+
}
|
|
3319
|
+
continue;
|
|
3320
|
+
}
|
|
3321
|
+
if (arg.startsWith("-")) {
|
|
3322
|
+
const short = arg.slice(1);
|
|
3323
|
+
if (SHORT_VALUE_FLAGS[short]) {
|
|
3324
|
+
index++;
|
|
3325
|
+
}
|
|
3326
|
+
continue;
|
|
3327
|
+
}
|
|
3328
|
+
positionals.push(arg);
|
|
3329
|
+
}
|
|
3330
|
+
return positionals;
|
|
3331
|
+
}
|
|
3332
|
+
function resolveIntentError(positionals) {
|
|
3333
|
+
const first = positionals[0]?.toLowerCase();
|
|
3334
|
+
if (!first) return void 0;
|
|
3335
|
+
if (!COMMANDS.has(first) && !SCOPES.has(first)) {
|
|
3336
|
+
return { message: `Unknown command: ${positionals[0]}` };
|
|
3337
|
+
}
|
|
3338
|
+
for (let index = 0; index < positionals.length; index++) {
|
|
3339
|
+
const token = positionals[index];
|
|
3340
|
+
const lower = token.toLowerCase();
|
|
3341
|
+
if (index === 0 && COMMANDS.has(lower)) continue;
|
|
3342
|
+
if (SCOPES.has(lower)) continue;
|
|
3343
|
+
return { message: `Unknown argument for ${first}: ${token}` };
|
|
3344
|
+
}
|
|
3345
|
+
return void 0;
|
|
3346
|
+
}
|
|
3347
|
+
function hasUsageCommandFlag(flags) {
|
|
3348
|
+
return Object.keys(flags).some((key) => /^last\d+$/.test(key) || USAGE_COMMAND_FLAGS.has(key));
|
|
3349
|
+
}
|
|
3292
3350
|
function resolveCliIntent(argv) {
|
|
3293
|
-
const positionals = argv
|
|
3351
|
+
const positionals = collectPositionals(argv);
|
|
3294
3352
|
const first = positionals[0]?.toLowerCase();
|
|
3295
|
-
const
|
|
3353
|
+
const parsedFlags = parseRawFlags(argv);
|
|
3354
|
+
let command = first === "limits" || first === "limit" || first === "pace" ? "limits" : "usage";
|
|
3355
|
+
const error = resolveIntentError(positionals);
|
|
3296
3356
|
const scopeToken = positionals.find((token, index) => {
|
|
3297
3357
|
const lower = token.toLowerCase();
|
|
3298
3358
|
if (index === 0 && COMMANDS.has(lower)) return false;
|
|
@@ -3300,8 +3360,11 @@ function resolveCliIntent(argv) {
|
|
|
3300
3360
|
})?.toLowerCase();
|
|
3301
3361
|
const sourceScope = scopeToken === "combined" ? "all" : scopeToken === "all" ? "all" : scopeToken === "codex" ? "codex" : scopeToken === "claude" ? "claude" : void 0;
|
|
3302
3362
|
const normalizedArgs = {
|
|
3303
|
-
...
|
|
3363
|
+
...parsedFlags
|
|
3304
3364
|
};
|
|
3365
|
+
if (first === "usage" && sourceScope && !hasUsageCommandFlag(parsedFlags)) {
|
|
3366
|
+
command = "limits";
|
|
3367
|
+
}
|
|
3305
3368
|
if (sourceScope === "codex") {
|
|
3306
3369
|
normalizedArgs.codex = true;
|
|
3307
3370
|
normalizedArgs.combined = false;
|
|
@@ -3315,7 +3378,7 @@ function resolveCliIntent(argv) {
|
|
|
3315
3378
|
if (command === "limits") {
|
|
3316
3379
|
normalizedArgs.limits = true;
|
|
3317
3380
|
}
|
|
3318
|
-
return { command, sourceScope, normalizedArgs };
|
|
3381
|
+
return { command, sourceScope, normalizedArgs, error };
|
|
3319
3382
|
}
|
|
3320
3383
|
function applyCliIntent(args, intent) {
|
|
3321
3384
|
return {
|
|
@@ -4320,6 +4383,20 @@ function getSelectedModelFamilies(args) {
|
|
|
4320
4383
|
}
|
|
4321
4384
|
|
|
4322
4385
|
// src/index.ts
|
|
4386
|
+
function printCommandHelp(error) {
|
|
4387
|
+
console.error(`Error: ${error}`);
|
|
4388
|
+
console.error("");
|
|
4389
|
+
console.error("Usage:");
|
|
4390
|
+
console.error(" vibestats limits all");
|
|
4391
|
+
console.error(" vibestats limits claude");
|
|
4392
|
+
console.error(" vibestats limits codex");
|
|
4393
|
+
console.error(" vibestats usage all");
|
|
4394
|
+
console.error(" vibestats usage --combined --daily");
|
|
4395
|
+
console.error(" vibestats usage codex --total");
|
|
4396
|
+
console.error(" vibestats wrapped");
|
|
4397
|
+
console.error("");
|
|
4398
|
+
console.error("Run `vibestats --help` for all flags.");
|
|
4399
|
+
}
|
|
4323
4400
|
function createSpinner(label = "Loading vibestats...") {
|
|
4324
4401
|
const spinnerFrames = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
4325
4402
|
const orange = "\x1B[38;5;208m";
|
|
@@ -4462,7 +4539,7 @@ async function publishArtifactWithFallback(artifact, baseUrl, fallbackUrl, prefe
|
|
|
4462
4539
|
var main = defineCommand({
|
|
4463
4540
|
meta: {
|
|
4464
4541
|
name: "vibestats",
|
|
4465
|
-
version: "1.3.
|
|
4542
|
+
version: "1.3.13",
|
|
4466
4543
|
description: "AI coding stats - usage tracking and annual wrapped for Claude Code & Codex"
|
|
4467
4544
|
},
|
|
4468
4545
|
args: {
|
|
@@ -4611,6 +4688,10 @@ var main = defineCommand({
|
|
|
4611
4688
|
},
|
|
4612
4689
|
async run({ args }) {
|
|
4613
4690
|
const intent = resolveCliIntent(process.argv.slice(2));
|
|
4691
|
+
if (intent.error) {
|
|
4692
|
+
printCommandHelp(intent.error.message);
|
|
4693
|
+
process.exit(1);
|
|
4694
|
+
}
|
|
4614
4695
|
const normalizedArgs = applyCliIntent(args, intent);
|
|
4615
4696
|
if (normalizedArgs.init) {
|
|
4616
4697
|
initConfig();
|