@ariestools/toolchain 9.0.0 → 9.0.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.
Files changed (85) hide show
  1. package/README.md +94 -0
  2. package/dist/actions/enable/editXyConfigCompile.d.ts +32 -0
  3. package/dist/actions/enable/editXyConfigCompile.d.ts.map +1 -0
  4. package/dist/actions/enable/index.d.ts +3 -0
  5. package/dist/actions/enable/index.d.ts.map +1 -0
  6. package/dist/actions/enable/tsNative.d.ts +36 -0
  7. package/dist/actions/enable/tsNative.d.ts.map +1 -0
  8. package/dist/actions/index.d.ts +2 -1
  9. package/dist/actions/index.d.ts.map +1 -1
  10. package/dist/actions/package/compile/XyConfig.d.ts +7 -2
  11. package/dist/actions/package/compile/XyConfig.d.ts.map +1 -1
  12. package/dist/actions/package/compile/resolveTscBin.d.ts +10 -0
  13. package/dist/actions/package/compile/resolveTscBin.d.ts.map +1 -1
  14. package/dist/actions/package/compile/runTsc.d.ts.map +1 -1
  15. package/dist/actions/package-lint-pnpm.d.ts +8 -1
  16. package/dist/actions/package-lint-pnpm.d.ts.map +1 -1
  17. package/dist/actions/package-lint.d.ts +16 -1
  18. package/dist/actions/package-lint.d.ts.map +1 -1
  19. package/dist/actions/packman/lint.d.ts.map +1 -1
  20. package/dist/actions/ruleCatalog.d.ts +4 -1
  21. package/dist/actions/ruleCatalog.d.ts.map +1 -1
  22. package/dist/actions/ruleRunner.d.ts +2 -1
  23. package/dist/actions/ruleRunner.d.ts.map +1 -1
  24. package/dist/actions/secure/dependabot.d.ts +22 -0
  25. package/dist/actions/secure/dependabot.d.ts.map +1 -0
  26. package/dist/actions/secure/dependabotRules.d.ts +9 -0
  27. package/dist/actions/secure/dependabotRules.d.ts.map +1 -0
  28. package/dist/actions/secure/deps.d.ts +18 -0
  29. package/dist/actions/secure/deps.d.ts.map +1 -0
  30. package/dist/actions/secure/index.d.ts +5 -0
  31. package/dist/actions/secure/index.d.ts.map +1 -0
  32. package/dist/actions/secure/secure.d.ts +16 -0
  33. package/dist/actions/secure/secure.d.ts.map +1 -0
  34. package/dist/actions/work/github.d.ts +3 -8
  35. package/dist/actions/work/github.d.ts.map +1 -1
  36. package/dist/bin/package/build.mjs +484 -420
  37. package/dist/bin/package/build.mjs.map +1 -1
  38. package/dist/bin/package/clean.mjs +70 -31
  39. package/dist/bin/package/clean.mjs.map +1 -1
  40. package/dist/bin/package/compile.mjs +74 -33
  41. package/dist/bin/package/compile.mjs.map +1 -1
  42. package/dist/bin/package/publint.mjs +429 -370
  43. package/dist/bin/package/publint.mjs.map +1 -1
  44. package/dist/bin/package/recompile.mjs +76 -32
  45. package/dist/bin/package/recompile.mjs.map +1 -1
  46. package/dist/bin/package/sync-layout.mjs +68 -32
  47. package/dist/bin/package/sync-layout.mjs.map +1 -1
  48. package/dist/bin/xy.mjs +1676 -787
  49. package/dist/bin/xy.mjs.map +1 -1
  50. package/dist/lib/github/index.d.ts +2 -0
  51. package/dist/lib/github/index.d.ts.map +1 -0
  52. package/dist/lib/github/runner.d.ts +25 -0
  53. package/dist/lib/github/runner.d.ts.map +1 -0
  54. package/dist/lib/index.d.ts +1 -0
  55. package/dist/lib/index.d.ts.map +1 -1
  56. package/dist/lib/ruleCommandRegistry.d.ts +17 -2
  57. package/dist/lib/ruleCommandRegistry.d.ts.map +1 -1
  58. package/dist/lib/secure/dependabot/fetchDependabotAlerts.d.ts +12 -0
  59. package/dist/lib/secure/dependabot/fetchDependabotAlerts.d.ts.map +1 -0
  60. package/dist/lib/secure/dependabot/index.d.ts +6 -0
  61. package/dist/lib/secure/dependabot/index.d.ts.map +1 -0
  62. package/dist/lib/secure/dependabot/interfaces.d.ts +49 -0
  63. package/dist/lib/secure/dependabot/interfaces.d.ts.map +1 -0
  64. package/dist/lib/secure/dependabot/renderDependabotAlerts.d.ts +4 -0
  65. package/dist/lib/secure/dependabot/renderDependabotAlerts.d.ts.map +1 -0
  66. package/dist/lib/secure/dependabot/summarizeDependabotAlerts.d.ts +5 -0
  67. package/dist/lib/secure/dependabot/summarizeDependabotAlerts.d.ts.map +1 -0
  68. package/dist/lib/secure/dependabot/vulnerabilityAlerts.d.ts +21 -0
  69. package/dist/lib/secure/dependabot/vulnerabilityAlerts.d.ts.map +1 -0
  70. package/dist/lib/secure/index.d.ts +1 -0
  71. package/dist/lib/secure/index.d.ts.map +1 -1
  72. package/dist/lib/secure/renderSecurityAudit.d.ts +4 -0
  73. package/dist/lib/secure/renderSecurityAudit.d.ts.map +1 -1
  74. package/dist/xy/common/enable/index.d.ts +3 -0
  75. package/dist/xy/common/enable/index.d.ts.map +1 -0
  76. package/dist/xy/common/index.d.ts.map +1 -1
  77. package/dist/xy/common/secure/dependabotCommand.d.ts +3 -0
  78. package/dist/xy/common/secure/dependabotCommand.d.ts.map +1 -0
  79. package/dist/xy/common/secure/depsCommand.d.ts +3 -0
  80. package/dist/xy/common/secure/depsCommand.d.ts.map +1 -0
  81. package/dist/xy/common/secure/index.d.ts +5 -0
  82. package/dist/xy/common/secure/index.d.ts.map +1 -0
  83. package/dist/xy/install/cleanCommand.d.ts.map +1 -1
  84. package/dist/xy/xy.d.ts.map +1 -1
  85. package/package.json +8 -7
package/dist/bin/xy.mjs CHANGED
@@ -16,10 +16,10 @@ import Pe, { PassThrough } from "node:stream";
16
16
  import { StringDecoder } from "node:string_decoder";
17
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, execSync, spawn } from "node:child_process";
19
- import * as readline from "node:readline";
20
- import u, { createInterface } from "node:readline";
19
+ import * as readline$1 from "node:readline";
20
+ import readline, { createInterface } from "node:readline";
21
21
  import { fileURLToPath as fileURLToPath$1 } from "url";
22
- import { TypeScriptLoader } from "cosmiconfig-typescript-loader";
22
+ import { createJiti } from "jiti";
23
23
  import { performance as performance$1 } from "node:perf_hooks";
24
24
  import util, { promisify, stripVTControlCharacters } from "node:util";
25
25
  import ts from "typescript";
@@ -722,24 +722,24 @@ function ht(n, t, e) {
722
722
  return s;
723
723
  }
724
724
  function Bt(n, t = {}) {
725
- return new I$1(n, t).streamSync();
725
+ return new I(n, t).streamSync();
726
726
  }
727
727
  function Qe(n, t = {}) {
728
- return new I$1(n, t).stream();
728
+ return new I(n, t).stream();
729
729
  }
730
730
  function ts$1(n, t = {}) {
731
- return new I$1(n, t).walkSync();
731
+ return new I(n, t).walkSync();
732
732
  }
733
733
  async function Je(n, t = {}) {
734
- return new I$1(n, t).walk();
734
+ return new I(n, t).walk();
735
735
  }
736
736
  function Ut(n, t = {}) {
737
- return new I$1(n, t).iterateSync();
737
+ return new I(n, t).iterateSync();
738
738
  }
739
739
  function es(n, t = {}) {
740
- return new I$1(n, t).iterate();
740
+ return new I(n, t).iterate();
741
741
  }
742
- var Gt, ce, ss, fe, ue, qt, de, pe, is, rs, ns, os$2, hs, as, ls, cs, fs$5, us, ds, at, Ss, lt, Es, we, ye, W, xs, be, vs, Ct, Cs, Ts, As, ks, Kt, Se, Ee, Q, tt, O$1, 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$1, Zs, ke, Qs, ti, ve, ei, D$1, 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$1, et, v$1, dt, st, C$1, F$1, T$1, Yt, Ft, k$1, 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, _$1, gt, se, je, yt, j$1, Nt, Lt, Ie, Fi, ie, ze, bt, Be, _t, Wt, ne, Ye, R$1, Pt, jt, It, it, rt, St, Xe, Di, Mi, Ni, nt, _i, ot, oe, he, ae, Et, Li, zt, xt, vt, Pi, I$1, le, ji, Ii, zi, Bi, Ui, Ze;
742
+ var Gt, ce, ss, fe, ue, qt, de, pe, is, rs, ns, os$2, hs, as, ls, cs, fs$5, 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;
743
743
  var init_index_min = __esmMin((() => {
744
744
  Gt = (n, t, e) => {
745
745
  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);
@@ -1143,7 +1143,7 @@ var init_index_min = __esmMin((() => {
1143
1143
  }
1144
1144
  };
1145
1145
  tt = (n, { windowsPathsNoEscape: t = !1, magicalBraces: e = !1 } = {}) => e ? t ? n.replace(/[?*()[\]{}]/g, "[$&]") : n.replace(/[?*()[\]\\{}]/g, "\\$&") : t ? n.replace(/[?*()[\]]/g, "[$&]") : n.replace(/[?*()[\]\\]/g, "\\$&");
1146
- O$1 = (n, t, e = {}) => (at(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new D$1(t, e).match(n));
1146
+ O = (n, t, e = {}) => (at(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new D(t, e).match(n));
1147
1147
  Rs = /^\*+([^+@!?\*\[\(]*)$/;
1148
1148
  Os = (n) => (t) => !t.startsWith(".") && t.endsWith(n);
1149
1149
  Fs = (n) => (t) => t.endsWith(n);
@@ -1187,59 +1187,59 @@ var init_index_min = __esmMin((() => {
1187
1187
  win32: { sep: "\\" },
1188
1188
  posix: { sep: "/" }
1189
1189
  };
1190
- O$1.sep = Ae === "win32" ? xe.win32.sep : xe.posix.sep;
1190
+ O.sep = Ae === "win32" ? xe.win32.sep : xe.posix.sep;
1191
1191
  A = Symbol("globstar **");
1192
- O$1.GLOBSTAR = A;
1192
+ O.GLOBSTAR = A;
1193
1193
  Vs = "[^/]*?";
1194
1194
  Ys = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
1195
1195
  Xs = "(?:(?!(?:\\/|^)\\.).)*?";
1196
- Js = (n, t = {}) => (e) => O$1(e, n, t);
1197
- O$1.filter = Js;
1198
- N$1 = (n, t = {}) => Object.assign({}, n, t);
1196
+ Js = (n, t = {}) => (e) => O(e, n, t);
1197
+ O.filter = Js;
1198
+ N = (n, t = {}) => Object.assign({}, n, t);
1199
1199
  Zs = (n) => {
1200
- if (!n || typeof n != "object" || !Object.keys(n).length) return O$1;
1201
- let t = O$1;
1202
- return Object.assign((s, i, r = {}) => t(s, i, N$1(n, r)), {
1200
+ if (!n || typeof n != "object" || !Object.keys(n).length) return O;
1201
+ let t = O;
1202
+ return Object.assign((s, i, r = {}) => t(s, i, N(n, r)), {
1203
1203
  Minimatch: class extends t.Minimatch {
1204
1204
  constructor(i, r = {}) {
1205
- super(i, N$1(n, r));
1205
+ super(i, N(n, r));
1206
1206
  }
1207
1207
  static defaults(i) {
1208
- return t.defaults(N$1(n, i)).Minimatch;
1208
+ return t.defaults(N(n, i)).Minimatch;
1209
1209
  }
1210
1210
  },
1211
1211
  AST: class extends t.AST {
1212
1212
  constructor(i, r, o = {}) {
1213
- super(i, r, N$1(n, o));
1213
+ super(i, r, N(n, o));
1214
1214
  }
1215
1215
  static fromGlob(i, r = {}) {
1216
- return t.AST.fromGlob(i, N$1(n, r));
1216
+ return t.AST.fromGlob(i, N(n, r));
1217
1217
  }
1218
1218
  },
1219
- unescape: (s, i = {}) => t.unescape(s, N$1(n, i)),
1220
- escape: (s, i = {}) => t.escape(s, N$1(n, i)),
1221
- filter: (s, i = {}) => t.filter(s, N$1(n, i)),
1222
- defaults: (s) => t.defaults(N$1(n, s)),
1223
- makeRe: (s, i = {}) => t.makeRe(s, N$1(n, i)),
1224
- braceExpand: (s, i = {}) => t.braceExpand(s, N$1(n, i)),
1225
- match: (s, i, r = {}) => t.match(s, i, N$1(n, r)),
1219
+ unescape: (s, i = {}) => t.unescape(s, N(n, i)),
1220
+ escape: (s, i = {}) => t.escape(s, N(n, i)),
1221
+ filter: (s, i = {}) => t.filter(s, N(n, i)),
1222
+ defaults: (s) => t.defaults(N(n, s)),
1223
+ makeRe: (s, i = {}) => t.makeRe(s, N(n, i)),
1224
+ braceExpand: (s, i = {}) => t.braceExpand(s, N(n, i)),
1225
+ match: (s, i, r = {}) => t.match(s, i, N(n, r)),
1226
1226
  sep: t.sep,
1227
1227
  GLOBSTAR: A
1228
1228
  });
1229
1229
  };
1230
- O$1.defaults = Zs;
1230
+ O.defaults = Zs;
1231
1231
  ke = (n, t = {}) => (at(n), t.nobrace || !/\{(?:(?!\{).)*\}/.test(n) ? [n] : ge(n, { max: t.braceExpandMax }));
1232
- O$1.braceExpand = ke;
1233
- Qs = (n, t = {}) => new D$1(n, t).makeRe();
1234
- O$1.makeRe = Qs;
1232
+ O.braceExpand = ke;
1233
+ Qs = (n, t = {}) => new D(n, t).makeRe();
1234
+ O.makeRe = Qs;
1235
1235
  ti = (n, t, e = {}) => {
1236
- let s = new D$1(t, e);
1236
+ let s = new D(t, e);
1237
1237
  return n = n.filter((i) => s.match(i)), s.options.nonull && !n.length && n.push(t), n;
1238
1238
  };
1239
- O$1.match = ti;
1239
+ O.match = ti;
1240
1240
  ve = /[?*]|[+@!]\(.*?\)|\[|\]/;
1241
1241
  ei = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
1242
- D$1 = class {
1242
+ D = class {
1243
1243
  options;
1244
1244
  set;
1245
1245
  pattern;
@@ -1516,13 +1516,13 @@ globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) retur
1516
1516
  return s.flipNegate ? !1 : this.negate;
1517
1517
  }
1518
1518
  static defaults(t) {
1519
- return O$1.defaults(t).Minimatch;
1519
+ return O.defaults(t).Minimatch;
1520
1520
  }
1521
1521
  };
1522
- O$1.AST = Q;
1523
- O$1.Minimatch = D$1;
1524
- O$1.escape = tt;
1525
- O$1.unescape = W;
1522
+ O.AST = Q;
1523
+ O.Minimatch = D;
1524
+ O.escape = tt;
1525
+ O.unescape = W;
1526
1526
  si = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date;
1527
1527
  Oe = /* @__PURE__ */ new Set();
1528
1528
  Vt = typeof process == "object" && process ? process : {};
@@ -2143,17 +2143,17 @@ globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) retur
2143
2143
  _e = Symbol("read");
2144
2144
  Ot = Symbol("flush");
2145
2145
  Le = Symbol("flushChunk");
2146
- P$1 = Symbol("encoding");
2146
+ P = Symbol("encoding");
2147
2147
  et = Symbol("decoder");
2148
- v$1 = Symbol("flowing");
2148
+ v = Symbol("flowing");
2149
2149
  dt = Symbol("paused");
2150
2150
  st = Symbol("resume");
2151
- C$1 = Symbol("buffer");
2152
- F$1 = Symbol("pipes");
2153
- T$1 = Symbol("bufferLength");
2151
+ C = Symbol("buffer");
2152
+ F = Symbol("pipes");
2153
+ T = Symbol("bufferLength");
2154
2154
  Yt = Symbol("bufferPush");
2155
2155
  Ft = Symbol("bufferShift");
2156
- k$1 = Symbol("objectMode");
2156
+ k = Symbol("objectMode");
2157
2157
  x$1 = Symbol("destroyed");
2158
2158
  Xt = Symbol("error");
2159
2159
  Jt = Symbol("emitData");
@@ -2197,12 +2197,12 @@ globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) retur
2197
2197
  di = (n) => !!n.objectMode;
2198
2198
  pi = (n) => !n.objectMode && !!n.encoding && n.encoding !== "buffer";
2199
2199
  V = class extends EventEmitter {
2200
- [v$1] = !1;
2200
+ [v] = !1;
2201
2201
  [dt] = !1;
2202
- [F$1] = [];
2203
- [C$1] = [];
2204
- [k$1];
2205
- [P$1];
2202
+ [F] = [];
2203
+ [C] = [];
2204
+ [k];
2205
+ [P];
2206
2206
  [B];
2207
2207
  [et];
2208
2208
  [G] = !1;
@@ -2210,7 +2210,7 @@ globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) retur
2210
2210
  [kt] = !1;
2211
2211
  [Rt] = !1;
2212
2212
  [ut] = null;
2213
- [T$1] = 0;
2213
+ [T] = 0;
2214
2214
  [x$1] = !1;
2215
2215
  [pt];
2216
2216
  [Dt] = !1;
@@ -2221,15 +2221,15 @@ globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) retur
2221
2221
  constructor(...t) {
2222
2222
  let e = t[0] || {};
2223
2223
  if (super(), e.objectMode && typeof e.encoding == "string") throw new TypeError("Encoding and objectMode may not be used together");
2224
- di(e) ? (this[k$1] = !0, this[P$1] = null) : pi(e) ? (this[P$1] = e.encoding, this[k$1] = !1) : (this[k$1] = !1, this[P$1] = null), this[B] = !!e.async, this[et] = this[P$1] ? new StringDecoder(this[P$1]) : null, e && e.debugExposeBuffer === !0 && Object.defineProperty(this, "buffer", { get: () => this[C$1] }), e && e.debugExposePipes === !0 && Object.defineProperty(this, "pipes", { get: () => this[F$1] });
2224
+ di(e) ? (this[k] = !0, this[P] = null) : pi(e) ? (this[P] = e.encoding, this[k] = !1) : (this[k] = !1, this[P] = null), this[B] = !!e.async, this[et] = this[P] ? new StringDecoder(this[P]) : null, e && e.debugExposeBuffer === !0 && Object.defineProperty(this, "buffer", { get: () => this[C] }), e && e.debugExposePipes === !0 && Object.defineProperty(this, "pipes", { get: () => this[F] });
2225
2225
  let { signal: s } = e;
2226
2226
  s && (this[pt] = s, s.aborted ? this[Qt]() : s.addEventListener("abort", () => this[Qt]()));
2227
2227
  }
2228
2228
  get bufferLength() {
2229
- return this[T$1];
2229
+ return this[T];
2230
2230
  }
2231
2231
  get encoding() {
2232
- return this[P$1];
2232
+ return this[P];
2233
2233
  }
2234
2234
  set encoding(t) {
2235
2235
  throw new Error("Encoding must be set at instantiation time");
@@ -2238,7 +2238,7 @@ globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) retur
2238
2238
  throw new Error("Encoding must be set at instantiation time");
2239
2239
  }
2240
2240
  get objectMode() {
2241
- return this[k$1];
2241
+ return this[k];
2242
2242
  }
2243
2243
  set objectMode(t) {
2244
2244
  throw new Error("objectMode must be set at instantiation time");
@@ -2262,80 +2262,80 @@ globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) retur
2262
2262
  if (this[x$1]) return this.emit("error", Object.assign(/* @__PURE__ */ new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" })), !0;
2263
2263
  typeof e == "function" && (s = e, e = "utf8"), e || (e = "utf8");
2264
2264
  let i = this[B] ? mt : li;
2265
- if (!this[k$1] && !Buffer.isBuffer(t)) {
2265
+ if (!this[k] && !Buffer.isBuffer(t)) {
2266
2266
  if (ui$1(t)) t = Buffer.from(t.buffer, t.byteOffset, t.byteLength);
2267
2267
  else if (fi(t)) t = Buffer.from(t);
2268
2268
  else if (typeof t != "string") throw new Error("Non-contiguous data written to non-objectMode stream");
2269
2269
  }
2270
- return this[k$1] ? (this[v$1] && this[T$1] !== 0 && this[Ot](!0), this[v$1] ? this.emit("data", t) : this[Yt](t), this[T$1] !== 0 && this.emit("readable"), s && i(s), this[v$1]) : t.length ? (typeof t == "string" && !(e === this[P$1] && !this[et]?.lastNeed) && (t = Buffer.from(t, e)), Buffer.isBuffer(t) && this[P$1] && (t = this[et].write(t)), this[v$1] && this[T$1] !== 0 && this[Ot](!0), this[v$1] ? this.emit("data", t) : this[Yt](t), this[T$1] !== 0 && this.emit("readable"), s && i(s), this[v$1]) : (this[T$1] !== 0 && this.emit("readable"), s && i(s), this[v$1]);
2270
+ return this[k] ? (this[v] && this[T] !== 0 && this[Ot](!0), this[v] ? this.emit("data", t) : this[Yt](t), this[T] !== 0 && this.emit("readable"), s && i(s), this[v]) : t.length ? (typeof t == "string" && !(e === this[P] && !this[et]?.lastNeed) && (t = Buffer.from(t, e)), Buffer.isBuffer(t) && this[P] && (t = this[et].write(t)), this[v] && this[T] !== 0 && this[Ot](!0), this[v] ? this.emit("data", t) : this[Yt](t), this[T] !== 0 && this.emit("readable"), s && i(s), this[v]) : (this[T] !== 0 && this.emit("readable"), s && i(s), this[v]);
2271
2271
  }
2272
2272
  read(t) {
2273
2273
  if (this[x$1]) return null;
2274
- if (this[M] = !1, this[T$1] === 0 || t === 0 || t && t > this[T$1]) return this[H](), null;
2275
- this[k$1] && (t = null), this[C$1].length > 1 && !this[k$1] && (this[C$1] = [this[P$1] ? this[C$1].join("") : Buffer.concat(this[C$1], this[T$1])]);
2276
- let e = this[_e](t || null, this[C$1][0]);
2274
+ if (this[M] = !1, this[T] === 0 || t === 0 || t && t > this[T]) return this[H](), null;
2275
+ this[k] && (t = null), this[C].length > 1 && !this[k] && (this[C] = [this[P] ? this[C].join("") : Buffer.concat(this[C], this[T])]);
2276
+ let e = this[_e](t || null, this[C][0]);
2277
2277
  return this[H](), e;
2278
2278
  }
2279
2279
  [_e](t, e) {
2280
- if (this[k$1]) this[Ft]();
2280
+ if (this[k]) this[Ft]();
2281
2281
  else {
2282
2282
  let s = e;
2283
- t === s.length || t === null ? this[Ft]() : typeof s == "string" ? (this[C$1][0] = s.slice(t), e = s.slice(0, t), this[T$1] -= t) : (this[C$1][0] = s.subarray(t), e = s.subarray(0, t), this[T$1] -= t);
2283
+ t === s.length || t === null ? this[Ft]() : typeof s == "string" ? (this[C][0] = s.slice(t), e = s.slice(0, t), this[T] -= t) : (this[C][0] = s.subarray(t), e = s.subarray(0, t), this[T] -= t);
2284
2284
  }
2285
- return this.emit("data", e), !this[C$1].length && !this[G] && this.emit("drain"), e;
2285
+ return this.emit("data", e), !this[C].length && !this[G] && this.emit("drain"), e;
2286
2286
  }
2287
2287
  end(t, e, s) {
2288
- return typeof t == "function" && (s = t, t = void 0), typeof e == "function" && (s = e, e = "utf8"), t !== void 0 && this.write(t, e), s && this.once("end", s), this[G] = !0, this.writable = !1, (this[v$1] || !this[dt]) && this[H](), this;
2288
+ return typeof t == "function" && (s = t, t = void 0), typeof e == "function" && (s = e, e = "utf8"), t !== void 0 && this.write(t, e), s && this.once("end", s), this[G] = !0, this.writable = !1, (this[v] || !this[dt]) && this[H](), this;
2289
2289
  }
2290
2290
  [st]() {
2291
- this[x$1] || (!this[Y] && !this[F$1].length && (this[M] = !0), this[dt] = !1, this[v$1] = !0, this.emit("resume"), this[C$1].length ? this[Ot]() : this[G] ? this[H]() : this.emit("drain"));
2291
+ this[x$1] || (!this[Y] && !this[F].length && (this[M] = !0), this[dt] = !1, this[v] = !0, this.emit("resume"), this[C].length ? this[Ot]() : this[G] ? this[H]() : this.emit("drain"));
2292
2292
  }
2293
2293
  resume() {
2294
2294
  return this[st]();
2295
2295
  }
2296
2296
  pause() {
2297
- this[v$1] = !1, this[dt] = !0, this[M] = !1;
2297
+ this[v] = !1, this[dt] = !0, this[M] = !1;
2298
2298
  }
2299
2299
  get destroyed() {
2300
2300
  return this[x$1];
2301
2301
  }
2302
2302
  get flowing() {
2303
- return this[v$1];
2303
+ return this[v];
2304
2304
  }
2305
2305
  get paused() {
2306
2306
  return this[dt];
2307
2307
  }
2308
2308
  [Yt](t) {
2309
- this[k$1] ? this[T$1] += 1 : this[T$1] += t.length, this[C$1].push(t);
2309
+ this[k] ? this[T] += 1 : this[T] += t.length, this[C].push(t);
2310
2310
  }
2311
2311
  [Ft]() {
2312
- return this[k$1] ? this[T$1] -= 1 : this[T$1] -= this[C$1][0].length, this[C$1].shift();
2312
+ return this[k] ? this[T] -= 1 : this[T] -= this[C][0].length, this[C].shift();
2313
2313
  }
2314
2314
  [Ot](t = !1) {
2315
2315
  do ;
2316
- while (this[Le](this[Ft]()) && this[C$1].length);
2317
- !t && !this[C$1].length && !this[G] && this.emit("drain");
2316
+ while (this[Le](this[Ft]()) && this[C].length);
2317
+ !t && !this[C].length && !this[G] && this.emit("drain");
2318
2318
  }
2319
2319
  [Le](t) {
2320
- return this.emit("data", t), this[v$1];
2320
+ return this.emit("data", t), this[v];
2321
2321
  }
2322
2322
  pipe(t, e) {
2323
2323
  if (this[x$1]) return t;
2324
2324
  this[M] = !1;
2325
2325
  let s = this[K];
2326
- return e = e || {}, t === Ne.stdout || t === Ne.stderr ? e.end = !1 : e.end = e.end !== !1, e.proxyErrors = !!e.proxyErrors, s ? e.end && t.end() : (this[F$1].push(e.proxyErrors ? new te(this, t, e) : new Mt(this, t, e)), this[B] ? mt(() => this[st]()) : this[st]()), t;
2326
+ return e = e || {}, t === Ne.stdout || t === Ne.stderr ? e.end = !1 : e.end = e.end !== !1, e.proxyErrors = !!e.proxyErrors, s ? e.end && t.end() : (this[F].push(e.proxyErrors ? new te(this, t, e) : new Mt(this, t, e)), this[B] ? mt(() => this[st]()) : this[st]()), t;
2327
2327
  }
2328
2328
  unpipe(t) {
2329
- let e = this[F$1].find((s) => s.dest === t);
2330
- e && (this[F$1].length === 1 ? (this[v$1] && this[Y] === 0 && (this[v$1] = !1), this[F$1] = []) : this[F$1].splice(this[F$1].indexOf(e), 1), e.unpipe());
2329
+ let e = this[F].find((s) => s.dest === t);
2330
+ e && (this[F].length === 1 ? (this[v] && this[Y] === 0 && (this[v] = !1), this[F] = []) : this[F].splice(this[F].indexOf(e), 1), e.unpipe());
2331
2331
  }
2332
2332
  addListener(t, e) {
2333
2333
  return this.on(t, e);
2334
2334
  }
2335
2335
  on(t, e) {
2336
2336
  let s = super.on(t, e);
2337
- if (t === "data") this[M] = !1, this[Y]++, !this[F$1].length && !this[v$1] && this[st]();
2338
- else if (t === "readable" && this[T$1] !== 0) super.emit("readable");
2337
+ if (t === "data") this[M] = !1, this[Y]++, !this[F].length && !this[v] && this[st]();
2338
+ else if (t === "readable" && this[T] !== 0) super.emit("readable");
2339
2339
  else if (ci(t) && this[K]) super.emit(t), this.removeAllListeners(t);
2340
2340
  else if (t === "error" && this[ut]) {
2341
2341
  let i = e;
@@ -2348,22 +2348,22 @@ while (this[Le](this[Ft]()) && this[C$1].length);
2348
2348
  }
2349
2349
  off(t, e) {
2350
2350
  let s = super.off(t, e);
2351
- return t === "data" && (this[Y] = this.listeners("data").length, this[Y] === 0 && !this[M] && !this[F$1].length && (this[v$1] = !1)), s;
2351
+ return t === "data" && (this[Y] = this.listeners("data").length, this[Y] === 0 && !this[M] && !this[F].length && (this[v] = !1)), s;
2352
2352
  }
2353
2353
  removeAllListeners(t) {
2354
2354
  let e = super.removeAllListeners(t);
2355
- return (t === "data" || t === void 0) && (this[Y] = 0, !this[M] && !this[F$1].length && (this[v$1] = !1)), e;
2355
+ return (t === "data" || t === void 0) && (this[Y] = 0, !this[M] && !this[F].length && (this[v] = !1)), e;
2356
2356
  }
2357
2357
  get emittedEnd() {
2358
2358
  return this[K];
2359
2359
  }
2360
2360
  [H]() {
2361
- !this[kt] && !this[K] && !this[x$1] && this[C$1].length === 0 && this[G] && (this[kt] = !0, this.emit("end"), this.emit("prefinish"), this.emit("finish"), this[Rt] && this.emit("close"), this[kt] = !1);
2361
+ !this[kt] && !this[K] && !this[x$1] && this[C].length === 0 && this[G] && (this[kt] = !0, this.emit("end"), this.emit("prefinish"), this.emit("finish"), this[Rt] && this.emit("close"), this[kt] = !1);
2362
2362
  }
2363
2363
  emit(t, ...e) {
2364
2364
  let s = e[0];
2365
2365
  if (t !== "error" && t !== "close" && t !== x$1 && this[x$1]) return !1;
2366
- if (t === "data") return !this[k$1] && !s ? !1 : this[B] ? (mt(() => this[Jt](s)), !0) : this[Jt](s);
2366
+ if (t === "data") return !this[k] && !s ? !1 : this[B] ? (mt(() => this[Jt](s)), !0) : this[Jt](s);
2367
2367
  if (t === "end") return this[We]();
2368
2368
  if (t === "close") {
2369
2369
  if (this[Rt] = !0, !this[K] && !this[x$1]) return !1;
@@ -2384,7 +2384,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
2384
2384
  return this[H](), i;
2385
2385
  }
2386
2386
  [Jt](t) {
2387
- for (let s of this[F$1]) s.dest.write(t) === !1 && this.pause();
2387
+ for (let s of this[F]) s.dest.write(t) === !1 && this.pause();
2388
2388
  let e = this[M] ? !1 : super.emit("data", t);
2389
2389
  return this[H](), e;
2390
2390
  }
@@ -2395,26 +2395,26 @@ while (this[Le](this[Ft]()) && this[C$1].length);
2395
2395
  if (this[et]) {
2396
2396
  let e = this[et].end();
2397
2397
  if (e) {
2398
- for (let s of this[F$1]) s.dest.write(e);
2398
+ for (let s of this[F]) s.dest.write(e);
2399
2399
  this[M] || super.emit("data", e);
2400
2400
  }
2401
2401
  }
2402
- for (let e of this[F$1]) e.end();
2402
+ for (let e of this[F]) e.end();
2403
2403
  let t = super.emit("end");
2404
2404
  return this.removeAllListeners("end"), t;
2405
2405
  }
2406
2406
  async collect() {
2407
2407
  let t = Object.assign([], { dataLength: 0 });
2408
- this[k$1] || (t.dataLength = 0);
2408
+ this[k] || (t.dataLength = 0);
2409
2409
  let e = this.promise();
2410
2410
  return this.on("data", (s) => {
2411
- t.push(s), this[k$1] || (t.dataLength += s.length);
2411
+ t.push(s), this[k] || (t.dataLength += s.length);
2412
2412
  }), await e, t;
2413
2413
  }
2414
2414
  async concat() {
2415
- if (this[k$1]) throw new Error("cannot concat in objectMode");
2415
+ if (this[k]) throw new Error("cannot concat in objectMode");
2416
2416
  let t = await this.collect();
2417
- return this[P$1] ? t.join("") : Buffer.concat(t, t.dataLength);
2417
+ return this[P] ? t.join("") : Buffer.concat(t, t.dataLength);
2418
2418
  }
2419
2419
  async promise() {
2420
2420
  return new Promise((t, e) => {
@@ -2486,7 +2486,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
2486
2486
  }
2487
2487
  destroy(t) {
2488
2488
  if (this[x$1]) return t ? this.emit("error", t) : this.emit(x$1), this;
2489
- this[x$1] = !0, this[M] = !0, this[C$1].length = 0, this[T$1] = 0;
2489
+ this[x$1] = !0, this[M] = !0, this[C].length = 0, this[T] = 0;
2490
2490
  let e = this;
2491
2491
  return typeof e.close == "function" && !this[Rt] && e.close(), t ? this.emit("error", t) : this.emit(x$1), this;
2492
2492
  }
@@ -2527,15 +2527,15 @@ while (this[Le](this[Ft]()) && this[C$1].length);
2527
2527
  Ke = 8;
2528
2528
  X = 10;
2529
2529
  Ve = 12;
2530
- _$1 = 15;
2531
- gt = ~_$1;
2530
+ _ = 15;
2531
+ gt = ~_;
2532
2532
  se = 16;
2533
2533
  je = 32;
2534
2534
  yt = 64;
2535
- j$1 = 128;
2535
+ j = 128;
2536
2536
  Nt = 256;
2537
2537
  Lt = 512;
2538
- Ie = yt | j$1 | Lt;
2538
+ Ie = yt | j | Lt;
2539
2539
  Fi = 1023;
2540
2540
  ie = (n) => n.isFile() ? Ke : n.isDirectory() ? U : n.isSymbolicLink() ? X : n.isCharacterDevice() ? He : n.isBlockDevice() ? qe : n.isSocket() ? Ve : n.isFIFO() ? Ge : L;
2541
2541
  ze = new ft({ max: 4096 });
@@ -2566,7 +2566,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
2566
2566
  }
2567
2567
  };
2568
2568
  Ye = Symbol("PathScurry setAsCwd");
2569
- R$1 = class {
2569
+ R = class {
2570
2570
  name;
2571
2571
  root;
2572
2572
  roots;
@@ -2697,7 +2697,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
2697
2697
  parent: this,
2698
2698
  fullpath: o
2699
2699
  });
2700
- return this.canReaddir() || (h.#e |= j$1), s.push(h), h;
2700
+ return this.canReaddir() || (h.#e |= j), s.push(h), h;
2701
2701
  }
2702
2702
  relative() {
2703
2703
  if (this.isCWD) return "";
@@ -2734,7 +2734,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
2734
2734
  return this.#y = s;
2735
2735
  }
2736
2736
  isUnknown() {
2737
- return (this.#e & _$1) === L;
2737
+ return (this.#e & _) === L;
2738
2738
  }
2739
2739
  isType(t) {
2740
2740
  return this[`is${t}`]();
@@ -2743,22 +2743,22 @@ while (this[Le](this[Ft]()) && this[C$1].length);
2743
2743
  return this.isUnknown() ? "Unknown" : this.isDirectory() ? "Directory" : this.isFile() ? "File" : this.isSymbolicLink() ? "SymbolicLink" : this.isFIFO() ? "FIFO" : this.isCharacterDevice() ? "CharacterDevice" : this.isBlockDevice() ? "BlockDevice" : this.isSocket() ? "Socket" : "Unknown";
2744
2744
  }
2745
2745
  isFile() {
2746
- return (this.#e & _$1) === Ke;
2746
+ return (this.#e & _) === Ke;
2747
2747
  }
2748
2748
  isDirectory() {
2749
- return (this.#e & _$1) === U;
2749
+ return (this.#e & _) === U;
2750
2750
  }
2751
2751
  isCharacterDevice() {
2752
- return (this.#e & _$1) === He;
2752
+ return (this.#e & _) === He;
2753
2753
  }
2754
2754
  isBlockDevice() {
2755
- return (this.#e & _$1) === qe;
2755
+ return (this.#e & _) === qe;
2756
2756
  }
2757
2757
  isFIFO() {
2758
- return (this.#e & _$1) === Ge;
2758
+ return (this.#e & _) === Ge;
2759
2759
  }
2760
2760
  isSocket() {
2761
- return (this.#e & _$1) === Ve;
2761
+ return (this.#e & _) === Ve;
2762
2762
  }
2763
2763
  isSymbolicLink() {
2764
2764
  return (this.#e & X) === X;
@@ -2779,14 +2779,14 @@ while (this[Le](this[Ft]()) && this[C$1].length);
2779
2779
  canReadlink() {
2780
2780
  if (this.#M) return !0;
2781
2781
  if (!this.parent) return !1;
2782
- let t = this.#e & _$1;
2783
- return !(t !== L && t !== X || this.#e & Nt || this.#e & j$1);
2782
+ let t = this.#e & _;
2783
+ return !(t !== L && t !== X || this.#e & Nt || this.#e & j);
2784
2784
  }
2785
2785
  calledReaddir() {
2786
2786
  return !!(this.#e & se);
2787
2787
  }
2788
2788
  isENOENT() {
2789
- return !!(this.#e & j$1);
2789
+ return !!(this.#e & j);
2790
2790
  }
2791
2791
  isNamed(t) {
2792
2792
  return this.nocase ? this.#C === _t(t) : this.#C === bt(t);
@@ -2821,7 +2821,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
2821
2821
  }
2822
2822
  }
2823
2823
  #v() {
2824
- this.#e & j$1 || (this.#e = (this.#e | j$1) & gt, this.#G());
2824
+ this.#e & j || (this.#e = (this.#e | j) & gt, this.#G());
2825
2825
  }
2826
2826
  #G() {
2827
2827
  let t = this.children();
@@ -2834,7 +2834,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
2834
2834
  #L() {
2835
2835
  if (this.#e & yt) return;
2836
2836
  let t = this.#e;
2837
- (t & _$1) === U && (t &= gt), this.#e = t | yt, this.#G();
2837
+ (t & _) === U && (t &= gt), this.#e = t | yt, this.#G();
2838
2838
  }
2839
2839
  #I(t = "") {
2840
2840
  t === "ENOTDIR" || t === "EPERM" ? this.#L() : t === "ENOENT" ? this.#v() : this.children().provisional = 0;
@@ -2844,13 +2844,13 @@ while (this[Le](this[Ft]()) && this[C$1].length);
2844
2844
  }
2845
2845
  #D(t = "") {
2846
2846
  let e = this.#e;
2847
- e |= Nt, t === "ENOENT" && (e |= j$1), (t === "EINVAL" || t === "UNKNOWN") && (e &= gt), this.#e = e, t === "ENOTDIR" && this.parent && this.parent.#L();
2847
+ e |= Nt, t === "ENOENT" && (e |= j), (t === "EINVAL" || t === "UNKNOWN") && (e &= gt), this.#e = e, t === "ENOTDIR" && this.parent && this.parent.#L();
2848
2848
  }
2849
2849
  #z(t, e) {
2850
2850
  return this.#U(t, e) || this.#B(t, e);
2851
2851
  }
2852
2852
  #B(t, e) {
2853
- let s = ie(t), i = this.newChild(t.name, s, { parent: this }), r = i.#e & _$1;
2853
+ let s = ie(t), i = this.newChild(t.name, s, { parent: this }), r = i.#e & _;
2854
2854
  return r !== U && r !== X && r !== L && (i.#e |= yt), e.unshift(i), e.provisional++, i;
2855
2855
  }
2856
2856
  #U(t, e) {
@@ -2864,14 +2864,14 @@ while (this[Le](this[Ft]()) && this[C$1].length);
2864
2864
  return e.#e = e.#e & gt | ie(t), r !== t.name && (e.name = t.name), s !== i.provisional && (s === i.length - 1 ? i.pop() : i.splice(s, 1), i.unshift(e)), i.provisional++, e;
2865
2865
  }
2866
2866
  async lstat() {
2867
- if ((this.#e & j$1) === 0) try {
2867
+ if ((this.#e & j) === 0) try {
2868
2868
  return this.#$(await this.#t.promises.lstat(this.fullpath())), this;
2869
2869
  } catch (t) {
2870
2870
  this.#F(t.code);
2871
2871
  }
2872
2872
  }
2873
2873
  lstatSync() {
2874
- if ((this.#e & j$1) === 0) try {
2874
+ if ((this.#e & j) === 0) try {
2875
2875
  return this.#$(this.#t.lstatSync(this.fullpath())), this;
2876
2876
  } catch (t) {
2877
2877
  this.#F(t.code);
@@ -2948,7 +2948,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
2948
2948
  }
2949
2949
  canReaddir() {
2950
2950
  if (this.#e & Ie) return !1;
2951
- let t = _$1 & this.#e;
2951
+ let t = _ & this.#e;
2952
2952
  return t === L || t === U || t === X;
2953
2953
  }
2954
2954
  shouldWalk(t, e) {
@@ -2956,7 +2956,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
2956
2956
  }
2957
2957
  async realpath() {
2958
2958
  if (this.#k) return this.#k;
2959
- if (!((Lt | Nt | j$1) & this.#e)) try {
2959
+ if (!((Lt | Nt | j) & this.#e)) try {
2960
2960
  let t = await this.#t.promises.realpath(this.fullpath());
2961
2961
  return this.#k = this.resolve(t);
2962
2962
  } catch {
@@ -2965,7 +2965,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
2965
2965
  }
2966
2966
  realpathSync() {
2967
2967
  if (this.#k) return this.#k;
2968
- if (!((Lt | Nt | j$1) & this.#e)) try {
2968
+ if (!((Lt | Nt | j) & this.#e)) try {
2969
2969
  let t = this.#t.realpathSync(this.fullpath());
2970
2970
  return this.#k = this.resolve(t);
2971
2971
  } catch {
@@ -2980,7 +2980,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
2980
2980
  for (i = t; i && i.parent && !e.has(i);) i.#x = void 0, i.#A = void 0, i = i.parent;
2981
2981
  }
2982
2982
  };
2983
- Pt = class n extends R$1 {
2983
+ Pt = class n extends R {
2984
2984
  sep = "\\";
2985
2985
  splitSep = Oi;
2986
2986
  constructor(t, e = L, s, i, r, o, h) {
@@ -3001,7 +3001,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
3001
3001
  return t = t.toUpperCase().replace(/\//g, "\\").replace($e, "$1\\"), t === e;
3002
3002
  }
3003
3003
  };
3004
- jt = class n extends R$1 {
3004
+ jt = class n extends R {
3005
3005
  splitSep = "/";
3006
3006
  sep = "/";
3007
3007
  constructor(t, e = L, s, i, r, o, h) {
@@ -3086,7 +3086,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
3086
3086
  return typeof t == "string" && (t = this.cwd.resolve(t)), (t.parent || t).fullpath();
3087
3087
  }
3088
3088
  async readdir(t = this.cwd, e = { withFileTypes: !0 }) {
3089
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$1 || (e = t, t = this.cwd);
3089
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
3090
3090
  let { withFileTypes: s } = e;
3091
3091
  if (t.canReaddir()) {
3092
3092
  let i = await t.readdir();
@@ -3094,7 +3094,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
3094
3094
  } else return [];
3095
3095
  }
3096
3096
  readdirSync(t = this.cwd, e = { withFileTypes: !0 }) {
3097
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$1 || (e = t, t = this.cwd);
3097
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
3098
3098
  let { withFileTypes: s = !0 } = e;
3099
3099
  return t.canReaddir() ? s ? t.readdirSync() : t.readdirSync().map((i) => i.name) : [];
3100
3100
  }
@@ -3105,27 +3105,27 @@ while (this[Le](this[Ft]()) && this[C$1].length);
3105
3105
  return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstatSync();
3106
3106
  }
3107
3107
  async readlink(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
3108
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$1 || (e = t.withFileTypes, t = this.cwd);
3108
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
3109
3109
  let s = await t.readlink();
3110
3110
  return e ? s : s?.fullpath();
3111
3111
  }
3112
3112
  readlinkSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
3113
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$1 || (e = t.withFileTypes, t = this.cwd);
3113
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
3114
3114
  let s = t.readlinkSync();
3115
3115
  return e ? s : s?.fullpath();
3116
3116
  }
3117
3117
  async realpath(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
3118
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$1 || (e = t.withFileTypes, t = this.cwd);
3118
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
3119
3119
  let s = await t.realpath();
3120
3120
  return e ? s : s?.fullpath();
3121
3121
  }
3122
3122
  realpathSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
3123
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$1 || (e = t.withFileTypes, t = this.cwd);
3123
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
3124
3124
  let s = t.realpathSync();
3125
3125
  return e ? s : s?.fullpath();
3126
3126
  }
3127
3127
  async walk(t = this.cwd, e = {}) {
3128
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$1 || (e = t, t = this.cwd);
3128
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
3129
3129
  let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = [];
3130
3130
  (!r || r(t)) && h.push(s ? t : t.fullpath());
3131
3131
  let a = /* @__PURE__ */ new Set(), l = (c, d) => {
@@ -3147,7 +3147,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
3147
3147
  });
3148
3148
  }
3149
3149
  walkSync(t = this.cwd, e = {}) {
3150
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$1 || (e = t, t = this.cwd);
3150
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
3151
3151
  let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = [];
3152
3152
  (!r || r(t)) && h.push(s ? t : t.fullpath());
3153
3153
  let a = /* @__PURE__ */ new Set([t]);
@@ -3169,13 +3169,13 @@ while (this[Le](this[Ft]()) && this[C$1].length);
3169
3169
  return this.iterate();
3170
3170
  }
3171
3171
  iterate(t = this.cwd, e = {}) {
3172
- return typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$1 || (e = t, t = this.cwd), this.stream(t, e)[Symbol.asyncIterator]();
3172
+ return typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd), this.stream(t, e)[Symbol.asyncIterator]();
3173
3173
  }
3174
3174
  [Symbol.iterator]() {
3175
3175
  return this.iterateSync();
3176
3176
  }
3177
3177
  *iterateSync(t = this.cwd, e = {}) {
3178
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$1 || (e = t, t = this.cwd);
3178
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
3179
3179
  let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e;
3180
3180
  (!r || r(t)) && (yield s ? t : t.fullpath());
3181
3181
  let h = /* @__PURE__ */ new Set([t]);
@@ -3193,7 +3193,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
3193
3193
  }
3194
3194
  }
3195
3195
  stream(t = this.cwd, e = {}) {
3196
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$1 || (e = t, t = this.cwd);
3196
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
3197
3197
  let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = new V({ objectMode: !0 });
3198
3198
  (!r || r(t)) && h.write(s ? t : t.fullpath());
3199
3199
  let a = /* @__PURE__ */ new Set(), l = [t], u = 0, c = () => {
@@ -3229,7 +3229,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
3229
3229
  return c(), h;
3230
3230
  }
3231
3231
  streamSync(t = this.cwd, e = {}) {
3232
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$1 || (e = t, t = this.cwd);
3232
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
3233
3233
  let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = new V({ objectMode: !0 }), a = /* @__PURE__ */ new Set();
3234
3234
  (!r || r(t)) && h.write(s ? t : t.fullpath());
3235
3235
  let l = [t], u = 0, c = () => {
@@ -3428,12 +3428,12 @@ while (this[Le](this[Ft]()) && this[C$1].length);
3428
3428
  for (let h of t) this.add(h);
3429
3429
  }
3430
3430
  add(t) {
3431
- let e = new D$1(t, this.mmopts);
3431
+ let e = new D(t, this.mmopts);
3432
3432
  for (let s = 0; s < e.set.length; s++) {
3433
3433
  let i = e.set[s], r = e.globParts[s];
3434
3434
  if (!i || !r) throw new Error("invalid pattern object");
3435
3435
  for (; i[0] === "." && r[0] === ".";) i.shift(), r.shift();
3436
- let o = new nt(i, r, 0, this.platform), h = new D$1(o.globString(), this.mmopts), a = r[r.length - 1] === "**", l = o.isAbsolute();
3436
+ let o = new nt(i, r, 0, this.platform), h = new D(o.globString(), this.mmopts), a = r[r.length - 1] === "**", l = o.isAbsolute();
3437
3437
  l ? this.absolute.push(h) : this.relative.push(h), a && (l ? this.absoluteChildren.push(h) : this.relativeChildren.push(h));
3438
3438
  }
3439
3439
  }
@@ -3782,7 +3782,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
3782
3782
  }
3783
3783
  };
3784
3784
  Pi = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux";
3785
- I$1 = class {
3785
+ I = class {
3786
3786
  absolute;
3787
3787
  cwd;
3788
3788
  root;
@@ -3845,7 +3845,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
3845
3845
  platform: this.platform,
3846
3846
  windowsPathsNoEscape: this.windowsPathsNoEscape,
3847
3847
  debug: !!this.opts.debug
3848
- }, [o, h] = this.pattern.map((a) => new D$1(a, i)).reduce((a, l) => (a[0].push(...l.set), a[1].push(...l.globParts), a), [[], []]);
3848
+ }, [o, h] = this.pattern.map((a) => new D(a, i)).reduce((a, l) => (a[0].push(...l.set), a[1].push(...l.globParts), a), [[], []]);
3849
3849
  this.patterns = o.map((a, l) => {
3850
3850
  let u = h[l];
3851
3851
  if (!u) throw new Error("invalid pattern object");
@@ -3903,7 +3903,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
3903
3903
  };
3904
3904
  le = (n, t = {}) => {
3905
3905
  Array.isArray(n) || (n = [n]);
3906
- for (let e of n) if (new D$1(e, t).hasMagic()) return !0;
3906
+ for (let e of n) if (new D(e, t).hasMagic()) return !0;
3907
3907
  return !1;
3908
3908
  };
3909
3909
  ji = Bt;
@@ -3926,7 +3926,7 @@ while (this[Le](this[Ft]()) && this[C$1].length);
3926
3926
  iterate: Bi,
3927
3927
  globIterateSync: Ut,
3928
3928
  iterateSync: zi,
3929
- Glob: I$1,
3929
+ Glob: I,
3930
3930
  hasMagic: le,
3931
3931
  escape: tt,
3932
3932
  unescape: W
@@ -6944,6 +6944,67 @@ function setGitConfig(key, value) {
6944
6944
  ], { stdio: "inherit" });
6945
6945
  }
6946
6946
  //#endregion
6947
+ //#region src/lib/github/runner.ts
6948
+ /**
6949
+ * Node's spawnSync defaults to a 1 MB buffer, which a paginated org-wide query
6950
+ * blows past — the child is killed and its partial stdout looks like a failure.
6951
+ */
6952
+ const GITHUB_MAX_BUFFER = 268435456;
6953
+ const defaultGithubRunner = (args, options = {}) => {
6954
+ const result = spawnSync("gh", args, {
6955
+ cwd: options.cwd,
6956
+ encoding: "utf8",
6957
+ env: process.env,
6958
+ maxBuffer: GITHUB_MAX_BUFFER,
6959
+ stdio: [
6960
+ "ignore",
6961
+ "pipe",
6962
+ "pipe"
6963
+ ]
6964
+ });
6965
+ return {
6966
+ status: result.status,
6967
+ stderr: typeof result.stderr === "string" ? result.stderr : "",
6968
+ stdout: typeof result.stdout === "string" ? result.stdout : ""
6969
+ };
6970
+ };
6971
+ /**
6972
+ `gh` is installed, authenticated, and the cwd resolves to a GitHub repository.
6973
+ */
6974
+ function githubIsAvailable(runner, cwd) {
6975
+ if (runner(["--version"], { cwd }).status !== 0) return false;
6976
+ if (runner(["auth", "status"], { cwd }).status !== 0) return false;
6977
+ const repo = runner([
6978
+ "repo",
6979
+ "view",
6980
+ "--json",
6981
+ "nameWithOwner"
6982
+ ], { cwd });
6983
+ return repo.status === 0 && repo.stdout.trim().length > 0;
6984
+ }
6985
+ function githubRunOrThrow(runner, args, cwd, context) {
6986
+ const result = runner(args, { cwd });
6987
+ if (result.status !== 0) {
6988
+ const detail = result.stderr.trim() || result.stdout.trim() || `exit ${String(result.status)}`;
6989
+ throw new Error(`${context}: ${detail}`);
6990
+ }
6991
+ return result.stdout;
6992
+ }
6993
+ /**
6994
+ Parse `gh api --paginate` output in either form it emits: without `--jq` it
6995
+ concatenates one JSON array per page with no separator, so the seams have to be
6996
+ spliced; with `--jq` it emits one compact JSON value per line.
6997
+ */
6998
+ function parseGithubPaginatedJson(stdout) {
6999
+ const trimmed = stdout.trim();
7000
+ if (trimmed.length === 0) return [];
7001
+ if (trimmed.startsWith("[")) {
7002
+ const parsed = JSON.parse(trimmed.replaceAll(/\]\s*\[/g, ","));
7003
+ return Array.isArray(parsed) ? parsed : [parsed];
7004
+ }
7005
+ return trimmed.split("\n").filter((line) => line.trim().length > 0).map((line) => JSON.parse(line));
7006
+ }
7007
+ //#endregion
6947
7008
  //#region src/lib/gitignoreTemplate.ts
6948
7009
  const require$6 = createRequire(import.meta.url);
6949
7010
  const packageRoot$1 = PATH.dirname(require$6.resolve("@ariestools/toolchain/package.json"));
@@ -7131,7 +7192,7 @@ function collectProductionLicenses(startDir) {
7131
7192
  return result;
7132
7193
  }
7133
7194
  //#endregion
7134
- //#region ../../node_modules/.pnpm/js-yaml@4.3.0/node_modules/js-yaml/lib/common.js
7195
+ //#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/common.js
7135
7196
  var require_common = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7136
7197
  function isNothing(subject) {
7137
7198
  return typeof subject === "undefined" || subject === null;
@@ -7170,7 +7231,7 @@ var require_common = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7170
7231
  module.exports.extend = extend;
7171
7232
  }));
7172
7233
  //#endregion
7173
- //#region ../../node_modules/.pnpm/js-yaml@4.3.0/node_modules/js-yaml/lib/exception.js
7234
+ //#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/exception.js
7174
7235
  var require_exception = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7175
7236
  function formatError(exception, compact) {
7176
7237
  let where = "";
@@ -7198,7 +7259,7 @@ var require_exception = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7198
7259
  module.exports = YAMLException;
7199
7260
  }));
7200
7261
  //#endregion
7201
- //#region ../../node_modules/.pnpm/js-yaml@4.3.0/node_modules/js-yaml/lib/snippet.js
7262
+ //#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/snippet.js
7202
7263
  var require_snippet = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7203
7264
  const common = require_common();
7204
7265
  function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
@@ -7260,7 +7321,7 @@ var require_snippet = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7260
7321
  module.exports = makeSnippet;
7261
7322
  }));
7262
7323
  //#endregion
7263
- //#region ../../node_modules/.pnpm/js-yaml@4.3.0/node_modules/js-yaml/lib/type.js
7324
+ //#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/type.js
7264
7325
  var require_type = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7265
7326
  const YAMLException = require_exception();
7266
7327
  const TYPE_CONSTRUCTOR_OPTIONS = [
@@ -7315,7 +7376,7 @@ var require_type = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7315
7376
  module.exports = Type;
7316
7377
  }));
7317
7378
  //#endregion
7318
- //#region ../../node_modules/.pnpm/js-yaml@4.3.0/node_modules/js-yaml/lib/schema.js
7379
+ //#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/schema.js
7319
7380
  var require_schema$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7320
7381
  const YAMLException = require_exception();
7321
7382
  const Type = require_type();
@@ -7383,7 +7444,7 @@ var require_schema$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7383
7444
  module.exports = Schema;
7384
7445
  }));
7385
7446
  //#endregion
7386
- //#region ../../node_modules/.pnpm/js-yaml@4.3.0/node_modules/js-yaml/lib/type/str.js
7447
+ //#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/type/str.js
7387
7448
  var require_str = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7388
7449
  module.exports = new (require_type())("tag:yaml.org,2002:str", {
7389
7450
  kind: "scalar",
@@ -7393,7 +7454,7 @@ var require_str = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7393
7454
  });
7394
7455
  }));
7395
7456
  //#endregion
7396
- //#region ../../node_modules/.pnpm/js-yaml@4.3.0/node_modules/js-yaml/lib/type/seq.js
7457
+ //#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/type/seq.js
7397
7458
  var require_seq$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7398
7459
  module.exports = new (require_type())("tag:yaml.org,2002:seq", {
7399
7460
  kind: "sequence",
@@ -7403,7 +7464,7 @@ var require_seq$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7403
7464
  });
7404
7465
  }));
7405
7466
  //#endregion
7406
- //#region ../../node_modules/.pnpm/js-yaml@4.3.0/node_modules/js-yaml/lib/type/map.js
7467
+ //#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/type/map.js
7407
7468
  var require_map$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7408
7469
  module.exports = new (require_type())("tag:yaml.org,2002:map", {
7409
7470
  kind: "mapping",
@@ -7413,7 +7474,7 @@ var require_map$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7413
7474
  });
7414
7475
  }));
7415
7476
  //#endregion
7416
- //#region ../../node_modules/.pnpm/js-yaml@4.3.0/node_modules/js-yaml/lib/schema/failsafe.js
7477
+ //#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/schema/failsafe.js
7417
7478
  var require_failsafe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7418
7479
  module.exports = new (require_schema$3())({ explicit: [
7419
7480
  require_str(),
@@ -7422,7 +7483,7 @@ var require_failsafe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7422
7483
  ] });
7423
7484
  }));
7424
7485
  //#endregion
7425
- //#region ../../node_modules/.pnpm/js-yaml@4.3.0/node_modules/js-yaml/lib/type/null.js
7486
+ //#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/type/null.js
7426
7487
  var require_null$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7427
7488
  const Type = require_type();
7428
7489
  function resolveYamlNull(data) {
@@ -7462,7 +7523,7 @@ var require_null$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7462
7523
  });
7463
7524
  }));
7464
7525
  //#endregion
7465
- //#region ../../node_modules/.pnpm/js-yaml@4.3.0/node_modules/js-yaml/lib/type/bool.js
7526
+ //#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/type/bool.js
7466
7527
  var require_bool$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7467
7528
  const Type = require_type();
7468
7529
  function resolveYamlBoolean(data) {
@@ -7496,7 +7557,7 @@ var require_bool$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7496
7557
  });
7497
7558
  }));
7498
7559
  //#endregion
7499
- //#region ../../node_modules/.pnpm/js-yaml@4.3.0/node_modules/js-yaml/lib/type/int.js
7560
+ //#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/type/int.js
7500
7561
  var require_int$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7501
7562
  const common = require_common();
7502
7563
  const Type = require_type();
@@ -7605,7 +7666,7 @@ var require_int$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7605
7666
  });
7606
7667
  }));
7607
7668
  //#endregion
7608
- //#region ../../node_modules/.pnpm/js-yaml@4.3.0/node_modules/js-yaml/lib/type/float.js
7669
+ //#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/type/float.js
7609
7670
  var require_float$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7610
7671
  const common = require_common();
7611
7672
  const Type = require_type();
@@ -7659,7 +7720,7 @@ var require_float$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7659
7720
  });
7660
7721
  }));
7661
7722
  //#endregion
7662
- //#region ../../node_modules/.pnpm/js-yaml@4.3.0/node_modules/js-yaml/lib/schema/json.js
7723
+ //#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/schema/json.js
7663
7724
  var require_json = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7664
7725
  module.exports = require_failsafe().extend({ implicit: [
7665
7726
  require_null$1(),
@@ -7669,12 +7730,12 @@ var require_json = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7669
7730
  ] });
7670
7731
  }));
7671
7732
  //#endregion
7672
- //#region ../../node_modules/.pnpm/js-yaml@4.3.0/node_modules/js-yaml/lib/schema/core.js
7733
+ //#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/schema/core.js
7673
7734
  var require_core = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7674
7735
  module.exports = require_json();
7675
7736
  }));
7676
7737
  //#endregion
7677
- //#region ../../node_modules/.pnpm/js-yaml@4.3.0/node_modules/js-yaml/lib/type/timestamp.js
7738
+ //#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/type/timestamp.js
7678
7739
  var require_timestamp$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7679
7740
  const Type = require_type();
7680
7741
  const YAML_DATE_REGEXP = /* @__PURE__ */ new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$");
@@ -7725,7 +7786,7 @@ var require_timestamp$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7725
7786
  });
7726
7787
  }));
7727
7788
  //#endregion
7728
- //#region ../../node_modules/.pnpm/js-yaml@4.3.0/node_modules/js-yaml/lib/type/merge.js
7789
+ //#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/type/merge.js
7729
7790
  var require_merge$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7730
7791
  const Type = require_type();
7731
7792
  function resolveYamlMerge(data) {
@@ -7737,7 +7798,7 @@ var require_merge$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7737
7798
  });
7738
7799
  }));
7739
7800
  //#endregion
7740
- //#region ../../node_modules/.pnpm/js-yaml@4.3.0/node_modules/js-yaml/lib/type/binary.js
7801
+ //#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/type/binary.js
7741
7802
  var require_binary$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7742
7803
  const Type = require_type();
7743
7804
  const BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
@@ -7824,14 +7885,14 @@ var require_binary$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7824
7885
  });
7825
7886
  }));
7826
7887
  //#endregion
7827
- //#region ../../node_modules/.pnpm/js-yaml@4.3.0/node_modules/js-yaml/lib/type/omap.js
7888
+ //#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/type/omap.js
7828
7889
  var require_omap$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7829
7890
  const Type = require_type();
7830
7891
  const _hasOwnProperty = Object.prototype.hasOwnProperty;
7831
7892
  const _toString = Object.prototype.toString;
7832
7893
  function resolveYamlOmap(data) {
7833
7894
  if (data === null) return true;
7834
- const objectKeys = [];
7895
+ const objectKeys = {};
7835
7896
  const object = data;
7836
7897
  for (let index = 0, length = object.length; index < length; index += 1) {
7837
7898
  const pair = object[index];
@@ -7843,8 +7904,8 @@ var require_omap$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7843
7904
  else return false;
7844
7905
  }
7845
7906
  if (!pairHasKey) return false;
7846
- if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
7847
- else return false;
7907
+ if (_hasOwnProperty.call(objectKeys, pairKey)) return false;
7908
+ Object.defineProperty(objectKeys, pairKey, { value: true });
7848
7909
  }
7849
7910
  return true;
7850
7911
  }
@@ -7858,7 +7919,7 @@ var require_omap$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7858
7919
  });
7859
7920
  }));
7860
7921
  //#endregion
7861
- //#region ../../node_modules/.pnpm/js-yaml@4.3.0/node_modules/js-yaml/lib/type/pairs.js
7922
+ //#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/type/pairs.js
7862
7923
  var require_pairs$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7863
7924
  const Type = require_type();
7864
7925
  const _toString = Object.prototype.toString;
@@ -7893,7 +7954,7 @@ var require_pairs$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7893
7954
  });
7894
7955
  }));
7895
7956
  //#endregion
7896
- //#region ../../node_modules/.pnpm/js-yaml@4.3.0/node_modules/js-yaml/lib/type/set.js
7957
+ //#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/type/set.js
7897
7958
  var require_set$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7898
7959
  const Type = require_type();
7899
7960
  const _hasOwnProperty = Object.prototype.hasOwnProperty;
@@ -7915,7 +7976,7 @@ var require_set$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7915
7976
  });
7916
7977
  }));
7917
7978
  //#endregion
7918
- //#region ../../node_modules/.pnpm/js-yaml@4.3.0/node_modules/js-yaml/lib/schema/default.js
7979
+ //#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/schema/default.js
7919
7980
  var require_default = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7920
7981
  module.exports = require_core().extend({
7921
7982
  implicit: [require_timestamp$1(), require_merge$2()],
@@ -7928,7 +7989,7 @@ var require_default = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7928
7989
  });
7929
7990
  }));
7930
7991
  //#endregion
7931
- //#region ../../node_modules/.pnpm/js-yaml@4.3.0/node_modules/js-yaml/lib/loader.js
7992
+ //#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/loader.js
7932
7993
  var require_loader = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7933
7994
  const common = require_common();
7934
7995
  const YAMLException = require_exception();
@@ -8956,7 +9017,7 @@ var require_loader = /* @__PURE__ */ __commonJSMin(((exports, module) => {
8956
9017
  module.exports.load = load;
8957
9018
  }));
8958
9019
  //#endregion
8959
- //#region ../../node_modules/.pnpm/js-yaml@4.3.0/node_modules/js-yaml/lib/dumper.js
9020
+ //#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/lib/dumper.js
8960
9021
  var require_dumper = /* @__PURE__ */ __commonJSMin(((exports, module) => {
8961
9022
  const common = require_common();
8962
9023
  const YAMLException = require_exception();
@@ -9455,7 +9516,7 @@ var require_dumper = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9455
9516
  module.exports.dump = dump;
9456
9517
  }));
9457
9518
  //#endregion
9458
- //#region ../../node_modules/.pnpm/js-yaml@4.3.0/node_modules/js-yaml/index.js
9519
+ //#region ../../node_modules/.pnpm/js-yaml@4.3.1/node_modules/js-yaml/index.js
9459
9520
  var require_js_yaml = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9460
9521
  const loader = require_loader();
9461
9522
  const dumper = require_dumper();
@@ -10396,7 +10457,42 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
10396
10457
  exports.cosmiconfigSync = cosmiconfigSync;
10397
10458
  }));
10398
10459
  //#endregion
10460
+ //#region ../../node_modules/.pnpm/cosmiconfig-typescript-loader@6.3.0_@types+node@26.2.0_cosmiconfig@10.0.0_typescript@6.0.3/node_modules/cosmiconfig-typescript-loader/dist/esm/typescript-compile-error.mjs
10461
+ var TypeScriptCompileError = class _TypeScriptCompileError extends Error {
10462
+ constructor(message) {
10463
+ super(message);
10464
+ this.name = this.constructor.name;
10465
+ Object.setPrototypeOf(this, new.target.prototype);
10466
+ }
10467
+ static fromError(error) {
10468
+ const message = `TypeScriptLoader failed to compile TypeScript:
10469
+ ${error.message}`;
10470
+ const newError = new _TypeScriptCompileError(message);
10471
+ newError.stack = error.stack;
10472
+ return newError;
10473
+ }
10474
+ };
10475
+ //#endregion
10476
+ //#region ../../node_modules/.pnpm/cosmiconfig-typescript-loader@6.3.0_@types+node@26.2.0_cosmiconfig@10.0.0_typescript@6.0.3/node_modules/cosmiconfig-typescript-loader/dist/esm/loader.mjs
10477
+ function TypeScriptLoader(options) {
10478
+ const loader = createJiti("", {
10479
+ interopDefault: true,
10480
+ ...options
10481
+ });
10482
+ return async (path, _content) => {
10483
+ try {
10484
+ const result = await loader.import(path);
10485
+ return result.default || result;
10486
+ } catch (error) {
10487
+ if (error instanceof Error) throw TypeScriptCompileError.fromError(error);
10488
+ throw error;
10489
+ }
10490
+ };
10491
+ }
10492
+ //#endregion
10399
10493
  //#region src/lib/ruleCommandRegistry.ts
10494
+ /** Title for the root `xy --rules` catalog. */
10495
+ const ROOT_RULES_TITLE = "XY Rules";
10400
10496
  const RULE_COMMANDS = {
10401
10497
  apiExposure: {
10402
10498
  command: "api-exposure",
@@ -10406,7 +10502,7 @@ const RULE_COMMANDS = {
10406
10502
  },
10407
10503
  check: {
10408
10504
  command: "check",
10409
- includeInRoot: true,
10505
+ includeInRoot: false,
10410
10506
  title: "Check Rules"
10411
10507
  },
10412
10508
  clean: {
@@ -10426,6 +10522,12 @@ const RULE_COMMANDS = {
10426
10522
  includeInRoot: true,
10427
10523
  title: "Dead Rules"
10428
10524
  },
10525
+ dependabot: {
10526
+ command: "secure dependabot",
10527
+ configKey: "dependabot",
10528
+ includeInRoot: true,
10529
+ title: "Dependabot Rules"
10530
+ },
10429
10531
  deplint: {
10430
10532
  command: "deplint",
10431
10533
  configKey: "deplint",
@@ -10447,7 +10549,7 @@ const RULE_COMMANDS = {
10447
10549
  lint: {
10448
10550
  aliases: ["relint"],
10449
10551
  command: "lint",
10450
- includeInRoot: true,
10552
+ includeInRoot: false,
10451
10553
  title: "Lint Rules"
10452
10554
  },
10453
10555
  lintLint: {
@@ -10528,7 +10630,7 @@ In-flight workspace loads — concurrent jobs for the same dir share one search.
10528
10630
  */
10529
10631
  const workspaceConfigLoadPromises = /* @__PURE__ */ new Map();
10530
10632
  const deprecationWarned = /* @__PURE__ */ new Set();
10531
- function isRecord$8(value) {
10633
+ function isRecord$10(value) {
10532
10634
  return typeof value === "object" && value !== null && !Array.isArray(value);
10533
10635
  }
10534
10636
  const explorerState = {};
@@ -10609,12 +10711,12 @@ function warnOnce(key, message) {
10609
10711
  */
10610
10712
  function resolveCommandField(cfg, commandName, configPath) {
10611
10713
  const configKey = canonicalRuleConfigKey(commandName);
10612
- const commands = isRecord$8(cfg.commands) ? cfg.commands : void 0;
10714
+ const commands = isRecord$10(cfg.commands) ? cfg.commands : void 0;
10613
10715
  const fromCommands = commands?.[configKey];
10614
- if (isRecord$8(fromCommands)) return fromCommands;
10716
+ if (isRecord$10(fromCommands)) return fromCommands;
10615
10717
  for (const alias of deprecatedRuleConfigAliases(configKey)) {
10616
10718
  const fromAlias = commands?.[alias];
10617
- if (!isRecord$8(fromAlias)) continue;
10719
+ if (!isRecord$10(fromAlias)) continue;
10618
10720
  warnOnce(`${configPath ?? "unknown"}:commands.${alias}`, `[xy] Deprecated: "commands.${alias}" in ${configPath ?? "xy.config"} — use "commands.${configKey}"`);
10619
10721
  return fromAlias;
10620
10722
  }
@@ -10626,7 +10728,7 @@ function resolveCommandField(cfg, commandName, configPath) {
10626
10728
  return {};
10627
10729
  }
10628
10730
  function mergeRuleConfigs(target, source) {
10629
- if (isRecord$8(target) && isRecord$8(source)) return {
10731
+ if (isRecord$10(target) && isRecord$10(source)) return {
10630
10732
  ...target,
10631
10733
  ...source
10632
10734
  };
@@ -19340,6 +19442,295 @@ function collectSecureDeclaredDependencies(cwd, targets, localPackageNames) {
19340
19442
  });
19341
19443
  }
19342
19444
  //#endregion
19445
+ //#region src/lib/secure/dependabot/fetchDependabotAlerts.ts
19446
+ /**
19447
+ Ask GitHub for only the fields we render. An org-wide sweep returns thousands
19448
+ of alerts, and each raw alert carries a full advisory body plus reference and
19449
+ identifier lists — the projection keeps the transfer to a fraction of that
19450
+ while preserving the payload shape `parseDependabotAlert` expects.
19451
+ */
19452
+ const ALERT_PROJECTION = [
19453
+ ".[] | {",
19454
+ "number, html_url, dependency, security_vulnerability,",
19455
+ "security_advisory: {",
19456
+ "ghsa_id: .security_advisory.ghsa_id,",
19457
+ "severity: .security_advisory.severity,",
19458
+ "summary: .security_advisory.summary },",
19459
+ "repository: { full_name: .repository.full_name }",
19460
+ "}"
19461
+ ].join(" ");
19462
+ const SEVERITIES = /* @__PURE__ */ new Set([
19463
+ "critical",
19464
+ "high",
19465
+ "low",
19466
+ "medium"
19467
+ ]);
19468
+ const SCOPES = /* @__PURE__ */ new Set(["development", "runtime"]);
19469
+ const RELATIONSHIPS = /* @__PURE__ */ new Set(["direct", "transitive"]);
19470
+ function isRecord$9(value) {
19471
+ return typeof value === "object" && value !== null && !Array.isArray(value);
19472
+ }
19473
+ function readString(value) {
19474
+ return typeof value === "string" ? value : "";
19475
+ }
19476
+ function readSeverity(value) {
19477
+ const raw = readString(value).toLowerCase();
19478
+ return SEVERITIES.has(raw) ? raw : "low";
19479
+ }
19480
+ function readScope(value) {
19481
+ const raw = readString(value).toLowerCase();
19482
+ return SCOPES.has(raw) ? raw : "unknown";
19483
+ }
19484
+ function readRelationship(value) {
19485
+ const raw = readString(value).toLowerCase();
19486
+ return RELATIONSHIPS.has(raw) ? raw : "unknown";
19487
+ }
19488
+ function parseDependabotAlert(raw) {
19489
+ if (!isRecord$9(raw)) return void 0;
19490
+ const dependency = isRecord$9(raw.dependency) ? raw.dependency : {};
19491
+ const dependencyPackage = isRecord$9(dependency.package) ? dependency.package : {};
19492
+ const advisory = isRecord$9(raw.security_advisory) ? raw.security_advisory : {};
19493
+ const vulnerability = isRecord$9(raw.security_vulnerability) ? raw.security_vulnerability : {};
19494
+ const patched = isRecord$9(vulnerability.first_patched_version) ? vulnerability.first_patched_version : {};
19495
+ const repository = isRecord$9(raw.repository) ? raw.repository : {};
19496
+ const packageName = readString(dependencyPackage.name);
19497
+ if (packageName.length === 0) return void 0;
19498
+ const patchedVersion = readString(patched.identifier);
19499
+ const repositoryName = readString(repository.full_name);
19500
+ return {
19501
+ ecosystem: readString(dependencyPackage.ecosystem),
19502
+ ghsaId: readString(advisory.ghsa_id),
19503
+ htmlUrl: readString(raw.html_url),
19504
+ manifestPath: readString(dependency.manifest_path),
19505
+ number: typeof raw.number === "number" ? raw.number : 0,
19506
+ packageName,
19507
+ relationship: readRelationship(dependency.relationship),
19508
+ scope: readScope(dependency.scope),
19509
+ severity: readSeverity(advisory.severity),
19510
+ summary: readString(advisory.summary),
19511
+ vulnerableVersionRange: readString(vulnerability.vulnerable_version_range),
19512
+ ...patchedVersion.length > 0 && { patchedVersion },
19513
+ ...repositoryName.length > 0 && { repository: repositoryName }
19514
+ };
19515
+ }
19516
+ function resolveTarget(runner, cwd, org) {
19517
+ if (org !== void 0 && org.length > 0) return org;
19518
+ const result = runner([
19519
+ "repo",
19520
+ "view",
19521
+ "--json",
19522
+ "nameWithOwner",
19523
+ "--jq",
19524
+ ".nameWithOwner"
19525
+ ], { cwd });
19526
+ return result.status === 0 ? result.stdout.trim() : "";
19527
+ }
19528
+ /**
19529
+ GitHub answers "the feature is switched off for this repo" with a 403 rather
19530
+ than an empty list, so treat that one message as a state, not an error.
19531
+ */
19532
+ function isAlertsDisabled(stderr, stdout) {
19533
+ return `${stderr}\n${stdout}`.includes("Dependabot alerts are disabled");
19534
+ }
19535
+ function fetchDependabotAlerts(options) {
19536
+ const { cwd, org, runner = defaultGithubRunner, state = "open" } = options;
19537
+ if (!githubIsAvailable(runner, cwd)) return {
19538
+ alerts: [],
19539
+ availability: "no-gh",
19540
+ target: org ?? ""
19541
+ };
19542
+ const target = resolveTarget(runner, cwd, org);
19543
+ const result = runner([
19544
+ "api",
19545
+ "--paginate",
19546
+ `${org !== void 0 && org.length > 0 ? `orgs/${org}/dependabot/alerts` : "repos/{owner}/{repo}/dependabot/alerts"}?state=${state}&per_page=100`,
19547
+ "--jq",
19548
+ ALERT_PROJECTION
19549
+ ], { cwd });
19550
+ if (result.status !== 0) {
19551
+ if (isAlertsDisabled(result.stderr, result.stdout)) return {
19552
+ alerts: [],
19553
+ availability: "disabled",
19554
+ target
19555
+ };
19556
+ const detail = result.stderr.trim() || result.stdout.trim() || `exit ${String(result.status)}`;
19557
+ throw new Error(`Failed to read Dependabot alerts for ${target.length > 0 ? target : cwd}: ${detail}`);
19558
+ }
19559
+ return {
19560
+ alerts: parseGithubPaginatedJson(result.stdout).map((entry) => parseDependabotAlert(entry)).filter((alert) => alert !== void 0),
19561
+ availability: "ok",
19562
+ target
19563
+ };
19564
+ }
19565
+ //#endregion
19566
+ //#region src/lib/secure/dependabot/interfaces.ts
19567
+ const DEPENDABOT_SEVERITIES = [
19568
+ "critical",
19569
+ "high",
19570
+ "medium",
19571
+ "low"
19572
+ ];
19573
+ //#endregion
19574
+ //#region src/lib/secure/dependabot/renderDependabotAlerts.ts
19575
+ const SEVERITY_COLOR = {
19576
+ critical: chalk.hex("#b26cff"),
19577
+ high: chalk.red,
19578
+ low: chalk.gray,
19579
+ medium: chalk.yellow
19580
+ };
19581
+ function relationshipLabel(alert) {
19582
+ return `${alert.relationship === "unknown" ? "?" : alert.relationship.slice(0, 6)}/${alert.scope === "development" ? "dev" : alert.scope === "runtime" ? "run" : "?"}`;
19583
+ }
19584
+ function pad$3(raw, colored, width) {
19585
+ return colored + " ".repeat(Math.max(0, width - raw.length));
19586
+ }
19587
+ function columnsFor(showRepository) {
19588
+ return [
19589
+ {
19590
+ color: (alert, raw) => SEVERITY_COLOR[alert.severity](raw),
19591
+ header: "Severity",
19592
+ value: (alert) => alert.severity
19593
+ },
19594
+ ...showRepository ? [{
19595
+ color: (_alert, raw) => chalk.gray(raw),
19596
+ header: "Repository",
19597
+ value: (alert) => alert.repository ?? "-"
19598
+ }] : [],
19599
+ {
19600
+ color: (_alert, raw) => chalk.white(raw),
19601
+ header: "Package",
19602
+ value: (alert) => alert.packageName
19603
+ },
19604
+ {
19605
+ color: (_alert, raw) => chalk.gray(raw),
19606
+ header: "Kind",
19607
+ value: (alert) => relationshipLabel(alert)
19608
+ },
19609
+ {
19610
+ color: (_alert, raw) => chalk.gray(raw),
19611
+ header: "Vulnerable",
19612
+ value: (alert) => alert.vulnerableVersionRange.length > 0 ? alert.vulnerableVersionRange : "-"
19613
+ },
19614
+ {
19615
+ color: (_alert, raw) => chalk.green(raw),
19616
+ header: "Patched",
19617
+ value: (alert) => alert.patchedVersion ?? "none"
19618
+ },
19619
+ {
19620
+ color: (_alert, raw) => chalk.gray(raw),
19621
+ header: "Advisory",
19622
+ value: (alert) => alert.ghsaId.length > 0 ? alert.ghsaId : "-"
19623
+ }
19624
+ ];
19625
+ }
19626
+ function renderDependabotSummary(summary) {
19627
+ if (summary.availability === "no-gh") {
19628
+ console.log(chalk.gray("Dependabot: gh is unavailable or unauthenticated — skipped."));
19629
+ return;
19630
+ }
19631
+ if (summary.availability === "disabled") {
19632
+ console.log(chalk.gray(`Dependabot: alerts are disabled for ${summary.target || "this repository"}.`));
19633
+ return;
19634
+ }
19635
+ if (summary.total === 0) {
19636
+ console.log(chalk.green(`Dependabot: no open alerts for ${summary.target || "this repository"}.`));
19637
+ return;
19638
+ }
19639
+ const parts = summary.bySeverity.filter((entry) => entry.count > 0).map((entry) => SEVERITY_COLOR[entry.severity](`${entry.count} ${entry.severity}`));
19640
+ const scope = summary.repositories > 1 ? ` across ${summary.repositories} repos` : "";
19641
+ console.log(`Dependabot: ${chalk.bold(String(summary.total))} open alert${summary.total === 1 ? "" : "s"}${scope} — ${parts.join(", ")}`);
19642
+ }
19643
+ function renderDependabotAlerts(alerts, summary) {
19644
+ renderDependabotSummary(summary);
19645
+ if (alerts.length === 0) return;
19646
+ const columns = columnsFor(alerts.some((alert) => alert.repository !== void 0) && summary.repositories > 1);
19647
+ const widths = columns.map((column) => {
19648
+ let width = column.header.length;
19649
+ for (const alert of alerts) width = Math.max(width, column.value(alert).length);
19650
+ return Math.min(width, 44);
19651
+ });
19652
+ console.log(columns.map((column, index) => chalk.bold(column.header.padEnd(widths[index]))).join(" "));
19653
+ let separatorWidth = -2;
19654
+ for (const width of widths) separatorWidth += width + 2;
19655
+ console.log(chalk.gray("─".repeat(separatorWidth)));
19656
+ for (const alert of alerts) console.log(columns.map((column, index) => {
19657
+ const raw = column.value(alert).slice(0, widths[index]);
19658
+ return pad$3(raw, column.color(alert, raw), widths[index]);
19659
+ }).join(" "));
19660
+ }
19661
+ //#endregion
19662
+ //#region src/lib/secure/dependabot/summarizeDependabotAlerts.ts
19663
+ function filterDependabotAlerts(alerts, filter = {}) {
19664
+ const { relationship = "all", scope = "all" } = filter;
19665
+ return alerts.filter((alert) => {
19666
+ if (scope !== "all" && alert.scope !== scope) return false;
19667
+ if (relationship !== "all" && alert.relationship !== relationship) return false;
19668
+ return true;
19669
+ });
19670
+ }
19671
+ const SEVERITY_ORDER = new Map(DEPENDABOT_SEVERITIES.map((severity, index) => [severity, index]));
19672
+ function sortDependabotAlerts(alerts) {
19673
+ return [...alerts].toSorted((left, right) => {
19674
+ const severity = (SEVERITY_ORDER.get(left.severity) ?? 0) - (SEVERITY_ORDER.get(right.severity) ?? 0);
19675
+ if (severity !== 0) return severity;
19676
+ const repository = (left.repository ?? "").localeCompare(right.repository ?? "");
19677
+ if (repository !== 0) return repository;
19678
+ return left.packageName.localeCompare(right.packageName) || left.number - right.number;
19679
+ });
19680
+ }
19681
+ function summarizeDependabotAlerts(report) {
19682
+ const repositories = new Set(report.alerts.map((alert) => alert.repository).filter((name) => name !== void 0));
19683
+ return {
19684
+ availability: report.availability,
19685
+ bySeverity: DEPENDABOT_SEVERITIES.map((severity) => {
19686
+ const matching = report.alerts.filter((alert) => alert.severity === severity);
19687
+ return {
19688
+ count: matching.length,
19689
+ direct: matching.filter((alert) => alert.relationship === "direct").length,
19690
+ runtime: matching.filter((alert) => alert.scope === "runtime").length,
19691
+ severity
19692
+ };
19693
+ }),
19694
+ repositories: repositories.size,
19695
+ target: report.target,
19696
+ total: report.alerts.length
19697
+ };
19698
+ }
19699
+ //#endregion
19700
+ //#region src/lib/secure/dependabot/vulnerabilityAlerts.ts
19701
+ const VULNERABILITY_ALERTS_PATH = "repos/{owner}/{repo}/vulnerability-alerts";
19702
+ /**
19703
+ GitHub answers the disabled case with a 404 whose body says so. Match the
19704
+ message rather than the status, because a bare 404 also covers "no such repo"
19705
+ and "token cannot see it", which are not the same finding.
19706
+ */
19707
+ function isExplicitlyDisabled(text) {
19708
+ return text.includes("Vulnerability alerts are disabled");
19709
+ }
19710
+ /**
19711
+ One `gh` subprocess, no body: 204 when alerts are on, 404 when off. Deliberately
19712
+ skips the three-call `githubIsAvailable` probe — `gh api` already fails cleanly
19713
+ when gh is absent or unauthenticated, and this runs inside `xy repo lint`.
19714
+ */
19715
+ function dependabotAlertsStatus(cwd, runner = defaultGithubRunner) {
19716
+ const result = runner(["api", VULNERABILITY_ALERTS_PATH], { cwd });
19717
+ if (result.status === 0) return "enabled";
19718
+ return isExplicitlyDisabled(`${result.stderr}\n${result.stdout}`) ? "disabled" : "unknown";
19719
+ }
19720
+ /**
19721
+ Turn Dependabot alerts on. Requires admin on the repository; returns false
19722
+ rather than throwing when the token cannot make the change, so a fix pass
19723
+ reports the rule as still failing instead of claiming a fix it did not make.
19724
+ */
19725
+ function enableDependabotAlerts(cwd, runner = defaultGithubRunner) {
19726
+ return runner([
19727
+ "api",
19728
+ "--method",
19729
+ "PUT",
19730
+ VULNERABILITY_ALERTS_PATH
19731
+ ], { cwd }).status === 0;
19732
+ }
19733
+ //#endregion
19343
19734
  //#region src/lib/secure/fetchPackageSecurityMetadata.ts
19344
19735
  const REGISTRY_BASE$2 = "https://registry.npmjs.org";
19345
19736
  const DOWNLOADS_BASE = "https://api.npmjs.org/downloads/point/last-week";
@@ -19510,6 +19901,24 @@ const columns = [
19510
19901
  value: (row) => formatSecureDownloads(row.downloads)
19511
19902
  }
19512
19903
  ];
19904
+ /**
19905
+ One-line overview for `xy secure`; the full table lives in `xy secure deps`.
19906
+ */
19907
+ function renderSecureDepsSummary(rows) {
19908
+ if (rows.length === 0) {
19909
+ console.log(chalk.green("Deps: no external direct dependencies found."));
19910
+ return;
19911
+ }
19912
+ const red = rows.filter((row) => row.red).length;
19913
+ const oldPackages = rows.filter((row) => row.ageLevel === "red" || row.ageLevel === "yellow").length;
19914
+ const lowDownloads = rows.filter((row) => row.downloadsLevel === "red" || row.downloadsLevel === "yellow").length;
19915
+ const detail = [
19916
+ red > 0 ? chalk.red(`${red} red`) : chalk.green("0 red"),
19917
+ chalk.gray(`${oldPackages} aging`),
19918
+ chalk.gray(`${lowDownloads} low-download`)
19919
+ ].join(", ");
19920
+ console.log(`Deps: ${chalk.bold(String(rows.length))} direct dependenc${rows.length === 1 ? "y" : "ies"} — ${detail}`);
19921
+ }
19513
19922
  function renderSecurityAuditRows(rows) {
19514
19923
  if (rows.length === 0) {
19515
19924
  console.log(chalk.green("Secure: no external direct dependencies found."));
@@ -20175,7 +20584,7 @@ function getStore() {
20175
20584
  if (!store) throw new HookError("[Inquirer] Hook functions can only be called from within a prompt");
20176
20585
  return store;
20177
20586
  }
20178
- function readline$1() {
20587
+ function readline$2() {
20179
20588
  return getStore().rl;
20180
20589
  }
20181
20590
  function withUpdates(fn) {
@@ -20217,7 +20626,7 @@ const effectScheduler = {
20217
20626
  const { index } = store;
20218
20627
  store.hooksEffect.push(() => {
20219
20628
  store.hooksCleanup[index]?.();
20220
- const cleanFn = cb(readline$1());
20629
+ const cleanFn = cb(readline$2());
20221
20630
  if (cleanFn != null && typeof cleanFn !== "function") throw new ValidationError("useEffect return value must be a cleanup function or nothing.");
20222
20631
  store.hooksCleanup[index] = cleanFn;
20223
20632
  });
@@ -20514,7 +20923,7 @@ const stringVisibleTrimSpacesRight$1 = (string) => {
20514
20923
  if (last === words.length) return string;
20515
20924
  return words.slice(0, last).join(" ") + words.slice(last).join("");
20516
20925
  };
20517
- const exec$1 = (string, columns, options = {}) => {
20926
+ const exec$2 = (string, columns, options = {}) => {
20518
20927
  if (options.trim !== false && string.trim() === "") return "";
20519
20928
  let returnValue = "";
20520
20929
  let escapeCode;
@@ -20599,7 +21008,7 @@ const exec$1 = (string, columns, options = {}) => {
20599
21008
  };
20600
21009
  const CRLF_OR_LF = /\r?\n/;
20601
21010
  function wrapAnsi$1(string, columns, options) {
20602
- return String(string).normalize().split(CRLF_OR_LF).map((line) => exec$1(line, columns, options)).join("\n");
21011
+ return String(string).normalize().split(CRLF_OR_LF).map((line) => exec$2(line, columns, options)).join("\n");
20603
21012
  }
20604
21013
  //#endregion
20605
21014
  //#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.2.0/node_modules/@inquirer/core/dist/lib/utils.js
@@ -20624,7 +21033,7 @@ function breakLines(content, width) {
20624
21033
  function readlineWidth() {
20625
21034
  return (0, import_cli_width.default)({
20626
21035
  defaultWidth: 80,
20627
- output: readline$1().output
21036
+ output: readline$2().output
20628
21037
  });
20629
21038
  }
20630
21039
  //#endregion
@@ -21041,7 +21450,7 @@ function createPrompt(view) {
21041
21450
  const cleanups = /* @__PURE__ */ new Set();
21042
21451
  const output = new import_lib.default();
21043
21452
  output.pipe(context.output ?? process.stdout);
21044
- const rl = readline.createInterface({
21453
+ const rl = readline$1.createInterface({
21045
21454
  terminal: true,
21046
21455
  input,
21047
21456
  output
@@ -21383,8 +21792,8 @@ const MAJOR_CEILINGS = /* @__PURE__ */ new Map([["typescript", {
21383
21792
  reason: [
21384
21793
  "typescript@7 is the native compiler and exports no compiler API —",
21385
21794
  "ESLint, deplint, dead-code and api-exposure all load it from `typescript`.",
21386
- "Install it side by side instead: `\"typescript-native\": \"npm:typescript@7\"`",
21387
- "with `compile.compiler: \"native\"`."
21795
+ "Install it side by side instead: run `xy enable ts-native`, or add",
21796
+ "`\"typescript-native\": \"npm:typescript@7\"` with `compile.compiler: \"native\"`."
21388
21797
  ].join(" ")
21389
21798
  }]]);
21390
21799
  /**
@@ -22646,7 +23055,7 @@ const RULE_LEVELS$2 = /* @__PURE__ */ new Set([
22646
23055
  "off",
22647
23056
  "warn"
22648
23057
  ]);
22649
- function isRecord$7(value) {
23058
+ function isRecord$8(value) {
22650
23059
  return typeof value === "object" && value !== null && !Array.isArray(value);
22651
23060
  }
22652
23061
  function isValidWeight(value) {
@@ -22663,7 +23072,7 @@ function parseTupleRuleSetting(location, setting) {
22663
23072
  if (setting.length !== 2) throw new TypeError(`${location} tuple must be [level, options]`);
22664
23073
  const [level, options] = setting;
22665
23074
  if (!isRuleLevel$5(level)) throw new TypeError(`${location} level must be "error", "warn", or "off"`);
22666
- if (!isRecord$7(options)) throw new TypeError(`${location} options must be an object`);
23075
+ if (!isRecord$8(options)) throw new TypeError(`${location} options must be an object`);
22667
23076
  return {
22668
23077
  enabled: level !== "off",
22669
23078
  level,
@@ -22696,7 +23105,7 @@ function parseRuleSetting(location, setting) {
22696
23105
  weight: parseWeight(location, setting)
22697
23106
  };
22698
23107
  if (Array.isArray(setting)) return parseTupleRuleSetting(location, setting);
22699
- if (isRecord$7(setting)) return parseObjectRuleSetting(location, setting);
23108
+ if (isRecord$8(setting)) return parseObjectRuleSetting(location, setting);
22700
23109
  throw new TypeError(`${location} must be a boolean, rule level, number, "infinite", [level, options], or { enabled?, level?, weight? } object`);
22701
23110
  }
22702
23111
  function validateRuleIds(location, rules) {
@@ -25771,18 +26180,18 @@ function findXyConfigFile(dir) {
25771
26180
  if (fs.existsSync(candidate)) return candidate;
25772
26181
  }
25773
26182
  }
25774
- function isJsonConfigPath(configPath) {
26183
+ function isJsonConfigPath$1(configPath) {
25775
26184
  const base = PATH.basename(configPath);
25776
26185
  return base === ".xyrc.json" || base.endsWith(".json");
25777
26186
  }
25778
- function getPropertyName$2(prop) {
26187
+ function getPropertyName$3(prop) {
25779
26188
  if (ts.isPropertyAssignment(prop)) {
25780
26189
  const { name } = prop;
25781
26190
  if (ts.isIdentifier(name) || ts.isStringLiteral(name) || ts.isNoSubstitutionTemplateLiteral(name)) return name.text;
25782
26191
  }
25783
26192
  if (ts.isShorthandPropertyAssignment(prop)) return prop.name.text;
25784
26193
  }
25785
- function isWhitespace$1(char) {
26194
+ function isWhitespace$2(char) {
25786
26195
  return char !== void 0 && /\s/.test(char);
25787
26196
  }
25788
26197
  /**
@@ -25793,9 +26202,9 @@ function findDeplintPackagesAssignment(sourceFile) {
25793
26202
  let found;
25794
26203
  function visit(node) {
25795
26204
  if (found !== void 0) return;
25796
- if (ts.isPropertyAssignment(node) && getPropertyName$2(node) === "packages" && ts.isObjectLiteralExpression(node.initializer)) {
26205
+ if (ts.isPropertyAssignment(node) && getPropertyName$3(node) === "packages" && ts.isObjectLiteralExpression(node.initializer)) {
25797
26206
  const parentObject = node.parent;
25798
- if (ts.isObjectLiteralExpression(parentObject) && ts.isPropertyAssignment(parentObject.parent) && getPropertyName$2(parentObject.parent) === "deplint") {
26207
+ if (ts.isObjectLiteralExpression(parentObject) && ts.isPropertyAssignment(parentObject.parent) && getPropertyName$3(parentObject.parent) === "deplint") {
25799
26208
  found = node;
25800
26209
  return;
25801
26210
  }
@@ -25809,7 +26218,7 @@ function findDeplintObjectAssignment(sourceFile) {
25809
26218
  let found;
25810
26219
  function visit(node) {
25811
26220
  if (found !== void 0) return;
25812
- if (ts.isPropertyAssignment(node) && getPropertyName$2(node) === "deplint" && ts.isObjectLiteralExpression(node.initializer)) {
26221
+ if (ts.isPropertyAssignment(node) && getPropertyName$3(node) === "deplint" && ts.isObjectLiteralExpression(node.initializer)) {
25813
26222
  found = node;
25814
26223
  return;
25815
26224
  }
@@ -25822,7 +26231,7 @@ function findCommandsObjectAssignment(sourceFile) {
25822
26231
  let found;
25823
26232
  function visit(node) {
25824
26233
  if (found !== void 0) return;
25825
- if (ts.isPropertyAssignment(node) && getPropertyName$2(node) === "commands" && ts.isObjectLiteralExpression(node.initializer)) {
26234
+ if (ts.isPropertyAssignment(node) && getPropertyName$3(node) === "commands" && ts.isObjectLiteralExpression(node.initializer)) {
25826
26235
  found = node;
25827
26236
  return;
25828
26237
  }
@@ -25831,7 +26240,7 @@ function findCommandsObjectAssignment(sourceFile) {
25831
26240
  visit(sourceFile);
25832
26241
  return found;
25833
26242
  }
25834
- function findDefaultExportObject(sourceFile) {
26243
+ function findDefaultExportObject$1(sourceFile) {
25835
26244
  for (const statement of sourceFile.statements) {
25836
26245
  if (ts.isExportAssignment(statement) && !statement.isExportEquals && ts.isObjectLiteralExpression(statement.expression)) return statement.expression;
25837
26246
  if (!ts.isVariableStatement(statement)) continue;
@@ -25854,7 +26263,7 @@ function formatPackageConfigValue(config) {
25854
26263
  if (config.refType !== void 0) parts.push(`refType: '${config.refType}'`);
25855
26264
  return `{ ${parts.join(", ")} }`;
25856
26265
  }
25857
- function detectIndent$1(text, packagesObject, sourceFile) {
26266
+ function detectIndent$2(text, packagesObject, sourceFile) {
25858
26267
  if (packagesObject.properties.length > 0) {
25859
26268
  const start = packagesObject.properties[0].getStart(sourceFile);
25860
26269
  let lineStart = start;
@@ -25870,18 +26279,18 @@ function detectIndent$1(text, packagesObject, sourceFile) {
25870
26279
  function findPackageProperty(packagesObject, dependency) {
25871
26280
  for (const prop of packagesObject.properties) {
25872
26281
  if (!ts.isPropertyAssignment(prop)) continue;
25873
- if (getPropertyName$2(prop) === dependency) return prop;
26282
+ if (getPropertyName$3(prop) === dependency) return prop;
25874
26283
  }
25875
26284
  }
25876
- function removePropertyFromObject(text, prop, sourceFile) {
26285
+ function removePropertyFromObject$1(text, prop, sourceFile) {
25877
26286
  let start = prop.getFullStart();
25878
26287
  let end = prop.getEnd();
25879
26288
  let cursor = end;
25880
- while (isWhitespace$1(text[cursor])) cursor++;
26289
+ while (isWhitespace$2(text[cursor])) cursor++;
25881
26290
  if (text[cursor] === ",") end = cursor + 1;
25882
26291
  else {
25883
26292
  let back = prop.getStart(sourceFile) - 1;
25884
- while (back >= 0 && isWhitespace$1(text[back])) back--;
26293
+ while (back >= 0 && isWhitespace$2(text[back])) back--;
25885
26294
  if (text[back] === ",") start = back;
25886
26295
  }
25887
26296
  return `${text.slice(0, start)}${text.slice(end)}`;
@@ -25892,7 +26301,7 @@ function upsertPackagePropertyInObject(text, packagesAssignment, sourceFile, dep
25892
26301
  const existing = findPackageProperty(packagesObject, dependency);
25893
26302
  if (config === void 0) {
25894
26303
  if (existing === void 0) return text;
25895
- return removePropertyFromObject(text, existing, sourceFile);
26304
+ return removePropertyFromObject$1(text, existing, sourceFile);
25896
26305
  }
25897
26306
  if (existing !== void 0) {
25898
26307
  const valueText = formatPackageConfigValue(config);
@@ -25902,7 +26311,7 @@ function upsertPackagePropertyInObject(text, packagesAssignment, sourceFile, dep
25902
26311
  }
25903
26312
  const valueText = formatPackageConfigValue(config);
25904
26313
  const keyText = quotePackageKey(dependency);
25905
- const indent = detectIndent$1(text, packagesObject, sourceFile);
26314
+ const indent = detectIndent$2(text, packagesObject, sourceFile);
25906
26315
  const entry = `${keyText}: ${valueText}`;
25907
26316
  const openBraceEnd = packagesObject.getStart(sourceFile) + 1;
25908
26317
  const insertion = `\n${indent}${entry},`;
@@ -25911,7 +26320,7 @@ function upsertPackagePropertyInObject(text, packagesAssignment, sourceFile, dep
25911
26320
  function insertPackagesIntoDeplint(text, deplintAssignment, sourceFile, dependency, config) {
25912
26321
  if (!ts.isObjectLiteralExpression(deplintAssignment.initializer)) throw new TypeError("deplint must be an object literal");
25913
26322
  const deplintObject = deplintAssignment.initializer;
25914
- const indent = detectIndent$1(text, deplintObject, sourceFile);
26323
+ const indent = detectIndent$2(text, deplintObject, sourceFile);
25915
26324
  const packagesBlock = `packages: {\n${indent} ${quotePackageKey(dependency)}: ${formatPackageConfigValue(config)},\n${indent}}`;
25916
26325
  const openBraceEnd = deplintObject.getStart(sourceFile) + 1;
25917
26326
  const insertion = `\n${indent}${packagesBlock},`;
@@ -25920,7 +26329,7 @@ function insertPackagesIntoDeplint(text, deplintAssignment, sourceFile, dependen
25920
26329
  function insertDeplintIntoCommands(text, commandsAssignment, sourceFile, dependency, config) {
25921
26330
  if (!ts.isObjectLiteralExpression(commandsAssignment.initializer)) throw new TypeError("commands must be an object literal");
25922
26331
  const commandsObject = commandsAssignment.initializer;
25923
- const indent = detectIndent$1(text, commandsObject, sourceFile);
26332
+ const indent = detectIndent$2(text, commandsObject, sourceFile);
25924
26333
  const block = [
25925
26334
  "deplint: {",
25926
26335
  `${indent} packages: {`,
@@ -25933,7 +26342,7 @@ function insertDeplintIntoCommands(text, commandsAssignment, sourceFile, depende
25933
26342
  return `${text.slice(0, openBraceEnd)}${insertion}${text.slice(openBraceEnd)}`;
25934
26343
  }
25935
26344
  function insertCommandsIntoConfigObject(text, configObject, sourceFile, dependency, config) {
25936
- const indent = detectIndent$1(text, configObject, sourceFile);
26345
+ const indent = detectIndent$2(text, configObject, sourceFile);
25937
26346
  const block = [
25938
26347
  "commands: {",
25939
26348
  `${indent} deplint: {`,
@@ -25972,7 +26381,7 @@ function applyPackageEditsToTsSource(text, edits) {
25972
26381
  result = insertDeplintIntoCommands(result, commandsAssignment, sourceFile, edit.dependency, edit.config);
25973
26382
  continue;
25974
26383
  }
25975
- const configObject = findDefaultExportObject(sourceFile);
26384
+ const configObject = findDefaultExportObject$1(sourceFile);
25976
26385
  if (configObject !== void 0) {
25977
26386
  result = insertCommandsIntoConfigObject(result, configObject, sourceFile, edit.dependency, edit.config);
25978
26387
  continue;
@@ -25981,11 +26390,11 @@ function applyPackageEditsToTsSource(text, edits) {
25981
26390
  }
25982
26391
  return result;
25983
26392
  }
25984
- function isRecord$6(value) {
26393
+ function isRecord$7(value) {
25985
26394
  return typeof value === "object" && value !== null && !Array.isArray(value);
25986
26395
  }
25987
26396
  function readJsonPackageConfig(value) {
25988
- if (!isRecord$6(value)) return void 0;
26397
+ if (!isRecord$7(value)) return void 0;
25989
26398
  const config = {};
25990
26399
  if (typeof value.placement === "string") config.placement = value.placement;
25991
26400
  if (typeof value.presence === "string") config.presence = value.presence;
@@ -25994,10 +26403,10 @@ function readJsonPackageConfig(value) {
25994
26403
  return config;
25995
26404
  }
25996
26405
  function resolveJsonDeplintObject(root) {
25997
- const commands = isRecord$6(root.commands) ? root.commands : void 0;
25998
- if (commands !== void 0 && isRecord$6(commands.deplint)) return commands.deplint;
25999
- if (isRecord$6(root.deplint)) return root.deplint;
26000
- if (!isRecord$6(root.commands)) root.commands = {};
26406
+ const commands = isRecord$7(root.commands) ? root.commands : void 0;
26407
+ if (commands !== void 0 && isRecord$7(commands.deplint)) return commands.deplint;
26408
+ if (isRecord$7(root.deplint)) return root.deplint;
26409
+ if (!isRecord$7(root.commands)) root.commands = {};
26001
26410
  const cmds = root.commands;
26002
26411
  const deplint = {};
26003
26412
  cmds.deplint = deplint;
@@ -26010,7 +26419,7 @@ function applyPackageEditsToJsonSource(text, edits) {
26010
26419
  if (edits.length === 0) return text;
26011
26420
  const root = JSON.parse(text);
26012
26421
  const deplint = resolveJsonDeplintObject(root);
26013
- const packages = isRecord$6(deplint.packages) ? deplint.packages : deplint.packages = {};
26422
+ const packages = isRecord$7(deplint.packages) ? deplint.packages : deplint.packages = {};
26014
26423
  for (const edit of edits) if (edit.config === void 0) delete packages[edit.dependency];
26015
26424
  else packages[edit.dependency] = edit.config;
26016
26425
  if (Object.keys(packages).length === 0) delete deplint.packages;
@@ -26020,7 +26429,7 @@ function readPackageConfigFromObjectLiteral(objectLiteral) {
26020
26429
  const config = {};
26021
26430
  for (const prop of objectLiteral.properties) {
26022
26431
  if (!ts.isPropertyAssignment(prop)) continue;
26023
- const key = getPropertyName$2(prop);
26432
+ const key = getPropertyName$3(prop);
26024
26433
  if (key === void 0) continue;
26025
26434
  const { initializer } = prop;
26026
26435
  if ([
@@ -26043,11 +26452,11 @@ Read `commands.deplint.packages` (or top-level `deplint.packages`) from a config
26043
26452
  function readPackagesFromConfigFile(configPath) {
26044
26453
  const text = fs.readFileSync(configPath, "utf8");
26045
26454
  const result = /* @__PURE__ */ new Map();
26046
- if (isJsonConfigPath(configPath)) try {
26455
+ if (isJsonConfigPath$1(configPath)) try {
26047
26456
  const root = JSON.parse(text);
26048
- const commands = isRecord$6(root.commands) ? root.commands : void 0;
26049
- const deplint = commands !== void 0 && isRecord$6(commands.deplint) ? commands.deplint : isRecord$6(root.deplint) ? root.deplint : void 0;
26050
- const packages = deplint !== void 0 && isRecord$6(deplint.packages) ? deplint.packages : void 0;
26457
+ const commands = isRecord$7(root.commands) ? root.commands : void 0;
26458
+ const deplint = commands !== void 0 && isRecord$7(commands.deplint) ? commands.deplint : isRecord$7(root.deplint) ? root.deplint : void 0;
26459
+ const packages = deplint !== void 0 && isRecord$7(deplint.packages) ? deplint.packages : void 0;
26051
26460
  if (packages === void 0) return result;
26052
26461
  for (const [name, value] of Object.entries(packages)) {
26053
26462
  const config = readJsonPackageConfig(value);
@@ -26061,7 +26470,7 @@ function readPackagesFromConfigFile(configPath) {
26061
26470
  if (packagesAssignment === void 0 || !ts.isObjectLiteralExpression(packagesAssignment.initializer)) return result;
26062
26471
  for (const prop of packagesAssignment.initializer.properties) {
26063
26472
  if (!ts.isPropertyAssignment(prop)) continue;
26064
- const name = getPropertyName$2(prop);
26473
+ const name = getPropertyName$3(prop);
26065
26474
  if (name === void 0 || !ts.isObjectLiteralExpression(prop.initializer)) continue;
26066
26475
  result.set(name, readPackageConfigFromObjectLiteral(prop.initializer));
26067
26476
  }
@@ -26106,7 +26515,7 @@ function applyPackageEditsToConfigDir(dir, edits) {
26106
26515
  return configPath;
26107
26516
  }
26108
26517
  const before = fs.readFileSync(existingPath, "utf8");
26109
- const after = isJsonConfigPath(existingPath) ? applyPackageEditsToJsonSource(before, edits) : applyPackageEditsToTsSource(before, edits);
26518
+ const after = isJsonConfigPath$1(existingPath) ? applyPackageEditsToJsonSource(before, edits) : applyPackageEditsToTsSource(before, edits);
26110
26519
  if (after === before) return void 0;
26111
26520
  fs.writeFileSync(existingPath, after, "utf8");
26112
26521
  return existingPath;
@@ -26393,7 +26802,7 @@ const BUILT_IN_RULE_OPTION_KEYS = {
26393
26802
  ]),
26394
26803
  "dep.workspace.protocol": /* @__PURE__ */ new Set(["ignore", "protocol"])
26395
26804
  };
26396
- function isRecord$5(value) {
26805
+ function isRecord$6(value) {
26397
26806
  return typeof value === "object" && value !== null && !Array.isArray(value);
26398
26807
  }
26399
26808
  function isRuleLevel$4(value) {
@@ -26430,7 +26839,7 @@ function parseRuleConfig$1(ruleId, value) {
26430
26839
  const level = value[0];
26431
26840
  if (!isRuleLevel$4(level)) throw new TypeError(`${formatRuleConfigLocation$1(ruleId)} level must be one of "off", "warn", or "error"`);
26432
26841
  const options = value[1];
26433
- if (!isRecord$5(options)) throw new TypeError(`${formatRuleConfigLocation$1(ruleId)} options must be an object`);
26842
+ if (!isRecord$6(options)) throw new TypeError(`${formatRuleConfigLocation$1(ruleId)} options must be an object`);
26434
26843
  return {
26435
26844
  level,
26436
26845
  options: { ...options }
@@ -26882,7 +27291,7 @@ const npmPackageNamePattern = /^@?[a-z0-9][\w./-]*$/i;
26882
27291
  function isStorybookMainFile(filePath) {
26883
27292
  return storybookMainPattern.test(filePath);
26884
27293
  }
26885
- function getPropertyName$1(prop) {
27294
+ function getPropertyName$2(prop) {
26886
27295
  if (ts.isIdentifier(prop.name)) return prop.name.text;
26887
27296
  if (ts.isStringLiteral(prop.name) || ts.isNoSubstitutionTemplateLiteral(prop.name)) return prop.name.text;
26888
27297
  }
@@ -26899,7 +27308,7 @@ function extractFromEntry(node, collected) {
26899
27308
  return;
26900
27309
  }
26901
27310
  if (ts.isObjectLiteralExpression(node)) {
26902
- for (const prop of node.properties) if (ts.isPropertyAssignment(prop) && getPropertyName$1(prop) === "name") extractFromEntry(prop.initializer, collected);
27311
+ for (const prop of node.properties) if (ts.isPropertyAssignment(prop) && getPropertyName$2(prop) === "name") extractFromEntry(prop.initializer, collected);
26903
27312
  return;
26904
27313
  }
26905
27314
  if (ts.isCallExpression(node)) {
@@ -26916,7 +27325,7 @@ function getStorybookConfigImports(filePath, importPaths) {
26916
27325
  const collected = [];
26917
27326
  function visit(node) {
26918
27327
  if (ts.isPropertyAssignment(node)) {
26919
- const name = getPropertyName$1(node);
27328
+ const name = getPropertyName$2(node);
26920
27329
  if (name === "addons") {
26921
27330
  if (ts.isArrayLiteralExpression(node.initializer)) for (const element of node.initializer.elements) extractFromEntry(element, collected);
26922
27331
  } else if (name === "framework" || name === "builder") extractFromEntry(node.initializer, collected);
@@ -27160,7 +27569,7 @@ function getMostUsedKey(indents) {
27160
27569
  function makeIndentString(type, amount) {
27161
27570
  return (type === INDENT_TYPE_SPACE ? " " : " ").repeat(amount);
27162
27571
  }
27163
- function detectIndent(string) {
27572
+ function detectIndent$1(string) {
27164
27573
  if (typeof string !== "string") throw new TypeError("Expected a string");
27165
27574
  let indents = makeIndentsMap(string, true);
27166
27575
  if (indents.size === 0) indents = makeIndentsMap(string, false);
@@ -27796,7 +28205,7 @@ const defaultSortOrder = fields.map(({ key }) => key);
27796
28205
  const overFields = pipe(fields.map(({ key, over }) => over ? overProperty(key, over) : void 0).filter(Boolean));
27797
28206
  function editStringJSON(json, over) {
27798
28207
  if (typeof json === "string") {
27799
- const { indent, type } = detectIndent(json);
28208
+ const { indent, type } = detectIndent$1(json);
27800
28209
  const endCharacters = json.slice(-1) === "\n" ? "\n" : "";
27801
28210
  const newline = detectNewlineGraceful(json);
27802
28211
  json = JSON.parse(json);
@@ -32924,6 +33333,18 @@ const resolveCompilePlatforms = (compile) => {
32924
33333
  };
32925
33334
  };
32926
33335
  //#endregion
33336
+ //#region src/actions/package/compile/resolveTscBin.ts
33337
+ /**
33338
+ * Default `package.json` key the native compiler is expected under:
33339
+ * `"typescript-native": "npm:typescript@~7.0.2"`. Override per package with
33340
+ * `compile.nativePackage`.
33341
+ */
33342
+ const DEFAULT_NATIVE_PACKAGE = "typescript-native";
33343
+ /**
33344
+ * Full `package.json` alias spec for {@link DEFAULT_NATIVE_PACKAGE}.
33345
+ */
33346
+ const DEFAULT_NATIVE_ALIAS_SPEC = `npm:typescript@~7.0.2`;
33347
+ //#endregion
32927
33348
  //#region src/actions/package/compile/monolithCopyEntries.ts
32928
33349
  const copyPlatforms = /* @__PURE__ */ new Set([
32929
33350
  "browser",
@@ -33036,7 +33457,7 @@ function findConfigFile(pkgDir) {
33036
33457
  if (fs.existsSync(candidate)) return candidate;
33037
33458
  }
33038
33459
  }
33039
- function getPropertyName(prop) {
33460
+ function getPropertyName$1(prop) {
33040
33461
  if (!ts.isPropertyAssignment(prop)) return void 0;
33041
33462
  const { name } = prop;
33042
33463
  if (ts.isIdentifier(name) || ts.isStringLiteral(name)) return name.text;
@@ -33049,15 +33470,15 @@ function getPropertyName(prop) {
33049
33470
  function collectEmptyTargetProps(sourceFile) {
33050
33471
  const found = [];
33051
33472
  function visit(node) {
33052
- if (ts.isPropertyAssignment(node) && getPropertyName(node) === "compile" && ts.isObjectLiteralExpression(node.initializer)) {
33053
- for (const prop of node.initializer.properties) if (ts.isPropertyAssignment(prop) && COMPILE_TARGET_NAMES.has(getPropertyName(prop) ?? "") && ts.isObjectLiteralExpression(prop.initializer) && prop.initializer.properties.length === 0) found.push(prop);
33473
+ if (ts.isPropertyAssignment(node) && getPropertyName$1(node) === "compile" && ts.isObjectLiteralExpression(node.initializer)) {
33474
+ for (const prop of node.initializer.properties) if (ts.isPropertyAssignment(prop) && COMPILE_TARGET_NAMES.has(getPropertyName$1(prop) ?? "") && ts.isObjectLiteralExpression(prop.initializer) && prop.initializer.properties.length === 0) found.push(prop);
33054
33475
  }
33055
33476
  ts.forEachChild(node, visit);
33056
33477
  }
33057
33478
  visit(sourceFile);
33058
33479
  return found;
33059
33480
  }
33060
- function isWhitespace(char) {
33481
+ function isWhitespace$1(char) {
33061
33482
  return char !== void 0 && /\s/.test(char);
33062
33483
  }
33063
33484
  /**
@@ -33073,11 +33494,11 @@ function removeProperties(text, props, sourceFile) {
33073
33494
  let start = prop.getFullStart();
33074
33495
  let end = prop.getEnd();
33075
33496
  let cursor = end;
33076
- while (isWhitespace(result[cursor])) cursor++;
33497
+ while (isWhitespace$1(result[cursor])) cursor++;
33077
33498
  if (result[cursor] === ",") end = cursor + 1;
33078
33499
  else {
33079
33500
  let back = prop.getStart(sourceFile) - 1;
33080
- while (back >= 0 && isWhitespace(result[back])) back--;
33501
+ while (back >= 0 && isWhitespace$1(result[back])) back--;
33081
33502
  if (result[back] === ",") start = back;
33082
33503
  }
33083
33504
  result = result.slice(0, start) + result.slice(end);
@@ -33101,9 +33522,9 @@ function checkCompileTargets(pkgDir, shouldFix) {
33101
33522
  const configName = PATH.basename(configPath);
33102
33523
  if (shouldFix) {
33103
33524
  fs.writeFileSync(configPath, removeProperties(text, emptyProps, sourceFile));
33104
- for (const prop of emptyProps) console.warn(chalk.yellow(`Publint [compileTargets]: removed deprecated empty "compile.${getPropertyName(prop)}" target from ${configName}`));
33525
+ for (const prop of emptyProps) console.warn(chalk.yellow(`Publint [compileTargets]: removed deprecated empty "compile.${getPropertyName$1(prop)}" target from ${configName}`));
33105
33526
  result.modified = true;
33106
- } else for (const prop of emptyProps) console.warn(chalk.yellow(`Publint [compileTargets]: "compile.${getPropertyName(prop)} = {}" is treated as "do not build" — set it to \`false\` or remove it (use --fix to remove) in ${configName}`));
33527
+ } else for (const prop of emptyProps) console.warn(chalk.yellow(`Publint [compileTargets]: "compile.${getPropertyName$1(prop)} = {}" is treated as "do not build" — set it to \`false\` or remove it (use --fix to remove) in ${configName}`));
33107
33528
  result.warnings += emptyProps.length;
33108
33529
  return result;
33109
33530
  }
@@ -33358,7 +33779,7 @@ function formatExportPath$1(pathParts) {
33358
33779
  function ensureExportsPath$1(value) {
33359
33780
  return value.startsWith("./") ? value : `./${value}`;
33360
33781
  }
33361
- function isRecord$4(value) {
33782
+ function isRecord$5(value) {
33362
33783
  return typeof value === "object" && value !== null && !Array.isArray(value);
33363
33784
  }
33364
33785
  function normalizeTarget(target) {
@@ -33395,7 +33816,7 @@ function collectExportLeaves(value, subpath = ".", pathParts = ["exports"], cond
33395
33816
  }];
33396
33817
  }
33397
33818
  if (Array.isArray(value)) return value.flatMap((entry, index) => collectExportLeaves(entry, subpath, [...pathParts, `[${index}]`], conditionPath));
33398
- if (!isRecord$4(value)) return [];
33819
+ if (!isRecord$5(value)) return [];
33399
33820
  return Object.entries(value).flatMap(([key, nested]) => {
33400
33821
  if (isSubpathExportKey$1(key)) return collectExportLeaves(nested, key, [...pathParts, key], conditionPath);
33401
33822
  return collectExportLeaves(nested, subpath, [...pathParts, key], [...conditionPath, key]);
@@ -33493,14 +33914,14 @@ function shouldNormalizeExportsForFix(pkg) {
33493
33914
  pkg.exports = { ".": pkg.exports };
33494
33915
  return true;
33495
33916
  }
33496
- if (isRecord$4(pkg.exports) && !hasSubpathKeys(pkg.exports)) {
33917
+ if (isRecord$5(pkg.exports) && !hasSubpathKeys(pkg.exports)) {
33497
33918
  pkg.exports = { ".": pkg.exports };
33498
33919
  return true;
33499
33920
  }
33500
33921
  return false;
33501
33922
  }
33502
33923
  function isRecordObject(value) {
33503
- return isRecord$4(value);
33924
+ return isRecord$5(value);
33504
33925
  }
33505
33926
  function ensureSubpath(exports, subpath) {
33506
33927
  const existing = exports[subpath];
@@ -34044,45 +34465,45 @@ function cloneResolvedPublintRules(rules) {
34044
34465
  };
34045
34466
  }
34046
34467
  //#endregion
34047
- //#region ../../node_modules/.pnpm/tinyexec@1.2.4/node_modules/tinyexec/dist/main.mjs
34048
- function _(e) {
34049
- for (const t in e) {
34050
- if (!Object.prototype.hasOwnProperty.call(e, t) || !h.test(t)) continue;
34051
- const n = e[t];
34052
- if (!n) return g;
34468
+ //#region ../../node_modules/.pnpm/tinyexec@1.3.0/node_modules/tinyexec/dist/main.mjs
34469
+ function getPathFromEnv(env) {
34470
+ for (const key in env) {
34471
+ if (!Object.prototype.hasOwnProperty.call(env, key) || !isPathLikePattern.test(key)) continue;
34472
+ const value = env[key];
34473
+ if (!value) return defaultEnvPathInfo;
34053
34474
  return {
34054
- key: t,
34055
- value: n
34475
+ key,
34476
+ value
34056
34477
  };
34057
34478
  }
34058
- return g;
34479
+ return defaultEnvPathInfo;
34059
34480
  }
34060
- function v(e, t) {
34061
- const n = t.value.split(delimiter);
34062
- const r = [];
34063
- let o = e;
34064
- let c;
34481
+ function addNodeBinToPath(cwd, path) {
34482
+ const parts = path.value.split(delimiter);
34483
+ const nodeBinPaths = [];
34484
+ let currentPath = cwd;
34485
+ let lastPath;
34065
34486
  do {
34066
- r.push(resolve(o, "node_modules", ".bin"));
34067
- c = o;
34068
- o = dirname(o);
34069
- } while (o !== c);
34070
- r.push(dirname(process.execPath));
34071
- const l = r.concat(n).join(delimiter);
34487
+ nodeBinPaths.push(resolve(currentPath, "node_modules", ".bin"));
34488
+ lastPath = currentPath;
34489
+ currentPath = dirname(currentPath);
34490
+ } while (currentPath !== lastPath);
34491
+ nodeBinPaths.push(dirname(process.execPath));
34492
+ const newPath = nodeBinPaths.concat(parts).join(delimiter);
34072
34493
  return {
34073
- key: t.key,
34074
- value: l
34494
+ key: path.key,
34495
+ value: newPath
34075
34496
  };
34076
34497
  }
34077
- function y(e, t, n = true) {
34078
- const r = {
34498
+ function computeEnv(cwd, env, nodePath = true) {
34499
+ const envWithDefault = {
34079
34500
  ...process.env,
34080
- ...t
34501
+ ...env
34081
34502
  };
34082
- if (!n) return r;
34083
- const i = v(e, _(r));
34084
- r[i.key] = i.value;
34085
- return r;
34503
+ if (!nodePath) return envWithDefault;
34504
+ const envPathInfo = addNodeBinToPath(cwd, getPathFromEnv(envWithDefault));
34505
+ envWithDefault[envPathInfo.key] = envPathInfo.value;
34506
+ return envWithDefault;
34086
34507
  }
34087
34508
  /**
34088
34509
  * Normalizes the command and arguments to work cross-platform.
@@ -34090,157 +34511,168 @@ function y(e, t, n = true) {
34090
34511
  * `node_modules/.bin` commands, and escaping meta characters.
34091
34512
  * On other platforms, it just returns the command and arguments as-is.
34092
34513
  */
34093
- function D(e, t = [], n = {}) {
34094
- if (n.shell === true || !T) return {
34095
- command: e,
34096
- args: t,
34097
- options: n
34098
- };
34099
- let i = O(e, n);
34100
- let a = null;
34101
- if (i !== null) {
34102
- const e = 150;
34103
- const t = Buffer.alloc(e);
34104
- let n = null;
34514
+ function normalizeSpawnCommand(command, args = [], options = {}) {
34515
+ if (options.shell === true || !isWindows) return {
34516
+ command,
34517
+ args,
34518
+ options
34519
+ };
34520
+ let file = resolveCommand(command, options);
34521
+ let shebang = null;
34522
+ if (file !== null) {
34523
+ const size = 150;
34524
+ const buffer = Buffer.alloc(size);
34525
+ let fd = null;
34105
34526
  try {
34106
- n = openSync(i, "r");
34107
- readSync(n, t, 0, e, 0);
34527
+ fd = openSync(file, "r");
34528
+ readSync(fd, buffer, 0, size, 0);
34108
34529
  } catch {} finally {
34109
- if (n !== null) closeSync(n);
34110
- }
34111
- const o = t.toString().match(S);
34112
- if (o !== null) {
34113
- const e = o[1].trim();
34114
- const t = e.indexOf(" ");
34115
- const n = t !== -1 ? e.slice(0, t) : e;
34116
- const i = t !== -1 ? e.slice(t + 1) : "";
34117
- const s = basename(n);
34118
- a = s === "env" ? i || null : s;
34119
- }
34120
- }
34121
- if (a !== null && i !== null) {
34122
- t = [i, ...t];
34123
- e = a;
34124
- i = O(e, n);
34125
- }
34126
- if (i === null || !C.test(i)) {
34127
- const r = i !== null && w.test(i);
34128
- e = normalize(e);
34129
- e = e.replace(x, "^$1");
34130
- t = t.map((e) => {
34131
- e = e.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
34132
- e = e.replace(/(?=(\\+?)?)\1$/, "$1$1");
34133
- e = `"${e}"`;
34134
- e = e.replace(x, "^$1");
34135
- if (r) e = e.replace(x, "^$1");
34136
- return e;
34530
+ if (fd !== null) closeSync(fd);
34531
+ }
34532
+ const match = buffer.toString().match(shebangRegExp);
34533
+ if (match !== null) {
34534
+ const line = match[1].trim();
34535
+ const separatorIndex = line.indexOf(" ");
34536
+ const path = separatorIndex !== -1 ? line.slice(0, separatorIndex) : line;
34537
+ const argument = separatorIndex !== -1 ? line.slice(separatorIndex + 1) : "";
34538
+ const binary = basename(path);
34539
+ shebang = binary === "env" ? argument || null : binary;
34540
+ }
34541
+ }
34542
+ if (shebang !== null && file !== null) {
34543
+ args = [file, ...args];
34544
+ command = shebang;
34545
+ file = resolveCommand(command, options);
34546
+ }
34547
+ if (file === null || !isWindowsExecutableRegExp.test(file)) {
34548
+ const needsDoubleEscapeMetaChars = file !== null && isNodeModulesCmdRegExp.test(file);
34549
+ command = normalize(command);
34550
+ command = command.replace(metaCharsRegExp, "^$1");
34551
+ args = args.map((arg) => {
34552
+ arg = arg.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
34553
+ arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
34554
+ arg = `"${arg}"`;
34555
+ arg = arg.replace(metaCharsRegExp, "^$1");
34556
+ if (needsDoubleEscapeMetaChars) arg = arg.replace(metaCharsRegExp, "^$1");
34557
+ return arg;
34137
34558
  });
34138
- t = [
34559
+ args = [
34139
34560
  "/d",
34140
34561
  "/s",
34141
34562
  "/c",
34142
- `"${[e, ...t].join(" ")}"`
34563
+ `"${[command, ...args].join(" ")}"`
34143
34564
  ];
34144
- e = n.env?.comspec ?? "cmd.exe";
34145
- n = {
34146
- ...n,
34565
+ command = options.env?.comspec ?? "cmd.exe";
34566
+ options = {
34567
+ ...options,
34147
34568
  windowsVerbatimArguments: true
34148
34569
  };
34149
34570
  }
34150
34571
  return {
34151
- command: e,
34152
- args: t,
34153
- options: n
34572
+ command,
34573
+ args,
34574
+ options
34154
34575
  };
34155
34576
  }
34156
34577
  /**
34157
34578
  * Resolves the command to an absolute path if possible.
34158
34579
  * Handles things like traversing PATH and adding extensions from PATHEXT
34159
34580
  */
34160
- function O(e, t) {
34161
- const r = (t.cwd ?? cwd()).toString();
34162
- const a = t.env ?? process.env;
34163
- const o = _(a).value;
34164
- const c = e.includes("/") || e.includes("\\") ? [""] : [r, ...o.split(delimiter)];
34165
- const l = a.PATHEXT ? a.PATHEXT.split(delimiter) : E;
34166
- if (e.includes(".") && l[0] !== "") l.unshift("");
34167
- for (const t of c) {
34168
- const n = resolve(r, t.startsWith("\"") && t.endsWith("\"") && t.length > 1 ? t.slice(1, -1) : t, e);
34169
- for (const e of l) {
34170
- const t = n + e;
34581
+ function resolveCommand(command, options) {
34582
+ const cwd$3 = (options.cwd ?? cwd()).toString();
34583
+ const env = options.env ?? process.env;
34584
+ const PATH = getPathFromEnv(env).value;
34585
+ const pathEnv = command.includes("/") || command.includes("\\") ? [""] : [cwd$3, ...PATH.split(delimiter)];
34586
+ let pathExt = env.PATHEXT ? env.PATHEXT.split(delimiter) : defaultPathExt;
34587
+ if (command.includes(".") && pathExt[0] !== "") pathExt = ["", ...pathExt];
34588
+ for (const extensions of [pathExt, noPathExt]) for (const path of pathEnv) {
34589
+ const dest = resolve(cwd$3, path.startsWith("\"") && path.endsWith("\"") && path.length > 1 ? path.slice(1, -1) : path, command);
34590
+ for (const ext of extensions) {
34591
+ const destWithExt = dest + ext;
34171
34592
  try {
34172
- if (statSync(t).isFile()) return t;
34593
+ if (statSync(destWithExt).isFile()) return destWithExt;
34173
34594
  } catch {}
34174
34595
  }
34175
34596
  }
34176
34597
  return null;
34177
34598
  }
34178
- function P(e) {
34179
- const t = new AbortController();
34180
- for (const n of e) {
34181
- if (n.aborted) {
34182
- t.abort();
34183
- return n;
34599
+ function combineSignals(signals) {
34600
+ const controller = new AbortController();
34601
+ for (const signal of signals) {
34602
+ if (signal.aborted) {
34603
+ controller.abort();
34604
+ return signal;
34184
34605
  }
34185
- const e = () => {
34186
- t.abort(n.reason);
34606
+ const onAbort = () => {
34607
+ controller.abort(signal.reason);
34187
34608
  };
34188
- n.addEventListener("abort", e, { signal: t.signal });
34609
+ signal.addEventListener("abort", onAbort, { signal: controller.signal });
34189
34610
  }
34190
- return t.signal;
34611
+ return controller.signal;
34191
34612
  }
34192
- async function F(e) {
34193
- let t = "";
34613
+ async function readStream(stream) {
34614
+ let output = "";
34194
34615
  try {
34195
- for await (const n of e) t += n.toString();
34616
+ for await (const chunk of stream) output += chunk.toString();
34196
34617
  } catch {}
34197
- return t;
34618
+ return output;
34198
34619
  }
34199
- var h, g, b, x, S, C, w, T, E, k, j, N, I, R, z;
34620
+ var isPathLikePattern, defaultEnvPathInfo, combineStreams, metaCharsRegExp, shebangRegExp, isWindowsExecutableRegExp, isNodeModulesCmdRegExp, isWindows, defaultPathExt, noPathExt, NonZeroExitError, defaultOptions, defaultNodeOptions, ExecProcess, x, exec$1;
34200
34621
  var init_main = __esmMin((() => {
34201
- h = /^path$/i;
34202
- g = {
34622
+ isPathLikePattern = /^path$/i;
34623
+ defaultEnvPathInfo = {
34203
34624
  key: "PATH",
34204
34625
  value: ""
34205
34626
  };
34206
- b = (e) => {
34207
- let t = e.length;
34208
- const n = new PassThrough();
34209
- const r = () => {
34210
- if (--t === 0) n.end();
34627
+ combineStreams = (streams) => {
34628
+ let streamCount = streams.length;
34629
+ const combined = new PassThrough();
34630
+ const maybeEmitEnd = () => {
34631
+ if (--streamCount === 0) combined.end();
34211
34632
  };
34212
- for (const t of e) pipeline(t, n, { end: false }).then(r).catch(r);
34213
- return n;
34214
- };
34215
- x = /([()\][%!^"`<>&|;, *?])/g;
34216
- S = /^#!\s*(.+)/;
34217
- C = /\.(?:com|exe)$/i;
34218
- w = /node_modules[\\/]\.bin[\\/][^\\/]+\.cmd$/i;
34219
- T = process.platform === "win32";
34220
- E = [
34633
+ for (const stream of streams) pipeline(stream, combined, { end: false }).then(maybeEmitEnd).catch(maybeEmitEnd);
34634
+ return combined;
34635
+ };
34636
+ metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
34637
+ shebangRegExp = /^#!\s*(.+)/;
34638
+ isWindowsExecutableRegExp = /\.(?:com|exe)$/i;
34639
+ isNodeModulesCmdRegExp = /node_modules[\\/]\.bin[\\/][^\\/]+\.cmd$/i;
34640
+ isWindows = process.platform === "win32";
34641
+ defaultPathExt = [
34221
34642
  ".EXE",
34222
34643
  ".CMD",
34223
34644
  ".BAT",
34224
34645
  ".COM"
34225
34646
  ];
34226
- k = class extends Error {
34647
+ noPathExt = [""];
34648
+ NonZeroExitError = class extends Error {
34227
34649
  result;
34228
34650
  output;
34229
- get exitCode() {
34230
- if (this.result.exitCode !== null) return this.result.exitCode;
34231
- }
34232
- constructor(e, t) {
34233
- super(`Process exited with non-zero status (${e.exitCode})`);
34234
- this.result = e;
34235
- this.output = t;
34651
+ exitCode;
34652
+ get signalCode() {
34653
+ return this.result.signalCode;
34654
+ }
34655
+ constructor(result, output, command, args) {
34656
+ let target = "The process";
34657
+ if (command) target = `The command \`${args?.length ? `${command} ${args.map((a) => /[ "'`()]/.test(a) ? JSON.stringify(a) : a).join(" ")}` : command}\``;
34658
+ const exitCode = result.exitCode ?? 1;
34659
+ super(result.signalCode !== null ? `${target} was killed by the signal ${result.signalCode}` : `${target} exited with a non-zero status (${exitCode})`);
34660
+ this.result = result;
34661
+ this.output = output;
34662
+ this.exitCode = exitCode;
34663
+ Object.defineProperty(this, "result", {
34664
+ enumerable: false,
34665
+ writable: false,
34666
+ configurable: false
34667
+ });
34236
34668
  }
34237
34669
  };
34238
- j = {
34670
+ defaultOptions = {
34239
34671
  timeout: void 0,
34240
34672
  persist: false
34241
34673
  };
34242
- N = { windowsHide: true };
34243
- I = class {
34674
+ defaultNodeOptions = { windowsHide: true };
34675
+ ExecProcess = class {
34244
34676
  _process;
34245
34677
  _aborted = false;
34246
34678
  _options;
@@ -34258,19 +34690,22 @@ var init_main = __esmMin((() => {
34258
34690
  get exitCode() {
34259
34691
  if (this._process && this._process.exitCode !== null) return this._process.exitCode;
34260
34692
  }
34261
- constructor(e, t, n) {
34693
+ get signalCode() {
34694
+ return this._process?.signalCode ?? null;
34695
+ }
34696
+ constructor(command, args, options) {
34262
34697
  this._options = {
34263
- ...j,
34264
- ...n
34698
+ ...defaultOptions,
34699
+ ...options
34265
34700
  };
34266
- this._command = e;
34267
- this._args = t ?? [];
34268
- this._processClosed = new Promise((e) => {
34269
- this._resolveClose = e;
34701
+ this._command = command;
34702
+ this._args = args ?? [];
34703
+ this._processClosed = new Promise((resolve) => {
34704
+ this._resolveClose = resolve;
34270
34705
  });
34271
34706
  }
34272
- kill(e) {
34273
- return this._process?.kill(e) === true;
34707
+ kill(signal) {
34708
+ return this._process?.kill(signal) === true;
34274
34709
  }
34275
34710
  get aborted() {
34276
34711
  return this._aborted;
@@ -34278,99 +34713,99 @@ var init_main = __esmMin((() => {
34278
34713
  get killed() {
34279
34714
  return this._process?.killed === true;
34280
34715
  }
34281
- pipe(e, t, n) {
34282
- return z(e, t, {
34283
- ...n,
34716
+ pipe(command, args, options) {
34717
+ return exec$1(command, args, {
34718
+ ...options,
34284
34719
  stdin: this
34285
34720
  });
34286
34721
  }
34287
34722
  async *[Symbol.asyncIterator]() {
34288
- const e = this._process;
34289
- if (!e) return;
34290
- const t = [];
34291
- if (this._streamErr) t.push(this._streamErr);
34292
- if (this._streamOut) t.push(this._streamOut);
34293
- const n = b(t);
34294
- const r = u.createInterface({ input: n });
34295
- for await (const e of r) yield e.toString();
34723
+ const proc = this._process;
34724
+ if (!proc) return;
34725
+ const streams = [];
34726
+ if (this._streamErr) streams.push(this._streamErr);
34727
+ if (this._streamOut) streams.push(this._streamOut);
34728
+ const streamCombined = combineStreams(streams);
34729
+ const rl = readline.createInterface({ input: streamCombined });
34730
+ for await (const chunk of rl) yield chunk.toString();
34296
34731
  await this._processClosed;
34297
- e.removeAllListeners();
34732
+ proc.removeAllListeners();
34298
34733
  if (this._thrownError) throw this._thrownError;
34299
- if (this._options?.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new k(this);
34734
+ if (this._options?.throwOnError && (this.exitCode !== 0 && this.exitCode !== void 0 || this.signalCode !== null)) throw new NonZeroExitError(this, void 0, this._command, this._args);
34300
34735
  }
34301
34736
  async _waitForOutput() {
34302
- const e = this._process;
34303
- if (!e) throw new Error("No process was started");
34304
- const [t, n] = await Promise.all([this._streamOut ? F(this._streamOut) : "", this._streamErr ? F(this._streamErr) : ""]);
34737
+ const proc = this._process;
34738
+ if (!proc) throw new Error("No process was started");
34739
+ const [stdout, stderr] = await Promise.all([this._streamOut ? readStream(this._streamOut) : "", this._streamErr ? readStream(this._streamErr) : ""]);
34305
34740
  await this._processClosed;
34306
- const { stdin: r } = this._options;
34307
- if (r && typeof r !== "string") await r;
34308
- e.removeAllListeners();
34741
+ const { stdin } = this._options;
34742
+ if (stdin && typeof stdin !== "string") await stdin;
34743
+ proc.removeAllListeners();
34309
34744
  if (this._thrownError) throw this._thrownError;
34310
- const i = {
34311
- stderr: n,
34312
- stdout: t,
34745
+ const result = {
34746
+ stderr,
34747
+ stdout,
34313
34748
  exitCode: this.exitCode
34314
34749
  };
34315
- if (this._options.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new k(this, i);
34316
- return i;
34750
+ if (this._options.throwOnError && (this.exitCode !== 0 && this.exitCode !== void 0 || this.signalCode !== null)) throw new NonZeroExitError(this, result, this._command, this._args);
34751
+ return result;
34317
34752
  }
34318
- then(e, t) {
34319
- return this._waitForOutput().then(e, t);
34753
+ then(onfulfilled, onrejected) {
34754
+ return this._waitForOutput().then(onfulfilled, onrejected);
34320
34755
  }
34321
34756
  _streamOut;
34322
34757
  _streamErr;
34323
34758
  spawn() {
34324
- const t = cwd();
34325
- const r = this._options;
34326
- const i = {
34327
- ...N,
34328
- ...r.nodeOptions
34759
+ const cwd$1 = cwd();
34760
+ const options = this._options;
34761
+ const nodeOptions = {
34762
+ ...defaultNodeOptions,
34763
+ ...options.nodeOptions
34329
34764
  };
34330
- const a = [];
34765
+ const signals = [];
34331
34766
  this._resetState();
34332
- if (r.timeout !== void 0) a.push(AbortSignal.timeout(r.timeout));
34333
- if (r.signal !== void 0) a.push(r.signal);
34334
- if (r.persist === true) i.detached = true;
34335
- if (a.length > 0) i.signal = P(a);
34336
- i.env = y(t, i.env, r.nodePath);
34337
- const o = D(this._command, this._args, i);
34338
- const s = spawn(o.command, o.args, o.options);
34339
- if (s.stderr) this._streamErr = s.stderr;
34340
- if (s.stdout) this._streamOut = s.stdout;
34341
- this._process = s;
34342
- s.once("error", this._onError);
34343
- s.once("close", this._onClose);
34344
- if (s.stdin) {
34345
- const { stdin: e } = r;
34346
- if (typeof e === "string") s.stdin.end(e);
34347
- else e?.process?.stdout?.pipe(s.stdin);
34767
+ if (options.timeout !== void 0) signals.push(AbortSignal.timeout(options.timeout));
34768
+ if (options.signal !== void 0) signals.push(options.signal);
34769
+ if (options.persist === true) nodeOptions.detached = true;
34770
+ if (signals.length > 0) nodeOptions.signal = combineSignals(signals);
34771
+ nodeOptions.env = computeEnv(cwd$1, nodeOptions.env, options.nodePath);
34772
+ const crossResult = normalizeSpawnCommand(this._command, this._args, nodeOptions);
34773
+ const handle = spawn(crossResult.command, crossResult.args, crossResult.options);
34774
+ if (handle.stderr) this._streamErr = handle.stderr;
34775
+ if (handle.stdout) this._streamOut = handle.stdout;
34776
+ this._process = handle;
34777
+ handle.once("error", this._onError);
34778
+ handle.once("close", this._onClose);
34779
+ if (handle.stdin) {
34780
+ const { stdin } = options;
34781
+ if (typeof stdin === "string") handle.stdin.end(stdin);
34782
+ else stdin?.process?.stdout?.pipe(handle.stdin);
34348
34783
  }
34349
34784
  }
34350
34785
  _resetState() {
34351
34786
  this._aborted = false;
34352
- this._processClosed = new Promise((e) => {
34353
- this._resolveClose = e;
34787
+ this._processClosed = new Promise((resolve) => {
34788
+ this._resolveClose = resolve;
34354
34789
  });
34355
34790
  this._thrownError = void 0;
34356
34791
  }
34357
- _onError = (e) => {
34358
- if (e.name === "AbortError" && (!(e.cause instanceof Error) || e.cause.name !== "TimeoutError")) {
34792
+ _onError = (err) => {
34793
+ if (err.name === "AbortError" && (!(err.cause instanceof Error) || err.cause.name !== "TimeoutError")) {
34359
34794
  this._aborted = true;
34360
34795
  return;
34361
34796
  }
34362
- this._thrownError = e;
34797
+ this._thrownError = err;
34363
34798
  };
34364
34799
  _onClose = () => {
34365
34800
  if (this._resolveClose) this._resolveClose();
34366
34801
  };
34367
34802
  };
34368
- R = (e, t, n) => {
34369
- const r = new I(e, t, n);
34370
- r.spawn();
34371
- return r;
34803
+ x = (command, args, userOptions) => {
34804
+ const proc = new ExecProcess(command, args, userOptions);
34805
+ proc.spawn();
34806
+ return proc;
34372
34807
  };
34373
- z = R;
34808
+ exec$1 = x;
34374
34809
  }));
34375
34810
  //#endregion
34376
34811
  //#region ../../node_modules/.pnpm/@publint+pack@0.1.6/node_modules/@publint/pack/src/node/utils.js
@@ -34419,7 +34854,7 @@ async function pack(dir, opts) {
34419
34854
  case "yarn": break;
34420
34855
  default: command.push("--ignore-scripts");
34421
34856
  }
34422
- const output = await z(command[0], command.slice(1), { nodeOptions: { cwd: dir } });
34857
+ const output = await exec$1(command[0], command.slice(1), { nodeOptions: { cwd: dir } });
34423
34858
  const tarballFile = await fs$1.readdir(packDestination).then((files) => {
34424
34859
  return files.find((file) => file.endsWith(".tgz") && output.stdout.includes(file));
34425
34860
  });
@@ -34456,7 +34891,7 @@ async function packAsJson(dir, opts) {
34456
34891
  case "yarn": break;
34457
34892
  default: command.push("--ignore-scripts");
34458
34893
  }
34459
- let { stdout } = await z(command[0], command.slice(1), { nodeOptions: { cwd: dir } });
34894
+ let { stdout } = await exec$1(command[0], command.slice(1), { nodeOptions: { cwd: dir } });
34460
34895
  try {
34461
34896
  stdout = stdout.trim();
34462
34897
  if (packageManager === "pnpm") stdout = fixPnpmStdout(stdout);
@@ -36121,7 +36556,7 @@ function createTarballVfs(files) {
36121
36556
  }
36122
36557
  var init_vfs_tarball = __esmMin((() => {}));
36123
36558
  //#endregion
36124
- //#region ../../node_modules/.pnpm/package-manager-detector@1.7.0/node_modules/package-manager-detector/dist/constants.mjs
36559
+ //#region ../../node_modules/.pnpm/package-manager-detector@1.8.0/node_modules/package-manager-detector/dist/constants.mjs
36125
36560
  var AGENTS, LOCKS, INSTALL_METADATA;
36126
36561
  var init_constants = __esmMin((() => {
36127
36562
  AGENTS = [
@@ -36130,6 +36565,7 @@ var init_constants = __esmMin((() => {
36130
36565
  "yarn@berry",
36131
36566
  "pnpm",
36132
36567
  "pnpm@6",
36568
+ "pnpm-rush",
36133
36569
  "bun",
36134
36570
  "deno",
36135
36571
  "nub",
@@ -36141,6 +36577,7 @@ var init_constants = __esmMin((() => {
36141
36577
  "bun.lock": "bun",
36142
36578
  "bun.lockb": "bun",
36143
36579
  "deno.lock": "deno",
36580
+ "nub.lock": "nub",
36144
36581
  "pnpm-lock.yaml": "pnpm",
36145
36582
  "pnpm-workspace.yaml": "pnpm",
36146
36583
  "yarn.lock": "yarn",
@@ -36161,7 +36598,7 @@ var init_constants = __esmMin((() => {
36161
36598
  };
36162
36599
  }));
36163
36600
  //#endregion
36164
- //#region ../../node_modules/.pnpm/package-manager-detector@1.7.0/node_modules/package-manager-detector/dist/detect.mjs
36601
+ //#region ../../node_modules/.pnpm/package-manager-detector@1.8.0/node_modules/package-manager-detector/dist/detect.mjs
36165
36602
  var detect_exports = /* @__PURE__ */ __exportAll({
36166
36603
  detect: () => detect,
36167
36604
  getUserAgent: () => getUserAgent
@@ -36206,6 +36643,10 @@ async function detect(options = {}) {
36206
36643
  for (const directory of lookup(cwd)) {
36207
36644
  for (const strategy of strategies) switch (strategy) {
36208
36645
  case "lockfile":
36646
+ if (await pathExists(PATH.join(directory, "rush.json"), "file")) return {
36647
+ name: "pnpm",
36648
+ agent: "pnpm-rush"
36649
+ };
36209
36650
  for (const lock of Object.keys(LOCKS)) if (await pathExists(PATH.join(directory, lock), "file")) {
36210
36651
  const name = LOCKS[lock];
36211
36652
  const result = await parsePackageJson(PATH.join(directory, "package.json"), options);
@@ -39047,7 +39488,7 @@ const VALID_RULE_LEVELS = /* @__PURE__ */ new Set([
39047
39488
  "warn",
39048
39489
  "error"
39049
39490
  ]);
39050
- function isRecord$3(value) {
39491
+ function isRecord$4(value) {
39051
39492
  return typeof value === "object" && value !== null && !Array.isArray(value);
39052
39493
  }
39053
39494
  function isRuleLevel$1(value) {
@@ -39072,13 +39513,13 @@ function parseRuleConfig(ruleId, value) {
39072
39513
  const level = value[0];
39073
39514
  if (!isRuleLevel$1(level)) throw new TypeError(`${formatRuleConfigLocation(ruleId)} level must be one of "off", "warn", or "error"`);
39074
39515
  const options = value[1];
39075
- if (!isRecord$3(options)) throw new TypeError(`${formatRuleConfigLocation(ruleId)} options must be an object`);
39516
+ if (!isRecord$4(options)) throw new TypeError(`${formatRuleConfigLocation(ruleId)} options must be an object`);
39076
39517
  return {
39077
39518
  level,
39078
39519
  options: { ...options }
39079
39520
  };
39080
39521
  }
39081
- if (isRecord$3(value)) return {
39522
+ if (isRecord$4(value)) return {
39082
39523
  level: "warn",
39083
39524
  options: { ...value }
39084
39525
  };
@@ -40114,6 +40555,290 @@ const eject = () => {
40114
40555
  return runSteps("Eject", [[pm.command, "react-scripts eject"]]);
40115
40556
  };
40116
40557
  //#endregion
40558
+ //#region src/actions/enable/editXyConfigCompile.ts
40559
+ function isJsonConfigPath(configPath) {
40560
+ const base = PATH.basename(configPath);
40561
+ return base === ".xyrc.json" || base.endsWith(".json");
40562
+ }
40563
+ function getPropertyName(prop) {
40564
+ if (ts.isPropertyAssignment(prop)) {
40565
+ const { name } = prop;
40566
+ if (ts.isIdentifier(name) || ts.isStringLiteral(name) || ts.isNoSubstitutionTemplateLiteral(name)) return name.text;
40567
+ }
40568
+ if (ts.isShorthandPropertyAssignment(prop)) return prop.name.text;
40569
+ }
40570
+ function isWhitespace(char) {
40571
+ return char !== void 0 && /\s/.test(char);
40572
+ }
40573
+ function findDefaultExportObject(sourceFile) {
40574
+ for (const statement of sourceFile.statements) {
40575
+ if (ts.isExportAssignment(statement) && !statement.isExportEquals && ts.isObjectLiteralExpression(statement.expression)) return statement.expression;
40576
+ if (!ts.isVariableStatement(statement)) continue;
40577
+ 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;
40578
+ }
40579
+ for (const statement of sourceFile.statements) {
40580
+ if (!ts.isVariableStatement(statement)) continue;
40581
+ for (const decl of statement.declarationList.declarations) if (decl.initializer && ts.isObjectLiteralExpression(decl.initializer)) return decl.initializer;
40582
+ }
40583
+ }
40584
+ function findObjectProperty(object, key) {
40585
+ for (const prop of object.properties) {
40586
+ if (!ts.isPropertyAssignment(prop)) continue;
40587
+ if (getPropertyName(prop) === key) return prop;
40588
+ }
40589
+ }
40590
+ function detectIndent(text, object, sourceFile) {
40591
+ if (object.properties.length > 0) {
40592
+ const start = object.properties[0].getStart(sourceFile);
40593
+ let lineStart = start;
40594
+ while (lineStart > 0 && text[lineStart - 1] !== "\n" && text[lineStart - 1] !== "\r") lineStart -= 1;
40595
+ const indent = text.slice(lineStart, start).match(/^[ \t]*/)?.[0];
40596
+ if (indent !== void 0 && indent.length > 0) return indent;
40597
+ }
40598
+ const braceStart = object.getStart(sourceFile);
40599
+ let lineStart = braceStart;
40600
+ while (lineStart > 0 && text[lineStart - 1] !== "\n" && text[lineStart - 1] !== "\r") lineStart -= 1;
40601
+ return `${text.slice(lineStart, braceStart).match(/^[ \t]*/)?.[0] ?? ""} `;
40602
+ }
40603
+ function removePropertyFromObject(text, prop, sourceFile) {
40604
+ let start = prop.getFullStart();
40605
+ let end = prop.getEnd();
40606
+ let cursor = end;
40607
+ while (isWhitespace(text[cursor])) cursor++;
40608
+ if (text[cursor] === ",") end = cursor + 1;
40609
+ else {
40610
+ let back = prop.getStart(sourceFile) - 1;
40611
+ while (back >= 0 && isWhitespace(text[back])) back--;
40612
+ if (text[back] === ",") start = back;
40613
+ }
40614
+ return `${text.slice(0, start)}${text.slice(end)}`;
40615
+ }
40616
+ function insertPropertyIntoObject(text, object, sourceFile, entry) {
40617
+ const indent = detectIndent(text, object, sourceFile);
40618
+ const openBraceEnd = object.getStart(sourceFile) + 1;
40619
+ const insertion = `\n${indent}${entry},`;
40620
+ return `${text.slice(0, openBraceEnd)}${insertion}${text.slice(openBraceEnd)}`;
40621
+ }
40622
+ function setStringProperty(text, object, sourceFile, key, value) {
40623
+ const existing = findObjectProperty(object, key);
40624
+ const valueText = `'${value}'`;
40625
+ if (existing !== void 0) {
40626
+ const valueStart = existing.initializer.getStart(sourceFile);
40627
+ const valueEnd = existing.initializer.getEnd();
40628
+ return `${text.slice(0, valueStart)}${valueText}${text.slice(valueEnd)}`;
40629
+ }
40630
+ return insertPropertyIntoObject(text, object, sourceFile, `${key}: ${valueText}`);
40631
+ }
40632
+ /**
40633
+ * Ensure `compile.compiler` is set on a TypeScript/JS xy.config source.
40634
+ * When `compiler` is `native` and `compile.validator` is `'shared'`, drops the
40635
+ * validator field — shared validation only works with the JS compiler API.
40636
+ */
40637
+ function applyCompileCompilerToTsSource(text, compiler) {
40638
+ const sourceFile = ts.createSourceFile("xy.config.ts", text, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
40639
+ const configObject = findDefaultExportObject(sourceFile);
40640
+ if (configObject === void 0) throw new Error("Could not find a config object in xy.config to set compile.compiler");
40641
+ const compileAssignment = findObjectProperty(configObject, "compile");
40642
+ if (compileAssignment === void 0) return insertPropertyIntoObject(text, configObject, sourceFile, `compile: { compiler: '${compiler}' }`);
40643
+ if (!ts.isObjectLiteralExpression(compileAssignment.initializer)) throw new TypeError("compile must be an object literal to set compiler");
40644
+ let result = setStringProperty(text, compileAssignment.initializer, sourceFile, "compiler", compiler);
40645
+ if (compiler !== "native") return result;
40646
+ const afterCompiler = ts.createSourceFile("xy.config.ts", result, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
40647
+ const afterConfig = findDefaultExportObject(afterCompiler);
40648
+ if (afterConfig === void 0) return result;
40649
+ const afterCompile = findObjectProperty(afterConfig, "compile");
40650
+ if (afterCompile === void 0 || !ts.isObjectLiteralExpression(afterCompile.initializer)) return result;
40651
+ const validator = findObjectProperty(afterCompile.initializer, "validator");
40652
+ if (validator === void 0) return result;
40653
+ if ((ts.isStringLiteral(validator.initializer) || ts.isNoSubstitutionTemplateLiteral(validator.initializer)) && validator.initializer.text === "shared") result = removePropertyFromObject(result, validator, afterCompiler);
40654
+ return result;
40655
+ }
40656
+ function isRecord$3(value) {
40657
+ return typeof value === "object" && value !== null && !Array.isArray(value);
40658
+ }
40659
+ /**
40660
+ * Ensure `compile.compiler` is set on a JSON xy.config (`.xyrc.json`).
40661
+ */
40662
+ function applyCompileCompilerToJsonSource(text, compiler) {
40663
+ const root = JSON.parse(text);
40664
+ const compile = isRecord$3(root.compile) ? { ...root.compile } : {};
40665
+ compile.compiler = compiler;
40666
+ if (compiler === "native" && compile.validator === "shared") delete compile.validator;
40667
+ root.compile = compile;
40668
+ return `${JSON.stringify(root, null, 2)}\n`;
40669
+ }
40670
+ function createMinimalNativeCompileConfigSource() {
40671
+ return [
40672
+ "import type { XyConfig } from '@ariestools/toolchain'",
40673
+ "",
40674
+ "const config: XyConfig = {",
40675
+ " compile: { compiler: 'native' },",
40676
+ "}",
40677
+ "",
40678
+ "export default config",
40679
+ ""
40680
+ ].join("\n");
40681
+ }
40682
+ /**
40683
+ * Set `compile.compiler` on the repo's xy config.
40684
+ * Creates `xy.config.ts` when none exists.
40685
+ */
40686
+ function applyCompileCompilerToConfigDir(dir, compiler) {
40687
+ const existingPath = findXyConfigFile(dir);
40688
+ if (existingPath === void 0) {
40689
+ const configPath = PATH.join(dir, "xy.config.ts");
40690
+ const text = compiler === "native" ? createMinimalNativeCompileConfigSource() : [
40691
+ "import type { XyConfig } from '@ariestools/toolchain'",
40692
+ "",
40693
+ "const config: XyConfig = {",
40694
+ ` compile: { compiler: '${compiler}' },`,
40695
+ "}",
40696
+ "",
40697
+ "export default config",
40698
+ ""
40699
+ ].join("\n");
40700
+ fs.writeFileSync(configPath, text, "utf8");
40701
+ return {
40702
+ changed: true,
40703
+ created: true,
40704
+ path: configPath
40705
+ };
40706
+ }
40707
+ const before = fs.readFileSync(existingPath, "utf8");
40708
+ const after = isJsonConfigPath(existingPath) ? applyCompileCompilerToJsonSource(before, compiler) : applyCompileCompilerToTsSource(before, compiler);
40709
+ if (after === before) return {
40710
+ changed: false,
40711
+ created: false,
40712
+ path: existingPath
40713
+ };
40714
+ fs.writeFileSync(existingPath, after, "utf8");
40715
+ return {
40716
+ changed: true,
40717
+ created: false,
40718
+ path: existingPath
40719
+ };
40720
+ }
40721
+ //#endregion
40722
+ //#region src/actions/enable/tsNative.ts
40723
+ function formatAliasSpec(range) {
40724
+ return `npm:typescript@${range}`;
40725
+ }
40726
+ /**
40727
+ * Prefer an existing 7.x alias range when already declared; otherwise use the
40728
+ * toolchain default (`~7.0.2`).
40729
+ */
40730
+ function resolveNativeAliasSpec(existing) {
40731
+ if (existing === void 0) return DEFAULT_NATIVE_ALIAS_SPEC;
40732
+ if (existing.startsWith("npm:typescript@")) return existing;
40733
+ if (import_semver.default.validRange(existing) !== null) return formatAliasSpec(existing);
40734
+ return DEFAULT_NATIVE_ALIAS_SPEC;
40735
+ }
40736
+ function typescriptMajor(spec) {
40737
+ if (spec === void 0) return void 0;
40738
+ if (spec.startsWith("workspace:") || spec.startsWith("npm:")) return void 0;
40739
+ return import_semver.default.coerce(spec)?.major;
40740
+ }
40741
+ /**
40742
+ * Ensure `typescript-native` lives in devDependencies at the resolved alias
40743
+ * spec. Moves a misplaced `dependencies` entry when present.
40744
+ */
40745
+ function ensureNativeDevDependency(cwd, pkg, nativeSpec, isVerbose) {
40746
+ if ((pkg.devDependencies?.["typescript-native"] ?? pkg.dependencies?.["typescript-native"]) === nativeSpec && pkg.devDependencies?.["typescript-native"] === nativeSpec) {
40747
+ if (isVerbose) console.log(chalk.gray(` ${DEFAULT_NATIVE_PACKAGE} already declared as ${nativeSpec}`));
40748
+ return false;
40749
+ }
40750
+ if (pkg.dependencies?.["typescript-native"] !== void 0) {
40751
+ delete pkg.dependencies[DEFAULT_NATIVE_PACKAGE];
40752
+ if (Object.keys(pkg.dependencies).length === 0) delete pkg.dependencies;
40753
+ }
40754
+ addDep(pkg, DEFAULT_NATIVE_PACKAGE, nativeSpec, "devDependencies");
40755
+ writePackageJson$2(cwd, pkg);
40756
+ console.log(chalk.green(`Added ${DEFAULT_NATIVE_PACKAGE}@${nativeSpec} to devDependencies`));
40757
+ return true;
40758
+ }
40759
+ /**
40760
+ * Warn when the JS compiler API package is missing or pinned to major 7+.
40761
+ */
40762
+ function logTypescriptApiStatus(pkg, isVerbose) {
40763
+ const apiSpec = pkg.devDependencies?.typescript ?? pkg.dependencies?.typescript;
40764
+ if (apiSpec === void 0) {
40765
+ console.warn(chalk.yellow("Note: no \"typescript\" package found. Keep typescript@6.x installed for ESLint and xy analyzers (the native compiler exports no compiler API)."));
40766
+ return;
40767
+ }
40768
+ const apiMajor = typescriptMajor(apiSpec);
40769
+ if (apiMajor !== void 0 && apiMajor >= 7) {
40770
+ console.warn(chalk.yellow(`Note: "typescript" is pinned to ${apiSpec} (major ${apiMajor}). Major 7+ is the native compiler and exports no API — pin typescript to 6.x and use ${DEFAULT_NATIVE_PACKAGE} for compile.`));
40771
+ return;
40772
+ }
40773
+ if (isVerbose) console.log(chalk.gray(` typescript (compiler API) remains ${apiSpec}`));
40774
+ }
40775
+ function configDisplayPath(cwd, configPath) {
40776
+ return PATH.relative(cwd, configPath) || PATH.basename(configPath);
40777
+ }
40778
+ function logConfigResult(cwd, configResult) {
40779
+ const display = configDisplayPath(cwd, configResult.path);
40780
+ if (configResult.created) {
40781
+ console.log(chalk.green(`Created ${display} with compile.compiler: 'native'`));
40782
+ return;
40783
+ }
40784
+ if (configResult.changed) {
40785
+ console.log(chalk.green(`Updated ${display} → compile.compiler: 'native'`));
40786
+ return;
40787
+ }
40788
+ console.log(chalk.gray(`${display} already has compile.compiler: 'native'`));
40789
+ }
40790
+ function maybeInstall(cwd, packageJsonChanged, noInstall) {
40791
+ if (!packageJsonChanged) return;
40792
+ if (noInstall) {
40793
+ console.log(chalk.gray("Skipped install (--no-install). Run your package manager install when ready."));
40794
+ return;
40795
+ }
40796
+ shouldRunInstall(cwd);
40797
+ }
40798
+ /**
40799
+ * Enable TypeScript native (`typescript@7` Go compiler) for type-check and
40800
+ * declaration emit in the current repo:
40801
+ *
40802
+ * 1. `devDependencies["typescript-native"] = "npm:typescript@~7.0.2"`
40803
+ * 2. `xy.config` → `compile.compiler: 'native'`
40804
+ * 3. Drop incompatible `compile.validator: 'shared'` when present
40805
+ * 4. Install when package.json changed (unless `--no-install`)
40806
+ *
40807
+ * Leaves the `typescript` (JS compiler API, 6.x) package alone — ESLint,
40808
+ * deplint, dead-code, and api-exposure still load it.
40809
+ */
40810
+ function enableTsNative({ noInstall = false, isVerbose = false } = {}) {
40811
+ const cwd = INIT_CWD();
40812
+ const packageJsonPath = PATH.join(cwd, "package.json");
40813
+ if (!existsSync(packageJsonPath)) throw new Error(`No package.json found in ${cwd}`);
40814
+ const pkg = readPackageJson$4(cwd);
40815
+ const nativeSpec = resolveNativeAliasSpec(pkg.devDependencies?.["typescript-native"] ?? pkg.dependencies?.["typescript-native"]);
40816
+ const packageJsonChanged = ensureNativeDevDependency(cwd, pkg, nativeSpec, isVerbose);
40817
+ logTypescriptApiStatus(pkg, isVerbose);
40818
+ const configResult = applyCompileCompilerToConfigDir(cwd, "native");
40819
+ logConfigResult(cwd, configResult);
40820
+ maybeInstall(cwd, packageJsonChanged, noInstall);
40821
+ console.log(chalk.cyan("TypeScript native compile enabled. `xy compile` will use the Go tsc for validation and declarations."));
40822
+ return {
40823
+ configChanged: configResult.changed,
40824
+ configCreated: configResult.created,
40825
+ configPath: configResult.path,
40826
+ packageJsonChanged,
40827
+ nativePackage: DEFAULT_NATIVE_PACKAGE,
40828
+ nativeSpec
40829
+ };
40830
+ }
40831
+ async function enableTsNativeAction(params = {}) {
40832
+ try {
40833
+ enableTsNative(params);
40834
+ return 0;
40835
+ } catch (error) {
40836
+ const message = error instanceof Error ? error.message : String(error);
40837
+ console.error(chalk.red(message));
40838
+ return resultFromExitCode(1);
40839
+ }
40840
+ }
40841
+ //#endregion
40117
40842
  //#region src/actions/fix.ts
40118
40843
  const fix = async ({ jobs, pkg, verbose }) => {
40119
40844
  const pkgOpts = pkg === void 0 ? [] : [pkg];
@@ -41874,12 +42599,19 @@ function setWorkspaceScalar(cwd, key, value, isSatisfied, successMessage) {
41874
42599
  function fixPnpmMinimumReleaseAge(cwd) {
41875
42600
  setWorkspaceScalar(cwd, "minimumReleaseAge", DEFAULT_MINIMUM_RELEASE_AGE_MINUTES, isMinimumReleaseAgeSatisfied, ` ✔ Fixed: set minimumReleaseAge: ${DEFAULT_MINIMUM_RELEASE_AGE_MINUTES} in pnpm-workspace.yaml`);
41876
42601
  }
41877
- function fixPnpmReleaseAgeExcludes(cwd, workspaces = []) {
42602
+ /**
42603
+ Rewrites `minimumReleaseAgeExclude` through the YAML document model rather than
42604
+ by splicing lines. Scoped patterns start with `@`, a YAML reserved indicator, so
42605
+ a hand-built ` - @scope/*` line is not valid YAML — the serializer quotes them.
42606
+
42607
+ Returns whether the file was updated.
42608
+ */
42609
+ function fixPnpmReleaseAgeExcludes(cwd, workspaces = [], configuredPatterns) {
41878
42610
  const doc = readPnpmWorkspaceDocument(cwd);
41879
- if (!doc) return;
42611
+ if (!doc) return false;
41880
42612
  if (!import_dist.isMap(doc.contents)) {
41881
42613
  console.log(chalk.yellow(" ⚠ pnpm-workspace.yaml has no top-level map; skipping fix"));
41882
- return;
42614
+ return false;
41883
42615
  }
41884
42616
  let seq = doc.get("minimumReleaseAgeExclude");
41885
42617
  if (!import_dist.isSeq(seq)) {
@@ -41887,8 +42619,8 @@ function fixPnpmReleaseAgeExcludes(cwd, workspaces = []) {
41887
42619
  doc.set("minimumReleaseAgeExclude", seq);
41888
42620
  }
41889
42621
  const seqNode = seq;
41890
- const { missing, unnecessary } = diffReleaseAgeExcludePatterns(cwd, workspaces, readSequenceStrings(seqNode));
41891
- if (missing.length === 0 && unnecessary.length === 0) return;
42622
+ const { missing, unnecessary } = diffReleaseAgeExcludePatterns(cwd, workspaces, readSequenceStrings(seqNode), configuredPatterns);
42623
+ if (missing.length === 0 && unnecessary.length === 0) return false;
41892
42624
  const unnecessarySet = new Set(unnecessary.map(normalizeReleaseAgeExcludePattern));
41893
42625
  seqNode.items = seqNode.items.filter((item) => {
41894
42626
  const value = import_dist.isScalar(item) ? item.value : item;
@@ -41905,6 +42637,7 @@ function fixPnpmReleaseAgeExcludes(cwd, workspaces = []) {
41905
42637
  writeFileSync(pnpmWorkspacePath(cwd), String(doc), "utf8");
41906
42638
  if (missing.length > 0) console.log(chalk.green(` ✔ Fixed: added ${missing.join(", ")} to minimumReleaseAgeExclude in pnpm-workspace.yaml`));
41907
42639
  if (unnecessary.length > 0) console.log(chalk.green(` ✔ Fixed: removed ${unnecessary.join(", ")} from minimumReleaseAgeExclude in pnpm-workspace.yaml`));
42640
+ return true;
41908
42641
  }
41909
42642
  //#endregion
41910
42643
  //#region src/actions/package-lint-specs.ts
@@ -42083,7 +42816,7 @@ function checkWorkspaceGlobCoverage(pkg, cwd, pm, workspaces) {
42083
42816
  }
42084
42817
  return result;
42085
42818
  }
42086
- function lintResultDiagnostics(ruleId, result) {
42819
+ function lintResultDiagnostics(ruleId, ruleLevel, result) {
42087
42820
  return [
42088
42821
  ...result.errors.map((message) => ({
42089
42822
  level: "error",
@@ -42091,7 +42824,7 @@ function lintResultDiagnostics(ruleId, result) {
42091
42824
  rule: ruleId
42092
42825
  })),
42093
42826
  ...result.fixable.map((message) => ({
42094
- level: "error",
42827
+ level: ruleLevel,
42095
42828
  message: `${message} (fixable)`,
42096
42829
  rule: ruleId
42097
42830
  })),
@@ -42102,30 +42835,136 @@ function lintResultDiagnostics(ruleId, result) {
42102
42835
  }))
42103
42836
  ];
42104
42837
  }
42105
- function checkEntryToRule(entry, shouldFix) {
42838
+ function repoLintRule({ check, description, fix, id, level = "error" }) {
42106
42839
  return {
42107
- check: ({ cwd, pkg }) => {
42108
- const result = entry.check();
42109
- const nonFixableDiagnostics = lintResultDiagnostics(entry.id, {
42840
+ check: (context, { fix: shouldFix, level: ruleLevel }) => {
42841
+ const result = check(context);
42842
+ const applied = shouldFix && fix !== void 0 && result.fixable.length > 0 ? fix(context) !== false : false;
42843
+ const diagnostics = lintResultDiagnostics(id, ruleLevel, {
42110
42844
  errors: result.errors,
42111
- fixable: shouldFix && entry.shouldFix ? [] : result.fixable,
42845
+ fixable: applied ? [] : result.fixable,
42112
42846
  warnings: result.warnings
42113
42847
  });
42114
- if (shouldFix && entry.shouldFix && result.fixable.length > 0) {
42115
- entry.shouldFix(cwd, pkg);
42116
- return {
42117
- diagnostics: nonFixableDiagnostics,
42118
- fixedCount: result.fixable.length
42119
- };
42120
- }
42121
- return { diagnostics: nonFixableDiagnostics };
42848
+ return applied ? {
42849
+ diagnostics,
42850
+ fixedCount: result.fixable.length
42851
+ } : { diagnostics };
42122
42852
  },
42123
- defaultLevel: entry.level ?? "error",
42124
- description: entry.label,
42125
- fixable: entry.shouldFix !== void 0,
42126
- id: entry.id
42853
+ defaultLevel: level,
42854
+ description,
42855
+ fixable: fix !== void 0,
42856
+ id
42127
42857
  };
42128
42858
  }
42859
+ const REPO_LINT_RULES = [
42860
+ repoLintRule({
42861
+ check: ({ pkg }) => checkRootPrivate(pkg),
42862
+ description: "Root package is private",
42863
+ fix: ({ cwd, pkg }) => fixRootPrivate(cwd, pkg),
42864
+ id: "repo.root-private"
42865
+ }),
42866
+ repoLintRule({
42867
+ check: ({ pkg }) => checkNoPublishConfigOnPrivate(pkg),
42868
+ description: "Private root has no publishConfig",
42869
+ fix: ({ cwd, pkg }) => fixNoPublishConfigOnPrivate(cwd, pkg),
42870
+ id: "repo.no-private-publish-config"
42871
+ }),
42872
+ repoLintRule({
42873
+ check: ({ workspaces }) => checkPackagesFolder(workspaces),
42874
+ description: "Workspace packages live under packages/",
42875
+ id: "repo.packages-folder"
42876
+ }),
42877
+ repoLintRule({
42878
+ check: ({ cwd, workspaces }) => checkSpecFileLayout(cwd, workspaces),
42879
+ description: "Spec files live in spec/ folders",
42880
+ id: "repo.spec-layout"
42881
+ }),
42882
+ repoLintRule({
42883
+ check: ({ cwd, pm, workspaces }) => checkWorkspacesFieldPlacement(cwd, pm, workspaces),
42884
+ description: "Workspace fields are declared in the package-manager-specific location",
42885
+ fix: ({ cwd, pm, workspaces }) => fixWorkspacesFieldPlacement(cwd, pm, workspaces),
42886
+ id: "repo.workspaces-field-placement"
42887
+ }),
42888
+ repoLintRule({
42889
+ check: ({ cwd, pkg, pm, workspaces }) => checkWorkspaceGlobCoverage(pkg, cwd, pm, workspaces),
42890
+ description: "Workspace globs cover every package",
42891
+ id: "repo.workspace-glob-coverage"
42892
+ }),
42893
+ repoLintRule({
42894
+ check: ({ cwd, workspaces }) => checkNoPackageManagerInWorkspaces(cwd, workspaces),
42895
+ description: "Only the root package declares packageManager",
42896
+ fix: ({ cwd, pkg, workspaces }) => fixNoPackageManagerInWorkspaces(cwd, pkg, workspaces),
42897
+ id: "repo.no-package-manager-in-workspaces"
42898
+ }),
42899
+ repoLintRule({
42900
+ check: ({ cwd, workspaces }) => checkVoltaOnlyInRoot(cwd, workspaces),
42901
+ description: "Only the root package declares volta",
42902
+ fix: ({ cwd, pkg, workspaces }) => fixVoltaOnlyInRoot(cwd, pkg, workspaces),
42903
+ id: "repo.volta-only-root"
42904
+ }),
42905
+ repoLintRule({
42906
+ check: ({ cwd, workspaces }) => checkEnginesOnlyInNonTerminal(cwd, workspaces),
42907
+ description: "Only non-terminal packages declare engines",
42908
+ fix: ({ cwd, pkg, workspaces }) => fixEnginesOnlyInNonTerminal(cwd, pkg, workspaces),
42909
+ id: "repo.engines-non-terminal"
42910
+ }),
42911
+ repoLintRule({
42912
+ check: ({ cwd, workspaces }) => checkVersionsIncludeLts(cwd, workspaces),
42913
+ description: "Engine and volta versions include latest LTS",
42914
+ id: "repo.engines-lts"
42915
+ }),
42916
+ repoLintRule({
42917
+ check: ({ cwd, pkg, workspaces }) => checkVersionConsistency(cwd, pkg, workspaces),
42918
+ description: "Workspace versions are consistent",
42919
+ fix: ({ cwd, pkg, workspaces }) => fixVersionConsistency(cwd, pkg, writeRootPackageJson, workspaces),
42920
+ id: "repo.version-consistency"
42921
+ }),
42922
+ repoLintRule({
42923
+ check: ({ cwd, pm, workspaces }) => pm === "pnpm" ? checkWorkspaceProtocol(cwd, workspaces) : checkInternalDepVersions(cwd, workspaces),
42924
+ description: "Internal dependencies use the expected workspace/version protocol",
42925
+ fix: ({ cwd, pm, workspaces }) => pm === "pnpm" ? fixWorkspaceProtocol(cwd, workspaces) : fixInternalDepVersions(cwd, workspaces),
42926
+ id: "repo.internal-dependency-ranges"
42927
+ }),
42928
+ repoLintRule({
42929
+ check: ({ cwd, workspaces }) => checkInternalPeerVersions(cwd, workspaces),
42930
+ description: "Internal peerDependencies use publishable ranges",
42931
+ fix: ({ cwd, workspaces }) => fixInternalPeerVersions(cwd, workspaces),
42932
+ id: "repo.internal-peer-ranges"
42933
+ }),
42934
+ repoLintRule({
42935
+ check: ({ cwd, pm, workspaces }) => checkPnpmReleaseAgeExcludes(cwd, pm, workspaces),
42936
+ description: "pnpm minimumReleaseAgeExclude matches imported scopes",
42937
+ fix: ({ cwd, workspaces }) => fixPnpmReleaseAgeExcludes(cwd, workspaces),
42938
+ id: "repo.pnpm-release-age-excludes"
42939
+ }),
42940
+ repoLintRule({
42941
+ check: ({ cwd, pm }) => checkPnpmMinimumReleaseAge(cwd, pm),
42942
+ description: "pnpm minimumReleaseAge is configured",
42943
+ fix: ({ cwd }) => fixPnpmMinimumReleaseAge(cwd),
42944
+ id: "repo.pnpm-minimum-release-age"
42945
+ }),
42946
+ repoLintRule({
42947
+ check: ({ cwd, pkg, pm }) => checkPnpmDependencyOverrides(cwd, pm, pkg),
42948
+ description: "pnpm dependency overrides are not configured",
42949
+ id: "repo.pnpm-no-overrides",
42950
+ level: "warn"
42951
+ }),
42952
+ repoLintRule({
42953
+ check: ({ cwd, githubRunner }) => {
42954
+ const result = emptyResult();
42955
+ if (dependabotAlertsStatus(cwd, githubRunner) === "disabled") result.fixable.push("Dependabot alerts are disabled for this repository");
42956
+ return result;
42957
+ },
42958
+ description: "Dependabot security alerts are enabled for the repository",
42959
+ fix: ({ cwd, githubRunner }) => {
42960
+ if (enableDependabotAlerts(cwd, githubRunner)) return true;
42961
+ console.log(chalk.yellow(" ⚠ Could not enable Dependabot alerts — the token needs admin on this repository"));
42962
+ return false;
42963
+ },
42964
+ id: "repo.dependabot-enabled",
42965
+ level: "warn"
42966
+ })
42967
+ ];
42129
42968
  function logRuleDiagnostic(diagnostic) {
42130
42969
  const color = diagnostic.level === "error" ? chalk.red : chalk.yellow;
42131
42970
  const marker = diagnostic.level === "error" ? "✗" : "⚠";
@@ -42137,12 +42976,19 @@ function logRulePassed(rule) {
42137
42976
  function logRuleFixed(rule, fixedCount) {
42138
42977
  console.log(chalk.green(` ✔ Fixed ${fixedCount} issue(s): ${rule.description ?? rule.id}`));
42139
42978
  }
42140
- function logSummary(errors, fixed) {
42979
+ function logSummary(errors, warnings, fixed) {
42141
42980
  if (fixed > 0) console.log(chalk.green(`\n Fixed ${fixed} issue(s)`));
42142
- if (errors > 0) console.log(chalk.red(`\n ${errors} error(s) found`));
42143
- else if (fixed === 0) console.log(chalk.green("\n All checks passed"));
42981
+ if (errors > 0) {
42982
+ console.log(chalk.red(`\n ${errors} error(s) found`));
42983
+ return;
42984
+ }
42985
+ if (warnings > 0) {
42986
+ console.log(chalk.yellow(`\n ${warnings} warning(s) found`));
42987
+ return;
42988
+ }
42989
+ if (fixed === 0) console.log(chalk.green("\n All checks passed"));
42144
42990
  }
42145
- async function packageLintMonorepo(shouldFix = false) {
42991
+ async function packageLintMonorepo(shouldFix = false, options = {}) {
42146
42992
  const cwd = INIT_CWD();
42147
42993
  let pkg;
42148
42994
  try {
@@ -42158,112 +43004,17 @@ async function packageLintMonorepo(shouldFix = false) {
42158
43004
  console.log(chalk.green("Repo Lint"));
42159
43005
  const pm = detectPackageManager$1();
42160
43006
  const workspaces = getPackageManager().listWorkspaces();
42161
- const checks = [
42162
- {
42163
- check: () => checkRootPrivate(pkg),
42164
- id: "repo.root-private",
42165
- shouldFix: fixRootPrivate,
42166
- label: "Root package is private"
42167
- },
42168
- {
42169
- check: () => checkNoPublishConfigOnPrivate(pkg),
42170
- id: "repo.no-private-publish-config",
42171
- shouldFix: fixNoPublishConfigOnPrivate,
42172
- label: "No publishConfig on private root"
42173
- },
42174
- {
42175
- check: () => checkPackagesFolder(workspaces),
42176
- id: "repo.packages-folder",
42177
- label: "All packages are in packages/ folder"
42178
- },
42179
- {
42180
- check: () => checkSpecFileLayout(cwd, workspaces),
42181
- id: "repo.spec-layout",
42182
- label: "Spec files live in a spec/ folder"
42183
- },
42184
- {
42185
- check: () => checkWorkspacesFieldPlacement(cwd, pm, workspaces),
42186
- id: "repo.workspaces-field-placement",
42187
- shouldFix: () => fixWorkspacesFieldPlacement(cwd, pm, workspaces),
42188
- label: pm === "pnpm" ? "No workspaces field in package.json (use pnpm-workspace.yaml)" : "Workspaces field only in root package.json"
42189
- },
42190
- {
42191
- check: () => checkWorkspaceGlobCoverage(pkg, cwd, pm, workspaces),
42192
- id: "repo.workspace-glob-coverage",
42193
- label: "Workspace globs cover all packages"
42194
- },
42195
- {
42196
- check: () => checkNoPackageManagerInWorkspaces(cwd, workspaces),
42197
- id: "repo.no-package-manager-in-workspaces",
42198
- shouldFix: () => fixNoPackageManagerInWorkspaces(cwd, pkg, workspaces),
42199
- label: "No packageManager in workspace packages"
42200
- },
42201
- {
42202
- check: () => checkVoltaOnlyInRoot(cwd, workspaces),
42203
- id: "repo.volta-only-root",
42204
- shouldFix: () => fixVoltaOnlyInRoot(cwd, pkg, workspaces),
42205
- label: "Volta only in root package.json"
42206
- },
42207
- {
42208
- check: () => checkEnginesOnlyInNonTerminal(cwd, workspaces),
42209
- id: "repo.engines-non-terminal",
42210
- shouldFix: () => fixEnginesOnlyInNonTerminal(cwd, pkg, workspaces),
42211
- label: "Engines only in non-terminal (library) packages"
42212
- },
42213
- {
42214
- check: () => checkVersionsIncludeLts(cwd, workspaces),
42215
- id: "repo.engines-lts",
42216
- label: "Engine/volta versions include latest LTS"
42217
- },
42218
- {
42219
- check: () => checkVersionConsistency(cwd, pkg, workspaces),
42220
- id: "repo.version-consistency",
42221
- shouldFix: () => fixVersionConsistency(cwd, pkg, writeRootPackageJson, workspaces),
42222
- label: "Consistent versions across packages"
42223
- },
42224
- pm === "pnpm" ? {
42225
- check: () => checkWorkspaceProtocol(cwd, workspaces),
42226
- id: "repo.internal-dependency-ranges",
42227
- shouldFix: () => fixWorkspaceProtocol(cwd, workspaces),
42228
- label: "Internal deps/devDeps use workspace: protocol"
42229
- } : {
42230
- check: () => checkInternalDepVersions(cwd, workspaces),
42231
- id: "repo.internal-dependency-ranges",
42232
- shouldFix: () => fixInternalDepVersions(cwd, workspaces),
42233
- label: "Internal deps/devDeps use correct version ranges"
42234
- },
42235
- {
42236
- check: () => checkInternalPeerVersions(cwd, workspaces),
42237
- id: "repo.internal-peer-ranges",
42238
- shouldFix: () => fixInternalPeerVersions(cwd, workspaces),
42239
- label: "Internal peerDeps use publishable ranges"
42240
- },
42241
- {
42242
- check: () => checkPnpmReleaseAgeExcludes(cwd, pm, workspaces),
42243
- id: "repo.pnpm-release-age-excludes",
42244
- shouldFix: () => fixPnpmReleaseAgeExcludes(cwd, workspaces),
42245
- label: "pnpm-workspace.yaml minimumReleaseAgeExclude matches imported scoped packages"
42246
- },
42247
- {
42248
- check: () => checkPnpmMinimumReleaseAge(cwd, pm),
42249
- id: "repo.pnpm-minimum-release-age",
42250
- shouldFix: () => fixPnpmMinimumReleaseAge(cwd),
42251
- label: "pnpm-workspace.yaml sets minimumReleaseAge"
42252
- },
42253
- ...pm === "pnpm" ? [{
42254
- check: () => checkPnpmDependencyOverrides(cwd, pm, pkg),
42255
- id: "repo.pnpm-no-overrides",
42256
- label: "No pnpm dependency overrides configured",
42257
- level: "warn"
42258
- }] : []
42259
- ];
43007
+ const config = await loadWorkspaceCommandConfig(cwd, "repoLint");
42260
43008
  const result = await runRuleChecks({
42261
- commandName: "repo lint",
42262
- configKey: "repoLint",
42263
- config: await loadWorkspaceCommandConfig(cwd, "repoLint"),
43009
+ commandName: RULE_COMMANDS.repoLint.command,
43010
+ configKey: RULE_COMMANDS.repoLint.configKey,
43011
+ config,
42264
43012
  context: {
42265
43013
  cwd,
42266
- pkg
43014
+ pkg,
43015
+ pm,
43016
+ workspaces,
43017
+ ...options.githubRunner !== void 0 && { githubRunner: options.githubRunner }
42267
43018
  },
42268
43019
  fix: shouldFix,
42269
43020
  reporter: {
@@ -42271,9 +43022,9 @@ async function packageLintMonorepo(shouldFix = false) {
42271
43022
  fixed: logRuleFixed,
42272
43023
  passed: logRulePassed
42273
43024
  },
42274
- rules: checks.map((entry) => checkEntryToRule(entry, shouldFix))
43025
+ rules: REPO_LINT_RULES
42275
43026
  });
42276
- logSummary(result.envelope.errorCount, result.envelope.data.fixedCount);
43027
+ logSummary(result.envelope.errorCount, result.envelope.warningCount, result.envelope.data.fixedCount);
42277
43028
  if (shouldFix && result.envelope.data.fixedCount > 0) shouldRunInstall();
42278
43029
  return result;
42279
43030
  }
@@ -43205,36 +43956,16 @@ function shouldCheckMinimumReleaseAgeExclude(cwd, config, isVerbose, isSilent) {
43205
43956
  }
43206
43957
  return false;
43207
43958
  }
43959
+ /**
43960
+ Delegates to the shared YAML-document writer. Splicing ` - ${pattern}` lines by
43961
+ hand emitted invalid YAML for scoped patterns — `@` is a YAML reserved
43962
+ indicator, so a plain scalar cannot start with one and pnpm then failed to read
43963
+ its own workspace file.
43964
+ */
43208
43965
  function shouldFixMinimumReleaseAgeExclude(cwd, config) {
43209
43966
  const content = readPnpmWorkspaceYaml(cwd);
43210
43967
  if (content == null || content.length === 0) return false;
43211
- const workspaces = getPackageManager().listWorkspaces();
43212
- const existingExcludes = parseYamlListSection(content, "minimumReleaseAgeExclude").map(normalizeReleaseAgeExcludePattern);
43213
- const { missing, unnecessary } = diffReleaseAgeExcludePatterns(cwd, workspaces, existingExcludes, config.configuredReleaseAgeExclude ?? [...KNOWN_RELEASE_AGE_EXCLUDE_PATTERNS]);
43214
- if (missing.length === 0 && unnecessary.length === 0) return true;
43215
- const unnecessarySet = new Set(unnecessary);
43216
- const nextExcludes = [...existingExcludes.filter((pattern) => !unnecessarySet.has(pattern))];
43217
- for (const pattern of missing) if (!nextExcludes.includes(pattern)) nextExcludes.push(pattern);
43218
- const lines = content.split("\n");
43219
- const sectionIndex = lines.findIndex((line) => /^minimumReleaseAgeExclude\s*:/.test(line));
43220
- if (nextExcludes.length === 0) {
43221
- if (sectionIndex !== -1) {
43222
- let end = sectionIndex + 1;
43223
- while (end < lines.length && /^\s+-/.test(lines[end])) end++;
43224
- lines.splice(sectionIndex, end - sectionIndex);
43225
- }
43226
- } else if (sectionIndex === -1) {
43227
- const newSection = ["minimumReleaseAgeExclude:", ...nextExcludes.map((s) => ` - ${s}`)];
43228
- if (lines.at(-1) === "") lines.splice(-1, 0, ...newSection);
43229
- else lines.push(...newSection);
43230
- } else {
43231
- let end = sectionIndex + 1;
43232
- while (end < lines.length && /^\s+-/.test(lines[end])) end++;
43233
- lines.splice(sectionIndex, end - sectionIndex, "minimumReleaseAgeExclude:", ...nextExcludes.map((s) => ` - ${s}`));
43234
- }
43235
- writePnpmWorkspaceYaml(cwd, lines.join("\n"));
43236
- if (missing.length > 0) console.log(chalk.green(` Fixed: added ${missing.join(", ")} to minimumReleaseAgeExclude`));
43237
- if (unnecessary.length > 0) console.log(chalk.green(` Fixed: removed ${unnecessary.join(", ")} from minimumReleaseAgeExclude`));
43968
+ fixPnpmReleaseAgeExcludes(cwd, getPackageManager().listWorkspaces(), config.configuredReleaseAgeExclude ?? [...KNOWN_RELEASE_AGE_EXCLUDE_PATTERNS]);
43238
43969
  return true;
43239
43970
  }
43240
43971
  function hasPnpmWorkspaceSetting(content, key) {
@@ -50426,6 +51157,51 @@ function ruleCatalogResult(rules, title) {
50426
51157
  };
50427
51158
  }
50428
51159
  //#endregion
51160
+ //#region src/actions/secure/dependabotRules.ts
51161
+ /**
51162
+ Severity → default level. Alerts are overwhelmingly transitive lockfile
51163
+ findings, so nothing fails a build by default; raise these in
51164
+ `commands.dependabot.rules` to gate on them.
51165
+ */
51166
+ const DEFAULT_LEVELS = {
51167
+ critical: "warn",
51168
+ high: "warn",
51169
+ low: "off",
51170
+ medium: "off"
51171
+ };
51172
+ function alertLabel(alert) {
51173
+ const where = alert.repository === void 0 ? "" : `${alert.repository} `;
51174
+ const kind = `${alert.relationship}/${alert.scope}`;
51175
+ const patched = alert.patchedVersion === void 0 ? "no patch available" : `patched in ${alert.patchedVersion}`;
51176
+ const advisory = alert.ghsaId.length > 0 ? ` ${alert.ghsaId}` : "";
51177
+ return `${where}${alert.packageName} ${alert.vulnerableVersionRange} (${kind}) — ${patched}${advisory}`;
51178
+ }
51179
+ function severityRule(severity) {
51180
+ return {
51181
+ check: ({ alerts }) => {
51182
+ return { diagnostics: alerts.filter((alert) => alert.severity === severity).map((alert) => ({
51183
+ message: alertLabel(alert),
51184
+ rule: `dependabot.${severity}`
51185
+ })) };
51186
+ },
51187
+ defaultLevel: DEFAULT_LEVELS[severity],
51188
+ description: `Open Dependabot alerts with ${severity} severity`,
51189
+ id: `dependabot.${severity}`
51190
+ };
51191
+ }
51192
+ const DEPENDABOT_RULES = [...DEPENDABOT_SEVERITIES.map((severity) => severityRule(severity)), {
51193
+ check: ({ availability, target }) => {
51194
+ if (availability !== "disabled") return {};
51195
+ return { diagnostics: [{
51196
+ message: `Dependabot alerts are disabled for ${target.length > 0 ? target : "this repository"} — enable them in Settings → Code security`,
51197
+ rule: "dependabot.alerts-enabled"
51198
+ }] };
51199
+ },
51200
+ defaultLevel: "warn",
51201
+ description: "Dependabot alerts are enabled for the repository",
51202
+ id: "dependabot.alerts-enabled"
51203
+ }];
51204
+ //#endregion
50429
51205
  //#region src/actions/skills/detectProfile.ts
50430
51206
  const XYLABS_SCOPE = "@xylabs/";
50431
51207
  const ARIESTOOLS_SCOPE = "@ariestools/";
@@ -51178,34 +51954,11 @@ const XY_WORK_GITHUB_LABEL = "xy-work";
51178
51954
  HTML comment marker embedded in issue bodies so we can recognize our issues.
51179
51955
  */
51180
51956
  const XY_WORK_GITHUB_BODY_MARKER_PREFIX = "<!-- xy-work:";
51181
- const defaultGithubWorkRunner = (args, options = {}) => {
51182
- const result = spawnSync("gh", args, {
51183
- cwd: options.cwd,
51184
- encoding: "utf8",
51185
- env: process.env,
51186
- stdio: [
51187
- "ignore",
51188
- "pipe",
51189
- "pipe"
51190
- ]
51191
- });
51192
- return {
51193
- status: result.status,
51194
- stderr: typeof result.stderr === "string" ? result.stderr : "",
51195
- stdout: typeof result.stdout === "string" ? result.stdout : ""
51196
- };
51197
- };
51957
+ const defaultGithubWorkRunner = defaultGithubRunner;
51198
51958
  const isRecord = (value) => {
51199
51959
  return typeof value === "object" && value !== null && !Array.isArray(value);
51200
51960
  };
51201
- const runOrThrow = (runner, args, cwd, context) => {
51202
- const result = runner(args, { cwd });
51203
- if (result.status !== 0) {
51204
- const detail = result.stderr.trim() || result.stdout.trim() || `exit ${String(result.status)}`;
51205
- throw new Error(`${context}: ${detail}`);
51206
- }
51207
- return result.stdout;
51208
- };
51961
+ const runOrThrow = githubRunOrThrow;
51209
51962
  const parseIssueUrl = (url) => {
51210
51963
  const match = url.trim().match(/\/issues\/(\d+)\s*$/);
51211
51964
  if (match === null) throw new Error(`Could not parse GitHub issue number from: ${url.trim()}`);
@@ -51393,17 +52146,7 @@ const createGithubWorkBridge = (runner = defaultGithubWorkRunner) => {
51393
52146
  ], cwd, "Failed to create GitHub issue");
51394
52147
  return parseIssueUrl(stdout);
51395
52148
  },
51396
- isAvailable: (cwd) => {
51397
- if (runner(["--version"], { cwd }).status !== 0) return false;
51398
- if (runner(["auth", "status"], { cwd }).status !== 0) return false;
51399
- const repo = runner([
51400
- "repo",
51401
- "view",
51402
- "--json",
51403
- "nameWithOwner"
51404
- ], { cwd });
51405
- return repo.status === 0 && repo.stdout.trim().length > 0;
51406
- },
52149
+ isAvailable: (cwd) => githubIsAvailable(runner, cwd),
51407
52150
  listIssues,
51408
52151
  listOpenIssues: (cwd) => listIssues(cwd, "open"),
51409
52152
  updateIssue: (cwd, issueNumber, update) => {
@@ -52136,109 +52879,6 @@ const workLint = async (options = {}) => {
52136
52879
  };
52137
52880
  //#endregion
52138
52881
  //#region src/actions/ruleCatalog.ts
52139
- const REPO_LINT_RULES = [
52140
- [
52141
- "repo.root-private",
52142
- "Root package is private",
52143
- "error",
52144
- true
52145
- ],
52146
- [
52147
- "repo.no-private-publish-config",
52148
- "Private root has no publishConfig",
52149
- "error",
52150
- true
52151
- ],
52152
- [
52153
- "repo.packages-folder",
52154
- "Workspace packages live under packages/",
52155
- "error",
52156
- false
52157
- ],
52158
- [
52159
- "repo.spec-layout",
52160
- "Spec files live in spec/ folders",
52161
- "error",
52162
- false
52163
- ],
52164
- [
52165
- "repo.workspaces-field-placement",
52166
- "Workspace fields are declared in the package-manager-specific location",
52167
- "error",
52168
- true
52169
- ],
52170
- [
52171
- "repo.workspace-glob-coverage",
52172
- "Workspace globs cover every package",
52173
- "error",
52174
- false
52175
- ],
52176
- [
52177
- "repo.no-package-manager-in-workspaces",
52178
- "Only the root package declares packageManager",
52179
- "error",
52180
- true
52181
- ],
52182
- [
52183
- "repo.volta-only-root",
52184
- "Only the root package declares volta",
52185
- "error",
52186
- true
52187
- ],
52188
- [
52189
- "repo.engines-non-terminal",
52190
- "Only non-terminal packages declare engines",
52191
- "error",
52192
- true
52193
- ],
52194
- [
52195
- "repo.engines-lts",
52196
- "Engine and volta versions include latest LTS",
52197
- "error",
52198
- false
52199
- ],
52200
- [
52201
- "repo.version-consistency",
52202
- "Workspace versions are consistent",
52203
- "error",
52204
- true
52205
- ],
52206
- [
52207
- "repo.internal-dependency-ranges",
52208
- "Internal dependencies use the expected workspace/version protocol",
52209
- "error",
52210
- true
52211
- ],
52212
- [
52213
- "repo.internal-peer-ranges",
52214
- "Internal peerDependencies use publishable ranges",
52215
- "error",
52216
- true
52217
- ],
52218
- [
52219
- "repo.pnpm-release-age-excludes",
52220
- "pnpm minimumReleaseAgeExclude matches imported scopes",
52221
- "error",
52222
- true
52223
- ],
52224
- [
52225
- "repo.pnpm-minimum-release-age",
52226
- "pnpm minimumReleaseAge is configured",
52227
- "error",
52228
- true
52229
- ],
52230
- [
52231
- "repo.pnpm-no-overrides",
52232
- "pnpm dependency overrides are not configured",
52233
- "warn",
52234
- false
52235
- ]
52236
- ].map(([id, description, defaultLevel, fixable]) => ({
52237
- defaultLevel,
52238
- description,
52239
- fixable,
52240
- id
52241
- }));
52242
52882
  const NON_FIXABLE_DEAD_RULES = /* @__PURE__ */ new Set([
52243
52883
  "dead.repo.deprecated-export",
52244
52884
  "dead.workspace.deprecated-export",
@@ -52259,7 +52899,7 @@ async function loadCommandConfig(commandName, pkg) {
52259
52899
  }
52260
52900
  return loadWorkspaceCommandConfig(process.cwd(), commandName);
52261
52901
  }
52262
- function staticCatalog(command, configKey, definitions, config) {
52902
+ function runtimeRuleCatalog(command, configKey, definitions, config) {
52263
52903
  const ruleSettings = config?.rules ?? {};
52264
52904
  const known = new Set(definitions.flatMap((rule) => [rule.id, ...rule.aliases ?? []]));
52265
52905
  const unknown = Object.keys(ruleSettings).filter((id) => !known.has(id));
@@ -52278,9 +52918,6 @@ function staticCatalog(command, configKey, definitions, config) {
52278
52918
  level: parseRuleLevelSetting(ruleConfigPath(configKey, rule.id), resolveSetting(rule), rule.defaultLevel)
52279
52919
  }));
52280
52920
  }
52281
- function runtimeRuleCatalog(command, configKey, definitions, config) {
52282
- return staticCatalog(command, configKey, definitions, config);
52283
- }
52284
52921
  function commandPrefix(prefix, rules) {
52285
52922
  return rules.map((rule) => ({
52286
52923
  ...rule,
@@ -52348,6 +52985,9 @@ async function getApiExposureRuleCatalog(pkg) {
52348
52985
  };
52349
52986
  });
52350
52987
  }
52988
+ async function getDependabotRuleCatalog() {
52989
+ return runtimeRuleCatalog(RULE_COMMANDS.dependabot.command, RULE_COMMANDS.dependabot.configKey, DEPENDABOT_RULES, await loadCommandConfig("dependabot"));
52990
+ }
52351
52991
  async function getGitlintRuleCatalog() {
52352
52992
  return runtimeRuleCatalog(RULE_COMMANDS.gitLint.command, RULE_COMMANDS.gitLint.configKey, GITLINT_RULES, await loadCommandConfig("gitLint"));
52353
52993
  }
@@ -52355,7 +52995,7 @@ async function getPackmanRuleCatalog() {
52355
52995
  return runtimeRuleCatalog(RULE_COMMANDS.packman.command, RULE_COMMANDS.packman.configKey, PACKMAN_RULES, await loadCommandConfig("packman"));
52356
52996
  }
52357
52997
  async function getRepoLintRuleCatalog() {
52358
- return staticCatalog(RULE_COMMANDS.repoLint.command, RULE_COMMANDS.repoLint.configKey, REPO_LINT_RULES, await loadCommandConfig("repoLint"));
52998
+ return runtimeRuleCatalog(RULE_COMMANDS.repoLint.command, RULE_COMMANDS.repoLint.configKey, REPO_LINT_RULES, await loadCommandConfig("repoLint"));
52359
52999
  }
52360
53000
  async function getNodeLintRuleCatalog() {
52361
53001
  return runtimeRuleCatalog(RULE_COMMANDS.nodeLint.command, RULE_COMMANDS.nodeLint.configKey, NODE_LINT_RULES, await loadCommandConfig("nodeLint"));
@@ -52449,53 +53089,186 @@ function getCycleRuleCatalog(depth = 25) {
52449
53089
  level: "warn"
52450
53090
  }];
52451
53091
  }
52452
- async function loadDirectRuleCatalog() {
52453
- return sortRules([...(await Promise.all([
52454
- getApiExposureRuleCatalog(),
52455
- getCleanRuleCatalog(),
52456
- getDeadRuleCatalog(),
52457
- getDeplintRuleCatalog(),
52458
- getGitlintRuleCatalog(),
52459
- getPackmanRuleCatalog(),
52460
- getPublintRuleCatalog(),
52461
- getRepoLintRuleCatalog(),
52462
- getNodeLintRuleCatalog(),
52463
- getLintlintRuleCatalog(),
52464
- getSkillsLintRuleCatalog(),
52465
- getWorkLintRuleCatalog()
52466
- ])).flat(), ...getCycleRuleCatalog()]);
52467
- }
52468
53092
  async function getCheckRuleCatalog() {
52469
- return sortRules(commandPrefix("check", (await Promise.all([
53093
+ const groups = await Promise.all([
52470
53094
  getGitlintRuleCatalog(),
52471
53095
  getPackmanRuleCatalog(),
52472
53096
  getPublintRuleCatalog(),
52473
53097
  getRepoLintRuleCatalog(),
52474
53098
  getLintlintRuleCatalog(),
52475
53099
  getSkillsLintRuleCatalog()
52476
- ])).flat()));
53100
+ ]);
53101
+ return sortRules(commandPrefix(RULE_COMMANDS.check.command, groups.flat()));
52477
53102
  }
52478
53103
  async function getFixRuleCatalog() {
52479
- return sortRules(commandPrefix("fix", (await Promise.all([
53104
+ const groups = await Promise.all([
52480
53105
  getGitlintRuleCatalog(),
52481
53106
  getDeplintRuleCatalog(),
52482
53107
  getRepoLintRuleCatalog(),
52483
53108
  getPublintRuleCatalog(),
52484
- getEslintRuleCatalog("lint"),
53109
+ getEslintRuleCatalog(RULE_COMMANDS.lint.command),
52485
53110
  getLintlintRuleCatalog()
52486
- ])).flat()));
53111
+ ]);
53112
+ return sortRules(commandPrefix(RULE_COMMANDS.fix.command, groups.flat()));
53113
+ }
53114
+ /**
53115
+ * Every rule-bearing command, keyed by its `RULE_COMMANDS` entry. Declaring
53116
+ * this as a total `Record<RuleCommandKey, …>` makes the compiler reject a new
53117
+ * registry entry that has no catalog loader (and vice versa), so the root
53118
+ * `xy --rules` view cannot silently miss a command.
53119
+ */
53120
+ const RULE_CATALOG_LOADERS = {
53121
+ apiExposure: () => getApiExposureRuleCatalog(),
53122
+ check: () => getCheckRuleCatalog(),
53123
+ clean: () => getCleanRuleCatalog(),
53124
+ cycle: () => getCycleRuleCatalog(),
53125
+ dead: () => getDeadRuleCatalog(),
53126
+ dependabot: () => getDependabotRuleCatalog(),
53127
+ deplint: () => getDeplintRuleCatalog(),
53128
+ fix: () => getFixRuleCatalog(),
53129
+ gitLint: () => getGitlintRuleCatalog(),
53130
+ lint: () => getEslintRuleCatalog(),
53131
+ lintLint: () => getLintlintRuleCatalog(),
53132
+ nodeLint: () => getNodeLintRuleCatalog(),
53133
+ packman: () => getPackmanRuleCatalog(),
53134
+ publint: () => getPublintRuleCatalog(),
53135
+ repoLint: () => getRepoLintRuleCatalog(),
53136
+ skillsLint: () => getSkillsLintRuleCatalog(),
53137
+ workLint: () => getWorkLintRuleCatalog()
53138
+ };
53139
+ function rootRuleCommandKeys() {
53140
+ return Object.keys(RULE_COMMANDS).filter((key) => RULE_COMMANDS[key].includeInRoot);
53141
+ }
53142
+ async function getDirectRuleCatalog() {
53143
+ return sortRules((await Promise.all(rootRuleCommandKeys().map((key) => RULE_CATALOG_LOADERS[key]()))).flat());
52487
53144
  }
52488
53145
  async function getMasterRuleCatalog() {
52489
- return sortRules(await loadDirectRuleCatalog());
53146
+ return getDirectRuleCatalog();
52490
53147
  }
52491
53148
  //#endregion
52492
- //#region src/actions/secure.ts
52493
- const secure = async ({ jobs = 16, pkg, verbose = false } = {}) => {
53149
+ //#region src/actions/secure/dependabot.ts
53150
+ /**
53151
+ Fetch and filter alerts without rendering — used by `xy secure` to build its
53152
+ per-tool summary, and by `xy secure dependabot` before rule evaluation.
53153
+ */
53154
+ function collectDependabotAlerts(options = {}) {
53155
+ const report = fetchDependabotAlerts({
53156
+ cwd: options.cwd ?? INIT_CWD(),
53157
+ ...options.org !== void 0 && { org: options.org },
53158
+ ...options.runner !== void 0 && { runner: options.runner },
53159
+ ...options.state !== void 0 && { state: options.state }
53160
+ });
53161
+ const filtered = {
53162
+ ...report,
53163
+ alerts: sortDependabotAlerts(filterDependabotAlerts(report.alerts, {
53164
+ ...options.relationship !== void 0 && { relationship: options.relationship },
53165
+ ...options.scope !== void 0 && { scope: options.scope }
53166
+ }))
53167
+ };
53168
+ return {
53169
+ report: filtered,
53170
+ summary: summarizeDependabotAlerts(filtered)
53171
+ };
53172
+ }
53173
+ /**
53174
+ An org-wide sweep can match thousands of alerts. Cap what reaches the console
53175
+ and say how many were held back — the envelope always carries every one.
53176
+ */
53177
+ const DIAGNOSTIC_DISPLAY_LIMIT = 50;
53178
+ function createCappedReporter() {
53179
+ let shown = 0;
53180
+ let suppressed = 0;
53181
+ return {
53182
+ diagnostic: (diagnostic) => {
53183
+ if (shown >= DIAGNOSTIC_DISPLAY_LIMIT) {
53184
+ suppressed += 1;
53185
+ return;
53186
+ }
53187
+ shown += 1;
53188
+ const color = diagnostic.level === "error" ? chalk.red : chalk.yellow;
53189
+ const marker = diagnostic.level === "error" ? "✗" : "⚠";
53190
+ console.log(color(` ${marker} ${diagnostic.message}`));
53191
+ },
53192
+ reportSuppressed: () => {
53193
+ if (suppressed === 0) return;
53194
+ console.log(chalk.gray(` … ${suppressed} more not shown — re-run with --json for the full list`));
53195
+ }
53196
+ };
53197
+ }
53198
+ async function dependabot(options = {}) {
53199
+ const cwd = options.cwd ?? INIT_CWD();
53200
+ const { report, summary } = collectDependabotAlerts(options);
53201
+ if (options.summaryOnly === true) renderDependabotAlerts([], summary);
53202
+ else renderDependabotAlerts(report.alerts, summary);
53203
+ const context = {
53204
+ alerts: report.alerts,
53205
+ availability: report.availability,
53206
+ target: report.target
53207
+ };
53208
+ const config = await loadWorkspaceCommandConfig(cwd, RULE_COMMANDS.dependabot.configKey);
53209
+ const reporter = createCappedReporter();
53210
+ const result = await runRuleChecks({
53211
+ commandName: RULE_COMMANDS.dependabot.command,
53212
+ config,
53213
+ configKey: RULE_COMMANDS.dependabot.configKey,
53214
+ context,
53215
+ reporter: options.summaryOnly === true ? {} : { diagnostic: reporter.diagnostic },
53216
+ rules: DEPENDABOT_RULES,
53217
+ ...options.strict !== void 0 && { strict: options.strict }
53218
+ });
53219
+ if (options.summaryOnly === true) {
53220
+ const reportable = result.envelope.errorCount + result.envelope.warningCount;
53221
+ if (reportable > 0) console.log(chalk.gray(` ${reportable} alert(s) at or above the configured rule levels — re-run without --summary for detail`));
53222
+ } else reporter.reportSuppressed();
53223
+ return result;
53224
+ }
53225
+ //#endregion
53226
+ //#region src/actions/secure/deps.ts
53227
+ const secureDeps = async ({ jobs = 16, pkg, render, verbose = false } = {}) => {
52494
53228
  return await runSecurityAudit(getPackageManager(), {
52495
53229
  concurrency: jobs,
52496
53230
  pkg,
52497
- verbose
53231
+ verbose,
53232
+ ...render !== void 0 && { render }
53233
+ });
53234
+ };
53235
+ /**
53236
+ Run the dependency audit purely to collect its rows — used by `xy secure` to
53237
+ build a summary without printing the full table.
53238
+ */
53239
+ const collectSecureDepsRows = async (options = {}) => {
53240
+ let rows = [];
53241
+ return {
53242
+ exitCode: await secureDeps({
53243
+ ...options,
53244
+ render: (collected) => {
53245
+ rows = collected;
53246
+ }
53247
+ }),
53248
+ rows
53249
+ };
53250
+ };
53251
+ //#endregion
53252
+ //#region src/actions/secure/secure.ts
53253
+ /**
53254
+ The `xy secure` overview: run both audits, print one summary line each, and
53255
+ point at the subcommands for the detail tables.
53256
+ */
53257
+ const secure = async (options = {}) => {
53258
+ const { rows, exitCode } = await collectSecureDepsRows({
53259
+ jobs: options.jobs,
53260
+ pkg: options.pkg,
53261
+ verbose: options.verbose ?? false
52498
53262
  });
53263
+ renderSecureDepsSummary(rows);
53264
+ const { summary } = collectDependabotAlerts({
53265
+ ...options.cwd !== void 0 && { cwd: options.cwd },
53266
+ ...options.org !== void 0 && { org: options.org },
53267
+ ...options.runner !== void 0 && { runner: options.runner }
53268
+ });
53269
+ renderDependabotSummary(summary);
53270
+ console.log(chalk.gray("\n Details: xy secure deps · xy secure dependabot"));
53271
+ return combineResults([resultFromExitCode(exitCode)]);
52499
53272
  };
52500
53273
  //#endregion
52501
53274
  //#region src/actions/sitemap.ts
@@ -53546,7 +54319,7 @@ const checkCommand = {
53546
54319
  const jobs = argv.jobs;
53547
54320
  if (isVerbose) console.log("Check");
53548
54321
  if (argv.rules === true) {
53549
- await withEnvelope("check rules", async () => ruleCatalogResult(await getCheckRuleCatalog(), "Check Rules"));
54322
+ await withEnvelope("check rules", async () => ruleCatalogResult(await getCheckRuleCatalog(), RULE_COMMANDS.check.title));
53550
54323
  return;
53551
54324
  }
53552
54325
  await withEnvelope("check", async () => {
@@ -53632,7 +54405,7 @@ const deadCommand = {
53632
54405
  const isFixRemove = argv["fix-remove"] === true;
53633
54406
  const pkg = argv.package;
53634
54407
  if (argv.rules === true) {
53635
- await withEnvelope("dead rules", async () => ruleCatalogResult(await getDeadRuleCatalog(pkg, { deprecated: argv.deprecated === true }), "Dead Rules"));
54408
+ await withEnvelope("dead rules", async () => ruleCatalogResult(await getDeadRuleCatalog(pkg, { deprecated: argv.deprecated === true }), RULE_COMMANDS.dead.title));
53636
54409
  return;
53637
54410
  }
53638
54411
  await withEnvelope("dead", () => dead({
@@ -53647,6 +54420,33 @@ const deadCommand = {
53647
54420
  }
53648
54421
  };
53649
54422
  //#endregion
54423
+ //#region src/xy/common/enable/index.ts
54424
+ const tsNativeCommand = {
54425
+ command: "ts-native",
54426
+ describe: "Enable TypeScript native (Go) compiler for type-check and declaration emit",
54427
+ builder: (yargs) => {
54428
+ return yargs.option("no-install", {
54429
+ default: false,
54430
+ description: "Skip package manager install after adding typescript-native",
54431
+ type: "boolean"
54432
+ });
54433
+ },
54434
+ handler: async (argv) => {
54435
+ await withEnvelope("enable ts-native", () => enableTsNativeAction({
54436
+ isVerbose: !!Boolean(argv.verbose),
54437
+ noInstall: !!Boolean(argv["no-install"])
54438
+ }));
54439
+ }
54440
+ };
54441
+ const enableCommand = {
54442
+ builder: (yargs) => {
54443
+ return yargs.command(tsNativeCommand).demandCommand(1, "Please specify what to enable (e.g. ts-native)").strictCommands();
54444
+ },
54445
+ command: "enable",
54446
+ describe: "Enable optional toolchain features for this repository",
54447
+ handler: () => {}
54448
+ };
54449
+ //#endregion
53650
54450
  //#region src/xy/deprecatedCommand.ts
53651
54451
  function warnDeprecatedCommand(oldCommand, newCommand) {
53652
54452
  console.warn(chalk.yellow(`Deprecated: "xy ${oldCommand}" is deprecated; use "xy ${newCommand}" instead.`));
@@ -53812,7 +54612,7 @@ const lintCommand$3 = {
53812
54612
  },
53813
54613
  handler: async (argv) => {
53814
54614
  if (argv.rules === true) {
53815
- await withEnvelope("packman lint rules", async () => ruleCatalogResult(await getPackmanRuleCatalog(), "Packman Lint Rules"));
54615
+ await withEnvelope("packman lint rules", async () => ruleCatalogResult(await getPackmanRuleCatalog(), RULE_COMMANDS.packman.title));
53816
54616
  return;
53817
54617
  }
53818
54618
  await withEnvelope("packman lint", () => packmanLint({
@@ -53944,7 +54744,7 @@ const lintCommand$2 = {
53944
54744
  handler: async (argv) => {
53945
54745
  if (Boolean(argv.verbose)) console.log("Repo Lint");
53946
54746
  if (argv.rules === true) {
53947
- await withEnvelope("repo lint rules", async () => ruleCatalogResult(await getRepoLintRuleCatalog(), "Repo Lint Rules"));
54747
+ await withEnvelope("repo lint rules", async () => ruleCatalogResult(await getRepoLintRuleCatalog(), RULE_COMMANDS.repoLint.title));
53948
54748
  return;
53949
54749
  }
53950
54750
  await withEnvelope("repo lint", () => packageLintMonorepo(!!Boolean(argv.fix)));
@@ -53974,19 +54774,101 @@ const retestCommand = {
53974
54774
  }
53975
54775
  };
53976
54776
  //#endregion
53977
- //#region src/xy/common/secureCommand.ts
53978
- const secureCommand = {
54777
+ //#region src/xy/common/secure/dependabotCommand.ts
54778
+ const dependabotCommand = {
54779
+ builder: (yargs) => {
54780
+ return yargs.option("org", {
54781
+ description: "Report every repository in this GitHub org instead of the current repo",
54782
+ type: "string"
54783
+ }).option("relationship", {
54784
+ choices: [
54785
+ "all",
54786
+ "direct",
54787
+ "transitive"
54788
+ ],
54789
+ default: "all",
54790
+ description: "Only report alerts for direct or transitive dependencies",
54791
+ type: "string"
54792
+ }).option("rules", {
54793
+ description: "List supported dependabot rules and their effective levels",
54794
+ type: "boolean"
54795
+ }).option("scope", {
54796
+ choices: [
54797
+ "all",
54798
+ "development",
54799
+ "runtime"
54800
+ ],
54801
+ default: "all",
54802
+ description: "Only report alerts for runtime or development dependencies",
54803
+ type: "string"
54804
+ }).option("state", {
54805
+ choices: [
54806
+ "all",
54807
+ "dismissed",
54808
+ "fixed",
54809
+ "open"
54810
+ ],
54811
+ default: "open",
54812
+ description: "Alert state to report",
54813
+ type: "string"
54814
+ }).option("summary", {
54815
+ description: "Print only the summary line, not the per-alert table",
54816
+ type: "boolean"
54817
+ });
54818
+ },
54819
+ command: "dependabot",
54820
+ describe: "Report GitHub Dependabot security alerts",
54821
+ handler: async (argv) => {
54822
+ if (argv.rules === true) {
54823
+ await withEnvelope("secure dependabot rules", async () => ruleCatalogResult(await getDependabotRuleCatalog(), RULE_COMMANDS.dependabot.title));
54824
+ return;
54825
+ }
54826
+ const options = {
54827
+ relationship: argv.relationship,
54828
+ scope: argv.scope,
54829
+ state: argv.state,
54830
+ strict: argv.strict === true,
54831
+ summaryOnly: argv.summary === true,
54832
+ ...typeof argv.org === "string" && argv.org.length > 0 && { org: argv.org }
54833
+ };
54834
+ await withEnvelope("secure dependabot", () => dependabot(options));
54835
+ }
54836
+ };
54837
+ //#endregion
54838
+ //#region src/xy/common/secure/depsCommand.ts
54839
+ const depsCommand = {
53979
54840
  builder: (yargs) => {
53980
54841
  return packagePositionalParam(yargs);
53981
54842
  },
54843
+ command: "deps [package]",
54844
+ describe: "Audit direct dependency age and downloads",
54845
+ handler: async (argv) => {
54846
+ if (Boolean(argv.verbose)) console.log(`Secure deps: ${argv.package ?? "all"}`);
54847
+ await withEnvelope("secure deps", () => secureDeps({
54848
+ jobs: argv.jobs,
54849
+ pkg: argv.package,
54850
+ verbose: !!Boolean(argv.verbose)
54851
+ }));
54852
+ }
54853
+ };
54854
+ //#endregion
54855
+ //#region src/xy/common/secure/index.ts
54856
+ const secureCommand = {
54857
+ builder: (yargs) => {
54858
+ return packagePositionalParam(yargs).command(dependabotCommand).command(depsCommand).option("org", {
54859
+ description: "Summarize Dependabot alerts for this GitHub org instead of the current repo",
54860
+ type: "string"
54861
+ });
54862
+ },
53982
54863
  command: "secure [package]",
53983
- describe: "Secure - Audit direct dependency age and downloads",
54864
+ describe: "Secure - Dependency and Dependabot security overview",
53984
54865
  handler: async (argv) => {
53985
54866
  if (Boolean(argv.verbose)) console.log(`Secure: ${argv.package ?? "all"}`);
53986
54867
  await withEnvelope("secure", () => secure({
53987
54868
  jobs: argv.jobs,
53988
54869
  pkg: argv.package,
53989
- verbose: !!Boolean(argv.verbose)
54870
+ verbose: !!Boolean(argv.verbose),
54871
+ ...typeof argv.org === "string" && argv.org.length > 0 && { org: argv.org }
53990
54872
  }));
53991
54873
  }
53992
54874
  };
@@ -54086,7 +54968,7 @@ const runSkillsTail = async (tail) => {
54086
54968
  }
54087
54969
  if (subcommand === "defaults") return skillsDefaults(args);
54088
54970
  if (subcommand === "lint") {
54089
- if (args.includes("--rules")) return ruleCatalogResult(await getSkillsLintRuleCatalog(), "Skills Lint Rules");
54971
+ if (args.includes("--rules")) return ruleCatalogResult(await getSkillsLintRuleCatalog(), RULE_COMMANDS.skillsLint.title);
54090
54972
  const lintArgs = args.filter((arg) => !LINT_FLAGS.has(arg) && !HELP_FLAGS.has(arg));
54091
54973
  if (lintArgs.length > 0) {
54092
54974
  console.error(`Unknown arguments for skills lint: ${lintArgs.join(", ")}`);
@@ -54563,7 +55445,7 @@ const workCommand = {
54563
55445
  //#endregion
54564
55446
  //#region src/xy/common/index.ts
54565
55447
  const xyCommonCommands = (args) => {
54566
- return args.command(checkCommand).command(licenseCommand).command(deadCommand).command(gitCommand).command(gitlintCommand).command(gitignoreCommand).command(npmignoreGenCommand).command(orphanCommand).command(packmanCommand).command(repoCommand).command(retestCommand).command(secureCommand).command(skillsCommand).command(testCommand).command(workCommand);
55448
+ return args.command(checkCommand).command(licenseCommand).command(deadCommand).command(enableCommand).command(gitCommand).command(gitlintCommand).command(gitignoreCommand).command(npmignoreGenCommand).command(orphanCommand).command(packmanCommand).command(repoCommand).command(retestCommand).command(secureCommand).command(skillsCommand).command(testCommand).command(workCommand);
54567
55449
  };
54568
55450
  //#endregion
54569
55451
  //#region src/xy/deploy/deployCommand.ts
@@ -54634,9 +55516,16 @@ const cleanCommand = {
54634
55516
  default: false,
54635
55517
  description: "Like --full, but also ignores clean.exclude / default excludes (only .git is protected)",
54636
55518
  type: "boolean"
55519
+ }).option("rules", {
55520
+ description: "List supported clean rules and their effective levels",
55521
+ type: "boolean"
54637
55522
  });
54638
55523
  },
54639
55524
  handler: async (argv) => {
55525
+ if (argv.rules === true) {
55526
+ await withEnvelope("clean rules", async () => ruleCatalogResult(await getCleanRuleCatalog(argv.package), RULE_COMMANDS.clean.title));
55527
+ return;
55528
+ }
54640
55529
  const fullMode = resolveFullMode(argv);
54641
55530
  if (Boolean(argv.verbose)) console.log(`Cleaning: ${argv.package ?? "all"}${fullMode === "none" ? "" : ` (${fullMode})`}`);
54642
55531
  await withEnvelope("clean", () => clean({
@@ -54765,7 +55654,7 @@ const apiExposureCommand = {
54765
55654
  if (Boolean(argv.verbose)) console.log("API Exposure");
54766
55655
  const pkg = typeof argv.package === "string" ? argv.package : void 0;
54767
55656
  if (argv.rules === true) {
54768
- await withEnvelope("api-exposure rules", async () => ruleCatalogResult(await getApiExposureRuleCatalog(pkg), "API Exposure Rules"));
55657
+ await withEnvelope("api-exposure rules", async () => ruleCatalogResult(await getApiExposureRuleCatalog(pkg), RULE_COMMANDS.apiExposure.title));
54769
55658
  return;
54770
55659
  }
54771
55660
  const dep = argv.dep?.flatMap((value) => value.split(",")).map((value) => value.trim()).filter(Boolean);
@@ -54807,7 +55696,7 @@ const cycleCommand = {
54807
55696
  handler: async (argv) => {
54808
55697
  if (Boolean(argv.verbose)) console.log("Cycle");
54809
55698
  if (argv.rules === true) {
54810
- await withEnvelope("cycle rules", async () => ruleCatalogResult(getCycleRuleCatalog(argv.depth), "Cycle Rules"));
55699
+ await withEnvelope("cycle rules", async () => ruleCatalogResult(getCycleRuleCatalog(argv.depth), RULE_COMMANDS.cycle.title));
54811
55700
  return;
54812
55701
  }
54813
55702
  await withEnvelope("cycle", () => cycle({
@@ -54900,7 +55789,7 @@ const deplintRunCommand = {
54900
55789
  if (Boolean(argv.verbose)) console.log("Deplint");
54901
55790
  const pkg = typeof argv.package === "string" ? argv.package : void 0;
54902
55791
  if (argv.rules === true) {
54903
- await withEnvelope("deplint rules", async () => ruleCatalogResult(await getDeplintRuleCatalog(pkg), "Deplint Rules"));
55792
+ await withEnvelope("deplint rules", async () => ruleCatalogResult(await getDeplintRuleCatalog(pkg), RULE_COMMANDS.deplint.title));
54904
55793
  return;
54905
55794
  }
54906
55795
  const cliExclude = argv.exclude?.flatMap((v) => v.split(",")).map((v) => v.trim()).filter(Boolean);
@@ -54944,7 +55833,7 @@ const fixCommand = {
54944
55833
  handler: async (argv) => {
54945
55834
  if (Boolean(argv.verbose)) console.log("Fix");
54946
55835
  if (argv.rules === true) {
54947
- await withEnvelope("fix rules", async () => ruleCatalogResult(await getFixRuleCatalog(), "Fix Rules"));
55836
+ await withEnvelope("fix rules", async () => ruleCatalogResult(await getFixRuleCatalog(), RULE_COMMANDS.fix.title));
54948
55837
  return;
54949
55838
  }
54950
55839
  await withEnvelope("fix", () => fix({
@@ -55093,7 +55982,7 @@ const runCommand = {
55093
55982
  handler: async (argv) => {
55094
55983
  if (Boolean(argv.verbose)) console.log(Boolean(argv.analyze) ? "Lint analyze" : "Lint");
55095
55984
  if (argv.rules === true) {
55096
- await withEnvelope("lint rules", async () => ruleCatalogResult(await getEslintRuleCatalog("lint"), "Lint Rules"));
55985
+ await withEnvelope("lint rules", async () => ruleCatalogResult(await getEslintRuleCatalog("lint"), RULE_COMMANDS.lint.title));
55097
55986
  return;
55098
55987
  }
55099
55988
  if (Boolean(argv.fresh)) {
@@ -60833,7 +61722,7 @@ const xyBase = async (plugins) => {
60833
61722
  warnIfUnsupportedPackageManager();
60834
61723
  if (isRootRulesRequest()) {
60835
61724
  if (process.argv.some((arg) => isTruthyLongFlag(arg, "--json"))) setJsonMode(true);
60836
- await withEnvelope("rules", async () => ruleCatalogResult(await getMasterRuleCatalog(), "XY Rules"));
61725
+ await withEnvelope("rules", async () => ruleCatalogResult(await getMasterRuleCatalog(), ROOT_RULES_TITLE));
60837
61726
  return;
60838
61727
  }
60839
61728
  const options = xyParseOptions();