ccusage 0.3.1 → 0.3.2

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.
@@ -1,5 +1,4 @@
1
- import { DailyUsage, SessionUsage } from "./data-loader-Ds_vUoR2.js";
2
- import "valibot";
1
+ import { DailyUsage, SessionUsage } from "./data-loader-ToqWI8hT.js";
3
2
 
4
3
  //#region types.d.ts
5
4
 
@@ -3,7 +3,6 @@ import { readFile } from "node:fs/promises";
3
3
  import { homedir } from "node:os";
4
4
  import path from "node:path";
5
5
  import path$1, { posix } from "path";
6
- import * as v from "valibot";
7
6
 
8
7
  //#region rolldown:runtime
9
8
  var __create = Object.create;
@@ -510,13 +509,13 @@ var require_walker = __commonJS({ "node_modules/fdir/dist/api/walker.js"(exports
510
509
  if (k2 === void 0) k2 = k;
511
510
  o[k2] = m[k];
512
511
  });
513
- var __setModuleDefault = void 0 && (void 0).__setModuleDefault || (Object.create ? function(o, v$1) {
512
+ var __setModuleDefault = void 0 && (void 0).__setModuleDefault || (Object.create ? function(o, v) {
514
513
  Object.defineProperty(o, "default", {
515
514
  enumerable: true,
516
- value: v$1
515
+ value: v
517
516
  });
518
- } : function(o, v$1) {
519
- o["default"] = v$1;
517
+ } : function(o, v) {
518
+ o["default"] = v;
520
519
  });
521
520
  var __importStar = void 0 && (void 0).__importStar || function() {
522
521
  var ownKeys = function(o) {
@@ -1218,7 +1217,7 @@ var require_parse = __commonJS({ "node_modules/picomatch/lib/parse.js"(exports,
1218
1217
  try {
1219
1218
  new RegExp(value);
1220
1219
  } catch (ex) {
1221
- return args.map((v$1) => utils$2.escapeRegex(v$1)).join("..");
1220
+ return args.map((v) => utils$2.escapeRegex(v)).join("..");
1222
1221
  }
1223
1222
  return value;
1224
1223
  };
@@ -2109,9 +2108,9 @@ var require_picomatch$1 = __commonJS({ "node_modules/picomatch/lib/picomatch.js"
2109
2108
  if (glob$1 === "" || typeof glob$1 !== "string" && !isState) throw new TypeError("Expected pattern to be a non-empty string");
2110
2109
  const opts = options || {};
2111
2110
  const posix$1 = opts.windows;
2112
- const regex = isState ? picomatch$2.compileRe(glob$1, options) : picomatch$2.makeRe(glob$1, options, false, true);
2113
- const state = regex.state;
2114
- delete regex.state;
2111
+ const regex$1 = isState ? picomatch$2.compileRe(glob$1, options) : picomatch$2.makeRe(glob$1, options, false, true);
2112
+ const state = regex$1.state;
2113
+ delete regex$1.state;
2115
2114
  let isIgnored = () => false;
2116
2115
  if (opts.ignore) {
2117
2116
  const ignoreOpts = {
@@ -2123,14 +2122,14 @@ var require_picomatch$1 = __commonJS({ "node_modules/picomatch/lib/picomatch.js"
2123
2122
  isIgnored = picomatch$2(opts.ignore, ignoreOpts, returnState);
2124
2123
  }
2125
2124
  const matcher = (input, returnObject = false) => {
2126
- const { isMatch, match, output } = picomatch$2.test(input, regex, options, {
2125
+ const { isMatch, match, output } = picomatch$2.test(input, regex$1, options, {
2127
2126
  glob: glob$1,
2128
2127
  posix: posix$1
2129
2128
  });
2130
2129
  const result = {
2131
2130
  glob: glob$1,
2132
2131
  state,
2133
- regex,
2132
+ regex: regex$1,
2134
2133
  posix: posix$1,
2135
2134
  input,
2136
2135
  output,
@@ -2169,7 +2168,7 @@ var require_picomatch$1 = __commonJS({ "node_modules/picomatch/lib/picomatch.js"
2169
2168
  * @return {Object} Returns an object with matching info.
2170
2169
  * @api public
2171
2170
  */
2172
- picomatch$2.test = (input, regex, options, { glob: glob$1, posix: posix$1 } = {}) => {
2171
+ picomatch$2.test = (input, regex$1, options, { glob: glob$1, posix: posix$1 } = {}) => {
2173
2172
  if (typeof input !== "string") throw new TypeError("Expected input to be a string");
2174
2173
  if (input === "") return {
2175
2174
  isMatch: false,
@@ -2183,8 +2182,8 @@ var require_picomatch$1 = __commonJS({ "node_modules/picomatch/lib/picomatch.js"
2183
2182
  output = format ? format(input) : input;
2184
2183
  match = output === glob$1;
2185
2184
  }
2186
- if (match === false || opts.capture === true) if (opts.matchBase === true || opts.basename === true) match = picomatch$2.matchBase(input, regex, options, posix$1);
2187
- else match = regex.exec(output);
2185
+ if (match === false || opts.capture === true) if (opts.matchBase === true || opts.basename === true) match = picomatch$2.matchBase(input, regex$1, options, posix$1);
2186
+ else match = regex$1.exec(output);
2188
2187
  return {
2189
2188
  isMatch: Boolean(match),
2190
2189
  match,
@@ -2205,8 +2204,8 @@ var require_picomatch$1 = __commonJS({ "node_modules/picomatch/lib/picomatch.js"
2205
2204
  * @api public
2206
2205
  */
2207
2206
  picomatch$2.matchBase = (input, glob$1, options) => {
2208
- const regex = glob$1 instanceof RegExp ? glob$1 : picomatch$2.makeRe(glob$1, options);
2209
- return regex.test(utils$1.basename(input));
2207
+ const regex$1 = glob$1 instanceof RegExp ? glob$1 : picomatch$2.makeRe(glob$1, options);
2208
+ return regex$1.test(utils$1.basename(input));
2210
2209
  };
2211
2210
  /**
2212
2211
  * Returns true if **any** of the given glob `patterns` match the specified `string`.
@@ -2290,9 +2289,9 @@ var require_picomatch$1 = __commonJS({ "node_modules/picomatch/lib/picomatch.js"
2290
2289
  const append = opts.contains ? "" : "$";
2291
2290
  let source = `${prepend}(?:${state.output})${append}`;
2292
2291
  if (state && state.negated === true) source = `^(?!${source}).*$`;
2293
- const regex = picomatch$2.toRegex(source, options);
2294
- if (returnState === true) regex.state = state;
2295
- return regex;
2292
+ const regex$1 = picomatch$2.toRegex(source, options);
2293
+ if (returnState === true) regex$1.state = state;
2294
+ return regex$1;
2296
2295
  };
2297
2296
  /**
2298
2297
  * Create a regular expression from a parsed glob pattern.
@@ -2572,14 +2571,14 @@ function getPartialMatcher(patterns, options) {
2572
2571
  if (inputParts[0] === ".." && ONLY_PARENT_DIRECTORIES.test(input)) return true;
2573
2572
  for (let i = 0; i < patterns.length; i++) {
2574
2573
  const patternParts = patternsParts[i];
2575
- const regex = regexes[i];
2574
+ const regex$1 = regexes[i];
2576
2575
  const inputPatternCount = inputParts.length;
2577
2576
  const minParts = Math.min(inputPatternCount, patternParts.length);
2578
2577
  let j = 0;
2579
2578
  while (j < minParts) {
2580
2579
  const part = patternParts[j];
2581
2580
  if (part.includes("/")) return true;
2582
- const match = regex[j].test(inputParts[j]);
2581
+ const match = regex$1[j].test(inputParts[j]);
2583
2582
  if (!match) break;
2584
2583
  if (part === "**") return true;
2585
2584
  j++;
@@ -2767,36 +2766,432 @@ async function glob(patternsOrOptions, options) {
2767
2766
  return crawl(opts, cwd, false);
2768
2767
  }
2769
2768
 
2769
+ //#endregion
2770
+ //#region node_modules/valibot/dist/index.js
2771
+ var store;
2772
+ /* @__NO_SIDE_EFFECTS__ */
2773
+ function getGlobalConfig(config2) {
2774
+ return {
2775
+ lang: config2?.lang ?? store?.lang,
2776
+ message: config2?.message,
2777
+ abortEarly: config2?.abortEarly ?? store?.abortEarly,
2778
+ abortPipeEarly: config2?.abortPipeEarly ?? store?.abortPipeEarly
2779
+ };
2780
+ }
2781
+ var store2;
2782
+ /* @__NO_SIDE_EFFECTS__ */
2783
+ function getGlobalMessage(lang) {
2784
+ return store2?.get(lang);
2785
+ }
2786
+ var store3;
2787
+ /* @__NO_SIDE_EFFECTS__ */
2788
+ function getSchemaMessage(lang) {
2789
+ return store3?.get(lang);
2790
+ }
2791
+ var store4;
2792
+ /* @__NO_SIDE_EFFECTS__ */
2793
+ function getSpecificMessage(reference, lang) {
2794
+ return store4?.get(reference)?.get(lang);
2795
+ }
2796
+ /* @__NO_SIDE_EFFECTS__ */
2797
+ function _stringify(input) {
2798
+ const type = typeof input;
2799
+ if (type === "string") return `"${input}"`;
2800
+ if (type === "number" || type === "bigint" || type === "boolean") return `${input}`;
2801
+ if (type === "object" || type === "function") return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
2802
+ return type;
2803
+ }
2804
+ function _addIssue(context, label, dataset, config2, other) {
2805
+ const input = other && "input" in other ? other.input : dataset.value;
2806
+ const expected = other?.expected ?? context.expects ?? null;
2807
+ const received = other?.received ?? /* @__PURE__ */ _stringify(input);
2808
+ const issue = {
2809
+ kind: context.kind,
2810
+ type: context.type,
2811
+ input,
2812
+ expected,
2813
+ received,
2814
+ message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
2815
+ requirement: context.requirement,
2816
+ path: other?.path,
2817
+ issues: other?.issues,
2818
+ lang: config2.lang,
2819
+ abortEarly: config2.abortEarly,
2820
+ abortPipeEarly: config2.abortPipeEarly
2821
+ };
2822
+ const isSchema = context.kind === "schema";
2823
+ const message2 = other?.message ?? context.message ?? /* @__PURE__ */ getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? /* @__PURE__ */ getSchemaMessage(issue.lang) : null) ?? config2.message ?? /* @__PURE__ */ getGlobalMessage(issue.lang);
2824
+ if (message2 !== void 0) issue.message = typeof message2 === "function" ? message2(issue) : message2;
2825
+ if (isSchema) dataset.typed = false;
2826
+ if (dataset.issues) dataset.issues.push(issue);
2827
+ else dataset.issues = [issue];
2828
+ }
2829
+ /* @__NO_SIDE_EFFECTS__ */
2830
+ function _getStandardProps(context) {
2831
+ return {
2832
+ version: 1,
2833
+ vendor: "valibot",
2834
+ validate(value2) {
2835
+ return context["~run"]({ value: value2 }, /* @__PURE__ */ getGlobalConfig());
2836
+ }
2837
+ };
2838
+ }
2839
+ /* @__NO_SIDE_EFFECTS__ */
2840
+ function _isValidObjectKey(object2, key) {
2841
+ return Object.hasOwn(object2, key) && key !== "__proto__" && key !== "prototype" && key !== "constructor";
2842
+ }
2843
+ /* @__NO_SIDE_EFFECTS__ */
2844
+ function _joinExpects(values2, separator) {
2845
+ const list = [...new Set(values2)];
2846
+ if (list.length > 1) return `(${list.join(` ${separator} `)})`;
2847
+ return list[0] ?? "never";
2848
+ }
2849
+ /* @__NO_SIDE_EFFECTS__ */
2850
+ function regex(requirement, message2) {
2851
+ return {
2852
+ kind: "validation",
2853
+ type: "regex",
2854
+ reference: regex,
2855
+ async: false,
2856
+ expects: `${requirement}`,
2857
+ requirement,
2858
+ message: message2,
2859
+ "~run"(dataset, config2) {
2860
+ if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "format", dataset, config2);
2861
+ return dataset;
2862
+ }
2863
+ };
2864
+ }
2865
+ /* @__NO_SIDE_EFFECTS__ */
2866
+ function getFallback(schema, dataset, config2) {
2867
+ return typeof schema.fallback === "function" ? schema.fallback(dataset, config2) : schema.fallback;
2868
+ }
2869
+ /* @__NO_SIDE_EFFECTS__ */
2870
+ function getDefault(schema, dataset, config2) {
2871
+ return typeof schema.default === "function" ? schema.default(dataset, config2) : schema.default;
2872
+ }
2873
+ /* @__NO_SIDE_EFFECTS__ */
2874
+ function boolean(message2) {
2875
+ return {
2876
+ kind: "schema",
2877
+ type: "boolean",
2878
+ reference: boolean,
2879
+ expects: "boolean",
2880
+ async: false,
2881
+ message: message2,
2882
+ get "~standard"() {
2883
+ return /* @__PURE__ */ _getStandardProps(this);
2884
+ },
2885
+ "~run"(dataset, config2) {
2886
+ if (typeof dataset.value === "boolean") dataset.typed = true;
2887
+ else _addIssue(this, "type", dataset, config2);
2888
+ return dataset;
2889
+ }
2890
+ };
2891
+ }
2892
+ /* @__NO_SIDE_EFFECTS__ */
2893
+ function number(message2) {
2894
+ return {
2895
+ kind: "schema",
2896
+ type: "number",
2897
+ reference: number,
2898
+ expects: "number",
2899
+ async: false,
2900
+ message: message2,
2901
+ get "~standard"() {
2902
+ return /* @__PURE__ */ _getStandardProps(this);
2903
+ },
2904
+ "~run"(dataset, config2) {
2905
+ if (typeof dataset.value === "number" && !isNaN(dataset.value)) dataset.typed = true;
2906
+ else _addIssue(this, "type", dataset, config2);
2907
+ return dataset;
2908
+ }
2909
+ };
2910
+ }
2911
+ /* @__NO_SIDE_EFFECTS__ */
2912
+ function object(entries2, message2) {
2913
+ return {
2914
+ kind: "schema",
2915
+ type: "object",
2916
+ reference: object,
2917
+ expects: "Object",
2918
+ async: false,
2919
+ entries: entries2,
2920
+ message: message2,
2921
+ get "~standard"() {
2922
+ return /* @__PURE__ */ _getStandardProps(this);
2923
+ },
2924
+ "~run"(dataset, config2) {
2925
+ const input = dataset.value;
2926
+ if (input && typeof input === "object") {
2927
+ dataset.typed = true;
2928
+ dataset.value = {};
2929
+ for (const key in this.entries) {
2930
+ const valueSchema = this.entries[key];
2931
+ if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
2932
+ const value2 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
2933
+ const valueDataset = valueSchema["~run"]({ value: value2 }, config2);
2934
+ if (valueDataset.issues) {
2935
+ const pathItem = {
2936
+ type: "object",
2937
+ origin: "value",
2938
+ input,
2939
+ key,
2940
+ value: value2
2941
+ };
2942
+ for (const issue of valueDataset.issues) {
2943
+ if (issue.path) issue.path.unshift(pathItem);
2944
+ else issue.path = [pathItem];
2945
+ dataset.issues?.push(issue);
2946
+ }
2947
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
2948
+ if (config2.abortEarly) {
2949
+ dataset.typed = false;
2950
+ break;
2951
+ }
2952
+ }
2953
+ if (!valueDataset.typed) dataset.typed = false;
2954
+ dataset.value[key] = valueDataset.value;
2955
+ } else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
2956
+ else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
2957
+ _addIssue(this, "key", dataset, config2, {
2958
+ input: void 0,
2959
+ expected: `"${key}"`,
2960
+ path: [{
2961
+ type: "object",
2962
+ origin: "key",
2963
+ input,
2964
+ key,
2965
+ value: input[key]
2966
+ }]
2967
+ });
2968
+ if (config2.abortEarly) break;
2969
+ }
2970
+ }
2971
+ } else _addIssue(this, "type", dataset, config2);
2972
+ return dataset;
2973
+ }
2974
+ };
2975
+ }
2976
+ /* @__NO_SIDE_EFFECTS__ */
2977
+ function optional(wrapped, default_) {
2978
+ return {
2979
+ kind: "schema",
2980
+ type: "optional",
2981
+ reference: optional,
2982
+ expects: `(${wrapped.expects} | undefined)`,
2983
+ async: false,
2984
+ wrapped,
2985
+ default: default_,
2986
+ get "~standard"() {
2987
+ return /* @__PURE__ */ _getStandardProps(this);
2988
+ },
2989
+ "~run"(dataset, config2) {
2990
+ if (dataset.value === void 0) {
2991
+ if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config2);
2992
+ if (dataset.value === void 0) {
2993
+ dataset.typed = true;
2994
+ return dataset;
2995
+ }
2996
+ }
2997
+ return this.wrapped["~run"](dataset, config2);
2998
+ }
2999
+ };
3000
+ }
3001
+ /* @__NO_SIDE_EFFECTS__ */
3002
+ function record(key, value2, message2) {
3003
+ return {
3004
+ kind: "schema",
3005
+ type: "record",
3006
+ reference: record,
3007
+ expects: "Object",
3008
+ async: false,
3009
+ key,
3010
+ value: value2,
3011
+ message: message2,
3012
+ get "~standard"() {
3013
+ return /* @__PURE__ */ _getStandardProps(this);
3014
+ },
3015
+ "~run"(dataset, config2) {
3016
+ const input = dataset.value;
3017
+ if (input && typeof input === "object") {
3018
+ dataset.typed = true;
3019
+ dataset.value = {};
3020
+ for (const entryKey in input) if (/* @__PURE__ */ _isValidObjectKey(input, entryKey)) {
3021
+ const entryValue = input[entryKey];
3022
+ const keyDataset = this.key["~run"]({ value: entryKey }, config2);
3023
+ if (keyDataset.issues) {
3024
+ const pathItem = {
3025
+ type: "object",
3026
+ origin: "key",
3027
+ input,
3028
+ key: entryKey,
3029
+ value: entryValue
3030
+ };
3031
+ for (const issue of keyDataset.issues) {
3032
+ issue.path = [pathItem];
3033
+ dataset.issues?.push(issue);
3034
+ }
3035
+ if (!dataset.issues) dataset.issues = keyDataset.issues;
3036
+ if (config2.abortEarly) {
3037
+ dataset.typed = false;
3038
+ break;
3039
+ }
3040
+ }
3041
+ const valueDataset = this.value["~run"]({ value: entryValue }, config2);
3042
+ if (valueDataset.issues) {
3043
+ const pathItem = {
3044
+ type: "object",
3045
+ origin: "value",
3046
+ input,
3047
+ key: entryKey,
3048
+ value: entryValue
3049
+ };
3050
+ for (const issue of valueDataset.issues) {
3051
+ if (issue.path) issue.path.unshift(pathItem);
3052
+ else issue.path = [pathItem];
3053
+ dataset.issues?.push(issue);
3054
+ }
3055
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
3056
+ if (config2.abortEarly) {
3057
+ dataset.typed = false;
3058
+ break;
3059
+ }
3060
+ }
3061
+ if (!keyDataset.typed || !valueDataset.typed) dataset.typed = false;
3062
+ if (keyDataset.typed) dataset.value[keyDataset.value] = valueDataset.value;
3063
+ }
3064
+ } else _addIssue(this, "type", dataset, config2);
3065
+ return dataset;
3066
+ }
3067
+ };
3068
+ }
3069
+ /* @__NO_SIDE_EFFECTS__ */
3070
+ function string(message2) {
3071
+ return {
3072
+ kind: "schema",
3073
+ type: "string",
3074
+ reference: string,
3075
+ expects: "string",
3076
+ async: false,
3077
+ message: message2,
3078
+ get "~standard"() {
3079
+ return /* @__PURE__ */ _getStandardProps(this);
3080
+ },
3081
+ "~run"(dataset, config2) {
3082
+ if (typeof dataset.value === "string") dataset.typed = true;
3083
+ else _addIssue(this, "type", dataset, config2);
3084
+ return dataset;
3085
+ }
3086
+ };
3087
+ }
3088
+ /* @__NO_SIDE_EFFECTS__ */
3089
+ function _subIssues(datasets) {
3090
+ let issues;
3091
+ if (datasets) for (const dataset of datasets) if (issues) issues.push(...dataset.issues);
3092
+ else issues = dataset.issues;
3093
+ return issues;
3094
+ }
3095
+ /* @__NO_SIDE_EFFECTS__ */
3096
+ function union(options, message2) {
3097
+ return {
3098
+ kind: "schema",
3099
+ type: "union",
3100
+ reference: union,
3101
+ expects: /* @__PURE__ */ _joinExpects(options.map((option) => option.expects), "|"),
3102
+ async: false,
3103
+ options,
3104
+ message: message2,
3105
+ get "~standard"() {
3106
+ return /* @__PURE__ */ _getStandardProps(this);
3107
+ },
3108
+ "~run"(dataset, config2) {
3109
+ let validDataset;
3110
+ let typedDatasets;
3111
+ let untypedDatasets;
3112
+ for (const schema of this.options) {
3113
+ const optionDataset = schema["~run"]({ value: dataset.value }, config2);
3114
+ if (optionDataset.typed) if (optionDataset.issues) if (typedDatasets) typedDatasets.push(optionDataset);
3115
+ else typedDatasets = [optionDataset];
3116
+ else {
3117
+ validDataset = optionDataset;
3118
+ break;
3119
+ }
3120
+ else if (untypedDatasets) untypedDatasets.push(optionDataset);
3121
+ else untypedDatasets = [optionDataset];
3122
+ }
3123
+ if (validDataset) return validDataset;
3124
+ if (typedDatasets) {
3125
+ if (typedDatasets.length === 1) return typedDatasets[0];
3126
+ _addIssue(this, "type", dataset, config2, { issues: /* @__PURE__ */ _subIssues(typedDatasets) });
3127
+ dataset.typed = true;
3128
+ } else if (untypedDatasets?.length === 1) return untypedDatasets[0];
3129
+ else _addIssue(this, "type", dataset, config2, { issues: /* @__PURE__ */ _subIssues(untypedDatasets) });
3130
+ return dataset;
3131
+ }
3132
+ };
3133
+ }
3134
+ /* @__NO_SIDE_EFFECTS__ */
3135
+ function pipe(...pipe2) {
3136
+ return {
3137
+ ...pipe2[0],
3138
+ pipe: pipe2,
3139
+ get "~standard"() {
3140
+ return /* @__PURE__ */ _getStandardProps(this);
3141
+ },
3142
+ "~run"(dataset, config2) {
3143
+ for (const item of pipe2) if (item.kind !== "metadata") {
3144
+ if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
3145
+ dataset.typed = false;
3146
+ break;
3147
+ }
3148
+ if (!dataset.issues || !config2.abortEarly && !config2.abortPipeEarly) dataset = item["~run"](dataset, config2);
3149
+ }
3150
+ return dataset;
3151
+ }
3152
+ };
3153
+ }
3154
+ /* @__NO_SIDE_EFFECTS__ */
3155
+ function safeParse(schema, input, config2) {
3156
+ const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config2));
3157
+ return {
3158
+ typed: dataset.typed,
3159
+ success: !dataset.issues,
3160
+ output: dataset.value,
3161
+ issues: dataset.issues
3162
+ };
3163
+ }
3164
+
2770
3165
  //#endregion
2771
3166
  //#region data-loader.ts
2772
3167
  const getDefaultClaudePath = () => path.join(homedir(), ".claude");
2773
- const UsageDataSchema = v.object({
2774
- timestamp: v.string(),
2775
- message: v.object({ usage: v.object({
2776
- input_tokens: v.number(),
2777
- output_tokens: v.number(),
2778
- cache_creation_input_tokens: v.optional(v.number()),
2779
- cache_read_input_tokens: v.optional(v.number())
3168
+ const UsageDataSchema = object({
3169
+ timestamp: string(),
3170
+ message: object({ usage: object({
3171
+ input_tokens: number(),
3172
+ output_tokens: number(),
3173
+ cache_creation_input_tokens: optional(number()),
3174
+ cache_read_input_tokens: optional(number())
2780
3175
  }) }),
2781
- costUSD: v.number()
3176
+ costUSD: number()
2782
3177
  });
2783
- const DailyUsageSchema = v.object({
2784
- date: v.string(),
2785
- inputTokens: v.number(),
2786
- outputTokens: v.number(),
2787
- cacheCreationTokens: v.number(),
2788
- cacheReadTokens: v.number(),
2789
- totalCost: v.number()
3178
+ const DailyUsageSchema = object({
3179
+ date: string(),
3180
+ inputTokens: number(),
3181
+ outputTokens: number(),
3182
+ cacheCreationTokens: number(),
3183
+ cacheReadTokens: number(),
3184
+ totalCost: number()
2790
3185
  });
2791
- const SessionUsageSchema = v.object({
2792
- sessionId: v.string(),
2793
- projectPath: v.string(),
2794
- inputTokens: v.number(),
2795
- outputTokens: v.number(),
2796
- cacheCreationTokens: v.number(),
2797
- cacheReadTokens: v.number(),
2798
- totalCost: v.number(),
2799
- lastActivity: v.string()
3186
+ const SessionUsageSchema = object({
3187
+ sessionId: string(),
3188
+ projectPath: string(),
3189
+ inputTokens: number(),
3190
+ outputTokens: number(),
3191
+ cacheCreationTokens: number(),
3192
+ cacheReadTokens: number(),
3193
+ totalCost: number(),
3194
+ lastActivity: string()
2800
3195
  });
2801
3196
  const formatDate = (dateStr) => {
2802
3197
  const date = new Date(dateStr);
@@ -2819,7 +3214,7 @@ async function loadUsageData(options) {
2819
3214
  const lines = content.trim().split("\n").filter((line) => line.length > 0);
2820
3215
  for (const line of lines) try {
2821
3216
  const parsed = JSON.parse(line);
2822
- const result = v.safeParse(UsageDataSchema, parsed);
3217
+ const result = safeParse(UsageDataSchema, parsed);
2823
3218
  if (!result.success) continue;
2824
3219
  const data = result.output;
2825
3220
  const date = formatDate(data.timestamp);
@@ -2867,7 +3262,7 @@ async function loadSessionData(options) {
2867
3262
  let lastTimestamp = "";
2868
3263
  for (const line of lines) try {
2869
3264
  const parsed = JSON.parse(line);
2870
- const result = v.safeParse(UsageDataSchema, parsed);
3265
+ const result = safeParse(UsageDataSchema, parsed);
2871
3266
  if (!result.success) continue;
2872
3267
  const data = result.output;
2873
3268
  const key = `${projectPath}/${sessionId}`;
@@ -2904,4 +3299,4 @@ async function loadSessionData(options) {
2904
3299
  }
2905
3300
 
2906
3301
  //#endregion
2907
- export { DailyUsageSchema, SessionUsageSchema, UsageDataSchema, __commonJS, __require, __toESM, formatDate, getDefaultClaudePath, loadSessionData, loadUsageData };
3302
+ export { DailyUsageSchema, SessionUsageSchema, UsageDataSchema, __commonJS, __require, __toESM, boolean, formatDate, getDefaultClaudePath, loadSessionData, loadUsageData, number, object, optional, pipe, record, regex, safeParse, string, union };