@ariestools/toolchain 9.1.2 → 9.2.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/COPYING +674 -0
- package/LICENSE +165 -0
- package/README.md +56 -22
- package/dist/actions/deplint/checkPackage/getUnlistedDependencies.d.ts.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnlistedDevDependencies.d.ts.map +1 -1
- package/dist/actions/deplint/findFiles.d.ts.map +1 -1
- package/dist/actions/deplint/findFilesByGlob.d.ts.map +1 -1
- package/dist/actions/deplint/getBasePackageName.d.ts +8 -0
- package/dist/actions/deplint/getBasePackageName.d.ts.map +1 -1
- package/dist/actions/deplint/packageEditor.d.ts.map +1 -1
- package/dist/actions/deplint/packageJsonEditor.d.ts.map +1 -1
- package/dist/actions/incremental.d.ts.map +1 -1
- package/dist/actions/package/compile/XyConfig.d.ts +3 -3
- package/dist/actions/package/compile/compile.d.ts.map +1 -1
- package/dist/actions/package-lint-specs.d.ts.map +1 -1
- package/dist/actions/publish.d.ts +6 -1
- package/dist/actions/publish.d.ts.map +1 -1
- package/dist/actions/repo-init/index.d.ts +2 -1
- package/dist/actions/repo-init/index.d.ts.map +1 -1
- package/dist/actions/repo-init/resolvePlan.d.ts +1 -0
- package/dist/actions/repo-init/resolvePlan.d.ts.map +1 -1
- package/dist/actions/repo-init/templateVars.d.ts +1 -0
- package/dist/actions/repo-init/templateVars.d.ts.map +1 -1
- package/dist/actions/repo-init/types.d.ts +16 -0
- package/dist/actions/repo-init/types.d.ts.map +1 -1
- package/dist/actions/repo-init.d.ts +1 -1
- package/dist/actions/repo-init.d.ts.map +1 -1
- package/dist/actions/sonar.d.ts +4 -0
- package/dist/actions/sonar.d.ts.map +1 -1
- package/dist/bin/package/build.mjs +4 -0
- package/dist/bin/package/build.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +4 -0
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +4 -0
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/bin/xy.mjs +606 -130
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/bin/xyex.d.ts +3 -0
- package/dist/bin/xyex.d.ts.map +1 -0
- package/dist/bin/xyex.mjs +62920 -0
- package/dist/bin/xyex.mjs.map +1 -0
- package/dist/lib/gitCheckoutRoot.d.ts +17 -0
- package/dist/lib/gitCheckoutRoot.d.ts.map +1 -0
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/pm/PackageManager.d.ts +7 -0
- package/dist/pm/PackageManager.d.ts.map +1 -1
- package/dist/pm/bunPackageManager.d.ts +1 -1
- package/dist/pm/bunPackageManager.d.ts.map +1 -1
- package/dist/pm/npmPackageManager.d.ts +1 -1
- package/dist/pm/npmPackageManager.d.ts.map +1 -1
- package/dist/pm/pnpmPackageManager.d.ts.map +1 -1
- package/dist/pm/yarnPackageManager.d.ts +1 -1
- package/dist/pm/yarnPackageManager.d.ts.map +1 -1
- package/dist/xy/build/index.d.ts +5 -1
- package/dist/xy/build/index.d.ts.map +1 -1
- package/dist/xy/common/index.d.ts +10 -1
- package/dist/xy/common/index.d.ts.map +1 -1
- package/dist/xy/common/packmanCommand.d.ts +7 -0
- package/dist/xy/common/packmanCommand.d.ts.map +1 -1
- package/dist/xy/common/repo/initCommand.d.ts.map +1 -1
- package/dist/xy/deploy/publishCommand.d.ts.map +1 -1
- package/dist/xy/experimentalCommand.d.ts +11 -0
- package/dist/xy/experimentalCommand.d.ts.map +1 -0
- package/dist/xy/index.d.ts +3 -0
- package/dist/xy/index.d.ts.map +1 -1
- package/dist/xy/lint/index.d.ts +5 -1
- package/dist/xy/lint/index.d.ts.map +1 -1
- package/dist/xy/react/index.d.ts +5 -1
- package/dist/xy/react/index.d.ts.map +1 -1
- package/dist/xy/stability.d.ts +94 -0
- package/dist/xy/stability.d.ts.map +1 -0
- package/dist/xy/stabilityCatalog.d.ts +30 -0
- package/dist/xy/stabilityCatalog.d.ts.map +1 -0
- package/dist/xy/xy.d.ts +19 -1
- package/dist/xy/xy.d.ts.map +1 -1
- package/dist/xy/xyParseOptions.d.ts +6 -1
- package/dist/xy/xyParseOptions.d.ts.map +1 -1
- package/package.json +19 -14
- package/templates/repo/cli/package/package.json.tmpl +7 -7
- package/templates/repo/cli/root/LICENSE.tmpl +1 -0
- package/templates/repo/cli/root/cspell.json.tmpl +1 -1
- package/templates/repo/cli/root/github/workflows/build-bun.yml.tmpl +8 -12
- package/templates/repo/cli/root/github/workflows/build-npm.yml.tmpl +10 -15
- package/templates/repo/cli/root/github/workflows/build-pnpm.yml.tmpl +9 -14
- package/templates/repo/cli/root/github/workflows/build-yarn.yml.tmpl +9 -14
- package/templates/repo/cli/root/package.json.tmpl +10 -9
- package/templates/repo/cli/root/vitest.config.ts.tmpl +3 -29
package/dist/bin/xy.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { builtinModules, createRequire } from "node:module";
|
|
3
|
+
import process$1, { cwd } from "node:process";
|
|
4
|
+
import os, { EOL, availableParallelism } from "node:os";
|
|
5
|
+
import tty from "node:tty";
|
|
3
6
|
import * as xi from "node:fs";
|
|
4
7
|
import fs, { closeSync, copyFileSync, existsSync, lstatSync, mkdirSync, openSync, promises, readFileSync, readSync, readdirSync, readlinkSync, rmSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
5
8
|
import PATH, { basename, delimiter, dirname, normalize, posix, resolve, win32 } from "node:path";
|
|
6
9
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
7
|
-
import process$1, { cwd } from "node:process";
|
|
8
|
-
import os, { EOL, availableParallelism } from "node:os";
|
|
9
|
-
import tty from "node:tty";
|
|
10
10
|
import { AsyncLocalStorage, AsyncResource } from "node:async_hooks";
|
|
11
11
|
import path from "node:path/posix";
|
|
12
12
|
import { lstatSync as lstatSync$1, readFileSync as readFileSync$1, readdir, readdirSync as readdirSync$1, readlinkSync as readlinkSync$1, realpathSync, statSync as statSync$1, writeFile } from "fs";
|
|
@@ -73,54 +73,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
73
73
|
}) : target, mod));
|
|
74
74
|
var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
75
75
|
//#endregion
|
|
76
|
-
//#region src/lib/aliasSpec.ts
|
|
77
|
-
const ALIAS_PREFIX = "npm:";
|
|
78
|
-
/**
|
|
79
|
-
* Splits an `npm:` alias spec into the registry name and the semver range it
|
|
80
|
-
* carries: `npm:typescript@~7.0.2` → `{ registryName: 'typescript', range: '~7.0.2' }`.
|
|
81
|
-
*
|
|
82
|
-
* Aliases exist so two releases of one package can be installed side by side —
|
|
83
|
-
* `typescript` (the compiler API) alongside `npm:typescript@7` (the native
|
|
84
|
-
* compiler). Without this, the declaration key is the only name updo sees, and
|
|
85
|
-
* a key like `typescript-native` is not a real package: the registry lookup
|
|
86
|
-
* 404s and the dependency is silently never updated.
|
|
87
|
-
*
|
|
88
|
-
* Returns undefined for non-alias specs and for alias specs carrying no range
|
|
89
|
-
* (`npm:typescript`), which express no version intent to move.
|
|
90
|
-
*/
|
|
91
|
-
function parseAliasSpec(spec) {
|
|
92
|
-
if (!spec.startsWith(ALIAS_PREFIX)) return void 0;
|
|
93
|
-
const target = spec.slice(4);
|
|
94
|
-
const separator = target.indexOf("@", 1);
|
|
95
|
-
if (separator <= 0 || separator === target.length - 1) return void 0;
|
|
96
|
-
return {
|
|
97
|
-
range: target.slice(separator + 1),
|
|
98
|
-
registryName: target.slice(0, separator)
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Re-wraps a resolved range in its `npm:` alias spec, so an update to an
|
|
103
|
-
* aliased declaration is written back in the form the package manager expects.
|
|
104
|
-
* Non-aliased declarations pass through untouched.
|
|
105
|
-
*/
|
|
106
|
-
function formatDeclaredRange(dep, range) {
|
|
107
|
-
return dep.registryName === dep.name ? range : `${ALIAS_PREFIX}${dep.registryName}@${range}`;
|
|
108
|
-
}
|
|
109
|
-
//#endregion
|
|
110
|
-
//#region src/lib/bundledCliPath.ts
|
|
111
|
-
const require$8 = createRequire(import.meta.url);
|
|
112
|
-
function toolchainPackageRoot() {
|
|
113
|
-
return PATH.dirname(require$8.resolve("@ariestools/toolchain/package.json"));
|
|
114
|
-
}
|
|
115
|
-
function bundledCliPath(name) {
|
|
116
|
-
return PATH.resolve(toolchainPackageRoot(), "dist/bin", name);
|
|
117
|
-
}
|
|
118
|
-
function resolvePublishedOrDevCli(bundledName, devResolve) {
|
|
119
|
-
const bundled = bundledCliPath(bundledName);
|
|
120
|
-
if (existsSync(bundled)) return bundled;
|
|
121
|
-
return devResolve();
|
|
122
|
-
}
|
|
123
|
-
//#endregion
|
|
124
76
|
//#region ../../node_modules/.pnpm/chalk@6.0.0/node_modules/chalk/source/utilities.js
|
|
125
77
|
function stringReplaceAll(string, substring, postfix) {
|
|
126
78
|
let index = string.indexOf(substring);
|
|
@@ -595,6 +547,89 @@ Object.defineProperties(createChalk.prototype, {
|
|
|
595
547
|
const chalk = createChalk();
|
|
596
548
|
createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
597
549
|
//#endregion
|
|
550
|
+
//#region src/xy/experimentalCommand.ts
|
|
551
|
+
function warnExperimentalCommand(commandName) {
|
|
552
|
+
console.warn(chalk.yellow(`Experimental: "xy ${commandName}" is an experimental command. Prefer "xyex ${commandName}" — the xyex surface may change without a major version bump.`));
|
|
553
|
+
}
|
|
554
|
+
function printXyexBanner() {
|
|
555
|
+
console.warn(chalk.magenta("⬡ XYEX — experimental CLI supersets. Commands and flags here may change on minor releases. Prefer `xy` for stable automation."));
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* Wraps a yargs command so the stable `xy` channel warns (and relabels help)
|
|
559
|
+
* while `xyex` exposes it unchanged.
|
|
560
|
+
*/
|
|
561
|
+
function withExperimentalChannel(command, channel, catalogName) {
|
|
562
|
+
const commandName = catalogName ?? (typeof command.command === "string" ? command.command.split(" ", 1)[0] ?? "unknown" : "unknown");
|
|
563
|
+
if (channel === "experimental") return command;
|
|
564
|
+
const describe = typeof command.describe === "string" ? `${command.describe} (experimental — prefer xyex)` : command.describe;
|
|
565
|
+
const originalHandler = command.handler;
|
|
566
|
+
if (originalHandler === void 0) return {
|
|
567
|
+
...command,
|
|
568
|
+
describe
|
|
569
|
+
};
|
|
570
|
+
return {
|
|
571
|
+
...command,
|
|
572
|
+
describe,
|
|
573
|
+
handler: (argv) => {
|
|
574
|
+
warnExperimentalCommand(commandName);
|
|
575
|
+
return originalHandler(argv);
|
|
576
|
+
}
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
function registerExperimentalCommands(args, channel, commands) {
|
|
580
|
+
let next = args;
|
|
581
|
+
for (const command of commands) next = next.command(withExperimentalChannel(command, channel));
|
|
582
|
+
return next;
|
|
583
|
+
}
|
|
584
|
+
//#endregion
|
|
585
|
+
//#region src/lib/aliasSpec.ts
|
|
586
|
+
const ALIAS_PREFIX = "npm:";
|
|
587
|
+
/**
|
|
588
|
+
* Splits an `npm:` alias spec into the registry name and the semver range it
|
|
589
|
+
* carries: `npm:typescript@~7.0.2` → `{ registryName: 'typescript', range: '~7.0.2' }`.
|
|
590
|
+
*
|
|
591
|
+
* Aliases exist so two releases of one package can be installed side by side —
|
|
592
|
+
* `typescript` (the compiler API) alongside `npm:typescript@7` (the native
|
|
593
|
+
* compiler). Without this, the declaration key is the only name updo sees, and
|
|
594
|
+
* a key like `typescript-native` is not a real package: the registry lookup
|
|
595
|
+
* 404s and the dependency is silently never updated.
|
|
596
|
+
*
|
|
597
|
+
* Returns undefined for non-alias specs and for alias specs carrying no range
|
|
598
|
+
* (`npm:typescript`), which express no version intent to move.
|
|
599
|
+
*/
|
|
600
|
+
function parseAliasSpec(spec) {
|
|
601
|
+
if (!spec.startsWith(ALIAS_PREFIX)) return void 0;
|
|
602
|
+
const target = spec.slice(4);
|
|
603
|
+
const separator = target.indexOf("@", 1);
|
|
604
|
+
if (separator <= 0 || separator === target.length - 1) return void 0;
|
|
605
|
+
return {
|
|
606
|
+
range: target.slice(separator + 1),
|
|
607
|
+
registryName: target.slice(0, separator)
|
|
608
|
+
};
|
|
609
|
+
}
|
|
610
|
+
/**
|
|
611
|
+
* Re-wraps a resolved range in its `npm:` alias spec, so an update to an
|
|
612
|
+
* aliased declaration is written back in the form the package manager expects.
|
|
613
|
+
* Non-aliased declarations pass through untouched.
|
|
614
|
+
*/
|
|
615
|
+
function formatDeclaredRange(dep, range) {
|
|
616
|
+
return dep.registryName === dep.name ? range : `${ALIAS_PREFIX}${dep.registryName}@${range}`;
|
|
617
|
+
}
|
|
618
|
+
//#endregion
|
|
619
|
+
//#region src/lib/bundledCliPath.ts
|
|
620
|
+
const require$8 = createRequire(import.meta.url);
|
|
621
|
+
function toolchainPackageRoot() {
|
|
622
|
+
return PATH.dirname(require$8.resolve("@ariestools/toolchain/package.json"));
|
|
623
|
+
}
|
|
624
|
+
function bundledCliPath(name) {
|
|
625
|
+
return PATH.resolve(toolchainPackageRoot(), "dist/bin", name);
|
|
626
|
+
}
|
|
627
|
+
function resolvePublishedOrDevCli(bundledName, devResolve) {
|
|
628
|
+
const bundled = bundledCliPath(bundledName);
|
|
629
|
+
if (existsSync(bundled)) return bundled;
|
|
630
|
+
return devResolve();
|
|
631
|
+
}
|
|
632
|
+
//#endregion
|
|
598
633
|
//#region src/lib/checkResult.ts
|
|
599
634
|
function logFailure(name, result, level, suffix) {
|
|
600
635
|
const message = `${name} had ${result} failures [${suffix}]`;
|
|
@@ -4729,8 +4764,8 @@ var BunPackageManager = class {
|
|
|
4729
4764
|
outdated() {
|
|
4730
4765
|
return ["bun", ["outdated"]];
|
|
4731
4766
|
}
|
|
4732
|
-
publish(
|
|
4733
|
-
return [["bun", ["publish"]]];
|
|
4767
|
+
publish(options = {}) {
|
|
4768
|
+
return [["bun", ["publish", ...options.tag != null && options.tag.length > 0 ? ["--tag", options.tag] : []]]];
|
|
4734
4769
|
}
|
|
4735
4770
|
runInWorkspace(pkg, script, args = []) {
|
|
4736
4771
|
const resolved = this.findWorkspace(pkg)?.name ?? pkg;
|
|
@@ -4896,11 +4931,12 @@ var NpmPackageManager = class {
|
|
|
4896
4931
|
outdated() {
|
|
4897
4932
|
return ["npm", ["outdated", "--workspaces"]];
|
|
4898
4933
|
}
|
|
4899
|
-
publish(
|
|
4934
|
+
publish(options = {}) {
|
|
4900
4935
|
return [["npm", [
|
|
4901
4936
|
"publish",
|
|
4902
4937
|
"--workspaces",
|
|
4903
|
-
"--include-workspace-root=false"
|
|
4938
|
+
"--include-workspace-root=false",
|
|
4939
|
+
...options.tag != null && options.tag.length > 0 ? ["--tag", options.tag] : []
|
|
4904
4940
|
]]];
|
|
4905
4941
|
}
|
|
4906
4942
|
runInWorkspace(pkg, script, args = []) {
|
|
@@ -5045,7 +5081,11 @@ var PnpmPackageManager = class {
|
|
|
5045
5081
|
publish(options = {}) {
|
|
5046
5082
|
const reporterFlags = options.verbose ?? false ? ["--loglevel=debug"] : ["--reporter=append-only"];
|
|
5047
5083
|
const env = { NODE_OPTIONS: "--max-old-space-size=8192" };
|
|
5048
|
-
const baseFlags = [
|
|
5084
|
+
const baseFlags = [
|
|
5085
|
+
"--no-git-checks",
|
|
5086
|
+
...options.tag != null && options.tag.length > 0 ? ["--tag", options.tag] : [],
|
|
5087
|
+
...reporterFlags
|
|
5088
|
+
];
|
|
5049
5089
|
const chunkSize = options.chunkSize ?? 0;
|
|
5050
5090
|
if (chunkSize <= 0) return [[
|
|
5051
5091
|
"pnpm",
|
|
@@ -5196,8 +5236,12 @@ var YarnPackageManager = class {
|
|
|
5196
5236
|
outdated() {
|
|
5197
5237
|
return ["yarn", ["outdated"]];
|
|
5198
5238
|
}
|
|
5199
|
-
publish(
|
|
5200
|
-
return [["npm", [
|
|
5239
|
+
publish(options = {}) {
|
|
5240
|
+
return [["npm", [
|
|
5241
|
+
"publish",
|
|
5242
|
+
"--workspaces",
|
|
5243
|
+
...options.tag != null && options.tag.length > 0 ? ["--tag", options.tag] : []
|
|
5244
|
+
]]];
|
|
5201
5245
|
}
|
|
5202
5246
|
runInWorkspace(pkg, script, args = []) {
|
|
5203
5247
|
const resolved = this.findWorkspace(pkg)?.name ?? pkg;
|
|
@@ -6878,6 +6922,26 @@ const generateIgnoreFiles = (filename, pkg) => {
|
|
|
6878
6922
|
}).every((result) => result === 0) ? 0 : 1;
|
|
6879
6923
|
};
|
|
6880
6924
|
//#endregion
|
|
6925
|
+
//#region src/lib/gitCheckoutRoot.ts
|
|
6926
|
+
/**
|
|
6927
|
+
* Claude Code's per-repo settings/session directory. It holds agent state —
|
|
6928
|
+
* including full Git worktrees under `.claude/worktrees/**` created for
|
|
6929
|
+
* background task sessions — and never holds package source, so file
|
|
6930
|
+
* discovery skips it wholesale.
|
|
6931
|
+
*/
|
|
6932
|
+
const CLAUDE_SETTINGS_DIR = ".claude";
|
|
6933
|
+
/**
|
|
6934
|
+
* True when `dir` is the root of its own Git checkout: a linked `git
|
|
6935
|
+
* worktree` (marked by a `.git` file), such as the `.claude/worktrees/**`
|
|
6936
|
+
* checkouts Claude Code creates for background sessions, or a nested clone
|
|
6937
|
+
* (marked by a `.git` directory). Files inside such a tree belong to that
|
|
6938
|
+
* checkout — file discovery for an enclosing package must never attribute
|
|
6939
|
+
* them to the package being scanned.
|
|
6940
|
+
*/
|
|
6941
|
+
function isGitCheckoutRoot(dir) {
|
|
6942
|
+
return fs.existsSync(PATH.join(dir, ".git"));
|
|
6943
|
+
}
|
|
6944
|
+
//#endregion
|
|
6881
6945
|
//#region src/lib/gitConfig.ts
|
|
6882
6946
|
/**
|
|
6883
6947
|
* Read a single Git config value via `git config --get <key>`.
|
|
@@ -22821,11 +22885,36 @@ function resolvePeerTargetSections(hasRuntimeSource, peerTargetOrIsTerminal) {
|
|
|
22821
22885
|
//#endregion
|
|
22822
22886
|
//#region src/actions/deplint/findFilesByGlob.ts
|
|
22823
22887
|
init_index_min();
|
|
22824
|
-
|
|
22888
|
+
/**
|
|
22889
|
+
* Wraps the pattern ignores with pruning of nested Git checkouts: any
|
|
22890
|
+
* directory below the scan root that is itself the root of a Git checkout —
|
|
22891
|
+
* a linked worktree such as the `.claude/worktrees/**` checkouts Claude Code
|
|
22892
|
+
* creates for background task sessions, or a nested clone — is a foreign tree
|
|
22893
|
+
* whose files must not be attributed to the package being scanned. Pruning at
|
|
22894
|
+
* the checkout root also keeps the walk from descending into it at all.
|
|
22895
|
+
*/
|
|
22896
|
+
function createIgnore(patterns) {
|
|
22897
|
+
const patternIgnore = new ot(patterns, {});
|
|
22898
|
+
const checkoutRootCache = /* @__PURE__ */ new Map();
|
|
22899
|
+
const isNestedCheckoutRoot = (relative, fullpath) => {
|
|
22900
|
+
if (relative === "") return false;
|
|
22901
|
+
let isCheckoutRoot = checkoutRootCache.get(fullpath);
|
|
22902
|
+
if (isCheckoutRoot === void 0) {
|
|
22903
|
+
isCheckoutRoot = isGitCheckoutRoot(fullpath);
|
|
22904
|
+
checkoutRootCache.set(fullpath, isCheckoutRoot);
|
|
22905
|
+
}
|
|
22906
|
+
return isCheckoutRoot;
|
|
22907
|
+
};
|
|
22908
|
+
return {
|
|
22909
|
+
childrenIgnored: (p) => patternIgnore.childrenIgnored(p) || isNestedCheckoutRoot(p.relative(), p.fullpath()),
|
|
22910
|
+
ignored: (p) => patternIgnore.ignored(p) || p.isDirectory() && isNestedCheckoutRoot(p.relative(), p.fullpath())
|
|
22911
|
+
};
|
|
22912
|
+
}
|
|
22913
|
+
function findFilesByGlob(cwd, pattern, ignore = []) {
|
|
22825
22914
|
return ts$1(pattern, {
|
|
22826
22915
|
cwd,
|
|
22827
22916
|
absolute: true,
|
|
22828
|
-
ignore,
|
|
22917
|
+
ignore: createIgnore(ignore),
|
|
22829
22918
|
nodir: true,
|
|
22830
22919
|
dot: true
|
|
22831
22920
|
});
|
|
@@ -23466,7 +23555,31 @@ function getBasePackageName(importName) {
|
|
|
23466
23555
|
const parts = importNameScrubbed.split("/");
|
|
23467
23556
|
return parts.length >= 2 ? `${parts[0]}/${parts[1]}` : importNameScrubbed;
|
|
23468
23557
|
}
|
|
23469
|
-
return importNameScrubbed.split("/", 1)[0];
|
|
23558
|
+
return importNameScrubbed.split("/", 1)[0] ?? "";
|
|
23559
|
+
}
|
|
23560
|
+
/**
|
|
23561
|
+
* npm package names that are safe as package.json dependency keys.
|
|
23562
|
+
* Rejects empty strings, `@scope` without a package, path-like leftovers
|
|
23563
|
+
* (`/foo`), and other names the registry would not accept.
|
|
23564
|
+
*/
|
|
23565
|
+
function isValidNpmDependencyName(name) {
|
|
23566
|
+
if (name.length === 0 || name.length > 214) return false;
|
|
23567
|
+
if (name.startsWith(".") || name.startsWith("_")) return false;
|
|
23568
|
+
if (name.includes("..") || name.includes("\\") || /\s/.test(name)) return false;
|
|
23569
|
+
if (name.startsWith("@")) {
|
|
23570
|
+
const slash = name.indexOf("/");
|
|
23571
|
+
if (slash <= 1 || slash === name.length - 1) return false;
|
|
23572
|
+
return isUnscopedNpmName(name.slice(1, slash)) && isUnscopedNpmName(name.slice(slash + 1));
|
|
23573
|
+
}
|
|
23574
|
+
return isUnscopedNpmName(name);
|
|
23575
|
+
}
|
|
23576
|
+
function isUnscopedNpmName(name) {
|
|
23577
|
+
return name.length > 0 && /^[\da-z][\w.~-]*$/i.test(name);
|
|
23578
|
+
}
|
|
23579
|
+
/** Package name derived from an import specifier, or undefined if it is not a real npm name. */
|
|
23580
|
+
function packageNameFromImport(importName) {
|
|
23581
|
+
const name = getBasePackageName(importName);
|
|
23582
|
+
return isValidNpmDependencyName(name) ? name : void 0;
|
|
23470
23583
|
}
|
|
23471
23584
|
//#endregion
|
|
23472
23585
|
//#region src/actions/api-exposure/analyzer/couplingWalk.ts
|
|
@@ -24349,8 +24462,8 @@ function getImportsFromFile(filePath, importPaths, typeImportPaths) {
|
|
|
24349
24462
|
"node:"
|
|
24350
24463
|
];
|
|
24351
24464
|
const isValidImport = (imp) => importsStartsWithExcludes.every((exc) => !imp.startsWith(exc)) && !imp.includes("*") && !imp.includes("!");
|
|
24352
|
-
const cleanedImports = imports.filter(isValidImport).map(
|
|
24353
|
-
const cleanedTypeImports = typeImports.filter(isValidImport).map(
|
|
24465
|
+
const cleanedImports = imports.filter(isValidImport).map(packageNameFromImport).filter((name) => name !== void 0);
|
|
24466
|
+
const cleanedTypeImports = typeImports.filter(isValidImport).map(packageNameFromImport).filter((name) => name !== void 0);
|
|
24354
24467
|
for (const imp of cleanedImports) {
|
|
24355
24468
|
importPaths[imp] ??= [];
|
|
24356
24469
|
importPaths[imp].push(filePath);
|
|
@@ -25316,6 +25429,7 @@ const workspaceDependencyFields = [
|
|
|
25316
25429
|
];
|
|
25317
25430
|
const ignoredInputDirs = /* @__PURE__ */ new Set([
|
|
25318
25431
|
".cache",
|
|
25432
|
+
".claude",
|
|
25319
25433
|
".git",
|
|
25320
25434
|
".next",
|
|
25321
25435
|
".turbo",
|
|
@@ -25403,7 +25517,8 @@ function collectFiles(dir, baseDir = dir) {
|
|
|
25403
25517
|
const entries = readdirSync(dir, { withFileTypes: true });
|
|
25404
25518
|
for (const entry of entries) {
|
|
25405
25519
|
if (entry.isDirectory()) {
|
|
25406
|
-
|
|
25520
|
+
const childDir = PATH.join(dir, entry.name);
|
|
25521
|
+
if (!ignoredInputDirs.has(entry.name) && !isGitCheckoutRoot(childDir)) files.push(...collectFiles(childDir, baseDir));
|
|
25407
25522
|
continue;
|
|
25408
25523
|
}
|
|
25409
25524
|
if (!entry.isFile() && !entry.isSymbolicLink()) continue;
|
|
@@ -26964,6 +27079,7 @@ const resolutionExtensions = [
|
|
|
26964
27079
|
".tsx"
|
|
26965
27080
|
];
|
|
26966
27081
|
const dotfileIgnorePatterns = [
|
|
27082
|
+
"**/.claude/**",
|
|
26967
27083
|
"**/.git/**",
|
|
26968
27084
|
"**/.yarn/**",
|
|
26969
27085
|
"**/.pnpm/**",
|
|
@@ -27384,7 +27500,7 @@ function getStorybookConfigImports(filePath, importPaths) {
|
|
|
27384
27500
|
ts.forEachChild(node, visit);
|
|
27385
27501
|
}
|
|
27386
27502
|
visit(sourceFile);
|
|
27387
|
-
const cleaned = [...new Set(collected.map(
|
|
27503
|
+
const cleaned = [...new Set(collected.map(packageNameFromImport).filter((name) => name !== void 0))];
|
|
27388
27504
|
for (const imp of cleaned) {
|
|
27389
27505
|
importPaths[imp] ??= [];
|
|
27390
27506
|
if (!importPaths[imp].includes(filePath)) importPaths[imp].push(filePath);
|
|
@@ -28323,6 +28439,7 @@ function removeDep(pkg, dep, section) {
|
|
|
28323
28439
|
* Add a dependency to a section with a resolved version.
|
|
28324
28440
|
*/
|
|
28325
28441
|
function addDep(pkg, dep, version, section) {
|
|
28442
|
+
if (!isValidNpmDependencyName(dep)) return;
|
|
28326
28443
|
const sectionObj = pkg[section] ?? {};
|
|
28327
28444
|
sectionObj[dep] = version;
|
|
28328
28445
|
pkg[section] = sectionObj;
|
|
@@ -28594,25 +28711,34 @@ function findUnlistedDependencies(name, dependencies, devDependencies, peerDepen
|
|
|
28594
28711
|
...peerDependencies
|
|
28595
28712
|
];
|
|
28596
28713
|
const results = [];
|
|
28597
|
-
for (const imp of externalDistImports)
|
|
28598
|
-
imp
|
|
28599
|
-
|
|
28600
|
-
|
|
28601
|
-
|
|
28602
|
-
|
|
28603
|
-
|
|
28604
|
-
|
|
28714
|
+
for (const imp of externalDistImports) {
|
|
28715
|
+
if (!isValidNpmDependencyName(imp)) continue;
|
|
28716
|
+
if (!isRuntimeImportListed(imp, name, dependencies, peerDependencies) && !isSatisfiedByTsScriptsVariant(imp, allDeps)) results.push({
|
|
28717
|
+
imp,
|
|
28718
|
+
section: "dependencies"
|
|
28719
|
+
});
|
|
28720
|
+
}
|
|
28721
|
+
for (const imp of externalDistTypeImports) {
|
|
28722
|
+
if (!isValidNpmDependencyName(imp)) continue;
|
|
28723
|
+
if (!isDistTypeImportListed(imp, name, dependencies, devDependencies, peerDependencies) && !isSatisfiedByTsScriptsVariant(imp, allDeps)) results.push({
|
|
28724
|
+
imp,
|
|
28725
|
+
section: "dependencies"
|
|
28726
|
+
});
|
|
28727
|
+
}
|
|
28605
28728
|
return results;
|
|
28606
28729
|
}
|
|
28607
28730
|
//#endregion
|
|
28608
28731
|
//#region src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
|
|
28609
28732
|
function findUnlistedDevDeps(name, dependencies, devDependencies, peerDependencies, externalAllImports, distImports, externalDistTypeImports) {
|
|
28610
28733
|
const results = [];
|
|
28611
|
-
for (const imp of externalAllImports)
|
|
28612
|
-
|
|
28613
|
-
|
|
28614
|
-
|
|
28615
|
-
|
|
28734
|
+
for (const imp of externalAllImports) {
|
|
28735
|
+
if (!isValidNpmDependencyName(imp)) continue;
|
|
28736
|
+
if (imp !== name && !distImports.includes(imp) && !externalDistTypeImports.includes(imp) && !dependencies.includes(imp) && !dependencies.includes(`@types/${imp}`) && !peerDependencies.includes(imp) && !peerDependencies.includes(`@types/${imp}`) && !devDependencies.includes(imp) && !devDependencies.includes(`@types/${imp}`) && !builtinModules.includes(imp) && !isSatisfiedByTsScriptsVariant(imp, [
|
|
28737
|
+
...dependencies,
|
|
28738
|
+
...devDependencies,
|
|
28739
|
+
...peerDependencies
|
|
28740
|
+
])) results.push(imp);
|
|
28741
|
+
}
|
|
28616
28742
|
return results;
|
|
28617
28743
|
}
|
|
28618
28744
|
//#endregion
|
|
@@ -30556,6 +30682,7 @@ var DeplintPackageEditor = class {
|
|
|
30556
30682
|
const before = JSON.stringify(this.pkg);
|
|
30557
30683
|
switch (fix.action) {
|
|
30558
30684
|
case "add":
|
|
30685
|
+
if (!isValidNpmDependencyName(fix.dependency)) break;
|
|
30559
30686
|
addDep(this.pkg, fix.dependency, fix.version, fix.section);
|
|
30560
30687
|
if (fix.section === "peerDependencies") setPeerOptional(this.pkg, fix.dependency, fix.optional);
|
|
30561
30688
|
break;
|
|
@@ -43222,13 +43349,15 @@ function emptyResult$1() {
|
|
|
43222
43349
|
const SKIP_DIRS = /* @__PURE__ */ new Set([
|
|
43223
43350
|
"node_modules",
|
|
43224
43351
|
"dist",
|
|
43225
|
-
"build"
|
|
43352
|
+
"build",
|
|
43353
|
+
".git",
|
|
43354
|
+
CLAUDE_SETTINGS_DIR
|
|
43226
43355
|
]);
|
|
43227
43356
|
function collectSpecFiles(dir, out) {
|
|
43228
43357
|
for (const entry of readdirSync(dir)) {
|
|
43229
43358
|
const fullPath = PATH.join(dir, entry);
|
|
43230
43359
|
if (statSync(fullPath).isDirectory()) {
|
|
43231
|
-
if (SKIP_DIRS.has(entry)) continue;
|
|
43360
|
+
if (SKIP_DIRS.has(entry) || isGitCheckoutRoot(fullPath)) continue;
|
|
43232
43361
|
collectSpecFiles(fullPath, out);
|
|
43233
43362
|
continue;
|
|
43234
43363
|
}
|
|
@@ -44732,12 +44861,14 @@ function didEnsureAuthenticatedWith(command) {
|
|
|
44732
44861
|
function didEnsurePublishAuthenticated(pmName = detectPackageManager$1()) {
|
|
44733
44862
|
return didEnsureAuthenticatedWith(publishAuthCommand(pmName));
|
|
44734
44863
|
}
|
|
44735
|
-
const publish = ({ chunkSize = 0, isVerbose = false } = {}) => {
|
|
44864
|
+
const publish = ({ chunkSize = 0, isVerbose = false, tag } = {}) => {
|
|
44736
44865
|
if (!didEnsurePublishAuthenticated()) return 1;
|
|
44737
44866
|
const pm = getPackageManager();
|
|
44738
44867
|
if (chunkSize > 0 && !CHUNK_SUPPORTING_PMS.has(pm.name)) console.warn(chalk.yellow(`Publish: --chunk-size=${chunkSize} is ignored by ${pm.name} (only pnpm supports chunking today); publishing in a single call.`));
|
|
44868
|
+
if (tag != null && tag.length > 0) console.log(chalk.gray(`Publish: using npm dist-tag "${tag}"`));
|
|
44739
44869
|
const steps = pm.publish({
|
|
44740
44870
|
chunkSize,
|
|
44871
|
+
tag,
|
|
44741
44872
|
verbose: isVerbose
|
|
44742
44873
|
});
|
|
44743
44874
|
if (chunkSize > 0 && steps.length > 1) console.warn(chalk.yellow(`Publish: chunking enabled (chunkSize=${chunkSize}, ${steps.length} chunks). Each chunk is a fresh package-manager process — if your registry requires interactive 2FA per publish, expect one auth prompt per chunk.`));
|
|
@@ -44911,6 +45042,7 @@ function printSummary(plan) {
|
|
|
44911
45042
|
console.log(chalk.gray(` template: ${plan.template}`));
|
|
44912
45043
|
console.log(chalk.gray(` package: ${plan.packageName}`));
|
|
44913
45044
|
console.log(chalk.gray(` scope: ${plan.scope || "(none)"}`));
|
|
45045
|
+
console.log(chalk.gray(` license: ${plan.license}`));
|
|
44914
45046
|
console.log(chalk.gray(` pm: ${plan.pm}`));
|
|
44915
45047
|
console.log(chalk.gray(` monorepo: ${String(plan.monorepo)}`));
|
|
44916
45048
|
console.log(chalk.gray(` react: ${String(plan.react)}`));
|
|
@@ -44956,10 +45088,22 @@ async function resolvePackageManager(provided, wizard, useDefaults) {
|
|
|
44956
45088
|
if (!wizard || useDefaults) return "pnpm";
|
|
44957
45089
|
return askChoice("Package manager", PMS, "pnpm");
|
|
44958
45090
|
}
|
|
45091
|
+
function normalizeRepoInitScope(raw) {
|
|
45092
|
+
const trimmed = raw.trim();
|
|
45093
|
+
if (trimmed === "none" || trimmed === "-" || trimmed.length === 0) return "";
|
|
45094
|
+
return trimmed.startsWith("@") ? trimmed : `@${trimmed}`;
|
|
45095
|
+
}
|
|
44959
45096
|
async function resolveScope(provided, wizard, useDefaults) {
|
|
44960
|
-
const fallback = provided ?? "@
|
|
45097
|
+
const fallback = normalizeRepoInitScope(provided ?? "@ariestools");
|
|
45098
|
+
if (provided !== void 0 || !wizard || useDefaults) return fallback;
|
|
45099
|
+
const answer = await askQuestion(chalk.cyan(`npm scope [${fallback || "none"}] (none for unscoped): `));
|
|
45100
|
+
if (answer.length === 0) return fallback;
|
|
45101
|
+
return normalizeRepoInitScope(answer);
|
|
45102
|
+
}
|
|
45103
|
+
async function resolveLicense(provided, wizard, useDefaults) {
|
|
45104
|
+
const fallback = provided ?? "MIT";
|
|
44961
45105
|
if (provided !== void 0 || !wizard || useDefaults) return fallback;
|
|
44962
|
-
const answer = await askQuestion(chalk.cyan(`
|
|
45106
|
+
const answer = await askQuestion(chalk.cyan(`License [${fallback}]: `));
|
|
44963
45107
|
return answer.length > 0 ? answer : fallback;
|
|
44964
45108
|
}
|
|
44965
45109
|
async function resolveDescription(provided, wizard, useDefaults) {
|
|
@@ -44974,7 +45118,7 @@ async function resolveSkillsTier(provided, wizard, useDefaults) {
|
|
|
44974
45118
|
}
|
|
44975
45119
|
return provided;
|
|
44976
45120
|
}
|
|
44977
|
-
if (!wizard || useDefaults) return
|
|
45121
|
+
if (!wizard || useDefaults) return "xy";
|
|
44978
45122
|
return askChoice("Skills tier (agent skills to install)", TIERS, "xy");
|
|
44979
45123
|
}
|
|
44980
45124
|
async function resolveSkillsOptional(provided, skillsTier, wizard, useDefaults) {
|
|
@@ -45008,10 +45152,12 @@ async function resolvePlanOptions(params, wizard, useDefaults) {
|
|
|
45008
45152
|
const react = await resolveWizardBoolean(params.react, "React project (eslint-config-react-flat + tsconfig-react)?", false, wizard, useDefaults);
|
|
45009
45153
|
const scope = await resolveScope(params.scope, wizard, useDefaults);
|
|
45010
45154
|
const description = await resolveDescription(params.description, wizard, useDefaults);
|
|
45155
|
+
const license = await resolveLicense(params.license, wizard, useDefaults);
|
|
45011
45156
|
const skillsTier = await resolveSkillsTier(params.skillsTier, wizard, useDefaults);
|
|
45012
45157
|
if (skillsTier === void 0) return void 0;
|
|
45013
45158
|
return {
|
|
45014
45159
|
description,
|
|
45160
|
+
license,
|
|
45015
45161
|
monorepo,
|
|
45016
45162
|
pm,
|
|
45017
45163
|
react,
|
|
@@ -45022,10 +45168,19 @@ async function resolvePlanOptions(params, wizard, useDefaults) {
|
|
|
45022
45168
|
}
|
|
45023
45169
|
function buildPlan(params, core, options) {
|
|
45024
45170
|
const projectName = PATH.basename(core.name);
|
|
45171
|
+
const githubOrg = params.githubOrg ?? (options.scope.replace(/^@/, "") || projectName);
|
|
45172
|
+
const authorName = params.author ?? "Aries Tools";
|
|
45173
|
+
const authorEmail = params.authorEmail ?? "support@ariestools.ai";
|
|
45174
|
+
const authorUrl = params.authorUrl ?? "https://ariestools.ai";
|
|
45025
45175
|
return {
|
|
45176
|
+
authorEmail,
|
|
45177
|
+
authorName,
|
|
45178
|
+
authorUrl,
|
|
45026
45179
|
description: options.description,
|
|
45027
|
-
githubOrg
|
|
45180
|
+
githubOrg,
|
|
45181
|
+
homepage: params.homepage ?? (githubOrg.length > 0 ? `https://github.com/${githubOrg}/${projectName}` : authorUrl),
|
|
45028
45182
|
isVerbose: params.isVerbose ?? false,
|
|
45183
|
+
license: options.license,
|
|
45029
45184
|
monorepo: options.monorepo,
|
|
45030
45185
|
name: core.name,
|
|
45031
45186
|
packageName: params.packageName ?? projectName,
|
|
@@ -45082,8 +45237,33 @@ function xyCommandForPm(pm) {
|
|
|
45082
45237
|
default: return `${pm} xy`;
|
|
45083
45238
|
}
|
|
45084
45239
|
}
|
|
45240
|
+
function licenseFileContents(license, year, authorName) {
|
|
45241
|
+
if (license === "MIT") return `MIT License
|
|
45242
|
+
|
|
45243
|
+
Copyright (c) ${String(year)} ${authorName}
|
|
45244
|
+
|
|
45245
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
45246
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
45247
|
+
in the Software without restriction, including without limitation the rights
|
|
45248
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
45249
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
45250
|
+
furnished to do so, subject to the following conditions:
|
|
45251
|
+
|
|
45252
|
+
The above copyright notice and this permission notice shall be included in all
|
|
45253
|
+
copies or substantial portions of the Software.
|
|
45254
|
+
|
|
45255
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
45256
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
45257
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
45258
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
45259
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
45260
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
45261
|
+
SOFTWARE.
|
|
45262
|
+
`;
|
|
45263
|
+
return `${license}\n\nCopyright (c) ${String(year)} ${authorName}\n`;
|
|
45264
|
+
}
|
|
45085
45265
|
function buildTemplateVariables(plan) {
|
|
45086
|
-
const { description, githubOrg, monorepo, packageName, pm, projectName, react, scope } = plan;
|
|
45266
|
+
const { authorEmail, authorName, authorUrl, description, githubOrg, homepage, license, monorepo, packageName, pm, projectName, react, scope } = plan;
|
|
45087
45267
|
const identifierName = packageName.replaceAll(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
45088
45268
|
const npmScope = scope.startsWith("@") || scope.length === 0 ? scope : `@${scope}`;
|
|
45089
45269
|
const scopedPackageName = npmScope.length > 0 ? `${npmScope}/${packageName}` : packageName;
|
|
@@ -45094,18 +45274,30 @@ function buildTemplateVariables(plan) {
|
|
|
45094
45274
|
const testInclude = monorepo ? "packages/*/src/spec/**/*.spec.{ts,tsx,mts,cts}" : "src/spec/**/*.spec.{ts,tsx,mts,cts}";
|
|
45095
45275
|
const srcPrefix = monorepo ? `packages/${packageName}/src/` : "src/";
|
|
45096
45276
|
const layoutLabel = monorepo ? "monorepo (pnpm/yarn/npm workspaces)" : "single package";
|
|
45277
|
+
const layoutDescription = monorepo ? `Monorepo for ${projectName} (\`${scopedPackageName}\`). Package sources live under \`packages/${packageName}\`.` : `Single-package repo for ${projectName} (\`${scopedPackageName}\`). Sources live under \`src/\`.`;
|
|
45278
|
+
const packageDirNote = monorepo ? ", never from inside a package directory" : "";
|
|
45279
|
+
const copyrightYear = String((/* @__PURE__ */ new Date()).getFullYear());
|
|
45097
45280
|
return {
|
|
45281
|
+
authorEmail,
|
|
45282
|
+
authorName,
|
|
45283
|
+
authorUrl,
|
|
45284
|
+
copyrightYear,
|
|
45098
45285
|
coverageInclude,
|
|
45099
45286
|
description,
|
|
45100
45287
|
eslintConfigPackage,
|
|
45101
45288
|
githubOrg,
|
|
45289
|
+
homepage,
|
|
45102
45290
|
identifierName,
|
|
45103
|
-
|
|
45291
|
+
keywordPrimary: npmScope.replace(/^@/, "") || "typescript",
|
|
45292
|
+
layoutDescription,
|
|
45104
45293
|
layoutLabel,
|
|
45294
|
+
license,
|
|
45295
|
+
licenseFile: licenseFileContents(license, Number(copyrightYear), authorName),
|
|
45105
45296
|
npmScope,
|
|
45106
|
-
packageDirNote
|
|
45297
|
+
packageDirNote,
|
|
45107
45298
|
packageManager: packageManagerField(pm),
|
|
45108
45299
|
packageName,
|
|
45300
|
+
pmExperimentalNote: pm === "pnpm" ? "" : "# Experimental package manager. pnpm is fully supported.\n",
|
|
45109
45301
|
pmName: pm,
|
|
45110
45302
|
projectName,
|
|
45111
45303
|
rootPackageName,
|
|
@@ -53973,12 +54165,22 @@ const sitemap = () => {
|
|
|
53973
54165
|
};
|
|
53974
54166
|
//#endregion
|
|
53975
54167
|
//#region src/actions/sonar.ts
|
|
54168
|
+
const SONAR_ESLINTRC = "sonar.eslintrc";
|
|
54169
|
+
/**
|
|
54170
|
+
* Quarantined experimental command. The toolchain no longer ships a bundled
|
|
54171
|
+
* SonarJS ESLint config. A local `sonar.eslintrc` is required to run anything.
|
|
54172
|
+
*/
|
|
53976
54173
|
const sonar = () => {
|
|
54174
|
+
if (!existsSync(SONAR_ESLINTRC)) {
|
|
54175
|
+
console.error(chalk.yellow("xy sonar is quarantined: no sonar.eslintrc in the current directory. The toolchain does not ship a bundled SonarJS config. Prefer `xy lint` (ESLint tiers 0–3). This command may be removed."));
|
|
54176
|
+
return 1;
|
|
54177
|
+
}
|
|
54178
|
+
console.warn(chalk.yellow("xy sonar is experimental and may be removed. Prefer `xyex sonar` only if you maintain sonar.eslintrc locally."));
|
|
53977
54179
|
return runSteps("Sonar", [["eslint", [
|
|
53978
54180
|
"-c",
|
|
53979
|
-
|
|
54181
|
+
SONAR_ESLINTRC,
|
|
53980
54182
|
"."
|
|
53981
|
-
]]]);
|
|
54183
|
+
]]], false);
|
|
53982
54184
|
};
|
|
53983
54185
|
//#endregion
|
|
53984
54186
|
//#region src/actions/start.ts
|
|
@@ -54961,7 +55163,7 @@ const packagePositionalParam = (yargs) => {
|
|
|
54961
55163
|
//#region src/xy/build/tscValidateCommand.ts
|
|
54962
55164
|
const tscValidateCommand = {
|
|
54963
55165
|
command: "tsc-validate [package]",
|
|
54964
|
-
describe: "TSC Validate - Type-check all packages in one process with a shared source-file cache
|
|
55166
|
+
describe: "TSC Validate - Type-check all packages in one process with a shared source-file cache",
|
|
54965
55167
|
builder: (yargs) => {
|
|
54966
55168
|
return packagePositionalParam(yargs);
|
|
54967
55169
|
},
|
|
@@ -54975,8 +55177,12 @@ const tscValidateCommand = {
|
|
|
54975
55177
|
};
|
|
54976
55178
|
//#endregion
|
|
54977
55179
|
//#region src/xy/build/index.ts
|
|
54978
|
-
const
|
|
54979
|
-
return args.command(buildCommand).command(compileCommand).command(recompileCommand).command(rebuildCommand).command(copyAssetsCommand)
|
|
55180
|
+
const xyBuildStableCommands = (args) => {
|
|
55181
|
+
return args.command(buildCommand).command(compileCommand).command(recompileCommand).command(rebuildCommand).command(copyAssetsCommand);
|
|
55182
|
+
};
|
|
55183
|
+
const buildExperimentalCommands = [tscValidateCommand];
|
|
55184
|
+
const xyBuildExperimentalCommands = (args, channel) => {
|
|
55185
|
+
return registerExperimentalCommands(args, channel, buildExperimentalCommands);
|
|
54980
55186
|
};
|
|
54981
55187
|
//#endregion
|
|
54982
55188
|
//#region src/xy/common/checkCommand.ts
|
|
@@ -55302,14 +55508,20 @@ const lintCommand$3 = {
|
|
|
55302
55508
|
}));
|
|
55303
55509
|
}
|
|
55304
55510
|
};
|
|
55305
|
-
|
|
55306
|
-
|
|
55307
|
-
|
|
55308
|
-
|
|
55309
|
-
|
|
55310
|
-
|
|
55311
|
-
|
|
55312
|
-
|
|
55511
|
+
/**
|
|
55512
|
+
* `packman lint` is stable (used by `xy check`). `convert` and `clean` stay
|
|
55513
|
+
* experimental and warn on the `xy` channel.
|
|
55514
|
+
*/
|
|
55515
|
+
function createPackmanCommand(channel) {
|
|
55516
|
+
return {
|
|
55517
|
+
builder: (yargs) => {
|
|
55518
|
+
return yargs.command(lintCommand$3).command(withExperimentalChannel(cleanCommand$1, channel, "packman clean")).command(withExperimentalChannel(convertCommand, channel, "packman convert")).demandCommand(1, "Please specify a packman subcommand").strictCommands();
|
|
55519
|
+
},
|
|
55520
|
+
command: "packman",
|
|
55521
|
+
describe: "Package manager policy — lint is stable; convert and clean are experimental",
|
|
55522
|
+
handler: () => {}
|
|
55523
|
+
};
|
|
55524
|
+
}
|
|
55313
55525
|
//#endregion
|
|
55314
55526
|
//#region src/xy/common/repo/initCommand.ts
|
|
55315
55527
|
const templates = (() => {
|
|
@@ -55331,7 +55543,22 @@ const initCommand$2 = {
|
|
|
55331
55543
|
describe: "Project name (also used as directory name)",
|
|
55332
55544
|
type: "string"
|
|
55333
55545
|
}).option("scope", {
|
|
55334
|
-
describe: "npm scope for packages (default: @
|
|
55546
|
+
describe: "npm scope for packages (default: @ariestools; \"none\" for unscoped)",
|
|
55547
|
+
type: "string"
|
|
55548
|
+
}).option("license", {
|
|
55549
|
+
describe: "SPDX license for the new repo (default: MIT — not the toolchain LGPL)",
|
|
55550
|
+
type: "string"
|
|
55551
|
+
}).option("author", {
|
|
55552
|
+
describe: "package.json author.name (default: Aries Tools)",
|
|
55553
|
+
type: "string"
|
|
55554
|
+
}).option("author-email", {
|
|
55555
|
+
describe: "package.json author.email",
|
|
55556
|
+
type: "string"
|
|
55557
|
+
}).option("author-url", {
|
|
55558
|
+
describe: "package.json author.url",
|
|
55559
|
+
type: "string"
|
|
55560
|
+
}).option("homepage", {
|
|
55561
|
+
describe: "package.json homepage (default: GitHub URL from --github-org)",
|
|
55335
55562
|
type: "string"
|
|
55336
55563
|
}).option("package", {
|
|
55337
55564
|
describe: "Package name within the monorepo (defaults to project name)",
|
|
@@ -55388,9 +55615,14 @@ const initCommand$2 = {
|
|
|
55388
55615
|
handler: async (argv) => {
|
|
55389
55616
|
if (Boolean(argv.verbose)) console.log("Repo Init");
|
|
55390
55617
|
await withEnvelope("repo init", () => repoInit({
|
|
55618
|
+
author: argv.author,
|
|
55619
|
+
authorEmail: argv["author-email"],
|
|
55620
|
+
authorUrl: argv["author-url"],
|
|
55391
55621
|
description: argv.description,
|
|
55392
55622
|
githubOrg: argv["github-org"],
|
|
55623
|
+
homepage: argv.homepage,
|
|
55393
55624
|
isVerbose: Boolean(argv.verbose),
|
|
55625
|
+
license: argv.license,
|
|
55394
55626
|
monorepo: argv.monorepo,
|
|
55395
55627
|
name: argv.name,
|
|
55396
55628
|
packageName: argv.package,
|
|
@@ -56102,8 +56334,19 @@ const workCommand = {
|
|
|
56102
56334
|
};
|
|
56103
56335
|
//#endregion
|
|
56104
56336
|
//#region src/xy/common/index.ts
|
|
56105
|
-
|
|
56106
|
-
|
|
56337
|
+
/** Stable common commands registered on both `xy` and `xyex`. */
|
|
56338
|
+
const xyCommonStableCommands = (args, channel) => {
|
|
56339
|
+
return args.command(checkCommand).command(licenseCommand).command(gitCommand).command(gitlintCommand).command(gitignoreCommand).command(npmignoreGenCommand).command(createPackmanCommand(channel)).command(repoCommand).command(retestCommand).command(secureCommand).command(skillsCommand).command(testCommand);
|
|
56340
|
+
};
|
|
56341
|
+
const commonExperimentalCommands = [
|
|
56342
|
+
deadCommand,
|
|
56343
|
+
enableCommand,
|
|
56344
|
+
orphanCommand,
|
|
56345
|
+
workCommand
|
|
56346
|
+
];
|
|
56347
|
+
/** Experimental common commands — prefer `xyex`; warn when invoked via `xy`. */
|
|
56348
|
+
const xyCommonExperimentalCommands = (args, channel) => {
|
|
56349
|
+
return registerExperimentalCommands(args, channel, commonExperimentalCommands);
|
|
56107
56350
|
};
|
|
56108
56351
|
//#endregion
|
|
56109
56352
|
//#region src/xy/deploy/deployCommand.ts
|
|
@@ -56137,16 +56380,21 @@ const publishCommand = {
|
|
|
56137
56380
|
default: 0,
|
|
56138
56381
|
describe: "Split the publish into chunks of N workspaces (pnpm only). Each chunk spawns a fresh process; 0 disables chunking. WARNING: with per-publish 2FA, each chunk triggers a fresh auth prompt — prefer heap bump first.",
|
|
56139
56382
|
type: "number"
|
|
56383
|
+
}).option("tag", {
|
|
56384
|
+
describe: "npm dist-tag to publish under (e.g. latest, next, canary). Use next/canary for prereleases so latest stays on stable cuts.",
|
|
56385
|
+
type: "string"
|
|
56140
56386
|
}),
|
|
56141
56387
|
command: "publish",
|
|
56142
56388
|
describe: "Publish - Publish packages to npmjs",
|
|
56143
56389
|
handler: async (argv) => {
|
|
56144
56390
|
const isVerbose = !!Boolean(argv.verbose);
|
|
56145
56391
|
const chunkSize = typeof argv.chunkSize === "number" ? argv.chunkSize : 0;
|
|
56392
|
+
const tag = typeof argv.tag === "string" && argv.tag.length > 0 ? argv.tag : void 0;
|
|
56146
56393
|
if (isVerbose) console.log("Publish packages to npmjs");
|
|
56147
56394
|
await withEnvelope("publish", () => publish({
|
|
56148
56395
|
chunkSize,
|
|
56149
|
-
isVerbose
|
|
56396
|
+
isVerbose,
|
|
56397
|
+
tag
|
|
56150
56398
|
}));
|
|
56151
56399
|
}
|
|
56152
56400
|
};
|
|
@@ -56916,7 +57164,7 @@ const republintCommand = {
|
|
|
56916
57164
|
//#region src/xy/lint/sonarCommand.ts
|
|
56917
57165
|
const sonarCommand = {
|
|
56918
57166
|
command: "sonar",
|
|
56919
|
-
describe: "Sonar -
|
|
57167
|
+
describe: "Sonar - Quarantined experimental check (requires local sonar.eslintrc)",
|
|
56920
57168
|
builder: (yargs) => {
|
|
56921
57169
|
return packagePositionalParam(yargs);
|
|
56922
57170
|
},
|
|
@@ -56927,8 +57175,12 @@ const sonarCommand = {
|
|
|
56927
57175
|
};
|
|
56928
57176
|
//#endregion
|
|
56929
57177
|
//#region src/xy/lint/index.ts
|
|
56930
|
-
const
|
|
56931
|
-
return args.command(apiExposureCommand).command(cycleCommand).command(lintCommand).command(lintlintCommand).command(deplintCommand).command(nodeCommand).command(nodeLintCommand).command(fixCommand).command(relintCommand).command(publintCommand).command(republintCommand)
|
|
57178
|
+
const xyLintStableCommands = (args) => {
|
|
57179
|
+
return args.command(apiExposureCommand).command(cycleCommand).command(lintCommand).command(lintlintCommand).command(deplintCommand).command(nodeCommand).command(nodeLintCommand).command(fixCommand).command(relintCommand).command(publintCommand).command(republintCommand);
|
|
57180
|
+
};
|
|
57181
|
+
const lintExperimentalCommands = [sonarCommand];
|
|
57182
|
+
const xyLintExperimentalCommands = (args, channel) => {
|
|
57183
|
+
return registerExperimentalCommands(args, channel, lintExperimentalCommands);
|
|
56932
57184
|
};
|
|
56933
57185
|
//#endregion
|
|
56934
57186
|
//#region src/xy/react/analyzeCommand.ts
|
|
@@ -57021,9 +57273,194 @@ const startCommand = {
|
|
|
57021
57273
|
};
|
|
57022
57274
|
//#endregion
|
|
57023
57275
|
//#region src/xy/react/index.ts
|
|
57024
|
-
const
|
|
57025
|
-
return args.command(
|
|
57276
|
+
const xyReactStableCommands = (args) => {
|
|
57277
|
+
return args.command(startCommand);
|
|
57026
57278
|
};
|
|
57279
|
+
const reactExperimentalCommands = [
|
|
57280
|
+
analyzeCommand,
|
|
57281
|
+
ejectCommand,
|
|
57282
|
+
sitemapCommand
|
|
57283
|
+
];
|
|
57284
|
+
const xyReactExperimentalCommands = (args, channel) => {
|
|
57285
|
+
return registerExperimentalCommands(args, channel, reactExperimentalCommands);
|
|
57286
|
+
};
|
|
57287
|
+
//#endregion
|
|
57288
|
+
//#region src/xy/stability.ts
|
|
57289
|
+
/**
|
|
57290
|
+
* Command names and their stability tier. Keys are the yargs path users type
|
|
57291
|
+
* (`packman`, `packman convert`). Nested subcommands inherit the parent's
|
|
57292
|
+
* tier unless listed separately.
|
|
57293
|
+
*/
|
|
57294
|
+
const COMMAND_STABILITY = {
|
|
57295
|
+
"build": "stable",
|
|
57296
|
+
"compile": "stable",
|
|
57297
|
+
"recompile": "stable",
|
|
57298
|
+
"rebuild": "stable",
|
|
57299
|
+
"copy-assets": "stable",
|
|
57300
|
+
"tsc-validate": "experimental",
|
|
57301
|
+
"lint": "stable",
|
|
57302
|
+
"lintlint": "deprecated",
|
|
57303
|
+
"fix": "stable",
|
|
57304
|
+
"relint": "deprecated",
|
|
57305
|
+
"deplint": "stable",
|
|
57306
|
+
"node": "stable",
|
|
57307
|
+
"node-lint": "deprecated",
|
|
57308
|
+
"publint": "stable",
|
|
57309
|
+
"republint": "deprecated",
|
|
57310
|
+
"api-exposure": "stable",
|
|
57311
|
+
"cycle": "stable",
|
|
57312
|
+
"sonar": "experimental",
|
|
57313
|
+
"deploy": "stable",
|
|
57314
|
+
"publish": "stable",
|
|
57315
|
+
"clean": "stable",
|
|
57316
|
+
"install": "stable",
|
|
57317
|
+
"reinstall": "stable",
|
|
57318
|
+
"up": "stable",
|
|
57319
|
+
"updo": "stable",
|
|
57320
|
+
"statics": "stable",
|
|
57321
|
+
"check": "stable",
|
|
57322
|
+
"license": "stable",
|
|
57323
|
+
"dead": "experimental",
|
|
57324
|
+
"enable": "experimental",
|
|
57325
|
+
"git": "stable",
|
|
57326
|
+
"gitlint": "deprecated",
|
|
57327
|
+
"gitignore": "stable",
|
|
57328
|
+
"npmignore-gen": "stable",
|
|
57329
|
+
"orphan": "experimental",
|
|
57330
|
+
"packman": "stable",
|
|
57331
|
+
"packman lint": "stable",
|
|
57332
|
+
"packman convert": "experimental",
|
|
57333
|
+
"packman clean": "experimental",
|
|
57334
|
+
"repo": "stable",
|
|
57335
|
+
"retest": "stable",
|
|
57336
|
+
"secure": "stable",
|
|
57337
|
+
"skills": "stable",
|
|
57338
|
+
"test": "stable",
|
|
57339
|
+
"work": "experimental",
|
|
57340
|
+
"start": "stable",
|
|
57341
|
+
"analyze": "experimental",
|
|
57342
|
+
"eject": "experimental",
|
|
57343
|
+
"sitemap": "experimental"
|
|
57344
|
+
};
|
|
57345
|
+
Object.entries(COMMAND_STABILITY).filter(([, stability]) => stability === "experimental").map(([name]) => name);
|
|
57346
|
+
const PACKAGE_STABILITY = {
|
|
57347
|
+
"@ariestools/eslint-config-flat": "stable",
|
|
57348
|
+
"@ariestools/eslint-config-react-flat": "stable",
|
|
57349
|
+
"@ariestools/lib-neutral": "stable-narrow",
|
|
57350
|
+
"@ariestools/toolchain": "stable",
|
|
57351
|
+
"@ariestools/tsconfig": "stable",
|
|
57352
|
+
"@ariestools/tsconfig-dom": "stable",
|
|
57353
|
+
"@ariestools/tsconfig-react": "stable",
|
|
57354
|
+
"@ariestools/vitest-config": "stable"
|
|
57355
|
+
};
|
|
57356
|
+
/**
|
|
57357
|
+
* Config flags and fields that may change on a minor. Stable `xy.config.ts`
|
|
57358
|
+
* fields used by stable commands remain semver-stable.
|
|
57359
|
+
*/
|
|
57360
|
+
const EXPERIMENTAL_CONFIG_SURFACES = [
|
|
57361
|
+
{
|
|
57362
|
+
description: "Shared-host typecheck (`compile.validator: 'shared'`). Same engine as `xyex tsc-validate`. Incompatible with `compile.compiler: 'native'`.",
|
|
57363
|
+
id: "compile.validator.shared",
|
|
57364
|
+
path: "compile.validator"
|
|
57365
|
+
},
|
|
57366
|
+
{
|
|
57367
|
+
description: "Reserved `compile.mode: 'tsc'`. Not wired into packageCompile.",
|
|
57368
|
+
id: "compile.mode.tsc",
|
|
57369
|
+
path: "compile.mode"
|
|
57370
|
+
},
|
|
57371
|
+
{
|
|
57372
|
+
description: "TypeScript 7 (Go) compiler. Enable with `xyex enable ts-native`. This repo may dogfood it; public examples must not require it.",
|
|
57373
|
+
id: "compile.compiler.native",
|
|
57374
|
+
path: "compile.compiler"
|
|
57375
|
+
},
|
|
57376
|
+
{
|
|
57377
|
+
description: "ESLint canary tier. Default remains tier 3. May change on a minor.",
|
|
57378
|
+
id: "eslint.tier.4",
|
|
57379
|
+
path: "recommendedConfig({ tier: 4 })"
|
|
57380
|
+
},
|
|
57381
|
+
{
|
|
57382
|
+
description: "Shared TypeScript ingestion lint mode.",
|
|
57383
|
+
id: "lint.mode.shared-typecheck",
|
|
57384
|
+
path: "xy lint --mode shared-typecheck"
|
|
57385
|
+
},
|
|
57386
|
+
{
|
|
57387
|
+
description: "npm, Yarn, and Bun. pnpm is the supported package manager.",
|
|
57388
|
+
id: "package-manager.non-pnpm",
|
|
57389
|
+
path: "package manager"
|
|
57390
|
+
}
|
|
57391
|
+
];
|
|
57392
|
+
const STABILITY_PROMOTION_RUBRIC = [
|
|
57393
|
+
"Tests in this repo and at least one dogfood consumer beyond this repo",
|
|
57394
|
+
"Flags and xy.config.ts fields documented in xy-toolchain skills",
|
|
57395
|
+
"--json envelope works when the command reports findings",
|
|
57396
|
+
"No known data-loss --fix",
|
|
57397
|
+
"One minor without a breaking rename"
|
|
57398
|
+
];
|
|
57399
|
+
//#endregion
|
|
57400
|
+
//#region src/xy/stabilityCatalog.ts
|
|
57401
|
+
function getStabilityCatalog() {
|
|
57402
|
+
const commands = Object.entries(COMMAND_STABILITY).map(([name, stability]) => ({
|
|
57403
|
+
name,
|
|
57404
|
+
stability
|
|
57405
|
+
})).toSorted((a, b) => a.name.localeCompare(b.name));
|
|
57406
|
+
const packages = Object.entries(PACKAGE_STABILITY).map(([name, stability]) => ({
|
|
57407
|
+
name,
|
|
57408
|
+
stability
|
|
57409
|
+
})).toSorted((a, b) => a.name.localeCompare(b.name));
|
|
57410
|
+
return {
|
|
57411
|
+
commands,
|
|
57412
|
+
experimentalConfig: EXPERIMENTAL_CONFIG_SURFACES,
|
|
57413
|
+
packages,
|
|
57414
|
+
promotion: {
|
|
57415
|
+
experimentalToStable: STABILITY_PROMOTION_RUBRIC,
|
|
57416
|
+
stableToRemoved: "major version, after a changelog warning alias"
|
|
57417
|
+
},
|
|
57418
|
+
schemaVersion: 1
|
|
57419
|
+
};
|
|
57420
|
+
}
|
|
57421
|
+
function stabilityColor(stability) {
|
|
57422
|
+
if (stability === "stable") return "green";
|
|
57423
|
+
if (stability === "experimental" || stability === "stable-narrow") return "yellow";
|
|
57424
|
+
return "gray";
|
|
57425
|
+
}
|
|
57426
|
+
function printNamedTable(title, rows) {
|
|
57427
|
+
console.log(chalk.bold(title));
|
|
57428
|
+
const nameWidth = Math.max(...rows.map((row) => row.name.length), 4);
|
|
57429
|
+
for (const row of rows) {
|
|
57430
|
+
const color = stabilityColor(row.stability);
|
|
57431
|
+
console.log(` ${row.name.padEnd(nameWidth)} ${chalk[color](row.stability)}`);
|
|
57432
|
+
}
|
|
57433
|
+
console.log();
|
|
57434
|
+
}
|
|
57435
|
+
function renderStabilityCatalog(catalog) {
|
|
57436
|
+
console.log(chalk.bold("XY Stability"));
|
|
57437
|
+
console.log(chalk.gray("xy is semver-stable. xyex may change on a minor. See docs/STABILITY.md."));
|
|
57438
|
+
console.log();
|
|
57439
|
+
printNamedTable("Commands", catalog.commands);
|
|
57440
|
+
printNamedTable("Packages", catalog.packages);
|
|
57441
|
+
console.log(chalk.bold("Experimental config"));
|
|
57442
|
+
const idWidth = Math.max(...catalog.experimentalConfig.map((entry) => entry.id.length), 4);
|
|
57443
|
+
for (const entry of catalog.experimentalConfig) {
|
|
57444
|
+
console.log(` ${entry.id.padEnd(idWidth)} ${chalk.gray(entry.path)}`);
|
|
57445
|
+
console.log(` ${entry.description}`);
|
|
57446
|
+
}
|
|
57447
|
+
console.log();
|
|
57448
|
+
console.log(chalk.bold("Promotion (experimental → stable)"));
|
|
57449
|
+
for (const item of catalog.promotion.experimentalToStable) console.log(` - ${item}`);
|
|
57450
|
+
console.log(chalk.gray(` Removal of a stable command: ${catalog.promotion.stableToRemoved}`));
|
|
57451
|
+
}
|
|
57452
|
+
function stabilityCatalogResult() {
|
|
57453
|
+
const catalog = getStabilityCatalog();
|
|
57454
|
+
if (!isJsonMode()) renderStabilityCatalog(catalog);
|
|
57455
|
+
return {
|
|
57456
|
+
envelope: {
|
|
57457
|
+
data: catalog,
|
|
57458
|
+
errorCount: 0,
|
|
57459
|
+
warningCount: 0
|
|
57460
|
+
},
|
|
57461
|
+
exitCode: 0
|
|
57462
|
+
};
|
|
57463
|
+
}
|
|
57027
57464
|
//#endregion
|
|
57028
57465
|
//#region src/xy/packageManagerWarning.ts
|
|
57029
57466
|
function unsupportedPackageManagerWarning(packageManager) {
|
|
@@ -62299,12 +62736,12 @@ function isYargsInstance(y) {
|
|
|
62299
62736
|
const Yargs = YargsFactory(esm_default);
|
|
62300
62737
|
//#endregion
|
|
62301
62738
|
//#region src/xy/xyParseOptions.ts
|
|
62302
|
-
function scriptNameForPackageManager() {
|
|
62739
|
+
function scriptNameForPackageManager(binName) {
|
|
62303
62740
|
switch (detectPackageManager$1()) {
|
|
62304
|
-
case "bun": return
|
|
62305
|
-
case "npm": return
|
|
62306
|
-
case "pnpm": return
|
|
62307
|
-
default: return
|
|
62741
|
+
case "bun": return `bun run ${binName}`;
|
|
62742
|
+
case "npm": return `npm exec -- ${binName}`;
|
|
62743
|
+
case "pnpm": return `pnpm ${binName}`;
|
|
62744
|
+
default: return `yarn ${binName}`;
|
|
62308
62745
|
}
|
|
62309
62746
|
}
|
|
62310
62747
|
function formatDuration(ms) {
|
|
@@ -62312,9 +62749,12 @@ function formatDuration(ms) {
|
|
|
62312
62749
|
if (ms < 6e4) return `${(ms / 1e3).toFixed(2)}s`;
|
|
62313
62750
|
return `${Math.floor(ms / 6e4)}m ${(ms % 6e4 / 1e3).toFixed(1)}s`;
|
|
62314
62751
|
}
|
|
62315
|
-
const xyParseOptions = () => {
|
|
62752
|
+
const xyParseOptions = (config = {}) => {
|
|
62316
62753
|
let isTimerRegistered = false;
|
|
62317
|
-
|
|
62754
|
+
const channel = config.channel ?? "stable";
|
|
62755
|
+
const binName = channel === "experimental" ? "xyex" : "xy";
|
|
62756
|
+
const brand = channel === "experimental" ? "XYEX" : "XY";
|
|
62757
|
+
return Yargs(hideBin(process.argv)).scriptName(config.scriptName ?? process.env.SCRIPT_NAME ?? scriptNameForPackageManager(binName)).middleware((argv) => {
|
|
62318
62758
|
if (Boolean(argv.json)) setJsonMode(true);
|
|
62319
62759
|
if (Boolean(argv.strict) || process.env.XY_STRICT === "1") setStrictMode(true);
|
|
62320
62760
|
}, true).middleware((argv) => {
|
|
@@ -62331,7 +62771,7 @@ const xyParseOptions = () => {
|
|
|
62331
62771
|
const commandName = argv._[0];
|
|
62332
62772
|
const jobs = argv.jobs;
|
|
62333
62773
|
const label = commandName != null && commandName.length > 0 ? ` [${chalk.white(commandName)}]` : "";
|
|
62334
|
-
console.log(chalk.blue(
|
|
62774
|
+
console.log(chalk.blue(`⬡ ${brand}`) + label + chalk.gray(` [threads: ${jobs}]`));
|
|
62335
62775
|
const start = Date.now();
|
|
62336
62776
|
process.on("exit", () => {
|
|
62337
62777
|
const whiteCommand = commandName != null && commandName.length > 0 ? chalk.white(commandName) : void 0;
|
|
@@ -62366,6 +62806,10 @@ const xyParseOptions = () => {
|
|
|
62366
62806
|
default: false,
|
|
62367
62807
|
description: "List supported rules and their effective levels",
|
|
62368
62808
|
type: "boolean"
|
|
62809
|
+
}).option("stability", {
|
|
62810
|
+
default: false,
|
|
62811
|
+
description: "List command, package, and experimental config stability",
|
|
62812
|
+
type: "boolean"
|
|
62369
62813
|
}).option("no-defer", {
|
|
62370
62814
|
default: false,
|
|
62371
62815
|
description: "Do not defer to local package.json script of the same name",
|
|
@@ -62387,8 +62831,8 @@ function registerPackageManagers() {
|
|
|
62387
62831
|
function isTruthyLongFlag(arg, flag) {
|
|
62388
62832
|
return arg === flag || arg === `${flag}=true`;
|
|
62389
62833
|
}
|
|
62390
|
-
function
|
|
62391
|
-
if (raw.every((arg) => !isTruthyLongFlag(arg,
|
|
62834
|
+
function isRootLongFlagRequest(flag, raw = process.argv.slice(2)) {
|
|
62835
|
+
if (raw.every((arg) => !isTruthyLongFlag(arg, flag))) return false;
|
|
62392
62836
|
for (let i = 0; i < raw.length; i++) {
|
|
62393
62837
|
const arg = raw[i];
|
|
62394
62838
|
if (arg === "--jobs" || arg === "-j") {
|
|
@@ -62399,17 +62843,41 @@ function isRootRulesRequest(raw = process.argv.slice(2)) {
|
|
|
62399
62843
|
}
|
|
62400
62844
|
return true;
|
|
62401
62845
|
}
|
|
62402
|
-
|
|
62846
|
+
function isRootRulesRequest(raw = process.argv.slice(2)) {
|
|
62847
|
+
return isRootLongFlagRequest("--rules", raw);
|
|
62848
|
+
}
|
|
62849
|
+
function isRootStabilityRequest(raw = process.argv.slice(2)) {
|
|
62850
|
+
return isRootLongFlagRequest("--stability", raw);
|
|
62851
|
+
}
|
|
62852
|
+
function registerCoreCommands(args, channel) {
|
|
62853
|
+
let next = xyLintStableCommands(args);
|
|
62854
|
+
next = xyLintExperimentalCommands(next, channel);
|
|
62855
|
+
next = xyCommonStableCommands(next, channel);
|
|
62856
|
+
next = xyCommonExperimentalCommands(next, channel);
|
|
62857
|
+
next = xyBuildStableCommands(next);
|
|
62858
|
+
next = xyBuildExperimentalCommands(next, channel);
|
|
62859
|
+
return next;
|
|
62860
|
+
}
|
|
62861
|
+
const xyBase = async (options = {}) => {
|
|
62862
|
+
const channel = options.channel ?? "stable";
|
|
62403
62863
|
registerPackageManagers();
|
|
62404
62864
|
warnIfUnsupportedPackageManager();
|
|
62405
|
-
if (
|
|
62865
|
+
if (channel === "experimental") printXyexBanner();
|
|
62866
|
+
if (isRootStabilityRequest() || isRootRulesRequest()) {
|
|
62406
62867
|
if (process.argv.some((arg) => isTruthyLongFlag(arg, "--json"))) setJsonMode(true);
|
|
62868
|
+
if (isRootStabilityRequest()) {
|
|
62869
|
+
await withEnvelope("stability", () => stabilityCatalogResult());
|
|
62870
|
+
return;
|
|
62871
|
+
}
|
|
62407
62872
|
await withEnvelope("rules", async () => ruleCatalogResult(await getMasterRuleCatalog(), ROOT_RULES_TITLE));
|
|
62408
62873
|
return;
|
|
62409
62874
|
}
|
|
62410
|
-
|
|
62411
|
-
|
|
62412
|
-
|
|
62875
|
+
let args = registerCoreCommands(xyParseOptions({
|
|
62876
|
+
channel,
|
|
62877
|
+
scriptName: options.scriptName
|
|
62878
|
+
}), channel);
|
|
62879
|
+
if (options.plugins) args = options.plugins(args, channel);
|
|
62880
|
+
const cliLabel = channel === "experimental" ? "xyex" : "xy";
|
|
62413
62881
|
return await args.demandCommand(1).command("*", "", () => {
|
|
62414
62882
|
const cmd = process.argv[2];
|
|
62415
62883
|
if (cmd === void 0) return;
|
|
@@ -62419,14 +62887,22 @@ const xyBase = async (plugins) => {
|
|
|
62419
62887
|
"--version"
|
|
62420
62888
|
].includes(a))) return;
|
|
62421
62889
|
console.error(chalk.yellow(`Command not found [${chalk.magenta(cmd)}]`));
|
|
62422
|
-
console.log(chalk.gray(
|
|
62890
|
+
console.log(chalk.gray(`Try '${cliLabel} --help' for list of commands`));
|
|
62423
62891
|
}).version().help().argv;
|
|
62424
62892
|
};
|
|
62893
|
+
function registerLifecyclePlugins(args, channel) {
|
|
62894
|
+
let result = xyInstallCommands(xyDeployCommands(args));
|
|
62895
|
+
if (isReactProject()) {
|
|
62896
|
+
result = xyReactStableCommands(result);
|
|
62897
|
+
result = xyReactExperimentalCommands(result, channel);
|
|
62898
|
+
}
|
|
62899
|
+
return result;
|
|
62900
|
+
}
|
|
62901
|
+
/** Stable public CLI (`xy`). Experimental commands still run with a migration warning. */
|
|
62425
62902
|
const xy = async () => {
|
|
62426
|
-
return await xyBase(
|
|
62427
|
-
|
|
62428
|
-
|
|
62429
|
-
return result;
|
|
62903
|
+
return await xyBase({
|
|
62904
|
+
channel: "stable",
|
|
62905
|
+
plugins: registerLifecyclePlugins
|
|
62430
62906
|
});
|
|
62431
62907
|
};
|
|
62432
62908
|
//#endregion
|