claudish 2.6.1 → 2.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3404 -431
- package/package.json +12 -2
- package/scripts/generate-manifest.ts +89 -0
- package/dist/mcp-server.js +0 -30705
- package/recommended-models.json +0 -133
package/dist/index.js
CHANGED
|
@@ -31245,6 +31245,2988 @@ var init_mcp_server = __esm(() => {
|
|
|
31245
31245
|
ALL_MODELS_CACHE_PATH = join(__dirname2, "../all-models.json");
|
|
31246
31246
|
});
|
|
31247
31247
|
|
|
31248
|
+
// src/profile-config.ts
|
|
31249
|
+
import { existsSync as existsSync2, mkdirSync, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
31250
|
+
import { homedir } from "node:os";
|
|
31251
|
+
import { join as join2 } from "node:path";
|
|
31252
|
+
function ensureConfigDir() {
|
|
31253
|
+
if (!existsSync2(CONFIG_DIR)) {
|
|
31254
|
+
mkdirSync(CONFIG_DIR, { recursive: true });
|
|
31255
|
+
}
|
|
31256
|
+
}
|
|
31257
|
+
function loadConfig() {
|
|
31258
|
+
ensureConfigDir();
|
|
31259
|
+
if (!existsSync2(CONFIG_FILE)) {
|
|
31260
|
+
return { ...DEFAULT_CONFIG };
|
|
31261
|
+
}
|
|
31262
|
+
try {
|
|
31263
|
+
const content = readFileSync2(CONFIG_FILE, "utf-8");
|
|
31264
|
+
const config3 = JSON.parse(content);
|
|
31265
|
+
return {
|
|
31266
|
+
version: config3.version || DEFAULT_CONFIG.version,
|
|
31267
|
+
defaultProfile: config3.defaultProfile || DEFAULT_CONFIG.defaultProfile,
|
|
31268
|
+
profiles: config3.profiles || DEFAULT_CONFIG.profiles
|
|
31269
|
+
};
|
|
31270
|
+
} catch (error46) {
|
|
31271
|
+
console.error(`Warning: Failed to load config, using defaults: ${error46}`);
|
|
31272
|
+
return { ...DEFAULT_CONFIG };
|
|
31273
|
+
}
|
|
31274
|
+
}
|
|
31275
|
+
function saveConfig(config3) {
|
|
31276
|
+
ensureConfigDir();
|
|
31277
|
+
writeFileSync2(CONFIG_FILE, JSON.stringify(config3, null, 2), "utf-8");
|
|
31278
|
+
}
|
|
31279
|
+
function configExists() {
|
|
31280
|
+
return existsSync2(CONFIG_FILE);
|
|
31281
|
+
}
|
|
31282
|
+
function getConfigPath() {
|
|
31283
|
+
return CONFIG_FILE;
|
|
31284
|
+
}
|
|
31285
|
+
function getProfile(name) {
|
|
31286
|
+
const config3 = loadConfig();
|
|
31287
|
+
return config3.profiles[name];
|
|
31288
|
+
}
|
|
31289
|
+
function getDefaultProfile() {
|
|
31290
|
+
const config3 = loadConfig();
|
|
31291
|
+
const profile = config3.profiles[config3.defaultProfile];
|
|
31292
|
+
if (!profile) {
|
|
31293
|
+
const firstProfile = Object.values(config3.profiles)[0];
|
|
31294
|
+
if (firstProfile) {
|
|
31295
|
+
return firstProfile;
|
|
31296
|
+
}
|
|
31297
|
+
return DEFAULT_CONFIG.profiles.default;
|
|
31298
|
+
}
|
|
31299
|
+
return profile;
|
|
31300
|
+
}
|
|
31301
|
+
function getProfileNames() {
|
|
31302
|
+
const config3 = loadConfig();
|
|
31303
|
+
return Object.keys(config3.profiles);
|
|
31304
|
+
}
|
|
31305
|
+
function setProfile(profile) {
|
|
31306
|
+
const config3 = loadConfig();
|
|
31307
|
+
const existingProfile = config3.profiles[profile.name];
|
|
31308
|
+
if (existingProfile) {
|
|
31309
|
+
profile.createdAt = existingProfile.createdAt;
|
|
31310
|
+
} else {
|
|
31311
|
+
profile.createdAt = new Date().toISOString();
|
|
31312
|
+
}
|
|
31313
|
+
profile.updatedAt = new Date().toISOString();
|
|
31314
|
+
config3.profiles[profile.name] = profile;
|
|
31315
|
+
saveConfig(config3);
|
|
31316
|
+
}
|
|
31317
|
+
function deleteProfile(name) {
|
|
31318
|
+
const config3 = loadConfig();
|
|
31319
|
+
if (!config3.profiles[name]) {
|
|
31320
|
+
return false;
|
|
31321
|
+
}
|
|
31322
|
+
const profileCount = Object.keys(config3.profiles).length;
|
|
31323
|
+
if (profileCount <= 1) {
|
|
31324
|
+
throw new Error("Cannot delete the last profile");
|
|
31325
|
+
}
|
|
31326
|
+
delete config3.profiles[name];
|
|
31327
|
+
if (config3.defaultProfile === name) {
|
|
31328
|
+
config3.defaultProfile = Object.keys(config3.profiles)[0];
|
|
31329
|
+
}
|
|
31330
|
+
saveConfig(config3);
|
|
31331
|
+
return true;
|
|
31332
|
+
}
|
|
31333
|
+
function setDefaultProfile(name) {
|
|
31334
|
+
const config3 = loadConfig();
|
|
31335
|
+
if (!config3.profiles[name]) {
|
|
31336
|
+
throw new Error(`Profile "${name}" does not exist`);
|
|
31337
|
+
}
|
|
31338
|
+
config3.defaultProfile = name;
|
|
31339
|
+
saveConfig(config3);
|
|
31340
|
+
}
|
|
31341
|
+
function getModelMapping(profileName) {
|
|
31342
|
+
const profile = profileName ? getProfile(profileName) : getDefaultProfile();
|
|
31343
|
+
if (!profile) {
|
|
31344
|
+
return {};
|
|
31345
|
+
}
|
|
31346
|
+
return profile.models;
|
|
31347
|
+
}
|
|
31348
|
+
function createProfile(name, models, description) {
|
|
31349
|
+
const now = new Date().toISOString();
|
|
31350
|
+
const profile = {
|
|
31351
|
+
name,
|
|
31352
|
+
description,
|
|
31353
|
+
models,
|
|
31354
|
+
createdAt: now,
|
|
31355
|
+
updatedAt: now
|
|
31356
|
+
};
|
|
31357
|
+
setProfile(profile);
|
|
31358
|
+
return profile;
|
|
31359
|
+
}
|
|
31360
|
+
function listProfiles() {
|
|
31361
|
+
const config3 = loadConfig();
|
|
31362
|
+
return Object.values(config3.profiles).map((profile) => ({
|
|
31363
|
+
...profile,
|
|
31364
|
+
isDefault: profile.name === config3.defaultProfile
|
|
31365
|
+
}));
|
|
31366
|
+
}
|
|
31367
|
+
var CONFIG_DIR, CONFIG_FILE, DEFAULT_CONFIG;
|
|
31368
|
+
var init_profile_config = __esm(() => {
|
|
31369
|
+
CONFIG_DIR = join2(homedir(), ".claudish");
|
|
31370
|
+
CONFIG_FILE = join2(CONFIG_DIR, "config.json");
|
|
31371
|
+
DEFAULT_CONFIG = {
|
|
31372
|
+
version: "1.0.0",
|
|
31373
|
+
defaultProfile: "default",
|
|
31374
|
+
profiles: {
|
|
31375
|
+
default: {
|
|
31376
|
+
name: "default",
|
|
31377
|
+
description: "Default profile - balanced performance and cost",
|
|
31378
|
+
models: {
|
|
31379
|
+
opus: "x-ai/grok-3-beta",
|
|
31380
|
+
sonnet: "x-ai/grok-code-fast-1",
|
|
31381
|
+
haiku: "google/gemini-2.5-flash"
|
|
31382
|
+
},
|
|
31383
|
+
createdAt: new Date().toISOString(),
|
|
31384
|
+
updatedAt: new Date().toISOString()
|
|
31385
|
+
}
|
|
31386
|
+
}
|
|
31387
|
+
};
|
|
31388
|
+
});
|
|
31389
|
+
|
|
31390
|
+
// node_modules/@inquirer/core/dist/lib/key.js
|
|
31391
|
+
var isUpKey = (key, keybindings = []) => key.name === "up" || keybindings.includes("vim") && key.name === "k" || keybindings.includes("emacs") && key.ctrl && key.name === "p", isDownKey = (key, keybindings = []) => key.name === "down" || keybindings.includes("vim") && key.name === "j" || keybindings.includes("emacs") && key.ctrl && key.name === "n", isBackspaceKey = (key) => key.name === "backspace", isTabKey = (key) => key.name === "tab", isNumberKey = (key) => "1234567890".includes(key.name), isEnterKey = (key) => key.name === "enter" || key.name === "return";
|
|
31392
|
+
|
|
31393
|
+
// node_modules/@inquirer/core/dist/lib/errors.js
|
|
31394
|
+
var AbortPromptError, CancelPromptError, ExitPromptError, HookError, ValidationError;
|
|
31395
|
+
var init_errors5 = __esm(() => {
|
|
31396
|
+
AbortPromptError = class AbortPromptError extends Error {
|
|
31397
|
+
name = "AbortPromptError";
|
|
31398
|
+
message = "Prompt was aborted";
|
|
31399
|
+
constructor(options) {
|
|
31400
|
+
super();
|
|
31401
|
+
this.cause = options?.cause;
|
|
31402
|
+
}
|
|
31403
|
+
};
|
|
31404
|
+
CancelPromptError = class CancelPromptError extends Error {
|
|
31405
|
+
name = "CancelPromptError";
|
|
31406
|
+
message = "Prompt was canceled";
|
|
31407
|
+
};
|
|
31408
|
+
ExitPromptError = class ExitPromptError extends Error {
|
|
31409
|
+
name = "ExitPromptError";
|
|
31410
|
+
};
|
|
31411
|
+
HookError = class HookError extends Error {
|
|
31412
|
+
name = "HookError";
|
|
31413
|
+
};
|
|
31414
|
+
ValidationError = class ValidationError extends Error {
|
|
31415
|
+
name = "ValidationError";
|
|
31416
|
+
};
|
|
31417
|
+
});
|
|
31418
|
+
|
|
31419
|
+
// node_modules/@inquirer/core/dist/lib/hook-engine.js
|
|
31420
|
+
import { AsyncLocalStorage, AsyncResource } from "node:async_hooks";
|
|
31421
|
+
function createStore(rl) {
|
|
31422
|
+
const store = {
|
|
31423
|
+
rl,
|
|
31424
|
+
hooks: [],
|
|
31425
|
+
hooksCleanup: [],
|
|
31426
|
+
hooksEffect: [],
|
|
31427
|
+
index: 0,
|
|
31428
|
+
handleChange() {}
|
|
31429
|
+
};
|
|
31430
|
+
return store;
|
|
31431
|
+
}
|
|
31432
|
+
function withHooks(rl, cb) {
|
|
31433
|
+
const store = createStore(rl);
|
|
31434
|
+
return hookStorage.run(store, () => {
|
|
31435
|
+
function cycle(render) {
|
|
31436
|
+
store.handleChange = () => {
|
|
31437
|
+
store.index = 0;
|
|
31438
|
+
render();
|
|
31439
|
+
};
|
|
31440
|
+
store.handleChange();
|
|
31441
|
+
}
|
|
31442
|
+
return cb(cycle);
|
|
31443
|
+
});
|
|
31444
|
+
}
|
|
31445
|
+
function getStore() {
|
|
31446
|
+
const store = hookStorage.getStore();
|
|
31447
|
+
if (!store) {
|
|
31448
|
+
throw new HookError("[Inquirer] Hook functions can only be called from within a prompt");
|
|
31449
|
+
}
|
|
31450
|
+
return store;
|
|
31451
|
+
}
|
|
31452
|
+
function readline() {
|
|
31453
|
+
return getStore().rl;
|
|
31454
|
+
}
|
|
31455
|
+
function withUpdates(fn) {
|
|
31456
|
+
const wrapped = (...args) => {
|
|
31457
|
+
const store = getStore();
|
|
31458
|
+
let shouldUpdate = false;
|
|
31459
|
+
const oldHandleChange = store.handleChange;
|
|
31460
|
+
store.handleChange = () => {
|
|
31461
|
+
shouldUpdate = true;
|
|
31462
|
+
};
|
|
31463
|
+
const returnValue = fn(...args);
|
|
31464
|
+
if (shouldUpdate) {
|
|
31465
|
+
oldHandleChange();
|
|
31466
|
+
}
|
|
31467
|
+
store.handleChange = oldHandleChange;
|
|
31468
|
+
return returnValue;
|
|
31469
|
+
};
|
|
31470
|
+
return AsyncResource.bind(wrapped);
|
|
31471
|
+
}
|
|
31472
|
+
function withPointer(cb) {
|
|
31473
|
+
const store = getStore();
|
|
31474
|
+
const { index } = store;
|
|
31475
|
+
const pointer = {
|
|
31476
|
+
get() {
|
|
31477
|
+
return store.hooks[index];
|
|
31478
|
+
},
|
|
31479
|
+
set(value) {
|
|
31480
|
+
store.hooks[index] = value;
|
|
31481
|
+
},
|
|
31482
|
+
initialized: index in store.hooks
|
|
31483
|
+
};
|
|
31484
|
+
const returnValue = cb(pointer);
|
|
31485
|
+
store.index++;
|
|
31486
|
+
return returnValue;
|
|
31487
|
+
}
|
|
31488
|
+
function handleChange() {
|
|
31489
|
+
getStore().handleChange();
|
|
31490
|
+
}
|
|
31491
|
+
var hookStorage, effectScheduler;
|
|
31492
|
+
var init_hook_engine = __esm(() => {
|
|
31493
|
+
init_errors5();
|
|
31494
|
+
hookStorage = new AsyncLocalStorage;
|
|
31495
|
+
effectScheduler = {
|
|
31496
|
+
queue(cb) {
|
|
31497
|
+
const store = getStore();
|
|
31498
|
+
const { index } = store;
|
|
31499
|
+
store.hooksEffect.push(() => {
|
|
31500
|
+
store.hooksCleanup[index]?.();
|
|
31501
|
+
const cleanFn = cb(readline());
|
|
31502
|
+
if (cleanFn != null && typeof cleanFn !== "function") {
|
|
31503
|
+
throw new ValidationError("useEffect return value must be a cleanup function or nothing.");
|
|
31504
|
+
}
|
|
31505
|
+
store.hooksCleanup[index] = cleanFn;
|
|
31506
|
+
});
|
|
31507
|
+
},
|
|
31508
|
+
run() {
|
|
31509
|
+
const store = getStore();
|
|
31510
|
+
withUpdates(() => {
|
|
31511
|
+
store.hooksEffect.forEach((effect) => {
|
|
31512
|
+
effect();
|
|
31513
|
+
});
|
|
31514
|
+
store.hooksEffect.length = 0;
|
|
31515
|
+
})();
|
|
31516
|
+
},
|
|
31517
|
+
clearAll() {
|
|
31518
|
+
const store = getStore();
|
|
31519
|
+
store.hooksCleanup.forEach((cleanFn) => {
|
|
31520
|
+
cleanFn?.();
|
|
31521
|
+
});
|
|
31522
|
+
store.hooksEffect.length = 0;
|
|
31523
|
+
store.hooksCleanup.length = 0;
|
|
31524
|
+
}
|
|
31525
|
+
};
|
|
31526
|
+
});
|
|
31527
|
+
|
|
31528
|
+
// node_modules/@inquirer/core/dist/lib/use-state.js
|
|
31529
|
+
import { AsyncResource as AsyncResource2 } from "node:async_hooks";
|
|
31530
|
+
function useState(defaultValue) {
|
|
31531
|
+
return withPointer((pointer) => {
|
|
31532
|
+
const setState = AsyncResource2.bind(function setState(newValue) {
|
|
31533
|
+
if (pointer.get() !== newValue) {
|
|
31534
|
+
pointer.set(newValue);
|
|
31535
|
+
handleChange();
|
|
31536
|
+
}
|
|
31537
|
+
});
|
|
31538
|
+
if (pointer.initialized) {
|
|
31539
|
+
return [pointer.get(), setState];
|
|
31540
|
+
}
|
|
31541
|
+
const value = typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
|
31542
|
+
pointer.set(value);
|
|
31543
|
+
return [value, setState];
|
|
31544
|
+
});
|
|
31545
|
+
}
|
|
31546
|
+
var init_use_state = __esm(() => {
|
|
31547
|
+
init_hook_engine();
|
|
31548
|
+
});
|
|
31549
|
+
|
|
31550
|
+
// node_modules/@inquirer/core/dist/lib/use-effect.js
|
|
31551
|
+
function useEffect(cb, depArray) {
|
|
31552
|
+
withPointer((pointer) => {
|
|
31553
|
+
const oldDeps = pointer.get();
|
|
31554
|
+
const hasChanged = !Array.isArray(oldDeps) || depArray.some((dep, i) => !Object.is(dep, oldDeps[i]));
|
|
31555
|
+
if (hasChanged) {
|
|
31556
|
+
effectScheduler.queue(cb);
|
|
31557
|
+
}
|
|
31558
|
+
pointer.set(depArray);
|
|
31559
|
+
});
|
|
31560
|
+
}
|
|
31561
|
+
var init_use_effect = __esm(() => {
|
|
31562
|
+
init_hook_engine();
|
|
31563
|
+
});
|
|
31564
|
+
|
|
31565
|
+
// node_modules/@inquirer/figures/dist/index.js
|
|
31566
|
+
import process3 from "node:process";
|
|
31567
|
+
function isUnicodeSupported() {
|
|
31568
|
+
if (process3.platform !== "win32") {
|
|
31569
|
+
return process3.env["TERM"] !== "linux";
|
|
31570
|
+
}
|
|
31571
|
+
return Boolean(process3.env["WT_SESSION"]) || Boolean(process3.env["TERMINUS_SUBLIME"]) || process3.env["ConEmuTask"] === "{cmd::Cmder}" || process3.env["TERM_PROGRAM"] === "Terminus-Sublime" || process3.env["TERM_PROGRAM"] === "vscode" || process3.env["TERM"] === "xterm-256color" || process3.env["TERM"] === "alacritty" || process3.env["TERMINAL_EMULATOR"] === "JetBrains-JediTerm";
|
|
31572
|
+
}
|
|
31573
|
+
var common, specialMainSymbols, specialFallbackSymbols, mainSymbols, fallbackSymbols, shouldUseMain, figures, dist_default, replacements;
|
|
31574
|
+
var init_dist = __esm(() => {
|
|
31575
|
+
common = {
|
|
31576
|
+
circleQuestionMark: "(?)",
|
|
31577
|
+
questionMarkPrefix: "(?)",
|
|
31578
|
+
square: "█",
|
|
31579
|
+
squareDarkShade: "▓",
|
|
31580
|
+
squareMediumShade: "▒",
|
|
31581
|
+
squareLightShade: "░",
|
|
31582
|
+
squareTop: "▀",
|
|
31583
|
+
squareBottom: "▄",
|
|
31584
|
+
squareLeft: "▌",
|
|
31585
|
+
squareRight: "▐",
|
|
31586
|
+
squareCenter: "■",
|
|
31587
|
+
bullet: "●",
|
|
31588
|
+
dot: "․",
|
|
31589
|
+
ellipsis: "…",
|
|
31590
|
+
pointerSmall: "›",
|
|
31591
|
+
triangleUp: "▲",
|
|
31592
|
+
triangleUpSmall: "▴",
|
|
31593
|
+
triangleDown: "▼",
|
|
31594
|
+
triangleDownSmall: "▾",
|
|
31595
|
+
triangleLeftSmall: "◂",
|
|
31596
|
+
triangleRightSmall: "▸",
|
|
31597
|
+
home: "⌂",
|
|
31598
|
+
heart: "♥",
|
|
31599
|
+
musicNote: "♪",
|
|
31600
|
+
musicNoteBeamed: "♫",
|
|
31601
|
+
arrowUp: "↑",
|
|
31602
|
+
arrowDown: "↓",
|
|
31603
|
+
arrowLeft: "←",
|
|
31604
|
+
arrowRight: "→",
|
|
31605
|
+
arrowLeftRight: "↔",
|
|
31606
|
+
arrowUpDown: "↕",
|
|
31607
|
+
almostEqual: "≈",
|
|
31608
|
+
notEqual: "≠",
|
|
31609
|
+
lessOrEqual: "≤",
|
|
31610
|
+
greaterOrEqual: "≥",
|
|
31611
|
+
identical: "≡",
|
|
31612
|
+
infinity: "∞",
|
|
31613
|
+
subscriptZero: "₀",
|
|
31614
|
+
subscriptOne: "₁",
|
|
31615
|
+
subscriptTwo: "₂",
|
|
31616
|
+
subscriptThree: "₃",
|
|
31617
|
+
subscriptFour: "₄",
|
|
31618
|
+
subscriptFive: "₅",
|
|
31619
|
+
subscriptSix: "₆",
|
|
31620
|
+
subscriptSeven: "₇",
|
|
31621
|
+
subscriptEight: "₈",
|
|
31622
|
+
subscriptNine: "₉",
|
|
31623
|
+
oneHalf: "½",
|
|
31624
|
+
oneThird: "⅓",
|
|
31625
|
+
oneQuarter: "¼",
|
|
31626
|
+
oneFifth: "⅕",
|
|
31627
|
+
oneSixth: "⅙",
|
|
31628
|
+
oneEighth: "⅛",
|
|
31629
|
+
twoThirds: "⅔",
|
|
31630
|
+
twoFifths: "⅖",
|
|
31631
|
+
threeQuarters: "¾",
|
|
31632
|
+
threeFifths: "⅗",
|
|
31633
|
+
threeEighths: "⅜",
|
|
31634
|
+
fourFifths: "⅘",
|
|
31635
|
+
fiveSixths: "⅚",
|
|
31636
|
+
fiveEighths: "⅝",
|
|
31637
|
+
sevenEighths: "⅞",
|
|
31638
|
+
line: "─",
|
|
31639
|
+
lineBold: "━",
|
|
31640
|
+
lineDouble: "═",
|
|
31641
|
+
lineDashed0: "┄",
|
|
31642
|
+
lineDashed1: "┅",
|
|
31643
|
+
lineDashed2: "┈",
|
|
31644
|
+
lineDashed3: "┉",
|
|
31645
|
+
lineDashed4: "╌",
|
|
31646
|
+
lineDashed5: "╍",
|
|
31647
|
+
lineDashed6: "╴",
|
|
31648
|
+
lineDashed7: "╶",
|
|
31649
|
+
lineDashed8: "╸",
|
|
31650
|
+
lineDashed9: "╺",
|
|
31651
|
+
lineDashed10: "╼",
|
|
31652
|
+
lineDashed11: "╾",
|
|
31653
|
+
lineDashed12: "−",
|
|
31654
|
+
lineDashed13: "–",
|
|
31655
|
+
lineDashed14: "‐",
|
|
31656
|
+
lineDashed15: "⁃",
|
|
31657
|
+
lineVertical: "│",
|
|
31658
|
+
lineVerticalBold: "┃",
|
|
31659
|
+
lineVerticalDouble: "║",
|
|
31660
|
+
lineVerticalDashed0: "┆",
|
|
31661
|
+
lineVerticalDashed1: "┇",
|
|
31662
|
+
lineVerticalDashed2: "┊",
|
|
31663
|
+
lineVerticalDashed3: "┋",
|
|
31664
|
+
lineVerticalDashed4: "╎",
|
|
31665
|
+
lineVerticalDashed5: "╏",
|
|
31666
|
+
lineVerticalDashed6: "╵",
|
|
31667
|
+
lineVerticalDashed7: "╷",
|
|
31668
|
+
lineVerticalDashed8: "╹",
|
|
31669
|
+
lineVerticalDashed9: "╻",
|
|
31670
|
+
lineVerticalDashed10: "╽",
|
|
31671
|
+
lineVerticalDashed11: "╿",
|
|
31672
|
+
lineDownLeft: "┐",
|
|
31673
|
+
lineDownLeftArc: "╮",
|
|
31674
|
+
lineDownBoldLeftBold: "┓",
|
|
31675
|
+
lineDownBoldLeft: "┒",
|
|
31676
|
+
lineDownLeftBold: "┑",
|
|
31677
|
+
lineDownDoubleLeftDouble: "╗",
|
|
31678
|
+
lineDownDoubleLeft: "╖",
|
|
31679
|
+
lineDownLeftDouble: "╕",
|
|
31680
|
+
lineDownRight: "┌",
|
|
31681
|
+
lineDownRightArc: "╭",
|
|
31682
|
+
lineDownBoldRightBold: "┏",
|
|
31683
|
+
lineDownBoldRight: "┎",
|
|
31684
|
+
lineDownRightBold: "┍",
|
|
31685
|
+
lineDownDoubleRightDouble: "╔",
|
|
31686
|
+
lineDownDoubleRight: "╓",
|
|
31687
|
+
lineDownRightDouble: "╒",
|
|
31688
|
+
lineUpLeft: "┘",
|
|
31689
|
+
lineUpLeftArc: "╯",
|
|
31690
|
+
lineUpBoldLeftBold: "┛",
|
|
31691
|
+
lineUpBoldLeft: "┚",
|
|
31692
|
+
lineUpLeftBold: "┙",
|
|
31693
|
+
lineUpDoubleLeftDouble: "╝",
|
|
31694
|
+
lineUpDoubleLeft: "╜",
|
|
31695
|
+
lineUpLeftDouble: "╛",
|
|
31696
|
+
lineUpRight: "└",
|
|
31697
|
+
lineUpRightArc: "╰",
|
|
31698
|
+
lineUpBoldRightBold: "┗",
|
|
31699
|
+
lineUpBoldRight: "┖",
|
|
31700
|
+
lineUpRightBold: "┕",
|
|
31701
|
+
lineUpDoubleRightDouble: "╚",
|
|
31702
|
+
lineUpDoubleRight: "╙",
|
|
31703
|
+
lineUpRightDouble: "╘",
|
|
31704
|
+
lineUpDownLeft: "┤",
|
|
31705
|
+
lineUpBoldDownBoldLeftBold: "┫",
|
|
31706
|
+
lineUpBoldDownBoldLeft: "┨",
|
|
31707
|
+
lineUpDownLeftBold: "┥",
|
|
31708
|
+
lineUpBoldDownLeftBold: "┩",
|
|
31709
|
+
lineUpDownBoldLeftBold: "┪",
|
|
31710
|
+
lineUpDownBoldLeft: "┧",
|
|
31711
|
+
lineUpBoldDownLeft: "┦",
|
|
31712
|
+
lineUpDoubleDownDoubleLeftDouble: "╣",
|
|
31713
|
+
lineUpDoubleDownDoubleLeft: "╢",
|
|
31714
|
+
lineUpDownLeftDouble: "╡",
|
|
31715
|
+
lineUpDownRight: "├",
|
|
31716
|
+
lineUpBoldDownBoldRightBold: "┣",
|
|
31717
|
+
lineUpBoldDownBoldRight: "┠",
|
|
31718
|
+
lineUpDownRightBold: "┝",
|
|
31719
|
+
lineUpBoldDownRightBold: "┡",
|
|
31720
|
+
lineUpDownBoldRightBold: "┢",
|
|
31721
|
+
lineUpDownBoldRight: "┟",
|
|
31722
|
+
lineUpBoldDownRight: "┞",
|
|
31723
|
+
lineUpDoubleDownDoubleRightDouble: "╠",
|
|
31724
|
+
lineUpDoubleDownDoubleRight: "╟",
|
|
31725
|
+
lineUpDownRightDouble: "╞",
|
|
31726
|
+
lineDownLeftRight: "┬",
|
|
31727
|
+
lineDownBoldLeftBoldRightBold: "┳",
|
|
31728
|
+
lineDownLeftBoldRightBold: "┯",
|
|
31729
|
+
lineDownBoldLeftRight: "┰",
|
|
31730
|
+
lineDownBoldLeftBoldRight: "┱",
|
|
31731
|
+
lineDownBoldLeftRightBold: "┲",
|
|
31732
|
+
lineDownLeftRightBold: "┮",
|
|
31733
|
+
lineDownLeftBoldRight: "┭",
|
|
31734
|
+
lineDownDoubleLeftDoubleRightDouble: "╦",
|
|
31735
|
+
lineDownDoubleLeftRight: "╥",
|
|
31736
|
+
lineDownLeftDoubleRightDouble: "╤",
|
|
31737
|
+
lineUpLeftRight: "┴",
|
|
31738
|
+
lineUpBoldLeftBoldRightBold: "┻",
|
|
31739
|
+
lineUpLeftBoldRightBold: "┷",
|
|
31740
|
+
lineUpBoldLeftRight: "┸",
|
|
31741
|
+
lineUpBoldLeftBoldRight: "┹",
|
|
31742
|
+
lineUpBoldLeftRightBold: "┺",
|
|
31743
|
+
lineUpLeftRightBold: "┶",
|
|
31744
|
+
lineUpLeftBoldRight: "┵",
|
|
31745
|
+
lineUpDoubleLeftDoubleRightDouble: "╩",
|
|
31746
|
+
lineUpDoubleLeftRight: "╨",
|
|
31747
|
+
lineUpLeftDoubleRightDouble: "╧",
|
|
31748
|
+
lineUpDownLeftRight: "┼",
|
|
31749
|
+
lineUpBoldDownBoldLeftBoldRightBold: "╋",
|
|
31750
|
+
lineUpDownBoldLeftBoldRightBold: "╈",
|
|
31751
|
+
lineUpBoldDownLeftBoldRightBold: "╇",
|
|
31752
|
+
lineUpBoldDownBoldLeftRightBold: "╊",
|
|
31753
|
+
lineUpBoldDownBoldLeftBoldRight: "╉",
|
|
31754
|
+
lineUpBoldDownLeftRight: "╀",
|
|
31755
|
+
lineUpDownBoldLeftRight: "╁",
|
|
31756
|
+
lineUpDownLeftBoldRight: "┽",
|
|
31757
|
+
lineUpDownLeftRightBold: "┾",
|
|
31758
|
+
lineUpBoldDownBoldLeftRight: "╂",
|
|
31759
|
+
lineUpDownLeftBoldRightBold: "┿",
|
|
31760
|
+
lineUpBoldDownLeftBoldRight: "╃",
|
|
31761
|
+
lineUpBoldDownLeftRightBold: "╄",
|
|
31762
|
+
lineUpDownBoldLeftBoldRight: "╅",
|
|
31763
|
+
lineUpDownBoldLeftRightBold: "╆",
|
|
31764
|
+
lineUpDoubleDownDoubleLeftDoubleRightDouble: "╬",
|
|
31765
|
+
lineUpDoubleDownDoubleLeftRight: "╫",
|
|
31766
|
+
lineUpDownLeftDoubleRightDouble: "╪",
|
|
31767
|
+
lineCross: "╳",
|
|
31768
|
+
lineBackslash: "╲",
|
|
31769
|
+
lineSlash: "╱"
|
|
31770
|
+
};
|
|
31771
|
+
specialMainSymbols = {
|
|
31772
|
+
tick: "✔",
|
|
31773
|
+
info: "ℹ",
|
|
31774
|
+
warning: "⚠",
|
|
31775
|
+
cross: "✘",
|
|
31776
|
+
squareSmall: "◻",
|
|
31777
|
+
squareSmallFilled: "◼",
|
|
31778
|
+
circle: "◯",
|
|
31779
|
+
circleFilled: "◉",
|
|
31780
|
+
circleDotted: "◌",
|
|
31781
|
+
circleDouble: "◎",
|
|
31782
|
+
circleCircle: "ⓞ",
|
|
31783
|
+
circleCross: "ⓧ",
|
|
31784
|
+
circlePipe: "Ⓘ",
|
|
31785
|
+
radioOn: "◉",
|
|
31786
|
+
radioOff: "◯",
|
|
31787
|
+
checkboxOn: "☒",
|
|
31788
|
+
checkboxOff: "☐",
|
|
31789
|
+
checkboxCircleOn: "ⓧ",
|
|
31790
|
+
checkboxCircleOff: "Ⓘ",
|
|
31791
|
+
pointer: "❯",
|
|
31792
|
+
triangleUpOutline: "△",
|
|
31793
|
+
triangleLeft: "◀",
|
|
31794
|
+
triangleRight: "▶",
|
|
31795
|
+
lozenge: "◆",
|
|
31796
|
+
lozengeOutline: "◇",
|
|
31797
|
+
hamburger: "☰",
|
|
31798
|
+
smiley: "㋡",
|
|
31799
|
+
mustache: "෴",
|
|
31800
|
+
star: "★",
|
|
31801
|
+
play: "▶",
|
|
31802
|
+
nodejs: "⬢",
|
|
31803
|
+
oneSeventh: "⅐",
|
|
31804
|
+
oneNinth: "⅑",
|
|
31805
|
+
oneTenth: "⅒"
|
|
31806
|
+
};
|
|
31807
|
+
specialFallbackSymbols = {
|
|
31808
|
+
tick: "√",
|
|
31809
|
+
info: "i",
|
|
31810
|
+
warning: "‼",
|
|
31811
|
+
cross: "×",
|
|
31812
|
+
squareSmall: "□",
|
|
31813
|
+
squareSmallFilled: "■",
|
|
31814
|
+
circle: "( )",
|
|
31815
|
+
circleFilled: "(*)",
|
|
31816
|
+
circleDotted: "( )",
|
|
31817
|
+
circleDouble: "( )",
|
|
31818
|
+
circleCircle: "(○)",
|
|
31819
|
+
circleCross: "(×)",
|
|
31820
|
+
circlePipe: "(│)",
|
|
31821
|
+
radioOn: "(*)",
|
|
31822
|
+
radioOff: "( )",
|
|
31823
|
+
checkboxOn: "[×]",
|
|
31824
|
+
checkboxOff: "[ ]",
|
|
31825
|
+
checkboxCircleOn: "(×)",
|
|
31826
|
+
checkboxCircleOff: "( )",
|
|
31827
|
+
pointer: ">",
|
|
31828
|
+
triangleUpOutline: "∆",
|
|
31829
|
+
triangleLeft: "◄",
|
|
31830
|
+
triangleRight: "►",
|
|
31831
|
+
lozenge: "♦",
|
|
31832
|
+
lozengeOutline: "◊",
|
|
31833
|
+
hamburger: "≡",
|
|
31834
|
+
smiley: "☺",
|
|
31835
|
+
mustache: "┌─┐",
|
|
31836
|
+
star: "✶",
|
|
31837
|
+
play: "►",
|
|
31838
|
+
nodejs: "♦",
|
|
31839
|
+
oneSeventh: "1/7",
|
|
31840
|
+
oneNinth: "1/9",
|
|
31841
|
+
oneTenth: "1/10"
|
|
31842
|
+
};
|
|
31843
|
+
mainSymbols = {
|
|
31844
|
+
...common,
|
|
31845
|
+
...specialMainSymbols
|
|
31846
|
+
};
|
|
31847
|
+
fallbackSymbols = {
|
|
31848
|
+
...common,
|
|
31849
|
+
...specialFallbackSymbols
|
|
31850
|
+
};
|
|
31851
|
+
shouldUseMain = isUnicodeSupported();
|
|
31852
|
+
figures = shouldUseMain ? mainSymbols : fallbackSymbols;
|
|
31853
|
+
dist_default = figures;
|
|
31854
|
+
replacements = Object.entries(specialMainSymbols);
|
|
31855
|
+
});
|
|
31856
|
+
|
|
31857
|
+
// node_modules/@inquirer/core/dist/lib/theme.js
|
|
31858
|
+
import { styleText } from "node:util";
|
|
31859
|
+
var defaultTheme;
|
|
31860
|
+
var init_theme = __esm(() => {
|
|
31861
|
+
init_dist();
|
|
31862
|
+
defaultTheme = {
|
|
31863
|
+
prefix: {
|
|
31864
|
+
idle: styleText("blue", "?"),
|
|
31865
|
+
done: styleText("green", dist_default.tick)
|
|
31866
|
+
},
|
|
31867
|
+
spinner: {
|
|
31868
|
+
interval: 80,
|
|
31869
|
+
frames: ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"].map((frame) => styleText("yellow", frame))
|
|
31870
|
+
},
|
|
31871
|
+
style: {
|
|
31872
|
+
answer: (text) => styleText("cyan", text),
|
|
31873
|
+
message: (text) => styleText("bold", text),
|
|
31874
|
+
error: (text) => styleText("red", `> ${text}`),
|
|
31875
|
+
defaultAnswer: (text) => styleText("dim", `(${text})`),
|
|
31876
|
+
help: (text) => styleText("dim", text),
|
|
31877
|
+
highlight: (text) => styleText("cyan", text),
|
|
31878
|
+
key: (text) => styleText("cyan", styleText("bold", `<${text}>`))
|
|
31879
|
+
}
|
|
31880
|
+
};
|
|
31881
|
+
});
|
|
31882
|
+
|
|
31883
|
+
// node_modules/@inquirer/core/dist/lib/make-theme.js
|
|
31884
|
+
function isPlainObject3(value) {
|
|
31885
|
+
if (typeof value !== "object" || value === null)
|
|
31886
|
+
return false;
|
|
31887
|
+
let proto = value;
|
|
31888
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
31889
|
+
proto = Object.getPrototypeOf(proto);
|
|
31890
|
+
}
|
|
31891
|
+
return Object.getPrototypeOf(value) === proto;
|
|
31892
|
+
}
|
|
31893
|
+
function deepMerge(...objects) {
|
|
31894
|
+
const output = {};
|
|
31895
|
+
for (const obj of objects) {
|
|
31896
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
31897
|
+
const prevValue = output[key];
|
|
31898
|
+
output[key] = isPlainObject3(prevValue) && isPlainObject3(value) ? deepMerge(prevValue, value) : value;
|
|
31899
|
+
}
|
|
31900
|
+
}
|
|
31901
|
+
return output;
|
|
31902
|
+
}
|
|
31903
|
+
function makeTheme(...themes) {
|
|
31904
|
+
const themesToMerge = [
|
|
31905
|
+
defaultTheme,
|
|
31906
|
+
...themes.filter((theme) => theme != null)
|
|
31907
|
+
];
|
|
31908
|
+
return deepMerge(...themesToMerge);
|
|
31909
|
+
}
|
|
31910
|
+
var init_make_theme = __esm(() => {
|
|
31911
|
+
init_theme();
|
|
31912
|
+
});
|
|
31913
|
+
|
|
31914
|
+
// node_modules/@inquirer/core/dist/lib/use-prefix.js
|
|
31915
|
+
function usePrefix({ status = "idle", theme }) {
|
|
31916
|
+
const [showLoader, setShowLoader] = useState(false);
|
|
31917
|
+
const [tick, setTick] = useState(0);
|
|
31918
|
+
const { prefix, spinner } = makeTheme(theme);
|
|
31919
|
+
useEffect(() => {
|
|
31920
|
+
if (status === "loading") {
|
|
31921
|
+
let tickInterval;
|
|
31922
|
+
let inc = -1;
|
|
31923
|
+
const delayTimeout = setTimeout(() => {
|
|
31924
|
+
setShowLoader(true);
|
|
31925
|
+
tickInterval = setInterval(() => {
|
|
31926
|
+
inc = inc + 1;
|
|
31927
|
+
setTick(inc % spinner.frames.length);
|
|
31928
|
+
}, spinner.interval);
|
|
31929
|
+
}, 300);
|
|
31930
|
+
return () => {
|
|
31931
|
+
clearTimeout(delayTimeout);
|
|
31932
|
+
clearInterval(tickInterval);
|
|
31933
|
+
};
|
|
31934
|
+
} else {
|
|
31935
|
+
setShowLoader(false);
|
|
31936
|
+
}
|
|
31937
|
+
}, [status]);
|
|
31938
|
+
if (showLoader) {
|
|
31939
|
+
return spinner.frames[tick];
|
|
31940
|
+
}
|
|
31941
|
+
const iconName = status === "loading" ? "idle" : status;
|
|
31942
|
+
return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
|
|
31943
|
+
}
|
|
31944
|
+
var init_use_prefix = __esm(() => {
|
|
31945
|
+
init_use_state();
|
|
31946
|
+
init_use_effect();
|
|
31947
|
+
init_make_theme();
|
|
31948
|
+
});
|
|
31949
|
+
|
|
31950
|
+
// node_modules/@inquirer/core/dist/lib/use-memo.js
|
|
31951
|
+
function useMemo(fn, dependencies) {
|
|
31952
|
+
return withPointer((pointer) => {
|
|
31953
|
+
const prev = pointer.get();
|
|
31954
|
+
if (!prev || prev.dependencies.length !== dependencies.length || prev.dependencies.some((dep, i) => dep !== dependencies[i])) {
|
|
31955
|
+
const value = fn();
|
|
31956
|
+
pointer.set({ value, dependencies });
|
|
31957
|
+
return value;
|
|
31958
|
+
}
|
|
31959
|
+
return prev.value;
|
|
31960
|
+
});
|
|
31961
|
+
}
|
|
31962
|
+
var init_use_memo = __esm(() => {
|
|
31963
|
+
init_hook_engine();
|
|
31964
|
+
});
|
|
31965
|
+
|
|
31966
|
+
// node_modules/@inquirer/core/dist/lib/use-ref.js
|
|
31967
|
+
function useRef(val) {
|
|
31968
|
+
return useState({ current: val })[0];
|
|
31969
|
+
}
|
|
31970
|
+
var init_use_ref = __esm(() => {
|
|
31971
|
+
init_use_state();
|
|
31972
|
+
});
|
|
31973
|
+
|
|
31974
|
+
// node_modules/@inquirer/core/dist/lib/use-keypress.js
|
|
31975
|
+
function useKeypress(userHandler) {
|
|
31976
|
+
const signal = useRef(userHandler);
|
|
31977
|
+
signal.current = userHandler;
|
|
31978
|
+
useEffect((rl) => {
|
|
31979
|
+
let ignore = false;
|
|
31980
|
+
const handler = withUpdates((_input, event) => {
|
|
31981
|
+
if (ignore)
|
|
31982
|
+
return;
|
|
31983
|
+
signal.current(event, rl);
|
|
31984
|
+
});
|
|
31985
|
+
rl.input.on("keypress", handler);
|
|
31986
|
+
return () => {
|
|
31987
|
+
ignore = true;
|
|
31988
|
+
rl.input.removeListener("keypress", handler);
|
|
31989
|
+
};
|
|
31990
|
+
}, []);
|
|
31991
|
+
}
|
|
31992
|
+
var init_use_keypress = __esm(() => {
|
|
31993
|
+
init_use_ref();
|
|
31994
|
+
init_use_effect();
|
|
31995
|
+
init_hook_engine();
|
|
31996
|
+
});
|
|
31997
|
+
|
|
31998
|
+
// node_modules/cli-width/index.js
|
|
31999
|
+
var require_cli_width = __commonJS((exports, module) => {
|
|
32000
|
+
module.exports = cliWidth;
|
|
32001
|
+
function normalizeOpts(options) {
|
|
32002
|
+
const defaultOpts = {
|
|
32003
|
+
defaultWidth: 0,
|
|
32004
|
+
output: process.stdout,
|
|
32005
|
+
tty: __require("tty")
|
|
32006
|
+
};
|
|
32007
|
+
if (!options) {
|
|
32008
|
+
return defaultOpts;
|
|
32009
|
+
}
|
|
32010
|
+
Object.keys(defaultOpts).forEach(function(key) {
|
|
32011
|
+
if (!options[key]) {
|
|
32012
|
+
options[key] = defaultOpts[key];
|
|
32013
|
+
}
|
|
32014
|
+
});
|
|
32015
|
+
return options;
|
|
32016
|
+
}
|
|
32017
|
+
function cliWidth(options) {
|
|
32018
|
+
const opts = normalizeOpts(options);
|
|
32019
|
+
if (opts.output.getWindowSize) {
|
|
32020
|
+
return opts.output.getWindowSize()[0] || opts.defaultWidth;
|
|
32021
|
+
}
|
|
32022
|
+
if (opts.tty.getWindowSize) {
|
|
32023
|
+
return opts.tty.getWindowSize()[1] || opts.defaultWidth;
|
|
32024
|
+
}
|
|
32025
|
+
if (opts.output.columns) {
|
|
32026
|
+
return opts.output.columns;
|
|
32027
|
+
}
|
|
32028
|
+
if (process.env.CLI_WIDTH) {
|
|
32029
|
+
const width = parseInt(process.env.CLI_WIDTH, 10);
|
|
32030
|
+
if (!isNaN(width) && width !== 0) {
|
|
32031
|
+
return width;
|
|
32032
|
+
}
|
|
32033
|
+
}
|
|
32034
|
+
return opts.defaultWidth;
|
|
32035
|
+
}
|
|
32036
|
+
});
|
|
32037
|
+
|
|
32038
|
+
// node_modules/ansi-regex/index.js
|
|
32039
|
+
function ansiRegex({ onlyFirst = false } = {}) {
|
|
32040
|
+
const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
|
|
32041
|
+
const osc = `(?:\\u001B\\][\\s\\S]*?${ST})`;
|
|
32042
|
+
const csi = "[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";
|
|
32043
|
+
const pattern = `${osc}|${csi}`;
|
|
32044
|
+
return new RegExp(pattern, onlyFirst ? undefined : "g");
|
|
32045
|
+
}
|
|
32046
|
+
|
|
32047
|
+
// node_modules/strip-ansi/index.js
|
|
32048
|
+
function stripAnsi(string5) {
|
|
32049
|
+
if (typeof string5 !== "string") {
|
|
32050
|
+
throw new TypeError(`Expected a \`string\`, got \`${typeof string5}\``);
|
|
32051
|
+
}
|
|
32052
|
+
return string5.replace(regex, "");
|
|
32053
|
+
}
|
|
32054
|
+
var regex;
|
|
32055
|
+
var init_strip_ansi = __esm(() => {
|
|
32056
|
+
regex = ansiRegex();
|
|
32057
|
+
});
|
|
32058
|
+
|
|
32059
|
+
// node_modules/get-east-asian-width/lookup.js
|
|
32060
|
+
function isAmbiguous(x) {
|
|
32061
|
+
return x === 161 || x === 164 || x === 167 || x === 168 || x === 170 || x === 173 || x === 174 || x >= 176 && x <= 180 || x >= 182 && x <= 186 || x >= 188 && x <= 191 || x === 198 || x === 208 || x === 215 || x === 216 || x >= 222 && x <= 225 || x === 230 || x >= 232 && x <= 234 || x === 236 || x === 237 || x === 240 || x === 242 || x === 243 || x >= 247 && x <= 250 || x === 252 || x === 254 || x === 257 || x === 273 || x === 275 || x === 283 || x === 294 || x === 295 || x === 299 || x >= 305 && x <= 307 || x === 312 || x >= 319 && x <= 322 || x === 324 || x >= 328 && x <= 331 || x === 333 || x === 338 || x === 339 || x === 358 || x === 359 || x === 363 || x === 462 || x === 464 || x === 466 || x === 468 || x === 470 || x === 472 || x === 474 || x === 476 || x === 593 || x === 609 || x === 708 || x === 711 || x >= 713 && x <= 715 || x === 717 || x === 720 || x >= 728 && x <= 731 || x === 733 || x === 735 || x >= 768 && x <= 879 || x >= 913 && x <= 929 || x >= 931 && x <= 937 || x >= 945 && x <= 961 || x >= 963 && x <= 969 || x === 1025 || x >= 1040 && x <= 1103 || x === 1105 || x === 8208 || x >= 8211 && x <= 8214 || x === 8216 || x === 8217 || x === 8220 || x === 8221 || x >= 8224 && x <= 8226 || x >= 8228 && x <= 8231 || x === 8240 || x === 8242 || x === 8243 || x === 8245 || x === 8251 || x === 8254 || x === 8308 || x === 8319 || x >= 8321 && x <= 8324 || x === 8364 || x === 8451 || x === 8453 || x === 8457 || x === 8467 || x === 8470 || x === 8481 || x === 8482 || x === 8486 || x === 8491 || x === 8531 || x === 8532 || x >= 8539 && x <= 8542 || x >= 8544 && x <= 8555 || x >= 8560 && x <= 8569 || x === 8585 || x >= 8592 && x <= 8601 || x === 8632 || x === 8633 || x === 8658 || x === 8660 || x === 8679 || x === 8704 || x === 8706 || x === 8707 || x === 8711 || x === 8712 || x === 8715 || x === 8719 || x === 8721 || x === 8725 || x === 8730 || x >= 8733 && x <= 8736 || x === 8739 || x === 8741 || x >= 8743 && x <= 8748 || x === 8750 || x >= 8756 && x <= 8759 || x === 8764 || x === 8765 || x === 8776 || x === 8780 || x === 8786 || x === 8800 || x === 8801 || x >= 8804 && x <= 8807 || x === 8810 || x === 8811 || x === 8814 || x === 8815 || x === 8834 || x === 8835 || x === 8838 || x === 8839 || x === 8853 || x === 8857 || x === 8869 || x === 8895 || x === 8978 || x >= 9312 && x <= 9449 || x >= 9451 && x <= 9547 || x >= 9552 && x <= 9587 || x >= 9600 && x <= 9615 || x >= 9618 && x <= 9621 || x === 9632 || x === 9633 || x >= 9635 && x <= 9641 || x === 9650 || x === 9651 || x === 9654 || x === 9655 || x === 9660 || x === 9661 || x === 9664 || x === 9665 || x >= 9670 && x <= 9672 || x === 9675 || x >= 9678 && x <= 9681 || x >= 9698 && x <= 9701 || x === 9711 || x === 9733 || x === 9734 || x === 9737 || x === 9742 || x === 9743 || x === 9756 || x === 9758 || x === 9792 || x === 9794 || x === 9824 || x === 9825 || x >= 9827 && x <= 9829 || x >= 9831 && x <= 9834 || x === 9836 || x === 9837 || x === 9839 || x === 9886 || x === 9887 || x === 9919 || x >= 9926 && x <= 9933 || x >= 9935 && x <= 9939 || x >= 9941 && x <= 9953 || x === 9955 || x === 9960 || x === 9961 || x >= 9963 && x <= 9969 || x === 9972 || x >= 9974 && x <= 9977 || x === 9979 || x === 9980 || x === 9982 || x === 9983 || x === 10045 || x >= 10102 && x <= 10111 || x >= 11094 && x <= 11097 || x >= 12872 && x <= 12879 || x >= 57344 && x <= 63743 || x >= 65024 && x <= 65039 || x === 65533 || x >= 127232 && x <= 127242 || x >= 127248 && x <= 127277 || x >= 127280 && x <= 127337 || x >= 127344 && x <= 127373 || x === 127375 || x === 127376 || x >= 127387 && x <= 127404 || x >= 917760 && x <= 917999 || x >= 983040 && x <= 1048573 || x >= 1048576 && x <= 1114109;
|
|
32062
|
+
}
|
|
32063
|
+
function isFullWidth(x) {
|
|
32064
|
+
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
32065
|
+
}
|
|
32066
|
+
function isWide(x) {
|
|
32067
|
+
return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9776 && x <= 9783 || x >= 9800 && x <= 9811 || x === 9855 || x >= 9866 && x <= 9871 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12773 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x >= 94192 && x <= 94198 || x >= 94208 && x <= 101589 || x >= 101631 && x <= 101662 || x >= 101760 && x <= 101874 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x >= 119552 && x <= 119638 || x >= 119648 && x <= 119670 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128728 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129674 || x >= 129678 && x <= 129734 || x === 129736 || x >= 129741 && x <= 129756 || x >= 129759 && x <= 129770 || x >= 129775 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
32068
|
+
}
|
|
32069
|
+
var init_lookup = () => {};
|
|
32070
|
+
|
|
32071
|
+
// node_modules/get-east-asian-width/index.js
|
|
32072
|
+
function validate(codePoint) {
|
|
32073
|
+
if (!Number.isSafeInteger(codePoint)) {
|
|
32074
|
+
throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
|
32075
|
+
}
|
|
32076
|
+
}
|
|
32077
|
+
function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
|
|
32078
|
+
validate(codePoint);
|
|
32079
|
+
if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) {
|
|
32080
|
+
return 2;
|
|
32081
|
+
}
|
|
32082
|
+
return 1;
|
|
32083
|
+
}
|
|
32084
|
+
var init_get_east_asian_width = __esm(() => {
|
|
32085
|
+
init_lookup();
|
|
32086
|
+
});
|
|
32087
|
+
|
|
32088
|
+
// node_modules/emoji-regex/index.js
|
|
32089
|
+
var require_emoji_regex = __commonJS((exports, module) => {
|
|
32090
|
+
module.exports = () => {
|
|
32091
|
+
return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
|
|
32092
|
+
};
|
|
32093
|
+
});
|
|
32094
|
+
|
|
32095
|
+
// node_modules/string-width/index.js
|
|
32096
|
+
function stringWidth(string5, options = {}) {
|
|
32097
|
+
if (typeof string5 !== "string" || string5.length === 0) {
|
|
32098
|
+
return 0;
|
|
32099
|
+
}
|
|
32100
|
+
const {
|
|
32101
|
+
ambiguousIsNarrow = true,
|
|
32102
|
+
countAnsiEscapeCodes = false
|
|
32103
|
+
} = options;
|
|
32104
|
+
if (!countAnsiEscapeCodes) {
|
|
32105
|
+
string5 = stripAnsi(string5);
|
|
32106
|
+
}
|
|
32107
|
+
if (string5.length === 0) {
|
|
32108
|
+
return 0;
|
|
32109
|
+
}
|
|
32110
|
+
let width = 0;
|
|
32111
|
+
const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
|
|
32112
|
+
for (const { segment: character } of segmenter.segment(string5)) {
|
|
32113
|
+
const codePoint = character.codePointAt(0);
|
|
32114
|
+
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
|
|
32115
|
+
continue;
|
|
32116
|
+
}
|
|
32117
|
+
if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) {
|
|
32118
|
+
continue;
|
|
32119
|
+
}
|
|
32120
|
+
if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) {
|
|
32121
|
+
continue;
|
|
32122
|
+
}
|
|
32123
|
+
if (codePoint >= 55296 && codePoint <= 57343) {
|
|
32124
|
+
continue;
|
|
32125
|
+
}
|
|
32126
|
+
if (codePoint >= 65024 && codePoint <= 65039) {
|
|
32127
|
+
continue;
|
|
32128
|
+
}
|
|
32129
|
+
if (defaultIgnorableCodePointRegex.test(character)) {
|
|
32130
|
+
continue;
|
|
32131
|
+
}
|
|
32132
|
+
if (import_emoji_regex.default().test(character)) {
|
|
32133
|
+
width += 2;
|
|
32134
|
+
continue;
|
|
32135
|
+
}
|
|
32136
|
+
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
32137
|
+
}
|
|
32138
|
+
return width;
|
|
32139
|
+
}
|
|
32140
|
+
var import_emoji_regex, segmenter, defaultIgnorableCodePointRegex;
|
|
32141
|
+
var init_string_width = __esm(() => {
|
|
32142
|
+
init_strip_ansi();
|
|
32143
|
+
init_get_east_asian_width();
|
|
32144
|
+
import_emoji_regex = __toESM(require_emoji_regex(), 1);
|
|
32145
|
+
segmenter = new Intl.Segmenter;
|
|
32146
|
+
defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
|
|
32147
|
+
});
|
|
32148
|
+
|
|
32149
|
+
// node_modules/ansi-styles/index.js
|
|
32150
|
+
function assembleStyles() {
|
|
32151
|
+
const codes = new Map;
|
|
32152
|
+
for (const [groupName, group] of Object.entries(styles)) {
|
|
32153
|
+
for (const [styleName, style] of Object.entries(group)) {
|
|
32154
|
+
styles[styleName] = {
|
|
32155
|
+
open: `\x1B[${style[0]}m`,
|
|
32156
|
+
close: `\x1B[${style[1]}m`
|
|
32157
|
+
};
|
|
32158
|
+
group[styleName] = styles[styleName];
|
|
32159
|
+
codes.set(style[0], style[1]);
|
|
32160
|
+
}
|
|
32161
|
+
Object.defineProperty(styles, groupName, {
|
|
32162
|
+
value: group,
|
|
32163
|
+
enumerable: false
|
|
32164
|
+
});
|
|
32165
|
+
}
|
|
32166
|
+
Object.defineProperty(styles, "codes", {
|
|
32167
|
+
value: codes,
|
|
32168
|
+
enumerable: false
|
|
32169
|
+
});
|
|
32170
|
+
styles.color.close = "\x1B[39m";
|
|
32171
|
+
styles.bgColor.close = "\x1B[49m";
|
|
32172
|
+
styles.color.ansi = wrapAnsi16();
|
|
32173
|
+
styles.color.ansi256 = wrapAnsi256();
|
|
32174
|
+
styles.color.ansi16m = wrapAnsi16m();
|
|
32175
|
+
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
32176
|
+
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
32177
|
+
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
32178
|
+
Object.defineProperties(styles, {
|
|
32179
|
+
rgbToAnsi256: {
|
|
32180
|
+
value(red, green, blue) {
|
|
32181
|
+
if (red === green && green === blue) {
|
|
32182
|
+
if (red < 8) {
|
|
32183
|
+
return 16;
|
|
32184
|
+
}
|
|
32185
|
+
if (red > 248) {
|
|
32186
|
+
return 231;
|
|
32187
|
+
}
|
|
32188
|
+
return Math.round((red - 8) / 247 * 24) + 232;
|
|
32189
|
+
}
|
|
32190
|
+
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
32191
|
+
},
|
|
32192
|
+
enumerable: false
|
|
32193
|
+
},
|
|
32194
|
+
hexToRgb: {
|
|
32195
|
+
value(hex3) {
|
|
32196
|
+
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex3.toString(16));
|
|
32197
|
+
if (!matches) {
|
|
32198
|
+
return [0, 0, 0];
|
|
32199
|
+
}
|
|
32200
|
+
let [colorString] = matches;
|
|
32201
|
+
if (colorString.length === 3) {
|
|
32202
|
+
colorString = [...colorString].map((character) => character + character).join("");
|
|
32203
|
+
}
|
|
32204
|
+
const integer2 = Number.parseInt(colorString, 16);
|
|
32205
|
+
return [
|
|
32206
|
+
integer2 >> 16 & 255,
|
|
32207
|
+
integer2 >> 8 & 255,
|
|
32208
|
+
integer2 & 255
|
|
32209
|
+
];
|
|
32210
|
+
},
|
|
32211
|
+
enumerable: false
|
|
32212
|
+
},
|
|
32213
|
+
hexToAnsi256: {
|
|
32214
|
+
value: (hex3) => styles.rgbToAnsi256(...styles.hexToRgb(hex3)),
|
|
32215
|
+
enumerable: false
|
|
32216
|
+
},
|
|
32217
|
+
ansi256ToAnsi: {
|
|
32218
|
+
value(code) {
|
|
32219
|
+
if (code < 8) {
|
|
32220
|
+
return 30 + code;
|
|
32221
|
+
}
|
|
32222
|
+
if (code < 16) {
|
|
32223
|
+
return 90 + (code - 8);
|
|
32224
|
+
}
|
|
32225
|
+
let red;
|
|
32226
|
+
let green;
|
|
32227
|
+
let blue;
|
|
32228
|
+
if (code >= 232) {
|
|
32229
|
+
red = ((code - 232) * 10 + 8) / 255;
|
|
32230
|
+
green = red;
|
|
32231
|
+
blue = red;
|
|
32232
|
+
} else {
|
|
32233
|
+
code -= 16;
|
|
32234
|
+
const remainder = code % 36;
|
|
32235
|
+
red = Math.floor(code / 36) / 5;
|
|
32236
|
+
green = Math.floor(remainder / 6) / 5;
|
|
32237
|
+
blue = remainder % 6 / 5;
|
|
32238
|
+
}
|
|
32239
|
+
const value = Math.max(red, green, blue) * 2;
|
|
32240
|
+
if (value === 0) {
|
|
32241
|
+
return 30;
|
|
32242
|
+
}
|
|
32243
|
+
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
32244
|
+
if (value === 2) {
|
|
32245
|
+
result += 60;
|
|
32246
|
+
}
|
|
32247
|
+
return result;
|
|
32248
|
+
},
|
|
32249
|
+
enumerable: false
|
|
32250
|
+
},
|
|
32251
|
+
rgbToAnsi: {
|
|
32252
|
+
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
|
32253
|
+
enumerable: false
|
|
32254
|
+
},
|
|
32255
|
+
hexToAnsi: {
|
|
32256
|
+
value: (hex3) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex3)),
|
|
32257
|
+
enumerable: false
|
|
32258
|
+
}
|
|
32259
|
+
});
|
|
32260
|
+
return styles;
|
|
32261
|
+
}
|
|
32262
|
+
var 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, modifierNames, foregroundColorNames, backgroundColorNames, colorNames, ansiStyles, ansi_styles_default;
|
|
32263
|
+
var init_ansi_styles = __esm(() => {
|
|
32264
|
+
styles = {
|
|
32265
|
+
modifier: {
|
|
32266
|
+
reset: [0, 0],
|
|
32267
|
+
bold: [1, 22],
|
|
32268
|
+
dim: [2, 22],
|
|
32269
|
+
italic: [3, 23],
|
|
32270
|
+
underline: [4, 24],
|
|
32271
|
+
overline: [53, 55],
|
|
32272
|
+
inverse: [7, 27],
|
|
32273
|
+
hidden: [8, 28],
|
|
32274
|
+
strikethrough: [9, 29]
|
|
32275
|
+
},
|
|
32276
|
+
color: {
|
|
32277
|
+
black: [30, 39],
|
|
32278
|
+
red: [31, 39],
|
|
32279
|
+
green: [32, 39],
|
|
32280
|
+
yellow: [33, 39],
|
|
32281
|
+
blue: [34, 39],
|
|
32282
|
+
magenta: [35, 39],
|
|
32283
|
+
cyan: [36, 39],
|
|
32284
|
+
white: [37, 39],
|
|
32285
|
+
blackBright: [90, 39],
|
|
32286
|
+
gray: [90, 39],
|
|
32287
|
+
grey: [90, 39],
|
|
32288
|
+
redBright: [91, 39],
|
|
32289
|
+
greenBright: [92, 39],
|
|
32290
|
+
yellowBright: [93, 39],
|
|
32291
|
+
blueBright: [94, 39],
|
|
32292
|
+
magentaBright: [95, 39],
|
|
32293
|
+
cyanBright: [96, 39],
|
|
32294
|
+
whiteBright: [97, 39]
|
|
32295
|
+
},
|
|
32296
|
+
bgColor: {
|
|
32297
|
+
bgBlack: [40, 49],
|
|
32298
|
+
bgRed: [41, 49],
|
|
32299
|
+
bgGreen: [42, 49],
|
|
32300
|
+
bgYellow: [43, 49],
|
|
32301
|
+
bgBlue: [44, 49],
|
|
32302
|
+
bgMagenta: [45, 49],
|
|
32303
|
+
bgCyan: [46, 49],
|
|
32304
|
+
bgWhite: [47, 49],
|
|
32305
|
+
bgBlackBright: [100, 49],
|
|
32306
|
+
bgGray: [100, 49],
|
|
32307
|
+
bgGrey: [100, 49],
|
|
32308
|
+
bgRedBright: [101, 49],
|
|
32309
|
+
bgGreenBright: [102, 49],
|
|
32310
|
+
bgYellowBright: [103, 49],
|
|
32311
|
+
bgBlueBright: [104, 49],
|
|
32312
|
+
bgMagentaBright: [105, 49],
|
|
32313
|
+
bgCyanBright: [106, 49],
|
|
32314
|
+
bgWhiteBright: [107, 49]
|
|
32315
|
+
}
|
|
32316
|
+
};
|
|
32317
|
+
modifierNames = Object.keys(styles.modifier);
|
|
32318
|
+
foregroundColorNames = Object.keys(styles.color);
|
|
32319
|
+
backgroundColorNames = Object.keys(styles.bgColor);
|
|
32320
|
+
colorNames = [...foregroundColorNames, ...backgroundColorNames];
|
|
32321
|
+
ansiStyles = assembleStyles();
|
|
32322
|
+
ansi_styles_default = ansiStyles;
|
|
32323
|
+
});
|
|
32324
|
+
|
|
32325
|
+
// node_modules/wrap-ansi/index.js
|
|
32326
|
+
function wrapAnsi(string5, columns, options) {
|
|
32327
|
+
return String(string5).normalize().replaceAll(`\r
|
|
32328
|
+
`, `
|
|
32329
|
+
`).split(`
|
|
32330
|
+
`).map((line) => exec(line, columns, options)).join(`
|
|
32331
|
+
`);
|
|
32332
|
+
}
|
|
32333
|
+
var ESCAPES, END_CODE = 39, ANSI_ESCAPE_BELL = "\x07", ANSI_CSI = "[", ANSI_OSC = "]", ANSI_SGR_TERMINATOR = "m", ANSI_ESCAPE_LINK, wrapAnsiCode = (code) => `${ESCAPES.values().next().value}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`, wrapAnsiHyperlink = (url2) => `${ESCAPES.values().next().value}${ANSI_ESCAPE_LINK}${url2}${ANSI_ESCAPE_BELL}`, wordLengths = (string5) => string5.split(" ").map((character) => stringWidth(character)), wrapWord = (rows, word, columns) => {
|
|
32334
|
+
const characters = [...word];
|
|
32335
|
+
let isInsideEscape = false;
|
|
32336
|
+
let isInsideLinkEscape = false;
|
|
32337
|
+
let visible = stringWidth(stripAnsi(rows.at(-1)));
|
|
32338
|
+
for (const [index, character] of characters.entries()) {
|
|
32339
|
+
const characterLength = stringWidth(character);
|
|
32340
|
+
if (visible + characterLength <= columns) {
|
|
32341
|
+
rows[rows.length - 1] += character;
|
|
32342
|
+
} else {
|
|
32343
|
+
rows.push(character);
|
|
32344
|
+
visible = 0;
|
|
32345
|
+
}
|
|
32346
|
+
if (ESCAPES.has(character)) {
|
|
32347
|
+
isInsideEscape = true;
|
|
32348
|
+
const ansiEscapeLinkCandidate = characters.slice(index + 1, index + 1 + ANSI_ESCAPE_LINK.length).join("");
|
|
32349
|
+
isInsideLinkEscape = ansiEscapeLinkCandidate === ANSI_ESCAPE_LINK;
|
|
32350
|
+
}
|
|
32351
|
+
if (isInsideEscape) {
|
|
32352
|
+
if (isInsideLinkEscape) {
|
|
32353
|
+
if (character === ANSI_ESCAPE_BELL) {
|
|
32354
|
+
isInsideEscape = false;
|
|
32355
|
+
isInsideLinkEscape = false;
|
|
32356
|
+
}
|
|
32357
|
+
} else if (character === ANSI_SGR_TERMINATOR) {
|
|
32358
|
+
isInsideEscape = false;
|
|
32359
|
+
}
|
|
32360
|
+
continue;
|
|
32361
|
+
}
|
|
32362
|
+
visible += characterLength;
|
|
32363
|
+
if (visible === columns && index < characters.length - 1) {
|
|
32364
|
+
rows.push("");
|
|
32365
|
+
visible = 0;
|
|
32366
|
+
}
|
|
32367
|
+
}
|
|
32368
|
+
if (!visible && rows.at(-1).length > 0 && rows.length > 1) {
|
|
32369
|
+
rows[rows.length - 2] += rows.pop();
|
|
32370
|
+
}
|
|
32371
|
+
}, stringVisibleTrimSpacesRight = (string5) => {
|
|
32372
|
+
const words = string5.split(" ");
|
|
32373
|
+
let last = words.length;
|
|
32374
|
+
while (last > 0) {
|
|
32375
|
+
if (stringWidth(words[last - 1]) > 0) {
|
|
32376
|
+
break;
|
|
32377
|
+
}
|
|
32378
|
+
last--;
|
|
32379
|
+
}
|
|
32380
|
+
if (last === words.length) {
|
|
32381
|
+
return string5;
|
|
32382
|
+
}
|
|
32383
|
+
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
32384
|
+
}, exec = (string5, columns, options = {}) => {
|
|
32385
|
+
if (options.trim !== false && string5.trim() === "") {
|
|
32386
|
+
return "";
|
|
32387
|
+
}
|
|
32388
|
+
let returnValue = "";
|
|
32389
|
+
let escapeCode;
|
|
32390
|
+
let escapeUrl;
|
|
32391
|
+
const lengths = wordLengths(string5);
|
|
32392
|
+
let rows = [""];
|
|
32393
|
+
for (const [index, word] of string5.split(" ").entries()) {
|
|
32394
|
+
if (options.trim !== false) {
|
|
32395
|
+
rows[rows.length - 1] = rows.at(-1).trimStart();
|
|
32396
|
+
}
|
|
32397
|
+
let rowLength = stringWidth(rows.at(-1));
|
|
32398
|
+
if (index !== 0) {
|
|
32399
|
+
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
32400
|
+
rows.push("");
|
|
32401
|
+
rowLength = 0;
|
|
32402
|
+
}
|
|
32403
|
+
if (rowLength > 0 || options.trim === false) {
|
|
32404
|
+
rows[rows.length - 1] += " ";
|
|
32405
|
+
rowLength++;
|
|
32406
|
+
}
|
|
32407
|
+
}
|
|
32408
|
+
if (options.hard && lengths[index] > columns) {
|
|
32409
|
+
const remainingColumns = columns - rowLength;
|
|
32410
|
+
const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns);
|
|
32411
|
+
const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns);
|
|
32412
|
+
if (breaksStartingNextLine < breaksStartingThisLine) {
|
|
32413
|
+
rows.push("");
|
|
32414
|
+
}
|
|
32415
|
+
wrapWord(rows, word, columns);
|
|
32416
|
+
continue;
|
|
32417
|
+
}
|
|
32418
|
+
if (rowLength + lengths[index] > columns && rowLength > 0 && lengths[index] > 0) {
|
|
32419
|
+
if (options.wordWrap === false && rowLength < columns) {
|
|
32420
|
+
wrapWord(rows, word, columns);
|
|
32421
|
+
continue;
|
|
32422
|
+
}
|
|
32423
|
+
rows.push("");
|
|
32424
|
+
}
|
|
32425
|
+
if (rowLength + lengths[index] > columns && options.wordWrap === false) {
|
|
32426
|
+
wrapWord(rows, word, columns);
|
|
32427
|
+
continue;
|
|
32428
|
+
}
|
|
32429
|
+
rows[rows.length - 1] += word;
|
|
32430
|
+
}
|
|
32431
|
+
if (options.trim !== false) {
|
|
32432
|
+
rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
|
|
32433
|
+
}
|
|
32434
|
+
const preString = rows.join(`
|
|
32435
|
+
`);
|
|
32436
|
+
const pre = [...preString];
|
|
32437
|
+
let preStringIndex = 0;
|
|
32438
|
+
for (const [index, character] of pre.entries()) {
|
|
32439
|
+
returnValue += character;
|
|
32440
|
+
if (ESCAPES.has(character)) {
|
|
32441
|
+
const { groups } = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`).exec(preString.slice(preStringIndex)) || { groups: {} };
|
|
32442
|
+
if (groups.code !== undefined) {
|
|
32443
|
+
const code2 = Number.parseFloat(groups.code);
|
|
32444
|
+
escapeCode = code2 === END_CODE ? undefined : code2;
|
|
32445
|
+
} else if (groups.uri !== undefined) {
|
|
32446
|
+
escapeUrl = groups.uri.length === 0 ? undefined : groups.uri;
|
|
32447
|
+
}
|
|
32448
|
+
}
|
|
32449
|
+
const code = ansi_styles_default.codes.get(Number(escapeCode));
|
|
32450
|
+
if (pre[index + 1] === `
|
|
32451
|
+
`) {
|
|
32452
|
+
if (escapeUrl) {
|
|
32453
|
+
returnValue += wrapAnsiHyperlink("");
|
|
32454
|
+
}
|
|
32455
|
+
if (escapeCode && code) {
|
|
32456
|
+
returnValue += wrapAnsiCode(code);
|
|
32457
|
+
}
|
|
32458
|
+
} else if (character === `
|
|
32459
|
+
`) {
|
|
32460
|
+
if (escapeCode && code) {
|
|
32461
|
+
returnValue += wrapAnsiCode(escapeCode);
|
|
32462
|
+
}
|
|
32463
|
+
if (escapeUrl) {
|
|
32464
|
+
returnValue += wrapAnsiHyperlink(escapeUrl);
|
|
32465
|
+
}
|
|
32466
|
+
}
|
|
32467
|
+
preStringIndex += character.length;
|
|
32468
|
+
}
|
|
32469
|
+
return returnValue;
|
|
32470
|
+
};
|
|
32471
|
+
var init_wrap_ansi = __esm(() => {
|
|
32472
|
+
init_string_width();
|
|
32473
|
+
init_strip_ansi();
|
|
32474
|
+
init_ansi_styles();
|
|
32475
|
+
ESCAPES = new Set([
|
|
32476
|
+
"\x1B",
|
|
32477
|
+
""
|
|
32478
|
+
]);
|
|
32479
|
+
ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
32480
|
+
});
|
|
32481
|
+
|
|
32482
|
+
// node_modules/@inquirer/core/dist/lib/utils.js
|
|
32483
|
+
function breakLines(content, width) {
|
|
32484
|
+
return content.split(`
|
|
32485
|
+
`).flatMap((line) => wrapAnsi(line, width, { trim: false, hard: true }).split(`
|
|
32486
|
+
`).map((str) => str.trimEnd())).join(`
|
|
32487
|
+
`);
|
|
32488
|
+
}
|
|
32489
|
+
function readlineWidth() {
|
|
32490
|
+
return import_cli_width.default({ defaultWidth: 80, output: readline().output });
|
|
32491
|
+
}
|
|
32492
|
+
var import_cli_width;
|
|
32493
|
+
var init_utils = __esm(() => {
|
|
32494
|
+
init_wrap_ansi();
|
|
32495
|
+
init_hook_engine();
|
|
32496
|
+
import_cli_width = __toESM(require_cli_width(), 1);
|
|
32497
|
+
});
|
|
32498
|
+
|
|
32499
|
+
// node_modules/@inquirer/core/dist/lib/pagination/use-pagination.js
|
|
32500
|
+
function usePointerPosition({ active, renderedItems, pageSize, loop }) {
|
|
32501
|
+
const state = useRef({
|
|
32502
|
+
lastPointer: active,
|
|
32503
|
+
lastActive: undefined
|
|
32504
|
+
});
|
|
32505
|
+
const { lastPointer, lastActive } = state.current;
|
|
32506
|
+
const middle = Math.floor(pageSize / 2);
|
|
32507
|
+
const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
|
|
32508
|
+
const defaultPointerPosition = renderedItems.slice(0, active).reduce((acc, item) => acc + item.length, 0);
|
|
32509
|
+
let pointer = defaultPointerPosition;
|
|
32510
|
+
if (renderedLength > pageSize) {
|
|
32511
|
+
if (loop) {
|
|
32512
|
+
pointer = lastPointer;
|
|
32513
|
+
if (lastActive != null && lastActive < active && active - lastActive < pageSize) {
|
|
32514
|
+
pointer = Math.min(middle, Math.abs(active - lastActive) === 1 ? Math.min(lastPointer + (renderedItems[lastActive]?.length ?? 0), Math.max(defaultPointerPosition, lastPointer)) : lastPointer + active - lastActive);
|
|
32515
|
+
}
|
|
32516
|
+
} else {
|
|
32517
|
+
const spaceUnderActive = renderedItems.slice(active).reduce((acc, item) => acc + item.length, 0);
|
|
32518
|
+
pointer = spaceUnderActive < pageSize - middle ? pageSize - spaceUnderActive : Math.min(defaultPointerPosition, middle);
|
|
32519
|
+
}
|
|
32520
|
+
}
|
|
32521
|
+
state.current.lastPointer = pointer;
|
|
32522
|
+
state.current.lastActive = active;
|
|
32523
|
+
return pointer;
|
|
32524
|
+
}
|
|
32525
|
+
function usePagination({ items, active, renderItem, pageSize, loop = true }) {
|
|
32526
|
+
const width = readlineWidth();
|
|
32527
|
+
const bound = (num) => (num % items.length + items.length) % items.length;
|
|
32528
|
+
const renderedItems = items.map((item, index) => {
|
|
32529
|
+
if (item == null)
|
|
32530
|
+
return [];
|
|
32531
|
+
return breakLines(renderItem({ item, index, isActive: index === active }), width).split(`
|
|
32532
|
+
`);
|
|
32533
|
+
});
|
|
32534
|
+
const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
|
|
32535
|
+
const renderItemAtIndex = (index) => renderedItems[index] ?? [];
|
|
32536
|
+
const pointer = usePointerPosition({ active, renderedItems, pageSize, loop });
|
|
32537
|
+
const activeItem = renderItemAtIndex(active).slice(0, pageSize);
|
|
32538
|
+
const activeItemPosition = pointer + activeItem.length <= pageSize ? pointer : pageSize - activeItem.length;
|
|
32539
|
+
const pageBuffer = Array.from({ length: pageSize });
|
|
32540
|
+
pageBuffer.splice(activeItemPosition, activeItem.length, ...activeItem);
|
|
32541
|
+
const itemVisited = new Set([active]);
|
|
32542
|
+
let bufferPointer = activeItemPosition + activeItem.length;
|
|
32543
|
+
let itemPointer = bound(active + 1);
|
|
32544
|
+
while (bufferPointer < pageSize && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer > active)) {
|
|
32545
|
+
const lines = renderItemAtIndex(itemPointer);
|
|
32546
|
+
const linesToAdd = lines.slice(0, pageSize - bufferPointer);
|
|
32547
|
+
pageBuffer.splice(bufferPointer, linesToAdd.length, ...linesToAdd);
|
|
32548
|
+
itemVisited.add(itemPointer);
|
|
32549
|
+
bufferPointer += linesToAdd.length;
|
|
32550
|
+
itemPointer = bound(itemPointer + 1);
|
|
32551
|
+
}
|
|
32552
|
+
bufferPointer = activeItemPosition - 1;
|
|
32553
|
+
itemPointer = bound(active - 1);
|
|
32554
|
+
while (bufferPointer >= 0 && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer < active)) {
|
|
32555
|
+
const lines = renderItemAtIndex(itemPointer);
|
|
32556
|
+
const linesToAdd = lines.slice(Math.max(0, lines.length - bufferPointer - 1));
|
|
32557
|
+
pageBuffer.splice(bufferPointer - linesToAdd.length + 1, linesToAdd.length, ...linesToAdd);
|
|
32558
|
+
itemVisited.add(itemPointer);
|
|
32559
|
+
bufferPointer -= linesToAdd.length;
|
|
32560
|
+
itemPointer = bound(itemPointer - 1);
|
|
32561
|
+
}
|
|
32562
|
+
return pageBuffer.filter((line) => typeof line === "string").join(`
|
|
32563
|
+
`);
|
|
32564
|
+
}
|
|
32565
|
+
var init_use_pagination = __esm(() => {
|
|
32566
|
+
init_use_ref();
|
|
32567
|
+
init_utils();
|
|
32568
|
+
});
|
|
32569
|
+
|
|
32570
|
+
// node_modules/mute-stream/lib/index.js
|
|
32571
|
+
var require_lib = __commonJS((exports, module) => {
|
|
32572
|
+
var Stream = __require("stream");
|
|
32573
|
+
|
|
32574
|
+
class MuteStream extends Stream {
|
|
32575
|
+
#isTTY = null;
|
|
32576
|
+
constructor(opts = {}) {
|
|
32577
|
+
super(opts);
|
|
32578
|
+
this.writable = this.readable = true;
|
|
32579
|
+
this.muted = false;
|
|
32580
|
+
this.on("pipe", this._onpipe);
|
|
32581
|
+
this.replace = opts.replace;
|
|
32582
|
+
this._prompt = opts.prompt || null;
|
|
32583
|
+
this._hadControl = false;
|
|
32584
|
+
}
|
|
32585
|
+
#destSrc(key, def) {
|
|
32586
|
+
if (this._dest) {
|
|
32587
|
+
return this._dest[key];
|
|
32588
|
+
}
|
|
32589
|
+
if (this._src) {
|
|
32590
|
+
return this._src[key];
|
|
32591
|
+
}
|
|
32592
|
+
return def;
|
|
32593
|
+
}
|
|
32594
|
+
#proxy(method, ...args) {
|
|
32595
|
+
if (typeof this._dest?.[method] === "function") {
|
|
32596
|
+
this._dest[method](...args);
|
|
32597
|
+
}
|
|
32598
|
+
if (typeof this._src?.[method] === "function") {
|
|
32599
|
+
this._src[method](...args);
|
|
32600
|
+
}
|
|
32601
|
+
}
|
|
32602
|
+
get isTTY() {
|
|
32603
|
+
if (this.#isTTY !== null) {
|
|
32604
|
+
return this.#isTTY;
|
|
32605
|
+
}
|
|
32606
|
+
return this.#destSrc("isTTY", false);
|
|
32607
|
+
}
|
|
32608
|
+
set isTTY(val) {
|
|
32609
|
+
this.#isTTY = val;
|
|
32610
|
+
}
|
|
32611
|
+
get rows() {
|
|
32612
|
+
return this.#destSrc("rows");
|
|
32613
|
+
}
|
|
32614
|
+
get columns() {
|
|
32615
|
+
return this.#destSrc("columns");
|
|
32616
|
+
}
|
|
32617
|
+
mute() {
|
|
32618
|
+
this.muted = true;
|
|
32619
|
+
}
|
|
32620
|
+
unmute() {
|
|
32621
|
+
this.muted = false;
|
|
32622
|
+
}
|
|
32623
|
+
_onpipe(src) {
|
|
32624
|
+
this._src = src;
|
|
32625
|
+
}
|
|
32626
|
+
pipe(dest, options) {
|
|
32627
|
+
this._dest = dest;
|
|
32628
|
+
return super.pipe(dest, options);
|
|
32629
|
+
}
|
|
32630
|
+
pause() {
|
|
32631
|
+
if (this._src) {
|
|
32632
|
+
return this._src.pause();
|
|
32633
|
+
}
|
|
32634
|
+
}
|
|
32635
|
+
resume() {
|
|
32636
|
+
if (this._src) {
|
|
32637
|
+
return this._src.resume();
|
|
32638
|
+
}
|
|
32639
|
+
}
|
|
32640
|
+
write(c) {
|
|
32641
|
+
if (this.muted) {
|
|
32642
|
+
if (!this.replace) {
|
|
32643
|
+
return true;
|
|
32644
|
+
}
|
|
32645
|
+
if (c.match(/^\u001b/)) {
|
|
32646
|
+
if (c.indexOf(this._prompt) === 0) {
|
|
32647
|
+
c = c.slice(this._prompt.length);
|
|
32648
|
+
c = c.replace(/./g, this.replace);
|
|
32649
|
+
c = this._prompt + c;
|
|
32650
|
+
}
|
|
32651
|
+
this._hadControl = true;
|
|
32652
|
+
return this.emit("data", c);
|
|
32653
|
+
} else {
|
|
32654
|
+
if (this._prompt && this._hadControl && c.indexOf(this._prompt) === 0) {
|
|
32655
|
+
this._hadControl = false;
|
|
32656
|
+
this.emit("data", this._prompt);
|
|
32657
|
+
c = c.slice(this._prompt.length);
|
|
32658
|
+
}
|
|
32659
|
+
c = c.toString().replace(/./g, this.replace);
|
|
32660
|
+
}
|
|
32661
|
+
}
|
|
32662
|
+
this.emit("data", c);
|
|
32663
|
+
}
|
|
32664
|
+
end(c) {
|
|
32665
|
+
if (this.muted) {
|
|
32666
|
+
if (c && this.replace) {
|
|
32667
|
+
c = c.toString().replace(/./g, this.replace);
|
|
32668
|
+
} else {
|
|
32669
|
+
c = null;
|
|
32670
|
+
}
|
|
32671
|
+
}
|
|
32672
|
+
if (c) {
|
|
32673
|
+
this.emit("data", c);
|
|
32674
|
+
}
|
|
32675
|
+
this.emit("end");
|
|
32676
|
+
}
|
|
32677
|
+
destroy(...args) {
|
|
32678
|
+
return this.#proxy("destroy", ...args);
|
|
32679
|
+
}
|
|
32680
|
+
destroySoon(...args) {
|
|
32681
|
+
return this.#proxy("destroySoon", ...args);
|
|
32682
|
+
}
|
|
32683
|
+
close(...args) {
|
|
32684
|
+
return this.#proxy("close", ...args);
|
|
32685
|
+
}
|
|
32686
|
+
}
|
|
32687
|
+
module.exports = MuteStream;
|
|
32688
|
+
});
|
|
32689
|
+
|
|
32690
|
+
// node_modules/signal-exit/dist/mjs/signals.js
|
|
32691
|
+
var signals;
|
|
32692
|
+
var init_signals = __esm(() => {
|
|
32693
|
+
signals = [];
|
|
32694
|
+
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
32695
|
+
if (process.platform !== "win32") {
|
|
32696
|
+
signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
|
|
32697
|
+
}
|
|
32698
|
+
if (process.platform === "linux") {
|
|
32699
|
+
signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
32700
|
+
}
|
|
32701
|
+
});
|
|
32702
|
+
|
|
32703
|
+
// node_modules/signal-exit/dist/mjs/index.js
|
|
32704
|
+
class Emitter {
|
|
32705
|
+
emitted = {
|
|
32706
|
+
afterExit: false,
|
|
32707
|
+
exit: false
|
|
32708
|
+
};
|
|
32709
|
+
listeners = {
|
|
32710
|
+
afterExit: [],
|
|
32711
|
+
exit: []
|
|
32712
|
+
};
|
|
32713
|
+
count = 0;
|
|
32714
|
+
id = Math.random();
|
|
32715
|
+
constructor() {
|
|
32716
|
+
if (global2[kExitEmitter]) {
|
|
32717
|
+
return global2[kExitEmitter];
|
|
32718
|
+
}
|
|
32719
|
+
ObjectDefineProperty(global2, kExitEmitter, {
|
|
32720
|
+
value: this,
|
|
32721
|
+
writable: false,
|
|
32722
|
+
enumerable: false,
|
|
32723
|
+
configurable: false
|
|
32724
|
+
});
|
|
32725
|
+
}
|
|
32726
|
+
on(ev, fn) {
|
|
32727
|
+
this.listeners[ev].push(fn);
|
|
32728
|
+
}
|
|
32729
|
+
removeListener(ev, fn) {
|
|
32730
|
+
const list = this.listeners[ev];
|
|
32731
|
+
const i = list.indexOf(fn);
|
|
32732
|
+
if (i === -1) {
|
|
32733
|
+
return;
|
|
32734
|
+
}
|
|
32735
|
+
if (i === 0 && list.length === 1) {
|
|
32736
|
+
list.length = 0;
|
|
32737
|
+
} else {
|
|
32738
|
+
list.splice(i, 1);
|
|
32739
|
+
}
|
|
32740
|
+
}
|
|
32741
|
+
emit(ev, code, signal) {
|
|
32742
|
+
if (this.emitted[ev]) {
|
|
32743
|
+
return false;
|
|
32744
|
+
}
|
|
32745
|
+
this.emitted[ev] = true;
|
|
32746
|
+
let ret = false;
|
|
32747
|
+
for (const fn of this.listeners[ev]) {
|
|
32748
|
+
ret = fn(code, signal) === true || ret;
|
|
32749
|
+
}
|
|
32750
|
+
if (ev === "exit") {
|
|
32751
|
+
ret = this.emit("afterExit", code, signal) || ret;
|
|
32752
|
+
}
|
|
32753
|
+
return ret;
|
|
32754
|
+
}
|
|
32755
|
+
}
|
|
32756
|
+
|
|
32757
|
+
class SignalExitBase {
|
|
32758
|
+
}
|
|
32759
|
+
var processOk = (process4) => !!process4 && typeof process4 === "object" && typeof process4.removeListener === "function" && typeof process4.emit === "function" && typeof process4.reallyExit === "function" && typeof process4.listeners === "function" && typeof process4.kill === "function" && typeof process4.pid === "number" && typeof process4.on === "function", kExitEmitter, global2, ObjectDefineProperty, signalExitWrap = (handler) => {
|
|
32760
|
+
return {
|
|
32761
|
+
onExit(cb, opts) {
|
|
32762
|
+
return handler.onExit(cb, opts);
|
|
32763
|
+
},
|
|
32764
|
+
load() {
|
|
32765
|
+
return handler.load();
|
|
32766
|
+
},
|
|
32767
|
+
unload() {
|
|
32768
|
+
return handler.unload();
|
|
32769
|
+
}
|
|
32770
|
+
};
|
|
32771
|
+
}, SignalExitFallback, SignalExit, process4, onExit, load, unload;
|
|
32772
|
+
var init_mjs = __esm(() => {
|
|
32773
|
+
init_signals();
|
|
32774
|
+
kExitEmitter = Symbol.for("signal-exit emitter");
|
|
32775
|
+
global2 = globalThis;
|
|
32776
|
+
ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
32777
|
+
SignalExitFallback = class SignalExitFallback extends SignalExitBase {
|
|
32778
|
+
onExit() {
|
|
32779
|
+
return () => {};
|
|
32780
|
+
}
|
|
32781
|
+
load() {}
|
|
32782
|
+
unload() {}
|
|
32783
|
+
};
|
|
32784
|
+
SignalExit = class SignalExit extends SignalExitBase {
|
|
32785
|
+
#hupSig = process4.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
32786
|
+
#emitter = new Emitter;
|
|
32787
|
+
#process;
|
|
32788
|
+
#originalProcessEmit;
|
|
32789
|
+
#originalProcessReallyExit;
|
|
32790
|
+
#sigListeners = {};
|
|
32791
|
+
#loaded = false;
|
|
32792
|
+
constructor(process4) {
|
|
32793
|
+
super();
|
|
32794
|
+
this.#process = process4;
|
|
32795
|
+
this.#sigListeners = {};
|
|
32796
|
+
for (const sig of signals) {
|
|
32797
|
+
this.#sigListeners[sig] = () => {
|
|
32798
|
+
const listeners = this.#process.listeners(sig);
|
|
32799
|
+
let { count } = this.#emitter;
|
|
32800
|
+
const p = process4;
|
|
32801
|
+
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
|
|
32802
|
+
count += p.__signal_exit_emitter__.count;
|
|
32803
|
+
}
|
|
32804
|
+
if (listeners.length === count) {
|
|
32805
|
+
this.unload();
|
|
32806
|
+
const ret = this.#emitter.emit("exit", null, sig);
|
|
32807
|
+
const s = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
32808
|
+
if (!ret)
|
|
32809
|
+
process4.kill(process4.pid, s);
|
|
32810
|
+
}
|
|
32811
|
+
};
|
|
32812
|
+
}
|
|
32813
|
+
this.#originalProcessReallyExit = process4.reallyExit;
|
|
32814
|
+
this.#originalProcessEmit = process4.emit;
|
|
32815
|
+
}
|
|
32816
|
+
onExit(cb, opts) {
|
|
32817
|
+
if (!processOk(this.#process)) {
|
|
32818
|
+
return () => {};
|
|
32819
|
+
}
|
|
32820
|
+
if (this.#loaded === false) {
|
|
32821
|
+
this.load();
|
|
32822
|
+
}
|
|
32823
|
+
const ev = opts?.alwaysLast ? "afterExit" : "exit";
|
|
32824
|
+
this.#emitter.on(ev, cb);
|
|
32825
|
+
return () => {
|
|
32826
|
+
this.#emitter.removeListener(ev, cb);
|
|
32827
|
+
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
|
|
32828
|
+
this.unload();
|
|
32829
|
+
}
|
|
32830
|
+
};
|
|
32831
|
+
}
|
|
32832
|
+
load() {
|
|
32833
|
+
if (this.#loaded) {
|
|
32834
|
+
return;
|
|
32835
|
+
}
|
|
32836
|
+
this.#loaded = true;
|
|
32837
|
+
this.#emitter.count += 1;
|
|
32838
|
+
for (const sig of signals) {
|
|
32839
|
+
try {
|
|
32840
|
+
const fn = this.#sigListeners[sig];
|
|
32841
|
+
if (fn)
|
|
32842
|
+
this.#process.on(sig, fn);
|
|
32843
|
+
} catch (_) {}
|
|
32844
|
+
}
|
|
32845
|
+
this.#process.emit = (ev, ...a) => {
|
|
32846
|
+
return this.#processEmit(ev, ...a);
|
|
32847
|
+
};
|
|
32848
|
+
this.#process.reallyExit = (code) => {
|
|
32849
|
+
return this.#processReallyExit(code);
|
|
32850
|
+
};
|
|
32851
|
+
}
|
|
32852
|
+
unload() {
|
|
32853
|
+
if (!this.#loaded) {
|
|
32854
|
+
return;
|
|
32855
|
+
}
|
|
32856
|
+
this.#loaded = false;
|
|
32857
|
+
signals.forEach((sig) => {
|
|
32858
|
+
const listener = this.#sigListeners[sig];
|
|
32859
|
+
if (!listener) {
|
|
32860
|
+
throw new Error("Listener not defined for signal: " + sig);
|
|
32861
|
+
}
|
|
32862
|
+
try {
|
|
32863
|
+
this.#process.removeListener(sig, listener);
|
|
32864
|
+
} catch (_) {}
|
|
32865
|
+
});
|
|
32866
|
+
this.#process.emit = this.#originalProcessEmit;
|
|
32867
|
+
this.#process.reallyExit = this.#originalProcessReallyExit;
|
|
32868
|
+
this.#emitter.count -= 1;
|
|
32869
|
+
}
|
|
32870
|
+
#processReallyExit(code) {
|
|
32871
|
+
if (!processOk(this.#process)) {
|
|
32872
|
+
return 0;
|
|
32873
|
+
}
|
|
32874
|
+
this.#process.exitCode = code || 0;
|
|
32875
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
32876
|
+
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
|
32877
|
+
}
|
|
32878
|
+
#processEmit(ev, ...args) {
|
|
32879
|
+
const og = this.#originalProcessEmit;
|
|
32880
|
+
if (ev === "exit" && processOk(this.#process)) {
|
|
32881
|
+
if (typeof args[0] === "number") {
|
|
32882
|
+
this.#process.exitCode = args[0];
|
|
32883
|
+
}
|
|
32884
|
+
const ret = og.call(this.#process, ev, ...args);
|
|
32885
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
32886
|
+
return ret;
|
|
32887
|
+
} else {
|
|
32888
|
+
return og.call(this.#process, ev, ...args);
|
|
32889
|
+
}
|
|
32890
|
+
}
|
|
32891
|
+
};
|
|
32892
|
+
process4 = globalThis.process;
|
|
32893
|
+
({
|
|
32894
|
+
onExit,
|
|
32895
|
+
load,
|
|
32896
|
+
unload
|
|
32897
|
+
} = signalExitWrap(processOk(process4) ? new SignalExit(process4) : new SignalExitFallback));
|
|
32898
|
+
});
|
|
32899
|
+
|
|
32900
|
+
// node_modules/@inquirer/ansi/dist/index.js
|
|
32901
|
+
var ESC = "\x1B[", cursorLeft, cursorHide, cursorShow, cursorUp = (rows = 1) => rows > 0 ? `${ESC}${rows}A` : "", cursorDown = (rows = 1) => rows > 0 ? `${ESC}${rows}B` : "", cursorTo = (x, y) => {
|
|
32902
|
+
if (typeof y === "number" && !Number.isNaN(y)) {
|
|
32903
|
+
return `${ESC}${y + 1};${x + 1}H`;
|
|
32904
|
+
}
|
|
32905
|
+
return `${ESC}${x + 1}G`;
|
|
32906
|
+
}, eraseLine, eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + eraseLine + cursorLeft : "";
|
|
32907
|
+
var init_dist2 = __esm(() => {
|
|
32908
|
+
cursorLeft = ESC + "G";
|
|
32909
|
+
cursorHide = ESC + "?25l";
|
|
32910
|
+
cursorShow = ESC + "?25h";
|
|
32911
|
+
eraseLine = ESC + "2K";
|
|
32912
|
+
});
|
|
32913
|
+
|
|
32914
|
+
// node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
32915
|
+
import { stripVTControlCharacters } from "node:util";
|
|
32916
|
+
|
|
32917
|
+
class ScreenManager {
|
|
32918
|
+
height = 0;
|
|
32919
|
+
extraLinesUnderPrompt = 0;
|
|
32920
|
+
cursorPos;
|
|
32921
|
+
rl;
|
|
32922
|
+
constructor(rl) {
|
|
32923
|
+
this.rl = rl;
|
|
32924
|
+
this.cursorPos = rl.getCursorPos();
|
|
32925
|
+
}
|
|
32926
|
+
write(content) {
|
|
32927
|
+
this.rl.output.unmute();
|
|
32928
|
+
this.rl.output.write(content);
|
|
32929
|
+
this.rl.output.mute();
|
|
32930
|
+
}
|
|
32931
|
+
render(content, bottomContent = "") {
|
|
32932
|
+
const promptLine = lastLine(content);
|
|
32933
|
+
const rawPromptLine = stripVTControlCharacters(promptLine);
|
|
32934
|
+
let prompt = rawPromptLine;
|
|
32935
|
+
if (this.rl.line.length > 0) {
|
|
32936
|
+
prompt = prompt.slice(0, -this.rl.line.length);
|
|
32937
|
+
}
|
|
32938
|
+
this.rl.setPrompt(prompt);
|
|
32939
|
+
this.cursorPos = this.rl.getCursorPos();
|
|
32940
|
+
const width = readlineWidth();
|
|
32941
|
+
content = breakLines(content, width);
|
|
32942
|
+
bottomContent = breakLines(bottomContent, width);
|
|
32943
|
+
if (rawPromptLine.length % width === 0) {
|
|
32944
|
+
content += `
|
|
32945
|
+
`;
|
|
32946
|
+
}
|
|
32947
|
+
let output = content + (bottomContent ? `
|
|
32948
|
+
` + bottomContent : "");
|
|
32949
|
+
const promptLineUpDiff = Math.floor(rawPromptLine.length / width) - this.cursorPos.rows;
|
|
32950
|
+
const bottomContentHeight = promptLineUpDiff + (bottomContent ? height(bottomContent) : 0);
|
|
32951
|
+
if (bottomContentHeight > 0)
|
|
32952
|
+
output += cursorUp(bottomContentHeight);
|
|
32953
|
+
output += cursorTo(this.cursorPos.cols);
|
|
32954
|
+
this.write(cursorDown(this.extraLinesUnderPrompt) + eraseLines(this.height) + output);
|
|
32955
|
+
this.extraLinesUnderPrompt = bottomContentHeight;
|
|
32956
|
+
this.height = height(output);
|
|
32957
|
+
}
|
|
32958
|
+
checkCursorPos() {
|
|
32959
|
+
const cursorPos = this.rl.getCursorPos();
|
|
32960
|
+
if (cursorPos.cols !== this.cursorPos.cols) {
|
|
32961
|
+
this.write(cursorTo(cursorPos.cols));
|
|
32962
|
+
this.cursorPos = cursorPos;
|
|
32963
|
+
}
|
|
32964
|
+
}
|
|
32965
|
+
done({ clearContent }) {
|
|
32966
|
+
this.rl.setPrompt("");
|
|
32967
|
+
let output = cursorDown(this.extraLinesUnderPrompt);
|
|
32968
|
+
output += clearContent ? eraseLines(this.height) : `
|
|
32969
|
+
`;
|
|
32970
|
+
output += cursorShow;
|
|
32971
|
+
this.write(output);
|
|
32972
|
+
this.rl.close();
|
|
32973
|
+
}
|
|
32974
|
+
}
|
|
32975
|
+
var height = (content) => content.split(`
|
|
32976
|
+
`).length, lastLine = (content) => content.split(`
|
|
32977
|
+
`).pop() ?? "";
|
|
32978
|
+
var init_screen_manager = __esm(() => {
|
|
32979
|
+
init_utils();
|
|
32980
|
+
init_dist2();
|
|
32981
|
+
});
|
|
32982
|
+
|
|
32983
|
+
// node_modules/@inquirer/core/dist/lib/promise-polyfill.js
|
|
32984
|
+
var PromisePolyfill;
|
|
32985
|
+
var init_promise_polyfill = __esm(() => {
|
|
32986
|
+
PromisePolyfill = class PromisePolyfill extends Promise {
|
|
32987
|
+
static withResolver() {
|
|
32988
|
+
let resolve;
|
|
32989
|
+
let reject;
|
|
32990
|
+
const promise3 = new Promise((res, rej) => {
|
|
32991
|
+
resolve = res;
|
|
32992
|
+
reject = rej;
|
|
32993
|
+
});
|
|
32994
|
+
return { promise: promise3, resolve, reject };
|
|
32995
|
+
}
|
|
32996
|
+
};
|
|
32997
|
+
});
|
|
32998
|
+
|
|
32999
|
+
// node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
33000
|
+
import * as readline2 from "node:readline";
|
|
33001
|
+
import { AsyncResource as AsyncResource3 } from "node:async_hooks";
|
|
33002
|
+
function getCallSites() {
|
|
33003
|
+
const _prepareStackTrace = Error.prepareStackTrace;
|
|
33004
|
+
let result = [];
|
|
33005
|
+
try {
|
|
33006
|
+
Error.prepareStackTrace = (_, callSites) => {
|
|
33007
|
+
const callSitesWithoutCurrent = callSites.slice(1);
|
|
33008
|
+
result = callSitesWithoutCurrent;
|
|
33009
|
+
return callSitesWithoutCurrent;
|
|
33010
|
+
};
|
|
33011
|
+
new Error().stack;
|
|
33012
|
+
} catch {
|
|
33013
|
+
return result;
|
|
33014
|
+
}
|
|
33015
|
+
Error.prepareStackTrace = _prepareStackTrace;
|
|
33016
|
+
return result;
|
|
33017
|
+
}
|
|
33018
|
+
function createPrompt(view) {
|
|
33019
|
+
const callSites = getCallSites();
|
|
33020
|
+
const prompt = (config3, context = {}) => {
|
|
33021
|
+
const { input = process.stdin, signal } = context;
|
|
33022
|
+
const cleanups = new Set;
|
|
33023
|
+
const output = new import_mute_stream.default;
|
|
33024
|
+
output.pipe(context.output ?? process.stdout);
|
|
33025
|
+
const rl = readline2.createInterface({
|
|
33026
|
+
terminal: true,
|
|
33027
|
+
input,
|
|
33028
|
+
output
|
|
33029
|
+
});
|
|
33030
|
+
const screen = new ScreenManager(rl);
|
|
33031
|
+
const { promise: promise3, resolve, reject } = PromisePolyfill.withResolver();
|
|
33032
|
+
const cancel = () => reject(new CancelPromptError);
|
|
33033
|
+
if (signal) {
|
|
33034
|
+
const abort = () => reject(new AbortPromptError({ cause: signal.reason }));
|
|
33035
|
+
if (signal.aborted) {
|
|
33036
|
+
abort();
|
|
33037
|
+
return Object.assign(promise3, { cancel });
|
|
33038
|
+
}
|
|
33039
|
+
signal.addEventListener("abort", abort);
|
|
33040
|
+
cleanups.add(() => signal.removeEventListener("abort", abort));
|
|
33041
|
+
}
|
|
33042
|
+
cleanups.add(onExit((code, signal2) => {
|
|
33043
|
+
reject(new ExitPromptError(`User force closed the prompt with ${code} ${signal2}`));
|
|
33044
|
+
}));
|
|
33045
|
+
const sigint = () => reject(new ExitPromptError(`User force closed the prompt with SIGINT`));
|
|
33046
|
+
rl.on("SIGINT", sigint);
|
|
33047
|
+
cleanups.add(() => rl.removeListener("SIGINT", sigint));
|
|
33048
|
+
const checkCursorPos = () => screen.checkCursorPos();
|
|
33049
|
+
rl.input.on("keypress", checkCursorPos);
|
|
33050
|
+
cleanups.add(() => rl.input.removeListener("keypress", checkCursorPos));
|
|
33051
|
+
return withHooks(rl, (cycle) => {
|
|
33052
|
+
const hooksCleanup = AsyncResource3.bind(() => effectScheduler.clearAll());
|
|
33053
|
+
rl.on("close", hooksCleanup);
|
|
33054
|
+
cleanups.add(() => rl.removeListener("close", hooksCleanup));
|
|
33055
|
+
cycle(() => {
|
|
33056
|
+
try {
|
|
33057
|
+
const nextView = view(config3, (value) => {
|
|
33058
|
+
setImmediate(() => resolve(value));
|
|
33059
|
+
});
|
|
33060
|
+
if (nextView === undefined) {
|
|
33061
|
+
const callerFilename = callSites[1]?.getFileName();
|
|
33062
|
+
throw new Error(`Prompt functions must return a string.
|
|
33063
|
+
at ${callerFilename}`);
|
|
33064
|
+
}
|
|
33065
|
+
const [content, bottomContent] = typeof nextView === "string" ? [nextView] : nextView;
|
|
33066
|
+
screen.render(content, bottomContent);
|
|
33067
|
+
effectScheduler.run();
|
|
33068
|
+
} catch (error46) {
|
|
33069
|
+
reject(error46);
|
|
33070
|
+
}
|
|
33071
|
+
});
|
|
33072
|
+
return Object.assign(promise3.then((answer) => {
|
|
33073
|
+
effectScheduler.clearAll();
|
|
33074
|
+
return answer;
|
|
33075
|
+
}, (error46) => {
|
|
33076
|
+
effectScheduler.clearAll();
|
|
33077
|
+
throw error46;
|
|
33078
|
+
}).finally(() => {
|
|
33079
|
+
cleanups.forEach((cleanup) => cleanup());
|
|
33080
|
+
screen.done({ clearContent: Boolean(context.clearPromptOnDone) });
|
|
33081
|
+
output.end();
|
|
33082
|
+
}).then(() => promise3), { cancel });
|
|
33083
|
+
});
|
|
33084
|
+
};
|
|
33085
|
+
return prompt;
|
|
33086
|
+
}
|
|
33087
|
+
var import_mute_stream;
|
|
33088
|
+
var init_create_prompt = __esm(() => {
|
|
33089
|
+
init_mjs();
|
|
33090
|
+
init_screen_manager();
|
|
33091
|
+
init_promise_polyfill();
|
|
33092
|
+
init_hook_engine();
|
|
33093
|
+
init_errors5();
|
|
33094
|
+
import_mute_stream = __toESM(require_lib(), 1);
|
|
33095
|
+
});
|
|
33096
|
+
|
|
33097
|
+
// node_modules/@inquirer/core/dist/lib/Separator.js
|
|
33098
|
+
import { styleText as styleText2 } from "node:util";
|
|
33099
|
+
|
|
33100
|
+
class Separator {
|
|
33101
|
+
separator = styleText2("dim", Array.from({ length: 15 }).join(dist_default.line));
|
|
33102
|
+
type = "separator";
|
|
33103
|
+
constructor(separator) {
|
|
33104
|
+
if (separator) {
|
|
33105
|
+
this.separator = separator;
|
|
33106
|
+
}
|
|
33107
|
+
}
|
|
33108
|
+
static isSeparator(choice) {
|
|
33109
|
+
return Boolean(choice && typeof choice === "object" && "type" in choice && choice.type === "separator");
|
|
33110
|
+
}
|
|
33111
|
+
}
|
|
33112
|
+
var init_Separator = __esm(() => {
|
|
33113
|
+
init_dist();
|
|
33114
|
+
});
|
|
33115
|
+
|
|
33116
|
+
// node_modules/@inquirer/core/dist/index.js
|
|
33117
|
+
var init_dist3 = __esm(() => {
|
|
33118
|
+
init_use_prefix();
|
|
33119
|
+
init_use_state();
|
|
33120
|
+
init_use_effect();
|
|
33121
|
+
init_use_memo();
|
|
33122
|
+
init_use_ref();
|
|
33123
|
+
init_use_keypress();
|
|
33124
|
+
init_make_theme();
|
|
33125
|
+
init_use_pagination();
|
|
33126
|
+
init_create_prompt();
|
|
33127
|
+
init_Separator();
|
|
33128
|
+
init_errors5();
|
|
33129
|
+
});
|
|
33130
|
+
|
|
33131
|
+
// node_modules/@inquirer/confirm/dist/index.js
|
|
33132
|
+
function getBooleanValue(value, defaultValue) {
|
|
33133
|
+
let answer = defaultValue !== false;
|
|
33134
|
+
if (/^(y|yes)/i.test(value))
|
|
33135
|
+
answer = true;
|
|
33136
|
+
else if (/^(n|no)/i.test(value))
|
|
33137
|
+
answer = false;
|
|
33138
|
+
return answer;
|
|
33139
|
+
}
|
|
33140
|
+
function boolToString(value) {
|
|
33141
|
+
return value ? "Yes" : "No";
|
|
33142
|
+
}
|
|
33143
|
+
var dist_default2;
|
|
33144
|
+
var init_dist4 = __esm(() => {
|
|
33145
|
+
init_dist3();
|
|
33146
|
+
dist_default2 = createPrompt((config3, done) => {
|
|
33147
|
+
const { transformer = boolToString } = config3;
|
|
33148
|
+
const [status, setStatus] = useState("idle");
|
|
33149
|
+
const [value, setValue] = useState("");
|
|
33150
|
+
const theme = makeTheme(config3.theme);
|
|
33151
|
+
const prefix = usePrefix({ status, theme });
|
|
33152
|
+
useKeypress((key, rl) => {
|
|
33153
|
+
if (status !== "idle")
|
|
33154
|
+
return;
|
|
33155
|
+
if (isEnterKey(key)) {
|
|
33156
|
+
const answer = getBooleanValue(value, config3.default);
|
|
33157
|
+
setValue(transformer(answer));
|
|
33158
|
+
setStatus("done");
|
|
33159
|
+
done(answer);
|
|
33160
|
+
} else if (isTabKey(key)) {
|
|
33161
|
+
const answer = boolToString(!getBooleanValue(value, config3.default));
|
|
33162
|
+
rl.clearLine(0);
|
|
33163
|
+
rl.write(answer);
|
|
33164
|
+
setValue(answer);
|
|
33165
|
+
} else {
|
|
33166
|
+
setValue(rl.line);
|
|
33167
|
+
}
|
|
33168
|
+
});
|
|
33169
|
+
let formattedValue = value;
|
|
33170
|
+
let defaultValue = "";
|
|
33171
|
+
if (status === "done") {
|
|
33172
|
+
formattedValue = theme.style.answer(value);
|
|
33173
|
+
} else {
|
|
33174
|
+
defaultValue = ` ${theme.style.defaultAnswer(config3.default === false ? "y/N" : "Y/n")}`;
|
|
33175
|
+
}
|
|
33176
|
+
const message = theme.style.message(config3.message, status);
|
|
33177
|
+
return `${prefix} ${message}${defaultValue} ${formattedValue}`;
|
|
33178
|
+
});
|
|
33179
|
+
});
|
|
33180
|
+
|
|
33181
|
+
// node_modules/@inquirer/input/dist/index.js
|
|
33182
|
+
var inputTheme, dist_default3;
|
|
33183
|
+
var init_dist5 = __esm(() => {
|
|
33184
|
+
init_dist3();
|
|
33185
|
+
inputTheme = {
|
|
33186
|
+
validationFailureMode: "keep"
|
|
33187
|
+
};
|
|
33188
|
+
dist_default3 = createPrompt((config3, done) => {
|
|
33189
|
+
const { prefill = "tab" } = config3;
|
|
33190
|
+
const theme = makeTheme(inputTheme, config3.theme);
|
|
33191
|
+
const [status, setStatus] = useState("idle");
|
|
33192
|
+
const [defaultValue = "", setDefaultValue] = useState(config3.default);
|
|
33193
|
+
const [errorMsg, setError] = useState();
|
|
33194
|
+
const [value, setValue] = useState("");
|
|
33195
|
+
const prefix = usePrefix({ status, theme });
|
|
33196
|
+
async function validate2(value2) {
|
|
33197
|
+
const { required: required2, pattern, patternError = "Invalid input" } = config3;
|
|
33198
|
+
if (required2 && !value2) {
|
|
33199
|
+
return "You must provide a value";
|
|
33200
|
+
}
|
|
33201
|
+
if (pattern && !pattern.test(value2)) {
|
|
33202
|
+
return patternError;
|
|
33203
|
+
}
|
|
33204
|
+
if (typeof config3.validate === "function") {
|
|
33205
|
+
return await config3.validate(value2) || "You must provide a valid value";
|
|
33206
|
+
}
|
|
33207
|
+
return true;
|
|
33208
|
+
}
|
|
33209
|
+
useKeypress(async (key, rl) => {
|
|
33210
|
+
if (status !== "idle") {
|
|
33211
|
+
return;
|
|
33212
|
+
}
|
|
33213
|
+
if (isEnterKey(key)) {
|
|
33214
|
+
const answer = value || defaultValue;
|
|
33215
|
+
setStatus("loading");
|
|
33216
|
+
const isValid3 = await validate2(answer);
|
|
33217
|
+
if (isValid3 === true) {
|
|
33218
|
+
setValue(answer);
|
|
33219
|
+
setStatus("done");
|
|
33220
|
+
done(answer);
|
|
33221
|
+
} else {
|
|
33222
|
+
if (theme.validationFailureMode === "clear") {
|
|
33223
|
+
setValue("");
|
|
33224
|
+
} else {
|
|
33225
|
+
rl.write(value);
|
|
33226
|
+
}
|
|
33227
|
+
setError(isValid3);
|
|
33228
|
+
setStatus("idle");
|
|
33229
|
+
}
|
|
33230
|
+
} else if (isBackspaceKey(key) && !value) {
|
|
33231
|
+
setDefaultValue(undefined);
|
|
33232
|
+
} else if (isTabKey(key) && !value) {
|
|
33233
|
+
setDefaultValue(undefined);
|
|
33234
|
+
rl.clearLine(0);
|
|
33235
|
+
rl.write(defaultValue);
|
|
33236
|
+
setValue(defaultValue);
|
|
33237
|
+
} else {
|
|
33238
|
+
setValue(rl.line);
|
|
33239
|
+
setError(undefined);
|
|
33240
|
+
}
|
|
33241
|
+
});
|
|
33242
|
+
useEffect((rl) => {
|
|
33243
|
+
if (prefill === "editable" && defaultValue) {
|
|
33244
|
+
rl.write(defaultValue);
|
|
33245
|
+
setValue(defaultValue);
|
|
33246
|
+
}
|
|
33247
|
+
}, []);
|
|
33248
|
+
const message = theme.style.message(config3.message, status);
|
|
33249
|
+
let formattedValue = value;
|
|
33250
|
+
if (typeof config3.transformer === "function") {
|
|
33251
|
+
formattedValue = config3.transformer(value, { isFinal: status === "done" });
|
|
33252
|
+
} else if (status === "done") {
|
|
33253
|
+
formattedValue = theme.style.answer(value);
|
|
33254
|
+
}
|
|
33255
|
+
let defaultStr;
|
|
33256
|
+
if (defaultValue && status !== "done" && !value) {
|
|
33257
|
+
defaultStr = theme.style.defaultAnswer(defaultValue);
|
|
33258
|
+
}
|
|
33259
|
+
let error46 = "";
|
|
33260
|
+
if (errorMsg) {
|
|
33261
|
+
error46 = theme.style.error(errorMsg);
|
|
33262
|
+
}
|
|
33263
|
+
return [
|
|
33264
|
+
[prefix, message, defaultStr, formattedValue].filter((v) => v !== undefined).join(" "),
|
|
33265
|
+
error46
|
|
33266
|
+
];
|
|
33267
|
+
});
|
|
33268
|
+
});
|
|
33269
|
+
|
|
33270
|
+
// node_modules/@inquirer/search/dist/index.js
|
|
33271
|
+
import { styleText as styleText3 } from "node:util";
|
|
33272
|
+
function isSelectable(item) {
|
|
33273
|
+
return !Separator.isSeparator(item) && !item.disabled;
|
|
33274
|
+
}
|
|
33275
|
+
function normalizeChoices(choices) {
|
|
33276
|
+
return choices.map((choice) => {
|
|
33277
|
+
if (Separator.isSeparator(choice))
|
|
33278
|
+
return choice;
|
|
33279
|
+
if (typeof choice === "string") {
|
|
33280
|
+
return {
|
|
33281
|
+
value: choice,
|
|
33282
|
+
name: choice,
|
|
33283
|
+
short: choice,
|
|
33284
|
+
disabled: false
|
|
33285
|
+
};
|
|
33286
|
+
}
|
|
33287
|
+
const name = choice.name ?? String(choice.value);
|
|
33288
|
+
const normalizedChoice = {
|
|
33289
|
+
value: choice.value,
|
|
33290
|
+
name,
|
|
33291
|
+
short: choice.short ?? name,
|
|
33292
|
+
disabled: choice.disabled ?? false
|
|
33293
|
+
};
|
|
33294
|
+
if (choice.description) {
|
|
33295
|
+
normalizedChoice.description = choice.description;
|
|
33296
|
+
}
|
|
33297
|
+
return normalizedChoice;
|
|
33298
|
+
});
|
|
33299
|
+
}
|
|
33300
|
+
var searchTheme, dist_default4;
|
|
33301
|
+
var init_dist6 = __esm(() => {
|
|
33302
|
+
init_dist3();
|
|
33303
|
+
init_dist();
|
|
33304
|
+
searchTheme = {
|
|
33305
|
+
icon: { cursor: dist_default.pointer },
|
|
33306
|
+
style: {
|
|
33307
|
+
disabled: (text) => styleText3("dim", `- ${text}`),
|
|
33308
|
+
searchTerm: (text) => styleText3("cyan", text),
|
|
33309
|
+
description: (text) => styleText3("cyan", text),
|
|
33310
|
+
keysHelpTip: (keys) => keys.map(([key, action]) => `${styleText3("bold", key)} ${styleText3("dim", action)}`).join(styleText3("dim", " • "))
|
|
33311
|
+
}
|
|
33312
|
+
};
|
|
33313
|
+
dist_default4 = createPrompt((config3, done) => {
|
|
33314
|
+
const { pageSize = 7, validate: validate2 = () => true } = config3;
|
|
33315
|
+
const theme = makeTheme(searchTheme, config3.theme);
|
|
33316
|
+
const [status, setStatus] = useState("loading");
|
|
33317
|
+
const [searchTerm, setSearchTerm] = useState("");
|
|
33318
|
+
const [searchResults, setSearchResults] = useState([]);
|
|
33319
|
+
const [searchError, setSearchError] = useState();
|
|
33320
|
+
const prefix = usePrefix({ status, theme });
|
|
33321
|
+
const bounds = useMemo(() => {
|
|
33322
|
+
const first = searchResults.findIndex(isSelectable);
|
|
33323
|
+
const last = searchResults.findLastIndex(isSelectable);
|
|
33324
|
+
return { first, last };
|
|
33325
|
+
}, [searchResults]);
|
|
33326
|
+
const [active = bounds.first, setActive] = useState();
|
|
33327
|
+
useEffect(() => {
|
|
33328
|
+
const controller = new AbortController;
|
|
33329
|
+
setStatus("loading");
|
|
33330
|
+
setSearchError(undefined);
|
|
33331
|
+
const fetchResults = async () => {
|
|
33332
|
+
try {
|
|
33333
|
+
const results = await config3.source(searchTerm || undefined, {
|
|
33334
|
+
signal: controller.signal
|
|
33335
|
+
});
|
|
33336
|
+
if (!controller.signal.aborted) {
|
|
33337
|
+
setActive(undefined);
|
|
33338
|
+
setSearchError(undefined);
|
|
33339
|
+
setSearchResults(normalizeChoices(results));
|
|
33340
|
+
setStatus("idle");
|
|
33341
|
+
}
|
|
33342
|
+
} catch (error47) {
|
|
33343
|
+
if (!controller.signal.aborted && error47 instanceof Error) {
|
|
33344
|
+
setSearchError(error47.message);
|
|
33345
|
+
}
|
|
33346
|
+
}
|
|
33347
|
+
};
|
|
33348
|
+
fetchResults();
|
|
33349
|
+
return () => {
|
|
33350
|
+
controller.abort();
|
|
33351
|
+
};
|
|
33352
|
+
}, [searchTerm]);
|
|
33353
|
+
const selectedChoice = searchResults[active];
|
|
33354
|
+
useKeypress(async (key, rl) => {
|
|
33355
|
+
if (isEnterKey(key)) {
|
|
33356
|
+
if (selectedChoice) {
|
|
33357
|
+
setStatus("loading");
|
|
33358
|
+
const isValid3 = await validate2(selectedChoice.value);
|
|
33359
|
+
setStatus("idle");
|
|
33360
|
+
if (isValid3 === true) {
|
|
33361
|
+
setStatus("done");
|
|
33362
|
+
done(selectedChoice.value);
|
|
33363
|
+
} else if (selectedChoice.name === searchTerm) {
|
|
33364
|
+
setSearchError(isValid3 || "You must provide a valid value");
|
|
33365
|
+
} else {
|
|
33366
|
+
rl.write(selectedChoice.name);
|
|
33367
|
+
setSearchTerm(selectedChoice.name);
|
|
33368
|
+
}
|
|
33369
|
+
} else {
|
|
33370
|
+
rl.write(searchTerm);
|
|
33371
|
+
}
|
|
33372
|
+
} else if (isTabKey(key) && selectedChoice) {
|
|
33373
|
+
rl.clearLine(0);
|
|
33374
|
+
rl.write(selectedChoice.name);
|
|
33375
|
+
setSearchTerm(selectedChoice.name);
|
|
33376
|
+
} else if (status !== "loading" && (isUpKey(key) || isDownKey(key))) {
|
|
33377
|
+
rl.clearLine(0);
|
|
33378
|
+
if (isUpKey(key) && active !== bounds.first || isDownKey(key) && active !== bounds.last) {
|
|
33379
|
+
const offset = isUpKey(key) ? -1 : 1;
|
|
33380
|
+
let next = active;
|
|
33381
|
+
do {
|
|
33382
|
+
next = (next + offset + searchResults.length) % searchResults.length;
|
|
33383
|
+
} while (!isSelectable(searchResults[next]));
|
|
33384
|
+
setActive(next);
|
|
33385
|
+
}
|
|
33386
|
+
} else {
|
|
33387
|
+
setSearchTerm(rl.line);
|
|
33388
|
+
}
|
|
33389
|
+
});
|
|
33390
|
+
const message = theme.style.message(config3.message, status);
|
|
33391
|
+
const helpLine = theme.style.keysHelpTip([
|
|
33392
|
+
["↑↓", "navigate"],
|
|
33393
|
+
["⏎", "select"]
|
|
33394
|
+
]);
|
|
33395
|
+
const page = usePagination({
|
|
33396
|
+
items: searchResults,
|
|
33397
|
+
active,
|
|
33398
|
+
renderItem({ item, isActive }) {
|
|
33399
|
+
if (Separator.isSeparator(item)) {
|
|
33400
|
+
return ` ${item.separator}`;
|
|
33401
|
+
}
|
|
33402
|
+
if (item.disabled) {
|
|
33403
|
+
const disabledLabel = typeof item.disabled === "string" ? item.disabled : "(disabled)";
|
|
33404
|
+
return theme.style.disabled(`${item.name} ${disabledLabel}`);
|
|
33405
|
+
}
|
|
33406
|
+
const color = isActive ? theme.style.highlight : (x) => x;
|
|
33407
|
+
const cursor = isActive ? theme.icon.cursor : ` `;
|
|
33408
|
+
return color(`${cursor} ${item.name}`);
|
|
33409
|
+
},
|
|
33410
|
+
pageSize,
|
|
33411
|
+
loop: false
|
|
33412
|
+
});
|
|
33413
|
+
let error46;
|
|
33414
|
+
if (searchError) {
|
|
33415
|
+
error46 = theme.style.error(searchError);
|
|
33416
|
+
} else if (searchResults.length === 0 && searchTerm !== "" && status === "idle") {
|
|
33417
|
+
error46 = theme.style.error("No results found");
|
|
33418
|
+
}
|
|
33419
|
+
let searchStr;
|
|
33420
|
+
if (status === "done" && selectedChoice) {
|
|
33421
|
+
return [prefix, message, theme.style.answer(selectedChoice.short)].filter(Boolean).join(" ").trimEnd();
|
|
33422
|
+
} else {
|
|
33423
|
+
searchStr = theme.style.searchTerm(searchTerm);
|
|
33424
|
+
}
|
|
33425
|
+
const description = selectedChoice?.description;
|
|
33426
|
+
const header = [prefix, message, searchStr].filter(Boolean).join(" ").trimEnd();
|
|
33427
|
+
const body = [
|
|
33428
|
+
error46 ?? page,
|
|
33429
|
+
" ",
|
|
33430
|
+
description ? theme.style.description(description) : "",
|
|
33431
|
+
helpLine
|
|
33432
|
+
].filter(Boolean).join(`
|
|
33433
|
+
`).trimEnd();
|
|
33434
|
+
return [header, body];
|
|
33435
|
+
});
|
|
33436
|
+
});
|
|
33437
|
+
|
|
33438
|
+
// node_modules/@inquirer/select/dist/index.js
|
|
33439
|
+
import { styleText as styleText4 } from "node:util";
|
|
33440
|
+
function isSelectable2(item) {
|
|
33441
|
+
return !Separator.isSeparator(item) && !item.disabled;
|
|
33442
|
+
}
|
|
33443
|
+
function normalizeChoices2(choices) {
|
|
33444
|
+
return choices.map((choice) => {
|
|
33445
|
+
if (Separator.isSeparator(choice))
|
|
33446
|
+
return choice;
|
|
33447
|
+
if (typeof choice === "string") {
|
|
33448
|
+
return {
|
|
33449
|
+
value: choice,
|
|
33450
|
+
name: choice,
|
|
33451
|
+
short: choice,
|
|
33452
|
+
disabled: false
|
|
33453
|
+
};
|
|
33454
|
+
}
|
|
33455
|
+
const name = choice.name ?? String(choice.value);
|
|
33456
|
+
const normalizedChoice = {
|
|
33457
|
+
value: choice.value,
|
|
33458
|
+
name,
|
|
33459
|
+
short: choice.short ?? name,
|
|
33460
|
+
disabled: choice.disabled ?? false
|
|
33461
|
+
};
|
|
33462
|
+
if (choice.description) {
|
|
33463
|
+
normalizedChoice.description = choice.description;
|
|
33464
|
+
}
|
|
33465
|
+
return normalizedChoice;
|
|
33466
|
+
});
|
|
33467
|
+
}
|
|
33468
|
+
var selectTheme, dist_default5;
|
|
33469
|
+
var init_dist7 = __esm(() => {
|
|
33470
|
+
init_dist3();
|
|
33471
|
+
init_dist2();
|
|
33472
|
+
init_dist();
|
|
33473
|
+
selectTheme = {
|
|
33474
|
+
icon: { cursor: dist_default.pointer },
|
|
33475
|
+
style: {
|
|
33476
|
+
disabled: (text) => styleText4("dim", `- ${text}`),
|
|
33477
|
+
description: (text) => styleText4("cyan", text),
|
|
33478
|
+
keysHelpTip: (keys) => keys.map(([key, action]) => `${styleText4("bold", key)} ${styleText4("dim", action)}`).join(styleText4("dim", " • "))
|
|
33479
|
+
},
|
|
33480
|
+
indexMode: "hidden",
|
|
33481
|
+
keybindings: []
|
|
33482
|
+
};
|
|
33483
|
+
dist_default5 = createPrompt((config3, done) => {
|
|
33484
|
+
const { loop = true, pageSize = 7 } = config3;
|
|
33485
|
+
const theme = makeTheme(selectTheme, config3.theme);
|
|
33486
|
+
const { keybindings } = theme;
|
|
33487
|
+
const [status, setStatus] = useState("idle");
|
|
33488
|
+
const prefix = usePrefix({ status, theme });
|
|
33489
|
+
const searchTimeoutRef = useRef();
|
|
33490
|
+
const searchEnabled = !keybindings.includes("vim");
|
|
33491
|
+
const items = useMemo(() => normalizeChoices2(config3.choices), [config3.choices]);
|
|
33492
|
+
const bounds = useMemo(() => {
|
|
33493
|
+
const first = items.findIndex(isSelectable2);
|
|
33494
|
+
const last = items.findLastIndex(isSelectable2);
|
|
33495
|
+
if (first === -1) {
|
|
33496
|
+
throw new ValidationError("[select prompt] No selectable choices. All choices are disabled.");
|
|
33497
|
+
}
|
|
33498
|
+
return { first, last };
|
|
33499
|
+
}, [items]);
|
|
33500
|
+
const defaultItemIndex = useMemo(() => {
|
|
33501
|
+
if (!("default" in config3))
|
|
33502
|
+
return -1;
|
|
33503
|
+
return items.findIndex((item) => isSelectable2(item) && item.value === config3.default);
|
|
33504
|
+
}, [config3.default, items]);
|
|
33505
|
+
const [active, setActive] = useState(defaultItemIndex === -1 ? bounds.first : defaultItemIndex);
|
|
33506
|
+
const selectedChoice = items[active];
|
|
33507
|
+
useKeypress((key, rl) => {
|
|
33508
|
+
clearTimeout(searchTimeoutRef.current);
|
|
33509
|
+
if (isEnterKey(key)) {
|
|
33510
|
+
setStatus("done");
|
|
33511
|
+
done(selectedChoice.value);
|
|
33512
|
+
} else if (isUpKey(key, keybindings) || isDownKey(key, keybindings)) {
|
|
33513
|
+
rl.clearLine(0);
|
|
33514
|
+
if (loop || isUpKey(key, keybindings) && active !== bounds.first || isDownKey(key, keybindings) && active !== bounds.last) {
|
|
33515
|
+
const offset = isUpKey(key, keybindings) ? -1 : 1;
|
|
33516
|
+
let next = active;
|
|
33517
|
+
do {
|
|
33518
|
+
next = (next + offset + items.length) % items.length;
|
|
33519
|
+
} while (!isSelectable2(items[next]));
|
|
33520
|
+
setActive(next);
|
|
33521
|
+
}
|
|
33522
|
+
} else if (isNumberKey(key) && !Number.isNaN(Number(rl.line))) {
|
|
33523
|
+
const selectedIndex = Number(rl.line) - 1;
|
|
33524
|
+
let selectableIndex = -1;
|
|
33525
|
+
const position = items.findIndex((item2) => {
|
|
33526
|
+
if (Separator.isSeparator(item2))
|
|
33527
|
+
return false;
|
|
33528
|
+
selectableIndex++;
|
|
33529
|
+
return selectableIndex === selectedIndex;
|
|
33530
|
+
});
|
|
33531
|
+
const item = items[position];
|
|
33532
|
+
if (item != null && isSelectable2(item)) {
|
|
33533
|
+
setActive(position);
|
|
33534
|
+
}
|
|
33535
|
+
searchTimeoutRef.current = setTimeout(() => {
|
|
33536
|
+
rl.clearLine(0);
|
|
33537
|
+
}, 700);
|
|
33538
|
+
} else if (isBackspaceKey(key)) {
|
|
33539
|
+
rl.clearLine(0);
|
|
33540
|
+
} else if (searchEnabled) {
|
|
33541
|
+
const searchTerm = rl.line.toLowerCase();
|
|
33542
|
+
const matchIndex = items.findIndex((item) => {
|
|
33543
|
+
if (Separator.isSeparator(item) || !isSelectable2(item))
|
|
33544
|
+
return false;
|
|
33545
|
+
return item.name.toLowerCase().startsWith(searchTerm);
|
|
33546
|
+
});
|
|
33547
|
+
if (matchIndex !== -1) {
|
|
33548
|
+
setActive(matchIndex);
|
|
33549
|
+
}
|
|
33550
|
+
searchTimeoutRef.current = setTimeout(() => {
|
|
33551
|
+
rl.clearLine(0);
|
|
33552
|
+
}, 700);
|
|
33553
|
+
}
|
|
33554
|
+
});
|
|
33555
|
+
useEffect(() => () => {
|
|
33556
|
+
clearTimeout(searchTimeoutRef.current);
|
|
33557
|
+
}, []);
|
|
33558
|
+
const message = theme.style.message(config3.message, status);
|
|
33559
|
+
const helpLine = theme.style.keysHelpTip([
|
|
33560
|
+
["↑↓", "navigate"],
|
|
33561
|
+
["⏎", "select"]
|
|
33562
|
+
]);
|
|
33563
|
+
let separatorCount = 0;
|
|
33564
|
+
const page = usePagination({
|
|
33565
|
+
items,
|
|
33566
|
+
active,
|
|
33567
|
+
renderItem({ item, isActive, index }) {
|
|
33568
|
+
if (Separator.isSeparator(item)) {
|
|
33569
|
+
separatorCount++;
|
|
33570
|
+
return ` ${item.separator}`;
|
|
33571
|
+
}
|
|
33572
|
+
const indexLabel = theme.indexMode === "number" ? `${index + 1 - separatorCount}. ` : "";
|
|
33573
|
+
if (item.disabled) {
|
|
33574
|
+
const disabledLabel = typeof item.disabled === "string" ? item.disabled : "(disabled)";
|
|
33575
|
+
return theme.style.disabled(`${indexLabel}${item.name} ${disabledLabel}`);
|
|
33576
|
+
}
|
|
33577
|
+
const color = isActive ? theme.style.highlight : (x) => x;
|
|
33578
|
+
const cursor = isActive ? theme.icon.cursor : ` `;
|
|
33579
|
+
return color(`${cursor} ${indexLabel}${item.name}`);
|
|
33580
|
+
},
|
|
33581
|
+
pageSize,
|
|
33582
|
+
loop
|
|
33583
|
+
});
|
|
33584
|
+
if (status === "done") {
|
|
33585
|
+
return [prefix, message, theme.style.answer(selectedChoice.short)].filter(Boolean).join(" ");
|
|
33586
|
+
}
|
|
33587
|
+
const { description } = selectedChoice;
|
|
33588
|
+
const lines = [
|
|
33589
|
+
[prefix, message].filter(Boolean).join(" "),
|
|
33590
|
+
page,
|
|
33591
|
+
" ",
|
|
33592
|
+
description ? theme.style.description(description) : "",
|
|
33593
|
+
helpLine
|
|
33594
|
+
].filter(Boolean).join(`
|
|
33595
|
+
`).trimEnd();
|
|
33596
|
+
return `${lines}${cursorHide}`;
|
|
33597
|
+
});
|
|
33598
|
+
});
|
|
33599
|
+
|
|
33600
|
+
// node_modules/@inquirer/prompts/dist/index.js
|
|
33601
|
+
var init_dist8 = __esm(() => {
|
|
33602
|
+
init_dist4();
|
|
33603
|
+
init_dist5();
|
|
33604
|
+
init_dist6();
|
|
33605
|
+
init_dist7();
|
|
33606
|
+
});
|
|
33607
|
+
|
|
33608
|
+
// src/model-selector.ts
|
|
33609
|
+
var exports_model_selector = {};
|
|
33610
|
+
__export(exports_model_selector, {
|
|
33611
|
+
selectProfile: () => selectProfile,
|
|
33612
|
+
selectModelsForProfile: () => selectModelsForProfile,
|
|
33613
|
+
selectModel: () => selectModel,
|
|
33614
|
+
promptForProfileName: () => promptForProfileName,
|
|
33615
|
+
promptForProfileDescription: () => promptForProfileDescription,
|
|
33616
|
+
promptForApiKey: () => promptForApiKey,
|
|
33617
|
+
confirmAction: () => confirmAction
|
|
33618
|
+
});
|
|
33619
|
+
import { readFileSync as readFileSync3, writeFileSync as writeFileSync3, existsSync as existsSync3 } from "node:fs";
|
|
33620
|
+
import { join as join3, dirname as dirname2 } from "node:path";
|
|
33621
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
33622
|
+
function loadRecommendedModels2() {
|
|
33623
|
+
if (existsSync3(RECOMMENDED_MODELS_JSON_PATH)) {
|
|
33624
|
+
try {
|
|
33625
|
+
const content = readFileSync3(RECOMMENDED_MODELS_JSON_PATH, "utf-8");
|
|
33626
|
+
const data = JSON.parse(content);
|
|
33627
|
+
return data.models || [];
|
|
33628
|
+
} catch {
|
|
33629
|
+
return [];
|
|
33630
|
+
}
|
|
33631
|
+
}
|
|
33632
|
+
return [];
|
|
33633
|
+
}
|
|
33634
|
+
async function fetchAllModels(forceUpdate = false) {
|
|
33635
|
+
if (!forceUpdate && existsSync3(ALL_MODELS_JSON_PATH)) {
|
|
33636
|
+
try {
|
|
33637
|
+
const cacheData = JSON.parse(readFileSync3(ALL_MODELS_JSON_PATH, "utf-8"));
|
|
33638
|
+
const lastUpdated = new Date(cacheData.lastUpdated);
|
|
33639
|
+
const now = new Date;
|
|
33640
|
+
const ageInDays = (now.getTime() - lastUpdated.getTime()) / (1000 * 60 * 60 * 24);
|
|
33641
|
+
if (ageInDays <= CACHE_MAX_AGE_DAYS2) {
|
|
33642
|
+
return cacheData.models;
|
|
33643
|
+
}
|
|
33644
|
+
} catch {}
|
|
33645
|
+
}
|
|
33646
|
+
console.log("Fetching models from OpenRouter...");
|
|
33647
|
+
try {
|
|
33648
|
+
const response = await fetch("https://openrouter.ai/api/v1/models");
|
|
33649
|
+
if (!response.ok)
|
|
33650
|
+
throw new Error(`API returned ${response.status}`);
|
|
33651
|
+
const data = await response.json();
|
|
33652
|
+
const models = data.data;
|
|
33653
|
+
writeFileSync3(ALL_MODELS_JSON_PATH, JSON.stringify({
|
|
33654
|
+
lastUpdated: new Date().toISOString(),
|
|
33655
|
+
models
|
|
33656
|
+
}), "utf-8");
|
|
33657
|
+
console.log(`Cached ${models.length} models`);
|
|
33658
|
+
return models;
|
|
33659
|
+
} catch (error46) {
|
|
33660
|
+
console.error(`Failed to fetch models: ${error46}`);
|
|
33661
|
+
return [];
|
|
33662
|
+
}
|
|
33663
|
+
}
|
|
33664
|
+
function toModelInfo(model) {
|
|
33665
|
+
const provider = model.id.split("/")[0];
|
|
33666
|
+
const contextLen = model.context_length || model.top_provider?.context_length || 0;
|
|
33667
|
+
const promptPrice = parseFloat(model.pricing?.prompt || "0");
|
|
33668
|
+
const completionPrice = parseFloat(model.pricing?.completion || "0");
|
|
33669
|
+
const isFree = promptPrice === 0 && completionPrice === 0;
|
|
33670
|
+
let pricingStr = "N/A";
|
|
33671
|
+
if (isFree) {
|
|
33672
|
+
pricingStr = "FREE";
|
|
33673
|
+
} else if (model.pricing) {
|
|
33674
|
+
const avgPrice = (promptPrice + completionPrice) / 2;
|
|
33675
|
+
if (avgPrice < 0.001) {
|
|
33676
|
+
pricingStr = `$${(avgPrice * 1e6).toFixed(2)}/1M`;
|
|
33677
|
+
} else {
|
|
33678
|
+
pricingStr = `$${avgPrice.toFixed(4)}/1K`;
|
|
33679
|
+
}
|
|
33680
|
+
}
|
|
33681
|
+
return {
|
|
33682
|
+
id: model.id,
|
|
33683
|
+
name: model.name || model.id,
|
|
33684
|
+
description: model.description || "",
|
|
33685
|
+
provider: provider.charAt(0).toUpperCase() + provider.slice(1),
|
|
33686
|
+
pricing: {
|
|
33687
|
+
input: model.pricing?.prompt || "N/A",
|
|
33688
|
+
output: model.pricing?.completion || "N/A",
|
|
33689
|
+
average: pricingStr
|
|
33690
|
+
},
|
|
33691
|
+
context: contextLen > 0 ? `${Math.round(contextLen / 1000)}K` : "N/A",
|
|
33692
|
+
contextLength: contextLen,
|
|
33693
|
+
supportsTools: (model.supported_parameters || []).includes("tools"),
|
|
33694
|
+
supportsReasoning: (model.supported_parameters || []).includes("reasoning"),
|
|
33695
|
+
supportsVision: (model.architecture?.input_modalities || []).includes("image"),
|
|
33696
|
+
isFree
|
|
33697
|
+
};
|
|
33698
|
+
}
|
|
33699
|
+
async function getFreeModels() {
|
|
33700
|
+
const allModels = await fetchAllModels();
|
|
33701
|
+
const freeModels = allModels.filter((model) => {
|
|
33702
|
+
const promptPrice = parseFloat(model.pricing?.prompt || "0");
|
|
33703
|
+
const completionPrice = parseFloat(model.pricing?.completion || "0");
|
|
33704
|
+
const isFree = promptPrice === 0 && completionPrice === 0;
|
|
33705
|
+
if (!isFree)
|
|
33706
|
+
return false;
|
|
33707
|
+
const provider = model.id.split("/")[0].toLowerCase();
|
|
33708
|
+
return TRUSTED_FREE_PROVIDERS.includes(provider);
|
|
33709
|
+
});
|
|
33710
|
+
freeModels.sort((a, b) => {
|
|
33711
|
+
const contextA = a.context_length || a.top_provider?.context_length || 0;
|
|
33712
|
+
const contextB = b.context_length || b.top_provider?.context_length || 0;
|
|
33713
|
+
return contextB - contextA;
|
|
33714
|
+
});
|
|
33715
|
+
const seenBase = new Set;
|
|
33716
|
+
const dedupedModels = freeModels.filter((model) => {
|
|
33717
|
+
const baseId = model.id.replace(/:free$/, "");
|
|
33718
|
+
if (seenBase.has(baseId))
|
|
33719
|
+
return false;
|
|
33720
|
+
seenBase.add(baseId);
|
|
33721
|
+
return true;
|
|
33722
|
+
});
|
|
33723
|
+
return dedupedModels.slice(0, 20).map(toModelInfo);
|
|
33724
|
+
}
|
|
33725
|
+
async function getAllModelsForSearch() {
|
|
33726
|
+
const allModels = await fetchAllModels();
|
|
33727
|
+
return allModels.map(toModelInfo);
|
|
33728
|
+
}
|
|
33729
|
+
function formatModelChoice(model) {
|
|
33730
|
+
const caps = [
|
|
33731
|
+
model.supportsTools ? "T" : "",
|
|
33732
|
+
model.supportsReasoning ? "R" : "",
|
|
33733
|
+
model.supportsVision ? "V" : ""
|
|
33734
|
+
].filter(Boolean).join("");
|
|
33735
|
+
const capsStr = caps ? ` [${caps}]` : "";
|
|
33736
|
+
const priceStr = model.pricing?.average || "N/A";
|
|
33737
|
+
const ctxStr = model.context || "N/A";
|
|
33738
|
+
return `${model.id} (${model.provider}, ${priceStr}, ${ctxStr}${capsStr})`;
|
|
33739
|
+
}
|
|
33740
|
+
function fuzzyMatch(text, query) {
|
|
33741
|
+
const lowerText = text.toLowerCase();
|
|
33742
|
+
const lowerQuery = query.toLowerCase();
|
|
33743
|
+
if (lowerText === lowerQuery)
|
|
33744
|
+
return 1;
|
|
33745
|
+
if (lowerText.includes(lowerQuery))
|
|
33746
|
+
return 0.8;
|
|
33747
|
+
let queryIdx = 0;
|
|
33748
|
+
let score = 0;
|
|
33749
|
+
for (let i = 0;i < lowerText.length && queryIdx < lowerQuery.length; i++) {
|
|
33750
|
+
if (lowerText[i] === lowerQuery[queryIdx]) {
|
|
33751
|
+
score++;
|
|
33752
|
+
queryIdx++;
|
|
33753
|
+
}
|
|
33754
|
+
}
|
|
33755
|
+
return queryIdx === lowerQuery.length ? score / lowerQuery.length * 0.6 : 0;
|
|
33756
|
+
}
|
|
33757
|
+
async function selectModel(options = {}) {
|
|
33758
|
+
const { freeOnly = false, recommended = true, message } = options;
|
|
33759
|
+
let models;
|
|
33760
|
+
if (freeOnly) {
|
|
33761
|
+
models = await getFreeModels();
|
|
33762
|
+
if (models.length === 0) {
|
|
33763
|
+
throw new Error("No free models available");
|
|
33764
|
+
}
|
|
33765
|
+
} else if (recommended) {
|
|
33766
|
+
const recommendedModels = loadRecommendedModels2();
|
|
33767
|
+
if (recommendedModels.length > 0) {
|
|
33768
|
+
models = recommendedModels;
|
|
33769
|
+
} else {
|
|
33770
|
+
const allModels = await getAllModelsForSearch();
|
|
33771
|
+
models = allModels.slice(0, 20);
|
|
33772
|
+
}
|
|
33773
|
+
} else {
|
|
33774
|
+
models = await getAllModelsForSearch();
|
|
33775
|
+
}
|
|
33776
|
+
const promptMessage = message || (freeOnly ? "Select a FREE model (type to search):" : "Select a model (type to search):");
|
|
33777
|
+
const selected = await dist_default4({
|
|
33778
|
+
message: promptMessage,
|
|
33779
|
+
source: async (term) => {
|
|
33780
|
+
if (!term) {
|
|
33781
|
+
return models.slice(0, 15).map((m) => ({
|
|
33782
|
+
name: formatModelChoice(m),
|
|
33783
|
+
value: m.id,
|
|
33784
|
+
description: m.description?.slice(0, 80)
|
|
33785
|
+
}));
|
|
33786
|
+
}
|
|
33787
|
+
const results = models.map((m) => ({
|
|
33788
|
+
model: m,
|
|
33789
|
+
score: Math.max(fuzzyMatch(m.id, term), fuzzyMatch(m.name, term), fuzzyMatch(m.provider, term) * 0.5)
|
|
33790
|
+
})).filter((r) => r.score > 0.1).sort((a, b) => b.score - a.score).slice(0, 15);
|
|
33791
|
+
return results.map((r) => ({
|
|
33792
|
+
name: formatModelChoice(r.model),
|
|
33793
|
+
value: r.model.id,
|
|
33794
|
+
description: r.model.description?.slice(0, 80)
|
|
33795
|
+
}));
|
|
33796
|
+
}
|
|
33797
|
+
});
|
|
33798
|
+
return selected;
|
|
33799
|
+
}
|
|
33800
|
+
async function selectModelsForProfile() {
|
|
33801
|
+
const allModels = await getAllModelsForSearch();
|
|
33802
|
+
console.log(`
|
|
33803
|
+
Configure models for each Claude tier:
|
|
33804
|
+
`);
|
|
33805
|
+
const selectForTier = async (tier, description) => {
|
|
33806
|
+
const useCustom = await dist_default2({
|
|
33807
|
+
message: `Configure ${tier} model? (${description})`,
|
|
33808
|
+
default: true
|
|
33809
|
+
});
|
|
33810
|
+
if (!useCustom)
|
|
33811
|
+
return;
|
|
33812
|
+
return dist_default4({
|
|
33813
|
+
message: `Select model for ${tier}:`,
|
|
33814
|
+
source: async (term) => {
|
|
33815
|
+
let filtered = allModels;
|
|
33816
|
+
if (term) {
|
|
33817
|
+
filtered = allModels.map((m) => ({
|
|
33818
|
+
model: m,
|
|
33819
|
+
score: Math.max(fuzzyMatch(m.id, term), fuzzyMatch(m.name, term), fuzzyMatch(m.provider, term) * 0.5)
|
|
33820
|
+
})).filter((r) => r.score > 0.1).sort((a, b) => b.score - a.score).slice(0, 15).map((r) => r.model);
|
|
33821
|
+
} else {
|
|
33822
|
+
filtered = filtered.slice(0, 15);
|
|
33823
|
+
}
|
|
33824
|
+
return filtered.map((m) => ({
|
|
33825
|
+
name: formatModelChoice(m),
|
|
33826
|
+
value: m.id,
|
|
33827
|
+
description: m.description?.slice(0, 80)
|
|
33828
|
+
}));
|
|
33829
|
+
}
|
|
33830
|
+
});
|
|
33831
|
+
};
|
|
33832
|
+
const opus = await selectForTier("Opus", "Most capable, used for complex reasoning");
|
|
33833
|
+
const sonnet = await selectForTier("Sonnet", "Balanced, used for general tasks");
|
|
33834
|
+
const haiku = await selectForTier("Haiku", "Fast & cheap, used for simple tasks");
|
|
33835
|
+
const subagent = await selectForTier("Subagent", "Used for spawned sub-agents");
|
|
33836
|
+
return { opus, sonnet, haiku, subagent };
|
|
33837
|
+
}
|
|
33838
|
+
async function promptForApiKey() {
|
|
33839
|
+
console.log(`
|
|
33840
|
+
OpenRouter API Key Required`);
|
|
33841
|
+
console.log(`Get your free API key from: https://openrouter.ai/keys
|
|
33842
|
+
`);
|
|
33843
|
+
const apiKey = await dist_default3({
|
|
33844
|
+
message: "Enter your OpenRouter API key:",
|
|
33845
|
+
validate: (value) => {
|
|
33846
|
+
if (!value.trim()) {
|
|
33847
|
+
return "API key cannot be empty";
|
|
33848
|
+
}
|
|
33849
|
+
if (!value.startsWith("sk-or-")) {
|
|
33850
|
+
return 'API key should start with "sk-or-"';
|
|
33851
|
+
}
|
|
33852
|
+
return true;
|
|
33853
|
+
}
|
|
33854
|
+
});
|
|
33855
|
+
return apiKey;
|
|
33856
|
+
}
|
|
33857
|
+
async function promptForProfileName(existing = []) {
|
|
33858
|
+
const name = await dist_default3({
|
|
33859
|
+
message: "Enter profile name:",
|
|
33860
|
+
validate: (value) => {
|
|
33861
|
+
const trimmed = value.trim();
|
|
33862
|
+
if (!trimmed) {
|
|
33863
|
+
return "Profile name cannot be empty";
|
|
33864
|
+
}
|
|
33865
|
+
if (!/^[a-z0-9-_]+$/i.test(trimmed)) {
|
|
33866
|
+
return "Profile name can only contain letters, numbers, hyphens, and underscores";
|
|
33867
|
+
}
|
|
33868
|
+
if (existing.includes(trimmed)) {
|
|
33869
|
+
return `Profile "${trimmed}" already exists`;
|
|
33870
|
+
}
|
|
33871
|
+
return true;
|
|
33872
|
+
}
|
|
33873
|
+
});
|
|
33874
|
+
return name.trim();
|
|
33875
|
+
}
|
|
33876
|
+
async function promptForProfileDescription() {
|
|
33877
|
+
const description = await dist_default3({
|
|
33878
|
+
message: "Enter profile description (optional):"
|
|
33879
|
+
});
|
|
33880
|
+
return description.trim();
|
|
33881
|
+
}
|
|
33882
|
+
async function selectProfile(profiles) {
|
|
33883
|
+
const selected = await dist_default5({
|
|
33884
|
+
message: "Select a profile:",
|
|
33885
|
+
choices: profiles.map((p) => ({
|
|
33886
|
+
name: p.isDefault ? `${p.name} (default)` : p.name,
|
|
33887
|
+
value: p.name,
|
|
33888
|
+
description: p.description
|
|
33889
|
+
}))
|
|
33890
|
+
});
|
|
33891
|
+
return selected;
|
|
33892
|
+
}
|
|
33893
|
+
async function confirmAction(message) {
|
|
33894
|
+
return dist_default2({ message, default: false });
|
|
33895
|
+
}
|
|
33896
|
+
var __filename3, __dirname3, ALL_MODELS_JSON_PATH, RECOMMENDED_MODELS_JSON_PATH, CACHE_MAX_AGE_DAYS2 = 2, TRUSTED_FREE_PROVIDERS;
|
|
33897
|
+
var init_model_selector = __esm(() => {
|
|
33898
|
+
init_dist8();
|
|
33899
|
+
__filename3 = fileURLToPath2(import.meta.url);
|
|
33900
|
+
__dirname3 = dirname2(__filename3);
|
|
33901
|
+
ALL_MODELS_JSON_PATH = join3(__dirname3, "../all-models.json");
|
|
33902
|
+
RECOMMENDED_MODELS_JSON_PATH = join3(__dirname3, "../recommended-models.json");
|
|
33903
|
+
TRUSTED_FREE_PROVIDERS = [
|
|
33904
|
+
"google",
|
|
33905
|
+
"openai",
|
|
33906
|
+
"x-ai",
|
|
33907
|
+
"deepseek",
|
|
33908
|
+
"qwen",
|
|
33909
|
+
"alibaba",
|
|
33910
|
+
"meta-llama",
|
|
33911
|
+
"microsoft",
|
|
33912
|
+
"mistralai",
|
|
33913
|
+
"nvidia",
|
|
33914
|
+
"cohere"
|
|
33915
|
+
];
|
|
33916
|
+
});
|
|
33917
|
+
|
|
33918
|
+
// src/profile-commands.ts
|
|
33919
|
+
var exports_profile_commands = {};
|
|
33920
|
+
__export(exports_profile_commands, {
|
|
33921
|
+
profileUseCommand: () => profileUseCommand,
|
|
33922
|
+
profileShowCommand: () => profileShowCommand,
|
|
33923
|
+
profileRemoveCommand: () => profileRemoveCommand,
|
|
33924
|
+
profileListCommand: () => profileListCommand,
|
|
33925
|
+
profileEditCommand: () => profileEditCommand,
|
|
33926
|
+
profileCommand: () => profileCommand,
|
|
33927
|
+
profileAddCommand: () => profileAddCommand,
|
|
33928
|
+
initCommand: () => initCommand
|
|
33929
|
+
});
|
|
33930
|
+
async function initCommand() {
|
|
33931
|
+
console.log(`
|
|
33932
|
+
${BOLD}${CYAN}Claudish Setup Wizard${RESET}
|
|
33933
|
+
`);
|
|
33934
|
+
if (configExists()) {
|
|
33935
|
+
const overwrite = await dist_default2({
|
|
33936
|
+
message: "Configuration already exists. Do you want to reconfigure?",
|
|
33937
|
+
default: false
|
|
33938
|
+
});
|
|
33939
|
+
if (!overwrite) {
|
|
33940
|
+
console.log("Setup cancelled.");
|
|
33941
|
+
return;
|
|
33942
|
+
}
|
|
33943
|
+
}
|
|
33944
|
+
console.log(`${DIM}This wizard will help you set up Claudish with your preferred models.${RESET}
|
|
33945
|
+
`);
|
|
33946
|
+
console.log(`${BOLD}Step 1: Create your default profile${RESET}
|
|
33947
|
+
`);
|
|
33948
|
+
const profileName = await promptForProfileName([]);
|
|
33949
|
+
const description = await promptForProfileDescription();
|
|
33950
|
+
console.log(`
|
|
33951
|
+
${BOLD}Step 2: Select models for each Claude tier${RESET}`);
|
|
33952
|
+
console.log(`${DIM}These models will be used when Claude Code requests specific model types.${RESET}
|
|
33953
|
+
`);
|
|
33954
|
+
const models = await selectModelsForProfile();
|
|
33955
|
+
const profile = createProfile(profileName, models, description);
|
|
33956
|
+
setDefaultProfile(profileName);
|
|
33957
|
+
console.log(`
|
|
33958
|
+
${GREEN}✓${RESET} Configuration saved to: ${CYAN}${getConfigPath()}${RESET}`);
|
|
33959
|
+
console.log(`
|
|
33960
|
+
${BOLD}Profile created:${RESET}`);
|
|
33961
|
+
printProfile(profile, true);
|
|
33962
|
+
console.log(`
|
|
33963
|
+
${BOLD}Usage:${RESET}`);
|
|
33964
|
+
console.log(` ${CYAN}claudish${RESET} # Use default profile`);
|
|
33965
|
+
console.log(` ${CYAN}claudish -p ${profileName}${RESET} # Use this profile explicitly`);
|
|
33966
|
+
console.log(` ${CYAN}claudish profile add${RESET} # Add another profile`);
|
|
33967
|
+
console.log("");
|
|
33968
|
+
}
|
|
33969
|
+
async function profileListCommand() {
|
|
33970
|
+
const profiles = listProfiles();
|
|
33971
|
+
const config3 = loadConfig();
|
|
33972
|
+
if (profiles.length === 0) {
|
|
33973
|
+
console.log("No profiles found. Run 'claudish init' to create one.");
|
|
33974
|
+
return;
|
|
33975
|
+
}
|
|
33976
|
+
console.log(`
|
|
33977
|
+
${BOLD}Claudish Profiles${RESET}
|
|
33978
|
+
`);
|
|
33979
|
+
console.log(`${DIM}Config: ${getConfigPath()}${RESET}
|
|
33980
|
+
`);
|
|
33981
|
+
for (const profile of profiles) {
|
|
33982
|
+
const isDefault = profile.name === config3.defaultProfile;
|
|
33983
|
+
printProfile(profile, isDefault);
|
|
33984
|
+
console.log("");
|
|
33985
|
+
}
|
|
33986
|
+
}
|
|
33987
|
+
async function profileAddCommand() {
|
|
33988
|
+
console.log(`
|
|
33989
|
+
${BOLD}${CYAN}Add New Profile${RESET}
|
|
33990
|
+
`);
|
|
33991
|
+
const existingNames = getProfileNames();
|
|
33992
|
+
const name = await promptForProfileName(existingNames);
|
|
33993
|
+
const description = await promptForProfileDescription();
|
|
33994
|
+
console.log(`
|
|
33995
|
+
${BOLD}Select models for this profile:${RESET}
|
|
33996
|
+
`);
|
|
33997
|
+
const models = await selectModelsForProfile();
|
|
33998
|
+
const profile = createProfile(name, models, description);
|
|
33999
|
+
console.log(`
|
|
34000
|
+
${GREEN}✓${RESET} Profile "${name}" created.`);
|
|
34001
|
+
printProfile(profile, false);
|
|
34002
|
+
const setAsDefault = await dist_default2({
|
|
34003
|
+
message: "Set this profile as default?",
|
|
34004
|
+
default: false
|
|
34005
|
+
});
|
|
34006
|
+
if (setAsDefault) {
|
|
34007
|
+
setDefaultProfile(name);
|
|
34008
|
+
console.log(`${GREEN}✓${RESET} "${name}" is now the default profile.`);
|
|
34009
|
+
}
|
|
34010
|
+
}
|
|
34011
|
+
async function profileRemoveCommand(name) {
|
|
34012
|
+
const profiles = getProfileNames();
|
|
34013
|
+
if (profiles.length === 0) {
|
|
34014
|
+
console.log("No profiles to remove.");
|
|
34015
|
+
return;
|
|
34016
|
+
}
|
|
34017
|
+
if (profiles.length === 1) {
|
|
34018
|
+
console.log("Cannot remove the last profile. Create another one first.");
|
|
34019
|
+
return;
|
|
34020
|
+
}
|
|
34021
|
+
let profileName = name;
|
|
34022
|
+
if (!profileName) {
|
|
34023
|
+
const profileList = listProfiles();
|
|
34024
|
+
profileName = await selectProfile(profileList.map((p) => ({
|
|
34025
|
+
name: p.name,
|
|
34026
|
+
description: p.description,
|
|
34027
|
+
isDefault: p.name === loadConfig().defaultProfile
|
|
34028
|
+
})));
|
|
34029
|
+
}
|
|
34030
|
+
const profile = getProfile(profileName);
|
|
34031
|
+
if (!profile) {
|
|
34032
|
+
console.log(`Profile "${profileName}" not found.`);
|
|
34033
|
+
return;
|
|
34034
|
+
}
|
|
34035
|
+
const confirmed = await confirmAction(`Are you sure you want to delete profile "${profileName}"?`);
|
|
34036
|
+
if (!confirmed) {
|
|
34037
|
+
console.log("Cancelled.");
|
|
34038
|
+
return;
|
|
34039
|
+
}
|
|
34040
|
+
try {
|
|
34041
|
+
deleteProfile(profileName);
|
|
34042
|
+
console.log(`${GREEN}✓${RESET} Profile "${profileName}" deleted.`);
|
|
34043
|
+
} catch (error46) {
|
|
34044
|
+
console.error(`Error: ${error46}`);
|
|
34045
|
+
}
|
|
34046
|
+
}
|
|
34047
|
+
async function profileUseCommand(name) {
|
|
34048
|
+
const profiles = getProfileNames();
|
|
34049
|
+
if (profiles.length === 0) {
|
|
34050
|
+
console.log("No profiles found. Run 'claudish init' to create one.");
|
|
34051
|
+
return;
|
|
34052
|
+
}
|
|
34053
|
+
let profileName = name;
|
|
34054
|
+
if (!profileName) {
|
|
34055
|
+
const profileList = listProfiles();
|
|
34056
|
+
profileName = await selectProfile(profileList.map((p) => ({
|
|
34057
|
+
name: p.name,
|
|
34058
|
+
description: p.description,
|
|
34059
|
+
isDefault: p.name === loadConfig().defaultProfile
|
|
34060
|
+
})));
|
|
34061
|
+
}
|
|
34062
|
+
const profile = getProfile(profileName);
|
|
34063
|
+
if (!profile) {
|
|
34064
|
+
console.log(`Profile "${profileName}" not found.`);
|
|
34065
|
+
return;
|
|
34066
|
+
}
|
|
34067
|
+
setDefaultProfile(profileName);
|
|
34068
|
+
console.log(`${GREEN}✓${RESET} "${profileName}" is now the default profile.`);
|
|
34069
|
+
}
|
|
34070
|
+
async function profileShowCommand(name) {
|
|
34071
|
+
let profileName = name;
|
|
34072
|
+
if (!profileName) {
|
|
34073
|
+
const config4 = loadConfig();
|
|
34074
|
+
profileName = config4.defaultProfile;
|
|
34075
|
+
}
|
|
34076
|
+
const profile = getProfile(profileName);
|
|
34077
|
+
if (!profile) {
|
|
34078
|
+
console.log(`Profile "${profileName}" not found.`);
|
|
34079
|
+
return;
|
|
34080
|
+
}
|
|
34081
|
+
const config3 = loadConfig();
|
|
34082
|
+
const isDefault = profileName === config3.defaultProfile;
|
|
34083
|
+
console.log("");
|
|
34084
|
+
printProfile(profile, isDefault, true);
|
|
34085
|
+
}
|
|
34086
|
+
async function profileEditCommand(name) {
|
|
34087
|
+
const profiles = getProfileNames();
|
|
34088
|
+
if (profiles.length === 0) {
|
|
34089
|
+
console.log("No profiles found. Run 'claudish init' to create one.");
|
|
34090
|
+
return;
|
|
34091
|
+
}
|
|
34092
|
+
let profileName = name;
|
|
34093
|
+
if (!profileName) {
|
|
34094
|
+
const profileList = listProfiles();
|
|
34095
|
+
profileName = await selectProfile(profileList.map((p) => ({
|
|
34096
|
+
name: p.name,
|
|
34097
|
+
description: p.description,
|
|
34098
|
+
isDefault: p.name === loadConfig().defaultProfile
|
|
34099
|
+
})));
|
|
34100
|
+
}
|
|
34101
|
+
const profile = getProfile(profileName);
|
|
34102
|
+
if (!profile) {
|
|
34103
|
+
console.log(`Profile "${profileName}" not found.`);
|
|
34104
|
+
return;
|
|
34105
|
+
}
|
|
34106
|
+
console.log(`
|
|
34107
|
+
${BOLD}Editing profile: ${profileName}${RESET}
|
|
34108
|
+
`);
|
|
34109
|
+
console.log(`${DIM}Current models:${RESET}`);
|
|
34110
|
+
printModelMapping(profile.models);
|
|
34111
|
+
console.log("");
|
|
34112
|
+
const whatToEdit = await dist_default5({
|
|
34113
|
+
message: "What do you want to edit?",
|
|
34114
|
+
choices: [
|
|
34115
|
+
{ name: "All models", value: "all" },
|
|
34116
|
+
{ name: "Opus model only", value: "opus" },
|
|
34117
|
+
{ name: "Sonnet model only", value: "sonnet" },
|
|
34118
|
+
{ name: "Haiku model only", value: "haiku" },
|
|
34119
|
+
{ name: "Subagent model only", value: "subagent" },
|
|
34120
|
+
{ name: "Description", value: "description" },
|
|
34121
|
+
{ name: "Cancel", value: "cancel" }
|
|
34122
|
+
]
|
|
34123
|
+
});
|
|
34124
|
+
if (whatToEdit === "cancel") {
|
|
34125
|
+
return;
|
|
34126
|
+
}
|
|
34127
|
+
if (whatToEdit === "description") {
|
|
34128
|
+
const newDescription = await promptForProfileDescription();
|
|
34129
|
+
profile.description = newDescription;
|
|
34130
|
+
setProfile(profile);
|
|
34131
|
+
console.log(`${GREEN}✓${RESET} Description updated.`);
|
|
34132
|
+
return;
|
|
34133
|
+
}
|
|
34134
|
+
if (whatToEdit === "all") {
|
|
34135
|
+
const models = await selectModelsForProfile();
|
|
34136
|
+
profile.models = { ...profile.models, ...models };
|
|
34137
|
+
setProfile(profile);
|
|
34138
|
+
console.log(`${GREEN}✓${RESET} All models updated.`);
|
|
34139
|
+
return;
|
|
34140
|
+
}
|
|
34141
|
+
const tier = whatToEdit;
|
|
34142
|
+
const tierName = tier.charAt(0).toUpperCase() + tier.slice(1);
|
|
34143
|
+
const newModel = await selectModel({
|
|
34144
|
+
message: `Select new model for ${tierName}:`
|
|
34145
|
+
});
|
|
34146
|
+
profile.models[tier] = newModel;
|
|
34147
|
+
setProfile(profile);
|
|
34148
|
+
console.log(`${GREEN}✓${RESET} ${tierName} model updated to: ${newModel}`);
|
|
34149
|
+
}
|
|
34150
|
+
function printProfile(profile, isDefault, verbose = false) {
|
|
34151
|
+
const defaultBadge = isDefault ? ` ${YELLOW}(default)${RESET}` : "";
|
|
34152
|
+
console.log(`${BOLD}${profile.name}${RESET}${defaultBadge}`);
|
|
34153
|
+
if (profile.description) {
|
|
34154
|
+
console.log(` ${DIM}${profile.description}${RESET}`);
|
|
34155
|
+
}
|
|
34156
|
+
printModelMapping(profile.models);
|
|
34157
|
+
if (verbose) {
|
|
34158
|
+
console.log(` ${DIM}Created: ${profile.createdAt}${RESET}`);
|
|
34159
|
+
console.log(` ${DIM}Updated: ${profile.updatedAt}${RESET}`);
|
|
34160
|
+
}
|
|
34161
|
+
}
|
|
34162
|
+
function printModelMapping(models) {
|
|
34163
|
+
console.log(` ${CYAN}opus${RESET}: ${models.opus || DIM + "not set" + RESET}`);
|
|
34164
|
+
console.log(` ${CYAN}sonnet${RESET}: ${models.sonnet || DIM + "not set" + RESET}`);
|
|
34165
|
+
console.log(` ${CYAN}haiku${RESET}: ${models.haiku || DIM + "not set" + RESET}`);
|
|
34166
|
+
if (models.subagent) {
|
|
34167
|
+
console.log(` ${CYAN}subagent${RESET}: ${models.subagent}`);
|
|
34168
|
+
}
|
|
34169
|
+
}
|
|
34170
|
+
async function profileCommand(args) {
|
|
34171
|
+
const subcommand = args[0];
|
|
34172
|
+
const name = args[1];
|
|
34173
|
+
switch (subcommand) {
|
|
34174
|
+
case "list":
|
|
34175
|
+
case "ls":
|
|
34176
|
+
await profileListCommand();
|
|
34177
|
+
break;
|
|
34178
|
+
case "add":
|
|
34179
|
+
case "new":
|
|
34180
|
+
case "create":
|
|
34181
|
+
await profileAddCommand();
|
|
34182
|
+
break;
|
|
34183
|
+
case "remove":
|
|
34184
|
+
case "rm":
|
|
34185
|
+
case "delete":
|
|
34186
|
+
await profileRemoveCommand(name);
|
|
34187
|
+
break;
|
|
34188
|
+
case "use":
|
|
34189
|
+
case "default":
|
|
34190
|
+
case "set":
|
|
34191
|
+
await profileUseCommand(name);
|
|
34192
|
+
break;
|
|
34193
|
+
case "show":
|
|
34194
|
+
case "view":
|
|
34195
|
+
await profileShowCommand(name);
|
|
34196
|
+
break;
|
|
34197
|
+
case "edit":
|
|
34198
|
+
await profileEditCommand(name);
|
|
34199
|
+
break;
|
|
34200
|
+
default:
|
|
34201
|
+
printProfileHelp();
|
|
34202
|
+
}
|
|
34203
|
+
}
|
|
34204
|
+
function printProfileHelp() {
|
|
34205
|
+
console.log(`
|
|
34206
|
+
${BOLD}Usage:${RESET} claudish profile <command> [options]
|
|
34207
|
+
|
|
34208
|
+
${BOLD}Commands:${RESET}
|
|
34209
|
+
${CYAN}list${RESET}, ${CYAN}ls${RESET} List all profiles
|
|
34210
|
+
${CYAN}add${RESET}, ${CYAN}new${RESET} Add a new profile
|
|
34211
|
+
${CYAN}remove${RESET} ${DIM}[name]${RESET} Remove a profile
|
|
34212
|
+
${CYAN}use${RESET} ${DIM}[name]${RESET} Set default profile
|
|
34213
|
+
${CYAN}show${RESET} ${DIM}[name]${RESET} Show profile details
|
|
34214
|
+
${CYAN}edit${RESET} ${DIM}[name]${RESET} Edit a profile
|
|
34215
|
+
|
|
34216
|
+
${BOLD}Examples:${RESET}
|
|
34217
|
+
claudish profile list
|
|
34218
|
+
claudish profile add
|
|
34219
|
+
claudish profile use frontend
|
|
34220
|
+
claudish profile remove debug
|
|
34221
|
+
`);
|
|
34222
|
+
}
|
|
34223
|
+
var RESET = "\x1B[0m", BOLD = "\x1B[1m", DIM = "\x1B[2m", GREEN = "\x1B[32m", YELLOW = "\x1B[33m", CYAN = "\x1B[36m";
|
|
34224
|
+
var init_profile_commands = __esm(() => {
|
|
34225
|
+
init_profile_config();
|
|
34226
|
+
init_model_selector();
|
|
34227
|
+
init_dist8();
|
|
34228
|
+
});
|
|
34229
|
+
|
|
31248
34230
|
// src/config.ts
|
|
31249
34231
|
var exports_config = {};
|
|
31250
34232
|
__export(exports_config, {
|
|
@@ -31337,29 +34319,85 @@ __export(exports_claude_runner, {
|
|
|
31337
34319
|
checkClaudeInstalled: () => checkClaudeInstalled
|
|
31338
34320
|
});
|
|
31339
34321
|
import { spawn } from "node:child_process";
|
|
31340
|
-
import { writeFileSync as
|
|
31341
|
-
import { tmpdir } from "node:os";
|
|
31342
|
-
import { join as
|
|
34322
|
+
import { writeFileSync as writeFileSync4, unlinkSync } from "node:fs";
|
|
34323
|
+
import { tmpdir, platform } from "node:os";
|
|
34324
|
+
import { join as join4 } from "node:path";
|
|
34325
|
+
function createStatusLineScript(tokenFilePath) {
|
|
34326
|
+
const tempDir = tmpdir();
|
|
34327
|
+
const timestamp = Date.now();
|
|
34328
|
+
const scriptPath = join4(tempDir, `claudish-status-${timestamp}.js`);
|
|
34329
|
+
const escapedTokenPath = tokenFilePath.replace(/\\/g, "\\\\");
|
|
34330
|
+
const script = `
|
|
34331
|
+
const fs = require('fs');
|
|
34332
|
+
const path = require('path');
|
|
34333
|
+
|
|
34334
|
+
const CYAN = "\\x1b[96m";
|
|
34335
|
+
const YELLOW = "\\x1b[93m";
|
|
34336
|
+
const GREEN = "\\x1b[92m";
|
|
34337
|
+
const MAGENTA = "\\x1b[95m";
|
|
34338
|
+
const DIM = "\\x1b[2m";
|
|
34339
|
+
const RESET = "\\x1b[0m";
|
|
34340
|
+
const BOLD = "\\x1b[1m";
|
|
34341
|
+
|
|
34342
|
+
let input = '';
|
|
34343
|
+
process.stdin.setEncoding('utf8');
|
|
34344
|
+
process.stdin.on('data', chunk => input += chunk);
|
|
34345
|
+
process.stdin.on('end', () => {
|
|
34346
|
+
try {
|
|
34347
|
+
let dir = path.basename(process.cwd());
|
|
34348
|
+
if (dir.length > 15) dir = dir.substring(0, 12) + '...';
|
|
34349
|
+
|
|
34350
|
+
let ctx = 100, cost = 0;
|
|
34351
|
+
const model = process.env.CLAUDISH_ACTIVE_MODEL_NAME || 'unknown';
|
|
34352
|
+
|
|
34353
|
+
try {
|
|
34354
|
+
const tokens = JSON.parse(fs.readFileSync('${escapedTokenPath}', 'utf-8'));
|
|
34355
|
+
cost = tokens.total_cost || 0;
|
|
34356
|
+
ctx = tokens.context_left_percent || 100;
|
|
34357
|
+
} catch (e) {
|
|
34358
|
+
try {
|
|
34359
|
+
const json = JSON.parse(input);
|
|
34360
|
+
cost = json.total_cost_usd || 0;
|
|
34361
|
+
} catch {}
|
|
34362
|
+
}
|
|
34363
|
+
|
|
34364
|
+
const costStr = cost.toFixed(3);
|
|
34365
|
+
console.log(\`\${CYAN}\${BOLD}\${dir}\${RESET} \${DIM}•\${RESET} \${YELLOW}\${model}\${RESET} \${DIM}•\${RESET} \${GREEN}$\${costStr}\${RESET} \${DIM}•\${RESET} \${MAGENTA}\${ctx}%\${RESET}\`);
|
|
34366
|
+
} catch (e) {
|
|
34367
|
+
console.log('claudish');
|
|
34368
|
+
}
|
|
34369
|
+
});
|
|
34370
|
+
`;
|
|
34371
|
+
writeFileSync4(scriptPath, script, "utf-8");
|
|
34372
|
+
return scriptPath;
|
|
34373
|
+
}
|
|
31343
34374
|
function createTempSettingsFile(modelDisplay, port) {
|
|
31344
34375
|
const tempDir = tmpdir();
|
|
31345
34376
|
const timestamp = Date.now();
|
|
31346
|
-
const tempPath =
|
|
31347
|
-
const
|
|
31348
|
-
|
|
31349
|
-
|
|
31350
|
-
|
|
31351
|
-
|
|
31352
|
-
|
|
31353
|
-
|
|
31354
|
-
|
|
34377
|
+
const tempPath = join4(tempDir, `claudish-settings-${timestamp}.json`);
|
|
34378
|
+
const tokenFilePath = join4(tempDir, `claudish-tokens-${port}.json`);
|
|
34379
|
+
let statusCommand;
|
|
34380
|
+
if (isWindows) {
|
|
34381
|
+
const scriptPath = createStatusLineScript(tokenFilePath);
|
|
34382
|
+
statusCommand = `node "${scriptPath}"`;
|
|
34383
|
+
} else {
|
|
34384
|
+
const CYAN2 = "\\033[96m";
|
|
34385
|
+
const YELLOW2 = "\\033[93m";
|
|
34386
|
+
const GREEN2 = "\\033[92m";
|
|
34387
|
+
const MAGENTA = "\\033[95m";
|
|
34388
|
+
const DIM2 = "\\033[2m";
|
|
34389
|
+
const RESET2 = "\\033[0m";
|
|
34390
|
+
const BOLD2 = "\\033[1m";
|
|
34391
|
+
statusCommand = `JSON=$(cat) && DIR=$(basename "$(pwd)") && [ \${#DIR} -gt 15 ] && DIR="\${DIR:0:12}..." || true && CTX=100 && COST="0" && if [ -f "${tokenFilePath}" ]; then TOKENS=$(cat "${tokenFilePath}" 2>/dev/null) && REAL_COST=$(echo "$TOKENS" | grep -o '"total_cost":[0-9.]*' | cut -d: -f2) && REAL_CTX=$(echo "$TOKENS" | grep -o '"context_left_percent":[0-9]*' | grep -o '[0-9]*') && if [ ! -z "$REAL_COST" ]; then COST="$REAL_COST"; else COST=$(echo "$JSON" | grep -o '"total_cost_usd":[0-9.]*' | cut -d: -f2); fi && if [ ! -z "$REAL_CTX" ]; then CTX="$REAL_CTX"; fi; else COST=$(echo "$JSON" | grep -o '"total_cost_usd":[0-9.]*' | cut -d: -f2); fi && [ -z "$COST" ] && COST="0" || true && printf "${CYAN2}${BOLD2}%s${RESET2} ${DIM2}•${RESET2} ${YELLOW2}%s${RESET2} ${DIM2}•${RESET2} ${GREEN2}\\$%.3f${RESET2} ${DIM2}•${RESET2} ${MAGENTA}%s%%${RESET2}\\n" "$DIR" "$CLAUDISH_ACTIVE_MODEL_NAME" "$COST" "$CTX"`;
|
|
34392
|
+
}
|
|
31355
34393
|
const settings = {
|
|
31356
34394
|
statusLine: {
|
|
31357
34395
|
type: "command",
|
|
31358
|
-
command:
|
|
34396
|
+
command: statusCommand,
|
|
31359
34397
|
padding: 0
|
|
31360
34398
|
}
|
|
31361
34399
|
};
|
|
31362
|
-
|
|
34400
|
+
writeFileSync4(tempPath, JSON.stringify(settings, null, 2), "utf-8");
|
|
31363
34401
|
return tempPath;
|
|
31364
34402
|
}
|
|
31365
34403
|
async function runClaudeWithProxy(config3, proxyUrl) {
|
|
@@ -31425,7 +34463,8 @@ async function runClaudeWithProxy(config3, proxyUrl) {
|
|
|
31425
34463
|
}
|
|
31426
34464
|
const proc = spawn("claude", claudeArgs, {
|
|
31427
34465
|
env,
|
|
31428
|
-
stdio: "inherit"
|
|
34466
|
+
stdio: "inherit",
|
|
34467
|
+
shell: isWindows
|
|
31429
34468
|
});
|
|
31430
34469
|
setupSignalHandlers(proc, tempSettingsPath, config3.quiet);
|
|
31431
34470
|
const exitCode = await new Promise((resolve) => {
|
|
@@ -31439,8 +34478,8 @@ async function runClaudeWithProxy(config3, proxyUrl) {
|
|
|
31439
34478
|
return exitCode;
|
|
31440
34479
|
}
|
|
31441
34480
|
function setupSignalHandlers(proc, tempSettingsPath, quiet) {
|
|
31442
|
-
const
|
|
31443
|
-
for (const signal of
|
|
34481
|
+
const signals2 = isWindows ? ["SIGINT", "SIGTERM"] : ["SIGINT", "SIGTERM", "SIGHUP"];
|
|
34482
|
+
for (const signal of signals2) {
|
|
31444
34483
|
process.on(signal, () => {
|
|
31445
34484
|
if (!quiet) {
|
|
31446
34485
|
console.log(`
|
|
@@ -31456,8 +34495,11 @@ function setupSignalHandlers(proc, tempSettingsPath, quiet) {
|
|
|
31456
34495
|
}
|
|
31457
34496
|
async function checkClaudeInstalled() {
|
|
31458
34497
|
try {
|
|
31459
|
-
const
|
|
31460
|
-
|
|
34498
|
+
const isWindows2 = process.platform === "win32";
|
|
34499
|
+
const command = isWindows2 ? "where" : "which";
|
|
34500
|
+
const proc = spawn(command, ["claude"], {
|
|
34501
|
+
stdio: "ignore",
|
|
34502
|
+
shell: isWindows2
|
|
31461
34503
|
});
|
|
31462
34504
|
const exitCode = await new Promise((resolve) => {
|
|
31463
34505
|
proc.on("exit", (code) => {
|
|
@@ -31469,8 +34511,10 @@ async function checkClaudeInstalled() {
|
|
|
31469
34511
|
return false;
|
|
31470
34512
|
}
|
|
31471
34513
|
}
|
|
34514
|
+
var isWindows;
|
|
31472
34515
|
var init_claude_runner = __esm(() => {
|
|
31473
34516
|
init_config();
|
|
34517
|
+
isWindows = platform() === "win32";
|
|
31474
34518
|
});
|
|
31475
34519
|
|
|
31476
34520
|
// src/types.ts
|
|
@@ -31493,17 +34537,17 @@ var init_types4 = __esm(() => {
|
|
|
31493
34537
|
});
|
|
31494
34538
|
|
|
31495
34539
|
// src/model-loader.ts
|
|
31496
|
-
import { readFileSync as
|
|
31497
|
-
import { join as
|
|
31498
|
-
import { fileURLToPath as
|
|
34540
|
+
import { readFileSync as readFileSync4, existsSync as existsSync4 } from "node:fs";
|
|
34541
|
+
import { join as join5, dirname as dirname3 } from "node:path";
|
|
34542
|
+
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
31499
34543
|
function loadModelInfo() {
|
|
31500
34544
|
if (_cachedModelInfo) {
|
|
31501
34545
|
return _cachedModelInfo;
|
|
31502
34546
|
}
|
|
31503
|
-
const jsonPath =
|
|
31504
|
-
if (
|
|
34547
|
+
const jsonPath = join5(__dirname4, "../recommended-models.json");
|
|
34548
|
+
if (existsSync4(jsonPath)) {
|
|
31505
34549
|
try {
|
|
31506
|
-
const jsonContent =
|
|
34550
|
+
const jsonContent = readFileSync4(jsonPath, "utf-8");
|
|
31507
34551
|
const data = JSON.parse(jsonContent);
|
|
31508
34552
|
const modelInfo = {};
|
|
31509
34553
|
for (const model of data.models) {
|
|
@@ -31535,10 +34579,10 @@ function getAvailableModels() {
|
|
|
31535
34579
|
if (_cachedModelIds) {
|
|
31536
34580
|
return _cachedModelIds;
|
|
31537
34581
|
}
|
|
31538
|
-
const jsonPath =
|
|
31539
|
-
if (
|
|
34582
|
+
const jsonPath = join5(__dirname4, "../recommended-models.json");
|
|
34583
|
+
if (existsSync4(jsonPath)) {
|
|
31540
34584
|
try {
|
|
31541
|
-
const jsonContent =
|
|
34585
|
+
const jsonContent = readFileSync4(jsonPath, "utf-8");
|
|
31542
34586
|
const data = JSON.parse(jsonContent);
|
|
31543
34587
|
const modelIds = data.models.sort((a, b) => a.priority - b.priority).map((m) => m.id);
|
|
31544
34588
|
const result = [...modelIds, "custom"];
|
|
@@ -31573,10 +34617,10 @@ async function fetchModelContextWindow(modelId) {
|
|
|
31573
34617
|
try {
|
|
31574
34618
|
const modelMetadata = loadModelInfo();
|
|
31575
34619
|
} catch (e) {}
|
|
31576
|
-
const jsonPath =
|
|
31577
|
-
if (
|
|
34620
|
+
const jsonPath = join5(__dirname4, "../recommended-models.json");
|
|
34621
|
+
if (existsSync4(jsonPath)) {
|
|
31578
34622
|
try {
|
|
31579
|
-
const jsonContent =
|
|
34623
|
+
const jsonContent = readFileSync4(jsonPath, "utf-8");
|
|
31580
34624
|
const data = JSON.parse(jsonContent);
|
|
31581
34625
|
const model = data.models.find((m) => m.id === modelId);
|
|
31582
34626
|
if (model && model.context) {
|
|
@@ -31605,10 +34649,10 @@ async function doesModelSupportReasoning(modelId) {
|
|
|
31605
34649
|
}
|
|
31606
34650
|
return false;
|
|
31607
34651
|
}
|
|
31608
|
-
var
|
|
34652
|
+
var __filename4, __dirname4, _cachedModelInfo = null, _cachedModelIds = null, _cachedOpenRouterModels = null;
|
|
31609
34653
|
var init_model_loader = __esm(() => {
|
|
31610
|
-
|
|
31611
|
-
|
|
34654
|
+
__filename4 = fileURLToPath3(import.meta.url);
|
|
34655
|
+
__dirname4 = dirname3(__filename4);
|
|
31612
34656
|
});
|
|
31613
34657
|
|
|
31614
34658
|
// src/utils.ts
|
|
@@ -31649,11 +34693,15 @@ function fuzzyScore2(text, query) {
|
|
|
31649
34693
|
// src/cli.ts
|
|
31650
34694
|
var exports_cli = {};
|
|
31651
34695
|
__export(exports_cli, {
|
|
31652
|
-
parseArgs: () => parseArgs
|
|
34696
|
+
parseArgs: () => parseArgs,
|
|
34697
|
+
getVersion: () => getVersion
|
|
31653
34698
|
});
|
|
31654
|
-
import { readFileSync as
|
|
31655
|
-
import { fileURLToPath as
|
|
31656
|
-
import { dirname as
|
|
34699
|
+
import { readFileSync as readFileSync5, writeFileSync as writeFileSync6, existsSync as existsSync5, mkdirSync as mkdirSync2, copyFileSync } from "node:fs";
|
|
34700
|
+
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
34701
|
+
import { dirname as dirname4, join as join6 } from "node:path";
|
|
34702
|
+
function getVersion() {
|
|
34703
|
+
return VERSION;
|
|
34704
|
+
}
|
|
31657
34705
|
async function parseArgs(args) {
|
|
31658
34706
|
const config3 = {
|
|
31659
34707
|
model: undefined,
|
|
@@ -31714,7 +34762,7 @@ async function parseArgs(args) {
|
|
|
31714
34762
|
const val = args[++i];
|
|
31715
34763
|
if (val)
|
|
31716
34764
|
config3.modelSubagent = val;
|
|
31717
|
-
} else if (arg === "--port"
|
|
34765
|
+
} else if (arg === "--port") {
|
|
31718
34766
|
const portArg = args[++i];
|
|
31719
34767
|
if (!portArg) {
|
|
31720
34768
|
console.error("--port requires a value");
|
|
@@ -31753,6 +34801,13 @@ async function parseArgs(args) {
|
|
|
31753
34801
|
config3.stdin = true;
|
|
31754
34802
|
} else if (arg === "--free") {
|
|
31755
34803
|
config3.freeOnly = true;
|
|
34804
|
+
} else if (arg === "--profile" || arg === "-p") {
|
|
34805
|
+
const profileArg = args[++i];
|
|
34806
|
+
if (!profileArg) {
|
|
34807
|
+
console.error("--profile requires a profile name");
|
|
34808
|
+
process.exit(1);
|
|
34809
|
+
}
|
|
34810
|
+
config3.profile = profileArg;
|
|
31756
34811
|
} else if (arg === "--cost-tracker") {
|
|
31757
34812
|
config3.costTracking = true;
|
|
31758
34813
|
if (!config3.monitor) {
|
|
@@ -31840,17 +34895,32 @@ async function parseArgs(args) {
|
|
|
31840
34895
|
if (config3.jsonOutput) {
|
|
31841
34896
|
config3.quiet = true;
|
|
31842
34897
|
}
|
|
34898
|
+
if (config3.profile || !config3.modelOpus || !config3.modelSonnet || !config3.modelHaiku || !config3.modelSubagent) {
|
|
34899
|
+
const profileModels = getModelMapping(config3.profile);
|
|
34900
|
+
if (!config3.modelOpus && profileModels.opus) {
|
|
34901
|
+
config3.modelOpus = profileModels.opus;
|
|
34902
|
+
}
|
|
34903
|
+
if (!config3.modelSonnet && profileModels.sonnet) {
|
|
34904
|
+
config3.modelSonnet = profileModels.sonnet;
|
|
34905
|
+
}
|
|
34906
|
+
if (!config3.modelHaiku && profileModels.haiku) {
|
|
34907
|
+
config3.modelHaiku = profileModels.haiku;
|
|
34908
|
+
}
|
|
34909
|
+
if (!config3.modelSubagent && profileModels.subagent) {
|
|
34910
|
+
config3.modelSubagent = profileModels.subagent;
|
|
34911
|
+
}
|
|
34912
|
+
}
|
|
31843
34913
|
return config3;
|
|
31844
34914
|
}
|
|
31845
34915
|
async function searchAndPrintModels(query, forceUpdate) {
|
|
31846
34916
|
let models = [];
|
|
31847
|
-
if (!forceUpdate &&
|
|
34917
|
+
if (!forceUpdate && existsSync5(ALL_MODELS_JSON_PATH2)) {
|
|
31848
34918
|
try {
|
|
31849
|
-
const cacheData = JSON.parse(
|
|
34919
|
+
const cacheData = JSON.parse(readFileSync5(ALL_MODELS_JSON_PATH2, "utf-8"));
|
|
31850
34920
|
const lastUpdated = new Date(cacheData.lastUpdated);
|
|
31851
34921
|
const now = new Date;
|
|
31852
34922
|
const ageInDays = (now.getTime() - lastUpdated.getTime()) / (1000 * 60 * 60 * 24);
|
|
31853
|
-
if (ageInDays <=
|
|
34923
|
+
if (ageInDays <= CACHE_MAX_AGE_DAYS3) {
|
|
31854
34924
|
models = cacheData.models;
|
|
31855
34925
|
}
|
|
31856
34926
|
} catch (e) {}
|
|
@@ -31863,7 +34933,7 @@ async function searchAndPrintModels(query, forceUpdate) {
|
|
|
31863
34933
|
throw new Error(`API returned ${response.status}`);
|
|
31864
34934
|
const data = await response.json();
|
|
31865
34935
|
models = data.data;
|
|
31866
|
-
|
|
34936
|
+
writeFileSync6(ALL_MODELS_JSON_PATH2, JSON.stringify({
|
|
31867
34937
|
lastUpdated: new Date().toISOString(),
|
|
31868
34938
|
models
|
|
31869
34939
|
}), "utf-8");
|
|
@@ -31919,13 +34989,13 @@ Found ${results.length} matching models:
|
|
|
31919
34989
|
}
|
|
31920
34990
|
async function printAllModels(jsonOutput, forceUpdate) {
|
|
31921
34991
|
let models = [];
|
|
31922
|
-
if (!forceUpdate &&
|
|
34992
|
+
if (!forceUpdate && existsSync5(ALL_MODELS_JSON_PATH2)) {
|
|
31923
34993
|
try {
|
|
31924
|
-
const cacheData = JSON.parse(
|
|
34994
|
+
const cacheData = JSON.parse(readFileSync5(ALL_MODELS_JSON_PATH2, "utf-8"));
|
|
31925
34995
|
const lastUpdated = new Date(cacheData.lastUpdated);
|
|
31926
34996
|
const now = new Date;
|
|
31927
34997
|
const ageInDays = (now.getTime() - lastUpdated.getTime()) / (1000 * 60 * 60 * 24);
|
|
31928
|
-
if (ageInDays <=
|
|
34998
|
+
if (ageInDays <= CACHE_MAX_AGE_DAYS3) {
|
|
31929
34999
|
models = cacheData.models;
|
|
31930
35000
|
if (!jsonOutput) {
|
|
31931
35001
|
console.error(`✓ Using cached models (last updated: ${cacheData.lastUpdated.split("T")[0]})`);
|
|
@@ -31941,7 +35011,7 @@ async function printAllModels(jsonOutput, forceUpdate) {
|
|
|
31941
35011
|
throw new Error(`API returned ${response.status}`);
|
|
31942
35012
|
const data = await response.json();
|
|
31943
35013
|
models = data.data;
|
|
31944
|
-
|
|
35014
|
+
writeFileSync6(ALL_MODELS_JSON_PATH2, JSON.stringify({
|
|
31945
35015
|
lastUpdated: new Date().toISOString(),
|
|
31946
35016
|
models
|
|
31947
35017
|
}), "utf-8");
|
|
@@ -32010,11 +35080,11 @@ All OpenRouter Models (${models.length} total):
|
|
|
32010
35080
|
console.log("Top models: claudish --top-models");
|
|
32011
35081
|
}
|
|
32012
35082
|
function isCacheStale() {
|
|
32013
|
-
if (!
|
|
35083
|
+
if (!existsSync5(MODELS_JSON_PATH)) {
|
|
32014
35084
|
return true;
|
|
32015
35085
|
}
|
|
32016
35086
|
try {
|
|
32017
|
-
const jsonContent =
|
|
35087
|
+
const jsonContent = readFileSync5(MODELS_JSON_PATH, "utf-8");
|
|
32018
35088
|
const data = JSON.parse(jsonContent);
|
|
32019
35089
|
if (!data.lastUpdated) {
|
|
32020
35090
|
return true;
|
|
@@ -32022,7 +35092,7 @@ function isCacheStale() {
|
|
|
32022
35092
|
const lastUpdated = new Date(data.lastUpdated);
|
|
32023
35093
|
const now = new Date;
|
|
32024
35094
|
const ageInDays = (now.getTime() - lastUpdated.getTime()) / (1000 * 60 * 60 * 24);
|
|
32025
|
-
return ageInDays >
|
|
35095
|
+
return ageInDays > CACHE_MAX_AGE_DAYS3;
|
|
32026
35096
|
} catch (error46) {
|
|
32027
35097
|
return true;
|
|
32028
35098
|
}
|
|
@@ -32110,9 +35180,9 @@ async function updateModelsFromOpenRouter() {
|
|
|
32110
35180
|
providers.add(provider);
|
|
32111
35181
|
}
|
|
32112
35182
|
let version2 = "1.1.5";
|
|
32113
|
-
if (
|
|
35183
|
+
if (existsSync5(MODELS_JSON_PATH)) {
|
|
32114
35184
|
try {
|
|
32115
|
-
const existing = JSON.parse(
|
|
35185
|
+
const existing = JSON.parse(readFileSync5(MODELS_JSON_PATH, "utf-8"));
|
|
32116
35186
|
version2 = existing.version || version2;
|
|
32117
35187
|
} catch {}
|
|
32118
35188
|
}
|
|
@@ -32122,7 +35192,7 @@ async function updateModelsFromOpenRouter() {
|
|
|
32122
35192
|
source: "https://openrouter.ai/models?categories=programming&fmt=cards&order=top-weekly",
|
|
32123
35193
|
models: recommendations
|
|
32124
35194
|
};
|
|
32125
|
-
|
|
35195
|
+
writeFileSync6(MODELS_JSON_PATH, JSON.stringify(updatedData, null, 2), "utf-8");
|
|
32126
35196
|
console.error(`✅ Updated ${recommendations.length} models (last updated: ${updatedData.lastUpdated})`);
|
|
32127
35197
|
} catch (error46) {
|
|
32128
35198
|
console.error(`❌ Failed to update models: ${error46 instanceof Error ? error46.message : String(error46)}`);
|
|
@@ -32140,7 +35210,7 @@ async function checkAndUpdateModelsCache(forceUpdate = false) {
|
|
|
32140
35210
|
await updateModelsFromOpenRouter();
|
|
32141
35211
|
} else {
|
|
32142
35212
|
try {
|
|
32143
|
-
const data = JSON.parse(
|
|
35213
|
+
const data = JSON.parse(readFileSync5(MODELS_JSON_PATH, "utf-8"));
|
|
32144
35214
|
console.error(`✓ Using cached models (last updated: ${data.lastUpdated})`);
|
|
32145
35215
|
} catch {}
|
|
32146
35216
|
}
|
|
@@ -32159,7 +35229,8 @@ USAGE:
|
|
|
32159
35229
|
OPTIONS:
|
|
32160
35230
|
-i, --interactive Run in interactive mode (default when no prompt given)
|
|
32161
35231
|
-m, --model <model> OpenRouter model to use (required for single-shot mode)
|
|
32162
|
-
-p, --
|
|
35232
|
+
-p, --profile <name> Use named profile for model mapping (default: uses default profile)
|
|
35233
|
+
--port <port> Proxy server port (default: random)
|
|
32163
35234
|
-d, --debug Enable debug logging to file (logs/claudish_*.log)
|
|
32164
35235
|
--log-level <level> Log verbosity: debug (full), info (truncated), minimal (labels only)
|
|
32165
35236
|
-q, --quiet Suppress [claudish] log messages (default in single-shot mode)
|
|
@@ -32183,6 +35254,15 @@ OPTIONS:
|
|
|
32183
35254
|
--help-ai Show AI agent usage guide (file-based patterns, sub-agents)
|
|
32184
35255
|
--init Install Claudish skill in current project (.claude/skills/)
|
|
32185
35256
|
|
|
35257
|
+
PROFILE MANAGEMENT:
|
|
35258
|
+
claudish init Setup wizard - create config and first profile
|
|
35259
|
+
claudish profile list List all profiles
|
|
35260
|
+
claudish profile add Add a new profile
|
|
35261
|
+
claudish profile remove Remove a profile (interactive or claudish profile remove <name>)
|
|
35262
|
+
claudish profile use Set default profile (interactive or claudish profile use <name>)
|
|
35263
|
+
claudish profile show Show profile details (default profile or claudish profile show <name>)
|
|
35264
|
+
claudish profile edit Edit a profile (interactive or claudish profile edit <name>)
|
|
35265
|
+
|
|
32186
35266
|
MODEL MAPPING (per-role override):
|
|
32187
35267
|
--model-opus <model> Model for Opus role (planning, complex tasks)
|
|
32188
35268
|
--model-sonnet <model> Model for Sonnet role (default coding)
|
|
@@ -32240,6 +35320,10 @@ EXAMPLES:
|
|
|
32240
35320
|
# Per-role model mapping (use different models for different Claude Code roles)
|
|
32241
35321
|
claudish --model-opus openai/gpt-5 --model-sonnet x-ai/grok-code-fast-1 --model-haiku minimax/minimax-m2
|
|
32242
35322
|
|
|
35323
|
+
# Use named profiles for pre-configured model mappings
|
|
35324
|
+
claudish -p frontend "implement component"
|
|
35325
|
+
claudish --profile debug "investigate error"
|
|
35326
|
+
|
|
32243
35327
|
# Hybrid: Native Anthropic for Opus, OpenRouter for Sonnet/Haiku
|
|
32244
35328
|
claudish --model-opus claude-3-opus-20240229 --model-sonnet x-ai/grok-code-fast-1
|
|
32245
35329
|
|
|
@@ -32286,8 +35370,8 @@ MORE INFO:
|
|
|
32286
35370
|
}
|
|
32287
35371
|
function printAIAgentGuide() {
|
|
32288
35372
|
try {
|
|
32289
|
-
const guidePath =
|
|
32290
|
-
const guideContent =
|
|
35373
|
+
const guidePath = join6(__dirname5, "../AI_AGENT_GUIDE.md");
|
|
35374
|
+
const guideContent = readFileSync5(guidePath, "utf-8");
|
|
32291
35375
|
console.log(guideContent);
|
|
32292
35376
|
} catch (error46) {
|
|
32293
35377
|
console.error("Error reading AI Agent Guide:");
|
|
@@ -32303,19 +35387,19 @@ async function initializeClaudishSkill() {
|
|
|
32303
35387
|
console.log(`\uD83D\uDD27 Initializing Claudish skill in current project...
|
|
32304
35388
|
`);
|
|
32305
35389
|
const cwd = process.cwd();
|
|
32306
|
-
const claudeDir =
|
|
32307
|
-
const skillsDir =
|
|
32308
|
-
const claudishSkillDir =
|
|
32309
|
-
const skillFile =
|
|
32310
|
-
if (
|
|
35390
|
+
const claudeDir = join6(cwd, ".claude");
|
|
35391
|
+
const skillsDir = join6(claudeDir, "skills");
|
|
35392
|
+
const claudishSkillDir = join6(skillsDir, "claudish-usage");
|
|
35393
|
+
const skillFile = join6(claudishSkillDir, "SKILL.md");
|
|
35394
|
+
if (existsSync5(skillFile)) {
|
|
32311
35395
|
console.log("✅ Claudish skill already installed at:");
|
|
32312
35396
|
console.log(` ${skillFile}
|
|
32313
35397
|
`);
|
|
32314
35398
|
console.log("\uD83D\uDCA1 To reinstall, delete the file and run 'claudish --init' again.");
|
|
32315
35399
|
return;
|
|
32316
35400
|
}
|
|
32317
|
-
const sourceSkillPath =
|
|
32318
|
-
if (!
|
|
35401
|
+
const sourceSkillPath = join6(__dirname5, "../skills/claudish-usage/SKILL.md");
|
|
35402
|
+
if (!existsSync5(sourceSkillPath)) {
|
|
32319
35403
|
console.error("❌ Error: Claudish skill file not found in installation.");
|
|
32320
35404
|
console.error(` Expected at: ${sourceSkillPath}`);
|
|
32321
35405
|
console.error(`
|
|
@@ -32324,16 +35408,16 @@ async function initializeClaudishSkill() {
|
|
|
32324
35408
|
process.exit(1);
|
|
32325
35409
|
}
|
|
32326
35410
|
try {
|
|
32327
|
-
if (!
|
|
32328
|
-
|
|
35411
|
+
if (!existsSync5(claudeDir)) {
|
|
35412
|
+
mkdirSync2(claudeDir, { recursive: true });
|
|
32329
35413
|
console.log("\uD83D\uDCC1 Created .claude/ directory");
|
|
32330
35414
|
}
|
|
32331
|
-
if (!
|
|
32332
|
-
|
|
35415
|
+
if (!existsSync5(skillsDir)) {
|
|
35416
|
+
mkdirSync2(skillsDir, { recursive: true });
|
|
32333
35417
|
console.log("\uD83D\uDCC1 Created .claude/skills/ directory");
|
|
32334
35418
|
}
|
|
32335
|
-
if (!
|
|
32336
|
-
|
|
35419
|
+
if (!existsSync5(claudishSkillDir)) {
|
|
35420
|
+
mkdirSync2(claudishSkillDir, { recursive: true });
|
|
32337
35421
|
console.log("\uD83D\uDCC1 Created .claude/skills/claudish-usage/ directory");
|
|
32338
35422
|
}
|
|
32339
35423
|
copyFileSync(sourceSkillPath, skillFile);
|
|
@@ -32375,8 +35459,8 @@ function printAvailableModels() {
|
|
|
32375
35459
|
let lastUpdated = "unknown";
|
|
32376
35460
|
let models = [];
|
|
32377
35461
|
try {
|
|
32378
|
-
if (
|
|
32379
|
-
const data = JSON.parse(
|
|
35462
|
+
if (existsSync5(MODELS_JSON_PATH)) {
|
|
35463
|
+
const data = JSON.parse(readFileSync5(MODELS_JSON_PATH, "utf-8"));
|
|
32380
35464
|
lastUpdated = data.lastUpdated || "unknown";
|
|
32381
35465
|
models = data.models || [];
|
|
32382
35466
|
}
|
|
@@ -32427,9 +35511,9 @@ Force update: claudish --list-models --force-update
|
|
|
32427
35511
|
`);
|
|
32428
35512
|
}
|
|
32429
35513
|
function printAvailableModelsJSON() {
|
|
32430
|
-
const jsonPath =
|
|
35514
|
+
const jsonPath = join6(__dirname5, "../recommended-models.json");
|
|
32431
35515
|
try {
|
|
32432
|
-
const jsonContent =
|
|
35516
|
+
const jsonContent = readFileSync5(jsonPath, "utf-8");
|
|
32433
35517
|
const data = JSON.parse(jsonContent);
|
|
32434
35518
|
console.log(JSON.stringify(data, null, 2));
|
|
32435
35519
|
} catch (error46) {
|
|
@@ -32453,325 +35537,17 @@ function printAvailableModelsJSON() {
|
|
|
32453
35537
|
console.log(JSON.stringify(output, null, 2));
|
|
32454
35538
|
}
|
|
32455
35539
|
}
|
|
32456
|
-
var
|
|
35540
|
+
var __filename5, __dirname5, packageJson, VERSION, CACHE_MAX_AGE_DAYS3 = 2, MODELS_JSON_PATH, ALL_MODELS_JSON_PATH2;
|
|
32457
35541
|
var init_cli = __esm(() => {
|
|
32458
35542
|
init_config();
|
|
32459
35543
|
init_model_loader();
|
|
32460
|
-
|
|
32461
|
-
__dirname4 = dirname3(__filename4);
|
|
32462
|
-
packageJson = JSON.parse(readFileSync3(join4(__dirname4, "../package.json"), "utf-8"));
|
|
32463
|
-
VERSION = packageJson.version;
|
|
32464
|
-
MODELS_JSON_PATH = join4(__dirname4, "../recommended-models.json");
|
|
32465
|
-
ALL_MODELS_JSON_PATH = join4(__dirname4, "../all-models.json");
|
|
32466
|
-
});
|
|
32467
|
-
|
|
32468
|
-
// src/simple-selector.ts
|
|
32469
|
-
var exports_simple_selector = {};
|
|
32470
|
-
__export(exports_simple_selector, {
|
|
32471
|
-
selectModelInteractively: () => selectModelInteractively,
|
|
32472
|
-
promptForApiKey: () => promptForApiKey
|
|
32473
|
-
});
|
|
32474
|
-
import { createInterface } from "readline";
|
|
32475
|
-
import { readFileSync as readFileSync4, writeFileSync as writeFileSync5, existsSync as existsSync4 } from "node:fs";
|
|
32476
|
-
import { join as join5, dirname as dirname4 } from "node:path";
|
|
32477
|
-
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
32478
|
-
function loadEnhancedModels() {
|
|
32479
|
-
const jsonPath = join5(__dirname5, "../recommended-models.json");
|
|
32480
|
-
if (existsSync4(jsonPath)) {
|
|
32481
|
-
try {
|
|
32482
|
-
const jsonContent = readFileSync4(jsonPath, "utf-8");
|
|
32483
|
-
const data = JSON.parse(jsonContent);
|
|
32484
|
-
return data.models || [];
|
|
32485
|
-
} catch {
|
|
32486
|
-
return [];
|
|
32487
|
-
}
|
|
32488
|
-
}
|
|
32489
|
-
return [];
|
|
32490
|
-
}
|
|
32491
|
-
async function loadFreeModels() {
|
|
32492
|
-
let allModels = [];
|
|
32493
|
-
if (existsSync4(ALL_MODELS_JSON_PATH2)) {
|
|
32494
|
-
try {
|
|
32495
|
-
const cacheData = JSON.parse(readFileSync4(ALL_MODELS_JSON_PATH2, "utf-8"));
|
|
32496
|
-
const lastUpdated = new Date(cacheData.lastUpdated);
|
|
32497
|
-
const now = new Date;
|
|
32498
|
-
const ageInDays = (now.getTime() - lastUpdated.getTime()) / (1000 * 60 * 60 * 24);
|
|
32499
|
-
if (ageInDays <= CACHE_MAX_AGE_DAYS3) {
|
|
32500
|
-
allModels = cacheData.models;
|
|
32501
|
-
}
|
|
32502
|
-
} catch {}
|
|
32503
|
-
}
|
|
32504
|
-
if (allModels.length === 0) {
|
|
32505
|
-
console.error("\uD83D\uDD04 Fetching models from OpenRouter...");
|
|
32506
|
-
try {
|
|
32507
|
-
const response = await fetch("https://openrouter.ai/api/v1/models");
|
|
32508
|
-
if (!response.ok)
|
|
32509
|
-
throw new Error(`API returned ${response.status}`);
|
|
32510
|
-
const data = await response.json();
|
|
32511
|
-
allModels = data.data;
|
|
32512
|
-
writeFileSync5(ALL_MODELS_JSON_PATH2, JSON.stringify({
|
|
32513
|
-
lastUpdated: new Date().toISOString(),
|
|
32514
|
-
models: allModels
|
|
32515
|
-
}), "utf-8");
|
|
32516
|
-
console.error(`✅ Cached ${allModels.length} models`);
|
|
32517
|
-
} catch (error46) {
|
|
32518
|
-
console.error(`❌ Failed to fetch models: ${error46}`);
|
|
32519
|
-
return [];
|
|
32520
|
-
}
|
|
32521
|
-
}
|
|
32522
|
-
const freeModels = allModels.filter((model) => {
|
|
32523
|
-
const promptPrice = parseFloat(model.pricing?.prompt || "0");
|
|
32524
|
-
const completionPrice = parseFloat(model.pricing?.completion || "0");
|
|
32525
|
-
const isFree = promptPrice === 0 && completionPrice === 0;
|
|
32526
|
-
if (!isFree)
|
|
32527
|
-
return false;
|
|
32528
|
-
const provider = model.id.split("/")[0].toLowerCase();
|
|
32529
|
-
return TRUSTED_FREE_PROVIDERS.includes(provider);
|
|
32530
|
-
});
|
|
32531
|
-
freeModels.sort((a, b) => {
|
|
32532
|
-
const contextA = a.context_length || a.top_provider?.context_length || 0;
|
|
32533
|
-
const contextB = b.context_length || b.top_provider?.context_length || 0;
|
|
32534
|
-
return contextB - contextA;
|
|
32535
|
-
});
|
|
32536
|
-
const seenBase = new Set;
|
|
32537
|
-
const dedupedModels = freeModels.filter((model) => {
|
|
32538
|
-
const baseId = model.id.replace(/:free$/, "");
|
|
32539
|
-
if (seenBase.has(baseId)) {
|
|
32540
|
-
return false;
|
|
32541
|
-
}
|
|
32542
|
-
seenBase.add(baseId);
|
|
32543
|
-
return true;
|
|
32544
|
-
});
|
|
32545
|
-
const topModels = dedupedModels.slice(0, 15);
|
|
32546
|
-
return topModels.map((model) => {
|
|
32547
|
-
const provider = model.id.split("/")[0];
|
|
32548
|
-
const contextLen = model.context_length || model.top_provider?.context_length || 0;
|
|
32549
|
-
return {
|
|
32550
|
-
id: model.id,
|
|
32551
|
-
name: model.name || model.id,
|
|
32552
|
-
description: model.description || "",
|
|
32553
|
-
provider: provider.charAt(0).toUpperCase() + provider.slice(1),
|
|
32554
|
-
pricing: {
|
|
32555
|
-
input: "FREE",
|
|
32556
|
-
output: "FREE",
|
|
32557
|
-
average: "FREE"
|
|
32558
|
-
},
|
|
32559
|
-
context: contextLen > 0 ? `${Math.round(contextLen / 1000)}K` : "N/A",
|
|
32560
|
-
supportsTools: (model.supported_parameters || []).includes("tools"),
|
|
32561
|
-
supportsReasoning: (model.supported_parameters || []).includes("reasoning"),
|
|
32562
|
-
supportsVision: (model.architecture?.input_modalities || []).includes("image")
|
|
32563
|
-
};
|
|
32564
|
-
});
|
|
32565
|
-
}
|
|
32566
|
-
async function promptForApiKey() {
|
|
32567
|
-
return new Promise((resolve) => {
|
|
32568
|
-
console.log(`
|
|
32569
|
-
\x1B[1m\x1B[36mOpenRouter API Key Required\x1B[0m
|
|
32570
|
-
`);
|
|
32571
|
-
console.log(`\x1B[2mGet your free API key from: https://openrouter.ai/keys\x1B[0m
|
|
32572
|
-
`);
|
|
32573
|
-
console.log("Enter your OpenRouter API key:");
|
|
32574
|
-
console.log(`\x1B[2m(it will not be saved, only used for this session)\x1B[0m
|
|
32575
|
-
`);
|
|
32576
|
-
const rl = createInterface({
|
|
32577
|
-
input: process.stdin,
|
|
32578
|
-
output: process.stdout,
|
|
32579
|
-
terminal: false
|
|
32580
|
-
});
|
|
32581
|
-
let apiKey = null;
|
|
32582
|
-
rl.on("line", (input) => {
|
|
32583
|
-
const trimmed = input.trim();
|
|
32584
|
-
if (!trimmed) {
|
|
32585
|
-
console.log("\x1B[31mError: API key cannot be empty\x1B[0m");
|
|
32586
|
-
return;
|
|
32587
|
-
}
|
|
32588
|
-
if (!trimmed.startsWith("sk-or-v1-")) {
|
|
32589
|
-
console.log("\x1B[33mWarning: OpenRouter API keys usually start with 'sk-or-v1-'\x1B[0m");
|
|
32590
|
-
console.log("\x1B[2mContinuing anyway...\x1B[0m");
|
|
32591
|
-
}
|
|
32592
|
-
apiKey = trimmed;
|
|
32593
|
-
rl.close();
|
|
32594
|
-
});
|
|
32595
|
-
rl.on("close", () => {
|
|
32596
|
-
if (apiKey) {
|
|
32597
|
-
process.stdin.pause();
|
|
32598
|
-
process.stdin.removeAllListeners("data");
|
|
32599
|
-
process.stdin.removeAllListeners("end");
|
|
32600
|
-
process.stdin.removeAllListeners("error");
|
|
32601
|
-
process.stdin.removeAllListeners("readable");
|
|
32602
|
-
if (process.stdin.isTTY && process.stdin.setRawMode) {
|
|
32603
|
-
process.stdin.setRawMode(false);
|
|
32604
|
-
}
|
|
32605
|
-
setTimeout(() => {
|
|
32606
|
-
resolve(apiKey);
|
|
32607
|
-
}, 200);
|
|
32608
|
-
} else {
|
|
32609
|
-
console.error("\x1B[31mError: API key is required\x1B[0m");
|
|
32610
|
-
process.exit(1);
|
|
32611
|
-
}
|
|
32612
|
-
});
|
|
32613
|
-
});
|
|
32614
|
-
}
|
|
32615
|
-
async function selectModelInteractively(options = {}) {
|
|
32616
|
-
const { freeOnly = false } = options;
|
|
32617
|
-
let displayModels;
|
|
32618
|
-
let enhancedMap;
|
|
32619
|
-
if (freeOnly) {
|
|
32620
|
-
const freeModels = await loadFreeModels();
|
|
32621
|
-
if (freeModels.length === 0) {
|
|
32622
|
-
console.error("❌ No free models found or failed to fetch models");
|
|
32623
|
-
process.exit(1);
|
|
32624
|
-
}
|
|
32625
|
-
displayModels = freeModels.map((m) => m.id);
|
|
32626
|
-
enhancedMap = new Map;
|
|
32627
|
-
for (const m of freeModels) {
|
|
32628
|
-
enhancedMap.set(m.id, m);
|
|
32629
|
-
}
|
|
32630
|
-
} else {
|
|
32631
|
-
displayModels = getAvailableModels();
|
|
32632
|
-
const enhancedModels = loadEnhancedModels();
|
|
32633
|
-
enhancedMap = new Map;
|
|
32634
|
-
for (const m of enhancedModels) {
|
|
32635
|
-
enhancedMap.set(m.id, m);
|
|
32636
|
-
}
|
|
32637
|
-
}
|
|
32638
|
-
const models = freeOnly ? displayModels : displayModels;
|
|
32639
|
-
return new Promise((resolve) => {
|
|
32640
|
-
const RESET = "\x1B[0m";
|
|
32641
|
-
const BOLD = "\x1B[1m";
|
|
32642
|
-
const DIM = "\x1B[2m";
|
|
32643
|
-
const CYAN = "\x1B[36m";
|
|
32644
|
-
const GREEN = "\x1B[32m";
|
|
32645
|
-
const YELLOW = "\x1B[33m";
|
|
32646
|
-
const MAGENTA = "\x1B[35m";
|
|
32647
|
-
const pad = (text, width) => {
|
|
32648
|
-
if (text.length > width)
|
|
32649
|
-
return text.slice(0, width - 3) + "...";
|
|
32650
|
-
return text + " ".repeat(width - text.length);
|
|
32651
|
-
};
|
|
32652
|
-
const headerText = freeOnly ? "Select a FREE OpenRouter Model" : "Select an OpenRouter Model";
|
|
32653
|
-
const headerPadding = " ".repeat(82 - 4 - headerText.length);
|
|
32654
|
-
console.log("");
|
|
32655
|
-
console.log(`${DIM}╭${"─".repeat(82)}╮${RESET}`);
|
|
32656
|
-
console.log(`${DIM}│${RESET} ${BOLD}${CYAN}${headerText}${RESET}${headerPadding}${DIM}│${RESET}`);
|
|
32657
|
-
console.log(`${DIM}├${"─".repeat(82)}┤${RESET}`);
|
|
32658
|
-
console.log(`${DIM}│${RESET} ${DIM}# Model Provider Pricing Context Caps${RESET} ${DIM}│${RESET}`);
|
|
32659
|
-
console.log(`${DIM}├${"─".repeat(82)}┤${RESET}`);
|
|
32660
|
-
models.forEach((modelId, index) => {
|
|
32661
|
-
const num = (index + 1).toString().padStart(2);
|
|
32662
|
-
const enhanced = enhancedMap.get(modelId);
|
|
32663
|
-
if (modelId === "custom") {
|
|
32664
|
-
console.log(`${DIM}│${RESET} ${YELLOW}${num}${RESET} ${DIM}Enter custom OpenRouter model ID...${RESET}${" ".repeat(40)}${DIM}│${RESET}`);
|
|
32665
|
-
} else if (enhanced) {
|
|
32666
|
-
const shortId = pad(modelId, 33);
|
|
32667
|
-
const provider = pad(enhanced.provider || "N/A", 10);
|
|
32668
|
-
const pricing = pad(enhanced.pricing?.average || "N/A", 9);
|
|
32669
|
-
const context = pad(enhanced.context || "N/A", 7);
|
|
32670
|
-
const tools = enhanced.supportsTools ? "✓" : "·";
|
|
32671
|
-
const reasoning = enhanced.supportsReasoning ? "✓" : "·";
|
|
32672
|
-
const vision = enhanced.supportsVision ? "✓" : "·";
|
|
32673
|
-
console.log(`${DIM}│${RESET} ${GREEN}${num}${RESET} ${BOLD}${shortId}${RESET} ${CYAN}${provider}${RESET} ${MAGENTA}${pricing}${RESET} ${context} ${tools} ${reasoning} ${vision} ${DIM}│${RESET}`);
|
|
32674
|
-
} else {
|
|
32675
|
-
const shortId = pad(modelId, 33);
|
|
32676
|
-
console.log(`${DIM}│${RESET} ${GREEN}${num}${RESET} ${shortId} ${DIM}${pad("N/A", 10)} ${pad("N/A", 9)} ${pad("N/A", 7)}${RESET} · · · ${DIM}│${RESET}`);
|
|
32677
|
-
}
|
|
32678
|
-
});
|
|
32679
|
-
console.log(`${DIM}├${"─".repeat(82)}┤${RESET}`);
|
|
32680
|
-
console.log(`${DIM}│${RESET} ${DIM}Caps: ✓/· = Tools, Reasoning, Vision${RESET}${" ".repeat(44)}${DIM}│${RESET}`);
|
|
32681
|
-
console.log(`${DIM}╰${"─".repeat(82)}╯${RESET}`);
|
|
32682
|
-
console.log("");
|
|
32683
|
-
console.log(`${DIM}Enter number (1-${models.length}) or 'q' to quit:${RESET}`);
|
|
32684
|
-
const rl = createInterface({
|
|
32685
|
-
input: process.stdin,
|
|
32686
|
-
output: process.stdout,
|
|
32687
|
-
terminal: false
|
|
32688
|
-
});
|
|
32689
|
-
let selectedModel = null;
|
|
32690
|
-
rl.on("line", (input) => {
|
|
32691
|
-
const trimmed = input.trim();
|
|
32692
|
-
if (trimmed.toLowerCase() === "q") {
|
|
32693
|
-
rl.close();
|
|
32694
|
-
process.exit(0);
|
|
32695
|
-
}
|
|
32696
|
-
const selection = parseInt(trimmed, 10);
|
|
32697
|
-
if (isNaN(selection) || selection < 1 || selection > models.length) {
|
|
32698
|
-
console.log(`\x1B[31mInvalid selection. Please enter 1-${models.length}\x1B[0m`);
|
|
32699
|
-
return;
|
|
32700
|
-
}
|
|
32701
|
-
const model = models[selection - 1];
|
|
32702
|
-
if (model === "custom") {
|
|
32703
|
-
rl.close();
|
|
32704
|
-
console.log(`
|
|
32705
|
-
\x1B[1m\x1B[36mEnter custom OpenRouter model ID:\x1B[0m`);
|
|
32706
|
-
const customRl = createInterface({
|
|
32707
|
-
input: process.stdin,
|
|
32708
|
-
output: process.stdout,
|
|
32709
|
-
terminal: false
|
|
32710
|
-
});
|
|
32711
|
-
let customModel = null;
|
|
32712
|
-
customRl.on("line", (customInput) => {
|
|
32713
|
-
customModel = customInput.trim();
|
|
32714
|
-
customRl.close();
|
|
32715
|
-
});
|
|
32716
|
-
customRl.on("close", () => {
|
|
32717
|
-
process.stdin.pause();
|
|
32718
|
-
process.stdin.removeAllListeners("data");
|
|
32719
|
-
process.stdin.removeAllListeners("end");
|
|
32720
|
-
process.stdin.removeAllListeners("error");
|
|
32721
|
-
process.stdin.removeAllListeners("readable");
|
|
32722
|
-
if (process.stdin.isTTY && process.stdin.setRawMode) {
|
|
32723
|
-
process.stdin.setRawMode(false);
|
|
32724
|
-
}
|
|
32725
|
-
setTimeout(() => {
|
|
32726
|
-
if (customModel) {
|
|
32727
|
-
resolve(customModel);
|
|
32728
|
-
} else {
|
|
32729
|
-
console.error("\x1B[31mError: Model ID cannot be empty\x1B[0m");
|
|
32730
|
-
process.exit(1);
|
|
32731
|
-
}
|
|
32732
|
-
}, 200);
|
|
32733
|
-
});
|
|
32734
|
-
} else {
|
|
32735
|
-
selectedModel = model;
|
|
32736
|
-
rl.close();
|
|
32737
|
-
}
|
|
32738
|
-
});
|
|
32739
|
-
rl.on("close", () => {
|
|
32740
|
-
if (selectedModel) {
|
|
32741
|
-
process.stdin.pause();
|
|
32742
|
-
process.stdin.removeAllListeners("data");
|
|
32743
|
-
process.stdin.removeAllListeners("end");
|
|
32744
|
-
process.stdin.removeAllListeners("error");
|
|
32745
|
-
process.stdin.removeAllListeners("readable");
|
|
32746
|
-
if (process.stdin.isTTY && process.stdin.setRawMode) {
|
|
32747
|
-
process.stdin.setRawMode(false);
|
|
32748
|
-
}
|
|
32749
|
-
setTimeout(() => {
|
|
32750
|
-
resolve(selectedModel);
|
|
32751
|
-
}, 200);
|
|
32752
|
-
}
|
|
32753
|
-
});
|
|
32754
|
-
});
|
|
32755
|
-
}
|
|
32756
|
-
var __filename5, __dirname5, ALL_MODELS_JSON_PATH2, CACHE_MAX_AGE_DAYS3 = 2, TRUSTED_FREE_PROVIDERS;
|
|
32757
|
-
var init_simple_selector = __esm(() => {
|
|
32758
|
-
init_model_loader();
|
|
35544
|
+
init_profile_config();
|
|
32759
35545
|
__filename5 = fileURLToPath4(import.meta.url);
|
|
32760
35546
|
__dirname5 = dirname4(__filename5);
|
|
32761
|
-
|
|
32762
|
-
|
|
32763
|
-
|
|
32764
|
-
|
|
32765
|
-
"x-ai",
|
|
32766
|
-
"deepseek",
|
|
32767
|
-
"qwen",
|
|
32768
|
-
"alibaba",
|
|
32769
|
-
"meta-llama",
|
|
32770
|
-
"microsoft",
|
|
32771
|
-
"mistralai",
|
|
32772
|
-
"nvidia",
|
|
32773
|
-
"cohere"
|
|
32774
|
-
];
|
|
35547
|
+
packageJson = JSON.parse(readFileSync5(join6(__dirname5, "../package.json"), "utf-8"));
|
|
35548
|
+
VERSION = packageJson.version;
|
|
35549
|
+
MODELS_JSON_PATH = join6(__dirname5, "../recommended-models.json");
|
|
35550
|
+
ALL_MODELS_JSON_PATH2 = join6(__dirname5, "../all-models.json");
|
|
32775
35551
|
});
|
|
32776
35552
|
|
|
32777
35553
|
// src/logger.ts
|
|
@@ -32787,8 +35563,8 @@ __export(exports_logger, {
|
|
|
32787
35563
|
getLogLevel: () => getLogLevel,
|
|
32788
35564
|
getLogFilePath: () => getLogFilePath
|
|
32789
35565
|
});
|
|
32790
|
-
import { writeFileSync as
|
|
32791
|
-
import { join as
|
|
35566
|
+
import { writeFileSync as writeFileSync7, appendFile, existsSync as existsSync6, mkdirSync as mkdirSync3 } from "fs";
|
|
35567
|
+
import { join as join7 } from "path";
|
|
32792
35568
|
function flushLogBuffer() {
|
|
32793
35569
|
if (!logFilePath || logBuffer.length === 0)
|
|
32794
35570
|
return;
|
|
@@ -32812,7 +35588,7 @@ function scheduleFlush() {
|
|
|
32812
35588
|
flushTimer = null;
|
|
32813
35589
|
}
|
|
32814
35590
|
if (logFilePath && logBuffer.length > 0) {
|
|
32815
|
-
|
|
35591
|
+
writeFileSync7(logFilePath, logBuffer.join(""), { flag: "a" });
|
|
32816
35592
|
logBuffer = [];
|
|
32817
35593
|
}
|
|
32818
35594
|
});
|
|
@@ -32827,13 +35603,13 @@ function initLogger(debugMode, level = "info") {
|
|
|
32827
35603
|
return;
|
|
32828
35604
|
}
|
|
32829
35605
|
logLevel = level;
|
|
32830
|
-
const logsDir =
|
|
32831
|
-
if (!
|
|
32832
|
-
|
|
35606
|
+
const logsDir = join7(process.cwd(), "logs");
|
|
35607
|
+
if (!existsSync6(logsDir)) {
|
|
35608
|
+
mkdirSync3(logsDir, { recursive: true });
|
|
32833
35609
|
}
|
|
32834
35610
|
const timestamp = new Date().toISOString().replace(/[:.]/g, "-").split("T").join("_").slice(0, -5);
|
|
32835
|
-
logFilePath =
|
|
32836
|
-
|
|
35611
|
+
logFilePath = join7(logsDir, `claudish_${timestamp}.log`);
|
|
35612
|
+
writeFileSync7(logFilePath, `Claudish Debug Log - ${new Date().toISOString()}
|
|
32837
35613
|
Log Level: ${level}
|
|
32838
35614
|
${"=".repeat(80)}
|
|
32839
35615
|
|
|
@@ -32942,7 +35718,7 @@ async function isPortAvailable(port) {
|
|
|
32942
35718
|
}
|
|
32943
35719
|
var init_port_manager = () => {};
|
|
32944
35720
|
|
|
32945
|
-
// node_modules
|
|
35721
|
+
// node_modules/hono/dist/compose.js
|
|
32946
35722
|
var compose = (middleware, onError, onNotFound) => {
|
|
32947
35723
|
return (context, next) => {
|
|
32948
35724
|
let index = -1;
|
|
@@ -32987,16 +35763,16 @@ var compose = (middleware, onError, onNotFound) => {
|
|
|
32987
35763
|
};
|
|
32988
35764
|
var init_compose = () => {};
|
|
32989
35765
|
|
|
32990
|
-
// node_modules
|
|
35766
|
+
// node_modules/hono/dist/http-exception.js
|
|
32991
35767
|
var init_http_exception = () => {};
|
|
32992
35768
|
|
|
32993
|
-
// node_modules
|
|
35769
|
+
// node_modules/hono/dist/request/constants.js
|
|
32994
35770
|
var GET_MATCH_RESULT;
|
|
32995
35771
|
var init_constants = __esm(() => {
|
|
32996
35772
|
GET_MATCH_RESULT = Symbol();
|
|
32997
35773
|
});
|
|
32998
35774
|
|
|
32999
|
-
// node_modules
|
|
35775
|
+
// node_modules/hono/dist/utils/body.js
|
|
33000
35776
|
async function parseFormData(request, options) {
|
|
33001
35777
|
const formData = await request.formData();
|
|
33002
35778
|
if (formData) {
|
|
@@ -33065,7 +35841,7 @@ var init_body = __esm(() => {
|
|
|
33065
35841
|
init_request();
|
|
33066
35842
|
});
|
|
33067
35843
|
|
|
33068
|
-
// node_modules
|
|
35844
|
+
// node_modules/hono/dist/utils/url.js
|
|
33069
35845
|
var splitPath = (path) => {
|
|
33070
35846
|
const paths = path.split("/");
|
|
33071
35847
|
if (paths[0] === "") {
|
|
@@ -33252,7 +36028,7 @@ var init_url = __esm(() => {
|
|
|
33252
36028
|
decodeURIComponent_ = decodeURIComponent;
|
|
33253
36029
|
});
|
|
33254
36030
|
|
|
33255
|
-
// node_modules
|
|
36031
|
+
// node_modules/hono/dist/request.js
|
|
33256
36032
|
var tryDecodeURIComponent = (str) => tryDecode(str, decodeURIComponent_), HonoRequest;
|
|
33257
36033
|
var init_request = __esm(() => {
|
|
33258
36034
|
init_http_exception();
|
|
@@ -33369,7 +36145,7 @@ var init_request = __esm(() => {
|
|
|
33369
36145
|
};
|
|
33370
36146
|
});
|
|
33371
36147
|
|
|
33372
|
-
// node_modules
|
|
36148
|
+
// node_modules/hono/dist/utils/html.js
|
|
33373
36149
|
var HtmlEscapedCallbackPhase, raw = (value, callbacks) => {
|
|
33374
36150
|
const escapedString = new String(value);
|
|
33375
36151
|
escapedString.isEscaped = true;
|
|
@@ -33408,7 +36184,7 @@ var init_html = __esm(() => {
|
|
|
33408
36184
|
};
|
|
33409
36185
|
});
|
|
33410
36186
|
|
|
33411
|
-
// node_modules
|
|
36187
|
+
// node_modules/hono/dist/context.js
|
|
33412
36188
|
var TEXT_PLAIN = "text/plain; charset=UTF-8", setDefaultContentType = (contentType, headers) => {
|
|
33413
36189
|
return {
|
|
33414
36190
|
"Content-Type": contentType,
|
|
@@ -33576,7 +36352,7 @@ var init_context = __esm(() => {
|
|
|
33576
36352
|
init_html();
|
|
33577
36353
|
});
|
|
33578
36354
|
|
|
33579
|
-
// node_modules
|
|
36355
|
+
// node_modules/hono/dist/router.js
|
|
33580
36356
|
var METHOD_NAME_ALL = "ALL", METHOD_NAME_ALL_LOWERCASE = "all", METHODS, MESSAGE_MATCHER_IS_ALREADY_BUILT = "Can not add a route since the matcher is already built.", UnsupportedPathError;
|
|
33581
36357
|
var init_router = __esm(() => {
|
|
33582
36358
|
METHODS = ["get", "post", "put", "delete", "options", "patch"];
|
|
@@ -33584,11 +36360,11 @@ var init_router = __esm(() => {
|
|
|
33584
36360
|
};
|
|
33585
36361
|
});
|
|
33586
36362
|
|
|
33587
|
-
// node_modules
|
|
36363
|
+
// node_modules/hono/dist/utils/constants.js
|
|
33588
36364
|
var COMPOSED_HANDLER = "__COMPOSED_HANDLER";
|
|
33589
36365
|
var init_constants2 = () => {};
|
|
33590
36366
|
|
|
33591
|
-
// node_modules
|
|
36367
|
+
// node_modules/hono/dist/hono-base.js
|
|
33592
36368
|
var notFoundHandler = (c) => {
|
|
33593
36369
|
return c.text("404 Not Found", 404);
|
|
33594
36370
|
}, errorHandler = (err, c) => {
|
|
@@ -33812,7 +36588,7 @@ var init_hono_base = __esm(() => {
|
|
|
33812
36588
|
init_url();
|
|
33813
36589
|
});
|
|
33814
36590
|
|
|
33815
|
-
// node_modules
|
|
36591
|
+
// node_modules/hono/dist/router/reg-exp-router/matcher.js
|
|
33816
36592
|
function match(method, path) {
|
|
33817
36593
|
const matchers = this.buildAllMatchers();
|
|
33818
36594
|
const match2 = (method2, path2) => {
|
|
@@ -33837,7 +36613,7 @@ var init_matcher = __esm(() => {
|
|
|
33837
36613
|
emptyParam = [];
|
|
33838
36614
|
});
|
|
33839
36615
|
|
|
33840
|
-
// node_modules
|
|
36616
|
+
// node_modules/hono/dist/router/reg-exp-router/node.js
|
|
33841
36617
|
function compareKey(a, b) {
|
|
33842
36618
|
if (a.length === 1) {
|
|
33843
36619
|
return b.length === 1 ? a < b ? -1 : 1 : -1;
|
|
@@ -33940,7 +36716,7 @@ var init_node = __esm(() => {
|
|
|
33940
36716
|
regExpMetaChars = new Set(".\\+*[^]$()");
|
|
33941
36717
|
});
|
|
33942
36718
|
|
|
33943
|
-
// node_modules
|
|
36719
|
+
// node_modules/hono/dist/router/reg-exp-router/trie.js
|
|
33944
36720
|
var Trie = class {
|
|
33945
36721
|
#context = { varIndex: 0 };
|
|
33946
36722
|
#root = new Node;
|
|
@@ -33999,7 +36775,7 @@ var init_trie = __esm(() => {
|
|
|
33999
36775
|
init_node();
|
|
34000
36776
|
});
|
|
34001
36777
|
|
|
34002
|
-
// node_modules
|
|
36778
|
+
// node_modules/hono/dist/router/reg-exp-router/router.js
|
|
34003
36779
|
function buildWildcardRegExp(path) {
|
|
34004
36780
|
return wildcardRegExpCache[path] ??= new RegExp(path === "*" ? "" : `^${path.replace(/\/\*$|([.\\+*[^\]$()])/g, (_, metaChar) => metaChar ? `\\${metaChar}` : "(?:|/.*)")}$`);
|
|
34005
36781
|
}
|
|
@@ -34171,7 +36947,7 @@ var init_router2 = __esm(() => {
|
|
|
34171
36947
|
wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
|
|
34172
36948
|
});
|
|
34173
36949
|
|
|
34174
|
-
// node_modules
|
|
36950
|
+
// node_modules/hono/dist/router/reg-exp-router/prepared-router.js
|
|
34175
36951
|
var PreparedRegExpRouter = class {
|
|
34176
36952
|
name = "PreparedRegExpRouter";
|
|
34177
36953
|
#matchers;
|
|
@@ -34248,13 +37024,13 @@ var init_prepared_router = __esm(() => {
|
|
|
34248
37024
|
init_router2();
|
|
34249
37025
|
});
|
|
34250
37026
|
|
|
34251
|
-
// node_modules
|
|
37027
|
+
// node_modules/hono/dist/router/reg-exp-router/index.js
|
|
34252
37028
|
var init_reg_exp_router = __esm(() => {
|
|
34253
37029
|
init_router2();
|
|
34254
37030
|
init_prepared_router();
|
|
34255
37031
|
});
|
|
34256
37032
|
|
|
34257
|
-
// node_modules
|
|
37033
|
+
// node_modules/hono/dist/router/smart-router/router.js
|
|
34258
37034
|
var SmartRouter = class {
|
|
34259
37035
|
name = "SmartRouter";
|
|
34260
37036
|
#routers = [];
|
|
@@ -34312,12 +37088,12 @@ var init_router3 = __esm(() => {
|
|
|
34312
37088
|
init_router();
|
|
34313
37089
|
});
|
|
34314
37090
|
|
|
34315
|
-
// node_modules
|
|
37091
|
+
// node_modules/hono/dist/router/smart-router/index.js
|
|
34316
37092
|
var init_smart_router = __esm(() => {
|
|
34317
37093
|
init_router3();
|
|
34318
37094
|
});
|
|
34319
37095
|
|
|
34320
|
-
// node_modules
|
|
37096
|
+
// node_modules/hono/dist/router/trie-router/node.js
|
|
34321
37097
|
var emptyParams, Node2 = class {
|
|
34322
37098
|
#methods;
|
|
34323
37099
|
#children;
|
|
@@ -34475,7 +37251,7 @@ var init_node2 = __esm(() => {
|
|
|
34475
37251
|
emptyParams = /* @__PURE__ */ Object.create(null);
|
|
34476
37252
|
});
|
|
34477
37253
|
|
|
34478
|
-
// node_modules
|
|
37254
|
+
// node_modules/hono/dist/router/trie-router/router.js
|
|
34479
37255
|
var TrieRouter = class {
|
|
34480
37256
|
name = "TrieRouter";
|
|
34481
37257
|
#node;
|
|
@@ -34501,12 +37277,12 @@ var init_router4 = __esm(() => {
|
|
|
34501
37277
|
init_node2();
|
|
34502
37278
|
});
|
|
34503
37279
|
|
|
34504
|
-
// node_modules
|
|
37280
|
+
// node_modules/hono/dist/router/trie-router/index.js
|
|
34505
37281
|
var init_trie_router = __esm(() => {
|
|
34506
37282
|
init_router4();
|
|
34507
37283
|
});
|
|
34508
37284
|
|
|
34509
|
-
// node_modules
|
|
37285
|
+
// node_modules/hono/dist/hono.js
|
|
34510
37286
|
var Hono2;
|
|
34511
37287
|
var init_hono = __esm(() => {
|
|
34512
37288
|
init_hono_base();
|
|
@@ -34523,12 +37299,12 @@ var init_hono = __esm(() => {
|
|
|
34523
37299
|
};
|
|
34524
37300
|
});
|
|
34525
37301
|
|
|
34526
|
-
// node_modules
|
|
34527
|
-
var
|
|
37302
|
+
// node_modules/hono/dist/index.js
|
|
37303
|
+
var init_dist9 = __esm(() => {
|
|
34528
37304
|
init_hono();
|
|
34529
37305
|
});
|
|
34530
37306
|
|
|
34531
|
-
// node_modules
|
|
37307
|
+
// node_modules/hono/dist/middleware/cors/index.js
|
|
34532
37308
|
var cors = (options) => {
|
|
34533
37309
|
const defaults = {
|
|
34534
37310
|
origin: "*",
|
|
@@ -34614,7 +37390,7 @@ var cors = (options) => {
|
|
|
34614
37390
|
};
|
|
34615
37391
|
var init_cors = () => {};
|
|
34616
37392
|
|
|
34617
|
-
// node_modules
|
|
37393
|
+
// node_modules/@hono/node-server/dist/index.mjs
|
|
34618
37394
|
import { createServer as createServerHTTP } from "http";
|
|
34619
37395
|
import { Http2ServerRequest as Http2ServerRequest2 } from "http2";
|
|
34620
37396
|
import { Http2ServerRequest } from "http2";
|
|
@@ -34989,7 +37765,7 @@ var RequestError, toRequestError = (e) => {
|
|
|
34989
37765
|
});
|
|
34990
37766
|
return server;
|
|
34991
37767
|
};
|
|
34992
|
-
var
|
|
37768
|
+
var init_dist10 = __esm(() => {
|
|
34993
37769
|
RequestError = class extends Error {
|
|
34994
37770
|
constructor(message, options) {
|
|
34995
37771
|
super(message, options);
|
|
@@ -35950,7 +38726,9 @@ function transformOpenAIToClaude(claudeRequestInput) {
|
|
|
35950
38726
|
var init_transform = () => {};
|
|
35951
38727
|
|
|
35952
38728
|
// src/handlers/openrouter-handler.ts
|
|
35953
|
-
import { writeFileSync as
|
|
38729
|
+
import { writeFileSync as writeFileSync8 } from "node:fs";
|
|
38730
|
+
import { tmpdir as tmpdir2 } from "node:os";
|
|
38731
|
+
import { join as join8 } from "node:path";
|
|
35954
38732
|
|
|
35955
38733
|
class OpenRouterHandler {
|
|
35956
38734
|
targetModel;
|
|
@@ -35997,7 +38775,7 @@ class OpenRouterHandler {
|
|
|
35997
38775
|
context_left_percent: leftPct,
|
|
35998
38776
|
updated_at: Date.now()
|
|
35999
38777
|
};
|
|
36000
|
-
|
|
38778
|
+
writeFileSync8(join8(tmpdir2(), `claudish-tokens-${this.port}.json`), JSON.stringify(data), "utf-8");
|
|
36001
38779
|
} catch (e) {}
|
|
36002
38780
|
}
|
|
36003
38781
|
async handle(c, payload) {
|
|
@@ -36425,31 +39203,217 @@ async function createProxyServer(port, openrouterApiKey, model, monitorMode = fa
|
|
|
36425
39203
|
};
|
|
36426
39204
|
}
|
|
36427
39205
|
var init_proxy_server = __esm(() => {
|
|
36428
|
-
|
|
39206
|
+
init_dist9();
|
|
36429
39207
|
init_cors();
|
|
36430
|
-
|
|
39208
|
+
init_dist10();
|
|
36431
39209
|
init_logger();
|
|
36432
39210
|
init_native_handler();
|
|
36433
39211
|
init_openrouter_handler();
|
|
36434
39212
|
});
|
|
36435
39213
|
|
|
39214
|
+
// src/update-checker.ts
|
|
39215
|
+
var exports_update_checker = {};
|
|
39216
|
+
__export(exports_update_checker, {
|
|
39217
|
+
checkForUpdates: () => checkForUpdates
|
|
39218
|
+
});
|
|
39219
|
+
import { execSync } from "node:child_process";
|
|
39220
|
+
import { createInterface as createInterface2 } from "node:readline";
|
|
39221
|
+
import { existsSync as existsSync7, readFileSync as readFileSync6, writeFileSync as writeFileSync9, mkdirSync as mkdirSync4, unlinkSync as unlinkSync2 } from "node:fs";
|
|
39222
|
+
import { join as join9 } from "node:path";
|
|
39223
|
+
import { tmpdir as tmpdir3, homedir as homedir2, platform as platform2 } from "node:os";
|
|
39224
|
+
function getCacheFilePath() {
|
|
39225
|
+
let cacheDir;
|
|
39226
|
+
if (isWindows2) {
|
|
39227
|
+
const localAppData = process.env.LOCALAPPDATA || join9(homedir2(), "AppData", "Local");
|
|
39228
|
+
cacheDir = join9(localAppData, "claudish");
|
|
39229
|
+
} else {
|
|
39230
|
+
cacheDir = join9(homedir2(), ".cache", "claudish");
|
|
39231
|
+
}
|
|
39232
|
+
try {
|
|
39233
|
+
if (!existsSync7(cacheDir)) {
|
|
39234
|
+
mkdirSync4(cacheDir, { recursive: true });
|
|
39235
|
+
}
|
|
39236
|
+
return join9(cacheDir, "update-check.json");
|
|
39237
|
+
} catch {
|
|
39238
|
+
return join9(tmpdir3(), "claudish-update-check.json");
|
|
39239
|
+
}
|
|
39240
|
+
}
|
|
39241
|
+
function readCache() {
|
|
39242
|
+
try {
|
|
39243
|
+
const cachePath = getCacheFilePath();
|
|
39244
|
+
if (!existsSync7(cachePath)) {
|
|
39245
|
+
return null;
|
|
39246
|
+
}
|
|
39247
|
+
const data = JSON.parse(readFileSync6(cachePath, "utf-8"));
|
|
39248
|
+
return data;
|
|
39249
|
+
} catch {
|
|
39250
|
+
return null;
|
|
39251
|
+
}
|
|
39252
|
+
}
|
|
39253
|
+
function writeCache(latestVersion) {
|
|
39254
|
+
try {
|
|
39255
|
+
const cachePath = getCacheFilePath();
|
|
39256
|
+
const data = {
|
|
39257
|
+
lastCheck: Date.now(),
|
|
39258
|
+
latestVersion
|
|
39259
|
+
};
|
|
39260
|
+
writeFileSync9(cachePath, JSON.stringify(data), "utf-8");
|
|
39261
|
+
} catch {}
|
|
39262
|
+
}
|
|
39263
|
+
function isCacheValid(cache) {
|
|
39264
|
+
const age = Date.now() - cache.lastCheck;
|
|
39265
|
+
return age < CACHE_MAX_AGE_MS;
|
|
39266
|
+
}
|
|
39267
|
+
function clearCache() {
|
|
39268
|
+
try {
|
|
39269
|
+
const cachePath = getCacheFilePath();
|
|
39270
|
+
if (existsSync7(cachePath)) {
|
|
39271
|
+
unlinkSync2(cachePath);
|
|
39272
|
+
}
|
|
39273
|
+
} catch {}
|
|
39274
|
+
}
|
|
39275
|
+
function compareVersions(v1, v2) {
|
|
39276
|
+
const parts1 = v1.replace(/^v/, "").split(".").map(Number);
|
|
39277
|
+
const parts2 = v2.replace(/^v/, "").split(".").map(Number);
|
|
39278
|
+
for (let i = 0;i < Math.max(parts1.length, parts2.length); i++) {
|
|
39279
|
+
const p1 = parts1[i] || 0;
|
|
39280
|
+
const p2 = parts2[i] || 0;
|
|
39281
|
+
if (p1 > p2)
|
|
39282
|
+
return 1;
|
|
39283
|
+
if (p1 < p2)
|
|
39284
|
+
return -1;
|
|
39285
|
+
}
|
|
39286
|
+
return 0;
|
|
39287
|
+
}
|
|
39288
|
+
async function fetchLatestVersion() {
|
|
39289
|
+
try {
|
|
39290
|
+
const controller = new AbortController;
|
|
39291
|
+
const timeout = setTimeout(() => controller.abort(), 5000);
|
|
39292
|
+
const response = await fetch(NPM_REGISTRY_URL, {
|
|
39293
|
+
signal: controller.signal,
|
|
39294
|
+
headers: { Accept: "application/json" }
|
|
39295
|
+
});
|
|
39296
|
+
clearTimeout(timeout);
|
|
39297
|
+
if (!response.ok) {
|
|
39298
|
+
return null;
|
|
39299
|
+
}
|
|
39300
|
+
const data = await response.json();
|
|
39301
|
+
return data.version || null;
|
|
39302
|
+
} catch {
|
|
39303
|
+
return null;
|
|
39304
|
+
}
|
|
39305
|
+
}
|
|
39306
|
+
function promptUser(question) {
|
|
39307
|
+
return new Promise((resolve) => {
|
|
39308
|
+
const rl = createInterface2({
|
|
39309
|
+
input: process.stdin,
|
|
39310
|
+
output: process.stderr
|
|
39311
|
+
});
|
|
39312
|
+
rl.question(question, (answer) => {
|
|
39313
|
+
rl.close();
|
|
39314
|
+
const normalized = answer.toLowerCase().trim();
|
|
39315
|
+
resolve(normalized === "y" || normalized === "yes");
|
|
39316
|
+
});
|
|
39317
|
+
});
|
|
39318
|
+
}
|
|
39319
|
+
function runUpdate() {
|
|
39320
|
+
try {
|
|
39321
|
+
console.error(`
|
|
39322
|
+
[claudish] Updating...
|
|
39323
|
+
`);
|
|
39324
|
+
const result = execSync("npm install -g claudish@latest", {
|
|
39325
|
+
stdio: "inherit",
|
|
39326
|
+
encoding: "utf-8",
|
|
39327
|
+
shell: true
|
|
39328
|
+
});
|
|
39329
|
+
console.error(`
|
|
39330
|
+
[claudish] Update complete! Please restart claudish.
|
|
39331
|
+
`);
|
|
39332
|
+
return true;
|
|
39333
|
+
} catch (error46) {
|
|
39334
|
+
console.error(`
|
|
39335
|
+
[claudish] Update failed. Try manually:`);
|
|
39336
|
+
console.error(` npm install -g claudish@latest
|
|
39337
|
+
`);
|
|
39338
|
+
return false;
|
|
39339
|
+
}
|
|
39340
|
+
}
|
|
39341
|
+
async function checkForUpdates(currentVersion, options = {}) {
|
|
39342
|
+
const { quiet = false, skipPrompt = false } = options;
|
|
39343
|
+
let latestVersion = null;
|
|
39344
|
+
const cache = readCache();
|
|
39345
|
+
if (cache && isCacheValid(cache)) {
|
|
39346
|
+
latestVersion = cache.latestVersion;
|
|
39347
|
+
} else {
|
|
39348
|
+
latestVersion = await fetchLatestVersion();
|
|
39349
|
+
writeCache(latestVersion);
|
|
39350
|
+
}
|
|
39351
|
+
if (!latestVersion) {
|
|
39352
|
+
return false;
|
|
39353
|
+
}
|
|
39354
|
+
if (compareVersions(latestVersion, currentVersion) <= 0) {
|
|
39355
|
+
return false;
|
|
39356
|
+
}
|
|
39357
|
+
if (!quiet) {
|
|
39358
|
+
console.error("");
|
|
39359
|
+
console.error("━".repeat(60));
|
|
39360
|
+
console.error(` New version available: ${currentVersion} → ${latestVersion}`);
|
|
39361
|
+
console.error("━".repeat(60));
|
|
39362
|
+
console.error("");
|
|
39363
|
+
}
|
|
39364
|
+
if (skipPrompt) {
|
|
39365
|
+
if (!quiet) {
|
|
39366
|
+
console.error(` Update with: npm install -g claudish@latest
|
|
39367
|
+
`);
|
|
39368
|
+
}
|
|
39369
|
+
return false;
|
|
39370
|
+
}
|
|
39371
|
+
const shouldUpdate = await promptUser(" Would you like to update now? [y/N] ");
|
|
39372
|
+
if (!shouldUpdate) {
|
|
39373
|
+
if (!quiet) {
|
|
39374
|
+
console.error(`
|
|
39375
|
+
Skipped. Update later with: npm install -g claudish@latest
|
|
39376
|
+
`);
|
|
39377
|
+
}
|
|
39378
|
+
return false;
|
|
39379
|
+
}
|
|
39380
|
+
const success2 = runUpdate();
|
|
39381
|
+
if (success2) {
|
|
39382
|
+
clearCache();
|
|
39383
|
+
return true;
|
|
39384
|
+
}
|
|
39385
|
+
return false;
|
|
39386
|
+
}
|
|
39387
|
+
var isWindows2, NPM_REGISTRY_URL = "https://registry.npmjs.org/claudish/latest", CACHE_MAX_AGE_MS;
|
|
39388
|
+
var init_update_checker = __esm(() => {
|
|
39389
|
+
isWindows2 = platform2() === "win32";
|
|
39390
|
+
CACHE_MAX_AGE_MS = 24 * 60 * 60 * 1000;
|
|
39391
|
+
});
|
|
39392
|
+
|
|
36436
39393
|
// src/index.ts
|
|
36437
39394
|
var import_dotenv2 = __toESM(require_main(), 1);
|
|
36438
39395
|
import_dotenv2.config();
|
|
36439
39396
|
var isMcpMode = process.argv.includes("--mcp");
|
|
39397
|
+
var args = process.argv.slice(2);
|
|
39398
|
+
var firstArg = args[0];
|
|
36440
39399
|
if (isMcpMode) {
|
|
36441
39400
|
Promise.resolve().then(() => (init_mcp_server(), exports_mcp_server)).then((mcp) => mcp.startMcpServer());
|
|
39401
|
+
} else if (firstArg === "init") {
|
|
39402
|
+
Promise.resolve().then(() => (init_profile_commands(), exports_profile_commands)).then((pc) => pc.initCommand());
|
|
39403
|
+
} else if (firstArg === "profile") {
|
|
39404
|
+
Promise.resolve().then(() => (init_profile_commands(), exports_profile_commands)).then((pc) => pc.profileCommand(args.slice(1)));
|
|
36442
39405
|
} else {
|
|
36443
39406
|
runCli();
|
|
36444
39407
|
}
|
|
36445
39408
|
async function runCli() {
|
|
36446
39409
|
const { checkClaudeInstalled: checkClaudeInstalled2, runClaudeWithProxy: runClaudeWithProxy2 } = await Promise.resolve().then(() => (init_claude_runner(), exports_claude_runner));
|
|
36447
|
-
const { parseArgs: parseArgs2 } = await Promise.resolve().then(() => (init_cli(), exports_cli));
|
|
39410
|
+
const { parseArgs: parseArgs2, getVersion: getVersion2 } = await Promise.resolve().then(() => (init_cli(), exports_cli));
|
|
36448
39411
|
const { DEFAULT_PORT_RANGE: DEFAULT_PORT_RANGE2 } = await Promise.resolve().then(() => (init_config(), exports_config));
|
|
36449
|
-
const {
|
|
39412
|
+
const { selectModel: selectModel2, promptForApiKey: promptForApiKey2 } = await Promise.resolve().then(() => (init_model_selector(), exports_model_selector));
|
|
36450
39413
|
const { initLogger: initLogger2, getLogFilePath: getLogFilePath2 } = await Promise.resolve().then(() => (init_logger(), exports_logger));
|
|
36451
39414
|
const { findAvailablePort: findAvailablePort2 } = await Promise.resolve().then(() => (init_port_manager(), exports_port_manager));
|
|
36452
39415
|
const { createProxyServer: createProxyServer2 } = await Promise.resolve().then(() => (init_proxy_server(), exports_proxy_server));
|
|
39416
|
+
const { checkForUpdates: checkForUpdates2 } = await Promise.resolve().then(() => (init_update_checker(), exports_update_checker));
|
|
36453
39417
|
async function readStdin() {
|
|
36454
39418
|
const chunks = [];
|
|
36455
39419
|
for await (const chunk of process.stdin) {
|
|
@@ -36466,6 +39430,15 @@ async function runCli() {
|
|
|
36466
39430
|
console.log(`[claudish] Debug log: ${logFile}`);
|
|
36467
39431
|
}
|
|
36468
39432
|
}
|
|
39433
|
+
if (cliConfig.interactive && !cliConfig.jsonOutput) {
|
|
39434
|
+
const shouldExit = await checkForUpdates2(getVersion2(), {
|
|
39435
|
+
quiet: cliConfig.quiet,
|
|
39436
|
+
skipPrompt: false
|
|
39437
|
+
});
|
|
39438
|
+
if (shouldExit) {
|
|
39439
|
+
process.exit(0);
|
|
39440
|
+
}
|
|
39441
|
+
}
|
|
36469
39442
|
if (!await checkClaudeInstalled2()) {
|
|
36470
39443
|
console.error("Error: Claude Code CLI is not installed");
|
|
36471
39444
|
console.error("Install it from: https://claude.com/claude-code");
|
|
@@ -36476,7 +39449,7 @@ async function runCli() {
|
|
|
36476
39449
|
console.log("");
|
|
36477
39450
|
}
|
|
36478
39451
|
if (cliConfig.interactive && !cliConfig.monitor && !cliConfig.model) {
|
|
36479
|
-
cliConfig.model = await
|
|
39452
|
+
cliConfig.model = await selectModel2({ freeOnly: cliConfig.freeOnly });
|
|
36480
39453
|
console.log("");
|
|
36481
39454
|
}
|
|
36482
39455
|
if (!cliConfig.interactive && !cliConfig.monitor && !cliConfig.model) {
|