claude-multi 0.5.8 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/dist/cli.js +2718 -448
- package/package.json +3 -1
package/dist/cli.js
CHANGED
|
@@ -7320,11 +7320,13 @@ 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 = {};
|
|
7328
7330
|
PROVIDER_TEMPLATES = {
|
|
7329
7331
|
glm: {
|
|
7330
7332
|
name: "glm",
|
|
@@ -7607,11 +7609,22 @@ var init_constants = __esm(() => {
|
|
|
7607
7609
|
});
|
|
7608
7610
|
|
|
7609
7611
|
// src/paths.ts
|
|
7612
|
+
var exports_paths = {};
|
|
7613
|
+
__export(exports_paths, {
|
|
7614
|
+
getBaseDir: () => getBaseDir,
|
|
7615
|
+
PINNED_CLAUDE_BIN: () => PINNED_CLAUDE_BIN,
|
|
7616
|
+
PINNED_BIN_DIR: () => PINNED_BIN_DIR
|
|
7617
|
+
});
|
|
7610
7618
|
import { homedir } from "node:os";
|
|
7619
|
+
import { join } from "node:path";
|
|
7611
7620
|
function getBaseDir() {
|
|
7612
7621
|
return process.env.CLAUDE_MULTI_HOME || homedir();
|
|
7613
7622
|
}
|
|
7614
|
-
var
|
|
7623
|
+
var PINNED_BIN_DIR, PINNED_CLAUDE_BIN;
|
|
7624
|
+
var init_paths = __esm(() => {
|
|
7625
|
+
PINNED_BIN_DIR = join(homedir(), ".claude-multi", "bin");
|
|
7626
|
+
PINNED_CLAUDE_BIN = process.platform === "win32" ? join(PINNED_BIN_DIR, "node_modules", ".bin", "claude.cmd") : join(PINNED_BIN_DIR, "node_modules", ".bin", "claude");
|
|
7627
|
+
});
|
|
7615
7628
|
|
|
7616
7629
|
// src/migration.ts
|
|
7617
7630
|
var exports_migration = {};
|
|
@@ -7625,12 +7638,12 @@ __export(exports_migration, {
|
|
|
7625
7638
|
CONFIG_VERSION: () => CONFIG_VERSION
|
|
7626
7639
|
});
|
|
7627
7640
|
import { existsSync, mkdirSync, readdirSync, copyFileSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
7628
|
-
import { join, dirname } from "node:path";
|
|
7641
|
+
import { join as join2, dirname } from "node:path";
|
|
7629
7642
|
function getBackupDir() {
|
|
7630
|
-
return
|
|
7643
|
+
return join2(getBaseDir(), ".claude-multi", "backups");
|
|
7631
7644
|
}
|
|
7632
7645
|
function getLockFile() {
|
|
7633
|
-
return
|
|
7646
|
+
return join2(getBaseDir(), ".claude-multi", ".migration.lock");
|
|
7634
7647
|
}
|
|
7635
7648
|
function createLock() {
|
|
7636
7649
|
const lockFile = getLockFile();
|
|
@@ -7686,24 +7699,24 @@ async function createBackup(config) {
|
|
|
7686
7699
|
const ts = new Date().toISOString().replace(/[:.]/g, "-");
|
|
7687
7700
|
const rand = Math.random().toString(36).slice(2, 6);
|
|
7688
7701
|
const fromV = config.version || "1.0.0";
|
|
7689
|
-
const backupPath =
|
|
7702
|
+
const backupPath = join2(backupDir, `${ts}-${rand}-v${fromV}-to-v${CONFIG_VERSION}`);
|
|
7690
7703
|
mkdirSync(backupPath, { recursive: true });
|
|
7691
|
-
const configSrc =
|
|
7704
|
+
const configSrc = join2(getBaseDir(), ".claude-multi", "config.json");
|
|
7692
7705
|
if (existsSync(configSrc)) {
|
|
7693
|
-
copyFileSync(configSrc,
|
|
7706
|
+
copyFileSync(configSrc, join2(backupPath, "config.json"));
|
|
7694
7707
|
}
|
|
7695
|
-
const instancesDir =
|
|
7708
|
+
const instancesDir = join2(backupPath, "instances");
|
|
7696
7709
|
for (const inst of config.instances) {
|
|
7697
|
-
const settingsFile =
|
|
7710
|
+
const settingsFile = join2(inst.configDir, "settings.json");
|
|
7698
7711
|
if (existsSync(settingsFile)) {
|
|
7699
|
-
const instDir =
|
|
7712
|
+
const instDir = join2(instancesDir, inst.name);
|
|
7700
7713
|
mkdirSync(instDir, { recursive: true });
|
|
7701
|
-
copyFileSync(settingsFile,
|
|
7714
|
+
copyFileSync(settingsFile, join2(instDir, "settings.json"));
|
|
7702
7715
|
}
|
|
7703
7716
|
}
|
|
7704
7717
|
const backups = readdirSync(backupDir).sort();
|
|
7705
7718
|
for (let i = 0;i < backups.length - 3; i++) {
|
|
7706
|
-
rmSync(
|
|
7719
|
+
rmSync(join2(backupDir, backups[i]), { force: true, recursive: true });
|
|
7707
7720
|
}
|
|
7708
7721
|
return backupPath;
|
|
7709
7722
|
}
|
|
@@ -7821,7 +7834,7 @@ import { existsSync as existsSync2, mkdirSync as mkdirSync2, readdirSync as read
|
|
|
7821
7834
|
import { readFile as readFile2, writeFile as writeFile2, copyFile, mkdir, symlink } from "node:fs/promises";
|
|
7822
7835
|
import { homedir as homedir2 } from "node:os";
|
|
7823
7836
|
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
7824
|
-
import { dirname as dirname2, isAbsolute, join as
|
|
7837
|
+
import { dirname as dirname2, isAbsolute, join as join3, relative, resolve } from "node:path";
|
|
7825
7838
|
function setTestConfigDir(dir) {
|
|
7826
7839
|
_testConfigDir = dir;
|
|
7827
7840
|
}
|
|
@@ -7829,18 +7842,18 @@ function clearTestConfigDir() {
|
|
|
7829
7842
|
_testConfigDir = undefined;
|
|
7830
7843
|
}
|
|
7831
7844
|
function getConfigDir() {
|
|
7832
|
-
return _testConfigDir ??
|
|
7845
|
+
return _testConfigDir ?? join3(homedir2(), ".claude-multi");
|
|
7833
7846
|
}
|
|
7834
7847
|
function getConfigFile() {
|
|
7835
|
-
return
|
|
7848
|
+
return join3(getConfigDir(), "config.json");
|
|
7836
7849
|
}
|
|
7837
7850
|
async function copyDirRecursive(source, target) {
|
|
7838
7851
|
if (!existsSync2(target)) {
|
|
7839
7852
|
await mkdir(target, { recursive: true });
|
|
7840
7853
|
}
|
|
7841
7854
|
for (const entry of readdirSync2(source)) {
|
|
7842
|
-
const src =
|
|
7843
|
-
const tgt =
|
|
7855
|
+
const src = join3(source, entry);
|
|
7856
|
+
const tgt = join3(target, entry);
|
|
7844
7857
|
const s = statSync(src);
|
|
7845
7858
|
if (s.isDirectory()) {
|
|
7846
7859
|
await copyDirRecursive(src, tgt);
|
|
@@ -7951,7 +7964,7 @@ function getDefaultClaudeDir() {
|
|
|
7951
7964
|
if (_testDefaultClaudeDir) {
|
|
7952
7965
|
return _testDefaultClaudeDir;
|
|
7953
7966
|
}
|
|
7954
|
-
return
|
|
7967
|
+
return join3(homedir2(), ".claude");
|
|
7955
7968
|
}
|
|
7956
7969
|
function isBrokenSymlink(path) {
|
|
7957
7970
|
try {
|
|
@@ -7975,7 +7988,7 @@ function isBrokenSymlink(path) {
|
|
|
7975
7988
|
function detectBrokenSymlinks(configDir) {
|
|
7976
7989
|
const result = { broken: [], all: [] };
|
|
7977
7990
|
for (const dir of SYNC_DIRS) {
|
|
7978
|
-
const targetPath =
|
|
7991
|
+
const targetPath = join3(configDir, dir);
|
|
7979
7992
|
try {
|
|
7980
7993
|
const stats = lstatSync(targetPath);
|
|
7981
7994
|
result.all.push(dir);
|
|
@@ -7988,12 +8001,12 @@ function detectBrokenSymlinks(configDir) {
|
|
|
7988
8001
|
}
|
|
7989
8002
|
function hasDefaultClaudeConfig() {
|
|
7990
8003
|
const defaultDir = getDefaultClaudeDir();
|
|
7991
|
-
const settingsFile =
|
|
8004
|
+
const settingsFile = join3(defaultDir, "settings.json");
|
|
7992
8005
|
return existsSync2(defaultDir) && existsSync2(settingsFile);
|
|
7993
8006
|
}
|
|
7994
8007
|
async function copySettingsFromDefault(targetConfigDir) {
|
|
7995
8008
|
const defaultDir = getDefaultClaudeDir();
|
|
7996
|
-
const sourceSettings =
|
|
8009
|
+
const sourceSettings = join3(defaultDir, "settings.json");
|
|
7997
8010
|
if (!existsSync2(sourceSettings)) {
|
|
7998
8011
|
throw new ClaudeMultiError(ErrorCode.DEFAULT_SETTINGS_NOT_FOUND, "Default Claude settings.json not found");
|
|
7999
8012
|
}
|
|
@@ -8013,7 +8026,7 @@ async function copySettingsFromDefault(targetConfigDir) {
|
|
|
8013
8026
|
if (!existsSync2(targetConfigDir)) {
|
|
8014
8027
|
await mkdir(targetConfigDir, { recursive: true });
|
|
8015
8028
|
}
|
|
8016
|
-
const targetSettings =
|
|
8029
|
+
const targetSettings = join3(targetConfigDir, "settings.json");
|
|
8017
8030
|
await writeFile2(targetSettings, JSON.stringify(safeSettings, null, 2), "utf-8");
|
|
8018
8031
|
}
|
|
8019
8032
|
async function copyAllFromDefault(targetConfigDir, autoSync = false) {
|
|
@@ -8042,8 +8055,8 @@ async function copyAllFromDefault(targetConfigDir, autoSync = false) {
|
|
|
8042
8055
|
const copyRecursive = async (source, target) => {
|
|
8043
8056
|
const entries = readdirSync2(source);
|
|
8044
8057
|
for (const entry of entries) {
|
|
8045
|
-
const sourcePath =
|
|
8046
|
-
const targetPath =
|
|
8058
|
+
const sourcePath = join3(source, entry);
|
|
8059
|
+
const targetPath = join3(target, entry);
|
|
8047
8060
|
const stat = statSync(sourcePath);
|
|
8048
8061
|
if (excludeFiles.includes(entry)) {
|
|
8049
8062
|
continue;
|
|
@@ -8083,7 +8096,7 @@ async function detectMcpConfigurations(configDir) {
|
|
|
8083
8096
|
if (!existsSync2(configDir)) {
|
|
8084
8097
|
return null;
|
|
8085
8098
|
}
|
|
8086
|
-
const settingsFile =
|
|
8099
|
+
const settingsFile = join3(configDir, "settings.json");
|
|
8087
8100
|
if (existsSync2(settingsFile)) {
|
|
8088
8101
|
try {
|
|
8089
8102
|
const settingsContent = await readFile2(settingsFile, "utf-8");
|
|
@@ -8095,7 +8108,7 @@ async function detectMcpConfigurations(configDir) {
|
|
|
8095
8108
|
}
|
|
8096
8109
|
const mcpFiles = ["mcp.json", "mcp-servers.json", "claude-mcp.json"];
|
|
8097
8110
|
for (const mcpFile of mcpFiles) {
|
|
8098
|
-
const mcpFilePath =
|
|
8111
|
+
const mcpFilePath = join3(configDir, mcpFile);
|
|
8099
8112
|
if (existsSync2(mcpFilePath)) {
|
|
8100
8113
|
try {
|
|
8101
8114
|
const mcpContent = await readFile2(mcpFilePath, "utf-8");
|
|
@@ -8118,8 +8131,8 @@ async function copyMcpServersFromDefault(targetConfigDir) {
|
|
|
8118
8131
|
if (!existsSync2(targetConfigDir)) {
|
|
8119
8132
|
await mkdir(targetConfigDir, { recursive: true });
|
|
8120
8133
|
}
|
|
8121
|
-
const pluginsDir =
|
|
8122
|
-
const defaultPluginsDir =
|
|
8134
|
+
const pluginsDir = join3(targetConfigDir, "plugins");
|
|
8135
|
+
const defaultPluginsDir = join3(defaultDir, "plugins");
|
|
8123
8136
|
if (existsSync2(defaultPluginsDir) && !existsSync2(pluginsDir)) {
|
|
8124
8137
|
await copyDirRecursive(defaultPluginsDir, pluginsDir);
|
|
8125
8138
|
}
|
|
@@ -8140,7 +8153,7 @@ async function copyMcpServersFromDefault(targetConfigDir) {
|
|
|
8140
8153
|
}
|
|
8141
8154
|
}
|
|
8142
8155
|
async function writeMcpConfiguration(targetConfigDir, mcpConfig) {
|
|
8143
|
-
const settingsFile =
|
|
8156
|
+
const settingsFile = join3(targetConfigDir, "settings.json");
|
|
8144
8157
|
if (existsSync2(settingsFile)) {
|
|
8145
8158
|
try {
|
|
8146
8159
|
const settingsContent = await readFile2(settingsFile, "utf-8");
|
|
@@ -8150,7 +8163,7 @@ async function writeMcpConfiguration(targetConfigDir, mcpConfig) {
|
|
|
8150
8163
|
return;
|
|
8151
8164
|
} catch (error) {}
|
|
8152
8165
|
}
|
|
8153
|
-
const mcpFile =
|
|
8166
|
+
const mcpFile = join3(targetConfigDir, "mcp.json");
|
|
8154
8167
|
await writeFile2(mcpFile, JSON.stringify(mcpConfig, null, 2), "utf-8");
|
|
8155
8168
|
}
|
|
8156
8169
|
async function copyMcpServersBetweenInstances(sourceInstanceName, targetInstanceName) {
|
|
@@ -8181,11 +8194,11 @@ async function createSettingsFromTemplate(targetConfigDir, template, apiKey) {
|
|
|
8181
8194
|
await mkdir(targetConfigDir, { recursive: true });
|
|
8182
8195
|
}
|
|
8183
8196
|
const settings = applyProviderTemplate(template, apiKey);
|
|
8184
|
-
const settingsFile =
|
|
8197
|
+
const settingsFile = join3(targetConfigDir, "settings.json");
|
|
8185
8198
|
await writeFile2(settingsFile, JSON.stringify(settings, null, 2), "utf-8");
|
|
8186
8199
|
}
|
|
8187
8200
|
async function initializeInstanceState(configDir) {
|
|
8188
|
-
const stateFile =
|
|
8201
|
+
const stateFile = join3(configDir, ".claude.json");
|
|
8189
8202
|
if (existsSync2(stateFile))
|
|
8190
8203
|
return;
|
|
8191
8204
|
if (!existsSync2(configDir)) {
|
|
@@ -8194,7 +8207,7 @@ async function initializeInstanceState(configDir) {
|
|
|
8194
8207
|
const state = {
|
|
8195
8208
|
numStartups: 1,
|
|
8196
8209
|
installMethod: "global",
|
|
8197
|
-
autoUpdates:
|
|
8210
|
+
autoUpdates: true,
|
|
8198
8211
|
hasSeenTasksHint: true,
|
|
8199
8212
|
hasCompletedOnboarding: true,
|
|
8200
8213
|
lastOnboardingVersion: "2.0.31",
|
|
@@ -8211,16 +8224,15 @@ async function initializeInstanceState(configDir) {
|
|
|
8211
8224
|
await writeFile2(stateFile, JSON.stringify(state, null, 2), "utf-8");
|
|
8212
8225
|
}
|
|
8213
8226
|
async function mergeProviderEnv(configDir, template, apiKey) {
|
|
8214
|
-
const settingsFile =
|
|
8227
|
+
const settingsFile = join3(configDir, "settings.json");
|
|
8215
8228
|
let existing = {};
|
|
8216
8229
|
if (existsSync2(settingsFile)) {
|
|
8217
8230
|
const raw = await readFile2(settingsFile, "utf-8");
|
|
8218
8231
|
existing = JSON.parse(raw);
|
|
8219
8232
|
}
|
|
8220
8233
|
const env2 = existing.env ?? {};
|
|
8221
|
-
const
|
|
8222
|
-
|
|
8223
|
-
existing.env = { ...env2, ...templateEnv };
|
|
8234
|
+
const templateSettings = applyProviderTemplate(template, apiKey);
|
|
8235
|
+
existing.env = { ...env2, ...templateSettings.env };
|
|
8224
8236
|
existing.includeCoAuthoredBy = template.settings.includeCoAuthoredBy;
|
|
8225
8237
|
await writeFile2(settingsFile, JSON.stringify(existing, null, 2), "utf-8");
|
|
8226
8238
|
}
|
|
@@ -8230,8 +8242,8 @@ async function syncPluginsAndSkills(configDir) {
|
|
|
8230
8242
|
throw new ClaudeMultiError(ErrorCode.INSTANCE_DIR_NOT_FOUND, "Instance config directory does not exist");
|
|
8231
8243
|
}
|
|
8232
8244
|
for (const dir of SYNC_DIRS) {
|
|
8233
|
-
const targetPath =
|
|
8234
|
-
const sourcePath =
|
|
8245
|
+
const targetPath = join3(configDir, dir);
|
|
8246
|
+
const sourcePath = join3(defaultDir, dir);
|
|
8235
8247
|
if (!existsSync2(sourcePath)) {
|
|
8236
8248
|
console.log(source_default.yellow(` ⚠ Source ${dir} not found in ${defaultDir}, skipping`));
|
|
8237
8249
|
continue;
|
|
@@ -8239,7 +8251,7 @@ async function syncPluginsAndSkills(configDir) {
|
|
|
8239
8251
|
if (existsSync2(targetPath)) {
|
|
8240
8252
|
try {
|
|
8241
8253
|
const linkTarget = readlinkSync(targetPath);
|
|
8242
|
-
if (linkTarget === sourcePath || linkTarget ===
|
|
8254
|
+
if (linkTarget === sourcePath || linkTarget === join3("..", "..", ".claude", dir)) {
|
|
8243
8255
|
console.log(source_default.gray(` ✓ ${dir} already synced`));
|
|
8244
8256
|
continue;
|
|
8245
8257
|
}
|
|
@@ -8259,8 +8271,8 @@ async function unsyncPluginsAndSkills(configDir) {
|
|
|
8259
8271
|
throw new ClaudeMultiError(ErrorCode.INSTANCE_DIR_NOT_FOUND, "Instance config directory does not exist");
|
|
8260
8272
|
}
|
|
8261
8273
|
for (const dir of SYNC_DIRS) {
|
|
8262
|
-
const targetPath =
|
|
8263
|
-
const sourcePath =
|
|
8274
|
+
const targetPath = join3(configDir, dir);
|
|
8275
|
+
const sourcePath = join3(defaultDir, dir);
|
|
8264
8276
|
if (!existsSync2(sourcePath)) {
|
|
8265
8277
|
console.log(source_default.yellow(` ⚠ Source ${dir} not found in ${defaultDir}, skipping`));
|
|
8266
8278
|
continue;
|
|
@@ -8281,8 +8293,8 @@ async function unsyncPluginsAndSkills(configDir) {
|
|
|
8281
8293
|
const copyRecursive = async (source, target) => {
|
|
8282
8294
|
const entries = readdirSync2(source);
|
|
8283
8295
|
for (const entry of entries) {
|
|
8284
|
-
const sourceEntry =
|
|
8285
|
-
const targetEntry =
|
|
8296
|
+
const sourceEntry = join3(source, entry);
|
|
8297
|
+
const targetEntry = join3(target, entry);
|
|
8286
8298
|
const stat = statSync(sourceEntry);
|
|
8287
8299
|
if (stat.isDirectory()) {
|
|
8288
8300
|
await mkdir(targetEntry, { recursive: true });
|
|
@@ -8297,7 +8309,7 @@ async function unsyncPluginsAndSkills(configDir) {
|
|
|
8297
8309
|
}
|
|
8298
8310
|
}
|
|
8299
8311
|
async function readClaudeSettings(configDir) {
|
|
8300
|
-
const settingsFile =
|
|
8312
|
+
const settingsFile = join3(configDir, "settings.json");
|
|
8301
8313
|
if (!existsSync2(settingsFile)) {
|
|
8302
8314
|
return null;
|
|
8303
8315
|
}
|
|
@@ -8313,7 +8325,7 @@ async function writeClaudeSettings(configDir, settings) {
|
|
|
8313
8325
|
if (!existsSync2(configDir)) {
|
|
8314
8326
|
await mkdir(configDir, { recursive: true });
|
|
8315
8327
|
}
|
|
8316
|
-
await writeJsonFileAtomic(
|
|
8328
|
+
await writeJsonFileAtomic(join3(configDir, "settings.json"), settings);
|
|
8317
8329
|
}
|
|
8318
8330
|
async function getEnabledPlugins(configDir) {
|
|
8319
8331
|
const settings = await readClaudeSettings(configDir);
|
|
@@ -8363,17 +8375,17 @@ function readMcpJsonFile(mcpPath) {
|
|
|
8363
8375
|
}
|
|
8364
8376
|
function scanPluginDir(baseDir, category, enabledPlugins) {
|
|
8365
8377
|
const subDir = category === PluginCategory.Internal ? "plugins" : "external_plugins";
|
|
8366
|
-
const dir =
|
|
8378
|
+
const dir = join3(baseDir, MARKETPLACE_REL, subDir);
|
|
8367
8379
|
if (!existsSync2(dir))
|
|
8368
8380
|
return [];
|
|
8369
8381
|
const results = [];
|
|
8370
8382
|
for (const entry of readdirSync2(dir, { withFileTypes: true })) {
|
|
8371
8383
|
if (!entry.isDirectory())
|
|
8372
8384
|
continue;
|
|
8373
|
-
const pluginPath =
|
|
8385
|
+
const pluginPath = join3(dir, entry.name);
|
|
8374
8386
|
let name = entry.name;
|
|
8375
8387
|
let description = "";
|
|
8376
|
-
const metaFile =
|
|
8388
|
+
const metaFile = join3(pluginPath, ".claude-plugin", "plugin.json");
|
|
8377
8389
|
if (existsSync2(metaFile)) {
|
|
8378
8390
|
try {
|
|
8379
8391
|
const meta = JSON.parse(readFileSync2(metaFile, "utf-8"));
|
|
@@ -8385,7 +8397,7 @@ function scanPluginDir(baseDir, category, enabledPlugins) {
|
|
|
8385
8397
|
console.error(source_default.yellow(`Warning: Could not parse plugin metadata for ${entry.name}`));
|
|
8386
8398
|
}
|
|
8387
8399
|
}
|
|
8388
|
-
const mcpFile =
|
|
8400
|
+
const mcpFile = join3(pluginPath, ".mcp.json");
|
|
8389
8401
|
const hasMcp = existsSync2(mcpFile);
|
|
8390
8402
|
let mcpServerNames;
|
|
8391
8403
|
if (hasMcp) {
|
|
@@ -8409,7 +8421,7 @@ function scanPluginDir(baseDir, category, enabledPlugins) {
|
|
|
8409
8421
|
}
|
|
8410
8422
|
function scanPluginsFromDir(baseDir) {
|
|
8411
8423
|
let enabledPlugins = {};
|
|
8412
|
-
const settingsFile =
|
|
8424
|
+
const settingsFile = join3(baseDir, "settings.json");
|
|
8413
8425
|
if (existsSync2(settingsFile)) {
|
|
8414
8426
|
try {
|
|
8415
8427
|
const s = JSON.parse(readFileSync2(settingsFile, "utf-8"));
|
|
@@ -8430,7 +8442,7 @@ function listInstancePlugins(configDir) {
|
|
|
8430
8442
|
return scanPluginsFromDir(configDir);
|
|
8431
8443
|
}
|
|
8432
8444
|
function isPluginsSymlinked(configDir) {
|
|
8433
|
-
const pluginsPath =
|
|
8445
|
+
const pluginsPath = join3(configDir, "plugins");
|
|
8434
8446
|
const st = lstatSafe(pluginsPath);
|
|
8435
8447
|
return st?.isSymbolicLink() ?? false;
|
|
8436
8448
|
}
|
|
@@ -8446,7 +8458,7 @@ function isClaudeCodeRunning(configDir) {
|
|
|
8446
8458
|
}
|
|
8447
8459
|
}
|
|
8448
8460
|
function readInstalledPlugins(pluginsDir) {
|
|
8449
|
-
const filePath =
|
|
8461
|
+
const filePath = join3(pluginsDir, "installed_plugins.json");
|
|
8450
8462
|
if (!existsSync2(filePath)) {
|
|
8451
8463
|
return { version: 2, plugins: {} };
|
|
8452
8464
|
}
|
|
@@ -8457,16 +8469,16 @@ function readInstalledPlugins(pluginsDir) {
|
|
|
8457
8469
|
}
|
|
8458
8470
|
}
|
|
8459
8471
|
async function writeInstalledPlugins(pluginsDir, data) {
|
|
8460
|
-
await writeJsonFileAtomic(
|
|
8472
|
+
await writeJsonFileAtomic(join3(pluginsDir, "installed_plugins.json"), data);
|
|
8461
8473
|
}
|
|
8462
8474
|
async function addPluginToInstalledPlugins(configDir, pluginId) {
|
|
8463
|
-
const pluginsDir =
|
|
8475
|
+
const pluginsDir = join3(configDir, "plugins");
|
|
8464
8476
|
const data = readInstalledPlugins(pluginsDir);
|
|
8465
8477
|
const key = `${pluginId}@claude-plugins-official`;
|
|
8466
8478
|
if (!data.plugins[key]) {
|
|
8467
8479
|
data.plugins[key] = [];
|
|
8468
8480
|
}
|
|
8469
|
-
const cachePath =
|
|
8481
|
+
const cachePath = join3(configDir, MARKETPLACE_REL);
|
|
8470
8482
|
const entry = {
|
|
8471
8483
|
scope: "user",
|
|
8472
8484
|
installPath: cachePath,
|
|
@@ -8478,7 +8490,7 @@ async function addPluginToInstalledPlugins(configDir, pluginId) {
|
|
|
8478
8490
|
await writeInstalledPlugins(pluginsDir, data);
|
|
8479
8491
|
}
|
|
8480
8492
|
async function removePluginFromInstalledPlugins(configDir, pluginId) {
|
|
8481
|
-
const pluginsDir =
|
|
8493
|
+
const pluginsDir = join3(configDir, "plugins");
|
|
8482
8494
|
const data = readInstalledPlugins(pluginsDir);
|
|
8483
8495
|
const key = `${pluginId}@claude-plugins-official`;
|
|
8484
8496
|
delete data.plugins[key];
|
|
@@ -8488,7 +8500,7 @@ function estimatePluginSize(pluginPath) {
|
|
|
8488
8500
|
let total = 0;
|
|
8489
8501
|
try {
|
|
8490
8502
|
for (const entry of readdirSync2(pluginPath, { withFileTypes: true })) {
|
|
8491
|
-
const fullPath =
|
|
8503
|
+
const fullPath = join3(pluginPath, entry.name);
|
|
8492
8504
|
if (entry.isDirectory()) {
|
|
8493
8505
|
total += estimatePluginSize(fullPath);
|
|
8494
8506
|
} else {
|
|
@@ -8506,7 +8518,7 @@ function detectMcpCollisions(configDir, newPluginIds) {
|
|
|
8506
8518
|
const defaultDir = getDefaultClaudeDir();
|
|
8507
8519
|
for (const pluginId of newPluginIds) {
|
|
8508
8520
|
for (const subDir of ["plugins", "external_plugins"]) {
|
|
8509
|
-
const mcpFile =
|
|
8521
|
+
const mcpFile = join3(defaultDir, MARKETPLACE_REL, subDir, pluginId, ".mcp.json");
|
|
8510
8522
|
if (!existsSync2(mcpFile))
|
|
8511
8523
|
continue;
|
|
8512
8524
|
const newServers = readMcpJsonFile(mcpFile);
|
|
@@ -8555,22 +8567,22 @@ function validatePluginOperation(configDir, operation, pluginId) {
|
|
|
8555
8567
|
async function copySinglePlugin(targetConfigDir, pluginId, category) {
|
|
8556
8568
|
const defaultDir = getDefaultClaudeDir();
|
|
8557
8569
|
const subDir = category === PluginCategory.Internal ? "plugins" : "external_plugins";
|
|
8558
|
-
const sourcePlugin =
|
|
8559
|
-
const targetPlugin =
|
|
8570
|
+
const sourcePlugin = join3(defaultDir, MARKETPLACE_REL, subDir, pluginId);
|
|
8571
|
+
const targetPlugin = join3(targetConfigDir, MARKETPLACE_REL, subDir, pluginId);
|
|
8560
8572
|
if (!existsSync2(sourcePlugin)) {
|
|
8561
8573
|
throw new ClaudeMultiError(ErrorCode.PLUGIN_NOT_FOUND, `Plugin '${pluginId}' not found in default Claude`);
|
|
8562
8574
|
}
|
|
8563
|
-
const scaffoldDir =
|
|
8575
|
+
const scaffoldDir = join3(targetConfigDir, MARKETPLACE_REL, subDir);
|
|
8564
8576
|
if (!existsSync2(scaffoldDir)) {
|
|
8565
8577
|
await mkdir(scaffoldDir, { recursive: true });
|
|
8566
8578
|
}
|
|
8567
|
-
const marketplaceDir =
|
|
8579
|
+
const marketplaceDir = join3(targetConfigDir, MARKETPLACE_REL);
|
|
8568
8580
|
if (!existsSync2(marketplaceDir)) {
|
|
8569
8581
|
await mkdir(marketplaceDir, { recursive: true });
|
|
8570
8582
|
}
|
|
8571
8583
|
for (const metaFile of ["known_marketplaces.json", "blocklist.json"]) {
|
|
8572
|
-
const src =
|
|
8573
|
-
const tgt =
|
|
8584
|
+
const src = join3(defaultDir, MARKETPLACE_REL, metaFile);
|
|
8585
|
+
const tgt = join3(marketplaceDir, metaFile);
|
|
8574
8586
|
if (existsSync2(src) && !existsSync2(tgt)) {
|
|
8575
8587
|
await copyFile(src, tgt);
|
|
8576
8588
|
}
|
|
@@ -8594,7 +8606,7 @@ async function copySelectedPlugins(targetConfigDir, selections) {
|
|
|
8594
8606
|
const defaultDir = getDefaultClaudeDir();
|
|
8595
8607
|
for (const sel of selections) {
|
|
8596
8608
|
const subDir = sel.category === PluginCategory.Internal ? "plugins" : "external_plugins";
|
|
8597
|
-
const source =
|
|
8609
|
+
const source = join3(defaultDir, MARKETPLACE_REL, subDir, sel.id);
|
|
8598
8610
|
if (!existsSync2(source)) {
|
|
8599
8611
|
throw new ClaudeMultiError(ErrorCode.PLUGIN_NOT_FOUND, `Plugin '${sel.id}' not found in default Claude`);
|
|
8600
8612
|
}
|
|
@@ -8602,7 +8614,7 @@ async function copySelectedPlugins(targetConfigDir, selections) {
|
|
|
8602
8614
|
let totalSize = 0;
|
|
8603
8615
|
for (const sel of selections) {
|
|
8604
8616
|
const subDir = sel.category === PluginCategory.Internal ? "plugins" : "external_plugins";
|
|
8605
|
-
totalSize += estimatePluginSize(
|
|
8617
|
+
totalSize += estimatePluginSize(join3(defaultDir, MARKETPLACE_REL, subDir, sel.id));
|
|
8606
8618
|
}
|
|
8607
8619
|
if (totalSize > 104857600) {
|
|
8608
8620
|
throw new ClaudeMultiError(ErrorCode.PLUGIN_TOO_LARGE, `Selected plugins total ${(totalSize / 1024 / 1024).toFixed(1)}MB. Ensure sufficient disk space.`);
|
|
@@ -8617,7 +8629,7 @@ async function copySelectedPlugins(targetConfigDir, selections) {
|
|
|
8617
8629
|
for (const done of completed) {
|
|
8618
8630
|
try {
|
|
8619
8631
|
const subDir = done.category === PluginCategory.Internal ? "plugins" : "external_plugins";
|
|
8620
|
-
const targetPath =
|
|
8632
|
+
const targetPath = join3(targetConfigDir, MARKETPLACE_REL, subDir, done.id);
|
|
8621
8633
|
if (existsSync2(targetPath)) {
|
|
8622
8634
|
rmSync2(targetPath, { force: true, recursive: true });
|
|
8623
8635
|
}
|
|
@@ -8634,7 +8646,7 @@ async function removeSinglePlugin(configDir, pluginId, category) {
|
|
|
8634
8646
|
throw new ClaudeMultiError(ErrorCode.SYMLINK_CONFLICT, "Cannot remove plugins from a symlinked instance. Disable auto-sync first.");
|
|
8635
8647
|
}
|
|
8636
8648
|
const subDir = category === PluginCategory.Internal ? "plugins" : "external_plugins";
|
|
8637
|
-
const pluginPath =
|
|
8649
|
+
const pluginPath = join3(configDir, MARKETPLACE_REL, subDir, pluginId);
|
|
8638
8650
|
if (!existsSync2(pluginPath)) {
|
|
8639
8651
|
throw new ClaudeMultiError(ErrorCode.PLUGIN_NOT_FOUND, `Plugin '${pluginId}' not found in this instance`);
|
|
8640
8652
|
}
|
|
@@ -8658,15 +8670,15 @@ async function removeSinglePlugin(configDir, pluginId, category) {
|
|
|
8658
8670
|
}
|
|
8659
8671
|
function getMcpServersFromPlugins(configDir) {
|
|
8660
8672
|
const result = {};
|
|
8661
|
-
const basePlugins =
|
|
8673
|
+
const basePlugins = join3(configDir, MARKETPLACE_REL);
|
|
8662
8674
|
for (const subDir of ["plugins", "external_plugins"]) {
|
|
8663
|
-
const dir =
|
|
8675
|
+
const dir = join3(basePlugins, subDir);
|
|
8664
8676
|
if (!existsSync2(dir))
|
|
8665
8677
|
continue;
|
|
8666
8678
|
for (const entry of readdirSync2(dir, { withFileTypes: true })) {
|
|
8667
8679
|
if (!entry.isDirectory())
|
|
8668
8680
|
continue;
|
|
8669
|
-
const mcpFile =
|
|
8681
|
+
const mcpFile = join3(dir, entry.name, ".mcp.json");
|
|
8670
8682
|
if (!existsSync2(mcpFile))
|
|
8671
8683
|
continue;
|
|
8672
8684
|
const servers = readMcpJsonFile(mcpFile);
|
|
@@ -8732,6 +8744,17 @@ import { writeFile as writeFile3 } from "node:fs/promises";
|
|
|
8732
8744
|
import { resolve as resolve2, dirname as dirname3 } from "node:path";
|
|
8733
8745
|
import { execSync } from "node:child_process";
|
|
8734
8746
|
function getClaudePath() {
|
|
8747
|
+
const override = process.env.CLAUDE_MULTI_CLAUDE_PATH;
|
|
8748
|
+
if (override) {
|
|
8749
|
+
const resolved = resolve2(override);
|
|
8750
|
+
if (!existsSync3(resolved)) {
|
|
8751
|
+
throw new ClaudeMultiError(ErrorCode.CLAUDE_NOT_FOUND, `CLAUDE_MULTI_CLAUDE_PATH points to ${resolved} but that file does not exist`);
|
|
8752
|
+
}
|
|
8753
|
+
return resolved;
|
|
8754
|
+
}
|
|
8755
|
+
if (existsSync3(PINNED_CLAUDE_BIN)) {
|
|
8756
|
+
return PINNED_CLAUDE_BIN;
|
|
8757
|
+
}
|
|
8735
8758
|
try {
|
|
8736
8759
|
const command = process.platform === "win32" ? "where claude" : "which claude";
|
|
8737
8760
|
const claudePath = execSync(command, { encoding: "utf-8" }).trim();
|
|
@@ -8810,6 +8833,1999 @@ function getDefaultBinaryPath(name) {
|
|
|
8810
8833
|
}
|
|
8811
8834
|
var init_wrapper = __esm(() => {
|
|
8812
8835
|
init_errors();
|
|
8836
|
+
init_paths();
|
|
8837
|
+
});
|
|
8838
|
+
|
|
8839
|
+
// node_modules/semver/internal/constants.js
|
|
8840
|
+
var require_constants = __commonJS((exports, module) => {
|
|
8841
|
+
var SEMVER_SPEC_VERSION = "2.0.0";
|
|
8842
|
+
var MAX_LENGTH = 256;
|
|
8843
|
+
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
|
|
8844
|
+
var MAX_SAFE_COMPONENT_LENGTH = 16;
|
|
8845
|
+
var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
|
|
8846
|
+
var RELEASE_TYPES = [
|
|
8847
|
+
"major",
|
|
8848
|
+
"premajor",
|
|
8849
|
+
"minor",
|
|
8850
|
+
"preminor",
|
|
8851
|
+
"patch",
|
|
8852
|
+
"prepatch",
|
|
8853
|
+
"prerelease"
|
|
8854
|
+
];
|
|
8855
|
+
module.exports = {
|
|
8856
|
+
MAX_LENGTH,
|
|
8857
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
|
8858
|
+
MAX_SAFE_BUILD_LENGTH,
|
|
8859
|
+
MAX_SAFE_INTEGER,
|
|
8860
|
+
RELEASE_TYPES,
|
|
8861
|
+
SEMVER_SPEC_VERSION,
|
|
8862
|
+
FLAG_INCLUDE_PRERELEASE: 1,
|
|
8863
|
+
FLAG_LOOSE: 2
|
|
8864
|
+
};
|
|
8865
|
+
});
|
|
8866
|
+
|
|
8867
|
+
// node_modules/semver/internal/debug.js
|
|
8868
|
+
var require_debug = __commonJS((exports, module) => {
|
|
8869
|
+
var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
|
|
8870
|
+
module.exports = debug;
|
|
8871
|
+
});
|
|
8872
|
+
|
|
8873
|
+
// node_modules/semver/internal/re.js
|
|
8874
|
+
var require_re = __commonJS((exports, module) => {
|
|
8875
|
+
var {
|
|
8876
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
|
8877
|
+
MAX_SAFE_BUILD_LENGTH,
|
|
8878
|
+
MAX_LENGTH
|
|
8879
|
+
} = require_constants();
|
|
8880
|
+
var debug = require_debug();
|
|
8881
|
+
exports = module.exports = {};
|
|
8882
|
+
var re = exports.re = [];
|
|
8883
|
+
var safeRe = exports.safeRe = [];
|
|
8884
|
+
var src = exports.src = [];
|
|
8885
|
+
var safeSrc = exports.safeSrc = [];
|
|
8886
|
+
var t = exports.t = {};
|
|
8887
|
+
var R = 0;
|
|
8888
|
+
var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
|
|
8889
|
+
var safeRegexReplacements = [
|
|
8890
|
+
["\\s", 1],
|
|
8891
|
+
["\\d", MAX_LENGTH],
|
|
8892
|
+
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
|
|
8893
|
+
];
|
|
8894
|
+
var makeSafeRegex = (value) => {
|
|
8895
|
+
for (const [token, max] of safeRegexReplacements) {
|
|
8896
|
+
value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
|
|
8897
|
+
}
|
|
8898
|
+
return value;
|
|
8899
|
+
};
|
|
8900
|
+
var createToken = (name, value, isGlobal) => {
|
|
8901
|
+
const safe = makeSafeRegex(value);
|
|
8902
|
+
const index = R++;
|
|
8903
|
+
debug(name, index, value);
|
|
8904
|
+
t[name] = index;
|
|
8905
|
+
src[index] = value;
|
|
8906
|
+
safeSrc[index] = safe;
|
|
8907
|
+
re[index] = new RegExp(value, isGlobal ? "g" : undefined);
|
|
8908
|
+
safeRe[index] = new RegExp(safe, isGlobal ? "g" : undefined);
|
|
8909
|
+
};
|
|
8910
|
+
createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
|
|
8911
|
+
createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
|
|
8912
|
+
createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
|
|
8913
|
+
createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.` + `(${src[t.NUMERICIDENTIFIER]})\\.` + `(${src[t.NUMERICIDENTIFIER]})`);
|
|
8914
|
+
createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + `(${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
8915
|
+
createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
|
|
8916
|
+
createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
8917
|
+
createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
|
|
8918
|
+
createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
|
|
8919
|
+
createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
|
|
8920
|
+
createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
|
|
8921
|
+
createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
|
|
8922
|
+
createToken("FULL", `^${src[t.FULLPLAIN]}$`);
|
|
8923
|
+
createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
|
|
8924
|
+
createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
|
|
8925
|
+
createToken("GTLT", "((?:<|>)?=?)");
|
|
8926
|
+
createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
|
|
8927
|
+
createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
|
|
8928
|
+
createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + `(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?` + `)?)?`);
|
|
8929
|
+
createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?` + `)?)?`);
|
|
8930
|
+
createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
|
|
8931
|
+
createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
|
|
8932
|
+
createToken("COERCEPLAIN", `${"(^|[^\\d])" + "(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})` + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
|
|
8933
|
+
createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
|
|
8934
|
+
createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?` + `(?:${src[t.BUILD]})?` + `(?:$|[^\\d])`);
|
|
8935
|
+
createToken("COERCERTL", src[t.COERCE], true);
|
|
8936
|
+
createToken("COERCERTLFULL", src[t.COERCEFULL], true);
|
|
8937
|
+
createToken("LONETILDE", "(?:~>?)");
|
|
8938
|
+
createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
|
|
8939
|
+
exports.tildeTrimReplace = "$1~";
|
|
8940
|
+
createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
|
|
8941
|
+
createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
8942
|
+
createToken("LONECARET", "(?:\\^)");
|
|
8943
|
+
createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
|
|
8944
|
+
exports.caretTrimReplace = "$1^";
|
|
8945
|
+
createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
|
|
8946
|
+
createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
8947
|
+
createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
|
|
8948
|
+
createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
|
|
8949
|
+
createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
|
|
8950
|
+
exports.comparatorTrimReplace = "$1$2$3";
|
|
8951
|
+
createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})` + `\\s+-\\s+` + `(${src[t.XRANGEPLAIN]})` + `\\s*$`);
|
|
8952
|
+
createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})` + `\\s+-\\s+` + `(${src[t.XRANGEPLAINLOOSE]})` + `\\s*$`);
|
|
8953
|
+
createToken("STAR", "(<|>)?=?\\s*\\*");
|
|
8954
|
+
createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
|
|
8955
|
+
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
8956
|
+
});
|
|
8957
|
+
|
|
8958
|
+
// node_modules/semver/internal/parse-options.js
|
|
8959
|
+
var require_parse_options = __commonJS((exports, module) => {
|
|
8960
|
+
var looseOption = Object.freeze({ loose: true });
|
|
8961
|
+
var emptyOpts = Object.freeze({});
|
|
8962
|
+
var parseOptions = (options) => {
|
|
8963
|
+
if (!options) {
|
|
8964
|
+
return emptyOpts;
|
|
8965
|
+
}
|
|
8966
|
+
if (typeof options !== "object") {
|
|
8967
|
+
return looseOption;
|
|
8968
|
+
}
|
|
8969
|
+
return options;
|
|
8970
|
+
};
|
|
8971
|
+
module.exports = parseOptions;
|
|
8972
|
+
});
|
|
8973
|
+
|
|
8974
|
+
// node_modules/semver/internal/identifiers.js
|
|
8975
|
+
var require_identifiers = __commonJS((exports, module) => {
|
|
8976
|
+
var numeric = /^[0-9]+$/;
|
|
8977
|
+
var compareIdentifiers = (a, b) => {
|
|
8978
|
+
if (typeof a === "number" && typeof b === "number") {
|
|
8979
|
+
return a === b ? 0 : a < b ? -1 : 1;
|
|
8980
|
+
}
|
|
8981
|
+
const anum = numeric.test(a);
|
|
8982
|
+
const bnum = numeric.test(b);
|
|
8983
|
+
if (anum && bnum) {
|
|
8984
|
+
a = +a;
|
|
8985
|
+
b = +b;
|
|
8986
|
+
}
|
|
8987
|
+
return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
|
|
8988
|
+
};
|
|
8989
|
+
var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
|
|
8990
|
+
module.exports = {
|
|
8991
|
+
compareIdentifiers,
|
|
8992
|
+
rcompareIdentifiers
|
|
8993
|
+
};
|
|
8994
|
+
});
|
|
8995
|
+
|
|
8996
|
+
// node_modules/semver/classes/semver.js
|
|
8997
|
+
var require_semver = __commonJS((exports, module) => {
|
|
8998
|
+
var debug = require_debug();
|
|
8999
|
+
var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
|
|
9000
|
+
var { safeRe: re, t } = require_re();
|
|
9001
|
+
var parseOptions = require_parse_options();
|
|
9002
|
+
var { compareIdentifiers } = require_identifiers();
|
|
9003
|
+
|
|
9004
|
+
class SemVer {
|
|
9005
|
+
constructor(version, options) {
|
|
9006
|
+
options = parseOptions(options);
|
|
9007
|
+
if (version instanceof SemVer) {
|
|
9008
|
+
if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
|
|
9009
|
+
return version;
|
|
9010
|
+
} else {
|
|
9011
|
+
version = version.version;
|
|
9012
|
+
}
|
|
9013
|
+
} else if (typeof version !== "string") {
|
|
9014
|
+
throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
|
|
9015
|
+
}
|
|
9016
|
+
if (version.length > MAX_LENGTH) {
|
|
9017
|
+
throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
|
|
9018
|
+
}
|
|
9019
|
+
debug("SemVer", version, options);
|
|
9020
|
+
this.options = options;
|
|
9021
|
+
this.loose = !!options.loose;
|
|
9022
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
9023
|
+
const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
|
9024
|
+
if (!m) {
|
|
9025
|
+
throw new TypeError(`Invalid Version: ${version}`);
|
|
9026
|
+
}
|
|
9027
|
+
this.raw = version;
|
|
9028
|
+
this.major = +m[1];
|
|
9029
|
+
this.minor = +m[2];
|
|
9030
|
+
this.patch = +m[3];
|
|
9031
|
+
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
|
9032
|
+
throw new TypeError("Invalid major version");
|
|
9033
|
+
}
|
|
9034
|
+
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
|
9035
|
+
throw new TypeError("Invalid minor version");
|
|
9036
|
+
}
|
|
9037
|
+
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
|
9038
|
+
throw new TypeError("Invalid patch version");
|
|
9039
|
+
}
|
|
9040
|
+
if (!m[4]) {
|
|
9041
|
+
this.prerelease = [];
|
|
9042
|
+
} else {
|
|
9043
|
+
this.prerelease = m[4].split(".").map((id) => {
|
|
9044
|
+
if (/^[0-9]+$/.test(id)) {
|
|
9045
|
+
const num = +id;
|
|
9046
|
+
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
|
9047
|
+
return num;
|
|
9048
|
+
}
|
|
9049
|
+
}
|
|
9050
|
+
return id;
|
|
9051
|
+
});
|
|
9052
|
+
}
|
|
9053
|
+
this.build = m[5] ? m[5].split(".") : [];
|
|
9054
|
+
this.format();
|
|
9055
|
+
}
|
|
9056
|
+
format() {
|
|
9057
|
+
this.version = `${this.major}.${this.minor}.${this.patch}`;
|
|
9058
|
+
if (this.prerelease.length) {
|
|
9059
|
+
this.version += `-${this.prerelease.join(".")}`;
|
|
9060
|
+
}
|
|
9061
|
+
return this.version;
|
|
9062
|
+
}
|
|
9063
|
+
toString() {
|
|
9064
|
+
return this.version;
|
|
9065
|
+
}
|
|
9066
|
+
compare(other) {
|
|
9067
|
+
debug("SemVer.compare", this.version, this.options, other);
|
|
9068
|
+
if (!(other instanceof SemVer)) {
|
|
9069
|
+
if (typeof other === "string" && other === this.version) {
|
|
9070
|
+
return 0;
|
|
9071
|
+
}
|
|
9072
|
+
other = new SemVer(other, this.options);
|
|
9073
|
+
}
|
|
9074
|
+
if (other.version === this.version) {
|
|
9075
|
+
return 0;
|
|
9076
|
+
}
|
|
9077
|
+
return this.compareMain(other) || this.comparePre(other);
|
|
9078
|
+
}
|
|
9079
|
+
compareMain(other) {
|
|
9080
|
+
if (!(other instanceof SemVer)) {
|
|
9081
|
+
other = new SemVer(other, this.options);
|
|
9082
|
+
}
|
|
9083
|
+
if (this.major < other.major) {
|
|
9084
|
+
return -1;
|
|
9085
|
+
}
|
|
9086
|
+
if (this.major > other.major) {
|
|
9087
|
+
return 1;
|
|
9088
|
+
}
|
|
9089
|
+
if (this.minor < other.minor) {
|
|
9090
|
+
return -1;
|
|
9091
|
+
}
|
|
9092
|
+
if (this.minor > other.minor) {
|
|
9093
|
+
return 1;
|
|
9094
|
+
}
|
|
9095
|
+
if (this.patch < other.patch) {
|
|
9096
|
+
return -1;
|
|
9097
|
+
}
|
|
9098
|
+
if (this.patch > other.patch) {
|
|
9099
|
+
return 1;
|
|
9100
|
+
}
|
|
9101
|
+
return 0;
|
|
9102
|
+
}
|
|
9103
|
+
comparePre(other) {
|
|
9104
|
+
if (!(other instanceof SemVer)) {
|
|
9105
|
+
other = new SemVer(other, this.options);
|
|
9106
|
+
}
|
|
9107
|
+
if (this.prerelease.length && !other.prerelease.length) {
|
|
9108
|
+
return -1;
|
|
9109
|
+
} else if (!this.prerelease.length && other.prerelease.length) {
|
|
9110
|
+
return 1;
|
|
9111
|
+
} else if (!this.prerelease.length && !other.prerelease.length) {
|
|
9112
|
+
return 0;
|
|
9113
|
+
}
|
|
9114
|
+
let i = 0;
|
|
9115
|
+
do {
|
|
9116
|
+
const a = this.prerelease[i];
|
|
9117
|
+
const b = other.prerelease[i];
|
|
9118
|
+
debug("prerelease compare", i, a, b);
|
|
9119
|
+
if (a === undefined && b === undefined) {
|
|
9120
|
+
return 0;
|
|
9121
|
+
} else if (b === undefined) {
|
|
9122
|
+
return 1;
|
|
9123
|
+
} else if (a === undefined) {
|
|
9124
|
+
return -1;
|
|
9125
|
+
} else if (a === b) {
|
|
9126
|
+
continue;
|
|
9127
|
+
} else {
|
|
9128
|
+
return compareIdentifiers(a, b);
|
|
9129
|
+
}
|
|
9130
|
+
} while (++i);
|
|
9131
|
+
}
|
|
9132
|
+
compareBuild(other) {
|
|
9133
|
+
if (!(other instanceof SemVer)) {
|
|
9134
|
+
other = new SemVer(other, this.options);
|
|
9135
|
+
}
|
|
9136
|
+
let i = 0;
|
|
9137
|
+
do {
|
|
9138
|
+
const a = this.build[i];
|
|
9139
|
+
const b = other.build[i];
|
|
9140
|
+
debug("build compare", i, a, b);
|
|
9141
|
+
if (a === undefined && b === undefined) {
|
|
9142
|
+
return 0;
|
|
9143
|
+
} else if (b === undefined) {
|
|
9144
|
+
return 1;
|
|
9145
|
+
} else if (a === undefined) {
|
|
9146
|
+
return -1;
|
|
9147
|
+
} else if (a === b) {
|
|
9148
|
+
continue;
|
|
9149
|
+
} else {
|
|
9150
|
+
return compareIdentifiers(a, b);
|
|
9151
|
+
}
|
|
9152
|
+
} while (++i);
|
|
9153
|
+
}
|
|
9154
|
+
inc(release, identifier, identifierBase) {
|
|
9155
|
+
if (release.startsWith("pre")) {
|
|
9156
|
+
if (!identifier && identifierBase === false) {
|
|
9157
|
+
throw new Error("invalid increment argument: identifier is empty");
|
|
9158
|
+
}
|
|
9159
|
+
if (identifier) {
|
|
9160
|
+
const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
|
|
9161
|
+
if (!match || match[1] !== identifier) {
|
|
9162
|
+
throw new Error(`invalid identifier: ${identifier}`);
|
|
9163
|
+
}
|
|
9164
|
+
}
|
|
9165
|
+
}
|
|
9166
|
+
switch (release) {
|
|
9167
|
+
case "premajor":
|
|
9168
|
+
this.prerelease.length = 0;
|
|
9169
|
+
this.patch = 0;
|
|
9170
|
+
this.minor = 0;
|
|
9171
|
+
this.major++;
|
|
9172
|
+
this.inc("pre", identifier, identifierBase);
|
|
9173
|
+
break;
|
|
9174
|
+
case "preminor":
|
|
9175
|
+
this.prerelease.length = 0;
|
|
9176
|
+
this.patch = 0;
|
|
9177
|
+
this.minor++;
|
|
9178
|
+
this.inc("pre", identifier, identifierBase);
|
|
9179
|
+
break;
|
|
9180
|
+
case "prepatch":
|
|
9181
|
+
this.prerelease.length = 0;
|
|
9182
|
+
this.inc("patch", identifier, identifierBase);
|
|
9183
|
+
this.inc("pre", identifier, identifierBase);
|
|
9184
|
+
break;
|
|
9185
|
+
case "prerelease":
|
|
9186
|
+
if (this.prerelease.length === 0) {
|
|
9187
|
+
this.inc("patch", identifier, identifierBase);
|
|
9188
|
+
}
|
|
9189
|
+
this.inc("pre", identifier, identifierBase);
|
|
9190
|
+
break;
|
|
9191
|
+
case "release":
|
|
9192
|
+
if (this.prerelease.length === 0) {
|
|
9193
|
+
throw new Error(`version ${this.raw} is not a prerelease`);
|
|
9194
|
+
}
|
|
9195
|
+
this.prerelease.length = 0;
|
|
9196
|
+
break;
|
|
9197
|
+
case "major":
|
|
9198
|
+
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
|
|
9199
|
+
this.major++;
|
|
9200
|
+
}
|
|
9201
|
+
this.minor = 0;
|
|
9202
|
+
this.patch = 0;
|
|
9203
|
+
this.prerelease = [];
|
|
9204
|
+
break;
|
|
9205
|
+
case "minor":
|
|
9206
|
+
if (this.patch !== 0 || this.prerelease.length === 0) {
|
|
9207
|
+
this.minor++;
|
|
9208
|
+
}
|
|
9209
|
+
this.patch = 0;
|
|
9210
|
+
this.prerelease = [];
|
|
9211
|
+
break;
|
|
9212
|
+
case "patch":
|
|
9213
|
+
if (this.prerelease.length === 0) {
|
|
9214
|
+
this.patch++;
|
|
9215
|
+
}
|
|
9216
|
+
this.prerelease = [];
|
|
9217
|
+
break;
|
|
9218
|
+
case "pre": {
|
|
9219
|
+
const base = Number(identifierBase) ? 1 : 0;
|
|
9220
|
+
if (this.prerelease.length === 0) {
|
|
9221
|
+
this.prerelease = [base];
|
|
9222
|
+
} else {
|
|
9223
|
+
let i = this.prerelease.length;
|
|
9224
|
+
while (--i >= 0) {
|
|
9225
|
+
if (typeof this.prerelease[i] === "number") {
|
|
9226
|
+
this.prerelease[i]++;
|
|
9227
|
+
i = -2;
|
|
9228
|
+
}
|
|
9229
|
+
}
|
|
9230
|
+
if (i === -1) {
|
|
9231
|
+
if (identifier === this.prerelease.join(".") && identifierBase === false) {
|
|
9232
|
+
throw new Error("invalid increment argument: identifier already exists");
|
|
9233
|
+
}
|
|
9234
|
+
this.prerelease.push(base);
|
|
9235
|
+
}
|
|
9236
|
+
}
|
|
9237
|
+
if (identifier) {
|
|
9238
|
+
let prerelease = [identifier, base];
|
|
9239
|
+
if (identifierBase === false) {
|
|
9240
|
+
prerelease = [identifier];
|
|
9241
|
+
}
|
|
9242
|
+
if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
|
|
9243
|
+
if (isNaN(this.prerelease[1])) {
|
|
9244
|
+
this.prerelease = prerelease;
|
|
9245
|
+
}
|
|
9246
|
+
} else {
|
|
9247
|
+
this.prerelease = prerelease;
|
|
9248
|
+
}
|
|
9249
|
+
}
|
|
9250
|
+
break;
|
|
9251
|
+
}
|
|
9252
|
+
default:
|
|
9253
|
+
throw new Error(`invalid increment argument: ${release}`);
|
|
9254
|
+
}
|
|
9255
|
+
this.raw = this.format();
|
|
9256
|
+
if (this.build.length) {
|
|
9257
|
+
this.raw += `+${this.build.join(".")}`;
|
|
9258
|
+
}
|
|
9259
|
+
return this;
|
|
9260
|
+
}
|
|
9261
|
+
}
|
|
9262
|
+
module.exports = SemVer;
|
|
9263
|
+
});
|
|
9264
|
+
|
|
9265
|
+
// node_modules/semver/functions/parse.js
|
|
9266
|
+
var require_parse = __commonJS((exports, module) => {
|
|
9267
|
+
var SemVer = require_semver();
|
|
9268
|
+
var parse = (version, options, throwErrors = false) => {
|
|
9269
|
+
if (version instanceof SemVer) {
|
|
9270
|
+
return version;
|
|
9271
|
+
}
|
|
9272
|
+
try {
|
|
9273
|
+
return new SemVer(version, options);
|
|
9274
|
+
} catch (er) {
|
|
9275
|
+
if (!throwErrors) {
|
|
9276
|
+
return null;
|
|
9277
|
+
}
|
|
9278
|
+
throw er;
|
|
9279
|
+
}
|
|
9280
|
+
};
|
|
9281
|
+
module.exports = parse;
|
|
9282
|
+
});
|
|
9283
|
+
|
|
9284
|
+
// node_modules/semver/functions/valid.js
|
|
9285
|
+
var require_valid = __commonJS((exports, module) => {
|
|
9286
|
+
var parse = require_parse();
|
|
9287
|
+
var valid = (version, options) => {
|
|
9288
|
+
const v = parse(version, options);
|
|
9289
|
+
return v ? v.version : null;
|
|
9290
|
+
};
|
|
9291
|
+
module.exports = valid;
|
|
9292
|
+
});
|
|
9293
|
+
|
|
9294
|
+
// node_modules/semver/functions/clean.js
|
|
9295
|
+
var require_clean = __commonJS((exports, module) => {
|
|
9296
|
+
var parse = require_parse();
|
|
9297
|
+
var clean = (version, options) => {
|
|
9298
|
+
const s = parse(version.trim().replace(/^[=v]+/, ""), options);
|
|
9299
|
+
return s ? s.version : null;
|
|
9300
|
+
};
|
|
9301
|
+
module.exports = clean;
|
|
9302
|
+
});
|
|
9303
|
+
|
|
9304
|
+
// node_modules/semver/functions/inc.js
|
|
9305
|
+
var require_inc = __commonJS((exports, module) => {
|
|
9306
|
+
var SemVer = require_semver();
|
|
9307
|
+
var inc = (version, release, options, identifier, identifierBase) => {
|
|
9308
|
+
if (typeof options === "string") {
|
|
9309
|
+
identifierBase = identifier;
|
|
9310
|
+
identifier = options;
|
|
9311
|
+
options = undefined;
|
|
9312
|
+
}
|
|
9313
|
+
try {
|
|
9314
|
+
return new SemVer(version instanceof SemVer ? version.version : version, options).inc(release, identifier, identifierBase).version;
|
|
9315
|
+
} catch (er) {
|
|
9316
|
+
return null;
|
|
9317
|
+
}
|
|
9318
|
+
};
|
|
9319
|
+
module.exports = inc;
|
|
9320
|
+
});
|
|
9321
|
+
|
|
9322
|
+
// node_modules/semver/functions/diff.js
|
|
9323
|
+
var require_diff = __commonJS((exports, module) => {
|
|
9324
|
+
var parse = require_parse();
|
|
9325
|
+
var diff = (version1, version2) => {
|
|
9326
|
+
const v1 = parse(version1, null, true);
|
|
9327
|
+
const v2 = parse(version2, null, true);
|
|
9328
|
+
const comparison = v1.compare(v2);
|
|
9329
|
+
if (comparison === 0) {
|
|
9330
|
+
return null;
|
|
9331
|
+
}
|
|
9332
|
+
const v1Higher = comparison > 0;
|
|
9333
|
+
const highVersion = v1Higher ? v1 : v2;
|
|
9334
|
+
const lowVersion = v1Higher ? v2 : v1;
|
|
9335
|
+
const highHasPre = !!highVersion.prerelease.length;
|
|
9336
|
+
const lowHasPre = !!lowVersion.prerelease.length;
|
|
9337
|
+
if (lowHasPre && !highHasPre) {
|
|
9338
|
+
if (!lowVersion.patch && !lowVersion.minor) {
|
|
9339
|
+
return "major";
|
|
9340
|
+
}
|
|
9341
|
+
if (lowVersion.compareMain(highVersion) === 0) {
|
|
9342
|
+
if (lowVersion.minor && !lowVersion.patch) {
|
|
9343
|
+
return "minor";
|
|
9344
|
+
}
|
|
9345
|
+
return "patch";
|
|
9346
|
+
}
|
|
9347
|
+
}
|
|
9348
|
+
const prefix = highHasPre ? "pre" : "";
|
|
9349
|
+
if (v1.major !== v2.major) {
|
|
9350
|
+
return prefix + "major";
|
|
9351
|
+
}
|
|
9352
|
+
if (v1.minor !== v2.minor) {
|
|
9353
|
+
return prefix + "minor";
|
|
9354
|
+
}
|
|
9355
|
+
if (v1.patch !== v2.patch) {
|
|
9356
|
+
return prefix + "patch";
|
|
9357
|
+
}
|
|
9358
|
+
return "prerelease";
|
|
9359
|
+
};
|
|
9360
|
+
module.exports = diff;
|
|
9361
|
+
});
|
|
9362
|
+
|
|
9363
|
+
// node_modules/semver/functions/major.js
|
|
9364
|
+
var require_major = __commonJS((exports, module) => {
|
|
9365
|
+
var SemVer = require_semver();
|
|
9366
|
+
var major = (a, loose) => new SemVer(a, loose).major;
|
|
9367
|
+
module.exports = major;
|
|
9368
|
+
});
|
|
9369
|
+
|
|
9370
|
+
// node_modules/semver/functions/minor.js
|
|
9371
|
+
var require_minor = __commonJS((exports, module) => {
|
|
9372
|
+
var SemVer = require_semver();
|
|
9373
|
+
var minor = (a, loose) => new SemVer(a, loose).minor;
|
|
9374
|
+
module.exports = minor;
|
|
9375
|
+
});
|
|
9376
|
+
|
|
9377
|
+
// node_modules/semver/functions/patch.js
|
|
9378
|
+
var require_patch = __commonJS((exports, module) => {
|
|
9379
|
+
var SemVer = require_semver();
|
|
9380
|
+
var patch = (a, loose) => new SemVer(a, loose).patch;
|
|
9381
|
+
module.exports = patch;
|
|
9382
|
+
});
|
|
9383
|
+
|
|
9384
|
+
// node_modules/semver/functions/prerelease.js
|
|
9385
|
+
var require_prerelease = __commonJS((exports, module) => {
|
|
9386
|
+
var parse = require_parse();
|
|
9387
|
+
var prerelease = (version, options) => {
|
|
9388
|
+
const parsed = parse(version, options);
|
|
9389
|
+
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
|
9390
|
+
};
|
|
9391
|
+
module.exports = prerelease;
|
|
9392
|
+
});
|
|
9393
|
+
|
|
9394
|
+
// node_modules/semver/functions/compare.js
|
|
9395
|
+
var require_compare = __commonJS((exports, module) => {
|
|
9396
|
+
var SemVer = require_semver();
|
|
9397
|
+
var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
|
|
9398
|
+
module.exports = compare;
|
|
9399
|
+
});
|
|
9400
|
+
|
|
9401
|
+
// node_modules/semver/functions/rcompare.js
|
|
9402
|
+
var require_rcompare = __commonJS((exports, module) => {
|
|
9403
|
+
var compare = require_compare();
|
|
9404
|
+
var rcompare = (a, b, loose) => compare(b, a, loose);
|
|
9405
|
+
module.exports = rcompare;
|
|
9406
|
+
});
|
|
9407
|
+
|
|
9408
|
+
// node_modules/semver/functions/compare-loose.js
|
|
9409
|
+
var require_compare_loose = __commonJS((exports, module) => {
|
|
9410
|
+
var compare = require_compare();
|
|
9411
|
+
var compareLoose = (a, b) => compare(a, b, true);
|
|
9412
|
+
module.exports = compareLoose;
|
|
9413
|
+
});
|
|
9414
|
+
|
|
9415
|
+
// node_modules/semver/functions/compare-build.js
|
|
9416
|
+
var require_compare_build = __commonJS((exports, module) => {
|
|
9417
|
+
var SemVer = require_semver();
|
|
9418
|
+
var compareBuild = (a, b, loose) => {
|
|
9419
|
+
const versionA = new SemVer(a, loose);
|
|
9420
|
+
const versionB = new SemVer(b, loose);
|
|
9421
|
+
return versionA.compare(versionB) || versionA.compareBuild(versionB);
|
|
9422
|
+
};
|
|
9423
|
+
module.exports = compareBuild;
|
|
9424
|
+
});
|
|
9425
|
+
|
|
9426
|
+
// node_modules/semver/functions/sort.js
|
|
9427
|
+
var require_sort = __commonJS((exports, module) => {
|
|
9428
|
+
var compareBuild = require_compare_build();
|
|
9429
|
+
var sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
|
|
9430
|
+
module.exports = sort;
|
|
9431
|
+
});
|
|
9432
|
+
|
|
9433
|
+
// node_modules/semver/functions/rsort.js
|
|
9434
|
+
var require_rsort = __commonJS((exports, module) => {
|
|
9435
|
+
var compareBuild = require_compare_build();
|
|
9436
|
+
var rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
|
|
9437
|
+
module.exports = rsort;
|
|
9438
|
+
});
|
|
9439
|
+
|
|
9440
|
+
// node_modules/semver/functions/gt.js
|
|
9441
|
+
var require_gt = __commonJS((exports, module) => {
|
|
9442
|
+
var compare = require_compare();
|
|
9443
|
+
var gt = (a, b, loose) => compare(a, b, loose) > 0;
|
|
9444
|
+
module.exports = gt;
|
|
9445
|
+
});
|
|
9446
|
+
|
|
9447
|
+
// node_modules/semver/functions/lt.js
|
|
9448
|
+
var require_lt = __commonJS((exports, module) => {
|
|
9449
|
+
var compare = require_compare();
|
|
9450
|
+
var lt = (a, b, loose) => compare(a, b, loose) < 0;
|
|
9451
|
+
module.exports = lt;
|
|
9452
|
+
});
|
|
9453
|
+
|
|
9454
|
+
// node_modules/semver/functions/eq.js
|
|
9455
|
+
var require_eq = __commonJS((exports, module) => {
|
|
9456
|
+
var compare = require_compare();
|
|
9457
|
+
var eq = (a, b, loose) => compare(a, b, loose) === 0;
|
|
9458
|
+
module.exports = eq;
|
|
9459
|
+
});
|
|
9460
|
+
|
|
9461
|
+
// node_modules/semver/functions/neq.js
|
|
9462
|
+
var require_neq = __commonJS((exports, module) => {
|
|
9463
|
+
var compare = require_compare();
|
|
9464
|
+
var neq = (a, b, loose) => compare(a, b, loose) !== 0;
|
|
9465
|
+
module.exports = neq;
|
|
9466
|
+
});
|
|
9467
|
+
|
|
9468
|
+
// node_modules/semver/functions/gte.js
|
|
9469
|
+
var require_gte = __commonJS((exports, module) => {
|
|
9470
|
+
var compare = require_compare();
|
|
9471
|
+
var gte = (a, b, loose) => compare(a, b, loose) >= 0;
|
|
9472
|
+
module.exports = gte;
|
|
9473
|
+
});
|
|
9474
|
+
|
|
9475
|
+
// node_modules/semver/functions/lte.js
|
|
9476
|
+
var require_lte = __commonJS((exports, module) => {
|
|
9477
|
+
var compare = require_compare();
|
|
9478
|
+
var lte = (a, b, loose) => compare(a, b, loose) <= 0;
|
|
9479
|
+
module.exports = lte;
|
|
9480
|
+
});
|
|
9481
|
+
|
|
9482
|
+
// node_modules/semver/functions/cmp.js
|
|
9483
|
+
var require_cmp = __commonJS((exports, module) => {
|
|
9484
|
+
var eq = require_eq();
|
|
9485
|
+
var neq = require_neq();
|
|
9486
|
+
var gt = require_gt();
|
|
9487
|
+
var gte = require_gte();
|
|
9488
|
+
var lt = require_lt();
|
|
9489
|
+
var lte = require_lte();
|
|
9490
|
+
var cmp = (a, op, b, loose) => {
|
|
9491
|
+
switch (op) {
|
|
9492
|
+
case "===":
|
|
9493
|
+
if (typeof a === "object") {
|
|
9494
|
+
a = a.version;
|
|
9495
|
+
}
|
|
9496
|
+
if (typeof b === "object") {
|
|
9497
|
+
b = b.version;
|
|
9498
|
+
}
|
|
9499
|
+
return a === b;
|
|
9500
|
+
case "!==":
|
|
9501
|
+
if (typeof a === "object") {
|
|
9502
|
+
a = a.version;
|
|
9503
|
+
}
|
|
9504
|
+
if (typeof b === "object") {
|
|
9505
|
+
b = b.version;
|
|
9506
|
+
}
|
|
9507
|
+
return a !== b;
|
|
9508
|
+
case "":
|
|
9509
|
+
case "=":
|
|
9510
|
+
case "==":
|
|
9511
|
+
return eq(a, b, loose);
|
|
9512
|
+
case "!=":
|
|
9513
|
+
return neq(a, b, loose);
|
|
9514
|
+
case ">":
|
|
9515
|
+
return gt(a, b, loose);
|
|
9516
|
+
case ">=":
|
|
9517
|
+
return gte(a, b, loose);
|
|
9518
|
+
case "<":
|
|
9519
|
+
return lt(a, b, loose);
|
|
9520
|
+
case "<=":
|
|
9521
|
+
return lte(a, b, loose);
|
|
9522
|
+
default:
|
|
9523
|
+
throw new TypeError(`Invalid operator: ${op}`);
|
|
9524
|
+
}
|
|
9525
|
+
};
|
|
9526
|
+
module.exports = cmp;
|
|
9527
|
+
});
|
|
9528
|
+
|
|
9529
|
+
// node_modules/semver/functions/coerce.js
|
|
9530
|
+
var require_coerce = __commonJS((exports, module) => {
|
|
9531
|
+
var SemVer = require_semver();
|
|
9532
|
+
var parse = require_parse();
|
|
9533
|
+
var { safeRe: re, t } = require_re();
|
|
9534
|
+
var coerce = (version, options) => {
|
|
9535
|
+
if (version instanceof SemVer) {
|
|
9536
|
+
return version;
|
|
9537
|
+
}
|
|
9538
|
+
if (typeof version === "number") {
|
|
9539
|
+
version = String(version);
|
|
9540
|
+
}
|
|
9541
|
+
if (typeof version !== "string") {
|
|
9542
|
+
return null;
|
|
9543
|
+
}
|
|
9544
|
+
options = options || {};
|
|
9545
|
+
let match = null;
|
|
9546
|
+
if (!options.rtl) {
|
|
9547
|
+
match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
|
|
9548
|
+
} else {
|
|
9549
|
+
const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
|
|
9550
|
+
let next;
|
|
9551
|
+
while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
|
|
9552
|
+
if (!match || next.index + next[0].length !== match.index + match[0].length) {
|
|
9553
|
+
match = next;
|
|
9554
|
+
}
|
|
9555
|
+
coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
|
|
9556
|
+
}
|
|
9557
|
+
coerceRtlRegex.lastIndex = -1;
|
|
9558
|
+
}
|
|
9559
|
+
if (match === null) {
|
|
9560
|
+
return null;
|
|
9561
|
+
}
|
|
9562
|
+
const major = match[2];
|
|
9563
|
+
const minor = match[3] || "0";
|
|
9564
|
+
const patch = match[4] || "0";
|
|
9565
|
+
const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
|
|
9566
|
+
const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
|
|
9567
|
+
return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options);
|
|
9568
|
+
};
|
|
9569
|
+
module.exports = coerce;
|
|
9570
|
+
});
|
|
9571
|
+
|
|
9572
|
+
// node_modules/semver/functions/truncate.js
|
|
9573
|
+
var require_truncate = __commonJS((exports, module) => {
|
|
9574
|
+
var parse = require_parse();
|
|
9575
|
+
var constants = require_constants();
|
|
9576
|
+
var SemVer = require_semver();
|
|
9577
|
+
var truncate = (version, truncation, options) => {
|
|
9578
|
+
if (!constants.RELEASE_TYPES.includes(truncation)) {
|
|
9579
|
+
return null;
|
|
9580
|
+
}
|
|
9581
|
+
const clonedVersion = cloneInputVersion(version, options);
|
|
9582
|
+
return clonedVersion && doTruncation(clonedVersion, truncation);
|
|
9583
|
+
};
|
|
9584
|
+
var cloneInputVersion = (version, options) => {
|
|
9585
|
+
const versionStringToParse = version instanceof SemVer ? version.version : version;
|
|
9586
|
+
return parse(versionStringToParse, options);
|
|
9587
|
+
};
|
|
9588
|
+
var doTruncation = (version, truncation) => {
|
|
9589
|
+
if (isPrerelease(truncation)) {
|
|
9590
|
+
return version.version;
|
|
9591
|
+
}
|
|
9592
|
+
version.prerelease = [];
|
|
9593
|
+
switch (truncation) {
|
|
9594
|
+
case "major":
|
|
9595
|
+
version.minor = 0;
|
|
9596
|
+
version.patch = 0;
|
|
9597
|
+
break;
|
|
9598
|
+
case "minor":
|
|
9599
|
+
version.patch = 0;
|
|
9600
|
+
break;
|
|
9601
|
+
}
|
|
9602
|
+
return version.format();
|
|
9603
|
+
};
|
|
9604
|
+
var isPrerelease = (type) => {
|
|
9605
|
+
return type.startsWith("pre");
|
|
9606
|
+
};
|
|
9607
|
+
module.exports = truncate;
|
|
9608
|
+
});
|
|
9609
|
+
|
|
9610
|
+
// node_modules/semver/internal/lrucache.js
|
|
9611
|
+
var require_lrucache = __commonJS((exports, module) => {
|
|
9612
|
+
class LRUCache {
|
|
9613
|
+
constructor() {
|
|
9614
|
+
this.max = 1000;
|
|
9615
|
+
this.map = new Map;
|
|
9616
|
+
}
|
|
9617
|
+
get(key) {
|
|
9618
|
+
const value = this.map.get(key);
|
|
9619
|
+
if (value === undefined) {
|
|
9620
|
+
return;
|
|
9621
|
+
} else {
|
|
9622
|
+
this.map.delete(key);
|
|
9623
|
+
this.map.set(key, value);
|
|
9624
|
+
return value;
|
|
9625
|
+
}
|
|
9626
|
+
}
|
|
9627
|
+
delete(key) {
|
|
9628
|
+
return this.map.delete(key);
|
|
9629
|
+
}
|
|
9630
|
+
set(key, value) {
|
|
9631
|
+
const deleted = this.delete(key);
|
|
9632
|
+
if (!deleted && value !== undefined) {
|
|
9633
|
+
if (this.map.size >= this.max) {
|
|
9634
|
+
const firstKey = this.map.keys().next().value;
|
|
9635
|
+
this.delete(firstKey);
|
|
9636
|
+
}
|
|
9637
|
+
this.map.set(key, value);
|
|
9638
|
+
}
|
|
9639
|
+
return this;
|
|
9640
|
+
}
|
|
9641
|
+
}
|
|
9642
|
+
module.exports = LRUCache;
|
|
9643
|
+
});
|
|
9644
|
+
|
|
9645
|
+
// node_modules/semver/classes/range.js
|
|
9646
|
+
var require_range = __commonJS((exports, module) => {
|
|
9647
|
+
var SPACE_CHARACTERS = /\s+/g;
|
|
9648
|
+
|
|
9649
|
+
class Range {
|
|
9650
|
+
constructor(range, options) {
|
|
9651
|
+
options = parseOptions(options);
|
|
9652
|
+
if (range instanceof Range) {
|
|
9653
|
+
if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
|
|
9654
|
+
return range;
|
|
9655
|
+
} else {
|
|
9656
|
+
return new Range(range.raw, options);
|
|
9657
|
+
}
|
|
9658
|
+
}
|
|
9659
|
+
if (range instanceof Comparator) {
|
|
9660
|
+
this.raw = range.value;
|
|
9661
|
+
this.set = [[range]];
|
|
9662
|
+
this.formatted = undefined;
|
|
9663
|
+
return this;
|
|
9664
|
+
}
|
|
9665
|
+
this.options = options;
|
|
9666
|
+
this.loose = !!options.loose;
|
|
9667
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
9668
|
+
this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
|
|
9669
|
+
this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
|
|
9670
|
+
if (!this.set.length) {
|
|
9671
|
+
throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
|
|
9672
|
+
}
|
|
9673
|
+
if (this.set.length > 1) {
|
|
9674
|
+
const first = this.set[0];
|
|
9675
|
+
this.set = this.set.filter((c) => !isNullSet(c[0]));
|
|
9676
|
+
if (this.set.length === 0) {
|
|
9677
|
+
this.set = [first];
|
|
9678
|
+
} else if (this.set.length > 1) {
|
|
9679
|
+
for (const c of this.set) {
|
|
9680
|
+
if (c.length === 1 && isAny(c[0])) {
|
|
9681
|
+
this.set = [c];
|
|
9682
|
+
break;
|
|
9683
|
+
}
|
|
9684
|
+
}
|
|
9685
|
+
}
|
|
9686
|
+
}
|
|
9687
|
+
this.formatted = undefined;
|
|
9688
|
+
}
|
|
9689
|
+
get range() {
|
|
9690
|
+
if (this.formatted === undefined) {
|
|
9691
|
+
this.formatted = "";
|
|
9692
|
+
for (let i = 0;i < this.set.length; i++) {
|
|
9693
|
+
if (i > 0) {
|
|
9694
|
+
this.formatted += "||";
|
|
9695
|
+
}
|
|
9696
|
+
const comps = this.set[i];
|
|
9697
|
+
for (let k = 0;k < comps.length; k++) {
|
|
9698
|
+
if (k > 0) {
|
|
9699
|
+
this.formatted += " ";
|
|
9700
|
+
}
|
|
9701
|
+
this.formatted += comps[k].toString().trim();
|
|
9702
|
+
}
|
|
9703
|
+
}
|
|
9704
|
+
}
|
|
9705
|
+
return this.formatted;
|
|
9706
|
+
}
|
|
9707
|
+
format() {
|
|
9708
|
+
return this.range;
|
|
9709
|
+
}
|
|
9710
|
+
toString() {
|
|
9711
|
+
return this.range;
|
|
9712
|
+
}
|
|
9713
|
+
parseRange(range) {
|
|
9714
|
+
range = range.replace(BUILDSTRIPRE, "");
|
|
9715
|
+
const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
|
|
9716
|
+
const memoKey = memoOpts + ":" + range;
|
|
9717
|
+
const cached = cache.get(memoKey);
|
|
9718
|
+
if (cached) {
|
|
9719
|
+
return cached;
|
|
9720
|
+
}
|
|
9721
|
+
const loose = this.options.loose;
|
|
9722
|
+
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
|
|
9723
|
+
range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
|
|
9724
|
+
debug("hyphen replace", range);
|
|
9725
|
+
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
|
|
9726
|
+
debug("comparator trim", range);
|
|
9727
|
+
range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
|
|
9728
|
+
debug("tilde trim", range);
|
|
9729
|
+
range = range.replace(re[t.CARETTRIM], caretTrimReplace);
|
|
9730
|
+
debug("caret trim", range);
|
|
9731
|
+
let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
|
|
9732
|
+
if (loose) {
|
|
9733
|
+
rangeList = rangeList.filter((comp) => {
|
|
9734
|
+
debug("loose invalid filter", comp, this.options);
|
|
9735
|
+
return !!comp.match(re[t.COMPARATORLOOSE]);
|
|
9736
|
+
});
|
|
9737
|
+
}
|
|
9738
|
+
debug("range list", rangeList);
|
|
9739
|
+
const rangeMap = new Map;
|
|
9740
|
+
const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
|
|
9741
|
+
for (const comp of comparators) {
|
|
9742
|
+
if (isNullSet(comp)) {
|
|
9743
|
+
return [comp];
|
|
9744
|
+
}
|
|
9745
|
+
rangeMap.set(comp.value, comp);
|
|
9746
|
+
}
|
|
9747
|
+
if (rangeMap.size > 1 && rangeMap.has("")) {
|
|
9748
|
+
rangeMap.delete("");
|
|
9749
|
+
}
|
|
9750
|
+
const result = [...rangeMap.values()];
|
|
9751
|
+
cache.set(memoKey, result);
|
|
9752
|
+
return result;
|
|
9753
|
+
}
|
|
9754
|
+
intersects(range, options) {
|
|
9755
|
+
if (!(range instanceof Range)) {
|
|
9756
|
+
throw new TypeError("a Range is required");
|
|
9757
|
+
}
|
|
9758
|
+
return this.set.some((thisComparators) => {
|
|
9759
|
+
return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
|
|
9760
|
+
return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
|
|
9761
|
+
return rangeComparators.every((rangeComparator) => {
|
|
9762
|
+
return thisComparator.intersects(rangeComparator, options);
|
|
9763
|
+
});
|
|
9764
|
+
});
|
|
9765
|
+
});
|
|
9766
|
+
});
|
|
9767
|
+
}
|
|
9768
|
+
test(version) {
|
|
9769
|
+
if (!version) {
|
|
9770
|
+
return false;
|
|
9771
|
+
}
|
|
9772
|
+
if (typeof version === "string") {
|
|
9773
|
+
try {
|
|
9774
|
+
version = new SemVer(version, this.options);
|
|
9775
|
+
} catch (er) {
|
|
9776
|
+
return false;
|
|
9777
|
+
}
|
|
9778
|
+
}
|
|
9779
|
+
for (let i = 0;i < this.set.length; i++) {
|
|
9780
|
+
if (testSet(this.set[i], version, this.options)) {
|
|
9781
|
+
return true;
|
|
9782
|
+
}
|
|
9783
|
+
}
|
|
9784
|
+
return false;
|
|
9785
|
+
}
|
|
9786
|
+
}
|
|
9787
|
+
module.exports = Range;
|
|
9788
|
+
var LRU = require_lrucache();
|
|
9789
|
+
var cache = new LRU;
|
|
9790
|
+
var parseOptions = require_parse_options();
|
|
9791
|
+
var Comparator = require_comparator();
|
|
9792
|
+
var debug = require_debug();
|
|
9793
|
+
var SemVer = require_semver();
|
|
9794
|
+
var {
|
|
9795
|
+
safeRe: re,
|
|
9796
|
+
src,
|
|
9797
|
+
t,
|
|
9798
|
+
comparatorTrimReplace,
|
|
9799
|
+
tildeTrimReplace,
|
|
9800
|
+
caretTrimReplace
|
|
9801
|
+
} = require_re();
|
|
9802
|
+
var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
|
|
9803
|
+
var BUILDSTRIPRE = new RegExp(src[t.BUILD], "g");
|
|
9804
|
+
var isNullSet = (c) => c.value === "<0.0.0-0";
|
|
9805
|
+
var isAny = (c) => c.value === "";
|
|
9806
|
+
var isSatisfiable = (comparators, options) => {
|
|
9807
|
+
let result = true;
|
|
9808
|
+
const remainingComparators = comparators.slice();
|
|
9809
|
+
let testComparator = remainingComparators.pop();
|
|
9810
|
+
while (result && remainingComparators.length) {
|
|
9811
|
+
result = remainingComparators.every((otherComparator) => {
|
|
9812
|
+
return testComparator.intersects(otherComparator, options);
|
|
9813
|
+
});
|
|
9814
|
+
testComparator = remainingComparators.pop();
|
|
9815
|
+
}
|
|
9816
|
+
return result;
|
|
9817
|
+
};
|
|
9818
|
+
var parseComparator = (comp, options) => {
|
|
9819
|
+
comp = comp.replace(re[t.BUILD], "");
|
|
9820
|
+
debug("comp", comp, options);
|
|
9821
|
+
comp = replaceCarets(comp, options);
|
|
9822
|
+
debug("caret", comp);
|
|
9823
|
+
comp = replaceTildes(comp, options);
|
|
9824
|
+
debug("tildes", comp);
|
|
9825
|
+
comp = replaceXRanges(comp, options);
|
|
9826
|
+
debug("xrange", comp);
|
|
9827
|
+
comp = replaceStars(comp, options);
|
|
9828
|
+
debug("stars", comp);
|
|
9829
|
+
return comp;
|
|
9830
|
+
};
|
|
9831
|
+
var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
|
|
9832
|
+
var replaceTildes = (comp, options) => {
|
|
9833
|
+
return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
|
|
9834
|
+
};
|
|
9835
|
+
var replaceTilde = (comp, options) => {
|
|
9836
|
+
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
9837
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
9838
|
+
debug("tilde", comp, _, M, m, p, pr);
|
|
9839
|
+
let ret;
|
|
9840
|
+
if (isX(M)) {
|
|
9841
|
+
ret = "";
|
|
9842
|
+
} else if (isX(m)) {
|
|
9843
|
+
ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
|
|
9844
|
+
} else if (isX(p)) {
|
|
9845
|
+
ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
|
|
9846
|
+
} else if (pr) {
|
|
9847
|
+
debug("replaceTilde pr", pr);
|
|
9848
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
9849
|
+
} else {
|
|
9850
|
+
ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
|
|
9851
|
+
}
|
|
9852
|
+
debug("tilde return", ret);
|
|
9853
|
+
return ret;
|
|
9854
|
+
});
|
|
9855
|
+
};
|
|
9856
|
+
var replaceCarets = (comp, options) => {
|
|
9857
|
+
return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
|
|
9858
|
+
};
|
|
9859
|
+
var replaceCaret = (comp, options) => {
|
|
9860
|
+
debug("caret", comp, options);
|
|
9861
|
+
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
|
9862
|
+
const z = options.includePrerelease ? "-0" : "";
|
|
9863
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
9864
|
+
debug("caret", comp, _, M, m, p, pr);
|
|
9865
|
+
let ret;
|
|
9866
|
+
if (isX(M)) {
|
|
9867
|
+
ret = "";
|
|
9868
|
+
} else if (isX(m)) {
|
|
9869
|
+
ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
9870
|
+
} else if (isX(p)) {
|
|
9871
|
+
if (M === "0") {
|
|
9872
|
+
ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
|
|
9873
|
+
} else {
|
|
9874
|
+
ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
|
|
9875
|
+
}
|
|
9876
|
+
} else if (pr) {
|
|
9877
|
+
debug("replaceCaret pr", pr);
|
|
9878
|
+
if (M === "0") {
|
|
9879
|
+
if (m === "0") {
|
|
9880
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
|
|
9881
|
+
} else {
|
|
9882
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
9883
|
+
}
|
|
9884
|
+
} else {
|
|
9885
|
+
ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
|
|
9886
|
+
}
|
|
9887
|
+
} else {
|
|
9888
|
+
debug("no pr");
|
|
9889
|
+
if (M === "0") {
|
|
9890
|
+
if (m === "0") {
|
|
9891
|
+
ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
|
|
9892
|
+
} else {
|
|
9893
|
+
ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
|
|
9894
|
+
}
|
|
9895
|
+
} else {
|
|
9896
|
+
ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
|
|
9897
|
+
}
|
|
9898
|
+
}
|
|
9899
|
+
debug("caret return", ret);
|
|
9900
|
+
return ret;
|
|
9901
|
+
});
|
|
9902
|
+
};
|
|
9903
|
+
var replaceXRanges = (comp, options) => {
|
|
9904
|
+
debug("replaceXRanges", comp, options);
|
|
9905
|
+
return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
|
|
9906
|
+
};
|
|
9907
|
+
var replaceXRange = (comp, options) => {
|
|
9908
|
+
comp = comp.trim();
|
|
9909
|
+
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
|
|
9910
|
+
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
|
9911
|
+
debug("xRange", comp, ret, gtlt, M, m, p, pr);
|
|
9912
|
+
const xM = isX(M);
|
|
9913
|
+
const xm = xM || isX(m);
|
|
9914
|
+
const xp = xm || isX(p);
|
|
9915
|
+
const anyX = xp;
|
|
9916
|
+
if (gtlt === "=" && anyX) {
|
|
9917
|
+
gtlt = "";
|
|
9918
|
+
}
|
|
9919
|
+
pr = options.includePrerelease ? "-0" : "";
|
|
9920
|
+
if (xM) {
|
|
9921
|
+
if (gtlt === ">" || gtlt === "<") {
|
|
9922
|
+
ret = "<0.0.0-0";
|
|
9923
|
+
} else {
|
|
9924
|
+
ret = "*";
|
|
9925
|
+
}
|
|
9926
|
+
} else if (gtlt && anyX) {
|
|
9927
|
+
if (xm) {
|
|
9928
|
+
m = 0;
|
|
9929
|
+
}
|
|
9930
|
+
p = 0;
|
|
9931
|
+
if (gtlt === ">") {
|
|
9932
|
+
gtlt = ">=";
|
|
9933
|
+
if (xm) {
|
|
9934
|
+
M = +M + 1;
|
|
9935
|
+
m = 0;
|
|
9936
|
+
p = 0;
|
|
9937
|
+
} else {
|
|
9938
|
+
m = +m + 1;
|
|
9939
|
+
p = 0;
|
|
9940
|
+
}
|
|
9941
|
+
} else if (gtlt === "<=") {
|
|
9942
|
+
gtlt = "<";
|
|
9943
|
+
if (xm) {
|
|
9944
|
+
M = +M + 1;
|
|
9945
|
+
} else {
|
|
9946
|
+
m = +m + 1;
|
|
9947
|
+
}
|
|
9948
|
+
}
|
|
9949
|
+
if (gtlt === "<") {
|
|
9950
|
+
pr = "-0";
|
|
9951
|
+
}
|
|
9952
|
+
ret = `${gtlt + M}.${m}.${p}${pr}`;
|
|
9953
|
+
} else if (xm) {
|
|
9954
|
+
ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
|
|
9955
|
+
} else if (xp) {
|
|
9956
|
+
ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
|
|
9957
|
+
}
|
|
9958
|
+
debug("xRange return", ret);
|
|
9959
|
+
return ret;
|
|
9960
|
+
});
|
|
9961
|
+
};
|
|
9962
|
+
var replaceStars = (comp, options) => {
|
|
9963
|
+
debug("replaceStars", comp, options);
|
|
9964
|
+
return comp.trim().replace(re[t.STAR], "");
|
|
9965
|
+
};
|
|
9966
|
+
var replaceGTE0 = (comp, options) => {
|
|
9967
|
+
debug("replaceGTE0", comp, options);
|
|
9968
|
+
return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
|
|
9969
|
+
};
|
|
9970
|
+
var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
|
|
9971
|
+
if (isX(fM)) {
|
|
9972
|
+
from = "";
|
|
9973
|
+
} else if (isX(fm)) {
|
|
9974
|
+
from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
|
|
9975
|
+
} else if (isX(fp)) {
|
|
9976
|
+
from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
|
|
9977
|
+
} else if (fpr) {
|
|
9978
|
+
from = `>=${from}`;
|
|
9979
|
+
} else {
|
|
9980
|
+
from = `>=${from}${incPr ? "-0" : ""}`;
|
|
9981
|
+
}
|
|
9982
|
+
if (isX(tM)) {
|
|
9983
|
+
to = "";
|
|
9984
|
+
} else if (isX(tm)) {
|
|
9985
|
+
to = `<${+tM + 1}.0.0-0`;
|
|
9986
|
+
} else if (isX(tp)) {
|
|
9987
|
+
to = `<${tM}.${+tm + 1}.0-0`;
|
|
9988
|
+
} else if (tpr) {
|
|
9989
|
+
to = `<=${tM}.${tm}.${tp}-${tpr}`;
|
|
9990
|
+
} else if (incPr) {
|
|
9991
|
+
to = `<${tM}.${tm}.${+tp + 1}-0`;
|
|
9992
|
+
} else {
|
|
9993
|
+
to = `<=${to}`;
|
|
9994
|
+
}
|
|
9995
|
+
return `${from} ${to}`.trim();
|
|
9996
|
+
};
|
|
9997
|
+
var testSet = (set, version, options) => {
|
|
9998
|
+
for (let i = 0;i < set.length; i++) {
|
|
9999
|
+
if (!set[i].test(version)) {
|
|
10000
|
+
return false;
|
|
10001
|
+
}
|
|
10002
|
+
}
|
|
10003
|
+
if (version.prerelease.length && !options.includePrerelease) {
|
|
10004
|
+
for (let i = 0;i < set.length; i++) {
|
|
10005
|
+
debug(set[i].semver);
|
|
10006
|
+
if (set[i].semver === Comparator.ANY) {
|
|
10007
|
+
continue;
|
|
10008
|
+
}
|
|
10009
|
+
if (set[i].semver.prerelease.length > 0) {
|
|
10010
|
+
const allowed = set[i].semver;
|
|
10011
|
+
if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
|
|
10012
|
+
return true;
|
|
10013
|
+
}
|
|
10014
|
+
}
|
|
10015
|
+
}
|
|
10016
|
+
return false;
|
|
10017
|
+
}
|
|
10018
|
+
return true;
|
|
10019
|
+
};
|
|
10020
|
+
});
|
|
10021
|
+
|
|
10022
|
+
// node_modules/semver/classes/comparator.js
|
|
10023
|
+
var require_comparator = __commonJS((exports, module) => {
|
|
10024
|
+
var ANY = Symbol("SemVer ANY");
|
|
10025
|
+
|
|
10026
|
+
class Comparator {
|
|
10027
|
+
static get ANY() {
|
|
10028
|
+
return ANY;
|
|
10029
|
+
}
|
|
10030
|
+
constructor(comp, options) {
|
|
10031
|
+
options = parseOptions(options);
|
|
10032
|
+
if (comp instanceof Comparator) {
|
|
10033
|
+
if (comp.loose === !!options.loose) {
|
|
10034
|
+
return comp;
|
|
10035
|
+
} else {
|
|
10036
|
+
comp = comp.value;
|
|
10037
|
+
}
|
|
10038
|
+
}
|
|
10039
|
+
comp = comp.trim().split(/\s+/).join(" ");
|
|
10040
|
+
debug("comparator", comp, options);
|
|
10041
|
+
this.options = options;
|
|
10042
|
+
this.loose = !!options.loose;
|
|
10043
|
+
this.parse(comp);
|
|
10044
|
+
if (this.semver === ANY) {
|
|
10045
|
+
this.value = "";
|
|
10046
|
+
} else {
|
|
10047
|
+
this.value = this.operator + this.semver.version;
|
|
10048
|
+
}
|
|
10049
|
+
debug("comp", this);
|
|
10050
|
+
}
|
|
10051
|
+
parse(comp) {
|
|
10052
|
+
const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
|
|
10053
|
+
const m = comp.match(r);
|
|
10054
|
+
if (!m) {
|
|
10055
|
+
throw new TypeError(`Invalid comparator: ${comp}`);
|
|
10056
|
+
}
|
|
10057
|
+
this.operator = m[1] !== undefined ? m[1] : "";
|
|
10058
|
+
if (this.operator === "=") {
|
|
10059
|
+
this.operator = "";
|
|
10060
|
+
}
|
|
10061
|
+
if (!m[2]) {
|
|
10062
|
+
this.semver = ANY;
|
|
10063
|
+
} else {
|
|
10064
|
+
this.semver = new SemVer(m[2], this.options.loose);
|
|
10065
|
+
}
|
|
10066
|
+
}
|
|
10067
|
+
toString() {
|
|
10068
|
+
return this.value;
|
|
10069
|
+
}
|
|
10070
|
+
test(version) {
|
|
10071
|
+
debug("Comparator.test", version, this.options.loose);
|
|
10072
|
+
if (this.semver === ANY || version === ANY) {
|
|
10073
|
+
return true;
|
|
10074
|
+
}
|
|
10075
|
+
if (typeof version === "string") {
|
|
10076
|
+
try {
|
|
10077
|
+
version = new SemVer(version, this.options);
|
|
10078
|
+
} catch (er) {
|
|
10079
|
+
return false;
|
|
10080
|
+
}
|
|
10081
|
+
}
|
|
10082
|
+
return cmp(version, this.operator, this.semver, this.options);
|
|
10083
|
+
}
|
|
10084
|
+
intersects(comp, options) {
|
|
10085
|
+
if (!(comp instanceof Comparator)) {
|
|
10086
|
+
throw new TypeError("a Comparator is required");
|
|
10087
|
+
}
|
|
10088
|
+
if (this.operator === "") {
|
|
10089
|
+
if (this.value === "") {
|
|
10090
|
+
return true;
|
|
10091
|
+
}
|
|
10092
|
+
return new Range(comp.value, options).test(this.value);
|
|
10093
|
+
} else if (comp.operator === "") {
|
|
10094
|
+
if (comp.value === "") {
|
|
10095
|
+
return true;
|
|
10096
|
+
}
|
|
10097
|
+
return new Range(this.value, options).test(comp.semver);
|
|
10098
|
+
}
|
|
10099
|
+
options = parseOptions(options);
|
|
10100
|
+
if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
|
|
10101
|
+
return false;
|
|
10102
|
+
}
|
|
10103
|
+
if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
|
|
10104
|
+
return false;
|
|
10105
|
+
}
|
|
10106
|
+
if (this.operator.startsWith(">") && comp.operator.startsWith(">")) {
|
|
10107
|
+
return true;
|
|
10108
|
+
}
|
|
10109
|
+
if (this.operator.startsWith("<") && comp.operator.startsWith("<")) {
|
|
10110
|
+
return true;
|
|
10111
|
+
}
|
|
10112
|
+
if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) {
|
|
10113
|
+
return true;
|
|
10114
|
+
}
|
|
10115
|
+
if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
|
|
10116
|
+
return true;
|
|
10117
|
+
}
|
|
10118
|
+
if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
|
|
10119
|
+
return true;
|
|
10120
|
+
}
|
|
10121
|
+
return false;
|
|
10122
|
+
}
|
|
10123
|
+
}
|
|
10124
|
+
module.exports = Comparator;
|
|
10125
|
+
var parseOptions = require_parse_options();
|
|
10126
|
+
var { safeRe: re, t } = require_re();
|
|
10127
|
+
var cmp = require_cmp();
|
|
10128
|
+
var debug = require_debug();
|
|
10129
|
+
var SemVer = require_semver();
|
|
10130
|
+
var Range = require_range();
|
|
10131
|
+
});
|
|
10132
|
+
|
|
10133
|
+
// node_modules/semver/functions/satisfies.js
|
|
10134
|
+
var require_satisfies = __commonJS((exports, module) => {
|
|
10135
|
+
var Range = require_range();
|
|
10136
|
+
var satisfies = (version, range, options) => {
|
|
10137
|
+
try {
|
|
10138
|
+
range = new Range(range, options);
|
|
10139
|
+
} catch (er) {
|
|
10140
|
+
return false;
|
|
10141
|
+
}
|
|
10142
|
+
return range.test(version);
|
|
10143
|
+
};
|
|
10144
|
+
module.exports = satisfies;
|
|
10145
|
+
});
|
|
10146
|
+
|
|
10147
|
+
// node_modules/semver/ranges/to-comparators.js
|
|
10148
|
+
var require_to_comparators = __commonJS((exports, module) => {
|
|
10149
|
+
var Range = require_range();
|
|
10150
|
+
var toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
|
|
10151
|
+
module.exports = toComparators;
|
|
10152
|
+
});
|
|
10153
|
+
|
|
10154
|
+
// node_modules/semver/ranges/max-satisfying.js
|
|
10155
|
+
var require_max_satisfying = __commonJS((exports, module) => {
|
|
10156
|
+
var SemVer = require_semver();
|
|
10157
|
+
var Range = require_range();
|
|
10158
|
+
var maxSatisfying = (versions, range, options) => {
|
|
10159
|
+
let max = null;
|
|
10160
|
+
let maxSV = null;
|
|
10161
|
+
let rangeObj = null;
|
|
10162
|
+
try {
|
|
10163
|
+
rangeObj = new Range(range, options);
|
|
10164
|
+
} catch (er) {
|
|
10165
|
+
return null;
|
|
10166
|
+
}
|
|
10167
|
+
versions.forEach((v) => {
|
|
10168
|
+
if (rangeObj.test(v)) {
|
|
10169
|
+
if (!max || maxSV.compare(v) === -1) {
|
|
10170
|
+
max = v;
|
|
10171
|
+
maxSV = new SemVer(max, options);
|
|
10172
|
+
}
|
|
10173
|
+
}
|
|
10174
|
+
});
|
|
10175
|
+
return max;
|
|
10176
|
+
};
|
|
10177
|
+
module.exports = maxSatisfying;
|
|
10178
|
+
});
|
|
10179
|
+
|
|
10180
|
+
// node_modules/semver/ranges/min-satisfying.js
|
|
10181
|
+
var require_min_satisfying = __commonJS((exports, module) => {
|
|
10182
|
+
var SemVer = require_semver();
|
|
10183
|
+
var Range = require_range();
|
|
10184
|
+
var minSatisfying = (versions, range, options) => {
|
|
10185
|
+
let min = null;
|
|
10186
|
+
let minSV = null;
|
|
10187
|
+
let rangeObj = null;
|
|
10188
|
+
try {
|
|
10189
|
+
rangeObj = new Range(range, options);
|
|
10190
|
+
} catch (er) {
|
|
10191
|
+
return null;
|
|
10192
|
+
}
|
|
10193
|
+
versions.forEach((v) => {
|
|
10194
|
+
if (rangeObj.test(v)) {
|
|
10195
|
+
if (!min || minSV.compare(v) === 1) {
|
|
10196
|
+
min = v;
|
|
10197
|
+
minSV = new SemVer(min, options);
|
|
10198
|
+
}
|
|
10199
|
+
}
|
|
10200
|
+
});
|
|
10201
|
+
return min;
|
|
10202
|
+
};
|
|
10203
|
+
module.exports = minSatisfying;
|
|
10204
|
+
});
|
|
10205
|
+
|
|
10206
|
+
// node_modules/semver/ranges/min-version.js
|
|
10207
|
+
var require_min_version = __commonJS((exports, module) => {
|
|
10208
|
+
var SemVer = require_semver();
|
|
10209
|
+
var Range = require_range();
|
|
10210
|
+
var gt = require_gt();
|
|
10211
|
+
var minVersion = (range, loose) => {
|
|
10212
|
+
range = new Range(range, loose);
|
|
10213
|
+
let minver = new SemVer("0.0.0");
|
|
10214
|
+
if (range.test(minver)) {
|
|
10215
|
+
return minver;
|
|
10216
|
+
}
|
|
10217
|
+
minver = new SemVer("0.0.0-0");
|
|
10218
|
+
if (range.test(minver)) {
|
|
10219
|
+
return minver;
|
|
10220
|
+
}
|
|
10221
|
+
minver = null;
|
|
10222
|
+
for (let i = 0;i < range.set.length; ++i) {
|
|
10223
|
+
const comparators = range.set[i];
|
|
10224
|
+
let setMin = null;
|
|
10225
|
+
comparators.forEach((comparator) => {
|
|
10226
|
+
const compver = new SemVer(comparator.semver.version);
|
|
10227
|
+
switch (comparator.operator) {
|
|
10228
|
+
case ">":
|
|
10229
|
+
if (compver.prerelease.length === 0) {
|
|
10230
|
+
compver.patch++;
|
|
10231
|
+
} else {
|
|
10232
|
+
compver.prerelease.push(0);
|
|
10233
|
+
}
|
|
10234
|
+
compver.raw = compver.format();
|
|
10235
|
+
case "":
|
|
10236
|
+
case ">=":
|
|
10237
|
+
if (!setMin || gt(compver, setMin)) {
|
|
10238
|
+
setMin = compver;
|
|
10239
|
+
}
|
|
10240
|
+
break;
|
|
10241
|
+
case "<":
|
|
10242
|
+
case "<=":
|
|
10243
|
+
break;
|
|
10244
|
+
default:
|
|
10245
|
+
throw new Error(`Unexpected operation: ${comparator.operator}`);
|
|
10246
|
+
}
|
|
10247
|
+
});
|
|
10248
|
+
if (setMin && (!minver || gt(minver, setMin))) {
|
|
10249
|
+
minver = setMin;
|
|
10250
|
+
}
|
|
10251
|
+
}
|
|
10252
|
+
if (minver && range.test(minver)) {
|
|
10253
|
+
return minver;
|
|
10254
|
+
}
|
|
10255
|
+
return null;
|
|
10256
|
+
};
|
|
10257
|
+
module.exports = minVersion;
|
|
10258
|
+
});
|
|
10259
|
+
|
|
10260
|
+
// node_modules/semver/ranges/valid.js
|
|
10261
|
+
var require_valid2 = __commonJS((exports, module) => {
|
|
10262
|
+
var Range = require_range();
|
|
10263
|
+
var validRange = (range, options) => {
|
|
10264
|
+
try {
|
|
10265
|
+
return new Range(range, options).range || "*";
|
|
10266
|
+
} catch (er) {
|
|
10267
|
+
return null;
|
|
10268
|
+
}
|
|
10269
|
+
};
|
|
10270
|
+
module.exports = validRange;
|
|
10271
|
+
});
|
|
10272
|
+
|
|
10273
|
+
// node_modules/semver/ranges/outside.js
|
|
10274
|
+
var require_outside = __commonJS((exports, module) => {
|
|
10275
|
+
var SemVer = require_semver();
|
|
10276
|
+
var Comparator = require_comparator();
|
|
10277
|
+
var { ANY } = Comparator;
|
|
10278
|
+
var Range = require_range();
|
|
10279
|
+
var satisfies = require_satisfies();
|
|
10280
|
+
var gt = require_gt();
|
|
10281
|
+
var lt = require_lt();
|
|
10282
|
+
var lte = require_lte();
|
|
10283
|
+
var gte = require_gte();
|
|
10284
|
+
var outside = (version, range, hilo, options) => {
|
|
10285
|
+
version = new SemVer(version, options);
|
|
10286
|
+
range = new Range(range, options);
|
|
10287
|
+
let gtfn, ltefn, ltfn, comp, ecomp;
|
|
10288
|
+
switch (hilo) {
|
|
10289
|
+
case ">":
|
|
10290
|
+
gtfn = gt;
|
|
10291
|
+
ltefn = lte;
|
|
10292
|
+
ltfn = lt;
|
|
10293
|
+
comp = ">";
|
|
10294
|
+
ecomp = ">=";
|
|
10295
|
+
break;
|
|
10296
|
+
case "<":
|
|
10297
|
+
gtfn = lt;
|
|
10298
|
+
ltefn = gte;
|
|
10299
|
+
ltfn = gt;
|
|
10300
|
+
comp = "<";
|
|
10301
|
+
ecomp = "<=";
|
|
10302
|
+
break;
|
|
10303
|
+
default:
|
|
10304
|
+
throw new TypeError('Must provide a hilo val of "<" or ">"');
|
|
10305
|
+
}
|
|
10306
|
+
if (satisfies(version, range, options)) {
|
|
10307
|
+
return false;
|
|
10308
|
+
}
|
|
10309
|
+
for (let i = 0;i < range.set.length; ++i) {
|
|
10310
|
+
const comparators = range.set[i];
|
|
10311
|
+
let high = null;
|
|
10312
|
+
let low = null;
|
|
10313
|
+
comparators.forEach((comparator) => {
|
|
10314
|
+
if (comparator.semver === ANY) {
|
|
10315
|
+
comparator = new Comparator(">=0.0.0");
|
|
10316
|
+
}
|
|
10317
|
+
high = high || comparator;
|
|
10318
|
+
low = low || comparator;
|
|
10319
|
+
if (gtfn(comparator.semver, high.semver, options)) {
|
|
10320
|
+
high = comparator;
|
|
10321
|
+
} else if (ltfn(comparator.semver, low.semver, options)) {
|
|
10322
|
+
low = comparator;
|
|
10323
|
+
}
|
|
10324
|
+
});
|
|
10325
|
+
if (high.operator === comp || high.operator === ecomp) {
|
|
10326
|
+
return false;
|
|
10327
|
+
}
|
|
10328
|
+
if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) {
|
|
10329
|
+
return false;
|
|
10330
|
+
} else if (low.operator === ecomp && ltfn(version, low.semver)) {
|
|
10331
|
+
return false;
|
|
10332
|
+
}
|
|
10333
|
+
}
|
|
10334
|
+
return true;
|
|
10335
|
+
};
|
|
10336
|
+
module.exports = outside;
|
|
10337
|
+
});
|
|
10338
|
+
|
|
10339
|
+
// node_modules/semver/ranges/gtr.js
|
|
10340
|
+
var require_gtr = __commonJS((exports, module) => {
|
|
10341
|
+
var outside = require_outside();
|
|
10342
|
+
var gtr = (version, range, options) => outside(version, range, ">", options);
|
|
10343
|
+
module.exports = gtr;
|
|
10344
|
+
});
|
|
10345
|
+
|
|
10346
|
+
// node_modules/semver/ranges/ltr.js
|
|
10347
|
+
var require_ltr = __commonJS((exports, module) => {
|
|
10348
|
+
var outside = require_outside();
|
|
10349
|
+
var ltr = (version, range, options) => outside(version, range, "<", options);
|
|
10350
|
+
module.exports = ltr;
|
|
10351
|
+
});
|
|
10352
|
+
|
|
10353
|
+
// node_modules/semver/ranges/intersects.js
|
|
10354
|
+
var require_intersects = __commonJS((exports, module) => {
|
|
10355
|
+
var Range = require_range();
|
|
10356
|
+
var intersects = (r1, r2, options) => {
|
|
10357
|
+
r1 = new Range(r1, options);
|
|
10358
|
+
r2 = new Range(r2, options);
|
|
10359
|
+
return r1.intersects(r2, options);
|
|
10360
|
+
};
|
|
10361
|
+
module.exports = intersects;
|
|
10362
|
+
});
|
|
10363
|
+
|
|
10364
|
+
// node_modules/semver/ranges/simplify.js
|
|
10365
|
+
var require_simplify = __commonJS((exports, module) => {
|
|
10366
|
+
var satisfies = require_satisfies();
|
|
10367
|
+
var compare = require_compare();
|
|
10368
|
+
module.exports = (versions, range, options) => {
|
|
10369
|
+
const set = [];
|
|
10370
|
+
let first = null;
|
|
10371
|
+
let prev = null;
|
|
10372
|
+
const v = versions.sort((a, b) => compare(a, b, options));
|
|
10373
|
+
for (const version of v) {
|
|
10374
|
+
const included = satisfies(version, range, options);
|
|
10375
|
+
if (included) {
|
|
10376
|
+
prev = version;
|
|
10377
|
+
if (!first) {
|
|
10378
|
+
first = version;
|
|
10379
|
+
}
|
|
10380
|
+
} else {
|
|
10381
|
+
if (prev) {
|
|
10382
|
+
set.push([first, prev]);
|
|
10383
|
+
}
|
|
10384
|
+
prev = null;
|
|
10385
|
+
first = null;
|
|
10386
|
+
}
|
|
10387
|
+
}
|
|
10388
|
+
if (first) {
|
|
10389
|
+
set.push([first, null]);
|
|
10390
|
+
}
|
|
10391
|
+
const ranges = [];
|
|
10392
|
+
for (const [min, max] of set) {
|
|
10393
|
+
if (min === max) {
|
|
10394
|
+
ranges.push(min);
|
|
10395
|
+
} else if (!max && min === v[0]) {
|
|
10396
|
+
ranges.push("*");
|
|
10397
|
+
} else if (!max) {
|
|
10398
|
+
ranges.push(`>=${min}`);
|
|
10399
|
+
} else if (min === v[0]) {
|
|
10400
|
+
ranges.push(`<=${max}`);
|
|
10401
|
+
} else {
|
|
10402
|
+
ranges.push(`${min} - ${max}`);
|
|
10403
|
+
}
|
|
10404
|
+
}
|
|
10405
|
+
const simplified = ranges.join(" || ");
|
|
10406
|
+
const original = typeof range.raw === "string" ? range.raw : String(range);
|
|
10407
|
+
return simplified.length < original.length ? simplified : range;
|
|
10408
|
+
};
|
|
10409
|
+
});
|
|
10410
|
+
|
|
10411
|
+
// node_modules/semver/ranges/subset.js
|
|
10412
|
+
var require_subset = __commonJS((exports, module) => {
|
|
10413
|
+
var Range = require_range();
|
|
10414
|
+
var Comparator = require_comparator();
|
|
10415
|
+
var { ANY } = Comparator;
|
|
10416
|
+
var satisfies = require_satisfies();
|
|
10417
|
+
var compare = require_compare();
|
|
10418
|
+
var subset = (sub, dom, options = {}) => {
|
|
10419
|
+
if (sub === dom) {
|
|
10420
|
+
return true;
|
|
10421
|
+
}
|
|
10422
|
+
sub = new Range(sub, options);
|
|
10423
|
+
dom = new Range(dom, options);
|
|
10424
|
+
let sawNonNull = false;
|
|
10425
|
+
OUTER:
|
|
10426
|
+
for (const simpleSub of sub.set) {
|
|
10427
|
+
for (const simpleDom of dom.set) {
|
|
10428
|
+
const isSub = simpleSubset(simpleSub, simpleDom, options);
|
|
10429
|
+
sawNonNull = sawNonNull || isSub !== null;
|
|
10430
|
+
if (isSub) {
|
|
10431
|
+
continue OUTER;
|
|
10432
|
+
}
|
|
10433
|
+
}
|
|
10434
|
+
if (sawNonNull) {
|
|
10435
|
+
return false;
|
|
10436
|
+
}
|
|
10437
|
+
}
|
|
10438
|
+
return true;
|
|
10439
|
+
};
|
|
10440
|
+
var minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
|
|
10441
|
+
var minimumVersion = [new Comparator(">=0.0.0")];
|
|
10442
|
+
var simpleSubset = (sub, dom, options) => {
|
|
10443
|
+
if (sub === dom) {
|
|
10444
|
+
return true;
|
|
10445
|
+
}
|
|
10446
|
+
if (sub.length === 1 && sub[0].semver === ANY) {
|
|
10447
|
+
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
10448
|
+
return true;
|
|
10449
|
+
} else if (options.includePrerelease) {
|
|
10450
|
+
sub = minimumVersionWithPreRelease;
|
|
10451
|
+
} else {
|
|
10452
|
+
sub = minimumVersion;
|
|
10453
|
+
}
|
|
10454
|
+
}
|
|
10455
|
+
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
10456
|
+
if (options.includePrerelease) {
|
|
10457
|
+
return true;
|
|
10458
|
+
} else {
|
|
10459
|
+
dom = minimumVersion;
|
|
10460
|
+
}
|
|
10461
|
+
}
|
|
10462
|
+
const eqSet = new Set;
|
|
10463
|
+
let gt, lt;
|
|
10464
|
+
for (const c of sub) {
|
|
10465
|
+
if (c.operator === ">" || c.operator === ">=") {
|
|
10466
|
+
gt = higherGT(gt, c, options);
|
|
10467
|
+
} else if (c.operator === "<" || c.operator === "<=") {
|
|
10468
|
+
lt = lowerLT(lt, c, options);
|
|
10469
|
+
} else {
|
|
10470
|
+
eqSet.add(c.semver);
|
|
10471
|
+
}
|
|
10472
|
+
}
|
|
10473
|
+
if (eqSet.size > 1) {
|
|
10474
|
+
return null;
|
|
10475
|
+
}
|
|
10476
|
+
let gtltComp;
|
|
10477
|
+
if (gt && lt) {
|
|
10478
|
+
gtltComp = compare(gt.semver, lt.semver, options);
|
|
10479
|
+
if (gtltComp > 0) {
|
|
10480
|
+
return null;
|
|
10481
|
+
} else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
|
|
10482
|
+
return null;
|
|
10483
|
+
}
|
|
10484
|
+
}
|
|
10485
|
+
for (const eq of eqSet) {
|
|
10486
|
+
if (gt && !satisfies(eq, String(gt), options)) {
|
|
10487
|
+
return null;
|
|
10488
|
+
}
|
|
10489
|
+
if (lt && !satisfies(eq, String(lt), options)) {
|
|
10490
|
+
return null;
|
|
10491
|
+
}
|
|
10492
|
+
for (const c of dom) {
|
|
10493
|
+
if (!satisfies(eq, String(c), options)) {
|
|
10494
|
+
return false;
|
|
10495
|
+
}
|
|
10496
|
+
}
|
|
10497
|
+
return true;
|
|
10498
|
+
}
|
|
10499
|
+
let higher, lower;
|
|
10500
|
+
let hasDomLT, hasDomGT;
|
|
10501
|
+
let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
|
|
10502
|
+
let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
|
|
10503
|
+
if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) {
|
|
10504
|
+
needDomLTPre = false;
|
|
10505
|
+
}
|
|
10506
|
+
for (const c of dom) {
|
|
10507
|
+
hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
|
|
10508
|
+
hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
|
|
10509
|
+
if (gt) {
|
|
10510
|
+
if (needDomGTPre) {
|
|
10511
|
+
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) {
|
|
10512
|
+
needDomGTPre = false;
|
|
10513
|
+
}
|
|
10514
|
+
}
|
|
10515
|
+
if (c.operator === ">" || c.operator === ">=") {
|
|
10516
|
+
higher = higherGT(gt, c, options);
|
|
10517
|
+
if (higher === c && higher !== gt) {
|
|
10518
|
+
return false;
|
|
10519
|
+
}
|
|
10520
|
+
} else if (gt.operator === ">=" && !c.test(gt.semver)) {
|
|
10521
|
+
return false;
|
|
10522
|
+
}
|
|
10523
|
+
}
|
|
10524
|
+
if (lt) {
|
|
10525
|
+
if (needDomLTPre) {
|
|
10526
|
+
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) {
|
|
10527
|
+
needDomLTPre = false;
|
|
10528
|
+
}
|
|
10529
|
+
}
|
|
10530
|
+
if (c.operator === "<" || c.operator === "<=") {
|
|
10531
|
+
lower = lowerLT(lt, c, options);
|
|
10532
|
+
if (lower === c && lower !== lt) {
|
|
10533
|
+
return false;
|
|
10534
|
+
}
|
|
10535
|
+
} else if (lt.operator === "<=" && !c.test(lt.semver)) {
|
|
10536
|
+
return false;
|
|
10537
|
+
}
|
|
10538
|
+
}
|
|
10539
|
+
if (!c.operator && (lt || gt) && gtltComp !== 0) {
|
|
10540
|
+
return false;
|
|
10541
|
+
}
|
|
10542
|
+
}
|
|
10543
|
+
if (gt && hasDomLT && !lt && gtltComp !== 0) {
|
|
10544
|
+
return false;
|
|
10545
|
+
}
|
|
10546
|
+
if (lt && hasDomGT && !gt && gtltComp !== 0) {
|
|
10547
|
+
return false;
|
|
10548
|
+
}
|
|
10549
|
+
if (needDomGTPre || needDomLTPre) {
|
|
10550
|
+
return false;
|
|
10551
|
+
}
|
|
10552
|
+
return true;
|
|
10553
|
+
};
|
|
10554
|
+
var higherGT = (a, b, options) => {
|
|
10555
|
+
if (!a) {
|
|
10556
|
+
return b;
|
|
10557
|
+
}
|
|
10558
|
+
const comp = compare(a.semver, b.semver, options);
|
|
10559
|
+
return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
|
|
10560
|
+
};
|
|
10561
|
+
var lowerLT = (a, b, options) => {
|
|
10562
|
+
if (!a) {
|
|
10563
|
+
return b;
|
|
10564
|
+
}
|
|
10565
|
+
const comp = compare(a.semver, b.semver, options);
|
|
10566
|
+
return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
|
|
10567
|
+
};
|
|
10568
|
+
module.exports = subset;
|
|
10569
|
+
});
|
|
10570
|
+
|
|
10571
|
+
// node_modules/semver/index.js
|
|
10572
|
+
var require_semver2 = __commonJS((exports, module) => {
|
|
10573
|
+
var internalRe = require_re();
|
|
10574
|
+
var constants = require_constants();
|
|
10575
|
+
var SemVer = require_semver();
|
|
10576
|
+
var identifiers = require_identifiers();
|
|
10577
|
+
var parse = require_parse();
|
|
10578
|
+
var valid = require_valid();
|
|
10579
|
+
var clean = require_clean();
|
|
10580
|
+
var inc = require_inc();
|
|
10581
|
+
var diff = require_diff();
|
|
10582
|
+
var major = require_major();
|
|
10583
|
+
var minor = require_minor();
|
|
10584
|
+
var patch = require_patch();
|
|
10585
|
+
var prerelease = require_prerelease();
|
|
10586
|
+
var compare = require_compare();
|
|
10587
|
+
var rcompare = require_rcompare();
|
|
10588
|
+
var compareLoose = require_compare_loose();
|
|
10589
|
+
var compareBuild = require_compare_build();
|
|
10590
|
+
var sort = require_sort();
|
|
10591
|
+
var rsort = require_rsort();
|
|
10592
|
+
var gt = require_gt();
|
|
10593
|
+
var lt = require_lt();
|
|
10594
|
+
var eq = require_eq();
|
|
10595
|
+
var neq = require_neq();
|
|
10596
|
+
var gte = require_gte();
|
|
10597
|
+
var lte = require_lte();
|
|
10598
|
+
var cmp = require_cmp();
|
|
10599
|
+
var coerce = require_coerce();
|
|
10600
|
+
var truncate = require_truncate();
|
|
10601
|
+
var Comparator = require_comparator();
|
|
10602
|
+
var Range = require_range();
|
|
10603
|
+
var satisfies = require_satisfies();
|
|
10604
|
+
var toComparators = require_to_comparators();
|
|
10605
|
+
var maxSatisfying = require_max_satisfying();
|
|
10606
|
+
var minSatisfying = require_min_satisfying();
|
|
10607
|
+
var minVersion = require_min_version();
|
|
10608
|
+
var validRange = require_valid2();
|
|
10609
|
+
var outside = require_outside();
|
|
10610
|
+
var gtr = require_gtr();
|
|
10611
|
+
var ltr = require_ltr();
|
|
10612
|
+
var intersects = require_intersects();
|
|
10613
|
+
var simplifyRange = require_simplify();
|
|
10614
|
+
var subset = require_subset();
|
|
10615
|
+
module.exports = {
|
|
10616
|
+
parse,
|
|
10617
|
+
valid,
|
|
10618
|
+
clean,
|
|
10619
|
+
inc,
|
|
10620
|
+
diff,
|
|
10621
|
+
major,
|
|
10622
|
+
minor,
|
|
10623
|
+
patch,
|
|
10624
|
+
prerelease,
|
|
10625
|
+
compare,
|
|
10626
|
+
rcompare,
|
|
10627
|
+
compareLoose,
|
|
10628
|
+
compareBuild,
|
|
10629
|
+
sort,
|
|
10630
|
+
rsort,
|
|
10631
|
+
gt,
|
|
10632
|
+
lt,
|
|
10633
|
+
eq,
|
|
10634
|
+
neq,
|
|
10635
|
+
gte,
|
|
10636
|
+
lte,
|
|
10637
|
+
cmp,
|
|
10638
|
+
coerce,
|
|
10639
|
+
truncate,
|
|
10640
|
+
Comparator,
|
|
10641
|
+
Range,
|
|
10642
|
+
satisfies,
|
|
10643
|
+
toComparators,
|
|
10644
|
+
maxSatisfying,
|
|
10645
|
+
minSatisfying,
|
|
10646
|
+
minVersion,
|
|
10647
|
+
validRange,
|
|
10648
|
+
outside,
|
|
10649
|
+
gtr,
|
|
10650
|
+
ltr,
|
|
10651
|
+
intersects,
|
|
10652
|
+
simplifyRange,
|
|
10653
|
+
subset,
|
|
10654
|
+
SemVer,
|
|
10655
|
+
re: internalRe.re,
|
|
10656
|
+
src: internalRe.src,
|
|
10657
|
+
tokens: internalRe.t,
|
|
10658
|
+
SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
|
|
10659
|
+
RELEASE_TYPES: constants.RELEASE_TYPES,
|
|
10660
|
+
compareIdentifiers: identifiers.compareIdentifiers,
|
|
10661
|
+
rcompareIdentifiers: identifiers.rcompareIdentifiers
|
|
10662
|
+
};
|
|
10663
|
+
});
|
|
10664
|
+
|
|
10665
|
+
// src/version.ts
|
|
10666
|
+
var exports_version = {};
|
|
10667
|
+
__export(exports_version, {
|
|
10668
|
+
upgradeClaudeMulti: () => upgradeClaudeMulti,
|
|
10669
|
+
updateClaudeCode: () => updateClaudeCode,
|
|
10670
|
+
isThirdPartyApiBroken: () => isThirdPartyApiBroken,
|
|
10671
|
+
installPinnedClaude: () => installPinnedClaude,
|
|
10672
|
+
getPinnedBinaryVersion: () => getPinnedBinaryVersion,
|
|
10673
|
+
getLatestVersion: () => getLatestVersion,
|
|
10674
|
+
getLatestClaudeMultiVersion: () => getLatestClaudeMultiVersion,
|
|
10675
|
+
getCurrentVersion: () => getCurrentVersion,
|
|
10676
|
+
getClaudeMultiVersion: () => getClaudeMultiVersion,
|
|
10677
|
+
compareVersions: () => compareVersions,
|
|
10678
|
+
checkForUpdates: () => checkForUpdates,
|
|
10679
|
+
checkForClaudeMultiUpdates: () => checkForClaudeMultiUpdates,
|
|
10680
|
+
COMPATIBLE_CLAUDE_VERSION: () => COMPATIBLE_CLAUDE_VERSION
|
|
10681
|
+
});
|
|
10682
|
+
import { execSync as execSync2 } from "node:child_process";
|
|
10683
|
+
import { existsSync as existsSync4, readFileSync as readFileSync3, writeFileSync as writeFileSync3, mkdirSync as mkdirSync4 } from "node:fs";
|
|
10684
|
+
import { join as join4, dirname as dirname4 } from "node:path";
|
|
10685
|
+
import { fileURLToPath } from "node:url";
|
|
10686
|
+
function getClaudeMultiVersion() {
|
|
10687
|
+
const pkgPath = join4(dirname4(fileURLToPath(import.meta.url)), "..", "package.json");
|
|
10688
|
+
const pkg = JSON.parse(readFileSync3(pkgPath, "utf-8"));
|
|
10689
|
+
if (typeof pkg !== "object" || pkg === null || typeof pkg.version !== "string") {
|
|
10690
|
+
throw new ClaudeMultiError(ErrorCode.CONFIG_CORRUPTED, "Could not read package version");
|
|
10691
|
+
}
|
|
10692
|
+
return pkg.version;
|
|
10693
|
+
}
|
|
10694
|
+
async function getLatestClaudeMultiVersion() {
|
|
10695
|
+
const response = await fetch("https://registry.npmjs.org/claude-multi/latest");
|
|
10696
|
+
const data = await response.json();
|
|
10697
|
+
return data.version;
|
|
10698
|
+
}
|
|
10699
|
+
async function checkForClaudeMultiUpdates() {
|
|
10700
|
+
try {
|
|
10701
|
+
const current = getClaudeMultiVersion();
|
|
10702
|
+
const latest = await getLatestClaudeMultiVersion();
|
|
10703
|
+
return {
|
|
10704
|
+
current,
|
|
10705
|
+
latest,
|
|
10706
|
+
updateAvailable: current !== latest
|
|
10707
|
+
};
|
|
10708
|
+
} catch {
|
|
10709
|
+
return { current: "", latest: "", updateAvailable: false };
|
|
10710
|
+
}
|
|
10711
|
+
}
|
|
10712
|
+
function upgradeClaudeMulti() {
|
|
10713
|
+
const pm = detectPackageManager();
|
|
10714
|
+
const commands = {
|
|
10715
|
+
bun: "bun upgrade -g claude-multi",
|
|
10716
|
+
npm: "npm update -g claude-multi",
|
|
10717
|
+
pnpm: "pnpm update -g claude-multi",
|
|
10718
|
+
deno: "deno install --reload -g npm:claude-multi"
|
|
10719
|
+
};
|
|
10720
|
+
execSync2(commands[pm], { stdio: "inherit" });
|
|
10721
|
+
}
|
|
10722
|
+
function getCurrentVersion() {
|
|
10723
|
+
const pm = detectPackageManager();
|
|
10724
|
+
try {
|
|
10725
|
+
if (pm === "deno")
|
|
10726
|
+
return null;
|
|
10727
|
+
const commands = {
|
|
10728
|
+
bun: "bun pm ls -g --json",
|
|
10729
|
+
npm: "npm ls -g --json @anthropic-ai/claude-code",
|
|
10730
|
+
pnpm: "pnpm ls -g --json"
|
|
10731
|
+
};
|
|
10732
|
+
const output = execSync2(commands[pm], {
|
|
10733
|
+
encoding: "utf-8",
|
|
10734
|
+
stdio: ["pipe", "pipe", "ignore"]
|
|
10735
|
+
});
|
|
10736
|
+
const data = JSON.parse(output);
|
|
10737
|
+
const root = Array.isArray(data) ? data[0] : data;
|
|
10738
|
+
return root?.dependencies?.["@anthropic-ai/claude-code"]?.version ?? null;
|
|
10739
|
+
} catch {
|
|
10740
|
+
return null;
|
|
10741
|
+
}
|
|
10742
|
+
}
|
|
10743
|
+
function isThirdPartyApiBroken(version) {
|
|
10744
|
+
return import_semver.default.gte(version, "2.1.154") && import_semver.default.lt(version, "2.1.156");
|
|
10745
|
+
}
|
|
10746
|
+
function getPinnedBinaryVersion() {
|
|
10747
|
+
const pkgJsonPath = join4(PINNED_BIN_DIR, "node_modules", "@anthropic-ai", "claude-code", "package.json");
|
|
10748
|
+
try {
|
|
10749
|
+
if (!existsSync4(pkgJsonPath))
|
|
10750
|
+
return null;
|
|
10751
|
+
const pkg = JSON.parse(readFileSync3(pkgJsonPath, "utf-8"));
|
|
10752
|
+
return pkg.version ?? null;
|
|
10753
|
+
} catch {
|
|
10754
|
+
return null;
|
|
10755
|
+
}
|
|
10756
|
+
}
|
|
10757
|
+
function installPinnedClaude() {
|
|
10758
|
+
const pm = detectPackageManager();
|
|
10759
|
+
mkdirSync4(PINNED_BIN_DIR, { recursive: true });
|
|
10760
|
+
const pkgJsonPath = join4(PINNED_BIN_DIR, "package.json");
|
|
10761
|
+
if (!existsSync4(pkgJsonPath)) {
|
|
10762
|
+
writeFileSync3(pkgJsonPath, JSON.stringify({ dependencies: {} }, null, 2));
|
|
10763
|
+
}
|
|
10764
|
+
const pkg = `@anthropic-ai/claude-code@${COMPATIBLE_CLAUDE_VERSION}`;
|
|
10765
|
+
const commands = {
|
|
10766
|
+
bun: `bun add --cwd ${PINNED_BIN_DIR} ${pkg}`,
|
|
10767
|
+
npm: `npm install --prefix ${PINNED_BIN_DIR} ${pkg}`,
|
|
10768
|
+
pnpm: `pnpm add --dir ${PINNED_BIN_DIR} ${pkg}`,
|
|
10769
|
+
deno: `cd ${PINNED_BIN_DIR} && npm install ${pkg}`
|
|
10770
|
+
};
|
|
10771
|
+
try {
|
|
10772
|
+
execSync2(commands[pm], { stdio: "inherit" });
|
|
10773
|
+
} catch (err) {
|
|
10774
|
+
throw new ClaudeMultiError(ErrorCode.UPDATE_FAILED, `Failed to install pinned Claude v${COMPATIBLE_CLAUDE_VERSION}: ${err instanceof Error ? err.message : String(err)}`, { cause: err });
|
|
10775
|
+
}
|
|
10776
|
+
}
|
|
10777
|
+
async function getLatestVersion() {
|
|
10778
|
+
try {
|
|
10779
|
+
const response = await fetch("https://registry.npmjs.org/@anthropic-ai/claude-code/latest");
|
|
10780
|
+
const data = await response.json();
|
|
10781
|
+
return data.version;
|
|
10782
|
+
} catch (err) {
|
|
10783
|
+
throw new ClaudeMultiError(ErrorCode.VERSION_CHECK_FAILED, `Failed to fetch latest version from npm registry: ${err instanceof Error ? err.message : String(err)}`, { cause: err });
|
|
10784
|
+
}
|
|
10785
|
+
}
|
|
10786
|
+
async function checkForUpdates() {
|
|
10787
|
+
const current = getCurrentVersion();
|
|
10788
|
+
const latest = await getLatestVersion();
|
|
10789
|
+
return {
|
|
10790
|
+
current,
|
|
10791
|
+
latest,
|
|
10792
|
+
updateAvailable: current !== null && current !== latest
|
|
10793
|
+
};
|
|
10794
|
+
}
|
|
10795
|
+
function compareVersions(v1, v2) {
|
|
10796
|
+
const parts1 = v1.split(".").map(Number);
|
|
10797
|
+
const parts2 = v2.split(".").map(Number);
|
|
10798
|
+
for (let i = 0;i < Math.max(parts1.length, parts2.length); i++) {
|
|
10799
|
+
const num1 = parts1[i] || 0;
|
|
10800
|
+
const num2 = parts2[i] || 0;
|
|
10801
|
+
if (num1 < num2)
|
|
10802
|
+
return -1;
|
|
10803
|
+
if (num1 > num2)
|
|
10804
|
+
return 1;
|
|
10805
|
+
}
|
|
10806
|
+
return 0;
|
|
10807
|
+
}
|
|
10808
|
+
async function updateClaudeCode() {
|
|
10809
|
+
const pm = detectPackageManager();
|
|
10810
|
+
const commands = {
|
|
10811
|
+
bun: "bun install -g @anthropic-ai/claude-code@latest",
|
|
10812
|
+
npm: "npm install -g @anthropic-ai/claude-code@latest",
|
|
10813
|
+
pnpm: "pnpm add -g @anthropic-ai/claude-code@latest",
|
|
10814
|
+
deno: "deno install --reload -g npm:@anthropic-ai/claude-code@latest"
|
|
10815
|
+
};
|
|
10816
|
+
try {
|
|
10817
|
+
console.log("Updating @anthropic-ai/claude-code...");
|
|
10818
|
+
execSync2(commands[pm], { stdio: "inherit" });
|
|
10819
|
+
console.log("Update completed successfully!");
|
|
10820
|
+
} catch (err) {
|
|
10821
|
+
throw new ClaudeMultiError(ErrorCode.UPDATE_FAILED, `Failed to update @anthropic-ai/claude-code: ${err instanceof Error ? err.message : String(err)}`, { cause: err });
|
|
10822
|
+
}
|
|
10823
|
+
}
|
|
10824
|
+
var import_semver, COMPATIBLE_CLAUDE_VERSION = "2.1.156";
|
|
10825
|
+
var init_version = __esm(() => {
|
|
10826
|
+
init_errors();
|
|
10827
|
+
init_paths();
|
|
10828
|
+
import_semver = __toESM(require_semver2(), 1);
|
|
8813
10829
|
});
|
|
8814
10830
|
|
|
8815
10831
|
// node_modules/react/cjs/react.development.js
|
|
@@ -10231,7 +12247,7 @@ var require_react_reconciler_constants_development = __commonJS((exports) => {
|
|
|
10231
12247
|
});
|
|
10232
12248
|
|
|
10233
12249
|
// node_modules/react-reconciler/constants.js
|
|
10234
|
-
var
|
|
12250
|
+
var require_constants2 = __commonJS((exports, module) => {
|
|
10235
12251
|
if (false) {} else {
|
|
10236
12252
|
module.exports = require_react_reconciler_constants_development();
|
|
10237
12253
|
}
|
|
@@ -25211,7 +27227,7 @@ var init_styles = __esm(async () => {
|
|
|
25211
27227
|
});
|
|
25212
27228
|
|
|
25213
27229
|
// node_modules/ws/lib/constants.js
|
|
25214
|
-
var
|
|
27230
|
+
var require_constants3 = __commonJS((exports, module) => {
|
|
25215
27231
|
var BINARY_TYPES = ["nodebuffer", "arraybuffer", "fragments"];
|
|
25216
27232
|
var hasBlob = typeof Blob !== "undefined";
|
|
25217
27233
|
if (hasBlob)
|
|
@@ -25232,7 +27248,7 @@ var require_constants2 = __commonJS((exports, module) => {
|
|
|
25232
27248
|
|
|
25233
27249
|
// node_modules/ws/lib/buffer-util.js
|
|
25234
27250
|
var require_buffer_util = __commonJS((exports, module) => {
|
|
25235
|
-
var { EMPTY_BUFFER } =
|
|
27251
|
+
var { EMPTY_BUFFER } = require_constants3();
|
|
25236
27252
|
var FastBuffer = Buffer[Symbol.species];
|
|
25237
27253
|
function concat2(list, totalLength) {
|
|
25238
27254
|
if (list.length === 0)
|
|
@@ -25345,7 +27361,7 @@ var require_permessage_deflate = __commonJS((exports, module) => {
|
|
|
25345
27361
|
var zlib = __require("zlib");
|
|
25346
27362
|
var bufferUtil = require_buffer_util();
|
|
25347
27363
|
var Limiter = require_limiter();
|
|
25348
|
-
var { kStatusCode } =
|
|
27364
|
+
var { kStatusCode } = require_constants3();
|
|
25349
27365
|
var FastBuffer = Buffer[Symbol.species];
|
|
25350
27366
|
var TRAILER = Buffer.from([0, 0, 255, 255]);
|
|
25351
27367
|
var kPerMessageDeflate = Symbol("permessage-deflate");
|
|
@@ -25607,7 +27623,7 @@ var require_permessage_deflate = __commonJS((exports, module) => {
|
|
|
25607
27623
|
// node_modules/ws/lib/validation.js
|
|
25608
27624
|
var require_validation = __commonJS((exports, module) => {
|
|
25609
27625
|
var { isUtf8 } = __require("buffer");
|
|
25610
|
-
var { hasBlob } =
|
|
27626
|
+
var { hasBlob } = require_constants3();
|
|
25611
27627
|
var tokenChars = [
|
|
25612
27628
|
0,
|
|
25613
27629
|
0,
|
|
@@ -25800,7 +27816,7 @@ var require_receiver = __commonJS((exports, module) => {
|
|
|
25800
27816
|
EMPTY_BUFFER,
|
|
25801
27817
|
kStatusCode,
|
|
25802
27818
|
kWebSocket
|
|
25803
|
-
} =
|
|
27819
|
+
} = require_constants3();
|
|
25804
27820
|
var { concat: concat2, toArrayBuffer, unmask } = require_buffer_util();
|
|
25805
27821
|
var { isValidStatusCode, isValidUTF8 } = require_validation();
|
|
25806
27822
|
var FastBuffer = Buffer[Symbol.species];
|
|
@@ -26180,7 +28196,7 @@ var require_sender = __commonJS((exports, module) => {
|
|
|
26180
28196
|
types: { isUint8Array }
|
|
26181
28197
|
} = __require("util");
|
|
26182
28198
|
var PerMessageDeflate = require_permessage_deflate();
|
|
26183
|
-
var { EMPTY_BUFFER, kWebSocket, NOOP } =
|
|
28199
|
+
var { EMPTY_BUFFER, kWebSocket, NOOP } = require_constants3();
|
|
26184
28200
|
var { isBlob, isValidStatusCode } = require_validation();
|
|
26185
28201
|
var { mask: applyMask, toBuffer } = require_buffer_util();
|
|
26186
28202
|
var kByteLength = Symbol("kByteLength");
|
|
@@ -26533,7 +28549,7 @@ var require_sender = __commonJS((exports, module) => {
|
|
|
26533
28549
|
|
|
26534
28550
|
// node_modules/ws/lib/event-target.js
|
|
26535
28551
|
var require_event_target = __commonJS((exports, module) => {
|
|
26536
|
-
var { kForOnEventAttribute, kListener } =
|
|
28552
|
+
var { kForOnEventAttribute, kListener } = require_constants3();
|
|
26537
28553
|
var kCode = Symbol("kCode");
|
|
26538
28554
|
var kData = Symbol("kData");
|
|
26539
28555
|
var kError = Symbol("kError");
|
|
@@ -26871,7 +28887,7 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
26871
28887
|
kStatusCode,
|
|
26872
28888
|
kWebSocket,
|
|
26873
28889
|
NOOP
|
|
26874
|
-
} =
|
|
28890
|
+
} = require_constants3();
|
|
26875
28891
|
var {
|
|
26876
28892
|
EventTarget: { addEventListener, removeEventListener }
|
|
26877
28893
|
} = require_event_target();
|
|
@@ -27771,7 +29787,7 @@ var require_websocket_server = __commonJS((exports, module) => {
|
|
|
27771
29787
|
var PerMessageDeflate = require_permessage_deflate();
|
|
27772
29788
|
var subprotocol = require_subprotocol();
|
|
27773
29789
|
var WebSocket = require_websocket();
|
|
27774
|
-
var { CLOSE_TIMEOUT, GUID, kWebSocket } =
|
|
29790
|
+
var { CLOSE_TIMEOUT, GUID, kWebSocket } = require_constants3();
|
|
27775
29791
|
var keyRegex = /^[+/0-9A-Za-z]{22}==$/;
|
|
27776
29792
|
var RUNNING = 0;
|
|
27777
29793
|
var CLOSING = 1;
|
|
@@ -31071,7 +33087,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
31071
33087
|
if (Array.isArray(arr))
|
|
31072
33088
|
return arr;
|
|
31073
33089
|
}
|
|
31074
|
-
var
|
|
33090
|
+
var compareVersions2 = function compareVersions3(v1, v2) {
|
|
31075
33091
|
var n1 = validateAndParse(v1);
|
|
31076
33092
|
var n2 = validateAndParse(v2);
|
|
31077
33093
|
var p1 = n1.pop();
|
|
@@ -31087,11 +33103,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
31087
33103
|
return 0;
|
|
31088
33104
|
};
|
|
31089
33105
|
var validate2 = function validate3(version) {
|
|
31090
|
-
return typeof version === "string" && /^[v\d]/.test(version) &&
|
|
33106
|
+
return typeof version === "string" && /^[v\d]/.test(version) && semver2.test(version);
|
|
31091
33107
|
};
|
|
31092
33108
|
var compare = function compare2(v1, v2, operator) {
|
|
31093
33109
|
assertValidOperator(operator);
|
|
31094
|
-
var res =
|
|
33110
|
+
var res = compareVersions2(v1, v2);
|
|
31095
33111
|
return operatorResMap[operator].includes(res);
|
|
31096
33112
|
};
|
|
31097
33113
|
var satisfies = function satisfies2(version, range2) {
|
|
@@ -31121,12 +33137,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
31121
33137
|
return false;
|
|
31122
33138
|
return true;
|
|
31123
33139
|
};
|
|
31124
|
-
var
|
|
33140
|
+
var semver2 = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i;
|
|
31125
33141
|
var validateAndParse = function validateAndParse2(version) {
|
|
31126
33142
|
if (typeof version !== "string") {
|
|
31127
33143
|
throw new TypeError("Invalid argument expected string");
|
|
31128
33144
|
}
|
|
31129
|
-
var match = version.match(
|
|
33145
|
+
var match = version.match(semver2);
|
|
31130
33146
|
if (!match) {
|
|
31131
33147
|
throw new Error("Invalid argument not valid semver ('".concat(version, "' received)"));
|
|
31132
33148
|
}
|
|
@@ -33000,12 +35016,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
33000
35016
|
function gt2() {
|
|
33001
35017
|
var a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
33002
35018
|
var b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
33003
|
-
return
|
|
35019
|
+
return compareVersions2(a, b) === 1;
|
|
33004
35020
|
}
|
|
33005
35021
|
function gte2() {
|
|
33006
35022
|
var a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
33007
35023
|
var b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
33008
|
-
return
|
|
35024
|
+
return compareVersions2(a, b) > -1;
|
|
33009
35025
|
}
|
|
33010
35026
|
var isReactNativeEnvironment = function isReactNativeEnvironment2() {
|
|
33011
35027
|
return window.document == null;
|
|
@@ -45010,7 +47026,7 @@ var init_reconciler = __esm(async () => {
|
|
|
45010
47026
|
init_styles()
|
|
45011
47027
|
]);
|
|
45012
47028
|
import_react_reconciler = __toESM(require_react_reconciler(), 1);
|
|
45013
|
-
import_constants3 = __toESM(
|
|
47029
|
+
import_constants3 = __toESM(require_constants2(), 1);
|
|
45014
47030
|
Scheduler = __toESM(require_scheduler(), 1);
|
|
45015
47031
|
import_react = __toESM(require_react(), 1);
|
|
45016
47032
|
if (process5.env["DEV"] === "true") {
|
|
@@ -48640,7 +50656,7 @@ var init_ink = __esm(async () => {
|
|
|
48640
50656
|
]);
|
|
48641
50657
|
import_react16 = __toESM(require_react(), 1);
|
|
48642
50658
|
import_signal_exit2 = __toESM(require_signal_exit(), 1);
|
|
48643
|
-
import_constants4 = __toESM(
|
|
50659
|
+
import_constants4 = __toESM(require_constants2(), 1);
|
|
48644
50660
|
textEncoder = new TextEncoder;
|
|
48645
50661
|
});
|
|
48646
50662
|
|
|
@@ -48754,7 +50770,7 @@ var init_render_to_string = __esm(async () => {
|
|
|
48754
50770
|
init_renderer(),
|
|
48755
50771
|
init_dom()
|
|
48756
50772
|
]);
|
|
48757
|
-
import_constants5 = __toESM(
|
|
50773
|
+
import_constants5 = __toESM(require_constants2(), 1);
|
|
48758
50774
|
render_to_string_default = renderToString;
|
|
48759
50775
|
});
|
|
48760
50776
|
|
|
@@ -53732,7 +55748,7 @@ var init_StatusBar = __esm(async () => {
|
|
|
53732
55748
|
});
|
|
53733
55749
|
|
|
53734
55750
|
// src/ink/hooks/useNavigation.tsx
|
|
53735
|
-
function
|
|
55751
|
+
function useNavigation2(onBack) {
|
|
53736
55752
|
const { exit } = use_app_default();
|
|
53737
55753
|
use_input_default((input, key) => {
|
|
53738
55754
|
if (key.escape) {
|
|
@@ -53869,10 +55885,40 @@ var exports_AddInstance = {};
|
|
|
53869
55885
|
__export(exports_AddInstance, {
|
|
53870
55886
|
AddInstance: () => AddInstance
|
|
53871
55887
|
});
|
|
53872
|
-
import { join as
|
|
55888
|
+
import { join as join6 } from "node:path";
|
|
53873
55889
|
import { homedir as homedir3 } from "node:os";
|
|
53874
55890
|
function stepNumber(step) {
|
|
53875
|
-
return
|
|
55891
|
+
return STEP_FLOW.indexOf(step) + 1;
|
|
55892
|
+
}
|
|
55893
|
+
function isStepVisible(step, state) {
|
|
55894
|
+
switch (step) {
|
|
55895
|
+
case "provider-region" /* ProviderRegion */:
|
|
55896
|
+
return !!state.selectedProvider && providerHasRegions(state.selectedProvider);
|
|
55897
|
+
case "provider-apikey" /* ProviderApiKey */:
|
|
55898
|
+
return state.useProvider;
|
|
55899
|
+
case "select-plugins" /* SelectPlugins */:
|
|
55900
|
+
return state.copyOption === CopyOption.SelectPlugins;
|
|
55901
|
+
case "autosync" /* Autosync */:
|
|
55902
|
+
return state.copyOption === CopyOption.All || state.copyOption === CopyOption.SelectPlugins;
|
|
55903
|
+
default:
|
|
55904
|
+
return true;
|
|
55905
|
+
}
|
|
55906
|
+
}
|
|
55907
|
+
function getVisibleSteps(state) {
|
|
55908
|
+
return STEP_FLOW.filter((s) => isStepVisible(s, state));
|
|
55909
|
+
}
|
|
55910
|
+
function getPrevStep(current, state) {
|
|
55911
|
+
const visible = getVisibleSteps(state);
|
|
55912
|
+
const idx = visible.indexOf(current);
|
|
55913
|
+
return idx > 0 ? visible[idx - 1] : null;
|
|
55914
|
+
}
|
|
55915
|
+
function getNextStep(current, state) {
|
|
55916
|
+
const visible = getVisibleSteps(state);
|
|
55917
|
+
const idx = visible.indexOf(current);
|
|
55918
|
+
return idx >= 0 && idx < visible.length - 1 ? visible[idx + 1] : null;
|
|
55919
|
+
}
|
|
55920
|
+
function getVisibleStepCount(state) {
|
|
55921
|
+
return getVisibleSteps(state).filter((s) => s !== "creating" /* Creating */ && s !== "done" /* Done */).length;
|
|
53876
55922
|
}
|
|
53877
55923
|
var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
53878
55924
|
name,
|
|
@@ -53931,10 +55977,10 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
53931
55977
|
}, undefined, true, undefined, this)
|
|
53932
55978
|
]
|
|
53933
55979
|
}, undefined, true, undefined, this);
|
|
53934
|
-
}, STEP_TITLES,
|
|
55980
|
+
}, STEP_TITLES, STEP_FLOW, AddInstance = ({ onBack, initialName }) => {
|
|
53935
55981
|
const { exit } = use_app_default();
|
|
53936
55982
|
const cfg = useConfig();
|
|
53937
|
-
const [step, setStep] = import_react67.useState(initialName ? "provider-select" : "name");
|
|
55983
|
+
const [step, setStep] = import_react67.useState(initialName ? "provider-select" /* ProviderSelect */ : "name" /* Name */);
|
|
53938
55984
|
const [name, setName] = import_react67.useState(initialName ?? "");
|
|
53939
55985
|
const [error, setError] = import_react67.useState("");
|
|
53940
55986
|
const [useProvider, setUseProvider] = import_react67.useState(false);
|
|
@@ -53946,34 +55992,41 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
53946
55992
|
const [selectedPluginIds, setSelectedPluginIds] = import_react67.useState([]);
|
|
53947
55993
|
const [result2, setResult] = import_react67.useState(null);
|
|
53948
55994
|
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);
|
|
55995
|
+
const wizardState = import_react67.useMemo(() => ({
|
|
55996
|
+
useProvider,
|
|
55997
|
+
selectedProvider,
|
|
55998
|
+
copyOption
|
|
55999
|
+
}), [useProvider, selectedProvider, copyOption]);
|
|
56000
|
+
const navTo = import_react67.useCallback((target) => {
|
|
56001
|
+
if (target) {
|
|
56002
|
+
setStep(target);
|
|
53972
56003
|
setError("");
|
|
53973
56004
|
} else {
|
|
53974
56005
|
onBack();
|
|
53975
56006
|
}
|
|
53976
|
-
}, [
|
|
56007
|
+
}, [onBack]);
|
|
56008
|
+
const goBack = import_react67.useCallback(() => {
|
|
56009
|
+
navTo(getPrevStep(step, wizardState));
|
|
56010
|
+
}, [step, wizardState, navTo]);
|
|
56011
|
+
const goForward = import_react67.useCallback(() => {
|
|
56012
|
+
const next = getNextStep(step, wizardState);
|
|
56013
|
+
if (next && next !== "creating" /* Creating */ && next !== "done" /* Done */) {
|
|
56014
|
+
navTo(next);
|
|
56015
|
+
}
|
|
56016
|
+
}, [step, wizardState, navTo]);
|
|
56017
|
+
useNavigation2(() => {
|
|
56018
|
+
onBack();
|
|
56019
|
+
});
|
|
56020
|
+
use_input_default((input, key) => {
|
|
56021
|
+
if (input === "q" && step === "done" /* Done */)
|
|
56022
|
+
exit();
|
|
56023
|
+
if (key.shift && key.leftArrow && step !== "creating" /* Creating */ && step !== "done" /* Done */) {
|
|
56024
|
+
goBack();
|
|
56025
|
+
}
|
|
56026
|
+
if (key.shift && key.rightArrow && step !== "creating" /* Creating */ && step !== "done" /* Done */) {
|
|
56027
|
+
goForward();
|
|
56028
|
+
}
|
|
56029
|
+
});
|
|
53977
56030
|
const handleNameSubmit = import_react67.useCallback((value) => {
|
|
53978
56031
|
if (!value.trim()) {
|
|
53979
56032
|
setError("Name is required");
|
|
@@ -53985,26 +56038,22 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
53985
56038
|
}
|
|
53986
56039
|
setError("");
|
|
53987
56040
|
setName(value);
|
|
53988
|
-
setStep("provider-select");
|
|
56041
|
+
setStep("provider-select" /* ProviderSelect */);
|
|
53989
56042
|
}, []);
|
|
53990
56043
|
const handleProviderSelect = import_react67.useCallback((value) => {
|
|
53991
56044
|
if (value === CopyOption.None) {
|
|
53992
56045
|
setUseProvider(false);
|
|
53993
56046
|
setSelectedProvider(null);
|
|
53994
|
-
setStep("paths-confirm");
|
|
56047
|
+
setStep("paths-confirm" /* PathsConfirm */);
|
|
53995
56048
|
return;
|
|
53996
56049
|
}
|
|
53997
56050
|
setUseProvider(true);
|
|
53998
56051
|
setSelectedProvider(value);
|
|
53999
|
-
|
|
54000
|
-
setStep("provider-region");
|
|
54001
|
-
} else {
|
|
54002
|
-
setStep("provider-apikey");
|
|
54003
|
-
}
|
|
56052
|
+
setStep(providerHasRegions(value) ? "provider-region" /* ProviderRegion */ : "provider-apikey" /* ProviderApiKey */);
|
|
54004
56053
|
}, []);
|
|
54005
56054
|
const handleRegionSelect = import_react67.useCallback((value) => {
|
|
54006
56055
|
setSelectedRegion(value);
|
|
54007
|
-
setStep("provider-apikey");
|
|
56056
|
+
setStep("provider-apikey" /* ProviderApiKey */);
|
|
54008
56057
|
}, []);
|
|
54009
56058
|
const handleApiKeySubmit = import_react67.useCallback((value) => {
|
|
54010
56059
|
if (!value.trim()) {
|
|
@@ -54013,17 +56062,17 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54013
56062
|
}
|
|
54014
56063
|
setError("");
|
|
54015
56064
|
setApiKey(value);
|
|
54016
|
-
setStep("paths-confirm");
|
|
56065
|
+
setStep("paths-confirm" /* PathsConfirm */);
|
|
54017
56066
|
}, []);
|
|
54018
56067
|
const handleDefaultsConfirm = import_react67.useCallback((_confirmed) => {
|
|
54019
|
-
setStep("copy-options");
|
|
56068
|
+
setStep("copy-options" /* CopyOptions */);
|
|
54020
56069
|
}, []);
|
|
54021
56070
|
const handleCopyOption = import_react67.useCallback((value) => {
|
|
54022
56071
|
setCopyOption(value);
|
|
54023
56072
|
if (value === CopyOption.SelectPlugins) {
|
|
54024
|
-
setStep("select-plugins");
|
|
56073
|
+
setStep("select-plugins" /* SelectPlugins */);
|
|
54025
56074
|
} else if (value === CopyOption.All) {
|
|
54026
|
-
setStep("autosync");
|
|
56075
|
+
setStep("autosync" /* Autosync */);
|
|
54027
56076
|
} else {
|
|
54028
56077
|
doCreate(value, false);
|
|
54029
56078
|
}
|
|
@@ -54035,17 +56084,17 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54035
56084
|
}
|
|
54036
56085
|
setSelectedPluginIds(ids);
|
|
54037
56086
|
setError("");
|
|
54038
|
-
setStep("autosync");
|
|
56087
|
+
setStep("autosync" /* Autosync */);
|
|
54039
56088
|
}, []);
|
|
54040
56089
|
const handleAutoSyncConfirm = import_react67.useCallback((confirmed) => {
|
|
54041
56090
|
setAutoSync(confirmed);
|
|
54042
56091
|
doCreate(copyOption, confirmed);
|
|
54043
56092
|
}, [copyOption, selectedPluginIds]);
|
|
54044
56093
|
const doCreate = async (copyOpt, sync) => {
|
|
54045
|
-
setStep("creating");
|
|
56094
|
+
setStep("creating" /* Creating */);
|
|
54046
56095
|
setError("");
|
|
54047
56096
|
try {
|
|
54048
|
-
const cDir =
|
|
56097
|
+
const cDir = join6(homedir3(), `.claude-${name}`);
|
|
54049
56098
|
const bPath = cfg.getDefaultBinaryPath(name);
|
|
54050
56099
|
const instance = {
|
|
54051
56100
|
name,
|
|
@@ -54080,12 +56129,12 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54080
56129
|
await cfg.mergeProviderEnv(cDir, template2, apiKey);
|
|
54081
56130
|
}
|
|
54082
56131
|
setResult({ configDir: cDir, binaryPath: bPath });
|
|
54083
|
-
setStep("done");
|
|
56132
|
+
setStep("done" /* Done */);
|
|
54084
56133
|
} catch (err) {
|
|
54085
56134
|
await removeInstance(name).catch(() => {});
|
|
54086
56135
|
removeWrapper(cfg.getDefaultBinaryPath(name));
|
|
54087
56136
|
setError(err instanceof Error ? err.message : String(err));
|
|
54088
|
-
setStep("name");
|
|
56137
|
+
setStep("name" /* Name */);
|
|
54089
56138
|
}
|
|
54090
56139
|
};
|
|
54091
56140
|
const hasDefaultConfig = cfg.hasDefaultConfig();
|
|
@@ -54117,14 +56166,14 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54117
56166
|
}, undefined, false, undefined, this),
|
|
54118
56167
|
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(StepIndicator, {
|
|
54119
56168
|
current: stepNumber(step),
|
|
54120
|
-
total:
|
|
56169
|
+
total: getVisibleStepCount(wizardState),
|
|
54121
56170
|
label: STEP_TITLES[step]
|
|
54122
56171
|
}, undefined, false, undefined, this),
|
|
54123
56172
|
error && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(StatusBar, {
|
|
54124
56173
|
message: error,
|
|
54125
56174
|
type: "error"
|
|
54126
56175
|
}, undefined, false, undefined, this),
|
|
54127
|
-
step === "name" && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
56176
|
+
step === "name" /* Name */ && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
54128
56177
|
flexDirection: "column",
|
|
54129
56178
|
gap: 1,
|
|
54130
56179
|
children: [
|
|
@@ -54137,11 +56186,12 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54137
56186
|
}, undefined, false, undefined, this),
|
|
54138
56187
|
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(TextInput, {
|
|
54139
56188
|
placeholder: "my-instance",
|
|
56189
|
+
defaultValue: name,
|
|
54140
56190
|
onSubmit: handleNameSubmit
|
|
54141
56191
|
}, undefined, false, undefined, this)
|
|
54142
56192
|
]
|
|
54143
56193
|
}, undefined, true, undefined, this),
|
|
54144
|
-
step === "provider-select" && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
56194
|
+
step === "provider-select" /* ProviderSelect */ && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
54145
56195
|
flexDirection: "column",
|
|
54146
56196
|
gap: 1,
|
|
54147
56197
|
children: [
|
|
@@ -54151,11 +56201,12 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54151
56201
|
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Select, {
|
|
54152
56202
|
options: providerOptions,
|
|
54153
56203
|
visibleOptionCount: providerOptions.length,
|
|
56204
|
+
defaultValue: selectedProvider ?? undefined,
|
|
54154
56205
|
onChange: handleProviderSelect
|
|
54155
56206
|
}, undefined, false, undefined, this)
|
|
54156
56207
|
]
|
|
54157
56208
|
}, undefined, true, undefined, this),
|
|
54158
|
-
step === "provider-region" && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
56209
|
+
step === "provider-region" /* ProviderRegion */ && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
54159
56210
|
flexDirection: "column",
|
|
54160
56211
|
gap: 1,
|
|
54161
56212
|
children: [
|
|
@@ -54178,11 +56229,12 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54178
56229
|
value: key
|
|
54179
56230
|
})),
|
|
54180
56231
|
visibleOptionCount: 3,
|
|
56232
|
+
defaultValue: selectedRegion ?? undefined,
|
|
54181
56233
|
onChange: handleRegionSelect
|
|
54182
56234
|
}, undefined, false, undefined, this)
|
|
54183
56235
|
]
|
|
54184
56236
|
}, undefined, true, undefined, this),
|
|
54185
|
-
step === "provider-apikey" && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
56237
|
+
step === "provider-apikey" /* ProviderApiKey */ && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
54186
56238
|
flexDirection: "column",
|
|
54187
56239
|
gap: 1,
|
|
54188
56240
|
children: [
|
|
@@ -54199,7 +56251,7 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54199
56251
|
}, undefined, false, undefined, this)
|
|
54200
56252
|
]
|
|
54201
56253
|
}, undefined, true, undefined, this),
|
|
54202
|
-
step === "paths-confirm" && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
56254
|
+
step === "paths-confirm" /* PathsConfirm */ && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
54203
56255
|
flexDirection: "column",
|
|
54204
56256
|
gap: 1,
|
|
54205
56257
|
children: [
|
|
@@ -54210,7 +56262,7 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54210
56262
|
dimColor: true,
|
|
54211
56263
|
children: [
|
|
54212
56264
|
"Config: ",
|
|
54213
|
-
|
|
56265
|
+
join6(homedir3(), `.claude-${name}`)
|
|
54214
56266
|
]
|
|
54215
56267
|
}, undefined, true, undefined, this),
|
|
54216
56268
|
/* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
@@ -54226,7 +56278,7 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54226
56278
|
}, undefined, false, undefined, this)
|
|
54227
56279
|
]
|
|
54228
56280
|
}, undefined, true, undefined, this),
|
|
54229
|
-
step === "copy-options" && !hasDefaultConfig && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
56281
|
+
step === "copy-options" /* CopyOptions */ && !hasDefaultConfig && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
54230
56282
|
flexDirection: "column",
|
|
54231
56283
|
gap: 1,
|
|
54232
56284
|
children: [
|
|
@@ -54240,7 +56292,7 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54240
56292
|
}, undefined, false, undefined, this)
|
|
54241
56293
|
]
|
|
54242
56294
|
}, undefined, true, undefined, this),
|
|
54243
|
-
step === "copy-options" && hasDefaultConfig && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
56295
|
+
step === "copy-options" /* CopyOptions */ && hasDefaultConfig && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
54244
56296
|
flexDirection: "column",
|
|
54245
56297
|
gap: 1,
|
|
54246
56298
|
children: [
|
|
@@ -54257,7 +56309,7 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54257
56309
|
}, undefined, false, undefined, this)
|
|
54258
56310
|
]
|
|
54259
56311
|
}, undefined, true, undefined, this),
|
|
54260
|
-
step === "select-plugins" && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
56312
|
+
step === "select-plugins" /* SelectPlugins */ && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
54261
56313
|
flexDirection: "column",
|
|
54262
56314
|
gap: 1,
|
|
54263
56315
|
children: [
|
|
@@ -54278,7 +56330,7 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54278
56330
|
}, undefined, false, undefined, this)
|
|
54279
56331
|
]
|
|
54280
56332
|
}, undefined, true, undefined, this),
|
|
54281
|
-
step === "autosync" && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
56333
|
+
step === "autosync" /* Autosync */ && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
|
|
54282
56334
|
flexDirection: "column",
|
|
54283
56335
|
gap: 1,
|
|
54284
56336
|
children: [
|
|
@@ -54295,11 +56347,11 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54295
56347
|
}, undefined, false, undefined, this)
|
|
54296
56348
|
]
|
|
54297
56349
|
}, undefined, true, undefined, this),
|
|
54298
|
-
step === "creating" && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
56350
|
+
step === "creating" /* Creating */ && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
54299
56351
|
dimColor: true,
|
|
54300
56352
|
children: "Creating instance..."
|
|
54301
56353
|
}, undefined, false, undefined, this),
|
|
54302
|
-
step === "done" && result2 && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(AddResult, {
|
|
56354
|
+
step === "done" /* Done */ && result2 && /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(AddResult, {
|
|
54303
56355
|
name,
|
|
54304
56356
|
binaryPath: result2.binaryPath,
|
|
54305
56357
|
configDir: result2.configDir
|
|
@@ -54308,7 +56360,7 @@ var import_react67, jsx_dev_runtime4, AddResult = ({
|
|
|
54308
56360
|
marginTop: 1,
|
|
54309
56361
|
children: /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
|
|
54310
56362
|
dimColor: true,
|
|
54311
|
-
children: "ESC back │ q quit"
|
|
56363
|
+
children: "Shift+← back │ Shift+→ next │ ESC back │ q quit"
|
|
54312
56364
|
}, undefined, false, undefined, this)
|
|
54313
56365
|
}, undefined, false, undefined, this)
|
|
54314
56366
|
]
|
|
@@ -54332,176 +56384,45 @@ var init_AddInstance = __esm(async () => {
|
|
|
54332
56384
|
import_react67 = __toESM(require_react(), 1);
|
|
54333
56385
|
jsx_dev_runtime4 = __toESM(require_jsx_dev_runtime(), 1);
|
|
54334
56386
|
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"
|
|
56387
|
+
["name" /* Name */]: "Instance Name",
|
|
56388
|
+
["provider-select" /* ProviderSelect */]: "Provider Template",
|
|
56389
|
+
["provider-region" /* ProviderRegion */]: "Region",
|
|
56390
|
+
["provider-apikey" /* ProviderApiKey */]: "API Key",
|
|
56391
|
+
["paths-confirm" /* PathsConfirm */]: "Paths",
|
|
56392
|
+
["copy-options" /* CopyOptions */]: "Copy Options",
|
|
56393
|
+
["select-plugins" /* SelectPlugins */]: "Select Plugins",
|
|
56394
|
+
["autosync" /* Autosync */]: "Auto-Sync",
|
|
56395
|
+
["creating" /* Creating */]: "Creating...",
|
|
56396
|
+
["done" /* Done */]: "Complete"
|
|
56397
|
+
};
|
|
56398
|
+
STEP_FLOW = [
|
|
56399
|
+
"name" /* Name */,
|
|
56400
|
+
"provider-select" /* ProviderSelect */,
|
|
56401
|
+
"provider-region" /* ProviderRegion */,
|
|
56402
|
+
"provider-apikey" /* ProviderApiKey */,
|
|
56403
|
+
"paths-confirm" /* PathsConfirm */,
|
|
56404
|
+
"copy-options" /* CopyOptions */,
|
|
56405
|
+
"select-plugins" /* SelectPlugins */,
|
|
56406
|
+
"autosync" /* Autosync */,
|
|
56407
|
+
"creating" /* Creating */,
|
|
56408
|
+
"done" /* Done */
|
|
54357
56409
|
];
|
|
54358
56410
|
});
|
|
54359
56411
|
|
|
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
56412
|
// src/health.ts
|
|
54501
|
-
|
|
54502
|
-
|
|
56413
|
+
var exports_health = {};
|
|
56414
|
+
__export(exports_health, {
|
|
56415
|
+
saveHealthStatus: () => saveHealthStatus,
|
|
56416
|
+
runHealthChecks: () => runHealthChecks,
|
|
56417
|
+
loadHealthStatus: () => loadHealthStatus,
|
|
56418
|
+
fixWrapperVersions: () => fixWrapperVersions,
|
|
56419
|
+
dismissIssue: () => dismissIssue,
|
|
56420
|
+
dismissAllIssues: () => dismissAllIssues
|
|
56421
|
+
});
|
|
56422
|
+
import { existsSync as existsSync6, readFileSync as readFileSync5, writeFileSync as writeFileSync4, mkdirSync as mkdirSync5 } from "node:fs";
|
|
56423
|
+
import { join as join7 } from "node:path";
|
|
54503
56424
|
function getHealthFile() {
|
|
54504
|
-
return
|
|
56425
|
+
return join7(getBaseDir(), ".claude-multi", "health-status.json");
|
|
54505
56426
|
}
|
|
54506
56427
|
function runHealthChecks(instances2, migrationStatus) {
|
|
54507
56428
|
const now2 = new Date().toISOString();
|
|
@@ -54522,7 +56443,7 @@ function runHealthChecks(instances2, migrationStatus) {
|
|
|
54522
56443
|
});
|
|
54523
56444
|
}
|
|
54524
56445
|
for (const inst of instances2) {
|
|
54525
|
-
if (!
|
|
56446
|
+
if (!existsSync6(inst.configDir)) {
|
|
54526
56447
|
issues.push({
|
|
54527
56448
|
id: `configdir-missing-${inst.name}`,
|
|
54528
56449
|
severity: "error",
|
|
@@ -54538,7 +56459,7 @@ function runHealthChecks(instances2, migrationStatus) {
|
|
|
54538
56459
|
});
|
|
54539
56460
|
continue;
|
|
54540
56461
|
}
|
|
54541
|
-
if (!
|
|
56462
|
+
if (!existsSync6(inst.binaryPath)) {
|
|
54542
56463
|
issues.push({
|
|
54543
56464
|
id: `binary-missing-${inst.name}`,
|
|
54544
56465
|
severity: "warning",
|
|
@@ -54553,8 +56474,8 @@ function runHealthChecks(instances2, migrationStatus) {
|
|
|
54553
56474
|
resolutionHint: "Re-create the instance or run 'claude-multi sync'"
|
|
54554
56475
|
});
|
|
54555
56476
|
}
|
|
54556
|
-
const settingsFile =
|
|
54557
|
-
if (
|
|
56477
|
+
const settingsFile = join7(inst.configDir, "settings.json");
|
|
56478
|
+
if (existsSync6(settingsFile)) {
|
|
54558
56479
|
try {
|
|
54559
56480
|
JSON.parse(readFileSync5(settingsFile, "utf-8"));
|
|
54560
56481
|
} catch {
|
|
@@ -54589,12 +56510,36 @@ function runHealthChecks(instances2, migrationStatus) {
|
|
|
54589
56510
|
resolutionHint: "Re-sync symlinks from the home screen"
|
|
54590
56511
|
});
|
|
54591
56512
|
}
|
|
56513
|
+
if (existsSync6(inst.binaryPath) && existsSync6(PINNED_CLAUDE_BIN)) {
|
|
56514
|
+
try {
|
|
56515
|
+
const wrapperContent = readFileSync5(inst.binaryPath, "utf-8");
|
|
56516
|
+
const shellMatch = wrapperContent.match(/exec\s+"([^"]+)"/);
|
|
56517
|
+
const nodeMatch = wrapperContent.match(/spawn\("([^"]+)"/);
|
|
56518
|
+
const currentBin = shellMatch?.[1] ?? nodeMatch?.[1];
|
|
56519
|
+
if (currentBin && currentBin !== PINNED_CLAUDE_BIN) {
|
|
56520
|
+
issues.push({
|
|
56521
|
+
id: `wrong-claude-version-${inst.name}`,
|
|
56522
|
+
severity: "error",
|
|
56523
|
+
category: "version",
|
|
56524
|
+
title: "Wrong Claude binary",
|
|
56525
|
+
message: `Instance '${inst.name}' uses a Claude version that may break 3rd-party providers`,
|
|
56526
|
+
detail: `Current: ${currentBin}
|
|
56527
|
+
Expected: ${PINNED_CLAUDE_BIN}`,
|
|
56528
|
+
instanceName: inst.name,
|
|
56529
|
+
timestamp: now2,
|
|
56530
|
+
dismissed: false,
|
|
56531
|
+
resolved: false,
|
|
56532
|
+
resolutionHint: "Run 'claude-multi doctor fix' or press ! from the home screen"
|
|
56533
|
+
});
|
|
56534
|
+
}
|
|
56535
|
+
} catch {}
|
|
56536
|
+
}
|
|
54592
56537
|
}
|
|
54593
56538
|
return issues;
|
|
54594
56539
|
}
|
|
54595
56540
|
function loadHealthStatus() {
|
|
54596
56541
|
const healthFile = getHealthFile();
|
|
54597
|
-
if (!
|
|
56542
|
+
if (!existsSync6(healthFile)) {
|
|
54598
56543
|
return { lastChecked: "", issues: [] };
|
|
54599
56544
|
}
|
|
54600
56545
|
try {
|
|
@@ -54604,10 +56549,10 @@ function loadHealthStatus() {
|
|
|
54604
56549
|
}
|
|
54605
56550
|
}
|
|
54606
56551
|
function saveHealthStatus(status) {
|
|
54607
|
-
const dir =
|
|
54608
|
-
if (!
|
|
54609
|
-
|
|
54610
|
-
|
|
56552
|
+
const dir = join7(getBaseDir(), ".claude-multi");
|
|
56553
|
+
if (!existsSync6(dir))
|
|
56554
|
+
mkdirSync5(dir, { recursive: true });
|
|
56555
|
+
writeFileSync4(getHealthFile(), JSON.stringify(status, null, 2), "utf-8");
|
|
54611
56556
|
}
|
|
54612
56557
|
function dismissIssue(id) {
|
|
54613
56558
|
const status = loadHealthStatus();
|
|
@@ -54624,12 +56569,197 @@ function dismissAllIssues() {
|
|
|
54624
56569
|
}
|
|
54625
56570
|
saveHealthStatus(status);
|
|
54626
56571
|
}
|
|
56572
|
+
function fixWrapperVersions(instances2) {
|
|
56573
|
+
if (!existsSync6(PINNED_CLAUDE_BIN))
|
|
56574
|
+
return [];
|
|
56575
|
+
const fixed = [];
|
|
56576
|
+
for (const inst of instances2) {
|
|
56577
|
+
if (!existsSync6(inst.binaryPath))
|
|
56578
|
+
continue;
|
|
56579
|
+
try {
|
|
56580
|
+
const content = readFileSync5(inst.binaryPath, "utf-8");
|
|
56581
|
+
const shellMatch = content.match(/exec\s+"([^"]+)"/);
|
|
56582
|
+
const nodeMatch = content.match(/spawn\("([^"]+)"/);
|
|
56583
|
+
const currentBin = shellMatch?.[1] ?? nodeMatch?.[1];
|
|
56584
|
+
if (!currentBin || currentBin === PINNED_CLAUDE_BIN)
|
|
56585
|
+
continue;
|
|
56586
|
+
const newContent = `#!/bin/sh
|
|
56587
|
+
# Claude Multi - Wrapper for ${inst.name}
|
|
56588
|
+
# Generated by claude-multi
|
|
56589
|
+
export CLAUDE_CONFIG_DIR="${inst.configDir}"
|
|
56590
|
+
exec "${PINNED_CLAUDE_BIN}" "$@"
|
|
56591
|
+
`;
|
|
56592
|
+
writeFileSync4(inst.binaryPath, newContent, { mode: 493 });
|
|
56593
|
+
fixed.push(inst.name);
|
|
56594
|
+
} catch {}
|
|
56595
|
+
}
|
|
56596
|
+
return fixed;
|
|
56597
|
+
}
|
|
54627
56598
|
var init_health = __esm(() => {
|
|
54628
56599
|
init_config();
|
|
54629
56600
|
init_paths();
|
|
54630
56601
|
init_constants();
|
|
54631
56602
|
});
|
|
54632
56603
|
|
|
56604
|
+
// src/ink/components/Footer.tsx
|
|
56605
|
+
var jsx_dev_runtime5, Footer = ({ showHealthHint }) => {
|
|
56606
|
+
const lineLen = 60;
|
|
56607
|
+
const lineProgress = useDrawLine(lineLen, 0, 4);
|
|
56608
|
+
const showHints = useFadeIn(100);
|
|
56609
|
+
return /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
56610
|
+
flexDirection: "column",
|
|
56611
|
+
width: "100",
|
|
56612
|
+
marginTop: 1,
|
|
56613
|
+
children: [
|
|
56614
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
56615
|
+
dimColor: true,
|
|
56616
|
+
children: "─".repeat(lineProgress)
|
|
56617
|
+
}, undefined, false, undefined, this),
|
|
56618
|
+
showHints && /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
56619
|
+
gap: 2,
|
|
56620
|
+
children: [
|
|
56621
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
56622
|
+
children: [
|
|
56623
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
56624
|
+
color: "gray",
|
|
56625
|
+
children: "↑↓"
|
|
56626
|
+
}, undefined, false, undefined, this),
|
|
56627
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
56628
|
+
dimColor: true,
|
|
56629
|
+
children: " navigate"
|
|
56630
|
+
}, undefined, false, undefined, this)
|
|
56631
|
+
]
|
|
56632
|
+
}, undefined, true, undefined, this),
|
|
56633
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
56634
|
+
children: [
|
|
56635
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
56636
|
+
color: "gray",
|
|
56637
|
+
children: "↵"
|
|
56638
|
+
}, undefined, false, undefined, this),
|
|
56639
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
56640
|
+
dimColor: true,
|
|
56641
|
+
children: " select"
|
|
56642
|
+
}, undefined, false, undefined, this)
|
|
56643
|
+
]
|
|
56644
|
+
}, undefined, true, undefined, this),
|
|
56645
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
56646
|
+
children: [
|
|
56647
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
56648
|
+
color: "gray",
|
|
56649
|
+
children: "esc"
|
|
56650
|
+
}, undefined, false, undefined, this),
|
|
56651
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
56652
|
+
dimColor: true,
|
|
56653
|
+
children: " back"
|
|
56654
|
+
}, undefined, false, undefined, this)
|
|
56655
|
+
]
|
|
56656
|
+
}, undefined, true, undefined, this),
|
|
56657
|
+
showHealthHint && /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
56658
|
+
children: [
|
|
56659
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
56660
|
+
color: "gray",
|
|
56661
|
+
children: "!"
|
|
56662
|
+
}, undefined, false, undefined, this),
|
|
56663
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
56664
|
+
dimColor: true,
|
|
56665
|
+
children: " health"
|
|
56666
|
+
}, undefined, false, undefined, this)
|
|
56667
|
+
]
|
|
56668
|
+
}, undefined, true, undefined, this),
|
|
56669
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
|
|
56670
|
+
children: [
|
|
56671
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
56672
|
+
color: "gray",
|
|
56673
|
+
children: "q"
|
|
56674
|
+
}, undefined, false, undefined, this),
|
|
56675
|
+
/* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
|
|
56676
|
+
dimColor: true,
|
|
56677
|
+
children: " quit"
|
|
56678
|
+
}, undefined, false, undefined, this)
|
|
56679
|
+
]
|
|
56680
|
+
}, undefined, true, undefined, this)
|
|
56681
|
+
]
|
|
56682
|
+
}, undefined, true, undefined, this)
|
|
56683
|
+
]
|
|
56684
|
+
}, undefined, true, undefined, this);
|
|
56685
|
+
};
|
|
56686
|
+
var init_Footer = __esm(async () => {
|
|
56687
|
+
init_useAnimations();
|
|
56688
|
+
await init_build2();
|
|
56689
|
+
jsx_dev_runtime5 = __toESM(require_jsx_dev_runtime(), 1);
|
|
56690
|
+
});
|
|
56691
|
+
|
|
56692
|
+
// src/ink/components/WarningBanner.tsx
|
|
56693
|
+
var jsx_dev_runtime6, WarningBanner = ({
|
|
56694
|
+
issueCount,
|
|
56695
|
+
errorCount,
|
|
56696
|
+
warningCount,
|
|
56697
|
+
hasVersionIssues = false
|
|
56698
|
+
}) => {
|
|
56699
|
+
const visible = useFadeIn(200);
|
|
56700
|
+
const icon = usePulse(["⚠", "⚠", " "], 1000);
|
|
56701
|
+
if (!visible || issueCount === 0)
|
|
56702
|
+
return null;
|
|
56703
|
+
const parts = [];
|
|
56704
|
+
if (errorCount > 0)
|
|
56705
|
+
parts.push(`${errorCount} error${errorCount > 1 ? "s" : ""}`);
|
|
56706
|
+
if (warningCount > 0)
|
|
56707
|
+
parts.push(`${warningCount} warning${warningCount > 1 ? "s" : ""}`);
|
|
56708
|
+
return /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Box_default, {
|
|
56709
|
+
flexDirection: "column",
|
|
56710
|
+
marginBottom: 1,
|
|
56711
|
+
children: [
|
|
56712
|
+
/* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Box_default, {
|
|
56713
|
+
children: [
|
|
56714
|
+
/* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
|
|
56715
|
+
color: "yellow",
|
|
56716
|
+
children: [
|
|
56717
|
+
icon,
|
|
56718
|
+
" "
|
|
56719
|
+
]
|
|
56720
|
+
}, undefined, true, undefined, this),
|
|
56721
|
+
/* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
|
|
56722
|
+
color: "yellow",
|
|
56723
|
+
bold: true,
|
|
56724
|
+
children: parts.join(", ")
|
|
56725
|
+
}, undefined, false, undefined, this),
|
|
56726
|
+
/* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
|
|
56727
|
+
color: "yellow",
|
|
56728
|
+
children: " — press "
|
|
56729
|
+
}, undefined, false, undefined, this),
|
|
56730
|
+
/* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
|
|
56731
|
+
color: "yellow",
|
|
56732
|
+
bold: true,
|
|
56733
|
+
children: "!"
|
|
56734
|
+
}, undefined, false, undefined, this),
|
|
56735
|
+
/* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
|
|
56736
|
+
color: "yellow",
|
|
56737
|
+
children: " to review"
|
|
56738
|
+
}, undefined, false, undefined, this)
|
|
56739
|
+
]
|
|
56740
|
+
}, undefined, true, undefined, this),
|
|
56741
|
+
hasVersionIssues && /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Box_default, {
|
|
56742
|
+
children: [
|
|
56743
|
+
/* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
|
|
56744
|
+
color: "red",
|
|
56745
|
+
children: " ⚠ Some instances use a Claude version incompatible with 3rd-party APIs. "
|
|
56746
|
+
}, undefined, false, undefined, this),
|
|
56747
|
+
/* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
|
|
56748
|
+
color: "red",
|
|
56749
|
+
bold: true,
|
|
56750
|
+
children: "Press ! to auto-fix."
|
|
56751
|
+
}, undefined, false, undefined, this)
|
|
56752
|
+
]
|
|
56753
|
+
}, undefined, true, undefined, this)
|
|
56754
|
+
]
|
|
56755
|
+
}, undefined, true, undefined, this);
|
|
56756
|
+
};
|
|
56757
|
+
var init_WarningBanner = __esm(async () => {
|
|
56758
|
+
init_useAnimations();
|
|
56759
|
+
await init_build2();
|
|
56760
|
+
jsx_dev_runtime6 = __toESM(require_jsx_dev_runtime(), 1);
|
|
56761
|
+
});
|
|
56762
|
+
|
|
54633
56763
|
// src/ink/hooks/useHealthCheck.ts
|
|
54634
56764
|
function useHealthCheck(instances2, migrationStatus) {
|
|
54635
56765
|
const [issues, setIssues] = import_react68.useState([]);
|
|
@@ -54762,7 +56892,7 @@ var init_InstanceCard = __esm(async () => {
|
|
|
54762
56892
|
var import_react69, jsx_dev_runtime8, ListInstances = ({ onBack }) => {
|
|
54763
56893
|
const [instances2, setInstances] = import_react69.useState([]);
|
|
54764
56894
|
const [loading, setLoading] = import_react69.useState(true);
|
|
54765
|
-
|
|
56895
|
+
useNavigation2(onBack);
|
|
54766
56896
|
import_react69.useEffect(() => {
|
|
54767
56897
|
listInstances().then((insts) => {
|
|
54768
56898
|
setInstances(insts);
|
|
@@ -54916,7 +57046,7 @@ var import_react70, jsx_dev_runtime10, DetailRow = ({
|
|
|
54916
57046
|
const [mcpCount, setMcpCount] = import_react70.useState(null);
|
|
54917
57047
|
const [mcpPluginCount, setMcpPluginCount] = import_react70.useState(null);
|
|
54918
57048
|
const [mcpCustomCount, setMcpCustomCount] = import_react70.useState(null);
|
|
54919
|
-
|
|
57049
|
+
useNavigation2(() => {
|
|
54920
57050
|
if (step === "info") {
|
|
54921
57051
|
setStep("select");
|
|
54922
57052
|
setSelected(null);
|
|
@@ -55160,7 +57290,7 @@ var import_react71, jsx_dev_runtime11, RemoveConfirm = ({ selected, onConfirm, o
|
|
|
55160
57290
|
const [selected, setSelected] = import_react71.useState(null);
|
|
55161
57291
|
const [error, setError] = import_react71.useState("");
|
|
55162
57292
|
const [removedConfig, setRemovedConfig] = import_react71.useState("");
|
|
55163
|
-
|
|
57293
|
+
useNavigation2(() => {
|
|
55164
57294
|
if (step === "confirm") {
|
|
55165
57295
|
setStep("select");
|
|
55166
57296
|
setSelected(null);
|
|
@@ -55367,7 +57497,7 @@ var import_react73, jsx_dev_runtime12, ToggleActionValue, ToggleAction = ({ sele
|
|
|
55367
57497
|
const [selected, setSelected] = import_react73.useState(null);
|
|
55368
57498
|
const { error, setError } = useMessage();
|
|
55369
57499
|
const [newStatus, setNewStatus] = import_react73.useState(false);
|
|
55370
|
-
|
|
57500
|
+
useNavigation2(() => {
|
|
55371
57501
|
if (step === "action") {
|
|
55372
57502
|
setStep("select");
|
|
55373
57503
|
setSelected(null);
|
|
@@ -55566,7 +57696,7 @@ var import_react74, jsx_dev_runtime13, PluginSuccess = ({ message }) => {
|
|
|
55566
57696
|
const plugins = action === PluginAction.Enable ? instancePlugins.filter((p) => !p.enabled) : action === PluginAction.Disable ? instancePlugins.filter((p) => p.enabled) : instancePlugins;
|
|
55567
57697
|
return plugins.map((p) => ({ label: formatPluginLabel(p, { showCategory: showCat }), value: p.id }));
|
|
55568
57698
|
}, [action, instancePlugins]);
|
|
55569
|
-
|
|
57699
|
+
useNavigation2(() => {
|
|
55570
57700
|
if (step === "select-instance" || step === "select-plugins" || step === "plugin-list" || step === "symlink-warning") {
|
|
55571
57701
|
setStep("action");
|
|
55572
57702
|
} else if (step === "done") {
|
|
@@ -55882,7 +58012,7 @@ var import_react75, jsx_dev_runtime14, SymlinkResults = ({ results }) => {
|
|
|
55882
58012
|
const [step, setStep] = import_react75.useState("select");
|
|
55883
58013
|
const [results, setResults] = import_react75.useState([]);
|
|
55884
58014
|
const { error, setError } = useMessage();
|
|
55885
|
-
|
|
58015
|
+
useNavigation2(() => {
|
|
55886
58016
|
if (step === "done")
|
|
55887
58017
|
onBack();
|
|
55888
58018
|
else
|
|
@@ -56126,7 +58256,7 @@ var import_react76, jsx_dev_runtime15, McpSourceDetails = ({ sources, action })
|
|
|
56126
58256
|
const { error, setError, success, setSuccess } = useMessage();
|
|
56127
58257
|
const [customName, setCustomName] = import_react76.useState("");
|
|
56128
58258
|
const [customConfig, setCustomConfig] = import_react76.useState("");
|
|
56129
|
-
|
|
58259
|
+
useNavigation2(() => {
|
|
56130
58260
|
if (step === "details" || step === "select" || step === "remove-select" || step === "add-name" || step === "add-config") {
|
|
56131
58261
|
setStep("action");
|
|
56132
58262
|
} else if (step === "select-target") {
|
|
@@ -56512,11 +58642,13 @@ var import_react77, jsx_dev_runtime17, HealthScreen = ({
|
|
|
56512
58642
|
onDismiss,
|
|
56513
58643
|
onDismissAll,
|
|
56514
58644
|
onRetry,
|
|
58645
|
+
onFix,
|
|
56515
58646
|
onBack
|
|
56516
58647
|
}) => {
|
|
56517
58648
|
const [step, setStep] = import_react77.useState("list");
|
|
56518
58649
|
const [selectedIssue, setSelectedIssue] = import_react77.useState(null);
|
|
56519
|
-
|
|
58650
|
+
const [fixMessage, setFixMessage] = import_react77.useState(null);
|
|
58651
|
+
useNavigation2(() => {
|
|
56520
58652
|
if (step === "detail") {
|
|
56521
58653
|
setStep("list");
|
|
56522
58654
|
setSelectedIssue(null);
|
|
@@ -56534,6 +58666,10 @@ var import_react77, jsx_dev_runtime17, HealthScreen = ({
|
|
|
56534
58666
|
onDismissAll();
|
|
56535
58667
|
} else if (input === "r") {
|
|
56536
58668
|
onRetry();
|
|
58669
|
+
} else if (input === "f") {
|
|
58670
|
+
onFix();
|
|
58671
|
+
setFixMessage("Wrappers updated to pinned Claude version!");
|
|
58672
|
+
setTimeout(() => setFixMessage(null), 3000);
|
|
56537
58673
|
} else if (input === " " && selectedIssue) {
|
|
56538
58674
|
setStep("detail");
|
|
56539
58675
|
}
|
|
@@ -56552,6 +58688,16 @@ var import_react77, jsx_dev_runtime17, HealthScreen = ({
|
|
|
56552
58688
|
message: "All systems healthy!",
|
|
56553
58689
|
type: "success"
|
|
56554
58690
|
}, undefined, false, undefined, this),
|
|
58691
|
+
fixMessage && /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Box_default, {
|
|
58692
|
+
marginTop: 1,
|
|
58693
|
+
children: /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Text, {
|
|
58694
|
+
color: "green",
|
|
58695
|
+
children: [
|
|
58696
|
+
"✓ ",
|
|
58697
|
+
fixMessage
|
|
58698
|
+
]
|
|
58699
|
+
}, undefined, true, undefined, this)
|
|
58700
|
+
}, undefined, false, undefined, this),
|
|
56555
58701
|
/* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Box_default, {
|
|
56556
58702
|
marginTop: 1,
|
|
56557
58703
|
children: /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Text, {
|
|
@@ -56563,6 +58709,7 @@ var import_react77, jsx_dev_runtime17, HealthScreen = ({
|
|
|
56563
58709
|
}, undefined, true, undefined, this);
|
|
56564
58710
|
}
|
|
56565
58711
|
const showActions = useFadeIn(100);
|
|
58712
|
+
const hasVersionIssues = issues.some((i) => i.category === "version");
|
|
56566
58713
|
return /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Box_default, {
|
|
56567
58714
|
flexDirection: "column",
|
|
56568
58715
|
width: "100",
|
|
@@ -56572,6 +58719,16 @@ var import_react77, jsx_dev_runtime17, HealthScreen = ({
|
|
|
56572
58719
|
/* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Header, {
|
|
56573
58720
|
title: "⚠ System Health"
|
|
56574
58721
|
}, undefined, false, undefined, this),
|
|
58722
|
+
fixMessage && /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Box_default, {
|
|
58723
|
+
marginBottom: 1,
|
|
58724
|
+
children: /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Text, {
|
|
58725
|
+
color: "green",
|
|
58726
|
+
children: [
|
|
58727
|
+
"✓ ",
|
|
58728
|
+
fixMessage
|
|
58729
|
+
]
|
|
58730
|
+
}, undefined, true, undefined, this)
|
|
58731
|
+
}, undefined, false, undefined, this),
|
|
56575
58732
|
step === "list" && /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Box_default, {
|
|
56576
58733
|
flexDirection: "column",
|
|
56577
58734
|
gap: 1,
|
|
@@ -56590,11 +58747,31 @@ var import_react77, jsx_dev_runtime17, HealthScreen = ({
|
|
|
56590
58747
|
showActions && /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Box_default, {
|
|
56591
58748
|
marginTop: 1,
|
|
56592
58749
|
flexDirection: "column",
|
|
56593
|
-
children:
|
|
56594
|
-
|
|
56595
|
-
|
|
56596
|
-
|
|
56597
|
-
|
|
58750
|
+
children: [
|
|
58751
|
+
hasVersionIssues && /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Box_default, {
|
|
58752
|
+
marginBottom: 1,
|
|
58753
|
+
children: [
|
|
58754
|
+
/* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Text, {
|
|
58755
|
+
color: "cyan",
|
|
58756
|
+
bold: true,
|
|
58757
|
+
children: "f"
|
|
58758
|
+
}, undefined, false, undefined, this),
|
|
58759
|
+
/* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Text, {
|
|
58760
|
+
color: "cyan",
|
|
58761
|
+
children: " fix wrappers "
|
|
58762
|
+
}, undefined, false, undefined, this),
|
|
58763
|
+
/* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Text, {
|
|
58764
|
+
dimColor: true,
|
|
58765
|
+
children: "│"
|
|
58766
|
+
}, undefined, false, undefined, this)
|
|
58767
|
+
]
|
|
58768
|
+
}, undefined, true, undefined, this),
|
|
58769
|
+
/* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Text, {
|
|
58770
|
+
dimColor: true,
|
|
58771
|
+
children: "Space view detail │ d dismiss │ D dismiss all │ r retry │ ESC back"
|
|
58772
|
+
}, undefined, false, undefined, this)
|
|
58773
|
+
]
|
|
58774
|
+
}, undefined, true, undefined, this)
|
|
56598
58775
|
]
|
|
56599
58776
|
}, undefined, true, undefined, this),
|
|
56600
58777
|
step === "detail" && selectedIssue && /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Box_default, {
|
|
@@ -56718,6 +58895,8 @@ var exports_App = {};
|
|
|
56718
58895
|
__export(exports_App, {
|
|
56719
58896
|
App: () => App2
|
|
56720
58897
|
});
|
|
58898
|
+
import { execSync as execSync3 } from "node:child_process";
|
|
58899
|
+
import { existsSync as existsSync7 } from "node:fs";
|
|
56721
58900
|
var import_react78, jsx_dev_runtime18, GoodbyeScreen = () => {
|
|
56722
58901
|
const msg = useTypewriter("\uD83D\uDC4B Goodbye!", 40);
|
|
56723
58902
|
return /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(Box_default, {
|
|
@@ -56728,6 +58907,44 @@ var import_react78, jsx_dev_runtime18, GoodbyeScreen = () => {
|
|
|
56728
58907
|
children: msg
|
|
56729
58908
|
}, undefined, false, undefined, this)
|
|
56730
58909
|
}, undefined, false, undefined, this);
|
|
58910
|
+
}, DoctorResultScreen = ({ fixedCount, onBack }) => {
|
|
58911
|
+
useNavigation(onBack);
|
|
58912
|
+
return /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(Box_default, {
|
|
58913
|
+
flexDirection: "column",
|
|
58914
|
+
width: "100",
|
|
58915
|
+
paddingX: 2,
|
|
58916
|
+
paddingY: 1,
|
|
58917
|
+
children: [
|
|
58918
|
+
/* @__PURE__ */ jsx_dev_runtime18.jsxDEV(Header, {
|
|
58919
|
+
title: "\uD83D\uDD27 Doctor Fix"
|
|
58920
|
+
}, undefined, false, undefined, this),
|
|
58921
|
+
fixedCount > 0 ? /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(jsx_dev_runtime18.Fragment, {
|
|
58922
|
+
children: [
|
|
58923
|
+
/* @__PURE__ */ jsx_dev_runtime18.jsxDEV(StatusBar, {
|
|
58924
|
+
message: `Fixed ${fixedCount} wrapper(s) to use pinned Claude v${COMPATIBLE_CLAUDE_VERSION}!`,
|
|
58925
|
+
type: "success"
|
|
58926
|
+
}, undefined, false, undefined, this),
|
|
58927
|
+
/* @__PURE__ */ jsx_dev_runtime18.jsxDEV(Box_default, {
|
|
58928
|
+
marginTop: 1,
|
|
58929
|
+
children: /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(Text, {
|
|
58930
|
+
dimColor: true,
|
|
58931
|
+
children: "All 3rd-party API instances now use the correct Claude binary."
|
|
58932
|
+
}, undefined, false, undefined, this)
|
|
58933
|
+
}, undefined, false, undefined, this)
|
|
58934
|
+
]
|
|
58935
|
+
}, undefined, true, undefined, this) : /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(StatusBar, {
|
|
58936
|
+
message: "All wrappers already use the correct Claude version",
|
|
58937
|
+
type: "info"
|
|
58938
|
+
}, undefined, false, undefined, this),
|
|
58939
|
+
/* @__PURE__ */ jsx_dev_runtime18.jsxDEV(Box_default, {
|
|
58940
|
+
marginTop: 1,
|
|
58941
|
+
children: /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(Text, {
|
|
58942
|
+
dimColor: true,
|
|
58943
|
+
children: "ESC to go back"
|
|
58944
|
+
}, undefined, false, undefined, this)
|
|
58945
|
+
}, undefined, false, undefined, this)
|
|
58946
|
+
]
|
|
58947
|
+
}, undefined, true, undefined, this);
|
|
56731
58948
|
}, InstanceLine = ({ instances: instances2 }) => {
|
|
56732
58949
|
const visible = useFadeIn(100);
|
|
56733
58950
|
if (!visible || instances2.length === 0)
|
|
@@ -56750,6 +58967,14 @@ var import_react78, jsx_dev_runtime18, GoodbyeScreen = () => {
|
|
|
56750
58967
|
const { issues, dismiss, dismissAll, retry } = useHealthCheck(instances2, migrationStatus);
|
|
56751
58968
|
const [screen, setScreen] = import_react78.useState("menu");
|
|
56752
58969
|
const [menuKey, setMenuKey] = import_react78.useState(0);
|
|
58970
|
+
const [ccVersion, setCcVersion] = import_react78.useState(null);
|
|
58971
|
+
const [doctorFixedCount, setDoctorFixedCount] = import_react78.useState(0);
|
|
58972
|
+
import_react78.useEffect(() => {
|
|
58973
|
+
try {
|
|
58974
|
+
const output = execSync3("claude --version 2>/dev/null", { encoding: "utf-8", timeout: 5000 }).trim();
|
|
58975
|
+
setCcVersion(output.split(" ")[0] || null);
|
|
58976
|
+
} catch {}
|
|
58977
|
+
}, []);
|
|
56753
58978
|
use_input_default((input, key) => {
|
|
56754
58979
|
if (screen !== "menu")
|
|
56755
58980
|
return;
|
|
@@ -56757,7 +58982,7 @@ var import_react78, jsx_dev_runtime18, GoodbyeScreen = () => {
|
|
|
56757
58982
|
setScreen("goodbye");
|
|
56758
58983
|
setTimeout(() => exit(), 300);
|
|
56759
58984
|
} else if (input === "!" && issues.length > 0) {
|
|
56760
|
-
|
|
58985
|
+
goToHealth();
|
|
56761
58986
|
}
|
|
56762
58987
|
});
|
|
56763
58988
|
if (loading) {
|
|
@@ -56782,6 +59007,29 @@ var import_react78, jsx_dev_runtime18, GoodbyeScreen = () => {
|
|
|
56782
59007
|
onDismiss: dismiss,
|
|
56783
59008
|
onDismissAll: dismissAll,
|
|
56784
59009
|
onRetry: retry,
|
|
59010
|
+
onFix: () => {
|
|
59011
|
+
if (!existsSync7(PINNED_CLAUDE_BIN)) {
|
|
59012
|
+
try {
|
|
59013
|
+
installPinnedClaude();
|
|
59014
|
+
} catch {}
|
|
59015
|
+
} else {
|
|
59016
|
+
const pinnedVer = getPinnedBinaryVersion();
|
|
59017
|
+
if (pinnedVer && isThirdPartyApiBroken(pinnedVer)) {
|
|
59018
|
+
try {
|
|
59019
|
+
installPinnedClaude();
|
|
59020
|
+
} catch {}
|
|
59021
|
+
}
|
|
59022
|
+
}
|
|
59023
|
+
const fixed = fixWrapperVersions(instances2);
|
|
59024
|
+
setDoctorFixedCount(fixed.length);
|
|
59025
|
+
retry();
|
|
59026
|
+
},
|
|
59027
|
+
onBack: goToMenu
|
|
59028
|
+
}, undefined, false, undefined, this);
|
|
59029
|
+
}
|
|
59030
|
+
if (screen === "doctor-result") {
|
|
59031
|
+
return /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(DoctorResultScreen, {
|
|
59032
|
+
fixedCount: doctorFixedCount,
|
|
56785
59033
|
onBack: goToMenu
|
|
56786
59034
|
}, undefined, false, undefined, this);
|
|
56787
59035
|
}
|
|
@@ -56797,6 +59045,11 @@ var import_react78, jsx_dev_runtime18, GoodbyeScreen = () => {
|
|
|
56797
59045
|
}
|
|
56798
59046
|
const errorCount = issues.filter((i) => i.severity === "error").length;
|
|
56799
59047
|
const warningCount = issues.filter((i) => i.severity === "warning").length;
|
|
59048
|
+
const versionIssues = issues.filter((i) => i.category === "version");
|
|
59049
|
+
const hasVersionIssues = versionIssues.length > 0;
|
|
59050
|
+
const goToHealth = () => {
|
|
59051
|
+
setScreen("health");
|
|
59052
|
+
};
|
|
56800
59053
|
const menuOptions = [
|
|
56801
59054
|
{ label: "➕ Add new instance", value: "add" },
|
|
56802
59055
|
{ label: "\uD83D\uDCCB List all instances", value: "list" },
|
|
@@ -56808,6 +59061,8 @@ var import_react78, jsx_dev_runtime18, GoodbyeScreen = () => {
|
|
|
56808
59061
|
{ label: "\uD83D\uDDD1️ Remove instance", value: "remove" },
|
|
56809
59062
|
{ label: "⚙️ MCP servers", value: "mcp" }
|
|
56810
59063
|
] : [],
|
|
59064
|
+
{ label: "\uD83E\uDE7A Doctor check", value: "doctor-check" },
|
|
59065
|
+
...hasVersionIssues ? [{ label: "\uD83D\uDD27 Fix wrappers (3rd-party API)", value: "doctor-fix" }] : [],
|
|
56811
59066
|
{ label: "\uD83D\uDEAA Exit", value: "exit" }
|
|
56812
59067
|
];
|
|
56813
59068
|
return /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(Box_default, {
|
|
@@ -56823,8 +59078,27 @@ var import_react78, jsx_dev_runtime18, GoodbyeScreen = () => {
|
|
|
56823
59078
|
/* @__PURE__ */ jsx_dev_runtime18.jsxDEV(WarningBanner, {
|
|
56824
59079
|
issueCount: issues.length,
|
|
56825
59080
|
errorCount,
|
|
56826
|
-
warningCount
|
|
59081
|
+
warningCount,
|
|
59082
|
+
hasVersionIssues
|
|
56827
59083
|
}, undefined, false, undefined, this),
|
|
59084
|
+
ccVersion && isThirdPartyApiBroken(ccVersion) && /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(Box_default, {
|
|
59085
|
+
marginBottom: 1,
|
|
59086
|
+
children: [
|
|
59087
|
+
/* @__PURE__ */ jsx_dev_runtime18.jsxDEV(Text, {
|
|
59088
|
+
color: "red",
|
|
59089
|
+
bold: true,
|
|
59090
|
+
children: [
|
|
59091
|
+
"⚠ Claude Code v",
|
|
59092
|
+
ccVersion,
|
|
59093
|
+
" does not work with 3rd party APIs. "
|
|
59094
|
+
]
|
|
59095
|
+
}, undefined, true, undefined, this),
|
|
59096
|
+
/* @__PURE__ */ jsx_dev_runtime18.jsxDEV(Text, {
|
|
59097
|
+
color: "red",
|
|
59098
|
+
children: "Run 'claude-multi doctor fix' to install a compatible version."
|
|
59099
|
+
}, undefined, false, undefined, this)
|
|
59100
|
+
]
|
|
59101
|
+
}, undefined, true, undefined, this),
|
|
56828
59102
|
/* @__PURE__ */ jsx_dev_runtime18.jsxDEV(InstanceLine, {
|
|
56829
59103
|
instances: instances2
|
|
56830
59104
|
}, undefined, false, undefined, this),
|
|
@@ -56835,6 +59109,27 @@ var import_react78, jsx_dev_runtime18, GoodbyeScreen = () => {
|
|
|
56835
59109
|
if (value === "exit") {
|
|
56836
59110
|
setScreen("goodbye");
|
|
56837
59111
|
setTimeout(() => exit(), 300);
|
|
59112
|
+
} else if (value === "doctor-check") {
|
|
59113
|
+
setScreen("health");
|
|
59114
|
+
} else if (value === "doctor-fix") {
|
|
59115
|
+
if (!existsSync7(PINNED_CLAUDE_BIN)) {
|
|
59116
|
+
try {
|
|
59117
|
+
installPinnedClaude();
|
|
59118
|
+
} catch {}
|
|
59119
|
+
} else {
|
|
59120
|
+
const pinnedVer = getPinnedBinaryVersion();
|
|
59121
|
+
if (pinnedVer && isThirdPartyApiBroken(pinnedVer)) {
|
|
59122
|
+
try {
|
|
59123
|
+
installPinnedClaude();
|
|
59124
|
+
} catch {}
|
|
59125
|
+
}
|
|
59126
|
+
}
|
|
59127
|
+
const fixed = fixWrapperVersions(instances2);
|
|
59128
|
+
setDoctorFixedCount(fixed.length);
|
|
59129
|
+
if (fixed.length > 0) {
|
|
59130
|
+
retry();
|
|
59131
|
+
}
|
|
59132
|
+
setScreen("doctor-result");
|
|
56838
59133
|
} else {
|
|
56839
59134
|
setScreen(value);
|
|
56840
59135
|
}
|
|
@@ -56847,14 +59142,18 @@ var import_react78, jsx_dev_runtime18, GoodbyeScreen = () => {
|
|
|
56847
59142
|
}, undefined, true, undefined, this);
|
|
56848
59143
|
}, SCREEN_MAP;
|
|
56849
59144
|
var init_App2 = __esm(async () => {
|
|
59145
|
+
init_version();
|
|
59146
|
+
init_paths();
|
|
56850
59147
|
init_useConfig();
|
|
56851
59148
|
init_useHealthCheck();
|
|
56852
59149
|
init_useAnimations();
|
|
59150
|
+
init_health();
|
|
56853
59151
|
await __promiseAll([
|
|
56854
59152
|
init_build2(),
|
|
56855
59153
|
init_build3(),
|
|
56856
59154
|
init_Header(),
|
|
56857
59155
|
init_Footer(),
|
|
59156
|
+
init_StatusBar(),
|
|
56858
59157
|
init_WarningBanner(),
|
|
56859
59158
|
init_AddInstance(),
|
|
56860
59159
|
init_ListInstances(),
|
|
@@ -56900,112 +59199,13 @@ var {
|
|
|
56900
59199
|
init_source();
|
|
56901
59200
|
init_config();
|
|
56902
59201
|
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
|
|
59202
|
+
init_version();
|
|
57006
59203
|
init_templates();
|
|
57007
59204
|
init_errors();
|
|
57008
59205
|
init_constants();
|
|
59206
|
+
var import_prompts = __toESM(require_prompts3(), 1);
|
|
59207
|
+
import { homedir as homedir4 } from "node:os";
|
|
59208
|
+
import { join as join8 } from "node:path";
|
|
57009
59209
|
function exitWithCode(code) {
|
|
57010
59210
|
process.exit(code);
|
|
57011
59211
|
}
|
|
@@ -57025,10 +59225,10 @@ function requireNonEmptyArgs(items, errorMsg, usage) {
|
|
|
57025
59225
|
}
|
|
57026
59226
|
}
|
|
57027
59227
|
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) =>
|
|
59228
|
+
program2.name("claude-multi").description("Manage multiple Claude Code instances with different aliases").version(getClaudeMultiVersion());
|
|
59229
|
+
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
59230
|
try {
|
|
57031
|
-
const configDir = options.config ||
|
|
59231
|
+
const configDir = options.config || join8(homedir4(), `.claude-${name}`);
|
|
57032
59232
|
const binaryPath = options.binary || getDefaultBinaryPath(name);
|
|
57033
59233
|
const hasDefaultConfig = hasDefaultClaudeConfig();
|
|
57034
59234
|
const hasDefaultMcp = await hasDefaultMcpConfig();
|
|
@@ -57305,6 +59505,70 @@ program2.command("auto-sync <name> <status>").description("Toggle auto-sync for
|
|
|
57305
59505
|
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
59506
|
await handleFixSymlinks(names, options.all);
|
|
57307
59507
|
});
|
|
59508
|
+
program2.command("doctor").description("Diagnose and fix common issues").argument("[action]", "Action to perform (fix, check)", "check").action(async (action = "check") => {
|
|
59509
|
+
try {
|
|
59510
|
+
const instances2 = await listInstances();
|
|
59511
|
+
const { runHealthChecks: runHealthChecks2, fixWrapperVersions: fixWrapperVersions2 } = await Promise.resolve().then(() => (init_health(), exports_health));
|
|
59512
|
+
const { existsSync: existsSync8 } = await import("node:fs");
|
|
59513
|
+
const { PINNED_CLAUDE_BIN: PINNED_CLAUDE_BIN3 } = await Promise.resolve().then(() => (init_paths(), exports_paths));
|
|
59514
|
+
const { installPinnedClaude: installPinnedClaude2, getPinnedBinaryVersion: getPinnedBinaryVersion2, isThirdPartyApiBroken: isThirdPartyApiBroken2, COMPATIBLE_CLAUDE_VERSION: COMPATIBLE_CLAUDE_VERSION2 } = await Promise.resolve().then(() => (init_version(), exports_version));
|
|
59515
|
+
if (action === "fix") {
|
|
59516
|
+
console.log(source_default.bold(`
|
|
59517
|
+
\uD83D\uDD27 Doctor Fix
|
|
59518
|
+
`));
|
|
59519
|
+
if (!existsSync8(PINNED_CLAUDE_BIN3)) {
|
|
59520
|
+
console.log(source_default.cyan(`Installing compatible Claude v${COMPATIBLE_CLAUDE_VERSION2}...`));
|
|
59521
|
+
installPinnedClaude2();
|
|
59522
|
+
console.log(source_default.green(`✓ Installed pinned Claude v${COMPATIBLE_CLAUDE_VERSION2}`));
|
|
59523
|
+
} else {
|
|
59524
|
+
const pinnedVer = getPinnedBinaryVersion2();
|
|
59525
|
+
const needsReinstall = !pinnedVer || isThirdPartyApiBroken2(pinnedVer) || pinnedVer !== COMPATIBLE_CLAUDE_VERSION2;
|
|
59526
|
+
if (needsReinstall) {
|
|
59527
|
+
const reason = !pinnedVer ? "version unknown" : isThirdPartyApiBroken2(pinnedVer) ? "incompatible" : "outdated";
|
|
59528
|
+
console.log(source_default.yellow(`Pinned binary is ${pinnedVer ? `v${pinnedVer}` : reason}. Reinstalling v${COMPATIBLE_CLAUDE_VERSION2}...`));
|
|
59529
|
+
installPinnedClaude2();
|
|
59530
|
+
console.log(source_default.green(`✓ Reinstalled pinned Claude v${COMPATIBLE_CLAUDE_VERSION2}`));
|
|
59531
|
+
}
|
|
59532
|
+
}
|
|
59533
|
+
const fixed = fixWrapperVersions2(instances2);
|
|
59534
|
+
if (fixed.length > 0) {
|
|
59535
|
+
console.log(source_default.green(`✓ Fixed ${fixed.length} wrapper(s) to use pinned Claude version:`));
|
|
59536
|
+
for (const name of fixed) {
|
|
59537
|
+
console.log(source_default.gray(` • ${name}`));
|
|
59538
|
+
}
|
|
59539
|
+
} else {
|
|
59540
|
+
console.log(source_default.gray(" All wrappers already use the correct Claude version"));
|
|
59541
|
+
}
|
|
59542
|
+
console.log(source_default.green(`
|
|
59543
|
+
✓ Doctor fix complete!`));
|
|
59544
|
+
} else {
|
|
59545
|
+
console.log(source_default.bold(`
|
|
59546
|
+
\uD83D\uDD0D Doctor Check
|
|
59547
|
+
`));
|
|
59548
|
+
const issues = runHealthChecks2(instances2);
|
|
59549
|
+
if (issues.length === 0) {
|
|
59550
|
+
console.log(source_default.green("✓ No issues found!"));
|
|
59551
|
+
} else {
|
|
59552
|
+
console.log(source_default.yellow(`Found ${issues.length} issue(s):
|
|
59553
|
+
`));
|
|
59554
|
+
for (const issue of issues) {
|
|
59555
|
+
const icon = issue.severity === "error" ? "✗" : "⚠";
|
|
59556
|
+
const color = issue.severity === "error" ? source_default.red : source_default.yellow;
|
|
59557
|
+
console.log(color(` ${icon} ${issue.title}`));
|
|
59558
|
+
console.log(source_default.gray(` ${issue.message}`));
|
|
59559
|
+
if (issue.resolutionHint) {
|
|
59560
|
+
console.log(source_default.gray(` Fix: ${issue.resolutionHint}`));
|
|
59561
|
+
}
|
|
59562
|
+
console.log();
|
|
59563
|
+
}
|
|
59564
|
+
console.log(source_default.gray("Run 'claude-multi doctor fix' to auto-fix"));
|
|
59565
|
+
}
|
|
59566
|
+
}
|
|
59567
|
+
} catch (error) {
|
|
59568
|
+
console.error(source_default.red(`✗ Error: ${toMessage(error)}`));
|
|
59569
|
+
exitWithCode(1);
|
|
59570
|
+
}
|
|
59571
|
+
});
|
|
57308
59572
|
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
59573
|
try {
|
|
57310
59574
|
switch (action) {
|
|
@@ -57799,6 +60063,12 @@ async function handleMcpVerify(instanceName) {
|
|
|
57799
60063
|
}
|
|
57800
60064
|
program2.action(async () => {
|
|
57801
60065
|
skipGlobalUpdateCheck = true;
|
|
60066
|
+
const unknownArgs = program2.args.filter((a) => !a.startsWith("-"));
|
|
60067
|
+
if (unknownArgs.length > 0) {
|
|
60068
|
+
console.error(source_default.red(`✗ Unknown command: ${unknownArgs[0]}`));
|
|
60069
|
+
console.log(source_default.gray("Run 'claude-multi --help' for available commands."));
|
|
60070
|
+
exitWithCode(1);
|
|
60071
|
+
}
|
|
57802
60072
|
try {
|
|
57803
60073
|
const { render: render2 } = await init_build2().then(() => exports_build);
|
|
57804
60074
|
const React39 = await Promise.resolve().then(() => __toESM(require_react(), 1));
|