@ariestools/toolchain 10.0.4 → 10.0.6
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/README.md +1 -1
- package/dist/actions/package/compile/XyConfig.d.ts +11 -0
- package/dist/actions/package/compile/XyConfig.d.ts.map +1 -1
- package/dist/actions/package-lint-docs.d.ts +12 -0
- package/dist/actions/package-lint-docs.d.ts.map +1 -0
- package/dist/actions/package-lint.d.ts.map +1 -1
- package/dist/actions/plan/lint.d.ts.map +1 -1
- package/dist/actions/plan/markdown.d.ts +8 -0
- package/dist/actions/plan/markdown.d.ts.map +1 -0
- package/dist/actions/plan/rootDocs.d.ts +10 -0
- package/dist/actions/plan/rootDocs.d.ts.map +1 -0
- package/dist/actions/plan/templates.d.ts +18 -3
- package/dist/actions/plan/templates.d.ts.map +1 -1
- package/dist/actions/repo-init/scaffold.d.ts.map +1 -1
- package/dist/actions/skills/lint.d.ts.map +1 -1
- package/dist/actions/skills/skillRules.d.ts +14 -1
- package/dist/actions/skills/skillRules.d.ts.map +1 -1
- package/dist/bin/package/build.mjs +2 -2
- package/dist/bin/package/build.mjs.map +1 -1
- package/dist/bin/package/clean.mjs +2 -2
- package/dist/bin/package/clean.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +2 -2
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/publint.mjs +2 -2
- package/dist/bin/package/publint.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +2 -2
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/bin/package/sync-layout.mjs +2 -2
- package/dist/bin/package/sync-layout.mjs.map +1 -1
- package/dist/bin/skills.mjs +126 -67
- package/dist/bin/skills.mjs.map +1 -1
- package/dist/bin/xy.mjs +464 -125
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/bin/xyex.mjs +464 -125
- package/dist/bin/xyex.mjs.map +1 -1
- package/dist/lib/toolchainVersion.d.ts.map +1 -1
- package/dist/lib/updo/applyUpdates.d.ts.map +1 -1
- package/dist/lib/updo/isRegistryDependencySpec.d.ts +8 -0
- package/dist/lib/updo/isRegistryDependencySpec.d.ts.map +1 -0
- package/dist/lib/updo/runUpdo.d.ts.map +1 -1
- package/dist/xy/common/skills/index.d.ts.map +1 -1
- package/package.json +9 -9
- package/templates/repo/cli/package/README.md.tmpl +11 -0
- package/templates/repo/cli/root/AGENTS.md.tmpl +6 -1
- package/templates/repo/cli/root/CLAUDE.md.tmpl +2 -36
- package/templates/repo/cli/root/README.md.tmpl +14 -0
package/dist/bin/xyex.mjs
CHANGED
|
@@ -617,9 +617,9 @@ function formatDeclaredRange(dep, range) {
|
|
|
617
617
|
}
|
|
618
618
|
//#endregion
|
|
619
619
|
//#region src/lib/bundledCliPath.ts
|
|
620
|
-
const require$
|
|
620
|
+
const require$7 = createRequire(import.meta.url);
|
|
621
621
|
function toolchainPackageRoot() {
|
|
622
|
-
return PATH.dirname(require$
|
|
622
|
+
return PATH.dirname(require$7.resolve("@ariestools/toolchain/package.json"));
|
|
623
623
|
}
|
|
624
624
|
function bundledCliPath(name) {
|
|
625
625
|
return PATH.resolve(toolchainPackageRoot(), "dist/bin", name);
|
|
@@ -6861,12 +6861,9 @@ var require_semver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
6861
6861
|
}));
|
|
6862
6862
|
//#endregion
|
|
6863
6863
|
//#region src/lib/toolchainVersion.ts
|
|
6864
|
-
|
|
6864
|
+
createRequire(import.meta.url);
|
|
6865
6865
|
function bundledToolchainVersion() {
|
|
6866
|
-
|
|
6867
|
-
const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
|
|
6868
|
-
if (pkg.version == null || pkg.version.length === 0) throw new Error("Could not read @ariestools/toolchain version");
|
|
6869
|
-
return pkg.version;
|
|
6866
|
+
return "10.0.6";
|
|
6870
6867
|
}
|
|
6871
6868
|
function bundledToolchainRange() {
|
|
6872
6869
|
return `^${bundledToolchainVersion()}`;
|
|
@@ -11808,7 +11805,7 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
11808
11805
|
exports.cosmiconfigSync = cosmiconfigSync;
|
|
11809
11806
|
}));
|
|
11810
11807
|
//#endregion
|
|
11811
|
-
//#region ../../node_modules/.pnpm/cosmiconfig-typescript-loader@6.3.0_@types+node@26.5.
|
|
11808
|
+
//#region ../../node_modules/.pnpm/cosmiconfig-typescript-loader@6.3.0_@types+node@26.5.1_cosmiconfig@10.0.1_typescript@6.0.3/node_modules/cosmiconfig-typescript-loader/dist/esm/typescript-compile-error.mjs
|
|
11812
11809
|
var TypeScriptCompileError = class _TypeScriptCompileError extends Error {
|
|
11813
11810
|
constructor(message) {
|
|
11814
11811
|
super(message);
|
|
@@ -11824,7 +11821,7 @@ ${error.message}`;
|
|
|
11824
11821
|
}
|
|
11825
11822
|
};
|
|
11826
11823
|
//#endregion
|
|
11827
|
-
//#region ../../node_modules/.pnpm/cosmiconfig-typescript-loader@6.3.0_@types+node@26.5.
|
|
11824
|
+
//#region ../../node_modules/.pnpm/cosmiconfig-typescript-loader@6.3.0_@types+node@26.5.1_cosmiconfig@10.0.1_typescript@6.0.3/node_modules/cosmiconfig-typescript-loader/dist/esm/loader.mjs
|
|
11828
11825
|
function TypeScriptLoader(options) {
|
|
11829
11826
|
const loader = createJiti("", {
|
|
11830
11827
|
interopDefault: true,
|
|
@@ -20736,7 +20733,7 @@ const LOCAL_PROTOCOLS = [
|
|
|
20736
20733
|
"link:",
|
|
20737
20734
|
"portal:"
|
|
20738
20735
|
];
|
|
20739
|
-
function readPackageJson$
|
|
20736
|
+
function readPackageJson$11(filePath) {
|
|
20740
20737
|
if (!existsSync(filePath)) return void 0;
|
|
20741
20738
|
try {
|
|
20742
20739
|
return JSON.parse(readFileSync(filePath, "utf8"));
|
|
@@ -20747,7 +20744,7 @@ function readPackageJson$10(filePath) {
|
|
|
20747
20744
|
function collectSecurePackageTargets(cwd, workspaces) {
|
|
20748
20745
|
const targets = [];
|
|
20749
20746
|
const seenLocations = /* @__PURE__ */ new Set();
|
|
20750
|
-
const rootName = readPackageJson$
|
|
20747
|
+
const rootName = readPackageJson$11(PATH.resolve(cwd, "package.json"))?.name;
|
|
20751
20748
|
if (rootName !== void 0 && rootName.length > 0) {
|
|
20752
20749
|
targets.push({
|
|
20753
20750
|
dir: PATH.resolve(cwd),
|
|
@@ -20788,7 +20785,7 @@ function collectExternalDeclaredDeps(deps, depType, target, localPackageNames, d
|
|
|
20788
20785
|
function collectSecureDeclaredDependencies(cwd, targets, localPackageNames) {
|
|
20789
20786
|
const declared = [];
|
|
20790
20787
|
for (const target of targets) {
|
|
20791
|
-
const pkg = readPackageJson$
|
|
20788
|
+
const pkg = readPackageJson$11(PATH.resolve(cwd, target.location, "package.json"));
|
|
20792
20789
|
if (!pkg) continue;
|
|
20793
20790
|
for (const depType of DEP_FIELDS$1) collectExternalDeclaredDeps(pkg[depType], depType, target, localPackageNames, declared);
|
|
20794
20791
|
}
|
|
@@ -21456,6 +21453,20 @@ function tryRunLocalScript(commandName, options = {}) {
|
|
|
21456
21453
|
}).status ?? 1;
|
|
21457
21454
|
}
|
|
21458
21455
|
//#endregion
|
|
21456
|
+
//#region src/lib/updo/isRegistryDependencySpec.ts
|
|
21457
|
+
/**
|
|
21458
|
+
* Registry ranges and tags have no protocol or path. Preserve local, Git,
|
|
21459
|
+
* tarball, catalog, and other indirect references instead of looking up their
|
|
21460
|
+
* declaration names on the registry or replacing them with version ranges.
|
|
21461
|
+
* Supported npm aliases still refer to registry versions.
|
|
21462
|
+
*/
|
|
21463
|
+
function isRegistryDependencySpec(spec) {
|
|
21464
|
+
const normalized = spec.trim();
|
|
21465
|
+
const versionSpec = parseAliasSpec(normalized)?.range ?? normalized;
|
|
21466
|
+
if (versionSpec === "." || versionSpec === ".." || /\.(?:tgz|tar\.gz)$/i.test(versionSpec)) return false;
|
|
21467
|
+
return !/^[a-z][a-z\d+.-]*:/i.test(versionSpec) && !/[/\\]/.test(versionSpec);
|
|
21468
|
+
}
|
|
21469
|
+
//#endregion
|
|
21459
21470
|
//#region src/lib/updo/applyUpdates.ts
|
|
21460
21471
|
function isSimpleRange(range) {
|
|
21461
21472
|
const trimmed = range.trim();
|
|
@@ -21466,6 +21477,7 @@ function shouldApplyToBag(bag, updateMap) {
|
|
|
21466
21477
|
if (!bag) return false;
|
|
21467
21478
|
let isChanged = false;
|
|
21468
21479
|
for (const name of Object.keys(bag)) {
|
|
21480
|
+
if (!isRegistryDependencySpec(bag[name])) continue;
|
|
21469
21481
|
const update = updateMap.get(name);
|
|
21470
21482
|
if (!update) continue;
|
|
21471
21483
|
if (bag[name] !== update.targetRange) {
|
|
@@ -21480,6 +21492,7 @@ function shouldApplyToPeerBag(pkg, updateMap) {
|
|
|
21480
21492
|
if (peer === void 0) return false;
|
|
21481
21493
|
let isChanged = false;
|
|
21482
21494
|
for (const name of Object.keys(peer)) {
|
|
21495
|
+
if (!isRegistryDependencySpec(peer[name])) continue;
|
|
21483
21496
|
const update = updateMap.get(name);
|
|
21484
21497
|
if (!update) continue;
|
|
21485
21498
|
if (pkg.dependencies?.[name] !== void 0) continue;
|
|
@@ -21880,13 +21893,13 @@ async function fetchAllRegistryInfo(packageNames, options = {}) {
|
|
|
21880
21893
|
return await fetchAllRegistryInfoDirect(packageNames, options);
|
|
21881
21894
|
}
|
|
21882
21895
|
//#endregion
|
|
21883
|
-
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.
|
|
21896
|
+
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.3_@types+node@26.5.1/node_modules/@inquirer/core/dist/lib/key.js
|
|
21884
21897
|
const isUpKey = (key, keybindings = []) => key.name === "up" || keybindings.includes("vim") && key.name === "k" || keybindings.includes("emacs") && key.ctrl && key.name === "p";
|
|
21885
21898
|
const isDownKey = (key, keybindings = []) => key.name === "down" || keybindings.includes("vim") && key.name === "j" || keybindings.includes("emacs") && key.ctrl && key.name === "n";
|
|
21886
21899
|
const isSpaceKey = (key) => key.name === "space";
|
|
21887
21900
|
const isEnterKey = (key) => key.name === "enter" || key.name === "return";
|
|
21888
21901
|
//#endregion
|
|
21889
|
-
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.
|
|
21902
|
+
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.3_@types+node@26.5.1/node_modules/@inquirer/core/dist/lib/errors.js
|
|
21890
21903
|
var AbortPromptError = class extends Error {
|
|
21891
21904
|
name = "AbortPromptError";
|
|
21892
21905
|
message = "Prompt was aborted";
|
|
@@ -21909,7 +21922,7 @@ var ValidationError = class extends Error {
|
|
|
21909
21922
|
name = "ValidationError";
|
|
21910
21923
|
};
|
|
21911
21924
|
//#endregion
|
|
21912
|
-
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.
|
|
21925
|
+
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.3_@types+node@26.5.1/node_modules/@inquirer/core/dist/lib/hook-engine.js
|
|
21913
21926
|
const hookStorage = new AsyncLocalStorage();
|
|
21914
21927
|
function createStore(rl) {
|
|
21915
21928
|
return {
|
|
@@ -22005,7 +22018,7 @@ const effectScheduler = {
|
|
|
22005
22018
|
}
|
|
22006
22019
|
};
|
|
22007
22020
|
//#endregion
|
|
22008
|
-
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.
|
|
22021
|
+
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.3_@types+node@26.5.1/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
22009
22022
|
function isFactory(value) {
|
|
22010
22023
|
return typeof value === "function";
|
|
22011
22024
|
}
|
|
@@ -22029,7 +22042,7 @@ function useState(defaultValue) {
|
|
|
22029
22042
|
});
|
|
22030
22043
|
}
|
|
22031
22044
|
//#endregion
|
|
22032
|
-
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.
|
|
22045
|
+
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.3_@types+node@26.5.1/node_modules/@inquirer/core/dist/lib/use-effect.js
|
|
22033
22046
|
function useEffect(cb, depArray) {
|
|
22034
22047
|
withPointer((pointer) => {
|
|
22035
22048
|
const oldDeps = pointer.get();
|
|
@@ -22038,12 +22051,12 @@ function useEffect(cb, depArray) {
|
|
|
22038
22051
|
});
|
|
22039
22052
|
}
|
|
22040
22053
|
//#endregion
|
|
22041
|
-
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.
|
|
22054
|
+
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.3_@types+node@26.5.1/node_modules/@inquirer/core/dist/lib/use-ref.js
|
|
22042
22055
|
function useRef(val) {
|
|
22043
22056
|
return useState({ current: val })[0];
|
|
22044
22057
|
}
|
|
22045
22058
|
//#endregion
|
|
22046
|
-
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.
|
|
22059
|
+
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.3_@types+node@26.5.1/node_modules/@inquirer/core/dist/lib/use-keypress.js
|
|
22047
22060
|
function useKeypress(userHandler) {
|
|
22048
22061
|
const signal = useRef(userHandler);
|
|
22049
22062
|
signal.current = userHandler;
|
|
@@ -22371,7 +22384,7 @@ function wrapAnsi$1(string, columns, options) {
|
|
|
22371
22384
|
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec$2(line, columns, options)).join("\n");
|
|
22372
22385
|
}
|
|
22373
22386
|
//#endregion
|
|
22374
|
-
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.
|
|
22387
|
+
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.3_@types+node@26.5.1/node_modules/@inquirer/core/dist/lib/utils.js
|
|
22375
22388
|
var import_cli_width = /* @__PURE__ */ __toESM(require_cli_width(), 1);
|
|
22376
22389
|
/**
|
|
22377
22390
|
* Force line returns at specific width. This function is ANSI code friendly and it'll
|
|
@@ -22711,7 +22724,7 @@ const eraseLine = "\x1B[2K";
|
|
|
22711
22724
|
/** Erase the specified number of lines above the cursor */
|
|
22712
22725
|
const eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + "\x1B[2K\x1B[G" : "";
|
|
22713
22726
|
//#endregion
|
|
22714
|
-
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.
|
|
22727
|
+
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.3_@types+node@26.5.1/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
22715
22728
|
const height = (content) => content.split("\n").length;
|
|
22716
22729
|
const lastLine = (content) => content.split("\n").pop() ?? "";
|
|
22717
22730
|
var ScreenManager = class {
|
|
@@ -22768,7 +22781,7 @@ var ScreenManager = class {
|
|
|
22768
22781
|
}
|
|
22769
22782
|
};
|
|
22770
22783
|
//#endregion
|
|
22771
|
-
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.
|
|
22784
|
+
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.3_@types+node@26.5.1/node_modules/@inquirer/core/dist/lib/promise-polyfill.js
|
|
22772
22785
|
var PromisePolyfill = class extends Promise {
|
|
22773
22786
|
static withResolver() {
|
|
22774
22787
|
let resolve;
|
|
@@ -22784,9 +22797,21 @@ var PromisePolyfill = class extends Promise {
|
|
|
22784
22797
|
}
|
|
22785
22798
|
};
|
|
22786
22799
|
//#endregion
|
|
22787
|
-
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.
|
|
22800
|
+
//#region ../../node_modules/.pnpm/@inquirer+core@12.0.3_@types+node@26.5.1/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
22788
22801
|
var import_lib = /* @__PURE__ */ __toESM(require_lib(), 1);
|
|
22789
22802
|
const nativeSetImmediate = globalThis.setImmediate;
|
|
22803
|
+
/**
|
|
22804
|
+
* Register an event listener and return its disposer, so registrations collapse
|
|
22805
|
+
* into a single statement: `cleanups.add(listenTo(rl, 'close', handler))`.
|
|
22806
|
+
*/
|
|
22807
|
+
function listenTo(target, event, listener) {
|
|
22808
|
+
if ("on" in target) {
|
|
22809
|
+
target.on(event, listener);
|
|
22810
|
+
return () => target.removeListener(event, listener);
|
|
22811
|
+
}
|
|
22812
|
+
target.addEventListener(event, listener);
|
|
22813
|
+
return () => target.removeEventListener(event, listener);
|
|
22814
|
+
}
|
|
22790
22815
|
function getCallSites() {
|
|
22791
22816
|
const savedPrepareStackTrace = Error.prepareStackTrace;
|
|
22792
22817
|
let result = [];
|
|
@@ -22818,36 +22843,44 @@ function createPrompt(view) {
|
|
|
22818
22843
|
output.mute();
|
|
22819
22844
|
const screen = new ScreenManager(rl);
|
|
22820
22845
|
const { promise, resolve, reject } = PromisePolyfill.withResolver();
|
|
22821
|
-
const cancel = () => reject(new CancelPromptError());
|
|
22822
|
-
if (signal) {
|
|
22823
|
-
const abort = () => reject(new AbortPromptError({ cause: signal.reason }));
|
|
22824
|
-
if (signal.aborted) {
|
|
22825
|
-
abort();
|
|
22826
|
-
return Object.assign(promise, { cancel });
|
|
22827
|
-
}
|
|
22828
|
-
signal.addEventListener("abort", abort);
|
|
22829
|
-
cleanups.add(() => signal.removeEventListener("abort", abort));
|
|
22830
|
-
}
|
|
22831
|
-
cleanups.add(onExit((code, signal) => {
|
|
22832
|
-
reject(new ExitPromptError(`User force closed the prompt with ${code} ${signal}`));
|
|
22833
|
-
}));
|
|
22834
|
-
const sigint = () => reject(new ExitPromptError(`User force closed the prompt with SIGINT`));
|
|
22835
|
-
rl.on("SIGINT", sigint);
|
|
22836
|
-
cleanups.add(() => rl.removeListener("SIGINT", sigint));
|
|
22837
22846
|
return withHooks(rl, (cycle) => {
|
|
22838
|
-
const
|
|
22839
|
-
|
|
22840
|
-
|
|
22847
|
+
const clearEffects = AsyncResource.bind(() => effectScheduler.clearAll());
|
|
22848
|
+
const settlePrompt = (settle) => {
|
|
22849
|
+
try {
|
|
22850
|
+
clearEffects();
|
|
22851
|
+
settle();
|
|
22852
|
+
} catch (error) {
|
|
22853
|
+
reject(error);
|
|
22854
|
+
}
|
|
22855
|
+
};
|
|
22856
|
+
const resolvePrompt = (value) => settlePrompt(() => resolve(value));
|
|
22857
|
+
const rejectPrompt = (error) => settlePrompt(() => reject(error));
|
|
22858
|
+
const promptPromise = Object.assign(promise.finally(() => {
|
|
22859
|
+
cleanups.forEach((cleanup) => cleanup());
|
|
22860
|
+
screen.done({ clearContent: Boolean(context.clearPromptOnDone) });
|
|
22861
|
+
output.end();
|
|
22862
|
+
}).then(() => promise), { cancel: () => rejectPrompt(new CancelPromptError()) });
|
|
22863
|
+
if (signal) {
|
|
22864
|
+
const abort = () => rejectPrompt(new AbortPromptError({ cause: signal.reason }));
|
|
22865
|
+
if (signal.aborted) {
|
|
22866
|
+
abort();
|
|
22867
|
+
return promptPromise;
|
|
22868
|
+
}
|
|
22869
|
+
cleanups.add(listenTo(signal, "abort", abort));
|
|
22870
|
+
}
|
|
22871
|
+
cleanups.add(onExit((code, signal) => {
|
|
22872
|
+
rejectPrompt(new ExitPromptError(`User force closed the prompt with ${code} ${signal}`));
|
|
22873
|
+
}));
|
|
22874
|
+
cleanups.add(listenTo(rl, "SIGINT", () => rejectPrompt(new ExitPromptError(`User force closed the prompt with SIGINT`))));
|
|
22875
|
+
cleanups.add(listenTo(rl, "close", clearEffects));
|
|
22841
22876
|
const startCycle = () => {
|
|
22842
|
-
|
|
22843
|
-
rl.input.on("keypress", checkCursorPos);
|
|
22844
|
-
cleanups.add(() => rl.input.removeListener("keypress", checkCursorPos));
|
|
22877
|
+
cleanups.add(listenTo(rl.input, "keypress", () => screen.checkCursorPos()));
|
|
22845
22878
|
let pendingDone = null;
|
|
22846
22879
|
cycle(() => {
|
|
22847
22880
|
let effectsSettled = false;
|
|
22848
22881
|
try {
|
|
22849
22882
|
const nextView = view(config, (value) => {
|
|
22850
|
-
if (effectsSettled)
|
|
22883
|
+
if (effectsSettled) resolvePrompt(value);
|
|
22851
22884
|
else pendingDone = { value };
|
|
22852
22885
|
});
|
|
22853
22886
|
if (nextView === void 0) {
|
|
@@ -22859,29 +22892,19 @@ function createPrompt(view) {
|
|
|
22859
22892
|
screen.render(content, bottomContent);
|
|
22860
22893
|
effectScheduler.run();
|
|
22861
22894
|
} catch (error) {
|
|
22862
|
-
|
|
22895
|
+
rejectPrompt(error);
|
|
22863
22896
|
}
|
|
22864
22897
|
effectsSettled = true;
|
|
22865
22898
|
if (pendingDone !== null) {
|
|
22866
22899
|
const { value } = pendingDone;
|
|
22867
22900
|
pendingDone = null;
|
|
22868
|
-
|
|
22901
|
+
resolvePrompt(value);
|
|
22869
22902
|
}
|
|
22870
22903
|
});
|
|
22871
22904
|
};
|
|
22872
22905
|
if ("readableFlowing" in input) nativeSetImmediate(startCycle);
|
|
22873
22906
|
else startCycle();
|
|
22874
|
-
return
|
|
22875
|
-
effectScheduler.clearAll();
|
|
22876
|
-
return answer;
|
|
22877
|
-
}, (error) => {
|
|
22878
|
-
effectScheduler.clearAll();
|
|
22879
|
-
throw error;
|
|
22880
|
-
}).finally(() => {
|
|
22881
|
-
cleanups.forEach((cleanup) => cleanup());
|
|
22882
|
-
screen.done({ clearContent: Boolean(context.clearPromptOnDone) });
|
|
22883
|
-
output.end();
|
|
22884
|
-
}).then(() => promise), { cancel });
|
|
22907
|
+
return promptPromise;
|
|
22885
22908
|
});
|
|
22886
22909
|
};
|
|
22887
22910
|
return prompt;
|
|
@@ -23435,7 +23458,7 @@ async function runUpdo(pm, options = {}) {
|
|
|
23435
23458
|
const workspaceNames = new Set(workspaces.map((ws) => ws.name));
|
|
23436
23459
|
const uniqueDependencyNames = /* @__PURE__ */ new Set();
|
|
23437
23460
|
console.log(chalk.gray("Scanning workspace dependencies..."));
|
|
23438
|
-
const declaredDeps = collectWorkspaceDeps(cwd, workspaces, workspaceNames);
|
|
23461
|
+
const declaredDeps = collectWorkspaceDeps(cwd, workspaces, workspaceNames).filter((dep) => isRegistryDependencySpec(dep.range));
|
|
23439
23462
|
for (const dep of declaredDeps) uniqueDependencyNames.add(dep.registryName);
|
|
23440
23463
|
console.log(chalk.gray(` Found ${uniqueDependencyNames.size} unique dependencies across ${workspaces.length} workspaces`));
|
|
23441
23464
|
const minReleaseAge = resolveMinReleaseAgeFilter(pm.name, cwd);
|
|
@@ -23771,7 +23794,7 @@ function isWorkspaceRootPackage(location, pkg) {
|
|
|
23771
23794
|
const abs = PATH.resolve(location);
|
|
23772
23795
|
return fs.existsSync(PATH.join(abs, "pnpm-workspace.yaml")) || fs.existsSync(PATH.join(abs, "pnpm-workspace.yml"));
|
|
23773
23796
|
}
|
|
23774
|
-
function readPackageJson$
|
|
23797
|
+
function readPackageJson$10(location) {
|
|
23775
23798
|
try {
|
|
23776
23799
|
return JSON.parse(fs.readFileSync(`${location}/package.json`, "utf8"));
|
|
23777
23800
|
} catch {
|
|
@@ -23843,7 +23866,7 @@ function buildClassification(role, facets, runtimeRoots) {
|
|
|
23843
23866
|
*/
|
|
23844
23867
|
function classifyDeplintPackage(location, optionsOrTerminal) {
|
|
23845
23868
|
const options = typeof optionsOrTerminal === "boolean" ? { terminal: optionsOrTerminal } : optionsOrTerminal;
|
|
23846
|
-
const pkg = readPackageJson$
|
|
23869
|
+
const pkg = readPackageJson$10(location);
|
|
23847
23870
|
if (pkg === void 0) return buildClassification("library", applyFacetOverrides(ROLE_FACET_DEFAULTS.library, options ?? {}), options?.runtimeRoots ?? []);
|
|
23848
23871
|
const merged = mergeOptions(pkg.xy?.commands?.deplint, options);
|
|
23849
23872
|
const autoRole = detectRole(location, pkg);
|
|
@@ -25374,7 +25397,7 @@ function collectExportTargets$3(value) {
|
|
|
25374
25397
|
if (typeof value !== "object" || value === null) return [];
|
|
25375
25398
|
return Object.values(value).flatMap(collectExportTargets$3);
|
|
25376
25399
|
}
|
|
25377
|
-
function readPackageJson$
|
|
25400
|
+
function readPackageJson$9(workspaceDir) {
|
|
25378
25401
|
try {
|
|
25379
25402
|
return JSON.parse(fs.readFileSync(PATH.join(workspaceDir, "package.json"), "utf8"));
|
|
25380
25403
|
} catch {
|
|
@@ -25427,7 +25450,7 @@ function mapEntryToSource(workspaceDir, entry) {
|
|
|
25427
25450
|
* to its `src/` origin. Falls back to `src/index.ts` when nothing maps.
|
|
25428
25451
|
*/
|
|
25429
25452
|
function resolveEntryPoints(workspaceDir) {
|
|
25430
|
-
const pkg = readPackageJson$
|
|
25453
|
+
const pkg = readPackageJson$9(workspaceDir);
|
|
25431
25454
|
const bin = pkg?.bin;
|
|
25432
25455
|
const manifestEntries = [
|
|
25433
25456
|
...collectExportTargets$3(pkg?.exports),
|
|
@@ -26753,7 +26776,7 @@ function readJsonFile(filePath) {
|
|
|
26753
26776
|
return {};
|
|
26754
26777
|
}
|
|
26755
26778
|
}
|
|
26756
|
-
function readPackageJson$
|
|
26779
|
+
function readPackageJson$8(rootDir, workspace) {
|
|
26757
26780
|
return readJsonFile(PATH.resolve(rootDir, workspace.location, "package.json"));
|
|
26758
26781
|
}
|
|
26759
26782
|
function isStringRecord(value) {
|
|
@@ -26891,7 +26914,7 @@ function createCurrentSnapshot({ action, options, pm, workspaces }) {
|
|
|
26891
26914
|
const fingerprints = {};
|
|
26892
26915
|
const sortedWorkspaces = workspaces.toSorted((a, b) => a.name.localeCompare(b.name));
|
|
26893
26916
|
for (const workspace of sortedWorkspaces) {
|
|
26894
|
-
const pkg = readPackageJson$
|
|
26917
|
+
const pkg = readPackageJson$8(rootDir, workspace);
|
|
26895
26918
|
const packageJsonPath = PATH.resolve(rootDir, workspace.location, "package.json");
|
|
26896
26919
|
const deps = workspaceDependencyNames(pkg, workspaceNames);
|
|
26897
26920
|
workspaceDeps[workspace.name] = deps;
|
|
@@ -26942,7 +26965,7 @@ function createDependentsMap(workspaces) {
|
|
|
26942
26965
|
const dependents = /* @__PURE__ */ new Map();
|
|
26943
26966
|
for (const workspace of workspaces) dependents.set(workspace.name, /* @__PURE__ */ new Set());
|
|
26944
26967
|
for (const workspace of workspaces) {
|
|
26945
|
-
const deps = workspaceDependencyNames(readPackageJson$
|
|
26968
|
+
const deps = workspaceDependencyNames(readPackageJson$8(rootDir, workspace), workspaceNames);
|
|
26946
26969
|
for (const dep of deps) dependents.get(dep)?.add(workspace.name);
|
|
26947
26970
|
}
|
|
26948
26971
|
return dependents;
|
|
@@ -28423,7 +28446,7 @@ function createSourceFileFilter(location, sourceIgnorePatterns) {
|
|
|
28423
28446
|
return !isIgnored(relativePath);
|
|
28424
28447
|
};
|
|
28425
28448
|
}
|
|
28426
|
-
function readPackageJson$
|
|
28449
|
+
function readPackageJson$7(location) {
|
|
28427
28450
|
try {
|
|
28428
28451
|
return JSON.parse(fs.readFileSync(`${location}/package.json`, "utf8"));
|
|
28429
28452
|
} catch {
|
|
@@ -28593,7 +28616,7 @@ function normalizeFindFilesOptions(sourceExcludeOrOptions) {
|
|
|
28593
28616
|
*/
|
|
28594
28617
|
function findFiles(location, sourceExcludeOrOptions) {
|
|
28595
28618
|
const { sourceExclude, runtimeEntry = "manifest", extraRuntimeRoots = [] } = normalizeFindFilesOptions(sourceExcludeOrOptions);
|
|
28596
|
-
const pkg = readPackageJson$
|
|
28619
|
+
const pkg = readPackageJson$7(location);
|
|
28597
28620
|
const workspaceIgnores = getNestedWorkspaceIgnores(location);
|
|
28598
28621
|
const sourceIgnorePatterns = toSourceIgnorePatterns(location, sourceExclude);
|
|
28599
28622
|
const shouldIncludeFile = createSourceFileFilter(location, sourceIgnorePatterns);
|
|
@@ -28848,7 +28871,7 @@ function hasExportTarget(location, target) {
|
|
|
28848
28871
|
if (target.includes("*")) return findFilesByGlob(location, target).length > 0;
|
|
28849
28872
|
return fs.existsSync(PATH.resolve(location, target));
|
|
28850
28873
|
}
|
|
28851
|
-
function readPackageJson$
|
|
28874
|
+
function readPackageJson$6(location) {
|
|
28852
28875
|
try {
|
|
28853
28876
|
return JSON.parse(fs.readFileSync(`${location}/package.json`, "utf8"));
|
|
28854
28877
|
} catch {
|
|
@@ -28856,7 +28879,7 @@ function readPackageJson$5(location) {
|
|
|
28856
28879
|
}
|
|
28857
28880
|
}
|
|
28858
28881
|
function warnMissingExportTargets(name, location) {
|
|
28859
|
-
const targets = collectExportTargets$1(readPackageJson$
|
|
28882
|
+
const targets = collectExportTargets$1(readPackageJson$6(location)?.exports);
|
|
28860
28883
|
const warnedTargets = /* @__PURE__ */ new Set();
|
|
28861
28884
|
const prefix = name != null && name.length > 0 ? `[${chalk.blue(name)}] ` : "";
|
|
28862
28885
|
for (const { path: exportPath, target } of targets) {
|
|
@@ -28868,7 +28891,7 @@ function warnMissingExportTargets(name, location) {
|
|
|
28868
28891
|
}
|
|
28869
28892
|
}
|
|
28870
28893
|
function hasShippedTsconfig(location) {
|
|
28871
|
-
return (readPackageJson$
|
|
28894
|
+
return (readPackageJson$6(location)?.files)?.some((f) => f === "tsconfig.json" || f.includes("tsconfig")) ?? false;
|
|
28872
28895
|
}
|
|
28873
28896
|
function getEffectiveRuntimeImportPaths({ distImportPaths, distTypeImportPaths, hasDist, srcImportPaths, srcTypeImportPaths, useSourceFallback }) {
|
|
28874
28897
|
if (hasDist) return {
|
|
@@ -29688,10 +29711,10 @@ function sortPackageJson(jsonIsh, options = {}) {
|
|
|
29688
29711
|
}
|
|
29689
29712
|
//#endregion
|
|
29690
29713
|
//#region src/actions/deplint/packageJsonEditor.ts
|
|
29691
|
-
function readPackageJson$
|
|
29714
|
+
function readPackageJson$5(location) {
|
|
29692
29715
|
return JSON.parse(fs.readFileSync(`${location}/package.json`, "utf8"));
|
|
29693
29716
|
}
|
|
29694
|
-
function writePackageJson$
|
|
29717
|
+
function writePackageJson$3(location, pkg) {
|
|
29695
29718
|
const sorted = sortPackageJson(JSON.stringify(pkg, null, 2));
|
|
29696
29719
|
fs.writeFileSync(`${location}/package.json`, `${sorted}\n`);
|
|
29697
29720
|
}
|
|
@@ -30798,7 +30821,7 @@ async function lookupNpmjsPublicAvailabilities(packageNames, concurrency = 16) {
|
|
|
30798
30821
|
function workspaceVisibilityByName(workspaceDirs) {
|
|
30799
30822
|
const visibilities = /* @__PURE__ */ new Map();
|
|
30800
30823
|
for (const [name, dir] of workspaceDirs) try {
|
|
30801
|
-
visibilities.set(name, classifyPackageVisibility(readPackageJson$
|
|
30824
|
+
visibilities.set(name, classifyPackageVisibility(readPackageJson$5(dir)));
|
|
30802
30825
|
} catch {}
|
|
30803
30826
|
return visibilities;
|
|
30804
30827
|
}
|
|
@@ -30867,7 +30890,7 @@ async function evaluateNotPublicSection(context, section, dependencies, versions
|
|
|
30867
30890
|
}
|
|
30868
30891
|
function readPackageJsonSafe(context) {
|
|
30869
30892
|
try {
|
|
30870
|
-
return readPackageJson$
|
|
30893
|
+
return readPackageJson$5(context.workspace.dir);
|
|
30871
30894
|
} catch {
|
|
30872
30895
|
return;
|
|
30873
30896
|
}
|
|
@@ -32169,7 +32192,7 @@ var DeplintPackageEditor = class {
|
|
|
32169
32192
|
workspace;
|
|
32170
32193
|
constructor(workspace) {
|
|
32171
32194
|
this.workspace = workspace;
|
|
32172
|
-
this.pkg = readPackageJson$
|
|
32195
|
+
this.pkg = readPackageJson$5(workspace.location);
|
|
32173
32196
|
}
|
|
32174
32197
|
applyFix(fix) {
|
|
32175
32198
|
const before = JSON.stringify(this.pkg);
|
|
@@ -32199,7 +32222,7 @@ var DeplintPackageEditor = class {
|
|
|
32199
32222
|
}
|
|
32200
32223
|
save() {
|
|
32201
32224
|
if (!this.dirty) return;
|
|
32202
|
-
writePackageJson$
|
|
32225
|
+
writePackageJson$3(this.workspace.location, this.pkg);
|
|
32203
32226
|
}
|
|
32204
32227
|
};
|
|
32205
32228
|
//#endregion
|
|
@@ -32541,7 +32564,7 @@ async function runDeplint(workspaces, options, workspaceNames) {
|
|
|
32541
32564
|
}
|
|
32542
32565
|
//#endregion
|
|
32543
32566
|
//#region src/actions/deplint/deplint.ts
|
|
32544
|
-
function emptyResult$
|
|
32567
|
+
function emptyResult$8() {
|
|
32545
32568
|
return {
|
|
32546
32569
|
envelope: { errorCount: 0 },
|
|
32547
32570
|
exitCode: 0
|
|
@@ -32572,7 +32595,7 @@ const deplint = async ({ pkg, classifier, deps, devDeps, fix, peerDeps, profile,
|
|
|
32572
32595
|
const effectiveFormat = format ?? (isJsonMode() ? "json" : "human");
|
|
32573
32596
|
const targetPackage = typeof pkg === "string" && pkg !== "undefined" && pkg.length > 0 ? pkg : void 0;
|
|
32574
32597
|
const { allWorkspaces, targetWorkspaces, workspaceNames } = resolveTargetWorkspaces$1(targetPackage, inputWorkspaces);
|
|
32575
|
-
if (targetPackage === void 0 && inputWorkspaces !== void 0 && targetWorkspaces.length === 0) return emptyResult$
|
|
32598
|
+
if (targetPackage === void 0 && inputWorkspaces !== void 0 && targetWorkspaces.length === 0) return emptyResult$8();
|
|
32576
32599
|
if (targetWorkspaces.length === 0) return missingWorkspaceResult(targetPackage);
|
|
32577
32600
|
const result = await runDeplint(targetWorkspaces, {
|
|
32578
32601
|
classifier,
|
|
@@ -35617,7 +35640,7 @@ const CONFIG_FILE_NAMES$1 = [
|
|
|
35617
35640
|
"xy.config.mjs",
|
|
35618
35641
|
"xy.config.cjs"
|
|
35619
35642
|
];
|
|
35620
|
-
function emptyResult$
|
|
35643
|
+
function emptyResult$7() {
|
|
35621
35644
|
return {
|
|
35622
35645
|
errors: 0,
|
|
35623
35646
|
modified: false,
|
|
@@ -35685,7 +35708,7 @@ function removeProperties(text, props, sourceFile) {
|
|
|
35685
35708
|
* field should be `false` (explicit off) or removed.
|
|
35686
35709
|
*/
|
|
35687
35710
|
function checkCompileTargets(pkgDir, shouldFix) {
|
|
35688
|
-
const result = emptyResult$
|
|
35711
|
+
const result = emptyResult$7();
|
|
35689
35712
|
const configPath = findConfigFile(pkgDir);
|
|
35690
35713
|
if (configPath === void 0) return result;
|
|
35691
35714
|
const text = fs.readFileSync(configPath, "utf8");
|
|
@@ -35703,7 +35726,7 @@ function checkCompileTargets(pkgDir, shouldFix) {
|
|
|
35703
35726
|
}
|
|
35704
35727
|
//#endregion
|
|
35705
35728
|
//#region src/actions/package/exportConditionPublint.ts
|
|
35706
|
-
function emptyResult$
|
|
35729
|
+
function emptyResult$6() {
|
|
35707
35730
|
return {
|
|
35708
35731
|
errors: 0,
|
|
35709
35732
|
modified: false,
|
|
@@ -35780,7 +35803,7 @@ function shouldReorderDefaultKeys(exports) {
|
|
|
35780
35803
|
return isModified;
|
|
35781
35804
|
}
|
|
35782
35805
|
function checkNeutralToDefault(pkg, shouldFix, log) {
|
|
35783
|
-
const result = emptyResult$
|
|
35806
|
+
const result = emptyResult$6();
|
|
35784
35807
|
const exports = pkg.exports;
|
|
35785
35808
|
if (!isNestedExportObject(exports) || !hasNeutralExport(exports)) return result;
|
|
35786
35809
|
if (shouldFix) {
|
|
@@ -35792,7 +35815,7 @@ function checkNeutralToDefault(pkg, shouldFix, log) {
|
|
|
35792
35815
|
return result;
|
|
35793
35816
|
}
|
|
35794
35817
|
function checkDefaultExportOrder(pkg, shouldFix, log) {
|
|
35795
|
-
const result = emptyResult$
|
|
35818
|
+
const result = emptyResult$6();
|
|
35796
35819
|
const exports = pkg.exports;
|
|
35797
35820
|
if (!isNestedExportObject(exports) || !hasDefaultNotLast(exports)) return result;
|
|
35798
35821
|
if (shouldFix) {
|
|
@@ -35929,7 +35952,7 @@ const platformSegments$1 = /* @__PURE__ */ new Set([
|
|
|
35929
35952
|
"neutral",
|
|
35930
35953
|
"node"
|
|
35931
35954
|
]);
|
|
35932
|
-
function emptyResult$
|
|
35955
|
+
function emptyResult$5() {
|
|
35933
35956
|
return {
|
|
35934
35957
|
errors: 0,
|
|
35935
35958
|
modified: false,
|
|
@@ -36122,7 +36145,7 @@ function activePlatforms(outputs) {
|
|
|
36122
36145
|
return [...new Set(outputs.map((output) => output.platform))];
|
|
36123
36146
|
}
|
|
36124
36147
|
function fixMissingExport(pkg, expected, allOutputs) {
|
|
36125
|
-
const result = emptyResult$
|
|
36148
|
+
const result = emptyResult$5();
|
|
36126
36149
|
const isNormalized = shouldNormalizeExportsForFix(pkg);
|
|
36127
36150
|
if (!isRecordObject(pkg.exports)) {
|
|
36128
36151
|
result.modified = isNormalized;
|
|
@@ -36144,7 +36167,7 @@ function fixMissingExport(pkg, expected, allOutputs) {
|
|
|
36144
36167
|
return result;
|
|
36145
36168
|
}
|
|
36146
36169
|
async function checkExportMappings(pkgDir, pkg, shouldFix) {
|
|
36147
|
-
const result = emptyResult$
|
|
36170
|
+
const result = emptyResult$5();
|
|
36148
36171
|
const expectedOutputs = await collectExpectedCompileOutputs(pkgDir);
|
|
36149
36172
|
if (expectedOutputs.length === 0) return result;
|
|
36150
36173
|
const diagnostics = dedupeDiagnostics$1(exportMapDiagnostics(pkgDir, pkg, expectedOutputs));
|
|
@@ -39311,10 +39334,10 @@ function mergeLeveledResult(target, source, check, rules) {
|
|
|
39311
39334
|
} else mergeResults(target, source);
|
|
39312
39335
|
target.modified ||= source.modified;
|
|
39313
39336
|
}
|
|
39314
|
-
async function readPackageJson$
|
|
39337
|
+
async function readPackageJson$4(pkgDir) {
|
|
39315
39338
|
return JSON.parse(await promises.readFile(PATH.join(pkgDir, "package.json"), "utf8"));
|
|
39316
39339
|
}
|
|
39317
|
-
async function writePackageJson$
|
|
39340
|
+
async function writePackageJson$2(pkgDir, pkg) {
|
|
39318
39341
|
const sorted = sortPackageJson(JSON.stringify(pkg, null, 2));
|
|
39319
39342
|
await promises.writeFile(PATH.join(pkgDir, "package.json"), sorted);
|
|
39320
39343
|
}
|
|
@@ -39537,9 +39560,9 @@ function applyEffectiveExcludes(pkg, exclude, rules) {
|
|
|
39537
39560
|
async function runCustomPublintPass(pkgDir, pkg, shouldFix, rules) {
|
|
39538
39561
|
const [errors, warnings, modified] = await customPubLint(pkgDir, pkg, shouldFix, rules);
|
|
39539
39562
|
if (shouldFix && modified) {
|
|
39540
|
-
await writePackageJson$
|
|
39563
|
+
await writePackageJson$2(pkgDir, pkg);
|
|
39541
39564
|
return {
|
|
39542
|
-
pkg: await readPackageJson$
|
|
39565
|
+
pkg: await readPackageJson$4(pkgDir),
|
|
39543
39566
|
result: {
|
|
39544
39567
|
errors,
|
|
39545
39568
|
modified,
|
|
@@ -39594,7 +39617,7 @@ const packagePublintDetailed = async ({ exclude = /* @__PURE__ */ new Set(), rul
|
|
|
39594
39617
|
const wsPublintConfig = normalizePublintConfig$1(await loadWorkspaceCommandConfig(pkgDir, "publint"));
|
|
39595
39618
|
const shouldPack = shouldPackParam ?? wsPublintConfig.pack ?? true;
|
|
39596
39619
|
const resolvedRules = ruleLevels === void 0 ? resolvePublintRules(wsPublintConfig) : cloneResolvedPublintRules(ruleLevels);
|
|
39597
|
-
let pkg = await readPackageJson$
|
|
39620
|
+
let pkg = await readPackageJson$4(pkgDir);
|
|
39598
39621
|
applyEffectiveExcludes(pkg, exclude, resolvedRules);
|
|
39599
39622
|
console.log(chalk.green(`Publint: ${String(pkg.name)}${Boolean(pkg.private) ? chalk.gray(" (private)") : ""}`));
|
|
39600
39623
|
console.log(chalk.gray(pkgDir));
|
|
@@ -40273,7 +40296,7 @@ const build = async ({ incremental, jobs, verbose, pkg }) => {
|
|
|
40273
40296
|
};
|
|
40274
40297
|
//#endregion
|
|
40275
40298
|
//#region src/actions/clean.ts
|
|
40276
|
-
function readPackageJson$
|
|
40299
|
+
function readPackageJson$3(packagePath) {
|
|
40277
40300
|
const packageJsonPath = PATH.join(packagePath, "package.json");
|
|
40278
40301
|
if (!existsSync(packageJsonPath)) return void 0;
|
|
40279
40302
|
try {
|
|
@@ -40283,7 +40306,7 @@ function readPackageJson$2(packagePath) {
|
|
|
40283
40306
|
}
|
|
40284
40307
|
}
|
|
40285
40308
|
function rootWorkspace(rootDir) {
|
|
40286
|
-
const name = readPackageJson$
|
|
40309
|
+
const name = readPackageJson$3(rootDir)?.name ?? packageName();
|
|
40287
40310
|
return name != null && name.length > 0 ? {
|
|
40288
40311
|
dir: PATH.resolve(rootDir),
|
|
40289
40312
|
location: ".",
|
|
@@ -40297,7 +40320,7 @@ function cleanWorkspaces(rootDir, pm) {
|
|
|
40297
40320
|
return root === void 0 ? workspaces : [root, ...workspaces];
|
|
40298
40321
|
}
|
|
40299
40322
|
function hasPackageCleanScript(rootDir, workspace) {
|
|
40300
|
-
const pkg = readPackageJson$
|
|
40323
|
+
const pkg = readPackageJson$3(PATH.join(rootDir, workspace.location));
|
|
40301
40324
|
return Object.hasOwn(pkg?.scripts ?? {}, "package-clean");
|
|
40302
40325
|
}
|
|
40303
40326
|
async function cleanBuiltInWorkspaces(rootDir, workspaces, jobs, fullMode) {
|
|
@@ -42972,7 +42995,7 @@ function ensureNativeDevDependency(cwd, pkg, nativeSpec, isVerbose) {
|
|
|
42972
42995
|
if (Object.keys(pkg.dependencies).length === 0) delete pkg.dependencies;
|
|
42973
42996
|
}
|
|
42974
42997
|
addDep(pkg, DEFAULT_NATIVE_PACKAGE, nativeSpec, "devDependencies");
|
|
42975
|
-
writePackageJson$
|
|
42998
|
+
writePackageJson$3(cwd, pkg);
|
|
42976
42999
|
console.log(chalk.green(`Added ${DEFAULT_NATIVE_PACKAGE}@${nativeSpec} to devDependencies`));
|
|
42977
43000
|
return true;
|
|
42978
43001
|
}
|
|
@@ -43031,7 +43054,7 @@ function enableTsNative({ noInstall = false, isVerbose = false } = {}) {
|
|
|
43031
43054
|
const cwd = INIT_CWD();
|
|
43032
43055
|
const packageJsonPath = PATH.join(cwd, "package.json");
|
|
43033
43056
|
if (!existsSync(packageJsonPath)) throw new Error(`No package.json found in ${cwd}`);
|
|
43034
|
-
const pkg = readPackageJson$
|
|
43057
|
+
const pkg = readPackageJson$5(cwd);
|
|
43035
43058
|
const nativeSpec = resolveNativeAliasSpec(pkg.devDependencies?.["typescript-native"] ?? pkg.dependencies?.["typescript-native"]);
|
|
43036
43059
|
const packageJsonChanged = ensureNativeDevDependency(cwd, pkg, nativeSpec, isVerbose);
|
|
43037
43060
|
logTypescriptApiStatus(pkg, isVerbose);
|
|
@@ -44230,14 +44253,14 @@ async function lintlint({ shouldFix, isVerbose } = {}) {
|
|
|
44230
44253
|
//#region src/actions/node-lint.ts
|
|
44231
44254
|
const REQUIRED_NODE_RANGE = ">=22";
|
|
44232
44255
|
const nodeConditionNames = /* @__PURE__ */ new Set(["node", "node-addons"]);
|
|
44233
|
-
function readPackageJson$
|
|
44256
|
+
function readPackageJson$2(path) {
|
|
44234
44257
|
try {
|
|
44235
44258
|
return JSON.parse(readFileSync(path, "utf8"));
|
|
44236
44259
|
} catch {
|
|
44237
44260
|
return;
|
|
44238
44261
|
}
|
|
44239
44262
|
}
|
|
44240
|
-
function writePackageJson(path, pkg) {
|
|
44263
|
+
function writePackageJson$1(path, pkg) {
|
|
44241
44264
|
writeFileSync(path, `${JSON.stringify(pkg, null, 2)}\n`, "utf8");
|
|
44242
44265
|
}
|
|
44243
44266
|
function targetPathPlatform(target) {
|
|
@@ -44260,14 +44283,14 @@ function isNodePackage(pkg) {
|
|
|
44260
44283
|
}
|
|
44261
44284
|
function checkVoltaNodeVersion(cwd, shouldFix) {
|
|
44262
44285
|
const rootPath = PATH.resolve(cwd, "package.json");
|
|
44263
|
-
const rootPkg = readPackageJson$
|
|
44286
|
+
const rootPkg = readPackageJson$2(rootPath);
|
|
44264
44287
|
if (!rootPkg?.volta) return [];
|
|
44265
44288
|
const pinned = rootPkg.volta.node;
|
|
44266
44289
|
const latest = latestVersions.node;
|
|
44267
44290
|
if (!(pinned === void 0 || import_semver.default.valid(pinned) === null || import_semver.default.lt(pinned, latest))) return [];
|
|
44268
44291
|
if (shouldFix) {
|
|
44269
44292
|
rootPkg.volta.node = latest;
|
|
44270
|
-
writePackageJson(rootPath, rootPkg);
|
|
44293
|
+
writePackageJson$1(rootPath, rootPkg);
|
|
44271
44294
|
console.log(chalk.green(` ✔ Fixed: set volta.node to ${latest} in root package.json`));
|
|
44272
44295
|
return [];
|
|
44273
44296
|
}
|
|
@@ -44279,7 +44302,7 @@ function checkVoltaNodeVersion(cwd, shouldFix) {
|
|
|
44279
44302
|
}
|
|
44280
44303
|
function checkPackageEngines(cwd, location, shouldFix) {
|
|
44281
44304
|
const pkgPath = PATH.resolve(cwd, location, "package.json");
|
|
44282
|
-
const pkg = readPackageJson$
|
|
44305
|
+
const pkg = readPackageJson$2(pkgPath);
|
|
44283
44306
|
if (!pkg) return [];
|
|
44284
44307
|
if (pkg.private === true) return [];
|
|
44285
44308
|
const label = pkg.name ?? location;
|
|
@@ -44292,7 +44315,7 @@ function checkPackageEngines(cwd, location, shouldFix) {
|
|
|
44292
44315
|
...pkg.engines,
|
|
44293
44316
|
node: REQUIRED_NODE_RANGE
|
|
44294
44317
|
};
|
|
44295
|
-
writePackageJson(pkgPath, pkg);
|
|
44318
|
+
writePackageJson$1(pkgPath, pkg);
|
|
44296
44319
|
console.log(chalk.green(` ✔ Fixed: set engines.node to "${REQUIRED_NODE_RANGE}" in ${file}`));
|
|
44297
44320
|
return [];
|
|
44298
44321
|
}
|
|
@@ -44308,7 +44331,7 @@ function checkPackageEngines(cwd, location, shouldFix) {
|
|
|
44308
44331
|
delete engines.node;
|
|
44309
44332
|
if (Object.keys(engines).length === 0) delete pkg.engines;
|
|
44310
44333
|
else pkg.engines = engines;
|
|
44311
|
-
writePackageJson(pkgPath, pkg);
|
|
44334
|
+
writePackageJson$1(pkgPath, pkg);
|
|
44312
44335
|
console.log(chalk.green(` ✔ Fixed: removed engines.node from ${file}`));
|
|
44313
44336
|
return [];
|
|
44314
44337
|
}
|
|
@@ -44361,7 +44384,7 @@ function logNodeDiagnostic(diagnostic) {
|
|
|
44361
44384
|
async function nodeLint(options = {}) {
|
|
44362
44385
|
const { shouldFix: isFix = false, verbose: isVerbose = false } = options;
|
|
44363
44386
|
const cwd = INIT_CWD();
|
|
44364
|
-
if (!readPackageJson$
|
|
44387
|
+
if (!readPackageJson$2(PATH.resolve(cwd, "package.json"))) {
|
|
44365
44388
|
console.error(chalk.red("Could not read package.json"));
|
|
44366
44389
|
return 1;
|
|
44367
44390
|
}
|
|
@@ -44460,6 +44483,113 @@ function orphanClean({ isVerbose } = {}) {
|
|
|
44460
44483
|
return 0;
|
|
44461
44484
|
}
|
|
44462
44485
|
//#endregion
|
|
44486
|
+
//#region src/actions/package-lint-docs.ts
|
|
44487
|
+
function emptyResult$4() {
|
|
44488
|
+
return {
|
|
44489
|
+
errors: [],
|
|
44490
|
+
fixable: [],
|
|
44491
|
+
warnings: []
|
|
44492
|
+
};
|
|
44493
|
+
}
|
|
44494
|
+
function isRootWorkspace(location) {
|
|
44495
|
+
return location === ".";
|
|
44496
|
+
}
|
|
44497
|
+
function packageDir(cwd, location) {
|
|
44498
|
+
return PATH.resolve(cwd, location);
|
|
44499
|
+
}
|
|
44500
|
+
function readPackageJson$1(cwd, location) {
|
|
44501
|
+
try {
|
|
44502
|
+
const raw = readFileSync(PATH.resolve(cwd, location, "package.json"), "utf8");
|
|
44503
|
+
return JSON.parse(raw);
|
|
44504
|
+
} catch {
|
|
44505
|
+
return;
|
|
44506
|
+
}
|
|
44507
|
+
}
|
|
44508
|
+
function writePackageJson(cwd, location, pkg) {
|
|
44509
|
+
writeFileSync(PATH.resolve(cwd, location, "package.json"), `${JSON.stringify(pkg, null, 2)}\n`, "utf8");
|
|
44510
|
+
}
|
|
44511
|
+
function readmeEntryKind(cwd, location) {
|
|
44512
|
+
const directory = packageDir(cwd, location);
|
|
44513
|
+
try {
|
|
44514
|
+
if (readdirSync(directory, { withFileTypes: true }).find((candidate) => candidate.name === "README.md") === void 0) return "missing";
|
|
44515
|
+
const stat = lstatSync(PATH.join(directory, "README.md"));
|
|
44516
|
+
return stat.isFile() && !stat.isSymbolicLink() ? "regular" : "other";
|
|
44517
|
+
} catch {
|
|
44518
|
+
return "missing";
|
|
44519
|
+
}
|
|
44520
|
+
}
|
|
44521
|
+
function packageReadmeTemplate(name, description) {
|
|
44522
|
+
return `# ${name}
|
|
44523
|
+
|
|
44524
|
+
${typeof description === "string" && description.trim().length > 0 ? description.trim() : "Package documentation for consumers."}
|
|
44525
|
+
|
|
44526
|
+
## Install
|
|
44527
|
+
|
|
44528
|
+
\`\`\`sh
|
|
44529
|
+
pnpm add ${name}
|
|
44530
|
+
\`\`\`
|
|
44531
|
+
|
|
44532
|
+
This README is the consumer entry point for the published package. Repository development docs live at the repository root (\`README.md\`, \`AGENTS.md\`, \`papers/\`, \`docs/\`).
|
|
44533
|
+
`;
|
|
44534
|
+
}
|
|
44535
|
+
function checkPackageReadme(cwd, workspaces) {
|
|
44536
|
+
const result = emptyResult$4();
|
|
44537
|
+
for (const { location, name } of workspaces) {
|
|
44538
|
+
if (isRootWorkspace(location)) continue;
|
|
44539
|
+
const kind = readmeEntryKind(cwd, location);
|
|
44540
|
+
if (kind === "regular") continue;
|
|
44541
|
+
if (kind === "missing") {
|
|
44542
|
+
result.fixable.push(`${name} (${location}) is missing README.md`);
|
|
44543
|
+
continue;
|
|
44544
|
+
}
|
|
44545
|
+
result.errors.push(`${name} (${location}) README.md must be a regular, non-symlink file`);
|
|
44546
|
+
}
|
|
44547
|
+
return result;
|
|
44548
|
+
}
|
|
44549
|
+
function fixPackageReadme(cwd, workspaces) {
|
|
44550
|
+
for (const { location, name } of workspaces) {
|
|
44551
|
+
if (isRootWorkspace(location)) continue;
|
|
44552
|
+
if (readmeEntryKind(cwd, location) !== "missing") continue;
|
|
44553
|
+
const pkg = readPackageJson$1(cwd, location);
|
|
44554
|
+
const packageName = typeof pkg?.name === "string" && pkg.name.length > 0 ? pkg.name : name;
|
|
44555
|
+
try {
|
|
44556
|
+
writeFileSync(PATH.join(packageDir(cwd, location), "README.md"), packageReadmeTemplate(packageName, pkg?.description), {
|
|
44557
|
+
encoding: "utf8",
|
|
44558
|
+
flag: "wx"
|
|
44559
|
+
});
|
|
44560
|
+
console.log(chalk.green(` ✔ Fixed: created ${location}/README.md`));
|
|
44561
|
+
} catch {}
|
|
44562
|
+
}
|
|
44563
|
+
}
|
|
44564
|
+
function checkPackageReadmeFiles(cwd, workspaces) {
|
|
44565
|
+
const result = emptyResult$4();
|
|
44566
|
+
for (const { location, name } of workspaces) {
|
|
44567
|
+
if (isRootWorkspace(location)) continue;
|
|
44568
|
+
const pkg = readPackageJson$1(cwd, location);
|
|
44569
|
+
if (pkg === void 0 || Boolean(pkg.private)) continue;
|
|
44570
|
+
const files = pkg.files;
|
|
44571
|
+
if (!Array.isArray(files)) {
|
|
44572
|
+
result.errors.push(`${name} (${location}) is missing a files field that includes README.md`);
|
|
44573
|
+
continue;
|
|
44574
|
+
}
|
|
44575
|
+
if (!files.includes("README.md")) result.fixable.push(`${name} (${location}) files must include README.md`);
|
|
44576
|
+
}
|
|
44577
|
+
return result;
|
|
44578
|
+
}
|
|
44579
|
+
function fixPackageReadmeFiles(cwd, workspaces) {
|
|
44580
|
+
for (const { location } of workspaces) {
|
|
44581
|
+
if (isRootWorkspace(location)) continue;
|
|
44582
|
+
const pkg = readPackageJson$1(cwd, location);
|
|
44583
|
+
if (pkg === void 0 || Boolean(pkg.private)) continue;
|
|
44584
|
+
const files = pkg.files;
|
|
44585
|
+
if (!Array.isArray(files) || files.includes("README.md")) continue;
|
|
44586
|
+
files.push("README.md");
|
|
44587
|
+
pkg.files = files;
|
|
44588
|
+
writePackageJson(cwd, location, pkg);
|
|
44589
|
+
console.log(chalk.green(` ✔ Fixed: added README.md to ${location}/package.json files`));
|
|
44590
|
+
}
|
|
44591
|
+
}
|
|
44592
|
+
//#endregion
|
|
44463
44593
|
//#region src/actions/package-lint-engines.ts
|
|
44464
44594
|
function emptyResult$3() {
|
|
44465
44595
|
return {
|
|
@@ -45061,6 +45191,18 @@ const REPO_LINT_RULES = [
|
|
|
45061
45191
|
description: "Spec files live in spec/ folders",
|
|
45062
45192
|
id: "repo.spec-layout"
|
|
45063
45193
|
}),
|
|
45194
|
+
repoLintRule({
|
|
45195
|
+
check: ({ cwd, workspaces }) => checkPackageReadme(cwd, workspaces),
|
|
45196
|
+
description: "Workspace packages have a consumer README.md",
|
|
45197
|
+
fix: ({ cwd, workspaces }) => fixPackageReadme(cwd, workspaces),
|
|
45198
|
+
id: "repo.package-readme"
|
|
45199
|
+
}),
|
|
45200
|
+
repoLintRule({
|
|
45201
|
+
check: ({ cwd, workspaces }) => checkPackageReadmeFiles(cwd, workspaces),
|
|
45202
|
+
description: "Publishable workspace packages include README.md in files",
|
|
45203
|
+
fix: ({ cwd, workspaces }) => fixPackageReadmeFiles(cwd, workspaces),
|
|
45204
|
+
id: "repo.package-readme-files"
|
|
45205
|
+
}),
|
|
45064
45206
|
repoLintRule({
|
|
45065
45207
|
check: ({ cwd, pm, workspaces }) => checkWorkspacesFieldPlacement(cwd, pm, workspaces),
|
|
45066
45208
|
description: "Workspace fields are declared in the package-manager-specific location",
|
|
@@ -46297,15 +46439,79 @@ const resolvePlanGitRoot = (start, command) => {
|
|
|
46297
46439
|
return root;
|
|
46298
46440
|
};
|
|
46299
46441
|
//#endregion
|
|
46442
|
+
//#region src/actions/plan/markdown.ts
|
|
46443
|
+
const DOC_INDEX_FOLDERS = ["papers", "docs"];
|
|
46444
|
+
function visibleMarkdown(markdown) {
|
|
46445
|
+
return markdown.replaceAll(/^ {0,3}([`~]{3,})[^\n]*\n[\s\S]*?^ {0,3}\1[^\n]*$/gmu, "\n").replaceAll(/`[^`\n]+`/gu, " ").replaceAll(/<!--[\s\S]*?-->/gu, " ");
|
|
46446
|
+
}
|
|
46447
|
+
function hasClaudeAgentsImport(markdown) {
|
|
46448
|
+
return /(?:^|[\s(])@(?:\.\/)?AGENTS\.md(?=$|[\s).,;:])/u.test(visibleMarkdown(markdown));
|
|
46449
|
+
}
|
|
46450
|
+
function claudeFileImports(markdown) {
|
|
46451
|
+
const imports = [];
|
|
46452
|
+
for (const match of visibleMarkdown(markdown).matchAll(/(?:^|[^A-Za-z0-9._-])@(?<imported>(?:\.\.?\/|\/|~\/)[^\s`<>]+|(?:[\w.-]+\/)*[\w.-]+\.(?:md|json|ts|tsx|js|mjs|cjs|txt|yml|yaml|toml))\b/gu)) {
|
|
46453
|
+
const imported = match.groups?.imported;
|
|
46454
|
+
if (imported !== void 0 && imported.length > 0) imports.push(imported);
|
|
46455
|
+
}
|
|
46456
|
+
return imports;
|
|
46457
|
+
}
|
|
46458
|
+
const normalizeLinkDestination = (raw) => {
|
|
46459
|
+
let dest = raw.trim();
|
|
46460
|
+
if (dest.startsWith("<") && dest.endsWith(">")) dest = dest.slice(1, -1).trim();
|
|
46461
|
+
const [unquoted] = dest.split(/\s/u, 2);
|
|
46462
|
+
dest = unquoted ?? "";
|
|
46463
|
+
if (dest.length === 0) return void 0;
|
|
46464
|
+
if (/^[a-z][a-z0-9+.-]*:/iu.test(dest)) return void 0;
|
|
46465
|
+
return dest.replace(/^\.\//u, "");
|
|
46466
|
+
};
|
|
46467
|
+
const linkDestinations = (markdown) => {
|
|
46468
|
+
const text = visibleMarkdown(markdown);
|
|
46469
|
+
const destinations = [];
|
|
46470
|
+
for (const match of text.matchAll(/(?<image>!)?\[[^\]]*\]\((?<dest>[^)]+)\)/gu)) {
|
|
46471
|
+
if (match.groups?.image === "!") continue;
|
|
46472
|
+
const dest = normalizeLinkDestination(match.groups?.dest ?? "");
|
|
46473
|
+
if (dest !== void 0) destinations.push(dest);
|
|
46474
|
+
}
|
|
46475
|
+
for (const match of text.matchAll(/^ {0,3}\[[^\]]+\]:\s+(?<dest>\S+)/gmu)) {
|
|
46476
|
+
const dest = normalizeLinkDestination(match.groups?.dest ?? "");
|
|
46477
|
+
if (dest !== void 0) destinations.push(dest);
|
|
46478
|
+
}
|
|
46479
|
+
return destinations;
|
|
46480
|
+
};
|
|
46481
|
+
function linksToDocFolder(markdown, folder) {
|
|
46482
|
+
return linkDestinations(markdown).some((dest) => {
|
|
46483
|
+
return dest === folder || dest.startsWith(`${folder}/`);
|
|
46484
|
+
});
|
|
46485
|
+
}
|
|
46486
|
+
function missingDocIndexFolders(markdown) {
|
|
46487
|
+
return DOC_INDEX_FOLDERS.filter((folder) => !linksToDocFolder(markdown, folder));
|
|
46488
|
+
}
|
|
46489
|
+
function documentationIndexSection(folders) {
|
|
46490
|
+
const labels = {
|
|
46491
|
+
docs: "Docs",
|
|
46492
|
+
papers: "Papers"
|
|
46493
|
+
};
|
|
46494
|
+
return `\n## Documentation\n\n${folders.map((folder) => `- [${labels[folder]}](./${folder}/README.md)`).join("\n")}\n`;
|
|
46495
|
+
}
|
|
46496
|
+
//#endregion
|
|
46300
46497
|
//#region src/actions/plan/templates.ts
|
|
46301
46498
|
const PLAN_REQUIRED_FILE_TEMPLATES = {
|
|
46302
46499
|
"AGENTS.md": `# Agent Instructions
|
|
46303
46500
|
|
|
46501
|
+
This file is the agent entry point for developing this repository. Human contributors should start at [README.md](./README.md).
|
|
46502
|
+
|
|
46503
|
+
## Documentation
|
|
46504
|
+
|
|
46505
|
+
- [Papers](./papers/README.md)
|
|
46506
|
+
- [Docs](./docs/README.md)
|
|
46507
|
+
- [Roadmap](./docs/ROADMAP.md)
|
|
46508
|
+
|
|
46304
46509
|
## Repository guidance
|
|
46305
46510
|
|
|
46306
46511
|
- Read \`README.md\`, the canonical papers, and \`docs/ROADMAP.md\` before making broad changes.
|
|
46307
46512
|
- Preserve unrelated worktree changes and follow repository-local tooling.
|
|
46308
46513
|
- Record durable implementation work in the configured issue tracker.
|
|
46514
|
+
- Use Markdown links to papers and docs. Do not use Claude \`@path\` imports in this file.
|
|
46309
46515
|
|
|
46310
46516
|
## Verification
|
|
46311
46517
|
|
|
@@ -46318,9 +46524,8 @@ All notable changes to this project are documented in this file.
|
|
|
46318
46524
|
## Unreleased
|
|
46319
46525
|
|
|
46320
46526
|
`,
|
|
46321
|
-
"CLAUDE.md":
|
|
46322
|
-
|
|
46323
|
-
Follow [AGENTS.md](./AGENTS.md) and all repository-local contribution and verification guidance.
|
|
46527
|
+
"CLAUDE.md": `<!-- Canonical agent instructions live in AGENTS.md. Claude Code imports that file. -->
|
|
46528
|
+
@AGENTS.md
|
|
46324
46529
|
`,
|
|
46325
46530
|
"CONTRIBUTING.md": `# Contributing
|
|
46326
46531
|
|
|
@@ -46335,6 +46540,13 @@ Run the applicable build, lint, and test commands before submitting changes.
|
|
|
46335
46540
|
"README.md": `# Project
|
|
46336
46541
|
|
|
46337
46542
|
Describe the project's purpose, supported workflows, and development entry points here.
|
|
46543
|
+
|
|
46544
|
+
This README is the human entry point for developing this repository. AI agents should start at [AGENTS.md](./AGENTS.md). Published package consumers should start at each package README.
|
|
46545
|
+
|
|
46546
|
+
## Documentation
|
|
46547
|
+
|
|
46548
|
+
- [Papers](./papers/README.md)
|
|
46549
|
+
- [Docs](./docs/README.md)
|
|
46338
46550
|
`,
|
|
46339
46551
|
"docs/README.md": `# Documentation
|
|
46340
46552
|
|
|
@@ -46432,6 +46644,105 @@ Identify the tests and operational evidence that support implementation claims.
|
|
|
46432
46644
|
`
|
|
46433
46645
|
};
|
|
46434
46646
|
//#endregion
|
|
46647
|
+
//#region src/actions/plan/rootDocs.ts
|
|
46648
|
+
const lstatIfPresent$2 = (filePath) => {
|
|
46649
|
+
try {
|
|
46650
|
+
return fs.lstatSync(filePath);
|
|
46651
|
+
} catch (error) {
|
|
46652
|
+
if (error.code === "ENOENT") return void 0;
|
|
46653
|
+
throw error;
|
|
46654
|
+
}
|
|
46655
|
+
};
|
|
46656
|
+
const rootFilePath = (root, relativePath) => {
|
|
46657
|
+
return PATH.join(root, relativePath);
|
|
46658
|
+
};
|
|
46659
|
+
const readRootMarkdown = (root, relativePath) => {
|
|
46660
|
+
const target = rootFilePath(root, relativePath);
|
|
46661
|
+
const stat = lstatIfPresent$2(target);
|
|
46662
|
+
if (stat === void 0 || !stat.isFile() || stat.isSymbolicLink()) return void 0;
|
|
46663
|
+
return fs.readFileSync(target, "utf8");
|
|
46664
|
+
};
|
|
46665
|
+
const writeRootMarkdown = (root, relativePath, contents) => {
|
|
46666
|
+
const target = rootFilePath(root, relativePath);
|
|
46667
|
+
const stat = lstatIfPresent$2(target);
|
|
46668
|
+
if (stat === void 0 || !stat.isFile() || stat.isSymbolicLink()) return false;
|
|
46669
|
+
fs.writeFileSync(target, contents.endsWith("\n") ? contents : `${contents}\n`, "utf8");
|
|
46670
|
+
return true;
|
|
46671
|
+
};
|
|
46672
|
+
const claudeImportsOutcome = (root, hasClaude, fix) => {
|
|
46673
|
+
if (!hasClaude) return { diagnostics: [] };
|
|
46674
|
+
const contents = readRootMarkdown(root, "CLAUDE.md");
|
|
46675
|
+
if (contents === void 0 || hasClaudeAgentsImport(contents)) return { diagnostics: [] };
|
|
46676
|
+
if (fix) {
|
|
46677
|
+
const template = PLAN_REQUIRED_FILE_TEMPLATES["CLAUDE.md"];
|
|
46678
|
+
const next = contents.trim().length === 0 ? template : `${template}${contents.trimStart()}`;
|
|
46679
|
+
if (writeRootMarkdown(root, "CLAUDE.md", next)) return {
|
|
46680
|
+
diagnostics: [],
|
|
46681
|
+
fixedCount: 1
|
|
46682
|
+
};
|
|
46683
|
+
}
|
|
46684
|
+
return { diagnostics: [{
|
|
46685
|
+
file: "CLAUDE.md",
|
|
46686
|
+
message: "CLAUDE.md must import AGENTS.md with @AGENTS.md (not a Markdown link, code span, or HTML comment)"
|
|
46687
|
+
}] };
|
|
46688
|
+
};
|
|
46689
|
+
const agentsNoAtImportsOutcome = (root, hasAgents) => {
|
|
46690
|
+
if (!hasAgents) return { diagnostics: [] };
|
|
46691
|
+
const contents = readRootMarkdown(root, "AGENTS.md");
|
|
46692
|
+
if (contents === void 0) return { diagnostics: [] };
|
|
46693
|
+
const imports = claudeFileImports(contents);
|
|
46694
|
+
if (imports.length === 0) return { diagnostics: [] };
|
|
46695
|
+
return { diagnostics: imports.map((imported) => ({
|
|
46696
|
+
file: "AGENTS.md",
|
|
46697
|
+
message: `AGENTS.md must not use Claude @imports (found @${imported}); use Markdown links so CLAUDE.md can import this file without recursively loading papers or docs`
|
|
46698
|
+
})) };
|
|
46699
|
+
};
|
|
46700
|
+
const docsIndexOutcome = (root, inventory, fix) => {
|
|
46701
|
+
const diagnostics = [];
|
|
46702
|
+
let fixedCount = 0;
|
|
46703
|
+
for (const file of ["README.md", "AGENTS.md"]) {
|
|
46704
|
+
if (!inventory.has(file)) continue;
|
|
46705
|
+
const contents = readRootMarkdown(root, file);
|
|
46706
|
+
if (contents === void 0) continue;
|
|
46707
|
+
const missing = missingDocIndexFolders(contents);
|
|
46708
|
+
if (missing.length === 0) continue;
|
|
46709
|
+
if (fix && writeRootMarkdown(root, file, `${contents.trimEnd()}${documentationIndexSection(missing)}`)) {
|
|
46710
|
+
fixedCount += 1;
|
|
46711
|
+
continue;
|
|
46712
|
+
}
|
|
46713
|
+
diagnostics.push({
|
|
46714
|
+
file,
|
|
46715
|
+
message: `${file} must Markdown-link to ${missing.map((folder) => `${folder}/`).join(" and ")}`
|
|
46716
|
+
});
|
|
46717
|
+
}
|
|
46718
|
+
return {
|
|
46719
|
+
diagnostics,
|
|
46720
|
+
...fixedCount > 0 && { fixedCount }
|
|
46721
|
+
};
|
|
46722
|
+
};
|
|
46723
|
+
const PLAN_ROOT_DOCUMENTATION_RULES = [
|
|
46724
|
+
{
|
|
46725
|
+
check: ({ root, rootEntries }, { fix }) => claudeImportsOutcome(root, rootEntries.regularFiles.has("CLAUDE.md"), fix),
|
|
46726
|
+
defaultLevel: "error",
|
|
46727
|
+
description: "CLAUDE.md imports AGENTS.md with @AGENTS.md",
|
|
46728
|
+
fixable: true,
|
|
46729
|
+
id: "plan.root.claude-imports-agents"
|
|
46730
|
+
},
|
|
46731
|
+
{
|
|
46732
|
+
check: ({ root, rootEntries }) => agentsNoAtImportsOutcome(root, rootEntries.regularFiles.has("AGENTS.md")),
|
|
46733
|
+
defaultLevel: "error",
|
|
46734
|
+
description: "AGENTS.md does not use Claude @path imports",
|
|
46735
|
+
id: "plan.root.agents-no-at-imports"
|
|
46736
|
+
},
|
|
46737
|
+
{
|
|
46738
|
+
check: ({ root, rootEntries }, { fix }) => docsIndexOutcome(root, rootEntries.regularFiles, fix),
|
|
46739
|
+
defaultLevel: "error",
|
|
46740
|
+
description: "root README.md and AGENTS.md Markdown-link to papers/ and docs/",
|
|
46741
|
+
fixable: true,
|
|
46742
|
+
id: "plan.root.docs-index"
|
|
46743
|
+
}
|
|
46744
|
+
];
|
|
46745
|
+
//#endregion
|
|
46435
46746
|
//#region src/actions/plan/lint.ts
|
|
46436
46747
|
const REQUIRED_ROOT_PATHS = [
|
|
46437
46748
|
"AGENTS.md",
|
|
@@ -46716,6 +47027,7 @@ const PLAN_LINT_RULES = [
|
|
|
46716
47027
|
fixable: true,
|
|
46717
47028
|
id: "plan.root.required-files"
|
|
46718
47029
|
},
|
|
47030
|
+
...PLAN_ROOT_DOCUMENTATION_RULES,
|
|
46719
47031
|
{
|
|
46720
47032
|
check: ({ papers, root }, { fix }) => unexpectedFilesOutcome(root, papers, ALLOWED_PAPER_PATHS, REQUIRED_PAPER_PATH_SET, "papers/ permits only README.md, WHITE-PAPER.md, YELLOW-PAPER.md, and optional GREEN-PAPER.md", fix),
|
|
46721
47033
|
defaultLevel: "error",
|
|
@@ -47836,7 +48148,7 @@ function scaffoldProject(plan) {
|
|
|
47836
48148
|
count += scaffoldFiles(plan.template, "package", projectDir, plan.pm, false, variables, plan.isVerbose);
|
|
47837
48149
|
const packagePkgPath = PATH.resolve(projectDir, "package.json");
|
|
47838
48150
|
const packagePkg = JSON.parse(readFileSync(packagePkgPath, "utf8"));
|
|
47839
|
-
count += scaffoldFiles(plan.template, "root", projectDir, plan.pm, false, variables, plan.isVerbose);
|
|
48151
|
+
count += scaffoldFiles(plan.template, "root", projectDir, plan.pm, false, variables, plan.isVerbose, /* @__PURE__ */ new Set(["README.md.tmpl"]));
|
|
47840
48152
|
normalizeRootPackageJson(projectDir, plan, packagePkg);
|
|
47841
48153
|
const mergeTmp = PATH.resolve(projectDir, ".package.json.merge");
|
|
47842
48154
|
if (existsSync(mergeTmp)) unlinkSync(mergeTmp);
|
|
@@ -48098,19 +48410,37 @@ const requiredSkillsForTier = (tier) => {
|
|
|
48098
48410
|
return TIER_REQUIRED_SKILLS[tier];
|
|
48099
48411
|
};
|
|
48100
48412
|
/**
|
|
48413
|
+
* Validates raw `commands.skillsLint.additionalSkills` config values.
|
|
48414
|
+
* Returns the deduped, deterministically ordered skill names.
|
|
48415
|
+
* @throws TypeError when the value is not an array of known managed skill names.
|
|
48416
|
+
*/
|
|
48417
|
+
const normalizeAdditionalSkills = (value) => {
|
|
48418
|
+
if (value === void 0) return [];
|
|
48419
|
+
if (!Array.isArray(value) || value.some((entry) => typeof entry !== "string")) throw new TypeError("commands.skillsLint.additionalSkills must be an array of skill names");
|
|
48420
|
+
const unknown = value.filter((entry) => !isXyoSkillName(entry));
|
|
48421
|
+
if (unknown.length > 0) throw new TypeError(`Unknown skills in commands.skillsLint.additionalSkills: ${unknown.join(", ")}. Known skills: ${XYO_SKILL_NAMES.join(", ")}`);
|
|
48422
|
+
return sortSkills([...new Set(value)]);
|
|
48423
|
+
};
|
|
48424
|
+
/**
|
|
48101
48425
|
* Required skills for a detected repo profile.
|
|
48102
|
-
* Adds `ariestools-sdk` when the repo depends on or produces packages from ariestools/sdk-js
|
|
48426
|
+
* Adds `ariestools-sdk` when the repo depends on or produces packages from ariestools/sdk-js,
|
|
48427
|
+
* plus any validated `additionalSkills` override from xy config.
|
|
48103
48428
|
*/
|
|
48104
48429
|
const requiredSkillsForProfile = (profile) => {
|
|
48105
48430
|
const base = requiredSkillsForTier(profile.tier);
|
|
48106
|
-
|
|
48107
|
-
|
|
48108
|
-
|
|
48109
|
-
|
|
48110
|
-
|
|
48111
|
-
|
|
48112
|
-
|
|
48113
|
-
|
|
48431
|
+
const withSdk = (() => {
|
|
48432
|
+
if (!profile.isUsingAriestoolsSdk) return base;
|
|
48433
|
+
if (base.length === 0) return sortSkills([
|
|
48434
|
+
"xy-development",
|
|
48435
|
+
"xy-toolchain",
|
|
48436
|
+
"ariestools-sdk"
|
|
48437
|
+
]);
|
|
48438
|
+
if (base.includes("ariestools-sdk")) return base;
|
|
48439
|
+
return sortSkills([...base, "ariestools-sdk"]);
|
|
48440
|
+
})();
|
|
48441
|
+
const additional = profile.additionalSkills ?? [];
|
|
48442
|
+
if (additional.length === 0) return withSdk;
|
|
48443
|
+
return sortSkills([.../* @__PURE__ */ new Set([...withSdk, ...additional])]);
|
|
48114
48444
|
};
|
|
48115
48445
|
const optionalSkillsForTier = (tier) => {
|
|
48116
48446
|
if (tier !== "xl1") return [];
|
|
@@ -54706,6 +55036,7 @@ const createSkillInstaller = (cwd) => {
|
|
|
54706
55036
|
const missingSkillReason = (profile, skillName) => {
|
|
54707
55037
|
if (skillName === "ariestools-sdk" && profile.isUsingAriestoolsSdk) return "repo uses packages from ariestools/sdk-js";
|
|
54708
55038
|
if (skillName === "xy-toolchain" && profile.isUsingToolchain) return "repo uses @ariestools/toolchain";
|
|
55039
|
+
if (profile.additionalSkills?.includes(skillName) === true) return "listed in commands.skillsLint.additionalSkills";
|
|
54709
55040
|
return "required for repo profile";
|
|
54710
55041
|
};
|
|
54711
55042
|
const checkRequiredSkills = (required, installed, latestVersions) => {
|
|
@@ -54832,7 +55163,7 @@ const SKILLS_LINT_RULES = [
|
|
|
54832
55163
|
{
|
|
54833
55164
|
check: ({ unnecessary }) => ({ diagnostics: skillDiagnostics("skills.unnecessary", unnecessary.map((skillName) => `${skillName} — installed but not required for this repo profile`)) }),
|
|
54834
55165
|
defaultLevel: "warn",
|
|
54835
|
-
description: "Installed skills are required or optional for the detected repo profile",
|
|
55166
|
+
description: "Installed skills are required or optional for the detected repo profile (extend via commands.skillsLint.additionalSkills)",
|
|
54836
55167
|
id: "skills.unnecessary"
|
|
54837
55168
|
},
|
|
54838
55169
|
{
|
|
@@ -54881,7 +55212,11 @@ const skillsLint = async (options = {}) => {
|
|
|
54881
55212
|
const projectDirs = options.projectDirs ?? [...PROJECT_SKILL_DIRS];
|
|
54882
55213
|
const globalDir = options.globalDir ?? DEFAULT_GLOBAL_DIR;
|
|
54883
55214
|
const isStrict = options.isStrict === true || options.strict === true;
|
|
54884
|
-
const
|
|
55215
|
+
const config = await loadWorkspaceCommandConfig(cwd, "skillsLint");
|
|
55216
|
+
const profile = {
|
|
55217
|
+
...detectRepoProfile(cwd),
|
|
55218
|
+
additionalSkills: normalizeAdditionalSkills(config.additionalSkills)
|
|
55219
|
+
};
|
|
54885
55220
|
const required = requiredSkillsForProfile(profile);
|
|
54886
55221
|
const optional = optionalSkillsForTier(profile.tier);
|
|
54887
55222
|
const installed = scanInstalledSkills(cwd, projectDirs);
|
|
@@ -54892,16 +55227,15 @@ const skillsLint = async (options = {}) => {
|
|
|
54892
55227
|
const unnecessary = collectUnnecessarySkills(profile, installed);
|
|
54893
55228
|
const duplicates = findDuplicateSkills(cwd, globalDir);
|
|
54894
55229
|
const unmigrated = findUnmigratedSkills(cwd);
|
|
54895
|
-
const installSkill = options.installSkill ?? createSkillInstaller(cwd);
|
|
54896
55230
|
return reportSkillsLintResult(await runRuleChecks({
|
|
54897
55231
|
commandName: "skills lint",
|
|
54898
55232
|
configKey: "skillsLint",
|
|
54899
|
-
config
|
|
55233
|
+
config,
|
|
54900
55234
|
context: {
|
|
54901
55235
|
cwd,
|
|
54902
55236
|
duplicates,
|
|
54903
55237
|
globalDir,
|
|
54904
|
-
installSkill,
|
|
55238
|
+
installSkill: options.installSkill ?? createSkillInstaller(cwd),
|
|
54905
55239
|
missing: requiredCheck.missing,
|
|
54906
55240
|
outdated: requiredCheck.outdated,
|
|
54907
55241
|
profile,
|
|
@@ -58267,6 +58601,11 @@ Checks:
|
|
|
58267
58601
|
XYOracleNetwork/xyo-skills for xyo/xl1 skills)
|
|
58268
58602
|
- Project/global duplicate installs
|
|
58269
58603
|
|
|
58604
|
+
Config (xy.config.ts):
|
|
58605
|
+
- commands.skillsLint.additionalSkills
|
|
58606
|
+
Treat extra skills as required even when the detected
|
|
58607
|
+
profile does not require them
|
|
58608
|
+
|
|
58270
58609
|
Options:
|
|
58271
58610
|
--fix Install missing, migrate relocated, and update outdated skills (project scope)
|
|
58272
58611
|
--offline Skip upstream version checks
|
|
@@ -65258,7 +65597,7 @@ const xyBase = async (options = {}) => {
|
|
|
65258
65597
|
].includes(a))) return;
|
|
65259
65598
|
console.error(chalk.yellow(`Command not found [${chalk.magenta(cmd)}]`));
|
|
65260
65599
|
console.log(chalk.gray(`Try '${cliLabel} --help' for list of commands`));
|
|
65261
|
-
}).version().help().argv;
|
|
65600
|
+
}).version(bundledToolchainVersion()).help().argv;
|
|
65262
65601
|
};
|
|
65263
65602
|
function registerLifecyclePlugins(args, channel) {
|
|
65264
65603
|
let result = xyInstallCommands(xyDeployCommands(args));
|