@yawlabs/ctxlint 0.18.1 → 0.18.2
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/.pre-commit-hooks.yaml +1 -1
- package/dist/index.js +508 -510
- package/package.json +5 -4
package/dist/index.js
CHANGED
|
@@ -8878,8 +8878,8 @@ var require_files = __commonJS({
|
|
|
8878
8878
|
exports.resolveGlobalYarnPath = resolveGlobalYarnPath;
|
|
8879
8879
|
exports.resolveModulePath = resolveModulePath;
|
|
8880
8880
|
var url2 = __importStar(__require("url"));
|
|
8881
|
-
var
|
|
8882
|
-
var
|
|
8881
|
+
var path20 = __importStar(__require("path"));
|
|
8882
|
+
var fs15 = __importStar(__require("fs"));
|
|
8883
8883
|
var child_process_1 = __require("child_process");
|
|
8884
8884
|
function uriToFilePath(uri) {
|
|
8885
8885
|
const parsed = url2.parse(uri);
|
|
@@ -8897,7 +8897,7 @@ var require_files = __commonJS({
|
|
|
8897
8897
|
segments.shift();
|
|
8898
8898
|
}
|
|
8899
8899
|
}
|
|
8900
|
-
return
|
|
8900
|
+
return path20.normalize(segments.join("/"));
|
|
8901
8901
|
}
|
|
8902
8902
|
function isWindows() {
|
|
8903
8903
|
return process.platform === "win32";
|
|
@@ -8925,9 +8925,9 @@ var require_files = __commonJS({
|
|
|
8925
8925
|
const env2 = process.env;
|
|
8926
8926
|
const newEnv = /* @__PURE__ */ Object.create(null);
|
|
8927
8927
|
Object.keys(env2).forEach((key) => newEnv[key] = env2[key]);
|
|
8928
|
-
if (nodePath &&
|
|
8928
|
+
if (nodePath && fs15.existsSync(nodePath)) {
|
|
8929
8929
|
if (newEnv[nodePathKey]) {
|
|
8930
|
-
newEnv[nodePathKey] = nodePath +
|
|
8930
|
+
newEnv[nodePathKey] = nodePath + path20.delimiter + newEnv[nodePathKey];
|
|
8931
8931
|
} else {
|
|
8932
8932
|
newEnv[nodePathKey] = nodePath;
|
|
8933
8933
|
}
|
|
@@ -8999,9 +8999,9 @@ var require_files = __commonJS({
|
|
|
8999
8999
|
}
|
|
9000
9000
|
if (prefix.length > 0) {
|
|
9001
9001
|
if (isWindows()) {
|
|
9002
|
-
return
|
|
9002
|
+
return path20.join(prefix, "node_modules");
|
|
9003
9003
|
} else {
|
|
9004
|
-
return
|
|
9004
|
+
return path20.join(prefix, "lib", "node_modules");
|
|
9005
9005
|
}
|
|
9006
9006
|
}
|
|
9007
9007
|
return void 0;
|
|
@@ -9040,7 +9040,7 @@ var require_files = __commonJS({
|
|
|
9040
9040
|
try {
|
|
9041
9041
|
const yarn = JSON.parse(line);
|
|
9042
9042
|
if (yarn.type === "log") {
|
|
9043
|
-
return
|
|
9043
|
+
return path20.join(yarn.data, "node_modules");
|
|
9044
9044
|
}
|
|
9045
9045
|
} catch (e) {
|
|
9046
9046
|
}
|
|
@@ -9062,24 +9062,24 @@ var require_files = __commonJS({
|
|
|
9062
9062
|
if (process.platform === "win32") {
|
|
9063
9063
|
_isCaseSensitive = false;
|
|
9064
9064
|
} else {
|
|
9065
|
-
_isCaseSensitive = !
|
|
9065
|
+
_isCaseSensitive = !fs15.existsSync(__filename.toUpperCase()) || !fs15.existsSync(__filename.toLowerCase());
|
|
9066
9066
|
}
|
|
9067
9067
|
return _isCaseSensitive;
|
|
9068
9068
|
}
|
|
9069
9069
|
FileSystem2.isCaseSensitive = isCaseSensitive;
|
|
9070
9070
|
function isParent(parent, child) {
|
|
9071
9071
|
if (isCaseSensitive()) {
|
|
9072
|
-
return
|
|
9072
|
+
return path20.normalize(child).indexOf(path20.normalize(parent)) === 0;
|
|
9073
9073
|
} else {
|
|
9074
|
-
return
|
|
9074
|
+
return path20.normalize(child).toLowerCase().indexOf(path20.normalize(parent).toLowerCase()) === 0;
|
|
9075
9075
|
}
|
|
9076
9076
|
}
|
|
9077
9077
|
FileSystem2.isParent = isParent;
|
|
9078
9078
|
})(FileSystem || (exports.FileSystem = FileSystem = {}));
|
|
9079
9079
|
function resolveModulePath(workspaceRoot, moduleName, nodePath, tracer) {
|
|
9080
9080
|
if (nodePath) {
|
|
9081
|
-
if (!
|
|
9082
|
-
nodePath =
|
|
9081
|
+
if (!path20.isAbsolute(nodePath)) {
|
|
9082
|
+
nodePath = path20.join(workspaceRoot, nodePath);
|
|
9083
9083
|
}
|
|
9084
9084
|
return resolve18(moduleName, nodePath, nodePath, tracer).then((value) => {
|
|
9085
9085
|
if (FileSystem.isParent(nodePath, value)) {
|
|
@@ -9314,18 +9314,18 @@ var require_main = __commonJS({
|
|
|
9314
9314
|
exports.createMessageConnection = createMessageConnection;
|
|
9315
9315
|
var ril_1 = __importDefault(require_ril());
|
|
9316
9316
|
ril_1.default.install();
|
|
9317
|
-
var
|
|
9317
|
+
var path20 = __importStar(__require("path"));
|
|
9318
9318
|
var os7 = __importStar(__require("os"));
|
|
9319
|
-
var
|
|
9319
|
+
var fs15 = __importStar(__require("fs"));
|
|
9320
9320
|
var crypto_1 = __require("crypto");
|
|
9321
9321
|
var net_1 = __require("net");
|
|
9322
9322
|
var api_1 = require_api();
|
|
9323
9323
|
__exportStar(require_api(), exports);
|
|
9324
9324
|
var IPCMessageReader = class extends api_1.AbstractMessageReader {
|
|
9325
9325
|
process;
|
|
9326
|
-
constructor(
|
|
9326
|
+
constructor(process12) {
|
|
9327
9327
|
super();
|
|
9328
|
-
this.process =
|
|
9328
|
+
this.process = process12;
|
|
9329
9329
|
const eventEmitter = this.process;
|
|
9330
9330
|
eventEmitter.on("error", (error52) => this.fireError(error52));
|
|
9331
9331
|
eventEmitter.on("close", () => this.fireClose());
|
|
@@ -9339,9 +9339,9 @@ var require_main = __commonJS({
|
|
|
9339
9339
|
var IPCMessageWriter = class extends api_1.AbstractMessageWriter {
|
|
9340
9340
|
process;
|
|
9341
9341
|
errorCount;
|
|
9342
|
-
constructor(
|
|
9342
|
+
constructor(process12) {
|
|
9343
9343
|
super();
|
|
9344
|
-
this.process =
|
|
9344
|
+
this.process = process12;
|
|
9345
9345
|
this.errorCount = 0;
|
|
9346
9346
|
const eventEmitter = this.process;
|
|
9347
9347
|
eventEmitter.on("error", (error52) => this.fireError(error52));
|
|
@@ -9457,7 +9457,7 @@ var require_main = __commonJS({
|
|
|
9457
9457
|
}
|
|
9458
9458
|
let randomLength = 32;
|
|
9459
9459
|
const fixedLength = "/lsp-.sock".length;
|
|
9460
|
-
const tmpDir =
|
|
9460
|
+
const tmpDir = fs15.realpathSync(XDG_RUNTIME_DIR ?? os7.tmpdir());
|
|
9461
9461
|
const limit = safeIpcPathLengths.get(process.platform);
|
|
9462
9462
|
if (limit !== void 0) {
|
|
9463
9463
|
randomLength = Math.min(limit - tmpDir.length - fixedLength, randomLength);
|
|
@@ -9466,7 +9466,7 @@ var require_main = __commonJS({
|
|
|
9466
9466
|
throw new Error(`Unable to generate a random pipe name with ${randomLength} characters.`);
|
|
9467
9467
|
}
|
|
9468
9468
|
const randomSuffix = (0, crypto_1.randomBytes)(Math.floor(randomLength / 2)).toString("hex");
|
|
9469
|
-
return
|
|
9469
|
+
return path20.join(tmpDir, `lsp-${randomSuffix}.sock`);
|
|
9470
9470
|
}
|
|
9471
9471
|
function createClientPipeTransport(pipeName, encoding = "utf-8") {
|
|
9472
9472
|
let connectResolve;
|
|
@@ -13414,29 +13414,27 @@ async function scanForMcpConfigs(projectRoot) {
|
|
|
13414
13414
|
const found = [];
|
|
13415
13415
|
const seen = /* @__PURE__ */ new Set();
|
|
13416
13416
|
const realRoot = resolveRealRoot(projectRoot);
|
|
13417
|
-
|
|
13418
|
-
|
|
13419
|
-
|
|
13420
|
-
|
|
13421
|
-
|
|
13422
|
-
|
|
13417
|
+
const matches = await Ze(MCP_CONFIG_PATTERNS, {
|
|
13418
|
+
cwd: projectRoot,
|
|
13419
|
+
absolute: true,
|
|
13420
|
+
nodir: true,
|
|
13421
|
+
dot: true
|
|
13422
|
+
});
|
|
13423
|
+
for (const match of matches) {
|
|
13424
|
+
const normalized = path2.normalize(match);
|
|
13425
|
+
if (seen.has(normalized)) continue;
|
|
13426
|
+
seen.add(normalized);
|
|
13427
|
+
const relativePath = path2.relative(projectRoot, normalized);
|
|
13428
|
+
const symlink = isSymlink(normalized);
|
|
13429
|
+
if (isExcludedScanTarget(normalized, realRoot, symlink)) continue;
|
|
13430
|
+
const target = symlink ? readSymlinkTarget(normalized) : void 0;
|
|
13431
|
+
found.push({
|
|
13432
|
+
absolutePath: normalized,
|
|
13433
|
+
relativePath: relativePath.replace(/\\/g, "/"),
|
|
13434
|
+
isSymlink: symlink,
|
|
13435
|
+
symlinkTarget: target,
|
|
13436
|
+
type: "mcp-config"
|
|
13423
13437
|
});
|
|
13424
|
-
for (const match of matches) {
|
|
13425
|
-
const normalized = path2.normalize(match);
|
|
13426
|
-
if (seen.has(normalized)) continue;
|
|
13427
|
-
seen.add(normalized);
|
|
13428
|
-
const relativePath = path2.relative(projectRoot, normalized);
|
|
13429
|
-
const symlink = isSymlink(normalized);
|
|
13430
|
-
if (isExcludedScanTarget(normalized, realRoot, symlink)) continue;
|
|
13431
|
-
const target = symlink ? readSymlinkTarget(normalized) : void 0;
|
|
13432
|
-
found.push({
|
|
13433
|
-
absolutePath: normalized,
|
|
13434
|
-
relativePath: relativePath.replace(/\\/g, "/"),
|
|
13435
|
-
isSymlink: symlink,
|
|
13436
|
-
symlinkTarget: target,
|
|
13437
|
-
type: "mcp-config"
|
|
13438
|
-
});
|
|
13439
|
-
}
|
|
13440
13438
|
}
|
|
13441
13439
|
return found.sort((a, b2) => a.relativePath.localeCompare(b2.relativePath));
|
|
13442
13440
|
}
|
|
@@ -14689,10 +14687,10 @@ var require_src2 = __commonJS({
|
|
|
14689
14687
|
var fs_1 = __require("fs");
|
|
14690
14688
|
var debug_1 = __importDefault(require_src());
|
|
14691
14689
|
var log = debug_1.default("@kwsites/file-exists");
|
|
14692
|
-
function check2(
|
|
14693
|
-
log(`checking %s`,
|
|
14690
|
+
function check2(path20, isFile, isDirectory2) {
|
|
14691
|
+
log(`checking %s`, path20);
|
|
14694
14692
|
try {
|
|
14695
|
-
const stat3 = fs_1.statSync(
|
|
14693
|
+
const stat3 = fs_1.statSync(path20);
|
|
14696
14694
|
if (stat3.isFile() && isFile) {
|
|
14697
14695
|
log(`[OK] path represents a file`);
|
|
14698
14696
|
return true;
|
|
@@ -14712,8 +14710,8 @@ var require_src2 = __commonJS({
|
|
|
14712
14710
|
throw e;
|
|
14713
14711
|
}
|
|
14714
14712
|
}
|
|
14715
|
-
function exists2(
|
|
14716
|
-
return check2(
|
|
14713
|
+
function exists2(path20, type = exports.READABLE) {
|
|
14714
|
+
return check2(path20, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);
|
|
14717
14715
|
}
|
|
14718
14716
|
exports.exists = exists2;
|
|
14719
14717
|
exports.FILE = 1;
|
|
@@ -15311,8 +15309,8 @@ function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
|
|
|
15311
15309
|
function forEachLineWithContent(input, callback) {
|
|
15312
15310
|
return toLinesWithContent(input, true).map((line) => callback(line));
|
|
15313
15311
|
}
|
|
15314
|
-
function folderExists(
|
|
15315
|
-
return (0, import_file_exists.exists)(
|
|
15312
|
+
function folderExists(path20) {
|
|
15313
|
+
return (0, import_file_exists.exists)(path20, import_file_exists.FOLDER);
|
|
15316
15314
|
}
|
|
15317
15315
|
function append(target, item) {
|
|
15318
15316
|
if (Array.isArray(target)) {
|
|
@@ -15503,8 +15501,8 @@ function checkIsRepoRootTask() {
|
|
|
15503
15501
|
commands,
|
|
15504
15502
|
format: "utf-8",
|
|
15505
15503
|
onError,
|
|
15506
|
-
parser(
|
|
15507
|
-
return /^\.(git)?$/.test(
|
|
15504
|
+
parser(path20) {
|
|
15505
|
+
return /^\.(git)?$/.test(path20.trim());
|
|
15508
15506
|
}
|
|
15509
15507
|
};
|
|
15510
15508
|
}
|
|
@@ -15760,11 +15758,11 @@ function parseGrep(grep) {
|
|
|
15760
15758
|
const paths = /* @__PURE__ */ new Set();
|
|
15761
15759
|
const results = {};
|
|
15762
15760
|
forEachLineWithContent(grep, (input) => {
|
|
15763
|
-
const [
|
|
15764
|
-
paths.add(
|
|
15765
|
-
(results[
|
|
15761
|
+
const [path20, line, preview] = input.split(NULL);
|
|
15762
|
+
paths.add(path20);
|
|
15763
|
+
(results[path20] = results[path20] || []).push({
|
|
15766
15764
|
line: asNumber(line),
|
|
15767
|
-
path:
|
|
15765
|
+
path: path20,
|
|
15768
15766
|
preview
|
|
15769
15767
|
});
|
|
15770
15768
|
});
|
|
@@ -16061,14 +16059,14 @@ function hashObjectTask(filePath, write) {
|
|
|
16061
16059
|
}
|
|
16062
16060
|
return straightThroughStringTask(commands, true);
|
|
16063
16061
|
}
|
|
16064
|
-
function parseInit(bare,
|
|
16062
|
+
function parseInit(bare, path20, text) {
|
|
16065
16063
|
const response = String(text).trim();
|
|
16066
16064
|
let result;
|
|
16067
16065
|
if (result = initResponseRegex.exec(response)) {
|
|
16068
|
-
return new InitSummary(bare,
|
|
16066
|
+
return new InitSummary(bare, path20, false, result[1]);
|
|
16069
16067
|
}
|
|
16070
16068
|
if (result = reInitResponseRegex.exec(response)) {
|
|
16071
|
-
return new InitSummary(bare,
|
|
16069
|
+
return new InitSummary(bare, path20, true, result[1]);
|
|
16072
16070
|
}
|
|
16073
16071
|
let gitDir = "";
|
|
16074
16072
|
const tokens = response.split(" ");
|
|
@@ -16079,12 +16077,12 @@ function parseInit(bare, path19, text) {
|
|
|
16079
16077
|
break;
|
|
16080
16078
|
}
|
|
16081
16079
|
}
|
|
16082
|
-
return new InitSummary(bare,
|
|
16080
|
+
return new InitSummary(bare, path20, /^re/i.test(response), gitDir);
|
|
16083
16081
|
}
|
|
16084
16082
|
function hasBareCommand(command) {
|
|
16085
16083
|
return command.includes(bareCommand);
|
|
16086
16084
|
}
|
|
16087
|
-
function initTask(bare = false,
|
|
16085
|
+
function initTask(bare = false, path20, customArgs) {
|
|
16088
16086
|
const commands = ["init", ...customArgs];
|
|
16089
16087
|
if (bare && !hasBareCommand(commands)) {
|
|
16090
16088
|
commands.splice(1, 0, bareCommand);
|
|
@@ -16093,7 +16091,7 @@ function initTask(bare = false, path19, customArgs) {
|
|
|
16093
16091
|
commands,
|
|
16094
16092
|
format: "utf-8",
|
|
16095
16093
|
parser(text) {
|
|
16096
|
-
return parseInit(commands.includes("--bare"),
|
|
16094
|
+
return parseInit(commands.includes("--bare"), path20, text);
|
|
16097
16095
|
}
|
|
16098
16096
|
};
|
|
16099
16097
|
}
|
|
@@ -16372,14 +16370,14 @@ function splitLine(result, lineStr) {
|
|
|
16372
16370
|
default:
|
|
16373
16371
|
return;
|
|
16374
16372
|
}
|
|
16375
|
-
function data(index, workingDir,
|
|
16373
|
+
function data(index, workingDir, path20) {
|
|
16376
16374
|
const raw = `${index}${workingDir}`;
|
|
16377
16375
|
const handler = parsers6.get(raw);
|
|
16378
16376
|
if (handler) {
|
|
16379
|
-
handler(result,
|
|
16377
|
+
handler(result, path20);
|
|
16380
16378
|
}
|
|
16381
16379
|
if (raw !== "##" && raw !== "!!") {
|
|
16382
|
-
result.files.push(new FileStatusSummary(
|
|
16380
|
+
result.files.push(new FileStatusSummary(path20, index, workingDir));
|
|
16383
16381
|
}
|
|
16384
16382
|
}
|
|
16385
16383
|
}
|
|
@@ -16566,8 +16564,8 @@ function deleteBranchTask(branch, forceDelete = false) {
|
|
|
16566
16564
|
return task;
|
|
16567
16565
|
}
|
|
16568
16566
|
function toPath(input) {
|
|
16569
|
-
const
|
|
16570
|
-
return
|
|
16567
|
+
const path20 = input.trim().replace(/^["']|["']$/g, "");
|
|
16568
|
+
return path20 && normalize2(path20);
|
|
16571
16569
|
}
|
|
16572
16570
|
function checkIgnoreTask(paths) {
|
|
16573
16571
|
return {
|
|
@@ -16706,8 +16704,8 @@ function stashListTask(opt = {}, customArgs) {
|
|
|
16706
16704
|
parser: parser4
|
|
16707
16705
|
};
|
|
16708
16706
|
}
|
|
16709
|
-
function addSubModuleTask(repo,
|
|
16710
|
-
return subModuleTask(["add", repo,
|
|
16707
|
+
function addSubModuleTask(repo, path20) {
|
|
16708
|
+
return subModuleTask(["add", repo, path20]);
|
|
16711
16709
|
}
|
|
16712
16710
|
function initSubModuleTask(customArgs) {
|
|
16713
16711
|
return subModuleTask(["init", ...customArgs]);
|
|
@@ -17970,9 +17968,9 @@ var init_esm = __esm({
|
|
|
17970
17968
|
"src/lib/responses/InitSummary.ts"() {
|
|
17971
17969
|
"use strict";
|
|
17972
17970
|
InitSummary = class {
|
|
17973
|
-
constructor(bare,
|
|
17971
|
+
constructor(bare, path20, existing, gitDir) {
|
|
17974
17972
|
this.bare = bare;
|
|
17975
|
-
this.path =
|
|
17973
|
+
this.path = path20;
|
|
17976
17974
|
this.existing = existing;
|
|
17977
17975
|
this.gitDir = gitDir;
|
|
17978
17976
|
}
|
|
@@ -18505,12 +18503,12 @@ var init_esm = __esm({
|
|
|
18505
18503
|
"use strict";
|
|
18506
18504
|
fromPathRegex = /^(.+)\0(.+)$/;
|
|
18507
18505
|
FileStatusSummary = class {
|
|
18508
|
-
constructor(
|
|
18509
|
-
this.path =
|
|
18506
|
+
constructor(path20, index, working_dir) {
|
|
18507
|
+
this.path = path20;
|
|
18510
18508
|
this.index = index;
|
|
18511
18509
|
this.working_dir = working_dir;
|
|
18512
18510
|
if (index === "R" || working_dir === "R") {
|
|
18513
|
-
const detail = fromPathRegex.exec(
|
|
18511
|
+
const detail = fromPathRegex.exec(path20) || [null, path20, path20];
|
|
18514
18512
|
this.from = detail[2] || "";
|
|
18515
18513
|
this.path = detail[1] || "";
|
|
18516
18514
|
}
|
|
@@ -18772,9 +18770,9 @@ var init_esm = __esm({
|
|
|
18772
18770
|
next
|
|
18773
18771
|
);
|
|
18774
18772
|
}
|
|
18775
|
-
hashObject(
|
|
18773
|
+
hashObject(path20, write) {
|
|
18776
18774
|
return this._runTask(
|
|
18777
|
-
hashObjectTask(
|
|
18775
|
+
hashObjectTask(path20, write === true),
|
|
18778
18776
|
trailingFunctionArgument(arguments)
|
|
18779
18777
|
);
|
|
18780
18778
|
}
|
|
@@ -19411,8 +19409,8 @@ var init_esm = __esm({
|
|
|
19411
19409
|
}
|
|
19412
19410
|
return this._runTask(straightThroughStringTask2(command, this._trimmed), next);
|
|
19413
19411
|
};
|
|
19414
|
-
Git2.prototype.submoduleAdd = function(repo,
|
|
19415
|
-
return this._runTask(addSubModuleTask2(repo,
|
|
19412
|
+
Git2.prototype.submoduleAdd = function(repo, path20, then) {
|
|
19413
|
+
return this._runTask(addSubModuleTask2(repo, path20), trailingFunctionArgument2(arguments));
|
|
19416
19414
|
};
|
|
19417
19415
|
Git2.prototype.submoduleUpdate = function(args2, then) {
|
|
19418
19416
|
return this._runTask(
|
|
@@ -19671,6 +19669,18 @@ function normalizePath(p2, projectRoot) {
|
|
|
19671
19669
|
const normalized = path3.posix.normalize(cleaned);
|
|
19672
19670
|
return process.platform === "win32" ? normalized.toLowerCase() : normalized;
|
|
19673
19671
|
}
|
|
19672
|
+
function toGitPathspec(p2, projectRoot) {
|
|
19673
|
+
if (p2.includes("*")) return null;
|
|
19674
|
+
let cleaned = p2.replace(/\\/g, "/");
|
|
19675
|
+
if (path3.isAbsolute(p2)) {
|
|
19676
|
+
const rel = path3.relative(projectRoot, p2).replace(/\\/g, "/");
|
|
19677
|
+
if (!rel || rel.startsWith("..")) return null;
|
|
19678
|
+
cleaned = rel;
|
|
19679
|
+
}
|
|
19680
|
+
const normalized = path3.posix.normalize(cleaned);
|
|
19681
|
+
if (normalized === ".." || normalized.startsWith("../")) return null;
|
|
19682
|
+
return process.platform === "win32" ? `:(icase)${normalized}` : normalized;
|
|
19683
|
+
}
|
|
19674
19684
|
function getGit(projectRoot) {
|
|
19675
19685
|
if (!gitInstance || gitProjectRoot !== projectRoot) {
|
|
19676
19686
|
gitInstance = esm_default(projectRoot);
|
|
@@ -19717,7 +19727,12 @@ async function getCommitsSinceBatch(projectRoot, paths, since) {
|
|
|
19717
19727
|
try {
|
|
19718
19728
|
const git = getGit(projectRoot);
|
|
19719
19729
|
const SENTINEL = "___CTXLINT_COMMIT___";
|
|
19720
|
-
const
|
|
19730
|
+
const pathspecs = [];
|
|
19731
|
+
for (const p2 of paths) {
|
|
19732
|
+
const spec = toGitPathspec(p2, projectRoot);
|
|
19733
|
+
if (spec) pathspecs.push(spec);
|
|
19734
|
+
}
|
|
19735
|
+
const logArgs = [
|
|
19721
19736
|
// Git's default core.quotePath=true wraps non-ASCII paths in quotes
|
|
19722
19737
|
// with octal escapes ("src/f\303\266\303\266.txt"); nothing below
|
|
19723
19738
|
// unquotes, so the leading `"` would break both the exact and the
|
|
@@ -19731,7 +19746,11 @@ async function getCommitsSinceBatch(projectRoot, paths, since) {
|
|
|
19731
19746
|
// what keeps git from rejecting the sentinel as an invalid --pretty
|
|
19732
19747
|
// format ("fatal: invalid --pretty format: ___CTXLINT_COMMIT___").
|
|
19733
19748
|
`--format=%n${SENTINEL}`
|
|
19734
|
-
]
|
|
19749
|
+
];
|
|
19750
|
+
if (pathspecs.length > 0) {
|
|
19751
|
+
logArgs.push("--", ...pathspecs);
|
|
19752
|
+
}
|
|
19753
|
+
const raw = await git.raw(logArgs);
|
|
19735
19754
|
const requested = new Set(counts.keys());
|
|
19736
19755
|
const lines = raw.split("\n");
|
|
19737
19756
|
let inCommit = false;
|
|
@@ -20423,13 +20442,28 @@ function getProjectFiles(projectRoot) {
|
|
|
20423
20442
|
cachedProjectFiles = { root: projectRoot, files };
|
|
20424
20443
|
return files;
|
|
20425
20444
|
}
|
|
20445
|
+
function getBasenameIndex(projectRoot, files) {
|
|
20446
|
+
if (cachedBasenameIndex?.root === projectRoot) return cachedBasenameIndex.index;
|
|
20447
|
+
const index = /* @__PURE__ */ new Map();
|
|
20448
|
+
for (const file2 of files) {
|
|
20449
|
+
const norm = file2.replace(/\\/g, "/");
|
|
20450
|
+
const base = path4.basename(norm);
|
|
20451
|
+
const list = index.get(base);
|
|
20452
|
+
if (list) list.push(norm);
|
|
20453
|
+
else index.set(base, [norm]);
|
|
20454
|
+
}
|
|
20455
|
+
cachedBasenameIndex = { root: projectRoot, index };
|
|
20456
|
+
return index;
|
|
20457
|
+
}
|
|
20426
20458
|
function resetPathsCache() {
|
|
20427
20459
|
cachedProjectFiles = null;
|
|
20460
|
+
cachedBasenameIndex = null;
|
|
20428
20461
|
resetRenameCache();
|
|
20429
20462
|
}
|
|
20430
20463
|
async function checkPaths(file2, projectRoot) {
|
|
20431
20464
|
const issues = [];
|
|
20432
20465
|
const projectFiles = getProjectFiles(projectRoot);
|
|
20466
|
+
const basenameIndex = getBasenameIndex(projectRoot, projectFiles);
|
|
20433
20467
|
const contextDir = path4.dirname(file2.filePath);
|
|
20434
20468
|
const pending = [];
|
|
20435
20469
|
for (const ref of file2.references.paths) {
|
|
@@ -20514,7 +20548,7 @@ async function checkPaths(file2, projectRoot) {
|
|
|
20514
20548
|
suggestion = `Did you mean ${rename.newPath}?`;
|
|
20515
20549
|
detail = `Renamed ${rename.daysAgo} days ago in commit ${rename.commitHash}`;
|
|
20516
20550
|
} else {
|
|
20517
|
-
const match = findClosestMatch(normalizedRef, projectFiles);
|
|
20551
|
+
const match = findClosestMatch(normalizedRef, projectFiles, basenameIndex);
|
|
20518
20552
|
if (match) {
|
|
20519
20553
|
fixTarget = match;
|
|
20520
20554
|
suggestion = `Did you mean ${match}?`;
|
|
@@ -20555,14 +20589,14 @@ async function checkPaths(file2, projectRoot) {
|
|
|
20555
20589
|
}
|
|
20556
20590
|
return issues;
|
|
20557
20591
|
}
|
|
20558
|
-
function findClosestMatch(target, files) {
|
|
20592
|
+
function findClosestMatch(target, files, basenameIndex) {
|
|
20559
20593
|
const targetNorm = target.replace(/\\/g, "/");
|
|
20560
20594
|
const targetBase = path4.basename(targetNorm);
|
|
20595
|
+
const candidates = basenameIndex.get(targetBase) ?? [];
|
|
20561
20596
|
let basenameMatch = null;
|
|
20562
20597
|
let basenameDistance = Infinity;
|
|
20563
|
-
for (const
|
|
20564
|
-
|
|
20565
|
-
if (path4.basename(fileNorm) === targetBase && fileNorm !== targetNorm) {
|
|
20598
|
+
for (const fileNorm of candidates) {
|
|
20599
|
+
if (fileNorm !== targetNorm) {
|
|
20566
20600
|
const dist = levenshtein(targetNorm, fileNorm);
|
|
20567
20601
|
if (dist < basenameDistance) {
|
|
20568
20602
|
basenameDistance = dist;
|
|
@@ -20586,7 +20620,7 @@ function findClosestMatch(target, files) {
|
|
|
20586
20620
|
}
|
|
20587
20621
|
return fullPathMatch;
|
|
20588
20622
|
}
|
|
20589
|
-
var import_fast_levenshtein, levenshtein, GLOB_IGNORE, cachedProjectFiles;
|
|
20623
|
+
var import_fast_levenshtein, levenshtein, GLOB_IGNORE, cachedProjectFiles, cachedBasenameIndex;
|
|
20590
20624
|
var init_paths = __esm({
|
|
20591
20625
|
"src/core/checks/paths.ts"() {
|
|
20592
20626
|
"use strict";
|
|
@@ -20598,6 +20632,7 @@ var init_paths = __esm({
|
|
|
20598
20632
|
levenshtein = import_fast_levenshtein.default.get;
|
|
20599
20633
|
GLOB_IGNORE = ["**/node_modules/**", "**/.git/**", "**/dist/**", "**/build/**"];
|
|
20600
20634
|
cachedProjectFiles = null;
|
|
20635
|
+
cachedBasenameIndex = null;
|
|
20601
20636
|
}
|
|
20602
20637
|
});
|
|
20603
20638
|
|
|
@@ -21593,12 +21628,12 @@ function parseTree(text, errors = [], options = ParseOptions.DEFAULT) {
|
|
|
21593
21628
|
}
|
|
21594
21629
|
return result;
|
|
21595
21630
|
}
|
|
21596
|
-
function findNodeAtLocation(root,
|
|
21631
|
+
function findNodeAtLocation(root, path20) {
|
|
21597
21632
|
if (!root) {
|
|
21598
21633
|
return void 0;
|
|
21599
21634
|
}
|
|
21600
21635
|
let node = root;
|
|
21601
|
-
for (let segment of
|
|
21636
|
+
for (let segment of path20) {
|
|
21602
21637
|
if (typeof segment === "string") {
|
|
21603
21638
|
if (node.type !== "object" || !Array.isArray(node.children)) {
|
|
21604
21639
|
return void 0;
|
|
@@ -26156,8 +26191,8 @@ var require_utils = __commonJS({
|
|
|
26156
26191
|
}
|
|
26157
26192
|
return output;
|
|
26158
26193
|
};
|
|
26159
|
-
exports.basename = (
|
|
26160
|
-
const segs =
|
|
26194
|
+
exports.basename = (path20, { windows } = {}) => {
|
|
26195
|
+
const segs = path20.split(windows ? /[\\/]/ : "/");
|
|
26161
26196
|
const last2 = segs[segs.length - 1];
|
|
26162
26197
|
if (last2 === "") {
|
|
26163
26198
|
return segs[segs.length - 2];
|
|
@@ -27715,7 +27750,7 @@ import { readFileSync as readFileSync7 } from "node:fs";
|
|
|
27715
27750
|
import { resolve as resolve14, dirname as dirname6 } from "node:path";
|
|
27716
27751
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
27717
27752
|
function loadVersion() {
|
|
27718
|
-
if (true) return "0.18.
|
|
27753
|
+
if (true) return "0.18.2";
|
|
27719
27754
|
try {
|
|
27720
27755
|
const __dir = dirname6(fileURLToPath2(import.meta.url));
|
|
27721
27756
|
const pkgPath = resolve14(__dir, "../package.json");
|
|
@@ -28677,8 +28712,8 @@ var init_parseUtil = __esm({
|
|
|
28677
28712
|
init_errors();
|
|
28678
28713
|
init_en();
|
|
28679
28714
|
makeIssue = (params) => {
|
|
28680
|
-
const { data, path:
|
|
28681
|
-
const fullPath = [...
|
|
28715
|
+
const { data, path: path20, errorMaps, issueData } = params;
|
|
28716
|
+
const fullPath = [...path20, ...issueData.path || []];
|
|
28682
28717
|
const fullIssue = {
|
|
28683
28718
|
...issueData,
|
|
28684
28719
|
path: fullPath
|
|
@@ -28961,11 +28996,11 @@ var init_types2 = __esm({
|
|
|
28961
28996
|
init_parseUtil();
|
|
28962
28997
|
init_util2();
|
|
28963
28998
|
ParseInputLazyPath = class {
|
|
28964
|
-
constructor(parent, value,
|
|
28999
|
+
constructor(parent, value, path20, key) {
|
|
28965
29000
|
this._cachedPath = [];
|
|
28966
29001
|
this.parent = parent;
|
|
28967
29002
|
this.data = value;
|
|
28968
|
-
this._path =
|
|
29003
|
+
this._path = path20;
|
|
28969
29004
|
this._key = key;
|
|
28970
29005
|
}
|
|
28971
29006
|
get path() {
|
|
@@ -32467,10 +32502,10 @@ function mergeDefs(...defs) {
|
|
|
32467
32502
|
function cloneDef(schema) {
|
|
32468
32503
|
return mergeDefs(schema._zod.def);
|
|
32469
32504
|
}
|
|
32470
|
-
function getElementAtPath(obj,
|
|
32471
|
-
if (!
|
|
32505
|
+
function getElementAtPath(obj, path20) {
|
|
32506
|
+
if (!path20)
|
|
32472
32507
|
return obj;
|
|
32473
|
-
return
|
|
32508
|
+
return path20.reduce((acc, key) => acc?.[key], obj);
|
|
32474
32509
|
}
|
|
32475
32510
|
function promiseAllObject(promisesObj) {
|
|
32476
32511
|
const keys = Object.keys(promisesObj);
|
|
@@ -32798,11 +32833,11 @@ function explicitlyAborted(x3, startIndex = 0) {
|
|
|
32798
32833
|
}
|
|
32799
32834
|
return false;
|
|
32800
32835
|
}
|
|
32801
|
-
function prefixIssues(
|
|
32836
|
+
function prefixIssues(path20, issues) {
|
|
32802
32837
|
return issues.map((iss) => {
|
|
32803
32838
|
var _a4;
|
|
32804
32839
|
(_a4 = iss).path ?? (_a4.path = []);
|
|
32805
|
-
iss.path.unshift(
|
|
32840
|
+
iss.path.unshift(path20);
|
|
32806
32841
|
return iss;
|
|
32807
32842
|
});
|
|
32808
32843
|
}
|
|
@@ -33020,16 +33055,16 @@ function flattenError(error52, mapper = (issue2) => issue2.message) {
|
|
|
33020
33055
|
}
|
|
33021
33056
|
function formatError(error52, mapper = (issue2) => issue2.message) {
|
|
33022
33057
|
const fieldErrors = { _errors: [] };
|
|
33023
|
-
const processError = (error53,
|
|
33058
|
+
const processError = (error53, path20 = []) => {
|
|
33024
33059
|
for (const issue2 of error53.issues) {
|
|
33025
33060
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
33026
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
33061
|
+
issue2.errors.map((issues) => processError({ issues }, [...path20, ...issue2.path]));
|
|
33027
33062
|
} else if (issue2.code === "invalid_key") {
|
|
33028
|
-
processError({ issues: issue2.issues }, [...
|
|
33063
|
+
processError({ issues: issue2.issues }, [...path20, ...issue2.path]);
|
|
33029
33064
|
} else if (issue2.code === "invalid_element") {
|
|
33030
|
-
processError({ issues: issue2.issues }, [...
|
|
33065
|
+
processError({ issues: issue2.issues }, [...path20, ...issue2.path]);
|
|
33031
33066
|
} else {
|
|
33032
|
-
const fullpath = [...
|
|
33067
|
+
const fullpath = [...path20, ...issue2.path];
|
|
33033
33068
|
if (fullpath.length === 0) {
|
|
33034
33069
|
fieldErrors._errors.push(mapper(issue2));
|
|
33035
33070
|
} else {
|
|
@@ -33056,17 +33091,17 @@ function formatError(error52, mapper = (issue2) => issue2.message) {
|
|
|
33056
33091
|
}
|
|
33057
33092
|
function treeifyError(error52, mapper = (issue2) => issue2.message) {
|
|
33058
33093
|
const result = { errors: [] };
|
|
33059
|
-
const processError = (error53,
|
|
33094
|
+
const processError = (error53, path20 = []) => {
|
|
33060
33095
|
var _a4, _b;
|
|
33061
33096
|
for (const issue2 of error53.issues) {
|
|
33062
33097
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
33063
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
33098
|
+
issue2.errors.map((issues) => processError({ issues }, [...path20, ...issue2.path]));
|
|
33064
33099
|
} else if (issue2.code === "invalid_key") {
|
|
33065
|
-
processError({ issues: issue2.issues }, [...
|
|
33100
|
+
processError({ issues: issue2.issues }, [...path20, ...issue2.path]);
|
|
33066
33101
|
} else if (issue2.code === "invalid_element") {
|
|
33067
|
-
processError({ issues: issue2.issues }, [...
|
|
33102
|
+
processError({ issues: issue2.issues }, [...path20, ...issue2.path]);
|
|
33068
33103
|
} else {
|
|
33069
|
-
const fullpath = [...
|
|
33104
|
+
const fullpath = [...path20, ...issue2.path];
|
|
33070
33105
|
if (fullpath.length === 0) {
|
|
33071
33106
|
result.errors.push(mapper(issue2));
|
|
33072
33107
|
continue;
|
|
@@ -33098,8 +33133,8 @@ function treeifyError(error52, mapper = (issue2) => issue2.message) {
|
|
|
33098
33133
|
}
|
|
33099
33134
|
function toDotPath(_path) {
|
|
33100
33135
|
const segs = [];
|
|
33101
|
-
const
|
|
33102
|
-
for (const seg of
|
|
33136
|
+
const path20 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
33137
|
+
for (const seg of path20) {
|
|
33103
33138
|
if (typeof seg === "number")
|
|
33104
33139
|
segs.push(`[${seg}]`);
|
|
33105
33140
|
else if (typeof seg === "symbol")
|
|
@@ -46860,13 +46895,13 @@ function resolveRef2(ref, ctx) {
|
|
|
46860
46895
|
if (!ref.startsWith("#")) {
|
|
46861
46896
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
46862
46897
|
}
|
|
46863
|
-
const
|
|
46864
|
-
if (
|
|
46898
|
+
const path20 = ref.slice(1).split("/").filter(Boolean);
|
|
46899
|
+
if (path20.length === 0) {
|
|
46865
46900
|
return ctx.rootSchema;
|
|
46866
46901
|
}
|
|
46867
46902
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
46868
|
-
if (
|
|
46869
|
-
const key =
|
|
46903
|
+
if (path20[0] === defsKey) {
|
|
46904
|
+
const key = path20[1];
|
|
46870
46905
|
if (!key || !ctx.defs[key]) {
|
|
46871
46906
|
throw new Error(`Reference not found: ${ref}`);
|
|
46872
46907
|
}
|
|
@@ -55035,8 +55070,8 @@ var require_utils2 = __commonJS({
|
|
|
55035
55070
|
}
|
|
55036
55071
|
return ind;
|
|
55037
55072
|
}
|
|
55038
|
-
function removeDotSegments(
|
|
55039
|
-
let input =
|
|
55073
|
+
function removeDotSegments(path20) {
|
|
55074
|
+
let input = path20;
|
|
55040
55075
|
const output = [];
|
|
55041
55076
|
let nextSlash = -1;
|
|
55042
55077
|
let len = 0;
|
|
@@ -55289,8 +55324,8 @@ var require_schemes = __commonJS({
|
|
|
55289
55324
|
wsComponent.secure = void 0;
|
|
55290
55325
|
}
|
|
55291
55326
|
if (wsComponent.resourceName) {
|
|
55292
|
-
const [
|
|
55293
|
-
wsComponent.path =
|
|
55327
|
+
const [path20, query] = wsComponent.resourceName.split("?");
|
|
55328
|
+
wsComponent.path = path20 && path20 !== "/" ? path20 : void 0;
|
|
55294
55329
|
wsComponent.query = query;
|
|
55295
55330
|
wsComponent.resourceName = void 0;
|
|
55296
55331
|
}
|
|
@@ -58729,12 +58764,12 @@ var require_dist3 = __commonJS({
|
|
|
58729
58764
|
throw new Error(`Unknown format "${name}"`);
|
|
58730
58765
|
return f;
|
|
58731
58766
|
};
|
|
58732
|
-
function addFormats(ajv, list,
|
|
58767
|
+
function addFormats(ajv, list, fs15, exportName) {
|
|
58733
58768
|
var _a4;
|
|
58734
58769
|
var _b;
|
|
58735
58770
|
(_a4 = (_b = ajv.opts.code).formats) !== null && _a4 !== void 0 ? _a4 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
58736
58771
|
for (const f of list)
|
|
58737
|
-
ajv.addFormat(f,
|
|
58772
|
+
ajv.addFormat(f, fs15[f]);
|
|
58738
58773
|
}
|
|
58739
58774
|
module.exports = exports = formatsPlugin;
|
|
58740
58775
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -61738,11 +61773,12 @@ var init_server4 = __esm({
|
|
|
61738
61773
|
}
|
|
61739
61774
|
});
|
|
61740
61775
|
|
|
61741
|
-
// node_modules/.pnpm/commander@
|
|
61742
|
-
var
|
|
61743
|
-
|
|
61776
|
+
// node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/error.js
|
|
61777
|
+
var CommanderError, InvalidArgumentError;
|
|
61778
|
+
var init_error = __esm({
|
|
61779
|
+
"node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/error.js"() {
|
|
61744
61780
|
init_define_WEB_FIRST_SEGMENTS();
|
|
61745
|
-
|
|
61781
|
+
CommanderError = class extends Error {
|
|
61746
61782
|
/**
|
|
61747
61783
|
* Constructs the CommanderError class
|
|
61748
61784
|
* @param {number} exitCode suggested exit code which could be used with process.exit
|
|
@@ -61758,7 +61794,7 @@ var require_error = __commonJS({
|
|
|
61758
61794
|
this.nestedError = void 0;
|
|
61759
61795
|
}
|
|
61760
61796
|
};
|
|
61761
|
-
|
|
61797
|
+
InvalidArgumentError = class extends CommanderError {
|
|
61762
61798
|
/**
|
|
61763
61799
|
* Constructs the InvalidArgumentError class
|
|
61764
61800
|
* @param {string} [message] explanation of why argument is invalid
|
|
@@ -61769,17 +61805,20 @@ var require_error = __commonJS({
|
|
|
61769
61805
|
this.name = this.constructor.name;
|
|
61770
61806
|
}
|
|
61771
61807
|
};
|
|
61772
|
-
exports.CommanderError = CommanderError2;
|
|
61773
|
-
exports.InvalidArgumentError = InvalidArgumentError2;
|
|
61774
61808
|
}
|
|
61775
61809
|
});
|
|
61776
61810
|
|
|
61777
|
-
// node_modules/.pnpm/commander@
|
|
61778
|
-
|
|
61779
|
-
|
|
61811
|
+
// node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/argument.js
|
|
61812
|
+
function humanReadableArgName(arg) {
|
|
61813
|
+
const nameOutput = arg.name() + (arg.variadic === true ? "..." : "");
|
|
61814
|
+
return arg.required ? "<" + nameOutput + ">" : "[" + nameOutput + "]";
|
|
61815
|
+
}
|
|
61816
|
+
var Argument;
|
|
61817
|
+
var init_argument = __esm({
|
|
61818
|
+
"node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/argument.js"() {
|
|
61780
61819
|
init_define_WEB_FIRST_SEGMENTS();
|
|
61781
|
-
|
|
61782
|
-
|
|
61820
|
+
init_error();
|
|
61821
|
+
Argument = class {
|
|
61783
61822
|
/**
|
|
61784
61823
|
* Initialize a new command argument with the given name and description.
|
|
61785
61824
|
* The default is that the argument is required, and you can explicitly
|
|
@@ -61864,7 +61903,7 @@ var require_argument = __commonJS({
|
|
|
61864
61903
|
this.argChoices = values.slice();
|
|
61865
61904
|
this.parseArg = (arg, previous) => {
|
|
61866
61905
|
if (!this.argChoices.includes(arg)) {
|
|
61867
|
-
throw new
|
|
61906
|
+
throw new InvalidArgumentError(
|
|
61868
61907
|
`Allowed choices are ${this.argChoices.join(", ")}.`
|
|
61869
61908
|
);
|
|
61870
61909
|
}
|
|
@@ -61894,21 +61933,17 @@ var require_argument = __commonJS({
|
|
|
61894
61933
|
return this;
|
|
61895
61934
|
}
|
|
61896
61935
|
};
|
|
61897
|
-
function humanReadableArgName(arg) {
|
|
61898
|
-
const nameOutput = arg.name() + (arg.variadic === true ? "..." : "");
|
|
61899
|
-
return arg.required ? "<" + nameOutput + ">" : "[" + nameOutput + "]";
|
|
61900
|
-
}
|
|
61901
|
-
exports.Argument = Argument2;
|
|
61902
|
-
exports.humanReadableArgName = humanReadableArgName;
|
|
61903
61936
|
}
|
|
61904
61937
|
});
|
|
61905
61938
|
|
|
61906
|
-
// node_modules/.pnpm/commander@
|
|
61907
|
-
|
|
61908
|
-
|
|
61939
|
+
// node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/help.js
|
|
61940
|
+
import { stripVTControlCharacters } from "node:util";
|
|
61941
|
+
var Help;
|
|
61942
|
+
var init_help = __esm({
|
|
61943
|
+
"node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/help.js"() {
|
|
61909
61944
|
init_define_WEB_FIRST_SEGMENTS();
|
|
61910
|
-
|
|
61911
|
-
|
|
61945
|
+
init_argument();
|
|
61946
|
+
Help = class {
|
|
61912
61947
|
constructor() {
|
|
61913
61948
|
this.helpWidth = void 0;
|
|
61914
61949
|
this.minWidthToWrap = 40;
|
|
@@ -62338,7 +62373,7 @@ var require_help = __commonJS({
|
|
|
62338
62373
|
* @returns {number}
|
|
62339
62374
|
*/
|
|
62340
62375
|
displayWidth(str) {
|
|
62341
|
-
return
|
|
62376
|
+
return stripVTControlCharacters(str).length;
|
|
62342
62377
|
}
|
|
62343
62378
|
/**
|
|
62344
62379
|
* Style the title for displaying in the help. Called with 'Usage:', 'Options:', etc.
|
|
@@ -62497,21 +62532,60 @@ ${itemIndentStr}`);
|
|
|
62497
62532
|
return wrappedLines.join("\n");
|
|
62498
62533
|
}
|
|
62499
62534
|
};
|
|
62500
|
-
function stripColor(str) {
|
|
62501
|
-
const sgrPattern = /\x1b\[\d*(;\d*)*m/g;
|
|
62502
|
-
return str.replace(sgrPattern, "");
|
|
62503
|
-
}
|
|
62504
|
-
exports.Help = Help2;
|
|
62505
|
-
exports.stripColor = stripColor;
|
|
62506
62535
|
}
|
|
62507
62536
|
});
|
|
62508
62537
|
|
|
62509
|
-
// node_modules/.pnpm/commander@
|
|
62510
|
-
|
|
62511
|
-
"
|
|
62538
|
+
// node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/option.js
|
|
62539
|
+
function camelcase(str) {
|
|
62540
|
+
return str.split("-").reduce((str2, word) => {
|
|
62541
|
+
return str2 + word[0].toUpperCase() + word.slice(1);
|
|
62542
|
+
});
|
|
62543
|
+
}
|
|
62544
|
+
function splitOptionFlags(flags) {
|
|
62545
|
+
let shortFlag;
|
|
62546
|
+
let longFlag;
|
|
62547
|
+
const shortFlagExp = /^-[^-]$/;
|
|
62548
|
+
const longFlagExp = /^--[^-]/;
|
|
62549
|
+
const flagParts = flags.split(/[ |,]+/).concat("guard");
|
|
62550
|
+
if (shortFlagExp.test(flagParts[0])) shortFlag = flagParts.shift();
|
|
62551
|
+
if (longFlagExp.test(flagParts[0])) longFlag = flagParts.shift();
|
|
62552
|
+
if (!shortFlag && shortFlagExp.test(flagParts[0]))
|
|
62553
|
+
shortFlag = flagParts.shift();
|
|
62554
|
+
if (!shortFlag && longFlagExp.test(flagParts[0])) {
|
|
62555
|
+
shortFlag = longFlag;
|
|
62556
|
+
longFlag = flagParts.shift();
|
|
62557
|
+
}
|
|
62558
|
+
if (flagParts[0].startsWith("-")) {
|
|
62559
|
+
const unsupportedFlag = flagParts[0];
|
|
62560
|
+
const baseError = `option creation failed due to '${unsupportedFlag}' in option flags '${flags}'`;
|
|
62561
|
+
if (/^-[^-][^-]/.test(unsupportedFlag))
|
|
62562
|
+
throw new Error(
|
|
62563
|
+
`${baseError}
|
|
62564
|
+
- a short flag is a single dash and a single character
|
|
62565
|
+
- either use a single dash and a single character (for a short flag)
|
|
62566
|
+
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`
|
|
62567
|
+
);
|
|
62568
|
+
if (shortFlagExp.test(unsupportedFlag))
|
|
62569
|
+
throw new Error(`${baseError}
|
|
62570
|
+
- too many short flags`);
|
|
62571
|
+
if (longFlagExp.test(unsupportedFlag))
|
|
62572
|
+
throw new Error(`${baseError}
|
|
62573
|
+
- too many long flags`);
|
|
62574
|
+
throw new Error(`${baseError}
|
|
62575
|
+
- unrecognised flag format`);
|
|
62576
|
+
}
|
|
62577
|
+
if (shortFlag === void 0 && longFlag === void 0)
|
|
62578
|
+
throw new Error(
|
|
62579
|
+
`option creation failed due to no flags found in '${flags}'.`
|
|
62580
|
+
);
|
|
62581
|
+
return { shortFlag, longFlag };
|
|
62582
|
+
}
|
|
62583
|
+
var Option, DualOptions;
|
|
62584
|
+
var init_option = __esm({
|
|
62585
|
+
"node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/option.js"() {
|
|
62512
62586
|
init_define_WEB_FIRST_SEGMENTS();
|
|
62513
|
-
|
|
62514
|
-
|
|
62587
|
+
init_error();
|
|
62588
|
+
Option = class {
|
|
62515
62589
|
/**
|
|
62516
62590
|
* Initialize a new `Option` with the given `flags` and `description`.
|
|
62517
62591
|
*
|
|
@@ -62669,7 +62743,7 @@ var require_option = __commonJS({
|
|
|
62669
62743
|
this.argChoices = values.slice();
|
|
62670
62744
|
this.parseArg = (arg, previous) => {
|
|
62671
62745
|
if (!this.argChoices.includes(arg)) {
|
|
62672
|
-
throw new
|
|
62746
|
+
throw new InvalidArgumentError(
|
|
62673
62747
|
`Allowed choices are ${this.argChoices.join(", ")}.`
|
|
62674
62748
|
);
|
|
62675
62749
|
}
|
|
@@ -62735,7 +62809,7 @@ var require_option = __commonJS({
|
|
|
62735
62809
|
return !this.required && !this.optional && !this.negate;
|
|
62736
62810
|
}
|
|
62737
62811
|
};
|
|
62738
|
-
|
|
62812
|
+
DualOptions = class {
|
|
62739
62813
|
/**
|
|
62740
62814
|
* @param {Option[]} options
|
|
62741
62815
|
*/
|
|
@@ -62771,151 +62845,143 @@ var require_option = __commonJS({
|
|
|
62771
62845
|
return option.negate === (negativeValue === value);
|
|
62772
62846
|
}
|
|
62773
62847
|
};
|
|
62774
|
-
function camelcase(str) {
|
|
62775
|
-
return str.split("-").reduce((str2, word) => {
|
|
62776
|
-
return str2 + word[0].toUpperCase() + word.slice(1);
|
|
62777
|
-
});
|
|
62778
|
-
}
|
|
62779
|
-
function splitOptionFlags(flags) {
|
|
62780
|
-
let shortFlag;
|
|
62781
|
-
let longFlag;
|
|
62782
|
-
const shortFlagExp = /^-[^-]$/;
|
|
62783
|
-
const longFlagExp = /^--[^-]/;
|
|
62784
|
-
const flagParts = flags.split(/[ |,]+/).concat("guard");
|
|
62785
|
-
if (shortFlagExp.test(flagParts[0])) shortFlag = flagParts.shift();
|
|
62786
|
-
if (longFlagExp.test(flagParts[0])) longFlag = flagParts.shift();
|
|
62787
|
-
if (!shortFlag && shortFlagExp.test(flagParts[0]))
|
|
62788
|
-
shortFlag = flagParts.shift();
|
|
62789
|
-
if (!shortFlag && longFlagExp.test(flagParts[0])) {
|
|
62790
|
-
shortFlag = longFlag;
|
|
62791
|
-
longFlag = flagParts.shift();
|
|
62792
|
-
}
|
|
62793
|
-
if (flagParts[0].startsWith("-")) {
|
|
62794
|
-
const unsupportedFlag = flagParts[0];
|
|
62795
|
-
const baseError = `option creation failed due to '${unsupportedFlag}' in option flags '${flags}'`;
|
|
62796
|
-
if (/^-[^-][^-]/.test(unsupportedFlag))
|
|
62797
|
-
throw new Error(
|
|
62798
|
-
`${baseError}
|
|
62799
|
-
- a short flag is a single dash and a single character
|
|
62800
|
-
- either use a single dash and a single character (for a short flag)
|
|
62801
|
-
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`
|
|
62802
|
-
);
|
|
62803
|
-
if (shortFlagExp.test(unsupportedFlag))
|
|
62804
|
-
throw new Error(`${baseError}
|
|
62805
|
-
- too many short flags`);
|
|
62806
|
-
if (longFlagExp.test(unsupportedFlag))
|
|
62807
|
-
throw new Error(`${baseError}
|
|
62808
|
-
- too many long flags`);
|
|
62809
|
-
throw new Error(`${baseError}
|
|
62810
|
-
- unrecognised flag format`);
|
|
62811
|
-
}
|
|
62812
|
-
if (shortFlag === void 0 && longFlag === void 0)
|
|
62813
|
-
throw new Error(
|
|
62814
|
-
`option creation failed due to no flags found in '${flags}'.`
|
|
62815
|
-
);
|
|
62816
|
-
return { shortFlag, longFlag };
|
|
62817
|
-
}
|
|
62818
|
-
exports.Option = Option2;
|
|
62819
|
-
exports.DualOptions = DualOptions;
|
|
62820
62848
|
}
|
|
62821
62849
|
});
|
|
62822
62850
|
|
|
62823
|
-
// node_modules/.pnpm/commander@
|
|
62824
|
-
|
|
62825
|
-
|
|
62826
|
-
|
|
62827
|
-
|
|
62828
|
-
|
|
62829
|
-
|
|
62830
|
-
|
|
62831
|
-
|
|
62832
|
-
|
|
62833
|
-
|
|
62834
|
-
|
|
62835
|
-
|
|
62836
|
-
|
|
62837
|
-
|
|
62838
|
-
|
|
62839
|
-
|
|
62840
|
-
|
|
62841
|
-
|
|
62842
|
-
|
|
62843
|
-
|
|
62844
|
-
|
|
62845
|
-
|
|
62846
|
-
|
|
62847
|
-
|
|
62848
|
-
|
|
62849
|
-
|
|
62850
|
-
|
|
62851
|
-
|
|
62852
|
-
// substitution
|
|
62853
|
-
);
|
|
62854
|
-
if (i2 > 1 && j3 > 1 && a[i2 - 1] === b2[j3 - 2] && a[i2 - 2] === b2[j3 - 1]) {
|
|
62855
|
-
d[i2][j3] = Math.min(d[i2][j3], d[i2 - 2][j3 - 2] + 1);
|
|
62856
|
-
}
|
|
62857
|
-
}
|
|
62851
|
+
// node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/suggestSimilar.js
|
|
62852
|
+
function editDistance(a, b2) {
|
|
62853
|
+
if (Math.abs(a.length - b2.length) > maxDistance)
|
|
62854
|
+
return Math.max(a.length, b2.length);
|
|
62855
|
+
const d = [];
|
|
62856
|
+
for (let i2 = 0; i2 <= a.length; i2++) {
|
|
62857
|
+
d[i2] = [i2];
|
|
62858
|
+
}
|
|
62859
|
+
for (let j3 = 0; j3 <= b2.length; j3++) {
|
|
62860
|
+
d[0][j3] = j3;
|
|
62861
|
+
}
|
|
62862
|
+
for (let j3 = 1; j3 <= b2.length; j3++) {
|
|
62863
|
+
for (let i2 = 1; i2 <= a.length; i2++) {
|
|
62864
|
+
let cost;
|
|
62865
|
+
if (a[i2 - 1] === b2[j3 - 1]) {
|
|
62866
|
+
cost = 0;
|
|
62867
|
+
} else {
|
|
62868
|
+
cost = 1;
|
|
62869
|
+
}
|
|
62870
|
+
d[i2][j3] = Math.min(
|
|
62871
|
+
d[i2 - 1][j3] + 1,
|
|
62872
|
+
// deletion
|
|
62873
|
+
d[i2][j3 - 1] + 1,
|
|
62874
|
+
// insertion
|
|
62875
|
+
d[i2 - 1][j3 - 1] + cost
|
|
62876
|
+
// substitution
|
|
62877
|
+
);
|
|
62878
|
+
if (i2 > 1 && j3 > 1 && a[i2 - 1] === b2[j3 - 2] && a[i2 - 2] === b2[j3 - 1]) {
|
|
62879
|
+
d[i2][j3] = Math.min(d[i2][j3], d[i2 - 2][j3 - 2] + 1);
|
|
62858
62880
|
}
|
|
62859
|
-
return d[a.length][b2.length];
|
|
62860
62881
|
}
|
|
62861
|
-
|
|
62862
|
-
|
|
62863
|
-
|
|
62864
|
-
|
|
62865
|
-
|
|
62866
|
-
|
|
62867
|
-
|
|
62868
|
-
|
|
62869
|
-
|
|
62870
|
-
|
|
62871
|
-
|
|
62872
|
-
|
|
62873
|
-
|
|
62874
|
-
|
|
62875
|
-
|
|
62876
|
-
|
|
62877
|
-
|
|
62878
|
-
|
|
62879
|
-
|
|
62880
|
-
|
|
62881
|
-
|
|
62882
|
-
|
|
62883
|
-
|
|
62884
|
-
|
|
62885
|
-
|
|
62886
|
-
similar.sort((a, b2) => a.localeCompare(b2));
|
|
62887
|
-
if (searchingOptions) {
|
|
62888
|
-
similar = similar.map((candidate) => `--${candidate}`);
|
|
62882
|
+
}
|
|
62883
|
+
return d[a.length][b2.length];
|
|
62884
|
+
}
|
|
62885
|
+
function suggestSimilar(word, candidates) {
|
|
62886
|
+
if (!candidates || candidates.length === 0) return "";
|
|
62887
|
+
candidates = Array.from(new Set(candidates));
|
|
62888
|
+
const searchingOptions = word.startsWith("--");
|
|
62889
|
+
if (searchingOptions) {
|
|
62890
|
+
word = word.slice(2);
|
|
62891
|
+
candidates = candidates.map((candidate) => candidate.slice(2));
|
|
62892
|
+
}
|
|
62893
|
+
let similar = [];
|
|
62894
|
+
let bestDistance = maxDistance;
|
|
62895
|
+
const minSimilarity = 0.4;
|
|
62896
|
+
candidates.forEach((candidate) => {
|
|
62897
|
+
if (candidate.length <= 1) return;
|
|
62898
|
+
const distance2 = editDistance(word, candidate);
|
|
62899
|
+
const length = Math.max(word.length, candidate.length);
|
|
62900
|
+
const similarity = (length - distance2) / length;
|
|
62901
|
+
if (similarity > minSimilarity) {
|
|
62902
|
+
if (distance2 < bestDistance) {
|
|
62903
|
+
bestDistance = distance2;
|
|
62904
|
+
similar = [candidate];
|
|
62905
|
+
} else if (distance2 === bestDistance) {
|
|
62906
|
+
similar.push(candidate);
|
|
62889
62907
|
}
|
|
62890
|
-
|
|
62891
|
-
|
|
62908
|
+
}
|
|
62909
|
+
});
|
|
62910
|
+
similar.sort((a, b2) => a.localeCompare(b2));
|
|
62911
|
+
if (searchingOptions) {
|
|
62912
|
+
similar = similar.map((candidate) => `--${candidate}`);
|
|
62913
|
+
}
|
|
62914
|
+
if (similar.length > 1) {
|
|
62915
|
+
return `
|
|
62892
62916
|
(Did you mean one of ${similar.join(", ")}?)`;
|
|
62893
|
-
|
|
62894
|
-
|
|
62895
|
-
|
|
62917
|
+
}
|
|
62918
|
+
if (similar.length === 1) {
|
|
62919
|
+
return `
|
|
62896
62920
|
(Did you mean ${similar[0]}?)`;
|
|
62897
|
-
|
|
62898
|
-
|
|
62899
|
-
|
|
62900
|
-
|
|
62921
|
+
}
|
|
62922
|
+
return "";
|
|
62923
|
+
}
|
|
62924
|
+
var maxDistance;
|
|
62925
|
+
var init_suggestSimilar = __esm({
|
|
62926
|
+
"node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/suggestSimilar.js"() {
|
|
62927
|
+
init_define_WEB_FIRST_SEGMENTS();
|
|
62928
|
+
maxDistance = 3;
|
|
62901
62929
|
}
|
|
62902
62930
|
});
|
|
62903
62931
|
|
|
62904
|
-
// node_modules/.pnpm/commander@
|
|
62905
|
-
|
|
62906
|
-
|
|
62932
|
+
// node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/command.js
|
|
62933
|
+
import { EventEmitter as EventEmitter2 } from "node:events";
|
|
62934
|
+
import childProcess from "node:child_process";
|
|
62935
|
+
import path18 from "node:path";
|
|
62936
|
+
import fs13 from "node:fs";
|
|
62937
|
+
import process5 from "node:process";
|
|
62938
|
+
import { stripVTControlCharacters as stripVTControlCharacters2 } from "node:util";
|
|
62939
|
+
function incrementNodeInspectorPort(args2) {
|
|
62940
|
+
return args2.map((arg) => {
|
|
62941
|
+
if (!arg.startsWith("--inspect")) {
|
|
62942
|
+
return arg;
|
|
62943
|
+
}
|
|
62944
|
+
let debugOption;
|
|
62945
|
+
let debugHost = "127.0.0.1";
|
|
62946
|
+
let debugPort = "9229";
|
|
62947
|
+
let match;
|
|
62948
|
+
if ((match = arg.match(/^(--inspect(-brk)?)$/)) !== null) {
|
|
62949
|
+
debugOption = match[1];
|
|
62950
|
+
} else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null) {
|
|
62951
|
+
debugOption = match[1];
|
|
62952
|
+
if (/^\d+$/.test(match[3])) {
|
|
62953
|
+
debugPort = match[3];
|
|
62954
|
+
} else {
|
|
62955
|
+
debugHost = match[3];
|
|
62956
|
+
}
|
|
62957
|
+
} else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null) {
|
|
62958
|
+
debugOption = match[1];
|
|
62959
|
+
debugHost = match[3];
|
|
62960
|
+
debugPort = match[4];
|
|
62961
|
+
}
|
|
62962
|
+
if (debugOption && debugPort !== "0") {
|
|
62963
|
+
return `${debugOption}=${debugHost}:${parseInt(debugPort) + 1}`;
|
|
62964
|
+
}
|
|
62965
|
+
return arg;
|
|
62966
|
+
});
|
|
62967
|
+
}
|
|
62968
|
+
function useColor() {
|
|
62969
|
+
if (process5.env.NO_COLOR || process5.env.FORCE_COLOR === "0" || process5.env.FORCE_COLOR === "false")
|
|
62970
|
+
return false;
|
|
62971
|
+
if (process5.env.FORCE_COLOR || process5.env.CLICOLOR_FORCE !== void 0)
|
|
62972
|
+
return true;
|
|
62973
|
+
return void 0;
|
|
62974
|
+
}
|
|
62975
|
+
var Command2;
|
|
62976
|
+
var init_command = __esm({
|
|
62977
|
+
"node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/command.js"() {
|
|
62907
62978
|
init_define_WEB_FIRST_SEGMENTS();
|
|
62908
|
-
|
|
62909
|
-
|
|
62910
|
-
|
|
62911
|
-
|
|
62912
|
-
|
|
62913
|
-
|
|
62914
|
-
var { CommanderError: CommanderError2 } = require_error();
|
|
62915
|
-
var { Help: Help2, stripColor } = require_help();
|
|
62916
|
-
var { Option: Option2, DualOptions } = require_option();
|
|
62917
|
-
var { suggestSimilar } = require_suggestSimilar();
|
|
62918
|
-
var Command3 = class _Command extends EventEmitter2 {
|
|
62979
|
+
init_argument();
|
|
62980
|
+
init_error();
|
|
62981
|
+
init_help();
|
|
62982
|
+
init_option();
|
|
62983
|
+
init_suggestSimilar();
|
|
62984
|
+
Command2 = class _Command extends EventEmitter2 {
|
|
62919
62985
|
/**
|
|
62920
62986
|
* Initialize a new `Command`.
|
|
62921
62987
|
*
|
|
@@ -62956,14 +63022,14 @@ var require_command = __commonJS({
|
|
|
62956
63022
|
this._showSuggestionAfterError = true;
|
|
62957
63023
|
this._savedState = null;
|
|
62958
63024
|
this._outputConfiguration = {
|
|
62959
|
-
writeOut: (str) =>
|
|
62960
|
-
writeErr: (str) =>
|
|
63025
|
+
writeOut: (str) => process5.stdout.write(str),
|
|
63026
|
+
writeErr: (str) => process5.stderr.write(str),
|
|
62961
63027
|
outputError: (str, write) => write(str),
|
|
62962
|
-
getOutHelpWidth: () =>
|
|
62963
|
-
getErrHelpWidth: () =>
|
|
62964
|
-
getOutHasColors: () => useColor() ?? (
|
|
62965
|
-
getErrHasColors: () => useColor() ?? (
|
|
62966
|
-
stripColor: (str) =>
|
|
63028
|
+
getOutHelpWidth: () => process5.stdout.isTTY ? process5.stdout.columns : void 0,
|
|
63029
|
+
getErrHelpWidth: () => process5.stderr.isTTY ? process5.stderr.columns : void 0,
|
|
63030
|
+
getOutHasColors: () => useColor() ?? (process5.stdout.isTTY && process5.stdout.hasColors?.()),
|
|
63031
|
+
getErrHasColors: () => useColor() ?? (process5.stderr.isTTY && process5.stderr.hasColors?.()),
|
|
63032
|
+
stripColor: (str) => stripVTControlCharacters2(str)
|
|
62967
63033
|
};
|
|
62968
63034
|
this._hidden = false;
|
|
62969
63035
|
this._helpOption = void 0;
|
|
@@ -63074,7 +63140,7 @@ var require_command = __commonJS({
|
|
|
63074
63140
|
* @return {Help}
|
|
63075
63141
|
*/
|
|
63076
63142
|
createHelp() {
|
|
63077
|
-
return Object.assign(new
|
|
63143
|
+
return Object.assign(new Help(), this.configureHelp());
|
|
63078
63144
|
}
|
|
63079
63145
|
/**
|
|
63080
63146
|
* You can customise the help by overriding Help properties using configureHelp(),
|
|
@@ -63172,7 +63238,7 @@ var require_command = __commonJS({
|
|
|
63172
63238
|
* @return {Argument} new argument
|
|
63173
63239
|
*/
|
|
63174
63240
|
createArgument(name, description) {
|
|
63175
|
-
return new
|
|
63241
|
+
return new Argument(name, description);
|
|
63176
63242
|
}
|
|
63177
63243
|
/**
|
|
63178
63244
|
* Define argument syntax for command.
|
|
@@ -63354,9 +63420,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
63354
63420
|
*/
|
|
63355
63421
|
_exit(exitCode, code, message) {
|
|
63356
63422
|
if (this._exitCallback) {
|
|
63357
|
-
this._exitCallback(new
|
|
63423
|
+
this._exitCallback(new CommanderError(exitCode, code, message));
|
|
63358
63424
|
}
|
|
63359
|
-
|
|
63425
|
+
process5.exit(exitCode);
|
|
63360
63426
|
}
|
|
63361
63427
|
/**
|
|
63362
63428
|
* Register callback `fn` for the command.
|
|
@@ -63398,7 +63464,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
63398
63464
|
* @return {Option} new option
|
|
63399
63465
|
*/
|
|
63400
63466
|
createOption(flags, description) {
|
|
63401
|
-
return new
|
|
63467
|
+
return new Option(flags, description);
|
|
63402
63468
|
}
|
|
63403
63469
|
/**
|
|
63404
63470
|
* Wrap parseArgs to catch 'commander.invalidArgument'.
|
|
@@ -63471,16 +63537,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
63471
63537
|
this._registerOption(option);
|
|
63472
63538
|
const oname = option.name();
|
|
63473
63539
|
const name = option.attributeName();
|
|
63474
|
-
if (option.
|
|
63475
|
-
const positiveLongFlag = option.long.replace(/^--no-/, "--");
|
|
63476
|
-
if (!this._findOption(positiveLongFlag)) {
|
|
63477
|
-
this.setOptionValueWithSource(
|
|
63478
|
-
name,
|
|
63479
|
-
option.defaultValue === void 0 ? true : option.defaultValue,
|
|
63480
|
-
"default"
|
|
63481
|
-
);
|
|
63482
|
-
}
|
|
63483
|
-
} else if (option.defaultValue !== void 0) {
|
|
63540
|
+
if (option.defaultValue !== void 0) {
|
|
63484
63541
|
this.setOptionValueWithSource(name, option.defaultValue, "default");
|
|
63485
63542
|
}
|
|
63486
63543
|
const handleOptionValue = (val, invalidValueMessage, valueSource) => {
|
|
@@ -63523,7 +63580,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
63523
63580
|
* @private
|
|
63524
63581
|
*/
|
|
63525
63582
|
_optionEx(config2, flags, description, fn, defaultValue) {
|
|
63526
|
-
if (typeof flags === "object" && flags instanceof
|
|
63583
|
+
if (typeof flags === "object" && flags instanceof Option) {
|
|
63527
63584
|
throw new Error(
|
|
63528
63585
|
"To add an Option object use addOption() instead of option() or requiredOption()"
|
|
63529
63586
|
);
|
|
@@ -63756,16 +63813,16 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
63756
63813
|
}
|
|
63757
63814
|
parseOptions = parseOptions || {};
|
|
63758
63815
|
if (argv === void 0 && parseOptions.from === void 0) {
|
|
63759
|
-
if (
|
|
63816
|
+
if (process5.versions?.electron) {
|
|
63760
63817
|
parseOptions.from = "electron";
|
|
63761
63818
|
}
|
|
63762
|
-
const execArgv =
|
|
63819
|
+
const execArgv = process5.execArgv ?? [];
|
|
63763
63820
|
if (execArgv.includes("-e") || execArgv.includes("--eval") || execArgv.includes("-p") || execArgv.includes("--print")) {
|
|
63764
63821
|
parseOptions.from = "eval";
|
|
63765
63822
|
}
|
|
63766
63823
|
}
|
|
63767
63824
|
if (argv === void 0) {
|
|
63768
|
-
argv =
|
|
63825
|
+
argv = process5.argv;
|
|
63769
63826
|
}
|
|
63770
63827
|
this.rawArgs = argv.slice();
|
|
63771
63828
|
let userArgs;
|
|
@@ -63776,7 +63833,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
63776
63833
|
userArgs = argv.slice(2);
|
|
63777
63834
|
break;
|
|
63778
63835
|
case "electron":
|
|
63779
|
-
if (
|
|
63836
|
+
if (process5.defaultApp) {
|
|
63780
63837
|
this._scriptPath = argv[1];
|
|
63781
63838
|
userArgs = argv.slice(2);
|
|
63782
63839
|
} else {
|
|
@@ -63855,6 +63912,18 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
63855
63912
|
}
|
|
63856
63913
|
_prepareForParse() {
|
|
63857
63914
|
if (this._savedState === null) {
|
|
63915
|
+
this.options.filter(
|
|
63916
|
+
(option) => option.negate && option.defaultValue === void 0 && this.getOptionValue(option.attributeName()) === void 0
|
|
63917
|
+
).forEach((option) => {
|
|
63918
|
+
const positiveLongFlag = option.long.replace(/^--no-/, "--");
|
|
63919
|
+
if (!this._findOption(positiveLongFlag)) {
|
|
63920
|
+
this.setOptionValueWithSource(
|
|
63921
|
+
option.attributeName(),
|
|
63922
|
+
true,
|
|
63923
|
+
"default"
|
|
63924
|
+
);
|
|
63925
|
+
}
|
|
63926
|
+
});
|
|
63858
63927
|
this.saveStateBeforeParse();
|
|
63859
63928
|
} else {
|
|
63860
63929
|
this.restoreStateBeforeParse();
|
|
@@ -63902,7 +63971,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
63902
63971
|
* @param {string} subcommandName
|
|
63903
63972
|
*/
|
|
63904
63973
|
_checkForMissingExecutable(executableFile, executableDir, subcommandName) {
|
|
63905
|
-
if (
|
|
63974
|
+
if (fs13.existsSync(executableFile)) return;
|
|
63906
63975
|
const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
|
|
63907
63976
|
const executableMissing = `'${executableFile}' does not exist
|
|
63908
63977
|
- if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
@@ -63917,14 +63986,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
63917
63986
|
*/
|
|
63918
63987
|
_executeSubCommand(subcommand, args2) {
|
|
63919
63988
|
args2 = args2.slice();
|
|
63920
|
-
let launchWithNode = false;
|
|
63921
63989
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
63922
63990
|
function findFile(baseDir, baseName) {
|
|
63923
|
-
const localBin =
|
|
63924
|
-
if (
|
|
63925
|
-
if (sourceExt.includes(
|
|
63991
|
+
const localBin = path18.resolve(baseDir, baseName);
|
|
63992
|
+
if (fs13.existsSync(localBin)) return localBin;
|
|
63993
|
+
if (sourceExt.includes(path18.extname(baseName))) return void 0;
|
|
63926
63994
|
const foundExt = sourceExt.find(
|
|
63927
|
-
(ext) =>
|
|
63995
|
+
(ext) => fs13.existsSync(`${localBin}${ext}`)
|
|
63928
63996
|
);
|
|
63929
63997
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
63930
63998
|
return void 0;
|
|
@@ -63936,21 +64004,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
63936
64004
|
if (this._scriptPath) {
|
|
63937
64005
|
let resolvedScriptPath;
|
|
63938
64006
|
try {
|
|
63939
|
-
resolvedScriptPath =
|
|
64007
|
+
resolvedScriptPath = fs13.realpathSync(this._scriptPath);
|
|
63940
64008
|
} catch {
|
|
63941
64009
|
resolvedScriptPath = this._scriptPath;
|
|
63942
64010
|
}
|
|
63943
|
-
executableDir =
|
|
63944
|
-
|
|
64011
|
+
executableDir = path18.resolve(
|
|
64012
|
+
path18.dirname(resolvedScriptPath),
|
|
63945
64013
|
executableDir
|
|
63946
64014
|
);
|
|
63947
64015
|
}
|
|
63948
64016
|
if (executableDir) {
|
|
63949
64017
|
let localFile = findFile(executableDir, executableFile);
|
|
63950
64018
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
63951
|
-
const legacyName =
|
|
64019
|
+
const legacyName = path18.basename(
|
|
63952
64020
|
this._scriptPath,
|
|
63953
|
-
|
|
64021
|
+
path18.extname(this._scriptPath)
|
|
63954
64022
|
);
|
|
63955
64023
|
if (legacyName !== this._name) {
|
|
63956
64024
|
localFile = findFile(
|
|
@@ -63961,13 +64029,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
63961
64029
|
}
|
|
63962
64030
|
executableFile = localFile || executableFile;
|
|
63963
64031
|
}
|
|
63964
|
-
launchWithNode = sourceExt.includes(
|
|
64032
|
+
const launchWithNode = sourceExt.includes(path18.extname(executableFile));
|
|
63965
64033
|
let proc;
|
|
63966
|
-
if (
|
|
64034
|
+
if (process5.platform !== "win32") {
|
|
63967
64035
|
if (launchWithNode) {
|
|
63968
64036
|
args2.unshift(executableFile);
|
|
63969
|
-
args2 = incrementNodeInspectorPort(
|
|
63970
|
-
proc = childProcess.spawn(
|
|
64037
|
+
args2 = incrementNodeInspectorPort(process5.execArgv).concat(args2);
|
|
64038
|
+
proc = childProcess.spawn(process5.argv[0], args2, { stdio: "inherit" });
|
|
63971
64039
|
} else {
|
|
63972
64040
|
proc = childProcess.spawn(executableFile, args2, { stdio: "inherit" });
|
|
63973
64041
|
}
|
|
@@ -63978,13 +64046,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
63978
64046
|
subcommand._name
|
|
63979
64047
|
);
|
|
63980
64048
|
args2.unshift(executableFile);
|
|
63981
|
-
args2 = incrementNodeInspectorPort(
|
|
63982
|
-
proc = childProcess.spawn(
|
|
64049
|
+
args2 = incrementNodeInspectorPort(process5.execArgv).concat(args2);
|
|
64050
|
+
proc = childProcess.spawn(process5.execPath, args2, { stdio: "inherit" });
|
|
63983
64051
|
}
|
|
63984
64052
|
if (!proc.killed) {
|
|
63985
64053
|
const signals2 = ["SIGUSR1", "SIGUSR2", "SIGTERM", "SIGINT", "SIGHUP"];
|
|
63986
64054
|
signals2.forEach((signal) => {
|
|
63987
|
-
|
|
64055
|
+
process5.on(signal, () => {
|
|
63988
64056
|
if (proc.killed === false && proc.exitCode === null) {
|
|
63989
64057
|
proc.kill(signal);
|
|
63990
64058
|
}
|
|
@@ -63995,10 +64063,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
63995
64063
|
proc.on("close", (code) => {
|
|
63996
64064
|
code = code ?? 1;
|
|
63997
64065
|
if (!exitCallback) {
|
|
63998
|
-
|
|
64066
|
+
process5.exit(code);
|
|
63999
64067
|
} else {
|
|
64000
64068
|
exitCallback(
|
|
64001
|
-
new
|
|
64069
|
+
new CommanderError(
|
|
64002
64070
|
code,
|
|
64003
64071
|
"commander.executeSubCommandAsync",
|
|
64004
64072
|
"(close)"
|
|
@@ -64017,9 +64085,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
64017
64085
|
throw new Error(`'${executableFile}' not executable`);
|
|
64018
64086
|
}
|
|
64019
64087
|
if (!exitCallback) {
|
|
64020
|
-
|
|
64088
|
+
process5.exit(1);
|
|
64021
64089
|
} else {
|
|
64022
|
-
const wrappedError = new
|
|
64090
|
+
const wrappedError = new CommanderError(
|
|
64023
64091
|
1,
|
|
64024
64092
|
"commander.executeSubCommandAsync",
|
|
64025
64093
|
"(error)"
|
|
@@ -64517,13 +64585,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
64517
64585
|
*/
|
|
64518
64586
|
_parseOptionsEnv() {
|
|
64519
64587
|
this.options.forEach((option) => {
|
|
64520
|
-
if (option.envVar && option.envVar in
|
|
64588
|
+
if (option.envVar && option.envVar in process5.env) {
|
|
64521
64589
|
const optionKey = option.attributeName();
|
|
64522
64590
|
if (this.getOptionValue(optionKey) === void 0 || ["default", "config", "env"].includes(
|
|
64523
64591
|
this.getOptionValueSource(optionKey)
|
|
64524
64592
|
)) {
|
|
64525
64593
|
if (option.required || option.optional) {
|
|
64526
|
-
this.emit(`optionEnv:${option.name()}`,
|
|
64594
|
+
this.emit(`optionEnv:${option.name()}`, process5.env[option.envVar]);
|
|
64527
64595
|
} else {
|
|
64528
64596
|
this.emit(`optionEnv:${option.name()}`);
|
|
64529
64597
|
}
|
|
@@ -64652,8 +64720,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
64652
64720
|
if (this._allowExcessArguments) return;
|
|
64653
64721
|
const expected = this.registeredArguments.length;
|
|
64654
64722
|
const s = expected === 1 ? "" : "s";
|
|
64723
|
+
const received = receivedArgs.length;
|
|
64655
64724
|
const forSubcommand = this.parent ? ` for '${this.name()}'` : "";
|
|
64656
|
-
const
|
|
64725
|
+
const details = receivedArgs.join(", ");
|
|
64726
|
+
const message = `error: too many arguments${forSubcommand}. Expected ${expected} argument${s} but got ${received}: ${details}.`;
|
|
64657
64727
|
this.error(message, { code: "commander.excessArguments" });
|
|
64658
64728
|
}
|
|
64659
64729
|
/**
|
|
@@ -64865,25 +64935,25 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
64865
64935
|
}
|
|
64866
64936
|
/**
|
|
64867
64937
|
* Set the name of the command from script filename, such as process.argv[1],
|
|
64868
|
-
* or
|
|
64938
|
+
* or import.meta.filename.
|
|
64869
64939
|
*
|
|
64870
64940
|
* (Used internally and public although not documented in README.)
|
|
64871
64941
|
*
|
|
64872
64942
|
* @example
|
|
64873
|
-
* program.nameFromFilename(
|
|
64943
|
+
* program.nameFromFilename(import.meta.filename);
|
|
64874
64944
|
*
|
|
64875
64945
|
* @param {string} filename
|
|
64876
64946
|
* @return {Command}
|
|
64877
64947
|
*/
|
|
64878
64948
|
nameFromFilename(filename) {
|
|
64879
|
-
this._name =
|
|
64949
|
+
this._name = path18.basename(filename, path18.extname(filename));
|
|
64880
64950
|
return this;
|
|
64881
64951
|
}
|
|
64882
64952
|
/**
|
|
64883
64953
|
* Get or set the directory for searching for executable subcommands of this command.
|
|
64884
64954
|
*
|
|
64885
64955
|
* @example
|
|
64886
|
-
* program.executableDir(
|
|
64956
|
+
* program.executableDir(import.meta.dirname);
|
|
64887
64957
|
* // or
|
|
64888
64958
|
* program.executableDir('subcommands');
|
|
64889
64959
|
*
|
|
@@ -65047,7 +65117,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
65047
65117
|
*/
|
|
65048
65118
|
help(contextOptions) {
|
|
65049
65119
|
this.outputHelp(contextOptions);
|
|
65050
|
-
let exitCode = Number(
|
|
65120
|
+
let exitCode = Number(process5.exitCode ?? 0);
|
|
65051
65121
|
if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
|
|
65052
65122
|
exitCode = 1;
|
|
65053
65123
|
}
|
|
@@ -65107,92 +65177,20 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
65107
65177
|
}
|
|
65108
65178
|
}
|
|
65109
65179
|
};
|
|
65110
|
-
function incrementNodeInspectorPort(args2) {
|
|
65111
|
-
return args2.map((arg) => {
|
|
65112
|
-
if (!arg.startsWith("--inspect")) {
|
|
65113
|
-
return arg;
|
|
65114
|
-
}
|
|
65115
|
-
let debugOption;
|
|
65116
|
-
let debugHost = "127.0.0.1";
|
|
65117
|
-
let debugPort = "9229";
|
|
65118
|
-
let match;
|
|
65119
|
-
if ((match = arg.match(/^(--inspect(-brk)?)$/)) !== null) {
|
|
65120
|
-
debugOption = match[1];
|
|
65121
|
-
} else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null) {
|
|
65122
|
-
debugOption = match[1];
|
|
65123
|
-
if (/^\d+$/.test(match[3])) {
|
|
65124
|
-
debugPort = match[3];
|
|
65125
|
-
} else {
|
|
65126
|
-
debugHost = match[3];
|
|
65127
|
-
}
|
|
65128
|
-
} else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null) {
|
|
65129
|
-
debugOption = match[1];
|
|
65130
|
-
debugHost = match[3];
|
|
65131
|
-
debugPort = match[4];
|
|
65132
|
-
}
|
|
65133
|
-
if (debugOption && debugPort !== "0") {
|
|
65134
|
-
return `${debugOption}=${debugHost}:${parseInt(debugPort) + 1}`;
|
|
65135
|
-
}
|
|
65136
|
-
return arg;
|
|
65137
|
-
});
|
|
65138
|
-
}
|
|
65139
|
-
function useColor() {
|
|
65140
|
-
if (process11.env.NO_COLOR || process11.env.FORCE_COLOR === "0" || process11.env.FORCE_COLOR === "false")
|
|
65141
|
-
return false;
|
|
65142
|
-
if (process11.env.FORCE_COLOR || process11.env.CLICOLOR_FORCE !== void 0)
|
|
65143
|
-
return true;
|
|
65144
|
-
return void 0;
|
|
65145
|
-
}
|
|
65146
|
-
exports.Command = Command3;
|
|
65147
|
-
exports.useColor = useColor;
|
|
65148
65180
|
}
|
|
65149
65181
|
});
|
|
65150
65182
|
|
|
65151
|
-
// node_modules/.pnpm/commander@
|
|
65152
|
-
var
|
|
65153
|
-
|
|
65183
|
+
// node_modules/.pnpm/commander@15.0.0/node_modules/commander/index.js
|
|
65184
|
+
var program;
|
|
65185
|
+
var init_commander = __esm({
|
|
65186
|
+
"node_modules/.pnpm/commander@15.0.0/node_modules/commander/index.js"() {
|
|
65154
65187
|
init_define_WEB_FIRST_SEGMENTS();
|
|
65155
|
-
|
|
65156
|
-
|
|
65157
|
-
|
|
65158
|
-
|
|
65159
|
-
|
|
65160
|
-
|
|
65161
|
-
exports.createCommand = (name) => new Command3(name);
|
|
65162
|
-
exports.createOption = (flags, description) => new Option2(flags, description);
|
|
65163
|
-
exports.createArgument = (name, description) => new Argument2(name, description);
|
|
65164
|
-
exports.Command = Command3;
|
|
65165
|
-
exports.Option = Option2;
|
|
65166
|
-
exports.Argument = Argument2;
|
|
65167
|
-
exports.Help = Help2;
|
|
65168
|
-
exports.CommanderError = CommanderError2;
|
|
65169
|
-
exports.InvalidArgumentError = InvalidArgumentError2;
|
|
65170
|
-
exports.InvalidOptionArgumentError = InvalidArgumentError2;
|
|
65171
|
-
}
|
|
65172
|
-
});
|
|
65173
|
-
|
|
65174
|
-
// node_modules/.pnpm/commander@14.0.3/node_modules/commander/esm.mjs
|
|
65175
|
-
var import_index2, program, createCommand, createArgument, createOption, CommanderError, InvalidArgumentError, InvalidOptionArgumentError, Command2, Argument, Option, Help;
|
|
65176
|
-
var init_esm3 = __esm({
|
|
65177
|
-
"node_modules/.pnpm/commander@14.0.3/node_modules/commander/esm.mjs"() {
|
|
65178
|
-
init_define_WEB_FIRST_SEGMENTS();
|
|
65179
|
-
import_index2 = __toESM(require_commander(), 1);
|
|
65180
|
-
({
|
|
65181
|
-
program,
|
|
65182
|
-
createCommand,
|
|
65183
|
-
createArgument,
|
|
65184
|
-
createOption,
|
|
65185
|
-
CommanderError,
|
|
65186
|
-
InvalidArgumentError,
|
|
65187
|
-
InvalidOptionArgumentError,
|
|
65188
|
-
Command: (
|
|
65189
|
-
// deprecated old name
|
|
65190
|
-
Command2
|
|
65191
|
-
),
|
|
65192
|
-
Argument,
|
|
65193
|
-
Option,
|
|
65194
|
-
Help
|
|
65195
|
-
} = import_index2.default);
|
|
65188
|
+
init_argument();
|
|
65189
|
+
init_command();
|
|
65190
|
+
init_error();
|
|
65191
|
+
init_help();
|
|
65192
|
+
init_option();
|
|
65193
|
+
program = new Command2();
|
|
65196
65194
|
}
|
|
65197
65195
|
});
|
|
65198
65196
|
|
|
@@ -65317,12 +65315,12 @@ var init_signals = __esm({
|
|
|
65317
65315
|
});
|
|
65318
65316
|
|
|
65319
65317
|
// node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
|
|
65320
|
-
var processOk, kExitEmitter, global, ObjectDefineProperty, Emitter, SignalExitBase, signalExitWrap, SignalExitFallback, SignalExit,
|
|
65318
|
+
var processOk, kExitEmitter, global, ObjectDefineProperty, Emitter, SignalExitBase, signalExitWrap, SignalExitFallback, SignalExit, process6, onExit, load, unload;
|
|
65321
65319
|
var init_mjs = __esm({
|
|
65322
65320
|
"node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js"() {
|
|
65323
65321
|
init_define_WEB_FIRST_SEGMENTS();
|
|
65324
65322
|
init_signals();
|
|
65325
|
-
processOk = (
|
|
65323
|
+
processOk = (process12) => !!process12 && typeof process12 === "object" && typeof process12.removeListener === "function" && typeof process12.emit === "function" && typeof process12.reallyExit === "function" && typeof process12.listeners === "function" && typeof process12.kill === "function" && typeof process12.pid === "number" && typeof process12.on === "function";
|
|
65326
65324
|
kExitEmitter = /* @__PURE__ */ Symbol.for("signal-exit emitter");
|
|
65327
65325
|
global = globalThis;
|
|
65328
65326
|
ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
@@ -65407,7 +65405,7 @@ var init_mjs = __esm({
|
|
|
65407
65405
|
// "SIGHUP" throws an `ENOSYS` error on Windows,
|
|
65408
65406
|
// so use a supported signal instead
|
|
65409
65407
|
/* c8 ignore start */
|
|
65410
|
-
#hupSig =
|
|
65408
|
+
#hupSig = process6.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
65411
65409
|
/* c8 ignore stop */
|
|
65412
65410
|
#emitter = new Emitter();
|
|
65413
65411
|
#process;
|
|
@@ -65415,15 +65413,15 @@ var init_mjs = __esm({
|
|
|
65415
65413
|
#originalProcessReallyExit;
|
|
65416
65414
|
#sigListeners = {};
|
|
65417
65415
|
#loaded = false;
|
|
65418
|
-
constructor(
|
|
65416
|
+
constructor(process12) {
|
|
65419
65417
|
super();
|
|
65420
|
-
this.#process =
|
|
65418
|
+
this.#process = process12;
|
|
65421
65419
|
this.#sigListeners = {};
|
|
65422
65420
|
for (const sig of signals) {
|
|
65423
65421
|
this.#sigListeners[sig] = () => {
|
|
65424
65422
|
const listeners = this.#process.listeners(sig);
|
|
65425
65423
|
let { count } = this.#emitter;
|
|
65426
|
-
const p2 =
|
|
65424
|
+
const p2 = process12;
|
|
65427
65425
|
if (typeof p2.__signal_exit_emitter__ === "object" && typeof p2.__signal_exit_emitter__.count === "number") {
|
|
65428
65426
|
count += p2.__signal_exit_emitter__.count;
|
|
65429
65427
|
}
|
|
@@ -65432,12 +65430,12 @@ var init_mjs = __esm({
|
|
|
65432
65430
|
const ret = this.#emitter.emit("exit", null, sig);
|
|
65433
65431
|
const s = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
65434
65432
|
if (!ret)
|
|
65435
|
-
|
|
65433
|
+
process12.kill(process12.pid, s);
|
|
65436
65434
|
}
|
|
65437
65435
|
};
|
|
65438
65436
|
}
|
|
65439
|
-
this.#originalProcessReallyExit =
|
|
65440
|
-
this.#originalProcessEmit =
|
|
65437
|
+
this.#originalProcessReallyExit = process12.reallyExit;
|
|
65438
|
+
this.#originalProcessEmit = process12.emit;
|
|
65441
65439
|
}
|
|
65442
65440
|
onExit(cb, opts) {
|
|
65443
65441
|
if (!processOk(this.#process)) {
|
|
@@ -65518,7 +65516,7 @@ var init_mjs = __esm({
|
|
|
65518
65516
|
}
|
|
65519
65517
|
}
|
|
65520
65518
|
};
|
|
65521
|
-
|
|
65519
|
+
process6 = globalThis.process;
|
|
65522
65520
|
({
|
|
65523
65521
|
onExit: (
|
|
65524
65522
|
/**
|
|
@@ -65552,19 +65550,19 @@ var init_mjs = __esm({
|
|
|
65552
65550
|
*/
|
|
65553
65551
|
unload
|
|
65554
65552
|
)
|
|
65555
|
-
} = signalExitWrap(processOk(
|
|
65553
|
+
} = signalExitWrap(processOk(process6) ? new SignalExit(process6) : new SignalExitFallback()));
|
|
65556
65554
|
}
|
|
65557
65555
|
});
|
|
65558
65556
|
|
|
65559
65557
|
// node_modules/.pnpm/restore-cursor@5.1.0/node_modules/restore-cursor/index.js
|
|
65560
|
-
import
|
|
65558
|
+
import process7 from "node:process";
|
|
65561
65559
|
var terminal, restoreCursor, restore_cursor_default;
|
|
65562
65560
|
var init_restore_cursor = __esm({
|
|
65563
65561
|
"node_modules/.pnpm/restore-cursor@5.1.0/node_modules/restore-cursor/index.js"() {
|
|
65564
65562
|
init_define_WEB_FIRST_SEGMENTS();
|
|
65565
65563
|
init_onetime();
|
|
65566
65564
|
init_mjs();
|
|
65567
|
-
terminal =
|
|
65565
|
+
terminal = process7.stderr.isTTY ? process7.stderr : process7.stdout.isTTY ? process7.stdout : void 0;
|
|
65568
65566
|
restoreCursor = terminal ? onetime_default(() => {
|
|
65569
65567
|
onExit(() => {
|
|
65570
65568
|
terminal.write("\x1B[?25h");
|
|
@@ -65576,7 +65574,7 @@ var init_restore_cursor = __esm({
|
|
|
65576
65574
|
});
|
|
65577
65575
|
|
|
65578
65576
|
// node_modules/.pnpm/cli-cursor@5.0.0/node_modules/cli-cursor/index.js
|
|
65579
|
-
import
|
|
65577
|
+
import process8 from "node:process";
|
|
65580
65578
|
var isHidden, cliCursor, cli_cursor_default;
|
|
65581
65579
|
var init_cli_cursor = __esm({
|
|
65582
65580
|
"node_modules/.pnpm/cli-cursor@5.0.0/node_modules/cli-cursor/index.js"() {
|
|
@@ -65584,14 +65582,14 @@ var init_cli_cursor = __esm({
|
|
|
65584
65582
|
init_restore_cursor();
|
|
65585
65583
|
isHidden = false;
|
|
65586
65584
|
cliCursor = {};
|
|
65587
|
-
cliCursor.show = (writableStream =
|
|
65585
|
+
cliCursor.show = (writableStream = process8.stderr) => {
|
|
65588
65586
|
if (!writableStream.isTTY) {
|
|
65589
65587
|
return;
|
|
65590
65588
|
}
|
|
65591
65589
|
isHidden = false;
|
|
65592
65590
|
writableStream.write("\x1B[?25h");
|
|
65593
65591
|
};
|
|
65594
|
-
cliCursor.hide = (writableStream =
|
|
65592
|
+
cliCursor.hide = (writableStream = process8.stderr) => {
|
|
65595
65593
|
if (!writableStream.isTTY) {
|
|
65596
65594
|
return;
|
|
65597
65595
|
}
|
|
@@ -67414,11 +67412,11 @@ var init_yoctocolors = __esm({
|
|
|
67414
67412
|
});
|
|
67415
67413
|
|
|
67416
67414
|
// node_modules/.pnpm/is-unicode-supported@2.1.0/node_modules/is-unicode-supported/index.js
|
|
67417
|
-
import
|
|
67415
|
+
import process9 from "node:process";
|
|
67418
67416
|
function isUnicodeSupported() {
|
|
67419
|
-
const { env: env2 } =
|
|
67417
|
+
const { env: env2 } = process9;
|
|
67420
67418
|
const { TERM, TERM_PROGRAM } = env2;
|
|
67421
|
-
if (
|
|
67419
|
+
if (process9.platform !== "win32") {
|
|
67422
67420
|
return TERM !== "linux";
|
|
67423
67421
|
}
|
|
67424
67422
|
return Boolean(env2.WT_SESSION) || Boolean(env2.TERMINUS_SUBLIME) || env2.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env2.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
@@ -67748,7 +67746,7 @@ var init_is_interactive = __esm({
|
|
|
67748
67746
|
});
|
|
67749
67747
|
|
|
67750
67748
|
// node_modules/.pnpm/stdin-discarder@0.3.2/node_modules/stdin-discarder/index.js
|
|
67751
|
-
import
|
|
67749
|
+
import process10 from "node:process";
|
|
67752
67750
|
var ASCII_ETX_CODE, StdinDiscarder, stdinDiscarder, stdin_discarder_default;
|
|
67753
67751
|
var init_stdin_discarder = __esm({
|
|
67754
67752
|
"node_modules/.pnpm/stdin-discarder@0.3.2/node_modules/stdin-discarder/index.js"() {
|
|
@@ -67765,7 +67763,7 @@ var init_stdin_discarder = __esm({
|
|
|
67765
67763
|
}
|
|
67766
67764
|
const code = typeof chunk === "string" ? chunk.codePointAt(0) : chunk[0];
|
|
67767
67765
|
if (code === ASCII_ETX_CODE) {
|
|
67768
|
-
|
|
67766
|
+
process10.kill(process10.pid, "SIGINT");
|
|
67769
67767
|
}
|
|
67770
67768
|
};
|
|
67771
67769
|
start() {
|
|
@@ -67783,8 +67781,8 @@ var init_stdin_discarder = __esm({
|
|
|
67783
67781
|
}
|
|
67784
67782
|
}
|
|
67785
67783
|
#realStart() {
|
|
67786
|
-
const { stdin } =
|
|
67787
|
-
if (
|
|
67784
|
+
const { stdin } = process10;
|
|
67785
|
+
if (process10.platform === "win32" || !stdin?.isTTY || typeof stdin.setRawMode !== "function") {
|
|
67788
67786
|
this.#stdin = void 0;
|
|
67789
67787
|
return;
|
|
67790
67788
|
}
|
|
@@ -67820,8 +67818,8 @@ var init_stdin_discarder = __esm({
|
|
|
67820
67818
|
});
|
|
67821
67819
|
|
|
67822
67820
|
// node_modules/.pnpm/ora@9.4.0/node_modules/ora/index.js
|
|
67823
|
-
import
|
|
67824
|
-
import { stripVTControlCharacters } from "node:util";
|
|
67821
|
+
import process11 from "node:process";
|
|
67822
|
+
import { stripVTControlCharacters as stripVTControlCharacters3 } from "node:util";
|
|
67825
67823
|
function ora(options) {
|
|
67826
67824
|
return new Ora(options);
|
|
67827
67825
|
}
|
|
@@ -67927,7 +67925,7 @@ var init_ora = __esm({
|
|
|
67927
67925
|
}
|
|
67928
67926
|
this.#options = {
|
|
67929
67927
|
color: "cyan",
|
|
67930
|
-
stream:
|
|
67928
|
+
stream: process11.stderr,
|
|
67931
67929
|
discardStdin: true,
|
|
67932
67930
|
hideCursor: true,
|
|
67933
67931
|
...options
|
|
@@ -67950,7 +67948,7 @@ var init_ora = __esm({
|
|
|
67950
67948
|
this.prefixText = this.#options.prefixText;
|
|
67951
67949
|
this.suffixText = this.#options.suffixText;
|
|
67952
67950
|
this.indent = this.#options.indent;
|
|
67953
|
-
if (
|
|
67951
|
+
if (process11.env.NODE_ENV === "test") {
|
|
67954
67952
|
this._stream = this.#stream;
|
|
67955
67953
|
this._isEnabled = this.#options.isEnabled;
|
|
67956
67954
|
Object.defineProperty(this, "_linesToClear", {
|
|
@@ -68052,7 +68050,7 @@ var init_ora = __esm({
|
|
|
68052
68050
|
}
|
|
68053
68051
|
#computeLineCountFrom(text, columns) {
|
|
68054
68052
|
let count = 0;
|
|
68055
|
-
for (const line of
|
|
68053
|
+
for (const line of stripVTControlCharacters3(text).split("\n")) {
|
|
68056
68054
|
count += Math.max(1, Math.ceil(stringWidth(line) / columns));
|
|
68057
68055
|
}
|
|
68058
68056
|
return count;
|
|
@@ -68140,7 +68138,7 @@ var init_ora = __esm({
|
|
|
68140
68138
|
if (!this.isEnabled || this.#hookedStreams.size > 0) {
|
|
68141
68139
|
return;
|
|
68142
68140
|
}
|
|
68143
|
-
const streamsToHook = /* @__PURE__ */ new Set([this.#stream,
|
|
68141
|
+
const streamsToHook = /* @__PURE__ */ new Set([this.#stream, process11.stdout, process11.stderr]);
|
|
68144
68142
|
for (const stream of streamsToHook) {
|
|
68145
68143
|
this.#hookStream(stream);
|
|
68146
68144
|
}
|
|
@@ -68235,7 +68233,7 @@ var init_ora = __esm({
|
|
|
68235
68233
|
if (this.#options.hideCursor) {
|
|
68236
68234
|
cli_cursor_default.hide(this.#stream);
|
|
68237
68235
|
}
|
|
68238
|
-
if (this.#options.discardStdin &&
|
|
68236
|
+
if (this.#options.discardStdin && process11.stdin.isTTY) {
|
|
68239
68237
|
stdin_discarder_default.start();
|
|
68240
68238
|
this.#isDiscardingStdin = true;
|
|
68241
68239
|
}
|
|
@@ -68765,8 +68763,8 @@ __export(cli_exports, {
|
|
|
68765
68763
|
promptYesNo: () => promptYesNo,
|
|
68766
68764
|
runCli: () => runCli
|
|
68767
68765
|
});
|
|
68768
|
-
import * as
|
|
68769
|
-
import * as
|
|
68766
|
+
import * as fs14 from "node:fs";
|
|
68767
|
+
import * as path19 from "node:path";
|
|
68770
68768
|
function validateCheckNames(names, source) {
|
|
68771
68769
|
const invalid = names.filter((n7) => n7 && !VALID_CHECKS.has(n7));
|
|
68772
68770
|
if (invalid.length > 0) {
|
|
@@ -68789,7 +68787,7 @@ async function runCli() {
|
|
|
68789
68787
|
"Also scan the user-global ~/.claude/settings.json in the dead-hook check (off by default; the standard run only reads project .claude/settings.json[.local])",
|
|
68790
68788
|
false
|
|
68791
68789
|
).option("--no-ignore-file", "Disable .ctxlintignore suppression (see all findings)").option("--watch", "Re-lint on context file changes", false).action(async (projectPath, opts) => {
|
|
68792
|
-
const resolvedPath =
|
|
68790
|
+
const resolvedPath = path19.resolve(projectPath);
|
|
68793
68791
|
const { config: config2, options, activeChecks } = resolveSession(resolvedPath, opts);
|
|
68794
68792
|
const spinner = options.format === "text" && !options.quiet ? ora("Scanning for context files...").start() : void 0;
|
|
68795
68793
|
try {
|
|
@@ -68920,41 +68918,41 @@ Fixed ${applied.totalFixes} issue${applied.totalFixes !== 1 ? "s" : ""} in ${app
|
|
|
68920
68918
|
const chalk2 = (await Promise.resolve().then(() => (init_source(), source_exports))).default;
|
|
68921
68919
|
console.log(chalk2.dim("\nWatching for changes... (Ctrl+C to stop)\n"));
|
|
68922
68920
|
const watchPaths = [
|
|
68923
|
-
|
|
68924
|
-
|
|
68925
|
-
|
|
68926
|
-
|
|
68927
|
-
|
|
68928
|
-
|
|
68929
|
-
|
|
68930
|
-
|
|
68931
|
-
|
|
68932
|
-
|
|
68933
|
-
|
|
68934
|
-
|
|
68935
|
-
|
|
68936
|
-
|
|
68937
|
-
|
|
68921
|
+
path19.join(resolvedPath, "CLAUDE.md"),
|
|
68922
|
+
path19.join(resolvedPath, "CLAUDE.local.md"),
|
|
68923
|
+
path19.join(resolvedPath, "AGENTS.md"),
|
|
68924
|
+
path19.join(resolvedPath, "AGENT.md"),
|
|
68925
|
+
path19.join(resolvedPath, ".cursorrules"),
|
|
68926
|
+
path19.join(resolvedPath, ".windsurfrules"),
|
|
68927
|
+
path19.join(resolvedPath, ".clinerules"),
|
|
68928
|
+
path19.join(resolvedPath, ".aiderules"),
|
|
68929
|
+
path19.join(resolvedPath, ".continuerules"),
|
|
68930
|
+
path19.join(resolvedPath, ".rules"),
|
|
68931
|
+
path19.join(resolvedPath, ".goosehints"),
|
|
68932
|
+
path19.join(resolvedPath, "GEMINI.md"),
|
|
68933
|
+
path19.join(resolvedPath, "replit.md"),
|
|
68934
|
+
path19.join(resolvedPath, "package.json"),
|
|
68935
|
+
path19.join(resolvedPath, ".mcp.json"),
|
|
68938
68936
|
// ctxlint config — re-resolve on edit so threshold changes,
|
|
68939
68937
|
// ignore-list edits, and check-list overrides take effect without
|
|
68940
68938
|
// restarting the watcher.
|
|
68941
|
-
|
|
68942
|
-
|
|
68939
|
+
path19.join(resolvedPath, ".ctxlintrc"),
|
|
68940
|
+
path19.join(resolvedPath, ".ctxlintrc.json"),
|
|
68943
68941
|
// .ctxlintignore — re-lint when suppression rules change.
|
|
68944
|
-
|
|
68942
|
+
path19.join(resolvedPath, ".ctxlintignore")
|
|
68945
68943
|
];
|
|
68946
68944
|
const watchDirs = [
|
|
68947
|
-
|
|
68948
|
-
|
|
68949
|
-
|
|
68950
|
-
|
|
68951
|
-
|
|
68952
|
-
|
|
68953
|
-
|
|
68954
|
-
|
|
68955
|
-
|
|
68956
|
-
|
|
68957
|
-
|
|
68945
|
+
path19.join(resolvedPath, ".claude"),
|
|
68946
|
+
path19.join(resolvedPath, ".cursor"),
|
|
68947
|
+
path19.join(resolvedPath, ".github"),
|
|
68948
|
+
path19.join(resolvedPath, ".windsurf"),
|
|
68949
|
+
path19.join(resolvedPath, ".aide"),
|
|
68950
|
+
path19.join(resolvedPath, ".amazonq"),
|
|
68951
|
+
path19.join(resolvedPath, ".goose"),
|
|
68952
|
+
path19.join(resolvedPath, ".junie"),
|
|
68953
|
+
path19.join(resolvedPath, ".aiassistant"),
|
|
68954
|
+
path19.join(resolvedPath, ".continue"),
|
|
68955
|
+
path19.join(resolvedPath, ".vscode")
|
|
68958
68956
|
];
|
|
68959
68957
|
const watchers = [];
|
|
68960
68958
|
let debounceTimer = null;
|
|
@@ -69016,13 +69014,13 @@ Fixed ${applied.totalFixes} issue${applied.totalFixes !== 1 ? "s" : ""} in ${app
|
|
|
69016
69014
|
};
|
|
69017
69015
|
for (const filePath of watchPaths) {
|
|
69018
69016
|
try {
|
|
69019
|
-
watchers.push(
|
|
69017
|
+
watchers.push(fs14.watch(filePath, rerun));
|
|
69020
69018
|
} catch {
|
|
69021
69019
|
}
|
|
69022
69020
|
}
|
|
69023
69021
|
for (const dir of watchDirs) {
|
|
69024
69022
|
try {
|
|
69025
|
-
watchers.push(
|
|
69023
|
+
watchers.push(fs14.watch(dir, { recursive: true }, rerun));
|
|
69026
69024
|
} catch {
|
|
69027
69025
|
}
|
|
69028
69026
|
}
|
|
@@ -69043,17 +69041,17 @@ Fixed ${applied.totalFixes} issue${applied.totalFixes !== 1 ? "s" : ""} in ${app
|
|
|
69043
69041
|
}
|
|
69044
69042
|
});
|
|
69045
69043
|
program2.command("init").description("Set up a git pre-commit hook that runs ctxlint --strict").argument("[path]", "Project directory", ".").action(async (projectPath) => {
|
|
69046
|
-
const resolvedRoot =
|
|
69047
|
-
const gitDir =
|
|
69048
|
-
const hooksDir =
|
|
69049
|
-
if (!
|
|
69044
|
+
const resolvedRoot = path19.resolve(projectPath);
|
|
69045
|
+
const gitDir = path19.join(resolvedRoot, ".git");
|
|
69046
|
+
const hooksDir = path19.join(gitDir, "hooks");
|
|
69047
|
+
if (!fs14.existsSync(gitDir)) {
|
|
69050
69048
|
console.error('Error: not a git repository. Run "git init" first.');
|
|
69051
69049
|
process.exit(1);
|
|
69052
69050
|
}
|
|
69053
|
-
if (!
|
|
69054
|
-
|
|
69051
|
+
if (!fs14.existsSync(hooksDir)) {
|
|
69052
|
+
fs14.mkdirSync(hooksDir, { recursive: true });
|
|
69055
69053
|
}
|
|
69056
|
-
const hookPath =
|
|
69054
|
+
const hookPath = path19.join(hooksDir, "pre-commit");
|
|
69057
69055
|
const fullHookContent = `#!/bin/sh
|
|
69058
69056
|
# ctxlint pre-commit hook
|
|
69059
69057
|
npx @yawlabs/ctxlint@${VERSION} --strict
|
|
@@ -69062,15 +69060,15 @@ npx @yawlabs/ctxlint@${VERSION} --strict
|
|
|
69062
69060
|
# ctxlint pre-commit hook
|
|
69063
69061
|
npx @yawlabs/ctxlint@${VERSION} --strict
|
|
69064
69062
|
`;
|
|
69065
|
-
if (
|
|
69066
|
-
const existing =
|
|
69063
|
+
if (fs14.existsSync(hookPath)) {
|
|
69064
|
+
const existing = fs14.readFileSync(hookPath, "utf-8");
|
|
69067
69065
|
const installed = existing.match(
|
|
69068
69066
|
/^[^#\r\n]*\bnpx\s+(?:-y\s+|--yes\s+)?@yawlabs\/ctxlint(?:@(\d+\.\d+\.\d+))?/m
|
|
69069
69067
|
);
|
|
69070
69068
|
if (installed) {
|
|
69071
69069
|
const pinned = installed[1];
|
|
69072
69070
|
if (pinned && pinned !== VERSION) {
|
|
69073
|
-
|
|
69071
|
+
fs14.writeFileSync(
|
|
69074
69072
|
hookPath,
|
|
69075
69073
|
existing.replace(/(@yawlabs\/ctxlint@)\d+\.\d+\.\d+/g, `$1${VERSION}`)
|
|
69076
69074
|
);
|
|
@@ -69080,10 +69078,10 @@ npx @yawlabs/ctxlint@${VERSION} --strict
|
|
|
69080
69078
|
}
|
|
69081
69079
|
return;
|
|
69082
69080
|
}
|
|
69083
|
-
|
|
69081
|
+
fs14.appendFileSync(hookPath, appendHookContent);
|
|
69084
69082
|
console.log("Added ctxlint to existing pre-commit hook.");
|
|
69085
69083
|
} else {
|
|
69086
|
-
|
|
69084
|
+
fs14.writeFileSync(hookPath, fullHookContent, { mode: 493 });
|
|
69087
69085
|
console.log("Created pre-commit hook at .git/hooks/pre-commit");
|
|
69088
69086
|
}
|
|
69089
69087
|
console.log("ctxlint will now run automatically before each commit.");
|
|
@@ -69105,7 +69103,7 @@ function resolveDepth(raw) {
|
|
|
69105
69103
|
return Number.isNaN(parsed) ? 2 : Math.max(0, Math.min(parsed, 10));
|
|
69106
69104
|
}
|
|
69107
69105
|
function resolveSession(resolvedPath, opts, throwOnConfigError = false) {
|
|
69108
|
-
const configPath = opts.config ?
|
|
69106
|
+
const configPath = opts.config ? path19.resolve(opts.config) : void 0;
|
|
69109
69107
|
const config2 = configPath ? loadConfigFromPath(configPath, throwOnConfigError) : loadConfig(resolvedPath);
|
|
69110
69108
|
const mcpGlobal = opts.mcpGlobal || config2?.mcpGlobal || false;
|
|
69111
69109
|
const mcpOnly = opts.mcpOnly || config2?.mcpOnly || false;
|
|
@@ -69189,7 +69187,7 @@ var init_cli = __esm({
|
|
|
69189
69187
|
"src/cli.ts"() {
|
|
69190
69188
|
"use strict";
|
|
69191
69189
|
init_define_WEB_FIRST_SEGMENTS();
|
|
69192
|
-
|
|
69190
|
+
init_commander();
|
|
69193
69191
|
init_ora();
|
|
69194
69192
|
init_paths();
|
|
69195
69193
|
init_cache();
|