ccusage 0.3.0 → 0.3.1

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,4 +1,5 @@
1
1
  import { DailyUsage, SessionUsage } from "./data-loader-Ds_vUoR2.js";
2
+ import "valibot";
2
3
 
3
4
  //#region types.d.ts
4
5
 
@@ -3,6 +3,7 @@ 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";
6
7
 
7
8
  //#region rolldown:runtime
8
9
  var __create = Object.create;
@@ -509,13 +510,13 @@ var require_walker = __commonJS({ "node_modules/fdir/dist/api/walker.js"(exports
509
510
  if (k2 === void 0) k2 = k;
510
511
  o[k2] = m[k];
511
512
  });
512
- var __setModuleDefault = void 0 && (void 0).__setModuleDefault || (Object.create ? function(o, v) {
513
+ var __setModuleDefault = void 0 && (void 0).__setModuleDefault || (Object.create ? function(o, v$1) {
513
514
  Object.defineProperty(o, "default", {
514
515
  enumerable: true,
515
- value: v
516
+ value: v$1
516
517
  });
517
- } : function(o, v) {
518
- o["default"] = v;
518
+ } : function(o, v$1) {
519
+ o["default"] = v$1;
519
520
  });
520
521
  var __importStar = void 0 && (void 0).__importStar || function() {
521
522
  var ownKeys = function(o) {
@@ -1217,7 +1218,7 @@ var require_parse = __commonJS({ "node_modules/picomatch/lib/parse.js"(exports,
1217
1218
  try {
1218
1219
  new RegExp(value);
1219
1220
  } catch (ex) {
1220
- return args.map((v) => utils$2.escapeRegex(v)).join("..");
1221
+ return args.map((v$1) => utils$2.escapeRegex(v$1)).join("..");
1221
1222
  }
1222
1223
  return value;
1223
1224
  };
@@ -2108,9 +2109,9 @@ var require_picomatch$1 = __commonJS({ "node_modules/picomatch/lib/picomatch.js"
2108
2109
  if (glob$1 === "" || typeof glob$1 !== "string" && !isState) throw new TypeError("Expected pattern to be a non-empty string");
2109
2110
  const opts = options || {};
2110
2111
  const posix$1 = opts.windows;
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;
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;
2114
2115
  let isIgnored = () => false;
2115
2116
  if (opts.ignore) {
2116
2117
  const ignoreOpts = {
@@ -2122,14 +2123,14 @@ var require_picomatch$1 = __commonJS({ "node_modules/picomatch/lib/picomatch.js"
2122
2123
  isIgnored = picomatch$2(opts.ignore, ignoreOpts, returnState);
2123
2124
  }
2124
2125
  const matcher = (input, returnObject = false) => {
2125
- const { isMatch, match, output } = picomatch$2.test(input, regex$1, options, {
2126
+ const { isMatch, match, output } = picomatch$2.test(input, regex, options, {
2126
2127
  glob: glob$1,
2127
2128
  posix: posix$1
2128
2129
  });
2129
2130
  const result = {
2130
2131
  glob: glob$1,
2131
2132
  state,
2132
- regex: regex$1,
2133
+ regex,
2133
2134
  posix: posix$1,
2134
2135
  input,
2135
2136
  output,
@@ -2168,7 +2169,7 @@ var require_picomatch$1 = __commonJS({ "node_modules/picomatch/lib/picomatch.js"
2168
2169
  * @return {Object} Returns an object with matching info.
2169
2170
  * @api public
2170
2171
  */
2171
- picomatch$2.test = (input, regex$1, options, { glob: glob$1, posix: posix$1 } = {}) => {
2172
+ picomatch$2.test = (input, regex, options, { glob: glob$1, posix: posix$1 } = {}) => {
2172
2173
  if (typeof input !== "string") throw new TypeError("Expected input to be a string");
2173
2174
  if (input === "") return {
2174
2175
  isMatch: false,
@@ -2182,8 +2183,8 @@ var require_picomatch$1 = __commonJS({ "node_modules/picomatch/lib/picomatch.js"
2182
2183
  output = format ? format(input) : input;
2183
2184
  match = output === glob$1;
2184
2185
  }
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);
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);
2187
2188
  return {
2188
2189
  isMatch: Boolean(match),
2189
2190
  match,
@@ -2204,8 +2205,8 @@ var require_picomatch$1 = __commonJS({ "node_modules/picomatch/lib/picomatch.js"
2204
2205
  * @api public
2205
2206
  */
2206
2207
  picomatch$2.matchBase = (input, glob$1, options) => {
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));
2208
+ const regex = glob$1 instanceof RegExp ? glob$1 : picomatch$2.makeRe(glob$1, options);
2209
+ return regex.test(utils$1.basename(input));
2209
2210
  };
2210
2211
  /**
2211
2212
  * Returns true if **any** of the given glob `patterns` match the specified `string`.
@@ -2289,9 +2290,9 @@ var require_picomatch$1 = __commonJS({ "node_modules/picomatch/lib/picomatch.js"
2289
2290
  const append = opts.contains ? "" : "$";
2290
2291
  let source = `${prepend}(?:${state.output})${append}`;
2291
2292
  if (state && state.negated === true) source = `^(?!${source}).*$`;
2292
- const regex$1 = picomatch$2.toRegex(source, options);
2293
- if (returnState === true) regex$1.state = state;
2294
- return regex$1;
2293
+ const regex = picomatch$2.toRegex(source, options);
2294
+ if (returnState === true) regex.state = state;
2295
+ return regex;
2295
2296
  };
2296
2297
  /**
2297
2298
  * Create a regular expression from a parsed glob pattern.
@@ -2571,14 +2572,14 @@ function getPartialMatcher(patterns, options) {
2571
2572
  if (inputParts[0] === ".." && ONLY_PARENT_DIRECTORIES.test(input)) return true;
2572
2573
  for (let i = 0; i < patterns.length; i++) {
2573
2574
  const patternParts = patternsParts[i];
2574
- const regex$1 = regexes[i];
2575
+ const regex = regexes[i];
2575
2576
  const inputPatternCount = inputParts.length;
2576
2577
  const minParts = Math.min(inputPatternCount, patternParts.length);
2577
2578
  let j = 0;
2578
2579
  while (j < minParts) {
2579
2580
  const part = patternParts[j];
2580
2581
  if (part.includes("/")) return true;
2581
- const match = regex$1[j].test(inputParts[j]);
2582
+ const match = regex[j].test(inputParts[j]);
2582
2583
  if (!match) break;
2583
2584
  if (part === "**") return true;
2584
2585
  j++;
@@ -2766,432 +2767,36 @@ async function glob(patternsOrOptions, options) {
2766
2767
  return crawl(opts, cwd, false);
2767
2768
  }
2768
2769
 
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
-
3165
2770
  //#endregion
3166
2771
  //#region data-loader.ts
3167
2772
  const getDefaultClaudePath = () => path.join(homedir(), ".claude");
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())
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())
3175
2780
  }) }),
3176
- costUSD: number()
2781
+ costUSD: v.number()
3177
2782
  });
3178
- const DailyUsageSchema = object({
3179
- date: string(),
3180
- inputTokens: number(),
3181
- outputTokens: number(),
3182
- cacheCreationTokens: number(),
3183
- cacheReadTokens: number(),
3184
- totalCost: number()
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()
3185
2790
  });
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()
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()
3195
2800
  });
3196
2801
  const formatDate = (dateStr) => {
3197
2802
  const date = new Date(dateStr);
@@ -3214,7 +2819,7 @@ async function loadUsageData(options) {
3214
2819
  const lines = content.trim().split("\n").filter((line) => line.length > 0);
3215
2820
  for (const line of lines) try {
3216
2821
  const parsed = JSON.parse(line);
3217
- const result = safeParse(UsageDataSchema, parsed);
2822
+ const result = v.safeParse(UsageDataSchema, parsed);
3218
2823
  if (!result.success) continue;
3219
2824
  const data = result.output;
3220
2825
  const date = formatDate(data.timestamp);
@@ -3262,7 +2867,7 @@ async function loadSessionData(options) {
3262
2867
  let lastTimestamp = "";
3263
2868
  for (const line of lines) try {
3264
2869
  const parsed = JSON.parse(line);
3265
- const result = safeParse(UsageDataSchema, parsed);
2870
+ const result = v.safeParse(UsageDataSchema, parsed);
3266
2871
  if (!result.success) continue;
3267
2872
  const data = result.output;
3268
2873
  const key = `${projectPath}/${sessionId}`;
@@ -3299,4 +2904,4 @@ async function loadSessionData(options) {
3299
2904
  }
3300
2905
 
3301
2906
  //#endregion
3302
- export { DailyUsageSchema, SessionUsageSchema, UsageDataSchema, __commonJS, __require, __toESM, boolean, formatDate, getDefaultClaudePath, loadSessionData, loadUsageData, number, object, optional, pipe, record, regex, safeParse, string, union };
2907
+ export { DailyUsageSchema, SessionUsageSchema, UsageDataSchema, __commonJS, __require, __toESM, formatDate, getDefaultClaudePath, loadSessionData, loadUsageData };
@@ -1,3 +1,3 @@
1
- import { DailyUsageSchema, SessionUsageSchema, UsageDataSchema, formatDate, getDefaultClaudePath, loadSessionData, loadUsageData } from "./data-loader-D64xoJ7s.js";
1
+ import { DailyUsageSchema, SessionUsageSchema, UsageDataSchema, formatDate, getDefaultClaudePath, loadSessionData, loadUsageData } from "./data-loader-Dh4y6ICb.js";
2
2
 
3
3
  export { DailyUsageSchema, SessionUsageSchema, UsageDataSchema, formatDate, getDefaultClaudePath, loadSessionData, loadUsageData };
package/dist/index.js CHANGED
@@ -1,7 +1,9 @@
1
1
  #!/usr/bin/env node
2
- import { __commonJS, __require, __toESM, boolean, getDefaultClaudePath, loadSessionData, loadUsageData, number, object, optional, pipe, record, regex, safeParse, string, union } from "./data-loader-D64xoJ7s.js";
2
+ import { __commonJS, __require, __toESM, getDefaultClaudePath, loadSessionData, loadUsageData } from "./data-loader-Dh4y6ICb.js";
3
3
  import { calculateTotals, createTotalsObject, getTotalTokens } from "./calculate-cost-DMC4FhU4.js";
4
4
  import { sep } from "node:path";
5
+ import * as v$1 from "valibot";
6
+ import * as v from "valibot";
5
7
  import process$1 from "node:process";
6
8
  import { formatWithOptions } from "node:util";
7
9
  import * as tty from "node:tty";
@@ -1145,8 +1147,8 @@ var require_debug = __commonJS({ "node_modules/cli-table3/src/debug.js"(exports,
1145
1147
  debug$3.reset = () => {
1146
1148
  messages = [];
1147
1149
  };
1148
- debug$3.setDebugLevel = (v) => {
1149
- level = v;
1150
+ debug$3.setDebugLevel = (v$2) => {
1151
+ level = v$2;
1150
1152
  };
1151
1153
  debug$3.warn = (msg) => debug$3(msg, debug$3.WARN);
1152
1154
  debug$3.info = (msg) => debug$3(msg, debug$3.INFO);
@@ -1168,7 +1170,7 @@ var require_ansi_regex = __commonJS({ "node_modules/ansi-regex/index.js"(exports
1168
1170
  //#region node_modules/strip-ansi/index.js
1169
1171
  var require_strip_ansi = __commonJS({ "node_modules/strip-ansi/index.js"(exports, module) {
1170
1172
  const ansiRegex$2 = require_ansi_regex();
1171
- module.exports = (string$1) => typeof string$1 === "string" ? string$1.replace(ansiRegex$2(), "") : string$1;
1173
+ module.exports = (string) => typeof string === "string" ? string.replace(ansiRegex$2(), "") : string;
1172
1174
  } });
1173
1175
 
1174
1176
  //#endregion
@@ -1197,14 +1199,14 @@ var require_string_width = __commonJS({ "node_modules/string-width/index.js"(exp
1197
1199
  const stripAnsi$2 = require_strip_ansi();
1198
1200
  const isFullwidthCodePoint = require_is_fullwidth_code_point();
1199
1201
  const emojiRegex$1 = require_emoji_regex();
1200
- const stringWidth$3 = (string$1) => {
1201
- if (typeof string$1 !== "string" || string$1.length === 0) return 0;
1202
- string$1 = stripAnsi$2(string$1);
1203
- if (string$1.length === 0) return 0;
1204
- string$1 = string$1.replace(emojiRegex$1(), " ");
1202
+ const stringWidth$3 = (string) => {
1203
+ if (typeof string !== "string" || string.length === 0) return 0;
1204
+ string = stripAnsi$2(string);
1205
+ if (string.length === 0) return 0;
1206
+ string = string.replace(emojiRegex$1(), " ");
1205
1207
  let width = 0;
1206
- for (let i$1 = 0; i$1 < string$1.length; i$1++) {
1207
- const code = string$1.codePointAt(i$1);
1208
+ for (let i$1 = 0; i$1 < string.length; i$1++) {
1209
+ const code = string.codePointAt(i$1);
1208
1210
  if (code <= 31 || code >= 127 && code <= 159) continue;
1209
1211
  if (code >= 768 && code <= 879) continue;
1210
1212
  if (code > 65535) i$1++;
@@ -2466,7 +2468,7 @@ var require_cell = __commonJS({ "node_modules/cli-table3/src/cell.js"(exports, m
2466
2468
  mergeTableOptions() {}
2467
2469
  };
2468
2470
  function firstDefined(...args) {
2469
- return args.filter((v) => v !== void 0 && v !== null).shift();
2471
+ return args.filter((v$2) => v$2 !== void 0 && v$2 !== null).shift();
2470
2472
  }
2471
2473
  function setOption(objA, objB, nameB, targetObj) {
2472
2474
  let nameA = nameB.split("-");
@@ -2809,17 +2811,17 @@ var require_picocolors = __commonJS({ "node_modules/picocolors/picocolors.js"(ex
2809
2811
  let p = process || {}, argv$1 = p.argv || [], env$1 = p.env || {};
2810
2812
  let isColorSupported$1 = !(!!env$1.NO_COLOR || argv$1.includes("--no-color")) && (!!env$1.FORCE_COLOR || argv$1.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env$1.TERM !== "dumb" || !!env$1.CI);
2811
2813
  let formatter = (open, close, replace = open) => (input) => {
2812
- let string$1 = "" + input, index = string$1.indexOf(close, open.length);
2813
- return ~index ? open + replaceClose$1(string$1, close, replace, index) + close : open + string$1 + close;
2814
+ let string = "" + input, index = string.indexOf(close, open.length);
2815
+ return ~index ? open + replaceClose$1(string, close, replace, index) + close : open + string + close;
2814
2816
  };
2815
- let replaceClose$1 = (string$1, close, replace, index) => {
2817
+ let replaceClose$1 = (string, close, replace, index) => {
2816
2818
  let result = "", cursor = 0;
2817
2819
  do {
2818
- result += string$1.substring(cursor, index) + replace;
2820
+ result += string.substring(cursor, index) + replace;
2819
2821
  cursor = index + close.length;
2820
- index = string$1.indexOf(close, cursor);
2822
+ index = string.indexOf(close, cursor);
2821
2823
  } while (~index);
2822
- return result + string$1.substring(cursor);
2824
+ return result + string.substring(cursor);
2823
2825
  };
2824
2826
  let createColors$1 = (enabled = isColorSupported$1) => {
2825
2827
  let f$1 = enabled ? formatter : () => String;
@@ -2916,17 +2918,17 @@ function isPlainObject$1(value) {
2916
2918
  }
2917
2919
  function _defu(baseObject, defaults, namespace = ".", merger) {
2918
2920
  if (!isPlainObject$1(defaults)) return _defu(baseObject, {}, namespace, merger);
2919
- const object$1 = Object.assign({}, defaults);
2921
+ const object = Object.assign({}, defaults);
2920
2922
  for (const key in baseObject) {
2921
2923
  if (key === "__proto__" || key === "constructor") continue;
2922
2924
  const value = baseObject[key];
2923
2925
  if (value === null || value === void 0) continue;
2924
- if (merger && merger(object$1, key, value, namespace)) continue;
2925
- if (Array.isArray(value) && Array.isArray(object$1[key])) object$1[key] = [...value, ...object$1[key]];
2926
- else if (isPlainObject$1(value) && isPlainObject$1(object$1[key])) object$1[key] = _defu(value, object$1[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
2927
- else object$1[key] = value;
2926
+ if (merger && merger(object, key, value, namespace)) continue;
2927
+ if (Array.isArray(value) && Array.isArray(object[key])) object[key] = [...value, ...object[key]];
2928
+ else if (isPlainObject$1(value) && isPlainObject$1(object[key])) object[key] = _defu(value, object[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
2929
+ else object[key] = value;
2928
2930
  }
2929
- return object$1;
2931
+ return object;
2930
2932
  }
2931
2933
  function createDefu(merger) {
2932
2934
  return (...arguments_) => arguments_.reduce((p$1, c$1) => _defu(p$1, c$1, "", merger), {});
@@ -3332,14 +3334,14 @@ const isDumbTerminal = env.TERM === "dumb";
3332
3334
  const isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;
3333
3335
  const isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
3334
3336
  const isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
3335
- function replaceClose(index, string$1, close, replace, head = string$1.slice(0, Math.max(0, index)) + replace, tail = string$1.slice(Math.max(0, index + close.length)), next = tail.indexOf(close)) {
3337
+ function replaceClose(index, string, close, replace, head = string.slice(0, Math.max(0, index)) + replace, tail = string.slice(Math.max(0, index + close.length)), next = tail.indexOf(close)) {
3336
3338
  return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
3337
3339
  }
3338
- function clearBleed(index, string$1, open, close, replace) {
3339
- return index < 0 ? open + string$1 + close : open + replaceClose(index, string$1, close, replace) + close;
3340
+ function clearBleed(index, string, open, close, replace) {
3341
+ return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
3340
3342
  }
3341
3343
  function filterEmpty(open, close, replace = open, at = open.length + 1) {
3342
- return (string$1) => string$1 || !(string$1 === "" || string$1 === void 0) ? clearBleed(("" + string$1).indexOf(close, at), string$1, open, close, replace) : "";
3344
+ return (string) => string || !(string === "" || string === void 0) ? clearBleed(("" + string).indexOf(close, at), string, open, close, replace) : "";
3343
3345
  }
3344
3346
  function init(open, close, replace) {
3345
3347
  return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
@@ -3678,10 +3680,10 @@ function ansiRegex({ onlyFirst = false } = {}) {
3678
3680
  const pattern = [`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`, "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
3679
3681
  return new RegExp(pattern, onlyFirst ? void 0 : "g");
3680
3682
  }
3681
- const regex$1 = ansiRegex();
3682
- function stripAnsi(string$1) {
3683
- if (typeof string$1 !== "string") throw new TypeError(`Expected a \`string\`, got \`${typeof string$1}\``);
3684
- return string$1.replace(regex$1, "");
3683
+ const regex = ansiRegex();
3684
+ function stripAnsi(string) {
3685
+ if (typeof string !== "string") throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
3686
+ return string.replace(regex, "");
3685
3687
  }
3686
3688
  function isAmbiguous(x) {
3687
3689
  return x === 161 || x === 164 || x === 167 || x === 168 || x === 170 || x === 173 || x === 174 || x >= 176 && x <= 180 || x >= 182 && x <= 186 || x >= 188 && x <= 191 || x === 198 || x === 208 || x === 215 || x === 216 || x >= 222 && x <= 225 || x === 230 || x >= 232 && x <= 234 || x === 236 || x === 237 || x === 240 || x === 242 || x === 243 || x >= 247 && x <= 250 || x === 252 || x === 254 || x === 257 || x === 273 || x === 275 || x === 283 || x === 294 || x === 295 || x === 299 || x >= 305 && x <= 307 || x === 312 || x >= 319 && x <= 322 || x === 324 || x >= 328 && x <= 331 || x === 333 || x === 338 || x === 339 || x === 358 || x === 359 || x === 363 || x === 462 || x === 464 || x === 466 || x === 468 || x === 470 || x === 472 || x === 474 || x === 476 || x === 593 || x === 609 || x === 708 || x === 711 || x >= 713 && x <= 715 || x === 717 || x === 720 || x >= 728 && x <= 731 || x === 733 || x === 735 || x >= 768 && x <= 879 || x >= 913 && x <= 929 || x >= 931 && x <= 937 || x >= 945 && x <= 961 || x >= 963 && x <= 969 || x === 1025 || x >= 1040 && x <= 1103 || x === 1105 || x === 8208 || x >= 8211 && x <= 8214 || x === 8216 || x === 8217 || x === 8220 || x === 8221 || x >= 8224 && x <= 8226 || x >= 8228 && x <= 8231 || x === 8240 || x === 8242 || x === 8243 || x === 8245 || x === 8251 || x === 8254 || x === 8308 || x === 8319 || x >= 8321 && x <= 8324 || x === 8364 || x === 8451 || x === 8453 || x === 8457 || x === 8467 || x === 8470 || x === 8481 || x === 8482 || x === 8486 || x === 8491 || x === 8531 || x === 8532 || x >= 8539 && x <= 8542 || x >= 8544 && x <= 8555 || x >= 8560 && x <= 8569 || x === 8585 || x >= 8592 && x <= 8601 || x === 8632 || x === 8633 || x === 8658 || x === 8660 || x === 8679 || x === 8704 || x === 8706 || x === 8707 || x === 8711 || x === 8712 || x === 8715 || x === 8719 || x === 8721 || x === 8725 || x === 8730 || x >= 8733 && x <= 8736 || x === 8739 || x === 8741 || x >= 8743 && x <= 8748 || x === 8750 || x >= 8756 && x <= 8759 || x === 8764 || x === 8765 || x === 8776 || x === 8780 || x === 8786 || x === 8800 || x === 8801 || x >= 8804 && x <= 8807 || x === 8810 || x === 8811 || x === 8814 || x === 8815 || x === 8834 || x === 8835 || x === 8838 || x === 8839 || x === 8853 || x === 8857 || x === 8869 || x === 8895 || x === 8978 || x >= 9312 && x <= 9449 || x >= 9451 && x <= 9547 || x >= 9552 && x <= 9587 || x >= 9600 && x <= 9615 || x >= 9618 && x <= 9621 || x === 9632 || x === 9633 || x >= 9635 && x <= 9641 || x === 9650 || x === 9651 || x === 9654 || x === 9655 || x === 9660 || x === 9661 || x === 9664 || x === 9665 || x >= 9670 && x <= 9672 || x === 9675 || x >= 9678 && x <= 9681 || x >= 9698 && x <= 9701 || x === 9711 || x === 9733 || x === 9734 || x === 9737 || x === 9742 || x === 9743 || x === 9756 || x === 9758 || x === 9792 || x === 9794 || x === 9824 || x === 9825 || x >= 9827 && x <= 9829 || x >= 9831 && x <= 9834 || x === 9836 || x === 9837 || x === 9839 || x === 9886 || x === 9887 || x === 9919 || x >= 9926 && x <= 9933 || x >= 9935 && x <= 9939 || x >= 9941 && x <= 9953 || x === 9955 || x === 9960 || x === 9961 || x >= 9963 && x <= 9969 || x === 9972 || x >= 9974 && x <= 9977 || x === 9979 || x === 9980 || x === 9982 || x === 9983 || x === 10045 || x >= 10102 && x <= 10111 || x >= 11094 && x <= 11097 || x >= 12872 && x <= 12879 || x >= 57344 && x <= 63743 || x >= 65024 && x <= 65039 || x === 65533 || x >= 127232 && x <= 127242 || x >= 127248 && x <= 127277 || x >= 127280 && x <= 127337 || x >= 127344 && x <= 127373 || x === 127375 || x === 127376 || x >= 127387 && x <= 127404 || x >= 917760 && x <= 917999 || x >= 983040 && x <= 1048573 || x >= 1048576 && x <= 1114109;
@@ -3705,14 +3707,14 @@ const emojiRegex = () => {
3705
3707
  };
3706
3708
  const segmenter = globalThis.Intl?.Segmenter ? new Intl.Segmenter() : { segment: (str) => str.split("") };
3707
3709
  const defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
3708
- function stringWidth$1(string$1, options = {}) {
3709
- if (typeof string$1 !== "string" || string$1.length === 0) return 0;
3710
+ function stringWidth$1(string, options = {}) {
3711
+ if (typeof string !== "string" || string.length === 0) return 0;
3710
3712
  const { ambiguousIsNarrow = true, countAnsiEscapeCodes = false } = options;
3711
- if (!countAnsiEscapeCodes) string$1 = stripAnsi(string$1);
3712
- if (string$1.length === 0) return 0;
3713
+ if (!countAnsiEscapeCodes) string = stripAnsi(string);
3714
+ if (string.length === 0) return 0;
3713
3715
  let width = 0;
3714
3716
  const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
3715
- for (const { segment: character } of segmenter.segment(string$1)) {
3717
+ for (const { segment: character } of segmenter.segment(string)) {
3716
3718
  const codePoint = character.codePointAt(0);
3717
3719
  if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) continue;
3718
3720
  if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) continue;
@@ -3835,7 +3837,7 @@ const consola = createConsola();
3835
3837
  //#endregion
3836
3838
  //#region package.json
3837
3839
  var name = "ccusage";
3838
- var version = "0.3.0";
3840
+ var version = "0.3.1";
3839
3841
  var description = "Usage analysis tool for Claude Code";
3840
3842
 
3841
3843
  //#endregion
@@ -3845,41 +3847,41 @@ const log = (...args) => console.log(...args);
3845
3847
 
3846
3848
  //#endregion
3847
3849
  //#region types.ts
3848
- const ModelSpecSchema = object({
3849
- max_tokens: optional(union([number(), string()])),
3850
- max_input_tokens: optional(union([number(), string()])),
3851
- max_output_tokens: optional(union([number(), string()])),
3852
- input_cost_per_token: optional(number()),
3853
- output_cost_per_token: optional(number()),
3854
- output_cost_per_reasoning_token: optional(number()),
3855
- cache_creation_input_token_cost: optional(number()),
3856
- cache_read_input_token_cost: optional(number()),
3857
- litellm_provider: optional(string()),
3858
- mode: optional(string()),
3859
- supports_function_calling: optional(boolean()),
3860
- supports_parallel_function_calling: optional(boolean()),
3861
- supports_vision: optional(boolean()),
3862
- supports_audio_input: optional(boolean()),
3863
- supports_audio_output: optional(boolean()),
3864
- supports_prompt_caching: optional(boolean()),
3865
- supports_response_schema: optional(boolean()),
3866
- supports_system_messages: optional(boolean()),
3867
- supports_reasoning: optional(boolean()),
3868
- supports_web_search: optional(boolean()),
3869
- search_context_cost_per_query: optional(object({
3870
- search_context_size_low: number(),
3871
- search_context_size_medium: number(),
3872
- search_context_size_high: number()
3850
+ const ModelSpecSchema = v$1.object({
3851
+ max_tokens: v$1.optional(v$1.union([v$1.number(), v$1.string()])),
3852
+ max_input_tokens: v$1.optional(v$1.union([v$1.number(), v$1.string()])),
3853
+ max_output_tokens: v$1.optional(v$1.union([v$1.number(), v$1.string()])),
3854
+ input_cost_per_token: v$1.optional(v$1.number()),
3855
+ output_cost_per_token: v$1.optional(v$1.number()),
3856
+ output_cost_per_reasoning_token: v$1.optional(v$1.number()),
3857
+ cache_creation_input_token_cost: v$1.optional(v$1.number()),
3858
+ cache_read_input_token_cost: v$1.optional(v$1.number()),
3859
+ litellm_provider: v$1.optional(v$1.string()),
3860
+ mode: v$1.optional(v$1.string()),
3861
+ supports_function_calling: v$1.optional(v$1.boolean()),
3862
+ supports_parallel_function_calling: v$1.optional(v$1.boolean()),
3863
+ supports_vision: v$1.optional(v$1.boolean()),
3864
+ supports_audio_input: v$1.optional(v$1.boolean()),
3865
+ supports_audio_output: v$1.optional(v$1.boolean()),
3866
+ supports_prompt_caching: v$1.optional(v$1.boolean()),
3867
+ supports_response_schema: v$1.optional(v$1.boolean()),
3868
+ supports_system_messages: v$1.optional(v$1.boolean()),
3869
+ supports_reasoning: v$1.optional(v$1.boolean()),
3870
+ supports_web_search: v$1.optional(v$1.boolean()),
3871
+ search_context_cost_per_query: v$1.optional(v$1.object({
3872
+ search_context_size_low: v$1.number(),
3873
+ search_context_size_medium: v$1.number(),
3874
+ search_context_size_high: v$1.number()
3873
3875
  })),
3874
- deprecation_date: optional(string())
3876
+ deprecation_date: v$1.optional(v$1.string())
3875
3877
  });
3876
- const LiteLLMModelPricesSchema = record(string(), ModelSpecSchema);
3877
- const dateSchema = pipe(string(), regex(/^\d{8}$/, "Date must be in YYYYMMDD format"));
3878
+ const LiteLLMModelPricesSchema = v$1.record(v$1.string(), ModelSpecSchema);
3879
+ const dateSchema = v$1.pipe(v$1.string(), v$1.regex(/^\d{8}$/, "Date must be in YYYYMMDD format"));
3878
3880
 
3879
3881
  //#endregion
3880
3882
  //#region shared-args.ts
3881
3883
  const parseDateArg = (value) => {
3882
- const result = safeParse(dateSchema, value);
3884
+ const result = v.safeParse(dateSchema, value);
3883
3885
  if (!result.success) throw new TypeError(result.issues[0].message);
3884
3886
  return result.output;
3885
3887
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccusage",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Usage analysis tool for Claude Code",
5
5
  "homepage": "https://github.com/ryoppippi/ccusage#readme",
6
6
  "bugs": {
@@ -26,5 +26,13 @@
26
26
  "bin": "./dist/index.js",
27
27
  "files": [
28
28
  "dist"
29
- ]
29
+ ],
30
+ "peerDependencies": {
31
+ "valibot": "^1.1.0"
32
+ },
33
+ "peerDependenciesMeta": {
34
+ "valibot": {
35
+ "optional": true
36
+ }
37
+ }
30
38
  }