@udohjeremiah/moniq 0.2.0 → 0.3.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/cli.js +168 -110
- package/dist/cli.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/cli.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { n as loadConfig } from "./dist-B1TNZsla.js";
|
|
3
|
-
import { createRequire } from "node:module";
|
|
4
3
|
import path from "node:path";
|
|
5
4
|
import { stdin } from "node:process";
|
|
6
5
|
import { styleText } from "node:util";
|
|
7
|
-
import { execFileSync } from "node:child_process";
|
|
6
|
+
import { execFile, execFileSync } from "node:child_process";
|
|
8
7
|
import { createInterface } from "node:readline/promises";
|
|
9
8
|
//#region ../../node_modules/.pnpm/cac@7.0.0/node_modules/cac/dist/index.js
|
|
10
9
|
function toArr(any) {
|
|
@@ -636,15 +635,42 @@ function getScript(packageJson, name) {
|
|
|
636
635
|
const value = Object.entries(scripts).find(([k]) => k === name)?.[1];
|
|
637
636
|
return typeof value === "string" ? value : void 0;
|
|
638
637
|
}
|
|
639
|
-
|
|
640
|
-
const
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
638
|
+
async function detectPackageManager(root) {
|
|
639
|
+
for (const [lockFile, pm] of Object.entries({
|
|
640
|
+
"bun.lock": "bun",
|
|
641
|
+
"bun.lockb": "bun",
|
|
642
|
+
"package-lock.json": "npm",
|
|
643
|
+
"pnpm-lock.yaml": "pnpm",
|
|
644
|
+
"yarn.lock": "yarn"
|
|
645
|
+
})) try {
|
|
646
|
+
const { access } = await import("node:fs/promises");
|
|
647
|
+
await access(path.join(root, lockFile));
|
|
648
|
+
return pm;
|
|
649
|
+
} catch {}
|
|
650
|
+
try {
|
|
651
|
+
const rawPm = (await readPackageJson(path.join(root, "package.json")))["packageManager"];
|
|
652
|
+
const pm = typeof rawPm === "string" ? rawPm.split("@", 2)[0] ?? "" : "";
|
|
653
|
+
if ([
|
|
654
|
+
"bun",
|
|
655
|
+
"npm",
|
|
656
|
+
"pnpm",
|
|
657
|
+
"yarn"
|
|
658
|
+
].includes(pm)) return pm;
|
|
659
|
+
} catch {}
|
|
660
|
+
const userAgent = process.env["npm_config_user_agent"] ?? "";
|
|
661
|
+
if (userAgent.startsWith("bun")) return "bun";
|
|
662
|
+
if (userAgent.startsWith("pnpm")) return "pnpm";
|
|
663
|
+
if (userAgent.startsWith("yarn")) return "yarn";
|
|
664
|
+
if (userAgent.startsWith("npm")) return "npm";
|
|
665
|
+
return "pnpm";
|
|
666
|
+
}
|
|
667
|
+
async function discoverWorkspace(root) {
|
|
668
|
+
const pm = await detectPackageManager(root);
|
|
644
669
|
let output;
|
|
645
670
|
switch (pm) {
|
|
671
|
+
case "bun": return resolveBunWorkspaces(root);
|
|
646
672
|
case "npm": {
|
|
647
|
-
output = execFileSync(
|
|
673
|
+
output = execFileSync(pmBin("npm"), [
|
|
648
674
|
"ls",
|
|
649
675
|
"--workspaces",
|
|
650
676
|
"--all",
|
|
@@ -659,7 +685,7 @@ function discoverWorkspace(root) {
|
|
|
659
685
|
return Object.values(tree.dependencies ?? {}).map((entry) => ({ path: entry.path }));
|
|
660
686
|
}
|
|
661
687
|
case "pnpm":
|
|
662
|
-
output = execFileSync(
|
|
688
|
+
output = execFileSync(pmBin("pnpm"), [
|
|
663
689
|
"ls",
|
|
664
690
|
"-r",
|
|
665
691
|
"--depth",
|
|
@@ -671,7 +697,7 @@ function discoverWorkspace(root) {
|
|
|
671
697
|
});
|
|
672
698
|
return JSON.parse(output).map((entry) => ({ path: entry.path }));
|
|
673
699
|
case "yarn":
|
|
674
|
-
output = execFileSync(
|
|
700
|
+
output = execFileSync(pmBin("yarn"), [
|
|
675
701
|
"workspaces",
|
|
676
702
|
"list",
|
|
677
703
|
"--json"
|
|
@@ -682,64 +708,27 @@ function discoverWorkspace(root) {
|
|
|
682
708
|
return output.trim().split("\n").filter(Boolean).map((line) => JSON.parse(line)).map((entry) => ({ path: path.resolve(root, entry.location) }));
|
|
683
709
|
}
|
|
684
710
|
}
|
|
685
|
-
function
|
|
686
|
-
const
|
|
687
|
-
if (
|
|
688
|
-
if (
|
|
689
|
-
|
|
690
|
-
const request = createRequire(import.meta.url);
|
|
691
|
-
for (const [lockFile, pm] of Object.entries({
|
|
692
|
-
"package-lock.json": "npm",
|
|
693
|
-
"pnpm-lock.yaml": "pnpm",
|
|
694
|
-
"yarn.lock": "yarn"
|
|
695
|
-
})) try {
|
|
696
|
-
request.resolve(path.join(root, lockFile));
|
|
697
|
-
return pm;
|
|
698
|
-
} catch {}
|
|
699
|
-
try {
|
|
700
|
-
const rawPm = request(path.join(root, "package.json"))["packageManager"];
|
|
701
|
-
const pm = typeof rawPm === "string" ? rawPm.split("@", 2)[0] ?? "" : "";
|
|
702
|
-
if ([
|
|
703
|
-
"npm",
|
|
704
|
-
"pnpm",
|
|
705
|
-
"yarn"
|
|
706
|
-
].includes(pm)) return pm;
|
|
707
|
-
} catch {}
|
|
708
|
-
return "pnpm";
|
|
709
|
-
}
|
|
710
|
-
function getNpmCommand() {
|
|
711
|
-
return path.join(path.dirname(process.execPath), "npm");
|
|
711
|
+
function getWorkspacePatterns(packageJson) {
|
|
712
|
+
const raw = packageJson["workspaces"];
|
|
713
|
+
if (Array.isArray(raw)) return raw;
|
|
714
|
+
if (typeof raw === "object" && raw !== null && "packages" in raw && Array.isArray(raw.packages)) return raw.packages;
|
|
715
|
+
return [];
|
|
712
716
|
}
|
|
713
|
-
function
|
|
714
|
-
|
|
715
|
-
const request = createRequire(import.meta.url);
|
|
716
|
-
const specifier = ["pnpm", "package.json"].join("/");
|
|
717
|
-
const packagePath = request.resolve(specifier);
|
|
718
|
-
return path.resolve(path.dirname(packagePath), "bin", "pnpm.cjs");
|
|
719
|
-
} catch {
|
|
720
|
-
return "pnpm";
|
|
721
|
-
}
|
|
717
|
+
function pmBin(pm) {
|
|
718
|
+
return pm;
|
|
722
719
|
}
|
|
723
|
-
function
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
return path.resolve(path.dirname(packagePath), "sources", "bin", "yarn.js");
|
|
733
|
-
} catch {
|
|
734
|
-
try {
|
|
735
|
-
const request = createRequire(import.meta.url);
|
|
736
|
-
const specifier = ["yarn", "package.json"].join("/");
|
|
737
|
-
const packagePath = request.resolve(specifier);
|
|
738
|
-
return path.resolve(path.dirname(packagePath), "bin", "yarn.js");
|
|
739
|
-
} catch {
|
|
740
|
-
return "yarn";
|
|
720
|
+
async function resolveBunWorkspaces(root) {
|
|
721
|
+
const patterns = getWorkspacePatterns(await readPackageJson(path.join(root, "package.json")));
|
|
722
|
+
const { glob } = await import("node:fs/promises");
|
|
723
|
+
const packagePaths = [];
|
|
724
|
+
for (const pattern of patterns) {
|
|
725
|
+
const iterable = glob(pattern, { cwd: root });
|
|
726
|
+
for await (const entry of iterable) {
|
|
727
|
+
const absolute = path.resolve(root, entry);
|
|
728
|
+
if (!packagePaths.includes(absolute)) packagePaths.push(absolute);
|
|
741
729
|
}
|
|
742
730
|
}
|
|
731
|
+
return packagePaths.map((p) => ({ path: p }));
|
|
743
732
|
}
|
|
744
733
|
//#endregion
|
|
745
734
|
//#region ../../node_modules/.pnpm/wildcard-match@5.1.4/node_modules/wildcard-match/build/index.es.mjs
|
|
@@ -928,7 +917,7 @@ async function resolve(config, root, packages_) {
|
|
|
928
917
|
}
|
|
929
918
|
//#endregion
|
|
930
919
|
//#region ../cli/dist/index.js
|
|
931
|
-
var version = "0.
|
|
920
|
+
var version = "0.3.0";
|
|
932
921
|
function formatDiagnostics(diagnostics, options) {
|
|
933
922
|
if ((options?.format ?? "pretty") === "json") return formatJson(diagnostics);
|
|
934
923
|
return formatPretty(diagnostics, options?.isDryRun);
|
|
@@ -1036,7 +1025,7 @@ async function check(options) {
|
|
|
1036
1025
|
} catch {
|
|
1037
1026
|
throw new Error("No moniq.config file found in or above the current directory.");
|
|
1038
1027
|
}
|
|
1039
|
-
const packages = discoverWorkspace(cwd);
|
|
1028
|
+
const packages = await discoverWorkspace(cwd);
|
|
1040
1029
|
if (packages.length === 0) throw new Error("No workspace packages found.");
|
|
1041
1030
|
const diagnostics = await resolve(config, cwd, packages);
|
|
1042
1031
|
let fixSummary;
|
|
@@ -1074,7 +1063,7 @@ async function doctor() {
|
|
|
1074
1063
|
});
|
|
1075
1064
|
}
|
|
1076
1065
|
try {
|
|
1077
|
-
const packageCount = discoverWorkspace(cwd).length;
|
|
1066
|
+
const packageCount = (await discoverWorkspace(cwd)).length;
|
|
1078
1067
|
if (packageCount === 0) issues.push({
|
|
1079
1068
|
message: "No workspace packages detected. Check your workspace configuration.",
|
|
1080
1069
|
severity: "warn"
|
|
@@ -1182,25 +1171,20 @@ const letterRows = [
|
|
|
1182
1171
|
];
|
|
1183
1172
|
const DESCRIPTION = "Policy-driven workspace linter for JavaScript/TypeScript monorepos.";
|
|
1184
1173
|
function renderBanner() {
|
|
1185
|
-
const lines = [];
|
|
1174
|
+
const lines = [""];
|
|
1186
1175
|
for (let rowIndex = 0; rowIndex < 6; rowIndex++) lines.push(assembleRow(rowIndex));
|
|
1187
|
-
const description =
|
|
1188
|
-
|
|
1189
|
-
lines.push("", versionLine, description);
|
|
1176
|
+
const description = styleText("bold", DESCRIPTION);
|
|
1177
|
+
lines.push(description, "");
|
|
1190
1178
|
return lines.join("\n");
|
|
1191
1179
|
}
|
|
1192
1180
|
function assembleRow(rowIndex) {
|
|
1193
|
-
let row = "
|
|
1181
|
+
let row = "";
|
|
1194
1182
|
for (let columnIndex = 0; columnIndex < 5; columnIndex++) {
|
|
1195
1183
|
row += rowPart(columnIndex, rowIndex);
|
|
1196
1184
|
if (columnIndex < 4) row += " ";
|
|
1197
1185
|
}
|
|
1198
1186
|
return row;
|
|
1199
1187
|
}
|
|
1200
|
-
function centerPad(text, width) {
|
|
1201
|
-
const pad = Math.max(0, Math.floor((width - text.length) / 2));
|
|
1202
|
-
return " ".repeat(pad) + text;
|
|
1203
|
-
}
|
|
1204
1188
|
function rowPart(columnIndex, rowIndex) {
|
|
1205
1189
|
const rows = letterRows.at(columnIndex);
|
|
1206
1190
|
const colorFunction = colorFns.at(columnIndex);
|
|
@@ -1216,6 +1200,20 @@ const SUPPORTED_LANGS = [
|
|
|
1216
1200
|
"mts",
|
|
1217
1201
|
"cts"
|
|
1218
1202
|
];
|
|
1203
|
+
const DIVIDER_WIDTH = 44;
|
|
1204
|
+
function labelPad(label) {
|
|
1205
|
+
return label.padEnd(18);
|
|
1206
|
+
}
|
|
1207
|
+
const STARTER_CONFIG = `import { defineConfig } from "@udohjeremiah/moniq";
|
|
1208
|
+
|
|
1209
|
+
export default defineConfig({
|
|
1210
|
+
scripts: {
|
|
1211
|
+
dev: { required: true },
|
|
1212
|
+
build: { required: true },
|
|
1213
|
+
lint: { required: true },
|
|
1214
|
+
},
|
|
1215
|
+
});
|
|
1216
|
+
`;
|
|
1219
1217
|
async function detectLang(cwd, packageJson) {
|
|
1220
1218
|
const rawDependencies = packageJson["dependencies"];
|
|
1221
1219
|
const rawDevelopmentDependencies = packageJson["devDependencies"];
|
|
@@ -1228,21 +1226,10 @@ async function detectLang(cwd, packageJson) {
|
|
|
1228
1226
|
if (typeof rawDevelopmentDependencies === "object" && rawDevelopmentDependencies !== null && Object.hasOwn(rawDevelopmentDependencies, "typescript")) return "ts";
|
|
1229
1227
|
return "js";
|
|
1230
1228
|
}
|
|
1231
|
-
function generateConfig() {
|
|
1232
|
-
return `import { defineConfig } from "@udohjeremiah/moniq";
|
|
1233
|
-
|
|
1234
|
-
export default defineConfig({
|
|
1235
|
-
scripts: {
|
|
1236
|
-
dev: { required: true },
|
|
1237
|
-
build: { required: true },
|
|
1238
|
-
lint: { required: true },
|
|
1239
|
-
},
|
|
1240
|
-
});
|
|
1241
|
-
`;
|
|
1242
|
-
}
|
|
1243
1229
|
async function init(options) {
|
|
1244
1230
|
const { _cwd, lang: explicitLang } = options;
|
|
1245
1231
|
const cwd = _cwd ?? process.cwd();
|
|
1232
|
+
console.log(renderBanner());
|
|
1246
1233
|
const rootPackageJson = await readRootPackageJson(cwd);
|
|
1247
1234
|
if (rootPackageJson === void 0) return;
|
|
1248
1235
|
const lang = explicitLang ?? await detectLang(cwd, rootPackageJson);
|
|
@@ -1254,35 +1241,63 @@ async function init(options) {
|
|
|
1254
1241
|
}
|
|
1255
1242
|
const filename = `moniq.config.${lang}`;
|
|
1256
1243
|
const configPath = path.join(cwd, filename);
|
|
1257
|
-
|
|
1258
|
-
console.log();
|
|
1259
|
-
let packages = [];
|
|
1244
|
+
if (!await handleExistingConfig(configPath, filename)) return;
|
|
1260
1245
|
let workspaceLabel = "single package";
|
|
1246
|
+
let packages = [];
|
|
1261
1247
|
try {
|
|
1262
|
-
packages = discoverWorkspace(cwd);
|
|
1248
|
+
packages = await discoverWorkspace(cwd);
|
|
1263
1249
|
if (packages.length > 1) workspaceLabel = `monorepo with ${String(packages.length)} packages`;
|
|
1264
1250
|
} catch {
|
|
1265
1251
|
workspaceLabel = "unknown (workspace detection failed)";
|
|
1266
1252
|
}
|
|
1267
|
-
const
|
|
1268
|
-
|
|
1253
|
+
const pm = await detectPackageManager(cwd);
|
|
1254
|
+
const langDisplay = [
|
|
1255
|
+
"cts",
|
|
1256
|
+
"mts",
|
|
1257
|
+
"ts"
|
|
1258
|
+
].includes(lang) ? "TypeScript" : "JavaScript";
|
|
1259
|
+
const dim = (s) => styleText("dim", s);
|
|
1260
|
+
const cyan = (s) => styleText("cyan", s);
|
|
1261
|
+
const sideDashes = (DIVIDER_WIDTH - 10) / 2;
|
|
1262
|
+
const topDivider = dim(` ${"─".repeat(sideDashes)} Detected ${"─".repeat(sideDashes)}`);
|
|
1263
|
+
const bottomDivider = dim(` ${"─".repeat(DIVIDER_WIDTH)}`);
|
|
1264
|
+
const labelIndent = " ".repeat(19);
|
|
1265
|
+
console.log(topDivider);
|
|
1266
|
+
console.log(` ${dim(labelPad("Workspace:"))} ${cyan(workspaceLabel)}`);
|
|
1269
1267
|
if (packages.length > 1) for (const package_ of packages) {
|
|
1270
|
-
const
|
|
1271
|
-
console.log(`
|
|
1268
|
+
const bullet = dim(`• ${path.relative(cwd, package_.path)}`);
|
|
1269
|
+
console.log(` ${labelIndent}${bullet}`);
|
|
1272
1270
|
}
|
|
1273
|
-
|
|
1274
|
-
console.log(`
|
|
1271
|
+
console.log(` ${dim(labelPad("Package Manager:"))} ${cyan(pm)}`);
|
|
1272
|
+
console.log(` ${dim(labelPad("Language:"))} ${cyan(langDisplay)}`);
|
|
1273
|
+
console.log(bottomDivider);
|
|
1275
1274
|
console.log();
|
|
1276
|
-
if (!
|
|
1275
|
+
if (!_cwd) {
|
|
1276
|
+
const stopSpinner = startSpinner("Installing @udohjeremiah/moniq as devDependency...");
|
|
1277
|
+
try {
|
|
1278
|
+
await installPackage(pm, cwd);
|
|
1279
|
+
stopSpinner();
|
|
1280
|
+
console.log(` ✅ Installed @udohjeremiah/moniq as devDependency`);
|
|
1281
|
+
console.log();
|
|
1282
|
+
} catch (error) {
|
|
1283
|
+
stopSpinner();
|
|
1284
|
+
const styledError = styleText("red", `❌ ${`Installation failed: ${String(error)}`}`);
|
|
1285
|
+
console.log(` ${styledError}`);
|
|
1286
|
+
console.log(` ${styleText("dim", "Make sure you have a working internet connection and try again.")}`);
|
|
1287
|
+
console.log();
|
|
1288
|
+
process.exitCode = 1;
|
|
1289
|
+
return;
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1277
1292
|
const { writeFile } = await import("node:fs/promises");
|
|
1278
|
-
await writeFile(configPath,
|
|
1293
|
+
await writeFile(configPath, STARTER_CONFIG, "utf8");
|
|
1279
1294
|
const createdMessage = `✅ Created ${filename}`;
|
|
1280
1295
|
console.log(` ${styleText(["bold", "green"], createdMessage)}`);
|
|
1281
1296
|
console.log();
|
|
1282
1297
|
await doctor();
|
|
1283
1298
|
console.log();
|
|
1284
1299
|
console.log(` ${styleText("dim", "Next steps:")}`);
|
|
1285
|
-
console.log(` 1. ${styleText("dim", "Edit")} ${styleText("cyan",
|
|
1300
|
+
console.log(` 1. ${styleText("dim", "Edit")} ${styleText("cyan", filename)} ${styleText("dim", "to configure your policies.")}`);
|
|
1286
1301
|
console.log(` 2. ${styleText("dim", "Run")} ${styleText("cyan", "moniq check")} ${styleText("dim", "to validate your workspace.")}`);
|
|
1287
1302
|
console.log(` 3. ${styleText("dim", "Run")} ${styleText("cyan", "moniq fix")} ${styleText("dim", "to apply automatic fixes.")}`);
|
|
1288
1303
|
console.log();
|
|
@@ -1305,17 +1320,40 @@ async function handleExistingConfig(configPath, filename) {
|
|
|
1305
1320
|
if (answer.trim().length === 0) return false;
|
|
1306
1321
|
return answer.toLowerCase() === "y" || answer.toLowerCase() === "yes";
|
|
1307
1322
|
}
|
|
1308
|
-
function
|
|
1309
|
-
switch (
|
|
1310
|
-
case "
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
case "
|
|
1316
|
-
|
|
1323
|
+
function installArguments(pm) {
|
|
1324
|
+
switch (pm) {
|
|
1325
|
+
case "bun": return [
|
|
1326
|
+
"add",
|
|
1327
|
+
"--dev",
|
|
1328
|
+
"@udohjeremiah/moniq"
|
|
1329
|
+
];
|
|
1330
|
+
case "npm": return [
|
|
1331
|
+
"install",
|
|
1332
|
+
"--save-dev",
|
|
1333
|
+
"@udohjeremiah/moniq"
|
|
1334
|
+
];
|
|
1335
|
+
case "yarn": return [
|
|
1336
|
+
"add",
|
|
1337
|
+
"--dev",
|
|
1338
|
+
"@udohjeremiah/moniq"
|
|
1339
|
+
];
|
|
1340
|
+
default: return [
|
|
1341
|
+
"add",
|
|
1342
|
+
"-D",
|
|
1343
|
+
"@udohjeremiah/moniq"
|
|
1344
|
+
];
|
|
1317
1345
|
}
|
|
1318
1346
|
}
|
|
1347
|
+
function installPackage(pm, root) {
|
|
1348
|
+
return new Promise((resolve, reject) => {
|
|
1349
|
+
const child = execFile(pm, installArguments(pm), { cwd: root });
|
|
1350
|
+
child.on("exit", (code) => {
|
|
1351
|
+
if (code === 0) resolve();
|
|
1352
|
+
else reject(/* @__PURE__ */ new Error(`Exit code ${String(code)}`));
|
|
1353
|
+
});
|
|
1354
|
+
child.on("error", reject);
|
|
1355
|
+
});
|
|
1356
|
+
}
|
|
1319
1357
|
async function readRootPackageJson(cwd) {
|
|
1320
1358
|
try {
|
|
1321
1359
|
return await readPackageJson(path.join(cwd, "package.json"));
|
|
@@ -1328,6 +1366,26 @@ async function readRootPackageJson(cwd) {
|
|
|
1328
1366
|
return;
|
|
1329
1367
|
}
|
|
1330
1368
|
}
|
|
1369
|
+
function startSpinner(text) {
|
|
1370
|
+
const frames = [
|
|
1371
|
+
"⠋",
|
|
1372
|
+
"⠙",
|
|
1373
|
+
"⠸",
|
|
1374
|
+
"⠴",
|
|
1375
|
+
"⠦",
|
|
1376
|
+
"⠧"
|
|
1377
|
+
];
|
|
1378
|
+
let index = 0;
|
|
1379
|
+
const id = setInterval(() => {
|
|
1380
|
+
const styled = styleText("dim", `${frames.at(index) ?? ""} ${text}`);
|
|
1381
|
+
process.stdout.write(`\r ${styled}`);
|
|
1382
|
+
index = (index + 1) % frames.length;
|
|
1383
|
+
}, 80);
|
|
1384
|
+
return () => {
|
|
1385
|
+
clearInterval(id);
|
|
1386
|
+
process.stdout.write("\r\x1B[K");
|
|
1387
|
+
};
|
|
1388
|
+
}
|
|
1331
1389
|
const cli = cac("moniq");
|
|
1332
1390
|
cli.command("check", "Run policy checks").option("--format <fmt>", "Output format: pretty or json", { default: "pretty" }).action(async (options) => {
|
|
1333
1391
|
const fmt = typeof options["format"] === "string" ? options["format"] : "pretty";
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","names":["wcmatch"],"sources":["../../../node_modules/.pnpm/cac@7.0.0/node_modules/cac/dist/index.js","../../workspace/dist/index.js","../../../node_modules/.pnpm/wildcard-match@5.1.4/node_modules/wildcard-match/build/index.es.mjs","../../core/dist/index.js","../../cli/dist/index.js"],"sourcesContent":["//#region node_modules/.pnpm/mri@1.2.0/node_modules/mri/lib/index.mjs\nfunction toArr(any) {\n\treturn any == null ? [] : Array.isArray(any) ? any : [any];\n}\nfunction toVal(out, key, val, opts) {\n\tvar x, old = out[key], nxt = !!~opts.string.indexOf(key) ? val == null || val === true ? \"\" : String(val) : typeof val === \"boolean\" ? val : !!~opts.boolean.indexOf(key) ? val === \"false\" ? false : val === \"true\" || (out._.push((x = +val, x * 0 === 0) ? x : val), !!val) : (x = +val, x * 0 === 0) ? x : val;\n\tout[key] = old == null ? nxt : Array.isArray(old) ? old.concat(nxt) : [old, nxt];\n}\nfunction lib_default(args, opts) {\n\targs = args || [];\n\topts = opts || {};\n\tvar k, arr, arg, name, val, out = { _: [] };\n\tvar i = 0, j = 0, idx = 0, len = args.length;\n\tconst alibi = opts.alias !== void 0;\n\tconst strict = opts.unknown !== void 0;\n\tconst defaults = opts.default !== void 0;\n\topts.alias = opts.alias || {};\n\topts.string = toArr(opts.string);\n\topts.boolean = toArr(opts.boolean);\n\tif (alibi) for (k in opts.alias) {\n\t\tarr = opts.alias[k] = toArr(opts.alias[k]);\n\t\tfor (i = 0; i < arr.length; i++) (opts.alias[arr[i]] = arr.concat(k)).splice(i, 1);\n\t}\n\tfor (i = opts.boolean.length; i-- > 0;) {\n\t\tarr = opts.alias[opts.boolean[i]] || [];\n\t\tfor (j = arr.length; j-- > 0;) opts.boolean.push(arr[j]);\n\t}\n\tfor (i = opts.string.length; i-- > 0;) {\n\t\tarr = opts.alias[opts.string[i]] || [];\n\t\tfor (j = arr.length; j-- > 0;) opts.string.push(arr[j]);\n\t}\n\tif (defaults) for (k in opts.default) {\n\t\tname = typeof opts.default[k];\n\t\tarr = opts.alias[k] = opts.alias[k] || [];\n\t\tif (opts[name] !== void 0) {\n\t\t\topts[name].push(k);\n\t\t\tfor (i = 0; i < arr.length; i++) opts[name].push(arr[i]);\n\t\t}\n\t}\n\tconst keys = strict ? Object.keys(opts.alias) : [];\n\tfor (i = 0; i < len; i++) {\n\t\targ = args[i];\n\t\tif (arg === \"--\") {\n\t\t\tout._ = out._.concat(args.slice(++i));\n\t\t\tbreak;\n\t\t}\n\t\tfor (j = 0; j < arg.length; j++) if (arg.charCodeAt(j) !== 45) break;\n\t\tif (j === 0) out._.push(arg);\n\t\telse if (arg.substring(j, j + 3) === \"no-\") {\n\t\t\tname = arg.substring(j + 3);\n\t\t\tif (strict && !~keys.indexOf(name)) return opts.unknown(arg);\n\t\t\tout[name] = false;\n\t\t} else {\n\t\t\tfor (idx = j + 1; idx < arg.length; idx++) if (arg.charCodeAt(idx) === 61) break;\n\t\t\tname = arg.substring(j, idx);\n\t\t\tval = arg.substring(++idx) || i + 1 === len || (\"\" + args[i + 1]).charCodeAt(0) === 45 || args[++i];\n\t\t\tarr = j === 2 ? [name] : name;\n\t\t\tfor (idx = 0; idx < arr.length; idx++) {\n\t\t\t\tname = arr[idx];\n\t\t\t\tif (strict && !~keys.indexOf(name)) return opts.unknown(\"-\".repeat(j) + name);\n\t\t\t\ttoVal(out, name, idx + 1 < arr.length || val, opts);\n\t\t\t}\n\t\t}\n\t}\n\tif (defaults) {\n\t\tfor (k in opts.default) if (out[k] === void 0) out[k] = opts.default[k];\n\t}\n\tif (alibi) for (k in out) {\n\t\tarr = opts.alias[k] || [];\n\t\twhile (arr.length > 0) out[arr.shift()] = out[k];\n\t}\n\treturn out;\n}\n\n//#endregion\n//#region src/utils.ts\nfunction removeBrackets(v) {\n\treturn v.replace(/[<[].+/, \"\").trim();\n}\nfunction findAllBrackets(v) {\n\tconst ANGLED_BRACKET_RE_GLOBAL = /<([^>]+)>/g;\n\tconst SQUARE_BRACKET_RE_GLOBAL = /\\[([^\\]]+)\\]/g;\n\tconst res = [];\n\tconst parse = (match) => {\n\t\tlet variadic = false;\n\t\tlet value = match[1];\n\t\tif (value.startsWith(\"...\")) {\n\t\t\tvalue = value.slice(3);\n\t\t\tvariadic = true;\n\t\t}\n\t\treturn {\n\t\t\trequired: match[0].startsWith(\"<\"),\n\t\t\tvalue,\n\t\t\tvariadic\n\t\t};\n\t};\n\tlet angledMatch;\n\twhile (angledMatch = ANGLED_BRACKET_RE_GLOBAL.exec(v)) res.push(parse(angledMatch));\n\tlet squareMatch;\n\twhile (squareMatch = SQUARE_BRACKET_RE_GLOBAL.exec(v)) res.push(parse(squareMatch));\n\treturn res;\n}\nfunction getMriOptions(options) {\n\tconst result = {\n\t\talias: {},\n\t\tboolean: []\n\t};\n\tfor (const [index, option] of options.entries()) {\n\t\tif (option.names.length > 1) result.alias[option.names[0]] = option.names.slice(1);\n\t\tif (option.isBoolean) if (option.negated) {\n\t\t\tif (!options.some((o, i) => {\n\t\t\t\treturn i !== index && o.names.some((name) => option.names.includes(name)) && typeof o.required === \"boolean\";\n\t\t\t})) result.boolean.push(option.names[0]);\n\t\t} else result.boolean.push(option.names[0]);\n\t}\n\treturn result;\n}\nfunction findLongest(arr) {\n\treturn arr.sort((a, b) => {\n\t\treturn a.length > b.length ? -1 : 1;\n\t})[0];\n}\nfunction padRight(str, length) {\n\treturn str.length >= length ? str : `${str}${\" \".repeat(length - str.length)}`;\n}\nfunction camelcase(input) {\n\treturn input.replaceAll(/([a-z])-([a-z])/g, (_, p1, p2) => {\n\t\treturn p1 + p2.toUpperCase();\n\t});\n}\nfunction setDotProp(obj, keys, val) {\n\tlet current = obj;\n\tfor (let i = 0; i < keys.length; i++) {\n\t\tconst key = keys[i];\n\t\tif (i === keys.length - 1) {\n\t\t\tcurrent[key] = val;\n\t\t\treturn;\n\t\t}\n\t\tif (current[key] == null) {\n\t\t\tconst nextKeyIsArrayIndex = +keys[i + 1] > -1;\n\t\t\tcurrent[key] = nextKeyIsArrayIndex ? [] : {};\n\t\t}\n\t\tcurrent = current[key];\n\t}\n}\nfunction setByType(obj, transforms) {\n\tfor (const key of Object.keys(transforms)) {\n\t\tconst transform = transforms[key];\n\t\tif (transform.shouldTransform) {\n\t\t\tobj[key] = [obj[key]].flat();\n\t\t\tif (typeof transform.transformFunction === \"function\") obj[key] = obj[key].map(transform.transformFunction);\n\t\t}\n\t}\n}\nfunction getFileName(input) {\n\tconst m = /([^\\\\/]+)$/.exec(input);\n\treturn m ? m[1] : \"\";\n}\nfunction camelcaseOptionName(name) {\n\treturn name.split(\".\").map((v, i) => {\n\t\treturn i === 0 ? camelcase(v) : v;\n\t}).join(\".\");\n}\nvar CACError = class extends Error {\n\tconstructor(message) {\n\t\tsuper(message);\n\t\tthis.name = \"CACError\";\n\t\tif (typeof Error.captureStackTrace !== \"function\") this.stack = new Error(message).stack;\n\t}\n};\n\n//#endregion\n//#region src/option.ts\nvar Option = class {\n\trawName;\n\tdescription;\n\t/** Option name */\n\tname;\n\t/** Option name and aliases */\n\tnames;\n\tisBoolean;\n\trequired;\n\tconfig;\n\tnegated;\n\tconstructor(rawName, description, config) {\n\t\tthis.rawName = rawName;\n\t\tthis.description = description;\n\t\tthis.config = Object.assign({}, config);\n\t\trawName = rawName.replaceAll(\".*\", \"\");\n\t\tthis.negated = false;\n\t\tthis.names = removeBrackets(rawName).split(\",\").map((v) => {\n\t\t\tlet name = v.trim().replace(/^-{1,2}/, \"\");\n\t\t\tif (name.startsWith(\"no-\")) {\n\t\t\t\tthis.negated = true;\n\t\t\t\tname = name.replace(/^no-/, \"\");\n\t\t\t}\n\t\t\treturn camelcaseOptionName(name);\n\t\t}).sort((a, b) => a.length > b.length ? 1 : -1);\n\t\tthis.name = this.names.at(-1);\n\t\tif (this.negated && this.config.default == null) this.config.default = true;\n\t\tif (rawName.includes(\"<\")) this.required = true;\n\t\telse if (rawName.includes(\"[\")) this.required = false;\n\t\telse this.isBoolean = true;\n\t}\n};\n\n//#endregion\n//#region src/runtime.ts\nlet runtimeProcessArgs;\nlet runtimeInfo;\nif (typeof process !== \"undefined\") {\n\tlet runtimeName;\n\tif (typeof Deno !== \"undefined\" && typeof Deno.version?.deno === \"string\") runtimeName = \"deno\";\n\telse if (typeof Bun !== \"undefined\" && typeof Bun.version === \"string\") runtimeName = \"bun\";\n\telse runtimeName = \"node\";\n\truntimeInfo = `${process.platform}-${process.arch} ${runtimeName}-${process.version}`;\n\truntimeProcessArgs = process.argv;\n} else if (typeof navigator === \"undefined\") runtimeInfo = `unknown`;\nelse runtimeInfo = `${navigator.platform} ${navigator.userAgent}`;\n\n//#endregion\n//#region src/command.ts\nvar Command = class {\n\trawName;\n\tdescription;\n\tconfig;\n\tcli;\n\toptions;\n\taliasNames;\n\tname;\n\targs;\n\tcommandAction;\n\tusageText;\n\tversionNumber;\n\texamples;\n\thelpCallback;\n\tglobalCommand;\n\tconstructor(rawName, description, config = {}, cli) {\n\t\tthis.rawName = rawName;\n\t\tthis.description = description;\n\t\tthis.config = config;\n\t\tthis.cli = cli;\n\t\tthis.options = [];\n\t\tthis.aliasNames = [];\n\t\tthis.name = removeBrackets(rawName);\n\t\tthis.args = findAllBrackets(rawName);\n\t\tthis.examples = [];\n\t}\n\tusage(text) {\n\t\tthis.usageText = text;\n\t\treturn this;\n\t}\n\tallowUnknownOptions() {\n\t\tthis.config.allowUnknownOptions = true;\n\t\treturn this;\n\t}\n\tignoreOptionDefaultValue() {\n\t\tthis.config.ignoreOptionDefaultValue = true;\n\t\treturn this;\n\t}\n\tversion(version, customFlags = \"-v, --version\") {\n\t\tthis.versionNumber = version;\n\t\tthis.option(customFlags, \"Display version number\");\n\t\treturn this;\n\t}\n\texample(example) {\n\t\tthis.examples.push(example);\n\t\treturn this;\n\t}\n\t/**\n\t* Add a option for this command\n\t* @param rawName Raw option name(s)\n\t* @param description Option description\n\t* @param config Option config\n\t*/\n\toption(rawName, description, config) {\n\t\tconst option = new Option(rawName, description, config);\n\t\tthis.options.push(option);\n\t\treturn this;\n\t}\n\talias(name) {\n\t\tthis.aliasNames.push(name);\n\t\treturn this;\n\t}\n\taction(callback) {\n\t\tthis.commandAction = callback;\n\t\treturn this;\n\t}\n\t/**\n\t* Check if a command name is matched by this command\n\t* @param name Command name\n\t*/\n\tisMatched(name) {\n\t\treturn this.name === name || this.aliasNames.includes(name);\n\t}\n\tget isDefaultCommand() {\n\t\treturn this.name === \"\" || this.aliasNames.includes(\"!\");\n\t}\n\tget isGlobalCommand() {\n\t\treturn this instanceof GlobalCommand;\n\t}\n\t/**\n\t* Check if an option is registered in this command\n\t* @param name Option name\n\t*/\n\thasOption(name) {\n\t\tname = name.split(\".\")[0];\n\t\treturn this.options.find((option) => {\n\t\t\treturn option.names.includes(name);\n\t\t});\n\t}\n\toutputHelp() {\n\t\tconst { name, commands } = this.cli;\n\t\tconst { versionNumber, options: globalOptions, helpCallback } = this.cli.globalCommand;\n\t\tlet sections = [{ body: `${name}${versionNumber ? `/${versionNumber}` : \"\"}` }];\n\t\tsections.push({\n\t\t\ttitle: \"Usage\",\n\t\t\tbody: ` $ ${name} ${this.usageText || this.rawName}`\n\t\t});\n\t\tif ((this.isGlobalCommand || this.isDefaultCommand) && commands.length > 0) {\n\t\t\tconst longestCommandName = findLongest(commands.map((command) => command.rawName));\n\t\t\tsections.push({\n\t\t\t\ttitle: \"Commands\",\n\t\t\t\tbody: commands.map((command) => {\n\t\t\t\t\treturn ` ${padRight(command.rawName, longestCommandName.length)} ${command.description}`;\n\t\t\t\t}).join(\"\\n\")\n\t\t\t}, {\n\t\t\t\ttitle: `For more info, run any command with the \\`--help\\` flag`,\n\t\t\t\tbody: commands.map((command) => ` $ ${name}${command.name === \"\" ? \"\" : ` ${command.name}`} --help`).join(\"\\n\")\n\t\t\t});\n\t\t}\n\t\tlet options = this.isGlobalCommand ? globalOptions : [...this.options, ...globalOptions || []];\n\t\tif (!this.isGlobalCommand && !this.isDefaultCommand) options = options.filter((option) => option.name !== \"version\");\n\t\tif (options.length > 0) {\n\t\t\tconst longestOptionName = findLongest(options.map((option) => option.rawName));\n\t\t\tsections.push({\n\t\t\t\ttitle: \"Options\",\n\t\t\t\tbody: options.map((option) => {\n\t\t\t\t\treturn ` ${padRight(option.rawName, longestOptionName.length)} ${option.description} ${option.config.default === void 0 ? \"\" : `(default: ${option.config.default})`}`;\n\t\t\t\t}).join(\"\\n\")\n\t\t\t});\n\t\t}\n\t\tif (this.examples.length > 0) sections.push({\n\t\t\ttitle: \"Examples\",\n\t\t\tbody: this.examples.map((example) => {\n\t\t\t\tif (typeof example === \"function\") return example(name);\n\t\t\t\treturn example;\n\t\t\t}).join(\"\\n\")\n\t\t});\n\t\tif (helpCallback) sections = helpCallback(sections) || sections;\n\t\tconsole.info(sections.map((section) => {\n\t\t\treturn section.title ? `${section.title}:\\n${section.body}` : section.body;\n\t\t}).join(\"\\n\\n\"));\n\t}\n\toutputVersion() {\n\t\tconst { name } = this.cli;\n\t\tconst { versionNumber } = this.cli.globalCommand;\n\t\tif (versionNumber) console.info(`${name}/${versionNumber} ${runtimeInfo}`);\n\t}\n\tcheckRequiredArgs() {\n\t\tconst minimalArgsCount = this.args.filter((arg) => arg.required).length;\n\t\tif (this.cli.args.length < minimalArgsCount) throw new CACError(`missing required args for command \\`${this.rawName}\\``);\n\t}\n\t/**\n\t* Check if the parsed options contain any unknown options\n\t*\n\t* Exit and output error when true\n\t*/\n\tcheckUnknownOptions() {\n\t\tconst { options, globalCommand } = this.cli;\n\t\tif (!this.config.allowUnknownOptions) {\n\t\t\tfor (const name of Object.keys(options)) if (name !== \"--\" && !this.hasOption(name) && !globalCommand.hasOption(name)) throw new CACError(`Unknown option \\`${name.length > 1 ? `--${name}` : `-${name}`}\\``);\n\t\t}\n\t}\n\t/**\n\t* Check if the required string-type options exist\n\t*/\n\tcheckOptionValue() {\n\t\tconst { options: parsedOptions, globalCommand } = this.cli;\n\t\tconst options = [...globalCommand.options, ...this.options];\n\t\tfor (const option of options) {\n\t\t\tconst value = parsedOptions[option.name.split(\".\")[0]];\n\t\t\tif (option.required) {\n\t\t\t\tconst hasNegated = options.some((o) => o.negated && o.names.includes(option.name));\n\t\t\t\tif (value === true || value === false && !hasNegated) throw new CACError(`option \\`${option.rawName}\\` value is missing`);\n\t\t\t}\n\t\t}\n\t}\n\t/**\n\t* Check if the number of args is more than expected\n\t*/\n\tcheckUnusedArgs() {\n\t\tconst maximumArgsCount = this.args.some((arg) => arg.variadic) ? Infinity : this.args.length;\n\t\tif (maximumArgsCount < this.cli.args.length) throw new CACError(`Unused args: ${this.cli.args.slice(maximumArgsCount).map((arg) => `\\`${arg}\\``).join(\", \")}`);\n\t}\n};\nvar GlobalCommand = class extends Command {\n\tconstructor(cli) {\n\t\tsuper(\"@@global@@\", \"\", {}, cli);\n\t}\n};\n\n//#endregion\n//#region src/cac.ts\nvar CAC = class extends EventTarget {\n\t/** The program name to display in help and version message */\n\tname;\n\tcommands;\n\tglobalCommand;\n\tmatchedCommand;\n\tmatchedCommandName;\n\t/**\n\t* Raw CLI arguments\n\t*/\n\trawArgs;\n\t/**\n\t* Parsed CLI arguments\n\t*/\n\targs;\n\t/**\n\t* Parsed CLI options, camelCased\n\t*/\n\toptions;\n\tshowHelpOnExit;\n\tshowVersionOnExit;\n\t/**\n\t* @param name The program name to display in help and version message\n\t*/\n\tconstructor(name = \"\") {\n\t\tsuper();\n\t\tthis.name = name;\n\t\tthis.commands = [];\n\t\tthis.rawArgs = [];\n\t\tthis.args = [];\n\t\tthis.options = {};\n\t\tthis.globalCommand = new GlobalCommand(this);\n\t\tthis.globalCommand.usage(\"<command> [options]\");\n\t}\n\t/**\n\t* Add a global usage text.\n\t*\n\t* This is not used by sub-commands.\n\t*/\n\tusage(text) {\n\t\tthis.globalCommand.usage(text);\n\t\treturn this;\n\t}\n\t/**\n\t* Add a sub-command\n\t*/\n\tcommand(rawName, description, config) {\n\t\tconst command = new Command(rawName, description || \"\", config, this);\n\t\tcommand.globalCommand = this.globalCommand;\n\t\tthis.commands.push(command);\n\t\treturn command;\n\t}\n\t/**\n\t* Add a global CLI option.\n\t*\n\t* Which is also applied to sub-commands.\n\t*/\n\toption(rawName, description, config) {\n\t\tthis.globalCommand.option(rawName, description, config);\n\t\treturn this;\n\t}\n\t/**\n\t* Show help message when `-h, --help` flags appear.\n\t*\n\t*/\n\thelp(callback) {\n\t\tthis.globalCommand.option(\"-h, --help\", \"Display this message\");\n\t\tthis.globalCommand.helpCallback = callback;\n\t\tthis.showHelpOnExit = true;\n\t\treturn this;\n\t}\n\t/**\n\t* Show version number when `-v, --version` flags appear.\n\t*\n\t*/\n\tversion(version, customFlags = \"-v, --version\") {\n\t\tthis.globalCommand.version(version, customFlags);\n\t\tthis.showVersionOnExit = true;\n\t\treturn this;\n\t}\n\t/**\n\t* Add a global example.\n\t*\n\t* This example added here will not be used by sub-commands.\n\t*/\n\texample(example) {\n\t\tthis.globalCommand.example(example);\n\t\treturn this;\n\t}\n\t/**\n\t* Output the corresponding help message\n\t* When a sub-command is matched, output the help message for the command\n\t* Otherwise output the global one.\n\t*\n\t*/\n\toutputHelp() {\n\t\tif (this.matchedCommand) this.matchedCommand.outputHelp();\n\t\telse this.globalCommand.outputHelp();\n\t}\n\t/**\n\t* Output the version number.\n\t*\n\t*/\n\toutputVersion() {\n\t\tthis.globalCommand.outputVersion();\n\t}\n\tsetParsedInfo({ args, options }, matchedCommand, matchedCommandName) {\n\t\tthis.args = args;\n\t\tthis.options = options;\n\t\tif (matchedCommand) this.matchedCommand = matchedCommand;\n\t\tif (matchedCommandName) this.matchedCommandName = matchedCommandName;\n\t\treturn this;\n\t}\n\tunsetMatchedCommand() {\n\t\tthis.matchedCommand = void 0;\n\t\tthis.matchedCommandName = void 0;\n\t}\n\t/**\n\t* Parse argv\n\t*/\n\tparse(argv, { run = true } = {}) {\n\t\tif (!argv) {\n\t\t\tif (!runtimeProcessArgs) throw new Error(\"No argv provided and runtime process argv is not available.\");\n\t\t\targv = runtimeProcessArgs;\n\t\t}\n\t\tthis.rawArgs = argv;\n\t\tif (!this.name) this.name = argv[1] ? getFileName(argv[1]) : \"cli\";\n\t\tlet shouldParse = true;\n\t\tfor (const command of this.commands) {\n\t\t\tconst parsed = this.mri(argv.slice(2), command);\n\t\t\tconst commandName = parsed.args[0];\n\t\t\tif (command.isMatched(commandName)) {\n\t\t\t\tshouldParse = false;\n\t\t\t\tconst parsedInfo = {\n\t\t\t\t\t...parsed,\n\t\t\t\t\targs: parsed.args.slice(1)\n\t\t\t\t};\n\t\t\t\tthis.setParsedInfo(parsedInfo, command, commandName);\n\t\t\t\tthis.dispatchEvent(new CustomEvent(`command:${commandName}`, { detail: command }));\n\t\t\t}\n\t\t}\n\t\tif (shouldParse) {\n\t\t\tfor (const command of this.commands) if (command.isDefaultCommand) {\n\t\t\t\tshouldParse = false;\n\t\t\t\tconst parsed = this.mri(argv.slice(2), command);\n\t\t\t\tthis.setParsedInfo(parsed, command);\n\t\t\t\tthis.dispatchEvent(new CustomEvent(\"command:!\", { detail: command }));\n\t\t\t}\n\t\t}\n\t\tif (shouldParse) {\n\t\t\tconst parsed = this.mri(argv.slice(2));\n\t\t\tthis.setParsedInfo(parsed);\n\t\t}\n\t\tif (this.options.help && this.showHelpOnExit) {\n\t\t\tthis.outputHelp();\n\t\t\trun = false;\n\t\t\tthis.unsetMatchedCommand();\n\t\t}\n\t\tif (this.options.version && this.showVersionOnExit && this.matchedCommandName == null) {\n\t\t\tthis.outputVersion();\n\t\t\trun = false;\n\t\t\tthis.unsetMatchedCommand();\n\t\t}\n\t\tconst parsedArgv = {\n\t\t\targs: this.args,\n\t\t\toptions: this.options\n\t\t};\n\t\tif (run) this.runMatchedCommand();\n\t\tif (!this.matchedCommand && this.args[0]) this.dispatchEvent(new CustomEvent(\"command:*\", { detail: this.args[0] }));\n\t\treturn parsedArgv;\n\t}\n\tmri(argv, command) {\n\t\tconst cliOptions = [...this.globalCommand.options, ...command ? command.options : []];\n\t\tconst mriOptions = getMriOptions(cliOptions);\n\t\tlet argsAfterDoubleDashes = [];\n\t\tconst doubleDashesIndex = argv.indexOf(\"--\");\n\t\tif (doubleDashesIndex !== -1) {\n\t\t\targsAfterDoubleDashes = argv.slice(doubleDashesIndex + 1);\n\t\t\targv = argv.slice(0, doubleDashesIndex);\n\t\t}\n\t\tlet parsed = lib_default(argv, mriOptions);\n\t\tparsed = Object.keys(parsed).reduce((res, name) => {\n\t\t\treturn {\n\t\t\t\t...res,\n\t\t\t\t[camelcaseOptionName(name)]: parsed[name]\n\t\t\t};\n\t\t}, { _: [] });\n\t\tconst args = parsed._;\n\t\tconst options = { \"--\": argsAfterDoubleDashes };\n\t\tconst ignoreDefault = command && command.config.ignoreOptionDefaultValue ? command.config.ignoreOptionDefaultValue : this.globalCommand.config.ignoreOptionDefaultValue;\n\t\tconst transforms = Object.create(null);\n\t\tfor (const cliOption of cliOptions) {\n\t\t\tif (!ignoreDefault && cliOption.config.default !== void 0) for (const name of cliOption.names) options[name] = cliOption.config.default;\n\t\t\tif (Array.isArray(cliOption.config.type) && transforms[cliOption.name] === void 0) {\n\t\t\t\ttransforms[cliOption.name] = Object.create(null);\n\t\t\t\ttransforms[cliOption.name].shouldTransform = true;\n\t\t\t\ttransforms[cliOption.name].transformFunction = cliOption.config.type[0];\n\t\t\t}\n\t\t}\n\t\tfor (const key of Object.keys(parsed)) if (key !== \"_\") {\n\t\t\tsetDotProp(options, key.split(\".\"), parsed[key]);\n\t\t\tsetByType(options, transforms);\n\t\t}\n\t\treturn {\n\t\t\targs,\n\t\t\toptions\n\t\t};\n\t}\n\trunMatchedCommand() {\n\t\tconst { args, options, matchedCommand: command } = this;\n\t\tif (!command || !command.commandAction) return;\n\t\tcommand.checkUnknownOptions();\n\t\tcommand.checkOptionValue();\n\t\tcommand.checkRequiredArgs();\n\t\tcommand.checkUnusedArgs();\n\t\tconst actionArgs = [];\n\t\tcommand.args.forEach((arg, index) => {\n\t\t\tif (arg.variadic) actionArgs.push(args.slice(index));\n\t\t\telse actionArgs.push(args[index]);\n\t\t});\n\t\tactionArgs.push(options);\n\t\treturn command.commandAction.apply(this, actionArgs);\n\t}\n};\n\n//#endregion\n//#region src/index.ts\n/**\n* @param name The program name to display in help and version message\n*/\nconst cac = (name = \"\") => new CAC(name);\n\n//#endregion\nexport { CAC, Command, cac, cac as default };","import { createRequire } from \"node:module\";\nimport { execFileSync } from \"node:child_process\";\nimport path from \"node:path\";\n//#region src/package-json.ts\nasync function readPackageJson(path) {\n\tconst { readFile } = await import(\"node:fs/promises\");\n\tconst content = await readFile(path, \"utf8\");\n\treturn JSON.parse(content);\n}\nasync function writePackageJson(filePath, data) {\n\tconst { writeFile } = await import(\"node:fs/promises\");\n\tawait writeFile(filePath, `${JSON.stringify(data, void 0, 2)}\\n`, \"utf8\");\n}\n//#endregion\n//#region src/scripts.ts\nfunction getScript(packageJson, name) {\n\tconst scripts = packageJson[\"scripts\"];\n\tif (typeof scripts !== \"object\" || scripts === null) return;\n\tconst value = Object.entries(scripts).find(([k]) => k === name)?.[1];\n\treturn typeof value === \"string\" ? value : void 0;\n}\nfunction setScript(packageJson, name, command) {\n\tlet scripts = packageJson[\"scripts\"];\n\tif (typeof scripts !== \"object\" || scripts === null) {\n\t\tscripts = {};\n\t\tpackageJson[\"scripts\"] = scripts;\n\t}\n\tObject.assign(scripts, { [name]: command });\n}\n//#endregion\n//#region src/workspace.ts\nconst npmCommand = getNpmCommand();\nconst pnpmCommand = getPnpmCommand();\nconst yarnCommand = getYarnCommand();\nfunction discoverWorkspace(root) {\n\tconst pm = detectPackageManager(root);\n\tlet output;\n\tswitch (pm) {\n\t\tcase \"npm\": {\n\t\t\toutput = execFileSync(npmCommand, [\n\t\t\t\t\"ls\",\n\t\t\t\t\"--workspaces\",\n\t\t\t\t\"--all\",\n\t\t\t\t\"--json\",\n\t\t\t\t\"--depth\",\n\t\t\t\t\"0\"\n\t\t\t], {\n\t\t\t\tcwd: root,\n\t\t\t\tencoding: \"utf8\"\n\t\t\t});\n\t\t\tconst tree = JSON.parse(output);\n\t\t\treturn Object.values(tree.dependencies ?? {}).map((entry) => ({ path: entry.path }));\n\t\t}\n\t\tcase \"pnpm\":\n\t\t\toutput = execFileSync(pnpmCommand, [\n\t\t\t\t\"ls\",\n\t\t\t\t\"-r\",\n\t\t\t\t\"--depth\",\n\t\t\t\t\"-1\",\n\t\t\t\t\"--json\"\n\t\t\t], {\n\t\t\t\tcwd: root,\n\t\t\t\tencoding: \"utf8\"\n\t\t\t});\n\t\t\treturn JSON.parse(output).map((entry) => ({ path: entry.path }));\n\t\tcase \"yarn\":\n\t\t\toutput = execFileSync(yarnCommand, [\n\t\t\t\t\"workspaces\",\n\t\t\t\t\"list\",\n\t\t\t\t\"--json\"\n\t\t\t], {\n\t\t\t\tcwd: root,\n\t\t\t\tencoding: \"utf8\"\n\t\t\t});\n\t\t\treturn output.trim().split(\"\\n\").filter(Boolean).map((line) => JSON.parse(line)).map((entry) => ({ path: path.resolve(root, entry.location) }));\n\t}\n}\nfunction detectPackageManager(root) {\n\tconst userAgent = process.env[\"npm_config_user_agent\"] ?? \"\";\n\tif (userAgent.startsWith(\"pnpm\")) return \"pnpm\";\n\tif (userAgent.startsWith(\"yarn\")) return \"yarn\";\n\tif (userAgent.startsWith(\"npm\")) return \"npm\";\n\tconst request = createRequire(import.meta.url);\n\tfor (const [lockFile, pm] of Object.entries({\n\t\t\"package-lock.json\": \"npm\",\n\t\t\"pnpm-lock.yaml\": \"pnpm\",\n\t\t\"yarn.lock\": \"yarn\"\n\t})) try {\n\t\trequest.resolve(path.join(root, lockFile));\n\t\treturn pm;\n\t} catch {}\n\ttry {\n\t\tconst rawPm = request(path.join(root, \"package.json\"))[\"packageManager\"];\n\t\tconst pm = typeof rawPm === \"string\" ? rawPm.split(\"@\", 2)[0] ?? \"\" : \"\";\n\t\tif ([\n\t\t\t\"npm\",\n\t\t\t\"pnpm\",\n\t\t\t\"yarn\"\n\t\t].includes(pm)) return pm;\n\t} catch {}\n\treturn \"pnpm\";\n}\nfunction getNpmCommand() {\n\treturn path.join(path.dirname(process.execPath), \"npm\");\n}\nfunction getPnpmCommand() {\n\ttry {\n\t\tconst request = createRequire(import.meta.url);\n\t\tconst specifier = [\"pnpm\", \"package.json\"].join(\"/\");\n\t\tconst packagePath = request.resolve(specifier);\n\t\treturn path.resolve(path.dirname(packagePath), \"bin\", \"pnpm.cjs\");\n\t} catch {\n\t\treturn \"pnpm\";\n\t}\n}\nfunction getYarnCommand() {\n\ttry {\n\t\tconst request = createRequire(import.meta.url);\n\t\tconst specifier = [\n\t\t\t\"@yarnpkg\",\n\t\t\t\"cli\",\n\t\t\t\"package.json\"\n\t\t].join(\"/\");\n\t\tconst packagePath = request.resolve(specifier);\n\t\treturn path.resolve(path.dirname(packagePath), \"sources\", \"bin\", \"yarn.js\");\n\t} catch {\n\t\ttry {\n\t\t\tconst request = createRequire(import.meta.url);\n\t\t\tconst specifier = [\"yarn\", \"package.json\"].join(\"/\");\n\t\t\tconst packagePath = request.resolve(specifier);\n\t\t\treturn path.resolve(path.dirname(packagePath), \"bin\", \"yarn.js\");\n\t\t} catch {\n\t\t\treturn \"yarn\";\n\t\t}\n\t}\n}\n//#endregion\nexport { discoverWorkspace, getScript, readPackageJson, setScript, writePackageJson };\n\n//# sourceMappingURL=index.js.map","/**\n * Escapes a character if it has a special meaning in regular expressions\n * and returns the character as is if it doesn't\n */\nfunction escapeRegExpChar(char) {\n if (char === '-' ||\n char === '^' ||\n char === '$' ||\n char === '+' ||\n char === '.' ||\n char === '(' ||\n char === ')' ||\n char === '|' ||\n char === '[' ||\n char === ']' ||\n char === '{' ||\n char === '}' ||\n char === '*' ||\n char === '?' ||\n char === '\\\\') {\n return \"\\\\\".concat(char);\n }\n else {\n return char;\n }\n}\n/**\n * Escapes all characters in a given string that have a special meaning in regular expressions\n */\nfunction escapeRegExpString(str) {\n var result = '';\n for (var i = 0; i < str.length; i++) {\n result += escapeRegExpChar(str[i]);\n }\n return result;\n}\n/**\n * Transforms one or more glob patterns into a RegExp pattern\n */\nfunction transform(pattern, separator) {\n if (separator === void 0) { separator = true; }\n if (Array.isArray(pattern)) {\n var regExpPatterns = pattern.map(function (p) { return \"^\".concat(transform(p, separator), \"$\"); });\n return \"(?:\".concat(regExpPatterns.join('|'), \")\");\n }\n var separatorSplitter = '';\n var separatorMatcher = '';\n var wildcard = '.';\n if (separator === true) {\n separatorSplitter = '/';\n separatorMatcher = '[/\\\\\\\\]';\n wildcard = '[^/\\\\\\\\]';\n }\n else if (separator) {\n separatorSplitter = separator;\n separatorMatcher = escapeRegExpString(separatorSplitter);\n if (separatorMatcher.length > 1) {\n separatorMatcher = \"(?:\".concat(separatorMatcher, \")\");\n wildcard = \"((?!\".concat(separatorMatcher, \").)\");\n }\n else {\n wildcard = \"[^\".concat(separatorMatcher, \"]\");\n }\n }\n var requiredSeparator = separator ? \"\".concat(separatorMatcher, \"+?\") : '';\n var optionalSeparator = separator ? \"\".concat(separatorMatcher, \"*?\") : '';\n var segments = separator ? pattern.split(separatorSplitter) : [pattern];\n var result = '';\n for (var s = 0; s < segments.length; s++) {\n var segment = segments[s];\n var nextSegment = segments[s + 1];\n var currentSeparator = '';\n if (!segment && s > 0) {\n continue;\n }\n if (separator) {\n if (s === segments.length - 1) {\n currentSeparator = optionalSeparator;\n }\n else if (nextSegment !== '**') {\n currentSeparator = requiredSeparator;\n }\n else {\n currentSeparator = '';\n }\n }\n if (separator && segment === '**') {\n if (currentSeparator) {\n result +=\n s === 0\n ? ''\n : s === segments.length - 1\n ? \"(?:\".concat(requiredSeparator, \"|$)\")\n : requiredSeparator;\n result += \"(?:\".concat(wildcard, \"*?\").concat(currentSeparator, \")*?\");\n }\n continue;\n }\n for (var c = 0; c < segment.length; c++) {\n var char = segment[c];\n if (char === '\\\\') {\n if (c < segment.length - 1) {\n result += escapeRegExpChar(segment[c + 1]);\n c++;\n }\n }\n else if (char === '?') {\n result += wildcard;\n }\n else if (char === '*') {\n result += \"\".concat(wildcard, \"*?\");\n }\n else {\n result += escapeRegExpChar(char);\n }\n }\n result += currentSeparator;\n }\n return result;\n}\n\nfunction isMatch(regexp, sample) {\n if (typeof sample !== 'string') {\n throw new TypeError(\"Sample must be a string, but \".concat(typeof sample, \" given\"));\n }\n return regexp.test(sample);\n}\n/**\n * Compiles one or more glob patterns into a RegExp and returns an isMatch function.\n * The isMatch function takes a sample string as its only argument and returns `true`\n * if the string matches the pattern(s).\n *\n * ```js\n * wildcardMatch('src/*.js')('src/index.js') //=> true\n * ```\n *\n * ```js\n * const isMatch = wildcardMatch('*.example.com', '.')\n * isMatch('foo.example.com') //=> true\n * isMatch('foo.bar.com') //=> false\n * ```\n */\nfunction wildcardMatch(pattern, options) {\n if (typeof pattern !== 'string' && !Array.isArray(pattern)) {\n throw new TypeError(\"The first argument must be a single pattern string or an array of patterns, but \".concat(typeof pattern, \" given\"));\n }\n if (typeof options === 'string' || typeof options === 'boolean') {\n options = { separator: options };\n }\n if (arguments.length === 2 &&\n !(typeof options === 'undefined' ||\n (typeof options === 'object' && options !== null && !Array.isArray(options)))) {\n throw new TypeError(\"The second argument must be an options object or a string/boolean separator, but \".concat(typeof options, \" given\"));\n }\n options = options || {};\n if (options.separator === '\\\\') {\n throw new Error('\\\\ is not a valid separator because it is used for escaping. Try setting the separator to `true` instead');\n }\n var regexpPattern = transform(pattern, options.separator);\n var regexp = new RegExp(\"^\".concat(regexpPattern, \"$\"), options.flags);\n var fn = isMatch.bind(null, regexp);\n fn.options = options;\n fn.pattern = pattern;\n fn.regexp = regexp;\n return fn;\n}\n\nexport { wildcardMatch as default };\n//# sourceMappingURL=index.es.mjs.map\n","import { getScript, readPackageJson } from \"@moniq/workspace\";\nimport path from \"node:path\";\nimport wcmatch from \"wildcard-match\";\n//#region src/scripts.ts\nasync function resolveScriptPolicies(scriptsConfig, root, packages_) {\n\tconst diagnostics = [];\n\tconst entries = Object.entries(scriptsConfig ?? {});\n\tfor (const [scriptName, policyOrArray] of entries) {\n\t\tconst policies = Array.isArray(policyOrArray) ? policyOrArray : [policyOrArray];\n\t\tfor (const package_ of packages_) {\n\t\t\tconst relativePath = path.relative(root, package_.path);\n\t\t\tconst policy = pickPolicy(policies, relativePath);\n\t\t\tif (policy !== void 0 && policy.severity !== \"off\") await resolvePolicy(policy, scriptName, package_, relativePath, diagnostics);\n\t\t}\n\t}\n\treturn diagnostics;\n}\nfunction isCommandMatch(actual, expected) {\n\tif (typeof expected === \"function\") return expected(actual);\n\tif (expected instanceof RegExp) return expected.test(actual);\n\treturn actual === expected;\n}\nfunction isGlobMatch(pattern, relativePath) {\n\tif (pattern === \"*\") return true;\n\tif (pattern === \".\") return relativePath === \".\" || relativePath === \"\";\n\treturn wcmatch(pattern)(relativePath);\n}\nfunction isMatchAny(patterns, relativePath) {\n\tfor (const pattern of patterns) if (isGlobMatch(pattern, relativePath)) return true;\n\treturn false;\n}\nfunction isPolicyMatch(policy, relativePath) {\n\tconst include = policy.include ?? [\"*\"];\n\tconst exclude = policy.exclude ?? [];\n\treturn isMatchAny(include, relativePath) && !isMatchAny(exclude, relativePath);\n}\nfunction pickPolicy(policies, relativePath) {\n\tfor (const policy of policies) if (isPolicyMatch(policy, relativePath)) return policy;\n}\nasync function resolvePolicy(policy, scriptName, package_, relativePath, diagnostics) {\n\tconst packageJson = await readPackageJson(path.join(package_.path, \"package.json\"));\n\tconst packageDisplayName = packageJson[\"name\"] ?? path.basename(package_.path);\n\tconst hasScript = getScript(packageJson, scriptName) !== void 0;\n\tconst severity = policy.severity ?? \"error\";\n\tif (policy.required !== false && !hasScript) {\n\t\tdiagnostics.push({\n\t\t\tfix: policy.autofix && typeof policy.command === \"string\" ? policy.command : void 0,\n\t\t\tmessage: `Missing required script \"${scriptName}\"`,\n\t\t\tpackageName: packageDisplayName,\n\t\t\tpackagePath: package_.path,\n\t\t\tscriptName,\n\t\t\tseverity\n\t\t});\n\t\treturn;\n\t}\n\tif (policy.command === void 0 || !hasScript) return;\n\tif (policy.allowCustomCommands !== void 0 && isMatchAny(policy.allowCustomCommands, relativePath)) return;\n\tconst actualCommand = getScript(packageJson, scriptName);\n\tif (actualCommand !== void 0 && isCommandMatch(actualCommand, policy.command)) return;\n\tdiagnostics.push({\n\t\tactual: actualCommand,\n\t\texpected: typeof policy.command === \"string\" ? policy.command : void 0,\n\t\tfix: policy.autofix && typeof policy.command === \"string\" ? policy.command : void 0,\n\t\tmessage: `Unexpected command for script \"${scriptName}\"`,\n\t\tpackageName: packageDisplayName,\n\t\tpackagePath: package_.path,\n\t\tscriptName,\n\t\tseverity\n\t});\n}\n//#endregion\n//#region src/index.ts\nasync function resolve(config, root, packages_) {\n\tconst diagnostics = [];\n\tconst scriptDiags = await resolveScriptPolicies(config.scripts, root, packages_);\n\tdiagnostics.push(...scriptDiags);\n\treturn diagnostics;\n}\n//#endregion\nexport { resolve };\n\n//# sourceMappingURL=index.js.map","import { cac } from \"cac\";\nimport { loadConfig } from \"@moniq/config\";\nimport { resolve } from \"@moniq/core\";\nimport { discoverWorkspace, readPackageJson } from \"@moniq/workspace\";\nimport { styleText } from \"node:util\";\nimport path from \"node:path\";\nimport { stdin } from \"node:process\";\nimport { createInterface } from \"node:readline/promises\";\n//#region ../moniq/package.json\nvar version = \"0.2.0\";\n//#endregion\n//#region src/format.ts\nfunction formatDiagnostics(diagnostics, options) {\n\tif ((options?.format ?? \"pretty\") === \"json\") return formatJson(diagnostics);\n\treturn formatPretty(diagnostics, options?.isDryRun);\n}\nfunction formatJson(diagnostics) {\n\treturn `${JSON.stringify(diagnostics, void 0, 2)}\\n`;\n}\nfunction formatPretty(diagnostics, isDryRun) {\n\tif (diagnostics.length === 0) return styleText([\"bold\", \"green\"], \"✅ No issues found.\");\n\tconst lines = [];\n\tconst byPackage = /* @__PURE__ */ new Map();\n\tfor (const d of diagnostics) {\n\t\tconst array = byPackage.get(d.packageName);\n\t\tif (array) array.push(d);\n\t\telse byPackage.set(d.packageName, [d]);\n\t}\n\tfor (const [packageName, diags] of byPackage) {\n\t\tlines.push(\"\", `📦 ${styleText([\"bold\", \"cyan\"], packageName)}`);\n\t\tfor (const d of diags) pushDiagnostic(lines, d, isDryRun);\n\t}\n\tconst errorCount = diagnostics.filter((d) => d.severity === \"error\").length;\n\tconst warningCount = diagnostics.filter((d) => d.severity === \"warn\").length;\n\tconst countParts = [];\n\tif (errorCount > 0) countParts.push(styleText(\"red\", `${String(errorCount)} error(s)`));\n\tif (warningCount > 0) countParts.push(styleText(\"yellow\", `${String(warningCount)} warning(s)`));\n\tconst summary = countParts.join(\", \");\n\tconst summaryLine = `📋 Found ${String(diagnostics.length)} issue(s) — ${summary.length > 0 ? summary : \"all clear\"}`;\n\tlines.push(\"\", styleText(\"dim\", summaryLine));\n\tif (isDryRun) {\n\t\tconst fixableCount = diagnostics.filter((d) => d.fix && d.severity !== \"off\").length;\n\t\tlines.push(\"\", styleText(\"dim\", `🔮 Dry-run: ${String(fixableCount)} fix(es) available`));\n\t}\n\treturn lines.join(\"\\n\");\n}\nfunction pushDiagnostic(lines, d, isDryRun) {\n\tconst badge = severityBadge(d.severity);\n\tconst emoji = severityEmoji(d.severity);\n\tlines.push(` ${emoji} ${badge} ${d.message}`);\n\tif (d.expected && d.actual) lines.push(` ${styleText(\"dim\", \"Expected:\")} ${styleText(\"cyan\", d.expected)}`, ` ${styleText(\"dim\", \"Actual:\")} ${styleText(\"red\", d.actual)}`);\n\telse if (d.expected) lines.push(` ${styleText(\"dim\", \"Expected:\")} ${styleText(\"cyan\", d.expected)}`);\n\telse if (d.actual) lines.push(` ${styleText(\"dim\", \"Actual:\")} ${styleText(\"red\", d.actual)}`);\n\tif (d.fix) {\n\t\tconst label = styleText(\"dim\", isDryRun ? \"Would fix:\" : \"Fix:\");\n\t\tconst icon = isDryRun ? \"🔮\" : \"🔧\";\n\t\tlines.push(` ${icon} ${label} ${d.fix}`);\n\t}\n}\nfunction severityBadge(severity) {\n\tif (severity === \"error\") return styleText([\"bold\", \"red\"], \"ERROR\");\n\tif (severity === \"warn\") return styleText([\"bold\", \"yellow\"], \"WARN\");\n\treturn styleText(\"gray\", \"OFF\");\n}\nfunction severityEmoji(severity) {\n\tif (severity === \"error\") return \"❌\";\n\tif (severity === \"warn\") return \"⚠️ \";\n\treturn \"⚪\";\n}\n//#endregion\n//#region src/scripts.ts\nasync function applyScriptFixes(diagnostics, options) {\n\tconst fixable = diagnostics.filter((d) => d.fix && d.severity !== \"off\");\n\tconst isDryRun = options?.isDryRun ?? false;\n\tlet fixed = 0;\n\tlet errors = 0;\n\tconst packages = /* @__PURE__ */ new Set();\n\tfor (const d of fixable) {\n\t\tif (!d.fix) continue;\n\t\tif (isDryRun) {\n\t\t\tfixed++;\n\t\t\tpackages.add(d.packagePath);\n\t\t\tcontinue;\n\t\t}\n\t\ttry {\n\t\t\tconst packageFilePath = path.join(d.packagePath, \"package.json\");\n\t\t\tconst { readFile, writeFile } = await import(\"node:fs/promises\");\n\t\t\tconst content = await readFile(packageFilePath, \"utf8\");\n\t\t\tconst package_ = JSON.parse(content);\n\t\t\tconst scriptName = d.scriptName;\n\t\t\tif (!scriptName) continue;\n\t\t\tconst scriptsRecord = package_[\"scripts\"];\n\t\t\tif (scriptsRecord) {\n\t\t\t\tconst entries = Object.entries(scriptsRecord);\n\t\t\t\tif (!Object.hasOwn(scriptsRecord, scriptName)) entries.push([scriptName, d.fix]);\n\t\t\t\tpackage_[\"scripts\"] = Object.fromEntries(entries.map(([name, command]) => {\n\t\t\t\t\treturn name === scriptName ? [name, d.fix ?? command] : [name, command];\n\t\t\t\t}));\n\t\t\t}\n\t\t\tawait writeFile(packageFilePath, `${JSON.stringify(package_, void 0, 2)}\\n`, \"utf8\");\n\t\t\tfixed++;\n\t\t\tpackages.add(d.packagePath);\n\t\t} catch {\n\t\t\terrors++;\n\t\t}\n\t}\n\treturn {\n\t\terrors,\n\t\tfixed,\n\t\tisDryRun,\n\t\tpackageCount: packages.size\n\t};\n}\n//#endregion\n//#region src/commands/check.ts\nasync function check(options) {\n\tconst cwd = process.cwd();\n\tlet config;\n\ttry {\n\t\tconfig = await loadConfig(cwd);\n\t} catch {\n\t\tthrow new Error(\"No moniq.config file found in or above the current directory.\");\n\t}\n\tconst packages = discoverWorkspace(cwd);\n\tif (packages.length === 0) throw new Error(\"No workspace packages found.\");\n\tconst diagnostics = await resolve(config, cwd, packages);\n\tlet fixSummary;\n\tif (options.fix) fixSummary = await applyScriptFixes(diagnostics, { isDryRun: options.isDryRun });\n\tif (options.format !== \"json\") {\n\t\tconsole.log(` 🔍 Scanned ${String(packages.length)} package(s)`);\n\t\tconsole.log();\n\t}\n\tconsole.log(formatDiagnostics(diagnostics, {\n\t\tformat: options.format,\n\t\tisDryRun: options.isDryRun\n\t}));\n\tif (fixSummary) if (fixSummary.isDryRun) {\n\t\tconst message = `🔮 Dry-run: ${String(fixSummary.fixed)} fix(es) available, ${String(fixSummary.errors)} error(s)`;\n\t\tconsole.log(styleText(\"dim\", message));\n\t} else {\n\t\tconst message = `✅ Fixed ${String(fixSummary.fixed)} issue(s) across ${String(fixSummary.packageCount)} package(s)`;\n\t\tconsole.log(styleText([\"bold\", \"green\"], message));\n\t}\n}\n//#endregion\n//#region src/commands/doctor.ts\nasync function doctor() {\n\tconst cwd = process.cwd();\n\tconst issues = [];\n\ttry {\n\t\tconst config = await loadConfig(cwd);\n\t\tissues.push({\n\t\t\tmessage: \"moniq.config file found and loadable.\",\n\t\t\tseverity: \"warn\"\n\t\t});\n\t\tcheckScriptPolicies(config, issues);\n\t} catch {\n\t\tissues.push({\n\t\t\tmessage: \"No moniq.config file found in or above the current directory.\",\n\t\t\tseverity: \"error\"\n\t\t});\n\t}\n\ttry {\n\t\tconst packageCount = discoverWorkspace(cwd).length;\n\t\tif (packageCount === 0) issues.push({\n\t\t\tmessage: \"No workspace packages detected. Check your workspace configuration.\",\n\t\t\tseverity: \"warn\"\n\t\t});\n\t\telse issues.push({\n\t\t\tmessage: `Detected ${String(packageCount)} workspace package(s).`,\n\t\t\tseverity: \"warn\"\n\t\t});\n\t} catch {\n\t\tissues.push({\n\t\t\tmessage: \"Failed to discover workspace packages. Ensure a lock file or packageManager field is present.\",\n\t\t\tseverity: \"error\"\n\t\t});\n\t}\n\tconsole.log();\n\tconsole.log(` ${styleText(\"bold\", \"🏥 Configuration Doctor\")}`);\n\tconsole.log();\n\tif (issues.length === 0) {\n\t\tconsole.log(` ${styleText([\"bold\", \"green\"], \"✅ Everything looks good!\")}`);\n\t\treturn;\n\t}\n\tfor (const issue of issues) {\n\t\tconst icon = issue.severity === \"error\" ? \"❌\" : \"⚠️ \";\n\t\tconst label = issue.severity === \"error\" ? styleText([\"bold\", \"red\"], \"ERROR\") : styleText([\"bold\", \"yellow\"], \"WARN\");\n\t\tconsole.log(` ${icon} ${label} ${issue.message}`);\n\t}\n\tconst errorCount = issues.filter((index) => index.severity === \"error\").length;\n\tconst warningCount = issues.filter((index) => index.severity === \"warn\").length;\n\tconst summary = styleText(\"dim\", `Found ${`${String(errorCount)} error(s)`}, ${`${String(warningCount)} warning(s)`}`);\n\tconsole.log();\n\tconsole.log(` ${summary}`);\n\tif (errorCount > 0) {\n\t\tconst tip = styleText([\"bold\", \"cyan\"], \"💡 Tip:\");\n\t\tconst hint = styleText(\"dim\", \"moniq init\");\n\t\tconsole.log();\n\t\tconsole.log(` ${tip} Run ${hint} to scaffold a starter configuration.`);\n\t}\n}\nfunction checkScriptPolicies(config, issues) {\n\tconst scripts = config.scripts;\n\tif (!scripts) return;\n\tfor (const [name, policyOrArray] of Object.entries(scripts)) {\n\t\tconst policies = Array.isArray(policyOrArray) ? policyOrArray : [policyOrArray];\n\t\tfor (const policy of policies) {\n\t\t\tconst sev = policy.severity;\n\t\t\tif (sev !== void 0 && ![\n\t\t\t\t\"error\",\n\t\t\t\t\"off\",\n\t\t\t\t\"warn\"\n\t\t\t].includes(sev)) issues.push({\n\t\t\t\tmessage: `Script policy \"${name}\" has invalid severity \"${sev}\".`,\n\t\t\t\tseverity: \"error\"\n\t\t\t});\n\t\t}\n\t}\n}\n//#endregion\n//#region src/banner.ts\nconst colorFns = [\n\t(s) => styleText(\"cyan\", s),\n\t(s) => styleText(\"magenta\", s),\n\t(s) => styleText(\"green\", s),\n\t(s) => styleText(\"yellow\", s),\n\t(s) => styleText(\"blue\", s)\n];\nconst letterRows = [\n\t[\n\t\t\"███╗ ███╗\",\n\t\t\"████╗ ████║\",\n\t\t\"██╔████╔██║\",\n\t\t\"██║╚██╔╝██║\",\n\t\t\"██║ ╚═╝ ██║\",\n\t\t\"╚═╝ ╚═╝\"\n\t],\n\t[\n\t\t\" ██████╗ \",\n\t\t\"██╔═══██╗\",\n\t\t\"██║ ██║\",\n\t\t\"██║ ██║\",\n\t\t\"╚██████╔╝\",\n\t\t\" ╚═════╝ \"\n\t],\n\t[\n\t\t\"███╗ ██╗\",\n\t\t\"████╗ ██║\",\n\t\t\"██╔██╗ ██║\",\n\t\t\"██║╚██╗██║\",\n\t\t\"██║ ╚████║\",\n\t\t\"╚═╝ ╚═══╝\"\n\t],\n\t[\n\t\t\"██╗\",\n\t\t\"██║\",\n\t\t\"██║\",\n\t\t\"██║\",\n\t\t\"██║\",\n\t\t\"╚═╝\"\n\t],\n\t[\n\t\t\" ██████╗ \",\n\t\t\"██╔═══██╗\",\n\t\t\"██║ ██║\",\n\t\t\"██║ ██║\",\n\t\t\"╚██████╔╝\",\n\t\t\" ╚════╝╗ \"\n\t]\n];\nconst DESCRIPTION = \"Policy-driven workspace linter for JavaScript/TypeScript monorepos.\";\nfunction renderBanner() {\n\tconst lines = [];\n\tfor (let rowIndex = 0; rowIndex < 6; rowIndex++) lines.push(assembleRow(rowIndex));\n\tconst description = centerPad(DESCRIPTION, 62);\n\tconst versionLine = centerPad(`v${version}`, 62);\n\tlines.push(\"\", versionLine, description);\n\treturn lines.join(\"\\n\");\n}\nfunction assembleRow(rowIndex) {\n\tlet row = \" \".repeat(6);\n\tfor (let columnIndex = 0; columnIndex < 5; columnIndex++) {\n\t\trow += rowPart(columnIndex, rowIndex);\n\t\tif (columnIndex < 4) row += \" \";\n\t}\n\treturn row;\n}\nfunction centerPad(text, width) {\n\tconst pad = Math.max(0, Math.floor((width - text.length) / 2));\n\treturn \" \".repeat(pad) + text;\n}\nfunction rowPart(columnIndex, rowIndex) {\n\tconst rows = letterRows.at(columnIndex);\n\tconst colorFunction = colorFns.at(columnIndex);\n\tif (rows === void 0 || colorFunction === void 0) return \"\";\n\tconst line = rows.at(rowIndex);\n\treturn line === void 0 ? \"\" : colorFunction(line);\n}\n//#endregion\n//#region src/commands/init.ts\nconst SUPPORTED_LANGS = [\n\t\"ts\",\n\t\"js\",\n\t\"mjs\",\n\t\"cjs\",\n\t\"mts\",\n\t\"cts\"\n];\nasync function detectLang(cwd, packageJson) {\n\tconst rawDependencies = packageJson[\"dependencies\"];\n\tconst rawDevelopmentDependencies = packageJson[\"devDependencies\"];\n\tconst { access } = await import(\"node:fs/promises\");\n\ttry {\n\t\tawait access(path.join(cwd, \"tsconfig.json\"));\n\t\treturn \"ts\";\n\t} catch {}\n\tif (typeof rawDependencies === \"object\" && rawDependencies !== null && Object.hasOwn(rawDependencies, \"typescript\")) return \"ts\";\n\tif (typeof rawDevelopmentDependencies === \"object\" && rawDevelopmentDependencies !== null && Object.hasOwn(rawDevelopmentDependencies, \"typescript\")) return \"ts\";\n\treturn \"js\";\n}\nfunction generateConfig() {\n\treturn `import { defineConfig } from \"@udohjeremiah/moniq\";\n\nexport default defineConfig({\n scripts: {\n dev: { required: true },\n build: { required: true },\n lint: { required: true },\n },\n});\n`;\n}\nasync function init(options) {\n\tconst { _cwd, lang: explicitLang } = options;\n\tconst cwd = _cwd ?? process.cwd();\n\tconst rootPackageJson = await readRootPackageJson(cwd);\n\tif (rootPackageJson === void 0) return;\n\tconst lang = explicitLang ?? await detectLang(cwd, rootPackageJson);\n\tif (!SUPPORTED_LANGS.includes(lang)) {\n\t\tconst unsupportedMessage = `Unsupported --lang \"${lang}\". Supported: ${SUPPORTED_LANGS.join(\", \")}`;\n\t\tconsole.error(` ${styleText(\"yellow\", unsupportedMessage)}`);\n\t\tprocess.exitCode = 1;\n\t\treturn;\n\t}\n\tconst filename = `moniq.config.${lang}`;\n\tconst configPath = path.join(cwd, filename);\n\tconsole.log(renderBanner());\n\tconsole.log();\n\tlet packages = [];\n\tlet workspaceLabel = \"single package\";\n\ttry {\n\t\tpackages = discoverWorkspace(cwd);\n\t\tif (packages.length > 1) workspaceLabel = `monorepo with ${String(packages.length)} packages`;\n\t} catch {\n\t\tworkspaceLabel = \"unknown (workspace detection failed)\";\n\t}\n\tconst detectedLabel = `🔍 Detected: ${styleText(\"cyan\", workspaceLabel)}`;\n\tconsole.log(` ${styleText(\"dim\", detectedLabel)}`);\n\tif (packages.length > 1) for (const package_ of packages) {\n\t\tconst packageLine = ` • ${path.relative(cwd, package_.path)}`;\n\t\tconsole.log(` ${styleText(\"dim\", packageLine)}`);\n\t}\n\tconst langLine = `🔍 Language: ${styleText(\"cyan\", langLabel(lang))}`;\n\tconsole.log(` ${styleText(\"dim\", langLine)}`);\n\tconsole.log();\n\tif (!await handleExistingConfig(configPath, filename)) return;\n\tconst { writeFile } = await import(\"node:fs/promises\");\n\tawait writeFile(configPath, generateConfig(), \"utf8\");\n\tconst createdMessage = `✅ Created ${filename}`;\n\tconsole.log(` ${styleText([\"bold\", \"green\"], createdMessage)}`);\n\tconsole.log();\n\tawait doctor();\n\tconsole.log();\n\tconsole.log(` ${styleText(\"dim\", \"Next steps:\")}`);\n\tconsole.log(` 1. ${styleText(\"dim\", \"Edit\")} ${styleText(\"cyan\", \"moniq.config\")} ${styleText(\"dim\", \"to fine-tune your policies.\")}`);\n\tconsole.log(` 2. ${styleText(\"dim\", \"Run\")} ${styleText(\"cyan\", \"moniq check\")} ${styleText(\"dim\", \"to validate your workspace.\")}`);\n\tconsole.log(` 3. ${styleText(\"dim\", \"Run\")} ${styleText(\"cyan\", \"moniq fix\")} ${styleText(\"dim\", \"to apply automatic fixes.\")}`);\n\tconsole.log();\n}\nasync function handleExistingConfig(configPath, filename) {\n\tconst { access } = await import(\"node:fs/promises\");\n\ttry {\n\t\tawait access(configPath);\n\t} catch {\n\t\treturn true;\n\t}\n\tif (!stdin.isTTY) return true;\n\tconst rl = createInterface({\n\t\tinput: stdin,\n\t\toutput: process.stdout\n\t});\n\tconst message = `${filename} already exists. Overwrite?`;\n\tconst answer = await rl.question(` ${styleText(\"dim\", message + \" (y/N) \")}`);\n\trl.close();\n\tif (answer.trim().length === 0) return false;\n\treturn answer.toLowerCase() === \"y\" || answer.toLowerCase() === \"yes\";\n}\nfunction langLabel(lang) {\n\tswitch (lang) {\n\t\tcase \"cjs\": return \"JavaScript (CommonJS)\";\n\t\tcase \"cts\": return \"TypeScript (CommonJS)\";\n\t\tcase \"js\": return \"JavaScript\";\n\t\tcase \"mjs\": return \"JavaScript (ESM)\";\n\t\tcase \"mts\": return \"TypeScript (ESM)\";\n\t\tcase \"ts\": return \"TypeScript\";\n\t\tdefault: return lang;\n\t}\n}\nasync function readRootPackageJson(cwd) {\n\ttry {\n\t\treturn await readPackageJson(path.join(cwd, \"package.json\"));\n\t} catch {\n\t\tconsole.log();\n\t\tconsole.log(` ${styleText(\"yellow\", \"⚠ No package.json found in current directory.\")}`);\n\t\tconsole.log(` Create one first, then run ${styleText(\"cyan\", \"moniq init\")} again.`);\n\t\tconsole.log();\n\t\tprocess.exitCode = 1;\n\t\treturn;\n\t}\n}\n//#endregion\n//#region src/index.ts\nconst cli = cac(\"moniq\");\ncli.command(\"check\", \"Run policy checks\").option(\"--format <fmt>\", \"Output format: pretty or json\", { default: \"pretty\" }).action(async (options) => {\n\tconst fmt = typeof options[\"format\"] === \"string\" ? options[\"format\"] : \"pretty\";\n\ttry {\n\t\tawait check({\n\t\t\tfix: false,\n\t\t\tformat: fmt\n\t\t});\n\t} catch (error) {\n\t\tconsole.error(String(error));\n\t\tprocess.exitCode = 1;\n\t}\n});\ncli.command(\"fix\", \"Run policy checks and apply autofixes\").option(\"--dry-run\", \"Preview autofixes without writing to files\").option(\"--format <fmt>\", \"Output format: pretty or json\", { default: \"pretty\" }).action(async (options) => {\n\tconst isDryRun = options[\"dryRun\"] === true;\n\tconst fmt = typeof options[\"format\"] === \"string\" ? options[\"format\"] : \"pretty\";\n\ttry {\n\t\tawait check({\n\t\t\tfix: true,\n\t\t\tformat: fmt,\n\t\t\tisDryRun\n\t\t});\n\t} catch (error) {\n\t\tconsole.error(String(error));\n\t\tprocess.exitCode = 1;\n\t}\n});\ncli.command(\"doctor\", \"Detect configuration mistakes\").action(async () => {\n\tawait doctor();\n});\ncli.command(\"init\", \"Scaffold a moniq.config file in the current directory\").option(\"--lang <type>\", \"Config language: ts, js, mjs, cjs, mts, cts (default: auto-detected)\").action(async (options) => {\n\tawait init({ lang: typeof options[\"lang\"] === \"string\" ? options[\"lang\"] : void 0 });\n});\ncli.help();\ncli.version(version);\ncli.parse();\n//#endregion\nexport {};\n\n//# sourceMappingURL=index.js.map"],"x_google_ignoreList":[0,2],"mappings":";;;;;;;;;AACA,SAAS,MAAM,KAAK;CACnB,OAAO,OAAO,OAAO,CAAC,IAAI,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,GAAG;AAC1D;AACA,SAAS,MAAM,KAAK,KAAK,KAAK,MAAM;CACnC,IAAI,GAAG,MAAM,IAAI,MAAM,MAAM,CAAC,CAAC,CAAC,KAAK,OAAO,QAAQ,GAAG,IAAI,OAAO,QAAQ,QAAQ,OAAO,KAAK,OAAO,GAAG,IAAI,OAAO,QAAQ,YAAY,MAAM,CAAC,CAAC,CAAC,KAAK,QAAQ,QAAQ,GAAG,IAAI,QAAQ,UAAU,QAAQ,QAAQ,WAAW,IAAI,EAAE,MAAM,IAAI,CAAC,KAAK,IAAI,MAAM,KAAK,IAAI,GAAG,GAAG,CAAC,CAAC,QAAQ,IAAI,CAAC,KAAK,IAAI,MAAM,KAAK,IAAI;CAC/S,IAAI,OAAO,OAAO,OAAO,MAAM,MAAM,QAAQ,GAAG,IAAI,IAAI,OAAO,GAAG,IAAI,CAAC,KAAK,GAAG;AAChF;AACA,SAAS,YAAY,MAAM,MAAM;CAChC,OAAO,QAAQ,CAAC;CAChB,OAAO,QAAQ,CAAC;CAChB,IAAI,GAAG,K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AAQ,SAAS,mBAAmB,CAAC,CAAC,OAAO,kBAAkB,iCAAiC,EAAE,SAAS,SAAS,CAAC,CAAC,CAAC,OAAO,OAAO,YAAY;CACpJ,MAAM,MAAM,OAAO,QAAQ,cAAc,WAAW,QAAQ,YAAY;CACxE,IAAI;EACH,MAAM,MAAM;GACX,KAAK;GACL,QAAQ;EACT,CAAC;CACF,SAAS,OAAO;EACf,QAAQ,MAAM,OAAO,KAAK,CAAC;EAC3B,QAAQ,WAAW;CACpB;AACD,CAAC;AACD,IAAI,QAAQ,OAAO,uCAAuC,CAAC,CAAC,OAAO,aAAa,4CAA4C,CAAC,CAAC,OAAO,kBAAkB,iCAAiC,EAAE,SAAS,SAAS,CAAC,CAAC,CAAC,OAAO,OAAO,YAAY;CACxO,MAAM,WAAW,QAAQ,cAAc;CACvC,MAAM,MAAM,OAAO,QAAQ,cAAc,WAAW,QAAQ,YAAY;CACxE,IAAI;EACH,MAAM,MAAM;GACX,KAAK;GACL,QAAQ;GACR;EACD,CAAC;CACF,SAAS,OAAO;EACf,QAAQ,MAAM,OAAO,KAAK,CAAC;EAC3B,QAAQ,WAAW;CACpB;AACD,CAAC;AACD,IAAI,QAAQ,UAAU,+BAA+B,CAAC,CAAC,OAAO,YAAY;CACzE,MAAM,OAAO;AACd,CAAC;AACD,IAAI,QAAQ,QAAQ,uDAAuD,CAAC,CAAC,OAAO,iBAAiB,sEAAsE,CAAC,CAAC,OAAO,OAAO,YAAY;CACtM,MAAM,KAAK,EAAE,MAAM,OAAO,QAAQ,YAAY,WAAW,QAAQ,UAAU,KAAK,EAAE,CAAC;AACpF,CAAC;AACD,IAAI,KAAK;AACT,IAAI,QAAQ,OAAO;AACnB,IAAI,MAAM"}
|
|
1
|
+
{"version":3,"file":"cli.js","names":["wcmatch"],"sources":["../../../node_modules/.pnpm/cac@7.0.0/node_modules/cac/dist/index.js","../../workspace/dist/index.js","../../../node_modules/.pnpm/wildcard-match@5.1.4/node_modules/wildcard-match/build/index.es.mjs","../../core/dist/index.js","../../cli/dist/index.js"],"sourcesContent":["//#region node_modules/.pnpm/mri@1.2.0/node_modules/mri/lib/index.mjs\nfunction toArr(any) {\n\treturn any == null ? [] : Array.isArray(any) ? any : [any];\n}\nfunction toVal(out, key, val, opts) {\n\tvar x, old = out[key], nxt = !!~opts.string.indexOf(key) ? val == null || val === true ? \"\" : String(val) : typeof val === \"boolean\" ? val : !!~opts.boolean.indexOf(key) ? val === \"false\" ? false : val === \"true\" || (out._.push((x = +val, x * 0 === 0) ? x : val), !!val) : (x = +val, x * 0 === 0) ? x : val;\n\tout[key] = old == null ? nxt : Array.isArray(old) ? old.concat(nxt) : [old, nxt];\n}\nfunction lib_default(args, opts) {\n\targs = args || [];\n\topts = opts || {};\n\tvar k, arr, arg, name, val, out = { _: [] };\n\tvar i = 0, j = 0, idx = 0, len = args.length;\n\tconst alibi = opts.alias !== void 0;\n\tconst strict = opts.unknown !== void 0;\n\tconst defaults = opts.default !== void 0;\n\topts.alias = opts.alias || {};\n\topts.string = toArr(opts.string);\n\topts.boolean = toArr(opts.boolean);\n\tif (alibi) for (k in opts.alias) {\n\t\tarr = opts.alias[k] = toArr(opts.alias[k]);\n\t\tfor (i = 0; i < arr.length; i++) (opts.alias[arr[i]] = arr.concat(k)).splice(i, 1);\n\t}\n\tfor (i = opts.boolean.length; i-- > 0;) {\n\t\tarr = opts.alias[opts.boolean[i]] || [];\n\t\tfor (j = arr.length; j-- > 0;) opts.boolean.push(arr[j]);\n\t}\n\tfor (i = opts.string.length; i-- > 0;) {\n\t\tarr = opts.alias[opts.string[i]] || [];\n\t\tfor (j = arr.length; j-- > 0;) opts.string.push(arr[j]);\n\t}\n\tif (defaults) for (k in opts.default) {\n\t\tname = typeof opts.default[k];\n\t\tarr = opts.alias[k] = opts.alias[k] || [];\n\t\tif (opts[name] !== void 0) {\n\t\t\topts[name].push(k);\n\t\t\tfor (i = 0; i < arr.length; i++) opts[name].push(arr[i]);\n\t\t}\n\t}\n\tconst keys = strict ? Object.keys(opts.alias) : [];\n\tfor (i = 0; i < len; i++) {\n\t\targ = args[i];\n\t\tif (arg === \"--\") {\n\t\t\tout._ = out._.concat(args.slice(++i));\n\t\t\tbreak;\n\t\t}\n\t\tfor (j = 0; j < arg.length; j++) if (arg.charCodeAt(j) !== 45) break;\n\t\tif (j === 0) out._.push(arg);\n\t\telse if (arg.substring(j, j + 3) === \"no-\") {\n\t\t\tname = arg.substring(j + 3);\n\t\t\tif (strict && !~keys.indexOf(name)) return opts.unknown(arg);\n\t\t\tout[name] = false;\n\t\t} else {\n\t\t\tfor (idx = j + 1; idx < arg.length; idx++) if (arg.charCodeAt(idx) === 61) break;\n\t\t\tname = arg.substring(j, idx);\n\t\t\tval = arg.substring(++idx) || i + 1 === len || (\"\" + args[i + 1]).charCodeAt(0) === 45 || args[++i];\n\t\t\tarr = j === 2 ? [name] : name;\n\t\t\tfor (idx = 0; idx < arr.length; idx++) {\n\t\t\t\tname = arr[idx];\n\t\t\t\tif (strict && !~keys.indexOf(name)) return opts.unknown(\"-\".repeat(j) + name);\n\t\t\t\ttoVal(out, name, idx + 1 < arr.length || val, opts);\n\t\t\t}\n\t\t}\n\t}\n\tif (defaults) {\n\t\tfor (k in opts.default) if (out[k] === void 0) out[k] = opts.default[k];\n\t}\n\tif (alibi) for (k in out) {\n\t\tarr = opts.alias[k] || [];\n\t\twhile (arr.length > 0) out[arr.shift()] = out[k];\n\t}\n\treturn out;\n}\n\n//#endregion\n//#region src/utils.ts\nfunction removeBrackets(v) {\n\treturn v.replace(/[<[].+/, \"\").trim();\n}\nfunction findAllBrackets(v) {\n\tconst ANGLED_BRACKET_RE_GLOBAL = /<([^>]+)>/g;\n\tconst SQUARE_BRACKET_RE_GLOBAL = /\\[([^\\]]+)\\]/g;\n\tconst res = [];\n\tconst parse = (match) => {\n\t\tlet variadic = false;\n\t\tlet value = match[1];\n\t\tif (value.startsWith(\"...\")) {\n\t\t\tvalue = value.slice(3);\n\t\t\tvariadic = true;\n\t\t}\n\t\treturn {\n\t\t\trequired: match[0].startsWith(\"<\"),\n\t\t\tvalue,\n\t\t\tvariadic\n\t\t};\n\t};\n\tlet angledMatch;\n\twhile (angledMatch = ANGLED_BRACKET_RE_GLOBAL.exec(v)) res.push(parse(angledMatch));\n\tlet squareMatch;\n\twhile (squareMatch = SQUARE_BRACKET_RE_GLOBAL.exec(v)) res.push(parse(squareMatch));\n\treturn res;\n}\nfunction getMriOptions(options) {\n\tconst result = {\n\t\talias: {},\n\t\tboolean: []\n\t};\n\tfor (const [index, option] of options.entries()) {\n\t\tif (option.names.length > 1) result.alias[option.names[0]] = option.names.slice(1);\n\t\tif (option.isBoolean) if (option.negated) {\n\t\t\tif (!options.some((o, i) => {\n\t\t\t\treturn i !== index && o.names.some((name) => option.names.includes(name)) && typeof o.required === \"boolean\";\n\t\t\t})) result.boolean.push(option.names[0]);\n\t\t} else result.boolean.push(option.names[0]);\n\t}\n\treturn result;\n}\nfunction findLongest(arr) {\n\treturn arr.sort((a, b) => {\n\t\treturn a.length > b.length ? -1 : 1;\n\t})[0];\n}\nfunction padRight(str, length) {\n\treturn str.length >= length ? str : `${str}${\" \".repeat(length - str.length)}`;\n}\nfunction camelcase(input) {\n\treturn input.replaceAll(/([a-z])-([a-z])/g, (_, p1, p2) => {\n\t\treturn p1 + p2.toUpperCase();\n\t});\n}\nfunction setDotProp(obj, keys, val) {\n\tlet current = obj;\n\tfor (let i = 0; i < keys.length; i++) {\n\t\tconst key = keys[i];\n\t\tif (i === keys.length - 1) {\n\t\t\tcurrent[key] = val;\n\t\t\treturn;\n\t\t}\n\t\tif (current[key] == null) {\n\t\t\tconst nextKeyIsArrayIndex = +keys[i + 1] > -1;\n\t\t\tcurrent[key] = nextKeyIsArrayIndex ? [] : {};\n\t\t}\n\t\tcurrent = current[key];\n\t}\n}\nfunction setByType(obj, transforms) {\n\tfor (const key of Object.keys(transforms)) {\n\t\tconst transform = transforms[key];\n\t\tif (transform.shouldTransform) {\n\t\t\tobj[key] = [obj[key]].flat();\n\t\t\tif (typeof transform.transformFunction === \"function\") obj[key] = obj[key].map(transform.transformFunction);\n\t\t}\n\t}\n}\nfunction getFileName(input) {\n\tconst m = /([^\\\\/]+)$/.exec(input);\n\treturn m ? m[1] : \"\";\n}\nfunction camelcaseOptionName(name) {\n\treturn name.split(\".\").map((v, i) => {\n\t\treturn i === 0 ? camelcase(v) : v;\n\t}).join(\".\");\n}\nvar CACError = class extends Error {\n\tconstructor(message) {\n\t\tsuper(message);\n\t\tthis.name = \"CACError\";\n\t\tif (typeof Error.captureStackTrace !== \"function\") this.stack = new Error(message).stack;\n\t}\n};\n\n//#endregion\n//#region src/option.ts\nvar Option = class {\n\trawName;\n\tdescription;\n\t/** Option name */\n\tname;\n\t/** Option name and aliases */\n\tnames;\n\tisBoolean;\n\trequired;\n\tconfig;\n\tnegated;\n\tconstructor(rawName, description, config) {\n\t\tthis.rawName = rawName;\n\t\tthis.description = description;\n\t\tthis.config = Object.assign({}, config);\n\t\trawName = rawName.replaceAll(\".*\", \"\");\n\t\tthis.negated = false;\n\t\tthis.names = removeBrackets(rawName).split(\",\").map((v) => {\n\t\t\tlet name = v.trim().replace(/^-{1,2}/, \"\");\n\t\t\tif (name.startsWith(\"no-\")) {\n\t\t\t\tthis.negated = true;\n\t\t\t\tname = name.replace(/^no-/, \"\");\n\t\t\t}\n\t\t\treturn camelcaseOptionName(name);\n\t\t}).sort((a, b) => a.length > b.length ? 1 : -1);\n\t\tthis.name = this.names.at(-1);\n\t\tif (this.negated && this.config.default == null) this.config.default = true;\n\t\tif (rawName.includes(\"<\")) this.required = true;\n\t\telse if (rawName.includes(\"[\")) this.required = false;\n\t\telse this.isBoolean = true;\n\t}\n};\n\n//#endregion\n//#region src/runtime.ts\nlet runtimeProcessArgs;\nlet runtimeInfo;\nif (typeof process !== \"undefined\") {\n\tlet runtimeName;\n\tif (typeof Deno !== \"undefined\" && typeof Deno.version?.deno === \"string\") runtimeName = \"deno\";\n\telse if (typeof Bun !== \"undefined\" && typeof Bun.version === \"string\") runtimeName = \"bun\";\n\telse runtimeName = \"node\";\n\truntimeInfo = `${process.platform}-${process.arch} ${runtimeName}-${process.version}`;\n\truntimeProcessArgs = process.argv;\n} else if (typeof navigator === \"undefined\") runtimeInfo = `unknown`;\nelse runtimeInfo = `${navigator.platform} ${navigator.userAgent}`;\n\n//#endregion\n//#region src/command.ts\nvar Command = class {\n\trawName;\n\tdescription;\n\tconfig;\n\tcli;\n\toptions;\n\taliasNames;\n\tname;\n\targs;\n\tcommandAction;\n\tusageText;\n\tversionNumber;\n\texamples;\n\thelpCallback;\n\tglobalCommand;\n\tconstructor(rawName, description, config = {}, cli) {\n\t\tthis.rawName = rawName;\n\t\tthis.description = description;\n\t\tthis.config = config;\n\t\tthis.cli = cli;\n\t\tthis.options = [];\n\t\tthis.aliasNames = [];\n\t\tthis.name = removeBrackets(rawName);\n\t\tthis.args = findAllBrackets(rawName);\n\t\tthis.examples = [];\n\t}\n\tusage(text) {\n\t\tthis.usageText = text;\n\t\treturn this;\n\t}\n\tallowUnknownOptions() {\n\t\tthis.config.allowUnknownOptions = true;\n\t\treturn this;\n\t}\n\tignoreOptionDefaultValue() {\n\t\tthis.config.ignoreOptionDefaultValue = true;\n\t\treturn this;\n\t}\n\tversion(version, customFlags = \"-v, --version\") {\n\t\tthis.versionNumber = version;\n\t\tthis.option(customFlags, \"Display version number\");\n\t\treturn this;\n\t}\n\texample(example) {\n\t\tthis.examples.push(example);\n\t\treturn this;\n\t}\n\t/**\n\t* Add a option for this command\n\t* @param rawName Raw option name(s)\n\t* @param description Option description\n\t* @param config Option config\n\t*/\n\toption(rawName, description, config) {\n\t\tconst option = new Option(rawName, description, config);\n\t\tthis.options.push(option);\n\t\treturn this;\n\t}\n\talias(name) {\n\t\tthis.aliasNames.push(name);\n\t\treturn this;\n\t}\n\taction(callback) {\n\t\tthis.commandAction = callback;\n\t\treturn this;\n\t}\n\t/**\n\t* Check if a command name is matched by this command\n\t* @param name Command name\n\t*/\n\tisMatched(name) {\n\t\treturn this.name === name || this.aliasNames.includes(name);\n\t}\n\tget isDefaultCommand() {\n\t\treturn this.name === \"\" || this.aliasNames.includes(\"!\");\n\t}\n\tget isGlobalCommand() {\n\t\treturn this instanceof GlobalCommand;\n\t}\n\t/**\n\t* Check if an option is registered in this command\n\t* @param name Option name\n\t*/\n\thasOption(name) {\n\t\tname = name.split(\".\")[0];\n\t\treturn this.options.find((option) => {\n\t\t\treturn option.names.includes(name);\n\t\t});\n\t}\n\toutputHelp() {\n\t\tconst { name, commands } = this.cli;\n\t\tconst { versionNumber, options: globalOptions, helpCallback } = this.cli.globalCommand;\n\t\tlet sections = [{ body: `${name}${versionNumber ? `/${versionNumber}` : \"\"}` }];\n\t\tsections.push({\n\t\t\ttitle: \"Usage\",\n\t\t\tbody: ` $ ${name} ${this.usageText || this.rawName}`\n\t\t});\n\t\tif ((this.isGlobalCommand || this.isDefaultCommand) && commands.length > 0) {\n\t\t\tconst longestCommandName = findLongest(commands.map((command) => command.rawName));\n\t\t\tsections.push({\n\t\t\t\ttitle: \"Commands\",\n\t\t\t\tbody: commands.map((command) => {\n\t\t\t\t\treturn ` ${padRight(command.rawName, longestCommandName.length)} ${command.description}`;\n\t\t\t\t}).join(\"\\n\")\n\t\t\t}, {\n\t\t\t\ttitle: `For more info, run any command with the \\`--help\\` flag`,\n\t\t\t\tbody: commands.map((command) => ` $ ${name}${command.name === \"\" ? \"\" : ` ${command.name}`} --help`).join(\"\\n\")\n\t\t\t});\n\t\t}\n\t\tlet options = this.isGlobalCommand ? globalOptions : [...this.options, ...globalOptions || []];\n\t\tif (!this.isGlobalCommand && !this.isDefaultCommand) options = options.filter((option) => option.name !== \"version\");\n\t\tif (options.length > 0) {\n\t\t\tconst longestOptionName = findLongest(options.map((option) => option.rawName));\n\t\t\tsections.push({\n\t\t\t\ttitle: \"Options\",\n\t\t\t\tbody: options.map((option) => {\n\t\t\t\t\treturn ` ${padRight(option.rawName, longestOptionName.length)} ${option.description} ${option.config.default === void 0 ? \"\" : `(default: ${option.config.default})`}`;\n\t\t\t\t}).join(\"\\n\")\n\t\t\t});\n\t\t}\n\t\tif (this.examples.length > 0) sections.push({\n\t\t\ttitle: \"Examples\",\n\t\t\tbody: this.examples.map((example) => {\n\t\t\t\tif (typeof example === \"function\") return example(name);\n\t\t\t\treturn example;\n\t\t\t}).join(\"\\n\")\n\t\t});\n\t\tif (helpCallback) sections = helpCallback(sections) || sections;\n\t\tconsole.info(sections.map((section) => {\n\t\t\treturn section.title ? `${section.title}:\\n${section.body}` : section.body;\n\t\t}).join(\"\\n\\n\"));\n\t}\n\toutputVersion() {\n\t\tconst { name } = this.cli;\n\t\tconst { versionNumber } = this.cli.globalCommand;\n\t\tif (versionNumber) console.info(`${name}/${versionNumber} ${runtimeInfo}`);\n\t}\n\tcheckRequiredArgs() {\n\t\tconst minimalArgsCount = this.args.filter((arg) => arg.required).length;\n\t\tif (this.cli.args.length < minimalArgsCount) throw new CACError(`missing required args for command \\`${this.rawName}\\``);\n\t}\n\t/**\n\t* Check if the parsed options contain any unknown options\n\t*\n\t* Exit and output error when true\n\t*/\n\tcheckUnknownOptions() {\n\t\tconst { options, globalCommand } = this.cli;\n\t\tif (!this.config.allowUnknownOptions) {\n\t\t\tfor (const name of Object.keys(options)) if (name !== \"--\" && !this.hasOption(name) && !globalCommand.hasOption(name)) throw new CACError(`Unknown option \\`${name.length > 1 ? `--${name}` : `-${name}`}\\``);\n\t\t}\n\t}\n\t/**\n\t* Check if the required string-type options exist\n\t*/\n\tcheckOptionValue() {\n\t\tconst { options: parsedOptions, globalCommand } = this.cli;\n\t\tconst options = [...globalCommand.options, ...this.options];\n\t\tfor (const option of options) {\n\t\t\tconst value = parsedOptions[option.name.split(\".\")[0]];\n\t\t\tif (option.required) {\n\t\t\t\tconst hasNegated = options.some((o) => o.negated && o.names.includes(option.name));\n\t\t\t\tif (value === true || value === false && !hasNegated) throw new CACError(`option \\`${option.rawName}\\` value is missing`);\n\t\t\t}\n\t\t}\n\t}\n\t/**\n\t* Check if the number of args is more than expected\n\t*/\n\tcheckUnusedArgs() {\n\t\tconst maximumArgsCount = this.args.some((arg) => arg.variadic) ? Infinity : this.args.length;\n\t\tif (maximumArgsCount < this.cli.args.length) throw new CACError(`Unused args: ${this.cli.args.slice(maximumArgsCount).map((arg) => `\\`${arg}\\``).join(\", \")}`);\n\t}\n};\nvar GlobalCommand = class extends Command {\n\tconstructor(cli) {\n\t\tsuper(\"@@global@@\", \"\", {}, cli);\n\t}\n};\n\n//#endregion\n//#region src/cac.ts\nvar CAC = class extends EventTarget {\n\t/** The program name to display in help and version message */\n\tname;\n\tcommands;\n\tglobalCommand;\n\tmatchedCommand;\n\tmatchedCommandName;\n\t/**\n\t* Raw CLI arguments\n\t*/\n\trawArgs;\n\t/**\n\t* Parsed CLI arguments\n\t*/\n\targs;\n\t/**\n\t* Parsed CLI options, camelCased\n\t*/\n\toptions;\n\tshowHelpOnExit;\n\tshowVersionOnExit;\n\t/**\n\t* @param name The program name to display in help and version message\n\t*/\n\tconstructor(name = \"\") {\n\t\tsuper();\n\t\tthis.name = name;\n\t\tthis.commands = [];\n\t\tthis.rawArgs = [];\n\t\tthis.args = [];\n\t\tthis.options = {};\n\t\tthis.globalCommand = new GlobalCommand(this);\n\t\tthis.globalCommand.usage(\"<command> [options]\");\n\t}\n\t/**\n\t* Add a global usage text.\n\t*\n\t* This is not used by sub-commands.\n\t*/\n\tusage(text) {\n\t\tthis.globalCommand.usage(text);\n\t\treturn this;\n\t}\n\t/**\n\t* Add a sub-command\n\t*/\n\tcommand(rawName, description, config) {\n\t\tconst command = new Command(rawName, description || \"\", config, this);\n\t\tcommand.globalCommand = this.globalCommand;\n\t\tthis.commands.push(command);\n\t\treturn command;\n\t}\n\t/**\n\t* Add a global CLI option.\n\t*\n\t* Which is also applied to sub-commands.\n\t*/\n\toption(rawName, description, config) {\n\t\tthis.globalCommand.option(rawName, description, config);\n\t\treturn this;\n\t}\n\t/**\n\t* Show help message when `-h, --help` flags appear.\n\t*\n\t*/\n\thelp(callback) {\n\t\tthis.globalCommand.option(\"-h, --help\", \"Display this message\");\n\t\tthis.globalCommand.helpCallback = callback;\n\t\tthis.showHelpOnExit = true;\n\t\treturn this;\n\t}\n\t/**\n\t* Show version number when `-v, --version` flags appear.\n\t*\n\t*/\n\tversion(version, customFlags = \"-v, --version\") {\n\t\tthis.globalCommand.version(version, customFlags);\n\t\tthis.showVersionOnExit = true;\n\t\treturn this;\n\t}\n\t/**\n\t* Add a global example.\n\t*\n\t* This example added here will not be used by sub-commands.\n\t*/\n\texample(example) {\n\t\tthis.globalCommand.example(example);\n\t\treturn this;\n\t}\n\t/**\n\t* Output the corresponding help message\n\t* When a sub-command is matched, output the help message for the command\n\t* Otherwise output the global one.\n\t*\n\t*/\n\toutputHelp() {\n\t\tif (this.matchedCommand) this.matchedCommand.outputHelp();\n\t\telse this.globalCommand.outputHelp();\n\t}\n\t/**\n\t* Output the version number.\n\t*\n\t*/\n\toutputVersion() {\n\t\tthis.globalCommand.outputVersion();\n\t}\n\tsetParsedInfo({ args, options }, matchedCommand, matchedCommandName) {\n\t\tthis.args = args;\n\t\tthis.options = options;\n\t\tif (matchedCommand) this.matchedCommand = matchedCommand;\n\t\tif (matchedCommandName) this.matchedCommandName = matchedCommandName;\n\t\treturn this;\n\t}\n\tunsetMatchedCommand() {\n\t\tthis.matchedCommand = void 0;\n\t\tthis.matchedCommandName = void 0;\n\t}\n\t/**\n\t* Parse argv\n\t*/\n\tparse(argv, { run = true } = {}) {\n\t\tif (!argv) {\n\t\t\tif (!runtimeProcessArgs) throw new Error(\"No argv provided and runtime process argv is not available.\");\n\t\t\targv = runtimeProcessArgs;\n\t\t}\n\t\tthis.rawArgs = argv;\n\t\tif (!this.name) this.name = argv[1] ? getFileName(argv[1]) : \"cli\";\n\t\tlet shouldParse = true;\n\t\tfor (const command of this.commands) {\n\t\t\tconst parsed = this.mri(argv.slice(2), command);\n\t\t\tconst commandName = parsed.args[0];\n\t\t\tif (command.isMatched(commandName)) {\n\t\t\t\tshouldParse = false;\n\t\t\t\tconst parsedInfo = {\n\t\t\t\t\t...parsed,\n\t\t\t\t\targs: parsed.args.slice(1)\n\t\t\t\t};\n\t\t\t\tthis.setParsedInfo(parsedInfo, command, commandName);\n\t\t\t\tthis.dispatchEvent(new CustomEvent(`command:${commandName}`, { detail: command }));\n\t\t\t}\n\t\t}\n\t\tif (shouldParse) {\n\t\t\tfor (const command of this.commands) if (command.isDefaultCommand) {\n\t\t\t\tshouldParse = false;\n\t\t\t\tconst parsed = this.mri(argv.slice(2), command);\n\t\t\t\tthis.setParsedInfo(parsed, command);\n\t\t\t\tthis.dispatchEvent(new CustomEvent(\"command:!\", { detail: command }));\n\t\t\t}\n\t\t}\n\t\tif (shouldParse) {\n\t\t\tconst parsed = this.mri(argv.slice(2));\n\t\t\tthis.setParsedInfo(parsed);\n\t\t}\n\t\tif (this.options.help && this.showHelpOnExit) {\n\t\t\tthis.outputHelp();\n\t\t\trun = false;\n\t\t\tthis.unsetMatchedCommand();\n\t\t}\n\t\tif (this.options.version && this.showVersionOnExit && this.matchedCommandName == null) {\n\t\t\tthis.outputVersion();\n\t\t\trun = false;\n\t\t\tthis.unsetMatchedCommand();\n\t\t}\n\t\tconst parsedArgv = {\n\t\t\targs: this.args,\n\t\t\toptions: this.options\n\t\t};\n\t\tif (run) this.runMatchedCommand();\n\t\tif (!this.matchedCommand && this.args[0]) this.dispatchEvent(new CustomEvent(\"command:*\", { detail: this.args[0] }));\n\t\treturn parsedArgv;\n\t}\n\tmri(argv, command) {\n\t\tconst cliOptions = [...this.globalCommand.options, ...command ? command.options : []];\n\t\tconst mriOptions = getMriOptions(cliOptions);\n\t\tlet argsAfterDoubleDashes = [];\n\t\tconst doubleDashesIndex = argv.indexOf(\"--\");\n\t\tif (doubleDashesIndex !== -1) {\n\t\t\targsAfterDoubleDashes = argv.slice(doubleDashesIndex + 1);\n\t\t\targv = argv.slice(0, doubleDashesIndex);\n\t\t}\n\t\tlet parsed = lib_default(argv, mriOptions);\n\t\tparsed = Object.keys(parsed).reduce((res, name) => {\n\t\t\treturn {\n\t\t\t\t...res,\n\t\t\t\t[camelcaseOptionName(name)]: parsed[name]\n\t\t\t};\n\t\t}, { _: [] });\n\t\tconst args = parsed._;\n\t\tconst options = { \"--\": argsAfterDoubleDashes };\n\t\tconst ignoreDefault = command && command.config.ignoreOptionDefaultValue ? command.config.ignoreOptionDefaultValue : this.globalCommand.config.ignoreOptionDefaultValue;\n\t\tconst transforms = Object.create(null);\n\t\tfor (const cliOption of cliOptions) {\n\t\t\tif (!ignoreDefault && cliOption.config.default !== void 0) for (const name of cliOption.names) options[name] = cliOption.config.default;\n\t\t\tif (Array.isArray(cliOption.config.type) && transforms[cliOption.name] === void 0) {\n\t\t\t\ttransforms[cliOption.name] = Object.create(null);\n\t\t\t\ttransforms[cliOption.name].shouldTransform = true;\n\t\t\t\ttransforms[cliOption.name].transformFunction = cliOption.config.type[0];\n\t\t\t}\n\t\t}\n\t\tfor (const key of Object.keys(parsed)) if (key !== \"_\") {\n\t\t\tsetDotProp(options, key.split(\".\"), parsed[key]);\n\t\t\tsetByType(options, transforms);\n\t\t}\n\t\treturn {\n\t\t\targs,\n\t\t\toptions\n\t\t};\n\t}\n\trunMatchedCommand() {\n\t\tconst { args, options, matchedCommand: command } = this;\n\t\tif (!command || !command.commandAction) return;\n\t\tcommand.checkUnknownOptions();\n\t\tcommand.checkOptionValue();\n\t\tcommand.checkRequiredArgs();\n\t\tcommand.checkUnusedArgs();\n\t\tconst actionArgs = [];\n\t\tcommand.args.forEach((arg, index) => {\n\t\t\tif (arg.variadic) actionArgs.push(args.slice(index));\n\t\t\telse actionArgs.push(args[index]);\n\t\t});\n\t\tactionArgs.push(options);\n\t\treturn command.commandAction.apply(this, actionArgs);\n\t}\n};\n\n//#endregion\n//#region src/index.ts\n/**\n* @param name The program name to display in help and version message\n*/\nconst cac = (name = \"\") => new CAC(name);\n\n//#endregion\nexport { CAC, Command, cac, cac as default };","import { execFileSync } from \"node:child_process\";\nimport path from \"node:path\";\n//#region src/package-json.ts\nasync function readPackageJson(path) {\n\tconst { readFile } = await import(\"node:fs/promises\");\n\tconst content = await readFile(path, \"utf8\");\n\treturn JSON.parse(content);\n}\nasync function writePackageJson(filePath, data) {\n\tconst { writeFile } = await import(\"node:fs/promises\");\n\tawait writeFile(filePath, `${JSON.stringify(data, void 0, 2)}\\n`, \"utf8\");\n}\n//#endregion\n//#region src/scripts.ts\nfunction getScript(packageJson, name) {\n\tconst scripts = packageJson[\"scripts\"];\n\tif (typeof scripts !== \"object\" || scripts === null) return;\n\tconst value = Object.entries(scripts).find(([k]) => k === name)?.[1];\n\treturn typeof value === \"string\" ? value : void 0;\n}\nfunction setScript(packageJson, name, command) {\n\tlet scripts = packageJson[\"scripts\"];\n\tif (typeof scripts !== \"object\" || scripts === null) {\n\t\tscripts = {};\n\t\tpackageJson[\"scripts\"] = scripts;\n\t}\n\tObject.assign(scripts, { [name]: command });\n}\n//#endregion\n//#region src/workspace.ts\nasync function detectPackageManager(root) {\n\tfor (const [lockFile, pm] of Object.entries({\n\t\t\"bun.lock\": \"bun\",\n\t\t\"bun.lockb\": \"bun\",\n\t\t\"package-lock.json\": \"npm\",\n\t\t\"pnpm-lock.yaml\": \"pnpm\",\n\t\t\"yarn.lock\": \"yarn\"\n\t})) try {\n\t\tconst { access } = await import(\"node:fs/promises\");\n\t\tawait access(path.join(root, lockFile));\n\t\treturn pm;\n\t} catch {}\n\ttry {\n\t\tconst rawPm = (await readPackageJson(path.join(root, \"package.json\")))[\"packageManager\"];\n\t\tconst pm = typeof rawPm === \"string\" ? rawPm.split(\"@\", 2)[0] ?? \"\" : \"\";\n\t\tif ([\n\t\t\t\"bun\",\n\t\t\t\"npm\",\n\t\t\t\"pnpm\",\n\t\t\t\"yarn\"\n\t\t].includes(pm)) return pm;\n\t} catch {}\n\tconst userAgent = process.env[\"npm_config_user_agent\"] ?? \"\";\n\tif (userAgent.startsWith(\"bun\")) return \"bun\";\n\tif (userAgent.startsWith(\"pnpm\")) return \"pnpm\";\n\tif (userAgent.startsWith(\"yarn\")) return \"yarn\";\n\tif (userAgent.startsWith(\"npm\")) return \"npm\";\n\treturn \"pnpm\";\n}\nasync function discoverWorkspace(root) {\n\tconst pm = await detectPackageManager(root);\n\tlet output;\n\tswitch (pm) {\n\t\tcase \"bun\": return resolveBunWorkspaces(root);\n\t\tcase \"npm\": {\n\t\t\toutput = execFileSync(pmBin(\"npm\"), [\n\t\t\t\t\"ls\",\n\t\t\t\t\"--workspaces\",\n\t\t\t\t\"--all\",\n\t\t\t\t\"--json\",\n\t\t\t\t\"--depth\",\n\t\t\t\t\"0\"\n\t\t\t], {\n\t\t\t\tcwd: root,\n\t\t\t\tencoding: \"utf8\"\n\t\t\t});\n\t\t\tconst tree = JSON.parse(output);\n\t\t\treturn Object.values(tree.dependencies ?? {}).map((entry) => ({ path: entry.path }));\n\t\t}\n\t\tcase \"pnpm\":\n\t\t\toutput = execFileSync(pmBin(\"pnpm\"), [\n\t\t\t\t\"ls\",\n\t\t\t\t\"-r\",\n\t\t\t\t\"--depth\",\n\t\t\t\t\"-1\",\n\t\t\t\t\"--json\"\n\t\t\t], {\n\t\t\t\tcwd: root,\n\t\t\t\tencoding: \"utf8\"\n\t\t\t});\n\t\t\treturn JSON.parse(output).map((entry) => ({ path: entry.path }));\n\t\tcase \"yarn\":\n\t\t\toutput = execFileSync(pmBin(\"yarn\"), [\n\t\t\t\t\"workspaces\",\n\t\t\t\t\"list\",\n\t\t\t\t\"--json\"\n\t\t\t], {\n\t\t\t\tcwd: root,\n\t\t\t\tencoding: \"utf8\"\n\t\t\t});\n\t\t\treturn output.trim().split(\"\\n\").filter(Boolean).map((line) => JSON.parse(line)).map((entry) => ({ path: path.resolve(root, entry.location) }));\n\t}\n}\nfunction getWorkspacePatterns(packageJson) {\n\tconst raw = packageJson[\"workspaces\"];\n\tif (Array.isArray(raw)) return raw;\n\tif (typeof raw === \"object\" && raw !== null && \"packages\" in raw && Array.isArray(raw.packages)) return raw.packages;\n\treturn [];\n}\nfunction pmBin(pm) {\n\treturn pm;\n}\nasync function resolveBunWorkspaces(root) {\n\tconst patterns = getWorkspacePatterns(await readPackageJson(path.join(root, \"package.json\")));\n\tconst { glob } = await import(\"node:fs/promises\");\n\tconst packagePaths = [];\n\tfor (const pattern of patterns) {\n\t\tconst iterable = glob(pattern, { cwd: root });\n\t\tfor await (const entry of iterable) {\n\t\t\tconst absolute = path.resolve(root, entry);\n\t\t\tif (!packagePaths.includes(absolute)) packagePaths.push(absolute);\n\t\t}\n\t}\n\treturn packagePaths.map((p) => ({ path: p }));\n}\n//#endregion\nexport { detectPackageManager, discoverWorkspace, getScript, readPackageJson, setScript, writePackageJson };\n\n//# sourceMappingURL=index.js.map","/**\n * Escapes a character if it has a special meaning in regular expressions\n * and returns the character as is if it doesn't\n */\nfunction escapeRegExpChar(char) {\n if (char === '-' ||\n char === '^' ||\n char === '$' ||\n char === '+' ||\n char === '.' ||\n char === '(' ||\n char === ')' ||\n char === '|' ||\n char === '[' ||\n char === ']' ||\n char === '{' ||\n char === '}' ||\n char === '*' ||\n char === '?' ||\n char === '\\\\') {\n return \"\\\\\".concat(char);\n }\n else {\n return char;\n }\n}\n/**\n * Escapes all characters in a given string that have a special meaning in regular expressions\n */\nfunction escapeRegExpString(str) {\n var result = '';\n for (var i = 0; i < str.length; i++) {\n result += escapeRegExpChar(str[i]);\n }\n return result;\n}\n/**\n * Transforms one or more glob patterns into a RegExp pattern\n */\nfunction transform(pattern, separator) {\n if (separator === void 0) { separator = true; }\n if (Array.isArray(pattern)) {\n var regExpPatterns = pattern.map(function (p) { return \"^\".concat(transform(p, separator), \"$\"); });\n return \"(?:\".concat(regExpPatterns.join('|'), \")\");\n }\n var separatorSplitter = '';\n var separatorMatcher = '';\n var wildcard = '.';\n if (separator === true) {\n separatorSplitter = '/';\n separatorMatcher = '[/\\\\\\\\]';\n wildcard = '[^/\\\\\\\\]';\n }\n else if (separator) {\n separatorSplitter = separator;\n separatorMatcher = escapeRegExpString(separatorSplitter);\n if (separatorMatcher.length > 1) {\n separatorMatcher = \"(?:\".concat(separatorMatcher, \")\");\n wildcard = \"((?!\".concat(separatorMatcher, \").)\");\n }\n else {\n wildcard = \"[^\".concat(separatorMatcher, \"]\");\n }\n }\n var requiredSeparator = separator ? \"\".concat(separatorMatcher, \"+?\") : '';\n var optionalSeparator = separator ? \"\".concat(separatorMatcher, \"*?\") : '';\n var segments = separator ? pattern.split(separatorSplitter) : [pattern];\n var result = '';\n for (var s = 0; s < segments.length; s++) {\n var segment = segments[s];\n var nextSegment = segments[s + 1];\n var currentSeparator = '';\n if (!segment && s > 0) {\n continue;\n }\n if (separator) {\n if (s === segments.length - 1) {\n currentSeparator = optionalSeparator;\n }\n else if (nextSegment !== '**') {\n currentSeparator = requiredSeparator;\n }\n else {\n currentSeparator = '';\n }\n }\n if (separator && segment === '**') {\n if (currentSeparator) {\n result +=\n s === 0\n ? ''\n : s === segments.length - 1\n ? \"(?:\".concat(requiredSeparator, \"|$)\")\n : requiredSeparator;\n result += \"(?:\".concat(wildcard, \"*?\").concat(currentSeparator, \")*?\");\n }\n continue;\n }\n for (var c = 0; c < segment.length; c++) {\n var char = segment[c];\n if (char === '\\\\') {\n if (c < segment.length - 1) {\n result += escapeRegExpChar(segment[c + 1]);\n c++;\n }\n }\n else if (char === '?') {\n result += wildcard;\n }\n else if (char === '*') {\n result += \"\".concat(wildcard, \"*?\");\n }\n else {\n result += escapeRegExpChar(char);\n }\n }\n result += currentSeparator;\n }\n return result;\n}\n\nfunction isMatch(regexp, sample) {\n if (typeof sample !== 'string') {\n throw new TypeError(\"Sample must be a string, but \".concat(typeof sample, \" given\"));\n }\n return regexp.test(sample);\n}\n/**\n * Compiles one or more glob patterns into a RegExp and returns an isMatch function.\n * The isMatch function takes a sample string as its only argument and returns `true`\n * if the string matches the pattern(s).\n *\n * ```js\n * wildcardMatch('src/*.js')('src/index.js') //=> true\n * ```\n *\n * ```js\n * const isMatch = wildcardMatch('*.example.com', '.')\n * isMatch('foo.example.com') //=> true\n * isMatch('foo.bar.com') //=> false\n * ```\n */\nfunction wildcardMatch(pattern, options) {\n if (typeof pattern !== 'string' && !Array.isArray(pattern)) {\n throw new TypeError(\"The first argument must be a single pattern string or an array of patterns, but \".concat(typeof pattern, \" given\"));\n }\n if (typeof options === 'string' || typeof options === 'boolean') {\n options = { separator: options };\n }\n if (arguments.length === 2 &&\n !(typeof options === 'undefined' ||\n (typeof options === 'object' && options !== null && !Array.isArray(options)))) {\n throw new TypeError(\"The second argument must be an options object or a string/boolean separator, but \".concat(typeof options, \" given\"));\n }\n options = options || {};\n if (options.separator === '\\\\') {\n throw new Error('\\\\ is not a valid separator because it is used for escaping. Try setting the separator to `true` instead');\n }\n var regexpPattern = transform(pattern, options.separator);\n var regexp = new RegExp(\"^\".concat(regexpPattern, \"$\"), options.flags);\n var fn = isMatch.bind(null, regexp);\n fn.options = options;\n fn.pattern = pattern;\n fn.regexp = regexp;\n return fn;\n}\n\nexport { wildcardMatch as default };\n//# sourceMappingURL=index.es.mjs.map\n","import { getScript, readPackageJson } from \"@moniq/workspace\";\nimport path from \"node:path\";\nimport wcmatch from \"wildcard-match\";\n//#region src/scripts.ts\nasync function resolveScriptPolicies(scriptsConfig, root, packages_) {\n\tconst diagnostics = [];\n\tconst entries = Object.entries(scriptsConfig ?? {});\n\tfor (const [scriptName, policyOrArray] of entries) {\n\t\tconst policies = Array.isArray(policyOrArray) ? policyOrArray : [policyOrArray];\n\t\tfor (const package_ of packages_) {\n\t\t\tconst relativePath = path.relative(root, package_.path);\n\t\t\tconst policy = pickPolicy(policies, relativePath);\n\t\t\tif (policy !== void 0 && policy.severity !== \"off\") await resolvePolicy(policy, scriptName, package_, relativePath, diagnostics);\n\t\t}\n\t}\n\treturn diagnostics;\n}\nfunction isCommandMatch(actual, expected) {\n\tif (typeof expected === \"function\") return expected(actual);\n\tif (expected instanceof RegExp) return expected.test(actual);\n\treturn actual === expected;\n}\nfunction isGlobMatch(pattern, relativePath) {\n\tif (pattern === \"*\") return true;\n\tif (pattern === \".\") return relativePath === \".\" || relativePath === \"\";\n\treturn wcmatch(pattern)(relativePath);\n}\nfunction isMatchAny(patterns, relativePath) {\n\tfor (const pattern of patterns) if (isGlobMatch(pattern, relativePath)) return true;\n\treturn false;\n}\nfunction isPolicyMatch(policy, relativePath) {\n\tconst include = policy.include ?? [\"*\"];\n\tconst exclude = policy.exclude ?? [];\n\treturn isMatchAny(include, relativePath) && !isMatchAny(exclude, relativePath);\n}\nfunction pickPolicy(policies, relativePath) {\n\tfor (const policy of policies) if (isPolicyMatch(policy, relativePath)) return policy;\n}\nasync function resolvePolicy(policy, scriptName, package_, relativePath, diagnostics) {\n\tconst packageJson = await readPackageJson(path.join(package_.path, \"package.json\"));\n\tconst packageDisplayName = packageJson[\"name\"] ?? path.basename(package_.path);\n\tconst hasScript = getScript(packageJson, scriptName) !== void 0;\n\tconst severity = policy.severity ?? \"error\";\n\tif (policy.required !== false && !hasScript) {\n\t\tdiagnostics.push({\n\t\t\tfix: policy.autofix && typeof policy.command === \"string\" ? policy.command : void 0,\n\t\t\tmessage: `Missing required script \"${scriptName}\"`,\n\t\t\tpackageName: packageDisplayName,\n\t\t\tpackagePath: package_.path,\n\t\t\tscriptName,\n\t\t\tseverity\n\t\t});\n\t\treturn;\n\t}\n\tif (policy.command === void 0 || !hasScript) return;\n\tif (policy.allowCustomCommands !== void 0 && isMatchAny(policy.allowCustomCommands, relativePath)) return;\n\tconst actualCommand = getScript(packageJson, scriptName);\n\tif (actualCommand !== void 0 && isCommandMatch(actualCommand, policy.command)) return;\n\tdiagnostics.push({\n\t\tactual: actualCommand,\n\t\texpected: typeof policy.command === \"string\" ? policy.command : void 0,\n\t\tfix: policy.autofix && typeof policy.command === \"string\" ? policy.command : void 0,\n\t\tmessage: `Unexpected command for script \"${scriptName}\"`,\n\t\tpackageName: packageDisplayName,\n\t\tpackagePath: package_.path,\n\t\tscriptName,\n\t\tseverity\n\t});\n}\n//#endregion\n//#region src/index.ts\nasync function resolve(config, root, packages_) {\n\tconst diagnostics = [];\n\tconst scriptDiags = await resolveScriptPolicies(config.scripts, root, packages_);\n\tdiagnostics.push(...scriptDiags);\n\treturn diagnostics;\n}\n//#endregion\nexport { resolve };\n\n//# sourceMappingURL=index.js.map","import { cac } from \"cac\";\nimport { loadConfig } from \"@moniq/config\";\nimport { resolve } from \"@moniq/core\";\nimport { detectPackageManager, discoverWorkspace, readPackageJson } from \"@moniq/workspace\";\nimport { styleText } from \"node:util\";\nimport path from \"node:path\";\nimport { execFile } from \"node:child_process\";\nimport { stdin } from \"node:process\";\nimport { createInterface } from \"node:readline/promises\";\n//#region ../moniq/package.json\nvar version = \"0.3.0\";\n//#endregion\n//#region src/format.ts\nfunction formatDiagnostics(diagnostics, options) {\n\tif ((options?.format ?? \"pretty\") === \"json\") return formatJson(diagnostics);\n\treturn formatPretty(diagnostics, options?.isDryRun);\n}\nfunction formatJson(diagnostics) {\n\treturn `${JSON.stringify(diagnostics, void 0, 2)}\\n`;\n}\nfunction formatPretty(diagnostics, isDryRun) {\n\tif (diagnostics.length === 0) return styleText([\"bold\", \"green\"], \"✅ No issues found.\");\n\tconst lines = [];\n\tconst byPackage = /* @__PURE__ */ new Map();\n\tfor (const d of diagnostics) {\n\t\tconst array = byPackage.get(d.packageName);\n\t\tif (array) array.push(d);\n\t\telse byPackage.set(d.packageName, [d]);\n\t}\n\tfor (const [packageName, diags] of byPackage) {\n\t\tlines.push(\"\", `📦 ${styleText([\"bold\", \"cyan\"], packageName)}`);\n\t\tfor (const d of diags) pushDiagnostic(lines, d, isDryRun);\n\t}\n\tconst errorCount = diagnostics.filter((d) => d.severity === \"error\").length;\n\tconst warningCount = diagnostics.filter((d) => d.severity === \"warn\").length;\n\tconst countParts = [];\n\tif (errorCount > 0) countParts.push(styleText(\"red\", `${String(errorCount)} error(s)`));\n\tif (warningCount > 0) countParts.push(styleText(\"yellow\", `${String(warningCount)} warning(s)`));\n\tconst summary = countParts.join(\", \");\n\tconst summaryLine = `📋 Found ${String(diagnostics.length)} issue(s) — ${summary.length > 0 ? summary : \"all clear\"}`;\n\tlines.push(\"\", styleText(\"dim\", summaryLine));\n\tif (isDryRun) {\n\t\tconst fixableCount = diagnostics.filter((d) => d.fix && d.severity !== \"off\").length;\n\t\tlines.push(\"\", styleText(\"dim\", `🔮 Dry-run: ${String(fixableCount)} fix(es) available`));\n\t}\n\treturn lines.join(\"\\n\");\n}\nfunction pushDiagnostic(lines, d, isDryRun) {\n\tconst badge = severityBadge(d.severity);\n\tconst emoji = severityEmoji(d.severity);\n\tlines.push(` ${emoji} ${badge} ${d.message}`);\n\tif (d.expected && d.actual) lines.push(` ${styleText(\"dim\", \"Expected:\")} ${styleText(\"cyan\", d.expected)}`, ` ${styleText(\"dim\", \"Actual:\")} ${styleText(\"red\", d.actual)}`);\n\telse if (d.expected) lines.push(` ${styleText(\"dim\", \"Expected:\")} ${styleText(\"cyan\", d.expected)}`);\n\telse if (d.actual) lines.push(` ${styleText(\"dim\", \"Actual:\")} ${styleText(\"red\", d.actual)}`);\n\tif (d.fix) {\n\t\tconst label = styleText(\"dim\", isDryRun ? \"Would fix:\" : \"Fix:\");\n\t\tconst icon = isDryRun ? \"🔮\" : \"🔧\";\n\t\tlines.push(` ${icon} ${label} ${d.fix}`);\n\t}\n}\nfunction severityBadge(severity) {\n\tif (severity === \"error\") return styleText([\"bold\", \"red\"], \"ERROR\");\n\tif (severity === \"warn\") return styleText([\"bold\", \"yellow\"], \"WARN\");\n\treturn styleText(\"gray\", \"OFF\");\n}\nfunction severityEmoji(severity) {\n\tif (severity === \"error\") return \"❌\";\n\tif (severity === \"warn\") return \"⚠️ \";\n\treturn \"⚪\";\n}\n//#endregion\n//#region src/scripts.ts\nasync function applyScriptFixes(diagnostics, options) {\n\tconst fixable = diagnostics.filter((d) => d.fix && d.severity !== \"off\");\n\tconst isDryRun = options?.isDryRun ?? false;\n\tlet fixed = 0;\n\tlet errors = 0;\n\tconst packages = /* @__PURE__ */ new Set();\n\tfor (const d of fixable) {\n\t\tif (!d.fix) continue;\n\t\tif (isDryRun) {\n\t\t\tfixed++;\n\t\t\tpackages.add(d.packagePath);\n\t\t\tcontinue;\n\t\t}\n\t\ttry {\n\t\t\tconst packageFilePath = path.join(d.packagePath, \"package.json\");\n\t\t\tconst { readFile, writeFile } = await import(\"node:fs/promises\");\n\t\t\tconst content = await readFile(packageFilePath, \"utf8\");\n\t\t\tconst package_ = JSON.parse(content);\n\t\t\tconst scriptName = d.scriptName;\n\t\t\tif (!scriptName) continue;\n\t\t\tconst scriptsRecord = package_[\"scripts\"];\n\t\t\tif (scriptsRecord) {\n\t\t\t\tconst entries = Object.entries(scriptsRecord);\n\t\t\t\tif (!Object.hasOwn(scriptsRecord, scriptName)) entries.push([scriptName, d.fix]);\n\t\t\t\tpackage_[\"scripts\"] = Object.fromEntries(entries.map(([name, command]) => {\n\t\t\t\t\treturn name === scriptName ? [name, d.fix ?? command] : [name, command];\n\t\t\t\t}));\n\t\t\t}\n\t\t\tawait writeFile(packageFilePath, `${JSON.stringify(package_, void 0, 2)}\\n`, \"utf8\");\n\t\t\tfixed++;\n\t\t\tpackages.add(d.packagePath);\n\t\t} catch {\n\t\t\terrors++;\n\t\t}\n\t}\n\treturn {\n\t\terrors,\n\t\tfixed,\n\t\tisDryRun,\n\t\tpackageCount: packages.size\n\t};\n}\n//#endregion\n//#region src/commands/check.ts\nasync function check(options) {\n\tconst cwd = process.cwd();\n\tlet config;\n\ttry {\n\t\tconfig = await loadConfig(cwd);\n\t} catch {\n\t\tthrow new Error(\"No moniq.config file found in or above the current directory.\");\n\t}\n\tconst packages = await discoverWorkspace(cwd);\n\tif (packages.length === 0) throw new Error(\"No workspace packages found.\");\n\tconst diagnostics = await resolve(config, cwd, packages);\n\tlet fixSummary;\n\tif (options.fix) fixSummary = await applyScriptFixes(diagnostics, { isDryRun: options.isDryRun });\n\tif (options.format !== \"json\") {\n\t\tconsole.log(` 🔍 Scanned ${String(packages.length)} package(s)`);\n\t\tconsole.log();\n\t}\n\tconsole.log(formatDiagnostics(diagnostics, {\n\t\tformat: options.format,\n\t\tisDryRun: options.isDryRun\n\t}));\n\tif (fixSummary) if (fixSummary.isDryRun) {\n\t\tconst message = `🔮 Dry-run: ${String(fixSummary.fixed)} fix(es) available, ${String(fixSummary.errors)} error(s)`;\n\t\tconsole.log(styleText(\"dim\", message));\n\t} else {\n\t\tconst message = `✅ Fixed ${String(fixSummary.fixed)} issue(s) across ${String(fixSummary.packageCount)} package(s)`;\n\t\tconsole.log(styleText([\"bold\", \"green\"], message));\n\t}\n}\n//#endregion\n//#region src/commands/doctor.ts\nasync function doctor() {\n\tconst cwd = process.cwd();\n\tconst issues = [];\n\ttry {\n\t\tconst config = await loadConfig(cwd);\n\t\tissues.push({\n\t\t\tmessage: \"moniq.config file found and loadable.\",\n\t\t\tseverity: \"warn\"\n\t\t});\n\t\tcheckScriptPolicies(config, issues);\n\t} catch {\n\t\tissues.push({\n\t\t\tmessage: \"No moniq.config file found in or above the current directory.\",\n\t\t\tseverity: \"error\"\n\t\t});\n\t}\n\ttry {\n\t\tconst packageCount = (await discoverWorkspace(cwd)).length;\n\t\tif (packageCount === 0) issues.push({\n\t\t\tmessage: \"No workspace packages detected. Check your workspace configuration.\",\n\t\t\tseverity: \"warn\"\n\t\t});\n\t\telse issues.push({\n\t\t\tmessage: `Detected ${String(packageCount)} workspace package(s).`,\n\t\t\tseverity: \"warn\"\n\t\t});\n\t} catch {\n\t\tissues.push({\n\t\t\tmessage: \"Failed to discover workspace packages. Ensure a lock file or packageManager field is present.\",\n\t\t\tseverity: \"error\"\n\t\t});\n\t}\n\tconsole.log();\n\tconsole.log(` ${styleText(\"bold\", \"🏥 Configuration Doctor\")}`);\n\tconsole.log();\n\tif (issues.length === 0) {\n\t\tconsole.log(` ${styleText([\"bold\", \"green\"], \"✅ Everything looks good!\")}`);\n\t\treturn;\n\t}\n\tfor (const issue of issues) {\n\t\tconst icon = issue.severity === \"error\" ? \"❌\" : \"⚠️ \";\n\t\tconst label = issue.severity === \"error\" ? styleText([\"bold\", \"red\"], \"ERROR\") : styleText([\"bold\", \"yellow\"], \"WARN\");\n\t\tconsole.log(` ${icon} ${label} ${issue.message}`);\n\t}\n\tconst errorCount = issues.filter((index) => index.severity === \"error\").length;\n\tconst warningCount = issues.filter((index) => index.severity === \"warn\").length;\n\tconst summary = styleText(\"dim\", `Found ${`${String(errorCount)} error(s)`}, ${`${String(warningCount)} warning(s)`}`);\n\tconsole.log();\n\tconsole.log(` ${summary}`);\n\tif (errorCount > 0) {\n\t\tconst tip = styleText([\"bold\", \"cyan\"], \"💡 Tip:\");\n\t\tconst hint = styleText(\"dim\", \"moniq init\");\n\t\tconsole.log();\n\t\tconsole.log(` ${tip} Run ${hint} to scaffold a starter configuration.`);\n\t}\n}\nfunction checkScriptPolicies(config, issues) {\n\tconst scripts = config.scripts;\n\tif (!scripts) return;\n\tfor (const [name, policyOrArray] of Object.entries(scripts)) {\n\t\tconst policies = Array.isArray(policyOrArray) ? policyOrArray : [policyOrArray];\n\t\tfor (const policy of policies) {\n\t\t\tconst sev = policy.severity;\n\t\t\tif (sev !== void 0 && ![\n\t\t\t\t\"error\",\n\t\t\t\t\"off\",\n\t\t\t\t\"warn\"\n\t\t\t].includes(sev)) issues.push({\n\t\t\t\tmessage: `Script policy \"${name}\" has invalid severity \"${sev}\".`,\n\t\t\t\tseverity: \"error\"\n\t\t\t});\n\t\t}\n\t}\n}\n//#endregion\n//#region src/banner.ts\nconst colorFns = [\n\t(s) => styleText(\"cyan\", s),\n\t(s) => styleText(\"magenta\", s),\n\t(s) => styleText(\"green\", s),\n\t(s) => styleText(\"yellow\", s),\n\t(s) => styleText(\"blue\", s)\n];\nconst letterRows = [\n\t[\n\t\t\"███╗ ███╗\",\n\t\t\"████╗ ████║\",\n\t\t\"██╔████╔██║\",\n\t\t\"██║╚██╔╝██║\",\n\t\t\"██║ ╚═╝ ██║\",\n\t\t\"╚═╝ ╚═╝\"\n\t],\n\t[\n\t\t\" ██████╗ \",\n\t\t\"██╔═══██╗\",\n\t\t\"██║ ██║\",\n\t\t\"██║ ██║\",\n\t\t\"╚██████╔╝\",\n\t\t\" ╚═════╝ \"\n\t],\n\t[\n\t\t\"███╗ ██╗\",\n\t\t\"████╗ ██║\",\n\t\t\"██╔██╗ ██║\",\n\t\t\"██║╚██╗██║\",\n\t\t\"██║ ╚████║\",\n\t\t\"╚═╝ ╚═══╝\"\n\t],\n\t[\n\t\t\"██╗\",\n\t\t\"██║\",\n\t\t\"██║\",\n\t\t\"██║\",\n\t\t\"██║\",\n\t\t\"╚═╝\"\n\t],\n\t[\n\t\t\" ██████╗ \",\n\t\t\"██╔═══██╗\",\n\t\t\"██║ ██║\",\n\t\t\"██║ ██║\",\n\t\t\"╚██████╔╝\",\n\t\t\" ╚════╝╗ \"\n\t]\n];\nconst DESCRIPTION = \"Policy-driven workspace linter for JavaScript/TypeScript monorepos.\";\nfunction renderBanner() {\n\tconst lines = [\"\"];\n\tfor (let rowIndex = 0; rowIndex < 6; rowIndex++) lines.push(assembleRow(rowIndex));\n\tconst description = styleText(\"bold\", DESCRIPTION);\n\tlines.push(description, \"\");\n\treturn lines.join(\"\\n\");\n}\nfunction assembleRow(rowIndex) {\n\tlet row = \"\";\n\tfor (let columnIndex = 0; columnIndex < 5; columnIndex++) {\n\t\trow += rowPart(columnIndex, rowIndex);\n\t\tif (columnIndex < 4) row += \" \";\n\t}\n\treturn row;\n}\nfunction rowPart(columnIndex, rowIndex) {\n\tconst rows = letterRows.at(columnIndex);\n\tconst colorFunction = colorFns.at(columnIndex);\n\tif (rows === void 0 || colorFunction === void 0) return \"\";\n\tconst line = rows.at(rowIndex);\n\treturn line === void 0 ? \"\" : colorFunction(line);\n}\n//#endregion\n//#region src/commands/init.ts\nconst SUPPORTED_LANGS = [\n\t\"ts\",\n\t\"js\",\n\t\"mjs\",\n\t\"cjs\",\n\t\"mts\",\n\t\"cts\"\n];\nconst DIVIDER_WIDTH = 44;\nfunction labelPad(label) {\n\treturn label.padEnd(18);\n}\nconst STARTER_CONFIG = `import { defineConfig } from \"@udohjeremiah/moniq\";\n\nexport default defineConfig({\n scripts: {\n dev: { required: true },\n build: { required: true },\n lint: { required: true },\n },\n});\n`;\nasync function detectLang(cwd, packageJson) {\n\tconst rawDependencies = packageJson[\"dependencies\"];\n\tconst rawDevelopmentDependencies = packageJson[\"devDependencies\"];\n\tconst { access } = await import(\"node:fs/promises\");\n\ttry {\n\t\tawait access(path.join(cwd, \"tsconfig.json\"));\n\t\treturn \"ts\";\n\t} catch {}\n\tif (typeof rawDependencies === \"object\" && rawDependencies !== null && Object.hasOwn(rawDependencies, \"typescript\")) return \"ts\";\n\tif (typeof rawDevelopmentDependencies === \"object\" && rawDevelopmentDependencies !== null && Object.hasOwn(rawDevelopmentDependencies, \"typescript\")) return \"ts\";\n\treturn \"js\";\n}\nasync function init(options) {\n\tconst { _cwd, lang: explicitLang } = options;\n\tconst cwd = _cwd ?? process.cwd();\n\tconsole.log(renderBanner());\n\tconst rootPackageJson = await readRootPackageJson(cwd);\n\tif (rootPackageJson === void 0) return;\n\tconst lang = explicitLang ?? await detectLang(cwd, rootPackageJson);\n\tif (!SUPPORTED_LANGS.includes(lang)) {\n\t\tconst unsupportedMessage = `Unsupported --lang \"${lang}\". Supported: ${SUPPORTED_LANGS.join(\", \")}`;\n\t\tconsole.error(` ${styleText(\"yellow\", unsupportedMessage)}`);\n\t\tprocess.exitCode = 1;\n\t\treturn;\n\t}\n\tconst filename = `moniq.config.${lang}`;\n\tconst configPath = path.join(cwd, filename);\n\tif (!await handleExistingConfig(configPath, filename)) return;\n\tlet workspaceLabel = \"single package\";\n\tlet packages = [];\n\ttry {\n\t\tpackages = await discoverWorkspace(cwd);\n\t\tif (packages.length > 1) workspaceLabel = `monorepo with ${String(packages.length)} packages`;\n\t} catch {\n\t\tworkspaceLabel = \"unknown (workspace detection failed)\";\n\t}\n\tconst pm = await detectPackageManager(cwd);\n\tconst langDisplay = [\n\t\t\"cts\",\n\t\t\"mts\",\n\t\t\"ts\"\n\t].includes(lang) ? \"TypeScript\" : \"JavaScript\";\n\tconst dim = (s) => styleText(\"dim\", s);\n\tconst cyan = (s) => styleText(\"cyan\", s);\n\tconst sideDashes = (DIVIDER_WIDTH - 10) / 2;\n\tconst topDivider = dim(` ${\"─\".repeat(sideDashes)} Detected ${\"─\".repeat(sideDashes)}`);\n\tconst bottomDivider = dim(` ${\"─\".repeat(DIVIDER_WIDTH)}`);\n\tconst labelIndent = \" \".repeat(19);\n\tconsole.log(topDivider);\n\tconsole.log(` ${dim(labelPad(\"Workspace:\"))} ${cyan(workspaceLabel)}`);\n\tif (packages.length > 1) for (const package_ of packages) {\n\t\tconst bullet = dim(`• ${path.relative(cwd, package_.path)}`);\n\t\tconsole.log(` ${labelIndent}${bullet}`);\n\t}\n\tconsole.log(` ${dim(labelPad(\"Package Manager:\"))} ${cyan(pm)}`);\n\tconsole.log(` ${dim(labelPad(\"Language:\"))} ${cyan(langDisplay)}`);\n\tconsole.log(bottomDivider);\n\tconsole.log();\n\tif (!_cwd) {\n\t\tconst stopSpinner = startSpinner(\"Installing @udohjeremiah/moniq as devDependency...\");\n\t\ttry {\n\t\t\tawait installPackage(pm, cwd);\n\t\t\tstopSpinner();\n\t\t\tconsole.log(` ✅ Installed @udohjeremiah/moniq as devDependency`);\n\t\t\tconsole.log();\n\t\t} catch (error) {\n\t\t\tstopSpinner();\n\t\t\tconst styledError = styleText(\"red\", `❌ ${`Installation failed: ${String(error)}`}`);\n\t\t\tconsole.log(` ${styledError}`);\n\t\t\tconsole.log(` ${styleText(\"dim\", \"Make sure you have a working internet connection and try again.\")}`);\n\t\t\tconsole.log();\n\t\t\tprocess.exitCode = 1;\n\t\t\treturn;\n\t\t}\n\t}\n\tconst { writeFile } = await import(\"node:fs/promises\");\n\tawait writeFile(configPath, STARTER_CONFIG, \"utf8\");\n\tconst createdMessage = `✅ Created ${filename}`;\n\tconsole.log(` ${styleText([\"bold\", \"green\"], createdMessage)}`);\n\tconsole.log();\n\tawait doctor();\n\tconsole.log();\n\tconsole.log(` ${styleText(\"dim\", \"Next steps:\")}`);\n\tconsole.log(` 1. ${styleText(\"dim\", \"Edit\")} ${styleText(\"cyan\", filename)} ${styleText(\"dim\", \"to configure your policies.\")}`);\n\tconsole.log(` 2. ${styleText(\"dim\", \"Run\")} ${styleText(\"cyan\", \"moniq check\")} ${styleText(\"dim\", \"to validate your workspace.\")}`);\n\tconsole.log(` 3. ${styleText(\"dim\", \"Run\")} ${styleText(\"cyan\", \"moniq fix\")} ${styleText(\"dim\", \"to apply automatic fixes.\")}`);\n\tconsole.log();\n}\nasync function handleExistingConfig(configPath, filename) {\n\tconst { access } = await import(\"node:fs/promises\");\n\ttry {\n\t\tawait access(configPath);\n\t} catch {\n\t\treturn true;\n\t}\n\tif (!stdin.isTTY) return true;\n\tconst rl = createInterface({\n\t\tinput: stdin,\n\t\toutput: process.stdout\n\t});\n\tconst message = `${filename} already exists. Overwrite?`;\n\tconst answer = await rl.question(` ${styleText(\"dim\", message + \" (y/N) \")}`);\n\trl.close();\n\tif (answer.trim().length === 0) return false;\n\treturn answer.toLowerCase() === \"y\" || answer.toLowerCase() === \"yes\";\n}\nfunction installArguments(pm) {\n\tswitch (pm) {\n\t\tcase \"bun\": return [\n\t\t\t\"add\",\n\t\t\t\"--dev\",\n\t\t\t\"@udohjeremiah/moniq\"\n\t\t];\n\t\tcase \"npm\": return [\n\t\t\t\"install\",\n\t\t\t\"--save-dev\",\n\t\t\t\"@udohjeremiah/moniq\"\n\t\t];\n\t\tcase \"yarn\": return [\n\t\t\t\"add\",\n\t\t\t\"--dev\",\n\t\t\t\"@udohjeremiah/moniq\"\n\t\t];\n\t\tdefault: return [\n\t\t\t\"add\",\n\t\t\t\"-D\",\n\t\t\t\"@udohjeremiah/moniq\"\n\t\t];\n\t}\n}\nfunction installPackage(pm, root) {\n\treturn new Promise((resolve, reject) => {\n\t\tconst child = execFile(pm, installArguments(pm), { cwd: root });\n\t\tchild.on(\"exit\", (code) => {\n\t\t\tif (code === 0) resolve();\n\t\t\telse reject(/* @__PURE__ */ new Error(`Exit code ${String(code)}`));\n\t\t});\n\t\tchild.on(\"error\", reject);\n\t});\n}\nasync function readRootPackageJson(cwd) {\n\ttry {\n\t\treturn await readPackageJson(path.join(cwd, \"package.json\"));\n\t} catch {\n\t\tconsole.log();\n\t\tconsole.log(` ${styleText(\"yellow\", \"⚠ No package.json found in current directory.\")}`);\n\t\tconsole.log(` Create one first, then run ${styleText(\"cyan\", \"moniq init\")} again.`);\n\t\tconsole.log();\n\t\tprocess.exitCode = 1;\n\t\treturn;\n\t}\n}\nfunction startSpinner(text) {\n\tconst frames = [\n\t\t\"⠋\",\n\t\t\"⠙\",\n\t\t\"⠸\",\n\t\t\"⠴\",\n\t\t\"⠦\",\n\t\t\"⠧\"\n\t];\n\tlet index = 0;\n\tconst id = setInterval(() => {\n\t\tconst styled = styleText(\"dim\", `${frames.at(index) ?? \"\"} ${text}`);\n\t\tprocess.stdout.write(`\\r ${styled}`);\n\t\tindex = (index + 1) % frames.length;\n\t}, 80);\n\treturn () => {\n\t\tclearInterval(id);\n\t\tprocess.stdout.write(\"\\r\\x1B[K\");\n\t};\n}\n//#endregion\n//#region src/index.ts\nconst cli = cac(\"moniq\");\ncli.command(\"check\", \"Run policy checks\").option(\"--format <fmt>\", \"Output format: pretty or json\", { default: \"pretty\" }).action(async (options) => {\n\tconst fmt = typeof options[\"format\"] === \"string\" ? options[\"format\"] : \"pretty\";\n\ttry {\n\t\tawait check({\n\t\t\tfix: false,\n\t\t\tformat: fmt\n\t\t});\n\t} catch (error) {\n\t\tconsole.error(String(error));\n\t\tprocess.exitCode = 1;\n\t}\n});\ncli.command(\"fix\", \"Run policy checks and apply autofixes\").option(\"--dry-run\", \"Preview autofixes without writing to files\").option(\"--format <fmt>\", \"Output format: pretty or json\", { default: \"pretty\" }).action(async (options) => {\n\tconst isDryRun = options[\"dryRun\"] === true;\n\tconst fmt = typeof options[\"format\"] === \"string\" ? options[\"format\"] : \"pretty\";\n\ttry {\n\t\tawait check({\n\t\t\tfix: true,\n\t\t\tformat: fmt,\n\t\t\tisDryRun\n\t\t});\n\t} catch (error) {\n\t\tconsole.error(String(error));\n\t\tprocess.exitCode = 1;\n\t}\n});\ncli.command(\"doctor\", \"Detect configuration mistakes\").action(async () => {\n\tawait doctor();\n});\ncli.command(\"init\", \"Scaffold a moniq.config file in the current directory\").option(\"--lang <type>\", \"Config language: ts, js, mjs, cjs, mts, cts (default: auto-detected)\").action(async (options) => {\n\tawait init({ lang: typeof options[\"lang\"] === \"string\" ? options[\"lang\"] : void 0 });\n});\ncli.help();\ncli.version(version);\ncli.parse();\n//#endregion\nexport {};\n\n//# sourceMappingURL=index.js.map"],"x_google_ignoreList":[0,2],"mappings":";;;;;;;;AACA,SAAS,MAAM,KAAK;CACnB,OAAO,OAAO,OAAO,CAAC,IAAI,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,GAAG;AAC1D;AACA,SAAS,MAAM,KAAK,KAAK,KAAK,MAAM;CACnC,IAAI,GAAG,MAAM,IAAI,MAAM,MAAM,CAAC,CAAC,CAAC,KAAK,OAAO,QAAQ,GAAG,IAAI,OAAO,QAAQ,QAAQ,OAAO,KAAK,OAAO,GAAG,IAAI,OAAO,QAAQ,YAAY,MAAM,CAAC,CAAC,CAAC,KAAK,QAAQ,QAAQ,GAAG,IAAI,QAAQ,UAAU,QAAQ,QAAQ,WAAW,IAAI,EAAE,MAAM,IAAI,CAAC,KAAK,IAAI,MAAM,KAAK,IAAI,GAAG,GAAG,CAAC,CAAC,QAAQ,IAAI,CAAC,KAAK,IAAI,MAAM,KAAK,IAAI;CAC/S,IAAI,OAAO,OAAO,OAAO,MAAM,MAAM,QAAQ,GAAG,IAAI,IAAI,OAAO,GAAG,IAAI,CAAC,KAAK,GAAG;AAChF;AACA,SAAS,YAAY,MAAM,MAAM;CAChC,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"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../node_modules/.pnpm/shell-quote@1.9.0/node_modules/shell-quote/quote.js","../../../node_modules/.pnpm/shell-quote@1.9.0/node_modules/shell-quote/parse.js","../../../node_modules/.pnpm/shell-quote@1.9.0/node_modules/shell-quote/index.js","../src/bin.ts"],"sourcesContent":["'use strict';\n\n/** @import { ControlOperator } from './parse' */\n\n/** @type {ControlOperator['op'][]} */\nvar OPS = /** @type {const} */ ([\n\t'||',\n\t'&&',\n\t';;',\n\t'|&',\n\t'<(',\n\t'<<<',\n\t'>>',\n\t'>&',\n\t'<&',\n\t'&',\n\t';',\n\t'(',\n\t')',\n\t'|',\n\t'<',\n\t'>'\n]);\nvar LINE_TERMINATORS = /[\\n\\r\\u2028\\u2029]/;\nvar GLOB_SHELL_SPECIAL = /[\\s#!\"$&'():;<=>@\\\\^`|]/g;\n\n/** @type {import('./quote')} */\nmodule.exports = function quote(xs) {\n\treturn xs.map(function (s) {\n\t\tif (s === '') {\n\t\t\treturn /** @type {const} */ ('\\'\\'');\n\t\t}\n\t\tif (s && typeof s === 'object') {\n\t\t\tif ('op' in s && s.op === 'glob') {\n\t\t\t\tif (typeof s.pattern !== 'string') {\n\t\t\t\t\tthrow new TypeError('glob token requires a string `pattern`');\n\t\t\t\t}\n\t\t\t\tif (LINE_TERMINATORS.test(s.pattern)) {\n\t\t\t\t\tthrow new TypeError('glob `pattern` must not contain line terminators');\n\t\t\t\t}\n\t\t\t\treturn s.pattern.replace(GLOB_SHELL_SPECIAL, '\\\\$&');\n\t\t\t}\n\t\t\tif ('op' in s && typeof s.op === 'string') {\n\t\t\t\tif (OPS.indexOf(s.op) < 0) {\n\t\t\t\t\tthrow new TypeError('invalid `op` value: ' + JSON.stringify(s.op));\n\t\t\t\t}\n\t\t\t\treturn s.op.replace(/[\\s\\S]/g, '\\\\$&');\n\t\t\t}\n\t\t\tif ('comment' in s && typeof s.comment === 'string') {\n\t\t\t\tif (LINE_TERMINATORS.test(s.comment)) {\n\t\t\t\t\tthrow new TypeError('`comment` must not contain line terminators');\n\t\t\t\t}\n\t\t\t\treturn '#' + s.comment;\n\t\t\t}\n\t\t\tthrow new TypeError('unrecognized object token shape');\n\t\t}\n\t\tif ((/[\"\\s\\\\]/).test(s) && !(/'/).test(s)) {\n\t\t\treturn \"'\" + s.replace(/(['])/g, '\\\\$1') + \"'\";\n\t\t}\n\t\tif ((/[\"'\\s]/).test(s)) {\n\t\t\treturn '\"' + s.replace(/([\"\\\\$`!])/g, '\\\\$1') + '\"';\n\t\t}\n\t\treturn String(s).replace(/([A-Za-z]:)?([#!\"$&'()*,:;<=>?@[\\\\\\]^`{|}~])/g, '$1\\\\$2');\n\t}).join(' ');\n};\n","'use strict';\n\n/**\n * @import {\n * \tControlOperator,\n * \tEnv,\n * \tGlobPattern,\n * \tParseEntry,\n * } from './parse' */\n\n// '<(' is process substitution operator and\n// can be parsed the same as control operator\nvar CONTROL = /** @type {const} */ ('(?:') + /** @type {const} */ ([\n\t'\\\\|\\\\|',\n\t'\\\\&\\\\&',\n\t';;',\n\t'\\\\|\\\\&',\n\t'\\\\<\\\\(',\n\t'\\\\<\\\\<\\\\<',\n\t'>>',\n\t'>\\\\&',\n\t'<\\\\&',\n\t'[&;()|<>]'\n]).join(/** @type {const} */ ('|')) + /** @type {const} */ (')');\nvar controlRE = new RegExp('^' + CONTROL + '$');\nvar META = /** @type {const} */ ('|&;()<> \\\\t');\nvar SINGLE_QUOTE = /** @type {const} */ ('\"((\\\\\\\\\"|[^\"])*?)\"');\nvar DOUBLE_QUOTE = /** @type {const} */ ('\\'((\\\\\\\\\\'|[^\\'])*?)\\'');\nvar hash = /^#$/;\n\nvar SQ = /** @type {const} */ (\"'\");\nvar DQ = /** @type {const} */ ('\"');\nvar DS = /** @type {const} */ ('$');\n\nvar TOKEN = '';\nvar mult = /** @type {const} */ (0x100000000); // Math.pow(16, 8);\nfor (var i = 0; i < 4; i++) {\n\tTOKEN += (mult * Math.random()).toString(16);\n}\nvar startsWithToken = new RegExp('^' + TOKEN);\n\n/**\n * @param {string} s\n * @param {RegExp} r\n */\nfunction matchAll(s, r) {\n\tvar origIndex = r.lastIndex;\n\n\tvar matches = [];\n\tvar matchObj;\n\n\twhile ((matchObj = r.exec(s))) {\n\t\tmatches[matches.length] = matchObj;\n\t\tif (r.lastIndex === matchObj.index) {\n\t\t\tr.lastIndex += 1;\n\t\t}\n\t}\n\n\tr.lastIndex = origIndex;\n\n\treturn matches;\n}\n\n/**\n * @param {Env} env\n * @param {string} pre\n * @param {string} key\n */\nfunction getVar(env, pre, key) {\n\tvar r = typeof env === 'function' ? env(key) : env[key];\n\tif (typeof r === 'undefined' && key != '') {\n\t\tr = '';\n\t} else if (typeof r === 'undefined') {\n\t\tr = '$';\n\t}\n\n\tif (typeof r === 'object') {\n\t\treturn pre + TOKEN + JSON.stringify(r) + TOKEN;\n\t}\n\treturn pre + r;\n}\n\n/**\n * @param {string} string\n * @param {Env} [env]\n * @param {{ escape?: string }} [opts]\n * @returns {ParseEntry[]}\n */\nfunction parseInternal(string, env, opts) {\n\tif (!opts) {\n\t\topts = {};\n\t}\n\tvar BS = opts.escape || '\\\\';\n\tvar BAREWORD = '(\\\\' + BS + '[\\'\"' + META + ']|[^\\\\s\\'\"' + META + '])+';\n\n\tvar chunker = new RegExp([\n\t\t'(' + CONTROL + ')', // control chars\n\t\t'(' + BAREWORD + '|' + SINGLE_QUOTE + '|' + DOUBLE_QUOTE + ')+'\n\t].join('|'), 'g');\n\n\tvar matches = matchAll(string, chunker);\n\n\tif (matches.length === 0) {\n\t\treturn [];\n\t}\n\tif (!env) {\n\t\tenv = {};\n\t}\n\n\tvar commented = false;\n\n\treturn matches.map(function (match) {\n\t\tvar s = match[0];\n\t\tif (!s || commented) {\n\t\t\treturn void undefined;\n\t\t}\n\t\tif (controlRE.test(s)) {\n\t\t\treturn /** @type {ControlOperator} */ ({ op: s });\n\t\t}\n\n\t\t// Hand-written scanner/parser for Bash quoting rules:\n\t\t//\n\t\t// 1. inside single quotes, all characters are printed literally.\n\t\t// 2. inside double quotes, all characters are printed literally\n\t\t// except variables prefixed by '$' and backslashes followed by\n\t\t// either a double quote or another backslash.\n\t\t// 3. outside of any quotes, backslashes are treated as escape\n\t\t// characters and not printed (unless they are themselves escaped)\n\t\t// 4. quote context can switch mid-token if there is no whitespace\n\t\t// between the two quote contexts (e.g. all'one'\"token\" parses as\n\t\t// \"allonetoken\")\n\t\t/** @type {string | boolean} */\n\t\tvar quote = false;\n\t\tvar esc = false;\n\t\tvar out = '';\n\t\tvar isGlob = false;\n\t\t/** @type {number} */\n\t\tvar i;\n\n\t\tfunction parseEnvVar() {\n\t\t\ti += 1;\n\t\t\t/** @type {number | RegExpMatchArray | null} */\n\t\t\tvar varend;\n\t\t\t/** @type {string} */\n\t\t\tvar varname;\n\t\t\tvar char = s.charAt(i);\n\n\t\t\tif (char === '{') {\n\t\t\t\ti += 1;\n\t\t\t\tif (s.charAt(i) === '}') {\n\t\t\t\t\tthrow new Error('Bad substitution: ' + s.slice(i - 2, i + 1));\n\t\t\t\t}\n\t\t\t\tvarend = s.indexOf('}', i);\n\t\t\t\tif (varend < 0) {\n\t\t\t\t\tthrow new Error('Bad substitution: ' + s.slice(i));\n\t\t\t\t}\n\t\t\t\tvarname = s.slice(i, varend);\n\t\t\t\ti = varend;\n\t\t\t} else if ((/[*@#?$!_-]/).test(char)) {\n\t\t\t\tvarname = char;\n\t\t\t\ti += 1;\n\t\t\t} else {\n\t\t\t\tvar slicedFromI = s.slice(i);\n\t\t\t\tvarend = slicedFromI.match(/[^\\w\\d_]/);\n\t\t\t\tif (!varend) {\n\t\t\t\t\tvarname = slicedFromI;\n\t\t\t\t\ti = s.length;\n\t\t\t\t} else {\n\t\t\t\t\tvarname = slicedFromI.slice(0, varend.index);\n\t\t\t\t\ti += /** @type {number} */ (varend.index) - 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn getVar(/** @type {NonNullable<typeof env>} */ (env), '', varname);\n\t\t}\n\n\t\tfor (i = 0; i < s.length; i++) {\n\t\t\tvar c = s.charAt(i);\n\t\t\tisGlob = isGlob || (!quote && (c === '*' || c === '?'));\n\t\t\tif (esc) {\n\t\t\t\tout += c;\n\t\t\t\tesc = false;\n\t\t\t} else if (quote) {\n\t\t\t\tif (c === quote) {\n\t\t\t\t\tquote = false;\n\t\t\t\t} else if (quote == SQ) {\n\t\t\t\t\tout += c;\n\t\t\t\t} else { // Double quote\n\t\t\t\t\tif (c === BS) {\n\t\t\t\t\t\ti += 1;\n\t\t\t\t\t\tc = s.charAt(i);\n\t\t\t\t\t\tif (c === DQ || c === BS || c === DS) {\n\t\t\t\t\t\t\tout += c;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tout += BS + c;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (c === DS) {\n\t\t\t\t\t\tout += parseEnvVar();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tout += c;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (c === DQ || c === SQ) {\n\t\t\t\tquote = c;\n\t\t\t} else if (controlRE.test(c)) {\n\t\t\t\treturn /** @type {ControlOperator} */ ({ op: s });\n\t\t\t} else if (hash.test(c)) {\n\t\t\t\tcommented = true;\n\t\t\t\tvar commentObj = { comment: string.slice(match.index + i + 1) };\n\t\t\t\tif (out.length) {\n\t\t\t\t\treturn /** @type {const} */ ([out, commentObj]);\n\t\t\t\t}\n\t\t\t\treturn /** @type {const} */ ([commentObj]);\n\t\t\t} else if (c === BS) {\n\t\t\t\tesc = true;\n\t\t\t} else if (c === DS) {\n\t\t\t\tout += parseEnvVar();\n\t\t\t} else {\n\t\t\t\tout += c;\n\t\t\t}\n\t\t}\n\n\t\tif (isGlob) {\n\t\t\treturn /** @type {GlobPattern} */ ({ op: 'glob', pattern: out });\n\t\t}\n\n\t\treturn out;\n\t}).reduce(function (prev, arg) { // finalize parsed arguments\n\t\tif (typeof arg === 'undefined') {\n\t\t\treturn prev;\n\t\t}\n\t\t/** @type {ParseEntry[]} */ ([]).concat(arg).forEach(function (entry) {\n\t\t\tprev[prev.length] = entry;\n\t\t});\n\t\treturn prev;\n\t}, /** @type {ParseEntry[]} */ ([]));\n}\n\n/** @type {import('./parse')} */\nmodule.exports = function parse(s, env, opts) {\n\tvar mapped = parseInternal(s, env, opts);\n\tif (typeof env !== 'function') {\n\t\treturn mapped;\n\t}\n\treturn mapped.reduce(function (acc, s) {\n\t\tif (typeof s === 'object') {\n\t\t\tacc[acc.length] = s;\n\t\t\treturn acc;\n\t\t}\n\t\tvar xs = s.split(RegExp('(' + TOKEN + '.*?' + TOKEN + ')', 'g'));\n\t\tif (xs.length === 1) {\n\t\t\tacc[acc.length] = xs[0];\n\t\t\treturn acc;\n\t\t}\n\t\txs.filter(Boolean).forEach(function (x) {\n\t\t\tacc[acc.length] = startsWithToken.test(x)\n\t\t\t\t? JSON.parse(x.split(TOKEN)[1])\n\t\t\t\t: x;\n\t\t});\n\t\treturn acc;\n\t}, /** @type {ParseEntry[]} */ ([]));\n};\n","'use strict';\n\nexports.quote = require('./quote');\nexports.parse = require('./parse');\n","import { parse } from \"shell-quote\";\n\nconst WRAPPER_SEQUENCES = [\n [\"pnpm\", \"exec\"],\n [\"pnpm\", \"dlx\"],\n [\"yarn\", \"dlx\"],\n];\n\nconst WRAPPER_SINGLE = new Set([\"bunx\", \"node\", \"npx\", \"yarn\"]);\n\nexport function bin(name: string) {\n return (command: string): boolean => {\n let tokens = parse(command).filter(\n (t): t is string => typeof t === \"string\",\n );\n\n while (tokens[0] === \"cross-env\" || /^[A-Z_]\\w*=/i.test(tokens[0] ?? \"\")) {\n tokens = tokens.slice(1);\n }\n\n ({ remaining: tokens } = stripWrappers(tokens));\n\n let index = 0;\n\n while (tokens.slice(index, index + 1)[0]?.startsWith(\"-\")) {\n index++;\n }\n\n const candidate = tokens.slice(index, index + 1)[0];\n return candidate !== undefined && toBinaryName(candidate) === name;\n };\n}\n\nfunction stripWrappers(tokens: string[]): { remaining: string[] } {\n let remaining = tokens;\n let isChanged = true;\n\n while (isChanged) {\n isChanged = false;\n\n const seq = WRAPPER_SEQUENCES.find((w) => {\n const slice = remaining.slice(0, w.length);\n return (\n slice.length === w.length &&\n slice.every((t, index_) => t === w.slice(index_, index_ + 1)[0])\n );\n });\n if (seq) {\n remaining = remaining.slice(seq.length);\n isChanged = true;\n } else if (WRAPPER_SINGLE.has(remaining[0] ?? \"\")) {\n remaining = remaining.slice(1);\n isChanged = true;\n }\n }\n\n return { remaining };\n}\n\nfunction toBinaryName(token: string): string {\n if (token.startsWith(\"@\")) {\n const atIndexes = Array.from(token.matchAll(/@/g), (m) => m.index);\n\n if (atIndexes.length >= 2) {\n return token.slice(0, atIndexes[1] ?? token.length);\n }\n\n return token;\n }\n\n const basename = token.split(\"/\").pop() ?? token;\n const atIndex = basename.lastIndexOf(\"@\");\n\n if (atIndex > 0) {\n return basename.slice(0, atIndex);\n }\n\n return basename;\n}\n"],"x_google_ignoreList":[0,1,2],"mappings":";;;;;CAKA,IAAI,MAA4B;EAC/B;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD;CACA,IAAI,mBAAmB;CACvB,IAAI,qBAAqB;;CAGzB,OAAO,UAAU,SAAS,MAAM,IAAI;EACnC,OAAO,GAAG,IAAI,SAAU,GAAG;GAC1B,IAAI,MAAM,IACT,OAA6B;GAE9B,IAAI,KAAK,OAAO,MAAM,UAAU;IAC/B,IAAI,QAAQ,KAAK,EAAE,OAAO,QAAQ;KACjC,IAAI,OAAO,EAAE,YAAY,UACxB,MAAM,IAAI,UAAU,wCAAwC;KAE7D,IAAI,iBAAiB,KAAK,EAAE,OAAO,GAClC,MAAM,IAAI,UAAU,kDAAkD;KAEvE,OAAO,EAAE,QAAQ,QAAQ,oBAAoB,MAAM;IACpD;IACA,IAAI,QAAQ,KAAK,OAAO,EAA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AI,IAAI,MAAM,EAAE,KAAK;EAEjE,IAAI,UAAU,UAAU,GACtB,OAAO,MAAM,MAAM,GAAG,UAAU,MAAM,MAAM,MAAM;EAGpD,OAAO;CACT;CAEA,MAAM,WAAW,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,KAAK;CAC3C,MAAM,UAAU,SAAS,YAAY,GAAG;CAExC,IAAI,UAAU,GACZ,OAAO,SAAS,MAAM,GAAG,OAAO;CAGlC,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../node_modules/.pnpm/shell-quote@1.9.0/node_modules/shell-quote/quote.js","../../../node_modules/.pnpm/shell-quote@1.9.0/node_modules/shell-quote/parse.js","../../../node_modules/.pnpm/shell-quote@1.9.0/node_modules/shell-quote/index.js","../src/bin.ts"],"sourcesContent":["'use strict';\n\n/** @import { ControlOperator } from './parse' */\n\n/** @type {ControlOperator['op'][]} */\nvar OPS = /** @type {const} */ ([\n\t'||',\n\t'&&',\n\t';;',\n\t'|&',\n\t'<(',\n\t'<<<',\n\t'>>',\n\t'>&',\n\t'<&',\n\t'&',\n\t';',\n\t'(',\n\t')',\n\t'|',\n\t'<',\n\t'>'\n]);\nvar LINE_TERMINATORS = /[\\n\\r\\u2028\\u2029]/;\nvar GLOB_SHELL_SPECIAL = /[\\s#!\"$&'():;<=>@\\\\^`|]/g;\n\n/** @type {import('./quote')} */\nmodule.exports = function quote(xs) {\n\treturn xs.map(function (s) {\n\t\tif (s === '') {\n\t\t\treturn /** @type {const} */ ('\\'\\'');\n\t\t}\n\t\tif (s && typeof s === 'object') {\n\t\t\tif ('op' in s && s.op === 'glob') {\n\t\t\t\tif (typeof s.pattern !== 'string') {\n\t\t\t\t\tthrow new TypeError('glob token requires a string `pattern`');\n\t\t\t\t}\n\t\t\t\tif (LINE_TERMINATORS.test(s.pattern)) {\n\t\t\t\t\tthrow new TypeError('glob `pattern` must not contain line terminators');\n\t\t\t\t}\n\t\t\t\treturn s.pattern.replace(GLOB_SHELL_SPECIAL, '\\\\$&');\n\t\t\t}\n\t\t\tif ('op' in s && typeof s.op === 'string') {\n\t\t\t\tif (OPS.indexOf(s.op) < 0) {\n\t\t\t\t\tthrow new TypeError('invalid `op` value: ' + JSON.stringify(s.op));\n\t\t\t\t}\n\t\t\t\treturn s.op.replace(/[\\s\\S]/g, '\\\\$&');\n\t\t\t}\n\t\t\tif ('comment' in s && typeof s.comment === 'string') {\n\t\t\t\tif (LINE_TERMINATORS.test(s.comment)) {\n\t\t\t\t\tthrow new TypeError('`comment` must not contain line terminators');\n\t\t\t\t}\n\t\t\t\treturn '#' + s.comment;\n\t\t\t}\n\t\t\tthrow new TypeError('unrecognized object token shape');\n\t\t}\n\t\tif ((/[\"\\s\\\\]/).test(s) && !(/'/).test(s)) {\n\t\t\treturn \"'\" + s.replace(/(['])/g, '\\\\$1') + \"'\";\n\t\t}\n\t\tif ((/[\"'\\s]/).test(s)) {\n\t\t\treturn '\"' + s.replace(/([\"\\\\$`!])/g, '\\\\$1') + '\"';\n\t\t}\n\t\treturn String(s).replace(/([A-Za-z]:)?([#!\"$&'()*,:;<=>?@[\\\\\\]^`{|}~])/g, '$1\\\\$2');\n\t}).join(' ');\n};\n","'use strict';\n\n/**\n * @import {\n * \tControlOperator,\n * \tEnv,\n * \tGlobPattern,\n * \tParseEntry,\n * } from './parse' */\n\n// '<(' is process substitution operator and\n// can be parsed the same as control operator\nvar CONTROL = /** @type {const} */ ('(?:') + /** @type {const} */ ([\n\t'\\\\|\\\\|',\n\t'\\\\&\\\\&',\n\t';;',\n\t'\\\\|\\\\&',\n\t'\\\\<\\\\(',\n\t'\\\\<\\\\<\\\\<',\n\t'>>',\n\t'>\\\\&',\n\t'<\\\\&',\n\t'[&;()|<>]'\n]).join(/** @type {const} */ ('|')) + /** @type {const} */ (')');\nvar controlRE = new RegExp('^' + CONTROL + '$');\nvar META = /** @type {const} */ ('|&;()<> \\\\t');\nvar SINGLE_QUOTE = /** @type {const} */ ('\"((\\\\\\\\\"|[^\"])*?)\"');\nvar DOUBLE_QUOTE = /** @type {const} */ ('\\'((\\\\\\\\\\'|[^\\'])*?)\\'');\nvar hash = /^#$/;\n\nvar SQ = /** @type {const} */ (\"'\");\nvar DQ = /** @type {const} */ ('\"');\nvar DS = /** @type {const} */ ('$');\n\nvar TOKEN = '';\nvar mult = /** @type {const} */ (0x100000000); // Math.pow(16, 8);\nfor (var i = 0; i < 4; i++) {\n\tTOKEN += (mult * Math.random()).toString(16);\n}\nvar startsWithToken = new RegExp('^' + TOKEN);\n\n/**\n * @param {string} s\n * @param {RegExp} r\n */\nfunction matchAll(s, r) {\n\tvar origIndex = r.lastIndex;\n\n\tvar matches = [];\n\tvar matchObj;\n\n\twhile ((matchObj = r.exec(s))) {\n\t\tmatches[matches.length] = matchObj;\n\t\tif (r.lastIndex === matchObj.index) {\n\t\t\tr.lastIndex += 1;\n\t\t}\n\t}\n\n\tr.lastIndex = origIndex;\n\n\treturn matches;\n}\n\n/**\n * @param {Env} env\n * @param {string} pre\n * @param {string} key\n */\nfunction getVar(env, pre, key) {\n\tvar r = typeof env === 'function' ? env(key) : env[key];\n\tif (typeof r === 'undefined' && key != '') {\n\t\tr = '';\n\t} else if (typeof r === 'undefined') {\n\t\tr = '$';\n\t}\n\n\tif (typeof r === 'object') {\n\t\treturn pre + TOKEN + JSON.stringify(r) + TOKEN;\n\t}\n\treturn pre + r;\n}\n\n/**\n * @param {string} string\n * @param {Env} [env]\n * @param {{ escape?: string }} [opts]\n * @returns {ParseEntry[]}\n */\nfunction parseInternal(string, env, opts) {\n\tif (!opts) {\n\t\topts = {};\n\t}\n\tvar BS = opts.escape || '\\\\';\n\tvar BAREWORD = '(\\\\' + BS + '[\\'\"' + META + ']|[^\\\\s\\'\"' + META + '])+';\n\n\tvar chunker = new RegExp([\n\t\t'(' + CONTROL + ')', // control chars\n\t\t'(' + BAREWORD + '|' + SINGLE_QUOTE + '|' + DOUBLE_QUOTE + ')+'\n\t].join('|'), 'g');\n\n\tvar matches = matchAll(string, chunker);\n\n\tif (matches.length === 0) {\n\t\treturn [];\n\t}\n\tif (!env) {\n\t\tenv = {};\n\t}\n\n\tvar commented = false;\n\n\treturn matches.map(function (match) {\n\t\tvar s = match[0];\n\t\tif (!s || commented) {\n\t\t\treturn void undefined;\n\t\t}\n\t\tif (controlRE.test(s)) {\n\t\t\treturn /** @type {ControlOperator} */ ({ op: s });\n\t\t}\n\n\t\t// Hand-written scanner/parser for Bash quoting rules:\n\t\t//\n\t\t// 1. inside single quotes, all characters are printed literally.\n\t\t// 2. inside double quotes, all characters are printed literally\n\t\t// except variables prefixed by '$' and backslashes followed by\n\t\t// either a double quote or another backslash.\n\t\t// 3. outside of any quotes, backslashes are treated as escape\n\t\t// characters and not printed (unless they are themselves escaped)\n\t\t// 4. quote context can switch mid-token if there is no whitespace\n\t\t// between the two quote contexts (e.g. all'one'\"token\" parses as\n\t\t// \"allonetoken\")\n\t\t/** @type {string | boolean} */\n\t\tvar quote = false;\n\t\tvar esc = false;\n\t\tvar out = '';\n\t\tvar isGlob = false;\n\t\t/** @type {number} */\n\t\tvar i;\n\n\t\tfunction parseEnvVar() {\n\t\t\ti += 1;\n\t\t\t/** @type {number | RegExpMatchArray | null} */\n\t\t\tvar varend;\n\t\t\t/** @type {string} */\n\t\t\tvar varname;\n\t\t\tvar char = s.charAt(i);\n\n\t\t\tif (char === '{') {\n\t\t\t\ti += 1;\n\t\t\t\tif (s.charAt(i) === '}') {\n\t\t\t\t\tthrow new Error('Bad substitution: ' + s.slice(i - 2, i + 1));\n\t\t\t\t}\n\t\t\t\tvarend = s.indexOf('}', i);\n\t\t\t\tif (varend < 0) {\n\t\t\t\t\tthrow new Error('Bad substitution: ' + s.slice(i));\n\t\t\t\t}\n\t\t\t\tvarname = s.slice(i, varend);\n\t\t\t\ti = varend;\n\t\t\t} else if ((/[*@#?$!_-]/).test(char)) {\n\t\t\t\tvarname = char;\n\t\t\t\ti += 1;\n\t\t\t} else {\n\t\t\t\tvar slicedFromI = s.slice(i);\n\t\t\t\tvarend = slicedFromI.match(/[^\\w\\d_]/);\n\t\t\t\tif (!varend) {\n\t\t\t\t\tvarname = slicedFromI;\n\t\t\t\t\ti = s.length;\n\t\t\t\t} else {\n\t\t\t\t\tvarname = slicedFromI.slice(0, varend.index);\n\t\t\t\t\ti += /** @type {number} */ (varend.index) - 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn getVar(/** @type {NonNullable<typeof env>} */ (env), '', varname);\n\t\t}\n\n\t\tfor (i = 0; i < s.length; i++) {\n\t\t\tvar c = s.charAt(i);\n\t\t\tisGlob = isGlob || (!quote && (c === '*' || c === '?'));\n\t\t\tif (esc) {\n\t\t\t\tout += c;\n\t\t\t\tesc = false;\n\t\t\t} else if (quote) {\n\t\t\t\tif (c === quote) {\n\t\t\t\t\tquote = false;\n\t\t\t\t} else if (quote == SQ) {\n\t\t\t\t\tout += c;\n\t\t\t\t} else { // Double quote\n\t\t\t\t\tif (c === BS) {\n\t\t\t\t\t\ti += 1;\n\t\t\t\t\t\tc = s.charAt(i);\n\t\t\t\t\t\tif (c === DQ || c === BS || c === DS) {\n\t\t\t\t\t\t\tout += c;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tout += BS + c;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (c === DS) {\n\t\t\t\t\t\tout += parseEnvVar();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tout += c;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (c === DQ || c === SQ) {\n\t\t\t\tquote = c;\n\t\t\t} else if (controlRE.test(c)) {\n\t\t\t\treturn /** @type {ControlOperator} */ ({ op: s });\n\t\t\t} else if (hash.test(c)) {\n\t\t\t\tcommented = true;\n\t\t\t\tvar commentObj = { comment: string.slice(match.index + i + 1) };\n\t\t\t\tif (out.length) {\n\t\t\t\t\treturn /** @type {const} */ ([out, commentObj]);\n\t\t\t\t}\n\t\t\t\treturn /** @type {const} */ ([commentObj]);\n\t\t\t} else if (c === BS) {\n\t\t\t\tesc = true;\n\t\t\t} else if (c === DS) {\n\t\t\t\tout += parseEnvVar();\n\t\t\t} else {\n\t\t\t\tout += c;\n\t\t\t}\n\t\t}\n\n\t\tif (isGlob) {\n\t\t\treturn /** @type {GlobPattern} */ ({ op: 'glob', pattern: out });\n\t\t}\n\n\t\treturn out;\n\t}).reduce(function (prev, arg) { // finalize parsed arguments\n\t\tif (typeof arg === 'undefined') {\n\t\t\treturn prev;\n\t\t}\n\t\t/** @type {ParseEntry[]} */ ([]).concat(arg).forEach(function (entry) {\n\t\t\tprev[prev.length] = entry;\n\t\t});\n\t\treturn prev;\n\t}, /** @type {ParseEntry[]} */ ([]));\n}\n\n/** @type {import('./parse')} */\nmodule.exports = function parse(s, env, opts) {\n\tvar mapped = parseInternal(s, env, opts);\n\tif (typeof env !== 'function') {\n\t\treturn mapped;\n\t}\n\treturn mapped.reduce(function (acc, s) {\n\t\tif (typeof s === 'object') {\n\t\t\tacc[acc.length] = s;\n\t\t\treturn acc;\n\t\t}\n\t\tvar xs = s.split(RegExp('(' + TOKEN + '.*?' + TOKEN + ')', 'g'));\n\t\tif (xs.length === 1) {\n\t\t\tacc[acc.length] = xs[0];\n\t\t\treturn acc;\n\t\t}\n\t\txs.filter(Boolean).forEach(function (x) {\n\t\t\tacc[acc.length] = startsWithToken.test(x)\n\t\t\t\t? JSON.parse(x.split(TOKEN)[1])\n\t\t\t\t: x;\n\t\t});\n\t\treturn acc;\n\t}, /** @type {ParseEntry[]} */ ([]));\n};\n","'use strict';\n\nexports.quote = require('./quote');\nexports.parse = require('./parse');\n","import { parse } from \"shell-quote\";\n\nconst WRAPPER_SEQUENCES = [\n [\"pnpm\", \"exec\"],\n [\"pnpm\", \"dlx\"],\n [\"yarn\", \"dlx\"],\n];\n\nconst WRAPPER_SINGLE = new Set([\"bunx\", \"node\", \"npx\", \"yarn\"]);\n\nexport function bin(name: string) {\n return (command: string) => {\n let tokens = parse(command).filter(\n (t): t is string => typeof t === \"string\",\n );\n\n while (tokens[0] === \"cross-env\" || /^[A-Z_]\\w*=/i.test(tokens[0] ?? \"\")) {\n tokens = tokens.slice(1);\n }\n\n ({ remaining: tokens } = stripWrappers(tokens));\n\n let index = 0;\n\n while (tokens.slice(index, index + 1)[0]?.startsWith(\"-\")) {\n index++;\n }\n\n const candidate = tokens.slice(index, index + 1)[0];\n return candidate !== undefined && toBinaryName(candidate) === name;\n };\n}\n\nfunction stripWrappers(tokens: string[]): { remaining: string[] } {\n let remaining = tokens;\n let isChanged = true;\n\n while (isChanged) {\n isChanged = false;\n\n const seq = WRAPPER_SEQUENCES.find((w) => {\n const slice = remaining.slice(0, w.length);\n return (\n slice.length === w.length &&\n slice.every((t, index_) => t === w.slice(index_, index_ + 1)[0])\n );\n });\n if (seq) {\n remaining = remaining.slice(seq.length);\n isChanged = true;\n } else if (WRAPPER_SINGLE.has(remaining[0] ?? \"\")) {\n remaining = remaining.slice(1);\n isChanged = true;\n }\n }\n\n return { remaining };\n}\n\nfunction toBinaryName(token: string) {\n if (token.startsWith(\"@\")) {\n const atIndexes = Array.from(token.matchAll(/@/g), (m) => m.index);\n\n if (atIndexes.length >= 2) {\n return token.slice(0, atIndexes[1] ?? token.length);\n }\n\n return token;\n }\n\n const basename = token.split(\"/\").pop() ?? token;\n const atIndex = basename.lastIndexOf(\"@\");\n\n if (atIndex > 0) {\n return basename.slice(0, atIndex);\n }\n\n return basename;\n}\n"],"x_google_ignoreList":[0,1,2],"mappings":";;;;;CAKA,IAAI,MAA4B;EAC/B;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD;CACA,IAAI,mBAAmB;CACvB,IAAI,qBAAqB;;CAGzB,OAAO,UAAU,SAAS,MAAM,IAAI;EACnC,OAAO,GAAG,IAAI,SAAU,GAAG;GAC1B,IAAI,MAAM,IACT,OAA6B;GAE9B,IAAI,KAAK,OAAO,MAAM,UAAU;IAC/B,IAAI,QAAQ,K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AAY;EACd,OAAO,IAAI,eAAe,IAAI,UAAU,MAAM,EAAE,GAAG;GACjD,YAAY,UAAU,MAAM,CAAC;GAC7B,YAAY;EACd;CACF;CAEA,OAAO,EAAE,UAAU;AACrB;AAEA,SAAS,aAAa,OAAe;CACnC,IAAI,MAAM,WAAW,GAAG,GAAG;EACzB,MAAM,YAAY,MAAM,KAAK,MAAM,SAAS,IAAI,IAAI,MAAM,EAAE,KAAK;EAEjE,IAAI,UAAU,UAAU,GACtB,OAAO,MAAM,MAAM,GAAG,UAAU,MAAM,MAAM,MAAM;EAGpD,OAAO;CACT;CAEA,MAAM,WAAW,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,KAAK;CAC3C,MAAM,UAAU,SAAS,YAAY,GAAG;CAExC,IAAI,UAAU,GACZ,OAAO,SAAS,MAAM,GAAG,OAAO;CAGlC,OAAO;AACT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@udohjeremiah/moniq",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Policy-driven workspace linter for JavaScript/TypeScript monorepos",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
"shell-quote": "^1.9.0",
|
|
48
48
|
"tsdown": "^0.22.4",
|
|
49
49
|
"vitest": "^4.1.10",
|
|
50
|
-
"@moniq/config": "0.0.0",
|
|
51
|
-
"@moniq/typescript-config": "0.0.0",
|
|
52
50
|
"@moniq/cli": "0.0.0",
|
|
53
|
-
"@moniq/
|
|
51
|
+
"@moniq/config": "0.0.0",
|
|
52
|
+
"@moniq/eslint-config": "0.0.0",
|
|
53
|
+
"@moniq/typescript-config": "0.0.0"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
56
|
"dev": "tsdown --watch",
|