@ariestools/toolchain 10.1.1 → 10.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/agent/document.d.ts +15 -0
- package/dist/actions/agent/document.d.ts.map +1 -1
- package/dist/actions/agent/index.d.ts +1 -1
- package/dist/actions/agent/index.d.ts.map +1 -1
- package/dist/actions/agent/lint.d.ts +5 -0
- package/dist/actions/agent/lint.d.ts.map +1 -1
- package/dist/actions/agent/mutate.d.ts.map +1 -1
- package/dist/actions/agent/rules.d.ts.map +1 -1
- package/dist/actions/agent/walk.d.ts.map +1 -1
- package/dist/actions/package/compile/XyConfig.d.ts +25 -2
- package/dist/actions/package/compile/XyConfig.d.ts.map +1 -1
- package/dist/actions/plan/markdown.d.ts.map +1 -1
- package/dist/actions/repo-init/scaffold.d.ts.map +1 -1
- package/dist/actions/repo-init/skillsInstall.d.ts.map +1 -1
- package/dist/actions/repo-init/templateVars.d.ts.map +1 -1
- package/dist/actions/secure/dependabot.d.ts.map +1 -1
- package/dist/actions/skills/defaults.d.ts +3 -3
- package/dist/actions/skills/defaults.d.ts.map +1 -1
- package/dist/actions/skills/detectProfile.d.ts.map +1 -1
- package/dist/actions/skills/editXyConfigSkillPresence.d.ts +13 -0
- package/dist/actions/skills/editXyConfigSkillPresence.d.ts.map +1 -0
- package/dist/actions/skills/installed.d.ts +7 -0
- package/dist/actions/skills/installed.d.ts.map +1 -1
- package/dist/actions/skills/legacyGenerated.d.ts +7 -0
- package/dist/actions/skills/legacyGenerated.d.ts.map +1 -0
- package/dist/actions/skills/lint.d.ts +3 -0
- package/dist/actions/skills/lint.d.ts.map +1 -1
- package/dist/actions/skills/lock.d.ts +5 -1
- package/dist/actions/skills/lock.d.ts.map +1 -1
- package/dist/actions/skills/pick.d.ts.map +1 -1
- package/dist/actions/skills/skillRules.d.ts +2 -1
- package/dist/actions/skills/skillRules.d.ts.map +1 -1
- package/dist/actions/work/lint.d.ts.map +1 -1
- package/dist/bin/package/build.mjs +1494 -1494
- package/dist/bin/package/build.mjs.map +1 -1
- package/dist/bin/package/clean.mjs +1813 -1813
- package/dist/bin/package/clean.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +1494 -1494
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/copy-assets-cjs.mjs +1 -1
- package/dist/bin/package/copy-assets-esm.mjs +1 -1
- package/dist/bin/package/publint.mjs +1 -1
- package/dist/bin/package/publint.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +1494 -1494
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/bin/package/sync-layout.mjs.map +1 -1
- package/dist/bin/xy.mjs +1293 -662
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/bin/xyex.mjs +1293 -662
- package/dist/bin/xyex.mjs.map +1 -1
- package/dist/lib/loadConfig.d.ts +5 -0
- package/dist/lib/loadConfig.d.ts.map +1 -1
- package/dist/xy/common/checkCommand.d.ts.map +1 -1
- package/dist/xy/common/skills/index.d.ts.map +1 -1
- package/dist/xy/xy.d.ts +2 -0
- package/dist/xy/xy.d.ts.map +1 -1
- package/package.json +4 -4
- package/templates/repo/cli/root/AGENTS.md.tmpl +26 -17
- package/templates/repo/cli/root/docs/README.md.tmpl +4 -0
- package/templates/repo/cli/root/github/workflows/build-bun.yml.tmpl +8 -0
- package/templates/repo/cli/root/github/workflows/build-npm.yml.tmpl +9 -1
- package/templates/repo/cli/root/github/workflows/build-pnpm.yml.tmpl +10 -2
- package/templates/repo/cli/root/github/workflows/build-yarn.yml.tmpl +9 -1
- package/templates/repo/cli/root/package.json.tmpl +3 -3
- package/templates/repo/cli/root/papers/README.md.tmpl +10 -0
- package/templates/repo/cli/root/pnpm-workspace.yaml +4 -0
package/dist/bin/xyex.mjs
CHANGED
|
@@ -6,15 +6,15 @@ import tty from "node:tty";
|
|
|
6
6
|
import * as xi from "node:fs";
|
|
7
7
|
import fs, { closeSync, copyFileSync, existsSync, lstatSync, mkdirSync, openSync, promises, readFileSync, readSync, readdirSync, readlinkSync, realpathSync, rmSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
8
8
|
import path, { basename, delimiter, dirname, normalize, posix, resolve, win32 } from "node:path";
|
|
9
|
+
import { basename as basename$1, dirname as dirname$1, extname, join, normalize as normalize$1, relative, resolve as resolve$1 } from "path";
|
|
10
|
+
import { lstatSync as lstatSync$1, readFileSync as readFileSync$1, readdir, readdirSync as readdirSync$1, readlinkSync as readlinkSync$1, realpathSync as realpathSync$1, statSync as statSync$1, writeFile } from "fs";
|
|
9
11
|
import { AsyncLocalStorage, AsyncResource } from "node:async_hooks";
|
|
10
12
|
import posixPath from "node:path/posix";
|
|
11
13
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
12
|
-
import { lstatSync as lstatSync$1, readFileSync as readFileSync$1, readdir, readdirSync as readdirSync$1, readlinkSync as readlinkSync$1, realpathSync as realpathSync$1, statSync as statSync$1, writeFile } from "fs";
|
|
13
14
|
import fs$1, { lstat, readdir as readdir$1, readlink, realpath } from "node:fs/promises";
|
|
14
15
|
import { EventEmitter } from "node:events";
|
|
15
16
|
import Pe, { PassThrough } from "node:stream";
|
|
16
17
|
import { StringDecoder } from "node:string_decoder";
|
|
17
|
-
import { basename as basename$1, dirname as dirname$1, extname, join, normalize as normalize$1, relative, resolve as resolve$1 } from "path";
|
|
18
18
|
import { execFile, execFileSync, spawn, spawnSync } from "node:child_process";
|
|
19
19
|
import * as readline$2 from "node:readline";
|
|
20
20
|
import readline, { createInterface } from "node:readline";
|
|
@@ -626,9 +626,441 @@ const ADAPTER_PATHS = [
|
|
|
626
626
|
".github/copilot-instructions.md",
|
|
627
627
|
"GEMINI.md"
|
|
628
628
|
];
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
629
|
+
const CLAUDE_AGENTS_IMPORT = /^@(\.\/)?AGENTS\.md$/;
|
|
630
|
+
const COPILOT_AGENTS_IMPORT = /^@(\.\/|\.\.\/)?AGENTS\.md$/;
|
|
631
|
+
/**
|
|
632
|
+
* Markdown with fenced blocks, inline code, and HTML comments removed, matching
|
|
633
|
+
* the plan linter's visible text so an import inside those does not count.
|
|
634
|
+
*/
|
|
635
|
+
function visibleInstructionMarkdown(markdown) {
|
|
636
|
+
return markdown.replaceAll(/^ {0,3}([`~]{3,})[^\n]*\n[\s\S]*?^ {0,3}\1[^\n]*$/gmu, "\n").replaceAll(/`[^`\n]+`/g, " ").replaceAll(/<!--[\s\S]*?-->/g, " ");
|
|
637
|
+
}
|
|
638
|
+
function visibleInstructionLines(markdown) {
|
|
639
|
+
return visibleInstructionMarkdown(markdown).split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* Where a Claude or Gemini `@AGENTS.md` import sits. Tool-specific sections
|
|
643
|
+
* may follow a leading import. An import that is not the first visible line
|
|
644
|
+
* does not count.
|
|
645
|
+
*/
|
|
646
|
+
function claudeAgentsImportPlacement(text) {
|
|
647
|
+
const index = visibleInstructionLines(text).findIndex((line) => CLAUDE_AGENTS_IMPORT.test(line));
|
|
648
|
+
if (index === -1) return "absent";
|
|
649
|
+
return index === 0 ? "first" : "later";
|
|
650
|
+
}
|
|
651
|
+
function hasCopilotAgentsReference(text) {
|
|
652
|
+
return visibleInstructionLines(text).some((line) => COPILOT_AGENTS_IMPORT.test(line));
|
|
653
|
+
}
|
|
654
|
+
function markdownLinkTargets(text) {
|
|
655
|
+
return visibleInstructionMarkdown(text).matchAll(/\[[^\]]*]\(([^)]+)\)/g).map((match) => match[1]?.trim() ?? "").filter((target) => target.length > 0).toArray();
|
|
656
|
+
}
|
|
657
|
+
//#endregion
|
|
658
|
+
//#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
|
|
659
|
+
var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
660
|
+
module.exports = isexe;
|
|
661
|
+
isexe.sync = sync;
|
|
662
|
+
var fs$5 = __require("fs");
|
|
663
|
+
function checkPathExt(path, options) {
|
|
664
|
+
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
665
|
+
if (!pathext) return true;
|
|
666
|
+
pathext = pathext.split(";");
|
|
667
|
+
if (pathext.indexOf("") !== -1) return true;
|
|
668
|
+
for (var i = 0; i < pathext.length; i++) {
|
|
669
|
+
var p = pathext[i].toLowerCase();
|
|
670
|
+
if (p && path.substr(-p.length).toLowerCase() === p) return true;
|
|
671
|
+
}
|
|
672
|
+
return false;
|
|
673
|
+
}
|
|
674
|
+
function checkStat(stat, path, options) {
|
|
675
|
+
if (!stat.isSymbolicLink() && !stat.isFile()) return false;
|
|
676
|
+
return checkPathExt(path, options);
|
|
677
|
+
}
|
|
678
|
+
function isexe(path, options, cb) {
|
|
679
|
+
fs$5.stat(path, function(er, stat) {
|
|
680
|
+
cb(er, er ? false : checkStat(stat, path, options));
|
|
681
|
+
});
|
|
682
|
+
}
|
|
683
|
+
function sync(path, options) {
|
|
684
|
+
return checkStat(fs$5.statSync(path), path, options);
|
|
685
|
+
}
|
|
686
|
+
}));
|
|
687
|
+
//#endregion
|
|
688
|
+
//#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js
|
|
689
|
+
var require_mode = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
690
|
+
module.exports = isexe;
|
|
691
|
+
isexe.sync = sync;
|
|
692
|
+
var fs$4 = __require("fs");
|
|
693
|
+
function isexe(path, options, cb) {
|
|
694
|
+
fs$4.stat(path, function(er, stat) {
|
|
695
|
+
cb(er, er ? false : checkStat(stat, options));
|
|
696
|
+
});
|
|
697
|
+
}
|
|
698
|
+
function sync(path, options) {
|
|
699
|
+
return checkStat(fs$4.statSync(path), options);
|
|
700
|
+
}
|
|
701
|
+
function checkStat(stat, options) {
|
|
702
|
+
return stat.isFile() && checkMode(stat, options);
|
|
703
|
+
}
|
|
704
|
+
function checkMode(stat, options) {
|
|
705
|
+
var mod = stat.mode;
|
|
706
|
+
var uid = stat.uid;
|
|
707
|
+
var gid = stat.gid;
|
|
708
|
+
var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
|
|
709
|
+
var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
|
|
710
|
+
var u = parseInt("100", 8);
|
|
711
|
+
var g = parseInt("010", 8);
|
|
712
|
+
var o = parseInt("001", 8);
|
|
713
|
+
var ug = u | g;
|
|
714
|
+
return mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
|
|
715
|
+
}
|
|
716
|
+
}));
|
|
717
|
+
//#endregion
|
|
718
|
+
//#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
|
|
719
|
+
var require_isexe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
720
|
+
__require("fs");
|
|
721
|
+
var core;
|
|
722
|
+
if (process.platform === "win32" || global.TESTING_WINDOWS) core = require_windows();
|
|
723
|
+
else core = require_mode();
|
|
724
|
+
module.exports = isexe;
|
|
725
|
+
isexe.sync = sync;
|
|
726
|
+
function isexe(path, options, cb) {
|
|
727
|
+
if (typeof options === "function") {
|
|
728
|
+
cb = options;
|
|
729
|
+
options = {};
|
|
730
|
+
}
|
|
731
|
+
if (!cb) {
|
|
732
|
+
if (typeof Promise !== "function") throw new TypeError("callback not provided");
|
|
733
|
+
return new Promise(function(resolve, reject) {
|
|
734
|
+
isexe(path, options || {}, function(er, is) {
|
|
735
|
+
if (er) reject(er);
|
|
736
|
+
else resolve(is);
|
|
737
|
+
});
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
core(path, options || {}, function(er, is) {
|
|
741
|
+
if (er) {
|
|
742
|
+
if (er.code === "EACCES" || options && options.ignoreErrors) {
|
|
743
|
+
er = null;
|
|
744
|
+
is = false;
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
cb(er, is);
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
function sync(path, options) {
|
|
751
|
+
try {
|
|
752
|
+
return core.sync(path, options || {});
|
|
753
|
+
} catch (er) {
|
|
754
|
+
if (options && options.ignoreErrors || er.code === "EACCES") return false;
|
|
755
|
+
else throw er;
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
}));
|
|
759
|
+
//#endregion
|
|
760
|
+
//#region ../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
|
|
761
|
+
var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
762
|
+
const isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
763
|
+
const path$5 = __require("path");
|
|
764
|
+
const COLON = isWindows ? ";" : ":";
|
|
765
|
+
const isexe = require_isexe();
|
|
766
|
+
const getNotFoundError = (cmd) => Object.assign(/* @__PURE__ */ new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
767
|
+
const getPathInfo = (cmd, opt) => {
|
|
768
|
+
const colon = opt.colon || COLON;
|
|
769
|
+
const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [...isWindows ? [process.cwd()] : [], ...(opt.path || process.env.PATH ||
|
|
770
|
+
/* istanbul ignore next: very unusual */ "").split(colon)];
|
|
771
|
+
const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
|
|
772
|
+
const pathExt = isWindows ? pathExtExe.split(colon) : [""];
|
|
773
|
+
if (isWindows) {
|
|
774
|
+
if (cmd.indexOf(".") !== -1 && pathExt[0] !== "") pathExt.unshift("");
|
|
775
|
+
}
|
|
776
|
+
return {
|
|
777
|
+
pathEnv,
|
|
778
|
+
pathExt,
|
|
779
|
+
pathExtExe
|
|
780
|
+
};
|
|
781
|
+
};
|
|
782
|
+
const which = (cmd, opt, cb) => {
|
|
783
|
+
if (typeof opt === "function") {
|
|
784
|
+
cb = opt;
|
|
785
|
+
opt = {};
|
|
786
|
+
}
|
|
787
|
+
if (!opt) opt = {};
|
|
788
|
+
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
789
|
+
const found = [];
|
|
790
|
+
const step = (i) => new Promise((resolve, reject) => {
|
|
791
|
+
if (i === pathEnv.length) return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
|
|
792
|
+
const ppRaw = pathEnv[i];
|
|
793
|
+
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
794
|
+
const pCmd = path$5.join(pathPart, cmd);
|
|
795
|
+
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
796
|
+
resolve(subStep(p, i, 0));
|
|
797
|
+
});
|
|
798
|
+
const subStep = (p, i, ii) => new Promise((resolve, reject) => {
|
|
799
|
+
if (ii === pathExt.length) return resolve(step(i + 1));
|
|
800
|
+
const ext = pathExt[ii];
|
|
801
|
+
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
802
|
+
if (!er && is) {
|
|
803
|
+
if (opt.all) found.push(p + ext);
|
|
804
|
+
else return resolve(p + ext);
|
|
805
|
+
}
|
|
806
|
+
return resolve(subStep(p, i, ii + 1));
|
|
807
|
+
});
|
|
808
|
+
});
|
|
809
|
+
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
810
|
+
};
|
|
811
|
+
const whichSync = (cmd, opt) => {
|
|
812
|
+
opt = opt || {};
|
|
813
|
+
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
814
|
+
const found = [];
|
|
815
|
+
for (let i = 0; i < pathEnv.length; i++) {
|
|
816
|
+
const ppRaw = pathEnv[i];
|
|
817
|
+
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
818
|
+
const pCmd = path$5.join(pathPart, cmd);
|
|
819
|
+
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
820
|
+
for (let j = 0; j < pathExt.length; j++) {
|
|
821
|
+
const cur = p + pathExt[j];
|
|
822
|
+
try {
|
|
823
|
+
if (isexe.sync(cur, { pathExt: pathExtExe })) {
|
|
824
|
+
if (opt.all) found.push(cur);
|
|
825
|
+
else return cur;
|
|
826
|
+
}
|
|
827
|
+
} catch (ex) {}
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
if (opt.all && found.length) return found;
|
|
831
|
+
if (opt.nothrow) return null;
|
|
832
|
+
throw getNotFoundError(cmd);
|
|
833
|
+
};
|
|
834
|
+
module.exports = which;
|
|
835
|
+
which.sync = whichSync;
|
|
836
|
+
}));
|
|
837
|
+
//#endregion
|
|
838
|
+
//#region ../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js
|
|
839
|
+
var require_path_key = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
840
|
+
const pathKey = (options = {}) => {
|
|
841
|
+
const environment = options.env || process.env;
|
|
842
|
+
if ((options.platform || process.platform) !== "win32") return "PATH";
|
|
843
|
+
return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
|
|
844
|
+
};
|
|
845
|
+
module.exports = pathKey;
|
|
846
|
+
module.exports.default = pathKey;
|
|
847
|
+
}));
|
|
848
|
+
//#endregion
|
|
849
|
+
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
|
|
850
|
+
var require_resolveCommand = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
851
|
+
const path$4 = __require("path");
|
|
852
|
+
const which = require_which();
|
|
853
|
+
const getPathKey = require_path_key();
|
|
854
|
+
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
855
|
+
const env = parsed.options.env || process.env;
|
|
856
|
+
const cwd = process.cwd();
|
|
857
|
+
const hasCustomCwd = parsed.options.cwd != null;
|
|
858
|
+
const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
|
|
859
|
+
if (shouldSwitchCwd) try {
|
|
860
|
+
process.chdir(parsed.options.cwd);
|
|
861
|
+
} catch (err) {}
|
|
862
|
+
let resolved;
|
|
863
|
+
try {
|
|
864
|
+
resolved = which.sync(parsed.command, {
|
|
865
|
+
path: env[getPathKey({ env })],
|
|
866
|
+
pathExt: withoutPathExt ? path$4.delimiter : void 0
|
|
867
|
+
});
|
|
868
|
+
} catch (e) {} finally {
|
|
869
|
+
if (shouldSwitchCwd) process.chdir(cwd);
|
|
870
|
+
}
|
|
871
|
+
if (resolved) resolved = path$4.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
872
|
+
return resolved;
|
|
873
|
+
}
|
|
874
|
+
function resolveCommand(parsed) {
|
|
875
|
+
return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
|
|
876
|
+
}
|
|
877
|
+
module.exports = resolveCommand;
|
|
878
|
+
}));
|
|
879
|
+
//#endregion
|
|
880
|
+
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js
|
|
881
|
+
var require_escape = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
882
|
+
const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
|
|
883
|
+
function escapeCommand(arg) {
|
|
884
|
+
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
885
|
+
return arg;
|
|
886
|
+
}
|
|
887
|
+
function escapeArgument(arg, doubleEscapeMetaChars) {
|
|
888
|
+
arg = `${arg}`;
|
|
889
|
+
arg = arg.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
|
|
890
|
+
arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
|
|
891
|
+
arg = `"${arg}"`;
|
|
892
|
+
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
893
|
+
if (doubleEscapeMetaChars) arg = arg.replace(metaCharsRegExp, "^$1");
|
|
894
|
+
return arg;
|
|
895
|
+
}
|
|
896
|
+
module.exports.command = escapeCommand;
|
|
897
|
+
module.exports.argument = escapeArgument;
|
|
898
|
+
}));
|
|
899
|
+
//#endregion
|
|
900
|
+
//#region ../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js
|
|
901
|
+
var require_shebang_regex = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
902
|
+
module.exports = /^#!(.*)/;
|
|
903
|
+
}));
|
|
904
|
+
//#endregion
|
|
905
|
+
//#region ../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js
|
|
906
|
+
var require_shebang_command = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
907
|
+
const shebangRegex = require_shebang_regex();
|
|
908
|
+
module.exports = (string = "") => {
|
|
909
|
+
const match = string.match(shebangRegex);
|
|
910
|
+
if (!match) return null;
|
|
911
|
+
const [path, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
912
|
+
const binary = path.split("/").pop();
|
|
913
|
+
if (binary === "env") return argument;
|
|
914
|
+
return argument ? `${binary} ${argument}` : binary;
|
|
915
|
+
};
|
|
916
|
+
}));
|
|
917
|
+
//#endregion
|
|
918
|
+
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
|
|
919
|
+
var require_readShebang = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
920
|
+
const fs$3 = __require("fs");
|
|
921
|
+
const shebangCommand = require_shebang_command();
|
|
922
|
+
function readShebang(command) {
|
|
923
|
+
const size = 150;
|
|
924
|
+
const buffer = Buffer.alloc(size);
|
|
925
|
+
let fd;
|
|
926
|
+
try {
|
|
927
|
+
fd = fs$3.openSync(command, "r");
|
|
928
|
+
fs$3.readSync(fd, buffer, 0, size, 0);
|
|
929
|
+
fs$3.closeSync(fd);
|
|
930
|
+
} catch (e) {}
|
|
931
|
+
return shebangCommand(buffer.toString());
|
|
932
|
+
}
|
|
933
|
+
module.exports = readShebang;
|
|
934
|
+
}));
|
|
935
|
+
//#endregion
|
|
936
|
+
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
|
|
937
|
+
var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
938
|
+
const path$3 = __require("path");
|
|
939
|
+
const resolveCommand = require_resolveCommand();
|
|
940
|
+
const escape = require_escape();
|
|
941
|
+
const readShebang = require_readShebang();
|
|
942
|
+
const isWin = process.platform === "win32";
|
|
943
|
+
const isExecutableRegExp = /\.(?:com|exe)$/i;
|
|
944
|
+
const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
945
|
+
function detectShebang(parsed) {
|
|
946
|
+
parsed.file = resolveCommand(parsed);
|
|
947
|
+
const shebang = parsed.file && readShebang(parsed.file);
|
|
948
|
+
if (shebang) {
|
|
949
|
+
parsed.args.unshift(parsed.file);
|
|
950
|
+
parsed.command = shebang;
|
|
951
|
+
return resolveCommand(parsed);
|
|
952
|
+
}
|
|
953
|
+
return parsed.file;
|
|
954
|
+
}
|
|
955
|
+
function parseNonShell(parsed) {
|
|
956
|
+
if (!isWin) return parsed;
|
|
957
|
+
const commandFile = detectShebang(parsed);
|
|
958
|
+
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
959
|
+
if (parsed.options.forceShell || needsShell) {
|
|
960
|
+
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
961
|
+
parsed.command = path$3.normalize(parsed.command);
|
|
962
|
+
parsed.command = escape.command(parsed.command);
|
|
963
|
+
parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
|
|
964
|
+
parsed.args = [
|
|
965
|
+
"/d",
|
|
966
|
+
"/s",
|
|
967
|
+
"/c",
|
|
968
|
+
`"${[parsed.command].concat(parsed.args).join(" ")}"`
|
|
969
|
+
];
|
|
970
|
+
parsed.command = process.env.comspec || "cmd.exe";
|
|
971
|
+
parsed.options.windowsVerbatimArguments = true;
|
|
972
|
+
}
|
|
973
|
+
return parsed;
|
|
974
|
+
}
|
|
975
|
+
function parse(command, args, options) {
|
|
976
|
+
if (args && !Array.isArray(args)) {
|
|
977
|
+
options = args;
|
|
978
|
+
args = null;
|
|
979
|
+
}
|
|
980
|
+
args = args ? args.slice(0) : [];
|
|
981
|
+
options = Object.assign({}, options);
|
|
982
|
+
const parsed = {
|
|
983
|
+
command,
|
|
984
|
+
args,
|
|
985
|
+
options,
|
|
986
|
+
file: void 0,
|
|
987
|
+
original: {
|
|
988
|
+
command,
|
|
989
|
+
args
|
|
990
|
+
}
|
|
991
|
+
};
|
|
992
|
+
return options.shell ? parsed : parseNonShell(parsed);
|
|
993
|
+
}
|
|
994
|
+
module.exports = parse;
|
|
995
|
+
}));
|
|
996
|
+
//#endregion
|
|
997
|
+
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js
|
|
998
|
+
var require_enoent = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
999
|
+
const isWin = process.platform === "win32";
|
|
1000
|
+
function notFoundError(original, syscall) {
|
|
1001
|
+
return Object.assign(/* @__PURE__ */ new Error(`${syscall} ${original.command} ENOENT`), {
|
|
1002
|
+
code: "ENOENT",
|
|
1003
|
+
errno: "ENOENT",
|
|
1004
|
+
syscall: `${syscall} ${original.command}`,
|
|
1005
|
+
path: original.command,
|
|
1006
|
+
spawnargs: original.args
|
|
1007
|
+
});
|
|
1008
|
+
}
|
|
1009
|
+
function hookChildProcess(cp, parsed) {
|
|
1010
|
+
if (!isWin) return;
|
|
1011
|
+
const originalEmit = cp.emit;
|
|
1012
|
+
cp.emit = function(name, arg1) {
|
|
1013
|
+
if (name === "exit") {
|
|
1014
|
+
const err = verifyENOENT(arg1, parsed);
|
|
1015
|
+
if (err) return originalEmit.call(cp, "error", err);
|
|
1016
|
+
}
|
|
1017
|
+
return originalEmit.apply(cp, arguments);
|
|
1018
|
+
};
|
|
1019
|
+
}
|
|
1020
|
+
function verifyENOENT(status, parsed) {
|
|
1021
|
+
if (isWin && status === 1 && !parsed.file) return notFoundError(parsed.original, "spawn");
|
|
1022
|
+
return null;
|
|
1023
|
+
}
|
|
1024
|
+
function verifyENOENTSync(status, parsed) {
|
|
1025
|
+
if (isWin && status === 1 && !parsed.file) return notFoundError(parsed.original, "spawnSync");
|
|
1026
|
+
return null;
|
|
1027
|
+
}
|
|
1028
|
+
module.exports = {
|
|
1029
|
+
hookChildProcess,
|
|
1030
|
+
verifyENOENT,
|
|
1031
|
+
verifyENOENTSync,
|
|
1032
|
+
notFoundError
|
|
1033
|
+
};
|
|
1034
|
+
}));
|
|
1035
|
+
//#endregion
|
|
1036
|
+
//#region src/lib/crossSpawn.ts
|
|
1037
|
+
var import_cross_spawn = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1038
|
+
const cp = __require("child_process");
|
|
1039
|
+
const parse = require_parse$1();
|
|
1040
|
+
const enoent = require_enoent();
|
|
1041
|
+
function spawn(command, args, options) {
|
|
1042
|
+
const parsed = parse(command, args, options);
|
|
1043
|
+
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
1044
|
+
enoent.hookChildProcess(spawned, parsed);
|
|
1045
|
+
return spawned;
|
|
1046
|
+
}
|
|
1047
|
+
function spawnSync(command, args, options) {
|
|
1048
|
+
const parsed = parse(command, args, options);
|
|
1049
|
+
const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
1050
|
+
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
1051
|
+
return result;
|
|
1052
|
+
}
|
|
1053
|
+
module.exports = spawn;
|
|
1054
|
+
module.exports.spawn = spawn;
|
|
1055
|
+
module.exports.sync = spawnSync;
|
|
1056
|
+
module.exports._parse = parse;
|
|
1057
|
+
module.exports._enoent = enoent;
|
|
1058
|
+
})))(), 1);
|
|
1059
|
+
function spawn$1(command, args, options) {
|
|
1060
|
+
return (0, import_cross_spawn.default)(command, args, options);
|
|
1061
|
+
}
|
|
1062
|
+
function spawnSync$1(command, args, options) {
|
|
1063
|
+
return import_cross_spawn.default.sync(command, args, options);
|
|
632
1064
|
}
|
|
633
1065
|
//#endregion
|
|
634
1066
|
//#region src/lib/gitCheckoutRoot.ts
|
|
@@ -687,7 +1119,18 @@ function walkRepoFiles(root, include) {
|
|
|
687
1119
|
}
|
|
688
1120
|
};
|
|
689
1121
|
visit(root, true);
|
|
690
|
-
return found.toSorted();
|
|
1122
|
+
return dropGitignored(root, found.toSorted());
|
|
1123
|
+
}
|
|
1124
|
+
function dropGitignored(root, relativePaths) {
|
|
1125
|
+
if (relativePaths.length === 0 || !fs.existsSync(path.join(root, ".git"))) return relativePaths;
|
|
1126
|
+
const result = spawnSync$1("git", ["check-ignore", "--stdin"], {
|
|
1127
|
+
cwd: root,
|
|
1128
|
+
encoding: "utf8",
|
|
1129
|
+
input: `${relativePaths.join("\n")}\n`
|
|
1130
|
+
});
|
|
1131
|
+
if (result.error !== void 0 || result.status !== 0 && result.status !== 1) return relativePaths;
|
|
1132
|
+
const ignored = new Set((result.stdout ?? "").split("\n").map((line) => line.trim()).filter((line) => line.length > 0));
|
|
1133
|
+
return relativePaths.filter((relativePath) => !ignored.has(relativePath));
|
|
691
1134
|
}
|
|
692
1135
|
//#endregion
|
|
693
1136
|
//#region src/actions/agent/context.ts
|
|
@@ -768,7 +1211,7 @@ Use the repository package scripts from the root.
|
|
|
768
1211
|
|
|
769
1212
|
## Failures
|
|
770
1213
|
|
|
771
|
-
Re-run the failing command after the fix.
|
|
1214
|
+
Re-run the failing command after the fix. Keep task assignments out of this file.
|
|
772
1215
|
`;
|
|
773
1216
|
const CLAUDE_ADAPTER = "@AGENTS.md\n";
|
|
774
1217
|
function writeIfMissing(cwd, relativePath, contents, result) {
|
|
@@ -918,7 +1361,7 @@ function Ht(n) {
|
|
|
918
1361
|
return isNaN(n) ? n.charCodeAt(0) : parseInt(n, 10);
|
|
919
1362
|
}
|
|
920
1363
|
function ps(n) {
|
|
921
|
-
return n.replace(as, fe).replace(ls, ue).replace(cs, qt).replace(fs$
|
|
1364
|
+
return n.replace(as, fe).replace(ls, ue).replace(cs, qt).replace(fs$2, de).replace(us, pe);
|
|
922
1365
|
}
|
|
923
1366
|
function ms(n) {
|
|
924
1367
|
return n.replace(is, "\\").replace(rs, "{").replace(ns, "}").replace(os$2, ",").replace(hs, ".");
|
|
@@ -1010,7 +1453,7 @@ function Ut(n, t = {}) {
|
|
|
1010
1453
|
function es(n, t = {}) {
|
|
1011
1454
|
return new I(n, t).iterate();
|
|
1012
1455
|
}
|
|
1013
|
-
var Gt, ce, ss, fe, ue, qt, de, pe, is, rs, ns, os$2, hs, as, ls, cs, fs$
|
|
1456
|
+
var Gt, ce, ss, fe, ue, qt, de, pe, is, rs, ns, os$2, hs, as, ls, cs, fs$2, us, ds, at, Ss, lt, Es, we, ye, W, xs, be, vs, Ct, Cs, Ts, As, ks, Kt, Se, Ee, Q, tt, O, Rs, Os, Fs, Ds, Ms, Ns, _s, Ls, Ws, Ps, js, Is, zs, Bs, Us, $s, Gs, Hs, Ce, Te, Ae, xe, A, Vs, Ys, Xs, Js, N, Zs, ke, Qs, ti, ve, ei, D, si, Oe, Vt, Fe, At, Re, ii, q, De, Tt, ri, ft, Ne, oi, hi, ai, G, H, K, kt, ut, Rt, _e, Ot, Le, P, et, v, dt, st, C, F, T, Yt, Ft, k, x$1, Xt, Jt, We, Zt, B, Qt, Dt, pt, Y, M, mt, li, ci, fi, ui$1, Mt, te, di, pi, V, vi, wt, Ue, $e, Ri, Oi, L, Ge, He, U, qe, Ke, X, Ve, _, gt, se, je, yt, j, Nt, Lt, Ie, Fi, ie, ze, bt, Be, _t, Wt, ne, Ye, R, Pt, jt, It, it, rt, St, Xe, Di, Mi, Ni, nt, _i, ot, oe, he, ae, Et, Li, zt, xt, vt, Pi, I, le, ji, Ii, zi, Bi, Ui, Ze;
|
|
1014
1457
|
var init_index_min = __esmMin((() => {
|
|
1015
1458
|
Gt = (n, t, e) => {
|
|
1016
1459
|
let s = n instanceof RegExp ? ce(n, e) : n, i = t instanceof RegExp ? ce(t, e) : t, r = s !== null && i != null && ss(s, i, e);
|
|
@@ -1055,7 +1498,7 @@ var init_index_min = __esmMin((() => {
|
|
|
1055
1498
|
as = /\\\\/g;
|
|
1056
1499
|
ls = /\\{/g;
|
|
1057
1500
|
cs = /\\}/g;
|
|
1058
|
-
fs$
|
|
1501
|
+
fs$2 = /\\,/g;
|
|
1059
1502
|
us = /\\./g;
|
|
1060
1503
|
ds = 1e5;
|
|
1061
1504
|
at = (n) => {
|
|
@@ -4254,414 +4697,6 @@ function copyAssetFiles(srcDir, destDir) {
|
|
|
4254
4697
|
return copied;
|
|
4255
4698
|
}
|
|
4256
4699
|
//#endregion
|
|
4257
|
-
//#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
|
|
4258
|
-
var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4259
|
-
module.exports = isexe;
|
|
4260
|
-
isexe.sync = sync;
|
|
4261
|
-
var fs$4 = __require("fs");
|
|
4262
|
-
function checkPathExt(path, options) {
|
|
4263
|
-
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
4264
|
-
if (!pathext) return true;
|
|
4265
|
-
pathext = pathext.split(";");
|
|
4266
|
-
if (pathext.indexOf("") !== -1) return true;
|
|
4267
|
-
for (var i = 0; i < pathext.length; i++) {
|
|
4268
|
-
var p = pathext[i].toLowerCase();
|
|
4269
|
-
if (p && path.substr(-p.length).toLowerCase() === p) return true;
|
|
4270
|
-
}
|
|
4271
|
-
return false;
|
|
4272
|
-
}
|
|
4273
|
-
function checkStat(stat, path, options) {
|
|
4274
|
-
if (!stat.isSymbolicLink() && !stat.isFile()) return false;
|
|
4275
|
-
return checkPathExt(path, options);
|
|
4276
|
-
}
|
|
4277
|
-
function isexe(path, options, cb) {
|
|
4278
|
-
fs$4.stat(path, function(er, stat) {
|
|
4279
|
-
cb(er, er ? false : checkStat(stat, path, options));
|
|
4280
|
-
});
|
|
4281
|
-
}
|
|
4282
|
-
function sync(path, options) {
|
|
4283
|
-
return checkStat(fs$4.statSync(path), path, options);
|
|
4284
|
-
}
|
|
4285
|
-
}));
|
|
4286
|
-
//#endregion
|
|
4287
|
-
//#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js
|
|
4288
|
-
var require_mode = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4289
|
-
module.exports = isexe;
|
|
4290
|
-
isexe.sync = sync;
|
|
4291
|
-
var fs$3 = __require("fs");
|
|
4292
|
-
function isexe(path, options, cb) {
|
|
4293
|
-
fs$3.stat(path, function(er, stat) {
|
|
4294
|
-
cb(er, er ? false : checkStat(stat, options));
|
|
4295
|
-
});
|
|
4296
|
-
}
|
|
4297
|
-
function sync(path, options) {
|
|
4298
|
-
return checkStat(fs$3.statSync(path), options);
|
|
4299
|
-
}
|
|
4300
|
-
function checkStat(stat, options) {
|
|
4301
|
-
return stat.isFile() && checkMode(stat, options);
|
|
4302
|
-
}
|
|
4303
|
-
function checkMode(stat, options) {
|
|
4304
|
-
var mod = stat.mode;
|
|
4305
|
-
var uid = stat.uid;
|
|
4306
|
-
var gid = stat.gid;
|
|
4307
|
-
var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
|
|
4308
|
-
var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
|
|
4309
|
-
var u = parseInt("100", 8);
|
|
4310
|
-
var g = parseInt("010", 8);
|
|
4311
|
-
var o = parseInt("001", 8);
|
|
4312
|
-
var ug = u | g;
|
|
4313
|
-
return mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
|
|
4314
|
-
}
|
|
4315
|
-
}));
|
|
4316
|
-
//#endregion
|
|
4317
|
-
//#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
|
|
4318
|
-
var require_isexe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4319
|
-
__require("fs");
|
|
4320
|
-
var core;
|
|
4321
|
-
if (process.platform === "win32" || global.TESTING_WINDOWS) core = require_windows();
|
|
4322
|
-
else core = require_mode();
|
|
4323
|
-
module.exports = isexe;
|
|
4324
|
-
isexe.sync = sync;
|
|
4325
|
-
function isexe(path, options, cb) {
|
|
4326
|
-
if (typeof options === "function") {
|
|
4327
|
-
cb = options;
|
|
4328
|
-
options = {};
|
|
4329
|
-
}
|
|
4330
|
-
if (!cb) {
|
|
4331
|
-
if (typeof Promise !== "function") throw new TypeError("callback not provided");
|
|
4332
|
-
return new Promise(function(resolve, reject) {
|
|
4333
|
-
isexe(path, options || {}, function(er, is) {
|
|
4334
|
-
if (er) reject(er);
|
|
4335
|
-
else resolve(is);
|
|
4336
|
-
});
|
|
4337
|
-
});
|
|
4338
|
-
}
|
|
4339
|
-
core(path, options || {}, function(er, is) {
|
|
4340
|
-
if (er) {
|
|
4341
|
-
if (er.code === "EACCES" || options && options.ignoreErrors) {
|
|
4342
|
-
er = null;
|
|
4343
|
-
is = false;
|
|
4344
|
-
}
|
|
4345
|
-
}
|
|
4346
|
-
cb(er, is);
|
|
4347
|
-
});
|
|
4348
|
-
}
|
|
4349
|
-
function sync(path, options) {
|
|
4350
|
-
try {
|
|
4351
|
-
return core.sync(path, options || {});
|
|
4352
|
-
} catch (er) {
|
|
4353
|
-
if (options && options.ignoreErrors || er.code === "EACCES") return false;
|
|
4354
|
-
else throw er;
|
|
4355
|
-
}
|
|
4356
|
-
}
|
|
4357
|
-
}));
|
|
4358
|
-
//#endregion
|
|
4359
|
-
//#region ../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
|
|
4360
|
-
var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4361
|
-
const isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
4362
|
-
const path$5 = __require("path");
|
|
4363
|
-
const COLON = isWindows ? ";" : ":";
|
|
4364
|
-
const isexe = require_isexe();
|
|
4365
|
-
const getNotFoundError = (cmd) => Object.assign(/* @__PURE__ */ new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
4366
|
-
const getPathInfo = (cmd, opt) => {
|
|
4367
|
-
const colon = opt.colon || COLON;
|
|
4368
|
-
const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [...isWindows ? [process.cwd()] : [], ...(opt.path || process.env.PATH ||
|
|
4369
|
-
/* istanbul ignore next: very unusual */ "").split(colon)];
|
|
4370
|
-
const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
|
|
4371
|
-
const pathExt = isWindows ? pathExtExe.split(colon) : [""];
|
|
4372
|
-
if (isWindows) {
|
|
4373
|
-
if (cmd.indexOf(".") !== -1 && pathExt[0] !== "") pathExt.unshift("");
|
|
4374
|
-
}
|
|
4375
|
-
return {
|
|
4376
|
-
pathEnv,
|
|
4377
|
-
pathExt,
|
|
4378
|
-
pathExtExe
|
|
4379
|
-
};
|
|
4380
|
-
};
|
|
4381
|
-
const which = (cmd, opt, cb) => {
|
|
4382
|
-
if (typeof opt === "function") {
|
|
4383
|
-
cb = opt;
|
|
4384
|
-
opt = {};
|
|
4385
|
-
}
|
|
4386
|
-
if (!opt) opt = {};
|
|
4387
|
-
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
4388
|
-
const found = [];
|
|
4389
|
-
const step = (i) => new Promise((resolve, reject) => {
|
|
4390
|
-
if (i === pathEnv.length) return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
|
|
4391
|
-
const ppRaw = pathEnv[i];
|
|
4392
|
-
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
4393
|
-
const pCmd = path$5.join(pathPart, cmd);
|
|
4394
|
-
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
4395
|
-
resolve(subStep(p, i, 0));
|
|
4396
|
-
});
|
|
4397
|
-
const subStep = (p, i, ii) => new Promise((resolve, reject) => {
|
|
4398
|
-
if (ii === pathExt.length) return resolve(step(i + 1));
|
|
4399
|
-
const ext = pathExt[ii];
|
|
4400
|
-
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
4401
|
-
if (!er && is) {
|
|
4402
|
-
if (opt.all) found.push(p + ext);
|
|
4403
|
-
else return resolve(p + ext);
|
|
4404
|
-
}
|
|
4405
|
-
return resolve(subStep(p, i, ii + 1));
|
|
4406
|
-
});
|
|
4407
|
-
});
|
|
4408
|
-
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
4409
|
-
};
|
|
4410
|
-
const whichSync = (cmd, opt) => {
|
|
4411
|
-
opt = opt || {};
|
|
4412
|
-
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
4413
|
-
const found = [];
|
|
4414
|
-
for (let i = 0; i < pathEnv.length; i++) {
|
|
4415
|
-
const ppRaw = pathEnv[i];
|
|
4416
|
-
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
4417
|
-
const pCmd = path$5.join(pathPart, cmd);
|
|
4418
|
-
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
4419
|
-
for (let j = 0; j < pathExt.length; j++) {
|
|
4420
|
-
const cur = p + pathExt[j];
|
|
4421
|
-
try {
|
|
4422
|
-
if (isexe.sync(cur, { pathExt: pathExtExe })) {
|
|
4423
|
-
if (opt.all) found.push(cur);
|
|
4424
|
-
else return cur;
|
|
4425
|
-
}
|
|
4426
|
-
} catch (ex) {}
|
|
4427
|
-
}
|
|
4428
|
-
}
|
|
4429
|
-
if (opt.all && found.length) return found;
|
|
4430
|
-
if (opt.nothrow) return null;
|
|
4431
|
-
throw getNotFoundError(cmd);
|
|
4432
|
-
};
|
|
4433
|
-
module.exports = which;
|
|
4434
|
-
which.sync = whichSync;
|
|
4435
|
-
}));
|
|
4436
|
-
//#endregion
|
|
4437
|
-
//#region ../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js
|
|
4438
|
-
var require_path_key = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4439
|
-
const pathKey = (options = {}) => {
|
|
4440
|
-
const environment = options.env || process.env;
|
|
4441
|
-
if ((options.platform || process.platform) !== "win32") return "PATH";
|
|
4442
|
-
return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
|
|
4443
|
-
};
|
|
4444
|
-
module.exports = pathKey;
|
|
4445
|
-
module.exports.default = pathKey;
|
|
4446
|
-
}));
|
|
4447
|
-
//#endregion
|
|
4448
|
-
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
|
|
4449
|
-
var require_resolveCommand = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4450
|
-
const path$4 = __require("path");
|
|
4451
|
-
const which = require_which();
|
|
4452
|
-
const getPathKey = require_path_key();
|
|
4453
|
-
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
4454
|
-
const env = parsed.options.env || process.env;
|
|
4455
|
-
const cwd = process.cwd();
|
|
4456
|
-
const hasCustomCwd = parsed.options.cwd != null;
|
|
4457
|
-
const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
|
|
4458
|
-
if (shouldSwitchCwd) try {
|
|
4459
|
-
process.chdir(parsed.options.cwd);
|
|
4460
|
-
} catch (err) {}
|
|
4461
|
-
let resolved;
|
|
4462
|
-
try {
|
|
4463
|
-
resolved = which.sync(parsed.command, {
|
|
4464
|
-
path: env[getPathKey({ env })],
|
|
4465
|
-
pathExt: withoutPathExt ? path$4.delimiter : void 0
|
|
4466
|
-
});
|
|
4467
|
-
} catch (e) {} finally {
|
|
4468
|
-
if (shouldSwitchCwd) process.chdir(cwd);
|
|
4469
|
-
}
|
|
4470
|
-
if (resolved) resolved = path$4.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
4471
|
-
return resolved;
|
|
4472
|
-
}
|
|
4473
|
-
function resolveCommand(parsed) {
|
|
4474
|
-
return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
|
|
4475
|
-
}
|
|
4476
|
-
module.exports = resolveCommand;
|
|
4477
|
-
}));
|
|
4478
|
-
//#endregion
|
|
4479
|
-
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js
|
|
4480
|
-
var require_escape = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4481
|
-
const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
|
|
4482
|
-
function escapeCommand(arg) {
|
|
4483
|
-
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
4484
|
-
return arg;
|
|
4485
|
-
}
|
|
4486
|
-
function escapeArgument(arg, doubleEscapeMetaChars) {
|
|
4487
|
-
arg = `${arg}`;
|
|
4488
|
-
arg = arg.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
|
|
4489
|
-
arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
|
|
4490
|
-
arg = `"${arg}"`;
|
|
4491
|
-
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
4492
|
-
if (doubleEscapeMetaChars) arg = arg.replace(metaCharsRegExp, "^$1");
|
|
4493
|
-
return arg;
|
|
4494
|
-
}
|
|
4495
|
-
module.exports.command = escapeCommand;
|
|
4496
|
-
module.exports.argument = escapeArgument;
|
|
4497
|
-
}));
|
|
4498
|
-
//#endregion
|
|
4499
|
-
//#region ../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js
|
|
4500
|
-
var require_shebang_regex = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4501
|
-
module.exports = /^#!(.*)/;
|
|
4502
|
-
}));
|
|
4503
|
-
//#endregion
|
|
4504
|
-
//#region ../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js
|
|
4505
|
-
var require_shebang_command = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4506
|
-
const shebangRegex = require_shebang_regex();
|
|
4507
|
-
module.exports = (string = "") => {
|
|
4508
|
-
const match = string.match(shebangRegex);
|
|
4509
|
-
if (!match) return null;
|
|
4510
|
-
const [path, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
4511
|
-
const binary = path.split("/").pop();
|
|
4512
|
-
if (binary === "env") return argument;
|
|
4513
|
-
return argument ? `${binary} ${argument}` : binary;
|
|
4514
|
-
};
|
|
4515
|
-
}));
|
|
4516
|
-
//#endregion
|
|
4517
|
-
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
|
|
4518
|
-
var require_readShebang = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4519
|
-
const fs$2 = __require("fs");
|
|
4520
|
-
const shebangCommand = require_shebang_command();
|
|
4521
|
-
function readShebang(command) {
|
|
4522
|
-
const size = 150;
|
|
4523
|
-
const buffer = Buffer.alloc(size);
|
|
4524
|
-
let fd;
|
|
4525
|
-
try {
|
|
4526
|
-
fd = fs$2.openSync(command, "r");
|
|
4527
|
-
fs$2.readSync(fd, buffer, 0, size, 0);
|
|
4528
|
-
fs$2.closeSync(fd);
|
|
4529
|
-
} catch (e) {}
|
|
4530
|
-
return shebangCommand(buffer.toString());
|
|
4531
|
-
}
|
|
4532
|
-
module.exports = readShebang;
|
|
4533
|
-
}));
|
|
4534
|
-
//#endregion
|
|
4535
|
-
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
|
|
4536
|
-
var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4537
|
-
const path$3 = __require("path");
|
|
4538
|
-
const resolveCommand = require_resolveCommand();
|
|
4539
|
-
const escape = require_escape();
|
|
4540
|
-
const readShebang = require_readShebang();
|
|
4541
|
-
const isWin = process.platform === "win32";
|
|
4542
|
-
const isExecutableRegExp = /\.(?:com|exe)$/i;
|
|
4543
|
-
const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
4544
|
-
function detectShebang(parsed) {
|
|
4545
|
-
parsed.file = resolveCommand(parsed);
|
|
4546
|
-
const shebang = parsed.file && readShebang(parsed.file);
|
|
4547
|
-
if (shebang) {
|
|
4548
|
-
parsed.args.unshift(parsed.file);
|
|
4549
|
-
parsed.command = shebang;
|
|
4550
|
-
return resolveCommand(parsed);
|
|
4551
|
-
}
|
|
4552
|
-
return parsed.file;
|
|
4553
|
-
}
|
|
4554
|
-
function parseNonShell(parsed) {
|
|
4555
|
-
if (!isWin) return parsed;
|
|
4556
|
-
const commandFile = detectShebang(parsed);
|
|
4557
|
-
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
4558
|
-
if (parsed.options.forceShell || needsShell) {
|
|
4559
|
-
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
4560
|
-
parsed.command = path$3.normalize(parsed.command);
|
|
4561
|
-
parsed.command = escape.command(parsed.command);
|
|
4562
|
-
parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
|
|
4563
|
-
parsed.args = [
|
|
4564
|
-
"/d",
|
|
4565
|
-
"/s",
|
|
4566
|
-
"/c",
|
|
4567
|
-
`"${[parsed.command].concat(parsed.args).join(" ")}"`
|
|
4568
|
-
];
|
|
4569
|
-
parsed.command = process.env.comspec || "cmd.exe";
|
|
4570
|
-
parsed.options.windowsVerbatimArguments = true;
|
|
4571
|
-
}
|
|
4572
|
-
return parsed;
|
|
4573
|
-
}
|
|
4574
|
-
function parse(command, args, options) {
|
|
4575
|
-
if (args && !Array.isArray(args)) {
|
|
4576
|
-
options = args;
|
|
4577
|
-
args = null;
|
|
4578
|
-
}
|
|
4579
|
-
args = args ? args.slice(0) : [];
|
|
4580
|
-
options = Object.assign({}, options);
|
|
4581
|
-
const parsed = {
|
|
4582
|
-
command,
|
|
4583
|
-
args,
|
|
4584
|
-
options,
|
|
4585
|
-
file: void 0,
|
|
4586
|
-
original: {
|
|
4587
|
-
command,
|
|
4588
|
-
args
|
|
4589
|
-
}
|
|
4590
|
-
};
|
|
4591
|
-
return options.shell ? parsed : parseNonShell(parsed);
|
|
4592
|
-
}
|
|
4593
|
-
module.exports = parse;
|
|
4594
|
-
}));
|
|
4595
|
-
//#endregion
|
|
4596
|
-
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js
|
|
4597
|
-
var require_enoent = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4598
|
-
const isWin = process.platform === "win32";
|
|
4599
|
-
function notFoundError(original, syscall) {
|
|
4600
|
-
return Object.assign(/* @__PURE__ */ new Error(`${syscall} ${original.command} ENOENT`), {
|
|
4601
|
-
code: "ENOENT",
|
|
4602
|
-
errno: "ENOENT",
|
|
4603
|
-
syscall: `${syscall} ${original.command}`,
|
|
4604
|
-
path: original.command,
|
|
4605
|
-
spawnargs: original.args
|
|
4606
|
-
});
|
|
4607
|
-
}
|
|
4608
|
-
function hookChildProcess(cp, parsed) {
|
|
4609
|
-
if (!isWin) return;
|
|
4610
|
-
const originalEmit = cp.emit;
|
|
4611
|
-
cp.emit = function(name, arg1) {
|
|
4612
|
-
if (name === "exit") {
|
|
4613
|
-
const err = verifyENOENT(arg1, parsed);
|
|
4614
|
-
if (err) return originalEmit.call(cp, "error", err);
|
|
4615
|
-
}
|
|
4616
|
-
return originalEmit.apply(cp, arguments);
|
|
4617
|
-
};
|
|
4618
|
-
}
|
|
4619
|
-
function verifyENOENT(status, parsed) {
|
|
4620
|
-
if (isWin && status === 1 && !parsed.file) return notFoundError(parsed.original, "spawn");
|
|
4621
|
-
return null;
|
|
4622
|
-
}
|
|
4623
|
-
function verifyENOENTSync(status, parsed) {
|
|
4624
|
-
if (isWin && status === 1 && !parsed.file) return notFoundError(parsed.original, "spawnSync");
|
|
4625
|
-
return null;
|
|
4626
|
-
}
|
|
4627
|
-
module.exports = {
|
|
4628
|
-
hookChildProcess,
|
|
4629
|
-
verifyENOENT,
|
|
4630
|
-
verifyENOENTSync,
|
|
4631
|
-
notFoundError
|
|
4632
|
-
};
|
|
4633
|
-
}));
|
|
4634
|
-
//#endregion
|
|
4635
|
-
//#region src/lib/crossSpawn.ts
|
|
4636
|
-
var import_cross_spawn = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4637
|
-
const cp = __require("child_process");
|
|
4638
|
-
const parse = require_parse$1();
|
|
4639
|
-
const enoent = require_enoent();
|
|
4640
|
-
function spawn(command, args, options) {
|
|
4641
|
-
const parsed = parse(command, args, options);
|
|
4642
|
-
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
4643
|
-
enoent.hookChildProcess(spawned, parsed);
|
|
4644
|
-
return spawned;
|
|
4645
|
-
}
|
|
4646
|
-
function spawnSync(command, args, options) {
|
|
4647
|
-
const parsed = parse(command, args, options);
|
|
4648
|
-
const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
4649
|
-
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
4650
|
-
return result;
|
|
4651
|
-
}
|
|
4652
|
-
module.exports = spawn;
|
|
4653
|
-
module.exports.spawn = spawn;
|
|
4654
|
-
module.exports.sync = spawnSync;
|
|
4655
|
-
module.exports._parse = parse;
|
|
4656
|
-
module.exports._enoent = enoent;
|
|
4657
|
-
})))(), 1);
|
|
4658
|
-
function spawn$1(command, args, options) {
|
|
4659
|
-
return (0, import_cross_spawn.default)(command, args, options);
|
|
4660
|
-
}
|
|
4661
|
-
function spawnSync$1(command, args, options) {
|
|
4662
|
-
return import_cross_spawn.default.sync(command, args, options);
|
|
4663
|
-
}
|
|
4664
|
-
//#endregion
|
|
4665
4700
|
//#region src/lib/deepMerge.ts
|
|
4666
4701
|
const UNSAFE_KEYS = /* @__PURE__ */ new Set([
|
|
4667
4702
|
"__proto__",
|
|
@@ -7114,7 +7149,7 @@ var require_semver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7114
7149
|
//#region src/lib/toolchainVersion.ts
|
|
7115
7150
|
createRequire(import.meta.url);
|
|
7116
7151
|
function bundledToolchainVersion() {
|
|
7117
|
-
return "10.1.
|
|
7152
|
+
return "10.1.2";
|
|
7118
7153
|
}
|
|
7119
7154
|
function bundledToolchainRange() {
|
|
7120
7155
|
return `^${bundledToolchainVersion()}`;
|
|
@@ -12234,7 +12269,7 @@ In-flight workspace loads — concurrent jobs for the same dir share one search.
|
|
|
12234
12269
|
*/
|
|
12235
12270
|
const workspaceConfigLoadPromises = /* @__PURE__ */ new Map();
|
|
12236
12271
|
const deprecationWarned = /* @__PURE__ */ new Set();
|
|
12237
|
-
function isRecord$
|
|
12272
|
+
function isRecord$14(value) {
|
|
12238
12273
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
12239
12274
|
}
|
|
12240
12275
|
const explorerState = {};
|
|
@@ -12315,12 +12350,12 @@ function warnOnce(key, message) {
|
|
|
12315
12350
|
*/
|
|
12316
12351
|
function resolveCommandField(cfg, commandName, configPath) {
|
|
12317
12352
|
const configKey = canonicalRuleConfigKey(commandName);
|
|
12318
|
-
const commands = isRecord$
|
|
12353
|
+
const commands = isRecord$14(cfg.commands) ? cfg.commands : void 0;
|
|
12319
12354
|
const fromCommands = commands?.[configKey];
|
|
12320
|
-
if (isRecord$
|
|
12355
|
+
if (isRecord$14(fromCommands)) return fromCommands;
|
|
12321
12356
|
for (const alias of deprecatedRuleConfigAliases(configKey)) {
|
|
12322
12357
|
const fromAlias = commands?.[alias];
|
|
12323
|
-
if (!isRecord$
|
|
12358
|
+
if (!isRecord$14(fromAlias)) continue;
|
|
12324
12359
|
warnOnce(`${configPath ?? "unknown"}:commands.${alias}`, `[xy] Deprecated: "commands.${alias}" in ${configPath ?? "xy.config"} — use "commands.${configKey}"`);
|
|
12325
12360
|
return fromAlias;
|
|
12326
12361
|
}
|
|
@@ -12332,7 +12367,7 @@ function resolveCommandField(cfg, commandName, configPath) {
|
|
|
12332
12367
|
return {};
|
|
12333
12368
|
}
|
|
12334
12369
|
function mergeRuleConfigs(target, source) {
|
|
12335
|
-
return isRecord$
|
|
12370
|
+
return isRecord$14(target) && isRecord$14(source) ? {
|
|
12336
12371
|
...target,
|
|
12337
12372
|
...source
|
|
12338
12373
|
} : source;
|
|
@@ -12361,6 +12396,21 @@ function isWorkspaceUnderRootConfig(workspaceDir) {
|
|
|
12361
12396
|
const relative = path.relative(rootDir, path.resolve(workspaceDir));
|
|
12362
12397
|
return relative === "" || !relative.startsWith("..") && !path.isAbsolute(relative);
|
|
12363
12398
|
}
|
|
12399
|
+
function commandKeyIsPresent(cfg, commandName) {
|
|
12400
|
+
const configKey = canonicalRuleConfigKey(commandName);
|
|
12401
|
+
const commands = isRecord$14(cfg.commands) ? cfg.commands : void 0;
|
|
12402
|
+
return commands !== void 0 && Object.hasOwn(commands, configKey);
|
|
12403
|
+
}
|
|
12404
|
+
/**
|
|
12405
|
+
* True when root or workspace xy config declares `commands.<key>`.
|
|
12406
|
+
* An empty merged command object is not a declaration.
|
|
12407
|
+
*/
|
|
12408
|
+
async function isCommandConfigDeclared(workspaceDir, commandName) {
|
|
12409
|
+
await ensureRootConfigLoaded();
|
|
12410
|
+
const root = configState.config ?? {};
|
|
12411
|
+
if (isWorkspaceUnderRootConfig(workspaceDir) && commandKeyIsPresent(root, commandName)) return true;
|
|
12412
|
+
return commandKeyIsPresent(await loadWorkspaceConfig(workspaceDir), commandName);
|
|
12413
|
+
}
|
|
12364
12414
|
async function loadWorkspaceCommandConfig(workspaceDir, commandName) {
|
|
12365
12415
|
const configKey = canonicalRuleConfigKey(commandName);
|
|
12366
12416
|
const root = await loadConfig();
|
|
@@ -21117,7 +21167,7 @@ const SEVERITIES = /* @__PURE__ */ new Set([
|
|
|
21117
21167
|
]);
|
|
21118
21168
|
const SCOPES = /* @__PURE__ */ new Set(["development", "runtime"]);
|
|
21119
21169
|
const RELATIONSHIPS = /* @__PURE__ */ new Set(["direct", "transitive"]);
|
|
21120
|
-
function isRecord$
|
|
21170
|
+
function isRecord$13(value) {
|
|
21121
21171
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
21122
21172
|
}
|
|
21123
21173
|
function readString(value) {
|
|
@@ -21136,13 +21186,13 @@ function readRelationship(value) {
|
|
|
21136
21186
|
return RELATIONSHIPS.has(raw) ? raw : "unknown";
|
|
21137
21187
|
}
|
|
21138
21188
|
function parseDependabotAlert(raw) {
|
|
21139
|
-
if (!isRecord$
|
|
21140
|
-
const dependency = isRecord$
|
|
21141
|
-
const dependencyPackage = isRecord$
|
|
21142
|
-
const advisory = isRecord$
|
|
21143
|
-
const vulnerability = isRecord$
|
|
21144
|
-
const patched = isRecord$
|
|
21145
|
-
const repository = isRecord$
|
|
21189
|
+
if (!isRecord$13(raw)) return void 0;
|
|
21190
|
+
const dependency = isRecord$13(raw.dependency) ? raw.dependency : {};
|
|
21191
|
+
const dependencyPackage = isRecord$13(dependency.package) ? dependency.package : {};
|
|
21192
|
+
const advisory = isRecord$13(raw.security_advisory) ? raw.security_advisory : {};
|
|
21193
|
+
const vulnerability = isRecord$13(raw.security_vulnerability) ? raw.security_vulnerability : {};
|
|
21194
|
+
const patched = isRecord$13(vulnerability.first_patched_version) ? vulnerability.first_patched_version : {};
|
|
21195
|
+
const repository = isRecord$13(raw.repository) ? raw.repository : {};
|
|
21146
21196
|
const packageName = readString(dependencyPackage.name);
|
|
21147
21197
|
if (packageName.length === 0) return void 0;
|
|
21148
21198
|
const patchedVersion = readString(patched.identifier);
|
|
@@ -24345,7 +24395,7 @@ const REQUIRED_SECTIONS = [
|
|
|
24345
24395
|
},
|
|
24346
24396
|
{
|
|
24347
24397
|
label: "authority",
|
|
24348
|
-
pattern: /
|
|
24398
|
+
pattern: /authorit/i
|
|
24349
24399
|
},
|
|
24350
24400
|
{
|
|
24351
24401
|
label: "repository map",
|
|
@@ -24357,7 +24407,33 @@ const REQUIRED_SECTIONS = [
|
|
|
24357
24407
|
},
|
|
24358
24408
|
{
|
|
24359
24409
|
label: "failures",
|
|
24360
|
-
pattern: /fail|troubleshoot/i
|
|
24410
|
+
pattern: /fail|troubleshoot|what not to do|pitfall/i
|
|
24411
|
+
}
|
|
24412
|
+
];
|
|
24413
|
+
const FRONT_MATTER_KINDS = [
|
|
24414
|
+
{
|
|
24415
|
+
kind: "decision",
|
|
24416
|
+
pattern: /^docs\/decisions\//
|
|
24417
|
+
},
|
|
24418
|
+
{
|
|
24419
|
+
kind: "evidence",
|
|
24420
|
+
pattern: /^docs\/evidence\//
|
|
24421
|
+
},
|
|
24422
|
+
{
|
|
24423
|
+
kind: "runbook",
|
|
24424
|
+
pattern: /^docs\/runbooks\//
|
|
24425
|
+
},
|
|
24426
|
+
{
|
|
24427
|
+
kind: "plan",
|
|
24428
|
+
pattern: /^docs\/plans\//
|
|
24429
|
+
},
|
|
24430
|
+
{
|
|
24431
|
+
kind: "paper",
|
|
24432
|
+
pattern: /^papers\//
|
|
24433
|
+
},
|
|
24434
|
+
{
|
|
24435
|
+
kind: "spec",
|
|
24436
|
+
pattern: /^specs\//
|
|
24361
24437
|
}
|
|
24362
24438
|
];
|
|
24363
24439
|
function finding(message) {
|
|
@@ -24378,6 +24454,34 @@ function linkExists(cwd, from, target) {
|
|
|
24378
24454
|
const resolved = path.resolve(cwd, path.dirname(from), bare);
|
|
24379
24455
|
return fs.existsSync(resolved);
|
|
24380
24456
|
}
|
|
24457
|
+
function docLinkExists(cwd, from, target) {
|
|
24458
|
+
const bare = target.split("#", 1)[0]?.split("?", 1)[0] ?? "";
|
|
24459
|
+
return bare.length === 0 || fs.existsSync(path.resolve(cwd, bare)) || linkExists(cwd, from, target);
|
|
24460
|
+
}
|
|
24461
|
+
function cellPath(cell) {
|
|
24462
|
+
return (/\[[^\]]*]\(([^)]+)\)/.exec(cell)?.[1] ?? cell).replaceAll(/[`[\]()]/g, " ").trim().split(/\s+/).find((part) => part.includes("/") || part.endsWith(".md"));
|
|
24463
|
+
}
|
|
24464
|
+
function authorityRows(section) {
|
|
24465
|
+
const rows = section.matchAll(/^\|(.+)\|$/gm).map((match) => (match[1] ?? "").split("|").map((cell) => cell.trim())).filter((cells) => cells.some((cell) => cell.length > 0) && cells.some((cell) => !/^:?-+:?$/.test(cell))).toArray();
|
|
24466
|
+
if (rows.length === 0) return [];
|
|
24467
|
+
const header = rows[0] ?? [];
|
|
24468
|
+
const headerIsLabels = header.some((cell) => /authority|document|^path$|^kind$/i.test(cell));
|
|
24469
|
+
const data = headerIsLabels ? rows.slice(1) : rows;
|
|
24470
|
+
const labeledPath = header.findIndex((cell) => /authority|document|^path$/i.test(cell));
|
|
24471
|
+
const pathIndex = headerIsLabels ? Math.max(labeledPath, 0) : 0;
|
|
24472
|
+
const kindIndex = headerIsLabels ? header.findIndex((cell) => /^kind$/i.test(cell)) : 1;
|
|
24473
|
+
const found = [];
|
|
24474
|
+
for (const cells of data) {
|
|
24475
|
+
const target = cellPath(cells[pathIndex] ?? "") ?? cells.map((cell) => cellPath(cell)).find((value) => value !== void 0);
|
|
24476
|
+
if (target === void 0) continue;
|
|
24477
|
+
const kind = kindIndex >= 0 ? cells[kindIndex]?.trim().toLowerCase() : void 0;
|
|
24478
|
+
found.push({
|
|
24479
|
+
kind,
|
|
24480
|
+
target
|
|
24481
|
+
});
|
|
24482
|
+
}
|
|
24483
|
+
return found;
|
|
24484
|
+
}
|
|
24381
24485
|
function daysSince(isoDate, now) {
|
|
24382
24486
|
const parsed = Date.parse(isoDate);
|
|
24383
24487
|
return Number.isNaN(parsed) ? void 0 : (now - parsed) / 864e5;
|
|
@@ -24400,14 +24504,41 @@ function contentCommitCount(cwd, relativePath) {
|
|
|
24400
24504
|
const count = Number(result.stdout.trim());
|
|
24401
24505
|
return Number.isFinite(count) ? count : void 0;
|
|
24402
24506
|
}
|
|
24507
|
+
function inferredFrontMatterKind(relativePath) {
|
|
24508
|
+
return FRONT_MATTER_KINDS.find((entry) => entry.pattern.test(relativePath))?.kind;
|
|
24509
|
+
}
|
|
24510
|
+
function resolvesToAgentsMd(cwd, from, target) {
|
|
24511
|
+
const bare = target.split("#", 1)[0]?.split("?", 1)[0] ?? "";
|
|
24512
|
+
return bare.length > 0 && !/^(?:https?:|mailto:)/.test(bare) && path.resolve(cwd, path.dirname(from), bare) === path.resolve(cwd, "AGENTS.md");
|
|
24513
|
+
}
|
|
24514
|
+
function restatesAgents(adapterText, agentsText) {
|
|
24515
|
+
const agentsBody = agentsText.trim();
|
|
24516
|
+
if (agentsBody.length < 40) return false;
|
|
24517
|
+
const lines = adapterText.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
|
|
24518
|
+
const importAt = lines.findIndex((line) => line.includes("AGENTS.md"));
|
|
24519
|
+
const rest = lines.slice(importAt + 1).join("\n");
|
|
24520
|
+
if (rest.includes(agentsBody)) return true;
|
|
24521
|
+
const h1 = firstHeading(agentsText);
|
|
24522
|
+
const h2s = agentsText.matchAll(/^##\s+(.+)$/gm).map((match) => match[1]?.trim() ?? "").filter((heading) => heading.length > 0).toArray();
|
|
24523
|
+
if (h1 === void 0 || h2s.length < 2) return false;
|
|
24524
|
+
const restHeadings = new Set(headings(rest).map((heading) => heading.toLowerCase()));
|
|
24525
|
+
if (!restHeadings.has(h1.toLowerCase())) return false;
|
|
24526
|
+
return h2s.filter((heading) => restHeadings.has(heading.toLowerCase())).length * 2 >= h2s.length;
|
|
24527
|
+
}
|
|
24403
24528
|
function adapterFinding(cwd, relativePath, agentsText) {
|
|
24404
24529
|
const fullPath = path.join(cwd, relativePath);
|
|
24405
24530
|
if (!fs.existsSync(fullPath)) return void 0;
|
|
24406
24531
|
if (fs.lstatSync(fullPath).isSymbolicLink()) return path.basename(fs.readlinkSync(fullPath)) === "AGENTS.md" ? void 0 : `${relativePath} symlink does not point at AGENTS.md (inverted-symlink)`;
|
|
24407
24532
|
const text = fs.readFileSync(fullPath, "utf8");
|
|
24408
|
-
if (isThinAgentsImport(text)) return void 0;
|
|
24409
24533
|
if (agentsText !== void 0 && text === agentsText) return `${relativePath} duplicates AGENTS.md (duplicate)`;
|
|
24410
|
-
|
|
24534
|
+
if (relativePath.endsWith("copilot-instructions.md")) {
|
|
24535
|
+
if (!(hasCopilotAgentsReference(text) || markdownLinkTargets(text).some((target) => resolvesToAgentsMd(cwd, relativePath, target)))) return `${relativePath} does not link to AGENTS.md; use a Markdown link to ../AGENTS.md or a symlink`;
|
|
24536
|
+
} else {
|
|
24537
|
+
const placement = claudeAgentsImportPlacement(text);
|
|
24538
|
+
if (placement === "later") return `${relativePath} mentions @AGENTS.md but the import is not the first line (pointer-not-import)`;
|
|
24539
|
+
if (placement === "absent") return `${relativePath} is a divergent adapter; start with an @AGENTS.md import or use a symlink`;
|
|
24540
|
+
}
|
|
24541
|
+
return agentsText !== void 0 && restatesAgents(text, agentsText) ? `${relativePath} duplicates AGENTS.md (duplicate)` : void 0;
|
|
24411
24542
|
}
|
|
24412
24543
|
const AGENT_LINT_RULES = [
|
|
24413
24544
|
{
|
|
@@ -24429,8 +24560,8 @@ const AGENT_LINT_RULES = [
|
|
|
24429
24560
|
}
|
|
24430
24561
|
return findings(messages);
|
|
24431
24562
|
},
|
|
24432
|
-
defaultLevel: "
|
|
24433
|
-
description: "Tool adapters
|
|
24563
|
+
defaultLevel: "warn",
|
|
24564
|
+
description: "Tool adapters lead with an AGENTS.md import or link, then tool-specific notes",
|
|
24434
24565
|
id: "agents.adapter-thin"
|
|
24435
24566
|
},
|
|
24436
24567
|
{
|
|
@@ -24450,7 +24581,7 @@ const AGENT_LINT_RULES = [
|
|
|
24450
24581
|
const missing = REQUIRED_SECTIONS.filter((section) => present.every((heading) => !section.pattern.test(heading)));
|
|
24451
24582
|
return missing.length === 0 ? {} : finding(`AGENTS.md is missing sections: ${missing.map((section) => section.label).join(", ")}`);
|
|
24452
24583
|
},
|
|
24453
|
-
defaultLevel: "
|
|
24584
|
+
defaultLevel: "warn",
|
|
24454
24585
|
description: "AGENTS.md has orient, authority, repository map, commands, and failures sections",
|
|
24455
24586
|
id: "agents.required-sections"
|
|
24456
24587
|
},
|
|
@@ -24479,7 +24610,7 @@ const AGENT_LINT_RULES = [
|
|
|
24479
24610
|
for (const document of context.documents) if (/\/(?:Users|home)\//.test(document.text)) messages.push(`${document.relativePath} contains an absolute home-directory path`);
|
|
24480
24611
|
return findings(messages);
|
|
24481
24612
|
},
|
|
24482
|
-
defaultLevel: "
|
|
24613
|
+
defaultLevel: "warn",
|
|
24483
24614
|
description: "Committed instruction files do not contain /Users or /home paths",
|
|
24484
24615
|
id: "agents.no-absolute-paths"
|
|
24485
24616
|
},
|
|
@@ -24507,20 +24638,16 @@ const AGENT_LINT_RULES = [
|
|
|
24507
24638
|
{
|
|
24508
24639
|
check: (context) => {
|
|
24509
24640
|
if (context.agents === void 0) return {};
|
|
24510
|
-
const section = context.agents.text.split(/^##\s+/m).find((part) =>
|
|
24641
|
+
const section = context.agents.text.split(/^##\s+/m).find((part) => /authorit/i.test(part.split("\n", 1)[0] ?? ""));
|
|
24511
24642
|
if (section === void 0) return {};
|
|
24512
24643
|
const messages = [];
|
|
24513
|
-
for (const row of section
|
|
24514
|
-
|
|
24515
|
-
|
|
24516
|
-
if (!(target.includes("/") || target.endsWith(".md"))) continue;
|
|
24517
|
-
if (!linkExists(context.cwd, "AGENTS.md", target)) {
|
|
24518
|
-
messages.push(`Authority row ${target} does not exist`);
|
|
24644
|
+
for (const row of authorityRows(section)) {
|
|
24645
|
+
if (!linkExists(context.cwd, "AGENTS.md", row.target)) {
|
|
24646
|
+
messages.push(`Authority row ${row.target} does not exist`);
|
|
24519
24647
|
continue;
|
|
24520
24648
|
}
|
|
24521
|
-
const
|
|
24522
|
-
|
|
24523
|
-
if (mismatchedAuthorityKind(kind, actual)) messages.push(`Authority row ${target} claims kind ${kind ?? ""} but front matter says ${actual ?? ""}`);
|
|
24649
|
+
const actual = readLinkedDocument(context, row.target)?.frontMatter.kind?.toLowerCase();
|
|
24650
|
+
if (mismatchedAuthorityKind(row.kind, actual)) messages.push(`Authority row ${row.target} claims kind ${row.kind ?? ""} but front matter says ${actual ?? ""}`);
|
|
24524
24651
|
}
|
|
24525
24652
|
return findings(messages);
|
|
24526
24653
|
},
|
|
@@ -24536,14 +24663,22 @@ const AGENT_LINT_RULES = [
|
|
|
24536
24663
|
if (!/^(?:docs|papers|specs)\//.test(document.relativePath) || document.relativePath.endsWith("/README.md")) continue;
|
|
24537
24664
|
const hasMatter = Object.keys(document.frontMatter).length > 0;
|
|
24538
24665
|
if (hasMatter && document.frontMatter.kind !== void 0) continue;
|
|
24539
|
-
|
|
24540
|
-
|
|
24666
|
+
const kind = inferredFrontMatterKind(document.relativePath);
|
|
24667
|
+
if (kind !== void 0 && !hasMatter && rule.fix) {
|
|
24668
|
+
const next = `---\nkind: ${kind}\n---\n\n${document.text}`;
|
|
24669
|
+
fs.writeFileSync(path.join(context.cwd, document.relativePath), next);
|
|
24670
|
+
document.text = next;
|
|
24671
|
+
document.frontMatter = { kind };
|
|
24672
|
+
document.body = document.text;
|
|
24541
24673
|
fixedCount += 1;
|
|
24542
24674
|
continue;
|
|
24543
24675
|
}
|
|
24544
24676
|
messages.push(`${document.relativePath} is missing front matter${hasMatter ? " kind" : ""}`);
|
|
24545
24677
|
}
|
|
24546
|
-
return fixedCount > 0 ? {
|
|
24678
|
+
return fixedCount > 0 ? {
|
|
24679
|
+
...findings(messages),
|
|
24680
|
+
fixedCount
|
|
24681
|
+
} : findings(messages);
|
|
24547
24682
|
},
|
|
24548
24683
|
defaultLevel: "warn",
|
|
24549
24684
|
description: "Markdown under docs/, papers/, and specs/ has front matter",
|
|
@@ -24561,7 +24696,7 @@ const AGENT_LINT_RULES = [
|
|
|
24561
24696
|
}
|
|
24562
24697
|
return finding("docs/README.md does not match the index generated from front matter");
|
|
24563
24698
|
},
|
|
24564
|
-
defaultLevel: "
|
|
24699
|
+
defaultLevel: "warn",
|
|
24565
24700
|
description: "docs/README.md matches the index generated from front matter",
|
|
24566
24701
|
fixable: true,
|
|
24567
24702
|
id: "docs.index-current"
|
|
@@ -24570,19 +24705,17 @@ const AGENT_LINT_RULES = [
|
|
|
24570
24705
|
check: (context) => {
|
|
24571
24706
|
const messages = [];
|
|
24572
24707
|
for (const document of context.documents) {
|
|
24573
|
-
|
|
24708
|
+
const state = document.frontMatter.state;
|
|
24709
|
+
if (state !== "superseded" && state !== "retired") continue;
|
|
24710
|
+
if (!document.relativePath.startsWith("docs/archive/")) messages.push(`${document.relativePath} has state ${state} but is not under docs/archive/`);
|
|
24711
|
+
if (state !== "superseded") continue;
|
|
24574
24712
|
const successor = document.frontMatter.supersededBy;
|
|
24575
|
-
if (successor === void 0 || !
|
|
24576
|
-
messages.push(`${document.relativePath} is superseded without a resolvable supersededBy`);
|
|
24577
|
-
continue;
|
|
24578
|
-
}
|
|
24579
|
-
const resolved = path.posix.normalize(path.posix.join(path.posix.dirname(document.relativePath), successor));
|
|
24580
|
-
if (!(resolved.includes("/archive/") || resolved.startsWith("archive/"))) messages.push(`${document.relativePath} is superseded but ${successor} is not under archive/`);
|
|
24713
|
+
if (successor === void 0 || !docLinkExists(context.cwd, document.relativePath, successor)) messages.push(`${document.relativePath} is superseded without a resolvable supersededBy`);
|
|
24581
24714
|
}
|
|
24582
24715
|
return findings(messages);
|
|
24583
24716
|
},
|
|
24584
24717
|
defaultLevel: "warn",
|
|
24585
|
-
description: "Superseded
|
|
24718
|
+
description: "Superseded and retired documents live under docs/archive/ and name a successor",
|
|
24586
24719
|
id: "docs.superseded-archived"
|
|
24587
24720
|
},
|
|
24588
24721
|
{
|
|
@@ -24604,6 +24737,9 @@ const AGENT_LINT_RULES = [
|
|
|
24604
24737
|
const now = Date.now();
|
|
24605
24738
|
const messages = [];
|
|
24606
24739
|
for (const document of context.documents) {
|
|
24740
|
+
if (document.relativePath.startsWith("docs/evidence/") || document.relativePath.startsWith("docs/decisions/") || document.relativePath.startsWith("docs/archive/")) continue;
|
|
24741
|
+
const state = document.frontMatter.state;
|
|
24742
|
+
if (state === "superseded" || state === "retired") continue;
|
|
24607
24743
|
const stamp = document.frontMatter.reviewed ?? document.frontMatter.date;
|
|
24608
24744
|
if (stamp === void 0) continue;
|
|
24609
24745
|
const age = daysSince(stamp, now);
|
|
@@ -24619,18 +24755,16 @@ const AGENT_LINT_RULES = [
|
|
|
24619
24755
|
},
|
|
24620
24756
|
{
|
|
24621
24757
|
check: (context) => {
|
|
24622
|
-
const corpus = context.documents.filter((document) => document.relativePath !== "docs/README.md").map((document) => document.text).join("\n");
|
|
24623
|
-
const index = documentAt(context, "docs/README.md")?.text ?? "";
|
|
24624
24758
|
const messages = [];
|
|
24625
24759
|
for (const document of context.documents) {
|
|
24626
24760
|
if (!document.relativePath.startsWith("docs/") || document.relativePath === "docs/README.md") continue;
|
|
24627
24761
|
const name = path.posix.basename(document.relativePath);
|
|
24628
|
-
if (!(
|
|
24762
|
+
if (!(context.documents.some((other) => other.relativePath !== document.relativePath && other.relativePath !== "docs/README.md" && (other.text.includes(document.relativePath) || other.text.includes(name))) || (context.agents?.text.includes(document.relativePath) ?? false) || (context.agents?.text.includes(name) ?? false))) messages.push(`${document.relativePath} is not linked from AGENTS.md or another document`);
|
|
24629
24763
|
}
|
|
24630
24764
|
return findings(messages);
|
|
24631
24765
|
},
|
|
24632
24766
|
defaultLevel: "warn",
|
|
24633
|
-
description: "docs/ files are linked from AGENTS.md
|
|
24767
|
+
description: "docs/ files are linked from AGENTS.md or another document",
|
|
24634
24768
|
id: "docs.orphan"
|
|
24635
24769
|
},
|
|
24636
24770
|
{
|
|
@@ -24642,17 +24776,22 @@ const AGENT_LINT_RULES = [
|
|
|
24642
24776
|
const messages = [];
|
|
24643
24777
|
for (const document of decisions) {
|
|
24644
24778
|
const base = path.posix.basename(document.relativePath);
|
|
24645
|
-
const numbered = /^(\d+)-/.exec(base);
|
|
24646
|
-
const adr = /^ADR-(\d+)/i.exec(base);
|
|
24647
24779
|
const dated = /^(\d{8})-/.exec(base);
|
|
24648
|
-
|
|
24649
|
-
|
|
24650
|
-
|
|
24780
|
+
const prefixed = /^[A-Za-z][\w]*-D(\d+)/.exec(base);
|
|
24781
|
+
const adr = /^ADR-(\d+)/i.exec(base);
|
|
24782
|
+
const numbered = /^(\d+)-/.exec(base);
|
|
24783
|
+
if (dated !== null) schemes.add("dated");
|
|
24784
|
+
else if (prefixed?.[1] !== void 0) {
|
|
24785
|
+
schemes.add("prefixed");
|
|
24786
|
+
ids.push(Number(prefixed[1]));
|
|
24651
24787
|
} else if (adr?.[1] !== void 0) {
|
|
24652
24788
|
schemes.add("adr");
|
|
24653
24789
|
ids.push(Number(adr[1]));
|
|
24654
|
-
} else if (
|
|
24655
|
-
else
|
|
24790
|
+
} else if (numbered?.[1] === void 0) schemes.add("other");
|
|
24791
|
+
else {
|
|
24792
|
+
schemes.add("numbered");
|
|
24793
|
+
ids.push(Number(numbered[1]));
|
|
24794
|
+
}
|
|
24656
24795
|
if (document.frontMatter.state === void 0) messages.push(`${document.relativePath} has no state`);
|
|
24657
24796
|
}
|
|
24658
24797
|
if (schemes.size > 1) messages.push(`docs/decisions uses more than one naming scheme: ${[...schemes].toSorted().join(", ")}`);
|
|
@@ -24695,6 +24834,20 @@ function readLinkedDocument(context, target) {
|
|
|
24695
24834
|
}
|
|
24696
24835
|
//#endregion
|
|
24697
24836
|
//#region src/actions/agent/lint.ts
|
|
24837
|
+
/**
|
|
24838
|
+
* `xy check` runs agent lint when the repo has adopted the convention or
|
|
24839
|
+
* opted in. A direct `xy agent lint` still reports a missing AGENTS.md.
|
|
24840
|
+
*/
|
|
24841
|
+
async function isAgentLintEnabled(cwd) {
|
|
24842
|
+
if (await isCommandConfigDeclared(cwd, "agentLint")) return true;
|
|
24843
|
+
try {
|
|
24844
|
+
fs.lstatSync(path.join(cwd, "AGENTS.md"));
|
|
24845
|
+
return true;
|
|
24846
|
+
} catch (error) {
|
|
24847
|
+
if ((typeof error === "object" && error !== null && "code" in error ? error.code : void 0) === "ENOENT") return false;
|
|
24848
|
+
throw error;
|
|
24849
|
+
}
|
|
24850
|
+
}
|
|
24698
24851
|
async function agentLint(options = {}) {
|
|
24699
24852
|
const cwd = options.cwd ?? INIT_CWD();
|
|
24700
24853
|
return runRuleChecks({
|
|
@@ -24703,8 +24856,9 @@ async function agentLint(options = {}) {
|
|
|
24703
24856
|
configKey: "agentLint",
|
|
24704
24857
|
context: loadAgentLintContext(cwd),
|
|
24705
24858
|
fix: options.fix === true,
|
|
24859
|
+
reporter: defaultRuleReporter(),
|
|
24706
24860
|
rules: AGENT_LINT_RULES,
|
|
24707
|
-
strict: options.strict === true
|
|
24861
|
+
strict: options.strict === true || isStrictMode()
|
|
24708
24862
|
});
|
|
24709
24863
|
}
|
|
24710
24864
|
const AUDIT_RULES = /* @__PURE__ */ new Set([
|
|
@@ -24721,8 +24875,9 @@ async function agentAudit(options = {}) {
|
|
|
24721
24875
|
config: await loadWorkspaceCommandConfig(cwd, "agentLint"),
|
|
24722
24876
|
configKey: "agentLint",
|
|
24723
24877
|
context: loadAgentLintContext(cwd),
|
|
24878
|
+
reporter: defaultRuleReporter(),
|
|
24724
24879
|
rules: AGENT_LINT_RULES.filter((rule) => AUDIT_RULES.has(rule.id)),
|
|
24725
|
-
strict: options.strict === true
|
|
24880
|
+
strict: options.strict === true || isStrictMode()
|
|
24726
24881
|
});
|
|
24727
24882
|
}
|
|
24728
24883
|
//#endregion
|
|
@@ -24731,28 +24886,41 @@ function agentIndex(cwd) {
|
|
|
24731
24886
|
writeDocsIndex(cwd, loadAgentLintContext(cwd).documents);
|
|
24732
24887
|
return "docs/README.md";
|
|
24733
24888
|
}
|
|
24889
|
+
function archiveDestination(relativeSource) {
|
|
24890
|
+
const underDocs = relativeSource.startsWith("docs/") ? relativeSource.slice(5) : path.posix.basename(relativeSource);
|
|
24891
|
+
return path.posix.join("docs/archive", underDocs);
|
|
24892
|
+
}
|
|
24893
|
+
function withArchivedState(text) {
|
|
24894
|
+
const match = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?/.exec(text);
|
|
24895
|
+
if (match?.[1] === void 0) return `---\nstate: retired\n---\n\n${text}`;
|
|
24896
|
+
let replaced = false;
|
|
24897
|
+
const lines = match[1].split("\n").map((line) => {
|
|
24898
|
+
const field = /^state\s*:\s*(.*)$/.exec(line.trim());
|
|
24899
|
+
if (field === null) return line;
|
|
24900
|
+
replaced = true;
|
|
24901
|
+
return field[1]?.trim().replaceAll(/^['"]|['"]$/g, "") === "superseded" ? line : "state: retired";
|
|
24902
|
+
});
|
|
24903
|
+
if (!replaced) lines.push("state: retired");
|
|
24904
|
+
const body = text.slice(match[0].length);
|
|
24905
|
+
return `---\n${lines.join("\n")}\n---\n${body.startsWith("\n") ? "" : "\n"}${body}`;
|
|
24906
|
+
}
|
|
24734
24907
|
function agentArchive(cwd, source) {
|
|
24735
24908
|
const relativeSource = source.split(path.sep).join("/");
|
|
24736
24909
|
const fullSource = path.resolve(cwd, relativeSource);
|
|
24737
24910
|
const root = path.resolve(cwd);
|
|
24738
24911
|
if (fullSource !== root && !fullSource.startsWith(`${root}${path.sep}`)) throw new Error(`Refusing to archive a path outside the repository: ${source}`);
|
|
24739
24912
|
if (!fs.existsSync(fullSource) || !fs.statSync(fullSource).isFile()) throw new Error(`Nothing to archive at ${relativeSource}`);
|
|
24740
|
-
const
|
|
24741
|
-
const
|
|
24742
|
-
|
|
24743
|
-
|
|
24744
|
-
}
|
|
24745
|
-
const
|
|
24746
|
-
|
|
24747
|
-
|
|
24748
|
-
|
|
24749
|
-
"",
|
|
24750
|
-
"> Archived. This document is historical and is not a current instruction.",
|
|
24751
|
-
"",
|
|
24752
|
-
parsed.body.trimStart()
|
|
24753
|
-
].join("\n");
|
|
24754
|
-
const destination = path.posix.join("docs/archive", path.posix.basename(relativeSource));
|
|
24913
|
+
const text = fs.readFileSync(fullSource, "utf8");
|
|
24914
|
+
const parsed = parseFrontMatter(text);
|
|
24915
|
+
const date = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
24916
|
+
const successor = parsed.frontMatter.supersededBy;
|
|
24917
|
+
const banner = `> ${parsed.frontMatter.state === "superseded" ? `Superseded${successor === void 0 ? "" : ` by ${successor}`}` : "Retired"} on ${date}. Original path: ${relativeSource}. This document is historical and is not a current instruction.`;
|
|
24918
|
+
const withState = withArchivedState(text);
|
|
24919
|
+
const front = /^(---\r?\n[\s\S]*?\r?\n---\r?\n)/.exec(withState);
|
|
24920
|
+
const archived = front?.[1] === void 0 || withState.includes(banner) ? withState : `${front[1]}\n${banner}\n\n${withState.slice(front[1].length)}`;
|
|
24921
|
+
const destination = archiveDestination(relativeSource);
|
|
24755
24922
|
const fullDestination = path.join(cwd, destination);
|
|
24923
|
+
if (path.resolve(fullDestination) === fullSource) throw new Error(`Archive destination is the source file: ${destination}`);
|
|
24756
24924
|
if (fs.existsSync(fullDestination)) throw new Error(`Archive destination already exists: ${destination}`);
|
|
24757
24925
|
fs.mkdirSync(path.dirname(fullDestination), { recursive: true });
|
|
24758
24926
|
fs.writeFileSync(fullDestination, archived.endsWith("\n") ? archived : `${archived}\n`);
|
|
@@ -25683,7 +25851,7 @@ const RULE_LEVELS = /* @__PURE__ */ new Set([
|
|
|
25683
25851
|
"off",
|
|
25684
25852
|
"warn"
|
|
25685
25853
|
]);
|
|
25686
|
-
function isRecord$
|
|
25854
|
+
function isRecord$12(value) {
|
|
25687
25855
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
25688
25856
|
}
|
|
25689
25857
|
function isValidWeight(value) {
|
|
@@ -25700,7 +25868,7 @@ function parseTupleRuleSetting(location, setting) {
|
|
|
25700
25868
|
if (setting.length !== 2) throw new TypeError(`${location} tuple must be [level, options]`);
|
|
25701
25869
|
const [level, options] = setting;
|
|
25702
25870
|
if (!isRuleLevel$3(level)) throw new TypeError(`${location} level must be "error", "warn", or "off"`);
|
|
25703
|
-
if (!isRecord$
|
|
25871
|
+
if (!isRecord$12(options)) throw new TypeError(`${location} options must be an object`);
|
|
25704
25872
|
return {
|
|
25705
25873
|
enabled: level !== "off",
|
|
25706
25874
|
level,
|
|
@@ -25733,7 +25901,7 @@ function parseRuleSetting(location, setting) {
|
|
|
25733
25901
|
weight: parseWeight(location, setting)
|
|
25734
25902
|
};
|
|
25735
25903
|
if (Array.isArray(setting)) return parseTupleRuleSetting(location, setting);
|
|
25736
|
-
if (isRecord$
|
|
25904
|
+
if (isRecord$12(setting)) return parseObjectRuleSetting(location, setting);
|
|
25737
25905
|
throw new TypeError(`${location} must be a boolean, rule level, number, "infinite", [level, options], or { enabled?, level?, weight? } object`);
|
|
25738
25906
|
}
|
|
25739
25907
|
function validateRuleIds(location, rules) {
|
|
@@ -28832,7 +29000,7 @@ function isJsonConfigPath$1(configPath) {
|
|
|
28832
29000
|
const base = path.basename(configPath);
|
|
28833
29001
|
return base === ".xyrc.json" || base.endsWith(".json");
|
|
28834
29002
|
}
|
|
28835
|
-
function getPropertyName$
|
|
29003
|
+
function getPropertyName$4(prop) {
|
|
28836
29004
|
if (ts.isPropertyAssignment(prop)) {
|
|
28837
29005
|
const { name } = prop;
|
|
28838
29006
|
if (ts.isIdentifier(name) || ts.isStringLiteral(name) || ts.isNoSubstitutionTemplateLiteral(name)) return name.text;
|
|
@@ -28850,9 +29018,9 @@ function findDeplintPackagesAssignment(sourceFile) {
|
|
|
28850
29018
|
let found;
|
|
28851
29019
|
function visit(node) {
|
|
28852
29020
|
if (found !== void 0) return;
|
|
28853
|
-
if (ts.isPropertyAssignment(node) && getPropertyName$
|
|
29021
|
+
if (ts.isPropertyAssignment(node) && getPropertyName$4(node) === "packages" && ts.isObjectLiteralExpression(node.initializer)) {
|
|
28854
29022
|
const parentObject = node.parent;
|
|
28855
|
-
if (ts.isObjectLiteralExpression(parentObject) && ts.isPropertyAssignment(parentObject.parent) && getPropertyName$
|
|
29023
|
+
if (ts.isObjectLiteralExpression(parentObject) && ts.isPropertyAssignment(parentObject.parent) && getPropertyName$4(parentObject.parent) === "deplint") {
|
|
28856
29024
|
found = node;
|
|
28857
29025
|
return;
|
|
28858
29026
|
}
|
|
@@ -28866,7 +29034,7 @@ function findDeplintObjectAssignment(sourceFile) {
|
|
|
28866
29034
|
let found;
|
|
28867
29035
|
function visit(node) {
|
|
28868
29036
|
if (found !== void 0) return;
|
|
28869
|
-
if (ts.isPropertyAssignment(node) && getPropertyName$
|
|
29037
|
+
if (ts.isPropertyAssignment(node) && getPropertyName$4(node) === "deplint" && ts.isObjectLiteralExpression(node.initializer)) {
|
|
28870
29038
|
found = node;
|
|
28871
29039
|
return;
|
|
28872
29040
|
}
|
|
@@ -28879,7 +29047,7 @@ function findCommandsObjectAssignment(sourceFile) {
|
|
|
28879
29047
|
let found;
|
|
28880
29048
|
function visit(node) {
|
|
28881
29049
|
if (found !== void 0) return;
|
|
28882
|
-
if (ts.isPropertyAssignment(node) && getPropertyName$
|
|
29050
|
+
if (ts.isPropertyAssignment(node) && getPropertyName$4(node) === "commands" && ts.isObjectLiteralExpression(node.initializer)) {
|
|
28883
29051
|
found = node;
|
|
28884
29052
|
return;
|
|
28885
29053
|
}
|
|
@@ -28912,7 +29080,7 @@ function formatPackageConfigValue(config) {
|
|
|
28912
29080
|
if (legacyRefType !== void 0) parts.push(`refType: '${legacyRefType}'`);
|
|
28913
29081
|
return `{ ${parts.join(", ")} }`;
|
|
28914
29082
|
}
|
|
28915
|
-
function detectIndent$
|
|
29083
|
+
function detectIndent$3(text, packagesObject, sourceFile) {
|
|
28916
29084
|
if (packagesObject.properties.length > 0) {
|
|
28917
29085
|
const start = packagesObject.properties[0].getStart(sourceFile);
|
|
28918
29086
|
let lineStart = start;
|
|
@@ -28928,7 +29096,7 @@ function detectIndent$2(text, packagesObject, sourceFile) {
|
|
|
28928
29096
|
function findPackageProperty(packagesObject, dependency) {
|
|
28929
29097
|
for (const prop of packagesObject.properties) {
|
|
28930
29098
|
if (!ts.isPropertyAssignment(prop)) continue;
|
|
28931
|
-
if (getPropertyName$
|
|
29099
|
+
if (getPropertyName$4(prop) === dependency) return prop;
|
|
28932
29100
|
}
|
|
28933
29101
|
}
|
|
28934
29102
|
function removePropertyFromObject$1(text, prop, sourceFile) {
|
|
@@ -28957,7 +29125,7 @@ function upsertPackagePropertyInObject(text, packagesAssignment, sourceFile, dep
|
|
|
28957
29125
|
}
|
|
28958
29126
|
const valueText = formatPackageConfigValue(config);
|
|
28959
29127
|
const keyText = quotePackageKey(dependency);
|
|
28960
|
-
const indent = detectIndent$
|
|
29128
|
+
const indent = detectIndent$3(text, packagesObject, sourceFile);
|
|
28961
29129
|
const entry = `${keyText}: ${valueText}`;
|
|
28962
29130
|
const openBraceEnd = packagesObject.getStart(sourceFile) + 1;
|
|
28963
29131
|
const insertion = `\n${indent}${entry},`;
|
|
@@ -28966,7 +29134,7 @@ function upsertPackagePropertyInObject(text, packagesAssignment, sourceFile, dep
|
|
|
28966
29134
|
function insertPackagesIntoDeplint(text, deplintAssignment, sourceFile, dependency, config) {
|
|
28967
29135
|
if (!ts.isObjectLiteralExpression(deplintAssignment.initializer)) throw new TypeError("deplint must be an object literal");
|
|
28968
29136
|
const deplintObject = deplintAssignment.initializer;
|
|
28969
|
-
const indent = detectIndent$
|
|
29137
|
+
const indent = detectIndent$3(text, deplintObject, sourceFile);
|
|
28970
29138
|
const packagesBlock = `packages: {\n${indent} ${quotePackageKey(dependency)}: ${formatPackageConfigValue(config)},\n${indent}}`;
|
|
28971
29139
|
const openBraceEnd = deplintObject.getStart(sourceFile) + 1;
|
|
28972
29140
|
const insertion = `\n${indent}${packagesBlock},`;
|
|
@@ -28975,7 +29143,7 @@ function insertPackagesIntoDeplint(text, deplintAssignment, sourceFile, dependen
|
|
|
28975
29143
|
function insertDeplintIntoCommands(text, commandsAssignment, sourceFile, dependency, config) {
|
|
28976
29144
|
if (!ts.isObjectLiteralExpression(commandsAssignment.initializer)) throw new TypeError("commands must be an object literal");
|
|
28977
29145
|
const commandsObject = commandsAssignment.initializer;
|
|
28978
|
-
const indent = detectIndent$
|
|
29146
|
+
const indent = detectIndent$3(text, commandsObject, sourceFile);
|
|
28979
29147
|
const block = [
|
|
28980
29148
|
"deplint: {",
|
|
28981
29149
|
`${indent} packages: {`,
|
|
@@ -28988,7 +29156,7 @@ function insertDeplintIntoCommands(text, commandsAssignment, sourceFile, depende
|
|
|
28988
29156
|
return `${text.slice(0, openBraceEnd)}${insertion}${text.slice(openBraceEnd)}`;
|
|
28989
29157
|
}
|
|
28990
29158
|
function insertCommandsIntoConfigObject(text, configObject, sourceFile, dependency, config) {
|
|
28991
|
-
const indent = detectIndent$
|
|
29159
|
+
const indent = detectIndent$3(text, configObject, sourceFile);
|
|
28992
29160
|
const block = [
|
|
28993
29161
|
"commands: {",
|
|
28994
29162
|
`${indent} deplint: {`,
|
|
@@ -29036,11 +29204,11 @@ function applyPackageEditsToTsSource(text, edits) {
|
|
|
29036
29204
|
}
|
|
29037
29205
|
return result;
|
|
29038
29206
|
}
|
|
29039
|
-
function isRecord$
|
|
29207
|
+
function isRecord$11(value) {
|
|
29040
29208
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
29041
29209
|
}
|
|
29042
29210
|
function readJsonPackageConfig(value) {
|
|
29043
|
-
if (!isRecord$
|
|
29211
|
+
if (!isRecord$11(value)) return void 0;
|
|
29044
29212
|
const config = {};
|
|
29045
29213
|
if (typeof value.placement === "string") config.placement = value.placement;
|
|
29046
29214
|
if (typeof value.presence === "string") config.presence = value.presence;
|
|
@@ -29049,10 +29217,10 @@ function readJsonPackageConfig(value) {
|
|
|
29049
29217
|
return config;
|
|
29050
29218
|
}
|
|
29051
29219
|
function resolveJsonDeplintObject(root) {
|
|
29052
|
-
const commands = isRecord$
|
|
29053
|
-
if (commands !== void 0 && isRecord$
|
|
29054
|
-
if (isRecord$
|
|
29055
|
-
if (!isRecord$
|
|
29220
|
+
const commands = isRecord$11(root.commands) ? root.commands : void 0;
|
|
29221
|
+
if (commands !== void 0 && isRecord$11(commands.deplint)) return commands.deplint;
|
|
29222
|
+
if (isRecord$11(root.deplint)) return root.deplint;
|
|
29223
|
+
if (!isRecord$11(root.commands)) root.commands = {};
|
|
29056
29224
|
const cmds = root.commands;
|
|
29057
29225
|
const deplint = {};
|
|
29058
29226
|
cmds.deplint = deplint;
|
|
@@ -29065,7 +29233,7 @@ function applyPackageEditsToJsonSource(text, edits) {
|
|
|
29065
29233
|
if (edits.length === 0) return text;
|
|
29066
29234
|
const root = JSON.parse(text);
|
|
29067
29235
|
const deplint = resolveJsonDeplintObject(root);
|
|
29068
|
-
const packages = isRecord$
|
|
29236
|
+
const packages = isRecord$11(deplint.packages) ? deplint.packages : deplint.packages = {};
|
|
29069
29237
|
for (const edit of edits) if (edit.config === void 0) delete packages[edit.dependency];
|
|
29070
29238
|
else packages[edit.dependency] = edit.config;
|
|
29071
29239
|
if (Object.keys(packages).length === 0) delete deplint.packages;
|
|
@@ -29075,7 +29243,7 @@ function readPackageConfigFromObjectLiteral(objectLiteral) {
|
|
|
29075
29243
|
const config = {};
|
|
29076
29244
|
for (const prop of objectLiteral.properties) {
|
|
29077
29245
|
if (!ts.isPropertyAssignment(prop)) continue;
|
|
29078
|
-
const key = getPropertyName$
|
|
29246
|
+
const key = getPropertyName$4(prop);
|
|
29079
29247
|
if (key === void 0) continue;
|
|
29080
29248
|
const { initializer } = prop;
|
|
29081
29249
|
if ([
|
|
@@ -29100,9 +29268,9 @@ function readPackagesFromConfigFile(configPath) {
|
|
|
29100
29268
|
const result = /* @__PURE__ */ new Map();
|
|
29101
29269
|
if (isJsonConfigPath$1(configPath)) try {
|
|
29102
29270
|
const root = JSON.parse(text);
|
|
29103
|
-
const commands = isRecord$
|
|
29104
|
-
const deplint = commands !== void 0 && isRecord$
|
|
29105
|
-
const packages = deplint !== void 0 && isRecord$
|
|
29271
|
+
const commands = isRecord$11(root.commands) ? root.commands : void 0;
|
|
29272
|
+
const deplint = commands !== void 0 && isRecord$11(commands.deplint) ? commands.deplint : isRecord$11(root.deplint) ? root.deplint : void 0;
|
|
29273
|
+
const packages = deplint !== void 0 && isRecord$11(deplint.packages) ? deplint.packages : void 0;
|
|
29106
29274
|
if (packages === void 0) return result;
|
|
29107
29275
|
for (const [name, value] of Object.entries(packages)) {
|
|
29108
29276
|
const config = readJsonPackageConfig(value);
|
|
@@ -29116,7 +29284,7 @@ function readPackagesFromConfigFile(configPath) {
|
|
|
29116
29284
|
if (packagesAssignment === void 0 || !ts.isObjectLiteralExpression(packagesAssignment.initializer)) return result;
|
|
29117
29285
|
for (const prop of packagesAssignment.initializer.properties) {
|
|
29118
29286
|
if (!ts.isPropertyAssignment(prop)) continue;
|
|
29119
|
-
const name = getPropertyName$
|
|
29287
|
+
const name = getPropertyName$4(prop);
|
|
29120
29288
|
if (name === void 0 || !ts.isObjectLiteralExpression(prop.initializer)) continue;
|
|
29121
29289
|
result.set(name, readPackageConfigFromObjectLiteral(prop.initializer));
|
|
29122
29290
|
}
|
|
@@ -29446,7 +29614,7 @@ const BUILT_IN_RULE_OPTION_KEYS = {
|
|
|
29446
29614
|
]),
|
|
29447
29615
|
"dep.workspace.protocol": /* @__PURE__ */ new Set(["ignore", "protocol"])
|
|
29448
29616
|
};
|
|
29449
|
-
function isRecord$
|
|
29617
|
+
function isRecord$10(value) {
|
|
29450
29618
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
29451
29619
|
}
|
|
29452
29620
|
function isRuleLevel$2(value) {
|
|
@@ -29487,7 +29655,7 @@ function parseRuleConfig$1(ruleId, value) {
|
|
|
29487
29655
|
const level = value[0];
|
|
29488
29656
|
if (!isRuleLevel$2(level)) throw new TypeError(`${formatRuleConfigLocation$1(ruleId)} level must be one of "off", "warn", or "error"`);
|
|
29489
29657
|
const options = value[1];
|
|
29490
|
-
if (!isRecord$
|
|
29658
|
+
if (!isRecord$10(options)) throw new TypeError(`${formatRuleConfigLocation$1(ruleId)} options must be an object`);
|
|
29491
29659
|
return {
|
|
29492
29660
|
level,
|
|
29493
29661
|
options: { ...options }
|
|
@@ -29942,7 +30110,7 @@ const npmPackageNamePattern = /^@?[a-z0-9][\w./-]*$/i;
|
|
|
29942
30110
|
function isStorybookMainFile(filePath) {
|
|
29943
30111
|
return storybookMainPattern.test(filePath);
|
|
29944
30112
|
}
|
|
29945
|
-
function getPropertyName$
|
|
30113
|
+
function getPropertyName$3(prop) {
|
|
29946
30114
|
if (ts.isIdentifier(prop.name)) return prop.name.text;
|
|
29947
30115
|
return ts.isStringLiteral(prop.name) || ts.isNoSubstitutionTemplateLiteral(prop.name) ? prop.name.text : void 0;
|
|
29948
30116
|
}
|
|
@@ -29957,7 +30125,7 @@ function extractFromEntry(node, collected) {
|
|
|
29957
30125
|
return;
|
|
29958
30126
|
}
|
|
29959
30127
|
if (ts.isObjectLiteralExpression(node)) {
|
|
29960
|
-
for (const prop of node.properties) if (ts.isPropertyAssignment(prop) && getPropertyName$
|
|
30128
|
+
for (const prop of node.properties) if (ts.isPropertyAssignment(prop) && getPropertyName$3(prop) === "name") extractFromEntry(prop.initializer, collected);
|
|
29961
30129
|
return;
|
|
29962
30130
|
}
|
|
29963
30131
|
if (ts.isCallExpression(node)) {
|
|
@@ -29974,7 +30142,7 @@ function getStorybookConfigImports(filePath, importPaths) {
|
|
|
29974
30142
|
const collected = [];
|
|
29975
30143
|
function visit(node) {
|
|
29976
30144
|
if (ts.isPropertyAssignment(node)) {
|
|
29977
|
-
const name = getPropertyName$
|
|
30145
|
+
const name = getPropertyName$3(node);
|
|
29978
30146
|
if (name === "addons") {
|
|
29979
30147
|
if (ts.isArrayLiteralExpression(node.initializer)) for (const element of node.initializer.elements) extractFromEntry(element, collected);
|
|
29980
30148
|
} else if (name === "framework" || name === "builder") extractFromEntry(node.initializer, collected);
|
|
@@ -30212,7 +30380,7 @@ function getMostUsedKey(indents) {
|
|
|
30212
30380
|
function makeIndentString(type, amount) {
|
|
30213
30381
|
return (type === INDENT_TYPE_SPACE ? " " : " ").repeat(amount);
|
|
30214
30382
|
}
|
|
30215
|
-
function detectIndent$
|
|
30383
|
+
function detectIndent$2(string) {
|
|
30216
30384
|
if (typeof string !== "string") throw new TypeError("Expected a string");
|
|
30217
30385
|
let indents = makeIndentsMap(string, true);
|
|
30218
30386
|
if (indents.size === 0) indents = makeIndentsMap(string, false);
|
|
@@ -30848,7 +31016,7 @@ const defaultSortOrder = fields.map(({ key }) => key);
|
|
|
30848
31016
|
const overFields = pipe(fields.map(({ key, over }) => over ? overProperty(key, over) : void 0).filter(Boolean));
|
|
30849
31017
|
function editStringJSON(json, over) {
|
|
30850
31018
|
if (typeof json === "string") {
|
|
30851
|
-
const { indent, type } = detectIndent$
|
|
31019
|
+
const { indent, type } = detectIndent$2(json);
|
|
30852
31020
|
const endCharacters = json.slice(-1) === "\n" ? "\n" : "";
|
|
30853
31021
|
const newline = detectNewlineGraceful(json);
|
|
30854
31022
|
json = JSON.parse(json);
|
|
@@ -36549,7 +36717,7 @@ const alwaysActiveConditions = /* @__PURE__ */ new Set(["default", "neutral"]);
|
|
|
36549
36717
|
const typeOnlyConditions = /* @__PURE__ */ new Set(["types"]);
|
|
36550
36718
|
const sourceFileRe = /\.(?:[cm]?tsx?)$/;
|
|
36551
36719
|
const declarationFileRe = /\.d\.[cm]?ts$/;
|
|
36552
|
-
function isRecord$
|
|
36720
|
+
function isRecord$9(value) {
|
|
36553
36721
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
36554
36722
|
}
|
|
36555
36723
|
function resolveOrExclude(target, conditions) {
|
|
@@ -36562,7 +36730,7 @@ function resolveOrExclude(target, conditions) {
|
|
|
36562
36730
|
}
|
|
36563
36731
|
return;
|
|
36564
36732
|
}
|
|
36565
|
-
if (!isRecord$
|
|
36733
|
+
if (!isRecord$9(target)) return void 0;
|
|
36566
36734
|
for (const [condition, nested] of Object.entries(target)) {
|
|
36567
36735
|
if (typeOnlyConditions.has(condition)) continue;
|
|
36568
36736
|
if (!alwaysActiveConditions.has(condition) && !conditions.has(condition)) continue;
|
|
@@ -36583,7 +36751,7 @@ Condition keys a target branches on, excluding always-active and type-only keys.
|
|
|
36583
36751
|
*/
|
|
36584
36752
|
function runtimeConditionKeys(target) {
|
|
36585
36753
|
if (Array.isArray(target)) return target.flatMap((entry) => runtimeConditionKeys(entry));
|
|
36586
|
-
if (!isRecord$
|
|
36754
|
+
if (!isRecord$9(target)) return [];
|
|
36587
36755
|
return Object.entries(target).flatMap(([condition, nested]) => [...alwaysActiveConditions.has(condition) || typeOnlyConditions.has(condition) ? [] : [condition], ...runtimeConditionKeys(nested)]);
|
|
36588
36756
|
}
|
|
36589
36757
|
/**
|
|
@@ -36597,7 +36765,7 @@ function conditionCombinations(keys) {
|
|
|
36597
36765
|
function leafTargets(target) {
|
|
36598
36766
|
if (typeof target === "string") return [target];
|
|
36599
36767
|
if (Array.isArray(target)) return target.flatMap((entry) => leafTargets(entry));
|
|
36600
|
-
return isRecord$
|
|
36768
|
+
return isRecord$9(target) ? Object.entries(target).filter(([condition]) => !typeOnlyConditions.has(condition)).flatMap(([, nested]) => leafTargets(nested)) : [];
|
|
36601
36769
|
}
|
|
36602
36770
|
function isSourceTarget(target) {
|
|
36603
36771
|
return sourceFileRe.test(target) && !declarationFileRe.test(target);
|
|
@@ -36616,7 +36784,7 @@ function normalizeTarget$1(target) {
|
|
|
36616
36784
|
return target === void 0 || target.startsWith("./") ? target : `./${target}`;
|
|
36617
36785
|
}
|
|
36618
36786
|
function exportSubpaths(exports) {
|
|
36619
|
-
const entries = isRecord$
|
|
36787
|
+
const entries = isRecord$9(exports) ? Object.entries(exports) : [];
|
|
36620
36788
|
return Object.fromEntries(entries.filter(([key]) => key === "." || key.startsWith("./")));
|
|
36621
36789
|
}
|
|
36622
36790
|
/**
|
|
@@ -36626,7 +36794,7 @@ function exportSubpaths(exports) {
|
|
|
36626
36794
|
* not also select.
|
|
36627
36795
|
*/
|
|
36628
36796
|
function importAliasTarget(imports, subpath, conditions) {
|
|
36629
|
-
if (!isRecord$
|
|
36797
|
+
if (!isRecord$9(imports) || !subpath.startsWith("./")) return void 0;
|
|
36630
36798
|
const alias = `#${subpath.slice(2)}`;
|
|
36631
36799
|
const importTarget = imports[alias];
|
|
36632
36800
|
return isRuntimeImportTarget(importTarget) ? {
|
|
@@ -36652,7 +36820,7 @@ function aliasMismatches(importTarget, exportTarget) {
|
|
|
36652
36820
|
* the conditions either map branches on.
|
|
36653
36821
|
*/
|
|
36654
36822
|
function findImportAliasDivergences(imports, exports) {
|
|
36655
|
-
if (!isRecord$
|
|
36823
|
+
if (!isRecord$9(imports)) return [];
|
|
36656
36824
|
const subpaths = exportSubpaths(exports);
|
|
36657
36825
|
return Object.entries(imports).flatMap(([alias, importTarget]) => {
|
|
36658
36826
|
if (!alias.startsWith("#") || alias.includes("*")) return [];
|
|
@@ -36911,7 +37079,7 @@ function findConfigFile(pkgDir) {
|
|
|
36911
37079
|
if (fs.existsSync(candidate)) return candidate;
|
|
36912
37080
|
}
|
|
36913
37081
|
}
|
|
36914
|
-
function getPropertyName$
|
|
37082
|
+
function getPropertyName$2(prop) {
|
|
36915
37083
|
if (!ts.isPropertyAssignment(prop)) return void 0;
|
|
36916
37084
|
const { name } = prop;
|
|
36917
37085
|
return ts.isIdentifier(name) || ts.isStringLiteral(name) ? name.text : void 0;
|
|
@@ -36924,8 +37092,8 @@ function getPropertyName$1(prop) {
|
|
|
36924
37092
|
function collectEmptyTargetProps(sourceFile) {
|
|
36925
37093
|
const found = [];
|
|
36926
37094
|
function visit(node) {
|
|
36927
|
-
if (ts.isPropertyAssignment(node) && getPropertyName$
|
|
36928
|
-
for (const prop of node.initializer.properties) if (ts.isPropertyAssignment(prop) && COMPILE_TARGET_NAMES.has(getPropertyName$
|
|
37095
|
+
if (ts.isPropertyAssignment(node) && getPropertyName$2(node) === "compile" && ts.isObjectLiteralExpression(node.initializer)) {
|
|
37096
|
+
for (const prop of node.initializer.properties) if (ts.isPropertyAssignment(prop) && COMPILE_TARGET_NAMES.has(getPropertyName$2(prop) ?? "") && ts.isObjectLiteralExpression(prop.initializer) && prop.initializer.properties.length === 0) found.push(prop);
|
|
36929
37097
|
}
|
|
36930
37098
|
ts.forEachChild(node, visit);
|
|
36931
37099
|
}
|
|
@@ -36976,9 +37144,9 @@ function checkCompileTargets(pkgDir, shouldFix) {
|
|
|
36976
37144
|
const configName = path.basename(configPath);
|
|
36977
37145
|
if (shouldFix) {
|
|
36978
37146
|
fs.writeFileSync(configPath, removeProperties(text, emptyProps, sourceFile));
|
|
36979
|
-
for (const prop of emptyProps) console.warn(chalk.yellow(`Publint [compileTargets]: removed deprecated empty "compile.${getPropertyName$
|
|
37147
|
+
for (const prop of emptyProps) console.warn(chalk.yellow(`Publint [compileTargets]: removed deprecated empty "compile.${getPropertyName$2(prop)}" target from ${configName}`));
|
|
36980
37148
|
result.modified = true;
|
|
36981
|
-
} else for (const prop of emptyProps) console.warn(chalk.yellow(`Publint [compileTargets]: "compile.${getPropertyName$
|
|
37149
|
+
} else for (const prop of emptyProps) console.warn(chalk.yellow(`Publint [compileTargets]: "compile.${getPropertyName$2(prop)} = {}" is treated as "do not build" — set it to \`false\` or remove it (use --fix to remove) in ${configName}`));
|
|
36982
37150
|
result.warnings += emptyProps.length;
|
|
36983
37151
|
return result;
|
|
36984
37152
|
}
|
|
@@ -37308,7 +37476,7 @@ function formatExportPath$1(pathParts) {
|
|
|
37308
37476
|
function ensureExportsPath$1(value) {
|
|
37309
37477
|
return value.startsWith("./") ? value : `./${value}`;
|
|
37310
37478
|
}
|
|
37311
|
-
function isRecord$
|
|
37479
|
+
function isRecord$8(value) {
|
|
37312
37480
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
37313
37481
|
}
|
|
37314
37482
|
function normalizeTarget(target) {
|
|
@@ -37345,7 +37513,7 @@ function collectExportLeaves(value, subpath = ".", pathParts = ["exports"], cond
|
|
|
37345
37513
|
}];
|
|
37346
37514
|
}
|
|
37347
37515
|
if (Array.isArray(value)) return value.flatMap((entry, index) => collectExportLeaves(entry, subpath, [...pathParts, `[${index}]`], conditionPath));
|
|
37348
|
-
if (!isRecord$
|
|
37516
|
+
if (!isRecord$8(value)) return [];
|
|
37349
37517
|
return Object.entries(value).flatMap(([key, nested]) => {
|
|
37350
37518
|
return isSubpathExportKey$1(key) ? collectExportLeaves(nested, key, [...pathParts, key], conditionPath) : collectExportLeaves(nested, subpath, [...pathParts, key], [...conditionPath, key]);
|
|
37351
37519
|
});
|
|
@@ -37467,14 +37635,14 @@ function shouldNormalizeExportsForFix(pkg) {
|
|
|
37467
37635
|
pkg.exports = { ".": pkg.exports };
|
|
37468
37636
|
return true;
|
|
37469
37637
|
}
|
|
37470
|
-
if (isRecord$
|
|
37638
|
+
if (isRecord$8(pkg.exports) && !hasSubpathKeys(pkg.exports)) {
|
|
37471
37639
|
pkg.exports = { ".": pkg.exports };
|
|
37472
37640
|
return true;
|
|
37473
37641
|
}
|
|
37474
37642
|
return false;
|
|
37475
37643
|
}
|
|
37476
37644
|
function isRecordObject(value) {
|
|
37477
|
-
return isRecord$
|
|
37645
|
+
return isRecord$8(value);
|
|
37478
37646
|
}
|
|
37479
37647
|
function ensureSubpath(exports, subpath) {
|
|
37480
37648
|
const existing = exports[subpath];
|
|
@@ -43014,7 +43182,7 @@ const VALID_RULE_LEVELS = /* @__PURE__ */ new Set([
|
|
|
43014
43182
|
"warn",
|
|
43015
43183
|
"error"
|
|
43016
43184
|
]);
|
|
43017
|
-
function isRecord$
|
|
43185
|
+
function isRecord$7(value) {
|
|
43018
43186
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
43019
43187
|
}
|
|
43020
43188
|
function isRuleLevel(value) {
|
|
@@ -43039,13 +43207,13 @@ function parseRuleConfig(ruleId, value) {
|
|
|
43039
43207
|
const level = value[0];
|
|
43040
43208
|
if (!isRuleLevel(level)) throw new TypeError(`${formatRuleConfigLocation(ruleId)} level must be one of "off", "warn", or "error"`);
|
|
43041
43209
|
const options = value[1];
|
|
43042
|
-
if (!isRecord$
|
|
43210
|
+
if (!isRecord$7(options)) throw new TypeError(`${formatRuleConfigLocation(ruleId)} options must be an object`);
|
|
43043
43211
|
return {
|
|
43044
43212
|
level,
|
|
43045
43213
|
options: { ...options }
|
|
43046
43214
|
};
|
|
43047
43215
|
}
|
|
43048
|
-
if (isRecord$
|
|
43216
|
+
if (isRecord$7(value)) return {
|
|
43049
43217
|
level: "warn",
|
|
43050
43218
|
options: { ...value }
|
|
43051
43219
|
};
|
|
@@ -44124,7 +44292,7 @@ function isJsonConfigPath(configPath) {
|
|
|
44124
44292
|
const base = path.basename(configPath);
|
|
44125
44293
|
return base === ".xyrc.json" || base.endsWith(".json");
|
|
44126
44294
|
}
|
|
44127
|
-
function getPropertyName(prop) {
|
|
44295
|
+
function getPropertyName$1(prop) {
|
|
44128
44296
|
if (ts.isPropertyAssignment(prop)) {
|
|
44129
44297
|
const { name } = prop;
|
|
44130
44298
|
if (ts.isIdentifier(name) || ts.isStringLiteral(name) || ts.isNoSubstitutionTemplateLiteral(name)) return name.text;
|
|
@@ -44148,10 +44316,10 @@ function findDefaultExportObject(sourceFile) {
|
|
|
44148
44316
|
function findObjectProperty(object, key) {
|
|
44149
44317
|
for (const prop of object.properties) {
|
|
44150
44318
|
if (!ts.isPropertyAssignment(prop)) continue;
|
|
44151
|
-
if (getPropertyName(prop) === key) return prop;
|
|
44319
|
+
if (getPropertyName$1(prop) === key) return prop;
|
|
44152
44320
|
}
|
|
44153
44321
|
}
|
|
44154
|
-
function detectIndent(text, object, sourceFile) {
|
|
44322
|
+
function detectIndent$1(text, object, sourceFile) {
|
|
44155
44323
|
if (object.properties.length > 0) {
|
|
44156
44324
|
const start = object.properties[0].getStart(sourceFile);
|
|
44157
44325
|
let lineStart = start;
|
|
@@ -44178,7 +44346,7 @@ function removePropertyFromObject(text, prop, sourceFile) {
|
|
|
44178
44346
|
return `${text.slice(0, start)}${text.slice(end)}`;
|
|
44179
44347
|
}
|
|
44180
44348
|
function insertPropertyIntoObject(text, object, sourceFile, entry) {
|
|
44181
|
-
const indent = detectIndent(text, object, sourceFile);
|
|
44349
|
+
const indent = detectIndent$1(text, object, sourceFile);
|
|
44182
44350
|
const openBraceEnd = object.getStart(sourceFile) + 1;
|
|
44183
44351
|
const insertion = `\n${indent}${entry},`;
|
|
44184
44352
|
return `${text.slice(0, openBraceEnd)}${insertion}${text.slice(openBraceEnd)}`;
|
|
@@ -44217,7 +44385,7 @@ function applyCompileCompilerToTsSource(text, compiler) {
|
|
|
44217
44385
|
if ((ts.isStringLiteral(validator.initializer) || ts.isNoSubstitutionTemplateLiteral(validator.initializer)) && validator.initializer.text === "shared") result = removePropertyFromObject(result, validator, afterCompiler);
|
|
44218
44386
|
return result;
|
|
44219
44387
|
}
|
|
44220
|
-
function isRecord$
|
|
44388
|
+
function isRecord$6(value) {
|
|
44221
44389
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
44222
44390
|
}
|
|
44223
44391
|
/**
|
|
@@ -44225,7 +44393,7 @@ function isRecord$5(value) {
|
|
|
44225
44393
|
*/
|
|
44226
44394
|
function applyCompileCompilerToJsonSource(text, compiler) {
|
|
44227
44395
|
const root = JSON.parse(text);
|
|
44228
|
-
const compile = isRecord$
|
|
44396
|
+
const compile = isRecord$6(root.compile) ? { ...root.compile } : {};
|
|
44229
44397
|
compile.compiler = compiler;
|
|
44230
44398
|
if (compiler === "native" && compile.validator === "shared") delete compile.validator;
|
|
44231
44399
|
root.compile = compile;
|
|
@@ -46459,12 +46627,12 @@ function checkPnpmReleaseAgeExcludes(cwd, pm, workspaces = []) {
|
|
|
46459
46627
|
for (const pattern of unnecessary) result.fixable.push(`pnpm-workspace.yaml minimumReleaseAgeExclude includes '${pattern}' but the repo does not use that scope`);
|
|
46460
46628
|
return result;
|
|
46461
46629
|
}
|
|
46462
|
-
function isRecord$
|
|
46630
|
+
function isRecord$5(value) {
|
|
46463
46631
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
46464
46632
|
}
|
|
46465
46633
|
function isConfiguredValue(value) {
|
|
46466
46634
|
if (value === void 0 || value === null) return false;
|
|
46467
|
-
if (isRecord$
|
|
46635
|
+
if (isRecord$5(value)) return Object.keys(value).length > 0;
|
|
46468
46636
|
return Array.isArray(value) ? value.length > 0 : value !== "";
|
|
46469
46637
|
}
|
|
46470
46638
|
function configuredYamlKeys(node) {
|
|
@@ -46489,8 +46657,8 @@ function formatOverrideWarning(location, keys) {
|
|
|
46489
46657
|
function checkPnpmDependencyOverrides(cwd, pm, rootPkg) {
|
|
46490
46658
|
const result = emptyResult$2();
|
|
46491
46659
|
if (pm !== "pnpm") return result;
|
|
46492
|
-
const packageJsonOverrides = (isRecord$
|
|
46493
|
-
if (isConfiguredValue(packageJsonOverrides)) result.warnings.push(formatOverrideWarning("Root package.json pnpm.overrides field", isRecord$
|
|
46660
|
+
const packageJsonOverrides = (isRecord$5(rootPkg.pnpm) ? rootPkg.pnpm : void 0)?.overrides;
|
|
46661
|
+
if (isConfiguredValue(packageJsonOverrides)) result.warnings.push(formatOverrideWarning("Root package.json pnpm.overrides field", isRecord$5(packageJsonOverrides) ? Object.keys(packageJsonOverrides) : []));
|
|
46494
46662
|
const workspaceOverrides = readPnpmWorkspaceDocument(cwd)?.get("overrides");
|
|
46495
46663
|
if (isConfiguredYamlNode(workspaceOverrides)) result.warnings.push(formatOverrideWarning("pnpm-workspace.yaml overrides field", configuredYamlKeys(workspaceOverrides)));
|
|
46496
46664
|
return result;
|
|
@@ -48037,7 +48205,7 @@ function visibleMarkdown(markdown) {
|
|
|
48037
48205
|
return markdown.replaceAll(/^ {0,3}([`~]{3,})[^\n]*\n[\s\S]*?^ {0,3}\1[^\n]*$/gmu, "\n").replaceAll(/`[^`\n]+`/gu, " ").replaceAll(/<!--[\s\S]*?-->/gu, " ");
|
|
48038
48206
|
}
|
|
48039
48207
|
function hasClaudeAgentsImport(markdown) {
|
|
48040
|
-
return
|
|
48208
|
+
return claudeAgentsImportPlacement(markdown) === "first";
|
|
48041
48209
|
}
|
|
48042
48210
|
function claudeFileImports(markdown) {
|
|
48043
48211
|
const imports = [];
|
|
@@ -48265,7 +48433,7 @@ const claudeImportsOutcome = (root, hasClaude, fix) => {
|
|
|
48265
48433
|
if (contents === void 0 || hasClaudeAgentsImport(contents)) return { diagnostics: [] };
|
|
48266
48434
|
if (fix) {
|
|
48267
48435
|
const template = PLAN_REQUIRED_FILE_TEMPLATES["CLAUDE.md"];
|
|
48268
|
-
const next = contents.trim().length === 0 ? template : `${template}${contents.trimStart()}`;
|
|
48436
|
+
const next = contents.trim().length === 0 ? template : `${template.trimEnd()}\n\n${contents.trimStart()}`;
|
|
48269
48437
|
if (writeRootMarkdown(root, "CLAUDE.md", next)) return {
|
|
48270
48438
|
diagnostics: [],
|
|
48271
48439
|
fixedCount: 1
|
|
@@ -49493,7 +49661,7 @@ async function resolveRepoInitPlan(params) {
|
|
|
49493
49661
|
//#region src/actions/repo-init/templateVars.ts
|
|
49494
49662
|
function packageManagerField(pm) {
|
|
49495
49663
|
switch (pm) {
|
|
49496
|
-
case "pnpm": return "pnpm@
|
|
49664
|
+
case "pnpm": return "pnpm@12.10.1";
|
|
49497
49665
|
case "yarn": return "yarn@4.13.0";
|
|
49498
49666
|
case "npm": return "npm@10.9.4";
|
|
49499
49667
|
case "bun": return "bun@1.3.3";
|
|
@@ -49545,7 +49713,8 @@ function buildTemplateVariables(plan) {
|
|
|
49545
49713
|
const layoutLabel = monorepo ? "monorepo (pnpm/yarn/npm workspaces)" : "single package";
|
|
49546
49714
|
const layoutDescription = monorepo ? `Monorepo for ${projectName} (\`${scopedPackageName}\`). Package sources live under \`packages/${packageName}\`.` : `Single-package repo for ${projectName} (\`${scopedPackageName}\`). Sources live under \`src/\`.`;
|
|
49547
49715
|
const packageDirNote = monorepo ? ", never from inside a package directory" : "";
|
|
49548
|
-
const
|
|
49716
|
+
const now = /* @__PURE__ */ new Date();
|
|
49717
|
+
const copyrightYear = String(now.getFullYear());
|
|
49549
49718
|
return {
|
|
49550
49719
|
authorEmail,
|
|
49551
49720
|
authorName,
|
|
@@ -49555,12 +49724,14 @@ function buildTemplateVariables(plan) {
|
|
|
49555
49724
|
description,
|
|
49556
49725
|
eslintConfigPackage,
|
|
49557
49726
|
githubOrg,
|
|
49727
|
+
githubRef: "${{ github.ref }}",
|
|
49558
49728
|
homepage,
|
|
49559
49729
|
identifierName,
|
|
49560
49730
|
keywordPrimary: npmScope.replace(/^@/, "") || "typescript",
|
|
49561
49731
|
layoutDescription,
|
|
49562
49732
|
layoutLabel,
|
|
49563
49733
|
license,
|
|
49734
|
+
nodeVersion: latestVersions.nodeCurrent,
|
|
49564
49735
|
licenseFile: licenseFileContents(license, Number(copyrightYear), authorName),
|
|
49565
49736
|
npmScope,
|
|
49566
49737
|
packageDirNote,
|
|
@@ -49574,6 +49745,9 @@ function buildTemplateVariables(plan) {
|
|
|
49574
49745
|
scopedPackageName,
|
|
49575
49746
|
srcPrefix,
|
|
49576
49747
|
testInclude,
|
|
49748
|
+
today: now.toISOString().slice(0, 10),
|
|
49749
|
+
vitestCoverageRange: "~5.0.3",
|
|
49750
|
+
vitestRange: "~5.0.3",
|
|
49577
49751
|
toolchainRange: bundledToolchainRange(),
|
|
49578
49752
|
toolchainVersion: bundledToolchainVersion(),
|
|
49579
49753
|
tsconfigPackage,
|
|
@@ -49667,11 +49841,14 @@ function mergePackageJsonRecords(rootPkg, packagePkg) {
|
|
|
49667
49841
|
...rootDev,
|
|
49668
49842
|
...pkgDev
|
|
49669
49843
|
},
|
|
49844
|
+
engineStrict: rootPkg.engineStrict ?? packagePkg.engineStrict,
|
|
49845
|
+
packageManager: rootPkg.packageManager ?? packagePkg.packageManager,
|
|
49670
49846
|
private: false,
|
|
49671
49847
|
scripts: {
|
|
49672
49848
|
...rootScripts,
|
|
49673
49849
|
...pkgScripts
|
|
49674
|
-
}
|
|
49850
|
+
},
|
|
49851
|
+
volta: rootPkg.volta ?? packagePkg.volta
|
|
49675
49852
|
};
|
|
49676
49853
|
}
|
|
49677
49854
|
function normalizeRootPackageJson(projectDir, plan, packagePkg) {
|
|
@@ -49856,7 +50033,7 @@ const argvAfterCommand = (command) => {
|
|
|
49856
50033
|
//#endregion
|
|
49857
50034
|
//#region src/actions/skills/defaults.ts
|
|
49858
50035
|
/**
|
|
49859
|
-
Source of truth for xy-development, xy-toolchain, and ariestools-sdk.
|
|
50036
|
+
Source of truth for xy-development, xy-toolchain, xy-agent, and ariestools-sdk.
|
|
49860
50037
|
*/
|
|
49861
50038
|
const ARIESTOOLS_SKILLS_SOURCE = "ariestools/ariestools-skills";
|
|
49862
50039
|
/**
|
|
@@ -49865,6 +50042,7 @@ Source of truth for xyo-knowledge and xl1-* skills.
|
|
|
49865
50042
|
const XYO_SKILLS_SOURCE = "XYOracleNetwork/xyo-skills";
|
|
49866
50043
|
const ARIESTOOLS_SKILLS = [
|
|
49867
50044
|
"ariestools-sdk",
|
|
50045
|
+
"xy-agent",
|
|
49868
50046
|
"xy-development",
|
|
49869
50047
|
"xy-toolchain"
|
|
49870
50048
|
];
|
|
@@ -49913,8 +50091,14 @@ const skillsDefaultsInstallPlans = (args) => {
|
|
|
49913
50091
|
source: XYO_SKILLS_SOURCE
|
|
49914
50092
|
}];
|
|
49915
50093
|
};
|
|
50094
|
+
const SKILL_SOURCES = {
|
|
50095
|
+
...Object.fromEntries(ARIESTOOLS_SKILLS.map((name) => [name, ARIESTOOLS_SKILLS_SOURCE])),
|
|
50096
|
+
...Object.fromEntries(XYO_STACK_SKILLS.map((name) => [name, XYO_SKILLS_SOURCE]))
|
|
50097
|
+
};
|
|
49916
50098
|
const skillSourceForName = (skillName) => {
|
|
49917
|
-
|
|
50099
|
+
const source = SKILL_SOURCES[skillName];
|
|
50100
|
+
if (source === void 0) throw new TypeError(`Unknown skill "${skillName}". Known skills: ${Object.keys(SKILL_SOURCES).join(", ")}`);
|
|
50101
|
+
return source;
|
|
49918
50102
|
};
|
|
49919
50103
|
const skillsDefaults = async (args) => {
|
|
49920
50104
|
for (const plan of skillsDefaultsInstallPlans(args)) {
|
|
@@ -49934,6 +50118,7 @@ const XYO_SKILL_NAMES = [...XYO_DEFAULT_SKILLS];
|
|
|
49934
50118
|
const SKILL_ORDER = [
|
|
49935
50119
|
"xy-development",
|
|
49936
50120
|
"xy-toolchain",
|
|
50121
|
+
"xy-agent",
|
|
49937
50122
|
"ariestools-sdk",
|
|
49938
50123
|
"xyo-knowledge",
|
|
49939
50124
|
"xl1-knowledge",
|
|
@@ -49960,6 +50145,7 @@ const XL1_SKILLS = [
|
|
|
49960
50145
|
"xl1-patterns",
|
|
49961
50146
|
"xl1-testing"
|
|
49962
50147
|
];
|
|
50148
|
+
const XY_OPTIONAL_SKILLS = ["xy-agent"];
|
|
49963
50149
|
const XL1_OPTIONAL_SKILLS = [
|
|
49964
50150
|
"xl1-dapp-kit",
|
|
49965
50151
|
"xl1-scaffold",
|
|
@@ -49992,7 +50178,7 @@ const normalizeAdditionalSkills = (value) => {
|
|
|
49992
50178
|
if (unknown.length > 0) throw new TypeError(`Unknown skills in commands.skillsLint.additionalSkills: ${unknown.join(", ")}. Known skills: ${XYO_SKILL_NAMES.join(", ")}`);
|
|
49993
50179
|
return sortSkills([...new Set(names.filter((entry) => isXyoSkillName(entry)))]);
|
|
49994
50180
|
};
|
|
49995
|
-
const PRESENCE_VALUES = /* @__PURE__ */ new Set([
|
|
50181
|
+
const PRESENCE_VALUES$1 = /* @__PURE__ */ new Set([
|
|
49996
50182
|
"allowed",
|
|
49997
50183
|
"off",
|
|
49998
50184
|
"required"
|
|
@@ -50008,7 +50194,7 @@ const normalizeSkillPresence = (value) => {
|
|
|
50008
50194
|
for (const [name, entry] of Object.entries(value)) {
|
|
50009
50195
|
if (!isXyoSkillName(name)) throw new TypeError(`Unknown skill in commands.skillsLint.skills: ${name}. Known skills: ${XYO_SKILL_NAMES.join(", ")}`);
|
|
50010
50196
|
const setting = (typeof entry === "object" && entry !== null ? entry : void 0)?.presence;
|
|
50011
|
-
if (typeof setting !== "string" || !PRESENCE_VALUES.has(setting)) throw new TypeError(`commands.skillsLint.skills.${name}.presence must be "required", "allowed", or "off"`);
|
|
50197
|
+
if (typeof setting !== "string" || !PRESENCE_VALUES$1.has(setting)) throw new TypeError(`commands.skillsLint.skills.${name}.presence must be "required", "allowed", or "off"`);
|
|
50012
50198
|
presence[name] = setting;
|
|
50013
50199
|
}
|
|
50014
50200
|
return presence;
|
|
@@ -50045,7 +50231,8 @@ const requiredSkillsForProfile = (profile) => {
|
|
|
50045
50231
|
return applySkillPresence(additional.length === 0 ? withDappKit : sortSkills([.../* @__PURE__ */ new Set([...withDappKit, ...additional])]), profile.skillPresence);
|
|
50046
50232
|
};
|
|
50047
50233
|
const optionalSkillsForTier = (tier) => {
|
|
50048
|
-
|
|
50234
|
+
if (tier === "none") return [];
|
|
50235
|
+
return tier === "xl1" ? sortSkills([...XY_OPTIONAL_SKILLS, ...XL1_OPTIONAL_SKILLS]) : XY_OPTIONAL_SKILLS;
|
|
50049
50236
|
};
|
|
50050
50237
|
const isXyoSkillName = (name) => {
|
|
50051
50238
|
return XYO_SKILL_NAMES.includes(name);
|
|
@@ -50067,11 +50254,7 @@ function skillsInstallPlansForTier(tier, includeOptional) {
|
|
|
50067
50254
|
const required = [...requiredSkillsForTier(tier)];
|
|
50068
50255
|
const optional = includeOptional ? [...optionalSkillsForTier(tier)] : [];
|
|
50069
50256
|
const names = [.../* @__PURE__ */ new Set([...required, ...optional])];
|
|
50070
|
-
const ariestoolsNames =
|
|
50071
|
-
"xy-development",
|
|
50072
|
-
"xy-toolchain",
|
|
50073
|
-
"ariestools-sdk"
|
|
50074
|
-
]);
|
|
50257
|
+
const ariestoolsNames = new Set(ARIESTOOLS_SKILLS);
|
|
50075
50258
|
const ariestools = names.filter((name) => ariestoolsNames.has(name));
|
|
50076
50259
|
const xyo = names.filter((name) => !ariestoolsNames.has(name));
|
|
50077
50260
|
const plans = [];
|
|
@@ -56337,8 +56520,7 @@ const ARIESTOOLS_SDK_JS_PACKAGES = /* @__PURE__ */ new Set([
|
|
|
56337
56520
|
"@ariestools/storage-adapters",
|
|
56338
56521
|
"@ariestools/telemetry",
|
|
56339
56522
|
"@ariestools/testing",
|
|
56340
|
-
"@ariestools/threads"
|
|
56341
|
-
"@ariestools/threads-test"
|
|
56523
|
+
"@ariestools/threads"
|
|
56342
56524
|
]);
|
|
56343
56525
|
const XY_ECOSYSTEM_SCOPES = [
|
|
56344
56526
|
XYLABS_SCOPE,
|
|
@@ -56475,31 +56657,39 @@ const detectRepoProfile = (cwd) => {
|
|
|
56475
56657
|
//#endregion
|
|
56476
56658
|
//#region src/actions/skills/installed.ts
|
|
56477
56659
|
const PROJECT_SKILL_DIRS = [".claude/skills", ".agents/skills"];
|
|
56478
|
-
const
|
|
56660
|
+
const metadataField = (field) => new RegExp(String.raw`metadata:\s*\n(?:[ \t]+[^\n]+\n)*?[ \t]+${field}:\s*['"]?([^\s#'"]+)`);
|
|
56479
56661
|
const listSkillDirs = (root) => {
|
|
56480
56662
|
return existsSync(root) ? readdirSync(root).filter((f) => statSync(path.resolve(root, f)).isDirectory()) : [];
|
|
56481
56663
|
};
|
|
56482
|
-
const recordInstalledSkill = (installed, relativeDir, name,
|
|
56664
|
+
const recordInstalledSkill = (installed, relativeDir, name, details) => {
|
|
56483
56665
|
const existing = installed.get(name);
|
|
56484
56666
|
if (existing == null) {
|
|
56485
56667
|
installed.set(name, {
|
|
56668
|
+
file: details.file,
|
|
56486
56669
|
locations: [relativeDir],
|
|
56487
56670
|
name,
|
|
56488
|
-
|
|
56671
|
+
status: details.status,
|
|
56672
|
+
version: details.version
|
|
56489
56673
|
});
|
|
56490
56674
|
return;
|
|
56491
56675
|
}
|
|
56492
56676
|
existing.locations.push(relativeDir);
|
|
56493
|
-
if (version != null && existing.version == null) existing.version = version;
|
|
56677
|
+
if (details.version != null && existing.version == null) existing.version = details.version;
|
|
56678
|
+
if (details.status != null && existing.status == null) existing.status = details.status;
|
|
56679
|
+
if (details.file != null && existing.file == null) existing.file = details.file;
|
|
56494
56680
|
};
|
|
56495
|
-
const
|
|
56681
|
+
const readSkillMetadata = (skillDir) => {
|
|
56496
56682
|
const skillMdPath = path.resolve(skillDir, "SKILL.md");
|
|
56497
|
-
if (!existsSync(skillMdPath)) return
|
|
56683
|
+
if (!existsSync(skillMdPath)) return {};
|
|
56498
56684
|
try {
|
|
56499
56685
|
const content = readFileSync(skillMdPath, "utf8");
|
|
56500
|
-
return
|
|
56686
|
+
return {
|
|
56687
|
+
file: skillMdPath,
|
|
56688
|
+
status: metadataField("status").exec(content)?.[1]?.trim(),
|
|
56689
|
+
version: metadataField("version").exec(content)?.[1]?.trim()
|
|
56690
|
+
};
|
|
56501
56691
|
} catch {
|
|
56502
|
-
return;
|
|
56692
|
+
return {};
|
|
56503
56693
|
}
|
|
56504
56694
|
};
|
|
56505
56695
|
const scanInstalledSkills = (cwd, projectDirs = PROJECT_SKILL_DIRS) => {
|
|
@@ -56507,8 +56697,8 @@ const scanInstalledSkills = (cwd, projectDirs = PROJECT_SKILL_DIRS) => {
|
|
|
56507
56697
|
for (const relativeDir of projectDirs) {
|
|
56508
56698
|
const root = path.resolve(cwd, relativeDir);
|
|
56509
56699
|
for (const name of listSkillDirs(root)) {
|
|
56510
|
-
const
|
|
56511
|
-
recordInstalledSkill(installed, relativeDir, name,
|
|
56700
|
+
const details = readSkillMetadata(path.resolve(root, name));
|
|
56701
|
+
recordInstalledSkill(installed, relativeDir, name, details);
|
|
56512
56702
|
}
|
|
56513
56703
|
}
|
|
56514
56704
|
return installed;
|
|
@@ -56517,16 +56707,131 @@ const listSkillDirsAt = (root) => {
|
|
|
56517
56707
|
return listSkillDirs(root);
|
|
56518
56708
|
};
|
|
56519
56709
|
//#endregion
|
|
56710
|
+
//#region src/actions/skills/legacyGenerated.ts
|
|
56711
|
+
const LEGACY_SKILL_NAMES = [
|
|
56712
|
+
"xylabs-e2e-setup",
|
|
56713
|
+
"xylabs-refactor-cohesion",
|
|
56714
|
+
"xylabs-xy-cli",
|
|
56715
|
+
"xylabs-xy-deplint-fix"
|
|
56716
|
+
];
|
|
56717
|
+
const LEGACY_RULES = [
|
|
56718
|
+
"xylabs-architecture.md",
|
|
56719
|
+
"xylabs-build.md",
|
|
56720
|
+
"xylabs-dependencies.md",
|
|
56721
|
+
"xylabs-error-handling.md",
|
|
56722
|
+
"xylabs-frameworks.md",
|
|
56723
|
+
"xylabs-git-workflow.md",
|
|
56724
|
+
"xylabs-linting.md",
|
|
56725
|
+
"xylabs-naming.md",
|
|
56726
|
+
"xylabs-style.md",
|
|
56727
|
+
"xylabs-typescript.md"
|
|
56728
|
+
];
|
|
56729
|
+
const LEGACY_XY_COMMANDS = [
|
|
56730
|
+
"xy-build.md",
|
|
56731
|
+
"xy-clean.md",
|
|
56732
|
+
"xy-compile.md",
|
|
56733
|
+
"xy-cycle.md",
|
|
56734
|
+
"xy-dead.md",
|
|
56735
|
+
"xy-deplint.md",
|
|
56736
|
+
"xy-deps.md",
|
|
56737
|
+
"xy-dupdeps.md",
|
|
56738
|
+
"xy-fix.md",
|
|
56739
|
+
"xy-gen-docs.md",
|
|
56740
|
+
"xy-gitignore.md",
|
|
56741
|
+
"xy-gitlint.md",
|
|
56742
|
+
"xy-knip.md",
|
|
56743
|
+
"xy-license.md",
|
|
56744
|
+
"xy-lint-rules.md",
|
|
56745
|
+
"xy-lint.md",
|
|
56746
|
+
"xy-publint.md",
|
|
56747
|
+
"xy-rebuild.md",
|
|
56748
|
+
"xy-recompile.md",
|
|
56749
|
+
"xy-reinstall.md",
|
|
56750
|
+
"xy-relint.md",
|
|
56751
|
+
"xy-retest.md",
|
|
56752
|
+
"xy-sonar.md",
|
|
56753
|
+
"xy-test.md",
|
|
56754
|
+
"xy-up.md"
|
|
56755
|
+
];
|
|
56756
|
+
const LEGACY_XYLABS_COMMANDS = [
|
|
56757
|
+
"xylabs-build.md",
|
|
56758
|
+
"xylabs-clean.md",
|
|
56759
|
+
"xylabs-compile.md",
|
|
56760
|
+
"xylabs-cycle.md",
|
|
56761
|
+
"xylabs-deplint.md",
|
|
56762
|
+
"xylabs-deploy.md",
|
|
56763
|
+
"xylabs-deploy-major.md",
|
|
56764
|
+
"xylabs-deploy-minor.md",
|
|
56765
|
+
"xylabs-fix.md",
|
|
56766
|
+
"xylabs-knip.md",
|
|
56767
|
+
"xylabs-lint.md",
|
|
56768
|
+
"xylabs-publint.md",
|
|
56769
|
+
"xylabs-rebuild.md",
|
|
56770
|
+
"xylabs-test.md"
|
|
56771
|
+
];
|
|
56772
|
+
const AUTO_MANAGED = "Auto-managed by `";
|
|
56773
|
+
function pushFile(found, filePath, skillName) {
|
|
56774
|
+
if (!existsSync(filePath)) return;
|
|
56775
|
+
found.push({
|
|
56776
|
+
file: filePath,
|
|
56777
|
+
skillName
|
|
56778
|
+
});
|
|
56779
|
+
}
|
|
56780
|
+
function scanRoot(cwd, found) {
|
|
56781
|
+
for (const dir of [".agents/skills", ".claude/skills"]) for (const name of LEGACY_SKILL_NAMES) pushFile(found, path.join(cwd, dir, name), name);
|
|
56782
|
+
const rulesDir = path.join(cwd, ".claude", "rules");
|
|
56783
|
+
for (const name of LEGACY_RULES) pushFile(found, path.join(rulesDir, name));
|
|
56784
|
+
if (existsSync(rulesDir)) for (const name of readdirSync(rulesDir)) {
|
|
56785
|
+
if (!name.startsWith("xylabs-") || !name.endsWith(".md") || LEGACY_RULES.includes(name)) continue;
|
|
56786
|
+
const filePath = path.join(rulesDir, name);
|
|
56787
|
+
try {
|
|
56788
|
+
if (readFileSync(filePath, "utf8").includes(AUTO_MANAGED)) pushFile(found, filePath);
|
|
56789
|
+
} catch {}
|
|
56790
|
+
}
|
|
56791
|
+
const commandsDir = path.join(cwd, ".claude", "commands");
|
|
56792
|
+
const commandNames = [...LEGACY_XY_COMMANDS, ...LEGACY_XYLABS_COMMANDS];
|
|
56793
|
+
for (const name of commandNames) pushFile(found, path.join(commandsDir, name));
|
|
56794
|
+
}
|
|
56795
|
+
function workspaceRoots(cwd) {
|
|
56796
|
+
const roots = [cwd];
|
|
56797
|
+
const packagesDir = path.join(cwd, "packages");
|
|
56798
|
+
if (!existsSync(packagesDir)) return roots;
|
|
56799
|
+
const entries = readdirSync(packagesDir, { withFileTypes: true });
|
|
56800
|
+
for (const entry of entries) {
|
|
56801
|
+
if (!entry.isDirectory()) continue;
|
|
56802
|
+
const root = path.join(packagesDir, entry.name);
|
|
56803
|
+
if (statSync(root).isDirectory()) roots.push(root);
|
|
56804
|
+
}
|
|
56805
|
+
return roots;
|
|
56806
|
+
}
|
|
56807
|
+
function findLegacyGeneratedFiles(cwd) {
|
|
56808
|
+
const found = [];
|
|
56809
|
+
const roots = workspaceRoots(cwd);
|
|
56810
|
+
for (const root of roots) scanRoot(root, found);
|
|
56811
|
+
return found;
|
|
56812
|
+
}
|
|
56813
|
+
async function removeLegacyGeneratedFile(item, removeSkill) {
|
|
56814
|
+
if (removeSkill !== void 0 && item.skillName !== void 0) {
|
|
56815
|
+
if (await removeSkill(item.skillName, path.dirname(path.dirname(path.dirname(item.file)))) === 0 && !existsSync(item.file)) return;
|
|
56816
|
+
}
|
|
56817
|
+
if (!existsSync(item.file)) return;
|
|
56818
|
+
if (statSync(item.file).isDirectory()) rmSync(item.file, {
|
|
56819
|
+
force: true,
|
|
56820
|
+
recursive: true
|
|
56821
|
+
});
|
|
56822
|
+
else unlinkSync(item.file);
|
|
56823
|
+
}
|
|
56824
|
+
//#endregion
|
|
56520
56825
|
//#region src/actions/skills/lock.ts
|
|
56521
56826
|
const SKILLS_LOCK_FILE = "skills-lock.json";
|
|
56522
56827
|
const normalizeSkillSource = (source) => {
|
|
56523
56828
|
return source.trim().replace(/^https?:\/\/github\.com\//i, "").replace(/^github:/i, "").replace(/\.git$/i, "").replace(/\/+$/, "").toLowerCase();
|
|
56524
56829
|
};
|
|
56525
|
-
const isRecord$
|
|
56830
|
+
const isRecord$4 = (value) => {
|
|
56526
56831
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
56527
56832
|
};
|
|
56528
56833
|
const parseLockEntry = (value) => {
|
|
56529
|
-
if (!isRecord$
|
|
56834
|
+
if (!isRecord$4(value) || typeof value.source !== "string" || value.source.length === 0) return void 0;
|
|
56530
56835
|
return {
|
|
56531
56836
|
computedHash: typeof value.computedHash === "string" ? value.computedHash : void 0,
|
|
56532
56837
|
skillPath: typeof value.skillPath === "string" ? value.skillPath : void 0,
|
|
@@ -56535,7 +56840,7 @@ const parseLockEntry = (value) => {
|
|
|
56535
56840
|
};
|
|
56536
56841
|
};
|
|
56537
56842
|
const parseSkillsLock = (value) => {
|
|
56538
|
-
if (!isRecord$
|
|
56843
|
+
if (!isRecord$4(value) || !isRecord$4(value.skills)) return void 0;
|
|
56539
56844
|
const skills = {};
|
|
56540
56845
|
for (const [name, entry] of Object.entries(value.skills)) {
|
|
56541
56846
|
const parsed = parseLockEntry(entry);
|
|
@@ -56570,14 +56875,47 @@ const unmigratedSkillsFromLock = (lock) => {
|
|
|
56570
56875
|
}
|
|
56571
56876
|
return unmigrated;
|
|
56572
56877
|
};
|
|
56573
|
-
const
|
|
56574
|
-
|
|
56878
|
+
const unmigratedSkillsFromInstalled = (installed, latestVersions) => {
|
|
56879
|
+
const found = [];
|
|
56880
|
+
for (const skill of MIGRATED_SKILLS) {
|
|
56881
|
+
const copy = installed.get(skill.name);
|
|
56882
|
+
if (copy == null) continue;
|
|
56883
|
+
const latest = latestVersions.get(skill.name);
|
|
56884
|
+
if (!(copy.version !== void 0 && latest !== void 0 && import_semver.default.valid(copy.version) !== null && import_semver.default.valid(latest) !== null && import_semver.default.gt(copy.version, latest)) && copy.status !== "redirect") continue;
|
|
56885
|
+
found.push({
|
|
56886
|
+
currentSource: copy.status === "redirect" ? "redirect stub" : copy.version ?? "unknown",
|
|
56887
|
+
expectedSource: skill.to,
|
|
56888
|
+
file: copy.file,
|
|
56889
|
+
name: skill.name
|
|
56890
|
+
});
|
|
56891
|
+
}
|
|
56892
|
+
return found;
|
|
56893
|
+
};
|
|
56894
|
+
const mergeUnmigratedSkills = (...groups) => {
|
|
56895
|
+
const byName = /* @__PURE__ */ new Map();
|
|
56896
|
+
for (const skill of groups.flat()) {
|
|
56897
|
+
const existing = byName.get(skill.name);
|
|
56898
|
+
if (existing === void 0) {
|
|
56899
|
+
byName.set(skill.name, skill);
|
|
56900
|
+
continue;
|
|
56901
|
+
}
|
|
56902
|
+
if (existing.file === void 0 && skill.file !== void 0) byName.set(skill.name, {
|
|
56903
|
+
...existing,
|
|
56904
|
+
file: skill.file
|
|
56905
|
+
});
|
|
56906
|
+
}
|
|
56907
|
+
return byName.values().toArray();
|
|
56908
|
+
};
|
|
56909
|
+
const findUnmigratedSkills = (cwd, installed, latestVersions) => {
|
|
56910
|
+
const fromLock = unmigratedSkillsFromLock(readSkillsLock(cwd));
|
|
56911
|
+
const fromFiles = installed === void 0 ? [] : unmigratedSkillsFromInstalled(installed, latestVersions ?? /* @__PURE__ */ new Map());
|
|
56912
|
+
return mergeUnmigratedSkills(fromLock, fromFiles);
|
|
56575
56913
|
};
|
|
56576
56914
|
//#endregion
|
|
56577
56915
|
//#region src/actions/skills/packageSkills.ts
|
|
56578
56916
|
const SKILL_NAME_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
56579
56917
|
const MAX_SKILL_NAME_LENGTH = 64;
|
|
56580
|
-
const isRecord$
|
|
56918
|
+
const isRecord$3 = (value) => {
|
|
56581
56919
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
56582
56920
|
};
|
|
56583
56921
|
const isSkillName = (name) => {
|
|
@@ -56591,7 +56929,7 @@ const readManifest = (filePath) => {
|
|
|
56591
56929
|
if (!existsSync(filePath)) return void 0;
|
|
56592
56930
|
try {
|
|
56593
56931
|
const value = JSON.parse(readFileSync(filePath, "utf8"));
|
|
56594
|
-
return isRecord$
|
|
56932
|
+
return isRecord$3(value) ? value : void 0;
|
|
56595
56933
|
} catch {
|
|
56596
56934
|
return;
|
|
56597
56935
|
}
|
|
@@ -56610,7 +56948,7 @@ const findInstalledPackageJson = (fromDir, depName) => {
|
|
|
56610
56948
|
}
|
|
56611
56949
|
};
|
|
56612
56950
|
const parseSkillEntry = (packageName, file, index, value) => {
|
|
56613
|
-
if (!isRecord$
|
|
56951
|
+
if (!isRecord$3(value) || typeof value.name !== "string" || !isSkillName(value.name)) return { problem: {
|
|
56614
56952
|
file,
|
|
56615
56953
|
message: `${packageName} — xy.skills[${index}] must be an object with a skill name`
|
|
56616
56954
|
} };
|
|
@@ -56651,7 +56989,7 @@ const parsePackageSkills = (packageName, file, manifest) => {
|
|
|
56651
56989
|
problems: []
|
|
56652
56990
|
};
|
|
56653
56991
|
const xy = manifest.xy;
|
|
56654
|
-
if (!isRecord$
|
|
56992
|
+
if (!isRecord$3(xy) || !Object.hasOwn(xy, "skills")) return {
|
|
56655
56993
|
entries: [],
|
|
56656
56994
|
problems: []
|
|
56657
56995
|
};
|
|
@@ -56837,7 +57175,7 @@ const missingSkillReason = (profile, skillName) => {
|
|
|
56837
57175
|
if (skillName === "xy-toolchain" && profile.isUsingToolchain) return "repo uses @ariestools/toolchain";
|
|
56838
57176
|
return profile.additionalSkills?.includes(skillName) === true ? "listed in commands.skillsLint.additionalSkills" : "required for repo profile";
|
|
56839
57177
|
};
|
|
56840
|
-
const checkRequiredSkills = (required, installed, latestVersions) => {
|
|
57178
|
+
const checkRequiredSkills = (required, installed, latestVersions, unmigratedNames = /* @__PURE__ */ new Set()) => {
|
|
56841
57179
|
const current = [];
|
|
56842
57180
|
const missing = [];
|
|
56843
57181
|
const outdated = [];
|
|
@@ -56857,6 +57195,7 @@ const checkRequiredSkills = (required, installed, latestVersions) => {
|
|
|
56857
57195
|
});
|
|
56858
57196
|
continue;
|
|
56859
57197
|
}
|
|
57198
|
+
if (unmigratedNames.has(skillName)) continue;
|
|
56860
57199
|
current.push({
|
|
56861
57200
|
name: skillName,
|
|
56862
57201
|
version: installedVersion
|
|
@@ -56993,7 +57332,7 @@ const SKILLS_LINT_RULES = [
|
|
|
56993
57332
|
if (await installSkills(unmigrated.map((skill) => ({ name: skill.name })), installSkill, "Migrating skills to canonical sources...", "Migrated skills reinstalled from ariestools/ariestools-skills. Re-run `xy skills lint` to verify versions.") === 0) return { fixedCount: unmigrated.length };
|
|
56994
57333
|
}
|
|
56995
57334
|
return { diagnostics: unmigrated.map((skill) => ({
|
|
56996
|
-
file:
|
|
57335
|
+
file: skill.file ?? "skills-lock.json",
|
|
56997
57336
|
message: `${skill.name} — installed from ${skill.currentSource}; migrate to ${skill.expectedSource}`,
|
|
56998
57337
|
rule: "skills.migrated-source"
|
|
56999
57338
|
})) };
|
|
@@ -57006,7 +57345,7 @@ const SKILLS_LINT_RULES = [
|
|
|
57006
57345
|
{
|
|
57007
57346
|
check: ({ unnecessary }) => ({ diagnostics: skillDiagnostics("skills.unnecessary", unnecessary.map((skillName) => `${skillName} — installed but not required for this repo profile`)) }),
|
|
57008
57347
|
defaultLevel: "warn",
|
|
57009
|
-
description: "Installed skills are required
|
|
57348
|
+
description: "Installed skills are required, optional, or allowed (commands.skillsLint.skills presence, or commands.skillsLint.additionalSkills)",
|
|
57010
57349
|
id: "skills.unnecessary"
|
|
57011
57350
|
},
|
|
57012
57351
|
{
|
|
@@ -57014,6 +57353,25 @@ const SKILLS_LINT_RULES = [
|
|
|
57014
57353
|
defaultLevel: "warn",
|
|
57015
57354
|
description: "Project-local skills are not duplicated globally",
|
|
57016
57355
|
id: "skills.duplicate-install"
|
|
57356
|
+
},
|
|
57357
|
+
{
|
|
57358
|
+
check: async ({ cwd, removeSkill }, { fix }) => {
|
|
57359
|
+
const found = findLegacyGeneratedFiles(cwd);
|
|
57360
|
+
if (found.length === 0) return {};
|
|
57361
|
+
if (fix) {
|
|
57362
|
+
for (const item of found) await removeLegacyGeneratedFile(item, removeSkill);
|
|
57363
|
+
return { fixedCount: found.length };
|
|
57364
|
+
}
|
|
57365
|
+
return { diagnostics: found.map((item) => ({
|
|
57366
|
+
file: item.file,
|
|
57367
|
+
message: `${path.basename(item.file)} — retired output of \`xy claude\` (removed in 8.2.8); delete it`,
|
|
57368
|
+
rule: "skills.legacy-generated"
|
|
57369
|
+
})) };
|
|
57370
|
+
},
|
|
57371
|
+
defaultLevel: "warn",
|
|
57372
|
+
description: "Retired xy claude skills, rules, and commands are absent",
|
|
57373
|
+
fixable: true,
|
|
57374
|
+
id: "skills.legacy-generated"
|
|
57017
57375
|
}
|
|
57018
57376
|
];
|
|
57019
57377
|
function logSkillsDiagnostic(diagnostic) {
|
|
@@ -57056,7 +57414,7 @@ const skillsLint = async (options = {}) => {
|
|
|
57056
57414
|
const cwd = options.cwd ?? INIT_CWD();
|
|
57057
57415
|
const projectDirs = options.projectDirs ?? [...PROJECT_SKILL_DIRS];
|
|
57058
57416
|
const globalDir = options.globalDir ?? DEFAULT_GLOBAL_DIR;
|
|
57059
|
-
const isStrict = options.isStrict === true || options.strict === true;
|
|
57417
|
+
const isStrict = options.isStrict === true || options.strict === true || isStrictMode();
|
|
57060
57418
|
const config = await loadWorkspaceCommandConfig(cwd, "skillsLint");
|
|
57061
57419
|
const profile = {
|
|
57062
57420
|
...detectRepoProfile(cwd),
|
|
@@ -57070,18 +57428,17 @@ const skillsLint = async (options = {}) => {
|
|
|
57070
57428
|
const installed = scanInstalledSkills(cwd, projectDirs);
|
|
57071
57429
|
logProfileHeader(profile);
|
|
57072
57430
|
const latestVersions = await resolveLatestSkillVersions(collectSkillNamesToCheck(required, installed), options);
|
|
57073
|
-
const
|
|
57431
|
+
const unmigrated = findUnmigratedSkills(cwd, installed, latestVersions);
|
|
57432
|
+
const requiredCheck = checkRequiredSkills(required, installed, latestVersions, new Set(unmigrated.map((skill) => skill.name)));
|
|
57074
57433
|
logCurrentRequiredSkills(requiredCheck);
|
|
57075
57434
|
const unnecessary = collectUnnecessarySkills(profile, installed).filter((name) => !recommendedNames.has(name));
|
|
57076
|
-
const duplicates = findDuplicateSkills(cwd, globalDir);
|
|
57077
|
-
const unmigrated = findUnmigratedSkills(cwd);
|
|
57078
57435
|
return reportSkillsLintResult(await runRuleChecks({
|
|
57079
57436
|
commandName: "skills lint",
|
|
57080
57437
|
configKey: "skillsLint",
|
|
57081
57438
|
config,
|
|
57082
57439
|
context: {
|
|
57083
57440
|
cwd,
|
|
57084
|
-
duplicates,
|
|
57441
|
+
duplicates: findDuplicateSkills(cwd, globalDir),
|
|
57085
57442
|
globalDir,
|
|
57086
57443
|
installSkill: installSkillOnce(options.installSkill ?? createSkillInstaller(cwd)),
|
|
57087
57444
|
installed,
|
|
@@ -57089,6 +57446,7 @@ const skillsLint = async (options = {}) => {
|
|
|
57089
57446
|
outdated: requiredCheck.outdated,
|
|
57090
57447
|
packageSkills,
|
|
57091
57448
|
profile,
|
|
57449
|
+
removeSkill: options.removeSkill,
|
|
57092
57450
|
unmigrated,
|
|
57093
57451
|
unnecessary
|
|
57094
57452
|
},
|
|
@@ -57159,7 +57517,7 @@ const defaultWorkConfig = () => ({
|
|
|
57159
57517
|
},
|
|
57160
57518
|
version: 1
|
|
57161
57519
|
});
|
|
57162
|
-
const isRecord$
|
|
57520
|
+
const isRecord$2 = (value) => {
|
|
57163
57521
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
57164
57522
|
};
|
|
57165
57523
|
const isStringArray = (value) => {
|
|
@@ -57185,7 +57543,7 @@ const parseStringArray = (value, label) => {
|
|
|
57185
57543
|
return value;
|
|
57186
57544
|
};
|
|
57187
57545
|
const parseRecord = (value, label) => {
|
|
57188
|
-
if (!isRecord$
|
|
57546
|
+
if (!isRecord$2(value)) throw new TypeError(`${label} must be an object`);
|
|
57189
57547
|
return value;
|
|
57190
57548
|
};
|
|
57191
57549
|
const isWorkType = (value) => {
|
|
@@ -57411,7 +57769,7 @@ HTML comment marker embedded in issue bodies so we can recognize our issues.
|
|
|
57411
57769
|
*/
|
|
57412
57770
|
const XY_WORK_GITHUB_BODY_MARKER_PREFIX = "<!-- xy-work:";
|
|
57413
57771
|
const defaultGithubWorkRunner = defaultGithubRunner;
|
|
57414
|
-
const isRecord = (value) => {
|
|
57772
|
+
const isRecord$1 = (value) => {
|
|
57415
57773
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
57416
57774
|
};
|
|
57417
57775
|
const runOrThrow = githubRunOrThrow;
|
|
@@ -57443,12 +57801,12 @@ const githubIssueIsOpen = (issue) => {
|
|
|
57443
57801
|
};
|
|
57444
57802
|
const readGithubStoreNumber = (stores) => {
|
|
57445
57803
|
const value = stores.github;
|
|
57446
|
-
if (!isRecord(value)) return void 0;
|
|
57804
|
+
if (!isRecord$1(value)) return void 0;
|
|
57447
57805
|
return typeof value.number !== "number" || !Number.isSafeInteger(value.number) || value.number < 1 ? void 0 : value.number;
|
|
57448
57806
|
};
|
|
57449
57807
|
const readGithubStoreUrl = (stores) => {
|
|
57450
57808
|
const value = stores.github;
|
|
57451
|
-
return !isRecord(value) || typeof value.url !== "string" || value.url.length === 0 ? void 0 : value.url;
|
|
57809
|
+
return !isRecord$1(value) || typeof value.url !== "string" || value.url.length === 0 ? void 0 : value.url;
|
|
57452
57810
|
};
|
|
57453
57811
|
const formatGithubWorkIssueBody = (item) => {
|
|
57454
57812
|
const sections = [];
|
|
@@ -57533,7 +57891,7 @@ const ensureXyWorkLabel = (runner, cwd) => {
|
|
|
57533
57891
|
], { cwd });
|
|
57534
57892
|
if (list.status === 0) try {
|
|
57535
57893
|
const labels = JSON.parse(list.stdout);
|
|
57536
|
-
if (Array.isArray(labels) && labels.some((entry) => isRecord(entry) && entry.name === "xy-work")) return;
|
|
57894
|
+
if (Array.isArray(labels) && labels.some((entry) => isRecord$1(entry) && entry.name === "xy-work")) return;
|
|
57537
57895
|
} catch {}
|
|
57538
57896
|
runner([
|
|
57539
57897
|
"label",
|
|
@@ -57550,11 +57908,11 @@ const parseIssueList = (stdout) => {
|
|
|
57550
57908
|
const parsed = JSON.parse(stdout);
|
|
57551
57909
|
if (!Array.isArray(parsed)) throw new TypeError("gh issue list returned non-array JSON");
|
|
57552
57910
|
return parsed.map((entry) => {
|
|
57553
|
-
if (!isRecord(entry)) throw new TypeError("gh issue list entry must be an object");
|
|
57911
|
+
if (!isRecord$1(entry)) throw new TypeError("gh issue list entry must be an object");
|
|
57554
57912
|
const labelsRaw = entry.labels;
|
|
57555
57913
|
const labels = Array.isArray(labelsRaw) ? labelsRaw.map((label) => {
|
|
57556
57914
|
if (typeof label === "string") return label;
|
|
57557
|
-
return isRecord(label) && typeof label.name === "string" ? label.name : "";
|
|
57915
|
+
return isRecord$1(label) && typeof label.name === "string" ? label.name : "";
|
|
57558
57916
|
}).filter((label) => label.length > 0) : [];
|
|
57559
57917
|
return {
|
|
57560
57918
|
body: typeof entry.body === "string" ? entry.body : "",
|
|
@@ -58723,6 +59081,263 @@ const sitemap = () => {
|
|
|
58723
59081
|
return runSteps("Sitemap", [["ts-node-script", "./scripts/sitemap.ts"]]);
|
|
58724
59082
|
};
|
|
58725
59083
|
//#endregion
|
|
59084
|
+
//#region src/actions/skills/editXyConfigSkillPresence.ts
|
|
59085
|
+
function isJsonConfig(filePath) {
|
|
59086
|
+
const base = path.basename(filePath);
|
|
59087
|
+
return base === ".xyrc" || base.endsWith(".json");
|
|
59088
|
+
}
|
|
59089
|
+
const PRESENCE_VALUES = /* @__PURE__ */ new Set([
|
|
59090
|
+
"allowed",
|
|
59091
|
+
"off",
|
|
59092
|
+
"required"
|
|
59093
|
+
]);
|
|
59094
|
+
function isSkillPresence(value) {
|
|
59095
|
+
return PRESENCE_VALUES.has(value);
|
|
59096
|
+
}
|
|
59097
|
+
function isRecord(value) {
|
|
59098
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
59099
|
+
}
|
|
59100
|
+
function getPropertyName(prop) {
|
|
59101
|
+
if (ts.isPropertyAssignment(prop)) {
|
|
59102
|
+
const { name } = prop;
|
|
59103
|
+
if (ts.isIdentifier(name) || ts.isStringLiteral(name) || ts.isNoSubstitutionTemplateLiteral(name)) return name.text;
|
|
59104
|
+
}
|
|
59105
|
+
return ts.isShorthandPropertyAssignment(prop) ? prop.name.text : void 0;
|
|
59106
|
+
}
|
|
59107
|
+
function findConfigObject(sourceFile) {
|
|
59108
|
+
for (const statement of sourceFile.statements) {
|
|
59109
|
+
if (ts.isExportAssignment(statement) && statement.isExportEquals !== true && ts.isObjectLiteralExpression(statement.expression)) return statement.expression;
|
|
59110
|
+
if (!ts.isVariableStatement(statement)) continue;
|
|
59111
|
+
for (const decl of statement.declarationList.declarations) if (decl.initializer && ts.isObjectLiteralExpression(decl.initializer) && ts.isIdentifier(decl.name) && decl.name.text === "config") return decl.initializer;
|
|
59112
|
+
}
|
|
59113
|
+
for (const statement of sourceFile.statements) {
|
|
59114
|
+
if (!ts.isVariableStatement(statement)) continue;
|
|
59115
|
+
for (const decl of statement.declarationList.declarations) if (decl.initializer && ts.isObjectLiteralExpression(decl.initializer)) return decl.initializer;
|
|
59116
|
+
}
|
|
59117
|
+
}
|
|
59118
|
+
function objectProperty(object, name) {
|
|
59119
|
+
for (const prop of object.properties) if (ts.isPropertyAssignment(prop) && getPropertyName(prop) === name) return prop;
|
|
59120
|
+
}
|
|
59121
|
+
function objectLiteral(prop) {
|
|
59122
|
+
return prop !== void 0 && ts.isObjectLiteralExpression(prop.initializer) ? prop.initializer : void 0;
|
|
59123
|
+
}
|
|
59124
|
+
function quoteKey(name) {
|
|
59125
|
+
return /^[A-Za-z_$][\w$]*$/.test(name) ? name : `'${name.replaceAll("\\", "\\\\").replaceAll("'", String.raw`\'`)}'`;
|
|
59126
|
+
}
|
|
59127
|
+
function detectIndent(text, object, sourceFile) {
|
|
59128
|
+
if (object.properties.length > 0) {
|
|
59129
|
+
const start = object.properties[0].getStart(sourceFile);
|
|
59130
|
+
let lineStart = start;
|
|
59131
|
+
while (lineStart > 0 && text[lineStart - 1] !== "\n" && text[lineStart - 1] !== "\r") lineStart -= 1;
|
|
59132
|
+
const indent = /^[ \t]*/.exec(text.slice(lineStart, start))?.[0];
|
|
59133
|
+
if (indent !== void 0 && indent.length > 0) return indent;
|
|
59134
|
+
}
|
|
59135
|
+
const braceStart = object.getStart(sourceFile);
|
|
59136
|
+
let lineStart = braceStart;
|
|
59137
|
+
while (lineStart > 0 && text[lineStart - 1] !== "\n" && text[lineStart - 1] !== "\r") lineStart -= 1;
|
|
59138
|
+
return `${/^[ \t]*/.exec(text.slice(lineStart, braceStart))?.[0] ?? ""} `;
|
|
59139
|
+
}
|
|
59140
|
+
function upsertSkillKey(text, skillsObject, sourceFile, name, presence) {
|
|
59141
|
+
const existing = objectProperty(skillsObject, name);
|
|
59142
|
+
const valueText = `{ presence: '${presence}' }`;
|
|
59143
|
+
if (existing !== void 0) {
|
|
59144
|
+
const valueStart = existing.initializer.getStart(sourceFile);
|
|
59145
|
+
const valueEnd = existing.initializer.getEnd();
|
|
59146
|
+
return `${text.slice(0, valueStart)}${valueText}${text.slice(valueEnd)}`;
|
|
59147
|
+
}
|
|
59148
|
+
const indent = detectIndent(text, skillsObject, sourceFile);
|
|
59149
|
+
const open = skillsObject.getStart(sourceFile) + 1;
|
|
59150
|
+
return `${text.slice(0, open)}\n${indent}${quoteKey(name)}: ${valueText},${text.slice(open)}`;
|
|
59151
|
+
}
|
|
59152
|
+
function insertBlock(text, object, sourceFile, block) {
|
|
59153
|
+
const indent = detectIndent(text, object, sourceFile);
|
|
59154
|
+
const open = object.getStart(sourceFile) + 1;
|
|
59155
|
+
return `${text.slice(0, open)}\n${indent}${block},${text.slice(open)}`;
|
|
59156
|
+
}
|
|
59157
|
+
function nestedSkillsObject(configObject) {
|
|
59158
|
+
const commands = objectLiteral(objectProperty(configObject, "commands"));
|
|
59159
|
+
if (commands === void 0) return void 0;
|
|
59160
|
+
const skillsLint = objectLiteral(objectProperty(commands, "skillsLint"));
|
|
59161
|
+
return skillsLint === void 0 ? void 0 : objectLiteral(objectProperty(skillsLint, "skills"));
|
|
59162
|
+
}
|
|
59163
|
+
function applyPresenceToSource(text, presence, scriptKind) {
|
|
59164
|
+
let result = text;
|
|
59165
|
+
for (const [name, setting] of Object.entries(presence)) {
|
|
59166
|
+
const sourceFile = ts.createSourceFile("xy.config.ts", result, ts.ScriptTarget.Latest, true, scriptKind);
|
|
59167
|
+
const configObject = findConfigObject(sourceFile);
|
|
59168
|
+
if (configObject === void 0) return void 0;
|
|
59169
|
+
const skills = nestedSkillsObject(configObject);
|
|
59170
|
+
if (skills !== void 0) {
|
|
59171
|
+
result = upsertSkillKey(result, skills, sourceFile, name, setting);
|
|
59172
|
+
continue;
|
|
59173
|
+
}
|
|
59174
|
+
const commands = objectLiteral(objectProperty(configObject, "commands"));
|
|
59175
|
+
const skillsLint = commands === void 0 ? void 0 : objectLiteral(objectProperty(commands, "skillsLint"));
|
|
59176
|
+
const indent = detectIndent(result, skillsLint ?? commands ?? configObject, sourceFile);
|
|
59177
|
+
if (skillsLint !== void 0) {
|
|
59178
|
+
result = insertBlock(result, skillsLint, sourceFile, `skills: {\n${indent} ${quoteKey(name)}: { presence: '${setting}' },\n${indent}}`);
|
|
59179
|
+
continue;
|
|
59180
|
+
}
|
|
59181
|
+
if (commands !== void 0) {
|
|
59182
|
+
const block = [
|
|
59183
|
+
"skillsLint: {",
|
|
59184
|
+
`${indent} skills: {`,
|
|
59185
|
+
`${indent} ${quoteKey(name)}: { presence: '${setting}' },`,
|
|
59186
|
+
`${indent} },`,
|
|
59187
|
+
`${indent}}`
|
|
59188
|
+
].join("\n");
|
|
59189
|
+
result = insertBlock(result, commands, sourceFile, block);
|
|
59190
|
+
continue;
|
|
59191
|
+
}
|
|
59192
|
+
const block = [
|
|
59193
|
+
"commands: {",
|
|
59194
|
+
`${indent} skillsLint: {`,
|
|
59195
|
+
`${indent} skills: {`,
|
|
59196
|
+
`${indent} ${quoteKey(name)}: { presence: '${setting}' },`,
|
|
59197
|
+
`${indent} },`,
|
|
59198
|
+
`${indent} },`,
|
|
59199
|
+
`${indent}}`
|
|
59200
|
+
].join("\n");
|
|
59201
|
+
result = insertBlock(result, configObject, sourceFile, block);
|
|
59202
|
+
}
|
|
59203
|
+
return result;
|
|
59204
|
+
}
|
|
59205
|
+
function readPresenceFromSource(text, scriptKind) {
|
|
59206
|
+
const sourceFile = ts.createSourceFile("xy.config.ts", text, ts.ScriptTarget.Latest, true, scriptKind);
|
|
59207
|
+
const skills = (() => {
|
|
59208
|
+
const configObject = findConfigObject(sourceFile);
|
|
59209
|
+
return configObject === void 0 ? void 0 : nestedSkillsObject(configObject);
|
|
59210
|
+
})();
|
|
59211
|
+
if (skills === void 0) return {};
|
|
59212
|
+
const presence = {};
|
|
59213
|
+
for (const prop of skills.properties) {
|
|
59214
|
+
if (!ts.isPropertyAssignment(prop) || !ts.isObjectLiteralExpression(prop.initializer)) continue;
|
|
59215
|
+
const name = getPropertyName(prop);
|
|
59216
|
+
const setting = objectProperty(prop.initializer, "presence");
|
|
59217
|
+
if (name === void 0 || setting === void 0) continue;
|
|
59218
|
+
if (!ts.isStringLiteral(setting.initializer) && !ts.isNoSubstitutionTemplateLiteral(setting.initializer)) continue;
|
|
59219
|
+
const value = setting.initializer.text;
|
|
59220
|
+
if (isSkillPresence(value)) presence[name] = value;
|
|
59221
|
+
}
|
|
59222
|
+
return presence;
|
|
59223
|
+
}
|
|
59224
|
+
function skillsObjectFromJson(root, create) {
|
|
59225
|
+
if (!isRecord(root.commands)) {
|
|
59226
|
+
if (!create) return void 0;
|
|
59227
|
+
root.commands = {};
|
|
59228
|
+
}
|
|
59229
|
+
const commands = root.commands;
|
|
59230
|
+
if (!isRecord(commands.skillsLint)) {
|
|
59231
|
+
if (!create) return void 0;
|
|
59232
|
+
commands.skillsLint = {};
|
|
59233
|
+
}
|
|
59234
|
+
const skillsLint = commands.skillsLint;
|
|
59235
|
+
if (!isRecord(skillsLint.skills)) {
|
|
59236
|
+
if (!create) return void 0;
|
|
59237
|
+
skillsLint.skills = {};
|
|
59238
|
+
}
|
|
59239
|
+
return skillsLint.skills;
|
|
59240
|
+
}
|
|
59241
|
+
function readPresenceFromJson(text) {
|
|
59242
|
+
const skills = skillsObjectFromJson(JSON.parse(text), false);
|
|
59243
|
+
if (skills === void 0) return {};
|
|
59244
|
+
const presence = {};
|
|
59245
|
+
for (const [name, value] of Object.entries(skills)) {
|
|
59246
|
+
if (!isRecord(value) || typeof value.presence !== "string") continue;
|
|
59247
|
+
if (typeof value.presence === "string" && isSkillPresence(value.presence)) presence[name] = value.presence;
|
|
59248
|
+
}
|
|
59249
|
+
return presence;
|
|
59250
|
+
}
|
|
59251
|
+
function applyPresenceToJson(text, presence) {
|
|
59252
|
+
const root = JSON.parse(text);
|
|
59253
|
+
const skills = skillsObjectFromJson(root, true);
|
|
59254
|
+
if (skills === void 0) return text;
|
|
59255
|
+
for (const [name, setting] of Object.entries(presence)) {
|
|
59256
|
+
const existing = skills[name];
|
|
59257
|
+
if (isRecord(existing)) existing.presence = setting;
|
|
59258
|
+
else skills[name] = { presence: setting };
|
|
59259
|
+
}
|
|
59260
|
+
return `${JSON.stringify(root, null, 2)}\n`;
|
|
59261
|
+
}
|
|
59262
|
+
function skillPresenceSnippet(presence) {
|
|
59263
|
+
return [
|
|
59264
|
+
"commands: {",
|
|
59265
|
+
" skillsLint: {",
|
|
59266
|
+
" skills: {",
|
|
59267
|
+
...Object.entries(presence).map(([name, setting]) => ` '${name}': { presence: '${setting}' },`),
|
|
59268
|
+
" },",
|
|
59269
|
+
" },",
|
|
59270
|
+
"},"
|
|
59271
|
+
].join("\n");
|
|
59272
|
+
}
|
|
59273
|
+
function readSkillPresenceFile(cwd) {
|
|
59274
|
+
const filePath = findXyConfigFile(cwd);
|
|
59275
|
+
if (filePath === void 0) return {};
|
|
59276
|
+
const text = fs.readFileSync(filePath, "utf8");
|
|
59277
|
+
if (isJsonConfig(filePath)) try {
|
|
59278
|
+
return readPresenceFromJson(text);
|
|
59279
|
+
} catch {
|
|
59280
|
+
return {};
|
|
59281
|
+
}
|
|
59282
|
+
return readPresenceFromSource(text, ts.ScriptKind.TS);
|
|
59283
|
+
}
|
|
59284
|
+
function minimalConfig(presence) {
|
|
59285
|
+
return [
|
|
59286
|
+
"import type { XyConfig } from '@ariestools/toolchain'",
|
|
59287
|
+
"",
|
|
59288
|
+
"const config: XyConfig = {",
|
|
59289
|
+
" commands: {",
|
|
59290
|
+
" skillsLint: {",
|
|
59291
|
+
" skills: {",
|
|
59292
|
+
...Object.entries(presence).map(([name, setting]) => ` '${name}': { presence: '${setting}' },`),
|
|
59293
|
+
" },",
|
|
59294
|
+
" },",
|
|
59295
|
+
" },",
|
|
59296
|
+
"}",
|
|
59297
|
+
"",
|
|
59298
|
+
"export default config",
|
|
59299
|
+
""
|
|
59300
|
+
].join("\n");
|
|
59301
|
+
}
|
|
59302
|
+
/**
|
|
59303
|
+
* Merge skill presence into the workspace xy config.
|
|
59304
|
+
* An existing file that has no config object is left unchanged.
|
|
59305
|
+
*/
|
|
59306
|
+
function writeSkillPresenceFile(cwd, presence) {
|
|
59307
|
+
const snippet = skillPresenceSnippet(presence);
|
|
59308
|
+
const filePath = findXyConfigFile(cwd) ?? path.join(cwd, XY_CONFIG_FILE_NAMES[0]);
|
|
59309
|
+
if (!fs.existsSync(filePath)) {
|
|
59310
|
+
fs.writeFileSync(filePath, minimalConfig(presence));
|
|
59311
|
+
return {
|
|
59312
|
+
ok: true,
|
|
59313
|
+
snippet
|
|
59314
|
+
};
|
|
59315
|
+
}
|
|
59316
|
+
const current = fs.readFileSync(filePath, "utf8");
|
|
59317
|
+
if (isJsonConfig(filePath)) try {
|
|
59318
|
+
fs.writeFileSync(filePath, applyPresenceToJson(current, presence));
|
|
59319
|
+
return {
|
|
59320
|
+
ok: true,
|
|
59321
|
+
snippet
|
|
59322
|
+
};
|
|
59323
|
+
} catch {
|
|
59324
|
+
return {
|
|
59325
|
+
ok: false,
|
|
59326
|
+
snippet
|
|
59327
|
+
};
|
|
59328
|
+
}
|
|
59329
|
+
const next = applyPresenceToSource(current, presence, ts.ScriptKind.TS);
|
|
59330
|
+
if (next === void 0) return {
|
|
59331
|
+
ok: false,
|
|
59332
|
+
snippet
|
|
59333
|
+
};
|
|
59334
|
+
fs.writeFileSync(filePath, next);
|
|
59335
|
+
return {
|
|
59336
|
+
ok: true,
|
|
59337
|
+
snippet
|
|
59338
|
+
};
|
|
59339
|
+
}
|
|
59340
|
+
//#endregion
|
|
58726
59341
|
//#region src/actions/skills/pick.ts
|
|
58727
59342
|
function skillPickRows(cwd, presence = {}) {
|
|
58728
59343
|
const profile = {
|
|
@@ -58752,47 +59367,6 @@ function formatSkillPickTable(rows) {
|
|
|
58752
59367
|
for (const row of rows) lines.push(`${row.name} ${row.source} ${row.installed ? "installed" : "missing"} ${row.state}`);
|
|
58753
59368
|
return lines.join("\n");
|
|
58754
59369
|
}
|
|
58755
|
-
function writeSkillPresence(cwd, presence) {
|
|
58756
|
-
const filePath = path.join(cwd, "xy.config.ts");
|
|
58757
|
-
const body = [
|
|
58758
|
-
"import type { XyConfig } from '@ariestools/toolchain'",
|
|
58759
|
-
"",
|
|
58760
|
-
"const config: XyConfig = {",
|
|
58761
|
-
" commands: {",
|
|
58762
|
-
" skillsLint: {",
|
|
58763
|
-
" skills: {",
|
|
58764
|
-
...Object.entries(presence).map(([name, setting]) => ` '${name}': { presence: '${setting}' },`),
|
|
58765
|
-
" },",
|
|
58766
|
-
" },",
|
|
58767
|
-
" },",
|
|
58768
|
-
"}",
|
|
58769
|
-
"",
|
|
58770
|
-
"export default config",
|
|
58771
|
-
""
|
|
58772
|
-
].join("\n");
|
|
58773
|
-
if (!fs.existsSync(filePath)) {
|
|
58774
|
-
fs.writeFileSync(filePath, body);
|
|
58775
|
-
return;
|
|
58776
|
-
}
|
|
58777
|
-
const replaced = spliceObject(fs.readFileSync(filePath, "utf8"), "skills:", [
|
|
58778
|
-
"skills: {",
|
|
58779
|
-
...Object.entries(presence).map(([name, setting]) => ` '${name}': { presence: '${setting}' },`),
|
|
58780
|
-
" }"
|
|
58781
|
-
].join("\n"));
|
|
58782
|
-
fs.writeFileSync(filePath, replaced ?? body);
|
|
58783
|
-
}
|
|
58784
|
-
function spliceObject(current, label, block) {
|
|
58785
|
-
const at = current.indexOf(label);
|
|
58786
|
-
if (at === -1) return void 0;
|
|
58787
|
-
const open = current.indexOf("{", at);
|
|
58788
|
-
if (open === -1) return void 0;
|
|
58789
|
-
let depth = 0;
|
|
58790
|
-
for (let index = open; index < current.length; index += 1) {
|
|
58791
|
-
if (current[index] === "{") depth += 1;
|
|
58792
|
-
if (current[index] === "}") depth -= 1;
|
|
58793
|
-
if (depth === 0) return `${current.slice(0, at)}${block}${current.slice(index + 1)}`;
|
|
58794
|
-
}
|
|
58795
|
-
}
|
|
58796
59370
|
async function skillsPick(options = {}) {
|
|
58797
59371
|
const cwd = options.cwd ?? INIT_CWD();
|
|
58798
59372
|
const selected = options.skills === void 0 ? await promptForSkills(cwd) : [...options.skills];
|
|
@@ -58810,14 +59384,19 @@ async function skillsPick(options = {}) {
|
|
|
58810
59384
|
const code = await install(name, skillSourceForName(name));
|
|
58811
59385
|
if (code !== 0) return code;
|
|
58812
59386
|
}
|
|
58813
|
-
const presence = {};
|
|
59387
|
+
const presence = { ...readSkillPresenceFile(cwd) };
|
|
58814
59388
|
for (const name of selected) presence[name] = "required";
|
|
58815
|
-
|
|
59389
|
+
const written = writeSkillPresenceFile(cwd, normalizeSkillPresence(Object.fromEntries(Object.entries(presence).map(([name, setting]) => [name, { presence: setting }]))));
|
|
59390
|
+
if (!written.ok) {
|
|
59391
|
+
console.error("xy skills pick could not find a config object. Paste this into xy config and re-run:");
|
|
59392
|
+
console.error(written.snippet);
|
|
59393
|
+
return 1;
|
|
59394
|
+
}
|
|
58816
59395
|
return 0;
|
|
58817
59396
|
}
|
|
58818
59397
|
async function promptForSkills(cwd) {
|
|
58819
59398
|
if (!process.stdin.isTTY || !process.stdout.isTTY) throw new Error("xy skills pick needs a TTY. Pass --skill <name> to choose without a prompt.");
|
|
58820
|
-
console.log(formatSkillPickTable(skillPickRows(cwd)));
|
|
59399
|
+
console.log(formatSkillPickTable(skillPickRows(cwd, readSkillPresenceFile(cwd))));
|
|
58821
59400
|
const rl = readline$1.createInterface({
|
|
58822
59401
|
input: process.stdin,
|
|
58823
59402
|
output: process.stdout
|
|
@@ -59847,7 +60426,7 @@ const lintCommand$6 = {
|
|
|
59847
60426
|
type: "boolean"
|
|
59848
60427
|
}).option("strict", {
|
|
59849
60428
|
default: false,
|
|
59850
|
-
describe: "Treat warnings as errors",
|
|
60429
|
+
describe: "Treat warnings as errors (also XY_STRICT=1)",
|
|
59851
60430
|
type: "boolean"
|
|
59852
60431
|
}),
|
|
59853
60432
|
command: "lint",
|
|
@@ -59883,7 +60462,7 @@ const initCommand$4 = {
|
|
|
59883
60462
|
const auditCommand = {
|
|
59884
60463
|
builder: (yargs) => yargs.option("strict", {
|
|
59885
60464
|
default: false,
|
|
59886
|
-
describe: "Treat warnings as errors",
|
|
60465
|
+
describe: "Treat warnings as errors (also XY_STRICT=1)",
|
|
59887
60466
|
type: "boolean"
|
|
59888
60467
|
}),
|
|
59889
60468
|
command: "audit",
|
|
@@ -59967,16 +60546,22 @@ const checkCommand = {
|
|
|
59967
60546
|
let errors = 0;
|
|
59968
60547
|
let exitCode = 0;
|
|
59969
60548
|
let warnings = 0;
|
|
60549
|
+
const errorDiagnostics = [];
|
|
60550
|
+
const warningDiagnostics = [];
|
|
59970
60551
|
const addResult = (result) => {
|
|
59971
60552
|
errors += resultErrorCount(result);
|
|
59972
60553
|
warnings += resultWarningCount(result);
|
|
59973
60554
|
exitCode += resultExitCode(result);
|
|
60555
|
+
if (typeof result === "number") return;
|
|
60556
|
+
errorDiagnostics.push(...result.envelope?.errors ?? []);
|
|
60557
|
+
warningDiagnostics.push(...result.envelope?.warnings ?? []);
|
|
59974
60558
|
};
|
|
59975
60559
|
console.log(chalk.blue("\n— agent lint —"));
|
|
59976
|
-
addResult(await agentLint({
|
|
60560
|
+
if (await isAgentLintEnabled(process.cwd())) addResult(await agentLint({
|
|
59977
60561
|
cwd: process.cwd(),
|
|
59978
60562
|
fix: isFix
|
|
59979
60563
|
}));
|
|
60564
|
+
else console.log(chalk.gray("No AGENTS.md — skipping agent lint"));
|
|
59980
60565
|
console.log(chalk.blue("\n— git lint —"));
|
|
59981
60566
|
if (isFix) addResult(await gitlintFix());
|
|
59982
60567
|
else addResult(await gitlint());
|
|
@@ -60008,7 +60593,9 @@ const checkCommand = {
|
|
|
60008
60593
|
return {
|
|
60009
60594
|
envelope: {
|
|
60010
60595
|
errorCount: errors,
|
|
60011
|
-
|
|
60596
|
+
errors: errorDiagnostics,
|
|
60597
|
+
warningCount: warnings,
|
|
60598
|
+
warnings: warningDiagnostics
|
|
60012
60599
|
},
|
|
60013
60600
|
exitCode
|
|
60014
60601
|
};
|
|
@@ -60124,7 +60711,7 @@ const gitLintCommand = {
|
|
|
60124
60711
|
//#endregion
|
|
60125
60712
|
//#region src/xy/common/gitCommand.ts
|
|
60126
60713
|
const gitCommand = {
|
|
60127
|
-
builder: (yargs) => yargs.command(gitLintCommand).demandCommand(1),
|
|
60714
|
+
builder: (yargs) => yargs.command(gitLintCommand).demandCommand(1).strictCommands(),
|
|
60128
60715
|
command: "git",
|
|
60129
60716
|
describe: "Git utilities",
|
|
60130
60717
|
handler: () => {
|
|
@@ -60665,11 +61252,28 @@ const CUSTOM_SKILLS_COMMANDS = /* @__PURE__ */ new Set([
|
|
|
60665
61252
|
]);
|
|
60666
61253
|
const HELP_FLAGS = /* @__PURE__ */ new Set(["--help", "-h"]);
|
|
60667
61254
|
const hasHelpFlag = (args) => args.some((arg) => HELP_FLAGS.has(arg));
|
|
61255
|
+
const printPickHelp = () => {
|
|
61256
|
+
console.log(`xy skills pick
|
|
61257
|
+
|
|
61258
|
+
Install catalog skills and record them as required.
|
|
61259
|
+
|
|
61260
|
+
Usage:
|
|
61261
|
+
xy skills pick [--skill <name>]...
|
|
61262
|
+
|
|
61263
|
+
Pick is catalog-only. A TTY is required when --skill is omitted.
|
|
61264
|
+
It writes commands.skillsLint.skills.<name>.presence: 'required'
|
|
61265
|
+
and keeps other presence entries.
|
|
61266
|
+
|
|
61267
|
+
Options:
|
|
61268
|
+
--skill <name> Skill to require. Repeat for more than one.
|
|
61269
|
+
-h, --help Show this help
|
|
61270
|
+
`);
|
|
61271
|
+
};
|
|
60668
61272
|
const printDefaultsHelp = () => {
|
|
60669
61273
|
console.log(`xy skills defaults
|
|
60670
61274
|
|
|
60671
61275
|
Install the default skill stacks:
|
|
60672
|
-
- ariestools/ariestools-skills (xy-development, xy-toolchain, ariestools-sdk)
|
|
61276
|
+
- ariestools/ariestools-skills (xy-development, xy-toolchain, xy-agent, ariestools-sdk)
|
|
60673
61277
|
- XYOracleNetwork/xyo-skills (xyo-knowledge, xl1-*)
|
|
60674
61278
|
|
|
60675
61279
|
Usage:
|
|
@@ -60720,12 +61324,16 @@ Config (xy.config.ts):
|
|
|
60720
61324
|
- commands.skillsLint.additionalSkills
|
|
60721
61325
|
Treat extra skills as required even when the detected
|
|
60722
61326
|
profile does not require them
|
|
61327
|
+
- commands.skillsLint.skills.<name>.presence
|
|
61328
|
+
required | allowed | off. required forces a skill on,
|
|
61329
|
+
off forces it off, allowed keeps an install from
|
|
61330
|
+
counting as unnecessary
|
|
60723
61331
|
|
|
60724
61332
|
Options:
|
|
60725
|
-
--fix Install missing
|
|
61333
|
+
--fix Install missing and update outdated required and package-declared skills; migrate relocated ones (project scope)
|
|
60726
61334
|
--offline Skip upstream version checks
|
|
60727
61335
|
--rules List supported skills lint rules and their effective levels
|
|
60728
|
-
--strict Fail on warnings (duplicates, unnecessary skills)
|
|
61336
|
+
--strict Fail on warnings (duplicates, unnecessary skills). XY_STRICT=1 does the same.
|
|
60729
61337
|
-h, --help Show this help
|
|
60730
61338
|
`);
|
|
60731
61339
|
};
|
|
@@ -60739,6 +61347,10 @@ const runSkillsTail = async (tail) => {
|
|
|
60739
61347
|
printLintHelp();
|
|
60740
61348
|
return 0;
|
|
60741
61349
|
}
|
|
61350
|
+
if (subcommand === "pick" && hasHelpFlag(args)) {
|
|
61351
|
+
printPickHelp();
|
|
61352
|
+
return 0;
|
|
61353
|
+
}
|
|
60742
61354
|
if (subcommand === "defaults") return skillsDefaults(args);
|
|
60743
61355
|
if (subcommand === "lint") {
|
|
60744
61356
|
if (args.includes("--rules")) return ruleCatalogResult(await getSkillsLintRuleCatalog(), RULE_COMMANDS.skillsLint.title);
|
|
@@ -67707,6 +68319,25 @@ function isRootRulesRequest(raw = process.argv.slice(2)) {
|
|
|
67707
68319
|
function isRootStabilityRequest(raw = process.argv.slice(2)) {
|
|
67708
68320
|
return isRootLongFlagRequest("--stability", raw);
|
|
67709
68321
|
}
|
|
68322
|
+
const RETIRED_COMMANDS = {
|
|
68323
|
+
"claude-rules": "skills",
|
|
68324
|
+
"compile-only": "compile",
|
|
68325
|
+
"deploy-minor": "deploy minor",
|
|
68326
|
+
"gitlint": "git lint",
|
|
68327
|
+
"lintlint": "lint lint"
|
|
68328
|
+
};
|
|
68329
|
+
function retiredCommandReplacement(commandName, cliLabel) {
|
|
68330
|
+
if (commandName.startsWith("claude-")) return `${cliLabel} skills`;
|
|
68331
|
+
const replacement = RETIRED_COMMANDS[commandName];
|
|
68332
|
+
return replacement === void 0 ? void 0 : `${cliLabel} ${replacement}`;
|
|
68333
|
+
}
|
|
68334
|
+
function reportUnknownCommand(commandName, cliLabel) {
|
|
68335
|
+
const replacement = retiredCommandReplacement(commandName, cliLabel);
|
|
68336
|
+
const message = replacement === void 0 ? `Command not found [${commandName}]` : `Command not found [${commandName}]. Use ${replacement}`;
|
|
68337
|
+
console.error(chalk.yellow(message));
|
|
68338
|
+
console.error(chalk.gray(`Try '${cliLabel} --help' for list of commands`));
|
|
68339
|
+
process.exitCode = 1;
|
|
68340
|
+
}
|
|
67710
68341
|
function registerCoreCommands(args, channel) {
|
|
67711
68342
|
let next = xyLintStableCommands(args);
|
|
67712
68343
|
next = xyLintExperimentalCommands(next, channel);
|
|
@@ -67736,15 +68367,15 @@ const xyBase = async (options = {}) => {
|
|
|
67736
68367
|
}), channel);
|
|
67737
68368
|
if (options.plugins) args = options.plugins(args, channel);
|
|
67738
68369
|
const cliLabel = channel === "experimental" ? "xyex" : "xy";
|
|
67739
|
-
return await args.demandCommand(1).command("*", "", () => {
|
|
67740
|
-
const
|
|
67741
|
-
|
|
68370
|
+
return await args.demandCommand(1).command("*", "", () => {}, (argv) => {
|
|
68371
|
+
const raw = argv._[0];
|
|
68372
|
+
const cmd = typeof raw === "string" || typeof raw === "number" ? String(raw) : "";
|
|
68373
|
+
if (cmd.length === 0 || process.argv.some((arg) => [
|
|
67742
68374
|
"--help",
|
|
67743
68375
|
"-h",
|
|
67744
68376
|
"--version"
|
|
67745
|
-
].includes(
|
|
67746
|
-
|
|
67747
|
-
console.log(chalk.gray(`Try '${cliLabel} --help' for list of commands`));
|
|
68377
|
+
].includes(arg))) return;
|
|
68378
|
+
reportUnknownCommand(cmd, cliLabel);
|
|
67748
68379
|
}).version(bundledToolchainVersion()).help().argv;
|
|
67749
68380
|
};
|
|
67750
68381
|
function registerLifecyclePlugins(args, channel) {
|