claude-multi 0.5.8 → 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 +16 -0
- package/dist/cli.js +2712 -447
- package/package.json +3 -1
package/dist/cli.js
CHANGED
|
@@ -7320,11 +7320,16 @@ function getProviderTemplate(name) {
|
|
|
7320
7320
|
}
|
|
7321
7321
|
function applyProviderTemplate(template, apiKey) {
|
|
7322
7322
|
const settings = structuredClone(template.settings);
|
|
7323
|
+
settings.env = { ...PROVIDER_COMMON_ENV, ...settings.env };
|
|
7323
7324
|
settings.env.ANTHROPIC_AUTH_TOKEN = apiKey;
|
|
7324
7325
|
return settings;
|
|
7325
7326
|
}
|
|
7326
|
-
var PROVIDER_TEMPLATES, API_KEY_PREFIXES, MIMO_TOKEN_REGIONS;
|
|
7327
|
+
var PROVIDER_COMMON_ENV, PROVIDER_TEMPLATES, API_KEY_PREFIXES, MIMO_TOKEN_REGIONS;
|
|
7327
7328
|
var init_templates = __esm(() => {
|
|
7329
|
+
PROVIDER_COMMON_ENV = {
|
|
7330
|
+
DISABLE_AUTOUPDATER: "1",
|
|
7331
|
+
DISABLE_UPDATES: "1"
|
|
7332
|
+
};
|
|
7328
7333
|
PROVIDER_TEMPLATES = {
|
|
7329
7334
|
glm: {
|
|
7330
7335
|
name: "glm",
|
|
@@ -7607,11 +7612,22 @@ var init_constants = __esm(() => {
|
|
|
7607
7612
|
});
|
|
7608
7613
|
|
|
7609
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
|
+
});
|
|
7610
7621
|
import { homedir } from "node:os";
|
|
7622
|
+
import { join } from "node:path";
|
|
7611
7623
|
function getBaseDir() {
|
|
7612
7624
|
return process.env.CLAUDE_MULTI_HOME || homedir();
|
|
7613
7625
|
}
|
|
7614
|
-
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
|
+
});
|
|
7615
7631
|
|
|
7616
7632
|
// src/migration.ts
|
|
7617
7633
|
var exports_migration = {};
|
|
@@ -7625,12 +7641,12 @@ __export(exports_migration, {
|
|
|
7625
7641
|
CONFIG_VERSION: () => CONFIG_VERSION
|
|
7626
7642
|
});
|
|
7627
7643
|
import { existsSync, mkdirSync, readdirSync, copyFileSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
7628
|
-
import { join, dirname } from "node:path";
|
|
7644
|
+
import { join as join2, dirname } from "node:path";
|
|
7629
7645
|
function getBackupDir() {
|
|
7630
|
-
return
|
|
7646
|
+
return join2(getBaseDir(), ".claude-multi", "backups");
|
|
7631
7647
|
}
|
|
7632
7648
|
function getLockFile() {
|
|
7633
|
-
return
|
|
7649
|
+
return join2(getBaseDir(), ".claude-multi", ".migration.lock");
|
|
7634
7650
|
}
|
|
7635
7651
|
function createLock() {
|
|
7636
7652
|
const lockFile = getLockFile();
|
|
@@ -7686,24 +7702,24 @@ async function createBackup(config) {
|
|
|
7686
7702
|
const ts = new Date().toISOString().replace(/[:.]/g, "-");
|
|
7687
7703
|
const rand = Math.random().toString(36).slice(2, 6);
|
|
7688
7704
|
const fromV = config.version || "1.0.0";
|
|
7689
|
-
const backupPath =
|
|
7705
|
+
const backupPath = join2(backupDir, `${ts}-${rand}-v${fromV}-to-v${CONFIG_VERSION}`);
|
|
7690
7706
|
mkdirSync(backupPath, { recursive: true });
|
|
7691
|
-
const configSrc =
|
|
7707
|
+
const configSrc = join2(getBaseDir(), ".claude-multi", "config.json");
|
|
7692
7708
|
if (existsSync(configSrc)) {
|
|
7693
|
-
copyFileSync(configSrc,
|
|
7709
|
+
copyFileSync(configSrc, join2(backupPath, "config.json"));
|
|
7694
7710
|
}
|
|
7695
|
-
const instancesDir =
|
|
7711
|
+
const instancesDir = join2(backupPath, "instances");
|
|
7696
7712
|
for (const inst of config.instances) {
|
|
7697
|
-
const settingsFile =
|
|
7713
|
+
const settingsFile = join2(inst.configDir, "settings.json");
|
|
7698
7714
|
if (existsSync(settingsFile)) {
|
|
7699
|
-
const instDir =
|
|
7715
|
+
const instDir = join2(instancesDir, inst.name);
|
|
7700
7716
|
mkdirSync(instDir, { recursive: true });
|
|
7701
|
-
copyFileSync(settingsFile,
|
|
7717
|
+
copyFileSync(settingsFile, join2(instDir, "settings.json"));
|
|
7702
7718
|
}
|
|
7703
7719
|
}
|
|
7704
7720
|
const backups = readdirSync(backupDir).sort();
|
|
7705
7721
|
for (let i = 0;i < backups.length - 3; i++) {
|
|
7706
|
-
rmSync(
|
|
7722
|
+
rmSync(join2(backupDir, backups[i]), { force: true, recursive: true });
|
|
7707
7723
|
}
|
|
7708
7724
|
return backupPath;
|
|
7709
7725
|
}
|
|
@@ -7821,7 +7837,7 @@ import { existsSync as existsSync2, mkdirSync as mkdirSync2, readdirSync as read
|
|
|
7821
7837
|
import { readFile as readFile2, writeFile as writeFile2, copyFile, mkdir, symlink } from "node:fs/promises";
|
|
7822
7838
|
import { homedir as homedir2 } from "node:os";
|
|
7823
7839
|
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
7824
|
-
import { dirname as dirname2, isAbsolute, join as
|
|
7840
|
+
import { dirname as dirname2, isAbsolute, join as join3, relative, resolve } from "node:path";
|
|
7825
7841
|
function setTestConfigDir(dir) {
|
|
7826
7842
|
_testConfigDir = dir;
|
|
7827
7843
|
}
|
|
@@ -7829,18 +7845,18 @@ function clearTestConfigDir() {
|
|
|
7829
7845
|
_testConfigDir = undefined;
|
|
7830
7846
|
}
|
|
7831
7847
|
function getConfigDir() {
|
|
7832
|
-
return _testConfigDir ??
|
|
7848
|
+
return _testConfigDir ?? join3(homedir2(), ".claude-multi");
|
|
7833
7849
|
}
|
|
7834
7850
|
function getConfigFile() {
|
|
7835
|
-
return
|
|
7851
|
+
return join3(getConfigDir(), "config.json");
|
|
7836
7852
|
}
|
|
7837
7853
|
async function copyDirRecursive(source, target) {
|
|
7838
7854
|
if (!existsSync2(target)) {
|
|
7839
7855
|
await mkdir(target, { recursive: true });
|
|
7840
7856
|
}
|
|
7841
7857
|
for (const entry of readdirSync2(source)) {
|
|
7842
|
-
const src =
|
|
7843
|
-
const tgt =
|
|
7858
|
+
const src = join3(source, entry);
|
|
7859
|
+
const tgt = join3(target, entry);
|
|
7844
7860
|
const s = statSync(src);
|
|
7845
7861
|
if (s.isDirectory()) {
|
|
7846
7862
|
await copyDirRecursive(src, tgt);
|
|
@@ -7951,7 +7967,7 @@ function getDefaultClaudeDir() {
|
|
|
7951
7967
|
if (_testDefaultClaudeDir) {
|
|
7952
7968
|
return _testDefaultClaudeDir;
|
|
7953
7969
|
}
|
|
7954
|
-
return
|
|
7970
|
+
return join3(homedir2(), ".claude");
|
|
7955
7971
|
}
|
|
7956
7972
|
function isBrokenSymlink(path) {
|
|
7957
7973
|
try {
|
|
@@ -7975,7 +7991,7 @@ function isBrokenSymlink(path) {
|
|
|
7975
7991
|
function detectBrokenSymlinks(configDir) {
|
|
7976
7992
|
const result = { broken: [], all: [] };
|
|
7977
7993
|
for (const dir of SYNC_DIRS) {
|
|
7978
|
-
const targetPath =
|
|
7994
|
+
const targetPath = join3(configDir, dir);
|
|
7979
7995
|
try {
|
|
7980
7996
|
const stats = lstatSync(targetPath);
|
|
7981
7997
|
result.all.push(dir);
|
|
@@ -7988,12 +8004,12 @@ function detectBrokenSymlinks(configDir) {
|
|
|
7988
8004
|
}
|
|
7989
8005
|
function hasDefaultClaudeConfig() {
|
|
7990
8006
|
const defaultDir = getDefaultClaudeDir();
|
|
7991
|
-
const settingsFile =
|
|
8007
|
+
const settingsFile = join3(defaultDir, "settings.json");
|
|
7992
8008
|
return existsSync2(defaultDir) && existsSync2(settingsFile);
|
|
7993
8009
|
}
|
|
7994
8010
|
async function copySettingsFromDefault(targetConfigDir) {
|
|
7995
8011
|
const defaultDir = getDefaultClaudeDir();
|
|
7996
|
-
const sourceSettings =
|
|
8012
|
+
const sourceSettings = join3(defaultDir, "settings.json");
|
|
7997
8013
|
if (!existsSync2(sourceSettings)) {
|
|
7998
8014
|
throw new ClaudeMultiError(ErrorCode.DEFAULT_SETTINGS_NOT_FOUND, "Default Claude settings.json not found");
|
|
7999
8015
|
}
|
|
@@ -8013,7 +8029,7 @@ async function copySettingsFromDefault(targetConfigDir) {
|
|
|
8013
8029
|
if (!existsSync2(targetConfigDir)) {
|
|
8014
8030
|
await mkdir(targetConfigDir, { recursive: true });
|
|
8015
8031
|
}
|
|
8016
|
-
const targetSettings =
|
|
8032
|
+
const targetSettings = join3(targetConfigDir, "settings.json");
|
|
8017
8033
|
await writeFile2(targetSettings, JSON.stringify(safeSettings, null, 2), "utf-8");
|
|
8018
8034
|
}
|
|
8019
8035
|
async function copyAllFromDefault(targetConfigDir, autoSync = false) {
|
|
@@ -8042,8 +8058,8 @@ async function copyAllFromDefault(targetConfigDir, autoSync = false) {
|
|
|
8042
8058
|
const copyRecursive = async (source, target) => {
|
|
8043
8059
|
const entries = readdirSync2(source);
|
|
8044
8060
|
for (const entry of entries) {
|
|
8045
|
-
const sourcePath =
|
|
8046
|
-
const targetPath =
|
|
8061
|
+
const sourcePath = join3(source, entry);
|
|
8062
|
+
const targetPath = join3(target, entry);
|
|
8047
8063
|
const stat = statSync(sourcePath);
|
|
8048
8064
|
if (excludeFiles.includes(entry)) {
|
|
8049
8065
|
continue;
|
|
@@ -8083,7 +8099,7 @@ async function detectMcpConfigurations(configDir) {
|
|
|
8083
8099
|
if (!existsSync2(configDir)) {
|
|
8084
8100
|
return null;
|
|
8085
8101
|
}
|
|
8086
|
-
const settingsFile =
|
|
8102
|
+
const settingsFile = join3(configDir, "settings.json");
|
|
8087
8103
|
if (existsSync2(settingsFile)) {
|
|
8088
8104
|
try {
|
|
8089
8105
|
const settingsContent = await readFile2(settingsFile, "utf-8");
|
|
@@ -8095,7 +8111,7 @@ async function detectMcpConfigurations(configDir) {
|
|
|
8095
8111
|
}
|
|
8096
8112
|
const mcpFiles = ["mcp.json", "mcp-servers.json", "claude-mcp.json"];
|
|
8097
8113
|
for (const mcpFile of mcpFiles) {
|
|
8098
|
-
const mcpFilePath =
|
|
8114
|
+
const mcpFilePath = join3(configDir, mcpFile);
|
|
8099
8115
|
if (existsSync2(mcpFilePath)) {
|
|
8100
8116
|
try {
|
|
8101
8117
|
const mcpContent = await readFile2(mcpFilePath, "utf-8");
|
|
@@ -8118,8 +8134,8 @@ async function copyMcpServersFromDefault(targetConfigDir) {
|
|
|
8118
8134
|
if (!existsSync2(targetConfigDir)) {
|
|
8119
8135
|
await mkdir(targetConfigDir, { recursive: true });
|
|
8120
8136
|
}
|
|
8121
|
-
const pluginsDir =
|
|
8122
|
-
const defaultPluginsDir =
|
|
8137
|
+
const pluginsDir = join3(targetConfigDir, "plugins");
|
|
8138
|
+
const defaultPluginsDir = join3(defaultDir, "plugins");
|
|
8123
8139
|
if (existsSync2(defaultPluginsDir) && !existsSync2(pluginsDir)) {
|
|
8124
8140
|
await copyDirRecursive(defaultPluginsDir, pluginsDir);
|
|
8125
8141
|
}
|
|
@@ -8140,7 +8156,7 @@ async function copyMcpServersFromDefault(targetConfigDir) {
|
|
|
8140
8156
|
}
|
|
8141
8157
|
}
|
|
8142
8158
|
async function writeMcpConfiguration(targetConfigDir, mcpConfig) {
|
|
8143
|
-
const settingsFile =
|
|
8159
|
+
const settingsFile = join3(targetConfigDir, "settings.json");
|
|
8144
8160
|
if (existsSync2(settingsFile)) {
|
|
8145
8161
|
try {
|
|
8146
8162
|
const settingsContent = await readFile2(settingsFile, "utf-8");
|
|
@@ -8150,7 +8166,7 @@ async function writeMcpConfiguration(targetConfigDir, mcpConfig) {
|
|
|
8150
8166
|
return;
|
|
8151
8167
|
} catch (error) {}
|
|
8152
8168
|
}
|
|
8153
|
-
const mcpFile =
|
|
8169
|
+
const mcpFile = join3(targetConfigDir, "mcp.json");
|
|
8154
8170
|
await writeFile2(mcpFile, JSON.stringify(mcpConfig, null, 2), "utf-8");
|
|
8155
8171
|
}
|
|
8156
8172
|
async function copyMcpServersBetweenInstances(sourceInstanceName, targetInstanceName) {
|
|
@@ -8181,11 +8197,11 @@ async function createSettingsFromTemplate(targetConfigDir, template, apiKey) {
|
|
|
8181
8197
|
await mkdir(targetConfigDir, { recursive: true });
|
|
8182
8198
|
}
|
|
8183
8199
|
const settings = applyProviderTemplate(template, apiKey);
|
|
8184
|
-
const settingsFile =
|
|
8200
|
+
const settingsFile = join3(targetConfigDir, "settings.json");
|
|
8185
8201
|
await writeFile2(settingsFile, JSON.stringify(settings, null, 2), "utf-8");
|
|
8186
8202
|
}
|
|
8187
8203
|
async function initializeInstanceState(configDir) {
|
|
8188
|
-
const stateFile =
|
|
8204
|
+
const stateFile = join3(configDir, ".claude.json");
|
|
8189
8205
|
if (existsSync2(stateFile))
|
|
8190
8206
|
return;
|
|
8191
8207
|
if (!existsSync2(configDir)) {
|
|
@@ -8211,16 +8227,15 @@ async function initializeInstanceState(configDir) {
|
|
|
8211
8227
|
await writeFile2(stateFile, JSON.stringify(state, null, 2), "utf-8");
|
|
8212
8228
|
}
|
|
8213
8229
|
async function mergeProviderEnv(configDir, template, apiKey) {
|
|
8214
|
-
const settingsFile =
|
|
8230
|
+
const settingsFile = join3(configDir, "settings.json");
|
|
8215
8231
|
let existing = {};
|
|
8216
8232
|
if (existsSync2(settingsFile)) {
|
|
8217
8233
|
const raw = await readFile2(settingsFile, "utf-8");
|
|
8218
8234
|
existing = JSON.parse(raw);
|
|
8219
8235
|
}
|
|
8220
8236
|
const env2 = existing.env ?? {};
|
|
8221
|
-
const
|
|
8222
|
-
|
|
8223
|
-
existing.env = { ...env2, ...templateEnv };
|
|
8237
|
+
const templateSettings = applyProviderTemplate(template, apiKey);
|
|
8238
|
+
existing.env = { ...env2, ...templateSettings.env };
|
|
8224
8239
|
existing.includeCoAuthoredBy = template.settings.includeCoAuthoredBy;
|
|
8225
8240
|
await writeFile2(settingsFile, JSON.stringify(existing, null, 2), "utf-8");
|
|
8226
8241
|
}
|
|
@@ -8230,8 +8245,8 @@ async function syncPluginsAndSkills(configDir) {
|
|
|
8230
8245
|
throw new ClaudeMultiError(ErrorCode.INSTANCE_DIR_NOT_FOUND, "Instance config directory does not exist");
|
|
8231
8246
|
}
|
|
8232
8247
|
for (const dir of SYNC_DIRS) {
|
|
8233
|
-
const targetPath =
|
|
8234
|
-
const sourcePath =
|
|
8248
|
+
const targetPath = join3(configDir, dir);
|
|
8249
|
+
const sourcePath = join3(defaultDir, dir);
|
|
8235
8250
|
if (!existsSync2(sourcePath)) {
|
|
8236
8251
|
console.log(source_default.yellow(` ⚠ Source ${dir} not found in ${defaultDir}, skipping`));
|
|
8237
8252
|
continue;
|
|
@@ -8239,7 +8254,7 @@ async function syncPluginsAndSkills(configDir) {
|
|
|
8239
8254
|
if (existsSync2(targetPath)) {
|
|
8240
8255
|
try {
|
|
8241
8256
|
const linkTarget = readlinkSync(targetPath);
|
|
8242
|
-
if (linkTarget === sourcePath || linkTarget ===
|
|
8257
|
+
if (linkTarget === sourcePath || linkTarget === join3("..", "..", ".claude", dir)) {
|
|
8243
8258
|
console.log(source_default.gray(` ✓ ${dir} already synced`));
|
|
8244
8259
|
continue;
|
|
8245
8260
|
}
|
|
@@ -8259,8 +8274,8 @@ async function unsyncPluginsAndSkills(configDir) {
|
|
|
8259
8274
|
throw new ClaudeMultiError(ErrorCode.INSTANCE_DIR_NOT_FOUND, "Instance config directory does not exist");
|
|
8260
8275
|
}
|
|
8261
8276
|
for (const dir of SYNC_DIRS) {
|
|
8262
|
-
const targetPath =
|
|
8263
|
-
const sourcePath =
|
|
8277
|
+
const targetPath = join3(configDir, dir);
|
|
8278
|
+
const sourcePath = join3(defaultDir, dir);
|
|
8264
8279
|
if (!existsSync2(sourcePath)) {
|
|
8265
8280
|
console.log(source_default.yellow(` ⚠ Source ${dir} not found in ${defaultDir}, skipping`));
|
|
8266
8281
|
continue;
|
|
@@ -8281,8 +8296,8 @@ async function unsyncPluginsAndSkills(configDir) {
|
|
|
8281
8296
|
const copyRecursive = async (source, target) => {
|
|
8282
8297
|
const entries = readdirSync2(source);
|
|
8283
8298
|
for (const entry of entries) {
|
|
8284
|
-
const sourceEntry =
|
|
8285
|
-
const targetEntry =
|
|
8299
|
+
const sourceEntry = join3(source, entry);
|
|
8300
|
+
const targetEntry = join3(target, entry);
|
|
8286
8301
|
const stat = statSync(sourceEntry);
|
|
8287
8302
|
if (stat.isDirectory()) {
|
|
8288
8303
|
await mkdir(targetEntry, { recursive: true });
|
|
@@ -8297,7 +8312,7 @@ async function unsyncPluginsAndSkills(configDir) {
|
|
|
8297
8312
|
}
|
|
8298
8313
|
}
|
|
8299
8314
|
async function readClaudeSettings(configDir) {
|
|
8300
|
-
const settingsFile =
|
|
8315
|
+
const settingsFile = join3(configDir, "settings.json");
|
|
8301
8316
|
if (!existsSync2(settingsFile)) {
|
|
8302
8317
|
return null;
|
|
8303
8318
|
}
|
|
@@ -8313,7 +8328,7 @@ async function writeClaudeSettings(configDir, settings) {
|
|
|
8313
8328
|
if (!existsSync2(configDir)) {
|
|
8314
8329
|
await mkdir(configDir, { recursive: true });
|
|
8315
8330
|
}
|
|
8316
|
-
await writeJsonFileAtomic(
|
|
8331
|
+
await writeJsonFileAtomic(join3(configDir, "settings.json"), settings);
|
|
8317
8332
|
}
|
|
8318
8333
|
async function getEnabledPlugins(configDir) {
|
|
8319
8334
|
const settings = await readClaudeSettings(configDir);
|
|
@@ -8363,17 +8378,17 @@ function readMcpJsonFile(mcpPath) {
|
|
|
8363
8378
|
}
|
|
8364
8379
|
function scanPluginDir(baseDir, category, enabledPlugins) {
|
|
8365
8380
|
const subDir = category === PluginCategory.Internal ? "plugins" : "external_plugins";
|
|
8366
|
-
const dir =
|
|
8381
|
+
const dir = join3(baseDir, MARKETPLACE_REL, subDir);
|
|
8367
8382
|
if (!existsSync2(dir))
|
|
8368
8383
|
return [];
|
|
8369
8384
|
const results = [];
|
|
8370
8385
|
for (const entry of readdirSync2(dir, { withFileTypes: true })) {
|
|
8371
8386
|
if (!entry.isDirectory())
|
|
8372
8387
|
continue;
|
|
8373
|
-
const pluginPath =
|
|
8388
|
+
const pluginPath = join3(dir, entry.name);
|
|
8374
8389
|
let name = entry.name;
|
|
8375
8390
|
let description = "";
|
|
8376
|
-
const metaFile =
|
|
8391
|
+
const metaFile = join3(pluginPath, ".claude-plugin", "plugin.json");
|
|
8377
8392
|
if (existsSync2(metaFile)) {
|
|
8378
8393
|
try {
|
|
8379
8394
|
const meta = JSON.parse(readFileSync2(metaFile, "utf-8"));
|
|
@@ -8385,7 +8400,7 @@ function scanPluginDir(baseDir, category, enabledPlugins) {
|
|
|
8385
8400
|
console.error(source_default.yellow(`Warning: Could not parse plugin metadata for ${entry.name}`));
|
|
8386
8401
|
}
|
|
8387
8402
|
}
|
|
8388
|
-
const mcpFile =
|
|
8403
|
+
const mcpFile = join3(pluginPath, ".mcp.json");
|
|
8389
8404
|
const hasMcp = existsSync2(mcpFile);
|
|
8390
8405
|
let mcpServerNames;
|
|
8391
8406
|
if (hasMcp) {
|
|
@@ -8409,7 +8424,7 @@ function scanPluginDir(baseDir, category, enabledPlugins) {
|
|
|
8409
8424
|
}
|
|
8410
8425
|
function scanPluginsFromDir(baseDir) {
|
|
8411
8426
|
let enabledPlugins = {};
|
|
8412
|
-
const settingsFile =
|
|
8427
|
+
const settingsFile = join3(baseDir, "settings.json");
|
|
8413
8428
|
if (existsSync2(settingsFile)) {
|
|
8414
8429
|
try {
|
|
8415
8430
|
const s = JSON.parse(readFileSync2(settingsFile, "utf-8"));
|
|
@@ -8430,7 +8445,7 @@ function listInstancePlugins(configDir) {
|
|
|
8430
8445
|
return scanPluginsFromDir(configDir);
|
|
8431
8446
|
}
|
|
8432
8447
|
function isPluginsSymlinked(configDir) {
|
|
8433
|
-
const pluginsPath =
|
|
8448
|
+
const pluginsPath = join3(configDir, "plugins");
|
|
8434
8449
|
const st = lstatSafe(pluginsPath);
|
|
8435
8450
|
return st?.isSymbolicLink() ?? false;
|
|
8436
8451
|
}
|
|
@@ -8446,7 +8461,7 @@ function isClaudeCodeRunning(configDir) {
|
|
|
8446
8461
|
}
|
|
8447
8462
|
}
|
|
8448
8463
|
function readInstalledPlugins(pluginsDir) {
|
|
8449
|
-
const filePath =
|
|
8464
|
+
const filePath = join3(pluginsDir, "installed_plugins.json");
|
|
8450
8465
|
if (!existsSync2(filePath)) {
|
|
8451
8466
|
return { version: 2, plugins: {} };
|
|
8452
8467
|
}
|
|
@@ -8457,16 +8472,16 @@ function readInstalledPlugins(pluginsDir) {
|
|
|
8457
8472
|
}
|
|
8458
8473
|
}
|
|
8459
8474
|
async function writeInstalledPlugins(pluginsDir, data) {
|
|
8460
|
-
await writeJsonFileAtomic(
|
|
8475
|
+
await writeJsonFileAtomic(join3(pluginsDir, "installed_plugins.json"), data);
|
|
8461
8476
|
}
|
|
8462
8477
|
async function addPluginToInstalledPlugins(configDir, pluginId) {
|
|
8463
|
-
const pluginsDir =
|
|
8478
|
+
const pluginsDir = join3(configDir, "plugins");
|
|
8464
8479
|
const data = readInstalledPlugins(pluginsDir);
|
|
8465
8480
|
const key = `${pluginId}@claude-plugins-official`;
|
|
8466
8481
|
if (!data.plugins[key]) {
|
|
8467
8482
|
data.plugins[key] = [];
|
|
8468
8483
|
}
|
|
8469
|
-
const cachePath =
|
|
8484
|
+
const cachePath = join3(configDir, MARKETPLACE_REL);
|
|
8470
8485
|
const entry = {
|
|
8471
8486
|
scope: "user",
|
|
8472
8487
|
installPath: cachePath,
|
|
@@ -8478,7 +8493,7 @@ async function addPluginToInstalledPlugins(configDir, pluginId) {
|
|
|
8478
8493
|
await writeInstalledPlugins(pluginsDir, data);
|
|
8479
8494
|
}
|
|
8480
8495
|
async function removePluginFromInstalledPlugins(configDir, pluginId) {
|
|
8481
|
-
const pluginsDir =
|
|
8496
|
+
const pluginsDir = join3(configDir, "plugins");
|
|
8482
8497
|
const data = readInstalledPlugins(pluginsDir);
|
|
8483
8498
|
const key = `${pluginId}@claude-plugins-official`;
|
|
8484
8499
|
delete data.plugins[key];
|
|
@@ -8488,7 +8503,7 @@ function estimatePluginSize(pluginPath) {
|
|
|
8488
8503
|
let total = 0;
|
|
8489
8504
|
try {
|
|
8490
8505
|
for (const entry of readdirSync2(pluginPath, { withFileTypes: true })) {
|
|
8491
|
-
const fullPath =
|
|
8506
|
+
const fullPath = join3(pluginPath, entry.name);
|
|
8492
8507
|
if (entry.isDirectory()) {
|
|
8493
8508
|
total += estimatePluginSize(fullPath);
|
|
8494
8509
|
} else {
|
|
@@ -8506,7 +8521,7 @@ function detectMcpCollisions(configDir, newPluginIds) {
|
|
|
8506
8521
|
const defaultDir = getDefaultClaudeDir();
|
|
8507
8522
|
for (const pluginId of newPluginIds) {
|
|
8508
8523
|
for (const subDir of ["plugins", "external_plugins"]) {
|
|
8509
|
-
const mcpFile =
|
|
8524
|
+
const mcpFile = join3(defaultDir, MARKETPLACE_REL, subDir, pluginId, ".mcp.json");
|
|
8510
8525
|
if (!existsSync2(mcpFile))
|
|
8511
8526
|
continue;
|
|
8512
8527
|
const newServers = readMcpJsonFile(mcpFile);
|
|
@@ -8555,22 +8570,22 @@ function validatePluginOperation(configDir, operation, pluginId) {
|
|
|
8555
8570
|
async function copySinglePlugin(targetConfigDir, pluginId, category) {
|
|
8556
8571
|
const defaultDir = getDefaultClaudeDir();
|
|
8557
8572
|
const subDir = category === PluginCategory.Internal ? "plugins" : "external_plugins";
|
|
8558
|
-
const sourcePlugin =
|
|
8559
|
-
const targetPlugin =
|
|
8573
|
+
const sourcePlugin = join3(defaultDir, MARKETPLACE_REL, subDir, pluginId);
|
|
8574
|
+
const targetPlugin = join3(targetConfigDir, MARKETPLACE_REL, subDir, pluginId);
|
|
8560
8575
|
if (!existsSync2(sourcePlugin)) {
|
|
8561
8576
|
throw new ClaudeMultiError(ErrorCode.PLUGIN_NOT_FOUND, `Plugin '${pluginId}' not found in default Claude`);
|
|
8562
8577
|
}
|
|
8563
|
-
const scaffoldDir =
|
|
8578
|
+
const scaffoldDir = join3(targetConfigDir, MARKETPLACE_REL, subDir);
|
|
8564
8579
|
if (!existsSync2(scaffoldDir)) {
|
|
8565
8580
|
await mkdir(scaffoldDir, { recursive: true });
|
|
8566
8581
|
}
|
|
8567
|
-
const marketplaceDir =
|
|
8582
|
+
const marketplaceDir = join3(targetConfigDir, MARKETPLACE_REL);
|
|
8568
8583
|
if (!existsSync2(marketplaceDir)) {
|
|
8569
8584
|
await mkdir(marketplaceDir, { recursive: true });
|
|
8570
8585
|
}
|
|
8571
8586
|
for (const metaFile of ["known_marketplaces.json", "blocklist.json"]) {
|
|
8572
|
-
const src =
|
|
8573
|
-
const tgt =
|
|
8587
|
+
const src = join3(defaultDir, MARKETPLACE_REL, metaFile);
|
|
8588
|
+
const tgt = join3(marketplaceDir, metaFile);
|
|
8574
8589
|
if (existsSync2(src) && !existsSync2(tgt)) {
|
|
8575
8590
|
await copyFile(src, tgt);
|
|
8576
8591
|
}
|
|
@@ -8594,7 +8609,7 @@ async function copySelectedPlugins(targetConfigDir, selections) {
|
|
|
8594
8609
|
const defaultDir = getDefaultClaudeDir();
|
|
8595
8610
|
for (const sel of selections) {
|
|
8596
8611
|
const subDir = sel.category === PluginCategory.Internal ? "plugins" : "external_plugins";
|
|
8597
|
-
const source =
|
|
8612
|
+
const source = join3(defaultDir, MARKETPLACE_REL, subDir, sel.id);
|
|
8598
8613
|
if (!existsSync2(source)) {
|
|
8599
8614
|
throw new ClaudeMultiError(ErrorCode.PLUGIN_NOT_FOUND, `Plugin '${sel.id}' not found in default Claude`);
|
|
8600
8615
|
}
|
|
@@ -8602,7 +8617,7 @@ async function copySelectedPlugins(targetConfigDir, selections) {
|
|
|
8602
8617
|
let totalSize = 0;
|
|
8603
8618
|
for (const sel of selections) {
|
|
8604
8619
|
const subDir = sel.category === PluginCategory.Internal ? "plugins" : "external_plugins";
|
|
8605
|
-
totalSize += estimatePluginSize(
|
|
8620
|
+
totalSize += estimatePluginSize(join3(defaultDir, MARKETPLACE_REL, subDir, sel.id));
|
|
8606
8621
|
}
|
|
8607
8622
|
if (totalSize > 104857600) {
|
|
8608
8623
|
throw new ClaudeMultiError(ErrorCode.PLUGIN_TOO_LARGE, `Selected plugins total ${(totalSize / 1024 / 1024).toFixed(1)}MB. Ensure sufficient disk space.`);
|
|
@@ -8617,7 +8632,7 @@ async function copySelectedPlugins(targetConfigDir, selections) {
|
|
|
8617
8632
|
for (const done of completed) {
|
|
8618
8633
|
try {
|
|
8619
8634
|
const subDir = done.category === PluginCategory.Internal ? "plugins" : "external_plugins";
|
|
8620
|
-
const targetPath =
|
|
8635
|
+
const targetPath = join3(targetConfigDir, MARKETPLACE_REL, subDir, done.id);
|
|
8621
8636
|
if (existsSync2(targetPath)) {
|
|
8622
8637
|
rmSync2(targetPath, { force: true, recursive: true });
|
|
8623
8638
|
}
|
|
@@ -8634,7 +8649,7 @@ async function removeSinglePlugin(configDir, pluginId, category) {
|
|
|
8634
8649
|
throw new ClaudeMultiError(ErrorCode.SYMLINK_CONFLICT, "Cannot remove plugins from a symlinked instance. Disable auto-sync first.");
|
|
8635
8650
|
}
|
|
8636
8651
|
const subDir = category === PluginCategory.Internal ? "plugins" : "external_plugins";
|
|
8637
|
-
const pluginPath =
|
|
8652
|
+
const pluginPath = join3(configDir, MARKETPLACE_REL, subDir, pluginId);
|
|
8638
8653
|
if (!existsSync2(pluginPath)) {
|
|
8639
8654
|
throw new ClaudeMultiError(ErrorCode.PLUGIN_NOT_FOUND, `Plugin '${pluginId}' not found in this instance`);
|
|
8640
8655
|
}
|
|
@@ -8658,15 +8673,15 @@ async function removeSinglePlugin(configDir, pluginId, category) {
|
|
|
8658
8673
|
}
|
|
8659
8674
|
function getMcpServersFromPlugins(configDir) {
|
|
8660
8675
|
const result = {};
|
|
8661
|
-
const basePlugins =
|
|
8676
|
+
const basePlugins = join3(configDir, MARKETPLACE_REL);
|
|
8662
8677
|
for (const subDir of ["plugins", "external_plugins"]) {
|
|
8663
|
-
const dir =
|
|
8678
|
+
const dir = join3(basePlugins, subDir);
|
|
8664
8679
|
if (!existsSync2(dir))
|
|
8665
8680
|
continue;
|
|
8666
8681
|
for (const entry of readdirSync2(dir, { withFileTypes: true })) {
|
|
8667
8682
|
if (!entry.isDirectory())
|
|
8668
8683
|
continue;
|
|
8669
|
-
const mcpFile =
|
|
8684
|
+
const mcpFile = join3(dir, entry.name, ".mcp.json");
|
|
8670
8685
|
if (!existsSync2(mcpFile))
|
|
8671
8686
|
continue;
|
|
8672
8687
|
const servers = readMcpJsonFile(mcpFile);
|
|
@@ -8732,6 +8747,17 @@ import { writeFile as writeFile3 } from "node:fs/promises";
|
|
|
8732
8747
|
import { resolve as resolve2, dirname as dirname3 } from "node:path";
|
|
8733
8748
|
import { execSync } from "node:child_process";
|
|
8734
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
|
+
}
|
|
8735
8761
|
try {
|
|
8736
8762
|
const command = process.platform === "win32" ? "where claude" : "which claude";
|
|
8737
8763
|
const claudePath = execSync(command, { encoding: "utf-8" }).trim();
|
|
@@ -8810,6 +8836,1999 @@ function getDefaultBinaryPath(name) {
|
|
|
8810
8836
|
}
|
|
8811
8837
|
var init_wrapper = __esm(() => {
|
|
8812
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);
|
|
8813
10832
|
});
|
|
8814
10833
|
|
|
8815
10834
|
// node_modules/react/cjs/react.development.js
|
|
@@ -10231,7 +12250,7 @@ var require_react_reconciler_constants_development = __commonJS((exports) => {
|
|
|
10231
12250
|
});
|
|
10232
12251
|
|
|
10233
12252
|
// node_modules/react-reconciler/constants.js
|
|
10234
|
-
var
|
|
12253
|
+
var require_constants2 = __commonJS((exports, module) => {
|
|
10235
12254
|
if (false) {} else {
|
|
10236
12255
|
module.exports = require_react_reconciler_constants_development();
|
|
10237
12256
|
}
|
|
@@ -25211,7 +27230,7 @@ var init_styles = __esm(async () => {
|
|
|
25211
27230
|
});
|
|
25212
27231
|
|
|
25213
27232
|
// node_modules/ws/lib/constants.js
|
|
25214
|
-
var
|
|
27233
|
+
var require_constants3 = __commonJS((exports, module) => {
|
|
25215
27234
|
var BINARY_TYPES = ["nodebuffer", "arraybuffer", "fragments"];
|
|
25216
27235
|
var hasBlob = typeof Blob !== "undefined";
|
|
25217
27236
|
if (hasBlob)
|
|
@@ -25232,7 +27251,7 @@ var require_constants2 = __commonJS((exports, module) => {
|
|
|
25232
27251
|
|
|
25233
27252
|
// node_modules/ws/lib/buffer-util.js
|
|
25234
27253
|
var require_buffer_util = __commonJS((exports, module) => {
|
|
25235
|
-
var { EMPTY_BUFFER } =
|
|
27254
|
+
var { EMPTY_BUFFER } = require_constants3();
|
|
25236
27255
|
var FastBuffer = Buffer[Symbol.species];
|
|
25237
27256
|
function concat2(list, totalLength) {
|
|
25238
27257
|
if (list.length === 0)
|
|
@@ -25345,7 +27364,7 @@ var require_permessage_deflate = __commonJS((exports, module) => {
|
|
|
25345
27364
|
var zlib = __require("zlib");
|
|
25346
27365
|
var bufferUtil = require_buffer_util();
|
|
25347
27366
|
var Limiter = require_limiter();
|
|
25348
|
-
var { kStatusCode } =
|
|
27367
|
+
var { kStatusCode } = require_constants3();
|
|
25349
27368
|
var FastBuffer = Buffer[Symbol.species];
|
|
25350
27369
|
var TRAILER = Buffer.from([0, 0, 255, 255]);
|
|
25351
27370
|
var kPerMessageDeflate = Symbol("permessage-deflate");
|
|
@@ -25607,7 +27626,7 @@ var require_permessage_deflate = __commonJS((exports, module) => {
|
|
|
25607
27626
|
// node_modules/ws/lib/validation.js
|
|
25608
27627
|
var require_validation = __commonJS((exports, module) => {
|
|
25609
27628
|
var { isUtf8 } = __require("buffer");
|
|
25610
|
-
var { hasBlob } =
|
|
27629
|
+
var { hasBlob } = require_constants3();
|
|
25611
27630
|
var tokenChars = [
|
|
25612
27631
|
0,
|
|
25613
27632
|
0,
|
|
@@ -25800,7 +27819,7 @@ var require_receiver = __commonJS((exports, module) => {
|
|
|
25800
27819
|
EMPTY_BUFFER,
|
|
25801
27820
|
kStatusCode,
|
|
25802
27821
|
kWebSocket
|
|
25803
|
-
} =
|
|
27822
|
+
} = require_constants3();
|
|
25804
27823
|
var { concat: concat2, toArrayBuffer, unmask } = require_buffer_util();
|
|
25805
27824
|
var { isValidStatusCode, isValidUTF8 } = require_validation();
|
|
25806
27825
|
var FastBuffer = Buffer[Symbol.species];
|
|
@@ -26180,7 +28199,7 @@ var require_sender = __commonJS((exports, module) => {
|
|
|
26180
28199
|
types: { isUint8Array }
|
|
26181
28200
|
} = __require("util");
|
|
26182
28201
|
var PerMessageDeflate = require_permessage_deflate();
|
|
26183
|
-
var { EMPTY_BUFFER, kWebSocket, NOOP } =
|
|
28202
|
+
var { EMPTY_BUFFER, kWebSocket, NOOP } = require_constants3();
|
|
26184
28203
|
var { isBlob, isValidStatusCode } = require_validation();
|
|
26185
28204
|
var { mask: applyMask, toBuffer } = require_buffer_util();
|
|
26186
28205
|
var kByteLength = Symbol("kByteLength");
|
|
@@ -26533,7 +28552,7 @@ var require_sender = __commonJS((exports, module) => {
|
|
|
26533
28552
|
|
|
26534
28553
|
// node_modules/ws/lib/event-target.js
|
|
26535
28554
|
var require_event_target = __commonJS((exports, module) => {
|
|
26536
|
-
var { kForOnEventAttribute, kListener } =
|
|
28555
|
+
var { kForOnEventAttribute, kListener } = require_constants3();
|
|
26537
28556
|
var kCode = Symbol("kCode");
|
|
26538
28557
|
var kData = Symbol("kData");
|
|
26539
28558
|
var kError = Symbol("kError");
|
|
@@ -26871,7 +28890,7 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
26871
28890
|
kStatusCode,
|
|
26872
28891
|
kWebSocket,
|
|
26873
28892
|
NOOP
|
|
26874
|
-
} =
|
|
28893
|
+
} = require_constants3();
|
|
26875
28894
|
var {
|
|
26876
28895
|
EventTarget: { addEventListener, removeEventListener }
|
|
26877
28896
|
} = require_event_target();
|
|
@@ -27771,7 +29790,7 @@ var require_websocket_server = __commonJS((exports, module) => {
|
|
|
27771
29790
|
var PerMessageDeflate = require_permessage_deflate();
|
|
27772
29791
|
var subprotocol = require_subprotocol();
|
|
27773
29792
|
var WebSocket = require_websocket();
|
|
27774
|
-
var { CLOSE_TIMEOUT, GUID, kWebSocket } =
|
|
29793
|
+
var { CLOSE_TIMEOUT, GUID, kWebSocket } = require_constants3();
|
|
27775
29794
|
var keyRegex = /^[+/0-9A-Za-z]{22}==$/;
|
|
27776
29795
|
var RUNNING = 0;
|
|
27777
29796
|
var CLOSING = 1;
|
|
@@ -31071,7 +33090,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
31071
33090
|
if (Array.isArray(arr))
|
|
31072
33091
|
return arr;
|
|
31073
33092
|
}
|
|
31074
|
-
var
|
|
33093
|
+
var compareVersions2 = function compareVersions3(v1, v2) {
|
|
31075
33094
|
var n1 = validateAndParse(v1);
|
|
31076
33095
|
var n2 = validateAndParse(v2);
|
|
31077
33096
|
var p1 = n1.pop();
|
|
@@ -31087,11 +33106,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
31087
33106
|
return 0;
|
|
31088
33107
|
};
|
|
31089
33108
|
var validate2 = function validate3(version) {
|
|
31090
|
-
return typeof version === "string" && /^[v\d]/.test(version) &&
|
|
33109
|
+
return typeof version === "string" && /^[v\d]/.test(version) && semver2.test(version);
|
|
31091
33110
|
};
|
|
31092
33111
|
var compare = function compare2(v1, v2, operator) {
|
|
31093
33112
|
assertValidOperator(operator);
|
|
31094
|
-
var res =
|
|
33113
|
+
var res = compareVersions2(v1, v2);
|
|
31095
33114
|
return operatorResMap[operator].includes(res);
|
|
31096
33115
|
};
|
|
31097
33116
|
var satisfies = function satisfies2(version, range2) {
|
|
@@ -31121,12 +33140,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
31121
33140
|
return false;
|
|
31122
33141
|
return true;
|
|
31123
33142
|
};
|
|
31124
|
-
var
|
|
33143
|
+
var semver2 = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i;
|
|
31125
33144
|
var validateAndParse = function validateAndParse2(version) {
|
|
31126
33145
|
if (typeof version !== "string") {
|
|
31127
33146
|
throw new TypeError("Invalid argument expected string");
|
|
31128
33147
|
}
|
|
31129
|
-
var match = version.match(
|
|
33148
|
+
var match = version.match(semver2);
|
|
31130
33149
|
if (!match) {
|
|
31131
33150
|
throw new Error("Invalid argument not valid semver ('".concat(version, "' received)"));
|
|
31132
33151
|
}
|
|
@@ -33000,12 +35019,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
33000
35019
|
function gt2() {
|
|
33001
35020
|
var a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
33002
35021
|
var b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
33003
|
-
return
|
|
35022
|
+
return compareVersions2(a, b) === 1;
|
|
33004
35023
|
}
|
|
33005
35024
|
function gte2() {
|
|
33006
35025
|
var a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
33007
35026
|
var b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
33008
|
-
return
|
|
35027
|
+
return compareVersions2(a, b) > -1;
|
|
33009
35028
|
}
|
|
33010
35029
|
var isReactNativeEnvironment = function isReactNativeEnvironment2() {
|
|
33011
35030
|
return window.document == null;
|
|
@@ -45010,7 +47029,7 @@ var init_reconciler = __esm(async () => {
|
|
|
45010
47029
|
init_styles()
|
|
45011
47030
|
]);
|
|
45012
47031
|
import_react_reconciler = __toESM(require_react_reconciler(), 1);
|
|
45013
|
-
import_constants3 = __toESM(
|
|
47032
|
+
import_constants3 = __toESM(require_constants2(), 1);
|
|
45014
47033
|
Scheduler = __toESM(require_scheduler(), 1);
|
|
45015
47034
|
import_react = __toESM(require_react(), 1);
|
|
45016
47035
|
if (process5.env["DEV"] === "true") {
|
|
@@ -48640,7 +50659,7 @@ var init_ink = __esm(async () => {
|
|
|
48640
50659
|
]);
|
|
48641
50660
|
import_react16 = __toESM(require_react(), 1);
|
|
48642
50661
|
import_signal_exit2 = __toESM(require_signal_exit(), 1);
|
|
48643
|
-
import_constants4 = __toESM(
|
|
50662
|
+
import_constants4 = __toESM(require_constants2(), 1);
|
|
48644
50663
|
textEncoder = new TextEncoder;
|
|
48645
50664
|
});
|
|
48646
50665
|
|
|
@@ -48754,7 +50773,7 @@ var init_render_to_string = __esm(async () => {
|
|
|
48754
50773
|
init_renderer(),
|
|
48755
50774
|
init_dom()
|
|
48756
50775
|
]);
|
|
48757
|
-
import_constants5 = __toESM(
|
|
50776
|
+
import_constants5 = __toESM(require_constants2(), 1);
|
|
48758
50777
|
render_to_string_default = renderToString;
|
|
48759
50778
|
});
|
|
48760
50779
|
|
|
@@ -53732,7 +55751,7 @@ var init_StatusBar = __esm(async () => {
|
|
|
53732
55751
|
});
|
|
53733
55752
|
|
|
53734
55753
|
// src/ink/hooks/useNavigation.tsx
|
|
53735
|
-
function
|
|
55754
|
+
function useNavigation2(onBack) {
|
|
53736
55755
|
const { exit } = use_app_default();
|
|
53737
55756
|
use_input_default((input, key) => {
|
|
53738
55757
|
if (key.escape) {
|
|
@@ -53869,10 +55888,40 @@ var exports_AddInstance = {};
|
|
|
53869
55888
|
__export(exports_AddInstance, {
|
|
53870
55889
|
AddInstance: () => AddInstance
|
|
53871
55890
|
});
|
|
53872
|
-
import { join as
|
|
55891
|
+
import { join as join6 } from "node:path";
|
|
53873
55892
|
import { homedir as homedir3 } from "node:os";
|
|
53874
55893
|
function stepNumber(step) {
|
|
53875
|
-
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;
|
|
53876
55925
|
}
|
|
53877
55926
|
var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
53878
55927
|
name,
|
|
@@ -53931,10 +55980,10 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
53931
55980
|
}, undefined, true, undefined, this)
|
|
53932
55981
|
]
|
|
53933
55982
|
}, undefined, true, undefined, this);
|
|
53934
|
-
}, STEP_TITLES,
|
|
55983
|
+
}, STEP_TITLES, STEP_FLOW, AddInstance = ({ onBack, initialName }) => {
|
|
53935
55984
|
const { exit } = use_app_default();
|
|
53936
55985
|
const cfg = useConfig();
|
|
53937
|
-
const [step, setStep] = import_react67.useState(initialName ? "provider-select" : "name");
|
|
55986
|
+
const [step, setStep] = import_react67.useState(initialName ? "provider-select" /* ProviderSelect */ : "name" /* Name */);
|
|
53938
55987
|
const [name, setName] = import_react67.useState(initialName ?? "");
|
|
53939
55988
|
const [error, setError] = import_react67.useState("");
|
|
53940
55989
|
const [useProvider, setUseProvider] = import_react67.useState(false);
|
|
@@ -53946,34 +55995,41 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
53946
55995
|
const [selectedPluginIds, setSelectedPluginIds] = import_react67.useState([]);
|
|
53947
55996
|
const [result2, setResult] = import_react67.useState(null);
|
|
53948
55997
|
const defaultPlugins = import_react67.useMemo(() => cfg.listDefaultPlugins(), [cfg]);
|
|
53949
|
-
|
|
53950
|
-
|
|
53951
|
-
|
|
53952
|
-
|
|
53953
|
-
|
|
53954
|
-
|
|
53955
|
-
|
|
53956
|
-
|
|
53957
|
-
exit();
|
|
53958
|
-
});
|
|
53959
|
-
const goBack = import_react67.useCallback(() => {
|
|
53960
|
-
const prevMap = {
|
|
53961
|
-
"provider-select": "name",
|
|
53962
|
-
"provider-region": "provider-select",
|
|
53963
|
-
"provider-apikey": "provider-region",
|
|
53964
|
-
"paths-confirm": "provider-select",
|
|
53965
|
-
"copy-options": "paths-confirm",
|
|
53966
|
-
"select-plugins": "copy-options",
|
|
53967
|
-
autosync: "copy-options"
|
|
53968
|
-
};
|
|
53969
|
-
const prev = prevMap[step];
|
|
53970
|
-
if (prev) {
|
|
53971
|
-
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);
|
|
53972
56006
|
setError("");
|
|
53973
56007
|
} else {
|
|
53974
56008
|
onBack();
|
|
53975
56009
|
}
|
|
53976
|
-
}, [
|
|
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
|
+
});
|
|
53977
56033
|
const handleNameSubmit = import_react67.useCallback((value) => {
|
|
53978
56034
|
if (!value.trim()) {
|
|
53979
56035
|
setError("Name is required");
|
|
@@ -53985,26 +56041,22 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
53985
56041
|
}
|
|
53986
56042
|
setError("");
|
|
53987
56043
|
setName(value);
|
|
53988
|
-
setStep("provider-select");
|
|
56044
|
+
setStep("provider-select" /* ProviderSelect */);
|
|
53989
56045
|
}, []);
|
|
53990
56046
|
const handleProviderSelect = import_react67.useCallback((value) => {
|
|
53991
56047
|
if (value === CopyOption.None) {
|
|
53992
56048
|
setUseProvider(false);
|
|
53993
56049
|
setSelectedProvider(null);
|
|
53994
|
-
setStep("paths-confirm");
|
|
56050
|
+
setStep("paths-confirm" /* PathsConfirm */);
|
|
53995
56051
|
return;
|
|
53996
56052
|
}
|
|
53997
56053
|
setUseProvider(true);
|
|
53998
56054
|
setSelectedProvider(value);
|
|
53999
|
-
|
|
54000
|
-
setStep("provider-region");
|
|
54001
|
-
} else {
|
|
54002
|
-
setStep("provider-apikey");
|
|
54003
|
-
}
|
|
56055
|
+
setStep(providerHasRegions(value) ? "provider-region" /* ProviderRegion */ : "provider-apikey" /* ProviderApiKey */);
|
|
54004
56056
|
}, []);
|
|
54005
56057
|
const handleRegionSelect = import_react67.useCallback((value) => {
|
|
54006
56058
|
setSelectedRegion(value);
|
|
54007
|
-
setStep("provider-apikey");
|
|
56059
|
+
setStep("provider-apikey" /* ProviderApiKey */);
|
|
54008
56060
|
}, []);
|
|
54009
56061
|
const handleApiKeySubmit = import_react67.useCallback((value) => {
|
|
54010
56062
|
if (!value.trim()) {
|
|
@@ -54013,17 +56065,17 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54013
56065
|
}
|
|
54014
56066
|
setError("");
|
|
54015
56067
|
setApiKey(value);
|
|
54016
|
-
setStep("paths-confirm");
|
|
56068
|
+
setStep("paths-confirm" /* PathsConfirm */);
|
|
54017
56069
|
}, []);
|
|
54018
56070
|
const handleDefaultsConfirm = import_react67.useCallback((_confirmed) => {
|
|
54019
|
-
setStep("copy-options");
|
|
56071
|
+
setStep("copy-options" /* CopyOptions */);
|
|
54020
56072
|
}, []);
|
|
54021
56073
|
const handleCopyOption = import_react67.useCallback((value) => {
|
|
54022
56074
|
setCopyOption(value);
|
|
54023
56075
|
if (value === CopyOption.SelectPlugins) {
|
|
54024
|
-
setStep("select-plugins");
|
|
56076
|
+
setStep("select-plugins" /* SelectPlugins */);
|
|
54025
56077
|
} else if (value === CopyOption.All) {
|
|
54026
|
-
setStep("autosync");
|
|
56078
|
+
setStep("autosync" /* Autosync */);
|
|
54027
56079
|
} else {
|
|
54028
56080
|
doCreate(value, false);
|
|
54029
56081
|
}
|
|
@@ -54035,17 +56087,17 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54035
56087
|
}
|
|
54036
56088
|
setSelectedPluginIds(ids);
|
|
54037
56089
|
setError("");
|
|
54038
|
-
setStep("autosync");
|
|
56090
|
+
setStep("autosync" /* Autosync */);
|
|
54039
56091
|
}, []);
|
|
54040
56092
|
const handleAutoSyncConfirm = import_react67.useCallback((confirmed) => {
|
|
54041
56093
|
setAutoSync(confirmed);
|
|
54042
56094
|
doCreate(copyOption, confirmed);
|
|
54043
56095
|
}, [copyOption, selectedPluginIds]);
|
|
54044
56096
|
const doCreate = async (copyOpt, sync) => {
|
|
54045
|
-
setStep("creating");
|
|
56097
|
+
setStep("creating" /* Creating */);
|
|
54046
56098
|
setError("");
|
|
54047
56099
|
try {
|
|
54048
|
-
const cDir =
|
|
56100
|
+
const cDir = join6(homedir3(), `.claude-${name}`);
|
|
54049
56101
|
const bPath = cfg.getDefaultBinaryPath(name);
|
|
54050
56102
|
const instance = {
|
|
54051
56103
|
name,
|
|
@@ -54080,12 +56132,12 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54080
56132
|
await cfg.mergeProviderEnv(cDir, template2, apiKey);
|
|
54081
56133
|
}
|
|
54082
56134
|
setResult({ configDir: cDir, binaryPath: bPath });
|
|
54083
|
-
setStep("done");
|
|
56135
|
+
setStep("done" /* Done */);
|
|
54084
56136
|
} catch (err) {
|
|
54085
56137
|
await removeInstance(name).catch(() => {});
|
|
54086
56138
|
removeWrapper(cfg.getDefaultBinaryPath(name));
|
|
54087
56139
|
setError(err instanceof Error ? err.message : String(err));
|
|
54088
|
-
setStep("name");
|
|
56140
|
+
setStep("name" /* Name */);
|
|
54089
56141
|
}
|
|
54090
56142
|
};
|
|
54091
56143
|
const hasDefaultConfig = cfg.hasDefaultConfig();
|
|
@@ -54117,14 +56169,14 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54117
56169
|
}, undefined, false, undefined, this),
|
|
54118
56170
|
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(StepIndicator, {
|
|
54119
56171
|
current: stepNumber(step),
|
|
54120
|
-
total:
|
|
56172
|
+
total: getVisibleStepCount(wizardState),
|
|
54121
56173
|
label: STEP_TITLES[step]
|
|
54122
56174
|
}, undefined, false, undefined, this),
|
|
54123
56175
|
error && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(StatusBar, {
|
|
54124
56176
|
message: error,
|
|
54125
56177
|
type: "error"
|
|
54126
56178
|
}, undefined, false, undefined, this),
|
|
54127
|
-
step === "name" && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
56179
|
+
step === "name" /* Name */ && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
54128
56180
|
flexDirection: "column",
|
|
54129
56181
|
gap: 1,
|
|
54130
56182
|
children: [
|
|
@@ -54137,11 +56189,12 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54137
56189
|
}, undefined, false, undefined, this),
|
|
54138
56190
|
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(TextInput, {
|
|
54139
56191
|
placeholder: "my-instance",
|
|
56192
|
+
defaultValue: name,
|
|
54140
56193
|
onSubmit: handleNameSubmit
|
|
54141
56194
|
}, undefined, false, undefined, this)
|
|
54142
56195
|
]
|
|
54143
56196
|
}, undefined, true, undefined, this),
|
|
54144
|
-
step === "provider-select" && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
56197
|
+
step === "provider-select" /* ProviderSelect */ && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
54145
56198
|
flexDirection: "column",
|
|
54146
56199
|
gap: 1,
|
|
54147
56200
|
children: [
|
|
@@ -54151,11 +56204,12 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54151
56204
|
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Select, {
|
|
54152
56205
|
options: providerOptions,
|
|
54153
56206
|
visibleOptionCount: providerOptions.length,
|
|
56207
|
+
defaultValue: selectedProvider ?? undefined,
|
|
54154
56208
|
onChange: handleProviderSelect
|
|
54155
56209
|
}, undefined, false, undefined, this)
|
|
54156
56210
|
]
|
|
54157
56211
|
}, undefined, true, undefined, this),
|
|
54158
|
-
step === "provider-region" && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
56212
|
+
step === "provider-region" /* ProviderRegion */ && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
54159
56213
|
flexDirection: "column",
|
|
54160
56214
|
gap: 1,
|
|
54161
56215
|
children: [
|
|
@@ -54178,11 +56232,12 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54178
56232
|
value: key
|
|
54179
56233
|
})),
|
|
54180
56234
|
visibleOptionCount: 3,
|
|
56235
|
+
defaultValue: selectedRegion ?? undefined,
|
|
54181
56236
|
onChange: handleRegionSelect
|
|
54182
56237
|
}, undefined, false, undefined, this)
|
|
54183
56238
|
]
|
|
54184
56239
|
}, undefined, true, undefined, this),
|
|
54185
|
-
step === "provider-apikey" && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
56240
|
+
step === "provider-apikey" /* ProviderApiKey */ && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
54186
56241
|
flexDirection: "column",
|
|
54187
56242
|
gap: 1,
|
|
54188
56243
|
children: [
|
|
@@ -54199,7 +56254,7 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54199
56254
|
}, undefined, false, undefined, this)
|
|
54200
56255
|
]
|
|
54201
56256
|
}, undefined, true, undefined, this),
|
|
54202
|
-
step === "paths-confirm" && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
56257
|
+
step === "paths-confirm" /* PathsConfirm */ && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
54203
56258
|
flexDirection: "column",
|
|
54204
56259
|
gap: 1,
|
|
54205
56260
|
children: [
|
|
@@ -54210,7 +56265,7 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54210
56265
|
dimColor: true,
|
|
54211
56266
|
children: [
|
|
54212
56267
|
"Config: ",
|
|
54213
|
-
|
|
56268
|
+
join6(homedir3(), `.claude-${name}`)
|
|
54214
56269
|
]
|
|
54215
56270
|
}, undefined, true, undefined, this),
|
|
54216
56271
|
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
@@ -54226,7 +56281,7 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54226
56281
|
}, undefined, false, undefined, this)
|
|
54227
56282
|
]
|
|
54228
56283
|
}, undefined, true, undefined, this),
|
|
54229
|
-
step === "copy-options" && !hasDefaultConfig && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
56284
|
+
step === "copy-options" /* CopyOptions */ && !hasDefaultConfig && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
54230
56285
|
flexDirection: "column",
|
|
54231
56286
|
gap: 1,
|
|
54232
56287
|
children: [
|
|
@@ -54240,7 +56295,7 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54240
56295
|
}, undefined, false, undefined, this)
|
|
54241
56296
|
]
|
|
54242
56297
|
}, undefined, true, undefined, this),
|
|
54243
|
-
step === "copy-options" && hasDefaultConfig && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
56298
|
+
step === "copy-options" /* CopyOptions */ && hasDefaultConfig && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
54244
56299
|
flexDirection: "column",
|
|
54245
56300
|
gap: 1,
|
|
54246
56301
|
children: [
|
|
@@ -54257,7 +56312,7 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54257
56312
|
}, undefined, false, undefined, this)
|
|
54258
56313
|
]
|
|
54259
56314
|
}, undefined, true, undefined, this),
|
|
54260
|
-
step === "select-plugins" && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
56315
|
+
step === "select-plugins" /* SelectPlugins */ && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
54261
56316
|
flexDirection: "column",
|
|
54262
56317
|
gap: 1,
|
|
54263
56318
|
children: [
|
|
@@ -54278,7 +56333,7 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54278
56333
|
}, undefined, false, undefined, this)
|
|
54279
56334
|
]
|
|
54280
56335
|
}, undefined, true, undefined, this),
|
|
54281
|
-
step === "autosync" && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
56336
|
+
step === "autosync" /* Autosync */ && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
54282
56337
|
flexDirection: "column",
|
|
54283
56338
|
gap: 1,
|
|
54284
56339
|
children: [
|
|
@@ -54295,11 +56350,11 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54295
56350
|
}, undefined, false, undefined, this)
|
|
54296
56351
|
]
|
|
54297
56352
|
}, undefined, true, undefined, this),
|
|
54298
|
-
step === "creating" && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
56353
|
+
step === "creating" /* Creating */ && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
54299
56354
|
dimColor: true,
|
|
54300
56355
|
children: "Creating instance..."
|
|
54301
56356
|
}, undefined, false, undefined, this),
|
|
54302
|
-
step === "done" && result2 && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(AddResult, {
|
|
56357
|
+
step === "done" /* Done */ && result2 && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(AddResult, {
|
|
54303
56358
|
name,
|
|
54304
56359
|
binaryPath: result2.binaryPath,
|
|
54305
56360
|
configDir: result2.configDir
|
|
@@ -54308,7 +56363,7 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54308
56363
|
marginTop: 1,
|
|
54309
56364
|
children: /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
54310
56365
|
dimColor: true,
|
|
54311
|
-
children: "ESC back │ q quit"
|
|
56366
|
+
children: "Shift+← back │ Shift+→ next │ ESC back │ q quit"
|
|
54312
56367
|
}, undefined, false, undefined, this)
|
|
54313
56368
|
}, undefined, false, undefined, this)
|
|
54314
56369
|
]
|
|
@@ -54332,176 +56387,45 @@ var init_AddInstance = __esm(async () => {
|
|
|
54332
56387
|
import_react67 = __toESM(require_react(), 1);
|
|
54333
56388
|
jsx_dev_runtime4 = __toESM(require_jsx_dev_runtime(), 1);
|
|
54334
56389
|
STEP_TITLES = {
|
|
54335
|
-
name: "Instance Name",
|
|
54336
|
-
"provider-select": "Provider Template",
|
|
54337
|
-
"provider-region": "Region",
|
|
54338
|
-
"provider-apikey": "API Key",
|
|
54339
|
-
"paths-confirm": "Paths",
|
|
54340
|
-
"copy-options": "Copy Options",
|
|
54341
|
-
"select-plugins": "Select Plugins",
|
|
54342
|
-
autosync: "Auto-Sync",
|
|
54343
|
-
creating: "Creating...",
|
|
54344
|
-
done: "Complete"
|
|
54345
|
-
};
|
|
54346
|
-
|
|
54347
|
-
"name"
|
|
54348
|
-
"provider-select"
|
|
54349
|
-
"provider-region"
|
|
54350
|
-
"provider-apikey"
|
|
54351
|
-
"paths-confirm"
|
|
54352
|
-
"copy-options"
|
|
54353
|
-
"select-plugins"
|
|
54354
|
-
"autosync"
|
|
54355
|
-
"creating"
|
|
54356
|
-
"done"
|
|
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 */
|
|
54357
56412
|
];
|
|
54358
56413
|
});
|
|
54359
56414
|
|
|
54360
|
-
// src/ink/components/Footer.tsx
|
|
54361
|
-
var jsx_dev_runtime5, Footer = ({ showHealthHint }) => {
|
|
54362
|
-
const lineLen = 60;
|
|
54363
|
-
const lineProgress = useDrawLine(lineLen, 0, 4);
|
|
54364
|
-
const showHints = useFadeIn(100);
|
|
54365
|
-
return /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
54366
|
-
flexDirection: "column",
|
|
54367
|
-
width: "100",
|
|
54368
|
-
marginTop: 1,
|
|
54369
|
-
children: [
|
|
54370
|
-
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
54371
|
-
dimColor: true,
|
|
54372
|
-
children: "─".repeat(lineProgress)
|
|
54373
|
-
}, undefined, false, undefined, this),
|
|
54374
|
-
showHints && /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
54375
|
-
gap: 2,
|
|
54376
|
-
children: [
|
|
54377
|
-
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
54378
|
-
children: [
|
|
54379
|
-
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
54380
|
-
color: "gray",
|
|
54381
|
-
children: "↑↓"
|
|
54382
|
-
}, undefined, false, undefined, this),
|
|
54383
|
-
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
54384
|
-
dimColor: true,
|
|
54385
|
-
children: " navigate"
|
|
54386
|
-
}, undefined, false, undefined, this)
|
|
54387
|
-
]
|
|
54388
|
-
}, undefined, true, undefined, this),
|
|
54389
|
-
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
54390
|
-
children: [
|
|
54391
|
-
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
54392
|
-
color: "gray",
|
|
54393
|
-
children: "↵"
|
|
54394
|
-
}, undefined, false, undefined, this),
|
|
54395
|
-
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
54396
|
-
dimColor: true,
|
|
54397
|
-
children: " select"
|
|
54398
|
-
}, undefined, false, undefined, this)
|
|
54399
|
-
]
|
|
54400
|
-
}, undefined, true, undefined, this),
|
|
54401
|
-
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
54402
|
-
children: [
|
|
54403
|
-
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
54404
|
-
color: "gray",
|
|
54405
|
-
children: "esc"
|
|
54406
|
-
}, undefined, false, undefined, this),
|
|
54407
|
-
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
54408
|
-
dimColor: true,
|
|
54409
|
-
children: " back"
|
|
54410
|
-
}, undefined, false, undefined, this)
|
|
54411
|
-
]
|
|
54412
|
-
}, undefined, true, undefined, this),
|
|
54413
|
-
showHealthHint && /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
54414
|
-
children: [
|
|
54415
|
-
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
54416
|
-
color: "gray",
|
|
54417
|
-
children: "!"
|
|
54418
|
-
}, undefined, false, undefined, this),
|
|
54419
|
-
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
54420
|
-
dimColor: true,
|
|
54421
|
-
children: " health"
|
|
54422
|
-
}, undefined, false, undefined, this)
|
|
54423
|
-
]
|
|
54424
|
-
}, undefined, true, undefined, this),
|
|
54425
|
-
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
54426
|
-
children: [
|
|
54427
|
-
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
54428
|
-
color: "gray",
|
|
54429
|
-
children: "q"
|
|
54430
|
-
}, undefined, false, undefined, this),
|
|
54431
|
-
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
54432
|
-
dimColor: true,
|
|
54433
|
-
children: " quit"
|
|
54434
|
-
}, undefined, false, undefined, this)
|
|
54435
|
-
]
|
|
54436
|
-
}, undefined, true, undefined, this)
|
|
54437
|
-
]
|
|
54438
|
-
}, undefined, true, undefined, this)
|
|
54439
|
-
]
|
|
54440
|
-
}, undefined, true, undefined, this);
|
|
54441
|
-
};
|
|
54442
|
-
var init_Footer = __esm(async () => {
|
|
54443
|
-
init_useAnimations();
|
|
54444
|
-
await init_build2();
|
|
54445
|
-
jsx_dev_runtime5 = __toESM(require_jsx_dev_runtime(), 1);
|
|
54446
|
-
});
|
|
54447
|
-
|
|
54448
|
-
// src/ink/components/WarningBanner.tsx
|
|
54449
|
-
var jsx_dev_runtime6, WarningBanner = ({
|
|
54450
|
-
issueCount,
|
|
54451
|
-
errorCount,
|
|
54452
|
-
warningCount
|
|
54453
|
-
}) => {
|
|
54454
|
-
const visible = useFadeIn(200);
|
|
54455
|
-
const icon = usePulse(["⚠", "⚠", " "], 1000);
|
|
54456
|
-
if (!visible || issueCount === 0)
|
|
54457
|
-
return null;
|
|
54458
|
-
const parts = [];
|
|
54459
|
-
if (errorCount > 0)
|
|
54460
|
-
parts.push(`${errorCount} error${errorCount > 1 ? "s" : ""}`);
|
|
54461
|
-
if (warningCount > 0)
|
|
54462
|
-
parts.push(`${warningCount} warning${warningCount > 1 ? "s" : ""}`);
|
|
54463
|
-
return /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Box_default, {
|
|
54464
|
-
marginBottom: 1,
|
|
54465
|
-
children: [
|
|
54466
|
-
/* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
|
|
54467
|
-
color: "yellow",
|
|
54468
|
-
children: [
|
|
54469
|
-
icon,
|
|
54470
|
-
" "
|
|
54471
|
-
]
|
|
54472
|
-
}, undefined, true, undefined, this),
|
|
54473
|
-
/* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
|
|
54474
|
-
color: "yellow",
|
|
54475
|
-
bold: true,
|
|
54476
|
-
children: parts.join(", ")
|
|
54477
|
-
}, undefined, false, undefined, this),
|
|
54478
|
-
/* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
|
|
54479
|
-
color: "yellow",
|
|
54480
|
-
children: " — press "
|
|
54481
|
-
}, undefined, false, undefined, this),
|
|
54482
|
-
/* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
|
|
54483
|
-
color: "yellow",
|
|
54484
|
-
bold: true,
|
|
54485
|
-
children: "!"
|
|
54486
|
-
}, undefined, false, undefined, this),
|
|
54487
|
-
/* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
|
|
54488
|
-
color: "yellow",
|
|
54489
|
-
children: " to review"
|
|
54490
|
-
}, undefined, false, undefined, this)
|
|
54491
|
-
]
|
|
54492
|
-
}, undefined, true, undefined, this);
|
|
54493
|
-
};
|
|
54494
|
-
var init_WarningBanner = __esm(async () => {
|
|
54495
|
-
init_useAnimations();
|
|
54496
|
-
await init_build2();
|
|
54497
|
-
jsx_dev_runtime6 = __toESM(require_jsx_dev_runtime(), 1);
|
|
54498
|
-
});
|
|
54499
|
-
|
|
54500
56415
|
// src/health.ts
|
|
54501
|
-
|
|
54502
|
-
|
|
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";
|
|
54503
56427
|
function getHealthFile() {
|
|
54504
|
-
return
|
|
56428
|
+
return join7(getBaseDir(), ".claude-multi", "health-status.json");
|
|
54505
56429
|
}
|
|
54506
56430
|
function runHealthChecks(instances2, migrationStatus) {
|
|
54507
56431
|
const now2 = new Date().toISOString();
|
|
@@ -54522,7 +56446,7 @@ function runHealthChecks(instances2, migrationStatus) {
|
|
|
54522
56446
|
});
|
|
54523
56447
|
}
|
|
54524
56448
|
for (const inst of instances2) {
|
|
54525
|
-
if (!
|
|
56449
|
+
if (!existsSync6(inst.configDir)) {
|
|
54526
56450
|
issues.push({
|
|
54527
56451
|
id: `configdir-missing-${inst.name}`,
|
|
54528
56452
|
severity: "error",
|
|
@@ -54538,7 +56462,7 @@ function runHealthChecks(instances2, migrationStatus) {
|
|
|
54538
56462
|
});
|
|
54539
56463
|
continue;
|
|
54540
56464
|
}
|
|
54541
|
-
if (!
|
|
56465
|
+
if (!existsSync6(inst.binaryPath)) {
|
|
54542
56466
|
issues.push({
|
|
54543
56467
|
id: `binary-missing-${inst.name}`,
|
|
54544
56468
|
severity: "warning",
|
|
@@ -54553,8 +56477,8 @@ function runHealthChecks(instances2, migrationStatus) {
|
|
|
54553
56477
|
resolutionHint: "Re-create the instance or run 'claude-multi sync'"
|
|
54554
56478
|
});
|
|
54555
56479
|
}
|
|
54556
|
-
const settingsFile =
|
|
54557
|
-
if (
|
|
56480
|
+
const settingsFile = join7(inst.configDir, "settings.json");
|
|
56481
|
+
if (existsSync6(settingsFile)) {
|
|
54558
56482
|
try {
|
|
54559
56483
|
JSON.parse(readFileSync5(settingsFile, "utf-8"));
|
|
54560
56484
|
} catch {
|
|
@@ -54589,12 +56513,36 @@ function runHealthChecks(instances2, migrationStatus) {
|
|
|
54589
56513
|
resolutionHint: "Re-sync symlinks from the home screen"
|
|
54590
56514
|
});
|
|
54591
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
|
+
}
|
|
54592
56540
|
}
|
|
54593
56541
|
return issues;
|
|
54594
56542
|
}
|
|
54595
56543
|
function loadHealthStatus() {
|
|
54596
56544
|
const healthFile = getHealthFile();
|
|
54597
|
-
if (!
|
|
56545
|
+
if (!existsSync6(healthFile)) {
|
|
54598
56546
|
return { lastChecked: "", issues: [] };
|
|
54599
56547
|
}
|
|
54600
56548
|
try {
|
|
@@ -54604,10 +56552,10 @@ function loadHealthStatus() {
|
|
|
54604
56552
|
}
|
|
54605
56553
|
}
|
|
54606
56554
|
function saveHealthStatus(status) {
|
|
54607
|
-
const dir =
|
|
54608
|
-
if (!
|
|
54609
|
-
|
|
54610
|
-
|
|
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");
|
|
54611
56559
|
}
|
|
54612
56560
|
function dismissIssue(id) {
|
|
54613
56561
|
const status = loadHealthStatus();
|
|
@@ -54624,12 +56572,197 @@ function dismissAllIssues() {
|
|
|
54624
56572
|
}
|
|
54625
56573
|
saveHealthStatus(status);
|
|
54626
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
|
+
}
|
|
54627
56601
|
var init_health = __esm(() => {
|
|
54628
56602
|
init_config();
|
|
54629
56603
|
init_paths();
|
|
54630
56604
|
init_constants();
|
|
54631
56605
|
});
|
|
54632
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
|
+
|
|
54633
56766
|
// src/ink/hooks/useHealthCheck.ts
|
|
54634
56767
|
function useHealthCheck(instances2, migrationStatus) {
|
|
54635
56768
|
const [issues, setIssues] = import_react68.useState([]);
|
|
@@ -54762,7 +56895,7 @@ var init_InstanceCard = __esm(async () => {
|
|
|
54762
56895
|
var import_react69, jsx_dev_runtime8, ListInstances = ({ onBack }) => {
|
|
54763
56896
|
const [instances2, setInstances] = import_react69.useState([]);
|
|
54764
56897
|
const [loading, setLoading] = import_react69.useState(true);
|
|
54765
|
-
|
|
56898
|
+
useNavigation2(onBack);
|
|
54766
56899
|
import_react69.useEffect(() => {
|
|
54767
56900
|
listInstances().then((insts) => {
|
|
54768
56901
|
setInstances(insts);
|
|
@@ -54916,7 +57049,7 @@ var import_react70, jsx_dev_runtime10, DetailRow = ({
|
|
|
54916
57049
|
const [mcpCount, setMcpCount] = import_react70.useState(null);
|
|
54917
57050
|
const [mcpPluginCount, setMcpPluginCount] = import_react70.useState(null);
|
|
54918
57051
|
const [mcpCustomCount, setMcpCustomCount] = import_react70.useState(null);
|
|
54919
|
-
|
|
57052
|
+
useNavigation2(() => {
|
|
54920
57053
|
if (step === "info") {
|
|
54921
57054
|
setStep("select");
|
|
54922
57055
|
setSelected(null);
|
|
@@ -55160,7 +57293,7 @@ var import_react71, jsx_dev_runtime11, RemoveConfirm = ({ selected, onConfirm, o
|
|
|
55160
57293
|
const [selected, setSelected] = import_react71.useState(null);
|
|
55161
57294
|
const [error, setError] = import_react71.useState("");
|
|
55162
57295
|
const [removedConfig, setRemovedConfig] = import_react71.useState("");
|
|
55163
|
-
|
|
57296
|
+
useNavigation2(() => {
|
|
55164
57297
|
if (step === "confirm") {
|
|
55165
57298
|
setStep("select");
|
|
55166
57299
|
setSelected(null);
|
|
@@ -55367,7 +57500,7 @@ var import_react73, jsx_dev_runtime12, ToggleActionValue, ToggleAction = ({ sele
|
|
|
55367
57500
|
const [selected, setSelected] = import_react73.useState(null);
|
|
55368
57501
|
const { error, setError } = useMessage();
|
|
55369
57502
|
const [newStatus, setNewStatus] = import_react73.useState(false);
|
|
55370
|
-
|
|
57503
|
+
useNavigation2(() => {
|
|
55371
57504
|
if (step === "action") {
|
|
55372
57505
|
setStep("select");
|
|
55373
57506
|
setSelected(null);
|
|
@@ -55566,7 +57699,7 @@ var import_react74, jsx_dev_runtime13, PluginSuccess = ({ message }) => {
|
|
|
55566
57699
|
const plugins = action === PluginAction.Enable ? instancePlugins.filter((p) => !p.enabled) : action === PluginAction.Disable ? instancePlugins.filter((p) => p.enabled) : instancePlugins;
|
|
55567
57700
|
return plugins.map((p) => ({ label: formatPluginLabel(p, { showCategory: showCat }), value: p.id }));
|
|
55568
57701
|
}, [action, instancePlugins]);
|
|
55569
|
-
|
|
57702
|
+
useNavigation2(() => {
|
|
55570
57703
|
if (step === "select-instance" || step === "select-plugins" || step === "plugin-list" || step === "symlink-warning") {
|
|
55571
57704
|
setStep("action");
|
|
55572
57705
|
} else if (step === "done") {
|
|
@@ -55882,7 +58015,7 @@ var import_react75, jsx_dev_runtime14, SymlinkResults = ({ results }) => {
|
|
|
55882
58015
|
const [step, setStep] = import_react75.useState("select");
|
|
55883
58016
|
const [results, setResults] = import_react75.useState([]);
|
|
55884
58017
|
const { error, setError } = useMessage();
|
|
55885
|
-
|
|
58018
|
+
useNavigation2(() => {
|
|
55886
58019
|
if (step === "done")
|
|
55887
58020
|
onBack();
|
|
55888
58021
|
else
|
|
@@ -56126,7 +58259,7 @@ var import_react76, jsx_dev_runtime15, McpSourceDetails = ({ sources, action })
|
|
|
56126
58259
|
const { error, setError, success, setSuccess } = useMessage();
|
|
56127
58260
|
const [customName, setCustomName] = import_react76.useState("");
|
|
56128
58261
|
const [customConfig, setCustomConfig] = import_react76.useState("");
|
|
56129
|
-
|
|
58262
|
+
useNavigation2(() => {
|
|
56130
58263
|
if (step === "details" || step === "select" || step === "remove-select" || step === "add-name" || step === "add-config") {
|
|
56131
58264
|
setStep("action");
|
|
56132
58265
|
} else if (step === "select-target") {
|
|
@@ -56512,11 +58645,13 @@ var import_react77, jsx_dev_runtime17, HealthScreen = ({
|
|
|
56512
58645
|
onDismiss,
|
|
56513
58646
|
onDismissAll,
|
|
56514
58647
|
onRetry,
|
|
58648
|
+
onFix,
|
|
56515
58649
|
onBack
|
|
56516
58650
|
}) => {
|
|
56517
58651
|
const [step, setStep] = import_react77.useState("list");
|
|
56518
58652
|
const [selectedIssue, setSelectedIssue] = import_react77.useState(null);
|
|
56519
|
-
|
|
58653
|
+
const [fixMessage, setFixMessage] = import_react77.useState(null);
|
|
58654
|
+
useNavigation2(() => {
|
|
56520
58655
|
if (step === "detail") {
|
|
56521
58656
|
setStep("list");
|
|
56522
58657
|
setSelectedIssue(null);
|
|
@@ -56534,6 +58669,10 @@ var import_react77, jsx_dev_runtime17, HealthScreen = ({
|
|
|
56534
58669
|
onDismissAll();
|
|
56535
58670
|
} else if (input === "r") {
|
|
56536
58671
|
onRetry();
|
|
58672
|
+
} else if (input === "f") {
|
|
58673
|
+
onFix();
|
|
58674
|
+
setFixMessage("Wrappers updated to pinned Claude version!");
|
|
58675
|
+
setTimeout(() => setFixMessage(null), 3000);
|
|
56537
58676
|
} else if (input === " " && selectedIssue) {
|
|
56538
58677
|
setStep("detail");
|
|
56539
58678
|
}
|
|
@@ -56552,6 +58691,16 @@ var import_react77, jsx_dev_runtime17, HealthScreen = ({
|
|
|
56552
58691
|
message: "All systems healthy!",
|
|
56553
58692
|
type: "success"
|
|
56554
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),
|
|
56555
58704
|
/* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Box_default, {
|
|
56556
58705
|
marginTop: 1,
|
|
56557
58706
|
children: /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Text, {
|
|
@@ -56563,6 +58712,7 @@ var import_react77, jsx_dev_runtime17, HealthScreen = ({
|
|
|
56563
58712
|
}, undefined, true, undefined, this);
|
|
56564
58713
|
}
|
|
56565
58714
|
const showActions = useFadeIn(100);
|
|
58715
|
+
const hasVersionIssues = issues.some((i) => i.category === "version");
|
|
56566
58716
|
return /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Box_default, {
|
|
56567
58717
|
flexDirection: "column",
|
|
56568
58718
|
width: "100",
|
|
@@ -56572,6 +58722,16 @@ var import_react77, jsx_dev_runtime17, HealthScreen = ({
|
|
|
56572
58722
|
/* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Header, {
|
|
56573
58723
|
title: "⚠ System Health"
|
|
56574
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),
|
|
56575
58735
|
step === "list" && /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Box_default, {
|
|
56576
58736
|
flexDirection: "column",
|
|
56577
58737
|
gap: 1,
|
|
@@ -56590,11 +58750,31 @@ var import_react77, jsx_dev_runtime17, HealthScreen = ({
|
|
|
56590
58750
|
showActions && /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Box_default, {
|
|
56591
58751
|
marginTop: 1,
|
|
56592
58752
|
flexDirection: "column",
|
|
56593
|
-
children:
|
|
56594
|
-
|
|
56595
|
-
|
|
56596
|
-
|
|
56597
|
-
|
|
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)
|
|
56598
58778
|
]
|
|
56599
58779
|
}, undefined, true, undefined, this),
|
|
56600
58780
|
step === "detail" && selectedIssue && /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Box_default, {
|
|
@@ -56718,6 +58898,8 @@ var exports_App = {};
|
|
|
56718
58898
|
__export(exports_App, {
|
|
56719
58899
|
App: () => App2
|
|
56720
58900
|
});
|
|
58901
|
+
import { execSync as execSync3 } from "node:child_process";
|
|
58902
|
+
import { existsSync as existsSync7 } from "node:fs";
|
|
56721
58903
|
var import_react78, jsx_dev_runtime18, GoodbyeScreen = () => {
|
|
56722
58904
|
const msg = useTypewriter("\uD83D\uDC4B Goodbye!", 40);
|
|
56723
58905
|
return /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(Box_default, {
|
|
@@ -56728,6 +58910,44 @@ var import_react78, jsx_dev_runtime18, GoodbyeScreen = () => {
|
|
|
56728
58910
|
children: msg
|
|
56729
58911
|
}, undefined, false, undefined, this)
|
|
56730
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);
|
|
56731
58951
|
}, InstanceLine = ({ instances: instances2 }) => {
|
|
56732
58952
|
const visible = useFadeIn(100);
|
|
56733
58953
|
if (!visible || instances2.length === 0)
|
|
@@ -56750,6 +58970,14 @@ var import_react78, jsx_dev_runtime18, GoodbyeScreen = () => {
|
|
|
56750
58970
|
const { issues, dismiss, dismissAll, retry } = useHealthCheck(instances2, migrationStatus);
|
|
56751
58971
|
const [screen, setScreen] = import_react78.useState("menu");
|
|
56752
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
|
+
}, []);
|
|
56753
58981
|
use_input_default((input, key) => {
|
|
56754
58982
|
if (screen !== "menu")
|
|
56755
58983
|
return;
|
|
@@ -56757,7 +58985,7 @@ var import_react78, jsx_dev_runtime18, GoodbyeScreen = () => {
|
|
|
56757
58985
|
setScreen("goodbye");
|
|
56758
58986
|
setTimeout(() => exit(), 300);
|
|
56759
58987
|
} else if (input === "!" && issues.length > 0) {
|
|
56760
|
-
|
|
58988
|
+
goToHealth();
|
|
56761
58989
|
}
|
|
56762
58990
|
});
|
|
56763
58991
|
if (loading) {
|
|
@@ -56782,6 +59010,29 @@ var import_react78, jsx_dev_runtime18, GoodbyeScreen = () => {
|
|
|
56782
59010
|
onDismiss: dismiss,
|
|
56783
59011
|
onDismissAll: dismissAll,
|
|
56784
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,
|
|
56785
59036
|
onBack: goToMenu
|
|
56786
59037
|
}, undefined, false, undefined, this);
|
|
56787
59038
|
}
|
|
@@ -56797,6 +59048,11 @@ var import_react78, jsx_dev_runtime18, GoodbyeScreen = () => {
|
|
|
56797
59048
|
}
|
|
56798
59049
|
const errorCount = issues.filter((i) => i.severity === "error").length;
|
|
56799
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
|
+
};
|
|
56800
59056
|
const menuOptions = [
|
|
56801
59057
|
{ label: "➕ Add new instance", value: "add" },
|
|
56802
59058
|
{ label: "\uD83D\uDCCB List all instances", value: "list" },
|
|
@@ -56808,6 +59064,8 @@ var import_react78, jsx_dev_runtime18, GoodbyeScreen = () => {
|
|
|
56808
59064
|
{ label: "\uD83D\uDDD1️ Remove instance", value: "remove" },
|
|
56809
59065
|
{ label: "⚙️ MCP servers", value: "mcp" }
|
|
56810
59066
|
] : [],
|
|
59067
|
+
{ label: "\uD83E\uDE7A Doctor check", value: "doctor-check" },
|
|
59068
|
+
...hasVersionIssues ? [{ label: "\uD83D\uDD27 Fix wrappers (3rd-party API)", value: "doctor-fix" }] : [],
|
|
56811
59069
|
{ label: "\uD83D\uDEAA Exit", value: "exit" }
|
|
56812
59070
|
];
|
|
56813
59071
|
return /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(Box_default, {
|
|
@@ -56823,8 +59081,27 @@ var import_react78, jsx_dev_runtime18, GoodbyeScreen = () => {
|
|
|
56823
59081
|
/* @__PURE__ */ jsx_dev_runtime18.jsxDEV(WarningBanner, {
|
|
56824
59082
|
issueCount: issues.length,
|
|
56825
59083
|
errorCount,
|
|
56826
|
-
warningCount
|
|
59084
|
+
warningCount,
|
|
59085
|
+
hasVersionIssues
|
|
56827
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),
|
|
56828
59105
|
/* @__PURE__ */ jsx_dev_runtime18.jsxDEV(InstanceLine, {
|
|
56829
59106
|
instances: instances2
|
|
56830
59107
|
}, undefined, false, undefined, this),
|
|
@@ -56835,6 +59112,27 @@ var import_react78, jsx_dev_runtime18, GoodbyeScreen = () => {
|
|
|
56835
59112
|
if (value === "exit") {
|
|
56836
59113
|
setScreen("goodbye");
|
|
56837
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");
|
|
56838
59136
|
} else {
|
|
56839
59137
|
setScreen(value);
|
|
56840
59138
|
}
|
|
@@ -56847,14 +59145,18 @@ var import_react78, jsx_dev_runtime18, GoodbyeScreen = () => {
|
|
|
56847
59145
|
}, undefined, true, undefined, this);
|
|
56848
59146
|
}, SCREEN_MAP;
|
|
56849
59147
|
var init_App2 = __esm(async () => {
|
|
59148
|
+
init_version();
|
|
59149
|
+
init_paths();
|
|
56850
59150
|
init_useConfig();
|
|
56851
59151
|
init_useHealthCheck();
|
|
56852
59152
|
init_useAnimations();
|
|
59153
|
+
init_health();
|
|
56853
59154
|
await __promiseAll([
|
|
56854
59155
|
init_build2(),
|
|
56855
59156
|
init_build3(),
|
|
56856
59157
|
init_Header(),
|
|
56857
59158
|
init_Footer(),
|
|
59159
|
+
init_StatusBar(),
|
|
56858
59160
|
init_WarningBanner(),
|
|
56859
59161
|
init_AddInstance(),
|
|
56860
59162
|
init_ListInstances(),
|
|
@@ -56900,112 +59202,13 @@ var {
|
|
|
56900
59202
|
init_source();
|
|
56901
59203
|
init_config();
|
|
56902
59204
|
init_wrapper();
|
|
56903
|
-
|
|
56904
|
-
import { homedir as homedir4 } from "node:os";
|
|
56905
|
-
import { join as join7 } from "node:path";
|
|
56906
|
-
|
|
56907
|
-
// src/version.ts
|
|
56908
|
-
init_errors();
|
|
56909
|
-
import { execSync as execSync2 } from "node:child_process";
|
|
56910
|
-
import { readFileSync as readFileSync3 } from "node:fs";
|
|
56911
|
-
import { join as join3, dirname as dirname4 } from "node:path";
|
|
56912
|
-
import { fileURLToPath } from "node:url";
|
|
56913
|
-
function getClaudeMultiVersion() {
|
|
56914
|
-
const pkgPath = join3(dirname4(fileURLToPath(import.meta.url)), "..", "package.json");
|
|
56915
|
-
const pkg = JSON.parse(readFileSync3(pkgPath, "utf-8"));
|
|
56916
|
-
if (typeof pkg !== "object" || pkg === null || typeof pkg.version !== "string") {
|
|
56917
|
-
throw new ClaudeMultiError(ErrorCode.CONFIG_CORRUPTED, "Could not read package version");
|
|
56918
|
-
}
|
|
56919
|
-
return pkg.version;
|
|
56920
|
-
}
|
|
56921
|
-
async function getLatestClaudeMultiVersion() {
|
|
56922
|
-
const response = await fetch("https://registry.npmjs.org/claude-multi/latest");
|
|
56923
|
-
const data = await response.json();
|
|
56924
|
-
return data.version;
|
|
56925
|
-
}
|
|
56926
|
-
async function checkForClaudeMultiUpdates() {
|
|
56927
|
-
try {
|
|
56928
|
-
const current = getClaudeMultiVersion();
|
|
56929
|
-
const latest = await getLatestClaudeMultiVersion();
|
|
56930
|
-
return {
|
|
56931
|
-
current,
|
|
56932
|
-
latest,
|
|
56933
|
-
updateAvailable: current !== latest
|
|
56934
|
-
};
|
|
56935
|
-
} catch {
|
|
56936
|
-
return { current: "", latest: "", updateAvailable: false };
|
|
56937
|
-
}
|
|
56938
|
-
}
|
|
56939
|
-
function upgradeClaudeMulti() {
|
|
56940
|
-
const pm = detectPackageManager();
|
|
56941
|
-
const commands = {
|
|
56942
|
-
bun: "bun upgrade -g claude-multi",
|
|
56943
|
-
npm: "npm update -g claude-multi",
|
|
56944
|
-
pnpm: "pnpm update -g claude-multi",
|
|
56945
|
-
deno: "deno install --reload -g npm:claude-multi"
|
|
56946
|
-
};
|
|
56947
|
-
execSync2(commands[pm], { stdio: "inherit" });
|
|
56948
|
-
}
|
|
56949
|
-
function getCurrentVersion() {
|
|
56950
|
-
const pm = detectPackageManager();
|
|
56951
|
-
try {
|
|
56952
|
-
if (pm === "deno")
|
|
56953
|
-
return null;
|
|
56954
|
-
const commands = {
|
|
56955
|
-
bun: "bun pm ls -g --json",
|
|
56956
|
-
npm: "npm ls -g --json @anthropic-ai/claude-code",
|
|
56957
|
-
pnpm: "pnpm ls -g --json"
|
|
56958
|
-
};
|
|
56959
|
-
const output = execSync2(commands[pm], {
|
|
56960
|
-
encoding: "utf-8",
|
|
56961
|
-
stdio: ["pipe", "pipe", "ignore"]
|
|
56962
|
-
});
|
|
56963
|
-
const data = JSON.parse(output);
|
|
56964
|
-
const root = Array.isArray(data) ? data[0] : data;
|
|
56965
|
-
return root?.dependencies?.["@anthropic-ai/claude-code"]?.version ?? null;
|
|
56966
|
-
} catch {
|
|
56967
|
-
return null;
|
|
56968
|
-
}
|
|
56969
|
-
}
|
|
56970
|
-
async function getLatestVersion() {
|
|
56971
|
-
try {
|
|
56972
|
-
const response = await fetch("https://registry.npmjs.org/@anthropic-ai/claude-code/latest");
|
|
56973
|
-
const data = await response.json();
|
|
56974
|
-
return data.version;
|
|
56975
|
-
} catch (err) {
|
|
56976
|
-
throw new ClaudeMultiError(ErrorCode.VERSION_CHECK_FAILED, `Failed to fetch latest version from npm registry: ${err instanceof Error ? err.message : String(err)}`, { cause: err });
|
|
56977
|
-
}
|
|
56978
|
-
}
|
|
56979
|
-
async function checkForUpdates() {
|
|
56980
|
-
const current = getCurrentVersion();
|
|
56981
|
-
const latest = await getLatestVersion();
|
|
56982
|
-
return {
|
|
56983
|
-
current,
|
|
56984
|
-
latest,
|
|
56985
|
-
updateAvailable: current !== null && current !== latest
|
|
56986
|
-
};
|
|
56987
|
-
}
|
|
56988
|
-
async function updateClaudeCode() {
|
|
56989
|
-
const pm = detectPackageManager();
|
|
56990
|
-
const commands = {
|
|
56991
|
-
bun: "bun install -g @anthropic-ai/claude-code@latest",
|
|
56992
|
-
npm: "npm install -g @anthropic-ai/claude-code@latest",
|
|
56993
|
-
pnpm: "pnpm add -g @anthropic-ai/claude-code@latest",
|
|
56994
|
-
deno: "deno install --reload -g npm:@anthropic-ai/claude-code@latest"
|
|
56995
|
-
};
|
|
56996
|
-
try {
|
|
56997
|
-
console.log("Updating @anthropic-ai/claude-code...");
|
|
56998
|
-
execSync2(commands[pm], { stdio: "inherit" });
|
|
56999
|
-
console.log("Update completed successfully!");
|
|
57000
|
-
} catch (err) {
|
|
57001
|
-
throw new ClaudeMultiError(ErrorCode.UPDATE_FAILED, `Failed to update @anthropic-ai/claude-code: ${err instanceof Error ? err.message : String(err)}`, { cause: err });
|
|
57002
|
-
}
|
|
57003
|
-
}
|
|
57004
|
-
|
|
57005
|
-
// src/cli.ts
|
|
59205
|
+
init_version();
|
|
57006
59206
|
init_templates();
|
|
57007
59207
|
init_errors();
|
|
57008
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";
|
|
57009
59212
|
function exitWithCode(code) {
|
|
57010
59213
|
process.exit(code);
|
|
57011
59214
|
}
|
|
@@ -57025,10 +59228,10 @@ function requireNonEmptyArgs(items, errorMsg, usage) {
|
|
|
57025
59228
|
}
|
|
57026
59229
|
}
|
|
57027
59230
|
var program2 = new Command;
|
|
57028
|
-
program2.name("claude-multi").description("Manage multiple Claude Code instances with different aliases").version(
|
|
57029
|
-
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) => {
|
|
57030
59233
|
try {
|
|
57031
|
-
const configDir = options.config ||
|
|
59234
|
+
const configDir = options.config || join8(homedir4(), `.claude-${name}`);
|
|
57032
59235
|
const binaryPath = options.binary || getDefaultBinaryPath(name);
|
|
57033
59236
|
const hasDefaultConfig = hasDefaultClaudeConfig();
|
|
57034
59237
|
const hasDefaultMcp = await hasDefaultMcpConfig();
|
|
@@ -57305,6 +59508,68 @@ program2.command("auto-sync <name> <status>").description("Toggle auto-sync for
|
|
|
57305
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) => {
|
|
57306
59509
|
await handleFixSymlinks(names, options.all);
|
|
57307
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
|
+
});
|
|
57308
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 = []) => {
|
|
57309
59574
|
try {
|
|
57310
59575
|
switch (action) {
|