claude-multi 0.5.7 → 0.6.0
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/CHANGELOG.md +40 -14
- package/dist/cli.js +2798 -441
- package/package.json +13 -4
package/dist/cli.js
CHANGED
|
@@ -7293,6 +7293,25 @@ var require_prompts3 = __commonJS((exports, module) => {
|
|
|
7293
7293
|
});
|
|
7294
7294
|
|
|
7295
7295
|
// src/templates.ts
|
|
7296
|
+
function getApiKeyPlaceholder(providerName) {
|
|
7297
|
+
const prefix = API_KEY_PREFIXES[providerName];
|
|
7298
|
+
return prefix ? `${prefix}...` : "sk-...";
|
|
7299
|
+
}
|
|
7300
|
+
function providerHasRegions(providerName) {
|
|
7301
|
+
return providerName === "mimo-token";
|
|
7302
|
+
}
|
|
7303
|
+
function resolveRegionTemplate(template, region) {
|
|
7304
|
+
if (!providerHasRegions(template.name)) {
|
|
7305
|
+
return template;
|
|
7306
|
+
}
|
|
7307
|
+
const regionConfig = MIMO_TOKEN_REGIONS[region];
|
|
7308
|
+
if (!regionConfig) {
|
|
7309
|
+
throw new Error(`Unknown region '${region}' for ${template.name}. Available: ${Object.keys(MIMO_TOKEN_REGIONS).join(", ")}`);
|
|
7310
|
+
}
|
|
7311
|
+
const resolved = structuredClone(template);
|
|
7312
|
+
resolved.settings.env.ANTHROPIC_BASE_URL = regionConfig.baseUrl;
|
|
7313
|
+
return resolved;
|
|
7314
|
+
}
|
|
7296
7315
|
function getAvailableProviders() {
|
|
7297
7316
|
return Object.values(PROVIDER_TEMPLATES);
|
|
7298
7317
|
}
|
|
@@ -7301,11 +7320,16 @@ function getProviderTemplate(name) {
|
|
|
7301
7320
|
}
|
|
7302
7321
|
function applyProviderTemplate(template, apiKey) {
|
|
7303
7322
|
const settings = structuredClone(template.settings);
|
|
7323
|
+
settings.env = { ...PROVIDER_COMMON_ENV, ...settings.env };
|
|
7304
7324
|
settings.env.ANTHROPIC_AUTH_TOKEN = apiKey;
|
|
7305
7325
|
return settings;
|
|
7306
7326
|
}
|
|
7307
|
-
var PROVIDER_TEMPLATES;
|
|
7327
|
+
var PROVIDER_COMMON_ENV, PROVIDER_TEMPLATES, API_KEY_PREFIXES, MIMO_TOKEN_REGIONS;
|
|
7308
7328
|
var init_templates = __esm(() => {
|
|
7329
|
+
PROVIDER_COMMON_ENV = {
|
|
7330
|
+
DISABLE_AUTOUPDATER: "1",
|
|
7331
|
+
DISABLE_UPDATES: "1"
|
|
7332
|
+
};
|
|
7309
7333
|
PROVIDER_TEMPLATES = {
|
|
7310
7334
|
glm: {
|
|
7311
7335
|
name: "glm",
|
|
@@ -7468,6 +7492,23 @@ var init_templates = __esm(() => {
|
|
|
7468
7492
|
}
|
|
7469
7493
|
}
|
|
7470
7494
|
};
|
|
7495
|
+
API_KEY_PREFIXES = {
|
|
7496
|
+
"mimo-token": "tp_"
|
|
7497
|
+
};
|
|
7498
|
+
MIMO_TOKEN_REGIONS = {
|
|
7499
|
+
cn: {
|
|
7500
|
+
label: "China",
|
|
7501
|
+
baseUrl: "https://token-plan-cn.xiaomimimo.com/anthropic"
|
|
7502
|
+
},
|
|
7503
|
+
sgp: {
|
|
7504
|
+
label: "Singapore",
|
|
7505
|
+
baseUrl: "https://token-plan-sgp.xiaomimimo.com/anthropic"
|
|
7506
|
+
},
|
|
7507
|
+
ams: {
|
|
7508
|
+
label: "Europe",
|
|
7509
|
+
baseUrl: "https://token-plan-ams.xiaomimimo.com/anthropic"
|
|
7510
|
+
}
|
|
7511
|
+
};
|
|
7471
7512
|
});
|
|
7472
7513
|
|
|
7473
7514
|
// src/util/json-file.ts
|
|
@@ -7571,11 +7612,22 @@ var init_constants = __esm(() => {
|
|
|
7571
7612
|
});
|
|
7572
7613
|
|
|
7573
7614
|
// src/paths.ts
|
|
7615
|
+
var exports_paths = {};
|
|
7616
|
+
__export(exports_paths, {
|
|
7617
|
+
getBaseDir: () => getBaseDir,
|
|
7618
|
+
PINNED_CLAUDE_BIN: () => PINNED_CLAUDE_BIN,
|
|
7619
|
+
PINNED_BIN_DIR: () => PINNED_BIN_DIR
|
|
7620
|
+
});
|
|
7574
7621
|
import { homedir } from "node:os";
|
|
7622
|
+
import { join } from "node:path";
|
|
7575
7623
|
function getBaseDir() {
|
|
7576
7624
|
return process.env.CLAUDE_MULTI_HOME || homedir();
|
|
7577
7625
|
}
|
|
7578
|
-
var
|
|
7626
|
+
var PINNED_BIN_DIR, PINNED_CLAUDE_BIN;
|
|
7627
|
+
var init_paths = __esm(() => {
|
|
7628
|
+
PINNED_BIN_DIR = join(homedir(), ".claude-multi", "bin");
|
|
7629
|
+
PINNED_CLAUDE_BIN = process.platform === "win32" ? join(PINNED_BIN_DIR, "node_modules", ".bin", "claude.cmd") : join(PINNED_BIN_DIR, "node_modules", ".bin", "claude");
|
|
7630
|
+
});
|
|
7579
7631
|
|
|
7580
7632
|
// src/migration.ts
|
|
7581
7633
|
var exports_migration = {};
|
|
@@ -7589,12 +7641,12 @@ __export(exports_migration, {
|
|
|
7589
7641
|
CONFIG_VERSION: () => CONFIG_VERSION
|
|
7590
7642
|
});
|
|
7591
7643
|
import { existsSync, mkdirSync, readdirSync, copyFileSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
7592
|
-
import { join, dirname } from "node:path";
|
|
7644
|
+
import { join as join2, dirname } from "node:path";
|
|
7593
7645
|
function getBackupDir() {
|
|
7594
|
-
return
|
|
7646
|
+
return join2(getBaseDir(), ".claude-multi", "backups");
|
|
7595
7647
|
}
|
|
7596
7648
|
function getLockFile() {
|
|
7597
|
-
return
|
|
7649
|
+
return join2(getBaseDir(), ".claude-multi", ".migration.lock");
|
|
7598
7650
|
}
|
|
7599
7651
|
function createLock() {
|
|
7600
7652
|
const lockFile = getLockFile();
|
|
@@ -7650,24 +7702,24 @@ async function createBackup(config) {
|
|
|
7650
7702
|
const ts = new Date().toISOString().replace(/[:.]/g, "-");
|
|
7651
7703
|
const rand = Math.random().toString(36).slice(2, 6);
|
|
7652
7704
|
const fromV = config.version || "1.0.0";
|
|
7653
|
-
const backupPath =
|
|
7705
|
+
const backupPath = join2(backupDir, `${ts}-${rand}-v${fromV}-to-v${CONFIG_VERSION}`);
|
|
7654
7706
|
mkdirSync(backupPath, { recursive: true });
|
|
7655
|
-
const configSrc =
|
|
7707
|
+
const configSrc = join2(getBaseDir(), ".claude-multi", "config.json");
|
|
7656
7708
|
if (existsSync(configSrc)) {
|
|
7657
|
-
copyFileSync(configSrc,
|
|
7709
|
+
copyFileSync(configSrc, join2(backupPath, "config.json"));
|
|
7658
7710
|
}
|
|
7659
|
-
const instancesDir =
|
|
7711
|
+
const instancesDir = join2(backupPath, "instances");
|
|
7660
7712
|
for (const inst of config.instances) {
|
|
7661
|
-
const settingsFile =
|
|
7713
|
+
const settingsFile = join2(inst.configDir, "settings.json");
|
|
7662
7714
|
if (existsSync(settingsFile)) {
|
|
7663
|
-
const instDir =
|
|
7715
|
+
const instDir = join2(instancesDir, inst.name);
|
|
7664
7716
|
mkdirSync(instDir, { recursive: true });
|
|
7665
|
-
copyFileSync(settingsFile,
|
|
7717
|
+
copyFileSync(settingsFile, join2(instDir, "settings.json"));
|
|
7666
7718
|
}
|
|
7667
7719
|
}
|
|
7668
7720
|
const backups = readdirSync(backupDir).sort();
|
|
7669
7721
|
for (let i = 0;i < backups.length - 3; i++) {
|
|
7670
|
-
rmSync(
|
|
7722
|
+
rmSync(join2(backupDir, backups[i]), { force: true, recursive: true });
|
|
7671
7723
|
}
|
|
7672
7724
|
return backupPath;
|
|
7673
7725
|
}
|
|
@@ -7785,7 +7837,7 @@ import { existsSync as existsSync2, mkdirSync as mkdirSync2, readdirSync as read
|
|
|
7785
7837
|
import { readFile as readFile2, writeFile as writeFile2, copyFile, mkdir, symlink } from "node:fs/promises";
|
|
7786
7838
|
import { homedir as homedir2 } from "node:os";
|
|
7787
7839
|
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
7788
|
-
import { dirname as dirname2, isAbsolute, join as
|
|
7840
|
+
import { dirname as dirname2, isAbsolute, join as join3, relative, resolve } from "node:path";
|
|
7789
7841
|
function setTestConfigDir(dir) {
|
|
7790
7842
|
_testConfigDir = dir;
|
|
7791
7843
|
}
|
|
@@ -7793,18 +7845,18 @@ function clearTestConfigDir() {
|
|
|
7793
7845
|
_testConfigDir = undefined;
|
|
7794
7846
|
}
|
|
7795
7847
|
function getConfigDir() {
|
|
7796
|
-
return _testConfigDir ??
|
|
7848
|
+
return _testConfigDir ?? join3(homedir2(), ".claude-multi");
|
|
7797
7849
|
}
|
|
7798
7850
|
function getConfigFile() {
|
|
7799
|
-
return
|
|
7851
|
+
return join3(getConfigDir(), "config.json");
|
|
7800
7852
|
}
|
|
7801
7853
|
async function copyDirRecursive(source, target) {
|
|
7802
7854
|
if (!existsSync2(target)) {
|
|
7803
7855
|
await mkdir(target, { recursive: true });
|
|
7804
7856
|
}
|
|
7805
7857
|
for (const entry of readdirSync2(source)) {
|
|
7806
|
-
const src =
|
|
7807
|
-
const tgt =
|
|
7858
|
+
const src = join3(source, entry);
|
|
7859
|
+
const tgt = join3(target, entry);
|
|
7808
7860
|
const s = statSync(src);
|
|
7809
7861
|
if (s.isDirectory()) {
|
|
7810
7862
|
await copyDirRecursive(src, tgt);
|
|
@@ -7915,7 +7967,7 @@ function getDefaultClaudeDir() {
|
|
|
7915
7967
|
if (_testDefaultClaudeDir) {
|
|
7916
7968
|
return _testDefaultClaudeDir;
|
|
7917
7969
|
}
|
|
7918
|
-
return
|
|
7970
|
+
return join3(homedir2(), ".claude");
|
|
7919
7971
|
}
|
|
7920
7972
|
function isBrokenSymlink(path) {
|
|
7921
7973
|
try {
|
|
@@ -7939,7 +7991,7 @@ function isBrokenSymlink(path) {
|
|
|
7939
7991
|
function detectBrokenSymlinks(configDir) {
|
|
7940
7992
|
const result = { broken: [], all: [] };
|
|
7941
7993
|
for (const dir of SYNC_DIRS) {
|
|
7942
|
-
const targetPath =
|
|
7994
|
+
const targetPath = join3(configDir, dir);
|
|
7943
7995
|
try {
|
|
7944
7996
|
const stats = lstatSync(targetPath);
|
|
7945
7997
|
result.all.push(dir);
|
|
@@ -7952,12 +8004,12 @@ function detectBrokenSymlinks(configDir) {
|
|
|
7952
8004
|
}
|
|
7953
8005
|
function hasDefaultClaudeConfig() {
|
|
7954
8006
|
const defaultDir = getDefaultClaudeDir();
|
|
7955
|
-
const settingsFile =
|
|
8007
|
+
const settingsFile = join3(defaultDir, "settings.json");
|
|
7956
8008
|
return existsSync2(defaultDir) && existsSync2(settingsFile);
|
|
7957
8009
|
}
|
|
7958
8010
|
async function copySettingsFromDefault(targetConfigDir) {
|
|
7959
8011
|
const defaultDir = getDefaultClaudeDir();
|
|
7960
|
-
const sourceSettings =
|
|
8012
|
+
const sourceSettings = join3(defaultDir, "settings.json");
|
|
7961
8013
|
if (!existsSync2(sourceSettings)) {
|
|
7962
8014
|
throw new ClaudeMultiError(ErrorCode.DEFAULT_SETTINGS_NOT_FOUND, "Default Claude settings.json not found");
|
|
7963
8015
|
}
|
|
@@ -7977,7 +8029,7 @@ async function copySettingsFromDefault(targetConfigDir) {
|
|
|
7977
8029
|
if (!existsSync2(targetConfigDir)) {
|
|
7978
8030
|
await mkdir(targetConfigDir, { recursive: true });
|
|
7979
8031
|
}
|
|
7980
|
-
const targetSettings =
|
|
8032
|
+
const targetSettings = join3(targetConfigDir, "settings.json");
|
|
7981
8033
|
await writeFile2(targetSettings, JSON.stringify(safeSettings, null, 2), "utf-8");
|
|
7982
8034
|
}
|
|
7983
8035
|
async function copyAllFromDefault(targetConfigDir, autoSync = false) {
|
|
@@ -8006,8 +8058,8 @@ async function copyAllFromDefault(targetConfigDir, autoSync = false) {
|
|
|
8006
8058
|
const copyRecursive = async (source, target) => {
|
|
8007
8059
|
const entries = readdirSync2(source);
|
|
8008
8060
|
for (const entry of entries) {
|
|
8009
|
-
const sourcePath =
|
|
8010
|
-
const targetPath =
|
|
8061
|
+
const sourcePath = join3(source, entry);
|
|
8062
|
+
const targetPath = join3(target, entry);
|
|
8011
8063
|
const stat = statSync(sourcePath);
|
|
8012
8064
|
if (excludeFiles.includes(entry)) {
|
|
8013
8065
|
continue;
|
|
@@ -8047,7 +8099,7 @@ async function detectMcpConfigurations(configDir) {
|
|
|
8047
8099
|
if (!existsSync2(configDir)) {
|
|
8048
8100
|
return null;
|
|
8049
8101
|
}
|
|
8050
|
-
const settingsFile =
|
|
8102
|
+
const settingsFile = join3(configDir, "settings.json");
|
|
8051
8103
|
if (existsSync2(settingsFile)) {
|
|
8052
8104
|
try {
|
|
8053
8105
|
const settingsContent = await readFile2(settingsFile, "utf-8");
|
|
@@ -8059,7 +8111,7 @@ async function detectMcpConfigurations(configDir) {
|
|
|
8059
8111
|
}
|
|
8060
8112
|
const mcpFiles = ["mcp.json", "mcp-servers.json", "claude-mcp.json"];
|
|
8061
8113
|
for (const mcpFile of mcpFiles) {
|
|
8062
|
-
const mcpFilePath =
|
|
8114
|
+
const mcpFilePath = join3(configDir, mcpFile);
|
|
8063
8115
|
if (existsSync2(mcpFilePath)) {
|
|
8064
8116
|
try {
|
|
8065
8117
|
const mcpContent = await readFile2(mcpFilePath, "utf-8");
|
|
@@ -8082,8 +8134,8 @@ async function copyMcpServersFromDefault(targetConfigDir) {
|
|
|
8082
8134
|
if (!existsSync2(targetConfigDir)) {
|
|
8083
8135
|
await mkdir(targetConfigDir, { recursive: true });
|
|
8084
8136
|
}
|
|
8085
|
-
const pluginsDir =
|
|
8086
|
-
const defaultPluginsDir =
|
|
8137
|
+
const pluginsDir = join3(targetConfigDir, "plugins");
|
|
8138
|
+
const defaultPluginsDir = join3(defaultDir, "plugins");
|
|
8087
8139
|
if (existsSync2(defaultPluginsDir) && !existsSync2(pluginsDir)) {
|
|
8088
8140
|
await copyDirRecursive(defaultPluginsDir, pluginsDir);
|
|
8089
8141
|
}
|
|
@@ -8104,7 +8156,7 @@ async function copyMcpServersFromDefault(targetConfigDir) {
|
|
|
8104
8156
|
}
|
|
8105
8157
|
}
|
|
8106
8158
|
async function writeMcpConfiguration(targetConfigDir, mcpConfig) {
|
|
8107
|
-
const settingsFile =
|
|
8159
|
+
const settingsFile = join3(targetConfigDir, "settings.json");
|
|
8108
8160
|
if (existsSync2(settingsFile)) {
|
|
8109
8161
|
try {
|
|
8110
8162
|
const settingsContent = await readFile2(settingsFile, "utf-8");
|
|
@@ -8114,7 +8166,7 @@ async function writeMcpConfiguration(targetConfigDir, mcpConfig) {
|
|
|
8114
8166
|
return;
|
|
8115
8167
|
} catch (error) {}
|
|
8116
8168
|
}
|
|
8117
|
-
const mcpFile =
|
|
8169
|
+
const mcpFile = join3(targetConfigDir, "mcp.json");
|
|
8118
8170
|
await writeFile2(mcpFile, JSON.stringify(mcpConfig, null, 2), "utf-8");
|
|
8119
8171
|
}
|
|
8120
8172
|
async function copyMcpServersBetweenInstances(sourceInstanceName, targetInstanceName) {
|
|
@@ -8145,11 +8197,11 @@ async function createSettingsFromTemplate(targetConfigDir, template, apiKey) {
|
|
|
8145
8197
|
await mkdir(targetConfigDir, { recursive: true });
|
|
8146
8198
|
}
|
|
8147
8199
|
const settings = applyProviderTemplate(template, apiKey);
|
|
8148
|
-
const settingsFile =
|
|
8200
|
+
const settingsFile = join3(targetConfigDir, "settings.json");
|
|
8149
8201
|
await writeFile2(settingsFile, JSON.stringify(settings, null, 2), "utf-8");
|
|
8150
8202
|
}
|
|
8151
8203
|
async function initializeInstanceState(configDir) {
|
|
8152
|
-
const stateFile =
|
|
8204
|
+
const stateFile = join3(configDir, ".claude.json");
|
|
8153
8205
|
if (existsSync2(stateFile))
|
|
8154
8206
|
return;
|
|
8155
8207
|
if (!existsSync2(configDir)) {
|
|
@@ -8175,16 +8227,15 @@ async function initializeInstanceState(configDir) {
|
|
|
8175
8227
|
await writeFile2(stateFile, JSON.stringify(state, null, 2), "utf-8");
|
|
8176
8228
|
}
|
|
8177
8229
|
async function mergeProviderEnv(configDir, template, apiKey) {
|
|
8178
|
-
const settingsFile =
|
|
8230
|
+
const settingsFile = join3(configDir, "settings.json");
|
|
8179
8231
|
let existing = {};
|
|
8180
8232
|
if (existsSync2(settingsFile)) {
|
|
8181
8233
|
const raw = await readFile2(settingsFile, "utf-8");
|
|
8182
8234
|
existing = JSON.parse(raw);
|
|
8183
8235
|
}
|
|
8184
8236
|
const env2 = existing.env ?? {};
|
|
8185
|
-
const
|
|
8186
|
-
|
|
8187
|
-
existing.env = { ...env2, ...templateEnv };
|
|
8237
|
+
const templateSettings = applyProviderTemplate(template, apiKey);
|
|
8238
|
+
existing.env = { ...env2, ...templateSettings.env };
|
|
8188
8239
|
existing.includeCoAuthoredBy = template.settings.includeCoAuthoredBy;
|
|
8189
8240
|
await writeFile2(settingsFile, JSON.stringify(existing, null, 2), "utf-8");
|
|
8190
8241
|
}
|
|
@@ -8194,8 +8245,8 @@ async function syncPluginsAndSkills(configDir) {
|
|
|
8194
8245
|
throw new ClaudeMultiError(ErrorCode.INSTANCE_DIR_NOT_FOUND, "Instance config directory does not exist");
|
|
8195
8246
|
}
|
|
8196
8247
|
for (const dir of SYNC_DIRS) {
|
|
8197
|
-
const targetPath =
|
|
8198
|
-
const sourcePath =
|
|
8248
|
+
const targetPath = join3(configDir, dir);
|
|
8249
|
+
const sourcePath = join3(defaultDir, dir);
|
|
8199
8250
|
if (!existsSync2(sourcePath)) {
|
|
8200
8251
|
console.log(source_default.yellow(` ⚠ Source ${dir} not found in ${defaultDir}, skipping`));
|
|
8201
8252
|
continue;
|
|
@@ -8203,7 +8254,7 @@ async function syncPluginsAndSkills(configDir) {
|
|
|
8203
8254
|
if (existsSync2(targetPath)) {
|
|
8204
8255
|
try {
|
|
8205
8256
|
const linkTarget = readlinkSync(targetPath);
|
|
8206
|
-
if (linkTarget === sourcePath || linkTarget ===
|
|
8257
|
+
if (linkTarget === sourcePath || linkTarget === join3("..", "..", ".claude", dir)) {
|
|
8207
8258
|
console.log(source_default.gray(` ✓ ${dir} already synced`));
|
|
8208
8259
|
continue;
|
|
8209
8260
|
}
|
|
@@ -8223,8 +8274,8 @@ async function unsyncPluginsAndSkills(configDir) {
|
|
|
8223
8274
|
throw new ClaudeMultiError(ErrorCode.INSTANCE_DIR_NOT_FOUND, "Instance config directory does not exist");
|
|
8224
8275
|
}
|
|
8225
8276
|
for (const dir of SYNC_DIRS) {
|
|
8226
|
-
const targetPath =
|
|
8227
|
-
const sourcePath =
|
|
8277
|
+
const targetPath = join3(configDir, dir);
|
|
8278
|
+
const sourcePath = join3(defaultDir, dir);
|
|
8228
8279
|
if (!existsSync2(sourcePath)) {
|
|
8229
8280
|
console.log(source_default.yellow(` ⚠ Source ${dir} not found in ${defaultDir}, skipping`));
|
|
8230
8281
|
continue;
|
|
@@ -8245,8 +8296,8 @@ async function unsyncPluginsAndSkills(configDir) {
|
|
|
8245
8296
|
const copyRecursive = async (source, target) => {
|
|
8246
8297
|
const entries = readdirSync2(source);
|
|
8247
8298
|
for (const entry of entries) {
|
|
8248
|
-
const sourceEntry =
|
|
8249
|
-
const targetEntry =
|
|
8299
|
+
const sourceEntry = join3(source, entry);
|
|
8300
|
+
const targetEntry = join3(target, entry);
|
|
8250
8301
|
const stat = statSync(sourceEntry);
|
|
8251
8302
|
if (stat.isDirectory()) {
|
|
8252
8303
|
await mkdir(targetEntry, { recursive: true });
|
|
@@ -8261,7 +8312,7 @@ async function unsyncPluginsAndSkills(configDir) {
|
|
|
8261
8312
|
}
|
|
8262
8313
|
}
|
|
8263
8314
|
async function readClaudeSettings(configDir) {
|
|
8264
|
-
const settingsFile =
|
|
8315
|
+
const settingsFile = join3(configDir, "settings.json");
|
|
8265
8316
|
if (!existsSync2(settingsFile)) {
|
|
8266
8317
|
return null;
|
|
8267
8318
|
}
|
|
@@ -8277,7 +8328,7 @@ async function writeClaudeSettings(configDir, settings) {
|
|
|
8277
8328
|
if (!existsSync2(configDir)) {
|
|
8278
8329
|
await mkdir(configDir, { recursive: true });
|
|
8279
8330
|
}
|
|
8280
|
-
await writeJsonFileAtomic(
|
|
8331
|
+
await writeJsonFileAtomic(join3(configDir, "settings.json"), settings);
|
|
8281
8332
|
}
|
|
8282
8333
|
async function getEnabledPlugins(configDir) {
|
|
8283
8334
|
const settings = await readClaudeSettings(configDir);
|
|
@@ -8327,17 +8378,17 @@ function readMcpJsonFile(mcpPath) {
|
|
|
8327
8378
|
}
|
|
8328
8379
|
function scanPluginDir(baseDir, category, enabledPlugins) {
|
|
8329
8380
|
const subDir = category === PluginCategory.Internal ? "plugins" : "external_plugins";
|
|
8330
|
-
const dir =
|
|
8381
|
+
const dir = join3(baseDir, MARKETPLACE_REL, subDir);
|
|
8331
8382
|
if (!existsSync2(dir))
|
|
8332
8383
|
return [];
|
|
8333
8384
|
const results = [];
|
|
8334
8385
|
for (const entry of readdirSync2(dir, { withFileTypes: true })) {
|
|
8335
8386
|
if (!entry.isDirectory())
|
|
8336
8387
|
continue;
|
|
8337
|
-
const pluginPath =
|
|
8388
|
+
const pluginPath = join3(dir, entry.name);
|
|
8338
8389
|
let name = entry.name;
|
|
8339
8390
|
let description = "";
|
|
8340
|
-
const metaFile =
|
|
8391
|
+
const metaFile = join3(pluginPath, ".claude-plugin", "plugin.json");
|
|
8341
8392
|
if (existsSync2(metaFile)) {
|
|
8342
8393
|
try {
|
|
8343
8394
|
const meta = JSON.parse(readFileSync2(metaFile, "utf-8"));
|
|
@@ -8349,7 +8400,7 @@ function scanPluginDir(baseDir, category, enabledPlugins) {
|
|
|
8349
8400
|
console.error(source_default.yellow(`Warning: Could not parse plugin metadata for ${entry.name}`));
|
|
8350
8401
|
}
|
|
8351
8402
|
}
|
|
8352
|
-
const mcpFile =
|
|
8403
|
+
const mcpFile = join3(pluginPath, ".mcp.json");
|
|
8353
8404
|
const hasMcp = existsSync2(mcpFile);
|
|
8354
8405
|
let mcpServerNames;
|
|
8355
8406
|
if (hasMcp) {
|
|
@@ -8373,7 +8424,7 @@ function scanPluginDir(baseDir, category, enabledPlugins) {
|
|
|
8373
8424
|
}
|
|
8374
8425
|
function scanPluginsFromDir(baseDir) {
|
|
8375
8426
|
let enabledPlugins = {};
|
|
8376
|
-
const settingsFile =
|
|
8427
|
+
const settingsFile = join3(baseDir, "settings.json");
|
|
8377
8428
|
if (existsSync2(settingsFile)) {
|
|
8378
8429
|
try {
|
|
8379
8430
|
const s = JSON.parse(readFileSync2(settingsFile, "utf-8"));
|
|
@@ -8394,7 +8445,7 @@ function listInstancePlugins(configDir) {
|
|
|
8394
8445
|
return scanPluginsFromDir(configDir);
|
|
8395
8446
|
}
|
|
8396
8447
|
function isPluginsSymlinked(configDir) {
|
|
8397
|
-
const pluginsPath =
|
|
8448
|
+
const pluginsPath = join3(configDir, "plugins");
|
|
8398
8449
|
const st = lstatSafe(pluginsPath);
|
|
8399
8450
|
return st?.isSymbolicLink() ?? false;
|
|
8400
8451
|
}
|
|
@@ -8410,7 +8461,7 @@ function isClaudeCodeRunning(configDir) {
|
|
|
8410
8461
|
}
|
|
8411
8462
|
}
|
|
8412
8463
|
function readInstalledPlugins(pluginsDir) {
|
|
8413
|
-
const filePath =
|
|
8464
|
+
const filePath = join3(pluginsDir, "installed_plugins.json");
|
|
8414
8465
|
if (!existsSync2(filePath)) {
|
|
8415
8466
|
return { version: 2, plugins: {} };
|
|
8416
8467
|
}
|
|
@@ -8421,16 +8472,16 @@ function readInstalledPlugins(pluginsDir) {
|
|
|
8421
8472
|
}
|
|
8422
8473
|
}
|
|
8423
8474
|
async function writeInstalledPlugins(pluginsDir, data) {
|
|
8424
|
-
await writeJsonFileAtomic(
|
|
8475
|
+
await writeJsonFileAtomic(join3(pluginsDir, "installed_plugins.json"), data);
|
|
8425
8476
|
}
|
|
8426
8477
|
async function addPluginToInstalledPlugins(configDir, pluginId) {
|
|
8427
|
-
const pluginsDir =
|
|
8478
|
+
const pluginsDir = join3(configDir, "plugins");
|
|
8428
8479
|
const data = readInstalledPlugins(pluginsDir);
|
|
8429
8480
|
const key = `${pluginId}@claude-plugins-official`;
|
|
8430
8481
|
if (!data.plugins[key]) {
|
|
8431
8482
|
data.plugins[key] = [];
|
|
8432
8483
|
}
|
|
8433
|
-
const cachePath =
|
|
8484
|
+
const cachePath = join3(configDir, MARKETPLACE_REL);
|
|
8434
8485
|
const entry = {
|
|
8435
8486
|
scope: "user",
|
|
8436
8487
|
installPath: cachePath,
|
|
@@ -8442,7 +8493,7 @@ async function addPluginToInstalledPlugins(configDir, pluginId) {
|
|
|
8442
8493
|
await writeInstalledPlugins(pluginsDir, data);
|
|
8443
8494
|
}
|
|
8444
8495
|
async function removePluginFromInstalledPlugins(configDir, pluginId) {
|
|
8445
|
-
const pluginsDir =
|
|
8496
|
+
const pluginsDir = join3(configDir, "plugins");
|
|
8446
8497
|
const data = readInstalledPlugins(pluginsDir);
|
|
8447
8498
|
const key = `${pluginId}@claude-plugins-official`;
|
|
8448
8499
|
delete data.plugins[key];
|
|
@@ -8452,7 +8503,7 @@ function estimatePluginSize(pluginPath) {
|
|
|
8452
8503
|
let total = 0;
|
|
8453
8504
|
try {
|
|
8454
8505
|
for (const entry of readdirSync2(pluginPath, { withFileTypes: true })) {
|
|
8455
|
-
const fullPath =
|
|
8506
|
+
const fullPath = join3(pluginPath, entry.name);
|
|
8456
8507
|
if (entry.isDirectory()) {
|
|
8457
8508
|
total += estimatePluginSize(fullPath);
|
|
8458
8509
|
} else {
|
|
@@ -8470,7 +8521,7 @@ function detectMcpCollisions(configDir, newPluginIds) {
|
|
|
8470
8521
|
const defaultDir = getDefaultClaudeDir();
|
|
8471
8522
|
for (const pluginId of newPluginIds) {
|
|
8472
8523
|
for (const subDir of ["plugins", "external_plugins"]) {
|
|
8473
|
-
const mcpFile =
|
|
8524
|
+
const mcpFile = join3(defaultDir, MARKETPLACE_REL, subDir, pluginId, ".mcp.json");
|
|
8474
8525
|
if (!existsSync2(mcpFile))
|
|
8475
8526
|
continue;
|
|
8476
8527
|
const newServers = readMcpJsonFile(mcpFile);
|
|
@@ -8519,22 +8570,22 @@ function validatePluginOperation(configDir, operation, pluginId) {
|
|
|
8519
8570
|
async function copySinglePlugin(targetConfigDir, pluginId, category) {
|
|
8520
8571
|
const defaultDir = getDefaultClaudeDir();
|
|
8521
8572
|
const subDir = category === PluginCategory.Internal ? "plugins" : "external_plugins";
|
|
8522
|
-
const sourcePlugin =
|
|
8523
|
-
const targetPlugin =
|
|
8573
|
+
const sourcePlugin = join3(defaultDir, MARKETPLACE_REL, subDir, pluginId);
|
|
8574
|
+
const targetPlugin = join3(targetConfigDir, MARKETPLACE_REL, subDir, pluginId);
|
|
8524
8575
|
if (!existsSync2(sourcePlugin)) {
|
|
8525
8576
|
throw new ClaudeMultiError(ErrorCode.PLUGIN_NOT_FOUND, `Plugin '${pluginId}' not found in default Claude`);
|
|
8526
8577
|
}
|
|
8527
|
-
const scaffoldDir =
|
|
8578
|
+
const scaffoldDir = join3(targetConfigDir, MARKETPLACE_REL, subDir);
|
|
8528
8579
|
if (!existsSync2(scaffoldDir)) {
|
|
8529
8580
|
await mkdir(scaffoldDir, { recursive: true });
|
|
8530
8581
|
}
|
|
8531
|
-
const marketplaceDir =
|
|
8582
|
+
const marketplaceDir = join3(targetConfigDir, MARKETPLACE_REL);
|
|
8532
8583
|
if (!existsSync2(marketplaceDir)) {
|
|
8533
8584
|
await mkdir(marketplaceDir, { recursive: true });
|
|
8534
8585
|
}
|
|
8535
8586
|
for (const metaFile of ["known_marketplaces.json", "blocklist.json"]) {
|
|
8536
|
-
const src =
|
|
8537
|
-
const tgt =
|
|
8587
|
+
const src = join3(defaultDir, MARKETPLACE_REL, metaFile);
|
|
8588
|
+
const tgt = join3(marketplaceDir, metaFile);
|
|
8538
8589
|
if (existsSync2(src) && !existsSync2(tgt)) {
|
|
8539
8590
|
await copyFile(src, tgt);
|
|
8540
8591
|
}
|
|
@@ -8558,7 +8609,7 @@ async function copySelectedPlugins(targetConfigDir, selections) {
|
|
|
8558
8609
|
const defaultDir = getDefaultClaudeDir();
|
|
8559
8610
|
for (const sel of selections) {
|
|
8560
8611
|
const subDir = sel.category === PluginCategory.Internal ? "plugins" : "external_plugins";
|
|
8561
|
-
const source =
|
|
8612
|
+
const source = join3(defaultDir, MARKETPLACE_REL, subDir, sel.id);
|
|
8562
8613
|
if (!existsSync2(source)) {
|
|
8563
8614
|
throw new ClaudeMultiError(ErrorCode.PLUGIN_NOT_FOUND, `Plugin '${sel.id}' not found in default Claude`);
|
|
8564
8615
|
}
|
|
@@ -8566,7 +8617,7 @@ async function copySelectedPlugins(targetConfigDir, selections) {
|
|
|
8566
8617
|
let totalSize = 0;
|
|
8567
8618
|
for (const sel of selections) {
|
|
8568
8619
|
const subDir = sel.category === PluginCategory.Internal ? "plugins" : "external_plugins";
|
|
8569
|
-
totalSize += estimatePluginSize(
|
|
8620
|
+
totalSize += estimatePluginSize(join3(defaultDir, MARKETPLACE_REL, subDir, sel.id));
|
|
8570
8621
|
}
|
|
8571
8622
|
if (totalSize > 104857600) {
|
|
8572
8623
|
throw new ClaudeMultiError(ErrorCode.PLUGIN_TOO_LARGE, `Selected plugins total ${(totalSize / 1024 / 1024).toFixed(1)}MB. Ensure sufficient disk space.`);
|
|
@@ -8581,7 +8632,7 @@ async function copySelectedPlugins(targetConfigDir, selections) {
|
|
|
8581
8632
|
for (const done of completed) {
|
|
8582
8633
|
try {
|
|
8583
8634
|
const subDir = done.category === PluginCategory.Internal ? "plugins" : "external_plugins";
|
|
8584
|
-
const targetPath =
|
|
8635
|
+
const targetPath = join3(targetConfigDir, MARKETPLACE_REL, subDir, done.id);
|
|
8585
8636
|
if (existsSync2(targetPath)) {
|
|
8586
8637
|
rmSync2(targetPath, { force: true, recursive: true });
|
|
8587
8638
|
}
|
|
@@ -8598,7 +8649,7 @@ async function removeSinglePlugin(configDir, pluginId, category) {
|
|
|
8598
8649
|
throw new ClaudeMultiError(ErrorCode.SYMLINK_CONFLICT, "Cannot remove plugins from a symlinked instance. Disable auto-sync first.");
|
|
8599
8650
|
}
|
|
8600
8651
|
const subDir = category === PluginCategory.Internal ? "plugins" : "external_plugins";
|
|
8601
|
-
const pluginPath =
|
|
8652
|
+
const pluginPath = join3(configDir, MARKETPLACE_REL, subDir, pluginId);
|
|
8602
8653
|
if (!existsSync2(pluginPath)) {
|
|
8603
8654
|
throw new ClaudeMultiError(ErrorCode.PLUGIN_NOT_FOUND, `Plugin '${pluginId}' not found in this instance`);
|
|
8604
8655
|
}
|
|
@@ -8622,15 +8673,15 @@ async function removeSinglePlugin(configDir, pluginId, category) {
|
|
|
8622
8673
|
}
|
|
8623
8674
|
function getMcpServersFromPlugins(configDir) {
|
|
8624
8675
|
const result = {};
|
|
8625
|
-
const basePlugins =
|
|
8676
|
+
const basePlugins = join3(configDir, MARKETPLACE_REL);
|
|
8626
8677
|
for (const subDir of ["plugins", "external_plugins"]) {
|
|
8627
|
-
const dir =
|
|
8678
|
+
const dir = join3(basePlugins, subDir);
|
|
8628
8679
|
if (!existsSync2(dir))
|
|
8629
8680
|
continue;
|
|
8630
8681
|
for (const entry of readdirSync2(dir, { withFileTypes: true })) {
|
|
8631
8682
|
if (!entry.isDirectory())
|
|
8632
8683
|
continue;
|
|
8633
|
-
const mcpFile =
|
|
8684
|
+
const mcpFile = join3(dir, entry.name, ".mcp.json");
|
|
8634
8685
|
if (!existsSync2(mcpFile))
|
|
8635
8686
|
continue;
|
|
8636
8687
|
const servers = readMcpJsonFile(mcpFile);
|
|
@@ -8696,6 +8747,17 @@ import { writeFile as writeFile3 } from "node:fs/promises";
|
|
|
8696
8747
|
import { resolve as resolve2, dirname as dirname3 } from "node:path";
|
|
8697
8748
|
import { execSync } from "node:child_process";
|
|
8698
8749
|
function getClaudePath() {
|
|
8750
|
+
const override = process.env.CLAUDE_MULTI_CLAUDE_PATH;
|
|
8751
|
+
if (override) {
|
|
8752
|
+
const resolved = resolve2(override);
|
|
8753
|
+
if (!existsSync3(resolved)) {
|
|
8754
|
+
throw new ClaudeMultiError(ErrorCode.CLAUDE_NOT_FOUND, `CLAUDE_MULTI_CLAUDE_PATH points to ${resolved} but that file does not exist`);
|
|
8755
|
+
}
|
|
8756
|
+
return resolved;
|
|
8757
|
+
}
|
|
8758
|
+
if (existsSync3(PINNED_CLAUDE_BIN)) {
|
|
8759
|
+
return PINNED_CLAUDE_BIN;
|
|
8760
|
+
}
|
|
8699
8761
|
try {
|
|
8700
8762
|
const command = process.platform === "win32" ? "where claude" : "which claude";
|
|
8701
8763
|
const claudePath = execSync(command, { encoding: "utf-8" }).trim();
|
|
@@ -8774,6 +8836,1999 @@ function getDefaultBinaryPath(name) {
|
|
|
8774
8836
|
}
|
|
8775
8837
|
var init_wrapper = __esm(() => {
|
|
8776
8838
|
init_errors();
|
|
8839
|
+
init_paths();
|
|
8840
|
+
});
|
|
8841
|
+
|
|
8842
|
+
// node_modules/semver/internal/constants.js
|
|
8843
|
+
var require_constants = __commonJS((exports, module) => {
|
|
8844
|
+
var SEMVER_SPEC_VERSION = "2.0.0";
|
|
8845
|
+
var MAX_LENGTH = 256;
|
|
8846
|
+
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
|
|
8847
|
+
var MAX_SAFE_COMPONENT_LENGTH = 16;
|
|
8848
|
+
var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
|
|
8849
|
+
var RELEASE_TYPES = [
|
|
8850
|
+
"major",
|
|
8851
|
+
"premajor",
|
|
8852
|
+
"minor",
|
|
8853
|
+
"preminor",
|
|
8854
|
+
"patch",
|
|
8855
|
+
"prepatch",
|
|
8856
|
+
"prerelease"
|
|
8857
|
+
];
|
|
8858
|
+
module.exports = {
|
|
8859
|
+
MAX_LENGTH,
|
|
8860
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
|
8861
|
+
MAX_SAFE_BUILD_LENGTH,
|
|
8862
|
+
MAX_SAFE_INTEGER,
|
|
8863
|
+
RELEASE_TYPES,
|
|
8864
|
+
SEMVER_SPEC_VERSION,
|
|
8865
|
+
FLAG_INCLUDE_PRERELEASE: 1,
|
|
8866
|
+
FLAG_LOOSE: 2
|
|
8867
|
+
};
|
|
8868
|
+
});
|
|
8869
|
+
|
|
8870
|
+
// node_modules/semver/internal/debug.js
|
|
8871
|
+
var require_debug = __commonJS((exports, module) => {
|
|
8872
|
+
var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
|
|
8873
|
+
module.exports = debug;
|
|
8874
|
+
});
|
|
8875
|
+
|
|
8876
|
+
// node_modules/semver/internal/re.js
|
|
8877
|
+
var require_re = __commonJS((exports, module) => {
|
|
8878
|
+
var {
|
|
8879
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
|
8880
|
+
MAX_SAFE_BUILD_LENGTH,
|
|
8881
|
+
MAX_LENGTH
|
|
8882
|
+
} = require_constants();
|
|
8883
|
+
var debug = require_debug();
|
|
8884
|
+
exports = module.exports = {};
|
|
8885
|
+
var re = exports.re = [];
|
|
8886
|
+
var safeRe = exports.safeRe = [];
|
|
8887
|
+
var src = exports.src = [];
|
|
8888
|
+
var safeSrc = exports.safeSrc = [];
|
|
8889
|
+
var t = exports.t = {};
|
|
8890
|
+
var R = 0;
|
|
8891
|
+
var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
|
|
8892
|
+
var safeRegexReplacements = [
|
|
8893
|
+
["\\s", 1],
|
|
8894
|
+
["\\d", MAX_LENGTH],
|
|
8895
|
+
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
|
|
8896
|
+
];
|
|
8897
|
+
var makeSafeRegex = (value) => {
|
|
8898
|
+
for (const [token, max] of safeRegexReplacements) {
|
|
8899
|
+
value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
|
|
8900
|
+
}
|
|
8901
|
+
return value;
|
|
8902
|
+
};
|
|
8903
|
+
var createToken = (name, value, isGlobal) => {
|
|
8904
|
+
const safe = makeSafeRegex(value);
|
|
8905
|
+
const index = R++;
|
|
8906
|
+
debug(name, index, value);
|
|
8907
|
+
t[name] = index;
|
|
8908
|
+
src[index] = value;
|
|
8909
|
+
safeSrc[index] = safe;
|
|
8910
|
+
re[index] = new RegExp(value, isGlobal ? "g" : undefined);
|
|
8911
|
+
safeRe[index] = new RegExp(safe, isGlobal ? "g" : undefined);
|
|
8912
|
+
};
|
|
8913
|
+
createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
|
|
8914
|
+
createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
|
|
8915
|
+
createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
|
|
8916
|
+
createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.` + `(${src[t.NUMERICIDENTIFIER]})\\.` + `(${src[t.NUMERICIDENTIFIER]})`);
|
|
8917
|
+
createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + `(${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
8918
|
+
createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
|
|
8919
|
+
createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
8920
|
+
createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
|
|
8921
|
+
createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
|
|
8922
|
+
createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
|
|
8923
|
+
createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
|
|
8924
|
+
createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
|
|
8925
|
+
createToken("FULL", `^${src[t.FULLPLAIN]}$`);
|
|
8926
|
+
createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
|
|
8927
|
+
createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
|
|
8928
|
+
createToken("GTLT", "((?:<|>)?=?)");
|
|
8929
|
+
createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
|
|
8930
|
+
createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
|
|
8931
|
+
createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + `(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?` + `)?)?`);
|
|
8932
|
+
createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?` + `)?)?`);
|
|
8933
|
+
createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
|
|
8934
|
+
createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
|
|
8935
|
+
createToken("COERCEPLAIN", `${"(^|[^\\d])" + "(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})` + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
|
|
8936
|
+
createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
|
|
8937
|
+
createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?` + `(?:${src[t.BUILD]})?` + `(?:$|[^\\d])`);
|
|
8938
|
+
createToken("COERCERTL", src[t.COERCE], true);
|
|
8939
|
+
createToken("COERCERTLFULL", src[t.COERCEFULL], true);
|
|
8940
|
+
createToken("LONETILDE", "(?:~>?)");
|
|
8941
|
+
createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
|
|
8942
|
+
exports.tildeTrimReplace = "$1~";
|
|
8943
|
+
createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
|
|
8944
|
+
createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
8945
|
+
createToken("LONECARET", "(?:\\^)");
|
|
8946
|
+
createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
|
|
8947
|
+
exports.caretTrimReplace = "$1^";
|
|
8948
|
+
createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
|
|
8949
|
+
createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
8950
|
+
createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
|
|
8951
|
+
createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
|
|
8952
|
+
createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
|
|
8953
|
+
exports.comparatorTrimReplace = "$1$2$3";
|
|
8954
|
+
createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})` + `\\s+-\\s+` + `(${src[t.XRANGEPLAIN]})` + `\\s*$`);
|
|
8955
|
+
createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})` + `\\s+-\\s+` + `(${src[t.XRANGEPLAINLOOSE]})` + `\\s*$`);
|
|
8956
|
+
createToken("STAR", "(<|>)?=?\\s*\\*");
|
|
8957
|
+
createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
|
|
8958
|
+
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
8959
|
+
});
|
|
8960
|
+
|
|
8961
|
+
// node_modules/semver/internal/parse-options.js
|
|
8962
|
+
var require_parse_options = __commonJS((exports, module) => {
|
|
8963
|
+
var looseOption = Object.freeze({ loose: true });
|
|
8964
|
+
var emptyOpts = Object.freeze({});
|
|
8965
|
+
var parseOptions = (options) => {
|
|
8966
|
+
if (!options) {
|
|
8967
|
+
return emptyOpts;
|
|
8968
|
+
}
|
|
8969
|
+
if (typeof options !== "object") {
|
|
8970
|
+
return looseOption;
|
|
8971
|
+
}
|
|
8972
|
+
return options;
|
|
8973
|
+
};
|
|
8974
|
+
module.exports = parseOptions;
|
|
8975
|
+
});
|
|
8976
|
+
|
|
8977
|
+
// node_modules/semver/internal/identifiers.js
|
|
8978
|
+
var require_identifiers = __commonJS((exports, module) => {
|
|
8979
|
+
var numeric = /^[0-9]+$/;
|
|
8980
|
+
var compareIdentifiers = (a, b) => {
|
|
8981
|
+
if (typeof a === "number" && typeof b === "number") {
|
|
8982
|
+
return a === b ? 0 : a < b ? -1 : 1;
|
|
8983
|
+
}
|
|
8984
|
+
const anum = numeric.test(a);
|
|
8985
|
+
const bnum = numeric.test(b);
|
|
8986
|
+
if (anum && bnum) {
|
|
8987
|
+
a = +a;
|
|
8988
|
+
b = +b;
|
|
8989
|
+
}
|
|
8990
|
+
return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
|
|
8991
|
+
};
|
|
8992
|
+
var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
|
|
8993
|
+
module.exports = {
|
|
8994
|
+
compareIdentifiers,
|
|
8995
|
+
rcompareIdentifiers
|
|
8996
|
+
};
|
|
8997
|
+
});
|
|
8998
|
+
|
|
8999
|
+
// node_modules/semver/classes/semver.js
|
|
9000
|
+
var require_semver = __commonJS((exports, module) => {
|
|
9001
|
+
var debug = require_debug();
|
|
9002
|
+
var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
|
|
9003
|
+
var { safeRe: re, t } = require_re();
|
|
9004
|
+
var parseOptions = require_parse_options();
|
|
9005
|
+
var { compareIdentifiers } = require_identifiers();
|
|
9006
|
+
|
|
9007
|
+
class SemVer {
|
|
9008
|
+
constructor(version, options) {
|
|
9009
|
+
options = parseOptions(options);
|
|
9010
|
+
if (version instanceof SemVer) {
|
|
9011
|
+
if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
|
|
9012
|
+
return version;
|
|
9013
|
+
} else {
|
|
9014
|
+
version = version.version;
|
|
9015
|
+
}
|
|
9016
|
+
} else if (typeof version !== "string") {
|
|
9017
|
+
throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
|
|
9018
|
+
}
|
|
9019
|
+
if (version.length > MAX_LENGTH) {
|
|
9020
|
+
throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
|
|
9021
|
+
}
|
|
9022
|
+
debug("SemVer", version, options);
|
|
9023
|
+
this.options = options;
|
|
9024
|
+
this.loose = !!options.loose;
|
|
9025
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
9026
|
+
const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
|
9027
|
+
if (!m) {
|
|
9028
|
+
throw new TypeError(`Invalid Version: ${version}`);
|
|
9029
|
+
}
|
|
9030
|
+
this.raw = version;
|
|
9031
|
+
this.major = +m[1];
|
|
9032
|
+
this.minor = +m[2];
|
|
9033
|
+
this.patch = +m[3];
|
|
9034
|
+
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
|
9035
|
+
throw new TypeError("Invalid major version");
|
|
9036
|
+
}
|
|
9037
|
+
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
|
9038
|
+
throw new TypeError("Invalid minor version");
|
|
9039
|
+
}
|
|
9040
|
+
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
|
9041
|
+
throw new TypeError("Invalid patch version");
|
|
9042
|
+
}
|
|
9043
|
+
if (!m[4]) {
|
|
9044
|
+
this.prerelease = [];
|
|
9045
|
+
} else {
|
|
9046
|
+
this.prerelease = m[4].split(".").map((id) => {
|
|
9047
|
+
if (/^[0-9]+$/.test(id)) {
|
|
9048
|
+
const num = +id;
|
|
9049
|
+
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
|
9050
|
+
return num;
|
|
9051
|
+
}
|
|
9052
|
+
}
|
|
9053
|
+
return id;
|
|
9054
|
+
});
|
|
9055
|
+
}
|
|
9056
|
+
this.build = m[5] ? m[5].split(".") : [];
|
|
9057
|
+
this.format();
|
|
9058
|
+
}
|
|
9059
|
+
format() {
|
|
9060
|
+
this.version = `${this.major}.${this.minor}.${this.patch}`;
|
|
9061
|
+
if (this.prerelease.length) {
|
|
9062
|
+
this.version += `-${this.prerelease.join(".")}`;
|
|
9063
|
+
}
|
|
9064
|
+
return this.version;
|
|
9065
|
+
}
|
|
9066
|
+
toString() {
|
|
9067
|
+
return this.version;
|
|
9068
|
+
}
|
|
9069
|
+
compare(other) {
|
|
9070
|
+
debug("SemVer.compare", this.version, this.options, other);
|
|
9071
|
+
if (!(other instanceof SemVer)) {
|
|
9072
|
+
if (typeof other === "string" && other === this.version) {
|
|
9073
|
+
return 0;
|
|
9074
|
+
}
|
|
9075
|
+
other = new SemVer(other, this.options);
|
|
9076
|
+
}
|
|
9077
|
+
if (other.version === this.version) {
|
|
9078
|
+
return 0;
|
|
9079
|
+
}
|
|
9080
|
+
return this.compareMain(other) || this.comparePre(other);
|
|
9081
|
+
}
|
|
9082
|
+
compareMain(other) {
|
|
9083
|
+
if (!(other instanceof SemVer)) {
|
|
9084
|
+
other = new SemVer(other, this.options);
|
|
9085
|
+
}
|
|
9086
|
+
if (this.major < other.major) {
|
|
9087
|
+
return -1;
|
|
9088
|
+
}
|
|
9089
|
+
if (this.major > other.major) {
|
|
9090
|
+
return 1;
|
|
9091
|
+
}
|
|
9092
|
+
if (this.minor < other.minor) {
|
|
9093
|
+
return -1;
|
|
9094
|
+
}
|
|
9095
|
+
if (this.minor > other.minor) {
|
|
9096
|
+
return 1;
|
|
9097
|
+
}
|
|
9098
|
+
if (this.patch < other.patch) {
|
|
9099
|
+
return -1;
|
|
9100
|
+
}
|
|
9101
|
+
if (this.patch > other.patch) {
|
|
9102
|
+
return 1;
|
|
9103
|
+
}
|
|
9104
|
+
return 0;
|
|
9105
|
+
}
|
|
9106
|
+
comparePre(other) {
|
|
9107
|
+
if (!(other instanceof SemVer)) {
|
|
9108
|
+
other = new SemVer(other, this.options);
|
|
9109
|
+
}
|
|
9110
|
+
if (this.prerelease.length && !other.prerelease.length) {
|
|
9111
|
+
return -1;
|
|
9112
|
+
} else if (!this.prerelease.length && other.prerelease.length) {
|
|
9113
|
+
return 1;
|
|
9114
|
+
} else if (!this.prerelease.length && !other.prerelease.length) {
|
|
9115
|
+
return 0;
|
|
9116
|
+
}
|
|
9117
|
+
let i = 0;
|
|
9118
|
+
do {
|
|
9119
|
+
const a = this.prerelease[i];
|
|
9120
|
+
const b = other.prerelease[i];
|
|
9121
|
+
debug("prerelease compare", i, a, b);
|
|
9122
|
+
if (a === undefined && b === undefined) {
|
|
9123
|
+
return 0;
|
|
9124
|
+
} else if (b === undefined) {
|
|
9125
|
+
return 1;
|
|
9126
|
+
} else if (a === undefined) {
|
|
9127
|
+
return -1;
|
|
9128
|
+
} else if (a === b) {
|
|
9129
|
+
continue;
|
|
9130
|
+
} else {
|
|
9131
|
+
return compareIdentifiers(a, b);
|
|
9132
|
+
}
|
|
9133
|
+
} while (++i);
|
|
9134
|
+
}
|
|
9135
|
+
compareBuild(other) {
|
|
9136
|
+
if (!(other instanceof SemVer)) {
|
|
9137
|
+
other = new SemVer(other, this.options);
|
|
9138
|
+
}
|
|
9139
|
+
let i = 0;
|
|
9140
|
+
do {
|
|
9141
|
+
const a = this.build[i];
|
|
9142
|
+
const b = other.build[i];
|
|
9143
|
+
debug("build compare", i, a, b);
|
|
9144
|
+
if (a === undefined && b === undefined) {
|
|
9145
|
+
return 0;
|
|
9146
|
+
} else if (b === undefined) {
|
|
9147
|
+
return 1;
|
|
9148
|
+
} else if (a === undefined) {
|
|
9149
|
+
return -1;
|
|
9150
|
+
} else if (a === b) {
|
|
9151
|
+
continue;
|
|
9152
|
+
} else {
|
|
9153
|
+
return compareIdentifiers(a, b);
|
|
9154
|
+
}
|
|
9155
|
+
} while (++i);
|
|
9156
|
+
}
|
|
9157
|
+
inc(release, identifier, identifierBase) {
|
|
9158
|
+
if (release.startsWith("pre")) {
|
|
9159
|
+
if (!identifier && identifierBase === false) {
|
|
9160
|
+
throw new Error("invalid increment argument: identifier is empty");
|
|
9161
|
+
}
|
|
9162
|
+
if (identifier) {
|
|
9163
|
+
const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
|
|
9164
|
+
if (!match || match[1] !== identifier) {
|
|
9165
|
+
throw new Error(`invalid identifier: ${identifier}`);
|
|
9166
|
+
}
|
|
9167
|
+
}
|
|
9168
|
+
}
|
|
9169
|
+
switch (release) {
|
|
9170
|
+
case "premajor":
|
|
9171
|
+
this.prerelease.length = 0;
|
|
9172
|
+
this.patch = 0;
|
|
9173
|
+
this.minor = 0;
|
|
9174
|
+
this.major++;
|
|
9175
|
+
this.inc("pre", identifier, identifierBase);
|
|
9176
|
+
break;
|
|
9177
|
+
case "preminor":
|
|
9178
|
+
this.prerelease.length = 0;
|
|
9179
|
+
this.patch = 0;
|
|
9180
|
+
this.minor++;
|
|
9181
|
+
this.inc("pre", identifier, identifierBase);
|
|
9182
|
+
break;
|
|
9183
|
+
case "prepatch":
|
|
9184
|
+
this.prerelease.length = 0;
|
|
9185
|
+
this.inc("patch", identifier, identifierBase);
|
|
9186
|
+
this.inc("pre", identifier, identifierBase);
|
|
9187
|
+
break;
|
|
9188
|
+
case "prerelease":
|
|
9189
|
+
if (this.prerelease.length === 0) {
|
|
9190
|
+
this.inc("patch", identifier, identifierBase);
|
|
9191
|
+
}
|
|
9192
|
+
this.inc("pre", identifier, identifierBase);
|
|
9193
|
+
break;
|
|
9194
|
+
case "release":
|
|
9195
|
+
if (this.prerelease.length === 0) {
|
|
9196
|
+
throw new Error(`version ${this.raw} is not a prerelease`);
|
|
9197
|
+
}
|
|
9198
|
+
this.prerelease.length = 0;
|
|
9199
|
+
break;
|
|
9200
|
+
case "major":
|
|
9201
|
+
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
|
|
9202
|
+
this.major++;
|
|
9203
|
+
}
|
|
9204
|
+
this.minor = 0;
|
|
9205
|
+
this.patch = 0;
|
|
9206
|
+
this.prerelease = [];
|
|
9207
|
+
break;
|
|
9208
|
+
case "minor":
|
|
9209
|
+
if (this.patch !== 0 || this.prerelease.length === 0) {
|
|
9210
|
+
this.minor++;
|
|
9211
|
+
}
|
|
9212
|
+
this.patch = 0;
|
|
9213
|
+
this.prerelease = [];
|
|
9214
|
+
break;
|
|
9215
|
+
case "patch":
|
|
9216
|
+
if (this.prerelease.length === 0) {
|
|
9217
|
+
this.patch++;
|
|
9218
|
+
}
|
|
9219
|
+
this.prerelease = [];
|
|
9220
|
+
break;
|
|
9221
|
+
case "pre": {
|
|
9222
|
+
const base = Number(identifierBase) ? 1 : 0;
|
|
9223
|
+
if (this.prerelease.length === 0) {
|
|
9224
|
+
this.prerelease = [base];
|
|
9225
|
+
} else {
|
|
9226
|
+
let i = this.prerelease.length;
|
|
9227
|
+
while (--i >= 0) {
|
|
9228
|
+
if (typeof this.prerelease[i] === "number") {
|
|
9229
|
+
this.prerelease[i]++;
|
|
9230
|
+
i = -2;
|
|
9231
|
+
}
|
|
9232
|
+
}
|
|
9233
|
+
if (i === -1) {
|
|
9234
|
+
if (identifier === this.prerelease.join(".") && identifierBase === false) {
|
|
9235
|
+
throw new Error("invalid increment argument: identifier already exists");
|
|
9236
|
+
}
|
|
9237
|
+
this.prerelease.push(base);
|
|
9238
|
+
}
|
|
9239
|
+
}
|
|
9240
|
+
if (identifier) {
|
|
9241
|
+
let prerelease = [identifier, base];
|
|
9242
|
+
if (identifierBase === false) {
|
|
9243
|
+
prerelease = [identifier];
|
|
9244
|
+
}
|
|
9245
|
+
if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
|
|
9246
|
+
if (isNaN(this.prerelease[1])) {
|
|
9247
|
+
this.prerelease = prerelease;
|
|
9248
|
+
}
|
|
9249
|
+
} else {
|
|
9250
|
+
this.prerelease = prerelease;
|
|
9251
|
+
}
|
|
9252
|
+
}
|
|
9253
|
+
break;
|
|
9254
|
+
}
|
|
9255
|
+
default:
|
|
9256
|
+
throw new Error(`invalid increment argument: ${release}`);
|
|
9257
|
+
}
|
|
9258
|
+
this.raw = this.format();
|
|
9259
|
+
if (this.build.length) {
|
|
9260
|
+
this.raw += `+${this.build.join(".")}`;
|
|
9261
|
+
}
|
|
9262
|
+
return this;
|
|
9263
|
+
}
|
|
9264
|
+
}
|
|
9265
|
+
module.exports = SemVer;
|
|
9266
|
+
});
|
|
9267
|
+
|
|
9268
|
+
// node_modules/semver/functions/parse.js
|
|
9269
|
+
var require_parse = __commonJS((exports, module) => {
|
|
9270
|
+
var SemVer = require_semver();
|
|
9271
|
+
var parse = (version, options, throwErrors = false) => {
|
|
9272
|
+
if (version instanceof SemVer) {
|
|
9273
|
+
return version;
|
|
9274
|
+
}
|
|
9275
|
+
try {
|
|
9276
|
+
return new SemVer(version, options);
|
|
9277
|
+
} catch (er) {
|
|
9278
|
+
if (!throwErrors) {
|
|
9279
|
+
return null;
|
|
9280
|
+
}
|
|
9281
|
+
throw er;
|
|
9282
|
+
}
|
|
9283
|
+
};
|
|
9284
|
+
module.exports = parse;
|
|
9285
|
+
});
|
|
9286
|
+
|
|
9287
|
+
// node_modules/semver/functions/valid.js
|
|
9288
|
+
var require_valid = __commonJS((exports, module) => {
|
|
9289
|
+
var parse = require_parse();
|
|
9290
|
+
var valid = (version, options) => {
|
|
9291
|
+
const v = parse(version, options);
|
|
9292
|
+
return v ? v.version : null;
|
|
9293
|
+
};
|
|
9294
|
+
module.exports = valid;
|
|
9295
|
+
});
|
|
9296
|
+
|
|
9297
|
+
// node_modules/semver/functions/clean.js
|
|
9298
|
+
var require_clean = __commonJS((exports, module) => {
|
|
9299
|
+
var parse = require_parse();
|
|
9300
|
+
var clean = (version, options) => {
|
|
9301
|
+
const s = parse(version.trim().replace(/^[=v]+/, ""), options);
|
|
9302
|
+
return s ? s.version : null;
|
|
9303
|
+
};
|
|
9304
|
+
module.exports = clean;
|
|
9305
|
+
});
|
|
9306
|
+
|
|
9307
|
+
// node_modules/semver/functions/inc.js
|
|
9308
|
+
var require_inc = __commonJS((exports, module) => {
|
|
9309
|
+
var SemVer = require_semver();
|
|
9310
|
+
var inc = (version, release, options, identifier, identifierBase) => {
|
|
9311
|
+
if (typeof options === "string") {
|
|
9312
|
+
identifierBase = identifier;
|
|
9313
|
+
identifier = options;
|
|
9314
|
+
options = undefined;
|
|
9315
|
+
}
|
|
9316
|
+
try {
|
|
9317
|
+
return new SemVer(version instanceof SemVer ? version.version : version, options).inc(release, identifier, identifierBase).version;
|
|
9318
|
+
} catch (er) {
|
|
9319
|
+
return null;
|
|
9320
|
+
}
|
|
9321
|
+
};
|
|
9322
|
+
module.exports = inc;
|
|
9323
|
+
});
|
|
9324
|
+
|
|
9325
|
+
// node_modules/semver/functions/diff.js
|
|
9326
|
+
var require_diff = __commonJS((exports, module) => {
|
|
9327
|
+
var parse = require_parse();
|
|
9328
|
+
var diff = (version1, version2) => {
|
|
9329
|
+
const v1 = parse(version1, null, true);
|
|
9330
|
+
const v2 = parse(version2, null, true);
|
|
9331
|
+
const comparison = v1.compare(v2);
|
|
9332
|
+
if (comparison === 0) {
|
|
9333
|
+
return null;
|
|
9334
|
+
}
|
|
9335
|
+
const v1Higher = comparison > 0;
|
|
9336
|
+
const highVersion = v1Higher ? v1 : v2;
|
|
9337
|
+
const lowVersion = v1Higher ? v2 : v1;
|
|
9338
|
+
const highHasPre = !!highVersion.prerelease.length;
|
|
9339
|
+
const lowHasPre = !!lowVersion.prerelease.length;
|
|
9340
|
+
if (lowHasPre && !highHasPre) {
|
|
9341
|
+
if (!lowVersion.patch && !lowVersion.minor) {
|
|
9342
|
+
return "major";
|
|
9343
|
+
}
|
|
9344
|
+
if (lowVersion.compareMain(highVersion) === 0) {
|
|
9345
|
+
if (lowVersion.minor && !lowVersion.patch) {
|
|
9346
|
+
return "minor";
|
|
9347
|
+
}
|
|
9348
|
+
return "patch";
|
|
9349
|
+
}
|
|
9350
|
+
}
|
|
9351
|
+
const prefix = highHasPre ? "pre" : "";
|
|
9352
|
+
if (v1.major !== v2.major) {
|
|
9353
|
+
return prefix + "major";
|
|
9354
|
+
}
|
|
9355
|
+
if (v1.minor !== v2.minor) {
|
|
9356
|
+
return prefix + "minor";
|
|
9357
|
+
}
|
|
9358
|
+
if (v1.patch !== v2.patch) {
|
|
9359
|
+
return prefix + "patch";
|
|
9360
|
+
}
|
|
9361
|
+
return "prerelease";
|
|
9362
|
+
};
|
|
9363
|
+
module.exports = diff;
|
|
9364
|
+
});
|
|
9365
|
+
|
|
9366
|
+
// node_modules/semver/functions/major.js
|
|
9367
|
+
var require_major = __commonJS((exports, module) => {
|
|
9368
|
+
var SemVer = require_semver();
|
|
9369
|
+
var major = (a, loose) => new SemVer(a, loose).major;
|
|
9370
|
+
module.exports = major;
|
|
9371
|
+
});
|
|
9372
|
+
|
|
9373
|
+
// node_modules/semver/functions/minor.js
|
|
9374
|
+
var require_minor = __commonJS((exports, module) => {
|
|
9375
|
+
var SemVer = require_semver();
|
|
9376
|
+
var minor = (a, loose) => new SemVer(a, loose).minor;
|
|
9377
|
+
module.exports = minor;
|
|
9378
|
+
});
|
|
9379
|
+
|
|
9380
|
+
// node_modules/semver/functions/patch.js
|
|
9381
|
+
var require_patch = __commonJS((exports, module) => {
|
|
9382
|
+
var SemVer = require_semver();
|
|
9383
|
+
var patch = (a, loose) => new SemVer(a, loose).patch;
|
|
9384
|
+
module.exports = patch;
|
|
9385
|
+
});
|
|
9386
|
+
|
|
9387
|
+
// node_modules/semver/functions/prerelease.js
|
|
9388
|
+
var require_prerelease = __commonJS((exports, module) => {
|
|
9389
|
+
var parse = require_parse();
|
|
9390
|
+
var prerelease = (version, options) => {
|
|
9391
|
+
const parsed = parse(version, options);
|
|
9392
|
+
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
|
9393
|
+
};
|
|
9394
|
+
module.exports = prerelease;
|
|
9395
|
+
});
|
|
9396
|
+
|
|
9397
|
+
// node_modules/semver/functions/compare.js
|
|
9398
|
+
var require_compare = __commonJS((exports, module) => {
|
|
9399
|
+
var SemVer = require_semver();
|
|
9400
|
+
var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
|
|
9401
|
+
module.exports = compare;
|
|
9402
|
+
});
|
|
9403
|
+
|
|
9404
|
+
// node_modules/semver/functions/rcompare.js
|
|
9405
|
+
var require_rcompare = __commonJS((exports, module) => {
|
|
9406
|
+
var compare = require_compare();
|
|
9407
|
+
var rcompare = (a, b, loose) => compare(b, a, loose);
|
|
9408
|
+
module.exports = rcompare;
|
|
9409
|
+
});
|
|
9410
|
+
|
|
9411
|
+
// node_modules/semver/functions/compare-loose.js
|
|
9412
|
+
var require_compare_loose = __commonJS((exports, module) => {
|
|
9413
|
+
var compare = require_compare();
|
|
9414
|
+
var compareLoose = (a, b) => compare(a, b, true);
|
|
9415
|
+
module.exports = compareLoose;
|
|
9416
|
+
});
|
|
9417
|
+
|
|
9418
|
+
// node_modules/semver/functions/compare-build.js
|
|
9419
|
+
var require_compare_build = __commonJS((exports, module) => {
|
|
9420
|
+
var SemVer = require_semver();
|
|
9421
|
+
var compareBuild = (a, b, loose) => {
|
|
9422
|
+
const versionA = new SemVer(a, loose);
|
|
9423
|
+
const versionB = new SemVer(b, loose);
|
|
9424
|
+
return versionA.compare(versionB) || versionA.compareBuild(versionB);
|
|
9425
|
+
};
|
|
9426
|
+
module.exports = compareBuild;
|
|
9427
|
+
});
|
|
9428
|
+
|
|
9429
|
+
// node_modules/semver/functions/sort.js
|
|
9430
|
+
var require_sort = __commonJS((exports, module) => {
|
|
9431
|
+
var compareBuild = require_compare_build();
|
|
9432
|
+
var sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
|
|
9433
|
+
module.exports = sort;
|
|
9434
|
+
});
|
|
9435
|
+
|
|
9436
|
+
// node_modules/semver/functions/rsort.js
|
|
9437
|
+
var require_rsort = __commonJS((exports, module) => {
|
|
9438
|
+
var compareBuild = require_compare_build();
|
|
9439
|
+
var rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
|
|
9440
|
+
module.exports = rsort;
|
|
9441
|
+
});
|
|
9442
|
+
|
|
9443
|
+
// node_modules/semver/functions/gt.js
|
|
9444
|
+
var require_gt = __commonJS((exports, module) => {
|
|
9445
|
+
var compare = require_compare();
|
|
9446
|
+
var gt = (a, b, loose) => compare(a, b, loose) > 0;
|
|
9447
|
+
module.exports = gt;
|
|
9448
|
+
});
|
|
9449
|
+
|
|
9450
|
+
// node_modules/semver/functions/lt.js
|
|
9451
|
+
var require_lt = __commonJS((exports, module) => {
|
|
9452
|
+
var compare = require_compare();
|
|
9453
|
+
var lt = (a, b, loose) => compare(a, b, loose) < 0;
|
|
9454
|
+
module.exports = lt;
|
|
9455
|
+
});
|
|
9456
|
+
|
|
9457
|
+
// node_modules/semver/functions/eq.js
|
|
9458
|
+
var require_eq = __commonJS((exports, module) => {
|
|
9459
|
+
var compare = require_compare();
|
|
9460
|
+
var eq = (a, b, loose) => compare(a, b, loose) === 0;
|
|
9461
|
+
module.exports = eq;
|
|
9462
|
+
});
|
|
9463
|
+
|
|
9464
|
+
// node_modules/semver/functions/neq.js
|
|
9465
|
+
var require_neq = __commonJS((exports, module) => {
|
|
9466
|
+
var compare = require_compare();
|
|
9467
|
+
var neq = (a, b, loose) => compare(a, b, loose) !== 0;
|
|
9468
|
+
module.exports = neq;
|
|
9469
|
+
});
|
|
9470
|
+
|
|
9471
|
+
// node_modules/semver/functions/gte.js
|
|
9472
|
+
var require_gte = __commonJS((exports, module) => {
|
|
9473
|
+
var compare = require_compare();
|
|
9474
|
+
var gte = (a, b, loose) => compare(a, b, loose) >= 0;
|
|
9475
|
+
module.exports = gte;
|
|
9476
|
+
});
|
|
9477
|
+
|
|
9478
|
+
// node_modules/semver/functions/lte.js
|
|
9479
|
+
var require_lte = __commonJS((exports, module) => {
|
|
9480
|
+
var compare = require_compare();
|
|
9481
|
+
var lte = (a, b, loose) => compare(a, b, loose) <= 0;
|
|
9482
|
+
module.exports = lte;
|
|
9483
|
+
});
|
|
9484
|
+
|
|
9485
|
+
// node_modules/semver/functions/cmp.js
|
|
9486
|
+
var require_cmp = __commonJS((exports, module) => {
|
|
9487
|
+
var eq = require_eq();
|
|
9488
|
+
var neq = require_neq();
|
|
9489
|
+
var gt = require_gt();
|
|
9490
|
+
var gte = require_gte();
|
|
9491
|
+
var lt = require_lt();
|
|
9492
|
+
var lte = require_lte();
|
|
9493
|
+
var cmp = (a, op, b, loose) => {
|
|
9494
|
+
switch (op) {
|
|
9495
|
+
case "===":
|
|
9496
|
+
if (typeof a === "object") {
|
|
9497
|
+
a = a.version;
|
|
9498
|
+
}
|
|
9499
|
+
if (typeof b === "object") {
|
|
9500
|
+
b = b.version;
|
|
9501
|
+
}
|
|
9502
|
+
return a === b;
|
|
9503
|
+
case "!==":
|
|
9504
|
+
if (typeof a === "object") {
|
|
9505
|
+
a = a.version;
|
|
9506
|
+
}
|
|
9507
|
+
if (typeof b === "object") {
|
|
9508
|
+
b = b.version;
|
|
9509
|
+
}
|
|
9510
|
+
return a !== b;
|
|
9511
|
+
case "":
|
|
9512
|
+
case "=":
|
|
9513
|
+
case "==":
|
|
9514
|
+
return eq(a, b, loose);
|
|
9515
|
+
case "!=":
|
|
9516
|
+
return neq(a, b, loose);
|
|
9517
|
+
case ">":
|
|
9518
|
+
return gt(a, b, loose);
|
|
9519
|
+
case ">=":
|
|
9520
|
+
return gte(a, b, loose);
|
|
9521
|
+
case "<":
|
|
9522
|
+
return lt(a, b, loose);
|
|
9523
|
+
case "<=":
|
|
9524
|
+
return lte(a, b, loose);
|
|
9525
|
+
default:
|
|
9526
|
+
throw new TypeError(`Invalid operator: ${op}`);
|
|
9527
|
+
}
|
|
9528
|
+
};
|
|
9529
|
+
module.exports = cmp;
|
|
9530
|
+
});
|
|
9531
|
+
|
|
9532
|
+
// node_modules/semver/functions/coerce.js
|
|
9533
|
+
var require_coerce = __commonJS((exports, module) => {
|
|
9534
|
+
var SemVer = require_semver();
|
|
9535
|
+
var parse = require_parse();
|
|
9536
|
+
var { safeRe: re, t } = require_re();
|
|
9537
|
+
var coerce = (version, options) => {
|
|
9538
|
+
if (version instanceof SemVer) {
|
|
9539
|
+
return version;
|
|
9540
|
+
}
|
|
9541
|
+
if (typeof version === "number") {
|
|
9542
|
+
version = String(version);
|
|
9543
|
+
}
|
|
9544
|
+
if (typeof version !== "string") {
|
|
9545
|
+
return null;
|
|
9546
|
+
}
|
|
9547
|
+
options = options || {};
|
|
9548
|
+
let match = null;
|
|
9549
|
+
if (!options.rtl) {
|
|
9550
|
+
match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
|
|
9551
|
+
} else {
|
|
9552
|
+
const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
|
|
9553
|
+
let next;
|
|
9554
|
+
while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
|
|
9555
|
+
if (!match || next.index + next[0].length !== match.index + match[0].length) {
|
|
9556
|
+
match = next;
|
|
9557
|
+
}
|
|
9558
|
+
coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
|
|
9559
|
+
}
|
|
9560
|
+
coerceRtlRegex.lastIndex = -1;
|
|
9561
|
+
}
|
|
9562
|
+
if (match === null) {
|
|
9563
|
+
return null;
|
|
9564
|
+
}
|
|
9565
|
+
const major = match[2];
|
|
9566
|
+
const minor = match[3] || "0";
|
|
9567
|
+
const patch = match[4] || "0";
|
|
9568
|
+
const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
|
|
9569
|
+
const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
|
|
9570
|
+
return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options);
|
|
9571
|
+
};
|
|
9572
|
+
module.exports = coerce;
|
|
9573
|
+
});
|
|
9574
|
+
|
|
9575
|
+
// node_modules/semver/functions/truncate.js
|
|
9576
|
+
var require_truncate = __commonJS((exports, module) => {
|
|
9577
|
+
var parse = require_parse();
|
|
9578
|
+
var constants = require_constants();
|
|
9579
|
+
var SemVer = require_semver();
|
|
9580
|
+
var truncate = (version, truncation, options) => {
|
|
9581
|
+
if (!constants.RELEASE_TYPES.includes(truncation)) {
|
|
9582
|
+
return null;
|
|
9583
|
+
}
|
|
9584
|
+
const clonedVersion = cloneInputVersion(version, options);
|
|
9585
|
+
return clonedVersion && doTruncation(clonedVersion, truncation);
|
|
9586
|
+
};
|
|
9587
|
+
var cloneInputVersion = (version, options) => {
|
|
9588
|
+
const versionStringToParse = version instanceof SemVer ? version.version : version;
|
|
9589
|
+
return parse(versionStringToParse, options);
|
|
9590
|
+
};
|
|
9591
|
+
var doTruncation = (version, truncation) => {
|
|
9592
|
+
if (isPrerelease(truncation)) {
|
|
9593
|
+
return version.version;
|
|
9594
|
+
}
|
|
9595
|
+
version.prerelease = [];
|
|
9596
|
+
switch (truncation) {
|
|
9597
|
+
case "major":
|
|
9598
|
+
version.minor = 0;
|
|
9599
|
+
version.patch = 0;
|
|
9600
|
+
break;
|
|
9601
|
+
case "minor":
|
|
9602
|
+
version.patch = 0;
|
|
9603
|
+
break;
|
|
9604
|
+
}
|
|
9605
|
+
return version.format();
|
|
9606
|
+
};
|
|
9607
|
+
var isPrerelease = (type) => {
|
|
9608
|
+
return type.startsWith("pre");
|
|
9609
|
+
};
|
|
9610
|
+
module.exports = truncate;
|
|
9611
|
+
});
|
|
9612
|
+
|
|
9613
|
+
// node_modules/semver/internal/lrucache.js
|
|
9614
|
+
var require_lrucache = __commonJS((exports, module) => {
|
|
9615
|
+
class LRUCache {
|
|
9616
|
+
constructor() {
|
|
9617
|
+
this.max = 1000;
|
|
9618
|
+
this.map = new Map;
|
|
9619
|
+
}
|
|
9620
|
+
get(key) {
|
|
9621
|
+
const value = this.map.get(key);
|
|
9622
|
+
if (value === undefined) {
|
|
9623
|
+
return;
|
|
9624
|
+
} else {
|
|
9625
|
+
this.map.delete(key);
|
|
9626
|
+
this.map.set(key, value);
|
|
9627
|
+
return value;
|
|
9628
|
+
}
|
|
9629
|
+
}
|
|
9630
|
+
delete(key) {
|
|
9631
|
+
return this.map.delete(key);
|
|
9632
|
+
}
|
|
9633
|
+
set(key, value) {
|
|
9634
|
+
const deleted = this.delete(key);
|
|
9635
|
+
if (!deleted && value !== undefined) {
|
|
9636
|
+
if (this.map.size >= this.max) {
|
|
9637
|
+
const firstKey = this.map.keys().next().value;
|
|
9638
|
+
this.delete(firstKey);
|
|
9639
|
+
}
|
|
9640
|
+
this.map.set(key, value);
|
|
9641
|
+
}
|
|
9642
|
+
return this;
|
|
9643
|
+
}
|
|
9644
|
+
}
|
|
9645
|
+
module.exports = LRUCache;
|
|
9646
|
+
});
|
|
9647
|
+
|
|
9648
|
+
// node_modules/semver/classes/range.js
|
|
9649
|
+
var require_range = __commonJS((exports, module) => {
|
|
9650
|
+
var SPACE_CHARACTERS = /\s+/g;
|
|
9651
|
+
|
|
9652
|
+
class Range {
|
|
9653
|
+
constructor(range, options) {
|
|
9654
|
+
options = parseOptions(options);
|
|
9655
|
+
if (range instanceof Range) {
|
|
9656
|
+
if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
|
|
9657
|
+
return range;
|
|
9658
|
+
} else {
|
|
9659
|
+
return new Range(range.raw, options);
|
|
9660
|
+
}
|
|
9661
|
+
}
|
|
9662
|
+
if (range instanceof Comparator) {
|
|
9663
|
+
this.raw = range.value;
|
|
9664
|
+
this.set = [[range]];
|
|
9665
|
+
this.formatted = undefined;
|
|
9666
|
+
return this;
|
|
9667
|
+
}
|
|
9668
|
+
this.options = options;
|
|
9669
|
+
this.loose = !!options.loose;
|
|
9670
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
9671
|
+
this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
|
|
9672
|
+
this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
|
|
9673
|
+
if (!this.set.length) {
|
|
9674
|
+
throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
|
|
9675
|
+
}
|
|
9676
|
+
if (this.set.length > 1) {
|
|
9677
|
+
const first = this.set[0];
|
|
9678
|
+
this.set = this.set.filter((c) => !isNullSet(c[0]));
|
|
9679
|
+
if (this.set.length === 0) {
|
|
9680
|
+
this.set = [first];
|
|
9681
|
+
} else if (this.set.length > 1) {
|
|
9682
|
+
for (const c of this.set) {
|
|
9683
|
+
if (c.length === 1 && isAny(c[0])) {
|
|
9684
|
+
this.set = [c];
|
|
9685
|
+
break;
|
|
9686
|
+
}
|
|
9687
|
+
}
|
|
9688
|
+
}
|
|
9689
|
+
}
|
|
9690
|
+
this.formatted = undefined;
|
|
9691
|
+
}
|
|
9692
|
+
get range() {
|
|
9693
|
+
if (this.formatted === undefined) {
|
|
9694
|
+
this.formatted = "";
|
|
9695
|
+
for (let i = 0;i < this.set.length; i++) {
|
|
9696
|
+
if (i > 0) {
|
|
9697
|
+
this.formatted += "||";
|
|
9698
|
+
}
|
|
9699
|
+
const comps = this.set[i];
|
|
9700
|
+
for (let k = 0;k < comps.length; k++) {
|
|
9701
|
+
if (k > 0) {
|
|
9702
|
+
this.formatted += " ";
|
|
9703
|
+
}
|
|
9704
|
+
this.formatted += comps[k].toString().trim();
|
|
9705
|
+
}
|
|
9706
|
+
}
|
|
9707
|
+
}
|
|
9708
|
+
return this.formatted;
|
|
9709
|
+
}
|
|
9710
|
+
format() {
|
|
9711
|
+
return this.range;
|
|
9712
|
+
}
|
|
9713
|
+
toString() {
|
|
9714
|
+
return this.range;
|
|
9715
|
+
}
|
|
9716
|
+
parseRange(range) {
|
|
9717
|
+
range = range.replace(BUILDSTRIPRE, "");
|
|
9718
|
+
const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
|
|
9719
|
+
const memoKey = memoOpts + ":" + range;
|
|
9720
|
+
const cached = cache.get(memoKey);
|
|
9721
|
+
if (cached) {
|
|
9722
|
+
return cached;
|
|
9723
|
+
}
|
|
9724
|
+
const loose = this.options.loose;
|
|
9725
|
+
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
|
|
9726
|
+
range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
|
|
9727
|
+
debug("hyphen replace", range);
|
|
9728
|
+
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
|
|
9729
|
+
debug("comparator trim", range);
|
|
9730
|
+
range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
|
|
9731
|
+
debug("tilde trim", range);
|
|
9732
|
+
range = range.replace(re[t.CARETTRIM], caretTrimReplace);
|
|
9733
|
+
debug("caret trim", range);
|
|
9734
|
+
let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
|
|
9735
|
+
if (loose) {
|
|
9736
|
+
rangeList = rangeList.filter((comp) => {
|
|
9737
|
+
debug("loose invalid filter", comp, this.options);
|
|
9738
|
+
return !!comp.match(re[t.COMPARATORLOOSE]);
|
|
9739
|
+
});
|
|
9740
|
+
}
|
|
9741
|
+
debug("range list", rangeList);
|
|
9742
|
+
const rangeMap = new Map;
|
|
9743
|
+
const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
|
|
9744
|
+
for (const comp of comparators) {
|
|
9745
|
+
if (isNullSet(comp)) {
|
|
9746
|
+
return [comp];
|
|
9747
|
+
}
|
|
9748
|
+
rangeMap.set(comp.value, comp);
|
|
9749
|
+
}
|
|
9750
|
+
if (rangeMap.size > 1 && rangeMap.has("")) {
|
|
9751
|
+
rangeMap.delete("");
|
|
9752
|
+
}
|
|
9753
|
+
const result = [...rangeMap.values()];
|
|
9754
|
+
cache.set(memoKey, result);
|
|
9755
|
+
return result;
|
|
9756
|
+
}
|
|
9757
|
+
intersects(range, options) {
|
|
9758
|
+
if (!(range instanceof Range)) {
|
|
9759
|
+
throw new TypeError("a Range is required");
|
|
9760
|
+
}
|
|
9761
|
+
return this.set.some((thisComparators) => {
|
|
9762
|
+
return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
|
|
9763
|
+
return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
|
|
9764
|
+
return rangeComparators.every((rangeComparator) => {
|
|
9765
|
+
return thisComparator.intersects(rangeComparator, options);
|
|
9766
|
+
});
|
|
9767
|
+
});
|
|
9768
|
+
});
|
|
9769
|
+
});
|
|
9770
|
+
}
|
|
9771
|
+
test(version) {
|
|
9772
|
+
if (!version) {
|
|
9773
|
+
return false;
|
|
9774
|
+
}
|
|
9775
|
+
if (typeof version === "string") {
|
|
9776
|
+
try {
|
|
9777
|
+
version = new SemVer(version, this.options);
|
|
9778
|
+
} catch (er) {
|
|
9779
|
+
return false;
|
|
9780
|
+
}
|
|
9781
|
+
}
|
|
9782
|
+
for (let i = 0;i < this.set.length; i++) {
|
|
9783
|
+
if (testSet(this.set[i], version, this.options)) {
|
|
9784
|
+
return true;
|
|
9785
|
+
}
|
|
9786
|
+
}
|
|
9787
|
+
return false;
|
|
9788
|
+
}
|
|
9789
|
+
}
|
|
9790
|
+
module.exports = Range;
|
|
9791
|
+
var LRU = require_lrucache();
|
|
9792
|
+
var cache = new LRU;
|
|
9793
|
+
var parseOptions = require_parse_options();
|
|
9794
|
+
var Comparator = require_comparator();
|
|
9795
|
+
var debug = require_debug();
|
|
9796
|
+
var SemVer = require_semver();
|
|
9797
|
+
var {
|
|
9798
|
+
safeRe: re,
|
|
9799
|
+
src,
|
|
9800
|
+
t,
|
|
9801
|
+
comparatorTrimReplace,
|
|
9802
|
+
tildeTrimReplace,
|
|
9803
|
+
caretTrimReplace
|
|
9804
|
+
} = require_re();
|
|
9805
|
+
var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
|
|
9806
|
+
var BUILDSTRIPRE = new RegExp(src[t.BUILD], "g");
|
|
9807
|
+
var isNullSet = (c) => c.value === "<0.0.0-0";
|
|
9808
|
+
var isAny = (c) => c.value === "";
|
|
9809
|
+
var isSatisfiable = (comparators, options) => {
|
|
9810
|
+
let result = true;
|
|
9811
|
+
const remainingComparators = comparators.slice();
|
|
9812
|
+
let testComparator = remainingComparators.pop();
|
|
9813
|
+
while (result && remainingComparators.length) {
|
|
9814
|
+
result = remainingComparators.every((otherComparator) => {
|
|
9815
|
+
return testComparator.intersects(otherComparator, options);
|
|
9816
|
+
});
|
|
9817
|
+
testComparator = remainingComparators.pop();
|
|
9818
|
+
}
|
|
9819
|
+
return result;
|
|
9820
|
+
};
|
|
9821
|
+
var parseComparator = (comp, options) => {
|
|
9822
|
+
comp = comp.replace(re[t.BUILD], "");
|
|
9823
|
+
debug("comp", comp, options);
|
|
9824
|
+
comp = replaceCarets(comp, options);
|
|
9825
|
+
debug("caret", comp);
|
|
9826
|
+
comp = replaceTildes(comp, options);
|
|
9827
|
+
debug("tildes", comp);
|
|
9828
|
+
comp = replaceXRanges(comp, options);
|
|
9829
|
+
debug("xrange", comp);
|
|
9830
|
+
comp = replaceStars(comp, options);
|
|
9831
|
+
debug("stars", comp);
|
|
9832
|
+
return comp;
|
|
9833
|
+
};
|
|
9834
|
+
var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
|
|
9835
|
+
var replaceTildes = (comp, options) => {
|
|
9836
|
+
return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
|
|
9837
|
+
};
|
|
9838
|
+
var replaceTilde = (comp, options) => {
|
|
9839
|
+
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
9840
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
9841
|
+
debug("tilde", comp, _, M, m, p, pr);
|
|
9842
|
+
let ret;
|
|
9843
|
+
if (isX(M)) {
|
|
9844
|
+
ret = "";
|
|
9845
|
+
} else if (isX(m)) {
|
|
9846
|
+
ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
|
|
9847
|
+
} else if (isX(p)) {
|
|
9848
|
+
ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
|
|
9849
|
+
} else if (pr) {
|
|
9850
|
+
debug("replaceTilde pr", pr);
|
|
9851
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
9852
|
+
} else {
|
|
9853
|
+
ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
|
|
9854
|
+
}
|
|
9855
|
+
debug("tilde return", ret);
|
|
9856
|
+
return ret;
|
|
9857
|
+
});
|
|
9858
|
+
};
|
|
9859
|
+
var replaceCarets = (comp, options) => {
|
|
9860
|
+
return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
|
|
9861
|
+
};
|
|
9862
|
+
var replaceCaret = (comp, options) => {
|
|
9863
|
+
debug("caret", comp, options);
|
|
9864
|
+
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
|
9865
|
+
const z = options.includePrerelease ? "-0" : "";
|
|
9866
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
9867
|
+
debug("caret", comp, _, M, m, p, pr);
|
|
9868
|
+
let ret;
|
|
9869
|
+
if (isX(M)) {
|
|
9870
|
+
ret = "";
|
|
9871
|
+
} else if (isX(m)) {
|
|
9872
|
+
ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
9873
|
+
} else if (isX(p)) {
|
|
9874
|
+
if (M === "0") {
|
|
9875
|
+
ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
|
|
9876
|
+
} else {
|
|
9877
|
+
ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
|
|
9878
|
+
}
|
|
9879
|
+
} else if (pr) {
|
|
9880
|
+
debug("replaceCaret pr", pr);
|
|
9881
|
+
if (M === "0") {
|
|
9882
|
+
if (m === "0") {
|
|
9883
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
|
|
9884
|
+
} else {
|
|
9885
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
9886
|
+
}
|
|
9887
|
+
} else {
|
|
9888
|
+
ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
|
|
9889
|
+
}
|
|
9890
|
+
} else {
|
|
9891
|
+
debug("no pr");
|
|
9892
|
+
if (M === "0") {
|
|
9893
|
+
if (m === "0") {
|
|
9894
|
+
ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
|
|
9895
|
+
} else {
|
|
9896
|
+
ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
|
|
9897
|
+
}
|
|
9898
|
+
} else {
|
|
9899
|
+
ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
|
|
9900
|
+
}
|
|
9901
|
+
}
|
|
9902
|
+
debug("caret return", ret);
|
|
9903
|
+
return ret;
|
|
9904
|
+
});
|
|
9905
|
+
};
|
|
9906
|
+
var replaceXRanges = (comp, options) => {
|
|
9907
|
+
debug("replaceXRanges", comp, options);
|
|
9908
|
+
return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
|
|
9909
|
+
};
|
|
9910
|
+
var replaceXRange = (comp, options) => {
|
|
9911
|
+
comp = comp.trim();
|
|
9912
|
+
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
|
|
9913
|
+
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
|
9914
|
+
debug("xRange", comp, ret, gtlt, M, m, p, pr);
|
|
9915
|
+
const xM = isX(M);
|
|
9916
|
+
const xm = xM || isX(m);
|
|
9917
|
+
const xp = xm || isX(p);
|
|
9918
|
+
const anyX = xp;
|
|
9919
|
+
if (gtlt === "=" && anyX) {
|
|
9920
|
+
gtlt = "";
|
|
9921
|
+
}
|
|
9922
|
+
pr = options.includePrerelease ? "-0" : "";
|
|
9923
|
+
if (xM) {
|
|
9924
|
+
if (gtlt === ">" || gtlt === "<") {
|
|
9925
|
+
ret = "<0.0.0-0";
|
|
9926
|
+
} else {
|
|
9927
|
+
ret = "*";
|
|
9928
|
+
}
|
|
9929
|
+
} else if (gtlt && anyX) {
|
|
9930
|
+
if (xm) {
|
|
9931
|
+
m = 0;
|
|
9932
|
+
}
|
|
9933
|
+
p = 0;
|
|
9934
|
+
if (gtlt === ">") {
|
|
9935
|
+
gtlt = ">=";
|
|
9936
|
+
if (xm) {
|
|
9937
|
+
M = +M + 1;
|
|
9938
|
+
m = 0;
|
|
9939
|
+
p = 0;
|
|
9940
|
+
} else {
|
|
9941
|
+
m = +m + 1;
|
|
9942
|
+
p = 0;
|
|
9943
|
+
}
|
|
9944
|
+
} else if (gtlt === "<=") {
|
|
9945
|
+
gtlt = "<";
|
|
9946
|
+
if (xm) {
|
|
9947
|
+
M = +M + 1;
|
|
9948
|
+
} else {
|
|
9949
|
+
m = +m + 1;
|
|
9950
|
+
}
|
|
9951
|
+
}
|
|
9952
|
+
if (gtlt === "<") {
|
|
9953
|
+
pr = "-0";
|
|
9954
|
+
}
|
|
9955
|
+
ret = `${gtlt + M}.${m}.${p}${pr}`;
|
|
9956
|
+
} else if (xm) {
|
|
9957
|
+
ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
|
|
9958
|
+
} else if (xp) {
|
|
9959
|
+
ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
|
|
9960
|
+
}
|
|
9961
|
+
debug("xRange return", ret);
|
|
9962
|
+
return ret;
|
|
9963
|
+
});
|
|
9964
|
+
};
|
|
9965
|
+
var replaceStars = (comp, options) => {
|
|
9966
|
+
debug("replaceStars", comp, options);
|
|
9967
|
+
return comp.trim().replace(re[t.STAR], "");
|
|
9968
|
+
};
|
|
9969
|
+
var replaceGTE0 = (comp, options) => {
|
|
9970
|
+
debug("replaceGTE0", comp, options);
|
|
9971
|
+
return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
|
|
9972
|
+
};
|
|
9973
|
+
var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
|
|
9974
|
+
if (isX(fM)) {
|
|
9975
|
+
from = "";
|
|
9976
|
+
} else if (isX(fm)) {
|
|
9977
|
+
from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
|
|
9978
|
+
} else if (isX(fp)) {
|
|
9979
|
+
from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
|
|
9980
|
+
} else if (fpr) {
|
|
9981
|
+
from = `>=${from}`;
|
|
9982
|
+
} else {
|
|
9983
|
+
from = `>=${from}${incPr ? "-0" : ""}`;
|
|
9984
|
+
}
|
|
9985
|
+
if (isX(tM)) {
|
|
9986
|
+
to = "";
|
|
9987
|
+
} else if (isX(tm)) {
|
|
9988
|
+
to = `<${+tM + 1}.0.0-0`;
|
|
9989
|
+
} else if (isX(tp)) {
|
|
9990
|
+
to = `<${tM}.${+tm + 1}.0-0`;
|
|
9991
|
+
} else if (tpr) {
|
|
9992
|
+
to = `<=${tM}.${tm}.${tp}-${tpr}`;
|
|
9993
|
+
} else if (incPr) {
|
|
9994
|
+
to = `<${tM}.${tm}.${+tp + 1}-0`;
|
|
9995
|
+
} else {
|
|
9996
|
+
to = `<=${to}`;
|
|
9997
|
+
}
|
|
9998
|
+
return `${from} ${to}`.trim();
|
|
9999
|
+
};
|
|
10000
|
+
var testSet = (set, version, options) => {
|
|
10001
|
+
for (let i = 0;i < set.length; i++) {
|
|
10002
|
+
if (!set[i].test(version)) {
|
|
10003
|
+
return false;
|
|
10004
|
+
}
|
|
10005
|
+
}
|
|
10006
|
+
if (version.prerelease.length && !options.includePrerelease) {
|
|
10007
|
+
for (let i = 0;i < set.length; i++) {
|
|
10008
|
+
debug(set[i].semver);
|
|
10009
|
+
if (set[i].semver === Comparator.ANY) {
|
|
10010
|
+
continue;
|
|
10011
|
+
}
|
|
10012
|
+
if (set[i].semver.prerelease.length > 0) {
|
|
10013
|
+
const allowed = set[i].semver;
|
|
10014
|
+
if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
|
|
10015
|
+
return true;
|
|
10016
|
+
}
|
|
10017
|
+
}
|
|
10018
|
+
}
|
|
10019
|
+
return false;
|
|
10020
|
+
}
|
|
10021
|
+
return true;
|
|
10022
|
+
};
|
|
10023
|
+
});
|
|
10024
|
+
|
|
10025
|
+
// node_modules/semver/classes/comparator.js
|
|
10026
|
+
var require_comparator = __commonJS((exports, module) => {
|
|
10027
|
+
var ANY = Symbol("SemVer ANY");
|
|
10028
|
+
|
|
10029
|
+
class Comparator {
|
|
10030
|
+
static get ANY() {
|
|
10031
|
+
return ANY;
|
|
10032
|
+
}
|
|
10033
|
+
constructor(comp, options) {
|
|
10034
|
+
options = parseOptions(options);
|
|
10035
|
+
if (comp instanceof Comparator) {
|
|
10036
|
+
if (comp.loose === !!options.loose) {
|
|
10037
|
+
return comp;
|
|
10038
|
+
} else {
|
|
10039
|
+
comp = comp.value;
|
|
10040
|
+
}
|
|
10041
|
+
}
|
|
10042
|
+
comp = comp.trim().split(/\s+/).join(" ");
|
|
10043
|
+
debug("comparator", comp, options);
|
|
10044
|
+
this.options = options;
|
|
10045
|
+
this.loose = !!options.loose;
|
|
10046
|
+
this.parse(comp);
|
|
10047
|
+
if (this.semver === ANY) {
|
|
10048
|
+
this.value = "";
|
|
10049
|
+
} else {
|
|
10050
|
+
this.value = this.operator + this.semver.version;
|
|
10051
|
+
}
|
|
10052
|
+
debug("comp", this);
|
|
10053
|
+
}
|
|
10054
|
+
parse(comp) {
|
|
10055
|
+
const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
|
|
10056
|
+
const m = comp.match(r);
|
|
10057
|
+
if (!m) {
|
|
10058
|
+
throw new TypeError(`Invalid comparator: ${comp}`);
|
|
10059
|
+
}
|
|
10060
|
+
this.operator = m[1] !== undefined ? m[1] : "";
|
|
10061
|
+
if (this.operator === "=") {
|
|
10062
|
+
this.operator = "";
|
|
10063
|
+
}
|
|
10064
|
+
if (!m[2]) {
|
|
10065
|
+
this.semver = ANY;
|
|
10066
|
+
} else {
|
|
10067
|
+
this.semver = new SemVer(m[2], this.options.loose);
|
|
10068
|
+
}
|
|
10069
|
+
}
|
|
10070
|
+
toString() {
|
|
10071
|
+
return this.value;
|
|
10072
|
+
}
|
|
10073
|
+
test(version) {
|
|
10074
|
+
debug("Comparator.test", version, this.options.loose);
|
|
10075
|
+
if (this.semver === ANY || version === ANY) {
|
|
10076
|
+
return true;
|
|
10077
|
+
}
|
|
10078
|
+
if (typeof version === "string") {
|
|
10079
|
+
try {
|
|
10080
|
+
version = new SemVer(version, this.options);
|
|
10081
|
+
} catch (er) {
|
|
10082
|
+
return false;
|
|
10083
|
+
}
|
|
10084
|
+
}
|
|
10085
|
+
return cmp(version, this.operator, this.semver, this.options);
|
|
10086
|
+
}
|
|
10087
|
+
intersects(comp, options) {
|
|
10088
|
+
if (!(comp instanceof Comparator)) {
|
|
10089
|
+
throw new TypeError("a Comparator is required");
|
|
10090
|
+
}
|
|
10091
|
+
if (this.operator === "") {
|
|
10092
|
+
if (this.value === "") {
|
|
10093
|
+
return true;
|
|
10094
|
+
}
|
|
10095
|
+
return new Range(comp.value, options).test(this.value);
|
|
10096
|
+
} else if (comp.operator === "") {
|
|
10097
|
+
if (comp.value === "") {
|
|
10098
|
+
return true;
|
|
10099
|
+
}
|
|
10100
|
+
return new Range(this.value, options).test(comp.semver);
|
|
10101
|
+
}
|
|
10102
|
+
options = parseOptions(options);
|
|
10103
|
+
if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
|
|
10104
|
+
return false;
|
|
10105
|
+
}
|
|
10106
|
+
if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
|
|
10107
|
+
return false;
|
|
10108
|
+
}
|
|
10109
|
+
if (this.operator.startsWith(">") && comp.operator.startsWith(">")) {
|
|
10110
|
+
return true;
|
|
10111
|
+
}
|
|
10112
|
+
if (this.operator.startsWith("<") && comp.operator.startsWith("<")) {
|
|
10113
|
+
return true;
|
|
10114
|
+
}
|
|
10115
|
+
if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) {
|
|
10116
|
+
return true;
|
|
10117
|
+
}
|
|
10118
|
+
if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
|
|
10119
|
+
return true;
|
|
10120
|
+
}
|
|
10121
|
+
if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
|
|
10122
|
+
return true;
|
|
10123
|
+
}
|
|
10124
|
+
return false;
|
|
10125
|
+
}
|
|
10126
|
+
}
|
|
10127
|
+
module.exports = Comparator;
|
|
10128
|
+
var parseOptions = require_parse_options();
|
|
10129
|
+
var { safeRe: re, t } = require_re();
|
|
10130
|
+
var cmp = require_cmp();
|
|
10131
|
+
var debug = require_debug();
|
|
10132
|
+
var SemVer = require_semver();
|
|
10133
|
+
var Range = require_range();
|
|
10134
|
+
});
|
|
10135
|
+
|
|
10136
|
+
// node_modules/semver/functions/satisfies.js
|
|
10137
|
+
var require_satisfies = __commonJS((exports, module) => {
|
|
10138
|
+
var Range = require_range();
|
|
10139
|
+
var satisfies = (version, range, options) => {
|
|
10140
|
+
try {
|
|
10141
|
+
range = new Range(range, options);
|
|
10142
|
+
} catch (er) {
|
|
10143
|
+
return false;
|
|
10144
|
+
}
|
|
10145
|
+
return range.test(version);
|
|
10146
|
+
};
|
|
10147
|
+
module.exports = satisfies;
|
|
10148
|
+
});
|
|
10149
|
+
|
|
10150
|
+
// node_modules/semver/ranges/to-comparators.js
|
|
10151
|
+
var require_to_comparators = __commonJS((exports, module) => {
|
|
10152
|
+
var Range = require_range();
|
|
10153
|
+
var toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
|
|
10154
|
+
module.exports = toComparators;
|
|
10155
|
+
});
|
|
10156
|
+
|
|
10157
|
+
// node_modules/semver/ranges/max-satisfying.js
|
|
10158
|
+
var require_max_satisfying = __commonJS((exports, module) => {
|
|
10159
|
+
var SemVer = require_semver();
|
|
10160
|
+
var Range = require_range();
|
|
10161
|
+
var maxSatisfying = (versions, range, options) => {
|
|
10162
|
+
let max = null;
|
|
10163
|
+
let maxSV = null;
|
|
10164
|
+
let rangeObj = null;
|
|
10165
|
+
try {
|
|
10166
|
+
rangeObj = new Range(range, options);
|
|
10167
|
+
} catch (er) {
|
|
10168
|
+
return null;
|
|
10169
|
+
}
|
|
10170
|
+
versions.forEach((v) => {
|
|
10171
|
+
if (rangeObj.test(v)) {
|
|
10172
|
+
if (!max || maxSV.compare(v) === -1) {
|
|
10173
|
+
max = v;
|
|
10174
|
+
maxSV = new SemVer(max, options);
|
|
10175
|
+
}
|
|
10176
|
+
}
|
|
10177
|
+
});
|
|
10178
|
+
return max;
|
|
10179
|
+
};
|
|
10180
|
+
module.exports = maxSatisfying;
|
|
10181
|
+
});
|
|
10182
|
+
|
|
10183
|
+
// node_modules/semver/ranges/min-satisfying.js
|
|
10184
|
+
var require_min_satisfying = __commonJS((exports, module) => {
|
|
10185
|
+
var SemVer = require_semver();
|
|
10186
|
+
var Range = require_range();
|
|
10187
|
+
var minSatisfying = (versions, range, options) => {
|
|
10188
|
+
let min = null;
|
|
10189
|
+
let minSV = null;
|
|
10190
|
+
let rangeObj = null;
|
|
10191
|
+
try {
|
|
10192
|
+
rangeObj = new Range(range, options);
|
|
10193
|
+
} catch (er) {
|
|
10194
|
+
return null;
|
|
10195
|
+
}
|
|
10196
|
+
versions.forEach((v) => {
|
|
10197
|
+
if (rangeObj.test(v)) {
|
|
10198
|
+
if (!min || minSV.compare(v) === 1) {
|
|
10199
|
+
min = v;
|
|
10200
|
+
minSV = new SemVer(min, options);
|
|
10201
|
+
}
|
|
10202
|
+
}
|
|
10203
|
+
});
|
|
10204
|
+
return min;
|
|
10205
|
+
};
|
|
10206
|
+
module.exports = minSatisfying;
|
|
10207
|
+
});
|
|
10208
|
+
|
|
10209
|
+
// node_modules/semver/ranges/min-version.js
|
|
10210
|
+
var require_min_version = __commonJS((exports, module) => {
|
|
10211
|
+
var SemVer = require_semver();
|
|
10212
|
+
var Range = require_range();
|
|
10213
|
+
var gt = require_gt();
|
|
10214
|
+
var minVersion = (range, loose) => {
|
|
10215
|
+
range = new Range(range, loose);
|
|
10216
|
+
let minver = new SemVer("0.0.0");
|
|
10217
|
+
if (range.test(minver)) {
|
|
10218
|
+
return minver;
|
|
10219
|
+
}
|
|
10220
|
+
minver = new SemVer("0.0.0-0");
|
|
10221
|
+
if (range.test(minver)) {
|
|
10222
|
+
return minver;
|
|
10223
|
+
}
|
|
10224
|
+
minver = null;
|
|
10225
|
+
for (let i = 0;i < range.set.length; ++i) {
|
|
10226
|
+
const comparators = range.set[i];
|
|
10227
|
+
let setMin = null;
|
|
10228
|
+
comparators.forEach((comparator) => {
|
|
10229
|
+
const compver = new SemVer(comparator.semver.version);
|
|
10230
|
+
switch (comparator.operator) {
|
|
10231
|
+
case ">":
|
|
10232
|
+
if (compver.prerelease.length === 0) {
|
|
10233
|
+
compver.patch++;
|
|
10234
|
+
} else {
|
|
10235
|
+
compver.prerelease.push(0);
|
|
10236
|
+
}
|
|
10237
|
+
compver.raw = compver.format();
|
|
10238
|
+
case "":
|
|
10239
|
+
case ">=":
|
|
10240
|
+
if (!setMin || gt(compver, setMin)) {
|
|
10241
|
+
setMin = compver;
|
|
10242
|
+
}
|
|
10243
|
+
break;
|
|
10244
|
+
case "<":
|
|
10245
|
+
case "<=":
|
|
10246
|
+
break;
|
|
10247
|
+
default:
|
|
10248
|
+
throw new Error(`Unexpected operation: ${comparator.operator}`);
|
|
10249
|
+
}
|
|
10250
|
+
});
|
|
10251
|
+
if (setMin && (!minver || gt(minver, setMin))) {
|
|
10252
|
+
minver = setMin;
|
|
10253
|
+
}
|
|
10254
|
+
}
|
|
10255
|
+
if (minver && range.test(minver)) {
|
|
10256
|
+
return minver;
|
|
10257
|
+
}
|
|
10258
|
+
return null;
|
|
10259
|
+
};
|
|
10260
|
+
module.exports = minVersion;
|
|
10261
|
+
});
|
|
10262
|
+
|
|
10263
|
+
// node_modules/semver/ranges/valid.js
|
|
10264
|
+
var require_valid2 = __commonJS((exports, module) => {
|
|
10265
|
+
var Range = require_range();
|
|
10266
|
+
var validRange = (range, options) => {
|
|
10267
|
+
try {
|
|
10268
|
+
return new Range(range, options).range || "*";
|
|
10269
|
+
} catch (er) {
|
|
10270
|
+
return null;
|
|
10271
|
+
}
|
|
10272
|
+
};
|
|
10273
|
+
module.exports = validRange;
|
|
10274
|
+
});
|
|
10275
|
+
|
|
10276
|
+
// node_modules/semver/ranges/outside.js
|
|
10277
|
+
var require_outside = __commonJS((exports, module) => {
|
|
10278
|
+
var SemVer = require_semver();
|
|
10279
|
+
var Comparator = require_comparator();
|
|
10280
|
+
var { ANY } = Comparator;
|
|
10281
|
+
var Range = require_range();
|
|
10282
|
+
var satisfies = require_satisfies();
|
|
10283
|
+
var gt = require_gt();
|
|
10284
|
+
var lt = require_lt();
|
|
10285
|
+
var lte = require_lte();
|
|
10286
|
+
var gte = require_gte();
|
|
10287
|
+
var outside = (version, range, hilo, options) => {
|
|
10288
|
+
version = new SemVer(version, options);
|
|
10289
|
+
range = new Range(range, options);
|
|
10290
|
+
let gtfn, ltefn, ltfn, comp, ecomp;
|
|
10291
|
+
switch (hilo) {
|
|
10292
|
+
case ">":
|
|
10293
|
+
gtfn = gt;
|
|
10294
|
+
ltefn = lte;
|
|
10295
|
+
ltfn = lt;
|
|
10296
|
+
comp = ">";
|
|
10297
|
+
ecomp = ">=";
|
|
10298
|
+
break;
|
|
10299
|
+
case "<":
|
|
10300
|
+
gtfn = lt;
|
|
10301
|
+
ltefn = gte;
|
|
10302
|
+
ltfn = gt;
|
|
10303
|
+
comp = "<";
|
|
10304
|
+
ecomp = "<=";
|
|
10305
|
+
break;
|
|
10306
|
+
default:
|
|
10307
|
+
throw new TypeError('Must provide a hilo val of "<" or ">"');
|
|
10308
|
+
}
|
|
10309
|
+
if (satisfies(version, range, options)) {
|
|
10310
|
+
return false;
|
|
10311
|
+
}
|
|
10312
|
+
for (let i = 0;i < range.set.length; ++i) {
|
|
10313
|
+
const comparators = range.set[i];
|
|
10314
|
+
let high = null;
|
|
10315
|
+
let low = null;
|
|
10316
|
+
comparators.forEach((comparator) => {
|
|
10317
|
+
if (comparator.semver === ANY) {
|
|
10318
|
+
comparator = new Comparator(">=0.0.0");
|
|
10319
|
+
}
|
|
10320
|
+
high = high || comparator;
|
|
10321
|
+
low = low || comparator;
|
|
10322
|
+
if (gtfn(comparator.semver, high.semver, options)) {
|
|
10323
|
+
high = comparator;
|
|
10324
|
+
} else if (ltfn(comparator.semver, low.semver, options)) {
|
|
10325
|
+
low = comparator;
|
|
10326
|
+
}
|
|
10327
|
+
});
|
|
10328
|
+
if (high.operator === comp || high.operator === ecomp) {
|
|
10329
|
+
return false;
|
|
10330
|
+
}
|
|
10331
|
+
if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) {
|
|
10332
|
+
return false;
|
|
10333
|
+
} else if (low.operator === ecomp && ltfn(version, low.semver)) {
|
|
10334
|
+
return false;
|
|
10335
|
+
}
|
|
10336
|
+
}
|
|
10337
|
+
return true;
|
|
10338
|
+
};
|
|
10339
|
+
module.exports = outside;
|
|
10340
|
+
});
|
|
10341
|
+
|
|
10342
|
+
// node_modules/semver/ranges/gtr.js
|
|
10343
|
+
var require_gtr = __commonJS((exports, module) => {
|
|
10344
|
+
var outside = require_outside();
|
|
10345
|
+
var gtr = (version, range, options) => outside(version, range, ">", options);
|
|
10346
|
+
module.exports = gtr;
|
|
10347
|
+
});
|
|
10348
|
+
|
|
10349
|
+
// node_modules/semver/ranges/ltr.js
|
|
10350
|
+
var require_ltr = __commonJS((exports, module) => {
|
|
10351
|
+
var outside = require_outside();
|
|
10352
|
+
var ltr = (version, range, options) => outside(version, range, "<", options);
|
|
10353
|
+
module.exports = ltr;
|
|
10354
|
+
});
|
|
10355
|
+
|
|
10356
|
+
// node_modules/semver/ranges/intersects.js
|
|
10357
|
+
var require_intersects = __commonJS((exports, module) => {
|
|
10358
|
+
var Range = require_range();
|
|
10359
|
+
var intersects = (r1, r2, options) => {
|
|
10360
|
+
r1 = new Range(r1, options);
|
|
10361
|
+
r2 = new Range(r2, options);
|
|
10362
|
+
return r1.intersects(r2, options);
|
|
10363
|
+
};
|
|
10364
|
+
module.exports = intersects;
|
|
10365
|
+
});
|
|
10366
|
+
|
|
10367
|
+
// node_modules/semver/ranges/simplify.js
|
|
10368
|
+
var require_simplify = __commonJS((exports, module) => {
|
|
10369
|
+
var satisfies = require_satisfies();
|
|
10370
|
+
var compare = require_compare();
|
|
10371
|
+
module.exports = (versions, range, options) => {
|
|
10372
|
+
const set = [];
|
|
10373
|
+
let first = null;
|
|
10374
|
+
let prev = null;
|
|
10375
|
+
const v = versions.sort((a, b) => compare(a, b, options));
|
|
10376
|
+
for (const version of v) {
|
|
10377
|
+
const included = satisfies(version, range, options);
|
|
10378
|
+
if (included) {
|
|
10379
|
+
prev = version;
|
|
10380
|
+
if (!first) {
|
|
10381
|
+
first = version;
|
|
10382
|
+
}
|
|
10383
|
+
} else {
|
|
10384
|
+
if (prev) {
|
|
10385
|
+
set.push([first, prev]);
|
|
10386
|
+
}
|
|
10387
|
+
prev = null;
|
|
10388
|
+
first = null;
|
|
10389
|
+
}
|
|
10390
|
+
}
|
|
10391
|
+
if (first) {
|
|
10392
|
+
set.push([first, null]);
|
|
10393
|
+
}
|
|
10394
|
+
const ranges = [];
|
|
10395
|
+
for (const [min, max] of set) {
|
|
10396
|
+
if (min === max) {
|
|
10397
|
+
ranges.push(min);
|
|
10398
|
+
} else if (!max && min === v[0]) {
|
|
10399
|
+
ranges.push("*");
|
|
10400
|
+
} else if (!max) {
|
|
10401
|
+
ranges.push(`>=${min}`);
|
|
10402
|
+
} else if (min === v[0]) {
|
|
10403
|
+
ranges.push(`<=${max}`);
|
|
10404
|
+
} else {
|
|
10405
|
+
ranges.push(`${min} - ${max}`);
|
|
10406
|
+
}
|
|
10407
|
+
}
|
|
10408
|
+
const simplified = ranges.join(" || ");
|
|
10409
|
+
const original = typeof range.raw === "string" ? range.raw : String(range);
|
|
10410
|
+
return simplified.length < original.length ? simplified : range;
|
|
10411
|
+
};
|
|
10412
|
+
});
|
|
10413
|
+
|
|
10414
|
+
// node_modules/semver/ranges/subset.js
|
|
10415
|
+
var require_subset = __commonJS((exports, module) => {
|
|
10416
|
+
var Range = require_range();
|
|
10417
|
+
var Comparator = require_comparator();
|
|
10418
|
+
var { ANY } = Comparator;
|
|
10419
|
+
var satisfies = require_satisfies();
|
|
10420
|
+
var compare = require_compare();
|
|
10421
|
+
var subset = (sub, dom, options = {}) => {
|
|
10422
|
+
if (sub === dom) {
|
|
10423
|
+
return true;
|
|
10424
|
+
}
|
|
10425
|
+
sub = new Range(sub, options);
|
|
10426
|
+
dom = new Range(dom, options);
|
|
10427
|
+
let sawNonNull = false;
|
|
10428
|
+
OUTER:
|
|
10429
|
+
for (const simpleSub of sub.set) {
|
|
10430
|
+
for (const simpleDom of dom.set) {
|
|
10431
|
+
const isSub = simpleSubset(simpleSub, simpleDom, options);
|
|
10432
|
+
sawNonNull = sawNonNull || isSub !== null;
|
|
10433
|
+
if (isSub) {
|
|
10434
|
+
continue OUTER;
|
|
10435
|
+
}
|
|
10436
|
+
}
|
|
10437
|
+
if (sawNonNull) {
|
|
10438
|
+
return false;
|
|
10439
|
+
}
|
|
10440
|
+
}
|
|
10441
|
+
return true;
|
|
10442
|
+
};
|
|
10443
|
+
var minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
|
|
10444
|
+
var minimumVersion = [new Comparator(">=0.0.0")];
|
|
10445
|
+
var simpleSubset = (sub, dom, options) => {
|
|
10446
|
+
if (sub === dom) {
|
|
10447
|
+
return true;
|
|
10448
|
+
}
|
|
10449
|
+
if (sub.length === 1 && sub[0].semver === ANY) {
|
|
10450
|
+
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
10451
|
+
return true;
|
|
10452
|
+
} else if (options.includePrerelease) {
|
|
10453
|
+
sub = minimumVersionWithPreRelease;
|
|
10454
|
+
} else {
|
|
10455
|
+
sub = minimumVersion;
|
|
10456
|
+
}
|
|
10457
|
+
}
|
|
10458
|
+
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
10459
|
+
if (options.includePrerelease) {
|
|
10460
|
+
return true;
|
|
10461
|
+
} else {
|
|
10462
|
+
dom = minimumVersion;
|
|
10463
|
+
}
|
|
10464
|
+
}
|
|
10465
|
+
const eqSet = new Set;
|
|
10466
|
+
let gt, lt;
|
|
10467
|
+
for (const c of sub) {
|
|
10468
|
+
if (c.operator === ">" || c.operator === ">=") {
|
|
10469
|
+
gt = higherGT(gt, c, options);
|
|
10470
|
+
} else if (c.operator === "<" || c.operator === "<=") {
|
|
10471
|
+
lt = lowerLT(lt, c, options);
|
|
10472
|
+
} else {
|
|
10473
|
+
eqSet.add(c.semver);
|
|
10474
|
+
}
|
|
10475
|
+
}
|
|
10476
|
+
if (eqSet.size > 1) {
|
|
10477
|
+
return null;
|
|
10478
|
+
}
|
|
10479
|
+
let gtltComp;
|
|
10480
|
+
if (gt && lt) {
|
|
10481
|
+
gtltComp = compare(gt.semver, lt.semver, options);
|
|
10482
|
+
if (gtltComp > 0) {
|
|
10483
|
+
return null;
|
|
10484
|
+
} else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
|
|
10485
|
+
return null;
|
|
10486
|
+
}
|
|
10487
|
+
}
|
|
10488
|
+
for (const eq of eqSet) {
|
|
10489
|
+
if (gt && !satisfies(eq, String(gt), options)) {
|
|
10490
|
+
return null;
|
|
10491
|
+
}
|
|
10492
|
+
if (lt && !satisfies(eq, String(lt), options)) {
|
|
10493
|
+
return null;
|
|
10494
|
+
}
|
|
10495
|
+
for (const c of dom) {
|
|
10496
|
+
if (!satisfies(eq, String(c), options)) {
|
|
10497
|
+
return false;
|
|
10498
|
+
}
|
|
10499
|
+
}
|
|
10500
|
+
return true;
|
|
10501
|
+
}
|
|
10502
|
+
let higher, lower;
|
|
10503
|
+
let hasDomLT, hasDomGT;
|
|
10504
|
+
let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
|
|
10505
|
+
let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
|
|
10506
|
+
if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) {
|
|
10507
|
+
needDomLTPre = false;
|
|
10508
|
+
}
|
|
10509
|
+
for (const c of dom) {
|
|
10510
|
+
hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
|
|
10511
|
+
hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
|
|
10512
|
+
if (gt) {
|
|
10513
|
+
if (needDomGTPre) {
|
|
10514
|
+
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) {
|
|
10515
|
+
needDomGTPre = false;
|
|
10516
|
+
}
|
|
10517
|
+
}
|
|
10518
|
+
if (c.operator === ">" || c.operator === ">=") {
|
|
10519
|
+
higher = higherGT(gt, c, options);
|
|
10520
|
+
if (higher === c && higher !== gt) {
|
|
10521
|
+
return false;
|
|
10522
|
+
}
|
|
10523
|
+
} else if (gt.operator === ">=" && !c.test(gt.semver)) {
|
|
10524
|
+
return false;
|
|
10525
|
+
}
|
|
10526
|
+
}
|
|
10527
|
+
if (lt) {
|
|
10528
|
+
if (needDomLTPre) {
|
|
10529
|
+
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) {
|
|
10530
|
+
needDomLTPre = false;
|
|
10531
|
+
}
|
|
10532
|
+
}
|
|
10533
|
+
if (c.operator === "<" || c.operator === "<=") {
|
|
10534
|
+
lower = lowerLT(lt, c, options);
|
|
10535
|
+
if (lower === c && lower !== lt) {
|
|
10536
|
+
return false;
|
|
10537
|
+
}
|
|
10538
|
+
} else if (lt.operator === "<=" && !c.test(lt.semver)) {
|
|
10539
|
+
return false;
|
|
10540
|
+
}
|
|
10541
|
+
}
|
|
10542
|
+
if (!c.operator && (lt || gt) && gtltComp !== 0) {
|
|
10543
|
+
return false;
|
|
10544
|
+
}
|
|
10545
|
+
}
|
|
10546
|
+
if (gt && hasDomLT && !lt && gtltComp !== 0) {
|
|
10547
|
+
return false;
|
|
10548
|
+
}
|
|
10549
|
+
if (lt && hasDomGT && !gt && gtltComp !== 0) {
|
|
10550
|
+
return false;
|
|
10551
|
+
}
|
|
10552
|
+
if (needDomGTPre || needDomLTPre) {
|
|
10553
|
+
return false;
|
|
10554
|
+
}
|
|
10555
|
+
return true;
|
|
10556
|
+
};
|
|
10557
|
+
var higherGT = (a, b, options) => {
|
|
10558
|
+
if (!a) {
|
|
10559
|
+
return b;
|
|
10560
|
+
}
|
|
10561
|
+
const comp = compare(a.semver, b.semver, options);
|
|
10562
|
+
return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
|
|
10563
|
+
};
|
|
10564
|
+
var lowerLT = (a, b, options) => {
|
|
10565
|
+
if (!a) {
|
|
10566
|
+
return b;
|
|
10567
|
+
}
|
|
10568
|
+
const comp = compare(a.semver, b.semver, options);
|
|
10569
|
+
return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
|
|
10570
|
+
};
|
|
10571
|
+
module.exports = subset;
|
|
10572
|
+
});
|
|
10573
|
+
|
|
10574
|
+
// node_modules/semver/index.js
|
|
10575
|
+
var require_semver2 = __commonJS((exports, module) => {
|
|
10576
|
+
var internalRe = require_re();
|
|
10577
|
+
var constants = require_constants();
|
|
10578
|
+
var SemVer = require_semver();
|
|
10579
|
+
var identifiers = require_identifiers();
|
|
10580
|
+
var parse = require_parse();
|
|
10581
|
+
var valid = require_valid();
|
|
10582
|
+
var clean = require_clean();
|
|
10583
|
+
var inc = require_inc();
|
|
10584
|
+
var diff = require_diff();
|
|
10585
|
+
var major = require_major();
|
|
10586
|
+
var minor = require_minor();
|
|
10587
|
+
var patch = require_patch();
|
|
10588
|
+
var prerelease = require_prerelease();
|
|
10589
|
+
var compare = require_compare();
|
|
10590
|
+
var rcompare = require_rcompare();
|
|
10591
|
+
var compareLoose = require_compare_loose();
|
|
10592
|
+
var compareBuild = require_compare_build();
|
|
10593
|
+
var sort = require_sort();
|
|
10594
|
+
var rsort = require_rsort();
|
|
10595
|
+
var gt = require_gt();
|
|
10596
|
+
var lt = require_lt();
|
|
10597
|
+
var eq = require_eq();
|
|
10598
|
+
var neq = require_neq();
|
|
10599
|
+
var gte = require_gte();
|
|
10600
|
+
var lte = require_lte();
|
|
10601
|
+
var cmp = require_cmp();
|
|
10602
|
+
var coerce = require_coerce();
|
|
10603
|
+
var truncate = require_truncate();
|
|
10604
|
+
var Comparator = require_comparator();
|
|
10605
|
+
var Range = require_range();
|
|
10606
|
+
var satisfies = require_satisfies();
|
|
10607
|
+
var toComparators = require_to_comparators();
|
|
10608
|
+
var maxSatisfying = require_max_satisfying();
|
|
10609
|
+
var minSatisfying = require_min_satisfying();
|
|
10610
|
+
var minVersion = require_min_version();
|
|
10611
|
+
var validRange = require_valid2();
|
|
10612
|
+
var outside = require_outside();
|
|
10613
|
+
var gtr = require_gtr();
|
|
10614
|
+
var ltr = require_ltr();
|
|
10615
|
+
var intersects = require_intersects();
|
|
10616
|
+
var simplifyRange = require_simplify();
|
|
10617
|
+
var subset = require_subset();
|
|
10618
|
+
module.exports = {
|
|
10619
|
+
parse,
|
|
10620
|
+
valid,
|
|
10621
|
+
clean,
|
|
10622
|
+
inc,
|
|
10623
|
+
diff,
|
|
10624
|
+
major,
|
|
10625
|
+
minor,
|
|
10626
|
+
patch,
|
|
10627
|
+
prerelease,
|
|
10628
|
+
compare,
|
|
10629
|
+
rcompare,
|
|
10630
|
+
compareLoose,
|
|
10631
|
+
compareBuild,
|
|
10632
|
+
sort,
|
|
10633
|
+
rsort,
|
|
10634
|
+
gt,
|
|
10635
|
+
lt,
|
|
10636
|
+
eq,
|
|
10637
|
+
neq,
|
|
10638
|
+
gte,
|
|
10639
|
+
lte,
|
|
10640
|
+
cmp,
|
|
10641
|
+
coerce,
|
|
10642
|
+
truncate,
|
|
10643
|
+
Comparator,
|
|
10644
|
+
Range,
|
|
10645
|
+
satisfies,
|
|
10646
|
+
toComparators,
|
|
10647
|
+
maxSatisfying,
|
|
10648
|
+
minSatisfying,
|
|
10649
|
+
minVersion,
|
|
10650
|
+
validRange,
|
|
10651
|
+
outside,
|
|
10652
|
+
gtr,
|
|
10653
|
+
ltr,
|
|
10654
|
+
intersects,
|
|
10655
|
+
simplifyRange,
|
|
10656
|
+
subset,
|
|
10657
|
+
SemVer,
|
|
10658
|
+
re: internalRe.re,
|
|
10659
|
+
src: internalRe.src,
|
|
10660
|
+
tokens: internalRe.t,
|
|
10661
|
+
SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
|
|
10662
|
+
RELEASE_TYPES: constants.RELEASE_TYPES,
|
|
10663
|
+
compareIdentifiers: identifiers.compareIdentifiers,
|
|
10664
|
+
rcompareIdentifiers: identifiers.rcompareIdentifiers
|
|
10665
|
+
};
|
|
10666
|
+
});
|
|
10667
|
+
|
|
10668
|
+
// src/version.ts
|
|
10669
|
+
var exports_version = {};
|
|
10670
|
+
__export(exports_version, {
|
|
10671
|
+
upgradeClaudeMulti: () => upgradeClaudeMulti,
|
|
10672
|
+
updateClaudeCode: () => updateClaudeCode,
|
|
10673
|
+
isThirdPartyApiBroken: () => isThirdPartyApiBroken,
|
|
10674
|
+
installPinnedClaude: () => installPinnedClaude,
|
|
10675
|
+
getPinnedBinaryVersion: () => getPinnedBinaryVersion,
|
|
10676
|
+
getLatestVersion: () => getLatestVersion,
|
|
10677
|
+
getLatestClaudeMultiVersion: () => getLatestClaudeMultiVersion,
|
|
10678
|
+
getCurrentVersion: () => getCurrentVersion,
|
|
10679
|
+
getClaudeMultiVersion: () => getClaudeMultiVersion,
|
|
10680
|
+
compareVersions: () => compareVersions,
|
|
10681
|
+
checkForUpdates: () => checkForUpdates,
|
|
10682
|
+
checkForClaudeMultiUpdates: () => checkForClaudeMultiUpdates,
|
|
10683
|
+
COMPATIBLE_CLAUDE_VERSION: () => COMPATIBLE_CLAUDE_VERSION
|
|
10684
|
+
});
|
|
10685
|
+
import { execSync as execSync2 } from "node:child_process";
|
|
10686
|
+
import { existsSync as existsSync4, readFileSync as readFileSync3, writeFileSync as writeFileSync3, mkdirSync as mkdirSync4 } from "node:fs";
|
|
10687
|
+
import { join as join4, dirname as dirname4 } from "node:path";
|
|
10688
|
+
import { fileURLToPath } from "node:url";
|
|
10689
|
+
function getClaudeMultiVersion() {
|
|
10690
|
+
const pkgPath = join4(dirname4(fileURLToPath(import.meta.url)), "..", "package.json");
|
|
10691
|
+
const pkg = JSON.parse(readFileSync3(pkgPath, "utf-8"));
|
|
10692
|
+
if (typeof pkg !== "object" || pkg === null || typeof pkg.version !== "string") {
|
|
10693
|
+
throw new ClaudeMultiError(ErrorCode.CONFIG_CORRUPTED, "Could not read package version");
|
|
10694
|
+
}
|
|
10695
|
+
return pkg.version;
|
|
10696
|
+
}
|
|
10697
|
+
async function getLatestClaudeMultiVersion() {
|
|
10698
|
+
const response = await fetch("https://registry.npmjs.org/claude-multi/latest");
|
|
10699
|
+
const data = await response.json();
|
|
10700
|
+
return data.version;
|
|
10701
|
+
}
|
|
10702
|
+
async function checkForClaudeMultiUpdates() {
|
|
10703
|
+
try {
|
|
10704
|
+
const current = getClaudeMultiVersion();
|
|
10705
|
+
const latest = await getLatestClaudeMultiVersion();
|
|
10706
|
+
return {
|
|
10707
|
+
current,
|
|
10708
|
+
latest,
|
|
10709
|
+
updateAvailable: current !== latest
|
|
10710
|
+
};
|
|
10711
|
+
} catch {
|
|
10712
|
+
return { current: "", latest: "", updateAvailable: false };
|
|
10713
|
+
}
|
|
10714
|
+
}
|
|
10715
|
+
function upgradeClaudeMulti() {
|
|
10716
|
+
const pm = detectPackageManager();
|
|
10717
|
+
const commands = {
|
|
10718
|
+
bun: "bun upgrade -g claude-multi",
|
|
10719
|
+
npm: "npm update -g claude-multi",
|
|
10720
|
+
pnpm: "pnpm update -g claude-multi",
|
|
10721
|
+
deno: "deno install --reload -g npm:claude-multi"
|
|
10722
|
+
};
|
|
10723
|
+
execSync2(commands[pm], { stdio: "inherit" });
|
|
10724
|
+
}
|
|
10725
|
+
function getCurrentVersion() {
|
|
10726
|
+
const pm = detectPackageManager();
|
|
10727
|
+
try {
|
|
10728
|
+
if (pm === "deno")
|
|
10729
|
+
return null;
|
|
10730
|
+
const commands = {
|
|
10731
|
+
bun: "bun pm ls -g --json",
|
|
10732
|
+
npm: "npm ls -g --json @anthropic-ai/claude-code",
|
|
10733
|
+
pnpm: "pnpm ls -g --json"
|
|
10734
|
+
};
|
|
10735
|
+
const output = execSync2(commands[pm], {
|
|
10736
|
+
encoding: "utf-8",
|
|
10737
|
+
stdio: ["pipe", "pipe", "ignore"]
|
|
10738
|
+
});
|
|
10739
|
+
const data = JSON.parse(output);
|
|
10740
|
+
const root = Array.isArray(data) ? data[0] : data;
|
|
10741
|
+
return root?.dependencies?.["@anthropic-ai/claude-code"]?.version ?? null;
|
|
10742
|
+
} catch {
|
|
10743
|
+
return null;
|
|
10744
|
+
}
|
|
10745
|
+
}
|
|
10746
|
+
function isThirdPartyApiBroken(version) {
|
|
10747
|
+
return import_semver.default.gte(version, "2.1.154");
|
|
10748
|
+
}
|
|
10749
|
+
function getPinnedBinaryVersion() {
|
|
10750
|
+
const pkgJsonPath = join4(PINNED_BIN_DIR, "node_modules", "@anthropic-ai", "claude-code", "package.json");
|
|
10751
|
+
try {
|
|
10752
|
+
if (!existsSync4(pkgJsonPath))
|
|
10753
|
+
return null;
|
|
10754
|
+
const pkg = JSON.parse(readFileSync3(pkgJsonPath, "utf-8"));
|
|
10755
|
+
return pkg.version ?? null;
|
|
10756
|
+
} catch {
|
|
10757
|
+
return null;
|
|
10758
|
+
}
|
|
10759
|
+
}
|
|
10760
|
+
function installPinnedClaude() {
|
|
10761
|
+
const pm = detectPackageManager();
|
|
10762
|
+
mkdirSync4(PINNED_BIN_DIR, { recursive: true });
|
|
10763
|
+
const pkgJsonPath = join4(PINNED_BIN_DIR, "package.json");
|
|
10764
|
+
if (!existsSync4(pkgJsonPath)) {
|
|
10765
|
+
writeFileSync3(pkgJsonPath, JSON.stringify({ dependencies: {} }, null, 2));
|
|
10766
|
+
}
|
|
10767
|
+
const pkg = `@anthropic-ai/claude-code@${COMPATIBLE_CLAUDE_VERSION}`;
|
|
10768
|
+
const commands = {
|
|
10769
|
+
bun: `bun add --cwd ${PINNED_BIN_DIR} ${pkg}`,
|
|
10770
|
+
npm: `npm install --prefix ${PINNED_BIN_DIR} ${pkg}`,
|
|
10771
|
+
pnpm: `pnpm add --dir ${PINNED_BIN_DIR} ${pkg}`,
|
|
10772
|
+
deno: `cd ${PINNED_BIN_DIR} && npm install ${pkg}`
|
|
10773
|
+
};
|
|
10774
|
+
try {
|
|
10775
|
+
execSync2(commands[pm], { stdio: "inherit" });
|
|
10776
|
+
} catch (err) {
|
|
10777
|
+
throw new ClaudeMultiError(ErrorCode.UPDATE_FAILED, `Failed to install pinned Claude v${COMPATIBLE_CLAUDE_VERSION}: ${err instanceof Error ? err.message : String(err)}`, { cause: err });
|
|
10778
|
+
}
|
|
10779
|
+
}
|
|
10780
|
+
async function getLatestVersion() {
|
|
10781
|
+
try {
|
|
10782
|
+
const response = await fetch("https://registry.npmjs.org/@anthropic-ai/claude-code/latest");
|
|
10783
|
+
const data = await response.json();
|
|
10784
|
+
return data.version;
|
|
10785
|
+
} catch (err) {
|
|
10786
|
+
throw new ClaudeMultiError(ErrorCode.VERSION_CHECK_FAILED, `Failed to fetch latest version from npm registry: ${err instanceof Error ? err.message : String(err)}`, { cause: err });
|
|
10787
|
+
}
|
|
10788
|
+
}
|
|
10789
|
+
async function checkForUpdates() {
|
|
10790
|
+
const current = getCurrentVersion();
|
|
10791
|
+
const latest = await getLatestVersion();
|
|
10792
|
+
return {
|
|
10793
|
+
current,
|
|
10794
|
+
latest,
|
|
10795
|
+
updateAvailable: current !== null && current !== latest
|
|
10796
|
+
};
|
|
10797
|
+
}
|
|
10798
|
+
function compareVersions(v1, v2) {
|
|
10799
|
+
const parts1 = v1.split(".").map(Number);
|
|
10800
|
+
const parts2 = v2.split(".").map(Number);
|
|
10801
|
+
for (let i = 0;i < Math.max(parts1.length, parts2.length); i++) {
|
|
10802
|
+
const num1 = parts1[i] || 0;
|
|
10803
|
+
const num2 = parts2[i] || 0;
|
|
10804
|
+
if (num1 < num2)
|
|
10805
|
+
return -1;
|
|
10806
|
+
if (num1 > num2)
|
|
10807
|
+
return 1;
|
|
10808
|
+
}
|
|
10809
|
+
return 0;
|
|
10810
|
+
}
|
|
10811
|
+
async function updateClaudeCode() {
|
|
10812
|
+
const pm = detectPackageManager();
|
|
10813
|
+
const commands = {
|
|
10814
|
+
bun: "bun install -g @anthropic-ai/claude-code@latest",
|
|
10815
|
+
npm: "npm install -g @anthropic-ai/claude-code@latest",
|
|
10816
|
+
pnpm: "pnpm add -g @anthropic-ai/claude-code@latest",
|
|
10817
|
+
deno: "deno install --reload -g npm:@anthropic-ai/claude-code@latest"
|
|
10818
|
+
};
|
|
10819
|
+
try {
|
|
10820
|
+
console.log("Updating @anthropic-ai/claude-code...");
|
|
10821
|
+
execSync2(commands[pm], { stdio: "inherit" });
|
|
10822
|
+
console.log("Update completed successfully!");
|
|
10823
|
+
} catch (err) {
|
|
10824
|
+
throw new ClaudeMultiError(ErrorCode.UPDATE_FAILED, `Failed to update @anthropic-ai/claude-code: ${err instanceof Error ? err.message : String(err)}`, { cause: err });
|
|
10825
|
+
}
|
|
10826
|
+
}
|
|
10827
|
+
var import_semver, COMPATIBLE_CLAUDE_VERSION = "2.1.153";
|
|
10828
|
+
var init_version = __esm(() => {
|
|
10829
|
+
init_errors();
|
|
10830
|
+
init_paths();
|
|
10831
|
+
import_semver = __toESM(require_semver2(), 1);
|
|
8777
10832
|
});
|
|
8778
10833
|
|
|
8779
10834
|
// node_modules/react/cjs/react.development.js
|
|
@@ -10195,7 +12250,7 @@ var require_react_reconciler_constants_development = __commonJS((exports) => {
|
|
|
10195
12250
|
});
|
|
10196
12251
|
|
|
10197
12252
|
// node_modules/react-reconciler/constants.js
|
|
10198
|
-
var
|
|
12253
|
+
var require_constants2 = __commonJS((exports, module) => {
|
|
10199
12254
|
if (false) {} else {
|
|
10200
12255
|
module.exports = require_react_reconciler_constants_development();
|
|
10201
12256
|
}
|
|
@@ -25175,7 +27230,7 @@ var init_styles = __esm(async () => {
|
|
|
25175
27230
|
});
|
|
25176
27231
|
|
|
25177
27232
|
// node_modules/ws/lib/constants.js
|
|
25178
|
-
var
|
|
27233
|
+
var require_constants3 = __commonJS((exports, module) => {
|
|
25179
27234
|
var BINARY_TYPES = ["nodebuffer", "arraybuffer", "fragments"];
|
|
25180
27235
|
var hasBlob = typeof Blob !== "undefined";
|
|
25181
27236
|
if (hasBlob)
|
|
@@ -25196,7 +27251,7 @@ var require_constants2 = __commonJS((exports, module) => {
|
|
|
25196
27251
|
|
|
25197
27252
|
// node_modules/ws/lib/buffer-util.js
|
|
25198
27253
|
var require_buffer_util = __commonJS((exports, module) => {
|
|
25199
|
-
var { EMPTY_BUFFER } =
|
|
27254
|
+
var { EMPTY_BUFFER } = require_constants3();
|
|
25200
27255
|
var FastBuffer = Buffer[Symbol.species];
|
|
25201
27256
|
function concat2(list, totalLength) {
|
|
25202
27257
|
if (list.length === 0)
|
|
@@ -25309,7 +27364,7 @@ var require_permessage_deflate = __commonJS((exports, module) => {
|
|
|
25309
27364
|
var zlib = __require("zlib");
|
|
25310
27365
|
var bufferUtil = require_buffer_util();
|
|
25311
27366
|
var Limiter = require_limiter();
|
|
25312
|
-
var { kStatusCode } =
|
|
27367
|
+
var { kStatusCode } = require_constants3();
|
|
25313
27368
|
var FastBuffer = Buffer[Symbol.species];
|
|
25314
27369
|
var TRAILER = Buffer.from([0, 0, 255, 255]);
|
|
25315
27370
|
var kPerMessageDeflate = Symbol("permessage-deflate");
|
|
@@ -25571,7 +27626,7 @@ var require_permessage_deflate = __commonJS((exports, module) => {
|
|
|
25571
27626
|
// node_modules/ws/lib/validation.js
|
|
25572
27627
|
var require_validation = __commonJS((exports, module) => {
|
|
25573
27628
|
var { isUtf8 } = __require("buffer");
|
|
25574
|
-
var { hasBlob } =
|
|
27629
|
+
var { hasBlob } = require_constants3();
|
|
25575
27630
|
var tokenChars = [
|
|
25576
27631
|
0,
|
|
25577
27632
|
0,
|
|
@@ -25764,7 +27819,7 @@ var require_receiver = __commonJS((exports, module) => {
|
|
|
25764
27819
|
EMPTY_BUFFER,
|
|
25765
27820
|
kStatusCode,
|
|
25766
27821
|
kWebSocket
|
|
25767
|
-
} =
|
|
27822
|
+
} = require_constants3();
|
|
25768
27823
|
var { concat: concat2, toArrayBuffer, unmask } = require_buffer_util();
|
|
25769
27824
|
var { isValidStatusCode, isValidUTF8 } = require_validation();
|
|
25770
27825
|
var FastBuffer = Buffer[Symbol.species];
|
|
@@ -26144,7 +28199,7 @@ var require_sender = __commonJS((exports, module) => {
|
|
|
26144
28199
|
types: { isUint8Array }
|
|
26145
28200
|
} = __require("util");
|
|
26146
28201
|
var PerMessageDeflate = require_permessage_deflate();
|
|
26147
|
-
var { EMPTY_BUFFER, kWebSocket, NOOP } =
|
|
28202
|
+
var { EMPTY_BUFFER, kWebSocket, NOOP } = require_constants3();
|
|
26148
28203
|
var { isBlob, isValidStatusCode } = require_validation();
|
|
26149
28204
|
var { mask: applyMask, toBuffer } = require_buffer_util();
|
|
26150
28205
|
var kByteLength = Symbol("kByteLength");
|
|
@@ -26497,7 +28552,7 @@ var require_sender = __commonJS((exports, module) => {
|
|
|
26497
28552
|
|
|
26498
28553
|
// node_modules/ws/lib/event-target.js
|
|
26499
28554
|
var require_event_target = __commonJS((exports, module) => {
|
|
26500
|
-
var { kForOnEventAttribute, kListener } =
|
|
28555
|
+
var { kForOnEventAttribute, kListener } = require_constants3();
|
|
26501
28556
|
var kCode = Symbol("kCode");
|
|
26502
28557
|
var kData = Symbol("kData");
|
|
26503
28558
|
var kError = Symbol("kError");
|
|
@@ -26835,7 +28890,7 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
26835
28890
|
kStatusCode,
|
|
26836
28891
|
kWebSocket,
|
|
26837
28892
|
NOOP
|
|
26838
|
-
} =
|
|
28893
|
+
} = require_constants3();
|
|
26839
28894
|
var {
|
|
26840
28895
|
EventTarget: { addEventListener, removeEventListener }
|
|
26841
28896
|
} = require_event_target();
|
|
@@ -27735,7 +29790,7 @@ var require_websocket_server = __commonJS((exports, module) => {
|
|
|
27735
29790
|
var PerMessageDeflate = require_permessage_deflate();
|
|
27736
29791
|
var subprotocol = require_subprotocol();
|
|
27737
29792
|
var WebSocket = require_websocket();
|
|
27738
|
-
var { CLOSE_TIMEOUT, GUID, kWebSocket } =
|
|
29793
|
+
var { CLOSE_TIMEOUT, GUID, kWebSocket } = require_constants3();
|
|
27739
29794
|
var keyRegex = /^[+/0-9A-Za-z]{22}==$/;
|
|
27740
29795
|
var RUNNING = 0;
|
|
27741
29796
|
var CLOSING = 1;
|
|
@@ -31035,7 +33090,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
31035
33090
|
if (Array.isArray(arr))
|
|
31036
33091
|
return arr;
|
|
31037
33092
|
}
|
|
31038
|
-
var
|
|
33093
|
+
var compareVersions2 = function compareVersions3(v1, v2) {
|
|
31039
33094
|
var n1 = validateAndParse(v1);
|
|
31040
33095
|
var n2 = validateAndParse(v2);
|
|
31041
33096
|
var p1 = n1.pop();
|
|
@@ -31051,11 +33106,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
31051
33106
|
return 0;
|
|
31052
33107
|
};
|
|
31053
33108
|
var validate2 = function validate3(version) {
|
|
31054
|
-
return typeof version === "string" && /^[v\d]/.test(version) &&
|
|
33109
|
+
return typeof version === "string" && /^[v\d]/.test(version) && semver2.test(version);
|
|
31055
33110
|
};
|
|
31056
33111
|
var compare = function compare2(v1, v2, operator) {
|
|
31057
33112
|
assertValidOperator(operator);
|
|
31058
|
-
var res =
|
|
33113
|
+
var res = compareVersions2(v1, v2);
|
|
31059
33114
|
return operatorResMap[operator].includes(res);
|
|
31060
33115
|
};
|
|
31061
33116
|
var satisfies = function satisfies2(version, range2) {
|
|
@@ -31085,12 +33140,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
31085
33140
|
return false;
|
|
31086
33141
|
return true;
|
|
31087
33142
|
};
|
|
31088
|
-
var
|
|
33143
|
+
var semver2 = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i;
|
|
31089
33144
|
var validateAndParse = function validateAndParse2(version) {
|
|
31090
33145
|
if (typeof version !== "string") {
|
|
31091
33146
|
throw new TypeError("Invalid argument expected string");
|
|
31092
33147
|
}
|
|
31093
|
-
var match = version.match(
|
|
33148
|
+
var match = version.match(semver2);
|
|
31094
33149
|
if (!match) {
|
|
31095
33150
|
throw new Error("Invalid argument not valid semver ('".concat(version, "' received)"));
|
|
31096
33151
|
}
|
|
@@ -32964,12 +35019,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
32964
35019
|
function gt2() {
|
|
32965
35020
|
var a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
32966
35021
|
var b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
32967
|
-
return
|
|
35022
|
+
return compareVersions2(a, b) === 1;
|
|
32968
35023
|
}
|
|
32969
35024
|
function gte2() {
|
|
32970
35025
|
var a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
32971
35026
|
var b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
32972
|
-
return
|
|
35027
|
+
return compareVersions2(a, b) > -1;
|
|
32973
35028
|
}
|
|
32974
35029
|
var isReactNativeEnvironment = function isReactNativeEnvironment2() {
|
|
32975
35030
|
return window.document == null;
|
|
@@ -44974,7 +47029,7 @@ var init_reconciler = __esm(async () => {
|
|
|
44974
47029
|
init_styles()
|
|
44975
47030
|
]);
|
|
44976
47031
|
import_react_reconciler = __toESM(require_react_reconciler(), 1);
|
|
44977
|
-
import_constants3 = __toESM(
|
|
47032
|
+
import_constants3 = __toESM(require_constants2(), 1);
|
|
44978
47033
|
Scheduler = __toESM(require_scheduler(), 1);
|
|
44979
47034
|
import_react = __toESM(require_react(), 1);
|
|
44980
47035
|
if (process5.env["DEV"] === "true") {
|
|
@@ -48604,7 +50659,7 @@ var init_ink = __esm(async () => {
|
|
|
48604
50659
|
]);
|
|
48605
50660
|
import_react16 = __toESM(require_react(), 1);
|
|
48606
50661
|
import_signal_exit2 = __toESM(require_signal_exit(), 1);
|
|
48607
|
-
import_constants4 = __toESM(
|
|
50662
|
+
import_constants4 = __toESM(require_constants2(), 1);
|
|
48608
50663
|
textEncoder = new TextEncoder;
|
|
48609
50664
|
});
|
|
48610
50665
|
|
|
@@ -48718,7 +50773,7 @@ var init_render_to_string = __esm(async () => {
|
|
|
48718
50773
|
init_renderer(),
|
|
48719
50774
|
init_dom()
|
|
48720
50775
|
]);
|
|
48721
|
-
import_constants5 = __toESM(
|
|
50776
|
+
import_constants5 = __toESM(require_constants2(), 1);
|
|
48722
50777
|
render_to_string_default = renderToString;
|
|
48723
50778
|
});
|
|
48724
50779
|
|
|
@@ -53696,7 +55751,7 @@ var init_StatusBar = __esm(async () => {
|
|
|
53696
55751
|
});
|
|
53697
55752
|
|
|
53698
55753
|
// src/ink/hooks/useNavigation.tsx
|
|
53699
|
-
function
|
|
55754
|
+
function useNavigation2(onBack) {
|
|
53700
55755
|
const { exit } = use_app_default();
|
|
53701
55756
|
use_input_default((input, key) => {
|
|
53702
55757
|
if (key.escape) {
|
|
@@ -53787,6 +55842,10 @@ function useConfig() {
|
|
|
53787
55842
|
getDefaultBinaryPath,
|
|
53788
55843
|
getAvailableProviders,
|
|
53789
55844
|
getProviderTemplate,
|
|
55845
|
+
providerHasRegions,
|
|
55846
|
+
resolveRegionTemplate,
|
|
55847
|
+
MIMO_TOKEN_REGIONS,
|
|
55848
|
+
getApiKeyPlaceholder,
|
|
53790
55849
|
updateInstanceAutoSync,
|
|
53791
55850
|
syncPluginsAndSkills,
|
|
53792
55851
|
initializeInstanceState,
|
|
@@ -53829,10 +55888,40 @@ var exports_AddInstance = {};
|
|
|
53829
55888
|
__export(exports_AddInstance, {
|
|
53830
55889
|
AddInstance: () => AddInstance
|
|
53831
55890
|
});
|
|
53832
|
-
import { join as
|
|
55891
|
+
import { join as join6 } from "node:path";
|
|
53833
55892
|
import { homedir as homedir3 } from "node:os";
|
|
53834
55893
|
function stepNumber(step) {
|
|
53835
|
-
return
|
|
55894
|
+
return STEP_FLOW.indexOf(step) + 1;
|
|
55895
|
+
}
|
|
55896
|
+
function isStepVisible(step, state) {
|
|
55897
|
+
switch (step) {
|
|
55898
|
+
case "provider-region" /* ProviderRegion */:
|
|
55899
|
+
return !!state.selectedProvider && providerHasRegions(state.selectedProvider);
|
|
55900
|
+
case "provider-apikey" /* ProviderApiKey */:
|
|
55901
|
+
return state.useProvider;
|
|
55902
|
+
case "select-plugins" /* SelectPlugins */:
|
|
55903
|
+
return state.copyOption === CopyOption.SelectPlugins;
|
|
55904
|
+
case "autosync" /* Autosync */:
|
|
55905
|
+
return state.copyOption === CopyOption.All || state.copyOption === CopyOption.SelectPlugins;
|
|
55906
|
+
default:
|
|
55907
|
+
return true;
|
|
55908
|
+
}
|
|
55909
|
+
}
|
|
55910
|
+
function getVisibleSteps(state) {
|
|
55911
|
+
return STEP_FLOW.filter((s) => isStepVisible(s, state));
|
|
55912
|
+
}
|
|
55913
|
+
function getPrevStep(current, state) {
|
|
55914
|
+
const visible = getVisibleSteps(state);
|
|
55915
|
+
const idx = visible.indexOf(current);
|
|
55916
|
+
return idx > 0 ? visible[idx - 1] : null;
|
|
55917
|
+
}
|
|
55918
|
+
function getNextStep(current, state) {
|
|
55919
|
+
const visible = getVisibleSteps(state);
|
|
55920
|
+
const idx = visible.indexOf(current);
|
|
55921
|
+
return idx >= 0 && idx < visible.length - 1 ? visible[idx + 1] : null;
|
|
55922
|
+
}
|
|
55923
|
+
function getVisibleStepCount(state) {
|
|
55924
|
+
return getVisibleSteps(state).filter((s) => s !== "creating" /* Creating */ && s !== "done" /* Done */).length;
|
|
53836
55925
|
}
|
|
53837
55926
|
var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
53838
55927
|
name,
|
|
@@ -53891,47 +55980,56 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
53891
55980
|
}, undefined, true, undefined, this)
|
|
53892
55981
|
]
|
|
53893
55982
|
}, undefined, true, undefined, this);
|
|
53894
|
-
}, STEP_TITLES,
|
|
55983
|
+
}, STEP_TITLES, STEP_FLOW, AddInstance = ({ onBack, initialName }) => {
|
|
53895
55984
|
const { exit } = use_app_default();
|
|
53896
55985
|
const cfg = useConfig();
|
|
53897
|
-
const [step, setStep] = import_react67.useState(initialName ? "provider-select" : "name");
|
|
55986
|
+
const [step, setStep] = import_react67.useState(initialName ? "provider-select" /* ProviderSelect */ : "name" /* Name */);
|
|
53898
55987
|
const [name, setName] = import_react67.useState(initialName ?? "");
|
|
53899
55988
|
const [error, setError] = import_react67.useState("");
|
|
53900
55989
|
const [useProvider, setUseProvider] = import_react67.useState(false);
|
|
53901
55990
|
const [selectedProvider, setSelectedProvider] = import_react67.useState(null);
|
|
55991
|
+
const [selectedRegion, setSelectedRegion] = import_react67.useState(null);
|
|
53902
55992
|
const [apiKey, setApiKey] = import_react67.useState("");
|
|
53903
55993
|
const [autoSync, setAutoSync] = import_react67.useState(false);
|
|
53904
55994
|
const [copyOption, setCopyOption] = import_react67.useState(CopyOption.None);
|
|
53905
55995
|
const [selectedPluginIds, setSelectedPluginIds] = import_react67.useState([]);
|
|
53906
55996
|
const [result2, setResult] = import_react67.useState(null);
|
|
53907
55997
|
const defaultPlugins = import_react67.useMemo(() => cfg.listDefaultPlugins(), [cfg]);
|
|
53908
|
-
|
|
53909
|
-
|
|
53910
|
-
|
|
53911
|
-
|
|
53912
|
-
|
|
53913
|
-
|
|
53914
|
-
|
|
53915
|
-
|
|
53916
|
-
exit();
|
|
53917
|
-
});
|
|
53918
|
-
const goBack = import_react67.useCallback(() => {
|
|
53919
|
-
const prevMap = {
|
|
53920
|
-
"provider-select": "name",
|
|
53921
|
-
"provider-apikey": "provider-select",
|
|
53922
|
-
"paths-confirm": "provider-select",
|
|
53923
|
-
"copy-options": "paths-confirm",
|
|
53924
|
-
"select-plugins": "copy-options",
|
|
53925
|
-
autosync: "copy-options"
|
|
53926
|
-
};
|
|
53927
|
-
const prev = prevMap[step];
|
|
53928
|
-
if (prev) {
|
|
53929
|
-
setStep(prev);
|
|
55998
|
+
const wizardState = import_react67.useMemo(() => ({
|
|
55999
|
+
useProvider,
|
|
56000
|
+
selectedProvider,
|
|
56001
|
+
copyOption
|
|
56002
|
+
}), [useProvider, selectedProvider, copyOption]);
|
|
56003
|
+
const navTo = import_react67.useCallback((target) => {
|
|
56004
|
+
if (target) {
|
|
56005
|
+
setStep(target);
|
|
53930
56006
|
setError("");
|
|
53931
56007
|
} else {
|
|
53932
56008
|
onBack();
|
|
53933
56009
|
}
|
|
53934
|
-
}, [
|
|
56010
|
+
}, [onBack]);
|
|
56011
|
+
const goBack = import_react67.useCallback(() => {
|
|
56012
|
+
navTo(getPrevStep(step, wizardState));
|
|
56013
|
+
}, [step, wizardState, navTo]);
|
|
56014
|
+
const goForward = import_react67.useCallback(() => {
|
|
56015
|
+
const next = getNextStep(step, wizardState);
|
|
56016
|
+
if (next && next !== "creating" /* Creating */ && next !== "done" /* Done */) {
|
|
56017
|
+
navTo(next);
|
|
56018
|
+
}
|
|
56019
|
+
}, [step, wizardState, navTo]);
|
|
56020
|
+
useNavigation2(() => {
|
|
56021
|
+
onBack();
|
|
56022
|
+
});
|
|
56023
|
+
use_input_default((input, key) => {
|
|
56024
|
+
if (input === "q" && step === "done" /* Done */)
|
|
56025
|
+
exit();
|
|
56026
|
+
if (key.shift && key.leftArrow && step !== "creating" /* Creating */ && step !== "done" /* Done */) {
|
|
56027
|
+
goBack();
|
|
56028
|
+
}
|
|
56029
|
+
if (key.shift && key.rightArrow && step !== "creating" /* Creating */ && step !== "done" /* Done */) {
|
|
56030
|
+
goForward();
|
|
56031
|
+
}
|
|
56032
|
+
});
|
|
53935
56033
|
const handleNameSubmit = import_react67.useCallback((value) => {
|
|
53936
56034
|
if (!value.trim()) {
|
|
53937
56035
|
setError("Name is required");
|
|
@@ -53943,18 +56041,22 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
53943
56041
|
}
|
|
53944
56042
|
setError("");
|
|
53945
56043
|
setName(value);
|
|
53946
|
-
setStep("provider-select");
|
|
56044
|
+
setStep("provider-select" /* ProviderSelect */);
|
|
53947
56045
|
}, []);
|
|
53948
56046
|
const handleProviderSelect = import_react67.useCallback((value) => {
|
|
53949
56047
|
if (value === CopyOption.None) {
|
|
53950
56048
|
setUseProvider(false);
|
|
53951
56049
|
setSelectedProvider(null);
|
|
53952
|
-
setStep("paths-confirm");
|
|
56050
|
+
setStep("paths-confirm" /* PathsConfirm */);
|
|
53953
56051
|
return;
|
|
53954
56052
|
}
|
|
53955
56053
|
setUseProvider(true);
|
|
53956
56054
|
setSelectedProvider(value);
|
|
53957
|
-
setStep("provider-apikey");
|
|
56055
|
+
setStep(providerHasRegions(value) ? "provider-region" /* ProviderRegion */ : "provider-apikey" /* ProviderApiKey */);
|
|
56056
|
+
}, []);
|
|
56057
|
+
const handleRegionSelect = import_react67.useCallback((value) => {
|
|
56058
|
+
setSelectedRegion(value);
|
|
56059
|
+
setStep("provider-apikey" /* ProviderApiKey */);
|
|
53958
56060
|
}, []);
|
|
53959
56061
|
const handleApiKeySubmit = import_react67.useCallback((value) => {
|
|
53960
56062
|
if (!value.trim()) {
|
|
@@ -53963,17 +56065,17 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
53963
56065
|
}
|
|
53964
56066
|
setError("");
|
|
53965
56067
|
setApiKey(value);
|
|
53966
|
-
setStep("paths-confirm");
|
|
56068
|
+
setStep("paths-confirm" /* PathsConfirm */);
|
|
53967
56069
|
}, []);
|
|
53968
56070
|
const handleDefaultsConfirm = import_react67.useCallback((_confirmed) => {
|
|
53969
|
-
setStep("copy-options");
|
|
56071
|
+
setStep("copy-options" /* CopyOptions */);
|
|
53970
56072
|
}, []);
|
|
53971
56073
|
const handleCopyOption = import_react67.useCallback((value) => {
|
|
53972
56074
|
setCopyOption(value);
|
|
53973
56075
|
if (value === CopyOption.SelectPlugins) {
|
|
53974
|
-
setStep("select-plugins");
|
|
56076
|
+
setStep("select-plugins" /* SelectPlugins */);
|
|
53975
56077
|
} else if (value === CopyOption.All) {
|
|
53976
|
-
setStep("autosync");
|
|
56078
|
+
setStep("autosync" /* Autosync */);
|
|
53977
56079
|
} else {
|
|
53978
56080
|
doCreate(value, false);
|
|
53979
56081
|
}
|
|
@@ -53985,17 +56087,17 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
53985
56087
|
}
|
|
53986
56088
|
setSelectedPluginIds(ids);
|
|
53987
56089
|
setError("");
|
|
53988
|
-
setStep("autosync");
|
|
56090
|
+
setStep("autosync" /* Autosync */);
|
|
53989
56091
|
}, []);
|
|
53990
56092
|
const handleAutoSyncConfirm = import_react67.useCallback((confirmed) => {
|
|
53991
56093
|
setAutoSync(confirmed);
|
|
53992
56094
|
doCreate(copyOption, confirmed);
|
|
53993
56095
|
}, [copyOption, selectedPluginIds]);
|
|
53994
56096
|
const doCreate = async (copyOpt, sync) => {
|
|
53995
|
-
setStep("creating");
|
|
56097
|
+
setStep("creating" /* Creating */);
|
|
53996
56098
|
setError("");
|
|
53997
56099
|
try {
|
|
53998
|
-
const cDir =
|
|
56100
|
+
const cDir = join6(homedir3(), `.claude-${name}`);
|
|
53999
56101
|
const bPath = cfg.getDefaultBinaryPath(name);
|
|
54000
56102
|
const instance = {
|
|
54001
56103
|
name,
|
|
@@ -54022,17 +56124,20 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54022
56124
|
await cfg.copySettingsFromDefault(cDir);
|
|
54023
56125
|
}
|
|
54024
56126
|
if (useProvider && selectedProvider) {
|
|
54025
|
-
|
|
56127
|
+
let template2 = cfg.getProviderTemplate(selectedProvider);
|
|
56128
|
+
if (template2 && selectedRegion && providerHasRegions(selectedProvider)) {
|
|
56129
|
+
template2 = resolveRegionTemplate(template2, selectedRegion);
|
|
56130
|
+
}
|
|
54026
56131
|
if (template2)
|
|
54027
56132
|
await cfg.mergeProviderEnv(cDir, template2, apiKey);
|
|
54028
56133
|
}
|
|
54029
56134
|
setResult({ configDir: cDir, binaryPath: bPath });
|
|
54030
|
-
setStep("done");
|
|
56135
|
+
setStep("done" /* Done */);
|
|
54031
56136
|
} catch (err) {
|
|
54032
56137
|
await removeInstance(name).catch(() => {});
|
|
54033
56138
|
removeWrapper(cfg.getDefaultBinaryPath(name));
|
|
54034
56139
|
setError(err instanceof Error ? err.message : String(err));
|
|
54035
|
-
setStep("name");
|
|
56140
|
+
setStep("name" /* Name */);
|
|
54036
56141
|
}
|
|
54037
56142
|
};
|
|
54038
56143
|
const hasDefaultConfig = cfg.hasDefaultConfig();
|
|
@@ -54064,14 +56169,14 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54064
56169
|
}, undefined, false, undefined, this),
|
|
54065
56170
|
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(StepIndicator, {
|
|
54066
56171
|
current: stepNumber(step),
|
|
54067
|
-
total:
|
|
56172
|
+
total: getVisibleStepCount(wizardState),
|
|
54068
56173
|
label: STEP_TITLES[step]
|
|
54069
56174
|
}, undefined, false, undefined, this),
|
|
54070
56175
|
error && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(StatusBar, {
|
|
54071
56176
|
message: error,
|
|
54072
56177
|
type: "error"
|
|
54073
56178
|
}, undefined, false, undefined, this),
|
|
54074
|
-
step === "name" && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
56179
|
+
step === "name" /* Name */ && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
54075
56180
|
flexDirection: "column",
|
|
54076
56181
|
gap: 1,
|
|
54077
56182
|
children: [
|
|
@@ -54084,11 +56189,12 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54084
56189
|
}, undefined, false, undefined, this),
|
|
54085
56190
|
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(TextInput, {
|
|
54086
56191
|
placeholder: "my-instance",
|
|
56192
|
+
defaultValue: name,
|
|
54087
56193
|
onSubmit: handleNameSubmit
|
|
54088
56194
|
}, undefined, false, undefined, this)
|
|
54089
56195
|
]
|
|
54090
56196
|
}, undefined, true, undefined, this),
|
|
54091
|
-
step === "provider-select" && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
56197
|
+
step === "provider-select" /* ProviderSelect */ && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
54092
56198
|
flexDirection: "column",
|
|
54093
56199
|
gap: 1,
|
|
54094
56200
|
children: [
|
|
@@ -54098,11 +56204,40 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54098
56204
|
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Select, {
|
|
54099
56205
|
options: providerOptions,
|
|
54100
56206
|
visibleOptionCount: providerOptions.length,
|
|
56207
|
+
defaultValue: selectedProvider ?? undefined,
|
|
54101
56208
|
onChange: handleProviderSelect
|
|
54102
56209
|
}, undefined, false, undefined, this)
|
|
54103
56210
|
]
|
|
54104
56211
|
}, undefined, true, undefined, this),
|
|
54105
|
-
step === "provider-
|
|
56212
|
+
step === "provider-region" /* ProviderRegion */ && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
56213
|
+
flexDirection: "column",
|
|
56214
|
+
gap: 1,
|
|
56215
|
+
children: [
|
|
56216
|
+
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
56217
|
+
children: "Select your subscription region:"
|
|
56218
|
+
}, undefined, false, undefined, this),
|
|
56219
|
+
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
56220
|
+
borderStyle: "round",
|
|
56221
|
+
borderColor: "yellow",
|
|
56222
|
+
paddingX: 1,
|
|
56223
|
+
children: /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
56224
|
+
bold: true,
|
|
56225
|
+
color: "yellow",
|
|
56226
|
+
children: "Check your Xiaomi account console to confirm the correct region for your subscription."
|
|
56227
|
+
}, undefined, false, undefined, this)
|
|
56228
|
+
}, undefined, false, undefined, this),
|
|
56229
|
+
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Select, {
|
|
56230
|
+
options: Object.entries(MIMO_TOKEN_REGIONS).map(([key, val]) => ({
|
|
56231
|
+
label: `${val.label} — ${val.baseUrl}`,
|
|
56232
|
+
value: key
|
|
56233
|
+
})),
|
|
56234
|
+
visibleOptionCount: 3,
|
|
56235
|
+
defaultValue: selectedRegion ?? undefined,
|
|
56236
|
+
onChange: handleRegionSelect
|
|
56237
|
+
}, undefined, false, undefined, this)
|
|
56238
|
+
]
|
|
56239
|
+
}, undefined, true, undefined, this),
|
|
56240
|
+
step === "provider-apikey" /* ProviderApiKey */ && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
54106
56241
|
flexDirection: "column",
|
|
54107
56242
|
gap: 1,
|
|
54108
56243
|
children: [
|
|
@@ -54114,12 +56249,12 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54114
56249
|
]
|
|
54115
56250
|
}, undefined, true, undefined, this),
|
|
54116
56251
|
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(PasswordInput, {
|
|
54117
|
-
placeholder: "sk-...",
|
|
56252
|
+
placeholder: selectedProvider ? getApiKeyPlaceholder(selectedProvider) : "sk-...",
|
|
54118
56253
|
onSubmit: handleApiKeySubmit
|
|
54119
56254
|
}, undefined, false, undefined, this)
|
|
54120
56255
|
]
|
|
54121
56256
|
}, undefined, true, undefined, this),
|
|
54122
|
-
step === "paths-confirm" && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
56257
|
+
step === "paths-confirm" /* PathsConfirm */ && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
54123
56258
|
flexDirection: "column",
|
|
54124
56259
|
gap: 1,
|
|
54125
56260
|
children: [
|
|
@@ -54130,7 +56265,7 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54130
56265
|
dimColor: true,
|
|
54131
56266
|
children: [
|
|
54132
56267
|
"Config: ",
|
|
54133
|
-
|
|
56268
|
+
join6(homedir3(), `.claude-${name}`)
|
|
54134
56269
|
]
|
|
54135
56270
|
}, undefined, true, undefined, this),
|
|
54136
56271
|
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
@@ -54146,7 +56281,7 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54146
56281
|
}, undefined, false, undefined, this)
|
|
54147
56282
|
]
|
|
54148
56283
|
}, undefined, true, undefined, this),
|
|
54149
|
-
step === "copy-options" && !hasDefaultConfig && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
56284
|
+
step === "copy-options" /* CopyOptions */ && !hasDefaultConfig && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
54150
56285
|
flexDirection: "column",
|
|
54151
56286
|
gap: 1,
|
|
54152
56287
|
children: [
|
|
@@ -54160,7 +56295,7 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54160
56295
|
}, undefined, false, undefined, this)
|
|
54161
56296
|
]
|
|
54162
56297
|
}, undefined, true, undefined, this),
|
|
54163
|
-
step === "copy-options" && hasDefaultConfig && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
56298
|
+
step === "copy-options" /* CopyOptions */ && hasDefaultConfig && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
54164
56299
|
flexDirection: "column",
|
|
54165
56300
|
gap: 1,
|
|
54166
56301
|
children: [
|
|
@@ -54177,7 +56312,7 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54177
56312
|
}, undefined, false, undefined, this)
|
|
54178
56313
|
]
|
|
54179
56314
|
}, undefined, true, undefined, this),
|
|
54180
|
-
step === "select-plugins" && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
56315
|
+
step === "select-plugins" /* SelectPlugins */ && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
54181
56316
|
flexDirection: "column",
|
|
54182
56317
|
gap: 1,
|
|
54183
56318
|
children: [
|
|
@@ -54198,7 +56333,7 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54198
56333
|
}, undefined, false, undefined, this)
|
|
54199
56334
|
]
|
|
54200
56335
|
}, undefined, true, undefined, this),
|
|
54201
|
-
step === "autosync" && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
56336
|
+
step === "autosync" /* Autosync */ && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
54202
56337
|
flexDirection: "column",
|
|
54203
56338
|
gap: 1,
|
|
54204
56339
|
children: [
|
|
@@ -54215,11 +56350,11 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54215
56350
|
}, undefined, false, undefined, this)
|
|
54216
56351
|
]
|
|
54217
56352
|
}, undefined, true, undefined, this),
|
|
54218
|
-
step === "creating" && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
56353
|
+
step === "creating" /* Creating */ && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
54219
56354
|
dimColor: true,
|
|
54220
56355
|
children: "Creating instance..."
|
|
54221
56356
|
}, undefined, false, undefined, this),
|
|
54222
|
-
step === "done" && result2 && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(AddResult, {
|
|
56357
|
+
step === "done" /* Done */ && result2 && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(AddResult, {
|
|
54223
56358
|
name,
|
|
54224
56359
|
binaryPath: result2.binaryPath,
|
|
54225
56360
|
configDir: result2.configDir
|
|
@@ -54228,7 +56363,7 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54228
56363
|
marginTop: 1,
|
|
54229
56364
|
children: /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
54230
56365
|
dimColor: true,
|
|
54231
|
-
children: "ESC back │ q quit"
|
|
56366
|
+
children: "Shift+← back │ Shift+→ next │ ESC back │ q quit"
|
|
54232
56367
|
}, undefined, false, undefined, this)
|
|
54233
56368
|
}, undefined, false, undefined, this)
|
|
54234
56369
|
]
|
|
@@ -54240,6 +56375,7 @@ var init_AddInstance = __esm(async () => {
|
|
|
54240
56375
|
init_wrapper();
|
|
54241
56376
|
init_useAnimations();
|
|
54242
56377
|
init_constants();
|
|
56378
|
+
init_templates();
|
|
54243
56379
|
await __promiseAll([
|
|
54244
56380
|
init_build2(),
|
|
54245
56381
|
init_build3(),
|
|
@@ -54251,174 +56387,45 @@ var init_AddInstance = __esm(async () => {
|
|
|
54251
56387
|
import_react67 = __toESM(require_react(), 1);
|
|
54252
56388
|
jsx_dev_runtime4 = __toESM(require_jsx_dev_runtime(), 1);
|
|
54253
56389
|
STEP_TITLES = {
|
|
54254
|
-
name: "Instance Name",
|
|
54255
|
-
"provider-select": "Provider Template",
|
|
54256
|
-
"provider-
|
|
54257
|
-
"
|
|
54258
|
-
"
|
|
54259
|
-
"
|
|
54260
|
-
|
|
54261
|
-
|
|
54262
|
-
|
|
54263
|
-
|
|
54264
|
-
|
|
54265
|
-
|
|
54266
|
-
"
|
|
54267
|
-
"provider-
|
|
54268
|
-
"
|
|
54269
|
-
"
|
|
54270
|
-
"
|
|
54271
|
-
"
|
|
54272
|
-
"
|
|
54273
|
-
"
|
|
56390
|
+
["name" /* Name */]: "Instance Name",
|
|
56391
|
+
["provider-select" /* ProviderSelect */]: "Provider Template",
|
|
56392
|
+
["provider-region" /* ProviderRegion */]: "Region",
|
|
56393
|
+
["provider-apikey" /* ProviderApiKey */]: "API Key",
|
|
56394
|
+
["paths-confirm" /* PathsConfirm */]: "Paths",
|
|
56395
|
+
["copy-options" /* CopyOptions */]: "Copy Options",
|
|
56396
|
+
["select-plugins" /* SelectPlugins */]: "Select Plugins",
|
|
56397
|
+
["autosync" /* Autosync */]: "Auto-Sync",
|
|
56398
|
+
["creating" /* Creating */]: "Creating...",
|
|
56399
|
+
["done" /* Done */]: "Complete"
|
|
56400
|
+
};
|
|
56401
|
+
STEP_FLOW = [
|
|
56402
|
+
"name" /* Name */,
|
|
56403
|
+
"provider-select" /* ProviderSelect */,
|
|
56404
|
+
"provider-region" /* ProviderRegion */,
|
|
56405
|
+
"provider-apikey" /* ProviderApiKey */,
|
|
56406
|
+
"paths-confirm" /* PathsConfirm */,
|
|
56407
|
+
"copy-options" /* CopyOptions */,
|
|
56408
|
+
"select-plugins" /* SelectPlugins */,
|
|
56409
|
+
"autosync" /* Autosync */,
|
|
56410
|
+
"creating" /* Creating */,
|
|
56411
|
+
"done" /* Done */
|
|
54274
56412
|
];
|
|
54275
56413
|
});
|
|
54276
56414
|
|
|
54277
|
-
// src/ink/components/Footer.tsx
|
|
54278
|
-
var jsx_dev_runtime5, Footer = ({ showHealthHint }) => {
|
|
54279
|
-
const lineLen = 60;
|
|
54280
|
-
const lineProgress = useDrawLine(lineLen, 0, 4);
|
|
54281
|
-
const showHints = useFadeIn(100);
|
|
54282
|
-
return /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
54283
|
-
flexDirection: "column",
|
|
54284
|
-
width: "100",
|
|
54285
|
-
marginTop: 1,
|
|
54286
|
-
children: [
|
|
54287
|
-
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
54288
|
-
dimColor: true,
|
|
54289
|
-
children: "─".repeat(lineProgress)
|
|
54290
|
-
}, undefined, false, undefined, this),
|
|
54291
|
-
showHints && /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
54292
|
-
gap: 2,
|
|
54293
|
-
children: [
|
|
54294
|
-
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
54295
|
-
children: [
|
|
54296
|
-
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
54297
|
-
color: "gray",
|
|
54298
|
-
children: "↑↓"
|
|
54299
|
-
}, undefined, false, undefined, this),
|
|
54300
|
-
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
54301
|
-
dimColor: true,
|
|
54302
|
-
children: " navigate"
|
|
54303
|
-
}, undefined, false, undefined, this)
|
|
54304
|
-
]
|
|
54305
|
-
}, undefined, true, undefined, this),
|
|
54306
|
-
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
54307
|
-
children: [
|
|
54308
|
-
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
54309
|
-
color: "gray",
|
|
54310
|
-
children: "↵"
|
|
54311
|
-
}, undefined, false, undefined, this),
|
|
54312
|
-
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
54313
|
-
dimColor: true,
|
|
54314
|
-
children: " select"
|
|
54315
|
-
}, undefined, false, undefined, this)
|
|
54316
|
-
]
|
|
54317
|
-
}, undefined, true, undefined, this),
|
|
54318
|
-
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
54319
|
-
children: [
|
|
54320
|
-
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
54321
|
-
color: "gray",
|
|
54322
|
-
children: "esc"
|
|
54323
|
-
}, undefined, false, undefined, this),
|
|
54324
|
-
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
54325
|
-
dimColor: true,
|
|
54326
|
-
children: " back"
|
|
54327
|
-
}, undefined, false, undefined, this)
|
|
54328
|
-
]
|
|
54329
|
-
}, undefined, true, undefined, this),
|
|
54330
|
-
showHealthHint && /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
54331
|
-
children: [
|
|
54332
|
-
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
54333
|
-
color: "gray",
|
|
54334
|
-
children: "!"
|
|
54335
|
-
}, undefined, false, undefined, this),
|
|
54336
|
-
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
54337
|
-
dimColor: true,
|
|
54338
|
-
children: " health"
|
|
54339
|
-
}, undefined, false, undefined, this)
|
|
54340
|
-
]
|
|
54341
|
-
}, undefined, true, undefined, this),
|
|
54342
|
-
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
54343
|
-
children: [
|
|
54344
|
-
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
54345
|
-
color: "gray",
|
|
54346
|
-
children: "q"
|
|
54347
|
-
}, undefined, false, undefined, this),
|
|
54348
|
-
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
54349
|
-
dimColor: true,
|
|
54350
|
-
children: " quit"
|
|
54351
|
-
}, undefined, false, undefined, this)
|
|
54352
|
-
]
|
|
54353
|
-
}, undefined, true, undefined, this)
|
|
54354
|
-
]
|
|
54355
|
-
}, undefined, true, undefined, this)
|
|
54356
|
-
]
|
|
54357
|
-
}, undefined, true, undefined, this);
|
|
54358
|
-
};
|
|
54359
|
-
var init_Footer = __esm(async () => {
|
|
54360
|
-
init_useAnimations();
|
|
54361
|
-
await init_build2();
|
|
54362
|
-
jsx_dev_runtime5 = __toESM(require_jsx_dev_runtime(), 1);
|
|
54363
|
-
});
|
|
54364
|
-
|
|
54365
|
-
// src/ink/components/WarningBanner.tsx
|
|
54366
|
-
var jsx_dev_runtime6, WarningBanner = ({
|
|
54367
|
-
issueCount,
|
|
54368
|
-
errorCount,
|
|
54369
|
-
warningCount
|
|
54370
|
-
}) => {
|
|
54371
|
-
const visible = useFadeIn(200);
|
|
54372
|
-
const icon = usePulse(["⚠", "⚠", " "], 1000);
|
|
54373
|
-
if (!visible || issueCount === 0)
|
|
54374
|
-
return null;
|
|
54375
|
-
const parts = [];
|
|
54376
|
-
if (errorCount > 0)
|
|
54377
|
-
parts.push(`${errorCount} error${errorCount > 1 ? "s" : ""}`);
|
|
54378
|
-
if (warningCount > 0)
|
|
54379
|
-
parts.push(`${warningCount} warning${warningCount > 1 ? "s" : ""}`);
|
|
54380
|
-
return /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Box_default, {
|
|
54381
|
-
marginBottom: 1,
|
|
54382
|
-
children: [
|
|
54383
|
-
/* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
|
|
54384
|
-
color: "yellow",
|
|
54385
|
-
children: [
|
|
54386
|
-
icon,
|
|
54387
|
-
" "
|
|
54388
|
-
]
|
|
54389
|
-
}, undefined, true, undefined, this),
|
|
54390
|
-
/* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
|
|
54391
|
-
color: "yellow",
|
|
54392
|
-
bold: true,
|
|
54393
|
-
children: parts.join(", ")
|
|
54394
|
-
}, undefined, false, undefined, this),
|
|
54395
|
-
/* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
|
|
54396
|
-
color: "yellow",
|
|
54397
|
-
children: " — press "
|
|
54398
|
-
}, undefined, false, undefined, this),
|
|
54399
|
-
/* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
|
|
54400
|
-
color: "yellow",
|
|
54401
|
-
bold: true,
|
|
54402
|
-
children: "!"
|
|
54403
|
-
}, undefined, false, undefined, this),
|
|
54404
|
-
/* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
|
|
54405
|
-
color: "yellow",
|
|
54406
|
-
children: " to review"
|
|
54407
|
-
}, undefined, false, undefined, this)
|
|
54408
|
-
]
|
|
54409
|
-
}, undefined, true, undefined, this);
|
|
54410
|
-
};
|
|
54411
|
-
var init_WarningBanner = __esm(async () => {
|
|
54412
|
-
init_useAnimations();
|
|
54413
|
-
await init_build2();
|
|
54414
|
-
jsx_dev_runtime6 = __toESM(require_jsx_dev_runtime(), 1);
|
|
54415
|
-
});
|
|
54416
|
-
|
|
54417
56415
|
// src/health.ts
|
|
54418
|
-
|
|
54419
|
-
|
|
56416
|
+
var exports_health = {};
|
|
56417
|
+
__export(exports_health, {
|
|
56418
|
+
saveHealthStatus: () => saveHealthStatus,
|
|
56419
|
+
runHealthChecks: () => runHealthChecks,
|
|
56420
|
+
loadHealthStatus: () => loadHealthStatus,
|
|
56421
|
+
fixWrapperVersions: () => fixWrapperVersions,
|
|
56422
|
+
dismissIssue: () => dismissIssue,
|
|
56423
|
+
dismissAllIssues: () => dismissAllIssues
|
|
56424
|
+
});
|
|
56425
|
+
import { existsSync as existsSync6, readFileSync as readFileSync5, writeFileSync as writeFileSync4, mkdirSync as mkdirSync5 } from "node:fs";
|
|
56426
|
+
import { join as join7 } from "node:path";
|
|
54420
56427
|
function getHealthFile() {
|
|
54421
|
-
return
|
|
56428
|
+
return join7(getBaseDir(), ".claude-multi", "health-status.json");
|
|
54422
56429
|
}
|
|
54423
56430
|
function runHealthChecks(instances2, migrationStatus) {
|
|
54424
56431
|
const now2 = new Date().toISOString();
|
|
@@ -54439,7 +56446,7 @@ function runHealthChecks(instances2, migrationStatus) {
|
|
|
54439
56446
|
});
|
|
54440
56447
|
}
|
|
54441
56448
|
for (const inst of instances2) {
|
|
54442
|
-
if (!
|
|
56449
|
+
if (!existsSync6(inst.configDir)) {
|
|
54443
56450
|
issues.push({
|
|
54444
56451
|
id: `configdir-missing-${inst.name}`,
|
|
54445
56452
|
severity: "error",
|
|
@@ -54455,7 +56462,7 @@ function runHealthChecks(instances2, migrationStatus) {
|
|
|
54455
56462
|
});
|
|
54456
56463
|
continue;
|
|
54457
56464
|
}
|
|
54458
|
-
if (!
|
|
56465
|
+
if (!existsSync6(inst.binaryPath)) {
|
|
54459
56466
|
issues.push({
|
|
54460
56467
|
id: `binary-missing-${inst.name}`,
|
|
54461
56468
|
severity: "warning",
|
|
@@ -54470,8 +56477,8 @@ function runHealthChecks(instances2, migrationStatus) {
|
|
|
54470
56477
|
resolutionHint: "Re-create the instance or run 'claude-multi sync'"
|
|
54471
56478
|
});
|
|
54472
56479
|
}
|
|
54473
|
-
const settingsFile =
|
|
54474
|
-
if (
|
|
56480
|
+
const settingsFile = join7(inst.configDir, "settings.json");
|
|
56481
|
+
if (existsSync6(settingsFile)) {
|
|
54475
56482
|
try {
|
|
54476
56483
|
JSON.parse(readFileSync5(settingsFile, "utf-8"));
|
|
54477
56484
|
} catch {
|
|
@@ -54506,12 +56513,36 @@ function runHealthChecks(instances2, migrationStatus) {
|
|
|
54506
56513
|
resolutionHint: "Re-sync symlinks from the home screen"
|
|
54507
56514
|
});
|
|
54508
56515
|
}
|
|
56516
|
+
if (existsSync6(inst.binaryPath) && existsSync6(PINNED_CLAUDE_BIN)) {
|
|
56517
|
+
try {
|
|
56518
|
+
const wrapperContent = readFileSync5(inst.binaryPath, "utf-8");
|
|
56519
|
+
const shellMatch = wrapperContent.match(/exec\s+"([^"]+)"/);
|
|
56520
|
+
const nodeMatch = wrapperContent.match(/spawn\("([^"]+)"/);
|
|
56521
|
+
const currentBin = shellMatch?.[1] ?? nodeMatch?.[1];
|
|
56522
|
+
if (currentBin && currentBin !== PINNED_CLAUDE_BIN) {
|
|
56523
|
+
issues.push({
|
|
56524
|
+
id: `wrong-claude-version-${inst.name}`,
|
|
56525
|
+
severity: "error",
|
|
56526
|
+
category: "version",
|
|
56527
|
+
title: "Wrong Claude binary",
|
|
56528
|
+
message: `Instance '${inst.name}' uses a Claude version that may break 3rd-party providers`,
|
|
56529
|
+
detail: `Current: ${currentBin}
|
|
56530
|
+
Expected: ${PINNED_CLAUDE_BIN}`,
|
|
56531
|
+
instanceName: inst.name,
|
|
56532
|
+
timestamp: now2,
|
|
56533
|
+
dismissed: false,
|
|
56534
|
+
resolved: false,
|
|
56535
|
+
resolutionHint: "Run 'claude-multi doctor fix' or press ! from the home screen"
|
|
56536
|
+
});
|
|
56537
|
+
}
|
|
56538
|
+
} catch {}
|
|
56539
|
+
}
|
|
54509
56540
|
}
|
|
54510
56541
|
return issues;
|
|
54511
56542
|
}
|
|
54512
56543
|
function loadHealthStatus() {
|
|
54513
56544
|
const healthFile = getHealthFile();
|
|
54514
|
-
if (!
|
|
56545
|
+
if (!existsSync6(healthFile)) {
|
|
54515
56546
|
return { lastChecked: "", issues: [] };
|
|
54516
56547
|
}
|
|
54517
56548
|
try {
|
|
@@ -54521,10 +56552,10 @@ function loadHealthStatus() {
|
|
|
54521
56552
|
}
|
|
54522
56553
|
}
|
|
54523
56554
|
function saveHealthStatus(status) {
|
|
54524
|
-
const dir =
|
|
54525
|
-
if (!
|
|
54526
|
-
|
|
54527
|
-
|
|
56555
|
+
const dir = join7(getBaseDir(), ".claude-multi");
|
|
56556
|
+
if (!existsSync6(dir))
|
|
56557
|
+
mkdirSync5(dir, { recursive: true });
|
|
56558
|
+
writeFileSync4(getHealthFile(), JSON.stringify(status, null, 2), "utf-8");
|
|
54528
56559
|
}
|
|
54529
56560
|
function dismissIssue(id) {
|
|
54530
56561
|
const status = loadHealthStatus();
|
|
@@ -54541,12 +56572,197 @@ function dismissAllIssues() {
|
|
|
54541
56572
|
}
|
|
54542
56573
|
saveHealthStatus(status);
|
|
54543
56574
|
}
|
|
56575
|
+
function fixWrapperVersions(instances2) {
|
|
56576
|
+
if (!existsSync6(PINNED_CLAUDE_BIN))
|
|
56577
|
+
return [];
|
|
56578
|
+
const fixed = [];
|
|
56579
|
+
for (const inst of instances2) {
|
|
56580
|
+
if (!existsSync6(inst.binaryPath))
|
|
56581
|
+
continue;
|
|
56582
|
+
try {
|
|
56583
|
+
const content = readFileSync5(inst.binaryPath, "utf-8");
|
|
56584
|
+
const shellMatch = content.match(/exec\s+"([^"]+)"/);
|
|
56585
|
+
const nodeMatch = content.match(/spawn\("([^"]+)"/);
|
|
56586
|
+
const currentBin = shellMatch?.[1] ?? nodeMatch?.[1];
|
|
56587
|
+
if (!currentBin || currentBin === PINNED_CLAUDE_BIN)
|
|
56588
|
+
continue;
|
|
56589
|
+
const newContent = `#!/bin/sh
|
|
56590
|
+
# Claude Multi - Wrapper for ${inst.name}
|
|
56591
|
+
# Generated by claude-multi
|
|
56592
|
+
export CLAUDE_CONFIG_DIR="${inst.configDir}"
|
|
56593
|
+
exec "${PINNED_CLAUDE_BIN}" "$@"
|
|
56594
|
+
`;
|
|
56595
|
+
writeFileSync4(inst.binaryPath, newContent, { mode: 493 });
|
|
56596
|
+
fixed.push(inst.name);
|
|
56597
|
+
} catch {}
|
|
56598
|
+
}
|
|
56599
|
+
return fixed;
|
|
56600
|
+
}
|
|
54544
56601
|
var init_health = __esm(() => {
|
|
54545
56602
|
init_config();
|
|
54546
56603
|
init_paths();
|
|
54547
56604
|
init_constants();
|
|
54548
56605
|
});
|
|
54549
56606
|
|
|
56607
|
+
// src/ink/components/Footer.tsx
|
|
56608
|
+
var jsx_dev_runtime5, Footer = ({ showHealthHint }) => {
|
|
56609
|
+
const lineLen = 60;
|
|
56610
|
+
const lineProgress = useDrawLine(lineLen, 0, 4);
|
|
56611
|
+
const showHints = useFadeIn(100);
|
|
56612
|
+
return /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
56613
|
+
flexDirection: "column",
|
|
56614
|
+
width: "100",
|
|
56615
|
+
marginTop: 1,
|
|
56616
|
+
children: [
|
|
56617
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
56618
|
+
dimColor: true,
|
|
56619
|
+
children: "─".repeat(lineProgress)
|
|
56620
|
+
}, undefined, false, undefined, this),
|
|
56621
|
+
showHints && /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
56622
|
+
gap: 2,
|
|
56623
|
+
children: [
|
|
56624
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
56625
|
+
children: [
|
|
56626
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
56627
|
+
color: "gray",
|
|
56628
|
+
children: "↑↓"
|
|
56629
|
+
}, undefined, false, undefined, this),
|
|
56630
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
56631
|
+
dimColor: true,
|
|
56632
|
+
children: " navigate"
|
|
56633
|
+
}, undefined, false, undefined, this)
|
|
56634
|
+
]
|
|
56635
|
+
}, undefined, true, undefined, this),
|
|
56636
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
56637
|
+
children: [
|
|
56638
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
56639
|
+
color: "gray",
|
|
56640
|
+
children: "↵"
|
|
56641
|
+
}, undefined, false, undefined, this),
|
|
56642
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
56643
|
+
dimColor: true,
|
|
56644
|
+
children: " select"
|
|
56645
|
+
}, undefined, false, undefined, this)
|
|
56646
|
+
]
|
|
56647
|
+
}, undefined, true, undefined, this),
|
|
56648
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
56649
|
+
children: [
|
|
56650
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
56651
|
+
color: "gray",
|
|
56652
|
+
children: "esc"
|
|
56653
|
+
}, undefined, false, undefined, this),
|
|
56654
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
56655
|
+
dimColor: true,
|
|
56656
|
+
children: " back"
|
|
56657
|
+
}, undefined, false, undefined, this)
|
|
56658
|
+
]
|
|
56659
|
+
}, undefined, true, undefined, this),
|
|
56660
|
+
showHealthHint && /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
56661
|
+
children: [
|
|
56662
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
56663
|
+
color: "gray",
|
|
56664
|
+
children: "!"
|
|
56665
|
+
}, undefined, false, undefined, this),
|
|
56666
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
56667
|
+
dimColor: true,
|
|
56668
|
+
children: " health"
|
|
56669
|
+
}, undefined, false, undefined, this)
|
|
56670
|
+
]
|
|
56671
|
+
}, undefined, true, undefined, this),
|
|
56672
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
56673
|
+
children: [
|
|
56674
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
56675
|
+
color: "gray",
|
|
56676
|
+
children: "q"
|
|
56677
|
+
}, undefined, false, undefined, this),
|
|
56678
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
56679
|
+
dimColor: true,
|
|
56680
|
+
children: " quit"
|
|
56681
|
+
}, undefined, false, undefined, this)
|
|
56682
|
+
]
|
|
56683
|
+
}, undefined, true, undefined, this)
|
|
56684
|
+
]
|
|
56685
|
+
}, undefined, true, undefined, this)
|
|
56686
|
+
]
|
|
56687
|
+
}, undefined, true, undefined, this);
|
|
56688
|
+
};
|
|
56689
|
+
var init_Footer = __esm(async () => {
|
|
56690
|
+
init_useAnimations();
|
|
56691
|
+
await init_build2();
|
|
56692
|
+
jsx_dev_runtime5 = __toESM(require_jsx_dev_runtime(), 1);
|
|
56693
|
+
});
|
|
56694
|
+
|
|
56695
|
+
// src/ink/components/WarningBanner.tsx
|
|
56696
|
+
var jsx_dev_runtime6, WarningBanner = ({
|
|
56697
|
+
issueCount,
|
|
56698
|
+
errorCount,
|
|
56699
|
+
warningCount,
|
|
56700
|
+
hasVersionIssues = false
|
|
56701
|
+
}) => {
|
|
56702
|
+
const visible = useFadeIn(200);
|
|
56703
|
+
const icon = usePulse(["⚠", "⚠", " "], 1000);
|
|
56704
|
+
if (!visible || issueCount === 0)
|
|
56705
|
+
return null;
|
|
56706
|
+
const parts = [];
|
|
56707
|
+
if (errorCount > 0)
|
|
56708
|
+
parts.push(`${errorCount} error${errorCount > 1 ? "s" : ""}`);
|
|
56709
|
+
if (warningCount > 0)
|
|
56710
|
+
parts.push(`${warningCount} warning${warningCount > 1 ? "s" : ""}`);
|
|
56711
|
+
return /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Box_default, {
|
|
56712
|
+
flexDirection: "column",
|
|
56713
|
+
marginBottom: 1,
|
|
56714
|
+
children: [
|
|
56715
|
+
/* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Box_default, {
|
|
56716
|
+
children: [
|
|
56717
|
+
/* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
|
|
56718
|
+
color: "yellow",
|
|
56719
|
+
children: [
|
|
56720
|
+
icon,
|
|
56721
|
+
" "
|
|
56722
|
+
]
|
|
56723
|
+
}, undefined, true, undefined, this),
|
|
56724
|
+
/* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
|
|
56725
|
+
color: "yellow",
|
|
56726
|
+
bold: true,
|
|
56727
|
+
children: parts.join(", ")
|
|
56728
|
+
}, undefined, false, undefined, this),
|
|
56729
|
+
/* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
|
|
56730
|
+
color: "yellow",
|
|
56731
|
+
children: " — press "
|
|
56732
|
+
}, undefined, false, undefined, this),
|
|
56733
|
+
/* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
|
|
56734
|
+
color: "yellow",
|
|
56735
|
+
bold: true,
|
|
56736
|
+
children: "!"
|
|
56737
|
+
}, undefined, false, undefined, this),
|
|
56738
|
+
/* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
|
|
56739
|
+
color: "yellow",
|
|
56740
|
+
children: " to review"
|
|
56741
|
+
}, undefined, false, undefined, this)
|
|
56742
|
+
]
|
|
56743
|
+
}, undefined, true, undefined, this),
|
|
56744
|
+
hasVersionIssues && /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Box_default, {
|
|
56745
|
+
children: [
|
|
56746
|
+
/* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
|
|
56747
|
+
color: "red",
|
|
56748
|
+
children: " ⚠ Some instances use a Claude version incompatible with 3rd-party APIs. "
|
|
56749
|
+
}, undefined, false, undefined, this),
|
|
56750
|
+
/* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
|
|
56751
|
+
color: "red",
|
|
56752
|
+
bold: true,
|
|
56753
|
+
children: "Press ! to auto-fix."
|
|
56754
|
+
}, undefined, false, undefined, this)
|
|
56755
|
+
]
|
|
56756
|
+
}, undefined, true, undefined, this)
|
|
56757
|
+
]
|
|
56758
|
+
}, undefined, true, undefined, this);
|
|
56759
|
+
};
|
|
56760
|
+
var init_WarningBanner = __esm(async () => {
|
|
56761
|
+
init_useAnimations();
|
|
56762
|
+
await init_build2();
|
|
56763
|
+
jsx_dev_runtime6 = __toESM(require_jsx_dev_runtime(), 1);
|
|
56764
|
+
});
|
|
56765
|
+
|
|
54550
56766
|
// src/ink/hooks/useHealthCheck.ts
|
|
54551
56767
|
function useHealthCheck(instances2, migrationStatus) {
|
|
54552
56768
|
const [issues, setIssues] = import_react68.useState([]);
|
|
@@ -54679,7 +56895,7 @@ var init_InstanceCard = __esm(async () => {
|
|
|
54679
56895
|
var import_react69, jsx_dev_runtime8, ListInstances = ({ onBack }) => {
|
|
54680
56896
|
const [instances2, setInstances] = import_react69.useState([]);
|
|
54681
56897
|
const [loading, setLoading] = import_react69.useState(true);
|
|
54682
|
-
|
|
56898
|
+
useNavigation2(onBack);
|
|
54683
56899
|
import_react69.useEffect(() => {
|
|
54684
56900
|
listInstances().then((insts) => {
|
|
54685
56901
|
setInstances(insts);
|
|
@@ -54833,7 +57049,7 @@ var import_react70, jsx_dev_runtime10, DetailRow = ({
|
|
|
54833
57049
|
const [mcpCount, setMcpCount] = import_react70.useState(null);
|
|
54834
57050
|
const [mcpPluginCount, setMcpPluginCount] = import_react70.useState(null);
|
|
54835
57051
|
const [mcpCustomCount, setMcpCustomCount] = import_react70.useState(null);
|
|
54836
|
-
|
|
57052
|
+
useNavigation2(() => {
|
|
54837
57053
|
if (step === "info") {
|
|
54838
57054
|
setStep("select");
|
|
54839
57055
|
setSelected(null);
|
|
@@ -55077,7 +57293,7 @@ var import_react71, jsx_dev_runtime11, RemoveConfirm = ({ selected, onConfirm, o
|
|
|
55077
57293
|
const [selected, setSelected] = import_react71.useState(null);
|
|
55078
57294
|
const [error, setError] = import_react71.useState("");
|
|
55079
57295
|
const [removedConfig, setRemovedConfig] = import_react71.useState("");
|
|
55080
|
-
|
|
57296
|
+
useNavigation2(() => {
|
|
55081
57297
|
if (step === "confirm") {
|
|
55082
57298
|
setStep("select");
|
|
55083
57299
|
setSelected(null);
|
|
@@ -55284,7 +57500,7 @@ var import_react73, jsx_dev_runtime12, ToggleActionValue, ToggleAction = ({ sele
|
|
|
55284
57500
|
const [selected, setSelected] = import_react73.useState(null);
|
|
55285
57501
|
const { error, setError } = useMessage();
|
|
55286
57502
|
const [newStatus, setNewStatus] = import_react73.useState(false);
|
|
55287
|
-
|
|
57503
|
+
useNavigation2(() => {
|
|
55288
57504
|
if (step === "action") {
|
|
55289
57505
|
setStep("select");
|
|
55290
57506
|
setSelected(null);
|
|
@@ -55483,7 +57699,7 @@ var import_react74, jsx_dev_runtime13, PluginSuccess = ({ message }) => {
|
|
|
55483
57699
|
const plugins = action === PluginAction.Enable ? instancePlugins.filter((p) => !p.enabled) : action === PluginAction.Disable ? instancePlugins.filter((p) => p.enabled) : instancePlugins;
|
|
55484
57700
|
return plugins.map((p) => ({ label: formatPluginLabel(p, { showCategory: showCat }), value: p.id }));
|
|
55485
57701
|
}, [action, instancePlugins]);
|
|
55486
|
-
|
|
57702
|
+
useNavigation2(() => {
|
|
55487
57703
|
if (step === "select-instance" || step === "select-plugins" || step === "plugin-list" || step === "symlink-warning") {
|
|
55488
57704
|
setStep("action");
|
|
55489
57705
|
} else if (step === "done") {
|
|
@@ -55799,7 +58015,7 @@ var import_react75, jsx_dev_runtime14, SymlinkResults = ({ results }) => {
|
|
|
55799
58015
|
const [step, setStep] = import_react75.useState("select");
|
|
55800
58016
|
const [results, setResults] = import_react75.useState([]);
|
|
55801
58017
|
const { error, setError } = useMessage();
|
|
55802
|
-
|
|
58018
|
+
useNavigation2(() => {
|
|
55803
58019
|
if (step === "done")
|
|
55804
58020
|
onBack();
|
|
55805
58021
|
else
|
|
@@ -56043,7 +58259,7 @@ var import_react76, jsx_dev_runtime15, McpSourceDetails = ({ sources, action })
|
|
|
56043
58259
|
const { error, setError, success, setSuccess } = useMessage();
|
|
56044
58260
|
const [customName, setCustomName] = import_react76.useState("");
|
|
56045
58261
|
const [customConfig, setCustomConfig] = import_react76.useState("");
|
|
56046
|
-
|
|
58262
|
+
useNavigation2(() => {
|
|
56047
58263
|
if (step === "details" || step === "select" || step === "remove-select" || step === "add-name" || step === "add-config") {
|
|
56048
58264
|
setStep("action");
|
|
56049
58265
|
} else if (step === "select-target") {
|
|
@@ -56429,11 +58645,13 @@ var import_react77, jsx_dev_runtime17, HealthScreen = ({
|
|
|
56429
58645
|
onDismiss,
|
|
56430
58646
|
onDismissAll,
|
|
56431
58647
|
onRetry,
|
|
58648
|
+
onFix,
|
|
56432
58649
|
onBack
|
|
56433
58650
|
}) => {
|
|
56434
58651
|
const [step, setStep] = import_react77.useState("list");
|
|
56435
58652
|
const [selectedIssue, setSelectedIssue] = import_react77.useState(null);
|
|
56436
|
-
|
|
58653
|
+
const [fixMessage, setFixMessage] = import_react77.useState(null);
|
|
58654
|
+
useNavigation2(() => {
|
|
56437
58655
|
if (step === "detail") {
|
|
56438
58656
|
setStep("list");
|
|
56439
58657
|
setSelectedIssue(null);
|
|
@@ -56451,6 +58669,10 @@ var import_react77, jsx_dev_runtime17, HealthScreen = ({
|
|
|
56451
58669
|
onDismissAll();
|
|
56452
58670
|
} else if (input === "r") {
|
|
56453
58671
|
onRetry();
|
|
58672
|
+
} else if (input === "f") {
|
|
58673
|
+
onFix();
|
|
58674
|
+
setFixMessage("Wrappers updated to pinned Claude version!");
|
|
58675
|
+
setTimeout(() => setFixMessage(null), 3000);
|
|
56454
58676
|
} else if (input === " " && selectedIssue) {
|
|
56455
58677
|
setStep("detail");
|
|
56456
58678
|
}
|
|
@@ -56469,6 +58691,16 @@ var import_react77, jsx_dev_runtime17, HealthScreen = ({
|
|
|
56469
58691
|
message: "All systems healthy!",
|
|
56470
58692
|
type: "success"
|
|
56471
58693
|
}, undefined, false, undefined, this),
|
|
58694
|
+
fixMessage && /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Box_default, {
|
|
58695
|
+
marginTop: 1,
|
|
58696
|
+
children: /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Text, {
|
|
58697
|
+
color: "green",
|
|
58698
|
+
children: [
|
|
58699
|
+
"✓ ",
|
|
58700
|
+
fixMessage
|
|
58701
|
+
]
|
|
58702
|
+
}, undefined, true, undefined, this)
|
|
58703
|
+
}, undefined, false, undefined, this),
|
|
56472
58704
|
/* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Box_default, {
|
|
56473
58705
|
marginTop: 1,
|
|
56474
58706
|
children: /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Text, {
|
|
@@ -56480,6 +58712,7 @@ var import_react77, jsx_dev_runtime17, HealthScreen = ({
|
|
|
56480
58712
|
}, undefined, true, undefined, this);
|
|
56481
58713
|
}
|
|
56482
58714
|
const showActions = useFadeIn(100);
|
|
58715
|
+
const hasVersionIssues = issues.some((i) => i.category === "version");
|
|
56483
58716
|
return /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Box_default, {
|
|
56484
58717
|
flexDirection: "column",
|
|
56485
58718
|
width: "100",
|
|
@@ -56489,6 +58722,16 @@ var import_react77, jsx_dev_runtime17, HealthScreen = ({
|
|
|
56489
58722
|
/* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Header, {
|
|
56490
58723
|
title: "⚠ System Health"
|
|
56491
58724
|
}, undefined, false, undefined, this),
|
|
58725
|
+
fixMessage && /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Box_default, {
|
|
58726
|
+
marginBottom: 1,
|
|
58727
|
+
children: /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Text, {
|
|
58728
|
+
color: "green",
|
|
58729
|
+
children: [
|
|
58730
|
+
"✓ ",
|
|
58731
|
+
fixMessage
|
|
58732
|
+
]
|
|
58733
|
+
}, undefined, true, undefined, this)
|
|
58734
|
+
}, undefined, false, undefined, this),
|
|
56492
58735
|
step === "list" && /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Box_default, {
|
|
56493
58736
|
flexDirection: "column",
|
|
56494
58737
|
gap: 1,
|
|
@@ -56507,11 +58750,31 @@ var import_react77, jsx_dev_runtime17, HealthScreen = ({
|
|
|
56507
58750
|
showActions && /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Box_default, {
|
|
56508
58751
|
marginTop: 1,
|
|
56509
58752
|
flexDirection: "column",
|
|
56510
|
-
children:
|
|
56511
|
-
|
|
56512
|
-
|
|
56513
|
-
|
|
56514
|
-
|
|
58753
|
+
children: [
|
|
58754
|
+
hasVersionIssues && /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Box_default, {
|
|
58755
|
+
marginBottom: 1,
|
|
58756
|
+
children: [
|
|
58757
|
+
/* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Text, {
|
|
58758
|
+
color: "cyan",
|
|
58759
|
+
bold: true,
|
|
58760
|
+
children: "f"
|
|
58761
|
+
}, undefined, false, undefined, this),
|
|
58762
|
+
/* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Text, {
|
|
58763
|
+
color: "cyan",
|
|
58764
|
+
children: " fix wrappers "
|
|
58765
|
+
}, undefined, false, undefined, this),
|
|
58766
|
+
/* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Text, {
|
|
58767
|
+
dimColor: true,
|
|
58768
|
+
children: "│"
|
|
58769
|
+
}, undefined, false, undefined, this)
|
|
58770
|
+
]
|
|
58771
|
+
}, undefined, true, undefined, this),
|
|
58772
|
+
/* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Text, {
|
|
58773
|
+
dimColor: true,
|
|
58774
|
+
children: "Space view detail │ d dismiss │ D dismiss all │ r retry │ ESC back"
|
|
58775
|
+
}, undefined, false, undefined, this)
|
|
58776
|
+
]
|
|
58777
|
+
}, undefined, true, undefined, this)
|
|
56515
58778
|
]
|
|
56516
58779
|
}, undefined, true, undefined, this),
|
|
56517
58780
|
step === "detail" && selectedIssue && /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Box_default, {
|
|
@@ -56635,6 +58898,8 @@ var exports_App = {};
|
|
|
56635
58898
|
__export(exports_App, {
|
|
56636
58899
|
App: () => App2
|
|
56637
58900
|
});
|
|
58901
|
+
import { execSync as execSync3 } from "node:child_process";
|
|
58902
|
+
import { existsSync as existsSync7 } from "node:fs";
|
|
56638
58903
|
var import_react78, jsx_dev_runtime18, GoodbyeScreen = () => {
|
|
56639
58904
|
const msg = useTypewriter("\uD83D\uDC4B Goodbye!", 40);
|
|
56640
58905
|
return /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(Box_default, {
|
|
@@ -56645,6 +58910,44 @@ var import_react78, jsx_dev_runtime18, GoodbyeScreen = () => {
|
|
|
56645
58910
|
children: msg
|
|
56646
58911
|
}, undefined, false, undefined, this)
|
|
56647
58912
|
}, undefined, false, undefined, this);
|
|
58913
|
+
}, DoctorResultScreen = ({ fixedCount, onBack }) => {
|
|
58914
|
+
useNavigation(onBack);
|
|
58915
|
+
return /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(Box_default, {
|
|
58916
|
+
flexDirection: "column",
|
|
58917
|
+
width: "100",
|
|
58918
|
+
paddingX: 2,
|
|
58919
|
+
paddingY: 1,
|
|
58920
|
+
children: [
|
|
58921
|
+
/* @__PURE__ */ jsx_dev_runtime18.jsxDEV(Header, {
|
|
58922
|
+
title: "\uD83D\uDD27 Doctor Fix"
|
|
58923
|
+
}, undefined, false, undefined, this),
|
|
58924
|
+
fixedCount > 0 ? /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(jsx_dev_runtime18.Fragment, {
|
|
58925
|
+
children: [
|
|
58926
|
+
/* @__PURE__ */ jsx_dev_runtime18.jsxDEV(StatusBar, {
|
|
58927
|
+
message: `Fixed ${fixedCount} wrapper(s) to use pinned Claude v${COMPATIBLE_CLAUDE_VERSION}!`,
|
|
58928
|
+
type: "success"
|
|
58929
|
+
}, undefined, false, undefined, this),
|
|
58930
|
+
/* @__PURE__ */ jsx_dev_runtime18.jsxDEV(Box_default, {
|
|
58931
|
+
marginTop: 1,
|
|
58932
|
+
children: /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(Text, {
|
|
58933
|
+
dimColor: true,
|
|
58934
|
+
children: "All 3rd-party API instances now use the correct Claude binary."
|
|
58935
|
+
}, undefined, false, undefined, this)
|
|
58936
|
+
}, undefined, false, undefined, this)
|
|
58937
|
+
]
|
|
58938
|
+
}, undefined, true, undefined, this) : /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(StatusBar, {
|
|
58939
|
+
message: "All wrappers already use the correct Claude version",
|
|
58940
|
+
type: "info"
|
|
58941
|
+
}, undefined, false, undefined, this),
|
|
58942
|
+
/* @__PURE__ */ jsx_dev_runtime18.jsxDEV(Box_default, {
|
|
58943
|
+
marginTop: 1,
|
|
58944
|
+
children: /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(Text, {
|
|
58945
|
+
dimColor: true,
|
|
58946
|
+
children: "ESC to go back"
|
|
58947
|
+
}, undefined, false, undefined, this)
|
|
58948
|
+
}, undefined, false, undefined, this)
|
|
58949
|
+
]
|
|
58950
|
+
}, undefined, true, undefined, this);
|
|
56648
58951
|
}, InstanceLine = ({ instances: instances2 }) => {
|
|
56649
58952
|
const visible = useFadeIn(100);
|
|
56650
58953
|
if (!visible || instances2.length === 0)
|
|
@@ -56667,6 +58970,14 @@ var import_react78, jsx_dev_runtime18, GoodbyeScreen = () => {
|
|
|
56667
58970
|
const { issues, dismiss, dismissAll, retry } = useHealthCheck(instances2, migrationStatus);
|
|
56668
58971
|
const [screen, setScreen] = import_react78.useState("menu");
|
|
56669
58972
|
const [menuKey, setMenuKey] = import_react78.useState(0);
|
|
58973
|
+
const [ccVersion, setCcVersion] = import_react78.useState(null);
|
|
58974
|
+
const [doctorFixedCount, setDoctorFixedCount] = import_react78.useState(0);
|
|
58975
|
+
import_react78.useEffect(() => {
|
|
58976
|
+
try {
|
|
58977
|
+
const output = execSync3("claude --version 2>/dev/null", { encoding: "utf-8", timeout: 5000 }).trim();
|
|
58978
|
+
setCcVersion(output.split(" ")[0] || null);
|
|
58979
|
+
} catch {}
|
|
58980
|
+
}, []);
|
|
56670
58981
|
use_input_default((input, key) => {
|
|
56671
58982
|
if (screen !== "menu")
|
|
56672
58983
|
return;
|
|
@@ -56674,7 +58985,7 @@ var import_react78, jsx_dev_runtime18, GoodbyeScreen = () => {
|
|
|
56674
58985
|
setScreen("goodbye");
|
|
56675
58986
|
setTimeout(() => exit(), 300);
|
|
56676
58987
|
} else if (input === "!" && issues.length > 0) {
|
|
56677
|
-
|
|
58988
|
+
goToHealth();
|
|
56678
58989
|
}
|
|
56679
58990
|
});
|
|
56680
58991
|
if (loading) {
|
|
@@ -56699,6 +59010,29 @@ var import_react78, jsx_dev_runtime18, GoodbyeScreen = () => {
|
|
|
56699
59010
|
onDismiss: dismiss,
|
|
56700
59011
|
onDismissAll: dismissAll,
|
|
56701
59012
|
onRetry: retry,
|
|
59013
|
+
onFix: () => {
|
|
59014
|
+
if (!existsSync7(PINNED_CLAUDE_BIN)) {
|
|
59015
|
+
try {
|
|
59016
|
+
installPinnedClaude();
|
|
59017
|
+
} catch {}
|
|
59018
|
+
} else {
|
|
59019
|
+
const pinnedVer = getPinnedBinaryVersion();
|
|
59020
|
+
if (pinnedVer && isThirdPartyApiBroken(pinnedVer)) {
|
|
59021
|
+
try {
|
|
59022
|
+
installPinnedClaude();
|
|
59023
|
+
} catch {}
|
|
59024
|
+
}
|
|
59025
|
+
}
|
|
59026
|
+
const fixed = fixWrapperVersions(instances2);
|
|
59027
|
+
setDoctorFixedCount(fixed.length);
|
|
59028
|
+
retry();
|
|
59029
|
+
},
|
|
59030
|
+
onBack: goToMenu
|
|
59031
|
+
}, undefined, false, undefined, this);
|
|
59032
|
+
}
|
|
59033
|
+
if (screen === "doctor-result") {
|
|
59034
|
+
return /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(DoctorResultScreen, {
|
|
59035
|
+
fixedCount: doctorFixedCount,
|
|
56702
59036
|
onBack: goToMenu
|
|
56703
59037
|
}, undefined, false, undefined, this);
|
|
56704
59038
|
}
|
|
@@ -56714,6 +59048,11 @@ var import_react78, jsx_dev_runtime18, GoodbyeScreen = () => {
|
|
|
56714
59048
|
}
|
|
56715
59049
|
const errorCount = issues.filter((i) => i.severity === "error").length;
|
|
56716
59050
|
const warningCount = issues.filter((i) => i.severity === "warning").length;
|
|
59051
|
+
const versionIssues = issues.filter((i) => i.category === "version");
|
|
59052
|
+
const hasVersionIssues = versionIssues.length > 0;
|
|
59053
|
+
const goToHealth = () => {
|
|
59054
|
+
setScreen("health");
|
|
59055
|
+
};
|
|
56717
59056
|
const menuOptions = [
|
|
56718
59057
|
{ label: "➕ Add new instance", value: "add" },
|
|
56719
59058
|
{ label: "\uD83D\uDCCB List all instances", value: "list" },
|
|
@@ -56725,6 +59064,8 @@ var import_react78, jsx_dev_runtime18, GoodbyeScreen = () => {
|
|
|
56725
59064
|
{ label: "\uD83D\uDDD1️ Remove instance", value: "remove" },
|
|
56726
59065
|
{ label: "⚙️ MCP servers", value: "mcp" }
|
|
56727
59066
|
] : [],
|
|
59067
|
+
{ label: "\uD83E\uDE7A Doctor check", value: "doctor-check" },
|
|
59068
|
+
...hasVersionIssues ? [{ label: "\uD83D\uDD27 Fix wrappers (3rd-party API)", value: "doctor-fix" }] : [],
|
|
56728
59069
|
{ label: "\uD83D\uDEAA Exit", value: "exit" }
|
|
56729
59070
|
];
|
|
56730
59071
|
return /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(Box_default, {
|
|
@@ -56740,8 +59081,27 @@ var import_react78, jsx_dev_runtime18, GoodbyeScreen = () => {
|
|
|
56740
59081
|
/* @__PURE__ */ jsx_dev_runtime18.jsxDEV(WarningBanner, {
|
|
56741
59082
|
issueCount: issues.length,
|
|
56742
59083
|
errorCount,
|
|
56743
|
-
warningCount
|
|
59084
|
+
warningCount,
|
|
59085
|
+
hasVersionIssues
|
|
56744
59086
|
}, undefined, false, undefined, this),
|
|
59087
|
+
ccVersion && isThirdPartyApiBroken(ccVersion) && /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(Box_default, {
|
|
59088
|
+
marginBottom: 1,
|
|
59089
|
+
children: [
|
|
59090
|
+
/* @__PURE__ */ jsx_dev_runtime18.jsxDEV(Text, {
|
|
59091
|
+
color: "red",
|
|
59092
|
+
bold: true,
|
|
59093
|
+
children: [
|
|
59094
|
+
"⚠ Claude Code v",
|
|
59095
|
+
ccVersion,
|
|
59096
|
+
" does not work with 3rd party APIs. "
|
|
59097
|
+
]
|
|
59098
|
+
}, undefined, true, undefined, this),
|
|
59099
|
+
/* @__PURE__ */ jsx_dev_runtime18.jsxDEV(Text, {
|
|
59100
|
+
color: "red",
|
|
59101
|
+
children: "Run 'claude-multi doctor fix' to install a compatible version."
|
|
59102
|
+
}, undefined, false, undefined, this)
|
|
59103
|
+
]
|
|
59104
|
+
}, undefined, true, undefined, this),
|
|
56745
59105
|
/* @__PURE__ */ jsx_dev_runtime18.jsxDEV(InstanceLine, {
|
|
56746
59106
|
instances: instances2
|
|
56747
59107
|
}, undefined, false, undefined, this),
|
|
@@ -56752,6 +59112,27 @@ var import_react78, jsx_dev_runtime18, GoodbyeScreen = () => {
|
|
|
56752
59112
|
if (value === "exit") {
|
|
56753
59113
|
setScreen("goodbye");
|
|
56754
59114
|
setTimeout(() => exit(), 300);
|
|
59115
|
+
} else if (value === "doctor-check") {
|
|
59116
|
+
setScreen("health");
|
|
59117
|
+
} else if (value === "doctor-fix") {
|
|
59118
|
+
if (!existsSync7(PINNED_CLAUDE_BIN)) {
|
|
59119
|
+
try {
|
|
59120
|
+
installPinnedClaude();
|
|
59121
|
+
} catch {}
|
|
59122
|
+
} else {
|
|
59123
|
+
const pinnedVer = getPinnedBinaryVersion();
|
|
59124
|
+
if (pinnedVer && isThirdPartyApiBroken(pinnedVer)) {
|
|
59125
|
+
try {
|
|
59126
|
+
installPinnedClaude();
|
|
59127
|
+
} catch {}
|
|
59128
|
+
}
|
|
59129
|
+
}
|
|
59130
|
+
const fixed = fixWrapperVersions(instances2);
|
|
59131
|
+
setDoctorFixedCount(fixed.length);
|
|
59132
|
+
if (fixed.length > 0) {
|
|
59133
|
+
retry();
|
|
59134
|
+
}
|
|
59135
|
+
setScreen("doctor-result");
|
|
56755
59136
|
} else {
|
|
56756
59137
|
setScreen(value);
|
|
56757
59138
|
}
|
|
@@ -56764,14 +59145,18 @@ var import_react78, jsx_dev_runtime18, GoodbyeScreen = () => {
|
|
|
56764
59145
|
}, undefined, true, undefined, this);
|
|
56765
59146
|
}, SCREEN_MAP;
|
|
56766
59147
|
var init_App2 = __esm(async () => {
|
|
59148
|
+
init_version();
|
|
59149
|
+
init_paths();
|
|
56767
59150
|
init_useConfig();
|
|
56768
59151
|
init_useHealthCheck();
|
|
56769
59152
|
init_useAnimations();
|
|
59153
|
+
init_health();
|
|
56770
59154
|
await __promiseAll([
|
|
56771
59155
|
init_build2(),
|
|
56772
59156
|
init_build3(),
|
|
56773
59157
|
init_Header(),
|
|
56774
59158
|
init_Footer(),
|
|
59159
|
+
init_StatusBar(),
|
|
56775
59160
|
init_WarningBanner(),
|
|
56776
59161
|
init_AddInstance(),
|
|
56777
59162
|
init_ListInstances(),
|
|
@@ -56817,112 +59202,13 @@ var {
|
|
|
56817
59202
|
init_source();
|
|
56818
59203
|
init_config();
|
|
56819
59204
|
init_wrapper();
|
|
56820
|
-
|
|
56821
|
-
import { homedir as homedir4 } from "node:os";
|
|
56822
|
-
import { join as join7 } from "node:path";
|
|
56823
|
-
|
|
56824
|
-
// src/version.ts
|
|
56825
|
-
init_errors();
|
|
56826
|
-
import { execSync as execSync2 } from "node:child_process";
|
|
56827
|
-
import { readFileSync as readFileSync3 } from "node:fs";
|
|
56828
|
-
import { join as join3, dirname as dirname4 } from "node:path";
|
|
56829
|
-
import { fileURLToPath } from "node:url";
|
|
56830
|
-
function getClaudeMultiVersion() {
|
|
56831
|
-
const pkgPath = join3(dirname4(fileURLToPath(import.meta.url)), "..", "package.json");
|
|
56832
|
-
const pkg = JSON.parse(readFileSync3(pkgPath, "utf-8"));
|
|
56833
|
-
if (typeof pkg !== "object" || pkg === null || typeof pkg.version !== "string") {
|
|
56834
|
-
throw new ClaudeMultiError(ErrorCode.CONFIG_CORRUPTED, "Could not read package version");
|
|
56835
|
-
}
|
|
56836
|
-
return pkg.version;
|
|
56837
|
-
}
|
|
56838
|
-
async function getLatestClaudeMultiVersion() {
|
|
56839
|
-
const response = await fetch("https://registry.npmjs.org/claude-multi/latest");
|
|
56840
|
-
const data = await response.json();
|
|
56841
|
-
return data.version;
|
|
56842
|
-
}
|
|
56843
|
-
async function checkForClaudeMultiUpdates() {
|
|
56844
|
-
try {
|
|
56845
|
-
const current = getClaudeMultiVersion();
|
|
56846
|
-
const latest = await getLatestClaudeMultiVersion();
|
|
56847
|
-
return {
|
|
56848
|
-
current,
|
|
56849
|
-
latest,
|
|
56850
|
-
updateAvailable: current !== latest
|
|
56851
|
-
};
|
|
56852
|
-
} catch {
|
|
56853
|
-
return { current: "", latest: "", updateAvailable: false };
|
|
56854
|
-
}
|
|
56855
|
-
}
|
|
56856
|
-
function upgradeClaudeMulti() {
|
|
56857
|
-
const pm = detectPackageManager();
|
|
56858
|
-
const commands = {
|
|
56859
|
-
bun: "bun upgrade -g claude-multi",
|
|
56860
|
-
npm: "npm update -g claude-multi",
|
|
56861
|
-
pnpm: "pnpm update -g claude-multi",
|
|
56862
|
-
deno: "deno install --reload -g npm:claude-multi"
|
|
56863
|
-
};
|
|
56864
|
-
execSync2(commands[pm], { stdio: "inherit" });
|
|
56865
|
-
}
|
|
56866
|
-
function getCurrentVersion() {
|
|
56867
|
-
const pm = detectPackageManager();
|
|
56868
|
-
try {
|
|
56869
|
-
if (pm === "deno")
|
|
56870
|
-
return null;
|
|
56871
|
-
const commands = {
|
|
56872
|
-
bun: "bun pm ls -g --json",
|
|
56873
|
-
npm: "npm ls -g --json @anthropic-ai/claude-code",
|
|
56874
|
-
pnpm: "pnpm ls -g --json"
|
|
56875
|
-
};
|
|
56876
|
-
const output = execSync2(commands[pm], {
|
|
56877
|
-
encoding: "utf-8",
|
|
56878
|
-
stdio: ["pipe", "pipe", "ignore"]
|
|
56879
|
-
});
|
|
56880
|
-
const data = JSON.parse(output);
|
|
56881
|
-
const root = Array.isArray(data) ? data[0] : data;
|
|
56882
|
-
return root?.dependencies?.["@anthropic-ai/claude-code"]?.version ?? null;
|
|
56883
|
-
} catch {
|
|
56884
|
-
return null;
|
|
56885
|
-
}
|
|
56886
|
-
}
|
|
56887
|
-
async function getLatestVersion() {
|
|
56888
|
-
try {
|
|
56889
|
-
const response = await fetch("https://registry.npmjs.org/@anthropic-ai/claude-code/latest");
|
|
56890
|
-
const data = await response.json();
|
|
56891
|
-
return data.version;
|
|
56892
|
-
} catch (err) {
|
|
56893
|
-
throw new ClaudeMultiError(ErrorCode.VERSION_CHECK_FAILED, `Failed to fetch latest version from npm registry: ${err instanceof Error ? err.message : String(err)}`, { cause: err });
|
|
56894
|
-
}
|
|
56895
|
-
}
|
|
56896
|
-
async function checkForUpdates() {
|
|
56897
|
-
const current = getCurrentVersion();
|
|
56898
|
-
const latest = await getLatestVersion();
|
|
56899
|
-
return {
|
|
56900
|
-
current,
|
|
56901
|
-
latest,
|
|
56902
|
-
updateAvailable: current !== null && current !== latest
|
|
56903
|
-
};
|
|
56904
|
-
}
|
|
56905
|
-
async function updateClaudeCode() {
|
|
56906
|
-
const pm = detectPackageManager();
|
|
56907
|
-
const commands = {
|
|
56908
|
-
bun: "bun install -g @anthropic-ai/claude-code@latest",
|
|
56909
|
-
npm: "npm install -g @anthropic-ai/claude-code@latest",
|
|
56910
|
-
pnpm: "pnpm add -g @anthropic-ai/claude-code@latest",
|
|
56911
|
-
deno: "deno install --reload -g npm:@anthropic-ai/claude-code@latest"
|
|
56912
|
-
};
|
|
56913
|
-
try {
|
|
56914
|
-
console.log("Updating @anthropic-ai/claude-code...");
|
|
56915
|
-
execSync2(commands[pm], { stdio: "inherit" });
|
|
56916
|
-
console.log("Update completed successfully!");
|
|
56917
|
-
} catch (err) {
|
|
56918
|
-
throw new ClaudeMultiError(ErrorCode.UPDATE_FAILED, `Failed to update @anthropic-ai/claude-code: ${err instanceof Error ? err.message : String(err)}`, { cause: err });
|
|
56919
|
-
}
|
|
56920
|
-
}
|
|
56921
|
-
|
|
56922
|
-
// src/cli.ts
|
|
59205
|
+
init_version();
|
|
56923
59206
|
init_templates();
|
|
56924
59207
|
init_errors();
|
|
56925
59208
|
init_constants();
|
|
59209
|
+
var import_prompts = __toESM(require_prompts3(), 1);
|
|
59210
|
+
import { homedir as homedir4 } from "node:os";
|
|
59211
|
+
import { join as join8 } from "node:path";
|
|
56926
59212
|
function exitWithCode(code) {
|
|
56927
59213
|
process.exit(code);
|
|
56928
59214
|
}
|
|
@@ -56942,10 +59228,10 @@ function requireNonEmptyArgs(items, errorMsg, usage) {
|
|
|
56942
59228
|
}
|
|
56943
59229
|
}
|
|
56944
59230
|
var program2 = new Command;
|
|
56945
|
-
program2.name("claude-multi").description("Manage multiple Claude Code instances with different aliases").version(
|
|
56946
|
-
program2.command("add <name>").description("Add a new Claude Code instance").option("-c, --config <dir>", "Config directory path", (name) =>
|
|
59231
|
+
program2.name("claude-multi").description("Manage multiple Claude Code instances with different aliases").version(getClaudeMultiVersion());
|
|
59232
|
+
program2.command("add <name>").description("Add a new Claude Code instance").option("-c, --config <dir>", "Config directory path", (name) => join8(homedir4(), `.claude-${name}`)).option("-b, --binary <path>", "Binary path (default: ~/.local/bin/claude-<name>)").option("--copy-settings", "Copy settings.json from default Claude").option("--copy-all", "Copy all files from default Claude").option("--copy-mcp", "Copy MCP server configurations from default Claude").option("--skip-prompts", "Skip interactive prompts (start fresh)").option("--provider <name>", "Use a provider template (glm, minimax, deepseek, mimo, mimo-token, kimi, qwen, qwen-coding)").option("--api-key <key>", "API key for the provider").option("--region <region>", "Region for regional providers (e.g., cn, sgp, ams for mimo-token)").option("--auto-sync", "Auto-sync plugins/skills via symlinks (default)").option("--manual", "Manually manage plugins/skills (copy files)").action(async (name, options) => {
|
|
56947
59233
|
try {
|
|
56948
|
-
const configDir = options.config ||
|
|
59234
|
+
const configDir = options.config || join8(homedir4(), `.claude-${name}`);
|
|
56949
59235
|
const binaryPath = options.binary || getDefaultBinaryPath(name);
|
|
56950
59236
|
const hasDefaultConfig = hasDefaultClaudeConfig();
|
|
56951
59237
|
const hasDefaultMcp = await hasDefaultMcpConfig();
|
|
@@ -56959,7 +59245,7 @@ program2.command("add <name>").description("Add a new Claude Code instance").opt
|
|
|
56959
59245
|
if (options.provider) {
|
|
56960
59246
|
providerTemplate = getProviderTemplate(options.provider);
|
|
56961
59247
|
if (!providerTemplate) {
|
|
56962
|
-
console.error(source_default.red(`✗ Unknown provider '${options.provider}'. Available:
|
|
59248
|
+
console.error(source_default.red(`✗ Unknown provider '${options.provider}'. Available: ${getAvailableProviders().map((p) => p.name).join(", ")}`));
|
|
56963
59249
|
exitWithCode(1);
|
|
56964
59250
|
}
|
|
56965
59251
|
if (!options.apiKey) {
|
|
@@ -56968,6 +59254,15 @@ program2.command("add <name>").description("Add a new Claude Code instance").opt
|
|
|
56968
59254
|
}
|
|
56969
59255
|
apiKey = options.apiKey;
|
|
56970
59256
|
useProviderTemplate = true;
|
|
59257
|
+
if (providerHasRegions(providerTemplate.name)) {
|
|
59258
|
+
const region = options.region || "cn";
|
|
59259
|
+
try {
|
|
59260
|
+
providerTemplate = resolveRegionTemplate(providerTemplate, region);
|
|
59261
|
+
} catch (err) {
|
|
59262
|
+
console.error(source_default.red(`✗ ${toMessage(err)}`));
|
|
59263
|
+
exitWithCode(1);
|
|
59264
|
+
}
|
|
59265
|
+
}
|
|
56971
59266
|
}
|
|
56972
59267
|
if (options.copySettings || options.copyAll || options.copyMcp || options.skipPrompts || options.provider) {
|
|
56973
59268
|
if (options.copyAll) {
|
|
@@ -57213,6 +59508,68 @@ program2.command("auto-sync <name> <status>").description("Toggle auto-sync for
|
|
|
57213
59508
|
program2.command("fix-symlinks [name...]").description("Fix broken symlinks for instances (auto-detects and repairs)").option("-a, --all", "Fix all instances").action(async (names, options) => {
|
|
57214
59509
|
await handleFixSymlinks(names, options.all);
|
|
57215
59510
|
});
|
|
59511
|
+
program2.command("doctor").description("Diagnose and fix common issues").argument("[action]", "Action to perform (fix, check)", "check").action(async (action = "check") => {
|
|
59512
|
+
try {
|
|
59513
|
+
const instances2 = await listInstances();
|
|
59514
|
+
const { runHealthChecks: runHealthChecks2, fixWrapperVersions: fixWrapperVersions2 } = await Promise.resolve().then(() => (init_health(), exports_health));
|
|
59515
|
+
const { existsSync: existsSync8 } = await import("node:fs");
|
|
59516
|
+
const { PINNED_CLAUDE_BIN: PINNED_CLAUDE_BIN3 } = await Promise.resolve().then(() => (init_paths(), exports_paths));
|
|
59517
|
+
const { installPinnedClaude: installPinnedClaude2, getPinnedBinaryVersion: getPinnedBinaryVersion2, isThirdPartyApiBroken: isThirdPartyApiBroken2, COMPATIBLE_CLAUDE_VERSION: COMPATIBLE_CLAUDE_VERSION2 } = await Promise.resolve().then(() => (init_version(), exports_version));
|
|
59518
|
+
if (action === "fix") {
|
|
59519
|
+
console.log(source_default.bold(`
|
|
59520
|
+
\uD83D\uDD27 Doctor Fix
|
|
59521
|
+
`));
|
|
59522
|
+
if (!existsSync8(PINNED_CLAUDE_BIN3)) {
|
|
59523
|
+
console.log(source_default.cyan(`Installing compatible Claude v${COMPATIBLE_CLAUDE_VERSION2}...`));
|
|
59524
|
+
installPinnedClaude2();
|
|
59525
|
+
console.log(source_default.green(`✓ Installed pinned Claude v${COMPATIBLE_CLAUDE_VERSION2}`));
|
|
59526
|
+
} else {
|
|
59527
|
+
const pinnedVer = getPinnedBinaryVersion2();
|
|
59528
|
+
if (pinnedVer && isThirdPartyApiBroken2(pinnedVer)) {
|
|
59529
|
+
console.log(source_default.yellow(`Pinned binary is v${pinnedVer} (incompatible). Reinstalling v${COMPATIBLE_CLAUDE_VERSION2}...`));
|
|
59530
|
+
installPinnedClaude2();
|
|
59531
|
+
console.log(source_default.green(`✓ Reinstalled pinned Claude v${COMPATIBLE_CLAUDE_VERSION2}`));
|
|
59532
|
+
}
|
|
59533
|
+
}
|
|
59534
|
+
const fixed = fixWrapperVersions2(instances2);
|
|
59535
|
+
if (fixed.length > 0) {
|
|
59536
|
+
console.log(source_default.green(`✓ Fixed ${fixed.length} wrapper(s) to use pinned Claude version:`));
|
|
59537
|
+
for (const name of fixed) {
|
|
59538
|
+
console.log(source_default.gray(` • ${name}`));
|
|
59539
|
+
}
|
|
59540
|
+
} else {
|
|
59541
|
+
console.log(source_default.gray(" All wrappers already use the correct Claude version"));
|
|
59542
|
+
}
|
|
59543
|
+
console.log(source_default.green(`
|
|
59544
|
+
✓ Doctor fix complete!`));
|
|
59545
|
+
} else {
|
|
59546
|
+
console.log(source_default.bold(`
|
|
59547
|
+
\uD83D\uDD0D Doctor Check
|
|
59548
|
+
`));
|
|
59549
|
+
const issues = runHealthChecks2(instances2);
|
|
59550
|
+
if (issues.length === 0) {
|
|
59551
|
+
console.log(source_default.green("✓ No issues found!"));
|
|
59552
|
+
} else {
|
|
59553
|
+
console.log(source_default.yellow(`Found ${issues.length} issue(s):
|
|
59554
|
+
`));
|
|
59555
|
+
for (const issue of issues) {
|
|
59556
|
+
const icon = issue.severity === "error" ? "✗" : "⚠";
|
|
59557
|
+
const color = issue.severity === "error" ? source_default.red : source_default.yellow;
|
|
59558
|
+
console.log(color(` ${icon} ${issue.title}`));
|
|
59559
|
+
console.log(source_default.gray(` ${issue.message}`));
|
|
59560
|
+
if (issue.resolutionHint) {
|
|
59561
|
+
console.log(source_default.gray(` Fix: ${issue.resolutionHint}`));
|
|
59562
|
+
}
|
|
59563
|
+
console.log();
|
|
59564
|
+
}
|
|
59565
|
+
console.log(source_default.gray("Run 'claude-multi doctor fix' to auto-fix"));
|
|
59566
|
+
}
|
|
59567
|
+
}
|
|
59568
|
+
} catch (error) {
|
|
59569
|
+
console.error(source_default.red(`✗ Error: ${toMessage(error)}`));
|
|
59570
|
+
exitWithCode(1);
|
|
59571
|
+
}
|
|
59572
|
+
});
|
|
57216
59573
|
program2.command("plugins").description("Manage plugins for instances").argument("[action]", "Action to perform (list, enable, disable, copy, install, remove, list-defaults, list-installed, check-collisions)", "list").argument("[instance]", "Instance name (for list/enable/disable/install/remove)", "").argument("[plugins...]", "Plugin IDs", []).action(async (action = "list", instanceName = "", plugins = []) => {
|
|
57217
59574
|
try {
|
|
57218
59575
|
switch (action) {
|