claudekit
Version:
CLI tools for Claude Code development workflow
1,742 lines (1,729 loc) • 2.33 MB
JavaScript
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __esm = (fn, res) => function __init() {
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
};
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// cli/utils/colors.ts
function shouldUseColors(options2 = {}) {
if (options2.force === true) {
return true;
}
if (process.env["NO_COLOR"] !== void 0) {
return false;
}
if (process.env["FORCE_COLOR"] === "0") {
return false;
}
if (process.stdout.isTTY !== true) {
return false;
}
return true;
}
var Colors, symbols, status, colors;
var init_colors = __esm({
"cli/utils/colors.ts"() {
"use strict";
Colors = class _Colors {
static useColors = shouldUseColors();
/**
* Force enable or disable colors (useful for testing)
*/
static setEnabled(enabled) {
_Colors.useColors = enabled;
}
/**
* Reset colors to environment-based detection
*/
static reset() {
_Colors.useColors = shouldUseColors();
}
/**
* Force colors to be enabled regardless of environment (mainly for testing)
*/
static forceEnable() {
_Colors.useColors = shouldUseColors({ force: true });
}
/**
* Check if colors are currently enabled
*/
static get enabled() {
return _Colors.useColors;
}
// Success messages (green)
static success(text) {
return _Colors.useColors ? `\x1B[32m${text}\x1B[0m` : text;
}
// Error messages (red)
static error(text) {
return _Colors.useColors ? `\x1B[31m${text}\x1B[0m` : text;
}
// Warning messages (yellow)
static warn(text) {
return _Colors.useColors ? `\x1B[33m${text}\x1B[0m` : text;
}
// Info messages (cyan)
static info(text) {
return _Colors.useColors ? `\x1B[36m${text}\x1B[0m` : text;
}
// Debug messages (gray)
static debug(text) {
return _Colors.useColors ? `\x1B[90m${text}\x1B[0m` : text;
}
// Accent/highlight text (blue)
static accent(text) {
return _Colors.useColors ? `\x1B[34m${text}\x1B[0m` : text;
}
// Bold text
static bold(text) {
return _Colors.useColors ? `\x1B[1m${text}\x1B[0m` : text;
}
// Dim/subtle text
static dim(text) {
return _Colors.useColors ? `\x1B[2m${text}\x1B[0m` : text;
}
// Underlined text
static underline(text) {
return _Colors.useColors ? `\x1B[4m${text}\x1B[0m` : text;
}
// Raw picocolors for complex styling (only when colors enabled)
static get pc() {
if (_Colors.useColors) {
return {
red: (text) => `\x1B[31m${text}\x1B[0m`,
green: (text) => `\x1B[32m${text}\x1B[0m`,
yellow: (text) => `\x1B[33m${text}\x1B[0m`,
blue: (text) => `\x1B[34m${text}\x1B[0m`,
magenta: (text) => `\x1B[35m${text}\x1B[0m`,
cyan: (text) => `\x1B[36m${text}\x1B[0m`,
white: (text) => `\x1B[37m${text}\x1B[0m`,
black: (text) => `\x1B[30m${text}\x1B[0m`,
gray: (text) => `\x1B[90m${text}\x1B[0m`,
grey: (text) => `\x1B[90m${text}\x1B[0m`,
bold: (text) => `\x1B[1m${text}\x1B[0m`,
dim: (text) => `\x1B[2m${text}\x1B[0m`,
italic: (text) => `\x1B[3m${text}\x1B[0m`,
underline: (text) => `\x1B[4m${text}\x1B[0m`,
strikethrough: (text) => `\x1B[9m${text}\x1B[0m`,
inverse: (text) => `\x1B[7m${text}\x1B[0m`,
bgRed: (text) => `\x1B[41m${text}\x1B[0m`,
bgGreen: (text) => `\x1B[42m${text}\x1B[0m`,
bgYellow: (text) => `\x1B[43m${text}\x1B[0m`,
bgBlue: (text) => `\x1B[44m${text}\x1B[0m`,
bgMagenta: (text) => `\x1B[45m${text}\x1B[0m`,
bgCyan: (text) => `\x1B[46m${text}\x1B[0m`,
bgWhite: (text) => `\x1B[47m${text}\x1B[0m`,
bgBlack: (text) => `\x1B[40m${text}\x1B[0m`,
bgGray: (text) => `\x1B[100m${text}\x1B[0m`,
bgGrey: (text) => `\x1B[100m${text}\x1B[0m`
};
} else {
return {
red: (text) => text,
green: (text) => text,
yellow: (text) => text,
blue: (text) => text,
magenta: (text) => text,
cyan: (text) => text,
white: (text) => text,
black: (text) => text,
gray: (text) => text,
grey: (text) => text,
bold: (text) => text,
dim: (text) => text,
italic: (text) => text,
underline: (text) => text,
strikethrough: (text) => text,
inverse: (text) => text,
bgRed: (text) => text,
bgGreen: (text) => text,
bgYellow: (text) => text,
bgBlue: (text) => text,
bgMagenta: (text) => text,
bgCyan: (text) => text,
bgWhite: (text) => text,
bgBlack: (text) => text,
bgGray: (text) => text,
bgGrey: (text) => text
};
}
}
};
symbols = {
success: Colors.success("\u2713"),
error: Colors.error("\u2717"),
warning: Colors.warn("\u26A0"),
info: Colors.info("\u2139"),
arrow: Colors.dim("\u2192"),
bullet: Colors.dim("\u2022"),
dash: Colors.dim("\u2500")
};
status = {
success: (text) => `${symbols.success} ${Colors.success(text)}`,
error: (text) => `${symbols.error} ${Colors.error(text)}`,
warning: (text) => `${symbols.warning} ${Colors.warn(text)}`,
info: (text) => `${symbols.info} ${Colors.info(text)}`
};
colors = Colors;
}
});
// node_modules/chalk/source/vendor/ansi-styles/index.js
function assembleStyles() {
const codes = /* @__PURE__ */ new Map();
for (const [groupName, group] of Object.entries(styles)) {
for (const [styleName, style] of Object.entries(group)) {
styles[styleName] = {
open: `\x1B[${style[0]}m`,
close: `\x1B[${style[1]}m`
};
group[styleName] = styles[styleName];
codes.set(style[0], style[1]);
}
Object.defineProperty(styles, groupName, {
value: group,
enumerable: false
});
}
Object.defineProperty(styles, "codes", {
value: codes,
enumerable: false
});
styles.color.close = "\x1B[39m";
styles.bgColor.close = "\x1B[49m";
styles.color.ansi = wrapAnsi16();
styles.color.ansi256 = wrapAnsi256();
styles.color.ansi16m = wrapAnsi16m();
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
Object.defineProperties(styles, {
rgbToAnsi256: {
value(red, green, blue) {
if (red === green && green === blue) {
if (red < 8) {
return 16;
}
if (red > 248) {
return 231;
}
return Math.round((red - 8) / 247 * 24) + 232;
}
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
},
enumerable: false
},
hexToRgb: {
value(hex) {
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
if (!matches) {
return [0, 0, 0];
}
let [colorString] = matches;
if (colorString.length === 3) {
colorString = [...colorString].map((character) => character + character).join("");
}
const integer = Number.parseInt(colorString, 16);
return [
/* eslint-disable no-bitwise */
integer >> 16 & 255,
integer >> 8 & 255,
integer & 255
/* eslint-enable no-bitwise */
];
},
enumerable: false
},
hexToAnsi256: {
value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
enumerable: false
},
ansi256ToAnsi: {
value(code) {
if (code < 8) {
return 30 + code;
}
if (code < 16) {
return 90 + (code - 8);
}
let red;
let green;
let blue;
if (code >= 232) {
red = ((code - 232) * 10 + 8) / 255;
green = red;
blue = red;
} else {
code -= 16;
const remainder = code % 36;
red = Math.floor(code / 36) / 5;
green = Math.floor(remainder / 6) / 5;
blue = remainder % 6 / 5;
}
const value = Math.max(red, green, blue) * 2;
if (value === 0) {
return 30;
}
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
if (value === 2) {
result += 60;
}
return result;
},
enumerable: false
},
rgbToAnsi: {
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
enumerable: false
},
hexToAnsi: {
value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
enumerable: false
}
});
return styles;
}
var ANSI_BACKGROUND_OFFSET, wrapAnsi16, wrapAnsi256, wrapAnsi16m, styles, modifierNames, foregroundColorNames, backgroundColorNames, colorNames, ansiStyles, ansi_styles_default;
var init_ansi_styles = __esm({
"node_modules/chalk/source/vendor/ansi-styles/index.js"() {
ANSI_BACKGROUND_OFFSET = 10;
wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
styles = {
modifier: {
reset: [0, 0],
// 21 isn't widely supported and 22 does the same thing
bold: [1, 22],
dim: [2, 22],
italic: [3, 23],
underline: [4, 24],
overline: [53, 55],
inverse: [7, 27],
hidden: [8, 28],
strikethrough: [9, 29]
},
color: {
black: [30, 39],
red: [31, 39],
green: [32, 39],
yellow: [33, 39],
blue: [34, 39],
magenta: [35, 39],
cyan: [36, 39],
white: [37, 39],
// Bright color
blackBright: [90, 39],
gray: [90, 39],
// Alias of `blackBright`
grey: [90, 39],
// Alias of `blackBright`
redBright: [91, 39],
greenBright: [92, 39],
yellowBright: [93, 39],
blueBright: [94, 39],
magentaBright: [95, 39],
cyanBright: [96, 39],
whiteBright: [97, 39]
},
bgColor: {
bgBlack: [40, 49],
bgRed: [41, 49],
bgGreen: [42, 49],
bgYellow: [43, 49],
bgBlue: [44, 49],
bgMagenta: [45, 49],
bgCyan: [46, 49],
bgWhite: [47, 49],
// Bright color
bgBlackBright: [100, 49],
bgGray: [100, 49],
// Alias of `bgBlackBright`
bgGrey: [100, 49],
// Alias of `bgBlackBright`
bgRedBright: [101, 49],
bgGreenBright: [102, 49],
bgYellowBright: [103, 49],
bgBlueBright: [104, 49],
bgMagentaBright: [105, 49],
bgCyanBright: [106, 49],
bgWhiteBright: [107, 49]
}
};
modifierNames = Object.keys(styles.modifier);
foregroundColorNames = Object.keys(styles.color);
backgroundColorNames = Object.keys(styles.bgColor);
colorNames = [...foregroundColorNames, ...backgroundColorNames];
ansiStyles = assembleStyles();
ansi_styles_default = ansiStyles;
}
});
// node_modules/chalk/source/vendor/supports-color/index.js
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : import_node_process.default.argv) {
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
const position = argv.indexOf(prefix + flag);
const terminatorPosition = argv.indexOf("--");
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
}
function envForceColor() {
if ("FORCE_COLOR" in env) {
if (env.FORCE_COLOR === "true") {
return 1;
}
if (env.FORCE_COLOR === "false") {
return 0;
}
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
}
}
function translateLevel(level) {
if (level === 0) {
return false;
}
return {
level,
hasBasic: true,
has256: level >= 2,
has16m: level >= 3
};
}
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
const noFlagForceColor = envForceColor();
if (noFlagForceColor !== void 0) {
flagForceColor = noFlagForceColor;
}
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
if (forceColor === 0) {
return 0;
}
if (sniffFlags) {
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
return 3;
}
if (hasFlag("color=256")) {
return 2;
}
}
if ("TF_BUILD" in env && "AGENT_NAME" in env) {
return 1;
}
if (haveStream && !streamIsTTY && forceColor === void 0) {
return 0;
}
const min = forceColor || 0;
if (env.TERM === "dumb") {
return min;
}
if (import_node_process.default.platform === "win32") {
const osRelease = import_node_os.default.release().split(".");
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
return Number(osRelease[2]) >= 14931 ? 3 : 2;
}
return 1;
}
if ("CI" in env) {
if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => key in env)) {
return 3;
}
if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
return 1;
}
return min;
}
if ("TEAMCITY_VERSION" in env) {
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
}
if (env.COLORTERM === "truecolor") {
return 3;
}
if (env.TERM === "xterm-kitty") {
return 3;
}
if (env.TERM === "xterm-ghostty") {
return 3;
}
if (env.TERM === "wezterm") {
return 3;
}
if ("TERM_PROGRAM" in env) {
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
switch (env.TERM_PROGRAM) {
case "iTerm.app": {
return version >= 3 ? 3 : 2;
}
case "Apple_Terminal": {
return 2;
}
}
}
if (/-256(color)?$/i.test(env.TERM)) {
return 2;
}
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
return 1;
}
if ("COLORTERM" in env) {
return 1;
}
return min;
}
function createSupportsColor(stream2, options2 = {}) {
const level = _supportsColor(stream2, {
streamIsTTY: stream2 && stream2.isTTY,
...options2
});
return translateLevel(level);
}
var import_node_process, import_node_os, import_node_tty, env, flagForceColor, supportsColor, supports_color_default;
var init_supports_color = __esm({
"node_modules/chalk/source/vendor/supports-color/index.js"() {
import_node_process = __toESM(require("node:process"), 1);
import_node_os = __toESM(require("node:os"), 1);
import_node_tty = __toESM(require("node:tty"), 1);
({ env } = import_node_process.default);
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
flagForceColor = 0;
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
flagForceColor = 1;
}
supportsColor = {
stdout: createSupportsColor({ isTTY: import_node_tty.default.isatty(1) }),
stderr: createSupportsColor({ isTTY: import_node_tty.default.isatty(2) })
};
supports_color_default = supportsColor;
}
});
// node_modules/chalk/source/utilities.js
function stringReplaceAll(string, substring, replacer) {
let index = string.indexOf(substring);
if (index === -1) {
return string;
}
const substringLength = substring.length;
let endIndex = 0;
let returnValue = "";
do {
returnValue += string.slice(endIndex, index) + substring + replacer;
endIndex = index + substringLength;
index = string.indexOf(substring, endIndex);
} while (index !== -1);
returnValue += string.slice(endIndex);
return returnValue;
}
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
let endIndex = 0;
let returnValue = "";
do {
const gotCR = string[index - 1] === "\r";
returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
endIndex = index + 1;
index = string.indexOf("\n", endIndex);
} while (index !== -1);
returnValue += string.slice(endIndex);
return returnValue;
}
var init_utilities = __esm({
"node_modules/chalk/source/utilities.js"() {
}
});
// node_modules/chalk/source/index.js
function createChalk(options2) {
return chalkFactory(options2);
}
var stdoutColor, stderrColor, GENERATOR, STYLER, IS_EMPTY, levelMapping, styles2, applyOptions, chalkFactory, getModelAnsi, usedModels, proto, createStyler, createBuilder, applyStyle, chalk, chalkStderr, source_default;
var init_source = __esm({
"node_modules/chalk/source/index.js"() {
init_ansi_styles();
init_supports_color();
init_utilities();
({ stdout: stdoutColor, stderr: stderrColor } = supports_color_default);
GENERATOR = Symbol("GENERATOR");
STYLER = Symbol("STYLER");
IS_EMPTY = Symbol("IS_EMPTY");
levelMapping = [
"ansi",
"ansi",
"ansi256",
"ansi16m"
];
styles2 = /* @__PURE__ */ Object.create(null);
applyOptions = (object, options2 = {}) => {
if (options2.level && !(Number.isInteger(options2.level) && options2.level >= 0 && options2.level <= 3)) {
throw new Error("The `level` option should be an integer from 0 to 3");
}
const colorLevel = stdoutColor ? stdoutColor.level : 0;
object.level = options2.level === void 0 ? colorLevel : options2.level;
};
chalkFactory = (options2) => {
const chalk2 = (...strings) => strings.join(" ");
applyOptions(chalk2, options2);
Object.setPrototypeOf(chalk2, createChalk.prototype);
return chalk2;
};
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
for (const [styleName, style] of Object.entries(ansi_styles_default)) {
styles2[styleName] = {
get() {
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
Object.defineProperty(this, styleName, { value: builder });
return builder;
}
};
}
styles2.visible = {
get() {
const builder = createBuilder(this, this[STYLER], true);
Object.defineProperty(this, "visible", { value: builder });
return builder;
}
};
getModelAnsi = (model, level, type, ...arguments_) => {
if (model === "rgb") {
if (level === "ansi16m") {
return ansi_styles_default[type].ansi16m(...arguments_);
}
if (level === "ansi256") {
return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
}
return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
}
if (model === "hex") {
return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
}
return ansi_styles_default[type][model](...arguments_);
};
usedModels = ["rgb", "hex", "ansi256"];
for (const model of usedModels) {
styles2[model] = {
get() {
const { level } = this;
return function(...arguments_) {
const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
return createBuilder(this, styler, this[IS_EMPTY]);
};
}
};
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
styles2[bgModel] = {
get() {
const { level } = this;
return function(...arguments_) {
const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
return createBuilder(this, styler, this[IS_EMPTY]);
};
}
};
}
proto = Object.defineProperties(() => {
}, {
...styles2,
level: {
enumerable: true,
get() {
return this[GENERATOR].level;
},
set(level) {
this[GENERATOR].level = level;
}
}
});
createStyler = (open, close, parent) => {
let openAll;
let closeAll;
if (parent === void 0) {
openAll = open;
closeAll = close;
} else {
openAll = parent.openAll + open;
closeAll = close + parent.closeAll;
}
return {
open,
close,
openAll,
closeAll,
parent
};
};
createBuilder = (self, _styler, _isEmpty) => {
const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
Object.setPrototypeOf(builder, proto);
builder[GENERATOR] = self;
builder[STYLER] = _styler;
builder[IS_EMPTY] = _isEmpty;
return builder;
};
applyStyle = (self, string) => {
if (self.level <= 0 || !string) {
return self[IS_EMPTY] ? "" : string;
}
let styler = self[STYLER];
if (styler === void 0) {
return string;
}
const { openAll, closeAll } = styler;
if (string.includes("\x1B")) {
while (styler !== void 0) {
string = stringReplaceAll(string, styler.close, styler.open);
styler = styler.parent;
}
}
const lfIndex = string.indexOf("\n");
if (lfIndex !== -1) {
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
}
return openAll + string + closeAll;
};
Object.defineProperties(createChalk.prototype, styles2);
chalk = createChalk();
chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
source_default = chalk;
}
});
// node_modules/mimic-function/index.js
function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
const { name } = to;
for (const property of Reflect.ownKeys(from)) {
copyProperty(to, from, property, ignoreNonConfigurable);
}
changePrototype(to, from);
changeToString(to, from, name);
return to;
}
var copyProperty, canCopyProperty, changePrototype, wrappedToString, toStringDescriptor, toStringName, changeToString;
var init_mimic_function = __esm({
"node_modules/mimic-function/index.js"() {
copyProperty = (to, from, property, ignoreNonConfigurable) => {
if (property === "length" || property === "prototype") {
return;
}
if (property === "arguments" || property === "caller") {
return;
}
const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {
return;
}
Object.defineProperty(to, property, fromDescriptor);
};
canCopyProperty = function(toDescriptor, fromDescriptor) {
return toDescriptor === void 0 || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
};
changePrototype = (to, from) => {
const fromPrototype = Object.getPrototypeOf(from);
if (fromPrototype === Object.getPrototypeOf(to)) {
return;
}
Object.setPrototypeOf(to, fromPrototype);
};
wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/
${fromBody}`;
toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, "toString");
toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");
changeToString = (to, from, name) => {
const withName = name === "" ? "" : `with ${name.trim()}() `;
const newToString = wrappedToString.bind(null, withName, from.toString());
Object.defineProperty(newToString, "name", toStringName);
const { writable, enumerable, configurable } = toStringDescriptor;
Object.defineProperty(to, "toString", { value: newToString, writable, enumerable, configurable });
};
}
});
// node_modules/ora/node_modules/onetime/index.js
var calledFunctions, onetime, onetime_default;
var init_onetime = __esm({
"node_modules/ora/node_modules/onetime/index.js"() {
init_mimic_function();
calledFunctions = /* @__PURE__ */ new WeakMap();
onetime = (function_, options2 = {}) => {
if (typeof function_ !== "function") {
throw new TypeError("Expected a function");
}
let returnValue;
let callCount = 0;
const functionName = function_.displayName || function_.name || "<anonymous>";
const onetime2 = function(...arguments_) {
calledFunctions.set(onetime2, ++callCount);
if (callCount === 1) {
returnValue = function_.apply(this, arguments_);
function_ = void 0;
} else if (options2.throw === true) {
throw new Error(`Function \`${functionName}\` can only be called once`);
}
return returnValue;
};
mimicFunction(onetime2, function_);
calledFunctions.set(onetime2, callCount);
return onetime2;
};
onetime.callCount = (function_) => {
if (!calledFunctions.has(function_)) {
throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
}
return calledFunctions.get(function_);
};
onetime_default = onetime;
}
});
// node_modules/signal-exit/dist/mjs/signals.js
var signals;
var init_signals = __esm({
"node_modules/signal-exit/dist/mjs/signals.js"() {
signals = [];
signals.push("SIGHUP", "SIGINT", "SIGTERM");
if (process.platform !== "win32") {
signals.push(
"SIGALRM",
"SIGABRT",
"SIGVTALRM",
"SIGXCPU",
"SIGXFSZ",
"SIGUSR2",
"SIGTRAP",
"SIGSYS",
"SIGQUIT",
"SIGIOT"
// should detect profiler and enable/disable accordingly.
// see #21
// 'SIGPROF'
);
}
if (process.platform === "linux") {
signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
}
}
});
// node_modules/signal-exit/dist/mjs/index.js
var processOk, kExitEmitter, global2, ObjectDefineProperty, Emitter, SignalExitBase, signalExitWrap, SignalExitFallback, SignalExit, process3, onExit, load, unload;
var init_mjs = __esm({
"node_modules/signal-exit/dist/mjs/index.js"() {
init_signals();
processOk = (process11) => !!process11 && typeof process11 === "object" && typeof process11.removeListener === "function" && typeof process11.emit === "function" && typeof process11.reallyExit === "function" && typeof process11.listeners === "function" && typeof process11.kill === "function" && typeof process11.pid === "number" && typeof process11.on === "function";
kExitEmitter = Symbol.for("signal-exit emitter");
global2 = globalThis;
ObjectDefineProperty = Object.defineProperty.bind(Object);
Emitter = class {
emitted = {
afterExit: false,
exit: false
};
listeners = {
afterExit: [],
exit: []
};
count = 0;
id = Math.random();
constructor() {
if (global2[kExitEmitter]) {
return global2[kExitEmitter];
}
ObjectDefineProperty(global2, kExitEmitter, {
value: this,
writable: false,
enumerable: false,
configurable: false
});
}
on(ev, fn) {
this.listeners[ev].push(fn);
}
removeListener(ev, fn) {
const list2 = this.listeners[ev];
const i = list2.indexOf(fn);
if (i === -1) {
return;
}
if (i === 0 && list2.length === 1) {
list2.length = 0;
} else {
list2.splice(i, 1);
}
}
emit(ev, code, signal) {
if (this.emitted[ev]) {
return false;
}
this.emitted[ev] = true;
let ret = false;
for (const fn of this.listeners[ev]) {
ret = fn(code, signal) === true || ret;
}
if (ev === "exit") {
ret = this.emit("afterExit", code, signal) || ret;
}
return ret;
}
};
SignalExitBase = class {
};
signalExitWrap = (handler) => {
return {
onExit(cb, opts) {
return handler.onExit(cb, opts);
},
load() {
return handler.load();
},
unload() {
return handler.unload();
}
};
};
SignalExitFallback = class extends SignalExitBase {
onExit() {
return () => {
};
}
load() {
}
unload() {
}
};
SignalExit = class extends SignalExitBase {
// "SIGHUP" throws an `ENOSYS` error on Windows,
// so use a supported signal instead
/* c8 ignore start */
#hupSig = process3.platform === "win32" ? "SIGINT" : "SIGHUP";
/* c8 ignore stop */
#emitter = new Emitter();
#process;
#originalProcessEmit;
#originalProcessReallyExit;
#sigListeners = {};
#loaded = false;
constructor(process11) {
super();
this.#process = process11;
this.#sigListeners = {};
for (const sig of signals) {
this.#sigListeners[sig] = () => {
const listeners = this.#process.listeners(sig);
let { count } = this.#emitter;
const p = process11;
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
count += p.__signal_exit_emitter__.count;
}
if (listeners.length === count) {
this.unload();
const ret = this.#emitter.emit("exit", null, sig);
const s = sig === "SIGHUP" ? this.#hupSig : sig;
if (!ret)
process11.kill(process11.pid, s);
}
};
}
this.#originalProcessReallyExit = process11.reallyExit;
this.#originalProcessEmit = process11.emit;
}
onExit(cb, opts) {
if (!processOk(this.#process)) {
return () => {
};
}
if (this.#loaded === false) {
this.load();
}
const ev = opts?.alwaysLast ? "afterExit" : "exit";
this.#emitter.on(ev, cb);
return () => {
this.#emitter.removeListener(ev, cb);
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
this.unload();
}
};
}
load() {
if (this.#loaded) {
return;
}
this.#loaded = true;
this.#emitter.count += 1;
for (const sig of signals) {
try {
const fn = this.#sigListeners[sig];
if (fn)
this.#process.on(sig, fn);
} catch (_) {
}
}
this.#process.emit = (ev, ...a) => {
return this.#processEmit(ev, ...a);
};
this.#process.reallyExit = (code) => {
return this.#processReallyExit(code);
};
}
unload() {
if (!this.#loaded) {
return;
}
this.#loaded = false;
signals.forEach((sig) => {
const listener = this.#sigListeners[sig];
if (!listener) {
throw new Error("Listener not defined for signal: " + sig);
}
try {
this.#process.removeListener(sig, listener);
} catch (_) {
}
});
this.#process.emit = this.#originalProcessEmit;
this.#process.reallyExit = this.#originalProcessReallyExit;
this.#emitter.count -= 1;
}
#processReallyExit(code) {
if (!processOk(this.#process)) {
return 0;
}
this.#process.exitCode = code || 0;
this.#emitter.emit("exit", this.#process.exitCode, null);
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
}
#processEmit(ev, ...args) {
const og = this.#originalProcessEmit;
if (ev === "exit" && processOk(this.#process)) {
if (typeof args[0] === "number") {
this.#process.exitCode = args[0];
}
const ret = og.call(this.#process, ev, ...args);
this.#emitter.emit("exit", this.#process.exitCode, null);
return ret;
} else {
return og.call(this.#process, ev, ...args);
}
}
};
process3 = globalThis.process;
({
onExit: (
/**
* Called when the process is exiting, whether via signal, explicit
* exit, or running out of stuff to do.
*
* If the global process object is not suitable for instrumentation,
* then this will be a no-op.
*
* Returns a function that may be used to unload signal-exit.
*/
onExit
),
load: (
/**
* Load the listeners. Likely you never need to call this, unless
* doing a rather deep integration with signal-exit functionality.
* Mostly exposed for the benefit of testing.
*
* @internal
*/
load
),
unload: (
/**
* Unload the listeners. Likely you never need to call this, unless
* doing a rather deep integration with signal-exit functionality.
* Mostly exposed for the benefit of testing.
*
* @internal
*/
unload
)
} = signalExitWrap(processOk(process3) ? new SignalExit(process3) : new SignalExitFallback()));
}
});
// node_modules/ora/node_modules/restore-cursor/index.js
var import_node_process2, terminal, restoreCursor, restore_cursor_default;
var init_restore_cursor = __esm({
"node_modules/ora/node_modules/restore-cursor/index.js"() {
import_node_process2 = __toESM(require("node:process"), 1);
init_onetime();
init_mjs();
terminal = import_node_process2.default.stderr.isTTY ? import_node_process2.default.stderr : import_node_process2.default.stdout.isTTY ? import_node_process2.default.stdout : void 0;
restoreCursor = terminal ? onetime_default(() => {
onExit(() => {
terminal.write("\x1B[?25h");
}, { alwaysLast: true });
}) : () => {
};
restore_cursor_default = restoreCursor;
}
});
// node_modules/ora/node_modules/cli-cursor/index.js
var import_node_process3, isHidden, cliCursor, cli_cursor_default;
var init_cli_cursor = __esm({
"node_modules/ora/node_modules/cli-cursor/index.js"() {
import_node_process3 = __toESM(require("node:process"), 1);
init_restore_cursor();
isHidden = false;
cliCursor = {};
cliCursor.show = (writableStream = import_node_process3.default.stderr) => {
if (!writableStream.isTTY) {
return;
}
isHidden = false;
writableStream.write("\x1B[?25h");
};
cliCursor.hide = (writableStream = import_node_process3.default.stderr) => {
if (!writableStream.isTTY) {
return;
}
restore_cursor_default();
isHidden = true;
writableStream.write("\x1B[?25l");
};
cliCursor.toggle = (force, writableStream) => {
if (force !== void 0) {
isHidden = force;
}
if (isHidden) {
cliCursor.show(writableStream);
} else {
cliCursor.hide(writableStream);
}
};
cli_cursor_default = cliCursor;
}
});
// node_modules/cli-spinners/spinners.json
var require_spinners = __commonJS({
"node_modules/cli-spinners/spinners.json"(exports2, module2) {
module2.exports = {
dots: {
interval: 80,
frames: [
"\u280B",
"\u2819",
"\u2839",
"\u2838",
"\u283C",
"\u2834",
"\u2826",
"\u2827",
"\u2807",
"\u280F"
]
},
dots2: {
interval: 80,
frames: [
"\u28FE",
"\u28FD",
"\u28FB",
"\u28BF",
"\u287F",
"\u28DF",
"\u28EF",
"\u28F7"
]
},
dots3: {
interval: 80,
frames: [
"\u280B",
"\u2819",
"\u281A",
"\u281E",
"\u2816",
"\u2826",
"\u2834",
"\u2832",
"\u2833",
"\u2813"
]
},
dots4: {
interval: 80,
frames: [
"\u2804",
"\u2806",
"\u2807",
"\u280B",
"\u2819",
"\u2838",
"\u2830",
"\u2820",
"\u2830",
"\u2838",
"\u2819",
"\u280B",
"\u2807",
"\u2806"
]
},
dots5: {
interval: 80,
frames: [
"\u280B",
"\u2819",
"\u281A",
"\u2812",
"\u2802",
"\u2802",
"\u2812",
"\u2832",
"\u2834",
"\u2826",
"\u2816",
"\u2812",
"\u2810",
"\u2810",
"\u2812",
"\u2813",
"\u280B"
]
},
dots6: {
interval: 80,
frames: [
"\u2801",
"\u2809",
"\u2819",
"\u281A",
"\u2812",
"\u2802",
"\u2802",
"\u2812",
"\u2832",
"\u2834",
"\u2824",
"\u2804",
"\u2804",
"\u2824",
"\u2834",
"\u2832",
"\u2812",
"\u2802",
"\u2802",
"\u2812",
"\u281A",
"\u2819",
"\u2809",
"\u2801"
]
},
dots7: {
interval: 80,
frames: [
"\u2808",
"\u2809",
"\u280B",
"\u2813",
"\u2812",
"\u2810",
"\u2810",
"\u2812",
"\u2816",
"\u2826",
"\u2824",
"\u2820",
"\u2820",
"\u2824",
"\u2826",
"\u2816",
"\u2812",
"\u2810",
"\u2810",
"\u2812",
"\u2813",
"\u280B",
"\u2809",
"\u2808"
]
},
dots8: {
interval: 80,
frames: [
"\u2801",
"\u2801",
"\u2809",
"\u2819",
"\u281A",
"\u2812",
"\u2802",
"\u2802",
"\u2812",
"\u2832",
"\u2834",
"\u2824",
"\u2804",
"\u2804",
"\u2824",
"\u2820",
"\u2820",
"\u2824",
"\u2826",
"\u2816",
"\u2812",
"\u2810",
"\u2810",
"\u2812",
"\u2813",
"\u280B",
"\u2809",
"\u2808",
"\u2808"
]
},
dots9: {
interval: 80,
frames: [
"\u28B9",
"\u28BA",
"\u28BC",
"\u28F8",
"\u28C7",
"\u2867",
"\u2857",
"\u284F"
]
},
dots10: {
interval: 80,
frames: [
"\u2884",
"\u2882",
"\u2881",
"\u2841",
"\u2848",
"\u2850",
"\u2860"
]
},
dots11: {
interval: 100,
frames: [
"\u2801",
"\u2802",
"\u2804",
"\u2840",
"\u2880",
"\u2820",
"\u2810",
"\u2808"
]
},
dots12: {
interval: 80,
frames: [
"\u2880\u2800",
"\u2840\u2800",
"\u2804\u2800",
"\u2882\u2800",
"\u2842\u2800",
"\u2805\u2800",
"\u2883\u2800",
"\u2843\u2800",
"\u280D\u2800",
"\u288B\u2800",
"\u284B\u2800",
"\u280D\u2801",
"\u288B\u2801",
"\u284B\u2801",
"\u280D\u2809",
"\u280B\u2809",
"\u280B\u2809",
"\u2809\u2819",
"\u2809\u2819",
"\u2809\u2829",
"\u2808\u2899",
"\u2808\u2859",
"\u2888\u2829",
"\u2840\u2899",
"\u2804\u2859",
"\u2882\u2829",
"\u2842\u2898",
"\u2805\u2858",
"\u2883\u2828",
"\u2843\u2890",
"\u280D\u2850",
"\u288B\u2820",
"\u284B\u2880",
"\u280D\u2841",
"\u288B\u2801",
"\u284B\u2801",
"\u280D\u2809",
"\u280B\u2809",
"\u280B\u2809",
"\u2809\u2819",
"\u2809\u2819",
"\u2809\u2829",
"\u2808\u2899",
"\u2808\u2859",
"\u2808\u2829",
"\u2800\u2899",
"\u2800\u2859",
"\u2800\u2829",
"\u2800\u2898",
"\u2800\u2858",
"\u2800\u2828",
"\u2800\u2890",
"\u2800\u2850",
"\u2800\u2820",
"\u2800\u2880",
"\u2800\u2840"
]
},
dots13: {
interval: 80,
frames: [
"\u28FC",
"\u28F9",
"\u28BB",
"\u283F",
"\u285F",
"\u28CF",
"\u28E7",
"\u28F6"
]
},
dots8Bit: {
interval: 80,
frames: [
"\u2800",
"\u2801",
"\u2802",
"\u2803",
"\u2804",
"\u2805",
"\u2806",
"\u2807",
"\u2840",
"\u2841",
"\u2842",
"\u2843",
"\u2844",
"\u2845",
"\u2846",
"\u2847",
"\u2808",
"\u2809",
"\u280A",
"\u280B",
"\u280C",
"\u280D",
"\u280E",
"\u280F",
"\u2848",
"\u2849",
"\u284A",
"\u284B",
"\u284C",
"\u284D",
"\u284E",
"\u284F",
"\u2810",
"\u2811",
"\u2812",
"\u2813",
"\u2814",
"\u2815",
"\u2816",
"\u2817",
"\u2850",
"\u2851",
"\u2852",
"\u2853",
"\u2854",
"\u2855",
"\u2856",
"\u2857",
"\u2818",
"\u2819",
"\u281A",
"\u281B",
"\u281C",
"\u281D",
"\u281E",
"\u281F",
"\u2858",
"\u2859",
"\u285A",
"\u285B",
"\u285C",
"\u285D",
"\u285E",
"\u285F",
"\u2820",
"\u2821",
"\u2822",
"\u2823",
"\u2824",
"\u2825",
"\u2826",
"\u2827",
"\u2860",
"\u2861",
"\u2862",
"\u2863",
"\u2864",
"\u2865",
"\u2866",
"\u2867",
"\u2828",
"\u2829",
"\u282A",
"\u282B",
"\u282C",
"\u282D",
"\u282E",
"\u282F",
"\u2868",
"\u2869",
"\u286A",
"\u286B",
"\u286C",
"\u286D",
"\u286E",
"\u286F",
"\u2830",
"\u2831",
"\u2832",
"\u2833",
"\u2834",
"\u2835",
"\u2836",
"\u2837",
"\u2870",
"\u2871",
"\u2872",
"\u2873",
"\u2874",
"\u2875",
"\u2876",
"\u2877",
"\u2838",
"\u2839",
"\u283A",
"\u283B",
"\u283C",
"\u283D",
"\u283E",
"\u283F",
"\u2878",
"\u2879",
"\u287A",
"\u287B",
"\u287C",
"\u287D",
"\u287E",
"\u287F",
"\u2880",
"\u2881",
"\u2882",
"\u2883",
"\u2884",
"\u2885",
"\u2886",
"\u2887",
"\u28C0",
"\u28C1",
"\u28C2",
"\u28C3",
"\u28C4",
"\u28C5",
"\u28C6",
"\u28C7",
"\u2888",
"\u2889",
"\u288A",
"\u288B",
"\u288C",
"\u288D",
"\u288E",
"\u288F",
"\u28C8",
"\u28C9",
"\u28CA",
"\u28CB",
"\u28CC",
"\u28CD",
"\u28CE",
"\u28CF",
"\u2890",
"\u2891",
"\u2892",
"\u2893",
"\u2894",
"\u2895",
"\u2896",
"\u2897",
"\u28D0",
"\u28D1",
"\u28D2",
"\u28D3",
"\u28D4",
"\u28D5",
"\u28D6",
"\u28D7",
"\u2898",
"\u2899",
"\u289A",
"\u289B",
"\u289C",
"\u289D",
"\u289E",
"\u289F",
"\u28D8",
"\u28D9",
"\u28DA",
"\u28DB",
"\u28DC",
"\u28DD",
"\u28DE",
"\u28DF",
"\u28A0",
"\u28A1",
"\u28A2",
"\u28A3",
"\u28A4",
"\u28A5",
"\u28A6",
"\u28A7",
"\u28E0",
"\u28E1",
"\u28E2",
"\u28E3",
"\u28E4",
"\u28E5",
"\u28E6",
"\u28E7",
"\u28A8",
"\u28A9",
"\u28AA",
"\u28AB",
"\u28AC",
"\u28AD",
"\u28AE",
"\u28AF",
"\u28E8",
"\u28E9",
"\u28EA",
"\u28EB",
"\u28EC",
"\u28ED",
"\u28EE",
"\u28EF",
"\u28B0",
"\u28B1",
"\u28B2",
"\u28B3",
"\u28B4",
"\u28B5",
"\u28B6",
"\u28B7",
"\u28F0",
"\u28F1",
"\u28F2",
"\u28F3",
"\u28F4",
"\u28F5",
"\u28F6",
"\u28F7",
"\u28B8",
"\u28B9",
"\u28BA",
"\u28BB",
"\u28BC",
"\u28BD",
"\u28BE",
"\u28BF",
"\u28F8",
"\u28F9",
"\u28FA",
"\u28FB",
"\u28FC",
"\u28FD",
"\u28FE",
"\u28FF"
]
},
sand: {
interval: 80,
frames: [
"\u2801",
"\u2802",
"\u2804",
"\u2840",
"\u2848",
"\u2850",
"\u2860",
"\u28C0",
"\u28C1",
"\u28C2",
"\u28C4",
"\u28CC",
"\u28D4",
"\u28E4",
"\u28E5",
"\u28E6",
"\u28EE",
"\u28F6",
"\u28F7",
"\u28FF",
"\u287F",
"\u283F",
"\u289F",
"\u281F",
"\u285B",
"\u281B",
"\u282B",
"\u288B",
"\u280B",
"\u280D",
"\u2849",
"\u2809",
"\u2811",
"\u2821",
"\u2881"
]
},
line: {
interval: 130,
frames: [
"-",
"\\",
"|",
"/"
]
},
line2: {
interval: 100,
frames: [
"\u2802",
"-",
"\u2013",
"\u2014",
"\u2013",
"-"
]
},
pipe: {
interval: 100,