claudekit-cli 3.16.0 → 3.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2644 -325
- package/package.json +3 -1
package/dist/index.js
CHANGED
|
@@ -6740,11 +6740,15 @@ var init_metadata = __esm(() => {
|
|
|
6740
6740
|
checksum: exports_external.string().regex(/^[a-f0-9]{64}$/, "Invalid SHA-256 checksum"),
|
|
6741
6741
|
ownership: exports_external.enum(["ck", "user", "ck-modified"]),
|
|
6742
6742
|
installedVersion: exports_external.string(),
|
|
6743
|
-
baseChecksum: exports_external.string().regex(/^[a-f0-9]{64}$/, "Invalid SHA-256 checksum").optional()
|
|
6743
|
+
baseChecksum: exports_external.string().regex(/^[a-f0-9]{64}$/, "Invalid SHA-256 checksum").optional(),
|
|
6744
|
+
sourceTimestamp: exports_external.string().datetime({ offset: true }).optional(),
|
|
6745
|
+
installedAt: exports_external.string().datetime({ offset: true }).optional()
|
|
6744
6746
|
});
|
|
6745
6747
|
InstalledSettingsSchema = exports_external.object({
|
|
6746
6748
|
hooks: exports_external.array(exports_external.string()).optional(),
|
|
6747
|
-
mcpServers: exports_external.array(exports_external.string()).optional()
|
|
6749
|
+
mcpServers: exports_external.array(exports_external.string()).optional(),
|
|
6750
|
+
hookTimestamps: exports_external.record(exports_external.string()).optional(),
|
|
6751
|
+
mcpServerTimestamps: exports_external.record(exports_external.string()).optional()
|
|
6748
6752
|
});
|
|
6749
6753
|
KitMetadataSchema = exports_external.object({
|
|
6750
6754
|
version: exports_external.string(),
|
|
@@ -13341,6 +13345,1789 @@ var require_extract_zip = __commonJS((exports, module) => {
|
|
|
13341
13345
|
};
|
|
13342
13346
|
});
|
|
13343
13347
|
|
|
13348
|
+
// node_modules/semver/internal/constants.js
|
|
13349
|
+
var require_constants = __commonJS((exports, module) => {
|
|
13350
|
+
var SEMVER_SPEC_VERSION = "2.0.0";
|
|
13351
|
+
var MAX_LENGTH = 256;
|
|
13352
|
+
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
|
|
13353
|
+
var MAX_SAFE_COMPONENT_LENGTH = 16;
|
|
13354
|
+
var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
|
|
13355
|
+
var RELEASE_TYPES = [
|
|
13356
|
+
"major",
|
|
13357
|
+
"premajor",
|
|
13358
|
+
"minor",
|
|
13359
|
+
"preminor",
|
|
13360
|
+
"patch",
|
|
13361
|
+
"prepatch",
|
|
13362
|
+
"prerelease"
|
|
13363
|
+
];
|
|
13364
|
+
module.exports = {
|
|
13365
|
+
MAX_LENGTH,
|
|
13366
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
|
13367
|
+
MAX_SAFE_BUILD_LENGTH,
|
|
13368
|
+
MAX_SAFE_INTEGER,
|
|
13369
|
+
RELEASE_TYPES,
|
|
13370
|
+
SEMVER_SPEC_VERSION,
|
|
13371
|
+
FLAG_INCLUDE_PRERELEASE: 1,
|
|
13372
|
+
FLAG_LOOSE: 2
|
|
13373
|
+
};
|
|
13374
|
+
});
|
|
13375
|
+
|
|
13376
|
+
// node_modules/semver/internal/debug.js
|
|
13377
|
+
var require_debug = __commonJS((exports, module) => {
|
|
13378
|
+
var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
|
|
13379
|
+
module.exports = debug;
|
|
13380
|
+
});
|
|
13381
|
+
|
|
13382
|
+
// node_modules/semver/internal/re.js
|
|
13383
|
+
var require_re = __commonJS((exports, module) => {
|
|
13384
|
+
var {
|
|
13385
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
|
13386
|
+
MAX_SAFE_BUILD_LENGTH,
|
|
13387
|
+
MAX_LENGTH
|
|
13388
|
+
} = require_constants();
|
|
13389
|
+
var debug = require_debug();
|
|
13390
|
+
exports = module.exports = {};
|
|
13391
|
+
var re2 = exports.re = [];
|
|
13392
|
+
var safeRe = exports.safeRe = [];
|
|
13393
|
+
var src = exports.src = [];
|
|
13394
|
+
var safeSrc = exports.safeSrc = [];
|
|
13395
|
+
var t = exports.t = {};
|
|
13396
|
+
var R3 = 0;
|
|
13397
|
+
var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
|
|
13398
|
+
var safeRegexReplacements = [
|
|
13399
|
+
["\\s", 1],
|
|
13400
|
+
["\\d", MAX_LENGTH],
|
|
13401
|
+
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
|
|
13402
|
+
];
|
|
13403
|
+
var makeSafeRegex = (value) => {
|
|
13404
|
+
for (const [token, max] of safeRegexReplacements) {
|
|
13405
|
+
value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
|
|
13406
|
+
}
|
|
13407
|
+
return value;
|
|
13408
|
+
};
|
|
13409
|
+
var createToken = (name2, value, isGlobal) => {
|
|
13410
|
+
const safe = makeSafeRegex(value);
|
|
13411
|
+
const index = R3++;
|
|
13412
|
+
debug(name2, index, value);
|
|
13413
|
+
t[name2] = index;
|
|
13414
|
+
src[index] = value;
|
|
13415
|
+
safeSrc[index] = safe;
|
|
13416
|
+
re2[index] = new RegExp(value, isGlobal ? "g" : undefined);
|
|
13417
|
+
safeRe[index] = new RegExp(safe, isGlobal ? "g" : undefined);
|
|
13418
|
+
};
|
|
13419
|
+
createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
|
|
13420
|
+
createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
|
|
13421
|
+
createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
|
|
13422
|
+
createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.` + `(${src[t.NUMERICIDENTIFIER]})\\.` + `(${src[t.NUMERICIDENTIFIER]})`);
|
|
13423
|
+
createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + `(${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
13424
|
+
createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
|
|
13425
|
+
createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
13426
|
+
createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
|
|
13427
|
+
createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
|
|
13428
|
+
createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
|
|
13429
|
+
createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
|
|
13430
|
+
createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
|
|
13431
|
+
createToken("FULL", `^${src[t.FULLPLAIN]}$`);
|
|
13432
|
+
createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
|
|
13433
|
+
createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
|
|
13434
|
+
createToken("GTLT", "((?:<|>)?=?)");
|
|
13435
|
+
createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
|
|
13436
|
+
createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
|
|
13437
|
+
createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + `(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?` + `)?)?`);
|
|
13438
|
+
createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?` + `)?)?`);
|
|
13439
|
+
createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
|
|
13440
|
+
createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
|
|
13441
|
+
createToken("COERCEPLAIN", `${"(^|[^\\d])" + "(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})` + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
|
|
13442
|
+
createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
|
|
13443
|
+
createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?` + `(?:${src[t.BUILD]})?` + `(?:$|[^\\d])`);
|
|
13444
|
+
createToken("COERCERTL", src[t.COERCE], true);
|
|
13445
|
+
createToken("COERCERTLFULL", src[t.COERCEFULL], true);
|
|
13446
|
+
createToken("LONETILDE", "(?:~>?)");
|
|
13447
|
+
createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
|
|
13448
|
+
exports.tildeTrimReplace = "$1~";
|
|
13449
|
+
createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
|
|
13450
|
+
createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
13451
|
+
createToken("LONECARET", "(?:\\^)");
|
|
13452
|
+
createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
|
|
13453
|
+
exports.caretTrimReplace = "$1^";
|
|
13454
|
+
createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
|
|
13455
|
+
createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
13456
|
+
createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
|
|
13457
|
+
createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
|
|
13458
|
+
createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
|
|
13459
|
+
exports.comparatorTrimReplace = "$1$2$3";
|
|
13460
|
+
createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})` + `\\s+-\\s+` + `(${src[t.XRANGEPLAIN]})` + `\\s*$`);
|
|
13461
|
+
createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})` + `\\s+-\\s+` + `(${src[t.XRANGEPLAINLOOSE]})` + `\\s*$`);
|
|
13462
|
+
createToken("STAR", "(<|>)?=?\\s*\\*");
|
|
13463
|
+
createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
|
|
13464
|
+
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
13465
|
+
});
|
|
13466
|
+
|
|
13467
|
+
// node_modules/semver/internal/parse-options.js
|
|
13468
|
+
var require_parse_options = __commonJS((exports, module) => {
|
|
13469
|
+
var looseOption = Object.freeze({ loose: true });
|
|
13470
|
+
var emptyOpts = Object.freeze({});
|
|
13471
|
+
var parseOptions = (options) => {
|
|
13472
|
+
if (!options) {
|
|
13473
|
+
return emptyOpts;
|
|
13474
|
+
}
|
|
13475
|
+
if (typeof options !== "object") {
|
|
13476
|
+
return looseOption;
|
|
13477
|
+
}
|
|
13478
|
+
return options;
|
|
13479
|
+
};
|
|
13480
|
+
module.exports = parseOptions;
|
|
13481
|
+
});
|
|
13482
|
+
|
|
13483
|
+
// node_modules/semver/internal/identifiers.js
|
|
13484
|
+
var require_identifiers = __commonJS((exports, module) => {
|
|
13485
|
+
var numeric = /^[0-9]+$/;
|
|
13486
|
+
var compareIdentifiers = (a3, b3) => {
|
|
13487
|
+
if (typeof a3 === "number" && typeof b3 === "number") {
|
|
13488
|
+
return a3 === b3 ? 0 : a3 < b3 ? -1 : 1;
|
|
13489
|
+
}
|
|
13490
|
+
const anum = numeric.test(a3);
|
|
13491
|
+
const bnum = numeric.test(b3);
|
|
13492
|
+
if (anum && bnum) {
|
|
13493
|
+
a3 = +a3;
|
|
13494
|
+
b3 = +b3;
|
|
13495
|
+
}
|
|
13496
|
+
return a3 === b3 ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a3 < b3 ? -1 : 1;
|
|
13497
|
+
};
|
|
13498
|
+
var rcompareIdentifiers = (a3, b3) => compareIdentifiers(b3, a3);
|
|
13499
|
+
module.exports = {
|
|
13500
|
+
compareIdentifiers,
|
|
13501
|
+
rcompareIdentifiers
|
|
13502
|
+
};
|
|
13503
|
+
});
|
|
13504
|
+
|
|
13505
|
+
// node_modules/semver/classes/semver.js
|
|
13506
|
+
var require_semver = __commonJS((exports, module) => {
|
|
13507
|
+
var debug = require_debug();
|
|
13508
|
+
var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
|
|
13509
|
+
var { safeRe: re2, t } = require_re();
|
|
13510
|
+
var parseOptions = require_parse_options();
|
|
13511
|
+
var { compareIdentifiers } = require_identifiers();
|
|
13512
|
+
|
|
13513
|
+
class SemVer {
|
|
13514
|
+
constructor(version, options) {
|
|
13515
|
+
options = parseOptions(options);
|
|
13516
|
+
if (version instanceof SemVer) {
|
|
13517
|
+
if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
|
|
13518
|
+
return version;
|
|
13519
|
+
} else {
|
|
13520
|
+
version = version.version;
|
|
13521
|
+
}
|
|
13522
|
+
} else if (typeof version !== "string") {
|
|
13523
|
+
throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
|
|
13524
|
+
}
|
|
13525
|
+
if (version.length > MAX_LENGTH) {
|
|
13526
|
+
throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
|
|
13527
|
+
}
|
|
13528
|
+
debug("SemVer", version, options);
|
|
13529
|
+
this.options = options;
|
|
13530
|
+
this.loose = !!options.loose;
|
|
13531
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
13532
|
+
const m2 = version.trim().match(options.loose ? re2[t.LOOSE] : re2[t.FULL]);
|
|
13533
|
+
if (!m2) {
|
|
13534
|
+
throw new TypeError(`Invalid Version: ${version}`);
|
|
13535
|
+
}
|
|
13536
|
+
this.raw = version;
|
|
13537
|
+
this.major = +m2[1];
|
|
13538
|
+
this.minor = +m2[2];
|
|
13539
|
+
this.patch = +m2[3];
|
|
13540
|
+
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
|
13541
|
+
throw new TypeError("Invalid major version");
|
|
13542
|
+
}
|
|
13543
|
+
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
|
13544
|
+
throw new TypeError("Invalid minor version");
|
|
13545
|
+
}
|
|
13546
|
+
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
|
13547
|
+
throw new TypeError("Invalid patch version");
|
|
13548
|
+
}
|
|
13549
|
+
if (!m2[4]) {
|
|
13550
|
+
this.prerelease = [];
|
|
13551
|
+
} else {
|
|
13552
|
+
this.prerelease = m2[4].split(".").map((id) => {
|
|
13553
|
+
if (/^[0-9]+$/.test(id)) {
|
|
13554
|
+
const num = +id;
|
|
13555
|
+
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
|
13556
|
+
return num;
|
|
13557
|
+
}
|
|
13558
|
+
}
|
|
13559
|
+
return id;
|
|
13560
|
+
});
|
|
13561
|
+
}
|
|
13562
|
+
this.build = m2[5] ? m2[5].split(".") : [];
|
|
13563
|
+
this.format();
|
|
13564
|
+
}
|
|
13565
|
+
format() {
|
|
13566
|
+
this.version = `${this.major}.${this.minor}.${this.patch}`;
|
|
13567
|
+
if (this.prerelease.length) {
|
|
13568
|
+
this.version += `-${this.prerelease.join(".")}`;
|
|
13569
|
+
}
|
|
13570
|
+
return this.version;
|
|
13571
|
+
}
|
|
13572
|
+
toString() {
|
|
13573
|
+
return this.version;
|
|
13574
|
+
}
|
|
13575
|
+
compare(other) {
|
|
13576
|
+
debug("SemVer.compare", this.version, this.options, other);
|
|
13577
|
+
if (!(other instanceof SemVer)) {
|
|
13578
|
+
if (typeof other === "string" && other === this.version) {
|
|
13579
|
+
return 0;
|
|
13580
|
+
}
|
|
13581
|
+
other = new SemVer(other, this.options);
|
|
13582
|
+
}
|
|
13583
|
+
if (other.version === this.version) {
|
|
13584
|
+
return 0;
|
|
13585
|
+
}
|
|
13586
|
+
return this.compareMain(other) || this.comparePre(other);
|
|
13587
|
+
}
|
|
13588
|
+
compareMain(other) {
|
|
13589
|
+
if (!(other instanceof SemVer)) {
|
|
13590
|
+
other = new SemVer(other, this.options);
|
|
13591
|
+
}
|
|
13592
|
+
if (this.major < other.major) {
|
|
13593
|
+
return -1;
|
|
13594
|
+
}
|
|
13595
|
+
if (this.major > other.major) {
|
|
13596
|
+
return 1;
|
|
13597
|
+
}
|
|
13598
|
+
if (this.minor < other.minor) {
|
|
13599
|
+
return -1;
|
|
13600
|
+
}
|
|
13601
|
+
if (this.minor > other.minor) {
|
|
13602
|
+
return 1;
|
|
13603
|
+
}
|
|
13604
|
+
if (this.patch < other.patch) {
|
|
13605
|
+
return -1;
|
|
13606
|
+
}
|
|
13607
|
+
if (this.patch > other.patch) {
|
|
13608
|
+
return 1;
|
|
13609
|
+
}
|
|
13610
|
+
return 0;
|
|
13611
|
+
}
|
|
13612
|
+
comparePre(other) {
|
|
13613
|
+
if (!(other instanceof SemVer)) {
|
|
13614
|
+
other = new SemVer(other, this.options);
|
|
13615
|
+
}
|
|
13616
|
+
if (this.prerelease.length && !other.prerelease.length) {
|
|
13617
|
+
return -1;
|
|
13618
|
+
} else if (!this.prerelease.length && other.prerelease.length) {
|
|
13619
|
+
return 1;
|
|
13620
|
+
} else if (!this.prerelease.length && !other.prerelease.length) {
|
|
13621
|
+
return 0;
|
|
13622
|
+
}
|
|
13623
|
+
let i = 0;
|
|
13624
|
+
do {
|
|
13625
|
+
const a3 = this.prerelease[i];
|
|
13626
|
+
const b3 = other.prerelease[i];
|
|
13627
|
+
debug("prerelease compare", i, a3, b3);
|
|
13628
|
+
if (a3 === undefined && b3 === undefined) {
|
|
13629
|
+
return 0;
|
|
13630
|
+
} else if (b3 === undefined) {
|
|
13631
|
+
return 1;
|
|
13632
|
+
} else if (a3 === undefined) {
|
|
13633
|
+
return -1;
|
|
13634
|
+
} else if (a3 === b3) {
|
|
13635
|
+
continue;
|
|
13636
|
+
} else {
|
|
13637
|
+
return compareIdentifiers(a3, b3);
|
|
13638
|
+
}
|
|
13639
|
+
} while (++i);
|
|
13640
|
+
}
|
|
13641
|
+
compareBuild(other) {
|
|
13642
|
+
if (!(other instanceof SemVer)) {
|
|
13643
|
+
other = new SemVer(other, this.options);
|
|
13644
|
+
}
|
|
13645
|
+
let i = 0;
|
|
13646
|
+
do {
|
|
13647
|
+
const a3 = this.build[i];
|
|
13648
|
+
const b3 = other.build[i];
|
|
13649
|
+
debug("build compare", i, a3, b3);
|
|
13650
|
+
if (a3 === undefined && b3 === undefined) {
|
|
13651
|
+
return 0;
|
|
13652
|
+
} else if (b3 === undefined) {
|
|
13653
|
+
return 1;
|
|
13654
|
+
} else if (a3 === undefined) {
|
|
13655
|
+
return -1;
|
|
13656
|
+
} else if (a3 === b3) {
|
|
13657
|
+
continue;
|
|
13658
|
+
} else {
|
|
13659
|
+
return compareIdentifiers(a3, b3);
|
|
13660
|
+
}
|
|
13661
|
+
} while (++i);
|
|
13662
|
+
}
|
|
13663
|
+
inc(release, identifier, identifierBase) {
|
|
13664
|
+
if (release.startsWith("pre")) {
|
|
13665
|
+
if (!identifier && identifierBase === false) {
|
|
13666
|
+
throw new Error("invalid increment argument: identifier is empty");
|
|
13667
|
+
}
|
|
13668
|
+
if (identifier) {
|
|
13669
|
+
const match = `-${identifier}`.match(this.options.loose ? re2[t.PRERELEASELOOSE] : re2[t.PRERELEASE]);
|
|
13670
|
+
if (!match || match[1] !== identifier) {
|
|
13671
|
+
throw new Error(`invalid identifier: ${identifier}`);
|
|
13672
|
+
}
|
|
13673
|
+
}
|
|
13674
|
+
}
|
|
13675
|
+
switch (release) {
|
|
13676
|
+
case "premajor":
|
|
13677
|
+
this.prerelease.length = 0;
|
|
13678
|
+
this.patch = 0;
|
|
13679
|
+
this.minor = 0;
|
|
13680
|
+
this.major++;
|
|
13681
|
+
this.inc("pre", identifier, identifierBase);
|
|
13682
|
+
break;
|
|
13683
|
+
case "preminor":
|
|
13684
|
+
this.prerelease.length = 0;
|
|
13685
|
+
this.patch = 0;
|
|
13686
|
+
this.minor++;
|
|
13687
|
+
this.inc("pre", identifier, identifierBase);
|
|
13688
|
+
break;
|
|
13689
|
+
case "prepatch":
|
|
13690
|
+
this.prerelease.length = 0;
|
|
13691
|
+
this.inc("patch", identifier, identifierBase);
|
|
13692
|
+
this.inc("pre", identifier, identifierBase);
|
|
13693
|
+
break;
|
|
13694
|
+
case "prerelease":
|
|
13695
|
+
if (this.prerelease.length === 0) {
|
|
13696
|
+
this.inc("patch", identifier, identifierBase);
|
|
13697
|
+
}
|
|
13698
|
+
this.inc("pre", identifier, identifierBase);
|
|
13699
|
+
break;
|
|
13700
|
+
case "release":
|
|
13701
|
+
if (this.prerelease.length === 0) {
|
|
13702
|
+
throw new Error(`version ${this.raw} is not a prerelease`);
|
|
13703
|
+
}
|
|
13704
|
+
this.prerelease.length = 0;
|
|
13705
|
+
break;
|
|
13706
|
+
case "major":
|
|
13707
|
+
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
|
|
13708
|
+
this.major++;
|
|
13709
|
+
}
|
|
13710
|
+
this.minor = 0;
|
|
13711
|
+
this.patch = 0;
|
|
13712
|
+
this.prerelease = [];
|
|
13713
|
+
break;
|
|
13714
|
+
case "minor":
|
|
13715
|
+
if (this.patch !== 0 || this.prerelease.length === 0) {
|
|
13716
|
+
this.minor++;
|
|
13717
|
+
}
|
|
13718
|
+
this.patch = 0;
|
|
13719
|
+
this.prerelease = [];
|
|
13720
|
+
break;
|
|
13721
|
+
case "patch":
|
|
13722
|
+
if (this.prerelease.length === 0) {
|
|
13723
|
+
this.patch++;
|
|
13724
|
+
}
|
|
13725
|
+
this.prerelease = [];
|
|
13726
|
+
break;
|
|
13727
|
+
case "pre": {
|
|
13728
|
+
const base = Number(identifierBase) ? 1 : 0;
|
|
13729
|
+
if (this.prerelease.length === 0) {
|
|
13730
|
+
this.prerelease = [base];
|
|
13731
|
+
} else {
|
|
13732
|
+
let i = this.prerelease.length;
|
|
13733
|
+
while (--i >= 0) {
|
|
13734
|
+
if (typeof this.prerelease[i] === "number") {
|
|
13735
|
+
this.prerelease[i]++;
|
|
13736
|
+
i = -2;
|
|
13737
|
+
}
|
|
13738
|
+
}
|
|
13739
|
+
if (i === -1) {
|
|
13740
|
+
if (identifier === this.prerelease.join(".") && identifierBase === false) {
|
|
13741
|
+
throw new Error("invalid increment argument: identifier already exists");
|
|
13742
|
+
}
|
|
13743
|
+
this.prerelease.push(base);
|
|
13744
|
+
}
|
|
13745
|
+
}
|
|
13746
|
+
if (identifier) {
|
|
13747
|
+
let prerelease = [identifier, base];
|
|
13748
|
+
if (identifierBase === false) {
|
|
13749
|
+
prerelease = [identifier];
|
|
13750
|
+
}
|
|
13751
|
+
if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
|
|
13752
|
+
if (isNaN(this.prerelease[1])) {
|
|
13753
|
+
this.prerelease = prerelease;
|
|
13754
|
+
}
|
|
13755
|
+
} else {
|
|
13756
|
+
this.prerelease = prerelease;
|
|
13757
|
+
}
|
|
13758
|
+
}
|
|
13759
|
+
break;
|
|
13760
|
+
}
|
|
13761
|
+
default:
|
|
13762
|
+
throw new Error(`invalid increment argument: ${release}`);
|
|
13763
|
+
}
|
|
13764
|
+
this.raw = this.format();
|
|
13765
|
+
if (this.build.length) {
|
|
13766
|
+
this.raw += `+${this.build.join(".")}`;
|
|
13767
|
+
}
|
|
13768
|
+
return this;
|
|
13769
|
+
}
|
|
13770
|
+
}
|
|
13771
|
+
module.exports = SemVer;
|
|
13772
|
+
});
|
|
13773
|
+
|
|
13774
|
+
// node_modules/semver/functions/parse.js
|
|
13775
|
+
var require_parse = __commonJS((exports, module) => {
|
|
13776
|
+
var SemVer = require_semver();
|
|
13777
|
+
var parse5 = (version, options, throwErrors = false) => {
|
|
13778
|
+
if (version instanceof SemVer) {
|
|
13779
|
+
return version;
|
|
13780
|
+
}
|
|
13781
|
+
try {
|
|
13782
|
+
return new SemVer(version, options);
|
|
13783
|
+
} catch (er) {
|
|
13784
|
+
if (!throwErrors) {
|
|
13785
|
+
return null;
|
|
13786
|
+
}
|
|
13787
|
+
throw er;
|
|
13788
|
+
}
|
|
13789
|
+
};
|
|
13790
|
+
module.exports = parse5;
|
|
13791
|
+
});
|
|
13792
|
+
|
|
13793
|
+
// node_modules/semver/functions/valid.js
|
|
13794
|
+
var require_valid = __commonJS((exports, module) => {
|
|
13795
|
+
var parse5 = require_parse();
|
|
13796
|
+
var valid = (version, options) => {
|
|
13797
|
+
const v2 = parse5(version, options);
|
|
13798
|
+
return v2 ? v2.version : null;
|
|
13799
|
+
};
|
|
13800
|
+
module.exports = valid;
|
|
13801
|
+
});
|
|
13802
|
+
|
|
13803
|
+
// node_modules/semver/functions/clean.js
|
|
13804
|
+
var require_clean = __commonJS((exports, module) => {
|
|
13805
|
+
var parse5 = require_parse();
|
|
13806
|
+
var clean = (version, options) => {
|
|
13807
|
+
const s = parse5(version.trim().replace(/^[=v]+/, ""), options);
|
|
13808
|
+
return s ? s.version : null;
|
|
13809
|
+
};
|
|
13810
|
+
module.exports = clean;
|
|
13811
|
+
});
|
|
13812
|
+
|
|
13813
|
+
// node_modules/semver/functions/inc.js
|
|
13814
|
+
var require_inc = __commonJS((exports, module) => {
|
|
13815
|
+
var SemVer = require_semver();
|
|
13816
|
+
var inc = (version, release, options, identifier, identifierBase) => {
|
|
13817
|
+
if (typeof options === "string") {
|
|
13818
|
+
identifierBase = identifier;
|
|
13819
|
+
identifier = options;
|
|
13820
|
+
options = undefined;
|
|
13821
|
+
}
|
|
13822
|
+
try {
|
|
13823
|
+
return new SemVer(version instanceof SemVer ? version.version : version, options).inc(release, identifier, identifierBase).version;
|
|
13824
|
+
} catch (er) {
|
|
13825
|
+
return null;
|
|
13826
|
+
}
|
|
13827
|
+
};
|
|
13828
|
+
module.exports = inc;
|
|
13829
|
+
});
|
|
13830
|
+
|
|
13831
|
+
// node_modules/semver/functions/diff.js
|
|
13832
|
+
var require_diff = __commonJS((exports, module) => {
|
|
13833
|
+
var parse5 = require_parse();
|
|
13834
|
+
var diff = (version1, version2) => {
|
|
13835
|
+
const v1 = parse5(version1, null, true);
|
|
13836
|
+
const v2 = parse5(version2, null, true);
|
|
13837
|
+
const comparison = v1.compare(v2);
|
|
13838
|
+
if (comparison === 0) {
|
|
13839
|
+
return null;
|
|
13840
|
+
}
|
|
13841
|
+
const v1Higher = comparison > 0;
|
|
13842
|
+
const highVersion = v1Higher ? v1 : v2;
|
|
13843
|
+
const lowVersion = v1Higher ? v2 : v1;
|
|
13844
|
+
const highHasPre = !!highVersion.prerelease.length;
|
|
13845
|
+
const lowHasPre = !!lowVersion.prerelease.length;
|
|
13846
|
+
if (lowHasPre && !highHasPre) {
|
|
13847
|
+
if (!lowVersion.patch && !lowVersion.minor) {
|
|
13848
|
+
return "major";
|
|
13849
|
+
}
|
|
13850
|
+
if (lowVersion.compareMain(highVersion) === 0) {
|
|
13851
|
+
if (lowVersion.minor && !lowVersion.patch) {
|
|
13852
|
+
return "minor";
|
|
13853
|
+
}
|
|
13854
|
+
return "patch";
|
|
13855
|
+
}
|
|
13856
|
+
}
|
|
13857
|
+
const prefix = highHasPre ? "pre" : "";
|
|
13858
|
+
if (v1.major !== v2.major) {
|
|
13859
|
+
return prefix + "major";
|
|
13860
|
+
}
|
|
13861
|
+
if (v1.minor !== v2.minor) {
|
|
13862
|
+
return prefix + "minor";
|
|
13863
|
+
}
|
|
13864
|
+
if (v1.patch !== v2.patch) {
|
|
13865
|
+
return prefix + "patch";
|
|
13866
|
+
}
|
|
13867
|
+
return "prerelease";
|
|
13868
|
+
};
|
|
13869
|
+
module.exports = diff;
|
|
13870
|
+
});
|
|
13871
|
+
|
|
13872
|
+
// node_modules/semver/functions/major.js
|
|
13873
|
+
var require_major = __commonJS((exports, module) => {
|
|
13874
|
+
var SemVer = require_semver();
|
|
13875
|
+
var major = (a3, loose) => new SemVer(a3, loose).major;
|
|
13876
|
+
module.exports = major;
|
|
13877
|
+
});
|
|
13878
|
+
|
|
13879
|
+
// node_modules/semver/functions/minor.js
|
|
13880
|
+
var require_minor = __commonJS((exports, module) => {
|
|
13881
|
+
var SemVer = require_semver();
|
|
13882
|
+
var minor = (a3, loose) => new SemVer(a3, loose).minor;
|
|
13883
|
+
module.exports = minor;
|
|
13884
|
+
});
|
|
13885
|
+
|
|
13886
|
+
// node_modules/semver/functions/patch.js
|
|
13887
|
+
var require_patch = __commonJS((exports, module) => {
|
|
13888
|
+
var SemVer = require_semver();
|
|
13889
|
+
var patch = (a3, loose) => new SemVer(a3, loose).patch;
|
|
13890
|
+
module.exports = patch;
|
|
13891
|
+
});
|
|
13892
|
+
|
|
13893
|
+
// node_modules/semver/functions/prerelease.js
|
|
13894
|
+
var require_prerelease = __commonJS((exports, module) => {
|
|
13895
|
+
var parse5 = require_parse();
|
|
13896
|
+
var prerelease = (version, options) => {
|
|
13897
|
+
const parsed = parse5(version, options);
|
|
13898
|
+
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
|
13899
|
+
};
|
|
13900
|
+
module.exports = prerelease;
|
|
13901
|
+
});
|
|
13902
|
+
|
|
13903
|
+
// node_modules/semver/functions/compare.js
|
|
13904
|
+
var require_compare = __commonJS((exports, module) => {
|
|
13905
|
+
var SemVer = require_semver();
|
|
13906
|
+
var compare = (a3, b3, loose) => new SemVer(a3, loose).compare(new SemVer(b3, loose));
|
|
13907
|
+
module.exports = compare;
|
|
13908
|
+
});
|
|
13909
|
+
|
|
13910
|
+
// node_modules/semver/functions/rcompare.js
|
|
13911
|
+
var require_rcompare = __commonJS((exports, module) => {
|
|
13912
|
+
var compare = require_compare();
|
|
13913
|
+
var rcompare = (a3, b3, loose) => compare(b3, a3, loose);
|
|
13914
|
+
module.exports = rcompare;
|
|
13915
|
+
});
|
|
13916
|
+
|
|
13917
|
+
// node_modules/semver/functions/compare-loose.js
|
|
13918
|
+
var require_compare_loose = __commonJS((exports, module) => {
|
|
13919
|
+
var compare = require_compare();
|
|
13920
|
+
var compareLoose = (a3, b3) => compare(a3, b3, true);
|
|
13921
|
+
module.exports = compareLoose;
|
|
13922
|
+
});
|
|
13923
|
+
|
|
13924
|
+
// node_modules/semver/functions/compare-build.js
|
|
13925
|
+
var require_compare_build = __commonJS((exports, module) => {
|
|
13926
|
+
var SemVer = require_semver();
|
|
13927
|
+
var compareBuild = (a3, b3, loose) => {
|
|
13928
|
+
const versionA = new SemVer(a3, loose);
|
|
13929
|
+
const versionB = new SemVer(b3, loose);
|
|
13930
|
+
return versionA.compare(versionB) || versionA.compareBuild(versionB);
|
|
13931
|
+
};
|
|
13932
|
+
module.exports = compareBuild;
|
|
13933
|
+
});
|
|
13934
|
+
|
|
13935
|
+
// node_modules/semver/functions/sort.js
|
|
13936
|
+
var require_sort = __commonJS((exports, module) => {
|
|
13937
|
+
var compareBuild = require_compare_build();
|
|
13938
|
+
var sort = (list3, loose) => list3.sort((a3, b3) => compareBuild(a3, b3, loose));
|
|
13939
|
+
module.exports = sort;
|
|
13940
|
+
});
|
|
13941
|
+
|
|
13942
|
+
// node_modules/semver/functions/rsort.js
|
|
13943
|
+
var require_rsort = __commonJS((exports, module) => {
|
|
13944
|
+
var compareBuild = require_compare_build();
|
|
13945
|
+
var rsort = (list3, loose) => list3.sort((a3, b3) => compareBuild(b3, a3, loose));
|
|
13946
|
+
module.exports = rsort;
|
|
13947
|
+
});
|
|
13948
|
+
|
|
13949
|
+
// node_modules/semver/functions/gt.js
|
|
13950
|
+
var require_gt = __commonJS((exports, module) => {
|
|
13951
|
+
var compare = require_compare();
|
|
13952
|
+
var gt = (a3, b3, loose) => compare(a3, b3, loose) > 0;
|
|
13953
|
+
module.exports = gt;
|
|
13954
|
+
});
|
|
13955
|
+
|
|
13956
|
+
// node_modules/semver/functions/lt.js
|
|
13957
|
+
var require_lt = __commonJS((exports, module) => {
|
|
13958
|
+
var compare = require_compare();
|
|
13959
|
+
var lt = (a3, b3, loose) => compare(a3, b3, loose) < 0;
|
|
13960
|
+
module.exports = lt;
|
|
13961
|
+
});
|
|
13962
|
+
|
|
13963
|
+
// node_modules/semver/functions/eq.js
|
|
13964
|
+
var require_eq = __commonJS((exports, module) => {
|
|
13965
|
+
var compare = require_compare();
|
|
13966
|
+
var eq = (a3, b3, loose) => compare(a3, b3, loose) === 0;
|
|
13967
|
+
module.exports = eq;
|
|
13968
|
+
});
|
|
13969
|
+
|
|
13970
|
+
// node_modules/semver/functions/neq.js
|
|
13971
|
+
var require_neq = __commonJS((exports, module) => {
|
|
13972
|
+
var compare = require_compare();
|
|
13973
|
+
var neq = (a3, b3, loose) => compare(a3, b3, loose) !== 0;
|
|
13974
|
+
module.exports = neq;
|
|
13975
|
+
});
|
|
13976
|
+
|
|
13977
|
+
// node_modules/semver/functions/gte.js
|
|
13978
|
+
var require_gte = __commonJS((exports, module) => {
|
|
13979
|
+
var compare = require_compare();
|
|
13980
|
+
var gte = (a3, b3, loose) => compare(a3, b3, loose) >= 0;
|
|
13981
|
+
module.exports = gte;
|
|
13982
|
+
});
|
|
13983
|
+
|
|
13984
|
+
// node_modules/semver/functions/lte.js
|
|
13985
|
+
var require_lte = __commonJS((exports, module) => {
|
|
13986
|
+
var compare = require_compare();
|
|
13987
|
+
var lte = (a3, b3, loose) => compare(a3, b3, loose) <= 0;
|
|
13988
|
+
module.exports = lte;
|
|
13989
|
+
});
|
|
13990
|
+
|
|
13991
|
+
// node_modules/semver/functions/cmp.js
|
|
13992
|
+
var require_cmp = __commonJS((exports, module) => {
|
|
13993
|
+
var eq = require_eq();
|
|
13994
|
+
var neq = require_neq();
|
|
13995
|
+
var gt = require_gt();
|
|
13996
|
+
var gte = require_gte();
|
|
13997
|
+
var lt = require_lt();
|
|
13998
|
+
var lte = require_lte();
|
|
13999
|
+
var cmp = (a3, op, b3, loose) => {
|
|
14000
|
+
switch (op) {
|
|
14001
|
+
case "===":
|
|
14002
|
+
if (typeof a3 === "object") {
|
|
14003
|
+
a3 = a3.version;
|
|
14004
|
+
}
|
|
14005
|
+
if (typeof b3 === "object") {
|
|
14006
|
+
b3 = b3.version;
|
|
14007
|
+
}
|
|
14008
|
+
return a3 === b3;
|
|
14009
|
+
case "!==":
|
|
14010
|
+
if (typeof a3 === "object") {
|
|
14011
|
+
a3 = a3.version;
|
|
14012
|
+
}
|
|
14013
|
+
if (typeof b3 === "object") {
|
|
14014
|
+
b3 = b3.version;
|
|
14015
|
+
}
|
|
14016
|
+
return a3 !== b3;
|
|
14017
|
+
case "":
|
|
14018
|
+
case "=":
|
|
14019
|
+
case "==":
|
|
14020
|
+
return eq(a3, b3, loose);
|
|
14021
|
+
case "!=":
|
|
14022
|
+
return neq(a3, b3, loose);
|
|
14023
|
+
case ">":
|
|
14024
|
+
return gt(a3, b3, loose);
|
|
14025
|
+
case ">=":
|
|
14026
|
+
return gte(a3, b3, loose);
|
|
14027
|
+
case "<":
|
|
14028
|
+
return lt(a3, b3, loose);
|
|
14029
|
+
case "<=":
|
|
14030
|
+
return lte(a3, b3, loose);
|
|
14031
|
+
default:
|
|
14032
|
+
throw new TypeError(`Invalid operator: ${op}`);
|
|
14033
|
+
}
|
|
14034
|
+
};
|
|
14035
|
+
module.exports = cmp;
|
|
14036
|
+
});
|
|
14037
|
+
|
|
14038
|
+
// node_modules/semver/functions/coerce.js
|
|
14039
|
+
var require_coerce = __commonJS((exports, module) => {
|
|
14040
|
+
var SemVer = require_semver();
|
|
14041
|
+
var parse5 = require_parse();
|
|
14042
|
+
var { safeRe: re2, t } = require_re();
|
|
14043
|
+
var coerce2 = (version, options) => {
|
|
14044
|
+
if (version instanceof SemVer) {
|
|
14045
|
+
return version;
|
|
14046
|
+
}
|
|
14047
|
+
if (typeof version === "number") {
|
|
14048
|
+
version = String(version);
|
|
14049
|
+
}
|
|
14050
|
+
if (typeof version !== "string") {
|
|
14051
|
+
return null;
|
|
14052
|
+
}
|
|
14053
|
+
options = options || {};
|
|
14054
|
+
let match = null;
|
|
14055
|
+
if (!options.rtl) {
|
|
14056
|
+
match = version.match(options.includePrerelease ? re2[t.COERCEFULL] : re2[t.COERCE]);
|
|
14057
|
+
} else {
|
|
14058
|
+
const coerceRtlRegex = options.includePrerelease ? re2[t.COERCERTLFULL] : re2[t.COERCERTL];
|
|
14059
|
+
let next;
|
|
14060
|
+
while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
|
|
14061
|
+
if (!match || next.index + next[0].length !== match.index + match[0].length) {
|
|
14062
|
+
match = next;
|
|
14063
|
+
}
|
|
14064
|
+
coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
|
|
14065
|
+
}
|
|
14066
|
+
coerceRtlRegex.lastIndex = -1;
|
|
14067
|
+
}
|
|
14068
|
+
if (match === null) {
|
|
14069
|
+
return null;
|
|
14070
|
+
}
|
|
14071
|
+
const major = match[2];
|
|
14072
|
+
const minor = match[3] || "0";
|
|
14073
|
+
const patch = match[4] || "0";
|
|
14074
|
+
const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
|
|
14075
|
+
const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
|
|
14076
|
+
return parse5(`${major}.${minor}.${patch}${prerelease}${build}`, options);
|
|
14077
|
+
};
|
|
14078
|
+
module.exports = coerce2;
|
|
14079
|
+
});
|
|
14080
|
+
|
|
14081
|
+
// node_modules/semver/internal/lrucache.js
|
|
14082
|
+
var require_lrucache = __commonJS((exports, module) => {
|
|
14083
|
+
class LRUCache {
|
|
14084
|
+
constructor() {
|
|
14085
|
+
this.max = 1000;
|
|
14086
|
+
this.map = new Map;
|
|
14087
|
+
}
|
|
14088
|
+
get(key) {
|
|
14089
|
+
const value = this.map.get(key);
|
|
14090
|
+
if (value === undefined) {
|
|
14091
|
+
return;
|
|
14092
|
+
} else {
|
|
14093
|
+
this.map.delete(key);
|
|
14094
|
+
this.map.set(key, value);
|
|
14095
|
+
return value;
|
|
14096
|
+
}
|
|
14097
|
+
}
|
|
14098
|
+
delete(key) {
|
|
14099
|
+
return this.map.delete(key);
|
|
14100
|
+
}
|
|
14101
|
+
set(key, value) {
|
|
14102
|
+
const deleted = this.delete(key);
|
|
14103
|
+
if (!deleted && value !== undefined) {
|
|
14104
|
+
if (this.map.size >= this.max) {
|
|
14105
|
+
const firstKey = this.map.keys().next().value;
|
|
14106
|
+
this.delete(firstKey);
|
|
14107
|
+
}
|
|
14108
|
+
this.map.set(key, value);
|
|
14109
|
+
}
|
|
14110
|
+
return this;
|
|
14111
|
+
}
|
|
14112
|
+
}
|
|
14113
|
+
module.exports = LRUCache;
|
|
14114
|
+
});
|
|
14115
|
+
|
|
14116
|
+
// node_modules/semver/classes/range.js
|
|
14117
|
+
var require_range = __commonJS((exports, module) => {
|
|
14118
|
+
var SPACE_CHARACTERS = /\s+/g;
|
|
14119
|
+
|
|
14120
|
+
class Range {
|
|
14121
|
+
constructor(range, options) {
|
|
14122
|
+
options = parseOptions(options);
|
|
14123
|
+
if (range instanceof Range) {
|
|
14124
|
+
if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
|
|
14125
|
+
return range;
|
|
14126
|
+
} else {
|
|
14127
|
+
return new Range(range.raw, options);
|
|
14128
|
+
}
|
|
14129
|
+
}
|
|
14130
|
+
if (range instanceof Comparator) {
|
|
14131
|
+
this.raw = range.value;
|
|
14132
|
+
this.set = [[range]];
|
|
14133
|
+
this.formatted = undefined;
|
|
14134
|
+
return this;
|
|
14135
|
+
}
|
|
14136
|
+
this.options = options;
|
|
14137
|
+
this.loose = !!options.loose;
|
|
14138
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
14139
|
+
this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
|
|
14140
|
+
this.set = this.raw.split("||").map((r2) => this.parseRange(r2.trim())).filter((c2) => c2.length);
|
|
14141
|
+
if (!this.set.length) {
|
|
14142
|
+
throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
|
|
14143
|
+
}
|
|
14144
|
+
if (this.set.length > 1) {
|
|
14145
|
+
const first = this.set[0];
|
|
14146
|
+
this.set = this.set.filter((c2) => !isNullSet(c2[0]));
|
|
14147
|
+
if (this.set.length === 0) {
|
|
14148
|
+
this.set = [first];
|
|
14149
|
+
} else if (this.set.length > 1) {
|
|
14150
|
+
for (const c2 of this.set) {
|
|
14151
|
+
if (c2.length === 1 && isAny(c2[0])) {
|
|
14152
|
+
this.set = [c2];
|
|
14153
|
+
break;
|
|
14154
|
+
}
|
|
14155
|
+
}
|
|
14156
|
+
}
|
|
14157
|
+
}
|
|
14158
|
+
this.formatted = undefined;
|
|
14159
|
+
}
|
|
14160
|
+
get range() {
|
|
14161
|
+
if (this.formatted === undefined) {
|
|
14162
|
+
this.formatted = "";
|
|
14163
|
+
for (let i = 0;i < this.set.length; i++) {
|
|
14164
|
+
if (i > 0) {
|
|
14165
|
+
this.formatted += "||";
|
|
14166
|
+
}
|
|
14167
|
+
const comps = this.set[i];
|
|
14168
|
+
for (let k2 = 0;k2 < comps.length; k2++) {
|
|
14169
|
+
if (k2 > 0) {
|
|
14170
|
+
this.formatted += " ";
|
|
14171
|
+
}
|
|
14172
|
+
this.formatted += comps[k2].toString().trim();
|
|
14173
|
+
}
|
|
14174
|
+
}
|
|
14175
|
+
}
|
|
14176
|
+
return this.formatted;
|
|
14177
|
+
}
|
|
14178
|
+
format() {
|
|
14179
|
+
return this.range;
|
|
14180
|
+
}
|
|
14181
|
+
toString() {
|
|
14182
|
+
return this.range;
|
|
14183
|
+
}
|
|
14184
|
+
parseRange(range) {
|
|
14185
|
+
const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
|
|
14186
|
+
const memoKey = memoOpts + ":" + range;
|
|
14187
|
+
const cached = cache2.get(memoKey);
|
|
14188
|
+
if (cached) {
|
|
14189
|
+
return cached;
|
|
14190
|
+
}
|
|
14191
|
+
const loose = this.options.loose;
|
|
14192
|
+
const hr = loose ? re2[t.HYPHENRANGELOOSE] : re2[t.HYPHENRANGE];
|
|
14193
|
+
range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
|
|
14194
|
+
debug("hyphen replace", range);
|
|
14195
|
+
range = range.replace(re2[t.COMPARATORTRIM], comparatorTrimReplace);
|
|
14196
|
+
debug("comparator trim", range);
|
|
14197
|
+
range = range.replace(re2[t.TILDETRIM], tildeTrimReplace);
|
|
14198
|
+
debug("tilde trim", range);
|
|
14199
|
+
range = range.replace(re2[t.CARETTRIM], caretTrimReplace);
|
|
14200
|
+
debug("caret trim", range);
|
|
14201
|
+
let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
|
|
14202
|
+
if (loose) {
|
|
14203
|
+
rangeList = rangeList.filter((comp) => {
|
|
14204
|
+
debug("loose invalid filter", comp, this.options);
|
|
14205
|
+
return !!comp.match(re2[t.COMPARATORLOOSE]);
|
|
14206
|
+
});
|
|
14207
|
+
}
|
|
14208
|
+
debug("range list", rangeList);
|
|
14209
|
+
const rangeMap = new Map;
|
|
14210
|
+
const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
|
|
14211
|
+
for (const comp of comparators) {
|
|
14212
|
+
if (isNullSet(comp)) {
|
|
14213
|
+
return [comp];
|
|
14214
|
+
}
|
|
14215
|
+
rangeMap.set(comp.value, comp);
|
|
14216
|
+
}
|
|
14217
|
+
if (rangeMap.size > 1 && rangeMap.has("")) {
|
|
14218
|
+
rangeMap.delete("");
|
|
14219
|
+
}
|
|
14220
|
+
const result = [...rangeMap.values()];
|
|
14221
|
+
cache2.set(memoKey, result);
|
|
14222
|
+
return result;
|
|
14223
|
+
}
|
|
14224
|
+
intersects(range, options) {
|
|
14225
|
+
if (!(range instanceof Range)) {
|
|
14226
|
+
throw new TypeError("a Range is required");
|
|
14227
|
+
}
|
|
14228
|
+
return this.set.some((thisComparators) => {
|
|
14229
|
+
return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
|
|
14230
|
+
return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
|
|
14231
|
+
return rangeComparators.every((rangeComparator) => {
|
|
14232
|
+
return thisComparator.intersects(rangeComparator, options);
|
|
14233
|
+
});
|
|
14234
|
+
});
|
|
14235
|
+
});
|
|
14236
|
+
});
|
|
14237
|
+
}
|
|
14238
|
+
test(version) {
|
|
14239
|
+
if (!version) {
|
|
14240
|
+
return false;
|
|
14241
|
+
}
|
|
14242
|
+
if (typeof version === "string") {
|
|
14243
|
+
try {
|
|
14244
|
+
version = new SemVer(version, this.options);
|
|
14245
|
+
} catch (er) {
|
|
14246
|
+
return false;
|
|
14247
|
+
}
|
|
14248
|
+
}
|
|
14249
|
+
for (let i = 0;i < this.set.length; i++) {
|
|
14250
|
+
if (testSet(this.set[i], version, this.options)) {
|
|
14251
|
+
return true;
|
|
14252
|
+
}
|
|
14253
|
+
}
|
|
14254
|
+
return false;
|
|
14255
|
+
}
|
|
14256
|
+
}
|
|
14257
|
+
module.exports = Range;
|
|
14258
|
+
var LRU = require_lrucache();
|
|
14259
|
+
var cache2 = new LRU;
|
|
14260
|
+
var parseOptions = require_parse_options();
|
|
14261
|
+
var Comparator = require_comparator();
|
|
14262
|
+
var debug = require_debug();
|
|
14263
|
+
var SemVer = require_semver();
|
|
14264
|
+
var {
|
|
14265
|
+
safeRe: re2,
|
|
14266
|
+
t,
|
|
14267
|
+
comparatorTrimReplace,
|
|
14268
|
+
tildeTrimReplace,
|
|
14269
|
+
caretTrimReplace
|
|
14270
|
+
} = require_re();
|
|
14271
|
+
var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
|
|
14272
|
+
var isNullSet = (c2) => c2.value === "<0.0.0-0";
|
|
14273
|
+
var isAny = (c2) => c2.value === "";
|
|
14274
|
+
var isSatisfiable = (comparators, options) => {
|
|
14275
|
+
let result = true;
|
|
14276
|
+
const remainingComparators = comparators.slice();
|
|
14277
|
+
let testComparator = remainingComparators.pop();
|
|
14278
|
+
while (result && remainingComparators.length) {
|
|
14279
|
+
result = remainingComparators.every((otherComparator) => {
|
|
14280
|
+
return testComparator.intersects(otherComparator, options);
|
|
14281
|
+
});
|
|
14282
|
+
testComparator = remainingComparators.pop();
|
|
14283
|
+
}
|
|
14284
|
+
return result;
|
|
14285
|
+
};
|
|
14286
|
+
var parseComparator = (comp, options) => {
|
|
14287
|
+
comp = comp.replace(re2[t.BUILD], "");
|
|
14288
|
+
debug("comp", comp, options);
|
|
14289
|
+
comp = replaceCarets(comp, options);
|
|
14290
|
+
debug("caret", comp);
|
|
14291
|
+
comp = replaceTildes(comp, options);
|
|
14292
|
+
debug("tildes", comp);
|
|
14293
|
+
comp = replaceXRanges(comp, options);
|
|
14294
|
+
debug("xrange", comp);
|
|
14295
|
+
comp = replaceStars(comp, options);
|
|
14296
|
+
debug("stars", comp);
|
|
14297
|
+
return comp;
|
|
14298
|
+
};
|
|
14299
|
+
var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
|
|
14300
|
+
var replaceTildes = (comp, options) => {
|
|
14301
|
+
return comp.trim().split(/\s+/).map((c2) => replaceTilde(c2, options)).join(" ");
|
|
14302
|
+
};
|
|
14303
|
+
var replaceTilde = (comp, options) => {
|
|
14304
|
+
const r2 = options.loose ? re2[t.TILDELOOSE] : re2[t.TILDE];
|
|
14305
|
+
return comp.replace(r2, (_3, M3, m2, p, pr) => {
|
|
14306
|
+
debug("tilde", comp, _3, M3, m2, p, pr);
|
|
14307
|
+
let ret;
|
|
14308
|
+
if (isX(M3)) {
|
|
14309
|
+
ret = "";
|
|
14310
|
+
} else if (isX(m2)) {
|
|
14311
|
+
ret = `>=${M3}.0.0 <${+M3 + 1}.0.0-0`;
|
|
14312
|
+
} else if (isX(p)) {
|
|
14313
|
+
ret = `>=${M3}.${m2}.0 <${M3}.${+m2 + 1}.0-0`;
|
|
14314
|
+
} else if (pr) {
|
|
14315
|
+
debug("replaceTilde pr", pr);
|
|
14316
|
+
ret = `>=${M3}.${m2}.${p}-${pr} <${M3}.${+m2 + 1}.0-0`;
|
|
14317
|
+
} else {
|
|
14318
|
+
ret = `>=${M3}.${m2}.${p} <${M3}.${+m2 + 1}.0-0`;
|
|
14319
|
+
}
|
|
14320
|
+
debug("tilde return", ret);
|
|
14321
|
+
return ret;
|
|
14322
|
+
});
|
|
14323
|
+
};
|
|
14324
|
+
var replaceCarets = (comp, options) => {
|
|
14325
|
+
return comp.trim().split(/\s+/).map((c2) => replaceCaret(c2, options)).join(" ");
|
|
14326
|
+
};
|
|
14327
|
+
var replaceCaret = (comp, options) => {
|
|
14328
|
+
debug("caret", comp, options);
|
|
14329
|
+
const r2 = options.loose ? re2[t.CARETLOOSE] : re2[t.CARET];
|
|
14330
|
+
const z3 = options.includePrerelease ? "-0" : "";
|
|
14331
|
+
return comp.replace(r2, (_3, M3, m2, p, pr) => {
|
|
14332
|
+
debug("caret", comp, _3, M3, m2, p, pr);
|
|
14333
|
+
let ret;
|
|
14334
|
+
if (isX(M3)) {
|
|
14335
|
+
ret = "";
|
|
14336
|
+
} else if (isX(m2)) {
|
|
14337
|
+
ret = `>=${M3}.0.0${z3} <${+M3 + 1}.0.0-0`;
|
|
14338
|
+
} else if (isX(p)) {
|
|
14339
|
+
if (M3 === "0") {
|
|
14340
|
+
ret = `>=${M3}.${m2}.0${z3} <${M3}.${+m2 + 1}.0-0`;
|
|
14341
|
+
} else {
|
|
14342
|
+
ret = `>=${M3}.${m2}.0${z3} <${+M3 + 1}.0.0-0`;
|
|
14343
|
+
}
|
|
14344
|
+
} else if (pr) {
|
|
14345
|
+
debug("replaceCaret pr", pr);
|
|
14346
|
+
if (M3 === "0") {
|
|
14347
|
+
if (m2 === "0") {
|
|
14348
|
+
ret = `>=${M3}.${m2}.${p}-${pr} <${M3}.${m2}.${+p + 1}-0`;
|
|
14349
|
+
} else {
|
|
14350
|
+
ret = `>=${M3}.${m2}.${p}-${pr} <${M3}.${+m2 + 1}.0-0`;
|
|
14351
|
+
}
|
|
14352
|
+
} else {
|
|
14353
|
+
ret = `>=${M3}.${m2}.${p}-${pr} <${+M3 + 1}.0.0-0`;
|
|
14354
|
+
}
|
|
14355
|
+
} else {
|
|
14356
|
+
debug("no pr");
|
|
14357
|
+
if (M3 === "0") {
|
|
14358
|
+
if (m2 === "0") {
|
|
14359
|
+
ret = `>=${M3}.${m2}.${p}${z3} <${M3}.${m2}.${+p + 1}-0`;
|
|
14360
|
+
} else {
|
|
14361
|
+
ret = `>=${M3}.${m2}.${p}${z3} <${M3}.${+m2 + 1}.0-0`;
|
|
14362
|
+
}
|
|
14363
|
+
} else {
|
|
14364
|
+
ret = `>=${M3}.${m2}.${p} <${+M3 + 1}.0.0-0`;
|
|
14365
|
+
}
|
|
14366
|
+
}
|
|
14367
|
+
debug("caret return", ret);
|
|
14368
|
+
return ret;
|
|
14369
|
+
});
|
|
14370
|
+
};
|
|
14371
|
+
var replaceXRanges = (comp, options) => {
|
|
14372
|
+
debug("replaceXRanges", comp, options);
|
|
14373
|
+
return comp.split(/\s+/).map((c2) => replaceXRange(c2, options)).join(" ");
|
|
14374
|
+
};
|
|
14375
|
+
var replaceXRange = (comp, options) => {
|
|
14376
|
+
comp = comp.trim();
|
|
14377
|
+
const r2 = options.loose ? re2[t.XRANGELOOSE] : re2[t.XRANGE];
|
|
14378
|
+
return comp.replace(r2, (ret, gtlt, M3, m2, p, pr) => {
|
|
14379
|
+
debug("xRange", comp, ret, gtlt, M3, m2, p, pr);
|
|
14380
|
+
const xM = isX(M3);
|
|
14381
|
+
const xm = xM || isX(m2);
|
|
14382
|
+
const xp = xm || isX(p);
|
|
14383
|
+
const anyX = xp;
|
|
14384
|
+
if (gtlt === "=" && anyX) {
|
|
14385
|
+
gtlt = "";
|
|
14386
|
+
}
|
|
14387
|
+
pr = options.includePrerelease ? "-0" : "";
|
|
14388
|
+
if (xM) {
|
|
14389
|
+
if (gtlt === ">" || gtlt === "<") {
|
|
14390
|
+
ret = "<0.0.0-0";
|
|
14391
|
+
} else {
|
|
14392
|
+
ret = "*";
|
|
14393
|
+
}
|
|
14394
|
+
} else if (gtlt && anyX) {
|
|
14395
|
+
if (xm) {
|
|
14396
|
+
m2 = 0;
|
|
14397
|
+
}
|
|
14398
|
+
p = 0;
|
|
14399
|
+
if (gtlt === ">") {
|
|
14400
|
+
gtlt = ">=";
|
|
14401
|
+
if (xm) {
|
|
14402
|
+
M3 = +M3 + 1;
|
|
14403
|
+
m2 = 0;
|
|
14404
|
+
p = 0;
|
|
14405
|
+
} else {
|
|
14406
|
+
m2 = +m2 + 1;
|
|
14407
|
+
p = 0;
|
|
14408
|
+
}
|
|
14409
|
+
} else if (gtlt === "<=") {
|
|
14410
|
+
gtlt = "<";
|
|
14411
|
+
if (xm) {
|
|
14412
|
+
M3 = +M3 + 1;
|
|
14413
|
+
} else {
|
|
14414
|
+
m2 = +m2 + 1;
|
|
14415
|
+
}
|
|
14416
|
+
}
|
|
14417
|
+
if (gtlt === "<") {
|
|
14418
|
+
pr = "-0";
|
|
14419
|
+
}
|
|
14420
|
+
ret = `${gtlt + M3}.${m2}.${p}${pr}`;
|
|
14421
|
+
} else if (xm) {
|
|
14422
|
+
ret = `>=${M3}.0.0${pr} <${+M3 + 1}.0.0-0`;
|
|
14423
|
+
} else if (xp) {
|
|
14424
|
+
ret = `>=${M3}.${m2}.0${pr} <${M3}.${+m2 + 1}.0-0`;
|
|
14425
|
+
}
|
|
14426
|
+
debug("xRange return", ret);
|
|
14427
|
+
return ret;
|
|
14428
|
+
});
|
|
14429
|
+
};
|
|
14430
|
+
var replaceStars = (comp, options) => {
|
|
14431
|
+
debug("replaceStars", comp, options);
|
|
14432
|
+
return comp.trim().replace(re2[t.STAR], "");
|
|
14433
|
+
};
|
|
14434
|
+
var replaceGTE0 = (comp, options) => {
|
|
14435
|
+
debug("replaceGTE0", comp, options);
|
|
14436
|
+
return comp.trim().replace(re2[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
|
|
14437
|
+
};
|
|
14438
|
+
var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
|
|
14439
|
+
if (isX(fM)) {
|
|
14440
|
+
from = "";
|
|
14441
|
+
} else if (isX(fm)) {
|
|
14442
|
+
from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
|
|
14443
|
+
} else if (isX(fp)) {
|
|
14444
|
+
from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
|
|
14445
|
+
} else if (fpr) {
|
|
14446
|
+
from = `>=${from}`;
|
|
14447
|
+
} else {
|
|
14448
|
+
from = `>=${from}${incPr ? "-0" : ""}`;
|
|
14449
|
+
}
|
|
14450
|
+
if (isX(tM)) {
|
|
14451
|
+
to = "";
|
|
14452
|
+
} else if (isX(tm)) {
|
|
14453
|
+
to = `<${+tM + 1}.0.0-0`;
|
|
14454
|
+
} else if (isX(tp)) {
|
|
14455
|
+
to = `<${tM}.${+tm + 1}.0-0`;
|
|
14456
|
+
} else if (tpr) {
|
|
14457
|
+
to = `<=${tM}.${tm}.${tp}-${tpr}`;
|
|
14458
|
+
} else if (incPr) {
|
|
14459
|
+
to = `<${tM}.${tm}.${+tp + 1}-0`;
|
|
14460
|
+
} else {
|
|
14461
|
+
to = `<=${to}`;
|
|
14462
|
+
}
|
|
14463
|
+
return `${from} ${to}`.trim();
|
|
14464
|
+
};
|
|
14465
|
+
var testSet = (set, version, options) => {
|
|
14466
|
+
for (let i = 0;i < set.length; i++) {
|
|
14467
|
+
if (!set[i].test(version)) {
|
|
14468
|
+
return false;
|
|
14469
|
+
}
|
|
14470
|
+
}
|
|
14471
|
+
if (version.prerelease.length && !options.includePrerelease) {
|
|
14472
|
+
for (let i = 0;i < set.length; i++) {
|
|
14473
|
+
debug(set[i].semver);
|
|
14474
|
+
if (set[i].semver === Comparator.ANY) {
|
|
14475
|
+
continue;
|
|
14476
|
+
}
|
|
14477
|
+
if (set[i].semver.prerelease.length > 0) {
|
|
14478
|
+
const allowed = set[i].semver;
|
|
14479
|
+
if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
|
|
14480
|
+
return true;
|
|
14481
|
+
}
|
|
14482
|
+
}
|
|
14483
|
+
}
|
|
14484
|
+
return false;
|
|
14485
|
+
}
|
|
14486
|
+
return true;
|
|
14487
|
+
};
|
|
14488
|
+
});
|
|
14489
|
+
|
|
14490
|
+
// node_modules/semver/classes/comparator.js
|
|
14491
|
+
var require_comparator = __commonJS((exports, module) => {
|
|
14492
|
+
var ANY = Symbol("SemVer ANY");
|
|
14493
|
+
|
|
14494
|
+
class Comparator {
|
|
14495
|
+
static get ANY() {
|
|
14496
|
+
return ANY;
|
|
14497
|
+
}
|
|
14498
|
+
constructor(comp, options) {
|
|
14499
|
+
options = parseOptions(options);
|
|
14500
|
+
if (comp instanceof Comparator) {
|
|
14501
|
+
if (comp.loose === !!options.loose) {
|
|
14502
|
+
return comp;
|
|
14503
|
+
} else {
|
|
14504
|
+
comp = comp.value;
|
|
14505
|
+
}
|
|
14506
|
+
}
|
|
14507
|
+
comp = comp.trim().split(/\s+/).join(" ");
|
|
14508
|
+
debug("comparator", comp, options);
|
|
14509
|
+
this.options = options;
|
|
14510
|
+
this.loose = !!options.loose;
|
|
14511
|
+
this.parse(comp);
|
|
14512
|
+
if (this.semver === ANY) {
|
|
14513
|
+
this.value = "";
|
|
14514
|
+
} else {
|
|
14515
|
+
this.value = this.operator + this.semver.version;
|
|
14516
|
+
}
|
|
14517
|
+
debug("comp", this);
|
|
14518
|
+
}
|
|
14519
|
+
parse(comp) {
|
|
14520
|
+
const r2 = this.options.loose ? re2[t.COMPARATORLOOSE] : re2[t.COMPARATOR];
|
|
14521
|
+
const m2 = comp.match(r2);
|
|
14522
|
+
if (!m2) {
|
|
14523
|
+
throw new TypeError(`Invalid comparator: ${comp}`);
|
|
14524
|
+
}
|
|
14525
|
+
this.operator = m2[1] !== undefined ? m2[1] : "";
|
|
14526
|
+
if (this.operator === "=") {
|
|
14527
|
+
this.operator = "";
|
|
14528
|
+
}
|
|
14529
|
+
if (!m2[2]) {
|
|
14530
|
+
this.semver = ANY;
|
|
14531
|
+
} else {
|
|
14532
|
+
this.semver = new SemVer(m2[2], this.options.loose);
|
|
14533
|
+
}
|
|
14534
|
+
}
|
|
14535
|
+
toString() {
|
|
14536
|
+
return this.value;
|
|
14537
|
+
}
|
|
14538
|
+
test(version) {
|
|
14539
|
+
debug("Comparator.test", version, this.options.loose);
|
|
14540
|
+
if (this.semver === ANY || version === ANY) {
|
|
14541
|
+
return true;
|
|
14542
|
+
}
|
|
14543
|
+
if (typeof version === "string") {
|
|
14544
|
+
try {
|
|
14545
|
+
version = new SemVer(version, this.options);
|
|
14546
|
+
} catch (er) {
|
|
14547
|
+
return false;
|
|
14548
|
+
}
|
|
14549
|
+
}
|
|
14550
|
+
return cmp(version, this.operator, this.semver, this.options);
|
|
14551
|
+
}
|
|
14552
|
+
intersects(comp, options) {
|
|
14553
|
+
if (!(comp instanceof Comparator)) {
|
|
14554
|
+
throw new TypeError("a Comparator is required");
|
|
14555
|
+
}
|
|
14556
|
+
if (this.operator === "") {
|
|
14557
|
+
if (this.value === "") {
|
|
14558
|
+
return true;
|
|
14559
|
+
}
|
|
14560
|
+
return new Range(comp.value, options).test(this.value);
|
|
14561
|
+
} else if (comp.operator === "") {
|
|
14562
|
+
if (comp.value === "") {
|
|
14563
|
+
return true;
|
|
14564
|
+
}
|
|
14565
|
+
return new Range(this.value, options).test(comp.semver);
|
|
14566
|
+
}
|
|
14567
|
+
options = parseOptions(options);
|
|
14568
|
+
if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
|
|
14569
|
+
return false;
|
|
14570
|
+
}
|
|
14571
|
+
if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
|
|
14572
|
+
return false;
|
|
14573
|
+
}
|
|
14574
|
+
if (this.operator.startsWith(">") && comp.operator.startsWith(">")) {
|
|
14575
|
+
return true;
|
|
14576
|
+
}
|
|
14577
|
+
if (this.operator.startsWith("<") && comp.operator.startsWith("<")) {
|
|
14578
|
+
return true;
|
|
14579
|
+
}
|
|
14580
|
+
if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) {
|
|
14581
|
+
return true;
|
|
14582
|
+
}
|
|
14583
|
+
if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
|
|
14584
|
+
return true;
|
|
14585
|
+
}
|
|
14586
|
+
if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
|
|
14587
|
+
return true;
|
|
14588
|
+
}
|
|
14589
|
+
return false;
|
|
14590
|
+
}
|
|
14591
|
+
}
|
|
14592
|
+
module.exports = Comparator;
|
|
14593
|
+
var parseOptions = require_parse_options();
|
|
14594
|
+
var { safeRe: re2, t } = require_re();
|
|
14595
|
+
var cmp = require_cmp();
|
|
14596
|
+
var debug = require_debug();
|
|
14597
|
+
var SemVer = require_semver();
|
|
14598
|
+
var Range = require_range();
|
|
14599
|
+
});
|
|
14600
|
+
|
|
14601
|
+
// node_modules/semver/functions/satisfies.js
|
|
14602
|
+
var require_satisfies = __commonJS((exports, module) => {
|
|
14603
|
+
var Range = require_range();
|
|
14604
|
+
var satisfies = (version, range, options) => {
|
|
14605
|
+
try {
|
|
14606
|
+
range = new Range(range, options);
|
|
14607
|
+
} catch (er) {
|
|
14608
|
+
return false;
|
|
14609
|
+
}
|
|
14610
|
+
return range.test(version);
|
|
14611
|
+
};
|
|
14612
|
+
module.exports = satisfies;
|
|
14613
|
+
});
|
|
14614
|
+
|
|
14615
|
+
// node_modules/semver/ranges/to-comparators.js
|
|
14616
|
+
var require_to_comparators = __commonJS((exports, module) => {
|
|
14617
|
+
var Range = require_range();
|
|
14618
|
+
var toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c2) => c2.value).join(" ").trim().split(" "));
|
|
14619
|
+
module.exports = toComparators;
|
|
14620
|
+
});
|
|
14621
|
+
|
|
14622
|
+
// node_modules/semver/ranges/max-satisfying.js
|
|
14623
|
+
var require_max_satisfying = __commonJS((exports, module) => {
|
|
14624
|
+
var SemVer = require_semver();
|
|
14625
|
+
var Range = require_range();
|
|
14626
|
+
var maxSatisfying = (versions, range, options) => {
|
|
14627
|
+
let max = null;
|
|
14628
|
+
let maxSV = null;
|
|
14629
|
+
let rangeObj = null;
|
|
14630
|
+
try {
|
|
14631
|
+
rangeObj = new Range(range, options);
|
|
14632
|
+
} catch (er) {
|
|
14633
|
+
return null;
|
|
14634
|
+
}
|
|
14635
|
+
versions.forEach((v2) => {
|
|
14636
|
+
if (rangeObj.test(v2)) {
|
|
14637
|
+
if (!max || maxSV.compare(v2) === -1) {
|
|
14638
|
+
max = v2;
|
|
14639
|
+
maxSV = new SemVer(max, options);
|
|
14640
|
+
}
|
|
14641
|
+
}
|
|
14642
|
+
});
|
|
14643
|
+
return max;
|
|
14644
|
+
};
|
|
14645
|
+
module.exports = maxSatisfying;
|
|
14646
|
+
});
|
|
14647
|
+
|
|
14648
|
+
// node_modules/semver/ranges/min-satisfying.js
|
|
14649
|
+
var require_min_satisfying = __commonJS((exports, module) => {
|
|
14650
|
+
var SemVer = require_semver();
|
|
14651
|
+
var Range = require_range();
|
|
14652
|
+
var minSatisfying = (versions, range, options) => {
|
|
14653
|
+
let min = null;
|
|
14654
|
+
let minSV = null;
|
|
14655
|
+
let rangeObj = null;
|
|
14656
|
+
try {
|
|
14657
|
+
rangeObj = new Range(range, options);
|
|
14658
|
+
} catch (er) {
|
|
14659
|
+
return null;
|
|
14660
|
+
}
|
|
14661
|
+
versions.forEach((v2) => {
|
|
14662
|
+
if (rangeObj.test(v2)) {
|
|
14663
|
+
if (!min || minSV.compare(v2) === 1) {
|
|
14664
|
+
min = v2;
|
|
14665
|
+
minSV = new SemVer(min, options);
|
|
14666
|
+
}
|
|
14667
|
+
}
|
|
14668
|
+
});
|
|
14669
|
+
return min;
|
|
14670
|
+
};
|
|
14671
|
+
module.exports = minSatisfying;
|
|
14672
|
+
});
|
|
14673
|
+
|
|
14674
|
+
// node_modules/semver/ranges/min-version.js
|
|
14675
|
+
var require_min_version = __commonJS((exports, module) => {
|
|
14676
|
+
var SemVer = require_semver();
|
|
14677
|
+
var Range = require_range();
|
|
14678
|
+
var gt = require_gt();
|
|
14679
|
+
var minVersion = (range, loose) => {
|
|
14680
|
+
range = new Range(range, loose);
|
|
14681
|
+
let minver = new SemVer("0.0.0");
|
|
14682
|
+
if (range.test(minver)) {
|
|
14683
|
+
return minver;
|
|
14684
|
+
}
|
|
14685
|
+
minver = new SemVer("0.0.0-0");
|
|
14686
|
+
if (range.test(minver)) {
|
|
14687
|
+
return minver;
|
|
14688
|
+
}
|
|
14689
|
+
minver = null;
|
|
14690
|
+
for (let i = 0;i < range.set.length; ++i) {
|
|
14691
|
+
const comparators = range.set[i];
|
|
14692
|
+
let setMin = null;
|
|
14693
|
+
comparators.forEach((comparator) => {
|
|
14694
|
+
const compver = new SemVer(comparator.semver.version);
|
|
14695
|
+
switch (comparator.operator) {
|
|
14696
|
+
case ">":
|
|
14697
|
+
if (compver.prerelease.length === 0) {
|
|
14698
|
+
compver.patch++;
|
|
14699
|
+
} else {
|
|
14700
|
+
compver.prerelease.push(0);
|
|
14701
|
+
}
|
|
14702
|
+
compver.raw = compver.format();
|
|
14703
|
+
case "":
|
|
14704
|
+
case ">=":
|
|
14705
|
+
if (!setMin || gt(compver, setMin)) {
|
|
14706
|
+
setMin = compver;
|
|
14707
|
+
}
|
|
14708
|
+
break;
|
|
14709
|
+
case "<":
|
|
14710
|
+
case "<=":
|
|
14711
|
+
break;
|
|
14712
|
+
default:
|
|
14713
|
+
throw new Error(`Unexpected operation: ${comparator.operator}`);
|
|
14714
|
+
}
|
|
14715
|
+
});
|
|
14716
|
+
if (setMin && (!minver || gt(minver, setMin))) {
|
|
14717
|
+
minver = setMin;
|
|
14718
|
+
}
|
|
14719
|
+
}
|
|
14720
|
+
if (minver && range.test(minver)) {
|
|
14721
|
+
return minver;
|
|
14722
|
+
}
|
|
14723
|
+
return null;
|
|
14724
|
+
};
|
|
14725
|
+
module.exports = minVersion;
|
|
14726
|
+
});
|
|
14727
|
+
|
|
14728
|
+
// node_modules/semver/ranges/valid.js
|
|
14729
|
+
var require_valid2 = __commonJS((exports, module) => {
|
|
14730
|
+
var Range = require_range();
|
|
14731
|
+
var validRange = (range, options) => {
|
|
14732
|
+
try {
|
|
14733
|
+
return new Range(range, options).range || "*";
|
|
14734
|
+
} catch (er) {
|
|
14735
|
+
return null;
|
|
14736
|
+
}
|
|
14737
|
+
};
|
|
14738
|
+
module.exports = validRange;
|
|
14739
|
+
});
|
|
14740
|
+
|
|
14741
|
+
// node_modules/semver/ranges/outside.js
|
|
14742
|
+
var require_outside = __commonJS((exports, module) => {
|
|
14743
|
+
var SemVer = require_semver();
|
|
14744
|
+
var Comparator = require_comparator();
|
|
14745
|
+
var { ANY } = Comparator;
|
|
14746
|
+
var Range = require_range();
|
|
14747
|
+
var satisfies = require_satisfies();
|
|
14748
|
+
var gt = require_gt();
|
|
14749
|
+
var lt = require_lt();
|
|
14750
|
+
var lte = require_lte();
|
|
14751
|
+
var gte = require_gte();
|
|
14752
|
+
var outside = (version, range, hilo, options) => {
|
|
14753
|
+
version = new SemVer(version, options);
|
|
14754
|
+
range = new Range(range, options);
|
|
14755
|
+
let gtfn, ltefn, ltfn, comp, ecomp;
|
|
14756
|
+
switch (hilo) {
|
|
14757
|
+
case ">":
|
|
14758
|
+
gtfn = gt;
|
|
14759
|
+
ltefn = lte;
|
|
14760
|
+
ltfn = lt;
|
|
14761
|
+
comp = ">";
|
|
14762
|
+
ecomp = ">=";
|
|
14763
|
+
break;
|
|
14764
|
+
case "<":
|
|
14765
|
+
gtfn = lt;
|
|
14766
|
+
ltefn = gte;
|
|
14767
|
+
ltfn = gt;
|
|
14768
|
+
comp = "<";
|
|
14769
|
+
ecomp = "<=";
|
|
14770
|
+
break;
|
|
14771
|
+
default:
|
|
14772
|
+
throw new TypeError('Must provide a hilo val of "<" or ">"');
|
|
14773
|
+
}
|
|
14774
|
+
if (satisfies(version, range, options)) {
|
|
14775
|
+
return false;
|
|
14776
|
+
}
|
|
14777
|
+
for (let i = 0;i < range.set.length; ++i) {
|
|
14778
|
+
const comparators = range.set[i];
|
|
14779
|
+
let high = null;
|
|
14780
|
+
let low = null;
|
|
14781
|
+
comparators.forEach((comparator) => {
|
|
14782
|
+
if (comparator.semver === ANY) {
|
|
14783
|
+
comparator = new Comparator(">=0.0.0");
|
|
14784
|
+
}
|
|
14785
|
+
high = high || comparator;
|
|
14786
|
+
low = low || comparator;
|
|
14787
|
+
if (gtfn(comparator.semver, high.semver, options)) {
|
|
14788
|
+
high = comparator;
|
|
14789
|
+
} else if (ltfn(comparator.semver, low.semver, options)) {
|
|
14790
|
+
low = comparator;
|
|
14791
|
+
}
|
|
14792
|
+
});
|
|
14793
|
+
if (high.operator === comp || high.operator === ecomp) {
|
|
14794
|
+
return false;
|
|
14795
|
+
}
|
|
14796
|
+
if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) {
|
|
14797
|
+
return false;
|
|
14798
|
+
} else if (low.operator === ecomp && ltfn(version, low.semver)) {
|
|
14799
|
+
return false;
|
|
14800
|
+
}
|
|
14801
|
+
}
|
|
14802
|
+
return true;
|
|
14803
|
+
};
|
|
14804
|
+
module.exports = outside;
|
|
14805
|
+
});
|
|
14806
|
+
|
|
14807
|
+
// node_modules/semver/ranges/gtr.js
|
|
14808
|
+
var require_gtr = __commonJS((exports, module) => {
|
|
14809
|
+
var outside = require_outside();
|
|
14810
|
+
var gtr = (version, range, options) => outside(version, range, ">", options);
|
|
14811
|
+
module.exports = gtr;
|
|
14812
|
+
});
|
|
14813
|
+
|
|
14814
|
+
// node_modules/semver/ranges/ltr.js
|
|
14815
|
+
var require_ltr = __commonJS((exports, module) => {
|
|
14816
|
+
var outside = require_outside();
|
|
14817
|
+
var ltr = (version, range, options) => outside(version, range, "<", options);
|
|
14818
|
+
module.exports = ltr;
|
|
14819
|
+
});
|
|
14820
|
+
|
|
14821
|
+
// node_modules/semver/ranges/intersects.js
|
|
14822
|
+
var require_intersects = __commonJS((exports, module) => {
|
|
14823
|
+
var Range = require_range();
|
|
14824
|
+
var intersects = (r1, r2, options) => {
|
|
14825
|
+
r1 = new Range(r1, options);
|
|
14826
|
+
r2 = new Range(r2, options);
|
|
14827
|
+
return r1.intersects(r2, options);
|
|
14828
|
+
};
|
|
14829
|
+
module.exports = intersects;
|
|
14830
|
+
});
|
|
14831
|
+
|
|
14832
|
+
// node_modules/semver/ranges/simplify.js
|
|
14833
|
+
var require_simplify = __commonJS((exports, module) => {
|
|
14834
|
+
var satisfies = require_satisfies();
|
|
14835
|
+
var compare = require_compare();
|
|
14836
|
+
module.exports = (versions, range, options) => {
|
|
14837
|
+
const set = [];
|
|
14838
|
+
let first = null;
|
|
14839
|
+
let prev = null;
|
|
14840
|
+
const v2 = versions.sort((a3, b3) => compare(a3, b3, options));
|
|
14841
|
+
for (const version of v2) {
|
|
14842
|
+
const included = satisfies(version, range, options);
|
|
14843
|
+
if (included) {
|
|
14844
|
+
prev = version;
|
|
14845
|
+
if (!first) {
|
|
14846
|
+
first = version;
|
|
14847
|
+
}
|
|
14848
|
+
} else {
|
|
14849
|
+
if (prev) {
|
|
14850
|
+
set.push([first, prev]);
|
|
14851
|
+
}
|
|
14852
|
+
prev = null;
|
|
14853
|
+
first = null;
|
|
14854
|
+
}
|
|
14855
|
+
}
|
|
14856
|
+
if (first) {
|
|
14857
|
+
set.push([first, null]);
|
|
14858
|
+
}
|
|
14859
|
+
const ranges = [];
|
|
14860
|
+
for (const [min, max] of set) {
|
|
14861
|
+
if (min === max) {
|
|
14862
|
+
ranges.push(min);
|
|
14863
|
+
} else if (!max && min === v2[0]) {
|
|
14864
|
+
ranges.push("*");
|
|
14865
|
+
} else if (!max) {
|
|
14866
|
+
ranges.push(`>=${min}`);
|
|
14867
|
+
} else if (min === v2[0]) {
|
|
14868
|
+
ranges.push(`<=${max}`);
|
|
14869
|
+
} else {
|
|
14870
|
+
ranges.push(`${min} - ${max}`);
|
|
14871
|
+
}
|
|
14872
|
+
}
|
|
14873
|
+
const simplified = ranges.join(" || ");
|
|
14874
|
+
const original = typeof range.raw === "string" ? range.raw : String(range);
|
|
14875
|
+
return simplified.length < original.length ? simplified : range;
|
|
14876
|
+
};
|
|
14877
|
+
});
|
|
14878
|
+
|
|
14879
|
+
// node_modules/semver/ranges/subset.js
|
|
14880
|
+
var require_subset = __commonJS((exports, module) => {
|
|
14881
|
+
var Range = require_range();
|
|
14882
|
+
var Comparator = require_comparator();
|
|
14883
|
+
var { ANY } = Comparator;
|
|
14884
|
+
var satisfies = require_satisfies();
|
|
14885
|
+
var compare = require_compare();
|
|
14886
|
+
var subset = (sub, dom, options = {}) => {
|
|
14887
|
+
if (sub === dom) {
|
|
14888
|
+
return true;
|
|
14889
|
+
}
|
|
14890
|
+
sub = new Range(sub, options);
|
|
14891
|
+
dom = new Range(dom, options);
|
|
14892
|
+
let sawNonNull = false;
|
|
14893
|
+
OUTER:
|
|
14894
|
+
for (const simpleSub of sub.set) {
|
|
14895
|
+
for (const simpleDom of dom.set) {
|
|
14896
|
+
const isSub = simpleSubset(simpleSub, simpleDom, options);
|
|
14897
|
+
sawNonNull = sawNonNull || isSub !== null;
|
|
14898
|
+
if (isSub) {
|
|
14899
|
+
continue OUTER;
|
|
14900
|
+
}
|
|
14901
|
+
}
|
|
14902
|
+
if (sawNonNull) {
|
|
14903
|
+
return false;
|
|
14904
|
+
}
|
|
14905
|
+
}
|
|
14906
|
+
return true;
|
|
14907
|
+
};
|
|
14908
|
+
var minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
|
|
14909
|
+
var minimumVersion = [new Comparator(">=0.0.0")];
|
|
14910
|
+
var simpleSubset = (sub, dom, options) => {
|
|
14911
|
+
if (sub === dom) {
|
|
14912
|
+
return true;
|
|
14913
|
+
}
|
|
14914
|
+
if (sub.length === 1 && sub[0].semver === ANY) {
|
|
14915
|
+
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
14916
|
+
return true;
|
|
14917
|
+
} else if (options.includePrerelease) {
|
|
14918
|
+
sub = minimumVersionWithPreRelease;
|
|
14919
|
+
} else {
|
|
14920
|
+
sub = minimumVersion;
|
|
14921
|
+
}
|
|
14922
|
+
}
|
|
14923
|
+
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
14924
|
+
if (options.includePrerelease) {
|
|
14925
|
+
return true;
|
|
14926
|
+
} else {
|
|
14927
|
+
dom = minimumVersion;
|
|
14928
|
+
}
|
|
14929
|
+
}
|
|
14930
|
+
const eqSet = new Set;
|
|
14931
|
+
let gt, lt;
|
|
14932
|
+
for (const c2 of sub) {
|
|
14933
|
+
if (c2.operator === ">" || c2.operator === ">=") {
|
|
14934
|
+
gt = higherGT(gt, c2, options);
|
|
14935
|
+
} else if (c2.operator === "<" || c2.operator === "<=") {
|
|
14936
|
+
lt = lowerLT(lt, c2, options);
|
|
14937
|
+
} else {
|
|
14938
|
+
eqSet.add(c2.semver);
|
|
14939
|
+
}
|
|
14940
|
+
}
|
|
14941
|
+
if (eqSet.size > 1) {
|
|
14942
|
+
return null;
|
|
14943
|
+
}
|
|
14944
|
+
let gtltComp;
|
|
14945
|
+
if (gt && lt) {
|
|
14946
|
+
gtltComp = compare(gt.semver, lt.semver, options);
|
|
14947
|
+
if (gtltComp > 0) {
|
|
14948
|
+
return null;
|
|
14949
|
+
} else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
|
|
14950
|
+
return null;
|
|
14951
|
+
}
|
|
14952
|
+
}
|
|
14953
|
+
for (const eq of eqSet) {
|
|
14954
|
+
if (gt && !satisfies(eq, String(gt), options)) {
|
|
14955
|
+
return null;
|
|
14956
|
+
}
|
|
14957
|
+
if (lt && !satisfies(eq, String(lt), options)) {
|
|
14958
|
+
return null;
|
|
14959
|
+
}
|
|
14960
|
+
for (const c2 of dom) {
|
|
14961
|
+
if (!satisfies(eq, String(c2), options)) {
|
|
14962
|
+
return false;
|
|
14963
|
+
}
|
|
14964
|
+
}
|
|
14965
|
+
return true;
|
|
14966
|
+
}
|
|
14967
|
+
let higher, lower;
|
|
14968
|
+
let hasDomLT, hasDomGT;
|
|
14969
|
+
let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
|
|
14970
|
+
let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
|
|
14971
|
+
if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) {
|
|
14972
|
+
needDomLTPre = false;
|
|
14973
|
+
}
|
|
14974
|
+
for (const c2 of dom) {
|
|
14975
|
+
hasDomGT = hasDomGT || c2.operator === ">" || c2.operator === ">=";
|
|
14976
|
+
hasDomLT = hasDomLT || c2.operator === "<" || c2.operator === "<=";
|
|
14977
|
+
if (gt) {
|
|
14978
|
+
if (needDomGTPre) {
|
|
14979
|
+
if (c2.semver.prerelease && c2.semver.prerelease.length && c2.semver.major === needDomGTPre.major && c2.semver.minor === needDomGTPre.minor && c2.semver.patch === needDomGTPre.patch) {
|
|
14980
|
+
needDomGTPre = false;
|
|
14981
|
+
}
|
|
14982
|
+
}
|
|
14983
|
+
if (c2.operator === ">" || c2.operator === ">=") {
|
|
14984
|
+
higher = higherGT(gt, c2, options);
|
|
14985
|
+
if (higher === c2 && higher !== gt) {
|
|
14986
|
+
return false;
|
|
14987
|
+
}
|
|
14988
|
+
} else if (gt.operator === ">=" && !satisfies(gt.semver, String(c2), options)) {
|
|
14989
|
+
return false;
|
|
14990
|
+
}
|
|
14991
|
+
}
|
|
14992
|
+
if (lt) {
|
|
14993
|
+
if (needDomLTPre) {
|
|
14994
|
+
if (c2.semver.prerelease && c2.semver.prerelease.length && c2.semver.major === needDomLTPre.major && c2.semver.minor === needDomLTPre.minor && c2.semver.patch === needDomLTPre.patch) {
|
|
14995
|
+
needDomLTPre = false;
|
|
14996
|
+
}
|
|
14997
|
+
}
|
|
14998
|
+
if (c2.operator === "<" || c2.operator === "<=") {
|
|
14999
|
+
lower = lowerLT(lt, c2, options);
|
|
15000
|
+
if (lower === c2 && lower !== lt) {
|
|
15001
|
+
return false;
|
|
15002
|
+
}
|
|
15003
|
+
} else if (lt.operator === "<=" && !satisfies(lt.semver, String(c2), options)) {
|
|
15004
|
+
return false;
|
|
15005
|
+
}
|
|
15006
|
+
}
|
|
15007
|
+
if (!c2.operator && (lt || gt) && gtltComp !== 0) {
|
|
15008
|
+
return false;
|
|
15009
|
+
}
|
|
15010
|
+
}
|
|
15011
|
+
if (gt && hasDomLT && !lt && gtltComp !== 0) {
|
|
15012
|
+
return false;
|
|
15013
|
+
}
|
|
15014
|
+
if (lt && hasDomGT && !gt && gtltComp !== 0) {
|
|
15015
|
+
return false;
|
|
15016
|
+
}
|
|
15017
|
+
if (needDomGTPre || needDomLTPre) {
|
|
15018
|
+
return false;
|
|
15019
|
+
}
|
|
15020
|
+
return true;
|
|
15021
|
+
};
|
|
15022
|
+
var higherGT = (a3, b3, options) => {
|
|
15023
|
+
if (!a3) {
|
|
15024
|
+
return b3;
|
|
15025
|
+
}
|
|
15026
|
+
const comp = compare(a3.semver, b3.semver, options);
|
|
15027
|
+
return comp > 0 ? a3 : comp < 0 ? b3 : b3.operator === ">" && a3.operator === ">=" ? b3 : a3;
|
|
15028
|
+
};
|
|
15029
|
+
var lowerLT = (a3, b3, options) => {
|
|
15030
|
+
if (!a3) {
|
|
15031
|
+
return b3;
|
|
15032
|
+
}
|
|
15033
|
+
const comp = compare(a3.semver, b3.semver, options);
|
|
15034
|
+
return comp < 0 ? a3 : comp > 0 ? b3 : b3.operator === "<" && a3.operator === "<=" ? b3 : a3;
|
|
15035
|
+
};
|
|
15036
|
+
module.exports = subset;
|
|
15037
|
+
});
|
|
15038
|
+
|
|
15039
|
+
// node_modules/semver/index.js
|
|
15040
|
+
var require_semver2 = __commonJS((exports, module) => {
|
|
15041
|
+
var internalRe = require_re();
|
|
15042
|
+
var constants5 = require_constants();
|
|
15043
|
+
var SemVer = require_semver();
|
|
15044
|
+
var identifiers = require_identifiers();
|
|
15045
|
+
var parse5 = require_parse();
|
|
15046
|
+
var valid = require_valid();
|
|
15047
|
+
var clean = require_clean();
|
|
15048
|
+
var inc = require_inc();
|
|
15049
|
+
var diff = require_diff();
|
|
15050
|
+
var major = require_major();
|
|
15051
|
+
var minor = require_minor();
|
|
15052
|
+
var patch = require_patch();
|
|
15053
|
+
var prerelease = require_prerelease();
|
|
15054
|
+
var compare = require_compare();
|
|
15055
|
+
var rcompare = require_rcompare();
|
|
15056
|
+
var compareLoose = require_compare_loose();
|
|
15057
|
+
var compareBuild = require_compare_build();
|
|
15058
|
+
var sort = require_sort();
|
|
15059
|
+
var rsort = require_rsort();
|
|
15060
|
+
var gt = require_gt();
|
|
15061
|
+
var lt = require_lt();
|
|
15062
|
+
var eq = require_eq();
|
|
15063
|
+
var neq = require_neq();
|
|
15064
|
+
var gte = require_gte();
|
|
15065
|
+
var lte = require_lte();
|
|
15066
|
+
var cmp = require_cmp();
|
|
15067
|
+
var coerce2 = require_coerce();
|
|
15068
|
+
var Comparator = require_comparator();
|
|
15069
|
+
var Range = require_range();
|
|
15070
|
+
var satisfies = require_satisfies();
|
|
15071
|
+
var toComparators = require_to_comparators();
|
|
15072
|
+
var maxSatisfying = require_max_satisfying();
|
|
15073
|
+
var minSatisfying = require_min_satisfying();
|
|
15074
|
+
var minVersion = require_min_version();
|
|
15075
|
+
var validRange = require_valid2();
|
|
15076
|
+
var outside = require_outside();
|
|
15077
|
+
var gtr = require_gtr();
|
|
15078
|
+
var ltr = require_ltr();
|
|
15079
|
+
var intersects = require_intersects();
|
|
15080
|
+
var simplifyRange = require_simplify();
|
|
15081
|
+
var subset = require_subset();
|
|
15082
|
+
module.exports = {
|
|
15083
|
+
parse: parse5,
|
|
15084
|
+
valid,
|
|
15085
|
+
clean,
|
|
15086
|
+
inc,
|
|
15087
|
+
diff,
|
|
15088
|
+
major,
|
|
15089
|
+
minor,
|
|
15090
|
+
patch,
|
|
15091
|
+
prerelease,
|
|
15092
|
+
compare,
|
|
15093
|
+
rcompare,
|
|
15094
|
+
compareLoose,
|
|
15095
|
+
compareBuild,
|
|
15096
|
+
sort,
|
|
15097
|
+
rsort,
|
|
15098
|
+
gt,
|
|
15099
|
+
lt,
|
|
15100
|
+
eq,
|
|
15101
|
+
neq,
|
|
15102
|
+
gte,
|
|
15103
|
+
lte,
|
|
15104
|
+
cmp,
|
|
15105
|
+
coerce: coerce2,
|
|
15106
|
+
Comparator,
|
|
15107
|
+
Range,
|
|
15108
|
+
satisfies,
|
|
15109
|
+
toComparators,
|
|
15110
|
+
maxSatisfying,
|
|
15111
|
+
minSatisfying,
|
|
15112
|
+
minVersion,
|
|
15113
|
+
validRange,
|
|
15114
|
+
outside,
|
|
15115
|
+
gtr,
|
|
15116
|
+
ltr,
|
|
15117
|
+
intersects,
|
|
15118
|
+
simplifyRange,
|
|
15119
|
+
subset,
|
|
15120
|
+
SemVer,
|
|
15121
|
+
re: internalRe.re,
|
|
15122
|
+
src: internalRe.src,
|
|
15123
|
+
tokens: internalRe.t,
|
|
15124
|
+
SEMVER_SPEC_VERSION: constants5.SEMVER_SPEC_VERSION,
|
|
15125
|
+
RELEASE_TYPES: constants5.RELEASE_TYPES,
|
|
15126
|
+
compareIdentifiers: identifiers.compareIdentifiers,
|
|
15127
|
+
rcompareIdentifiers: identifiers.rcompareIdentifiers
|
|
15128
|
+
};
|
|
15129
|
+
});
|
|
15130
|
+
|
|
13344
15131
|
// node_modules/retry/lib/retry_operation.js
|
|
13345
15132
|
var require_retry_operation = __commonJS((exports, module) => {
|
|
13346
15133
|
function RetryOperation(timeouts, options) {
|
|
@@ -14093,25 +15880,25 @@ class OwnershipDisplay {
|
|
|
14093
15880
|
static formatOwnership(ownership) {
|
|
14094
15881
|
switch (ownership) {
|
|
14095
15882
|
case "ck":
|
|
14096
|
-
return
|
|
15883
|
+
return import_picocolors18.default.blue("CK-owned");
|
|
14097
15884
|
case "user":
|
|
14098
|
-
return
|
|
15885
|
+
return import_picocolors18.default.green("User-created");
|
|
14099
15886
|
case "ck-modified":
|
|
14100
|
-
return
|
|
15887
|
+
return import_picocolors18.default.yellow("CK-modified");
|
|
14101
15888
|
default:
|
|
14102
|
-
return
|
|
15889
|
+
return import_picocolors18.default.gray("Unknown");
|
|
14103
15890
|
}
|
|
14104
15891
|
}
|
|
14105
15892
|
static formatAction(action) {
|
|
14106
15893
|
switch (action) {
|
|
14107
15894
|
case "delete":
|
|
14108
|
-
return
|
|
15895
|
+
return import_picocolors18.default.red("✖ DELETE");
|
|
14109
15896
|
case "preserve":
|
|
14110
|
-
return
|
|
15897
|
+
return import_picocolors18.default.green("✓ PRESERVE");
|
|
14111
15898
|
case "skip":
|
|
14112
|
-
return
|
|
15899
|
+
return import_picocolors18.default.gray("○ SKIP");
|
|
14113
15900
|
default:
|
|
14114
|
-
return
|
|
15901
|
+
return import_picocolors18.default.gray("? UNKNOWN");
|
|
14115
15902
|
}
|
|
14116
15903
|
}
|
|
14117
15904
|
static calculateSummary(results) {
|
|
@@ -14145,78 +15932,78 @@ class OwnershipDisplay {
|
|
|
14145
15932
|
}
|
|
14146
15933
|
static displaySummary(summary, title = "Ownership Summary") {
|
|
14147
15934
|
const lines = [
|
|
14148
|
-
`Total files: ${
|
|
15935
|
+
`Total files: ${import_picocolors18.default.bold(String(summary.totalFiles))}`,
|
|
14149
15936
|
"",
|
|
14150
15937
|
"By ownership:",
|
|
14151
|
-
` ${
|
|
14152
|
-
` ${
|
|
14153
|
-
` ${
|
|
15938
|
+
` ${import_picocolors18.default.blue("●")} CK-owned: ${summary.ckOwned}`,
|
|
15939
|
+
` ${import_picocolors18.default.green("●")} User-created: ${summary.userCreated}`,
|
|
15940
|
+
` ${import_picocolors18.default.yellow("●")} CK-modified: ${summary.ckModified}`,
|
|
14154
15941
|
"",
|
|
14155
15942
|
"Actions:",
|
|
14156
|
-
` ${
|
|
14157
|
-
` ${
|
|
15943
|
+
` ${import_picocolors18.default.red("✖")} To delete: ${summary.toDelete}`,
|
|
15944
|
+
` ${import_picocolors18.default.green("✓")} To preserve: ${summary.toPreserve}`
|
|
14158
15945
|
];
|
|
14159
15946
|
le(lines.join(`
|
|
14160
15947
|
`), title);
|
|
14161
15948
|
}
|
|
14162
15949
|
static displayOperationPreview(results, maxItems = 10) {
|
|
14163
15950
|
const summary = OwnershipDisplay.calculateSummary(results);
|
|
14164
|
-
f2.info(
|
|
15951
|
+
f2.info(import_picocolors18.default.bold("DRY RUN - Preview of changes:"));
|
|
14165
15952
|
console.log("");
|
|
14166
15953
|
const toDelete = results.filter((r2) => r2.action === "delete");
|
|
14167
15954
|
const toPreserve = results.filter((r2) => r2.action === "preserve");
|
|
14168
15955
|
if (toDelete.length > 0) {
|
|
14169
|
-
console.log(
|
|
15956
|
+
console.log(import_picocolors18.default.red(import_picocolors18.default.bold(`Files to DELETE (${toDelete.length}):`)));
|
|
14170
15957
|
const showDelete = toDelete.slice(0, maxItems);
|
|
14171
15958
|
for (const result of showDelete) {
|
|
14172
|
-
console.log(` ${
|
|
15959
|
+
console.log(` ${import_picocolors18.default.red("✖")} ${result.path}`);
|
|
14173
15960
|
}
|
|
14174
15961
|
if (toDelete.length > maxItems) {
|
|
14175
|
-
console.log(
|
|
15962
|
+
console.log(import_picocolors18.default.gray(` ... and ${toDelete.length - maxItems} more`));
|
|
14176
15963
|
}
|
|
14177
15964
|
console.log("");
|
|
14178
15965
|
}
|
|
14179
15966
|
if (toPreserve.length > 0) {
|
|
14180
|
-
console.log(
|
|
15967
|
+
console.log(import_picocolors18.default.green(import_picocolors18.default.bold(`Files to PRESERVE (${toPreserve.length}):`)));
|
|
14181
15968
|
const showPreserve = toPreserve.slice(0, maxItems);
|
|
14182
15969
|
for (const result of showPreserve) {
|
|
14183
|
-
const reason = result.reason ?
|
|
14184
|
-
console.log(` ${
|
|
15970
|
+
const reason = result.reason ? import_picocolors18.default.gray(` (${result.reason})`) : "";
|
|
15971
|
+
console.log(` ${import_picocolors18.default.green("✓")} ${result.path}${reason}`);
|
|
14185
15972
|
}
|
|
14186
15973
|
if (toPreserve.length > maxItems) {
|
|
14187
|
-
console.log(
|
|
15974
|
+
console.log(import_picocolors18.default.gray(` ... and ${toPreserve.length - maxItems} more`));
|
|
14188
15975
|
}
|
|
14189
15976
|
console.log("");
|
|
14190
15977
|
}
|
|
14191
15978
|
OwnershipDisplay.displaySummary(summary, "Preview Summary");
|
|
14192
|
-
f2.warn(
|
|
15979
|
+
f2.warn(import_picocolors18.default.yellow("No changes were made. Run without --dry-run to apply changes."));
|
|
14193
15980
|
}
|
|
14194
15981
|
static displayFile(path11, ownership, action, reason) {
|
|
14195
15982
|
const ownershipStr = OwnershipDisplay.formatOwnership(ownership);
|
|
14196
15983
|
const actionStr = OwnershipDisplay.formatAction(action);
|
|
14197
|
-
const reasonStr = reason ?
|
|
15984
|
+
const reasonStr = reason ? import_picocolors18.default.gray(` - ${reason}`) : "";
|
|
14198
15985
|
console.log(` ${actionStr} ${path11} [${ownershipStr}]${reasonStr}`);
|
|
14199
15986
|
}
|
|
14200
15987
|
static displayForceWarning() {
|
|
14201
|
-
f2.warn(`${
|
|
14202
|
-
${
|
|
14203
|
-
${
|
|
15988
|
+
f2.warn(`${import_picocolors18.default.yellow(import_picocolors18.default.bold("FORCE MODE ENABLED"))}
|
|
15989
|
+
${import_picocolors18.default.yellow("User modifications will be overwritten!")}
|
|
15990
|
+
${import_picocolors18.default.gray("Use --dry-run first to preview changes.")}`);
|
|
14204
15991
|
}
|
|
14205
15992
|
static displayLegacyWarning() {
|
|
14206
|
-
f2.warn(`${
|
|
14207
|
-
${
|
|
14208
|
-
${
|
|
15993
|
+
f2.warn(`${import_picocolors18.default.yellow(import_picocolors18.default.bold("Legacy Installation Detected"))}
|
|
15994
|
+
${import_picocolors18.default.yellow("No ownership metadata found.")}
|
|
15995
|
+
${import_picocolors18.default.gray("Running migration to enable ownership tracking...")}`);
|
|
14209
15996
|
}
|
|
14210
15997
|
static displayCompletionSummary(deleted, preserved) {
|
|
14211
|
-
const message = `${
|
|
14212
|
-
${
|
|
15998
|
+
const message = `${import_picocolors18.default.green(`✓ Deleted ${deleted} CK-owned file(s)`)}
|
|
15999
|
+
${import_picocolors18.default.blue(`✓ Preserved ${preserved} user/modified file(s)`)}`;
|
|
14213
16000
|
f2.success(message);
|
|
14214
16001
|
}
|
|
14215
16002
|
}
|
|
14216
|
-
var
|
|
16003
|
+
var import_picocolors18;
|
|
14217
16004
|
var init_ownership_display = __esm(() => {
|
|
14218
16005
|
init_dist2();
|
|
14219
|
-
|
|
16006
|
+
import_picocolors18 = __toESM(require_picocolors(), 1);
|
|
14220
16007
|
});
|
|
14221
16008
|
|
|
14222
16009
|
// src/domains/help/commands/common-options.ts
|
|
@@ -14734,22 +16521,22 @@ function padEnd(text, width) {
|
|
|
14734
16521
|
const padding = Math.max(0, width - visibleLength);
|
|
14735
16522
|
return text + " ".repeat(padding);
|
|
14736
16523
|
}
|
|
14737
|
-
var
|
|
16524
|
+
var import_picocolors28, NO_COLOR, isColorSupported, identity = (text) => text, colors, defaultTheme;
|
|
14738
16525
|
var init_help_colors = __esm(() => {
|
|
14739
|
-
|
|
16526
|
+
import_picocolors28 = __toESM(require_picocolors(), 1);
|
|
14740
16527
|
NO_COLOR = process.env.NO_COLOR !== undefined;
|
|
14741
16528
|
isColorSupported = !NO_COLOR && Boolean(process.stdout.isTTY);
|
|
14742
16529
|
colors = {
|
|
14743
|
-
banner: isColorSupported ?
|
|
14744
|
-
command: isColorSupported ?
|
|
14745
|
-
heading: isColorSupported ?
|
|
14746
|
-
flag: isColorSupported ?
|
|
14747
|
-
description: isColorSupported ?
|
|
14748
|
-
example: isColorSupported ?
|
|
14749
|
-
warning: isColorSupported ?
|
|
14750
|
-
error: isColorSupported ?
|
|
14751
|
-
muted: isColorSupported ?
|
|
14752
|
-
success: isColorSupported ?
|
|
16530
|
+
banner: isColorSupported ? import_picocolors28.default.cyan : identity,
|
|
16531
|
+
command: isColorSupported ? import_picocolors28.default.bold : identity,
|
|
16532
|
+
heading: isColorSupported ? import_picocolors28.default.yellow : identity,
|
|
16533
|
+
flag: isColorSupported ? import_picocolors28.default.green : identity,
|
|
16534
|
+
description: isColorSupported ? import_picocolors28.default.gray : identity,
|
|
16535
|
+
example: isColorSupported ? import_picocolors28.default.blue : identity,
|
|
16536
|
+
warning: isColorSupported ? import_picocolors28.default.yellow : identity,
|
|
16537
|
+
error: isColorSupported ? import_picocolors28.default.red : identity,
|
|
16538
|
+
muted: isColorSupported ? import_picocolors28.default.dim : identity,
|
|
16539
|
+
success: isColorSupported ? import_picocolors28.default.green : identity
|
|
14753
16540
|
};
|
|
14754
16541
|
defaultTheme = {
|
|
14755
16542
|
banner: colors.banner,
|
|
@@ -17707,11 +19494,15 @@ async function checkPathRefsValid(projectDir) {
|
|
|
17707
19494
|
const broken = [];
|
|
17708
19495
|
for (const ref of refs) {
|
|
17709
19496
|
let refPath;
|
|
17710
|
-
if (ref.startsWith("$HOME") || ref.startsWith("%USERPROFILE%")) {
|
|
17711
|
-
refPath = normalize3(ref.replace(
|
|
19497
|
+
if (ref.startsWith("$HOME") || ref.startsWith("${HOME}") || ref.startsWith("%USERPROFILE%")) {
|
|
19498
|
+
refPath = normalize3(ref.replace(/^\$\{?HOME\}?/, home).replace("%USERPROFILE%", home));
|
|
19499
|
+
} else if (ref.startsWith("$CLAUDE_PROJECT_DIR") || ref.startsWith("${CLAUDE_PROJECT_DIR}") || ref.startsWith("%CLAUDE_PROJECT_DIR%")) {
|
|
19500
|
+
refPath = normalize3(ref.replace(/^\$\{?CLAUDE_PROJECT_DIR\}?/, projectDir).replace("%CLAUDE_PROJECT_DIR%", projectDir));
|
|
19501
|
+
} else if (ref.startsWith("~")) {
|
|
19502
|
+
refPath = normalize3(ref.replace(/^~/, home));
|
|
17712
19503
|
} else if (ref.startsWith("/")) {
|
|
17713
19504
|
refPath = normalize3(ref);
|
|
17714
|
-
} else if (
|
|
19505
|
+
} else if (/^[A-Za-z]:/.test(ref)) {
|
|
17715
19506
|
refPath = normalize3(ref);
|
|
17716
19507
|
} else {
|
|
17717
19508
|
refPath = resolve(baseDir, ref);
|
|
@@ -17719,7 +19510,7 @@ async function checkPathRefsValid(projectDir) {
|
|
|
17719
19510
|
const normalizedPath = normalize3(refPath);
|
|
17720
19511
|
const isWithinHome = normalizedPath.startsWith(home);
|
|
17721
19512
|
const isWithinBase = normalizedPath.startsWith(normalize3(baseDir));
|
|
17722
|
-
const isAbsoluteAllowed = ref.startsWith("/") ||
|
|
19513
|
+
const isAbsoluteAllowed = ref.startsWith("/") || /^[A-Za-z]:/.test(ref);
|
|
17723
19514
|
if (!isWithinHome && !isWithinBase && !isAbsoluteAllowed) {
|
|
17724
19515
|
logger.verbose("Skipping potentially unsafe path reference", { ref, refPath });
|
|
17725
19516
|
continue;
|
|
@@ -31987,17 +33778,169 @@ init_dist2();
|
|
|
31987
33778
|
// src/domains/installation/merger/copy-executor.ts
|
|
31988
33779
|
init_logger();
|
|
31989
33780
|
init_types2();
|
|
31990
|
-
var
|
|
33781
|
+
var import_fs_extra8 = __toESM(require_lib(), 1);
|
|
31991
33782
|
var import_ignore3 = __toESM(require_ignore(), 1);
|
|
31992
|
-
import { dirname as dirname8, join as
|
|
33783
|
+
import { dirname as dirname8, join as join39, relative as relative6 } from "node:path";
|
|
31993
33784
|
|
|
31994
33785
|
// src/domains/installation/selective-merger.ts
|
|
31995
33786
|
import { stat as stat6 } from "node:fs/promises";
|
|
33787
|
+
|
|
33788
|
+
// src/services/file-operations/manifest/manifest-reader.ts
|
|
33789
|
+
import { join as join35 } from "node:path";
|
|
31996
33790
|
init_logger();
|
|
33791
|
+
init_types2();
|
|
33792
|
+
var import_fs_extra4 = __toESM(require_lib(), 1);
|
|
33793
|
+
async function readManifest(claudeDir) {
|
|
33794
|
+
const metadataPath = join35(claudeDir, "metadata.json");
|
|
33795
|
+
if (!await import_fs_extra4.pathExists(metadataPath)) {
|
|
33796
|
+
return null;
|
|
33797
|
+
}
|
|
33798
|
+
try {
|
|
33799
|
+
const content = await import_fs_extra4.readFile(metadataPath, "utf-8");
|
|
33800
|
+
const parsed = JSON.parse(content);
|
|
33801
|
+
return MetadataSchema.parse(parsed);
|
|
33802
|
+
} catch (error) {
|
|
33803
|
+
logger.debug(`Failed to read manifest: ${error}`);
|
|
33804
|
+
return null;
|
|
33805
|
+
}
|
|
33806
|
+
}
|
|
33807
|
+
async function readKitManifest(claudeDir, kit) {
|
|
33808
|
+
const metadata = await readManifest(claudeDir);
|
|
33809
|
+
if (!metadata)
|
|
33810
|
+
return null;
|
|
33811
|
+
return getKitMetadata(metadata, kit);
|
|
33812
|
+
}
|
|
33813
|
+
async function findFileInInstalledKits(claudeDir, relativePath, excludeKit) {
|
|
33814
|
+
const metadata = await readManifest(claudeDir);
|
|
33815
|
+
if (!metadata?.kits) {
|
|
33816
|
+
return {
|
|
33817
|
+
exists: false,
|
|
33818
|
+
ownerKit: null,
|
|
33819
|
+
checksum: null,
|
|
33820
|
+
version: null,
|
|
33821
|
+
sourceTimestamp: null,
|
|
33822
|
+
installedAt: null
|
|
33823
|
+
};
|
|
33824
|
+
}
|
|
33825
|
+
for (const [kitName, kitMeta] of Object.entries(metadata.kits)) {
|
|
33826
|
+
const kit = kitName;
|
|
33827
|
+
if (kit === excludeKit)
|
|
33828
|
+
continue;
|
|
33829
|
+
if (!kitMeta.files)
|
|
33830
|
+
continue;
|
|
33831
|
+
const file = kitMeta.files.find((f3) => f3.path === relativePath);
|
|
33832
|
+
if (file) {
|
|
33833
|
+
return {
|
|
33834
|
+
exists: true,
|
|
33835
|
+
ownerKit: kit,
|
|
33836
|
+
checksum: file.checksum,
|
|
33837
|
+
version: kitMeta.version,
|
|
33838
|
+
sourceTimestamp: file.sourceTimestamp ?? null,
|
|
33839
|
+
installedAt: file.installedAt ?? null
|
|
33840
|
+
};
|
|
33841
|
+
}
|
|
33842
|
+
}
|
|
33843
|
+
return {
|
|
33844
|
+
exists: false,
|
|
33845
|
+
ownerKit: null,
|
|
33846
|
+
checksum: null,
|
|
33847
|
+
version: null,
|
|
33848
|
+
sourceTimestamp: null,
|
|
33849
|
+
installedAt: null
|
|
33850
|
+
};
|
|
33851
|
+
}
|
|
33852
|
+
async function getUninstallManifest(claudeDir, kit) {
|
|
33853
|
+
const detection = await detectMetadataFormat(claudeDir);
|
|
33854
|
+
if (detection.format === "multi-kit" && detection.metadata?.kits) {
|
|
33855
|
+
const installedKits = Object.keys(detection.metadata.kits);
|
|
33856
|
+
if (kit) {
|
|
33857
|
+
const kitMeta = detection.metadata.kits[kit];
|
|
33858
|
+
if (!kitMeta?.files) {
|
|
33859
|
+
return {
|
|
33860
|
+
filesToRemove: [],
|
|
33861
|
+
filesToPreserve: USER_CONFIG_PATTERNS,
|
|
33862
|
+
hasManifest: true,
|
|
33863
|
+
isMultiKit: true,
|
|
33864
|
+
remainingKits: installedKits.filter((k2) => k2 !== kit)
|
|
33865
|
+
};
|
|
33866
|
+
}
|
|
33867
|
+
const kitFiles = kitMeta.files.map((f3) => f3.path);
|
|
33868
|
+
const sharedFiles = new Set;
|
|
33869
|
+
for (const otherKit of installedKits) {
|
|
33870
|
+
if (otherKit !== kit) {
|
|
33871
|
+
const otherMeta = detection.metadata.kits[otherKit];
|
|
33872
|
+
if (otherMeta?.files) {
|
|
33873
|
+
for (const f3 of otherMeta.files) {
|
|
33874
|
+
sharedFiles.add(f3.path);
|
|
33875
|
+
}
|
|
33876
|
+
}
|
|
33877
|
+
}
|
|
33878
|
+
}
|
|
33879
|
+
const filesToRemove = kitFiles.filter((f3) => !sharedFiles.has(f3));
|
|
33880
|
+
const filesToPreserve = [
|
|
33881
|
+
...USER_CONFIG_PATTERNS,
|
|
33882
|
+
...kitFiles.filter((f3) => sharedFiles.has(f3))
|
|
33883
|
+
];
|
|
33884
|
+
return {
|
|
33885
|
+
filesToRemove,
|
|
33886
|
+
filesToPreserve,
|
|
33887
|
+
hasManifest: true,
|
|
33888
|
+
isMultiKit: true,
|
|
33889
|
+
remainingKits: installedKits.filter((k2) => k2 !== kit)
|
|
33890
|
+
};
|
|
33891
|
+
}
|
|
33892
|
+
const allFiles = getAllTrackedFiles(detection.metadata);
|
|
33893
|
+
return {
|
|
33894
|
+
filesToRemove: allFiles.map((f3) => f3.path),
|
|
33895
|
+
filesToPreserve: USER_CONFIG_PATTERNS,
|
|
33896
|
+
hasManifest: true,
|
|
33897
|
+
isMultiKit: true,
|
|
33898
|
+
remainingKits: []
|
|
33899
|
+
};
|
|
33900
|
+
}
|
|
33901
|
+
if (detection.format === "legacy" && detection.metadata) {
|
|
33902
|
+
const legacyFiles2 = detection.metadata.files?.map((f3) => f3.path) || [];
|
|
33903
|
+
const installedFiles = detection.metadata.installedFiles || [];
|
|
33904
|
+
const hasFiles = legacyFiles2.length > 0 || installedFiles.length > 0;
|
|
33905
|
+
if (!hasFiles) {
|
|
33906
|
+
const legacyDirs2 = ["commands", "agents", "skills", "workflows", "hooks", "scripts"];
|
|
33907
|
+
const legacyFileList = ["metadata.json"];
|
|
33908
|
+
return {
|
|
33909
|
+
filesToRemove: [...legacyDirs2, ...legacyFileList],
|
|
33910
|
+
filesToPreserve: USER_CONFIG_PATTERNS,
|
|
33911
|
+
hasManifest: false,
|
|
33912
|
+
isMultiKit: false,
|
|
33913
|
+
remainingKits: []
|
|
33914
|
+
};
|
|
33915
|
+
}
|
|
33916
|
+
return {
|
|
33917
|
+
filesToRemove: legacyFiles2.length > 0 ? legacyFiles2 : installedFiles,
|
|
33918
|
+
filesToPreserve: detection.metadata.userConfigFiles || USER_CONFIG_PATTERNS,
|
|
33919
|
+
hasManifest: true,
|
|
33920
|
+
isMultiKit: false,
|
|
33921
|
+
remainingKits: []
|
|
33922
|
+
};
|
|
33923
|
+
}
|
|
33924
|
+
const legacyDirs = ["commands", "agents", "skills", "workflows", "hooks", "scripts"];
|
|
33925
|
+
const legacyFiles = ["metadata.json"];
|
|
33926
|
+
return {
|
|
33927
|
+
filesToRemove: [...legacyDirs, ...legacyFiles],
|
|
33928
|
+
filesToPreserve: USER_CONFIG_PATTERNS,
|
|
33929
|
+
hasManifest: false,
|
|
33930
|
+
isMultiKit: false,
|
|
33931
|
+
remainingKits: []
|
|
33932
|
+
};
|
|
33933
|
+
}
|
|
33934
|
+
|
|
33935
|
+
// src/domains/installation/selective-merger.ts
|
|
33936
|
+
init_logger();
|
|
33937
|
+
var import_semver = __toESM(require_semver2(), 1);
|
|
31997
33938
|
|
|
31998
33939
|
class SelectiveMerger {
|
|
31999
33940
|
manifest;
|
|
32000
33941
|
manifestMap;
|
|
33942
|
+
claudeDir = null;
|
|
33943
|
+
installingKit = null;
|
|
32001
33944
|
constructor(manifest) {
|
|
32002
33945
|
this.manifest = manifest;
|
|
32003
33946
|
this.manifestMap = new Map;
|
|
@@ -32007,11 +33950,21 @@ class SelectiveMerger {
|
|
|
32007
33950
|
}
|
|
32008
33951
|
}
|
|
32009
33952
|
}
|
|
33953
|
+
setMultiKitContext(claudeDir, installingKit) {
|
|
33954
|
+
this.claudeDir = claudeDir;
|
|
33955
|
+
this.installingKit = installingKit;
|
|
33956
|
+
}
|
|
32010
33957
|
async shouldCopyFile(destPath, relativePath) {
|
|
32011
33958
|
let destStat;
|
|
32012
33959
|
try {
|
|
32013
33960
|
destStat = await stat6(destPath);
|
|
32014
33961
|
} catch {
|
|
33962
|
+
if (this.claudeDir && this.installingKit) {
|
|
33963
|
+
const installed = await findFileInInstalledKits(this.claudeDir, relativePath, this.installingKit);
|
|
33964
|
+
if (installed.exists) {
|
|
33965
|
+
logger.debug(`File ${relativePath} tracked by ${installed.ownerKit} but missing on disk`);
|
|
33966
|
+
}
|
|
33967
|
+
}
|
|
32015
33968
|
return { changed: true, reason: "new" };
|
|
32016
33969
|
}
|
|
32017
33970
|
const manifestEntry = this.manifestMap.get(relativePath);
|
|
@@ -32019,6 +33972,94 @@ class SelectiveMerger {
|
|
|
32019
33972
|
logger.debug(`No manifest entry for ${relativePath}, will copy`);
|
|
32020
33973
|
return { changed: true, reason: "new" };
|
|
32021
33974
|
}
|
|
33975
|
+
if (this.claudeDir && this.installingKit) {
|
|
33976
|
+
const installed = await findFileInInstalledKits(this.claudeDir, relativePath, this.installingKit);
|
|
33977
|
+
if (installed.exists && installed.checksum && installed.ownerKit) {
|
|
33978
|
+
if (installed.checksum === manifestEntry.checksum) {
|
|
33979
|
+
logger.debug(`Shared identical: ${relativePath} (owned by ${installed.ownerKit})`);
|
|
33980
|
+
return {
|
|
33981
|
+
changed: false,
|
|
33982
|
+
reason: "shared-identical",
|
|
33983
|
+
sourceChecksum: manifestEntry.checksum,
|
|
33984
|
+
destChecksum: installed.checksum,
|
|
33985
|
+
sharedWithKit: installed.ownerKit
|
|
33986
|
+
};
|
|
33987
|
+
}
|
|
33988
|
+
const incomingTimestamp = manifestEntry.lastModified ?? null;
|
|
33989
|
+
const existingTimestamp = installed.sourceTimestamp;
|
|
33990
|
+
const conflictBase = {
|
|
33991
|
+
relativePath,
|
|
33992
|
+
incomingKit: this.installingKit,
|
|
33993
|
+
existingKit: installed.ownerKit,
|
|
33994
|
+
incomingTimestamp,
|
|
33995
|
+
existingTimestamp
|
|
33996
|
+
};
|
|
33997
|
+
if (incomingTimestamp && existingTimestamp) {
|
|
33998
|
+
const incomingTime = new Date(incomingTimestamp).getTime();
|
|
33999
|
+
const existingTime = new Date(existingTimestamp).getTime();
|
|
34000
|
+
if (Number.isNaN(incomingTime) || Number.isNaN(existingTime)) {
|
|
34001
|
+
logger.debug(`Invalid timestamp for ${relativePath}, falling back to version`);
|
|
34002
|
+
} else if (incomingTime > existingTime) {
|
|
34003
|
+
logger.debug(`Shared newer: ${relativePath} - incoming ${incomingTimestamp} > existing ${existingTimestamp}`);
|
|
34004
|
+
return {
|
|
34005
|
+
changed: true,
|
|
34006
|
+
reason: "shared-newer",
|
|
34007
|
+
sourceChecksum: manifestEntry.checksum,
|
|
34008
|
+
destChecksum: installed.checksum,
|
|
34009
|
+
sharedWithKit: installed.ownerKit,
|
|
34010
|
+
conflictInfo: { ...conflictBase, winner: "incoming", reason: "newer" }
|
|
34011
|
+
};
|
|
34012
|
+
} else if (incomingTime < existingTime) {
|
|
34013
|
+
logger.debug(`Shared older: ${relativePath} - incoming ${incomingTimestamp} < existing ${existingTimestamp}`);
|
|
34014
|
+
return {
|
|
34015
|
+
changed: false,
|
|
34016
|
+
reason: "shared-older",
|
|
34017
|
+
sourceChecksum: manifestEntry.checksum,
|
|
34018
|
+
destChecksum: installed.checksum,
|
|
34019
|
+
sharedWithKit: installed.ownerKit,
|
|
34020
|
+
conflictInfo: { ...conflictBase, winner: "existing", reason: "existing-newer" }
|
|
34021
|
+
};
|
|
34022
|
+
} else {
|
|
34023
|
+
logger.debug(`Shared tie: ${relativePath} - same timestamp, keeping existing`);
|
|
34024
|
+
return {
|
|
34025
|
+
changed: false,
|
|
34026
|
+
reason: "shared-older",
|
|
34027
|
+
sourceChecksum: manifestEntry.checksum,
|
|
34028
|
+
destChecksum: installed.checksum,
|
|
34029
|
+
sharedWithKit: installed.ownerKit,
|
|
34030
|
+
conflictInfo: { ...conflictBase, winner: "existing", reason: "tie" }
|
|
34031
|
+
};
|
|
34032
|
+
}
|
|
34033
|
+
} else if (installed.version) {
|
|
34034
|
+
const incomingVersion = this.manifest?.version || "0.0.0";
|
|
34035
|
+
const installedVersion = installed.version;
|
|
34036
|
+
const incomingSemver = import_semver.default.coerce(incomingVersion);
|
|
34037
|
+
const installedSemver = import_semver.default.coerce(installedVersion);
|
|
34038
|
+
if (incomingSemver && installedSemver) {
|
|
34039
|
+
if (import_semver.default.lte(incomingSemver, installedSemver)) {
|
|
34040
|
+
logger.debug(`Shared older (version fallback): ${relativePath} - incoming ${incomingVersion} <= installed ${installedVersion}`);
|
|
34041
|
+
return {
|
|
34042
|
+
changed: false,
|
|
34043
|
+
reason: "shared-older",
|
|
34044
|
+
sourceChecksum: manifestEntry.checksum,
|
|
34045
|
+
destChecksum: installed.checksum,
|
|
34046
|
+
sharedWithKit: installed.ownerKit,
|
|
34047
|
+
conflictInfo: { ...conflictBase, winner: "existing", reason: "no-timestamps" }
|
|
34048
|
+
};
|
|
34049
|
+
}
|
|
34050
|
+
}
|
|
34051
|
+
logger.debug(`Updating shared file (version fallback): ${relativePath} - incoming ${incomingVersion} > installed ${installedVersion}`);
|
|
34052
|
+
return {
|
|
34053
|
+
changed: true,
|
|
34054
|
+
reason: "shared-newer",
|
|
34055
|
+
sourceChecksum: manifestEntry.checksum,
|
|
34056
|
+
destChecksum: installed.checksum,
|
|
34057
|
+
sharedWithKit: installed.ownerKit,
|
|
34058
|
+
conflictInfo: { ...conflictBase, winner: "incoming", reason: "no-timestamps" }
|
|
34059
|
+
};
|
|
34060
|
+
}
|
|
34061
|
+
}
|
|
34062
|
+
}
|
|
32022
34063
|
if (destStat.size !== manifestEntry.size) {
|
|
32023
34064
|
logger.debug(`Size differs for ${relativePath}: ${destStat.size} vs ${manifestEntry.size}`);
|
|
32024
34065
|
return {
|
|
@@ -32055,10 +34096,10 @@ class SelectiveMerger {
|
|
|
32055
34096
|
|
|
32056
34097
|
// src/domains/installation/merger/file-scanner.ts
|
|
32057
34098
|
init_logger();
|
|
32058
|
-
var
|
|
34099
|
+
var import_fs_extra5 = __toESM(require_lib(), 1);
|
|
32059
34100
|
var import_ignore2 = __toESM(require_ignore(), 1);
|
|
32060
34101
|
import { relative as relative5 } from "node:path";
|
|
32061
|
-
import { join as
|
|
34102
|
+
import { join as join36 } from "node:path";
|
|
32062
34103
|
|
|
32063
34104
|
// node_modules/@isaacs/balanced-match/dist/esm/index.js
|
|
32064
34105
|
var balanced = (a3, b3, str) => {
|
|
@@ -33512,12 +35553,12 @@ class FileScanner {
|
|
|
33512
35553
|
}
|
|
33513
35554
|
async getFiles(dir, baseDir = dir) {
|
|
33514
35555
|
const files = [];
|
|
33515
|
-
const entries = await
|
|
35556
|
+
const entries = await import_fs_extra5.readdir(dir, { encoding: "utf8" });
|
|
33516
35557
|
for (const entry of entries) {
|
|
33517
|
-
const fullPath =
|
|
35558
|
+
const fullPath = join36(dir, entry);
|
|
33518
35559
|
const relativePath = relative5(baseDir, fullPath);
|
|
33519
35560
|
const normalizedRelativePath = relativePath.replace(/\\/g, "/");
|
|
33520
|
-
const stats = await
|
|
35561
|
+
const stats = await import_fs_extra5.lstat(fullPath);
|
|
33521
35562
|
if (stats.isSymbolicLink()) {
|
|
33522
35563
|
logger.warning(`Skipping symbolic link: ${normalizedRelativePath}`);
|
|
33523
35564
|
continue;
|
|
@@ -33548,10 +35589,34 @@ class FileScanner {
|
|
|
33548
35589
|
}
|
|
33549
35590
|
|
|
33550
35591
|
// src/domains/config/installed-settings-tracker.ts
|
|
33551
|
-
init_logger();
|
|
33552
35592
|
import { existsSync as existsSync16 } from "node:fs";
|
|
33553
|
-
import { mkdir as mkdir14, readFile as
|
|
33554
|
-
import { dirname as dirname6, join as
|
|
35593
|
+
import { mkdir as mkdir14, readFile as readFile12, writeFile as writeFile9 } from "node:fs/promises";
|
|
35594
|
+
import { dirname as dirname6, join as join37 } from "node:path";
|
|
35595
|
+
|
|
35596
|
+
// src/shared/index.ts
|
|
35597
|
+
init_logger();
|
|
35598
|
+
init_environment();
|
|
35599
|
+
init_terminal_utils();
|
|
35600
|
+
|
|
35601
|
+
// src/shared/command-normalizer.ts
|
|
35602
|
+
function normalizeCommand(cmd) {
|
|
35603
|
+
if (!cmd)
|
|
35604
|
+
return "";
|
|
35605
|
+
let normalized = cmd;
|
|
35606
|
+
normalized = normalized.replace(/"\$HOME"/g, "$HOME");
|
|
35607
|
+
normalized = normalized.replace(/"\$CLAUDE_PROJECT_DIR"/g, "$HOME");
|
|
35608
|
+
normalized = normalized.replace(/"\$\{HOME\}"/g, "$HOME");
|
|
35609
|
+
normalized = normalized.replace(/\$CLAUDE_PROJECT_DIR/g, "$HOME");
|
|
35610
|
+
normalized = normalized.replace(/\$\{HOME\}/g, "$HOME");
|
|
35611
|
+
normalized = normalized.replace(/"%USERPROFILE%"/g, "$HOME");
|
|
35612
|
+
normalized = normalized.replace(/%USERPROFILE%/g, "$HOME");
|
|
35613
|
+
normalized = normalized.replace(/"%CLAUDE_PROJECT_DIR%"/g, "$HOME");
|
|
35614
|
+
normalized = normalized.replace(/%CLAUDE_PROJECT_DIR%/g, "$HOME");
|
|
35615
|
+
normalized = normalized.replace(/\\/g, "/");
|
|
35616
|
+
normalized = normalized.replace(/\s+/g, " ").trim();
|
|
35617
|
+
return normalized;
|
|
35618
|
+
}
|
|
35619
|
+
// src/domains/config/installed-settings-tracker.ts
|
|
33555
35620
|
var CK_JSON_FILE = ".ck.json";
|
|
33556
35621
|
|
|
33557
35622
|
class InstalledSettingsTracker {
|
|
@@ -33565,9 +35630,9 @@ class InstalledSettingsTracker {
|
|
|
33565
35630
|
}
|
|
33566
35631
|
getCkJsonPath() {
|
|
33567
35632
|
if (this.isGlobal) {
|
|
33568
|
-
return
|
|
35633
|
+
return join37(this.projectDir, CK_JSON_FILE);
|
|
33569
35634
|
}
|
|
33570
|
-
return
|
|
35635
|
+
return join37(this.projectDir, ".claude", CK_JSON_FILE);
|
|
33571
35636
|
}
|
|
33572
35637
|
async loadInstalledSettings() {
|
|
33573
35638
|
const ckJsonPath = this.getCkJsonPath();
|
|
@@ -33575,7 +35640,7 @@ class InstalledSettingsTracker {
|
|
|
33575
35640
|
return { hooks: [], mcpServers: [] };
|
|
33576
35641
|
}
|
|
33577
35642
|
try {
|
|
33578
|
-
const content = await
|
|
35643
|
+
const content = await readFile12(ckJsonPath, "utf-8");
|
|
33579
35644
|
const data = JSON.parse(content);
|
|
33580
35645
|
const installed = data.kits?.[this.kitName]?.installedSettings;
|
|
33581
35646
|
if (installed) {
|
|
@@ -33592,7 +35657,7 @@ class InstalledSettingsTracker {
|
|
|
33592
35657
|
try {
|
|
33593
35658
|
let data = {};
|
|
33594
35659
|
if (existsSync16(ckJsonPath)) {
|
|
33595
|
-
const content = await
|
|
35660
|
+
const content = await readFile12(ckJsonPath, "utf-8");
|
|
33596
35661
|
data = JSON.parse(content);
|
|
33597
35662
|
}
|
|
33598
35663
|
if (!data.kits) {
|
|
@@ -33610,7 +35675,8 @@ class InstalledSettingsTracker {
|
|
|
33610
35675
|
}
|
|
33611
35676
|
}
|
|
33612
35677
|
wasHookInstalled(command, installed) {
|
|
33613
|
-
|
|
35678
|
+
const normalizedCommand = normalizeCommand(command);
|
|
35679
|
+
return installed.hooks?.some((hook) => normalizeCommand(hook) === normalizedCommand) ?? false;
|
|
33614
35680
|
}
|
|
33615
35681
|
wasMcpServerInstalled(serverName, installed) {
|
|
33616
35682
|
return installed.mcpServers?.includes(serverName) ?? false;
|
|
@@ -33619,8 +35685,10 @@ class InstalledSettingsTracker {
|
|
|
33619
35685
|
if (!settings.hooks) {
|
|
33620
35686
|
settings.hooks = [];
|
|
33621
35687
|
}
|
|
33622
|
-
|
|
33623
|
-
|
|
35688
|
+
const normalizedCommand = normalizeCommand(command);
|
|
35689
|
+
const alreadyTracked = settings.hooks.some((hook) => normalizeCommand(hook) === normalizedCommand);
|
|
35690
|
+
if (!alreadyTracked) {
|
|
35691
|
+
settings.hooks.push(normalizedCommand);
|
|
33624
35692
|
}
|
|
33625
35693
|
}
|
|
33626
35694
|
trackMcpServer(serverName, settings) {
|
|
@@ -33640,9 +35708,6 @@ class InstalledSettingsTracker {
|
|
|
33640
35708
|
// src/domains/config/merger/merge-engine.ts
|
|
33641
35709
|
init_logger();
|
|
33642
35710
|
|
|
33643
|
-
// src/domains/config/merger/conflict-resolver.ts
|
|
33644
|
-
init_logger();
|
|
33645
|
-
|
|
33646
35711
|
// src/domains/config/merger/diff-calculator.ts
|
|
33647
35712
|
function truncateCommand(cmd, maxLen = 50) {
|
|
33648
35713
|
if (cmd.length <= maxLen)
|
|
@@ -33661,12 +35726,12 @@ function deepCopyEntry(entry) {
|
|
|
33661
35726
|
function extractCommands(entries, commands) {
|
|
33662
35727
|
for (const entry of entries) {
|
|
33663
35728
|
if ("command" in entry && entry.command) {
|
|
33664
|
-
commands.add(entry.command);
|
|
35729
|
+
commands.add(normalizeCommand(entry.command));
|
|
33665
35730
|
}
|
|
33666
35731
|
if ("hooks" in entry && entry.hooks) {
|
|
33667
35732
|
for (const hook of entry.hooks) {
|
|
33668
35733
|
if (hook.command) {
|
|
33669
|
-
commands.add(hook.command);
|
|
35734
|
+
commands.add(normalizeCommand(hook.command));
|
|
33670
35735
|
}
|
|
33671
35736
|
}
|
|
33672
35737
|
}
|
|
@@ -33695,13 +35760,46 @@ function logDuplicates(duplicateCommands, eventName, result) {
|
|
|
33695
35760
|
|
|
33696
35761
|
// src/domains/config/merger/conflict-resolver.ts
|
|
33697
35762
|
function wasCommandInstalled(command, installedHooks) {
|
|
33698
|
-
|
|
35763
|
+
const normalizedCommand = normalizeCommand(command);
|
|
35764
|
+
return installedHooks.some((hook) => normalizeCommand(hook) === normalizedCommand);
|
|
33699
35765
|
}
|
|
33700
|
-
function
|
|
33701
|
-
|
|
33702
|
-
|
|
35766
|
+
function dedupeDestinationEntries(entries) {
|
|
35767
|
+
const seenCommands = new Set;
|
|
35768
|
+
const deduped = [];
|
|
35769
|
+
let removedCount = 0;
|
|
35770
|
+
for (const entry of entries) {
|
|
35771
|
+
const commands = getEntryCommands(entry);
|
|
35772
|
+
if (commands.length === 0) {
|
|
35773
|
+
deduped.push(deepCopyEntry(entry));
|
|
35774
|
+
continue;
|
|
35775
|
+
}
|
|
35776
|
+
const uniqueCommands = commands.filter((cmd) => !seenCommands.has(normalizeCommand(cmd)));
|
|
35777
|
+
if (uniqueCommands.length === 0) {
|
|
35778
|
+
removedCount++;
|
|
35779
|
+
logger.verbose(`Removing duplicate hook entry: ${commands[0]?.slice(0, 50)}...`);
|
|
35780
|
+
continue;
|
|
35781
|
+
}
|
|
35782
|
+
if ("hooks" in entry && entry.hooks && uniqueCommands.length < commands.length) {
|
|
35783
|
+
const filteredHooks = entry.hooks.filter((h2) => !h2.command || !seenCommands.has(normalizeCommand(h2.command)));
|
|
35784
|
+
deduped.push({ ...entry, hooks: filteredHooks });
|
|
35785
|
+
} else {
|
|
35786
|
+
deduped.push(deepCopyEntry(entry));
|
|
35787
|
+
}
|
|
35788
|
+
for (const cmd of commands) {
|
|
35789
|
+
seenCommands.add(normalizeCommand(cmd));
|
|
35790
|
+
}
|
|
35791
|
+
}
|
|
35792
|
+
return { deduped, removedCount };
|
|
35793
|
+
}
|
|
35794
|
+
function mergeHookEntries(sourceEntries, destEntries, eventName, result, installedHooks = [], sourceKit) {
|
|
35795
|
+
const { deduped: dedupedDest, removedCount } = dedupeDestinationEntries(destEntries);
|
|
35796
|
+
if (removedCount > 0) {
|
|
35797
|
+
logger.info(`Cleaned up ${removedCount} duplicate hook(s) from existing settings`);
|
|
33703
35798
|
}
|
|
33704
|
-
|
|
35799
|
+
if (dedupedDest.length > 0) {
|
|
35800
|
+
result.hooksPreserved += dedupedDest.length;
|
|
35801
|
+
}
|
|
35802
|
+
const merged = dedupedDest;
|
|
33705
35803
|
const matcherIndex = new Map;
|
|
33706
35804
|
for (let i = 0;i < merged.length; i++) {
|
|
33707
35805
|
const entry = merged[i];
|
|
@@ -33710,11 +35808,11 @@ function mergeHookEntries(sourceEntries, destEntries, eventName, result, install
|
|
|
33710
35808
|
}
|
|
33711
35809
|
}
|
|
33712
35810
|
const existingCommands = new Set;
|
|
33713
|
-
extractCommands(
|
|
35811
|
+
extractCommands(dedupedDest, existingCommands);
|
|
33714
35812
|
for (const entry of sourceEntries) {
|
|
33715
35813
|
const sourceMatcher = "matcher" in entry ? entry.matcher : undefined;
|
|
33716
35814
|
const commands = getEntryCommands(entry);
|
|
33717
|
-
const userRemovedCommands = commands.filter((cmd) => !existingCommands.has(cmd) && wasCommandInstalled(cmd, installedHooks));
|
|
35815
|
+
const userRemovedCommands = commands.filter((cmd) => !existingCommands.has(normalizeCommand(cmd)) && wasCommandInstalled(cmd, installedHooks));
|
|
33718
35816
|
if (userRemovedCommands.length > 0) {
|
|
33719
35817
|
result.hooksSkipped += userRemovedCommands.length;
|
|
33720
35818
|
for (const cmd of userRemovedCommands) {
|
|
@@ -33729,27 +35827,31 @@ function mergeHookEntries(sourceEntries, destEntries, eventName, result, install
|
|
|
33729
35827
|
if (existingIdx === undefined)
|
|
33730
35828
|
continue;
|
|
33731
35829
|
const existingEntry = merged[existingIdx];
|
|
33732
|
-
const newCommands = commands.filter((cmd) => !existingCommands.has(cmd) && !wasCommandInstalled(cmd, installedHooks));
|
|
33733
|
-
const duplicateCommands = commands.filter((cmd) => existingCommands.has(cmd));
|
|
35830
|
+
const newCommands = commands.filter((cmd) => !existingCommands.has(normalizeCommand(cmd)) && !wasCommandInstalled(cmd, installedHooks));
|
|
35831
|
+
const duplicateCommands = commands.filter((cmd) => existingCommands.has(normalizeCommand(cmd)));
|
|
33734
35832
|
logDuplicates(duplicateCommands, eventName, result);
|
|
33735
35833
|
if (newCommands.length > 0 && "hooks" in entry && entry.hooks) {
|
|
33736
35834
|
if (!existingEntry.hooks) {
|
|
33737
35835
|
existingEntry.hooks = [];
|
|
33738
35836
|
}
|
|
33739
35837
|
for (const hook of entry.hooks) {
|
|
33740
|
-
if (hook.command && !existingCommands.has(hook.command) && !wasCommandInstalled(hook.command, installedHooks)) {
|
|
33741
|
-
|
|
33742
|
-
|
|
35838
|
+
if (hook.command && !existingCommands.has(normalizeCommand(hook.command)) && !wasCommandInstalled(hook.command, installedHooks)) {
|
|
35839
|
+
const taggedHook = sourceKit ? { ...hook, _origin: sourceKit } : hook;
|
|
35840
|
+
existingEntry.hooks.push(taggedHook);
|
|
35841
|
+
existingCommands.add(normalizeCommand(hook.command));
|
|
33743
35842
|
result.newlyInstalledHooks.push(hook.command);
|
|
35843
|
+
if (sourceKit) {
|
|
35844
|
+
trackHookOrigin(result, sourceKit, hook.command);
|
|
35845
|
+
}
|
|
33744
35846
|
}
|
|
33745
35847
|
}
|
|
33746
35848
|
result.hooksAdded++;
|
|
33747
35849
|
}
|
|
33748
35850
|
} else {
|
|
33749
|
-
const isFullyDuplicated = commands.length > 0 && commands.every((cmd) => existingCommands.has(cmd));
|
|
33750
|
-
const duplicateCommands = commands.filter((cmd) => existingCommands.has(cmd));
|
|
35851
|
+
const isFullyDuplicated = commands.length > 0 && commands.every((cmd) => existingCommands.has(normalizeCommand(cmd)));
|
|
35852
|
+
const duplicateCommands = commands.filter((cmd) => existingCommands.has(normalizeCommand(cmd)));
|
|
33751
35853
|
logDuplicates(duplicateCommands, eventName, result);
|
|
33752
|
-
const hasNonRemovedCommands = commands.length === 0 || commands.some((cmd) => !existingCommands.has(cmd) && !wasCommandInstalled(cmd, installedHooks));
|
|
35854
|
+
const hasNonRemovedCommands = commands.length === 0 || commands.some((cmd) => !existingCommands.has(normalizeCommand(cmd)) && !wasCommandInstalled(cmd, installedHooks));
|
|
33753
35855
|
if (!isFullyDuplicated && hasNonRemovedCommands) {
|
|
33754
35856
|
let filteredEntry = entry;
|
|
33755
35857
|
if ("hooks" in entry && entry.hooks && userRemovedCommands.length > 0) {
|
|
@@ -33758,17 +35860,22 @@ function mergeHookEntries(sourceEntries, destEntries, eventName, result, install
|
|
|
33758
35860
|
} else if ("command" in entry && wasCommandInstalled(entry.command, installedHooks)) {
|
|
33759
35861
|
continue;
|
|
33760
35862
|
}
|
|
33761
|
-
|
|
35863
|
+
const taggedEntry = sourceKit ? tagHooksWithOrigin(filteredEntry, sourceKit) : filteredEntry;
|
|
35864
|
+
merged.push(taggedEntry);
|
|
33762
35865
|
result.hooksAdded++;
|
|
33763
35866
|
if (sourceMatcher) {
|
|
33764
35867
|
matcherIndex.set(sourceMatcher, merged.length - 1);
|
|
33765
35868
|
}
|
|
33766
35869
|
for (const cmd of commands) {
|
|
33767
|
-
|
|
33768
|
-
|
|
35870
|
+
const normalizedCmd = normalizeCommand(cmd);
|
|
35871
|
+
if (!existingCommands.has(normalizedCmd) && !wasCommandInstalled(cmd, installedHooks)) {
|
|
35872
|
+
existingCommands.add(normalizedCmd);
|
|
33769
35873
|
result.newlyInstalledHooks.push(cmd);
|
|
33770
|
-
|
|
33771
|
-
|
|
35874
|
+
if (sourceKit) {
|
|
35875
|
+
trackHookOrigin(result, sourceKit, cmd);
|
|
35876
|
+
}
|
|
35877
|
+
} else if (!existingCommands.has(normalizedCmd)) {
|
|
35878
|
+
existingCommands.add(normalizedCmd);
|
|
33772
35879
|
}
|
|
33773
35880
|
}
|
|
33774
35881
|
}
|
|
@@ -33776,14 +35883,32 @@ function mergeHookEntries(sourceEntries, destEntries, eventName, result, install
|
|
|
33776
35883
|
}
|
|
33777
35884
|
return merged;
|
|
33778
35885
|
}
|
|
35886
|
+
function tagHooksWithOrigin(entry, kit) {
|
|
35887
|
+
if ("hooks" in entry && entry.hooks) {
|
|
35888
|
+
return {
|
|
35889
|
+
...entry,
|
|
35890
|
+
hooks: entry.hooks.map((h2) => ({ ...h2, _origin: kit }))
|
|
35891
|
+
};
|
|
35892
|
+
}
|
|
35893
|
+
if ("command" in entry) {
|
|
35894
|
+
return { ...entry, _origin: kit };
|
|
35895
|
+
}
|
|
35896
|
+
return entry;
|
|
35897
|
+
}
|
|
35898
|
+
function trackHookOrigin(result, kit, command) {
|
|
35899
|
+
const existing = result.hooksByOrigin.get(kit) || [];
|
|
35900
|
+
existing.push(command);
|
|
35901
|
+
result.hooksByOrigin.set(kit, existing);
|
|
35902
|
+
}
|
|
33779
35903
|
|
|
33780
35904
|
// src/domains/config/merger/merge-engine.ts
|
|
33781
35905
|
function mergeHooks(sourceHooks, destHooks, result, options) {
|
|
33782
35906
|
const merged = { ...destHooks };
|
|
33783
35907
|
const installedHooks = options?.installedSettings?.hooks ?? [];
|
|
35908
|
+
const sourceKit = options?.sourceKit;
|
|
33784
35909
|
for (const [eventName, sourceEntries] of Object.entries(sourceHooks)) {
|
|
33785
35910
|
const destEntries = destHooks[eventName] || [];
|
|
33786
|
-
merged[eventName] = mergeHookEntries(sourceEntries, destEntries, eventName, result, installedHooks);
|
|
35911
|
+
merged[eventName] = mergeHookEntries(sourceEntries, destEntries, eventName, result, installedHooks, sourceKit);
|
|
33787
35912
|
}
|
|
33788
35913
|
return merged;
|
|
33789
35914
|
}
|
|
@@ -33797,8 +35922,54 @@ function mergeMcp(sourceMcp, destMcp, result, options) {
|
|
|
33797
35922
|
if (sourceMcp.servers) {
|
|
33798
35923
|
const destServers = destMcp.servers || {};
|
|
33799
35924
|
merged.servers = { ...destServers };
|
|
35925
|
+
const sourceTimestamps = options?.sourceTimestamps?.mcpServers ?? {};
|
|
35926
|
+
const destTimestamps = options?.installedSettings?.mcpServerTimestamps ?? {};
|
|
33800
35927
|
for (const [serverName, serverConfig] of Object.entries(sourceMcp.servers)) {
|
|
33801
35928
|
if (serverName in destServers) {
|
|
35929
|
+
const sourceTs = sourceTimestamps[serverName];
|
|
35930
|
+
const destTs = destTimestamps[serverName];
|
|
35931
|
+
if (sourceTs && destTs) {
|
|
35932
|
+
const sourceTime = new Date(sourceTs).getTime();
|
|
35933
|
+
const destTime = new Date(destTs).getTime();
|
|
35934
|
+
if (sourceTime > destTime) {
|
|
35935
|
+
merged.servers[serverName] = serverConfig;
|
|
35936
|
+
result.mcpServersOverwritten = (result.mcpServersOverwritten ?? 0) + 1;
|
|
35937
|
+
result.mcpConflicts = result.mcpConflicts ?? [];
|
|
35938
|
+
result.mcpConflicts.push({
|
|
35939
|
+
serverName,
|
|
35940
|
+
incomingKit: options?.sourceKit ?? "unknown",
|
|
35941
|
+
existingKit: "existing",
|
|
35942
|
+
winner: options?.sourceKit ?? "incoming",
|
|
35943
|
+
reason: "newer"
|
|
35944
|
+
});
|
|
35945
|
+
logger.debug(`Overwrote MCP server (newer): ${serverName}`);
|
|
35946
|
+
continue;
|
|
35947
|
+
}
|
|
35948
|
+
if (sourceTime < destTime) {
|
|
35949
|
+
result.mcpServersPreserved++;
|
|
35950
|
+
result.mcpConflicts = result.mcpConflicts ?? [];
|
|
35951
|
+
result.mcpConflicts.push({
|
|
35952
|
+
serverName,
|
|
35953
|
+
incomingKit: options?.sourceKit ?? "unknown",
|
|
35954
|
+
existingKit: "existing",
|
|
35955
|
+
winner: "existing",
|
|
35956
|
+
reason: "existing-newer"
|
|
35957
|
+
});
|
|
35958
|
+
logger.debug(`Preserved MCP server (existing newer): ${serverName}`);
|
|
35959
|
+
continue;
|
|
35960
|
+
}
|
|
35961
|
+
result.mcpServersPreserved++;
|
|
35962
|
+
result.mcpConflicts = result.mcpConflicts ?? [];
|
|
35963
|
+
result.mcpConflicts.push({
|
|
35964
|
+
serverName,
|
|
35965
|
+
incomingKit: options?.sourceKit ?? "unknown",
|
|
35966
|
+
existingKit: "existing",
|
|
35967
|
+
winner: "existing",
|
|
35968
|
+
reason: "tie"
|
|
35969
|
+
});
|
|
35970
|
+
logger.debug(`Preserved MCP server (tie): ${serverName}`);
|
|
35971
|
+
continue;
|
|
35972
|
+
}
|
|
33802
35973
|
const userModified = JSON.stringify(serverConfig) !== JSON.stringify(destServers[serverName]);
|
|
33803
35974
|
if (userModified) {
|
|
33804
35975
|
result.mcpServersPreserved++;
|
|
@@ -33834,7 +36005,8 @@ function mergeSettings(source, destination, options) {
|
|
|
33834
36005
|
mcpServersSkipped: 0,
|
|
33835
36006
|
conflictsDetected: [],
|
|
33836
36007
|
newlyInstalledHooks: [],
|
|
33837
|
-
newlyInstalledServers: []
|
|
36008
|
+
newlyInstalledServers: [],
|
|
36009
|
+
hooksByOrigin: new Map
|
|
33838
36010
|
};
|
|
33839
36011
|
if (source.hooks) {
|
|
33840
36012
|
result.merged.hooks = mergeHooks(source.hooks, destination.hooks || {}, result, options);
|
|
@@ -33851,15 +36023,15 @@ function mergeSettings(source, destination, options) {
|
|
|
33851
36023
|
}
|
|
33852
36024
|
// src/domains/config/merger/file-io.ts
|
|
33853
36025
|
init_logger();
|
|
33854
|
-
var
|
|
36026
|
+
var import_fs_extra6 = __toESM(require_lib(), 1);
|
|
33855
36027
|
import { randomUUID } from "node:crypto";
|
|
33856
|
-
import { dirname as dirname7, join as
|
|
36028
|
+
import { dirname as dirname7, join as join38 } from "node:path";
|
|
33857
36029
|
async function readSettingsFile(filePath) {
|
|
33858
36030
|
try {
|
|
33859
|
-
if (!await
|
|
36031
|
+
if (!await import_fs_extra6.pathExists(filePath)) {
|
|
33860
36032
|
return null;
|
|
33861
36033
|
}
|
|
33862
|
-
const content = await
|
|
36034
|
+
const content = await import_fs_extra6.readFile(filePath, "utf-8");
|
|
33863
36035
|
const parsed = JSON.parse(content);
|
|
33864
36036
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
33865
36037
|
logger.warning(`Invalid settings file format (expected object): ${filePath}`);
|
|
@@ -33873,14 +36045,14 @@ async function readSettingsFile(filePath) {
|
|
|
33873
36045
|
}
|
|
33874
36046
|
async function atomicWriteFile(filePath, content) {
|
|
33875
36047
|
const dir = dirname7(filePath);
|
|
33876
|
-
const tempPath =
|
|
36048
|
+
const tempPath = join38(dir, `.settings-${randomUUID()}.tmp`);
|
|
33877
36049
|
try {
|
|
33878
|
-
await
|
|
33879
|
-
await
|
|
36050
|
+
await import_fs_extra6.writeFile(tempPath, content, "utf-8");
|
|
36051
|
+
await import_fs_extra6.rename(tempPath, filePath);
|
|
33880
36052
|
} catch (error) {
|
|
33881
36053
|
try {
|
|
33882
|
-
if (await
|
|
33883
|
-
await
|
|
36054
|
+
if (await import_fs_extra6.pathExists(tempPath)) {
|
|
36055
|
+
await import_fs_extra6.unlink(tempPath);
|
|
33884
36056
|
}
|
|
33885
36057
|
} catch {}
|
|
33886
36058
|
throw error;
|
|
@@ -33909,7 +36081,7 @@ class SettingsMerger {
|
|
|
33909
36081
|
// src/domains/installation/merger/settings-processor.ts
|
|
33910
36082
|
init_environment();
|
|
33911
36083
|
init_logger();
|
|
33912
|
-
var
|
|
36084
|
+
var import_fs_extra7 = __toESM(require_lib(), 1);
|
|
33913
36085
|
|
|
33914
36086
|
class SettingsProcessor {
|
|
33915
36087
|
isGlobal = false;
|
|
@@ -33917,6 +36089,7 @@ class SettingsProcessor {
|
|
|
33917
36089
|
projectDir = "";
|
|
33918
36090
|
kitName = "engineer";
|
|
33919
36091
|
tracker = null;
|
|
36092
|
+
installingKit;
|
|
33920
36093
|
setGlobalFlag(isGlobal) {
|
|
33921
36094
|
this.isGlobal = isGlobal;
|
|
33922
36095
|
}
|
|
@@ -33931,6 +36104,9 @@ class SettingsProcessor {
|
|
|
33931
36104
|
this.kitName = kit;
|
|
33932
36105
|
this.initTracker();
|
|
33933
36106
|
}
|
|
36107
|
+
setInstallingKit(kit) {
|
|
36108
|
+
this.installingKit = kit;
|
|
36109
|
+
}
|
|
33934
36110
|
initTracker() {
|
|
33935
36111
|
if (this.projectDir) {
|
|
33936
36112
|
this.tracker = new InstalledSettingsTracker(this.projectDir, this.isGlobal, this.kitName);
|
|
@@ -33938,7 +36114,7 @@ class SettingsProcessor {
|
|
|
33938
36114
|
}
|
|
33939
36115
|
async processSettingsJson(sourceFile, destFile) {
|
|
33940
36116
|
try {
|
|
33941
|
-
const sourceContent = await
|
|
36117
|
+
const sourceContent = await import_fs_extra7.readFile(sourceFile, "utf-8");
|
|
33942
36118
|
let transformedSource = sourceContent;
|
|
33943
36119
|
if (this.isGlobal) {
|
|
33944
36120
|
const homeVar = isWindows() ? '"%USERPROFILE%"' : '"$HOME"';
|
|
@@ -33953,12 +36129,12 @@ class SettingsProcessor {
|
|
|
33953
36129
|
logger.debug(`Transformed .claude/ paths to ${projectDirVar}/.claude/ in settings.json for local installation`);
|
|
33954
36130
|
}
|
|
33955
36131
|
}
|
|
33956
|
-
const destExists = await
|
|
36132
|
+
const destExists = await import_fs_extra7.pathExists(destFile);
|
|
33957
36133
|
if (destExists && !this.forceOverwriteSettings) {
|
|
33958
36134
|
await this.selectiveMergeSettings(transformedSource, destFile);
|
|
33959
36135
|
} else {
|
|
33960
36136
|
const formattedContent = this.formatJsonContent(transformedSource);
|
|
33961
|
-
await
|
|
36137
|
+
await import_fs_extra7.writeFile(destFile, formattedContent, "utf-8");
|
|
33962
36138
|
try {
|
|
33963
36139
|
const parsedSettings = JSON.parse(formattedContent);
|
|
33964
36140
|
if (this.forceOverwriteSettings && destExists) {
|
|
@@ -33972,7 +36148,7 @@ class SettingsProcessor {
|
|
|
33972
36148
|
}
|
|
33973
36149
|
} catch (error) {
|
|
33974
36150
|
logger.error(`Failed to process settings.json: ${error}`);
|
|
33975
|
-
await
|
|
36151
|
+
await import_fs_extra7.copy(sourceFile, destFile, { overwrite: true });
|
|
33976
36152
|
}
|
|
33977
36153
|
}
|
|
33978
36154
|
async selectiveMergeSettings(transformedSourceContent, destFile) {
|
|
@@ -33982,10 +36158,15 @@ class SettingsProcessor {
|
|
|
33982
36158
|
} catch {
|
|
33983
36159
|
logger.warning("Failed to parse source settings.json, falling back to overwrite");
|
|
33984
36160
|
const formattedContent = this.formatJsonContent(transformedSourceContent);
|
|
33985
|
-
await
|
|
36161
|
+
await import_fs_extra7.writeFile(destFile, formattedContent, "utf-8");
|
|
33986
36162
|
return;
|
|
33987
36163
|
}
|
|
33988
|
-
|
|
36164
|
+
let destSettings;
|
|
36165
|
+
if (this.isGlobal) {
|
|
36166
|
+
destSettings = await this.readAndNormalizeGlobalSettings(destFile);
|
|
36167
|
+
} else {
|
|
36168
|
+
destSettings = await SettingsMerger.readSettingsFile(destFile);
|
|
36169
|
+
}
|
|
33989
36170
|
if (!destSettings) {
|
|
33990
36171
|
await SettingsMerger.writeSettingsFile(destFile, sourceSettings);
|
|
33991
36172
|
await this.trackInstalledSettings(sourceSettings);
|
|
@@ -33996,7 +36177,8 @@ class SettingsProcessor {
|
|
|
33996
36177
|
installedSettings = await this.tracker.loadInstalledSettings();
|
|
33997
36178
|
}
|
|
33998
36179
|
const mergeResult = SettingsMerger.merge(sourceSettings, destSettings, {
|
|
33999
|
-
installedSettings
|
|
36180
|
+
installedSettings,
|
|
36181
|
+
sourceKit: this.installingKit
|
|
34000
36182
|
});
|
|
34001
36183
|
logger.verbose("Settings merge details", {
|
|
34002
36184
|
hooksAdded: mergeResult.hooksAdded,
|
|
@@ -34060,6 +36242,25 @@ class SettingsProcessor {
|
|
|
34060
36242
|
return content;
|
|
34061
36243
|
}
|
|
34062
36244
|
}
|
|
36245
|
+
async readAndNormalizeGlobalSettings(destFile) {
|
|
36246
|
+
try {
|
|
36247
|
+
const content = await import_fs_extra7.readFile(destFile, "utf-8");
|
|
36248
|
+
if (!content.trim())
|
|
36249
|
+
return null;
|
|
36250
|
+
const homeVar = isWindows() ? "%USERPROFILE%" : "$HOME";
|
|
36251
|
+
let normalized = content;
|
|
36252
|
+
normalized = normalized.replace(/"\$CLAUDE_PROJECT_DIR"/g, `"${homeVar}"`);
|
|
36253
|
+
normalized = normalized.replace(/\$CLAUDE_PROJECT_DIR/g, homeVar);
|
|
36254
|
+
normalized = normalized.replace(/"%CLAUDE_PROJECT_DIR%"/g, `"${homeVar}"`);
|
|
36255
|
+
normalized = normalized.replace(/%CLAUDE_PROJECT_DIR%/g, homeVar);
|
|
36256
|
+
if (normalized !== content) {
|
|
36257
|
+
logger.debug("Normalized $CLAUDE_PROJECT_DIR paths to $HOME in existing global settings");
|
|
36258
|
+
}
|
|
36259
|
+
return JSON.parse(normalized);
|
|
36260
|
+
} catch {
|
|
36261
|
+
return null;
|
|
36262
|
+
}
|
|
36263
|
+
}
|
|
34063
36264
|
transformClaudePaths(content, prefix) {
|
|
34064
36265
|
if (/\.claude\/[^\s"']*[;`$&|><]/.test(content)) {
|
|
34065
36266
|
logger.warning("Potentially unsafe characters detected in .claude/ paths");
|
|
@@ -34084,13 +36285,22 @@ class CopyExecutor {
|
|
|
34084
36285
|
settingsProcessor;
|
|
34085
36286
|
selectiveMerger = null;
|
|
34086
36287
|
unchangedSkipped = 0;
|
|
36288
|
+
sharedSkipped = 0;
|
|
34087
36289
|
installedFiles = new Set;
|
|
34088
36290
|
installedDirectories = new Set;
|
|
36291
|
+
fileConflicts = [];
|
|
36292
|
+
claudeDir = null;
|
|
36293
|
+
installingKit = null;
|
|
34089
36294
|
constructor(neverCopyPatterns) {
|
|
34090
36295
|
this.userConfigChecker = import_ignore3.default().add(USER_CONFIG_PATTERNS);
|
|
34091
36296
|
this.fileScanner = new FileScanner(neverCopyPatterns);
|
|
34092
36297
|
this.settingsProcessor = new SettingsProcessor;
|
|
34093
36298
|
}
|
|
36299
|
+
setMultiKitContext(claudeDir, installingKit) {
|
|
36300
|
+
this.claudeDir = claudeDir;
|
|
36301
|
+
this.installingKit = installingKit;
|
|
36302
|
+
this.settingsProcessor.setInstallingKit(installingKit);
|
|
36303
|
+
}
|
|
34094
36304
|
setIncludePatterns(patterns) {
|
|
34095
36305
|
this.fileScanner.setIncludePatterns(patterns);
|
|
34096
36306
|
}
|
|
@@ -34109,6 +36319,9 @@ class CopyExecutor {
|
|
|
34109
36319
|
setManifest(manifest) {
|
|
34110
36320
|
this.selectiveMerger = manifest ? new SelectiveMerger(manifest) : null;
|
|
34111
36321
|
if (manifest && this.selectiveMerger?.hasManifest()) {
|
|
36322
|
+
if (this.claudeDir && this.installingKit) {
|
|
36323
|
+
this.selectiveMerger.setMultiKitContext(this.claudeDir, this.installingKit);
|
|
36324
|
+
}
|
|
34112
36325
|
logger.debug(`Selective merge enabled with ${this.selectiveMerger.getManifestFileCount()} tracked files`);
|
|
34113
36326
|
}
|
|
34114
36327
|
}
|
|
@@ -34124,8 +36337,8 @@ class CopyExecutor {
|
|
|
34124
36337
|
for (const file of files) {
|
|
34125
36338
|
const relativePath = relative6(sourceDir, file);
|
|
34126
36339
|
const normalizedRelativePath = relativePath.replace(/\\/g, "/");
|
|
34127
|
-
const destPath =
|
|
34128
|
-
if (await
|
|
36340
|
+
const destPath = join39(destDir, relativePath);
|
|
36341
|
+
if (await import_fs_extra8.pathExists(destPath)) {
|
|
34129
36342
|
if (this.fileScanner.shouldNeverCopy(normalizedRelativePath)) {
|
|
34130
36343
|
logger.debug(`Security-sensitive file exists but won't be overwritten: ${normalizedRelativePath}`);
|
|
34131
36344
|
continue;
|
|
@@ -34146,14 +36359,14 @@ class CopyExecutor {
|
|
|
34146
36359
|
for (const file of files) {
|
|
34147
36360
|
const relativePath = relative6(sourceDir, file);
|
|
34148
36361
|
const normalizedRelativePath = relativePath.replace(/\\/g, "/");
|
|
34149
|
-
const destPath =
|
|
36362
|
+
const destPath = join39(destDir, relativePath);
|
|
34150
36363
|
if (this.fileScanner.shouldNeverCopy(normalizedRelativePath)) {
|
|
34151
36364
|
logger.debug(`Skipping security-sensitive file: ${normalizedRelativePath}`);
|
|
34152
36365
|
skippedCount++;
|
|
34153
36366
|
continue;
|
|
34154
36367
|
}
|
|
34155
36368
|
if (this.userConfigChecker.ignores(normalizedRelativePath)) {
|
|
34156
|
-
const fileExists = await
|
|
36369
|
+
const fileExists = await import_fs_extra8.pathExists(destPath);
|
|
34157
36370
|
if (fileExists) {
|
|
34158
36371
|
logger.debug(`Preserving user config: ${normalizedRelativePath}`);
|
|
34159
36372
|
skippedCount++;
|
|
@@ -34169,19 +36382,36 @@ class CopyExecutor {
|
|
|
34169
36382
|
}
|
|
34170
36383
|
if (this.selectiveMerger?.hasManifest()) {
|
|
34171
36384
|
const compareResult = await this.selectiveMerger.shouldCopyFile(destPath, normalizedRelativePath);
|
|
36385
|
+
if (compareResult.conflictInfo) {
|
|
36386
|
+
this.fileConflicts.push(compareResult.conflictInfo);
|
|
36387
|
+
}
|
|
34172
36388
|
if (!compareResult.changed) {
|
|
34173
|
-
|
|
34174
|
-
|
|
36389
|
+
if (compareResult.reason === "shared-identical" || compareResult.reason === "shared-older") {
|
|
36390
|
+
logger.debug(`Preserving shared file: ${normalizedRelativePath} (${compareResult.reason})`);
|
|
36391
|
+
this.sharedSkipped++;
|
|
36392
|
+
} else {
|
|
36393
|
+
logger.debug(`Skipping unchanged: ${normalizedRelativePath}`);
|
|
36394
|
+
this.unchangedSkipped++;
|
|
36395
|
+
}
|
|
34175
36396
|
this.trackInstalledFile(normalizedRelativePath);
|
|
34176
36397
|
continue;
|
|
34177
36398
|
}
|
|
34178
36399
|
}
|
|
34179
|
-
await
|
|
36400
|
+
await import_fs_extra8.copy(file, destPath, { overwrite: true });
|
|
34180
36401
|
this.trackInstalledFile(normalizedRelativePath);
|
|
34181
36402
|
copiedCount++;
|
|
34182
36403
|
}
|
|
34183
|
-
|
|
34184
|
-
|
|
36404
|
+
const parts = [];
|
|
36405
|
+
if (copiedCount > 0)
|
|
36406
|
+
parts.push(`Updated ${copiedCount} file(s)`);
|
|
36407
|
+
if (this.unchangedSkipped > 0)
|
|
36408
|
+
parts.push(`skipped ${this.unchangedSkipped} unchanged`);
|
|
36409
|
+
if (this.sharedSkipped > 0)
|
|
36410
|
+
parts.push(`preserved ${this.sharedSkipped} shared`);
|
|
36411
|
+
if (skippedCount > 0)
|
|
36412
|
+
parts.push(`skipped ${skippedCount} protected`);
|
|
36413
|
+
if (parts.length > 0) {
|
|
36414
|
+
logger.success(parts.join(", "));
|
|
34185
36415
|
} else {
|
|
34186
36416
|
logger.success(`Copied ${copiedCount} file(s), skipped ${skippedCount} protected file(s)`);
|
|
34187
36417
|
}
|
|
@@ -34201,6 +36431,9 @@ class CopyExecutor {
|
|
|
34201
36431
|
getAllInstalledFiles() {
|
|
34202
36432
|
return Array.from(this.installedFiles).sort();
|
|
34203
36433
|
}
|
|
36434
|
+
getFileConflicts() {
|
|
36435
|
+
return this.fileConflicts;
|
|
36436
|
+
}
|
|
34204
36437
|
trackInstalledFile(relativePath) {
|
|
34205
36438
|
this.installedFiles.add(relativePath);
|
|
34206
36439
|
let dir = dirname8(relativePath);
|
|
@@ -34235,6 +36468,9 @@ class FileMerger {
|
|
|
34235
36468
|
setManifest(manifest) {
|
|
34236
36469
|
this.copyExecutor.setManifest(manifest);
|
|
34237
36470
|
}
|
|
36471
|
+
setMultiKitContext(claudeDir, installingKit) {
|
|
36472
|
+
this.copyExecutor.setMultiKitContext(claudeDir, installingKit);
|
|
36473
|
+
}
|
|
34238
36474
|
async merge(sourceDir, destDir, skipConfirmation = false) {
|
|
34239
36475
|
const conflicts = await this.copyExecutor.detectConflicts(sourceDir, destDir);
|
|
34240
36476
|
if (conflicts.length > 0 && !skipConfirmation) {
|
|
@@ -34261,119 +36497,14 @@ class FileMerger {
|
|
|
34261
36497
|
getAllInstalledFiles() {
|
|
34262
36498
|
return this.copyExecutor.getAllInstalledFiles();
|
|
34263
36499
|
}
|
|
36500
|
+
getFileConflicts() {
|
|
36501
|
+
return this.copyExecutor.getFileConflicts();
|
|
36502
|
+
}
|
|
34264
36503
|
}
|
|
34265
36504
|
|
|
34266
36505
|
// src/domains/migration/legacy-migration.ts
|
|
34267
36506
|
import { readdir as readdir9, stat as stat7 } from "node:fs/promises";
|
|
34268
36507
|
import { join as join43, relative as relative7 } from "node:path";
|
|
34269
|
-
|
|
34270
|
-
// src/services/file-operations/manifest/manifest-reader.ts
|
|
34271
|
-
import { join as join39 } from "node:path";
|
|
34272
|
-
init_logger();
|
|
34273
|
-
init_types2();
|
|
34274
|
-
var import_fs_extra8 = __toESM(require_lib(), 1);
|
|
34275
|
-
async function readManifest(claudeDir) {
|
|
34276
|
-
const metadataPath = join39(claudeDir, "metadata.json");
|
|
34277
|
-
if (!await import_fs_extra8.pathExists(metadataPath)) {
|
|
34278
|
-
return null;
|
|
34279
|
-
}
|
|
34280
|
-
try {
|
|
34281
|
-
const content = await import_fs_extra8.readFile(metadataPath, "utf-8");
|
|
34282
|
-
const parsed = JSON.parse(content);
|
|
34283
|
-
return MetadataSchema.parse(parsed);
|
|
34284
|
-
} catch (error) {
|
|
34285
|
-
logger.debug(`Failed to read manifest: ${error}`);
|
|
34286
|
-
return null;
|
|
34287
|
-
}
|
|
34288
|
-
}
|
|
34289
|
-
async function readKitManifest(claudeDir, kit) {
|
|
34290
|
-
const metadata = await readManifest(claudeDir);
|
|
34291
|
-
if (!metadata)
|
|
34292
|
-
return null;
|
|
34293
|
-
return getKitMetadata(metadata, kit);
|
|
34294
|
-
}
|
|
34295
|
-
async function getUninstallManifest(claudeDir, kit) {
|
|
34296
|
-
const detection = await detectMetadataFormat(claudeDir);
|
|
34297
|
-
if (detection.format === "multi-kit" && detection.metadata?.kits) {
|
|
34298
|
-
const installedKits = Object.keys(detection.metadata.kits);
|
|
34299
|
-
if (kit) {
|
|
34300
|
-
const kitMeta = detection.metadata.kits[kit];
|
|
34301
|
-
if (!kitMeta?.files) {
|
|
34302
|
-
return {
|
|
34303
|
-
filesToRemove: [],
|
|
34304
|
-
filesToPreserve: USER_CONFIG_PATTERNS,
|
|
34305
|
-
hasManifest: true,
|
|
34306
|
-
isMultiKit: true,
|
|
34307
|
-
remainingKits: installedKits.filter((k2) => k2 !== kit)
|
|
34308
|
-
};
|
|
34309
|
-
}
|
|
34310
|
-
const kitFiles = kitMeta.files.map((f3) => f3.path);
|
|
34311
|
-
const sharedFiles = new Set;
|
|
34312
|
-
for (const otherKit of installedKits) {
|
|
34313
|
-
if (otherKit !== kit) {
|
|
34314
|
-
const otherMeta = detection.metadata.kits[otherKit];
|
|
34315
|
-
if (otherMeta?.files) {
|
|
34316
|
-
for (const f3 of otherMeta.files) {
|
|
34317
|
-
sharedFiles.add(f3.path);
|
|
34318
|
-
}
|
|
34319
|
-
}
|
|
34320
|
-
}
|
|
34321
|
-
}
|
|
34322
|
-
const filesToRemove = kitFiles.filter((f3) => !sharedFiles.has(f3));
|
|
34323
|
-
const filesToPreserve = [
|
|
34324
|
-
...USER_CONFIG_PATTERNS,
|
|
34325
|
-
...kitFiles.filter((f3) => sharedFiles.has(f3))
|
|
34326
|
-
];
|
|
34327
|
-
return {
|
|
34328
|
-
filesToRemove,
|
|
34329
|
-
filesToPreserve,
|
|
34330
|
-
hasManifest: true,
|
|
34331
|
-
isMultiKit: true,
|
|
34332
|
-
remainingKits: installedKits.filter((k2) => k2 !== kit)
|
|
34333
|
-
};
|
|
34334
|
-
}
|
|
34335
|
-
const allFiles = getAllTrackedFiles(detection.metadata);
|
|
34336
|
-
return {
|
|
34337
|
-
filesToRemove: allFiles.map((f3) => f3.path),
|
|
34338
|
-
filesToPreserve: USER_CONFIG_PATTERNS,
|
|
34339
|
-
hasManifest: true,
|
|
34340
|
-
isMultiKit: true,
|
|
34341
|
-
remainingKits: []
|
|
34342
|
-
};
|
|
34343
|
-
}
|
|
34344
|
-
if (detection.format === "legacy" && detection.metadata) {
|
|
34345
|
-
const legacyFiles2 = detection.metadata.files?.map((f3) => f3.path) || [];
|
|
34346
|
-
const installedFiles = detection.metadata.installedFiles || [];
|
|
34347
|
-
const hasFiles = legacyFiles2.length > 0 || installedFiles.length > 0;
|
|
34348
|
-
if (!hasFiles) {
|
|
34349
|
-
const legacyDirs2 = ["commands", "agents", "skills", "workflows", "hooks", "scripts"];
|
|
34350
|
-
const legacyFileList = ["metadata.json"];
|
|
34351
|
-
return {
|
|
34352
|
-
filesToRemove: [...legacyDirs2, ...legacyFileList],
|
|
34353
|
-
filesToPreserve: USER_CONFIG_PATTERNS,
|
|
34354
|
-
hasManifest: false,
|
|
34355
|
-
isMultiKit: false,
|
|
34356
|
-
remainingKits: []
|
|
34357
|
-
};
|
|
34358
|
-
}
|
|
34359
|
-
return {
|
|
34360
|
-
filesToRemove: legacyFiles2.length > 0 ? legacyFiles2 : installedFiles,
|
|
34361
|
-
filesToPreserve: detection.metadata.userConfigFiles || USER_CONFIG_PATTERNS,
|
|
34362
|
-
hasManifest: true,
|
|
34363
|
-
isMultiKit: false,
|
|
34364
|
-
remainingKits: []
|
|
34365
|
-
};
|
|
34366
|
-
}
|
|
34367
|
-
const legacyDirs = ["commands", "agents", "skills", "workflows", "hooks", "scripts"];
|
|
34368
|
-
const legacyFiles = ["metadata.json"];
|
|
34369
|
-
return {
|
|
34370
|
-
filesToRemove: [...legacyDirs, ...legacyFiles],
|
|
34371
|
-
filesToPreserve: USER_CONFIG_PATTERNS,
|
|
34372
|
-
hasManifest: false,
|
|
34373
|
-
isMultiKit: false,
|
|
34374
|
-
remainingKits: []
|
|
34375
|
-
};
|
|
34376
|
-
}
|
|
34377
36508
|
// src/services/file-operations/manifest/manifest-tracker.ts
|
|
34378
36509
|
import { join as join42 } from "node:path";
|
|
34379
36510
|
|
|
@@ -34385,7 +36516,8 @@ import { join as join40 } from "node:path";
|
|
|
34385
36516
|
var ReleaseManifestFileSchema = exports_external.object({
|
|
34386
36517
|
path: exports_external.string(),
|
|
34387
36518
|
checksum: exports_external.string().regex(/^[a-f0-9]{64}$/),
|
|
34388
|
-
size: exports_external.number()
|
|
36519
|
+
size: exports_external.number(),
|
|
36520
|
+
lastModified: exports_external.string().datetime({ offset: true }).optional()
|
|
34389
36521
|
});
|
|
34390
36522
|
var ReleaseManifestSchema = exports_external.object({
|
|
34391
36523
|
version: exports_external.string(),
|
|
@@ -34593,15 +36725,17 @@ async function writeManifest(claudeDir, kitName, version, scope, kitType, tracke
|
|
|
34593
36725
|
installedAt,
|
|
34594
36726
|
files: trackedFiles.length > 0 ? trackedFiles : undefined
|
|
34595
36727
|
};
|
|
36728
|
+
const existingKits = existingMetadata.kits || {};
|
|
36729
|
+
const otherKitsExist = Object.keys(existingKits).some((k2) => k2 !== kit);
|
|
34596
36730
|
const metadata = {
|
|
34597
36731
|
kits: {
|
|
34598
|
-
...
|
|
36732
|
+
...existingKits,
|
|
34599
36733
|
[kit]: kitMetadata
|
|
34600
36734
|
},
|
|
34601
36735
|
scope,
|
|
34602
|
-
name: kitName,
|
|
34603
|
-
version,
|
|
34604
|
-
installedAt,
|
|
36736
|
+
name: otherKitsExist ? existingMetadata.name ?? kitName : kitName,
|
|
36737
|
+
version: otherKitsExist ? existingMetadata.version ?? version : version,
|
|
36738
|
+
installedAt: otherKitsExist ? existingMetadata.installedAt ?? installedAt : installedAt,
|
|
34605
36739
|
userConfigFiles: [...USER_CONFIG_PATTERNS, ...userConfigFiles]
|
|
34606
36740
|
};
|
|
34607
36741
|
const validated = MetadataSchema.parse(metadata);
|
|
@@ -34672,14 +36806,16 @@ class ManifestTracker {
|
|
|
34672
36806
|
getUserConfigFiles() {
|
|
34673
36807
|
return Array.from(this.userConfigFiles).sort();
|
|
34674
36808
|
}
|
|
34675
|
-
async addTrackedFile(filePath, relativePath, ownership, installedVersion) {
|
|
36809
|
+
async addTrackedFile(filePath, relativePath, ownership, installedVersion, sourceTimestamp) {
|
|
34676
36810
|
const checksum = await OwnershipChecker.calculateChecksum(filePath);
|
|
34677
36811
|
const normalized = relativePath.replace(/\\/g, "/");
|
|
34678
36812
|
this.trackedFiles.set(normalized, {
|
|
34679
36813
|
path: normalized,
|
|
34680
36814
|
checksum,
|
|
34681
36815
|
ownership,
|
|
34682
|
-
installedVersion
|
|
36816
|
+
installedVersion,
|
|
36817
|
+
sourceTimestamp,
|
|
36818
|
+
installedAt: new Date().toISOString()
|
|
34683
36819
|
});
|
|
34684
36820
|
this.installedFiles.add(normalized);
|
|
34685
36821
|
}
|
|
@@ -34695,7 +36831,9 @@ class ManifestTracker {
|
|
|
34695
36831
|
path: normalized,
|
|
34696
36832
|
checksum,
|
|
34697
36833
|
ownership: file.ownership,
|
|
34698
|
-
installedVersion: file.installedVersion
|
|
36834
|
+
installedVersion: file.installedVersion,
|
|
36835
|
+
sourceTimestamp: file.sourceTimestamp,
|
|
36836
|
+
installedAt: new Date().toISOString()
|
|
34699
36837
|
});
|
|
34700
36838
|
this.installedFiles.add(normalized);
|
|
34701
36839
|
return true;
|
|
@@ -34748,7 +36886,8 @@ function buildFileTrackingList(options) {
|
|
|
34748
36886
|
filePath,
|
|
34749
36887
|
relativePath,
|
|
34750
36888
|
ownership,
|
|
34751
|
-
installedVersion
|
|
36889
|
+
installedVersion,
|
|
36890
|
+
sourceTimestamp: manifestEntry?.lastModified
|
|
34752
36891
|
});
|
|
34753
36892
|
}
|
|
34754
36893
|
return filesToTrack;
|
|
@@ -34974,6 +37113,101 @@ User-created files (sample):`);
|
|
|
34974
37113
|
}
|
|
34975
37114
|
}
|
|
34976
37115
|
|
|
37116
|
+
// src/domains/ui/conflict-summary.ts
|
|
37117
|
+
init_logger();
|
|
37118
|
+
var import_picocolors17 = __toESM(require_picocolors(), 1);
|
|
37119
|
+
function displayConflictSummary(summary) {
|
|
37120
|
+
const totalUpdated = summary.files.updated.length + summary.hooks.updated.length + summary.mcp.updated.length;
|
|
37121
|
+
const totalKept = summary.files.kept.length + summary.hooks.kept.length + summary.mcp.kept.length;
|
|
37122
|
+
if (totalUpdated === 0 && totalKept === 0) {
|
|
37123
|
+
logger.verbose("No conflicts detected during installation");
|
|
37124
|
+
return;
|
|
37125
|
+
}
|
|
37126
|
+
console.log();
|
|
37127
|
+
console.log(import_picocolors17.default.bold("Dual-Kit Conflict Resolution"));
|
|
37128
|
+
console.log(import_picocolors17.default.dim("─".repeat(40)));
|
|
37129
|
+
if (summary.files.updated.length > 0 || summary.files.kept.length > 0) {
|
|
37130
|
+
const updated = summary.files.updated.length;
|
|
37131
|
+
const kept = summary.files.kept.length;
|
|
37132
|
+
const winners = formatWinners(summary.files.updated);
|
|
37133
|
+
console.log(` Files: ${import_picocolors17.default.green(`${updated} updated`)}${winners}, ${import_picocolors17.default.dim(`${kept} kept`)}`);
|
|
37134
|
+
}
|
|
37135
|
+
if (summary.hooks.updated.length > 0 || summary.hooks.kept.length > 0) {
|
|
37136
|
+
const updated = summary.hooks.updated.length;
|
|
37137
|
+
const kept = summary.hooks.kept.length;
|
|
37138
|
+
const winners = formatHookWinners(summary.hooks.updated);
|
|
37139
|
+
console.log(` Hooks: ${import_picocolors17.default.green(`${updated} updated`)}${winners}, ${import_picocolors17.default.dim(`${kept} kept`)}`);
|
|
37140
|
+
}
|
|
37141
|
+
if (summary.mcp.updated.length > 0 || summary.mcp.kept.length > 0) {
|
|
37142
|
+
const updated = summary.mcp.updated.length;
|
|
37143
|
+
const kept = summary.mcp.kept.length;
|
|
37144
|
+
const winners = formatMcpWinners(summary.mcp.updated);
|
|
37145
|
+
console.log(` MCP: ${import_picocolors17.default.green(`${updated} updated`)}${winners}, ${import_picocolors17.default.dim(`${kept} kept`)}`);
|
|
37146
|
+
}
|
|
37147
|
+
if (logger.isVerbose() && totalUpdated > 0) {
|
|
37148
|
+
console.log();
|
|
37149
|
+
console.log(import_picocolors17.default.dim("Details:"));
|
|
37150
|
+
for (const file of summary.files.updated) {
|
|
37151
|
+
console.log(` ${import_picocolors17.default.dim("-")} ${file.relativePath}: ${import_picocolors17.default.green(file.winner)} won`);
|
|
37152
|
+
}
|
|
37153
|
+
for (const hook of summary.hooks.updated) {
|
|
37154
|
+
const shortCmd = hook.command.length > 40 ? `${hook.command.slice(0, 40)}...` : hook.command;
|
|
37155
|
+
console.log(` ${import_picocolors17.default.dim("-")} hook: ${shortCmd} → ${import_picocolors17.default.green(hook.winner)}`);
|
|
37156
|
+
}
|
|
37157
|
+
for (const mcp of summary.mcp.updated) {
|
|
37158
|
+
console.log(` ${import_picocolors17.default.dim("-")} mcp: ${mcp.serverName} → ${import_picocolors17.default.green(mcp.winner)}`);
|
|
37159
|
+
}
|
|
37160
|
+
}
|
|
37161
|
+
console.log();
|
|
37162
|
+
}
|
|
37163
|
+
function formatWinners(items) {
|
|
37164
|
+
const counts = new Map;
|
|
37165
|
+
for (const item of items) {
|
|
37166
|
+
const kit = item.winner === "incoming" ? item.incomingKit : item.existingKit;
|
|
37167
|
+
counts.set(kit, (counts.get(kit) ?? 0) + 1);
|
|
37168
|
+
}
|
|
37169
|
+
if (counts.size === 0)
|
|
37170
|
+
return "";
|
|
37171
|
+
const parts = Array.from(counts.entries()).map(([kit, count]) => `${kit}: ${count}`);
|
|
37172
|
+
return import_picocolors17.default.dim(` (${parts.join(", ")})`);
|
|
37173
|
+
}
|
|
37174
|
+
function formatHookWinners(items) {
|
|
37175
|
+
const counts = new Map;
|
|
37176
|
+
for (const item of items) {
|
|
37177
|
+
counts.set(item.winner, (counts.get(item.winner) ?? 0) + 1);
|
|
37178
|
+
}
|
|
37179
|
+
if (counts.size === 0)
|
|
37180
|
+
return "";
|
|
37181
|
+
const parts = Array.from(counts.entries()).map(([kit, count]) => `${kit}: ${count}`);
|
|
37182
|
+
return import_picocolors17.default.dim(` (${parts.join(", ")})`);
|
|
37183
|
+
}
|
|
37184
|
+
function formatMcpWinners(items) {
|
|
37185
|
+
const counts = new Map;
|
|
37186
|
+
for (const item of items) {
|
|
37187
|
+
counts.set(item.winner, (counts.get(item.winner) ?? 0) + 1);
|
|
37188
|
+
}
|
|
37189
|
+
if (counts.size === 0)
|
|
37190
|
+
return "";
|
|
37191
|
+
const parts = Array.from(counts.entries()).map(([kit, count]) => `${kit}: ${count}`);
|
|
37192
|
+
return import_picocolors17.default.dim(` (${parts.join(", ")})`);
|
|
37193
|
+
}
|
|
37194
|
+
function buildConflictSummary(fileConflicts, hookConflicts, mcpConflicts) {
|
|
37195
|
+
return {
|
|
37196
|
+
files: {
|
|
37197
|
+
updated: fileConflicts.filter((c2) => c2.winner === "incoming"),
|
|
37198
|
+
kept: fileConflicts.filter((c2) => c2.winner === "existing")
|
|
37199
|
+
},
|
|
37200
|
+
hooks: {
|
|
37201
|
+
updated: hookConflicts.filter((c2) => c2.winner !== "existing"),
|
|
37202
|
+
kept: hookConflicts.filter((c2) => c2.winner === "existing")
|
|
37203
|
+
},
|
|
37204
|
+
mcp: {
|
|
37205
|
+
updated: mcpConflicts.filter((c2) => c2.winner !== "existing"),
|
|
37206
|
+
kept: mcpConflicts.filter((c2) => c2.winner === "existing")
|
|
37207
|
+
}
|
|
37208
|
+
};
|
|
37209
|
+
}
|
|
37210
|
+
|
|
34977
37211
|
// src/services/file-operations/file-scanner.ts
|
|
34978
37212
|
import { join as join44, relative as relative8, resolve as resolve6 } from "node:path";
|
|
34979
37213
|
init_logger();
|
|
@@ -35440,6 +37674,9 @@ async function handleMerge(ctx) {
|
|
|
35440
37674
|
merger.setForceOverwriteSettings(ctx.options.forceOverwriteSettings);
|
|
35441
37675
|
merger.setProjectDir(ctx.resolvedDir);
|
|
35442
37676
|
merger.setKitName(ctx.kit.name);
|
|
37677
|
+
if (ctx.kitType) {
|
|
37678
|
+
merger.setMultiKitContext(ctx.claudeDir, ctx.kitType);
|
|
37679
|
+
}
|
|
35443
37680
|
const releaseManifest = await ReleaseManifestLoader.load(ctx.extractDir);
|
|
35444
37681
|
if (releaseManifest) {
|
|
35445
37682
|
merger.setManifest(releaseManifest);
|
|
@@ -35466,6 +37703,11 @@ async function handleMerge(ctx) {
|
|
|
35466
37703
|
}
|
|
35467
37704
|
const sourceDir = ctx.options.global ? join48(ctx.extractDir, ".claude") : ctx.extractDir;
|
|
35468
37705
|
await merger.merge(sourceDir, ctx.resolvedDir, ctx.isNonInteractive);
|
|
37706
|
+
const fileConflicts = merger.getFileConflicts();
|
|
37707
|
+
if (fileConflicts.length > 0 && !ctx.isNonInteractive) {
|
|
37708
|
+
const summary = buildConflictSummary(fileConflicts, [], []);
|
|
37709
|
+
displayConflictSummary(summary);
|
|
37710
|
+
}
|
|
35469
37711
|
const installedFiles = merger.getAllInstalledFiles();
|
|
35470
37712
|
const filesToTrack = buildFileTrackingList({
|
|
35471
37713
|
installedFiles,
|
|
@@ -37379,6 +39621,38 @@ async function handleSelection(ctx) {
|
|
|
37379
39621
|
return { ...ctx, cancelled: true };
|
|
37380
39622
|
}
|
|
37381
39623
|
}
|
|
39624
|
+
if (!ctx.options.fresh) {
|
|
39625
|
+
const prefix = PathResolver.getPathPrefix(ctx.options.global);
|
|
39626
|
+
const claudeDir = prefix ? join62(resolvedDir, prefix) : resolvedDir;
|
|
39627
|
+
try {
|
|
39628
|
+
const existingMetadata = await readManifest(claudeDir);
|
|
39629
|
+
if (existingMetadata?.kits) {
|
|
39630
|
+
const existingKitTypes = Object.keys(existingMetadata.kits);
|
|
39631
|
+
const otherKits = existingKitTypes.filter((k2) => k2 !== kitType);
|
|
39632
|
+
if (otherKits.length > 0) {
|
|
39633
|
+
const existingKitsDisplay = otherKits.map((k2) => `${k2}@${existingMetadata.kits?.[k2]?.version || "unknown"}`).join(", ");
|
|
39634
|
+
if (!ctx.options.yes && !ctx.isNonInteractive) {
|
|
39635
|
+
try {
|
|
39636
|
+
const confirmAdd = await ctx.prompts.confirm(`${existingKitsDisplay} already installed. Add ${kit.name} alongside?`);
|
|
39637
|
+
if (!confirmAdd) {
|
|
39638
|
+
logger.warning("Multi-kit installation cancelled by user");
|
|
39639
|
+
return { ...ctx, cancelled: true };
|
|
39640
|
+
}
|
|
39641
|
+
logger.info(`Adding ${kit.name} alongside existing kit(s)`);
|
|
39642
|
+
} catch {
|
|
39643
|
+
logger.warning("Prompt cancelled or interrupted");
|
|
39644
|
+
return { ...ctx, cancelled: true };
|
|
39645
|
+
}
|
|
39646
|
+
} else {
|
|
39647
|
+
const reason = ctx.options.yes ? "(--yes flag)" : "(non-interactive mode)";
|
|
39648
|
+
logger.info(`Adding ${kit.name} alongside ${existingKitsDisplay} ${reason}`);
|
|
39649
|
+
}
|
|
39650
|
+
}
|
|
39651
|
+
}
|
|
39652
|
+
} catch (error) {
|
|
39653
|
+
logger.debug(`Metadata read skipped: ${error instanceof Error ? error.message : "unknown error"}`);
|
|
39654
|
+
}
|
|
39655
|
+
}
|
|
37382
39656
|
if (ctx.options.fresh) {
|
|
37383
39657
|
const prefix = PathResolver.getPathPrefix(ctx.options.global);
|
|
37384
39658
|
const claudeDir = prefix ? join62(resolvedDir, prefix) : resolvedDir;
|
|
@@ -37483,7 +39757,7 @@ import { copyFile as copyFile6, mkdir as mkdir20, open, rename as rename3, stat
|
|
|
37483
39757
|
import { dirname as dirname9, join as join63, resolve as resolve8 } from "node:path";
|
|
37484
39758
|
init_logger();
|
|
37485
39759
|
var import_fs_extra30 = __toESM(require_lib(), 1);
|
|
37486
|
-
var
|
|
39760
|
+
var import_picocolors19 = __toESM(require_picocolors(), 1);
|
|
37487
39761
|
async function handleSync(ctx) {
|
|
37488
39762
|
if (!ctx.options.sync) {
|
|
37489
39763
|
return ctx;
|
|
@@ -37651,7 +39925,7 @@ async function executeSyncMerge(ctx) {
|
|
|
37651
39925
|
}
|
|
37652
39926
|
const backupDir = PathResolver.getBackupDir();
|
|
37653
39927
|
await createBackup(ctx.claudeDir, trackedFiles, backupDir);
|
|
37654
|
-
logger.success(`Backup created at ${
|
|
39928
|
+
logger.success(`Backup created at ${import_picocolors19.default.dim(backupDir)}`);
|
|
37655
39929
|
if (plan.autoUpdate.length > 0) {
|
|
37656
39930
|
logger.info(`Auto-updating ${plan.autoUpdate.length} file(s)...`);
|
|
37657
39931
|
let updateSuccess = 0;
|
|
@@ -37761,22 +40035,22 @@ async function executeSyncMerge(ctx) {
|
|
|
37761
40035
|
totalRejected += result.rejected;
|
|
37762
40036
|
}
|
|
37763
40037
|
console.log("");
|
|
37764
|
-
console.log(
|
|
37765
|
-
console.log(
|
|
40038
|
+
console.log(import_picocolors19.default.bold("Sync Summary:"));
|
|
40039
|
+
console.log(import_picocolors19.default.dim("─".repeat(40)));
|
|
37766
40040
|
if (plan.autoUpdate.length > 0) {
|
|
37767
|
-
console.log(
|
|
40041
|
+
console.log(import_picocolors19.default.green(` ✓ ${plan.autoUpdate.length} file(s) auto-updated`));
|
|
37768
40042
|
}
|
|
37769
40043
|
if (totalApplied > 0) {
|
|
37770
|
-
console.log(
|
|
40044
|
+
console.log(import_picocolors19.default.green(` ✓ ${totalApplied} hunk(s) applied`));
|
|
37771
40045
|
}
|
|
37772
40046
|
if (totalRejected > 0) {
|
|
37773
|
-
console.log(
|
|
40047
|
+
console.log(import_picocolors19.default.yellow(` ○ ${totalRejected} hunk(s) rejected`));
|
|
37774
40048
|
}
|
|
37775
40049
|
if (skippedFiles > 0) {
|
|
37776
|
-
console.log(
|
|
40050
|
+
console.log(import_picocolors19.default.yellow(` ○ ${skippedFiles} file(s) skipped`));
|
|
37777
40051
|
}
|
|
37778
40052
|
if (plan.skipped.length > 0) {
|
|
37779
|
-
console.log(
|
|
40053
|
+
console.log(import_picocolors19.default.dim(` ─ ${plan.skipped.length} user-owned file(s) unchanged`));
|
|
37780
40054
|
}
|
|
37781
40055
|
} else if (plan.needsReview.length > 0 && ctx.isNonInteractive) {
|
|
37782
40056
|
logger.error(`Cannot complete sync: ${plan.needsReview.length} file(s) require interactive review`);
|
|
@@ -37799,30 +40073,30 @@ Options:
|
|
|
37799
40073
|
}
|
|
37800
40074
|
function displaySyncPlan(plan) {
|
|
37801
40075
|
console.log("");
|
|
37802
|
-
console.log(
|
|
37803
|
-
console.log(
|
|
40076
|
+
console.log(import_picocolors19.default.bold("Sync Plan:"));
|
|
40077
|
+
console.log(import_picocolors19.default.dim("─".repeat(40)));
|
|
37804
40078
|
if (plan.autoUpdate.length > 0) {
|
|
37805
|
-
console.log(
|
|
40079
|
+
console.log(import_picocolors19.default.green(` ${plan.autoUpdate.length} file(s) will be auto-updated`));
|
|
37806
40080
|
for (const file of plan.autoUpdate.slice(0, 5)) {
|
|
37807
|
-
console.log(
|
|
40081
|
+
console.log(import_picocolors19.default.dim(` • ${file.path}`));
|
|
37808
40082
|
}
|
|
37809
40083
|
if (plan.autoUpdate.length > 5) {
|
|
37810
|
-
console.log(
|
|
40084
|
+
console.log(import_picocolors19.default.dim(` ... and ${plan.autoUpdate.length - 5} more`));
|
|
37811
40085
|
}
|
|
37812
40086
|
}
|
|
37813
40087
|
if (plan.needsReview.length > 0) {
|
|
37814
|
-
console.log(
|
|
40088
|
+
console.log(import_picocolors19.default.yellow(` ${plan.needsReview.length} file(s) need interactive review`));
|
|
37815
40089
|
for (const file of plan.needsReview.slice(0, 5)) {
|
|
37816
|
-
console.log(
|
|
40090
|
+
console.log(import_picocolors19.default.dim(` • ${file.path}`));
|
|
37817
40091
|
}
|
|
37818
40092
|
if (plan.needsReview.length > 5) {
|
|
37819
|
-
console.log(
|
|
40093
|
+
console.log(import_picocolors19.default.dim(` ... and ${plan.needsReview.length - 5} more`));
|
|
37820
40094
|
}
|
|
37821
40095
|
}
|
|
37822
40096
|
if (plan.skipped.length > 0) {
|
|
37823
|
-
console.log(
|
|
40097
|
+
console.log(import_picocolors19.default.dim(` ${plan.skipped.length} user-owned file(s) will be skipped`));
|
|
37824
40098
|
}
|
|
37825
|
-
console.log(
|
|
40099
|
+
console.log(import_picocolors19.default.dim("─".repeat(40)));
|
|
37826
40100
|
}
|
|
37827
40101
|
async function createBackup(claudeDir, files, backupDir) {
|
|
37828
40102
|
await mkdir20(backupDir, { recursive: true });
|
|
@@ -38146,6 +40420,24 @@ function transformContent(content) {
|
|
|
38146
40420
|
return homePrefix;
|
|
38147
40421
|
});
|
|
38148
40422
|
}
|
|
40423
|
+
transformed = transformed.replace(/\$CLAUDE_PROJECT_DIR\/\.claude\//g, () => {
|
|
40424
|
+
changes++;
|
|
40425
|
+
return claudePath;
|
|
40426
|
+
});
|
|
40427
|
+
transformed = transformed.replace(/"\$CLAUDE_PROJECT_DIR"\/\.claude\//g, () => {
|
|
40428
|
+
changes++;
|
|
40429
|
+
return `"${homePrefix}"/.claude/`;
|
|
40430
|
+
});
|
|
40431
|
+
transformed = transformed.replace(/\$\{CLAUDE_PROJECT_DIR\}\/\.claude\//g, () => {
|
|
40432
|
+
changes++;
|
|
40433
|
+
return claudePath;
|
|
40434
|
+
});
|
|
40435
|
+
if (IS_WINDOWS3) {
|
|
40436
|
+
transformed = transformed.replace(/%CLAUDE_PROJECT_DIR%\/\.claude\//g, () => {
|
|
40437
|
+
changes++;
|
|
40438
|
+
return claudePath;
|
|
40439
|
+
});
|
|
40440
|
+
}
|
|
38149
40441
|
transformed = transformed.replace(/\.\/\.claude\//g, () => {
|
|
38150
40442
|
changes++;
|
|
38151
40443
|
return claudePath;
|
|
@@ -38381,7 +40673,7 @@ Protected files (.env, etc.) were not modified.`;
|
|
|
38381
40673
|
// src/commands/new/new-command.ts
|
|
38382
40674
|
init_logger();
|
|
38383
40675
|
init_types2();
|
|
38384
|
-
var
|
|
40676
|
+
var import_picocolors20 = __toESM(require_picocolors(), 1);
|
|
38385
40677
|
|
|
38386
40678
|
// src/commands/new/phases/directory-setup.ts
|
|
38387
40679
|
import { resolve as resolve9 } from "node:path";
|
|
@@ -38569,6 +40861,8 @@ async function projectCreation(kit, resolvedDir, validOptions, isNonInteractive2
|
|
|
38569
40861
|
output.section("Installing");
|
|
38570
40862
|
logger.verbose("Installation target", { directory: resolvedDir });
|
|
38571
40863
|
const merger = new FileMerger;
|
|
40864
|
+
const claudeDir = join68(resolvedDir, ".claude");
|
|
40865
|
+
merger.setMultiKitContext(claudeDir, kit);
|
|
38572
40866
|
if (validOptions.exclude && validOptions.exclude.length > 0) {
|
|
38573
40867
|
merger.addIgnorePatterns(validOptions.exclude);
|
|
38574
40868
|
}
|
|
@@ -38576,7 +40870,6 @@ async function projectCreation(kit, resolvedDir, validOptions, isNonInteractive2
|
|
|
38576
40870
|
await CommandsPrefix.cleanupCommandsDirectory(resolvedDir, false);
|
|
38577
40871
|
}
|
|
38578
40872
|
await merger.merge(extractDir, resolvedDir, true);
|
|
38579
|
-
const claudeDir = join68(resolvedDir, ".claude");
|
|
38580
40873
|
const releaseManifest = await ReleaseManifestLoader.load(extractDir);
|
|
38581
40874
|
const installedFiles = merger.getAllInstalledFiles();
|
|
38582
40875
|
const filesToTrack = buildFileTrackingList({
|
|
@@ -38683,7 +40976,7 @@ async function newCommand(options) {
|
|
|
38683
40976
|
if (ctx.cancelled)
|
|
38684
40977
|
return;
|
|
38685
40978
|
prompts.outro(`✨ Project created successfully at ${ctx.resolvedDir}`);
|
|
38686
|
-
log.info(`${
|
|
40979
|
+
log.info(`${import_picocolors20.default.dim("Tip:")} To update later: ${import_picocolors20.default.cyan("ck update")} (CLI) + ${import_picocolors20.default.cyan("ck init")} (kit content)`);
|
|
38687
40980
|
} catch (error) {
|
|
38688
40981
|
logger.error(error instanceof Error ? error.message : "Unknown error occurred");
|
|
38689
40982
|
process.exit(1);
|
|
@@ -38692,7 +40985,7 @@ async function newCommand(options) {
|
|
|
38692
40985
|
// src/commands/uninstall/uninstall-command.ts
|
|
38693
40986
|
init_logger();
|
|
38694
40987
|
init_types2();
|
|
38695
|
-
var
|
|
40988
|
+
var import_picocolors22 = __toESM(require_picocolors(), 1);
|
|
38696
40989
|
|
|
38697
40990
|
// src/commands/uninstall/installation-detector.ts
|
|
38698
40991
|
var import_fs_extra33 = __toESM(require_lib(), 1);
|
|
@@ -38726,7 +41019,7 @@ var import_fs_extra34 = __toESM(require_lib(), 1);
|
|
|
38726
41019
|
import { readdirSync, rmSync } from "node:fs";
|
|
38727
41020
|
import { dirname as dirname10, join as join69 } from "node:path";
|
|
38728
41021
|
init_logger();
|
|
38729
|
-
var
|
|
41022
|
+
var import_picocolors21 = __toESM(require_picocolors(), 1);
|
|
38730
41023
|
function classifyFileByOwnership(ownership, forceOverwrite, deleteReason) {
|
|
38731
41024
|
if (ownership === "ck") {
|
|
38732
41025
|
return { action: "delete", reason: deleteReason };
|
|
@@ -38817,27 +41110,27 @@ async function analyzeInstallation(installation, forceOverwrite, kit) {
|
|
|
38817
41110
|
}
|
|
38818
41111
|
function displayDryRunPreview(analysis, installationType) {
|
|
38819
41112
|
console.log("");
|
|
38820
|
-
log.info(
|
|
41113
|
+
log.info(import_picocolors21.default.bold(`DRY RUN - Preview for ${installationType} installation:`));
|
|
38821
41114
|
console.log("");
|
|
38822
41115
|
if (analysis.toDelete.length > 0) {
|
|
38823
|
-
console.log(
|
|
41116
|
+
console.log(import_picocolors21.default.red(import_picocolors21.default.bold(`Files to DELETE (${analysis.toDelete.length}):`)));
|
|
38824
41117
|
const showDelete = analysis.toDelete.slice(0, 10);
|
|
38825
41118
|
for (const item of showDelete) {
|
|
38826
|
-
console.log(` ${
|
|
41119
|
+
console.log(` ${import_picocolors21.default.red("✖")} ${item.path}`);
|
|
38827
41120
|
}
|
|
38828
41121
|
if (analysis.toDelete.length > 10) {
|
|
38829
|
-
console.log(
|
|
41122
|
+
console.log(import_picocolors21.default.gray(` ... and ${analysis.toDelete.length - 10} more`));
|
|
38830
41123
|
}
|
|
38831
41124
|
console.log("");
|
|
38832
41125
|
}
|
|
38833
41126
|
if (analysis.toPreserve.length > 0) {
|
|
38834
|
-
console.log(
|
|
41127
|
+
console.log(import_picocolors21.default.green(import_picocolors21.default.bold(`Files to PRESERVE (${analysis.toPreserve.length}):`)));
|
|
38835
41128
|
const showPreserve = analysis.toPreserve.slice(0, 10);
|
|
38836
41129
|
for (const item of showPreserve) {
|
|
38837
|
-
console.log(` ${
|
|
41130
|
+
console.log(` ${import_picocolors21.default.green("✓")} ${item.path} ${import_picocolors21.default.gray(`(${item.reason})`)}`);
|
|
38838
41131
|
}
|
|
38839
41132
|
if (analysis.toPreserve.length > 10) {
|
|
38840
|
-
console.log(
|
|
41133
|
+
console.log(import_picocolors21.default.gray(` ... and ${analysis.toPreserve.length - 10} more`));
|
|
38841
41134
|
}
|
|
38842
41135
|
console.log("");
|
|
38843
41136
|
}
|
|
@@ -38985,10 +41278,10 @@ async function uninstallCommand(options) {
|
|
|
38985
41278
|
}
|
|
38986
41279
|
displayInstallations(installations, scope);
|
|
38987
41280
|
if (validOptions.kit) {
|
|
38988
|
-
log.info(
|
|
41281
|
+
log.info(import_picocolors22.default.cyan(`Kit-scoped uninstall: ${validOptions.kit} kit only`));
|
|
38989
41282
|
}
|
|
38990
41283
|
if (validOptions.dryRun) {
|
|
38991
|
-
log.info(
|
|
41284
|
+
log.info(import_picocolors22.default.yellow("DRY RUN MODE - No files will be deleted"));
|
|
38992
41285
|
await removeInstallations(installations, {
|
|
38993
41286
|
dryRun: true,
|
|
38994
41287
|
forceOverwrite: validOptions.forceOverwrite,
|
|
@@ -38998,8 +41291,8 @@ async function uninstallCommand(options) {
|
|
|
38998
41291
|
return;
|
|
38999
41292
|
}
|
|
39000
41293
|
if (validOptions.forceOverwrite) {
|
|
39001
|
-
log.warn(`${
|
|
39002
|
-
${
|
|
41294
|
+
log.warn(`${import_picocolors22.default.yellow(import_picocolors22.default.bold("FORCE MODE ENABLED"))}
|
|
41295
|
+
${import_picocolors22.default.yellow("User modifications will be permanently deleted!")}`);
|
|
39003
41296
|
}
|
|
39004
41297
|
if (!validOptions.yes) {
|
|
39005
41298
|
const kitLabel = validOptions.kit ? ` (${validOptions.kit} kit only)` : "";
|
|
@@ -39338,7 +41631,7 @@ class CliVersionChecker {
|
|
|
39338
41631
|
}
|
|
39339
41632
|
}
|
|
39340
41633
|
// src/domains/versioning/checking/notification-display.ts
|
|
39341
|
-
var
|
|
41634
|
+
var import_picocolors23 = __toESM(require_picocolors(), 1);
|
|
39342
41635
|
function createNotificationBox2(borderColor, boxWidth) {
|
|
39343
41636
|
const contentWidth = boxWidth - 2;
|
|
39344
41637
|
const topBorder = borderColor(`╭${"─".repeat(contentWidth)}╮`);
|
|
@@ -39363,13 +41656,13 @@ function displayKitNotification(result, options = {}) {
|
|
|
39363
41656
|
const displayCurrent = normalizeVersion(currentVersion);
|
|
39364
41657
|
const displayLatest = normalizeVersion(latestVersion);
|
|
39365
41658
|
const boxWidth = 52;
|
|
39366
|
-
const { topBorder, bottomBorder, emptyLine, padLine } = createNotificationBox2(
|
|
39367
|
-
const headerText =
|
|
41659
|
+
const { topBorder, bottomBorder, emptyLine, padLine } = createNotificationBox2(import_picocolors23.default.cyan, boxWidth);
|
|
41660
|
+
const headerText = import_picocolors23.default.bold(import_picocolors23.default.yellow("⬆ Kit Update Available"));
|
|
39368
41661
|
const headerLen = "⬆ Kit Update Available".length;
|
|
39369
|
-
const versionText = `${
|
|
41662
|
+
const versionText = `${import_picocolors23.default.dim(displayCurrent)} ${import_picocolors23.default.white("→")} ${import_picocolors23.default.green(import_picocolors23.default.bold(displayLatest))}`;
|
|
39370
41663
|
const versionLen = displayCurrent.length + 3 + displayLatest.length;
|
|
39371
41664
|
const updateCmd = isGlobal ? "ck init -g" : "ck init";
|
|
39372
|
-
const commandText = `Run: ${
|
|
41665
|
+
const commandText = `Run: ${import_picocolors23.default.cyan(import_picocolors23.default.bold(updateCmd))}`;
|
|
39373
41666
|
const commandLen = `Run: ${updateCmd}`.length;
|
|
39374
41667
|
console.log("");
|
|
39375
41668
|
console.log(topBorder);
|
|
@@ -39387,12 +41680,12 @@ function displayCliNotification(result) {
|
|
|
39387
41680
|
return;
|
|
39388
41681
|
const { currentVersion, latestVersion } = result;
|
|
39389
41682
|
const boxWidth = 52;
|
|
39390
|
-
const { topBorder, bottomBorder, emptyLine, padLine } = createNotificationBox2(
|
|
39391
|
-
const headerText =
|
|
41683
|
+
const { topBorder, bottomBorder, emptyLine, padLine } = createNotificationBox2(import_picocolors23.default.magenta, boxWidth);
|
|
41684
|
+
const headerText = import_picocolors23.default.bold(import_picocolors23.default.yellow("⬆ CLI Update Available"));
|
|
39392
41685
|
const headerLen = "⬆ CLI Update Available".length;
|
|
39393
|
-
const versionText = `${
|
|
41686
|
+
const versionText = `${import_picocolors23.default.dim(currentVersion)} ${import_picocolors23.default.white("→")} ${import_picocolors23.default.green(import_picocolors23.default.bold(latestVersion))}`;
|
|
39394
41687
|
const versionLen = currentVersion.length + 3 + latestVersion.length;
|
|
39395
|
-
const commandText = `Run: ${
|
|
41688
|
+
const commandText = `Run: ${import_picocolors23.default.magenta(import_picocolors23.default.bold("ck update"))}`;
|
|
39396
41689
|
const commandLen = "Run: ck update".length;
|
|
39397
41690
|
console.log("");
|
|
39398
41691
|
console.log(topBorder);
|
|
@@ -39429,11 +41722,11 @@ init_logger();
|
|
|
39429
41722
|
init_types2();
|
|
39430
41723
|
init_types2();
|
|
39431
41724
|
var import_compare_versions5 = __toESM(require_umd(), 1);
|
|
39432
|
-
var
|
|
41725
|
+
var import_picocolors24 = __toESM(require_picocolors(), 1);
|
|
39433
41726
|
// package.json
|
|
39434
41727
|
var package_default = {
|
|
39435
41728
|
name: "claudekit-cli",
|
|
39436
|
-
version: "3.
|
|
41729
|
+
version: "3.17.0",
|
|
39437
41730
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
39438
41731
|
type: "module",
|
|
39439
41732
|
repository: {
|
|
@@ -39500,6 +41793,7 @@ var package_default = {
|
|
|
39500
41793
|
"p-limit": "^7.2.0",
|
|
39501
41794
|
picocolors: "^1.1.1",
|
|
39502
41795
|
"proper-lockfile": "^4.1.2",
|
|
41796
|
+
semver: "^7.7.3",
|
|
39503
41797
|
tar: "^7.4.3",
|
|
39504
41798
|
tmp: "^0.2.3",
|
|
39505
41799
|
zod: "^3.23.8"
|
|
@@ -39514,6 +41808,7 @@ var package_default = {
|
|
|
39514
41808
|
"@types/fs-extra": "^11.0.4",
|
|
39515
41809
|
"@types/node": "^22.10.1",
|
|
39516
41810
|
"@types/proper-lockfile": "^4.1.4",
|
|
41811
|
+
"@types/semver": "^7.7.1",
|
|
39517
41812
|
"@types/tar": "^6.1.13",
|
|
39518
41813
|
"@types/tmp": "^0.2.6",
|
|
39519
41814
|
"semantic-release": "^24.2.0",
|
|
@@ -39560,28 +41855,28 @@ async function displayKitUpdateReminder() {
|
|
|
39560
41855
|
const maxCmdLen = Math.max(cmdLocal.length, cmdGlobal.length);
|
|
39561
41856
|
const pad = (cmd) => cmd.padEnd(maxCmdLen);
|
|
39562
41857
|
const lines = [];
|
|
39563
|
-
lines.push(
|
|
41858
|
+
lines.push(import_picocolors24.default.yellow(KIT_UPDATE_REMINDER_HEADER));
|
|
39564
41859
|
lines.push("");
|
|
39565
41860
|
lines.push("To update your ClaudeKit content (skills, commands, workflows):");
|
|
39566
41861
|
if (hasLocal && localVersion) {
|
|
39567
|
-
lines.push(` ${
|
|
41862
|
+
lines.push(` ${import_picocolors24.default.cyan(pad(cmdLocal))} Update local project (${localVersion})`);
|
|
39568
41863
|
const localCheck = versionCheckResults.get(localVersion);
|
|
39569
41864
|
if (localCheck?.updateAvailable) {
|
|
39570
41865
|
const indent = " ".repeat(maxCmdLen + 4);
|
|
39571
|
-
lines.push(`${indent}${
|
|
41866
|
+
lines.push(`${indent}${import_picocolors24.default.green(`→ ${localCheck.latestVersion} available!`)}`);
|
|
39572
41867
|
}
|
|
39573
41868
|
} else {
|
|
39574
|
-
lines.push(` ${
|
|
41869
|
+
lines.push(` ${import_picocolors24.default.cyan(pad(cmdLocal))} Initialize in current project`);
|
|
39575
41870
|
}
|
|
39576
41871
|
if (hasGlobal && globalVersion) {
|
|
39577
|
-
lines.push(` ${
|
|
41872
|
+
lines.push(` ${import_picocolors24.default.cyan(pad(cmdGlobal))} Update global ~/.claude (${globalVersion})`);
|
|
39578
41873
|
const globalCheck = versionCheckResults.get(globalVersion);
|
|
39579
41874
|
if (globalCheck?.updateAvailable) {
|
|
39580
41875
|
const indent = " ".repeat(maxCmdLen + 4);
|
|
39581
|
-
lines.push(`${indent}${
|
|
41876
|
+
lines.push(`${indent}${import_picocolors24.default.green(`→ ${globalCheck.latestVersion} available!`)}`);
|
|
39582
41877
|
}
|
|
39583
41878
|
} else {
|
|
39584
|
-
lines.push(` ${
|
|
41879
|
+
lines.push(` ${import_picocolors24.default.cyan(pad(cmdGlobal))} Initialize global ~/.claude`);
|
|
39585
41880
|
}
|
|
39586
41881
|
logger.info("");
|
|
39587
41882
|
log.info(lines.join(`
|
|
@@ -39705,7 +42000,7 @@ Manual update: ${updateCmd}`);
|
|
|
39705
42000
|
// src/commands/version.ts
|
|
39706
42001
|
init_logger();
|
|
39707
42002
|
init_types2();
|
|
39708
|
-
var
|
|
42003
|
+
var import_picocolors25 = __toESM(require_picocolors(), 1);
|
|
39709
42004
|
function formatRelativeTime(dateString) {
|
|
39710
42005
|
if (!dateString)
|
|
39711
42006
|
return "Unknown";
|
|
@@ -39727,30 +42022,30 @@ function formatRelativeTime(dateString) {
|
|
|
39727
42022
|
}
|
|
39728
42023
|
function displayKitReleases(kitName, releases) {
|
|
39729
42024
|
console.log(`
|
|
39730
|
-
${
|
|
42025
|
+
${import_picocolors25.default.bold(import_picocolors25.default.cyan(kitName))} - Available Versions:
|
|
39731
42026
|
`);
|
|
39732
42027
|
if (releases.length === 0) {
|
|
39733
|
-
console.log(
|
|
42028
|
+
console.log(import_picocolors25.default.dim(" No releases found"));
|
|
39734
42029
|
return;
|
|
39735
42030
|
}
|
|
39736
42031
|
for (const release of releases) {
|
|
39737
|
-
const version =
|
|
42032
|
+
const version = import_picocolors25.default.green(release.tag_name);
|
|
39738
42033
|
const name2 = release.name || "No title";
|
|
39739
42034
|
const publishedAt = formatRelativeTime(release.published_at);
|
|
39740
42035
|
const assetCount = release.assets.length;
|
|
39741
42036
|
const badges = [];
|
|
39742
42037
|
if (release.prerelease)
|
|
39743
|
-
badges.push(
|
|
42038
|
+
badges.push(import_picocolors25.default.yellow("[prerelease]"));
|
|
39744
42039
|
if (release.draft)
|
|
39745
|
-
badges.push(
|
|
42040
|
+
badges.push(import_picocolors25.default.gray("[draft]"));
|
|
39746
42041
|
const badgeStr = badges.length > 0 ? ` ${badges.join(" ")}` : "";
|
|
39747
42042
|
const versionPart = version.padEnd(20);
|
|
39748
42043
|
const namePart = name2.length > 40 ? `${name2.slice(0, 37)}...` : name2.padEnd(40);
|
|
39749
|
-
const timePart =
|
|
39750
|
-
const assetPart =
|
|
42044
|
+
const timePart = import_picocolors25.default.dim(publishedAt.padEnd(20));
|
|
42045
|
+
const assetPart = import_picocolors25.default.dim(`(${assetCount} ${assetCount === 1 ? "asset" : "assets"})`);
|
|
39751
42046
|
console.log(` ${versionPart} ${namePart} ${timePart} ${assetPart}${badgeStr}`);
|
|
39752
42047
|
}
|
|
39753
|
-
console.log(
|
|
42048
|
+
console.log(import_picocolors25.default.dim(`
|
|
39754
42049
|
Showing ${releases.length} ${releases.length === 1 ? "release" : "releases"}`));
|
|
39755
42050
|
}
|
|
39756
42051
|
async function versionCommand(options) {
|
|
@@ -39785,8 +42080,8 @@ async function versionCommand(options) {
|
|
|
39785
42080
|
for (const result of results) {
|
|
39786
42081
|
if (result.error) {
|
|
39787
42082
|
console.log(`
|
|
39788
|
-
${
|
|
39789
|
-
console.log(
|
|
42083
|
+
${import_picocolors25.default.bold(import_picocolors25.default.cyan(result.kitConfig.name))} - ${import_picocolors25.default.red("Error")}`);
|
|
42084
|
+
console.log(import_picocolors25.default.dim(` ${result.error}`));
|
|
39790
42085
|
} else {
|
|
39791
42086
|
displayKitReleases(result.kitConfig.name, result.releases);
|
|
39792
42087
|
}
|
|
@@ -39860,6 +42155,30 @@ import { join as join72 } from "node:path";
|
|
|
39860
42155
|
init_logger();
|
|
39861
42156
|
init_types2();
|
|
39862
42157
|
var packageVersion = package_default.version;
|
|
42158
|
+
function formatInstalledKits(metadata) {
|
|
42159
|
+
if (!metadata.kits || Object.keys(metadata.kits).length === 0) {
|
|
42160
|
+
if (metadata.version) {
|
|
42161
|
+
const kitName = metadata.name || "ClaudeKit";
|
|
42162
|
+
return `${metadata.version} (${kitName})`;
|
|
42163
|
+
}
|
|
42164
|
+
return null;
|
|
42165
|
+
}
|
|
42166
|
+
const kitVersions = Object.entries(metadata.kits).filter(([_3, meta]) => meta.version && meta.version.trim() !== "").map(([kit, meta]) => `${kit}@${meta.version}`).sort().join(", ");
|
|
42167
|
+
return kitVersions.length > 0 ? kitVersions : null;
|
|
42168
|
+
}
|
|
42169
|
+
function getInstalledKitTypes(metadata) {
|
|
42170
|
+
if (!metadata.kits)
|
|
42171
|
+
return [];
|
|
42172
|
+
return Object.keys(metadata.kits);
|
|
42173
|
+
}
|
|
42174
|
+
function getFirstKitVersion(metadata) {
|
|
42175
|
+
const kitTypes = getInstalledKitTypes(metadata);
|
|
42176
|
+
if (kitTypes.length === 0) {
|
|
42177
|
+
return metadata.version ?? null;
|
|
42178
|
+
}
|
|
42179
|
+
const firstKit = kitTypes[0];
|
|
42180
|
+
return metadata.kits?.[firstKit]?.version ?? null;
|
|
42181
|
+
}
|
|
39863
42182
|
async function displayVersion() {
|
|
39864
42183
|
console.log(`CLI Version: ${packageVersion}`);
|
|
39865
42184
|
let foundAnyKit = false;
|
|
@@ -39874,10 +42193,10 @@ async function displayVersion() {
|
|
|
39874
42193
|
try {
|
|
39875
42194
|
const rawMetadata = JSON.parse(readFileSync5(localMetadataPath, "utf-8"));
|
|
39876
42195
|
const metadata = MetadataSchema.parse(rawMetadata);
|
|
39877
|
-
|
|
39878
|
-
|
|
39879
|
-
console.log(`Local Kit Version: ${
|
|
39880
|
-
localKitVersion = metadata
|
|
42196
|
+
const kitsDisplay = formatInstalledKits(metadata);
|
|
42197
|
+
if (kitsDisplay) {
|
|
42198
|
+
console.log(`Local Kit Version: ${kitsDisplay}`);
|
|
42199
|
+
localKitVersion = getFirstKitVersion(metadata);
|
|
39881
42200
|
foundAnyKit = true;
|
|
39882
42201
|
}
|
|
39883
42202
|
} catch (error) {
|
|
@@ -39888,11 +42207,11 @@ async function displayVersion() {
|
|
|
39888
42207
|
try {
|
|
39889
42208
|
const rawMetadata = JSON.parse(readFileSync5(globalMetadataPath, "utf-8"));
|
|
39890
42209
|
const metadata = MetadataSchema.parse(rawMetadata);
|
|
39891
|
-
|
|
39892
|
-
|
|
39893
|
-
console.log(`Global Kit Version: ${
|
|
42210
|
+
const kitsDisplay = formatInstalledKits(metadata);
|
|
42211
|
+
if (kitsDisplay) {
|
|
42212
|
+
console.log(`Global Kit Version: ${kitsDisplay}`);
|
|
39894
42213
|
if (!localKitVersion) {
|
|
39895
|
-
localKitVersion = metadata
|
|
42214
|
+
localKitVersion = getFirstKitVersion(metadata);
|
|
39896
42215
|
isGlobalOnlyKit = true;
|
|
39897
42216
|
}
|
|
39898
42217
|
foundAnyKit = true;
|
|
@@ -39931,7 +42250,7 @@ function getPackageVersion2() {
|
|
|
39931
42250
|
|
|
39932
42251
|
// src/shared/logger.ts
|
|
39933
42252
|
init_output_manager();
|
|
39934
|
-
var
|
|
42253
|
+
var import_picocolors26 = __toESM(require_picocolors(), 1);
|
|
39935
42254
|
import { createWriteStream as createWriteStream3 } from "node:fs";
|
|
39936
42255
|
|
|
39937
42256
|
class Logger2 {
|
|
@@ -39940,23 +42259,23 @@ class Logger2 {
|
|
|
39940
42259
|
exitHandlerRegistered = false;
|
|
39941
42260
|
info(message) {
|
|
39942
42261
|
const symbols = output.getSymbols();
|
|
39943
|
-
console.log(
|
|
42262
|
+
console.log(import_picocolors26.default.blue(symbols.info), message);
|
|
39944
42263
|
}
|
|
39945
42264
|
success(message) {
|
|
39946
42265
|
const symbols = output.getSymbols();
|
|
39947
|
-
console.log(
|
|
42266
|
+
console.log(import_picocolors26.default.green(symbols.success), message);
|
|
39948
42267
|
}
|
|
39949
42268
|
warning(message) {
|
|
39950
42269
|
const symbols = output.getSymbols();
|
|
39951
|
-
console.log(
|
|
42270
|
+
console.log(import_picocolors26.default.yellow(symbols.warning), message);
|
|
39952
42271
|
}
|
|
39953
42272
|
error(message) {
|
|
39954
42273
|
const symbols = output.getSymbols();
|
|
39955
|
-
console.error(
|
|
42274
|
+
console.error(import_picocolors26.default.red(symbols.error), message);
|
|
39956
42275
|
}
|
|
39957
42276
|
debug(message) {
|
|
39958
42277
|
if (process.env.DEBUG) {
|
|
39959
|
-
console.log(
|
|
42278
|
+
console.log(import_picocolors26.default.gray("[DEBUG]"), message);
|
|
39960
42279
|
}
|
|
39961
42280
|
}
|
|
39962
42281
|
verbose(message, context) {
|
|
@@ -39965,7 +42284,7 @@ class Logger2 {
|
|
|
39965
42284
|
const timestamp = this.getTimestamp();
|
|
39966
42285
|
const sanitizedMessage = this.sanitize(message);
|
|
39967
42286
|
const formattedContext = context ? this.formatContext(context) : "";
|
|
39968
|
-
const logLine = `${timestamp} ${
|
|
42287
|
+
const logLine = `${timestamp} ${import_picocolors26.default.gray("[VERBOSE]")} ${sanitizedMessage}${formattedContext}`;
|
|
39969
42288
|
console.error(logLine);
|
|
39970
42289
|
if (this.logFileStream) {
|
|
39971
42290
|
const plainLogLine = `${timestamp} [VERBOSE] ${sanitizedMessage}${formattedContext}`;
|
|
@@ -40068,7 +42387,7 @@ var logger3 = new Logger2;
|
|
|
40068
42387
|
|
|
40069
42388
|
// src/shared/output-manager.ts
|
|
40070
42389
|
init_terminal_utils();
|
|
40071
|
-
var
|
|
42390
|
+
var import_picocolors27 = __toESM(require_picocolors(), 1);
|
|
40072
42391
|
var SYMBOLS2 = {
|
|
40073
42392
|
unicode: {
|
|
40074
42393
|
prompt: "◇",
|
|
@@ -40147,7 +42466,7 @@ class OutputManager2 {
|
|
|
40147
42466
|
if (this.config.quiet)
|
|
40148
42467
|
return;
|
|
40149
42468
|
const symbol = this.getSymbols().success;
|
|
40150
|
-
console.log(
|
|
42469
|
+
console.log(import_picocolors27.default.green(`${symbol} ${message}`));
|
|
40151
42470
|
}
|
|
40152
42471
|
error(message, data) {
|
|
40153
42472
|
if (this.config.json) {
|
|
@@ -40155,7 +42474,7 @@ class OutputManager2 {
|
|
|
40155
42474
|
return;
|
|
40156
42475
|
}
|
|
40157
42476
|
const symbol = this.getSymbols().error;
|
|
40158
|
-
console.error(
|
|
42477
|
+
console.error(import_picocolors27.default.red(`${symbol} ${message}`));
|
|
40159
42478
|
}
|
|
40160
42479
|
warning(message, data) {
|
|
40161
42480
|
if (this.config.json) {
|
|
@@ -40165,7 +42484,7 @@ class OutputManager2 {
|
|
|
40165
42484
|
if (this.config.quiet)
|
|
40166
42485
|
return;
|
|
40167
42486
|
const symbol = this.getSymbols().warning;
|
|
40168
|
-
console.log(
|
|
42487
|
+
console.log(import_picocolors27.default.yellow(`${symbol} ${message}`));
|
|
40169
42488
|
}
|
|
40170
42489
|
info(message, data) {
|
|
40171
42490
|
if (this.config.json) {
|
|
@@ -40175,7 +42494,7 @@ class OutputManager2 {
|
|
|
40175
42494
|
if (this.config.quiet)
|
|
40176
42495
|
return;
|
|
40177
42496
|
const symbol = this.getSymbols().info;
|
|
40178
|
-
console.log(
|
|
42497
|
+
console.log(import_picocolors27.default.blue(`${symbol} ${message}`));
|
|
40179
42498
|
}
|
|
40180
42499
|
verbose(message, data) {
|
|
40181
42500
|
if (!this.config.verbose)
|
|
@@ -40184,7 +42503,7 @@ class OutputManager2 {
|
|
|
40184
42503
|
this.addJsonEntry({ type: "info", message, data });
|
|
40185
42504
|
return;
|
|
40186
42505
|
}
|
|
40187
|
-
console.log(
|
|
42506
|
+
console.log(import_picocolors27.default.dim(` ${message}`));
|
|
40188
42507
|
}
|
|
40189
42508
|
indent(message) {
|
|
40190
42509
|
if (this.config.json)
|
|
@@ -40209,7 +42528,7 @@ class OutputManager2 {
|
|
|
40209
42528
|
return;
|
|
40210
42529
|
const symbols = this.getSymbols();
|
|
40211
42530
|
console.log();
|
|
40212
|
-
console.log(
|
|
42531
|
+
console.log(import_picocolors27.default.bold(import_picocolors27.default.cyan(`${symbols.line} ${title}`)));
|
|
40213
42532
|
}
|
|
40214
42533
|
addJsonEntry(entry) {
|
|
40215
42534
|
this.jsonBuffer.push({
|