ccusage 15.9.7 → 15.9.8
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/{data-loader-G78wtKpU.js → data-loader-DGO3W7OE.js} +10 -10
- package/dist/data-loader.js +3 -3
- package/dist/{debug-BFlA56YT.js → debug-DobNnsGn.js} +3 -3
- package/dist/debug.js +4 -4
- package/dist/index.js +1279 -206
- package/dist/{logger-CHezuMoN.js → logger-OEFb8rpr.js} +1 -1
- package/dist/logger.js +1 -1
- package/dist/{mcp-BEHYXSQT.js → mcp-BNRa354P.js} +3 -3
- package/dist/mcp.js +4 -4
- package/dist/{pricing-fetcher-CLjmfFHB.js → pricing-fetcher-s0HJ9Lpa.js} +2 -2
- package/dist/pricing-fetcher.js +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { BLOCKS_COMPACT_WIDTH_THRESHOLD, BLOCKS_DEFAULT_TERMINAL_WIDTH, BLOCKS_WARNING_THRESHOLD, BURN_RATE_THRESHOLDS, DEFAULT_RECENT_DAYS, DEFAULT_REFRESH_INTERVAL_SECONDS, MAX_REFRESH_INTERVAL_SECONDS, MCP_DEFAULT_PORT, MIN_REFRESH_INTERVAL_SECONDS, MIN_RENDER_INTERVAL_MS, PROJECT_ALIASES_ENV, PricingFetcher, WEEK_DAYS, __commonJSMin, __require, __toESM, inspectError, isFailure, map, pipe, require_usingCtx, try_ } from "./pricing-fetcher-
|
|
2
|
+
import { BLOCKS_COMPACT_WIDTH_THRESHOLD, BLOCKS_DEFAULT_TERMINAL_WIDTH, BLOCKS_WARNING_THRESHOLD, BURN_RATE_THRESHOLDS, DEFAULT_RECENT_DAYS, DEFAULT_REFRESH_INTERVAL_SECONDS, MAX_REFRESH_INTERVAL_SECONDS, MCP_DEFAULT_PORT, MIN_REFRESH_INTERVAL_SECONDS, MIN_RENDER_INTERVAL_MS, PROJECT_ALIASES_ENV, PricingFetcher, WEEK_DAYS, __commonJSMin, __require, __toESM, inspectError, isFailure, isSuccess, map, pipe, require_usingCtx, succeed, try_ } from "./pricing-fetcher-s0HJ9Lpa.js";
|
|
3
3
|
import { getTotalTokens } from "./_token-utils-WjkbrjKv.js";
|
|
4
4
|
import { CostModes, SortOrders, filterDateSchema, statuslineHookJsonSchema } from "./_types-BbEk8t2a.js";
|
|
5
5
|
import { calculateTotals, createTotalsObject } from "./calculate-cost-BDqO4yWA.js";
|
|
6
|
-
import { DEFAULT_SESSION_DURATION_HOURS, calculateBurnRate, calculateContextTokens, calculateCostForEntry, createUniqueHash, filterRecentBlocks, formatDateCompact, getClaudePaths, getContextUsageThresholds, getEarliestTimestamp, getUsageLimitResetTime, globUsageFiles, identifySessionBlocks, loadDailyUsageData, loadMonthlyUsageData, loadSessionBlockData, loadSessionData, loadSessionUsageById, loadWeeklyUsageData, projectBlockUsage, sortFilesByTimestamp, uniq, unwrap, usageDataSchema } from "./data-loader-
|
|
7
|
-
import { description, log, logger, name, version } from "./logger-
|
|
8
|
-
import { detectMismatches, printMismatchReport } from "./debug-
|
|
9
|
-
import { createMcpHttpApp, createMcpServer, startMcpServerStdio } from "./mcp-
|
|
10
|
-
import a, { readFile } from "node:fs/promises";
|
|
11
|
-
import path from "node:path";
|
|
6
|
+
import { DEFAULT_SESSION_DURATION_HOURS, calculateBurnRate, calculateContextTokens, calculateCostForEntry, createUniqueHash, filterRecentBlocks, formatDateCompact, getClaudePaths, getContextUsageThresholds, getEarliestTimestamp, getUsageLimitResetTime, globUsageFiles, identifySessionBlocks, loadDailyUsageData, loadMonthlyUsageData, loadSessionBlockData, loadSessionData, loadSessionUsageById, loadWeeklyUsageData, projectBlockUsage, sortFilesByTimestamp, uniq, unwrap, usageDataSchema } from "./data-loader-DGO3W7OE.js";
|
|
7
|
+
import { description, log, logger, name, version } from "./logger-OEFb8rpr.js";
|
|
8
|
+
import { detectMismatches, printMismatchReport } from "./debug-DobNnsGn.js";
|
|
9
|
+
import { createMcpHttpApp, createMcpServer, startMcpServerStdio } from "./mcp-BNRa354P.js";
|
|
10
|
+
import a, { readFile, stat } from "node:fs/promises";
|
|
11
|
+
import path, { join } from "node:path";
|
|
12
12
|
import process$1 from "node:process";
|
|
13
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
14
|
+
import { tmpdir } from "node:os";
|
|
13
15
|
import { stripVTControlCharacters } from "node:util";
|
|
14
16
|
import { fileURLToPath } from "node:url";
|
|
15
17
|
import { spawn } from "node:child_process";
|
|
@@ -81,8 +83,8 @@ async function resolveExamples(ctx, examples) {
|
|
|
81
83
|
return typeof examples === "string" ? examples : typeof examples === "function" ? await examples(ctx) : "";
|
|
82
84
|
}
|
|
83
85
|
function mapResourceWithBuiltinKey(resource) {
|
|
84
|
-
return Object.entries(resource).reduce((acc, [key, value]) => {
|
|
85
|
-
return acc[resolveBuiltInKey(key)] = value, acc;
|
|
86
|
+
return Object.entries(resource).reduce((acc, [key, value$1]) => {
|
|
87
|
+
return acc[resolveBuiltInKey(key)] = value$1, acc;
|
|
86
88
|
}, create());
|
|
87
89
|
}
|
|
88
90
|
function create(obj = null) {
|
|
@@ -94,8 +96,8 @@ function log$1(...args) {
|
|
|
94
96
|
function deepFreeze(obj) {
|
|
95
97
|
if (obj === null || typeof obj !== "object") return obj;
|
|
96
98
|
for (const key of Object.keys(obj)) {
|
|
97
|
-
const value = obj[key];
|
|
98
|
-
if (typeof value === "object" && value !== null) deepFreeze(value);
|
|
99
|
+
const value$1 = obj[key];
|
|
100
|
+
if (typeof value$1 === "object" && value$1 !== null) deepFreeze(value$1);
|
|
99
101
|
}
|
|
100
102
|
return Object.freeze(obj);
|
|
101
103
|
}
|
|
@@ -143,8 +145,8 @@ var DefaultTranslation = class {
|
|
|
143
145
|
};
|
|
144
146
|
const BUILT_IN_PREFIX_CODE = BUILT_IN_PREFIX.codePointAt(0);
|
|
145
147
|
async function createCommandContext({ args, values, positionals, rest, argv: argv$1, tokens, command, cliOptions, callMode = "entry", omitted = false }) {
|
|
146
|
-
const _args = Object.entries(args).reduce((acc, [key, value]) => {
|
|
147
|
-
return acc[key] = Object.assign(create(), value), acc;
|
|
148
|
+
const _args = Object.entries(args).reduce((acc, [key, value$1]) => {
|
|
149
|
+
return acc[key] = Object.assign(create(), value$1), acc;
|
|
148
150
|
}, create()), env$2 = Object.assign(create(), COMMAND_OPTIONS_DEFAULT, cliOptions), locale = resolveLocale(cliOptions.locale), localeStr = locale.toString(), translationAdapterFactory = cliOptions.translationAdapterFactory || createTranslationAdapter, adapter = translationAdapterFactory({
|
|
149
151
|
locale: localeStr,
|
|
150
152
|
fallbackLocale: DEFAULT_LOCALE
|
|
@@ -186,8 +188,8 @@ async function createCommandContext({ args, values, positionals, rest, argv: arg
|
|
|
186
188
|
})), loadedOptionsResources = Object.entries(args).map(([key, arg]) => {
|
|
187
189
|
const description$1 = arg.description || "";
|
|
188
190
|
return [key, description$1];
|
|
189
|
-
}), defaultCommandResource = loadedOptionsResources.reduce((res, [key, value]) => {
|
|
190
|
-
return res[resolveArgKey(key)] = value, res;
|
|
191
|
+
}), defaultCommandResource = loadedOptionsResources.reduce((res, [key, value$1]) => {
|
|
192
|
+
return res[resolveArgKey(key)] = value$1, res;
|
|
191
193
|
}, create());
|
|
192
194
|
defaultCommandResource.description = command.description || "", defaultCommandResource.examples = await resolveExamples(ctx, command.examples), adapter.setResource(DEFAULT_LOCALE, defaultCommandResource);
|
|
193
195
|
const originalResource = await loadCommandResource(ctx, command);
|
|
@@ -211,15 +213,15 @@ async function loadCommandResource(ctx, command) {
|
|
|
211
213
|
} catch {}
|
|
212
214
|
return resource;
|
|
213
215
|
}
|
|
214
|
-
function define(definition) {
|
|
216
|
+
function define$1(definition) {
|
|
215
217
|
return definition;
|
|
216
218
|
}
|
|
217
219
|
/**
|
|
218
220
|
* @author kazuya kawaguchi (a.k.a. kazupon)
|
|
219
221
|
* @license MIT
|
|
220
222
|
*/
|
|
221
|
-
function kebabnize(str) {
|
|
222
|
-
return str.replace(/[A-Z]/g, (match, offset) => (offset > 0 ? "-" : "") + match.toLowerCase());
|
|
223
|
+
function kebabnize(str$1) {
|
|
224
|
+
return str$1.replace(/[A-Z]/g, (match, offset) => (offset > 0 ? "-" : "") + match.toLowerCase());
|
|
223
225
|
}
|
|
224
226
|
function renderHeader(ctx) {
|
|
225
227
|
const title = ctx.env.description || ctx.env.name || "";
|
|
@@ -349,13 +351,13 @@ function resolveDisplayValue(ctx, key) {
|
|
|
349
351
|
return "";
|
|
350
352
|
}
|
|
351
353
|
async function generateOptionalArgsUsage(ctx, optionsPairs) {
|
|
352
|
-
const optionsMaxLength = Math.max(...Object.entries(optionsPairs).map(([_, value]) => value.length)), optionSchemaMaxLength = ctx.env.usageOptionType ? Math.max(...Object.entries(optionsPairs).map(([key]) => resolveNegatableType(key, ctx).length)) : 0, usages = await Promise.all(Object.entries(optionsPairs).map(([key, value]) => {
|
|
354
|
+
const optionsMaxLength = Math.max(...Object.entries(optionsPairs).map(([_, value$1]) => value$1.length)), optionSchemaMaxLength = ctx.env.usageOptionType ? Math.max(...Object.entries(optionsPairs).map(([key]) => resolveNegatableType(key, ctx).length)) : 0, usages = await Promise.all(Object.entries(optionsPairs).map(([key, value$1]) => {
|
|
353
355
|
let rawDesc = ctx.translate(resolveArgKey(key));
|
|
354
356
|
if (!rawDesc && key.startsWith("no-")) {
|
|
355
357
|
const name$1 = resolveNegatableKey(key), schema = ctx.args[name$1], optionKey = makeShortLongOptionPair(schema, name$1, ctx.toKebab);
|
|
356
358
|
rawDesc = `${ctx.translate(resolveBuiltInKey("NEGATABLE"))} ${optionKey}`;
|
|
357
359
|
}
|
|
358
|
-
const optionsSchema = ctx.env.usageOptionType ? `[${resolveNegatableType(key, ctx)}] ` : "", valueDesc = key.startsWith("no-") ? "" : resolveDisplayValue(ctx, key), desc = `${optionsSchema ? optionsSchema.padEnd(optionSchemaMaxLength + 3) : ""}${rawDesc}`, option = `${value.padEnd(optionsMaxLength + ctx.env.middleMargin)}${desc}${valueDesc ? ` ${valueDesc}` : ""}`;
|
|
360
|
+
const optionsSchema = ctx.env.usageOptionType ? `[${resolveNegatableType(key, ctx)}] ` : "", valueDesc = key.startsWith("no-") ? "" : resolveDisplayValue(ctx, key), desc = `${optionsSchema ? optionsSchema.padEnd(optionSchemaMaxLength + 3) : ""}${rawDesc}`, option = `${value$1.padEnd(optionsMaxLength + ctx.env.middleMargin)}${desc}${valueDesc ? ` ${valueDesc}` : ""}`;
|
|
359
361
|
return `${option.padStart(ctx.env.leftMargin + option.length)}`;
|
|
360
362
|
}));
|
|
361
363
|
return usages.join("\n");
|
|
@@ -405,21 +407,21 @@ function parseArgs(args, options = {}) {
|
|
|
405
407
|
}
|
|
406
408
|
if (isShortOption(arg)) {
|
|
407
409
|
const shortOption = arg.charAt(1);
|
|
408
|
-
let value, inlineValue;
|
|
410
|
+
let value$1, inlineValue;
|
|
409
411
|
if (groupCount) {
|
|
410
412
|
if (tokens.push({
|
|
411
413
|
kind: "option",
|
|
412
414
|
name: shortOption,
|
|
413
415
|
rawName: arg,
|
|
414
416
|
index,
|
|
415
|
-
value,
|
|
417
|
+
value: value$1,
|
|
416
418
|
inlineValue
|
|
417
419
|
}), groupCount === 1 && hasOptionValue(nextArg)) {
|
|
418
|
-
if (value = remainings.shift(), hasShortValueSeparator) inlineValue = true, hasShortValueSeparator = false;
|
|
420
|
+
if (value$1 = remainings.shift(), hasShortValueSeparator) inlineValue = true, hasShortValueSeparator = false;
|
|
419
421
|
tokens.push({
|
|
420
422
|
kind: "option",
|
|
421
423
|
index,
|
|
422
|
-
value,
|
|
424
|
+
value: value$1,
|
|
423
425
|
inlineValue
|
|
424
426
|
});
|
|
425
427
|
}
|
|
@@ -428,10 +430,10 @@ function parseArgs(args, options = {}) {
|
|
|
428
430
|
name: shortOption,
|
|
429
431
|
rawName: arg,
|
|
430
432
|
index,
|
|
431
|
-
value,
|
|
433
|
+
value: value$1,
|
|
432
434
|
inlineValue
|
|
433
435
|
});
|
|
434
|
-
if (value != null) ++index;
|
|
436
|
+
if (value$1 != null) ++index;
|
|
435
437
|
continue;
|
|
436
438
|
}
|
|
437
439
|
if (isShortOptionGroup(arg)) {
|
|
@@ -460,13 +462,13 @@ function parseArgs(args, options = {}) {
|
|
|
460
462
|
continue;
|
|
461
463
|
}
|
|
462
464
|
if (isLongOptionAndValue(arg)) {
|
|
463
|
-
const equalIndex = arg.indexOf(EQUAL_CHAR), longOption = arg.slice(2, equalIndex), value = arg.slice(equalIndex + 1);
|
|
465
|
+
const equalIndex = arg.indexOf(EQUAL_CHAR), longOption = arg.slice(2, equalIndex), value$1 = arg.slice(equalIndex + 1);
|
|
464
466
|
tokens.push({
|
|
465
467
|
kind: "option",
|
|
466
468
|
name: longOption,
|
|
467
469
|
rawName: `${LONG_OPTION_PREFIX}${longOption}`,
|
|
468
470
|
index,
|
|
469
|
-
value,
|
|
471
|
+
value: value$1,
|
|
470
472
|
inlineValue: true
|
|
471
473
|
});
|
|
472
474
|
continue;
|
|
@@ -494,8 +496,8 @@ function isLongOptionAndValue(arg) {
|
|
|
494
496
|
function hasLongOptionPrefix(arg) {
|
|
495
497
|
return arg.length > 2 && ~arg.indexOf(LONG_OPTION_PREFIX);
|
|
496
498
|
}
|
|
497
|
-
function hasOptionValue(value) {
|
|
498
|
-
return !(value == null) && value.codePointAt(0) !== HYPHEN_CODE;
|
|
499
|
+
function hasOptionValue(value$1) {
|
|
500
|
+
return !(value$1 == null) && value$1.codePointAt(0) !== HYPHEN_CODE;
|
|
499
501
|
}
|
|
500
502
|
const SKIP_POSITIONAL_DEFAULT = -1;
|
|
501
503
|
function resolveArgs(args, tokens, { shortGrouping = false, skipPositional = SKIP_POSITIONAL_DEFAULT, toKebab = false } = {}) {
|
|
@@ -505,15 +507,15 @@ function resolveArgs(args, tokens, { shortGrouping = false, skipPositional = SKI
|
|
|
505
507
|
function toShortValue() {
|
|
506
508
|
if (expandableShortOptions.length === 0) return void 0;
|
|
507
509
|
{
|
|
508
|
-
const value = expandableShortOptions.map((token) => token.name).join("");
|
|
509
|
-
return expandableShortOptions.length = 0, value;
|
|
510
|
+
const value$1 = expandableShortOptions.map((token) => token.name).join("");
|
|
511
|
+
return expandableShortOptions.length = 0, value$1;
|
|
510
512
|
}
|
|
511
513
|
}
|
|
512
|
-
function applyLongOptionValue(value = void 0) {
|
|
513
|
-
if (currentLongOption) currentLongOption.value = value, optionTokens.push({ ...currentLongOption }), currentLongOption = void 0;
|
|
514
|
+
function applyLongOptionValue(value$1 = void 0) {
|
|
515
|
+
if (currentLongOption) currentLongOption.value = value$1, optionTokens.push({ ...currentLongOption }), currentLongOption = void 0;
|
|
514
516
|
}
|
|
515
|
-
function applyShortOptionValue(value = void 0) {
|
|
516
|
-
if (currentShortOption) currentShortOption.value = value || toShortValue(), optionTokens.push({ ...currentShortOption }), currentShortOption = void 0;
|
|
517
|
+
function applyShortOptionValue(value$1 = void 0) {
|
|
518
|
+
if (currentShortOption) currentShortOption.value = value$1 || toShortValue(), optionTokens.push({ ...currentShortOption }), currentShortOption = void 0;
|
|
517
519
|
}
|
|
518
520
|
const schemas = Object.values(args);
|
|
519
521
|
let terminated = false;
|
|
@@ -636,8 +638,8 @@ var ArgResolveError = class extends Error {
|
|
|
636
638
|
function validateRequire(token, option, schema) {
|
|
637
639
|
if (schema.required && schema.type !== "boolean" && !token.value) return createRequireError(option, schema);
|
|
638
640
|
}
|
|
639
|
-
function isNumeric(str) {
|
|
640
|
-
return str.trim() !== "" && !isNaN(str);
|
|
641
|
+
function isNumeric(str$1) {
|
|
642
|
+
return str$1.trim() !== "" && !isNaN(str$1);
|
|
641
643
|
}
|
|
642
644
|
function createTypeError(option, schema) {
|
|
643
645
|
return new ArgResolveError(`Optional argument '--${option}' ${schema.short ? `or '-${schema.short}' ` : ""}should be '${schema.type}'`, option, "type", schema);
|
|
@@ -951,8 +953,8 @@ const getErrorOutput = ({ exitCode, signalCode }) => ({
|
|
|
951
953
|
let promises = [];
|
|
952
954
|
while (iterators.length > 0) {
|
|
953
955
|
promises = iterators.map((iterator$1, index$1) => promises[index$1] ?? getNext(iterator$1));
|
|
954
|
-
const [{ value, done }, index] = await Promise.race(promises.map((promise, index$1) => Promise.all([promise, index$1]))), [iterator] = iterators.splice(index, 1);
|
|
955
|
-
if (promises.splice(index, 1), !done) iterators.push(iterator), yield value;
|
|
956
|
+
const [{ value: value$1, done }, index] = await Promise.race(promises.map((promise, index$1) => Promise.all([promise, index$1]))), [iterator] = iterators.splice(index, 1);
|
|
957
|
+
if (promises.splice(index, 1), !done) iterators.push(iterator), yield value$1;
|
|
956
958
|
}
|
|
957
959
|
} finally {
|
|
958
960
|
await Promise.all(iterators.map((iterator) => iterator.return()));
|
|
@@ -989,8 +991,8 @@ async function processWithJq(jsonData, jqCommand) {
|
|
|
989
991
|
});
|
|
990
992
|
return result();
|
|
991
993
|
}
|
|
992
|
-
function parseDateArg(value) {
|
|
993
|
-
const result = filterDateSchema.safeParse(value);
|
|
994
|
+
function parseDateArg(value$1) {
|
|
995
|
+
const result = filterDateSchema.safeParse(value$1);
|
|
994
996
|
if (!result.success) throw new TypeError(result.error.issues[0]?.message ?? "Invalid date format");
|
|
995
997
|
return result.data;
|
|
996
998
|
}
|
|
@@ -1126,34 +1128,34 @@ var require_debug$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1126
1128
|
function codeRegex(capture) {
|
|
1127
1129
|
return capture ? /\u001b\[((?:\d*;){0,5}\d*)m/g : /\u001b\[(?:\d*;){0,5}\d*m/g;
|
|
1128
1130
|
}
|
|
1129
|
-
function strlen(str) {
|
|
1130
|
-
let code = codeRegex(), stripped = ("" + str).replace(code, ""), split = stripped.split("\n");
|
|
1131
|
+
function strlen(str$1) {
|
|
1132
|
+
let code = codeRegex(), stripped = ("" + str$1).replace(code, ""), split = stripped.split("\n");
|
|
1131
1133
|
return split.reduce(function(memo, s) {
|
|
1132
1134
|
return stringWidth$1(s) > memo ? stringWidth$1(s) : memo;
|
|
1133
1135
|
}, 0);
|
|
1134
1136
|
}
|
|
1135
|
-
function repeat(str, times) {
|
|
1136
|
-
return Array(times + 1).join(str);
|
|
1137
|
+
function repeat(str$1, times) {
|
|
1138
|
+
return Array(times + 1).join(str$1);
|
|
1137
1139
|
}
|
|
1138
|
-
function pad(str, len, pad$1, dir) {
|
|
1139
|
-
let length = strlen(str);
|
|
1140
|
+
function pad(str$1, len, pad$1, dir) {
|
|
1141
|
+
let length = strlen(str$1);
|
|
1140
1142
|
if (len + 1 >= length) {
|
|
1141
1143
|
let padlen = len - length;
|
|
1142
1144
|
switch (dir) {
|
|
1143
1145
|
case "right":
|
|
1144
|
-
str = repeat(pad$1, padlen) + str;
|
|
1146
|
+
str$1 = repeat(pad$1, padlen) + str$1;
|
|
1145
1147
|
break;
|
|
1146
1148
|
case "center": {
|
|
1147
1149
|
let right = Math.ceil(padlen / 2), left = padlen - right;
|
|
1148
|
-
str = repeat(pad$1, left) + str + repeat(pad$1, right);
|
|
1150
|
+
str$1 = repeat(pad$1, left) + str$1 + repeat(pad$1, right);
|
|
1149
1151
|
break;
|
|
1150
1152
|
}
|
|
1151
1153
|
default:
|
|
1152
|
-
str = str + repeat(pad$1, padlen);
|
|
1154
|
+
str$1 = str$1 + repeat(pad$1, padlen);
|
|
1153
1155
|
break;
|
|
1154
1156
|
}
|
|
1155
1157
|
}
|
|
1156
|
-
return str;
|
|
1158
|
+
return str$1;
|
|
1157
1159
|
}
|
|
1158
1160
|
let codeCache = {};
|
|
1159
1161
|
function addToCodeCache(name$1, on$1, off) {
|
|
@@ -1209,15 +1211,15 @@ var require_debug$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1209
1211
|
if (lastForegroundAdded && lastForegroundAdded != "\x1B[39m") ret = lastForegroundAdded + ret;
|
|
1210
1212
|
return ret;
|
|
1211
1213
|
}
|
|
1212
|
-
function truncateWidth(str, desiredLength) {
|
|
1213
|
-
if (str.length === strlen(str)) return str.substr(0, desiredLength);
|
|
1214
|
-
while (strlen(str) > desiredLength) str = str.slice(0, -1);
|
|
1215
|
-
return str;
|
|
1214
|
+
function truncateWidth(str$1, desiredLength) {
|
|
1215
|
+
if (str$1.length === strlen(str$1)) return str$1.substr(0, desiredLength);
|
|
1216
|
+
while (strlen(str$1) > desiredLength) str$1 = str$1.slice(0, -1);
|
|
1217
|
+
return str$1;
|
|
1216
1218
|
}
|
|
1217
|
-
function truncateWidthWithAnsi(str, desiredLength) {
|
|
1218
|
-
let code = codeRegex(true), split = str.split(codeRegex()), splitIndex = 0, retLen = 0, ret = "", myArray, state = {};
|
|
1219
|
+
function truncateWidthWithAnsi(str$1, desiredLength) {
|
|
1220
|
+
let code = codeRegex(true), split = str$1.split(codeRegex()), splitIndex = 0, retLen = 0, ret = "", myArray, state = {};
|
|
1219
1221
|
while (retLen < desiredLength) {
|
|
1220
|
-
myArray = code.exec(str);
|
|
1222
|
+
myArray = code.exec(str$1);
|
|
1221
1223
|
let toAdd = split[splitIndex];
|
|
1222
1224
|
if (splitIndex++, retLen + strlen(toAdd) > desiredLength) toAdd = truncateWidth(toAdd, desiredLength - retLen);
|
|
1223
1225
|
if (ret += toAdd, retLen += strlen(toAdd), retLen < desiredLength) {
|
|
@@ -1227,15 +1229,15 @@ var require_debug$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1227
1229
|
}
|
|
1228
1230
|
return unwindState(state, ret);
|
|
1229
1231
|
}
|
|
1230
|
-
function truncate(str, desiredLength, truncateChar) {
|
|
1232
|
+
function truncate(str$1, desiredLength, truncateChar) {
|
|
1231
1233
|
truncateChar = truncateChar || "…";
|
|
1232
|
-
let lengthOfStr = strlen(str);
|
|
1233
|
-
if (lengthOfStr <= desiredLength) return str;
|
|
1234
|
+
let lengthOfStr = strlen(str$1);
|
|
1235
|
+
if (lengthOfStr <= desiredLength) return str$1;
|
|
1234
1236
|
desiredLength -= strlen(truncateChar);
|
|
1235
|
-
let ret = truncateWidthWithAnsi(str, desiredLength);
|
|
1237
|
+
let ret = truncateWidthWithAnsi(str$1, desiredLength);
|
|
1236
1238
|
ret += truncateChar;
|
|
1237
1239
|
const hrefTag = "\x1B]8;;\x07";
|
|
1238
|
-
if (str.includes(hrefTag) && !ret.includes(hrefTag)) ret += hrefTag;
|
|
1240
|
+
if (str$1.includes(hrefTag) && !ret.includes(hrefTag)) ret += hrefTag;
|
|
1239
1241
|
return ret;
|
|
1240
1242
|
}
|
|
1241
1243
|
function defaultOptions() {
|
|
@@ -1293,9 +1295,9 @@ var require_debug$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1293
1295
|
}
|
|
1294
1296
|
function textWrap(maxLength, input) {
|
|
1295
1297
|
let lines = [], line = "";
|
|
1296
|
-
function pushLine(str, ws) {
|
|
1298
|
+
function pushLine(str$1, ws) {
|
|
1297
1299
|
if (line.length && ws) line += ws;
|
|
1298
|
-
line += str;
|
|
1300
|
+
line += str$1;
|
|
1299
1301
|
while (line.length > maxLength) lines.push(line.slice(0, maxLength)), line = line.slice(maxLength);
|
|
1300
1302
|
}
|
|
1301
1303
|
let split = input.split(/(\s+)/g);
|
|
@@ -1730,11 +1732,11 @@ var require_debug$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1730
1732
|
var r = Math.floor(Math.random() * range);
|
|
1731
1733
|
return r;
|
|
1732
1734
|
}
|
|
1733
|
-
function isChar(character) {
|
|
1734
|
-
var bool = false;
|
|
1735
|
+
function isChar(character$1) {
|
|
1736
|
+
var bool$1 = false;
|
|
1735
1737
|
return all.filter(function(i) {
|
|
1736
|
-
bool = i === character;
|
|
1737
|
-
}), bool;
|
|
1738
|
+
bool$1 = i === character$1;
|
|
1739
|
+
}), bool$1;
|
|
1738
1740
|
}
|
|
1739
1741
|
function heComes(text$1, options$1) {
|
|
1740
1742
|
var result = "", counts, l;
|
|
@@ -1830,16 +1832,16 @@ var require_debug$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1830
1832
|
colors$1.enabled = true;
|
|
1831
1833
|
}, colors$1.disable = function() {
|
|
1832
1834
|
colors$1.enabled = false;
|
|
1833
|
-
}, colors$1.stripColors = colors$1.strip = function(str) {
|
|
1834
|
-
return ("" + str).replace(/\x1B\[\d+m/g, "");
|
|
1835
|
-
}, colors$1.stylize = function stylize(str, style) {
|
|
1836
|
-
if (!colors$1.enabled) return str + "";
|
|
1835
|
+
}, colors$1.stripColors = colors$1.strip = function(str$1) {
|
|
1836
|
+
return ("" + str$1).replace(/\x1B\[\d+m/g, "");
|
|
1837
|
+
}, colors$1.stylize = function stylize(str$1, style) {
|
|
1838
|
+
if (!colors$1.enabled) return str$1 + "";
|
|
1837
1839
|
var styleMap = ansiStyles[style];
|
|
1838
|
-
return !styleMap && style in colors$1 ? colors$1[style](str) : styleMap.open + str + styleMap.close;
|
|
1840
|
+
return !styleMap && style in colors$1 ? colors$1[style](str$1) : styleMap.open + str$1 + styleMap.close;
|
|
1839
1841
|
};
|
|
1840
|
-
var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g, escapeStringRegexp = function(str) {
|
|
1841
|
-
if (typeof str !== "string") throw new TypeError("Expected a string");
|
|
1842
|
-
return str.replace(matchOperatorsRe, "\\$&");
|
|
1842
|
+
var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g, escapeStringRegexp = function(str$1) {
|
|
1843
|
+
if (typeof str$1 !== "string") throw new TypeError("Expected a string");
|
|
1844
|
+
return str$1.replace(matchOperatorsRe, "\\$&");
|
|
1843
1845
|
};
|
|
1844
1846
|
function build(_styles) {
|
|
1845
1847
|
var builder = function builder$1() {
|
|
@@ -1856,18 +1858,18 @@ var require_debug$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1856
1858
|
}), ret;
|
|
1857
1859
|
})(), proto = defineProps(function colors$2() {}, styles);
|
|
1858
1860
|
function applyStyle() {
|
|
1859
|
-
var args = Array.prototype.slice.call(arguments), str = args.map(function(arg) {
|
|
1861
|
+
var args = Array.prototype.slice.call(arguments), str$1 = args.map(function(arg) {
|
|
1860
1862
|
return arg != null && arg.constructor === String ? arg : util.inspect(arg);
|
|
1861
1863
|
}).join(" ");
|
|
1862
|
-
if (!colors$1.enabled || !str) return str;
|
|
1863
|
-
var newLinesPresent = str.indexOf("\n") != -1, nestedStyles = this._styles, i = nestedStyles.length;
|
|
1864
|
+
if (!colors$1.enabled || !str$1) return str$1;
|
|
1865
|
+
var newLinesPresent = str$1.indexOf("\n") != -1, nestedStyles = this._styles, i = nestedStyles.length;
|
|
1864
1866
|
while (i--) {
|
|
1865
1867
|
var code = ansiStyles[nestedStyles[i]];
|
|
1866
|
-
if (str = code.open + str.replace(code.closeRe, code.open) + code.close, newLinesPresent) str = str.replace(newLineRegex, function(match) {
|
|
1868
|
+
if (str$1 = code.open + str$1.replace(code.closeRe, code.open) + code.close, newLinesPresent) str$1 = str$1.replace(newLineRegex, function(match) {
|
|
1867
1869
|
return code.close + match + code.open;
|
|
1868
1870
|
});
|
|
1869
1871
|
}
|
|
1870
|
-
return str;
|
|
1872
|
+
return str$1;
|
|
1871
1873
|
}
|
|
1872
1874
|
colors$1.setTheme = function(theme) {
|
|
1873
1875
|
if (typeof theme === "string") {
|
|
@@ -1875,13 +1877,13 @@ var require_debug$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1875
1877
|
return;
|
|
1876
1878
|
}
|
|
1877
1879
|
for (var style in theme) (function(style$1) {
|
|
1878
|
-
colors$1[style$1] = function(str) {
|
|
1880
|
+
colors$1[style$1] = function(str$1) {
|
|
1879
1881
|
if (typeof theme[style$1] === "object") {
|
|
1880
|
-
var out = str;
|
|
1882
|
+
var out = str$1;
|
|
1881
1883
|
for (var i in theme[style$1]) out = colors$1[theme[style$1][i]](out);
|
|
1882
1884
|
return out;
|
|
1883
1885
|
}
|
|
1884
|
-
return colors$1[theme[style$1]](str);
|
|
1886
|
+
return colors$1[theme[style$1]](str$1);
|
|
1885
1887
|
};
|
|
1886
1888
|
})(style);
|
|
1887
1889
|
};
|
|
@@ -1893,15 +1895,15 @@ var require_debug$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1893
1895
|
} };
|
|
1894
1896
|
}), ret;
|
|
1895
1897
|
}
|
|
1896
|
-
var sequencer = function sequencer$1(map$
|
|
1897
|
-
var exploded = str.split("");
|
|
1898
|
-
return exploded = exploded.map(map$
|
|
1898
|
+
var sequencer = function sequencer$1(map$3, str$1) {
|
|
1899
|
+
var exploded = str$1.split("");
|
|
1900
|
+
return exploded = exploded.map(map$3), exploded.join("");
|
|
1899
1901
|
};
|
|
1900
|
-
for (var map$
|
|
1901
|
-
colors$1[map$
|
|
1902
|
-
return sequencer(colors$1.maps[map$
|
|
1902
|
+
for (var map$2 in colors$1.trap = require_trap(), colors$1.zalgo = require_zalgo(), colors$1.maps = {}, colors$1.maps.america = require_america()(colors$1), colors$1.maps.zebra = require_zebra()(colors$1), colors$1.maps.rainbow = require_rainbow()(colors$1), colors$1.maps.random = require_random()(colors$1), colors$1.maps) (function(map$3) {
|
|
1903
|
+
colors$1[map$3] = function(str$1) {
|
|
1904
|
+
return sequencer(colors$1.maps[map$3], str$1);
|
|
1903
1905
|
};
|
|
1904
|
-
})(map$
|
|
1906
|
+
})(map$2);
|
|
1905
1907
|
defineProps(colors$1, init());
|
|
1906
1908
|
})), require_safe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1907
1909
|
var colors = require_colors();
|
|
@@ -2079,8 +2081,8 @@ var require_debug$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2079
2081
|
for (let i = 1; i < span; i++) ret += 1 + dimensionTable[startingIndex + i];
|
|
2080
2082
|
return ret;
|
|
2081
2083
|
}
|
|
2082
|
-
function sumPlusOne(a$1, b) {
|
|
2083
|
-
return a$1 + b + 1;
|
|
2084
|
+
function sumPlusOne(a$1, b$1) {
|
|
2085
|
+
return a$1 + b$1 + 1;
|
|
2084
2086
|
}
|
|
2085
2087
|
let CHAR_NAMES = [
|
|
2086
2088
|
"top",
|
|
@@ -2304,8 +2306,8 @@ var require_debug$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2304
2306
|
return result.join("\n");
|
|
2305
2307
|
}
|
|
2306
2308
|
get width() {
|
|
2307
|
-
let str = this.toString().split("\n");
|
|
2308
|
-
return str[0].length;
|
|
2309
|
+
let str$1 = this.toString().split("\n");
|
|
2310
|
+
return str$1[0].length;
|
|
2309
2311
|
}
|
|
2310
2312
|
};
|
|
2311
2313
|
Table$1.reset = () => debug.reset();
|
|
@@ -2314,8 +2316,8 @@ var require_debug$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2314
2316
|
row.forEach(function(cell) {
|
|
2315
2317
|
line.push(cell.draw(lineNum));
|
|
2316
2318
|
});
|
|
2317
|
-
let str = line.join("");
|
|
2318
|
-
if (str.length) result.push(str);
|
|
2319
|
+
let str$1 = line.join("");
|
|
2320
|
+
if (str$1.length) result.push(str$1);
|
|
2319
2321
|
}
|
|
2320
2322
|
module.exports = Table$1;
|
|
2321
2323
|
})), require_cli_table3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -2358,10 +2360,10 @@ function stringWidth(string, options = {}) {
|
|
|
2358
2360
|
if (string.length === 0) return 0;
|
|
2359
2361
|
let width = 0;
|
|
2360
2362
|
const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
|
|
2361
|
-
for (const { segment: character } of segmenter.segment(string)) {
|
|
2362
|
-
const codePoint = character.codePointAt(0);
|
|
2363
|
-
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159 || codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279 || codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071 || codePoint >= 55296 && codePoint <= 57343 || codePoint >= 65024 && codePoint <= 65039 || defaultIgnorableCodePointRegex.test(character)) continue;
|
|
2364
|
-
if ((0, import_emoji_regex.default)().test(character)) {
|
|
2363
|
+
for (const { segment: character$1 } of segmenter.segment(string)) {
|
|
2364
|
+
const codePoint = character$1.codePointAt(0);
|
|
2365
|
+
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159 || codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279 || codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071 || codePoint >= 55296 && codePoint <= 57343 || codePoint >= 65024 && codePoint <= 65039 || defaultIgnorableCodePointRegex.test(character$1)) continue;
|
|
2366
|
+
if ((0, import_emoji_regex.default)().test(character$1)) {
|
|
2365
2367
|
width += 2;
|
|
2366
2368
|
continue;
|
|
2367
2369
|
}
|
|
@@ -2369,7 +2371,7 @@ function stringWidth(string, options = {}) {
|
|
|
2369
2371
|
}
|
|
2370
2372
|
return width;
|
|
2371
2373
|
}
|
|
2372
|
-
var ResponsiveTable = class {
|
|
2374
|
+
var import_usingCtx$2 = /* @__PURE__ */ __toESM(require_usingCtx(), 1), ResponsiveTable = class {
|
|
2373
2375
|
head;
|
|
2374
2376
|
rows = [];
|
|
2375
2377
|
colAligns;
|
|
@@ -2498,6 +2500,12 @@ function pushBreakdownRows(table, breakdowns, extraColumns = 1, trailingColumns
|
|
|
2498
2500
|
table.push(row);
|
|
2499
2501
|
}
|
|
2500
2502
|
}
|
|
2503
|
+
async function getFileModifiedTime(filePath) {
|
|
2504
|
+
return pipe(try_({
|
|
2505
|
+
try: stat(filePath),
|
|
2506
|
+
catch: (error) => error
|
|
2507
|
+
}), map((stats) => stats.mtime.getTime()), unwrap(0));
|
|
2508
|
+
}
|
|
2501
2509
|
var LiveMonitor = class {
|
|
2502
2510
|
config;
|
|
2503
2511
|
fetcher = null;
|
|
@@ -2515,8 +2523,8 @@ var LiveMonitor = class {
|
|
|
2515
2523
|
if (allFiles.length === 0) return null;
|
|
2516
2524
|
const filesToRead = [];
|
|
2517
2525
|
for (const file of allFiles) {
|
|
2518
|
-
const timestamp = await getEarliestTimestamp(file), lastTimestamp = this.lastFileTimestamps.get(file);
|
|
2519
|
-
if (timestamp != null && (lastTimestamp == null || timestamp.getTime() > lastTimestamp)) filesToRead.push(file), this.lastFileTimestamps.set(file, timestamp.getTime());
|
|
2526
|
+
const timestamp$1 = await getEarliestTimestamp(file), lastTimestamp = this.lastFileTimestamps.get(file);
|
|
2527
|
+
if (timestamp$1 != null && (lastTimestamp == null || timestamp$1.getTime() > lastTimestamp)) filesToRead.push(file), this.lastFileTimestamps.set(file, timestamp$1.getTime());
|
|
2520
2528
|
}
|
|
2521
2529
|
if (filesToRead.length > 0) {
|
|
2522
2530
|
const sortedFiles = await sortFilesByTimestamp(filesToRead);
|
|
@@ -2580,12 +2588,47 @@ function setArbitraryLengthTimeout(callback, delay$1) {
|
|
|
2580
2588
|
};
|
|
2581
2589
|
return queueTimeout(), { valueOf: () => timeoutId };
|
|
2582
2590
|
}
|
|
2591
|
+
var _computedKey$1;
|
|
2592
|
+
_computedKey$1 = Symbol.asyncIterator;
|
|
2593
|
+
var MuxAsyncIterator = class {
|
|
2594
|
+
#iteratorCount = 0;
|
|
2595
|
+
#yields = [];
|
|
2596
|
+
#throws = [];
|
|
2597
|
+
#signal = Promise.withResolvers();
|
|
2598
|
+
add(iterable) {
|
|
2599
|
+
++this.#iteratorCount, this.#callIteratorNext(iterable[Symbol.asyncIterator]());
|
|
2600
|
+
}
|
|
2601
|
+
async #callIteratorNext(iterator) {
|
|
2602
|
+
try {
|
|
2603
|
+
const { value: value$1, done } = await iterator.next();
|
|
2604
|
+
if (done) --this.#iteratorCount;
|
|
2605
|
+
else this.#yields.push({
|
|
2606
|
+
iterator,
|
|
2607
|
+
value: value$1
|
|
2608
|
+
});
|
|
2609
|
+
} catch (e) {
|
|
2610
|
+
this.#throws.push(e);
|
|
2611
|
+
}
|
|
2612
|
+
this.#signal.resolve();
|
|
2613
|
+
}
|
|
2614
|
+
async *iterate() {
|
|
2615
|
+
while (this.#iteratorCount > 0) {
|
|
2616
|
+
await this.#signal.promise;
|
|
2617
|
+
for (const { iterator, value: value$1 } of this.#yields) yield value$1, this.#callIteratorNext(iterator);
|
|
2618
|
+
if (this.#throws.length) for (const e of this.#throws) throw e;
|
|
2619
|
+
this.#yields.length = 0, this.#signal = Promise.withResolvers();
|
|
2620
|
+
}
|
|
2621
|
+
}
|
|
2622
|
+
[_computedKey$1]() {
|
|
2623
|
+
return this.iterate();
|
|
2624
|
+
}
|
|
2625
|
+
};
|
|
2583
2626
|
const isBrowser = globalThis.window?.document !== void 0, isNode = globalThis.process?.versions?.node !== void 0, isBun = globalThis.process?.versions?.bun !== void 0, isDeno = globalThis.Deno?.version?.deno !== void 0, isElectron = globalThis.process?.versions?.electron !== void 0, isJsDom = globalThis.navigator?.userAgent?.includes("jsdom") === true, isWebWorker = typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope, isDedicatedWorker = typeof DedicatedWorkerGlobalScope !== "undefined" && globalThis instanceof DedicatedWorkerGlobalScope, isSharedWorker = typeof SharedWorkerGlobalScope !== "undefined" && globalThis instanceof SharedWorkerGlobalScope, isServiceWorker = typeof ServiceWorkerGlobalScope !== "undefined" && globalThis instanceof ServiceWorkerGlobalScope, platform = globalThis.navigator?.userAgentData?.platform, isMacOs = platform === "macOS" || globalThis.navigator?.platform === "MacIntel" || globalThis.navigator?.userAgent?.includes(" Mac ") === true || globalThis.process?.platform === "darwin", isWindows$1 = platform === "Windows" || globalThis.navigator?.platform === "Win32" || globalThis.process?.platform === "win32", isLinux = platform === "Linux" || globalThis.navigator?.platform?.startsWith("Linux") === true || globalThis.navigator?.userAgent?.includes(" Linux ") === true || globalThis.process?.platform === "linux", isIos = platform === "iOS" || globalThis.navigator?.platform === "MacIntel" && globalThis.navigator?.maxTouchPoints > 1 || /iPad|iPhone|iPod/.test(globalThis.navigator?.platform), isAndroid = platform === "Android" || globalThis.navigator?.platform === "Android" || globalThis.navigator?.userAgent?.includes(" Android ") === true || globalThis.process?.platform === "android", ESC = "\x1B[", SEP = ";", isTerminalApp = !isBrowser && process$1.env.TERM_PROGRAM === "Apple_Terminal", isWindows = !isBrowser && process$1.platform === "win32", cwdFunction = isBrowser ? () => {
|
|
2584
2627
|
throw new Error("`process.cwd()` only works in Node.js, not the browser.");
|
|
2585
2628
|
} : process$1.cwd, cursorTo = (x, y) => {
|
|
2586
2629
|
if (typeof x !== "number") throw new TypeError("The `x` argument is required");
|
|
2587
2630
|
return typeof y === "number" ? ESC + (y + 1) + SEP + (x + 1) + "H" : ESC + (x + 1) + "G";
|
|
2588
|
-
}, cursorForward = (count = 1) => ESC + count + "C", cursorLeft = ESC + "G", cursorSavePosition = isTerminalApp ? "\x1B7" : ESC + "s", cursorRestorePosition = isTerminalApp ? "\x1B8" : ESC + "u", cursorGetPosition = ESC + "6n", cursorNextLine = ESC + "E", cursorPrevLine = ESC + "F", cursorHide = ESC + "?25l", cursorShow = ESC + "?25h", eraseEndLine = ESC + "K", eraseStartLine = ESC + "1K", eraseLine = ESC + "2K", eraseDown = ESC + "J", eraseUp = ESC + "1J", eraseScreen = ESC + "2J", scrollUp = ESC + "S", scrollDown = ESC + "T", clearScreen = "\x1Bc", clearTerminal = isWindows ? `${eraseScreen}${ESC}0f` : `${eraseScreen}${ESC}3J${ESC}H`, enterAlternativeScreen = ESC + "?1049h", exitAlternativeScreen = ESC + "?1049l", toZeroIfInfinity = (value) => Number.isFinite(value) ? value : 0;
|
|
2631
|
+
}, cursorForward = (count = 1) => ESC + count + "C", cursorLeft = ESC + "G", cursorSavePosition = isTerminalApp ? "\x1B7" : ESC + "s", cursorRestorePosition = isTerminalApp ? "\x1B8" : ESC + "u", cursorGetPosition = ESC + "6n", cursorNextLine = ESC + "E", cursorPrevLine = ESC + "F", cursorHide = ESC + "?25l", cursorShow = ESC + "?25h", eraseEndLine = ESC + "K", eraseStartLine = ESC + "1K", eraseLine = ESC + "2K", eraseDown = ESC + "J", eraseUp = ESC + "1J", eraseScreen = ESC + "2J", scrollUp = ESC + "S", scrollDown = ESC + "T", clearScreen = "\x1Bc", clearTerminal = isWindows ? `${eraseScreen}${ESC}0f` : `${eraseScreen}${ESC}3J${ESC}H`, enterAlternativeScreen = ESC + "?1049h", exitAlternativeScreen = ESC + "?1049l", toZeroIfInfinity = (value$1) => Number.isFinite(value$1) ? value$1 : 0;
|
|
2589
2632
|
function parseNumber(milliseconds) {
|
|
2590
2633
|
return {
|
|
2591
2634
|
days: Math.trunc(milliseconds / 864e5),
|
|
@@ -2617,7 +2660,7 @@ function parseMilliseconds(milliseconds) {
|
|
|
2617
2660
|
}
|
|
2618
2661
|
throw new TypeError("Expected a finite number or bigint");
|
|
2619
2662
|
}
|
|
2620
|
-
const isZero = (value) => value === 0 || value === 0n, pluralize = (word, count) => count === 1 || count === 1n ? word : `${word}s`, SECOND_ROUNDING_EPSILON = 1e-7, ONE_DAY_IN_MILLISECONDS = 24n * 60n * 60n * 1000n;
|
|
2663
|
+
const isZero = (value$1) => value$1 === 0 || value$1 === 0n, pluralize = (word, count) => count === 1 || count === 1n ? word : `${word}s`, SECOND_ROUNDING_EPSILON = 1e-7, ONE_DAY_IN_MILLISECONDS = 24n * 60n * 60n * 1000n;
|
|
2621
2664
|
function prettyMilliseconds(milliseconds, options) {
|
|
2622
2665
|
const isBigInt = typeof milliseconds === "bigint";
|
|
2623
2666
|
if (!isBigInt && !Number.isFinite(milliseconds)) throw new TypeError("Expected a finite number or bigint");
|
|
@@ -2626,15 +2669,15 @@ function prettyMilliseconds(milliseconds, options) {
|
|
|
2626
2669
|
if (milliseconds = milliseconds < 0 ? -milliseconds : milliseconds, options.colonNotation) options.compact = false, options.formatSubMilliseconds = false, options.separateMilliseconds = false, options.verbose = false;
|
|
2627
2670
|
if (options.compact) options.unitCount = 1, options.secondsDecimalDigits = 0, options.millisecondsDecimalDigits = 0;
|
|
2628
2671
|
let result = [];
|
|
2629
|
-
const floorDecimals = (value, decimalDigits) => {
|
|
2630
|
-
const flooredInterimValue = Math.floor(value * 10 ** decimalDigits + SECOND_ROUNDING_EPSILON), flooredValue = Math.round(flooredInterimValue) / 10 ** decimalDigits;
|
|
2672
|
+
const floorDecimals = (value$1, decimalDigits) => {
|
|
2673
|
+
const flooredInterimValue = Math.floor(value$1 * 10 ** decimalDigits + SECOND_ROUNDING_EPSILON), flooredValue = Math.round(flooredInterimValue) / 10 ** decimalDigits;
|
|
2631
2674
|
return flooredValue.toFixed(decimalDigits);
|
|
2632
|
-
}, add = (value, long, short, valueString) => {
|
|
2633
|
-
if (!((result.length === 0 || !options.colonNotation) && isZero(value) && !(options.colonNotation && short === "m"))) {
|
|
2634
|
-
if (valueString ??= String(value), options.colonNotation) {
|
|
2675
|
+
}, add = (value$1, long, short, valueString) => {
|
|
2676
|
+
if (!((result.length === 0 || !options.colonNotation) && isZero(value$1) && !(options.colonNotation && short === "m"))) {
|
|
2677
|
+
if (valueString ??= String(value$1), options.colonNotation) {
|
|
2635
2678
|
const wholeDigits = valueString.includes(".") ? valueString.split(".")[0].length : valueString.length, minLength = result.length > 0 ? 2 : 1;
|
|
2636
2679
|
valueString = "0".repeat(Math.max(0, minLength - wholeDigits)) + valueString;
|
|
2637
|
-
} else valueString += options.verbose ? " " + pluralize(long, value) : short;
|
|
2680
|
+
} else valueString += options.verbose ? " " + pluralize(long, value$1) : short;
|
|
2638
2681
|
result.push(valueString);
|
|
2639
2682
|
}
|
|
2640
2683
|
}, parsed = parseMilliseconds(milliseconds), days = BigInt(parsed.days);
|
|
@@ -2720,8 +2763,8 @@ var TerminalManager = class {
|
|
|
2720
2763
|
this.showCursor(), this.exitAlternateScreen(), this.disableSyncMode();
|
|
2721
2764
|
}
|
|
2722
2765
|
};
|
|
2723
|
-
function createProgressBar(value, max, width, options = {}) {
|
|
2724
|
-
const { showPercentage = true, showValues = false, fillChar = "█", emptyChar = "░", leftBracket = "[", rightBracket = "]", colors: colors$2 = {} } = options, percentage = max > 0 ? Math.min(100, value / max * 100) : 0, fillWidth = Math.round(percentage / 100 * width), emptyWidth = width - fillWidth;
|
|
2766
|
+
function createProgressBar(value$1, max, width, options = {}) {
|
|
2767
|
+
const { showPercentage = true, showValues = false, fillChar = "█", emptyChar = "░", leftBracket = "[", rightBracket = "]", colors: colors$2 = {} } = options, percentage = max > 0 ? Math.min(100, value$1 / max * 100) : 0, fillWidth = Math.round(percentage / 100 * width), emptyWidth = width - fillWidth;
|
|
2725
2768
|
let color = "";
|
|
2726
2769
|
if (colors$2.critical != null && percentage >= 90) color = colors$2.critical;
|
|
2727
2770
|
else if (colors$2.high != null && percentage >= 80) color = colors$2.high;
|
|
@@ -2731,7 +2774,7 @@ function createProgressBar(value, max, width, options = {}) {
|
|
|
2731
2774
|
if (color !== "") bar += color;
|
|
2732
2775
|
if (bar += fillChar.repeat(fillWidth), bar += emptyChar.repeat(emptyWidth), color !== "") bar += ANSI_RESET;
|
|
2733
2776
|
if (bar += rightBracket, showPercentage) bar += ` ${percentage.toFixed(1)}%`;
|
|
2734
|
-
if (showValues) bar += ` (${value}/${max})`;
|
|
2777
|
+
if (showValues) bar += ` (${value$1}/${max})`;
|
|
2735
2778
|
return bar;
|
|
2736
2779
|
}
|
|
2737
2780
|
function centerText(text, width) {
|
|
@@ -2898,10 +2941,10 @@ function renderCompactLiveDisplay(terminal, block, config, totalTokens, elapsed,
|
|
|
2898
2941
|
if (burnRate != null) terminal.write(`Rate: ${formatNumber(burnRate.tokensPerMinute)}/min\n`);
|
|
2899
2942
|
terminal.write(`${"─".repeat(width)}\n`), terminal.write(import_picocolors$7.default.gray(`Refresh: ${config.refreshInterval / 1e3}s | Ctrl+C: stop\n`));
|
|
2900
2943
|
}
|
|
2901
|
-
var import_picocolors$6 = /* @__PURE__ */ __toESM(require_picocolors(), 1), import_usingCtx = /* @__PURE__ */ __toESM(require_usingCtx(), 1);
|
|
2944
|
+
var import_picocolors$6 = /* @__PURE__ */ __toESM(require_picocolors(), 1), import_usingCtx$1 = /* @__PURE__ */ __toESM(require_usingCtx(), 1);
|
|
2902
2945
|
async function startLiveMonitoring(config) {
|
|
2903
2946
|
try {
|
|
2904
|
-
var _usingCtx = (0, import_usingCtx.default)();
|
|
2947
|
+
var _usingCtx = (0, import_usingCtx$1.default)();
|
|
2905
2948
|
const terminal = new TerminalManager(), abortController = new AbortController();
|
|
2906
2949
|
let lastRenderTime = 0;
|
|
2907
2950
|
const cleanup = () => {
|
|
@@ -2977,12 +3020,12 @@ function formatBlockTime(block, compact = false, locale) {
|
|
|
2977
3020
|
function formatModels(models) {
|
|
2978
3021
|
return models.length === 0 ? "-" : formatModelsDisplayMultiline(models);
|
|
2979
3022
|
}
|
|
2980
|
-
function parseTokenLimit(value, maxFromAll) {
|
|
2981
|
-
if (value == null || value === "" || value === "max") return maxFromAll > 0 ? maxFromAll : void 0;
|
|
2982
|
-
const limit = Number.parseInt(value, 10);
|
|
3023
|
+
function parseTokenLimit(value$1, maxFromAll) {
|
|
3024
|
+
if (value$1 == null || value$1 === "" || value$1 === "max") return maxFromAll > 0 ? maxFromAll : void 0;
|
|
3025
|
+
const limit = Number.parseInt(value$1, 10);
|
|
2983
3026
|
return Number.isNaN(limit) ? void 0 : limit;
|
|
2984
3027
|
}
|
|
2985
|
-
const blocksCommand = define({
|
|
3028
|
+
const blocksCommand = define$1({
|
|
2986
3029
|
name: "blocks",
|
|
2987
3030
|
description: "Show usage report grouped by session billing blocks",
|
|
2988
3031
|
args: {
|
|
@@ -3242,9 +3285,9 @@ function getProjectAliases() {
|
|
|
3242
3285
|
aliasCache = /* @__PURE__ */ new Map();
|
|
3243
3286
|
const aliasEnv = (process$1.env[PROJECT_ALIASES_ENV] ?? "").trim();
|
|
3244
3287
|
if (aliasEnv === "") return aliasCache;
|
|
3245
|
-
const pairs = aliasEnv.split(",").map((pair) => pair.trim()).filter((pair) => pair !== "");
|
|
3246
|
-
for (const pair of pairs) {
|
|
3247
|
-
const parts = pair.split("=").map((s) => s.trim()), rawName = parts[0], alias = parts[1];
|
|
3288
|
+
const pairs$1 = aliasEnv.split(",").map((pair$1) => pair$1.trim()).filter((pair$1) => pair$1 !== "");
|
|
3289
|
+
for (const pair$1 of pairs$1) {
|
|
3290
|
+
const parts = pair$1.split("=").map((s) => s.trim()), rawName = parts[0], alias = parts[1];
|
|
3248
3291
|
if (rawName != null && alias != null && rawName !== "" && alias !== "") aliasCache.set(rawName, alias);
|
|
3249
3292
|
}
|
|
3250
3293
|
return aliasCache;
|
|
@@ -3286,7 +3329,7 @@ function formatProjectName(projectName) {
|
|
|
3286
3329
|
return aliases.has(parsed) ? aliases.get(parsed) : parsed;
|
|
3287
3330
|
}
|
|
3288
3331
|
var import_picocolors$4 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
|
|
3289
|
-
const dailyCommand = define({
|
|
3332
|
+
const dailyCommand = define$1({
|
|
3290
3333
|
name: "daily",
|
|
3291
3334
|
description: "Show usage report grouped by date",
|
|
3292
3335
|
...sharedCommandConfig,
|
|
@@ -3476,8 +3519,8 @@ var RequestError = class extends Error {
|
|
|
3476
3519
|
}, wrapBodyStream = Symbol("wrapBodyStream"), newRequestFromIncoming = (method, url, incoming, abortController) => {
|
|
3477
3520
|
const headerRecord = [], rawHeaders = incoming.rawHeaders;
|
|
3478
3521
|
for (let i = 0; i < rawHeaders.length; i += 2) {
|
|
3479
|
-
const { [i]: key, [i + 1]: value } = rawHeaders;
|
|
3480
|
-
if (key.charCodeAt(0) !== 58) headerRecord.push([key, value]);
|
|
3522
|
+
const { [i]: key, [i + 1]: value$1 } = rawHeaders;
|
|
3523
|
+
if (key.charCodeAt(0) !== 58) headerRecord.push([key, value$1]);
|
|
3481
3524
|
}
|
|
3482
3525
|
const init$1 = {
|
|
3483
3526
|
method,
|
|
@@ -3499,9 +3542,9 @@ var RequestError = class extends Error {
|
|
|
3499
3542
|
init$1.body = new ReadableStream({ async pull(controller) {
|
|
3500
3543
|
try {
|
|
3501
3544
|
reader ||= Readable.toWeb(incoming).getReader();
|
|
3502
|
-
const { done, value } = await reader.read();
|
|
3545
|
+
const { done, value: value$1 } = await reader.read();
|
|
3503
3546
|
if (done) controller.close();
|
|
3504
|
-
else controller.enqueue(value);
|
|
3547
|
+
else controller.enqueue(value$1);
|
|
3505
3548
|
} catch (error) {
|
|
3506
3549
|
controller.error(error);
|
|
3507
3550
|
}
|
|
@@ -3650,10 +3693,10 @@ function writeFromReadableStreamDefaultReader(reader, writable, currentReadPromi
|
|
|
3650
3693
|
function onDrain() {
|
|
3651
3694
|
reader.read().then(flow, handleStreamError);
|
|
3652
3695
|
}
|
|
3653
|
-
function flow({ done, value }) {
|
|
3696
|
+
function flow({ done, value: value$1 }) {
|
|
3654
3697
|
try {
|
|
3655
3698
|
if (done) writable.end();
|
|
3656
|
-
else if (!writable.write(value)) writable.once("drain", onDrain);
|
|
3699
|
+
else if (!writable.write(value$1)) writable.once("drain", onDrain);
|
|
3657
3700
|
else return reader.read().then(flow, handleStreamError);
|
|
3658
3701
|
} catch (e) {
|
|
3659
3702
|
handleStreamError(e);
|
|
@@ -3733,10 +3776,10 @@ var outgoingEnded = Symbol("outgoingEnded"), handleRequestError = () => new Resp
|
|
|
3733
3776
|
break;
|
|
3734
3777
|
}
|
|
3735
3778
|
}
|
|
3736
|
-
if (done && !("content-length" in resHeaderRecord)) resHeaderRecord["content-length"] = values.reduce((acc, value) => acc + value.length, 0);
|
|
3779
|
+
if (done && !("content-length" in resHeaderRecord)) resHeaderRecord["content-length"] = values.reduce((acc, value$1) => acc + value$1.length, 0);
|
|
3737
3780
|
}
|
|
3738
|
-
if (outgoing.writeHead(res.status, resHeaderRecord), values.forEach((value) => {
|
|
3739
|
-
outgoing.write(value);
|
|
3781
|
+
if (outgoing.writeHead(res.status, resHeaderRecord), values.forEach((value$1) => {
|
|
3782
|
+
outgoing.write(value$1);
|
|
3740
3783
|
}), done) outgoing.end();
|
|
3741
3784
|
else {
|
|
3742
3785
|
if (values.length === 0) flushHeaders(outgoing);
|
|
@@ -3805,7 +3848,7 @@ var outgoingEnded = Symbol("outgoingEnded"), handleRequestError = () => new Resp
|
|
|
3805
3848
|
listeningListener && listeningListener(serverInfo);
|
|
3806
3849
|
}), server;
|
|
3807
3850
|
};
|
|
3808
|
-
const mcpCommand = define({
|
|
3851
|
+
const mcpCommand = define$1({
|
|
3809
3852
|
name: "mcp",
|
|
3810
3853
|
description: "Start MCP server with usage reporting tools",
|
|
3811
3854
|
args: {
|
|
@@ -3845,7 +3888,7 @@ const mcpCommand = define({
|
|
|
3845
3888
|
}
|
|
3846
3889
|
});
|
|
3847
3890
|
var import_picocolors$3 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
|
|
3848
|
-
const monthlyCommand = define({
|
|
3891
|
+
const monthlyCommand = define$1({
|
|
3849
3892
|
name: "monthly",
|
|
3850
3893
|
description: "Show usage report grouped by month",
|
|
3851
3894
|
...sharedCommandConfig,
|
|
@@ -4051,7 +4094,7 @@ function calculateSessionTotalTokens(entries) {
|
|
|
4051
4094
|
}, 0);
|
|
4052
4095
|
}
|
|
4053
4096
|
var import_picocolors$2 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
|
|
4054
|
-
const sessionCommand = define({
|
|
4097
|
+
const sessionCommand = define$1({
|
|
4055
4098
|
name: "session",
|
|
4056
4099
|
description: "Show usage report grouped by conversation session",
|
|
4057
4100
|
...sharedCommandConfig,
|
|
@@ -4199,7 +4242,937 @@ const sessionCommand = define({
|
|
|
4199
4242
|
]), log(table.toString()), table.isCompactMode()) logger.info("\nRunning in Compact Mode"), logger.info("Expand terminal width to see cache metrics and total tokens");
|
|
4200
4243
|
}
|
|
4201
4244
|
}
|
|
4202
|
-
})
|
|
4245
|
+
});
|
|
4246
|
+
var require_main = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4247
|
+
(function(factory) {
|
|
4248
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
4249
|
+
var v = factory(__require, exports);
|
|
4250
|
+
if (v !== void 0) module.exports = v;
|
|
4251
|
+
} else if (typeof define === "function" && define.amd) define([
|
|
4252
|
+
"require",
|
|
4253
|
+
"exports",
|
|
4254
|
+
"./impl/format",
|
|
4255
|
+
"./impl/edit",
|
|
4256
|
+
"./impl/scanner",
|
|
4257
|
+
"./impl/parser"
|
|
4258
|
+
], factory);
|
|
4259
|
+
})(function(require$1, exports$1) {
|
|
4260
|
+
Object.defineProperty(exports$1, "__esModule", { value: true }), exports$1.applyEdits = exports$1.modify = exports$1.format = exports$1.printParseErrorCode = exports$1.ParseErrorCode = exports$1.stripComments = exports$1.visit = exports$1.getNodeValue = exports$1.getNodePath = exports$1.findNodeAtOffset = exports$1.findNodeAtLocation = exports$1.parseTree = exports$1.parse = exports$1.getLocation = exports$1.SyntaxKind = exports$1.ScanError = exports$1.createScanner = void 0;
|
|
4261
|
+
const formatter$1 = require$1("./impl/format"), edit = require$1("./impl/edit"), scanner = require$1("./impl/scanner"), parser = require$1("./impl/parser");
|
|
4262
|
+
exports$1.createScanner = scanner.createScanner;
|
|
4263
|
+
var ScanError;
|
|
4264
|
+
(function(ScanError$1) {
|
|
4265
|
+
ScanError$1[ScanError$1["None"] = 0] = "None", ScanError$1[ScanError$1["UnexpectedEndOfComment"] = 1] = "UnexpectedEndOfComment", ScanError$1[ScanError$1["UnexpectedEndOfString"] = 2] = "UnexpectedEndOfString", ScanError$1[ScanError$1["UnexpectedEndOfNumber"] = 3] = "UnexpectedEndOfNumber", ScanError$1[ScanError$1["InvalidUnicode"] = 4] = "InvalidUnicode", ScanError$1[ScanError$1["InvalidEscapeCharacter"] = 5] = "InvalidEscapeCharacter", ScanError$1[ScanError$1["InvalidCharacter"] = 6] = "InvalidCharacter";
|
|
4266
|
+
})(ScanError || (exports$1.ScanError = ScanError = {}));
|
|
4267
|
+
var SyntaxKind;
|
|
4268
|
+
(function(SyntaxKind$1) {
|
|
4269
|
+
SyntaxKind$1[SyntaxKind$1["OpenBraceToken"] = 1] = "OpenBraceToken", SyntaxKind$1[SyntaxKind$1["CloseBraceToken"] = 2] = "CloseBraceToken", SyntaxKind$1[SyntaxKind$1["OpenBracketToken"] = 3] = "OpenBracketToken", SyntaxKind$1[SyntaxKind$1["CloseBracketToken"] = 4] = "CloseBracketToken", SyntaxKind$1[SyntaxKind$1["CommaToken"] = 5] = "CommaToken", SyntaxKind$1[SyntaxKind$1["ColonToken"] = 6] = "ColonToken", SyntaxKind$1[SyntaxKind$1["NullKeyword"] = 7] = "NullKeyword", SyntaxKind$1[SyntaxKind$1["TrueKeyword"] = 8] = "TrueKeyword", SyntaxKind$1[SyntaxKind$1["FalseKeyword"] = 9] = "FalseKeyword", SyntaxKind$1[SyntaxKind$1["StringLiteral"] = 10] = "StringLiteral", SyntaxKind$1[SyntaxKind$1["NumericLiteral"] = 11] = "NumericLiteral", SyntaxKind$1[SyntaxKind$1["LineCommentTrivia"] = 12] = "LineCommentTrivia", SyntaxKind$1[SyntaxKind$1["BlockCommentTrivia"] = 13] = "BlockCommentTrivia", SyntaxKind$1[SyntaxKind$1["LineBreakTrivia"] = 14] = "LineBreakTrivia", SyntaxKind$1[SyntaxKind$1["Trivia"] = 15] = "Trivia", SyntaxKind$1[SyntaxKind$1["Unknown"] = 16] = "Unknown", SyntaxKind$1[SyntaxKind$1["EOF"] = 17] = "EOF";
|
|
4270
|
+
})(SyntaxKind || (exports$1.SyntaxKind = SyntaxKind = {})), exports$1.getLocation = parser.getLocation, exports$1.parse = parser.parse, exports$1.parseTree = parser.parseTree, exports$1.findNodeAtLocation = parser.findNodeAtLocation, exports$1.findNodeAtOffset = parser.findNodeAtOffset, exports$1.getNodePath = parser.getNodePath, exports$1.getNodeValue = parser.getNodeValue, exports$1.visit = parser.visit, exports$1.stripComments = parser.stripComments;
|
|
4271
|
+
var ParseErrorCode;
|
|
4272
|
+
(function(ParseErrorCode$1) {
|
|
4273
|
+
ParseErrorCode$1[ParseErrorCode$1["InvalidSymbol"] = 1] = "InvalidSymbol", ParseErrorCode$1[ParseErrorCode$1["InvalidNumberFormat"] = 2] = "InvalidNumberFormat", ParseErrorCode$1[ParseErrorCode$1["PropertyNameExpected"] = 3] = "PropertyNameExpected", ParseErrorCode$1[ParseErrorCode$1["ValueExpected"] = 4] = "ValueExpected", ParseErrorCode$1[ParseErrorCode$1["ColonExpected"] = 5] = "ColonExpected", ParseErrorCode$1[ParseErrorCode$1["CommaExpected"] = 6] = "CommaExpected", ParseErrorCode$1[ParseErrorCode$1["CloseBraceExpected"] = 7] = "CloseBraceExpected", ParseErrorCode$1[ParseErrorCode$1["CloseBracketExpected"] = 8] = "CloseBracketExpected", ParseErrorCode$1[ParseErrorCode$1["EndOfFileExpected"] = 9] = "EndOfFileExpected", ParseErrorCode$1[ParseErrorCode$1["InvalidCommentToken"] = 10] = "InvalidCommentToken", ParseErrorCode$1[ParseErrorCode$1["UnexpectedEndOfComment"] = 11] = "UnexpectedEndOfComment", ParseErrorCode$1[ParseErrorCode$1["UnexpectedEndOfString"] = 12] = "UnexpectedEndOfString", ParseErrorCode$1[ParseErrorCode$1["UnexpectedEndOfNumber"] = 13] = "UnexpectedEndOfNumber", ParseErrorCode$1[ParseErrorCode$1["InvalidUnicode"] = 14] = "InvalidUnicode", ParseErrorCode$1[ParseErrorCode$1["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter", ParseErrorCode$1[ParseErrorCode$1["InvalidCharacter"] = 16] = "InvalidCharacter";
|
|
4274
|
+
})(ParseErrorCode || (exports$1.ParseErrorCode = ParseErrorCode = {}));
|
|
4275
|
+
function printParseErrorCode(code) {
|
|
4276
|
+
switch (code) {
|
|
4277
|
+
case 1: return "InvalidSymbol";
|
|
4278
|
+
case 2: return "InvalidNumberFormat";
|
|
4279
|
+
case 3: return "PropertyNameExpected";
|
|
4280
|
+
case 4: return "ValueExpected";
|
|
4281
|
+
case 5: return "ColonExpected";
|
|
4282
|
+
case 6: return "CommaExpected";
|
|
4283
|
+
case 7: return "CloseBraceExpected";
|
|
4284
|
+
case 8: return "CloseBracketExpected";
|
|
4285
|
+
case 9: return "EndOfFileExpected";
|
|
4286
|
+
case 10: return "InvalidCommentToken";
|
|
4287
|
+
case 11: return "UnexpectedEndOfComment";
|
|
4288
|
+
case 12: return "UnexpectedEndOfString";
|
|
4289
|
+
case 13: return "UnexpectedEndOfNumber";
|
|
4290
|
+
case 14: return "InvalidUnicode";
|
|
4291
|
+
case 15: return "InvalidEscapeCharacter";
|
|
4292
|
+
case 16: return "InvalidCharacter";
|
|
4293
|
+
}
|
|
4294
|
+
return "<unknown ParseErrorCode>";
|
|
4295
|
+
}
|
|
4296
|
+
exports$1.printParseErrorCode = printParseErrorCode;
|
|
4297
|
+
function format(documentText, range, options) {
|
|
4298
|
+
return formatter$1.format(documentText, range, options);
|
|
4299
|
+
}
|
|
4300
|
+
exports$1.format = format;
|
|
4301
|
+
function modify(text, path$1, value$1, options) {
|
|
4302
|
+
return edit.setProperty(text, path$1, value$1, options);
|
|
4303
|
+
}
|
|
4304
|
+
exports$1.modify = modify;
|
|
4305
|
+
function applyEdits(text, edits) {
|
|
4306
|
+
let sortedEdits = edits.slice(0).sort((a$1, b$1) => {
|
|
4307
|
+
const diff = a$1.offset - b$1.offset;
|
|
4308
|
+
return diff === 0 ? a$1.length - b$1.length : diff;
|
|
4309
|
+
}), lastModifiedOffset = text.length;
|
|
4310
|
+
for (let i = sortedEdits.length - 1; i >= 0; i--) {
|
|
4311
|
+
let e = sortedEdits[i];
|
|
4312
|
+
if (e.offset + e.length <= lastModifiedOffset) text = edit.applyEdit(text, e);
|
|
4313
|
+
else throw new Error("Overlapping edit");
|
|
4314
|
+
lastModifiedOffset = e.offset;
|
|
4315
|
+
}
|
|
4316
|
+
return text;
|
|
4317
|
+
}
|
|
4318
|
+
exports$1.applyEdits = applyEdits;
|
|
4319
|
+
});
|
|
4320
|
+
})), import_main = /* @__PURE__ */ __toESM(require_main(), 1);
|
|
4321
|
+
function filterInPlace(array, predicate) {
|
|
4322
|
+
let outputIndex = 0;
|
|
4323
|
+
for (const cur of array) {
|
|
4324
|
+
if (!predicate(cur)) continue;
|
|
4325
|
+
array[outputIndex] = cur, outputIndex += 1;
|
|
4326
|
+
}
|
|
4327
|
+
return array.splice(outputIndex), array;
|
|
4328
|
+
}
|
|
4329
|
+
function deepMerge(record, other, options) {
|
|
4330
|
+
return deepMergeInternal(record, other, /* @__PURE__ */ new Set(), options);
|
|
4331
|
+
}
|
|
4332
|
+
function deepMergeInternal(record, other, seen, options) {
|
|
4333
|
+
const result = {}, keys = new Set([...getKeys(record), ...getKeys(other)]);
|
|
4334
|
+
for (const key of keys) {
|
|
4335
|
+
if (key === "__proto__") continue;
|
|
4336
|
+
const a$1 = record[key];
|
|
4337
|
+
if (!Object.hasOwn(other, key)) {
|
|
4338
|
+
result[key] = a$1;
|
|
4339
|
+
continue;
|
|
4340
|
+
}
|
|
4341
|
+
const b$1 = other[key];
|
|
4342
|
+
if (isNonNullObject(a$1) && isNonNullObject(b$1) && !seen.has(a$1) && !seen.has(b$1)) {
|
|
4343
|
+
seen.add(a$1), seen.add(b$1), result[key] = mergeObjects(a$1, b$1, seen, options);
|
|
4344
|
+
continue;
|
|
4345
|
+
}
|
|
4346
|
+
result[key] = b$1;
|
|
4347
|
+
}
|
|
4348
|
+
return result;
|
|
4349
|
+
}
|
|
4350
|
+
function mergeObjects(left, right, seen, options = {
|
|
4351
|
+
arrays: "merge",
|
|
4352
|
+
sets: "merge",
|
|
4353
|
+
maps: "merge"
|
|
4354
|
+
}) {
|
|
4355
|
+
if (isMergeable(left) && isMergeable(right)) return deepMergeInternal(left, right, seen, options);
|
|
4356
|
+
if (isIterable(left) && isIterable(right)) {
|
|
4357
|
+
if (Array.isArray(left) && Array.isArray(right)) return options.arrays === "merge" ? left.concat(right) : right;
|
|
4358
|
+
if (left instanceof Map && right instanceof Map) return options.maps === "merge" ? new Map([...left, ...right]) : right;
|
|
4359
|
+
if (left instanceof Set && right instanceof Set) return options.sets === "merge" ? new Set([...left, ...right]) : right;
|
|
4360
|
+
}
|
|
4361
|
+
return right;
|
|
4362
|
+
}
|
|
4363
|
+
function isMergeable(value$1) {
|
|
4364
|
+
return Object.getPrototypeOf(value$1) === Object.prototype;
|
|
4365
|
+
}
|
|
4366
|
+
function isIterable(value$1) {
|
|
4367
|
+
return typeof value$1[Symbol.iterator] === "function";
|
|
4368
|
+
}
|
|
4369
|
+
function isNonNullObject(value$1) {
|
|
4370
|
+
return value$1 !== null && typeof value$1 === "object";
|
|
4371
|
+
}
|
|
4372
|
+
function getKeys(record) {
|
|
4373
|
+
const result = Object.getOwnPropertySymbols(record);
|
|
4374
|
+
return filterInPlace(result, (key) => Object.prototype.propertyIsEnumerable.call(record, key)), result.push(...Object.keys(record)), result;
|
|
4375
|
+
}
|
|
4376
|
+
function isLeap(yearNumber) {
|
|
4377
|
+
return yearNumber % 4 === 0 && yearNumber % 100 !== 0 || yearNumber % 400 === 0;
|
|
4378
|
+
}
|
|
4379
|
+
function success(body) {
|
|
4380
|
+
return {
|
|
4381
|
+
ok: true,
|
|
4382
|
+
body
|
|
4383
|
+
};
|
|
4384
|
+
}
|
|
4385
|
+
function failure() {
|
|
4386
|
+
return { ok: false };
|
|
4387
|
+
}
|
|
4388
|
+
function unflat(keys, values = { __proto__: null }) {
|
|
4389
|
+
return keys.reduceRight((acc, key) => ({ [key]: acc }), values);
|
|
4390
|
+
}
|
|
4391
|
+
function or(parsers) {
|
|
4392
|
+
return (scanner) => {
|
|
4393
|
+
for (const parse$1 of parsers) {
|
|
4394
|
+
const result = parse$1(scanner);
|
|
4395
|
+
if (result.ok) return result;
|
|
4396
|
+
}
|
|
4397
|
+
return failure();
|
|
4398
|
+
};
|
|
4399
|
+
}
|
|
4400
|
+
function join$1(parser, separator) {
|
|
4401
|
+
const Separator = character(separator);
|
|
4402
|
+
return (scanner) => {
|
|
4403
|
+
const out = [], first = parser(scanner);
|
|
4404
|
+
if (!first.ok) return success(out);
|
|
4405
|
+
out.push(first.body);
|
|
4406
|
+
while (!scanner.eof()) {
|
|
4407
|
+
if (!Separator(scanner).ok) break;
|
|
4408
|
+
const result = parser(scanner);
|
|
4409
|
+
if (!result.ok) throw new SyntaxError(`Invalid token after "${separator}"`);
|
|
4410
|
+
out.push(result.body);
|
|
4411
|
+
}
|
|
4412
|
+
return success(out);
|
|
4413
|
+
};
|
|
4414
|
+
}
|
|
4415
|
+
function join1(parser, separator) {
|
|
4416
|
+
const Separator = character(separator);
|
|
4417
|
+
return (scanner) => {
|
|
4418
|
+
const first = parser(scanner);
|
|
4419
|
+
if (!first.ok) return failure();
|
|
4420
|
+
const out = [first.body];
|
|
4421
|
+
while (!scanner.eof()) {
|
|
4422
|
+
if (!Separator(scanner).ok) break;
|
|
4423
|
+
const result = parser(scanner);
|
|
4424
|
+
if (!result.ok) throw new SyntaxError(`Invalid token after "${separator}"`);
|
|
4425
|
+
out.push(result.body);
|
|
4426
|
+
}
|
|
4427
|
+
return success(out);
|
|
4428
|
+
};
|
|
4429
|
+
}
|
|
4430
|
+
function kv(keyParser, separator, valueParser) {
|
|
4431
|
+
const Separator = character(separator);
|
|
4432
|
+
return (scanner) => {
|
|
4433
|
+
const position = scanner.position, key = keyParser(scanner);
|
|
4434
|
+
if (!key.ok) return failure();
|
|
4435
|
+
const sep$1 = Separator(scanner);
|
|
4436
|
+
if (!sep$1.ok) throw new SyntaxError(`key/value pair doesn't have "${separator}"`);
|
|
4437
|
+
const value$1 = valueParser(scanner);
|
|
4438
|
+
if (!value$1.ok) {
|
|
4439
|
+
const lineEndIndex = scanner.source.indexOf("\n", scanner.position), endPosition = lineEndIndex > 0 ? lineEndIndex : scanner.source.length, line = scanner.source.slice(position, endPosition);
|
|
4440
|
+
throw new SyntaxError(`Cannot parse value on line '${line}'`);
|
|
4441
|
+
}
|
|
4442
|
+
return success(unflat(key.body, value$1.body));
|
|
4443
|
+
};
|
|
4444
|
+
}
|
|
4445
|
+
function surround(left, parser, right) {
|
|
4446
|
+
const Left = character(left), Right = character(right);
|
|
4447
|
+
return (scanner) => {
|
|
4448
|
+
if (!Left(scanner).ok) return failure();
|
|
4449
|
+
const result = parser(scanner);
|
|
4450
|
+
if (!result.ok) throw new SyntaxError(`Invalid token after "${left}"`);
|
|
4451
|
+
if (!Right(scanner).ok) throw new SyntaxError(`Not closed by "${right}" after started with "${left}"`);
|
|
4452
|
+
return success(result.body);
|
|
4453
|
+
};
|
|
4454
|
+
}
|
|
4455
|
+
function character(str$1) {
|
|
4456
|
+
return (scanner) => {
|
|
4457
|
+
return scanner.skipWhitespaces(), scanner.startsWith(str$1) ? (scanner.next(str$1.length), scanner.skipWhitespaces(), success(void 0)) : failure();
|
|
4458
|
+
};
|
|
4459
|
+
}
|
|
4460
|
+
const BARE_KEY_REGEXP = /[A-Za-z0-9_-]+/y;
|
|
4461
|
+
function bareKey(scanner) {
|
|
4462
|
+
scanner.skipWhitespaces();
|
|
4463
|
+
const key = scanner.match(BARE_KEY_REGEXP)?.[0];
|
|
4464
|
+
return key ? (scanner.next(key.length), success(key)) : failure();
|
|
4465
|
+
}
|
|
4466
|
+
function escapeSequence(scanner) {
|
|
4467
|
+
if (scanner.char() !== "\\") return failure();
|
|
4468
|
+
switch (scanner.next(), scanner.char()) {
|
|
4469
|
+
case "b": return scanner.next(), success("\b");
|
|
4470
|
+
case "t": return scanner.next(), success(" ");
|
|
4471
|
+
case "n": return scanner.next(), success("\n");
|
|
4472
|
+
case "f": return scanner.next(), success("\f");
|
|
4473
|
+
case "r": return scanner.next(), success("\r");
|
|
4474
|
+
case "u":
|
|
4475
|
+
case "U": {
|
|
4476
|
+
const codePointLen = scanner.char() === "u" ? 4 : 6, codePoint = parseInt("0x" + scanner.slice(1, 1 + codePointLen), 16), str$1 = String.fromCodePoint(codePoint);
|
|
4477
|
+
return scanner.next(codePointLen + 1), success(str$1);
|
|
4478
|
+
}
|
|
4479
|
+
case "\"": return scanner.next(), success("\"");
|
|
4480
|
+
case "\\": return scanner.next(), success("\\");
|
|
4481
|
+
default: throw new SyntaxError(`Invalid escape sequence: \\${scanner.char()}`);
|
|
4482
|
+
}
|
|
4483
|
+
}
|
|
4484
|
+
function basicString(scanner) {
|
|
4485
|
+
if (scanner.skipWhitespaces(), scanner.char() !== "\"") return failure();
|
|
4486
|
+
scanner.next();
|
|
4487
|
+
const acc = [];
|
|
4488
|
+
while (scanner.char() !== "\"" && !scanner.eof()) {
|
|
4489
|
+
if (scanner.char() === "\n") throw new SyntaxError("Single-line string cannot contain EOL");
|
|
4490
|
+
const escapedChar = escapeSequence(scanner);
|
|
4491
|
+
if (escapedChar.ok) acc.push(escapedChar.body);
|
|
4492
|
+
else acc.push(scanner.char()), scanner.next();
|
|
4493
|
+
}
|
|
4494
|
+
if (scanner.eof()) throw new SyntaxError(`Single-line string is not closed:\n${acc.join("")}`);
|
|
4495
|
+
return scanner.next(), success(acc.join(""));
|
|
4496
|
+
}
|
|
4497
|
+
function literalString(scanner) {
|
|
4498
|
+
if (scanner.skipWhitespaces(), scanner.char() !== "'") return failure();
|
|
4499
|
+
scanner.next();
|
|
4500
|
+
const acc = [];
|
|
4501
|
+
while (scanner.char() !== "'" && !scanner.eof()) {
|
|
4502
|
+
if (scanner.char() === "\n") throw new SyntaxError("Single-line string cannot contain EOL");
|
|
4503
|
+
acc.push(scanner.char()), scanner.next();
|
|
4504
|
+
}
|
|
4505
|
+
if (scanner.eof()) throw new SyntaxError(`Single-line string is not closed:\n${acc.join("")}`);
|
|
4506
|
+
return scanner.next(), success(acc.join(""));
|
|
4507
|
+
}
|
|
4508
|
+
function multilineBasicString(scanner) {
|
|
4509
|
+
if (scanner.skipWhitespaces(), !scanner.startsWith("\"\"\"")) return failure();
|
|
4510
|
+
if (scanner.next(3), scanner.char() === "\n") scanner.next();
|
|
4511
|
+
else if (scanner.startsWith("\r\n")) scanner.next(2);
|
|
4512
|
+
const acc = [];
|
|
4513
|
+
while (!scanner.startsWith("\"\"\"") && !scanner.eof()) {
|
|
4514
|
+
if (scanner.startsWith("\\\n")) {
|
|
4515
|
+
scanner.next(), scanner.nextUntilChar({ skipComments: false });
|
|
4516
|
+
continue;
|
|
4517
|
+
} else if (scanner.startsWith("\\\r\n")) {
|
|
4518
|
+
scanner.next(), scanner.nextUntilChar({ skipComments: false });
|
|
4519
|
+
continue;
|
|
4520
|
+
}
|
|
4521
|
+
const escapedChar = escapeSequence(scanner);
|
|
4522
|
+
if (escapedChar.ok) acc.push(escapedChar.body);
|
|
4523
|
+
else acc.push(scanner.char()), scanner.next();
|
|
4524
|
+
}
|
|
4525
|
+
if (scanner.eof()) throw new SyntaxError(`Multi-line string is not closed:\n${acc.join("")}`);
|
|
4526
|
+
if (scanner.char(3) === "\"") acc.push("\""), scanner.next();
|
|
4527
|
+
return scanner.next(3), success(acc.join(""));
|
|
4528
|
+
}
|
|
4529
|
+
function multilineLiteralString(scanner) {
|
|
4530
|
+
if (scanner.skipWhitespaces(), !scanner.startsWith("'''")) return failure();
|
|
4531
|
+
if (scanner.next(3), scanner.char() === "\n") scanner.next();
|
|
4532
|
+
else if (scanner.startsWith("\r\n")) scanner.next(2);
|
|
4533
|
+
const acc = [];
|
|
4534
|
+
while (!scanner.startsWith("'''") && !scanner.eof()) acc.push(scanner.char()), scanner.next();
|
|
4535
|
+
if (scanner.eof()) throw new SyntaxError(`Multi-line string is not closed:\n${acc.join("")}`);
|
|
4536
|
+
if (scanner.char(3) === "'") acc.push("'"), scanner.next();
|
|
4537
|
+
return scanner.next(3), success(acc.join(""));
|
|
4538
|
+
}
|
|
4539
|
+
const BOOLEAN_REGEXP = /(?:true|false)\b/y;
|
|
4540
|
+
function boolean(scanner) {
|
|
4541
|
+
scanner.skipWhitespaces();
|
|
4542
|
+
const match = scanner.match(BOOLEAN_REGEXP);
|
|
4543
|
+
if (!match) return failure();
|
|
4544
|
+
const string = match[0];
|
|
4545
|
+
scanner.next(string.length);
|
|
4546
|
+
const value$1 = string === "true";
|
|
4547
|
+
return success(value$1);
|
|
4548
|
+
}
|
|
4549
|
+
const INFINITY_MAP = new Map([
|
|
4550
|
+
["inf", Infinity],
|
|
4551
|
+
["+inf", Infinity],
|
|
4552
|
+
["-inf", -Infinity]
|
|
4553
|
+
]), INFINITY_REGEXP = /[+-]?inf\b/y;
|
|
4554
|
+
function infinity(scanner) {
|
|
4555
|
+
scanner.skipWhitespaces();
|
|
4556
|
+
const match = scanner.match(INFINITY_REGEXP);
|
|
4557
|
+
if (!match) return failure();
|
|
4558
|
+
const string = match[0];
|
|
4559
|
+
scanner.next(string.length);
|
|
4560
|
+
const value$1 = INFINITY_MAP.get(string);
|
|
4561
|
+
return success(value$1);
|
|
4562
|
+
}
|
|
4563
|
+
const NAN_REGEXP = /[+-]?nan\b/y;
|
|
4564
|
+
function nan(scanner) {
|
|
4565
|
+
scanner.skipWhitespaces();
|
|
4566
|
+
const match = scanner.match(NAN_REGEXP);
|
|
4567
|
+
if (!match) return failure();
|
|
4568
|
+
const string = match[0];
|
|
4569
|
+
scanner.next(string.length);
|
|
4570
|
+
const value$1 = NaN;
|
|
4571
|
+
return success(value$1);
|
|
4572
|
+
}
|
|
4573
|
+
const dottedKey = join1(or([
|
|
4574
|
+
bareKey,
|
|
4575
|
+
basicString,
|
|
4576
|
+
literalString
|
|
4577
|
+
]), "."), BINARY_REGEXP = /0b[01]+(?:_[01]+)*\b/y;
|
|
4578
|
+
function binary$1(scanner) {
|
|
4579
|
+
scanner.skipWhitespaces();
|
|
4580
|
+
const match = scanner.match(BINARY_REGEXP)?.[0];
|
|
4581
|
+
if (!match) return failure();
|
|
4582
|
+
scanner.next(match.length);
|
|
4583
|
+
const value$1 = match.slice(2).replaceAll("_", ""), number = parseInt(value$1, 2);
|
|
4584
|
+
return isNaN(number) ? failure() : success(number);
|
|
4585
|
+
}
|
|
4586
|
+
const OCTAL_REGEXP = /0o[0-7]+(?:_[0-7]+)*\b/y;
|
|
4587
|
+
function octal(scanner) {
|
|
4588
|
+
scanner.skipWhitespaces();
|
|
4589
|
+
const match = scanner.match(OCTAL_REGEXP)?.[0];
|
|
4590
|
+
if (!match) return failure();
|
|
4591
|
+
scanner.next(match.length);
|
|
4592
|
+
const value$1 = match.slice(2).replaceAll("_", ""), number = parseInt(value$1, 8);
|
|
4593
|
+
return isNaN(number) ? failure() : success(number);
|
|
4594
|
+
}
|
|
4595
|
+
const HEX_REGEXP = /0x[0-9a-f]+(?:_[0-9a-f]+)*\b/iy;
|
|
4596
|
+
function hex(scanner) {
|
|
4597
|
+
scanner.skipWhitespaces();
|
|
4598
|
+
const match = scanner.match(HEX_REGEXP)?.[0];
|
|
4599
|
+
if (!match) return failure();
|
|
4600
|
+
scanner.next(match.length);
|
|
4601
|
+
const value$1 = match.slice(2).replaceAll("_", ""), number = parseInt(value$1, 16);
|
|
4602
|
+
return isNaN(number) ? failure() : success(number);
|
|
4603
|
+
}
|
|
4604
|
+
const INTEGER_REGEXP = /[+-]?(?:0|[1-9][0-9]*(?:_[0-9]+)*)\b/y;
|
|
4605
|
+
function integer(scanner) {
|
|
4606
|
+
scanner.skipWhitespaces();
|
|
4607
|
+
const match = scanner.match(INTEGER_REGEXP)?.[0];
|
|
4608
|
+
if (!match) return failure();
|
|
4609
|
+
scanner.next(match.length);
|
|
4610
|
+
const value$1 = match.replaceAll("_", ""), int$1 = parseInt(value$1, 10);
|
|
4611
|
+
return success(int$1);
|
|
4612
|
+
}
|
|
4613
|
+
const FLOAT_REGEXP = /[+-]?(?:0|[1-9][0-9]*(?:_[0-9]+)*)(?:\.[0-9]+(?:_[0-9]+)*)?(?:e[+-]?[0-9]+(?:_[0-9]+)*)?\b/iy;
|
|
4614
|
+
function float$1(scanner) {
|
|
4615
|
+
scanner.skipWhitespaces();
|
|
4616
|
+
const match = scanner.match(FLOAT_REGEXP)?.[0];
|
|
4617
|
+
if (!match) return failure();
|
|
4618
|
+
scanner.next(match.length);
|
|
4619
|
+
const value$1 = match.replaceAll("_", ""), float$2 = parseFloat(value$1);
|
|
4620
|
+
return isNaN(float$2) ? failure() : success(float$2);
|
|
4621
|
+
}
|
|
4622
|
+
const DATE_TIME_REGEXP = /(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})(?:[ 0-9TZ.:+-]+)?\b/y;
|
|
4623
|
+
function dateTime(scanner) {
|
|
4624
|
+
scanner.skipWhitespaces();
|
|
4625
|
+
const match = scanner.match(DATE_TIME_REGEXP);
|
|
4626
|
+
if (!match) return failure();
|
|
4627
|
+
const string = match[0];
|
|
4628
|
+
scanner.next(string.length);
|
|
4629
|
+
const groups = match.groups;
|
|
4630
|
+
if (groups.month == "02") {
|
|
4631
|
+
const days = parseInt(groups.day);
|
|
4632
|
+
if (days > 29) throw new SyntaxError(`Invalid date string "${match}"`);
|
|
4633
|
+
const year = parseInt(groups.year);
|
|
4634
|
+
if (days > 28 && !isLeap(year)) throw new SyntaxError(`Invalid date string "${match}"`);
|
|
4635
|
+
}
|
|
4636
|
+
const date = new Date(string.trim());
|
|
4637
|
+
if (isNaN(date.getTime())) throw new SyntaxError(`Invalid date string "${match}"`);
|
|
4638
|
+
return success(date);
|
|
4639
|
+
}
|
|
4640
|
+
const LOCAL_TIME_REGEXP = /(\d{2}):(\d{2}):(\d{2})(?:\.[0-9]+)?\b/y;
|
|
4641
|
+
function localTime(scanner) {
|
|
4642
|
+
scanner.skipWhitespaces();
|
|
4643
|
+
const match = scanner.match(LOCAL_TIME_REGEXP)?.[0];
|
|
4644
|
+
return match ? (scanner.next(match.length), success(match)) : failure();
|
|
4645
|
+
}
|
|
4646
|
+
function arrayValue(scanner) {
|
|
4647
|
+
if (scanner.skipWhitespaces(), scanner.char() !== "[") return failure();
|
|
4648
|
+
scanner.next();
|
|
4649
|
+
const array = [];
|
|
4650
|
+
while (!scanner.eof()) {
|
|
4651
|
+
scanner.nextUntilChar();
|
|
4652
|
+
const result = value(scanner);
|
|
4653
|
+
if (!result.ok || (array.push(result.body), scanner.skipWhitespaces(), scanner.char() !== ",")) break;
|
|
4654
|
+
scanner.next();
|
|
4655
|
+
}
|
|
4656
|
+
if (scanner.nextUntilChar(), scanner.char() !== "]") throw new SyntaxError("Array is not closed");
|
|
4657
|
+
return scanner.next(), success(array);
|
|
4658
|
+
}
|
|
4659
|
+
function inlineTable(scanner) {
|
|
4660
|
+
if (scanner.nextUntilChar(), scanner.char(1) === "}") return scanner.next(2), success({ __proto__: null });
|
|
4661
|
+
const pairs$1 = surround("{", join$1(pair, ","), "}")(scanner);
|
|
4662
|
+
if (!pairs$1.ok) return failure();
|
|
4663
|
+
let table = { __proto__: null };
|
|
4664
|
+
for (const pair$1 of pairs$1.body) table = deepMerge(table, pair$1);
|
|
4665
|
+
return success(table);
|
|
4666
|
+
}
|
|
4667
|
+
const value = or([
|
|
4668
|
+
multilineBasicString,
|
|
4669
|
+
multilineLiteralString,
|
|
4670
|
+
basicString,
|
|
4671
|
+
literalString,
|
|
4672
|
+
boolean,
|
|
4673
|
+
infinity,
|
|
4674
|
+
nan,
|
|
4675
|
+
dateTime,
|
|
4676
|
+
localTime,
|
|
4677
|
+
binary$1,
|
|
4678
|
+
octal,
|
|
4679
|
+
hex,
|
|
4680
|
+
float$1,
|
|
4681
|
+
integer,
|
|
4682
|
+
arrayValue,
|
|
4683
|
+
inlineTable
|
|
4684
|
+
]), pair = kv(dottedKey, "=", value), tableHeader = surround("[", dottedKey, "]"), tableArrayHeader = surround("[[", dottedKey, "]]"), BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
|
|
4685
|
+
function resolveYamlBinary(data) {
|
|
4686
|
+
if (data === null) return false;
|
|
4687
|
+
let code, bitlen = 0;
|
|
4688
|
+
const max = data.length, map$3 = BASE64_MAP;
|
|
4689
|
+
for (let idx = 0; idx < max; idx++) if (code = map$3.indexOf(data.charAt(idx)), !(code > 64)) {
|
|
4690
|
+
if (code < 0) return false;
|
|
4691
|
+
bitlen += 6;
|
|
4692
|
+
}
|
|
4693
|
+
return bitlen % 8 === 0;
|
|
4694
|
+
}
|
|
4695
|
+
function constructYamlBinary(data) {
|
|
4696
|
+
const input = data.replace(/[\r\n=]/g, ""), max = input.length, map$3 = BASE64_MAP, result = [];
|
|
4697
|
+
let bits = 0;
|
|
4698
|
+
for (let idx = 0; idx < max; idx++) {
|
|
4699
|
+
if (idx % 4 === 0 && idx) result.push(bits >> 16 & 255), result.push(bits >> 8 & 255), result.push(bits & 255);
|
|
4700
|
+
bits = bits << 6 | map$3.indexOf(input.charAt(idx));
|
|
4701
|
+
}
|
|
4702
|
+
const tailbits = max % 4 * 6;
|
|
4703
|
+
if (tailbits === 0) result.push(bits >> 16 & 255), result.push(bits >> 8 & 255), result.push(bits & 255);
|
|
4704
|
+
else if (tailbits === 18) result.push(bits >> 10 & 255), result.push(bits >> 2 & 255);
|
|
4705
|
+
else if (tailbits === 12) result.push(bits >> 4 & 255);
|
|
4706
|
+
return new Uint8Array(result);
|
|
4707
|
+
}
|
|
4708
|
+
function representYamlBinary(object) {
|
|
4709
|
+
const max = object.length, map$3 = BASE64_MAP;
|
|
4710
|
+
let result = "", bits = 0;
|
|
4711
|
+
for (let idx = 0; idx < max; idx++) {
|
|
4712
|
+
if (idx % 3 === 0 && idx) result += map$3[bits >> 18 & 63], result += map$3[bits >> 12 & 63], result += map$3[bits >> 6 & 63], result += map$3[bits & 63];
|
|
4713
|
+
bits = (bits << 8) + object[idx];
|
|
4714
|
+
}
|
|
4715
|
+
const tail = max % 3;
|
|
4716
|
+
if (tail === 0) result += map$3[bits >> 18 & 63], result += map$3[bits >> 12 & 63], result += map$3[bits >> 6 & 63], result += map$3[bits & 63];
|
|
4717
|
+
else if (tail === 2) result += map$3[bits >> 10 & 63], result += map$3[bits >> 4 & 63], result += map$3[bits << 2 & 63], result += map$3[64];
|
|
4718
|
+
else if (tail === 1) result += map$3[bits >> 2 & 63], result += map$3[bits << 4 & 63], result += map$3[64], result += map$3[64];
|
|
4719
|
+
return result;
|
|
4720
|
+
}
|
|
4721
|
+
function isBinary(obj) {
|
|
4722
|
+
return obj instanceof Uint8Array;
|
|
4723
|
+
}
|
|
4724
|
+
const binary = {
|
|
4725
|
+
tag: "tag:yaml.org,2002:binary",
|
|
4726
|
+
construct: constructYamlBinary,
|
|
4727
|
+
kind: "scalar",
|
|
4728
|
+
predicate: isBinary,
|
|
4729
|
+
represent: representYamlBinary,
|
|
4730
|
+
resolve: resolveYamlBinary
|
|
4731
|
+
}, YAML_TRUE_BOOLEANS = [
|
|
4732
|
+
"true",
|
|
4733
|
+
"True",
|
|
4734
|
+
"TRUE"
|
|
4735
|
+
], YAML_FALSE_BOOLEANS = [
|
|
4736
|
+
"false",
|
|
4737
|
+
"False",
|
|
4738
|
+
"FALSE"
|
|
4739
|
+
], YAML_BOOLEANS = [...YAML_TRUE_BOOLEANS, ...YAML_FALSE_BOOLEANS], bool = {
|
|
4740
|
+
tag: "tag:yaml.org,2002:bool",
|
|
4741
|
+
kind: "scalar",
|
|
4742
|
+
defaultStyle: "lowercase",
|
|
4743
|
+
predicate: (value$1) => typeof value$1 === "boolean" || value$1 instanceof Boolean,
|
|
4744
|
+
construct: (data) => YAML_TRUE_BOOLEANS.includes(data),
|
|
4745
|
+
resolve: (data) => YAML_BOOLEANS.includes(data),
|
|
4746
|
+
represent: {
|
|
4747
|
+
lowercase: (object) => {
|
|
4748
|
+
const value$1 = object instanceof Boolean ? object.valueOf() : object;
|
|
4749
|
+
return value$1 ? "true" : "false";
|
|
4750
|
+
},
|
|
4751
|
+
uppercase: (object) => {
|
|
4752
|
+
const value$1 = object instanceof Boolean ? object.valueOf() : object;
|
|
4753
|
+
return value$1 ? "TRUE" : "FALSE";
|
|
4754
|
+
},
|
|
4755
|
+
camelcase: (object) => {
|
|
4756
|
+
const value$1 = object instanceof Boolean ? object.valueOf() : object;
|
|
4757
|
+
return value$1 ? "True" : "False";
|
|
4758
|
+
}
|
|
4759
|
+
}
|
|
4760
|
+
};
|
|
4761
|
+
function isNegativeZero(i) {
|
|
4762
|
+
return i === 0 && Number.NEGATIVE_INFINITY === 1 / i;
|
|
4763
|
+
}
|
|
4764
|
+
function isPlainObject(object) {
|
|
4765
|
+
return Object.prototype.toString.call(object) === "[object Object]";
|
|
4766
|
+
}
|
|
4767
|
+
const YAML_FLOAT_PATTERN = /* @__PURE__ */ new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
|
|
4768
|
+
function resolveYamlFloat(data) {
|
|
4769
|
+
return !(!YAML_FLOAT_PATTERN.test(data) || data[data.length - 1] === "_");
|
|
4770
|
+
}
|
|
4771
|
+
function constructYamlFloat(data) {
|
|
4772
|
+
let value$1 = data.replace(/_/g, "").toLowerCase();
|
|
4773
|
+
const sign = value$1[0] === "-" ? -1 : 1;
|
|
4774
|
+
if (value$1[0] && "+-".includes(value$1[0])) value$1 = value$1.slice(1);
|
|
4775
|
+
return value$1 === ".inf" ? sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY : value$1 === ".nan" ? NaN : sign * parseFloat(value$1);
|
|
4776
|
+
}
|
|
4777
|
+
const SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
|
|
4778
|
+
function representYamlFloat(object, style) {
|
|
4779
|
+
const value$1 = object instanceof Number ? object.valueOf() : object;
|
|
4780
|
+
if (isNaN(value$1)) switch (style) {
|
|
4781
|
+
case "lowercase": return ".nan";
|
|
4782
|
+
case "uppercase": return ".NAN";
|
|
4783
|
+
case "camelcase": return ".NaN";
|
|
4784
|
+
}
|
|
4785
|
+
else if (Number.POSITIVE_INFINITY === value$1) switch (style) {
|
|
4786
|
+
case "lowercase": return ".inf";
|
|
4787
|
+
case "uppercase": return ".INF";
|
|
4788
|
+
case "camelcase": return ".Inf";
|
|
4789
|
+
}
|
|
4790
|
+
else if (Number.NEGATIVE_INFINITY === value$1) switch (style) {
|
|
4791
|
+
case "lowercase": return "-.inf";
|
|
4792
|
+
case "uppercase": return "-.INF";
|
|
4793
|
+
case "camelcase": return "-.Inf";
|
|
4794
|
+
}
|
|
4795
|
+
else if (isNegativeZero(value$1)) return "-0.0";
|
|
4796
|
+
const res = value$1.toString(10);
|
|
4797
|
+
return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
|
|
4798
|
+
}
|
|
4799
|
+
function isFloat(object) {
|
|
4800
|
+
if (object instanceof Number) object = object.valueOf();
|
|
4801
|
+
return typeof object === "number" && (object % 1 !== 0 || isNegativeZero(object));
|
|
4802
|
+
}
|
|
4803
|
+
const float = {
|
|
4804
|
+
tag: "tag:yaml.org,2002:float",
|
|
4805
|
+
construct: constructYamlFloat,
|
|
4806
|
+
defaultStyle: "lowercase",
|
|
4807
|
+
kind: "scalar",
|
|
4808
|
+
predicate: isFloat,
|
|
4809
|
+
represent: representYamlFloat,
|
|
4810
|
+
resolve: resolveYamlFloat
|
|
4811
|
+
};
|
|
4812
|
+
function isCharCodeInRange(c, lower, upper) {
|
|
4813
|
+
return lower <= c && c <= upper;
|
|
4814
|
+
}
|
|
4815
|
+
function isHexCode(c) {
|
|
4816
|
+
return isCharCodeInRange(c, 48, 57) || isCharCodeInRange(c, 65, 70) || isCharCodeInRange(c, 97, 102);
|
|
4817
|
+
}
|
|
4818
|
+
function isOctCode(c) {
|
|
4819
|
+
return isCharCodeInRange(c, 48, 55);
|
|
4820
|
+
}
|
|
4821
|
+
function isDecCode(c) {
|
|
4822
|
+
return isCharCodeInRange(c, 48, 57);
|
|
4823
|
+
}
|
|
4824
|
+
function resolveYamlInteger(data) {
|
|
4825
|
+
const max = data.length;
|
|
4826
|
+
let index = 0, hasDigits = false;
|
|
4827
|
+
if (!max) return false;
|
|
4828
|
+
let ch = data[index];
|
|
4829
|
+
if (ch === "-" || ch === "+") ch = data[++index];
|
|
4830
|
+
if (ch === "0") {
|
|
4831
|
+
if (index + 1 === max) return true;
|
|
4832
|
+
if (ch = data[++index], ch === "b") {
|
|
4833
|
+
for (index++; index < max; index++) if (ch = data[index], ch !== "_") {
|
|
4834
|
+
if (ch !== "0" && ch !== "1") return false;
|
|
4835
|
+
hasDigits = true;
|
|
4836
|
+
}
|
|
4837
|
+
return hasDigits && ch !== "_";
|
|
4838
|
+
}
|
|
4839
|
+
if (ch === "x") {
|
|
4840
|
+
for (index++; index < max; index++) if (ch = data[index], ch !== "_") {
|
|
4841
|
+
if (!isHexCode(data.charCodeAt(index))) return false;
|
|
4842
|
+
hasDigits = true;
|
|
4843
|
+
}
|
|
4844
|
+
return hasDigits && ch !== "_";
|
|
4845
|
+
}
|
|
4846
|
+
for (; index < max; index++) if (ch = data[index], ch !== "_") {
|
|
4847
|
+
if (!isOctCode(data.charCodeAt(index))) return false;
|
|
4848
|
+
hasDigits = true;
|
|
4849
|
+
}
|
|
4850
|
+
return hasDigits && ch !== "_";
|
|
4851
|
+
}
|
|
4852
|
+
if (ch === "_") return false;
|
|
4853
|
+
for (; index < max; index++) if (ch = data[index], ch !== "_") {
|
|
4854
|
+
if (!isDecCode(data.charCodeAt(index))) return false;
|
|
4855
|
+
hasDigits = true;
|
|
4856
|
+
}
|
|
4857
|
+
return !hasDigits || ch === "_" ? false : /^(:[0-5]?[0-9])+$/.test(data.slice(index));
|
|
4858
|
+
}
|
|
4859
|
+
function constructYamlInteger(data) {
|
|
4860
|
+
let value$1 = data;
|
|
4861
|
+
if (value$1.includes("_")) value$1 = value$1.replace(/_/g, "");
|
|
4862
|
+
let sign = 1, ch = value$1[0];
|
|
4863
|
+
if (ch === "-" || ch === "+") {
|
|
4864
|
+
if (ch === "-") sign = -1;
|
|
4865
|
+
value$1 = value$1.slice(1), ch = value$1[0];
|
|
4866
|
+
}
|
|
4867
|
+
return value$1 === "0" ? 0 : ch === "0" ? value$1[1] === "b" ? sign * parseInt(value$1.slice(2), 2) : value$1[1] === "x" ? sign * parseInt(value$1, 16) : sign * parseInt(value$1, 8) : sign * parseInt(value$1, 10);
|
|
4868
|
+
}
|
|
4869
|
+
function isInteger(object) {
|
|
4870
|
+
if (object instanceof Number) object = object.valueOf();
|
|
4871
|
+
return typeof object === "number" && object % 1 === 0 && !isNegativeZero(object);
|
|
4872
|
+
}
|
|
4873
|
+
const int = {
|
|
4874
|
+
tag: "tag:yaml.org,2002:int",
|
|
4875
|
+
construct: constructYamlInteger,
|
|
4876
|
+
defaultStyle: "decimal",
|
|
4877
|
+
kind: "scalar",
|
|
4878
|
+
predicate: isInteger,
|
|
4879
|
+
represent: {
|
|
4880
|
+
binary(object) {
|
|
4881
|
+
const value$1 = object instanceof Number ? object.valueOf() : object;
|
|
4882
|
+
return value$1 >= 0 ? `0b${value$1.toString(2)}` : `-0b${value$1.toString(2).slice(1)}`;
|
|
4883
|
+
},
|
|
4884
|
+
octal(object) {
|
|
4885
|
+
const value$1 = object instanceof Number ? object.valueOf() : object;
|
|
4886
|
+
return value$1 >= 0 ? `0${value$1.toString(8)}` : `-0${value$1.toString(8).slice(1)}`;
|
|
4887
|
+
},
|
|
4888
|
+
decimal(object) {
|
|
4889
|
+
const value$1 = object instanceof Number ? object.valueOf() : object;
|
|
4890
|
+
return value$1.toString(10);
|
|
4891
|
+
},
|
|
4892
|
+
hexadecimal(object) {
|
|
4893
|
+
const value$1 = object instanceof Number ? object.valueOf() : object;
|
|
4894
|
+
return value$1 >= 0 ? `0x${value$1.toString(16).toUpperCase()}` : `-0x${value$1.toString(16).toUpperCase().slice(1)}`;
|
|
4895
|
+
}
|
|
4896
|
+
},
|
|
4897
|
+
resolve: resolveYamlInteger
|
|
4898
|
+
}, map$1 = {
|
|
4899
|
+
tag: "tag:yaml.org,2002:map",
|
|
4900
|
+
resolve() {
|
|
4901
|
+
return true;
|
|
4902
|
+
},
|
|
4903
|
+
construct(data) {
|
|
4904
|
+
return data !== null ? data : {};
|
|
4905
|
+
},
|
|
4906
|
+
kind: "mapping"
|
|
4907
|
+
}, merge = {
|
|
4908
|
+
tag: "tag:yaml.org,2002:merge",
|
|
4909
|
+
kind: "scalar",
|
|
4910
|
+
resolve: (data) => data === "<<" || data === null,
|
|
4911
|
+
construct: (data) => data
|
|
4912
|
+
}, nil = {
|
|
4913
|
+
tag: "tag:yaml.org,2002:null",
|
|
4914
|
+
kind: "scalar",
|
|
4915
|
+
defaultStyle: "lowercase",
|
|
4916
|
+
predicate: (object) => object === null,
|
|
4917
|
+
construct: () => null,
|
|
4918
|
+
resolve: (data) => {
|
|
4919
|
+
return data === "~" || data === "null" || data === "Null" || data === "NULL";
|
|
4920
|
+
},
|
|
4921
|
+
represent: {
|
|
4922
|
+
lowercase: () => "null",
|
|
4923
|
+
uppercase: () => "NULL",
|
|
4924
|
+
camelcase: () => "Null"
|
|
4925
|
+
}
|
|
4926
|
+
};
|
|
4927
|
+
function resolveYamlOmap(data) {
|
|
4928
|
+
const objectKeys = /* @__PURE__ */ new Set();
|
|
4929
|
+
for (const object of data) {
|
|
4930
|
+
if (!isPlainObject(object)) return false;
|
|
4931
|
+
const keys = Object.keys(object);
|
|
4932
|
+
if (keys.length !== 1) return false;
|
|
4933
|
+
for (const key of keys) {
|
|
4934
|
+
if (objectKeys.has(key)) return false;
|
|
4935
|
+
objectKeys.add(key);
|
|
4936
|
+
}
|
|
4937
|
+
}
|
|
4938
|
+
return true;
|
|
4939
|
+
}
|
|
4940
|
+
const omap = {
|
|
4941
|
+
tag: "tag:yaml.org,2002:omap",
|
|
4942
|
+
kind: "sequence",
|
|
4943
|
+
resolve: resolveYamlOmap,
|
|
4944
|
+
construct(data) {
|
|
4945
|
+
return data;
|
|
4946
|
+
}
|
|
4947
|
+
};
|
|
4948
|
+
function resolveYamlPairs(data) {
|
|
4949
|
+
return data === null ? true : data.every((it) => isPlainObject(it) && Object.keys(it).length === 1);
|
|
4950
|
+
}
|
|
4951
|
+
const pairs = {
|
|
4952
|
+
tag: "tag:yaml.org,2002:pairs",
|
|
4953
|
+
construct(data) {
|
|
4954
|
+
return data?.flatMap(Object.entries) ?? [];
|
|
4955
|
+
},
|
|
4956
|
+
kind: "sequence",
|
|
4957
|
+
resolve: resolveYamlPairs
|
|
4958
|
+
}, REGEXP = /^\/(?<regexp>[\s\S]+)\/(?<modifiers>[gismuy]*)$/, regexp = {
|
|
4959
|
+
tag: "tag:yaml.org,2002:js/regexp",
|
|
4960
|
+
kind: "scalar",
|
|
4961
|
+
resolve(data) {
|
|
4962
|
+
if (data === null || !data.length) return false;
|
|
4963
|
+
if (data.charAt(0) === "/") {
|
|
4964
|
+
const groups = data.match(REGEXP)?.groups;
|
|
4965
|
+
if (!groups) return false;
|
|
4966
|
+
const modifiers = groups.modifiers ?? "";
|
|
4967
|
+
if (new Set(modifiers).size < modifiers.length) return false;
|
|
4968
|
+
}
|
|
4969
|
+
return true;
|
|
4970
|
+
},
|
|
4971
|
+
construct(data) {
|
|
4972
|
+
const { regexp: regexp$1 = data, modifiers = "" } = data.match(REGEXP)?.groups ?? {};
|
|
4973
|
+
return new RegExp(regexp$1, modifiers);
|
|
4974
|
+
},
|
|
4975
|
+
predicate: (object) => object instanceof RegExp,
|
|
4976
|
+
represent: (object) => object.toString()
|
|
4977
|
+
}, seq = {
|
|
4978
|
+
tag: "tag:yaml.org,2002:seq",
|
|
4979
|
+
kind: "sequence",
|
|
4980
|
+
resolve: () => true,
|
|
4981
|
+
construct: (data) => data !== null ? data : []
|
|
4982
|
+
}, set = {
|
|
4983
|
+
tag: "tag:yaml.org,2002:set",
|
|
4984
|
+
kind: "mapping",
|
|
4985
|
+
construct: (data) => data !== null ? data : {},
|
|
4986
|
+
resolve: (data) => {
|
|
4987
|
+
return data === null ? true : Object.values(data).every((it) => it === null);
|
|
4988
|
+
}
|
|
4989
|
+
}, str = {
|
|
4990
|
+
tag: "tag:yaml.org,2002:str",
|
|
4991
|
+
kind: "scalar",
|
|
4992
|
+
resolve: () => true,
|
|
4993
|
+
construct: (data) => data !== null ? data : ""
|
|
4994
|
+
}, YAML_DATE_REGEXP = /* @__PURE__ */ new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"), YAML_TIMESTAMP_REGEXP = /* @__PURE__ */ new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");
|
|
4995
|
+
function resolveYamlTimestamp(data) {
|
|
4996
|
+
return data === null ? false : YAML_DATE_REGEXP.exec(data) !== null || YAML_TIMESTAMP_REGEXP.exec(data) !== null;
|
|
4997
|
+
}
|
|
4998
|
+
function constructYamlTimestamp(data) {
|
|
4999
|
+
let match = YAML_DATE_REGEXP.exec(data);
|
|
5000
|
+
if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
|
|
5001
|
+
if (match === null) throw new Error("Cannot construct YAML timestamp: date resolve error");
|
|
5002
|
+
const year = +match[1], month = +match[2] - 1, day = +match[3];
|
|
5003
|
+
if (!match[4]) return new Date(Date.UTC(year, month, day));
|
|
5004
|
+
const hour = +match[4], minute = +match[5], second = +match[6];
|
|
5005
|
+
let fraction = 0;
|
|
5006
|
+
if (match[7]) {
|
|
5007
|
+
let partFraction = match[7].slice(0, 3);
|
|
5008
|
+
while (partFraction.length < 3) partFraction += "0";
|
|
5009
|
+
fraction = +partFraction;
|
|
5010
|
+
}
|
|
5011
|
+
let delta = null;
|
|
5012
|
+
if (match[9] && match[10]) {
|
|
5013
|
+
const tzHour = +match[10], tzMinute = +(match[11] || 0);
|
|
5014
|
+
if (delta = (tzHour * 60 + tzMinute) * 6e4, match[9] === "-") delta = -delta;
|
|
5015
|
+
}
|
|
5016
|
+
const date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
|
|
5017
|
+
if (delta) date.setTime(date.getTime() - delta);
|
|
5018
|
+
return date;
|
|
5019
|
+
}
|
|
5020
|
+
function representYamlTimestamp(date) {
|
|
5021
|
+
return date.toISOString();
|
|
5022
|
+
}
|
|
5023
|
+
const timestamp = {
|
|
5024
|
+
tag: "tag:yaml.org,2002:timestamp",
|
|
5025
|
+
construct: constructYamlTimestamp,
|
|
5026
|
+
predicate(object) {
|
|
5027
|
+
return object instanceof Date;
|
|
5028
|
+
},
|
|
5029
|
+
kind: "scalar",
|
|
5030
|
+
represent: representYamlTimestamp,
|
|
5031
|
+
resolve: resolveYamlTimestamp
|
|
5032
|
+
}, undefinedType = {
|
|
5033
|
+
tag: "tag:yaml.org,2002:js/undefined",
|
|
5034
|
+
kind: "scalar",
|
|
5035
|
+
resolve() {
|
|
5036
|
+
return true;
|
|
5037
|
+
},
|
|
5038
|
+
construct() {
|
|
5039
|
+
return void 0;
|
|
5040
|
+
},
|
|
5041
|
+
predicate(object) {
|
|
5042
|
+
return typeof object === "undefined";
|
|
5043
|
+
},
|
|
5044
|
+
represent() {
|
|
5045
|
+
return "";
|
|
5046
|
+
}
|
|
5047
|
+
};
|
|
5048
|
+
function createTypeMap(implicitTypes, explicitTypes) {
|
|
5049
|
+
const result = {
|
|
5050
|
+
fallback: /* @__PURE__ */ new Map(),
|
|
5051
|
+
mapping: /* @__PURE__ */ new Map(),
|
|
5052
|
+
scalar: /* @__PURE__ */ new Map(),
|
|
5053
|
+
sequence: /* @__PURE__ */ new Map()
|
|
5054
|
+
}, fallbackMap = result.fallback;
|
|
5055
|
+
for (const type of [...implicitTypes, ...explicitTypes]) {
|
|
5056
|
+
const map$3 = result[type.kind];
|
|
5057
|
+
map$3.set(type.tag, type), fallbackMap.set(type.tag, type);
|
|
5058
|
+
}
|
|
5059
|
+
return result;
|
|
5060
|
+
}
|
|
5061
|
+
function createSchema({ explicitTypes = [], implicitTypes = [], include }) {
|
|
5062
|
+
if (include) implicitTypes.push(...include.implicitTypes), explicitTypes.push(...include.explicitTypes);
|
|
5063
|
+
const typeMap = createTypeMap(implicitTypes, explicitTypes);
|
|
5064
|
+
return {
|
|
5065
|
+
implicitTypes,
|
|
5066
|
+
explicitTypes,
|
|
5067
|
+
typeMap
|
|
5068
|
+
};
|
|
5069
|
+
}
|
|
5070
|
+
const FAILSAFE_SCHEMA = createSchema({ explicitTypes: [
|
|
5071
|
+
str,
|
|
5072
|
+
seq,
|
|
5073
|
+
map$1
|
|
5074
|
+
] }), JSON_SCHEMA = createSchema({
|
|
5075
|
+
implicitTypes: [
|
|
5076
|
+
nil,
|
|
5077
|
+
bool,
|
|
5078
|
+
int,
|
|
5079
|
+
float
|
|
5080
|
+
],
|
|
5081
|
+
include: FAILSAFE_SCHEMA
|
|
5082
|
+
}), CORE_SCHEMA = createSchema({ include: JSON_SCHEMA }), DEFAULT_SCHEMA = createSchema({
|
|
5083
|
+
explicitTypes: [
|
|
5084
|
+
binary,
|
|
5085
|
+
omap,
|
|
5086
|
+
pairs,
|
|
5087
|
+
set
|
|
5088
|
+
],
|
|
5089
|
+
implicitTypes: [timestamp, merge],
|
|
5090
|
+
include: CORE_SCHEMA
|
|
5091
|
+
}), EXTENDED_SCHEMA = createSchema({
|
|
5092
|
+
explicitTypes: [regexp, undefinedType],
|
|
5093
|
+
include: DEFAULT_SCHEMA
|
|
5094
|
+
});
|
|
5095
|
+
var _computedKey;
|
|
5096
|
+
function resolveOptions(options) {
|
|
5097
|
+
return {
|
|
5098
|
+
validator: options.validator,
|
|
5099
|
+
allowNoExist: options.allowNoExist ?? true,
|
|
5100
|
+
allowValidatorFailure: options.allowValidatorFailure
|
|
5101
|
+
};
|
|
5102
|
+
}
|
|
5103
|
+
_computedKey = Symbol.dispose;
|
|
5104
|
+
var LimoFile = class {
|
|
5105
|
+
#data;
|
|
5106
|
+
#oldData;
|
|
5107
|
+
#path;
|
|
5108
|
+
#text;
|
|
5109
|
+
#options;
|
|
5110
|
+
#parseOptions;
|
|
5111
|
+
constructor(path$1, options) {
|
|
5112
|
+
this.#options = resolveOptions(options), this.#parseOptions = options.parseOptions, this.#path = path$1;
|
|
5113
|
+
const { data, text } = this._read();
|
|
5114
|
+
this.#data = this.#oldData = data, this.#text = text;
|
|
5115
|
+
}
|
|
5116
|
+
[_computedKey]() {
|
|
5117
|
+
this._write();
|
|
5118
|
+
}
|
|
5119
|
+
get data() {
|
|
5120
|
+
return this.#data;
|
|
5121
|
+
}
|
|
5122
|
+
set data(value$1) {
|
|
5123
|
+
this.#data = value$1;
|
|
5124
|
+
}
|
|
5125
|
+
_read() {
|
|
5126
|
+
if (existsSync(this.#path)) {
|
|
5127
|
+
const text = readFileSync(this.#path, { encoding: "utf8" });
|
|
5128
|
+
if (text.trim() === "") return {
|
|
5129
|
+
data: void 0,
|
|
5130
|
+
text
|
|
5131
|
+
};
|
|
5132
|
+
try {
|
|
5133
|
+
const data = this.#parseOptions.parse(text), { validator, allowValidatorFailure } = this.#options;
|
|
5134
|
+
if (validator != null && !validator(data)) {
|
|
5135
|
+
if (allowValidatorFailure) return {
|
|
5136
|
+
data: void 0,
|
|
5137
|
+
text
|
|
5138
|
+
};
|
|
5139
|
+
throw new Error(`Invalid data: ${text}`);
|
|
5140
|
+
}
|
|
5141
|
+
return {
|
|
5142
|
+
data,
|
|
5143
|
+
text
|
|
5144
|
+
};
|
|
5145
|
+
} catch (error) {
|
|
5146
|
+
throw new Error(`Failed to parse ${this.#path}: ${error}`);
|
|
5147
|
+
}
|
|
5148
|
+
}
|
|
5149
|
+
if (!this.#options.allowNoExist) throw new Error(`File not found: ${this.#path}`);
|
|
5150
|
+
return {
|
|
5151
|
+
data: void 0,
|
|
5152
|
+
text: void 0
|
|
5153
|
+
};
|
|
5154
|
+
}
|
|
5155
|
+
_write() {
|
|
5156
|
+
if (this.#data != null) try {
|
|
5157
|
+
let content;
|
|
5158
|
+
if (this.#parseOptions.preserveFormat && this.#text != null && this.#oldData != null) content = this.#parseOptions.preserveFormat(this.#text, this.#oldData, this.#data);
|
|
5159
|
+
else content = this.#parseOptions.stringify(this.#data);
|
|
5160
|
+
writeFileSync(this.#path, content);
|
|
5161
|
+
} catch (error) {
|
|
5162
|
+
throw new Error(`Failed to write ${this.#path}: ${error}`);
|
|
5163
|
+
}
|
|
5164
|
+
}
|
|
5165
|
+
};
|
|
5166
|
+
function createLimoJson(path$1, options = {}) {
|
|
5167
|
+
return new LimoFile(path$1, {
|
|
5168
|
+
...options,
|
|
5169
|
+
parseOptions: {
|
|
5170
|
+
parse: (text) => JSON.parse(text),
|
|
5171
|
+
stringify: (data) => JSON.stringify(data, null, 2)
|
|
5172
|
+
}
|
|
5173
|
+
});
|
|
5174
|
+
}
|
|
5175
|
+
const { stdin: stdin$1 } = process;
|
|
4203
5176
|
async function getStdin() {
|
|
4204
5177
|
let result = "";
|
|
4205
5178
|
if (stdin$1.isTTY) return result;
|
|
@@ -4214,90 +5187,190 @@ getStdin.buffer = async () => {
|
|
|
4214
5187
|
for await (const chunk of stdin$1) result.push(chunk), length += chunk.length;
|
|
4215
5188
|
return Buffer.concat(result, length);
|
|
4216
5189
|
};
|
|
4217
|
-
var import_picocolors$1 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
|
|
5190
|
+
var import_picocolors$1 = /* @__PURE__ */ __toESM(require_picocolors(), 1), import_usingCtx = /* @__PURE__ */ __toESM(require_usingCtx(), 1);
|
|
4218
5191
|
function formatRemainingTime(remaining) {
|
|
4219
5192
|
const remainingHours = Math.floor(remaining / 60), remainingMins = remaining % 60;
|
|
4220
5193
|
return remainingHours > 0 ? `${remainingHours}h ${remainingMins}m left` : `${remainingMins}m left`;
|
|
4221
5194
|
}
|
|
4222
|
-
|
|
5195
|
+
function getSemaphore(sessionId) {
|
|
5196
|
+
const semaphoreDir = join(tmpdir(), "ccusage-semaphore"), semaphorePath = join(semaphoreDir, `${sessionId}.lock`);
|
|
5197
|
+
mkdirSync(semaphoreDir, { recursive: true });
|
|
5198
|
+
const semaphore = createLimoJson(semaphorePath);
|
|
5199
|
+
return semaphore;
|
|
5200
|
+
}
|
|
5201
|
+
const statuslineCommand = define$1({
|
|
4223
5202
|
name: "statusline",
|
|
4224
|
-
description: "Display compact status line for Claude Code hooks (Beta)",
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
5203
|
+
description: "Display compact status line for Claude Code hooks with hybrid time+file caching (Beta)",
|
|
5204
|
+
toKebab: true,
|
|
5205
|
+
args: {
|
|
5206
|
+
offline: {
|
|
5207
|
+
...sharedArgs.offline,
|
|
5208
|
+
default: true
|
|
5209
|
+
},
|
|
5210
|
+
cache: {
|
|
5211
|
+
type: "boolean",
|
|
5212
|
+
description: "Enable cache for status line output (default: true)",
|
|
5213
|
+
default: true
|
|
5214
|
+
},
|
|
5215
|
+
refreshInterval: {
|
|
5216
|
+
type: "number",
|
|
5217
|
+
description: `Refresh interval in seconds for cache expiry (default: ${DEFAULT_REFRESH_INTERVAL_SECONDS})`,
|
|
5218
|
+
default: DEFAULT_REFRESH_INTERVAL_SECONDS
|
|
5219
|
+
}
|
|
5220
|
+
},
|
|
4229
5221
|
async run(ctx) {
|
|
4230
5222
|
logger.level = 0;
|
|
4231
|
-
const stdin$2 = await getStdin();
|
|
5223
|
+
const refreshInterval = ctx.values.refreshInterval, stdin$2 = await getStdin();
|
|
4232
5224
|
if (stdin$2.length === 0) log("❌ No input provided"), process$1.exit(1);
|
|
4233
5225
|
const hookDataJson = JSON.parse(stdin$2.trim()), hookDataParseResult = statuslineHookJsonSchema.safeParse(hookDataJson);
|
|
4234
5226
|
if (!hookDataParseResult.success) log("❌ Invalid input format:", hookDataParseResult.error.message), process$1.exit(1);
|
|
4235
|
-
const hookData = hookDataParseResult.data,
|
|
4236
|
-
if (
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
}),
|
|
4242
|
-
catch: (error) => error
|
|
4243
|
-
}), map((sessionCost$1) => sessionCost$1?.totalCost), inspectError((error) => logger.error("Failed to load session data:", error)), unwrap(void 0)), today = /* @__PURE__ */ new Date(), todayStr = today.toISOString().split("T")[0]?.replace(/-/g, "") ?? "", todayCost = await pipe(try_({
|
|
4244
|
-
try: loadDailyUsageData({
|
|
4245
|
-
since: todayStr,
|
|
4246
|
-
until: todayStr,
|
|
4247
|
-
mode: "auto",
|
|
4248
|
-
offline: ctx.values.offline
|
|
4249
|
-
}),
|
|
4250
|
-
catch: (error) => error
|
|
4251
|
-
}), map((dailyData) => {
|
|
4252
|
-
if (dailyData.length > 0) {
|
|
4253
|
-
const totals = calculateTotals(dailyData);
|
|
4254
|
-
return totals.totalCost;
|
|
5227
|
+
const hookData = hookDataParseResult.data, sessionId = hookData.session_id, initialSemaphoreState = pipe(succeed(getSemaphore(sessionId)), map((semaphore) => semaphore.data), unwrap(void 0)), currentMtime = await getFileModifiedTime(hookData.transcript_path);
|
|
5228
|
+
if (ctx.values.cache && initialSemaphoreState != null) {
|
|
5229
|
+
const now = Date.now(), timeElapsed = now - (initialSemaphoreState.lastUpdateTime ?? 0), isExpired = timeElapsed >= refreshInterval * 1e3, isFileModified = initialSemaphoreState.transcriptMtime !== currentMtime;
|
|
5230
|
+
if (!isExpired && !isFileModified) {
|
|
5231
|
+
log(initialSemaphoreState.lastOutput);
|
|
5232
|
+
return;
|
|
4255
5233
|
}
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
5234
|
+
if (initialSemaphoreState.isUpdating === true) {
|
|
5235
|
+
const pid = initialSemaphoreState.pid;
|
|
5236
|
+
let isProcessAlive = false;
|
|
5237
|
+
if (pid != null) try {
|
|
5238
|
+
process$1.kill(pid, 0), isProcessAlive = true;
|
|
5239
|
+
} catch {
|
|
5240
|
+
isProcessAlive = false;
|
|
5241
|
+
}
|
|
5242
|
+
if (isProcessAlive) {
|
|
5243
|
+
log(initialSemaphoreState.lastOutput);
|
|
5244
|
+
return;
|
|
5245
|
+
}
|
|
5246
|
+
}
|
|
5247
|
+
}
|
|
5248
|
+
try {
|
|
5249
|
+
var _usingCtx = (0, import_usingCtx.default)();
|
|
5250
|
+
const currentPid = process$1.pid, semaphore = _usingCtx.u(getSemaphore(sessionId));
|
|
5251
|
+
if (semaphore.data != null) semaphore.data = {
|
|
5252
|
+
...semaphore.data,
|
|
5253
|
+
isUpdating: true,
|
|
5254
|
+
pid: currentPid
|
|
4267
5255
|
};
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
burnRateInfo: burnRateInfo$1
|
|
5256
|
+
else {
|
|
5257
|
+
const currentMtimeForInit = await getFileModifiedTime(hookData.transcript_path);
|
|
5258
|
+
semaphore.data = {
|
|
5259
|
+
date: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5260
|
+
lastOutput: "",
|
|
5261
|
+
lastUpdateTime: 0,
|
|
5262
|
+
transcriptPath: hookData.transcript_path,
|
|
5263
|
+
transcriptMtime: currentMtimeForInit,
|
|
5264
|
+
isUpdating: true,
|
|
5265
|
+
pid: currentPid
|
|
4279
5266
|
};
|
|
4280
5267
|
}
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
}
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
5268
|
+
} catch (_) {
|
|
5269
|
+
_usingCtx.e = _;
|
|
5270
|
+
} finally {
|
|
5271
|
+
_usingCtx.d();
|
|
5272
|
+
}
|
|
5273
|
+
const mainProcessingResult = pipe(await try_({
|
|
5274
|
+
try: async () => {
|
|
5275
|
+
const sessionCost = await pipe(try_({
|
|
5276
|
+
try: loadSessionUsageById(sessionId, {
|
|
5277
|
+
mode: "auto",
|
|
5278
|
+
offline: ctx.values.offline
|
|
5279
|
+
}),
|
|
5280
|
+
catch: (error) => error
|
|
5281
|
+
}), map((sessionCost$1) => sessionCost$1?.totalCost), inspectError((error) => logger.error("Failed to load session data:", error)), unwrap(void 0)), today = /* @__PURE__ */ new Date(), todayStr = today.toISOString().split("T")[0]?.replace(/-/g, "") ?? "", todayCost = await pipe(try_({
|
|
5282
|
+
try: loadDailyUsageData({
|
|
5283
|
+
since: todayStr,
|
|
5284
|
+
until: todayStr,
|
|
5285
|
+
mode: "auto",
|
|
5286
|
+
offline: ctx.values.offline
|
|
5287
|
+
}),
|
|
5288
|
+
catch: (error) => error
|
|
5289
|
+
}), map((dailyData) => {
|
|
5290
|
+
if (dailyData.length > 0) {
|
|
5291
|
+
const totals = calculateTotals(dailyData);
|
|
5292
|
+
return totals.totalCost;
|
|
5293
|
+
}
|
|
5294
|
+
return 0;
|
|
5295
|
+
}), inspectError((error) => logger.error("Failed to load daily data:", error)), unwrap(0)), { blockInfo, burnRateInfo } = await pipe(try_({
|
|
5296
|
+
try: loadSessionBlockData({
|
|
5297
|
+
mode: "auto",
|
|
5298
|
+
offline: ctx.values.offline
|
|
5299
|
+
}),
|
|
5300
|
+
catch: (error) => error
|
|
5301
|
+
}), map((blocks) => {
|
|
5302
|
+
if (blocks.length === 0) return {
|
|
5303
|
+
blockInfo: "No active block",
|
|
5304
|
+
burnRateInfo: ""
|
|
5305
|
+
};
|
|
5306
|
+
const activeBlock = blocks.find((block) => {
|
|
5307
|
+
return !!block.isActive;
|
|
5308
|
+
});
|
|
5309
|
+
if (activeBlock != null) {
|
|
5310
|
+
const now = /* @__PURE__ */ new Date(), remaining = Math.round((activeBlock.endTime.getTime() - now.getTime()) / (1e3 * 60)), blockCost = activeBlock.costUSD, blockInfo$1 = `${formatCurrency(blockCost)} block (${formatRemainingTime(remaining)})`, burnRate = calculateBurnRate(activeBlock), burnRateInfo$1 = burnRate != null ? (() => {
|
|
5311
|
+
const costPerHour = burnRate.costPerHour, costPerHourStr = `${formatCurrency(costPerHour)}/hr`, coloredBurnRate = burnRate.tokensPerMinuteForIndicator < 2e3 ? import_picocolors$1.default.green(costPerHourStr) : burnRate.tokensPerMinuteForIndicator < 5e3 ? import_picocolors$1.default.yellow(costPerHourStr) : import_picocolors$1.default.red(costPerHourStr);
|
|
5312
|
+
return ` | 🔥 ${coloredBurnRate}`;
|
|
5313
|
+
})() : "";
|
|
5314
|
+
return {
|
|
5315
|
+
blockInfo: blockInfo$1,
|
|
5316
|
+
burnRateInfo: burnRateInfo$1
|
|
5317
|
+
};
|
|
5318
|
+
}
|
|
5319
|
+
return {
|
|
5320
|
+
blockInfo: "No active block",
|
|
5321
|
+
burnRateInfo: ""
|
|
5322
|
+
};
|
|
5323
|
+
}), inspectError((error) => logger.error("Failed to load block data:", error)), unwrap({
|
|
5324
|
+
blockInfo: "No active block",
|
|
5325
|
+
burnRateInfo: ""
|
|
5326
|
+
})), contextInfo = await pipe(try_({
|
|
5327
|
+
try: calculateContextTokens(hookData.transcript_path, hookData.model.id, ctx.values.offline),
|
|
5328
|
+
catch: (error) => error
|
|
5329
|
+
}), inspectError((error) => logger.debug(`Failed to calculate context tokens: ${error instanceof Error ? error.message : String(error)}`)), map((ctx$1) => {
|
|
5330
|
+
if (ctx$1 == null) return void 0;
|
|
5331
|
+
const thresholds = getContextUsageThresholds(), color = ctx$1.percentage < thresholds.LOW ? import_picocolors$1.default.green : ctx$1.percentage < thresholds.MEDIUM ? import_picocolors$1.default.yellow : import_picocolors$1.default.red, coloredPercentage = color(`${ctx$1.percentage}%`), tokenDisplay = ctx$1.inputTokens.toLocaleString();
|
|
5332
|
+
return `${tokenDisplay} (${coloredPercentage})`;
|
|
5333
|
+
}), unwrap(void 0)), modelName = hookData.model.display_name, sessionDisplay = sessionCost != null ? formatCurrency(sessionCost) : "N/A", statusLine = `🤖 ${modelName} | 💰 ${sessionDisplay} session / ${formatCurrency(todayCost)} today / ${blockInfo}${burnRateInfo} | 🧠 ${contextInfo ?? "N/A"}`;
|
|
5334
|
+
return statusLine;
|
|
5335
|
+
},
|
|
4290
5336
|
catch: (error) => error
|
|
4291
|
-
})
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
5337
|
+
})());
|
|
5338
|
+
if (isSuccess(mainProcessingResult)) try {
|
|
5339
|
+
var _usingCtx3 = (0, import_usingCtx.default)();
|
|
5340
|
+
const statusLine = mainProcessingResult.value;
|
|
5341
|
+
if (log(statusLine), !ctx.values.cache) return;
|
|
5342
|
+
const semaphore = _usingCtx3.u(getSemaphore(sessionId));
|
|
5343
|
+
semaphore.data = {
|
|
5344
|
+
date: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5345
|
+
lastOutput: statusLine,
|
|
5346
|
+
lastUpdateTime: Date.now(),
|
|
5347
|
+
transcriptPath: hookData.transcript_path,
|
|
5348
|
+
transcriptMtime: currentMtime,
|
|
5349
|
+
isUpdating: false,
|
|
5350
|
+
pid: void 0
|
|
5351
|
+
};
|
|
5352
|
+
return;
|
|
5353
|
+
} catch (_) {
|
|
5354
|
+
_usingCtx3.e = _;
|
|
5355
|
+
} finally {
|
|
5356
|
+
_usingCtx3.d();
|
|
5357
|
+
}
|
|
5358
|
+
if (isFailure(mainProcessingResult)) try {
|
|
5359
|
+
var _usingCtx4 = (0, import_usingCtx.default)();
|
|
5360
|
+
if (initialSemaphoreState?.lastOutput != null && initialSemaphoreState.lastOutput !== "") log(initialSemaphoreState.lastOutput);
|
|
5361
|
+
else log("❌ Error generating status");
|
|
5362
|
+
if (logger.error("Error in statusline command:", mainProcessingResult.error), !ctx.values.cache) return;
|
|
5363
|
+
const semaphore = _usingCtx4.u(getSemaphore(sessionId));
|
|
5364
|
+
if (semaphore.data != null) semaphore.data.isUpdating = false, semaphore.data.pid = void 0;
|
|
5365
|
+
} catch (_) {
|
|
5366
|
+
_usingCtx4.e = _;
|
|
5367
|
+
} finally {
|
|
5368
|
+
_usingCtx4.d();
|
|
5369
|
+
}
|
|
4297
5370
|
}
|
|
4298
5371
|
});
|
|
4299
5372
|
var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
|
|
4300
|
-
const weeklyCommand = define({
|
|
5373
|
+
const weeklyCommand = define$1({
|
|
4301
5374
|
name: "weekly",
|
|
4302
5375
|
description: "Show usage report grouped by week",
|
|
4303
5376
|
args: {
|