@ariestools/toolchain 9.0.0 → 9.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +94 -0
- package/dist/actions/index.d.ts +1 -1
- package/dist/actions/index.d.ts.map +1 -1
- package/dist/actions/package-lint-pnpm.d.ts +8 -1
- package/dist/actions/package-lint-pnpm.d.ts.map +1 -1
- package/dist/actions/package-lint.d.ts +16 -1
- package/dist/actions/package-lint.d.ts.map +1 -1
- package/dist/actions/packman/lint.d.ts.map +1 -1
- package/dist/actions/ruleCatalog.d.ts +4 -1
- package/dist/actions/ruleCatalog.d.ts.map +1 -1
- package/dist/actions/ruleRunner.d.ts +2 -1
- package/dist/actions/ruleRunner.d.ts.map +1 -1
- package/dist/actions/secure/dependabot.d.ts +22 -0
- package/dist/actions/secure/dependabot.d.ts.map +1 -0
- package/dist/actions/secure/dependabotRules.d.ts +9 -0
- package/dist/actions/secure/dependabotRules.d.ts.map +1 -0
- package/dist/actions/secure/deps.d.ts +18 -0
- package/dist/actions/secure/deps.d.ts.map +1 -0
- package/dist/actions/secure/index.d.ts +5 -0
- package/dist/actions/secure/index.d.ts.map +1 -0
- package/dist/actions/secure/secure.d.ts +16 -0
- package/dist/actions/secure/secure.d.ts.map +1 -0
- package/dist/actions/work/github.d.ts +3 -8
- package/dist/actions/work/github.d.ts.map +1 -1
- package/dist/bin/package/build.mjs +444 -418
- package/dist/bin/package/build.mjs.map +1 -1
- package/dist/bin/package/clean.mjs +36 -30
- package/dist/bin/package/clean.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +28 -28
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/publint.mjs +395 -369
- package/dist/bin/package/publint.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +36 -30
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/bin/package/sync-layout.mjs +28 -28
- package/dist/bin/package/sync-layout.mjs.map +1 -1
- package/dist/bin/xy.mjs +1258 -725
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/lib/github/index.d.ts +2 -0
- package/dist/lib/github/index.d.ts.map +1 -0
- package/dist/lib/github/runner.d.ts +25 -0
- package/dist/lib/github/runner.d.ts.map +1 -0
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/ruleCommandRegistry.d.ts +17 -2
- package/dist/lib/ruleCommandRegistry.d.ts.map +1 -1
- package/dist/lib/secure/dependabot/fetchDependabotAlerts.d.ts +12 -0
- package/dist/lib/secure/dependabot/fetchDependabotAlerts.d.ts.map +1 -0
- package/dist/lib/secure/dependabot/index.d.ts +6 -0
- package/dist/lib/secure/dependabot/index.d.ts.map +1 -0
- package/dist/lib/secure/dependabot/interfaces.d.ts +49 -0
- package/dist/lib/secure/dependabot/interfaces.d.ts.map +1 -0
- package/dist/lib/secure/dependabot/renderDependabotAlerts.d.ts +4 -0
- package/dist/lib/secure/dependabot/renderDependabotAlerts.d.ts.map +1 -0
- package/dist/lib/secure/dependabot/summarizeDependabotAlerts.d.ts +5 -0
- package/dist/lib/secure/dependabot/summarizeDependabotAlerts.d.ts.map +1 -0
- package/dist/lib/secure/dependabot/vulnerabilityAlerts.d.ts +21 -0
- package/dist/lib/secure/dependabot/vulnerabilityAlerts.d.ts.map +1 -0
- package/dist/lib/secure/index.d.ts +1 -0
- package/dist/lib/secure/index.d.ts.map +1 -1
- package/dist/lib/secure/renderSecurityAudit.d.ts +4 -0
- package/dist/lib/secure/renderSecurityAudit.d.ts.map +1 -1
- package/dist/xy/common/secure/dependabotCommand.d.ts +3 -0
- package/dist/xy/common/secure/dependabotCommand.d.ts.map +1 -0
- package/dist/xy/common/secure/depsCommand.d.ts +3 -0
- package/dist/xy/common/secure/depsCommand.d.ts.map +1 -0
- package/dist/xy/common/secure/index.d.ts +5 -0
- package/dist/xy/common/secure/index.d.ts.map +1 -0
- package/dist/xy/install/cleanCommand.d.ts.map +1 -1
- package/dist/xy/xy.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/bin/xy.mjs
CHANGED
|
@@ -16,8 +16,8 @@ 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
|
|
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
22
|
import { TypeScriptLoader } from "cosmiconfig-typescript-loader";
|
|
23
23
|
import { performance as performance$1 } from "node:perf_hooks";
|
|
@@ -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
|
|
725
|
+
return new I(n, t).streamSync();
|
|
726
726
|
}
|
|
727
727
|
function Qe(n, t = {}) {
|
|
728
|
-
return new I
|
|
728
|
+
return new I(n, t).stream();
|
|
729
729
|
}
|
|
730
730
|
function ts$1(n, t = {}) {
|
|
731
|
-
return new I
|
|
731
|
+
return new I(n, t).walkSync();
|
|
732
732
|
}
|
|
733
733
|
async function Je(n, t = {}) {
|
|
734
|
-
return new I
|
|
734
|
+
return new I(n, t).walk();
|
|
735
735
|
}
|
|
736
736
|
function Ut(n, t = {}) {
|
|
737
|
-
return new I
|
|
737
|
+
return new I(n, t).iterateSync();
|
|
738
738
|
}
|
|
739
739
|
function es(n, t = {}) {
|
|
740
|
-
return new I
|
|
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
|
|
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
|
|
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
|
|
1190
|
+
O.sep = Ae === "win32" ? xe.win32.sep : xe.posix.sep;
|
|
1191
1191
|
A = Symbol("globstar **");
|
|
1192
|
-
O
|
|
1192
|
+
O.GLOBSTAR = A;
|
|
1193
1193
|
Vs = "[^/]*?";
|
|
1194
1194
|
Ys = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
|
|
1195
1195
|
Xs = "(?:(?!(?:\\/|^)\\.).)*?";
|
|
1196
|
-
Js = (n, t = {}) => (e) => O
|
|
1197
|
-
O
|
|
1198
|
-
N
|
|
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
|
|
1201
|
-
let t = O
|
|
1202
|
-
return Object.assign((s, i, r = {}) => t(s, i, N
|
|
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
|
|
1205
|
+
super(i, N(n, r));
|
|
1206
1206
|
}
|
|
1207
1207
|
static defaults(i) {
|
|
1208
|
-
return t.defaults(N
|
|
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
|
|
1213
|
+
super(i, r, N(n, o));
|
|
1214
1214
|
}
|
|
1215
1215
|
static fromGlob(i, r = {}) {
|
|
1216
|
-
return t.AST.fromGlob(i, N
|
|
1216
|
+
return t.AST.fromGlob(i, N(n, r));
|
|
1217
1217
|
}
|
|
1218
1218
|
},
|
|
1219
|
-
unescape: (s, i = {}) => t.unescape(s, N
|
|
1220
|
-
escape: (s, i = {}) => t.escape(s, N
|
|
1221
|
-
filter: (s, i = {}) => t.filter(s, N
|
|
1222
|
-
defaults: (s) => t.defaults(N
|
|
1223
|
-
makeRe: (s, i = {}) => t.makeRe(s, N
|
|
1224
|
-
braceExpand: (s, i = {}) => t.braceExpand(s, N
|
|
1225
|
-
match: (s, i, r = {}) => t.match(s, i, N
|
|
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
|
|
1230
|
+
O.defaults = Zs;
|
|
1231
1231
|
ke = (n, t = {}) => (at(n), t.nobrace || !/\{(?:(?!\{).)*\}/.test(n) ? [n] : ge(n, { max: t.braceExpandMax }));
|
|
1232
|
-
O
|
|
1233
|
-
Qs = (n, t = {}) => new D
|
|
1234
|
-
O
|
|
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
|
|
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
|
|
1239
|
+
O.match = ti;
|
|
1240
1240
|
ve = /[?*]|[+@!]\(.*?\)|\[|\]/;
|
|
1241
1241
|
ei = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
1242
|
-
D
|
|
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
|
|
1519
|
+
return O.defaults(t).Minimatch;
|
|
1520
1520
|
}
|
|
1521
1521
|
};
|
|
1522
|
-
O
|
|
1523
|
-
O
|
|
1524
|
-
O
|
|
1525
|
-
O
|
|
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
|
|
2146
|
+
P = Symbol("encoding");
|
|
2147
2147
|
et = Symbol("decoder");
|
|
2148
|
-
v
|
|
2148
|
+
v = Symbol("flowing");
|
|
2149
2149
|
dt = Symbol("paused");
|
|
2150
2150
|
st = Symbol("resume");
|
|
2151
|
-
C
|
|
2152
|
-
F
|
|
2153
|
-
T
|
|
2151
|
+
C = Symbol("buffer");
|
|
2152
|
+
F = Symbol("pipes");
|
|
2153
|
+
T = Symbol("bufferLength");
|
|
2154
2154
|
Yt = Symbol("bufferPush");
|
|
2155
2155
|
Ft = Symbol("bufferShift");
|
|
2156
|
-
k
|
|
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
|
|
2200
|
+
[v] = !1;
|
|
2201
2201
|
[dt] = !1;
|
|
2202
|
-
[F
|
|
2203
|
-
[C
|
|
2204
|
-
[k
|
|
2205
|
-
[P
|
|
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
|
|
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
|
|
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
|
|
2229
|
+
return this[T];
|
|
2230
2230
|
}
|
|
2231
2231
|
get encoding() {
|
|
2232
|
-
return this[P
|
|
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
|
|
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
|
|
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
|
|
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
|
|
2275
|
-
this[k
|
|
2276
|
-
let e = this[_e](t || null, this[C
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
2303
|
+
return this[v];
|
|
2304
2304
|
}
|
|
2305
2305
|
get paused() {
|
|
2306
2306
|
return this[dt];
|
|
2307
2307
|
}
|
|
2308
2308
|
[Yt](t) {
|
|
2309
|
-
this[k
|
|
2309
|
+
this[k] ? this[T] += 1 : this[T] += t.length, this[C].push(t);
|
|
2310
2310
|
}
|
|
2311
2311
|
[Ft]() {
|
|
2312
|
-
return this[k
|
|
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
|
|
2317
|
-
!t && !this[C
|
|
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
|
|
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
|
|
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
|
|
2330
|
-
e && (this[F
|
|
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
|
|
2338
|
-
else if (t === "readable" && this[T
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
2415
|
+
if (this[k]) throw new Error("cannot concat in objectMode");
|
|
2416
2416
|
let t = await this.collect();
|
|
2417
|
-
return this[P
|
|
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
|
|
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
|
-
_
|
|
2531
|
-
gt = ~_
|
|
2530
|
+
_ = 15;
|
|
2531
|
+
gt = ~_;
|
|
2532
2532
|
se = 16;
|
|
2533
2533
|
je = 32;
|
|
2534
2534
|
yt = 64;
|
|
2535
|
-
j
|
|
2535
|
+
j = 128;
|
|
2536
2536
|
Nt = 256;
|
|
2537
2537
|
Lt = 512;
|
|
2538
|
-
Ie = yt | j
|
|
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
|
|
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
|
|
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 & _
|
|
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 & _
|
|
2746
|
+
return (this.#e & _) === Ke;
|
|
2747
2747
|
}
|
|
2748
2748
|
isDirectory() {
|
|
2749
|
-
return (this.#e & _
|
|
2749
|
+
return (this.#e & _) === U;
|
|
2750
2750
|
}
|
|
2751
2751
|
isCharacterDevice() {
|
|
2752
|
-
return (this.#e & _
|
|
2752
|
+
return (this.#e & _) === He;
|
|
2753
2753
|
}
|
|
2754
2754
|
isBlockDevice() {
|
|
2755
|
-
return (this.#e & _
|
|
2755
|
+
return (this.#e & _) === qe;
|
|
2756
2756
|
}
|
|
2757
2757
|
isFIFO() {
|
|
2758
|
-
return (this.#e & _
|
|
2758
|
+
return (this.#e & _) === Ge;
|
|
2759
2759
|
}
|
|
2760
2760
|
isSocket() {
|
|
2761
|
-
return (this.#e & _
|
|
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 & _
|
|
2783
|
-
return !(t !== L && t !== X || this.#e & Nt || this.#e & j
|
|
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
|
|
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
|
|
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 & _
|
|
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
|
|
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 & _
|
|
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
|
|
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
|
|
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 = _
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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 (
|
|
7847
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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();
|
|
@@ -10397,6 +10458,8 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
10397
10458
|
}));
|
|
10398
10459
|
//#endregion
|
|
10399
10460
|
//#region src/lib/ruleCommandRegistry.ts
|
|
10461
|
+
/** Title for the root `xy --rules` catalog. */
|
|
10462
|
+
const ROOT_RULES_TITLE = "XY Rules";
|
|
10400
10463
|
const RULE_COMMANDS = {
|
|
10401
10464
|
apiExposure: {
|
|
10402
10465
|
command: "api-exposure",
|
|
@@ -10406,7 +10469,7 @@ const RULE_COMMANDS = {
|
|
|
10406
10469
|
},
|
|
10407
10470
|
check: {
|
|
10408
10471
|
command: "check",
|
|
10409
|
-
includeInRoot:
|
|
10472
|
+
includeInRoot: false,
|
|
10410
10473
|
title: "Check Rules"
|
|
10411
10474
|
},
|
|
10412
10475
|
clean: {
|
|
@@ -10426,6 +10489,12 @@ const RULE_COMMANDS = {
|
|
|
10426
10489
|
includeInRoot: true,
|
|
10427
10490
|
title: "Dead Rules"
|
|
10428
10491
|
},
|
|
10492
|
+
dependabot: {
|
|
10493
|
+
command: "secure dependabot",
|
|
10494
|
+
configKey: "dependabot",
|
|
10495
|
+
includeInRoot: true,
|
|
10496
|
+
title: "Dependabot Rules"
|
|
10497
|
+
},
|
|
10429
10498
|
deplint: {
|
|
10430
10499
|
command: "deplint",
|
|
10431
10500
|
configKey: "deplint",
|
|
@@ -10447,7 +10516,7 @@ const RULE_COMMANDS = {
|
|
|
10447
10516
|
lint: {
|
|
10448
10517
|
aliases: ["relint"],
|
|
10449
10518
|
command: "lint",
|
|
10450
|
-
includeInRoot:
|
|
10519
|
+
includeInRoot: false,
|
|
10451
10520
|
title: "Lint Rules"
|
|
10452
10521
|
},
|
|
10453
10522
|
lintLint: {
|
|
@@ -10528,7 +10597,7 @@ In-flight workspace loads — concurrent jobs for the same dir share one search.
|
|
|
10528
10597
|
*/
|
|
10529
10598
|
const workspaceConfigLoadPromises = /* @__PURE__ */ new Map();
|
|
10530
10599
|
const deprecationWarned = /* @__PURE__ */ new Set();
|
|
10531
|
-
function isRecord$
|
|
10600
|
+
function isRecord$9(value) {
|
|
10532
10601
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
10533
10602
|
}
|
|
10534
10603
|
const explorerState = {};
|
|
@@ -10609,12 +10678,12 @@ function warnOnce(key, message) {
|
|
|
10609
10678
|
*/
|
|
10610
10679
|
function resolveCommandField(cfg, commandName, configPath) {
|
|
10611
10680
|
const configKey = canonicalRuleConfigKey(commandName);
|
|
10612
|
-
const commands = isRecord$
|
|
10681
|
+
const commands = isRecord$9(cfg.commands) ? cfg.commands : void 0;
|
|
10613
10682
|
const fromCommands = commands?.[configKey];
|
|
10614
|
-
if (isRecord$
|
|
10683
|
+
if (isRecord$9(fromCommands)) return fromCommands;
|
|
10615
10684
|
for (const alias of deprecatedRuleConfigAliases(configKey)) {
|
|
10616
10685
|
const fromAlias = commands?.[alias];
|
|
10617
|
-
if (!isRecord$
|
|
10686
|
+
if (!isRecord$9(fromAlias)) continue;
|
|
10618
10687
|
warnOnce(`${configPath ?? "unknown"}:commands.${alias}`, `[xy] Deprecated: "commands.${alias}" in ${configPath ?? "xy.config"} — use "commands.${configKey}"`);
|
|
10619
10688
|
return fromAlias;
|
|
10620
10689
|
}
|
|
@@ -10626,7 +10695,7 @@ function resolveCommandField(cfg, commandName, configPath) {
|
|
|
10626
10695
|
return {};
|
|
10627
10696
|
}
|
|
10628
10697
|
function mergeRuleConfigs(target, source) {
|
|
10629
|
-
if (isRecord$
|
|
10698
|
+
if (isRecord$9(target) && isRecord$9(source)) return {
|
|
10630
10699
|
...target,
|
|
10631
10700
|
...source
|
|
10632
10701
|
};
|
|
@@ -19340,6 +19409,295 @@ function collectSecureDeclaredDependencies(cwd, targets, localPackageNames) {
|
|
|
19340
19409
|
});
|
|
19341
19410
|
}
|
|
19342
19411
|
//#endregion
|
|
19412
|
+
//#region src/lib/secure/dependabot/fetchDependabotAlerts.ts
|
|
19413
|
+
/**
|
|
19414
|
+
Ask GitHub for only the fields we render. An org-wide sweep returns thousands
|
|
19415
|
+
of alerts, and each raw alert carries a full advisory body plus reference and
|
|
19416
|
+
identifier lists — the projection keeps the transfer to a fraction of that
|
|
19417
|
+
while preserving the payload shape `parseDependabotAlert` expects.
|
|
19418
|
+
*/
|
|
19419
|
+
const ALERT_PROJECTION = [
|
|
19420
|
+
".[] | {",
|
|
19421
|
+
"number, html_url, dependency, security_vulnerability,",
|
|
19422
|
+
"security_advisory: {",
|
|
19423
|
+
"ghsa_id: .security_advisory.ghsa_id,",
|
|
19424
|
+
"severity: .security_advisory.severity,",
|
|
19425
|
+
"summary: .security_advisory.summary },",
|
|
19426
|
+
"repository: { full_name: .repository.full_name }",
|
|
19427
|
+
"}"
|
|
19428
|
+
].join(" ");
|
|
19429
|
+
const SEVERITIES = /* @__PURE__ */ new Set([
|
|
19430
|
+
"critical",
|
|
19431
|
+
"high",
|
|
19432
|
+
"low",
|
|
19433
|
+
"medium"
|
|
19434
|
+
]);
|
|
19435
|
+
const SCOPES = /* @__PURE__ */ new Set(["development", "runtime"]);
|
|
19436
|
+
const RELATIONSHIPS = /* @__PURE__ */ new Set(["direct", "transitive"]);
|
|
19437
|
+
function isRecord$8(value) {
|
|
19438
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
19439
|
+
}
|
|
19440
|
+
function readString(value) {
|
|
19441
|
+
return typeof value === "string" ? value : "";
|
|
19442
|
+
}
|
|
19443
|
+
function readSeverity(value) {
|
|
19444
|
+
const raw = readString(value).toLowerCase();
|
|
19445
|
+
return SEVERITIES.has(raw) ? raw : "low";
|
|
19446
|
+
}
|
|
19447
|
+
function readScope(value) {
|
|
19448
|
+
const raw = readString(value).toLowerCase();
|
|
19449
|
+
return SCOPES.has(raw) ? raw : "unknown";
|
|
19450
|
+
}
|
|
19451
|
+
function readRelationship(value) {
|
|
19452
|
+
const raw = readString(value).toLowerCase();
|
|
19453
|
+
return RELATIONSHIPS.has(raw) ? raw : "unknown";
|
|
19454
|
+
}
|
|
19455
|
+
function parseDependabotAlert(raw) {
|
|
19456
|
+
if (!isRecord$8(raw)) return void 0;
|
|
19457
|
+
const dependency = isRecord$8(raw.dependency) ? raw.dependency : {};
|
|
19458
|
+
const dependencyPackage = isRecord$8(dependency.package) ? dependency.package : {};
|
|
19459
|
+
const advisory = isRecord$8(raw.security_advisory) ? raw.security_advisory : {};
|
|
19460
|
+
const vulnerability = isRecord$8(raw.security_vulnerability) ? raw.security_vulnerability : {};
|
|
19461
|
+
const patched = isRecord$8(vulnerability.first_patched_version) ? vulnerability.first_patched_version : {};
|
|
19462
|
+
const repository = isRecord$8(raw.repository) ? raw.repository : {};
|
|
19463
|
+
const packageName = readString(dependencyPackage.name);
|
|
19464
|
+
if (packageName.length === 0) return void 0;
|
|
19465
|
+
const patchedVersion = readString(patched.identifier);
|
|
19466
|
+
const repositoryName = readString(repository.full_name);
|
|
19467
|
+
return {
|
|
19468
|
+
ecosystem: readString(dependencyPackage.ecosystem),
|
|
19469
|
+
ghsaId: readString(advisory.ghsa_id),
|
|
19470
|
+
htmlUrl: readString(raw.html_url),
|
|
19471
|
+
manifestPath: readString(dependency.manifest_path),
|
|
19472
|
+
number: typeof raw.number === "number" ? raw.number : 0,
|
|
19473
|
+
packageName,
|
|
19474
|
+
relationship: readRelationship(dependency.relationship),
|
|
19475
|
+
scope: readScope(dependency.scope),
|
|
19476
|
+
severity: readSeverity(advisory.severity),
|
|
19477
|
+
summary: readString(advisory.summary),
|
|
19478
|
+
vulnerableVersionRange: readString(vulnerability.vulnerable_version_range),
|
|
19479
|
+
...patchedVersion.length > 0 && { patchedVersion },
|
|
19480
|
+
...repositoryName.length > 0 && { repository: repositoryName }
|
|
19481
|
+
};
|
|
19482
|
+
}
|
|
19483
|
+
function resolveTarget(runner, cwd, org) {
|
|
19484
|
+
if (org !== void 0 && org.length > 0) return org;
|
|
19485
|
+
const result = runner([
|
|
19486
|
+
"repo",
|
|
19487
|
+
"view",
|
|
19488
|
+
"--json",
|
|
19489
|
+
"nameWithOwner",
|
|
19490
|
+
"--jq",
|
|
19491
|
+
".nameWithOwner"
|
|
19492
|
+
], { cwd });
|
|
19493
|
+
return result.status === 0 ? result.stdout.trim() : "";
|
|
19494
|
+
}
|
|
19495
|
+
/**
|
|
19496
|
+
GitHub answers "the feature is switched off for this repo" with a 403 rather
|
|
19497
|
+
than an empty list, so treat that one message as a state, not an error.
|
|
19498
|
+
*/
|
|
19499
|
+
function isAlertsDisabled(stderr, stdout) {
|
|
19500
|
+
return `${stderr}\n${stdout}`.includes("Dependabot alerts are disabled");
|
|
19501
|
+
}
|
|
19502
|
+
function fetchDependabotAlerts(options) {
|
|
19503
|
+
const { cwd, org, runner = defaultGithubRunner, state = "open" } = options;
|
|
19504
|
+
if (!githubIsAvailable(runner, cwd)) return {
|
|
19505
|
+
alerts: [],
|
|
19506
|
+
availability: "no-gh",
|
|
19507
|
+
target: org ?? ""
|
|
19508
|
+
};
|
|
19509
|
+
const target = resolveTarget(runner, cwd, org);
|
|
19510
|
+
const result = runner([
|
|
19511
|
+
"api",
|
|
19512
|
+
"--paginate",
|
|
19513
|
+
`${org !== void 0 && org.length > 0 ? `orgs/${org}/dependabot/alerts` : "repos/{owner}/{repo}/dependabot/alerts"}?state=${state}&per_page=100`,
|
|
19514
|
+
"--jq",
|
|
19515
|
+
ALERT_PROJECTION
|
|
19516
|
+
], { cwd });
|
|
19517
|
+
if (result.status !== 0) {
|
|
19518
|
+
if (isAlertsDisabled(result.stderr, result.stdout)) return {
|
|
19519
|
+
alerts: [],
|
|
19520
|
+
availability: "disabled",
|
|
19521
|
+
target
|
|
19522
|
+
};
|
|
19523
|
+
const detail = result.stderr.trim() || result.stdout.trim() || `exit ${String(result.status)}`;
|
|
19524
|
+
throw new Error(`Failed to read Dependabot alerts for ${target.length > 0 ? target : cwd}: ${detail}`);
|
|
19525
|
+
}
|
|
19526
|
+
return {
|
|
19527
|
+
alerts: parseGithubPaginatedJson(result.stdout).map((entry) => parseDependabotAlert(entry)).filter((alert) => alert !== void 0),
|
|
19528
|
+
availability: "ok",
|
|
19529
|
+
target
|
|
19530
|
+
};
|
|
19531
|
+
}
|
|
19532
|
+
//#endregion
|
|
19533
|
+
//#region src/lib/secure/dependabot/interfaces.ts
|
|
19534
|
+
const DEPENDABOT_SEVERITIES = [
|
|
19535
|
+
"critical",
|
|
19536
|
+
"high",
|
|
19537
|
+
"medium",
|
|
19538
|
+
"low"
|
|
19539
|
+
];
|
|
19540
|
+
//#endregion
|
|
19541
|
+
//#region src/lib/secure/dependabot/renderDependabotAlerts.ts
|
|
19542
|
+
const SEVERITY_COLOR = {
|
|
19543
|
+
critical: chalk.hex("#b26cff"),
|
|
19544
|
+
high: chalk.red,
|
|
19545
|
+
low: chalk.gray,
|
|
19546
|
+
medium: chalk.yellow
|
|
19547
|
+
};
|
|
19548
|
+
function relationshipLabel(alert) {
|
|
19549
|
+
return `${alert.relationship === "unknown" ? "?" : alert.relationship.slice(0, 6)}/${alert.scope === "development" ? "dev" : alert.scope === "runtime" ? "run" : "?"}`;
|
|
19550
|
+
}
|
|
19551
|
+
function pad$3(raw, colored, width) {
|
|
19552
|
+
return colored + " ".repeat(Math.max(0, width - raw.length));
|
|
19553
|
+
}
|
|
19554
|
+
function columnsFor(showRepository) {
|
|
19555
|
+
return [
|
|
19556
|
+
{
|
|
19557
|
+
color: (alert, raw) => SEVERITY_COLOR[alert.severity](raw),
|
|
19558
|
+
header: "Severity",
|
|
19559
|
+
value: (alert) => alert.severity
|
|
19560
|
+
},
|
|
19561
|
+
...showRepository ? [{
|
|
19562
|
+
color: (_alert, raw) => chalk.gray(raw),
|
|
19563
|
+
header: "Repository",
|
|
19564
|
+
value: (alert) => alert.repository ?? "-"
|
|
19565
|
+
}] : [],
|
|
19566
|
+
{
|
|
19567
|
+
color: (_alert, raw) => chalk.white(raw),
|
|
19568
|
+
header: "Package",
|
|
19569
|
+
value: (alert) => alert.packageName
|
|
19570
|
+
},
|
|
19571
|
+
{
|
|
19572
|
+
color: (_alert, raw) => chalk.gray(raw),
|
|
19573
|
+
header: "Kind",
|
|
19574
|
+
value: (alert) => relationshipLabel(alert)
|
|
19575
|
+
},
|
|
19576
|
+
{
|
|
19577
|
+
color: (_alert, raw) => chalk.gray(raw),
|
|
19578
|
+
header: "Vulnerable",
|
|
19579
|
+
value: (alert) => alert.vulnerableVersionRange.length > 0 ? alert.vulnerableVersionRange : "-"
|
|
19580
|
+
},
|
|
19581
|
+
{
|
|
19582
|
+
color: (_alert, raw) => chalk.green(raw),
|
|
19583
|
+
header: "Patched",
|
|
19584
|
+
value: (alert) => alert.patchedVersion ?? "none"
|
|
19585
|
+
},
|
|
19586
|
+
{
|
|
19587
|
+
color: (_alert, raw) => chalk.gray(raw),
|
|
19588
|
+
header: "Advisory",
|
|
19589
|
+
value: (alert) => alert.ghsaId.length > 0 ? alert.ghsaId : "-"
|
|
19590
|
+
}
|
|
19591
|
+
];
|
|
19592
|
+
}
|
|
19593
|
+
function renderDependabotSummary(summary) {
|
|
19594
|
+
if (summary.availability === "no-gh") {
|
|
19595
|
+
console.log(chalk.gray("Dependabot: gh is unavailable or unauthenticated — skipped."));
|
|
19596
|
+
return;
|
|
19597
|
+
}
|
|
19598
|
+
if (summary.availability === "disabled") {
|
|
19599
|
+
console.log(chalk.gray(`Dependabot: alerts are disabled for ${summary.target || "this repository"}.`));
|
|
19600
|
+
return;
|
|
19601
|
+
}
|
|
19602
|
+
if (summary.total === 0) {
|
|
19603
|
+
console.log(chalk.green(`Dependabot: no open alerts for ${summary.target || "this repository"}.`));
|
|
19604
|
+
return;
|
|
19605
|
+
}
|
|
19606
|
+
const parts = summary.bySeverity.filter((entry) => entry.count > 0).map((entry) => SEVERITY_COLOR[entry.severity](`${entry.count} ${entry.severity}`));
|
|
19607
|
+
const scope = summary.repositories > 1 ? ` across ${summary.repositories} repos` : "";
|
|
19608
|
+
console.log(`Dependabot: ${chalk.bold(String(summary.total))} open alert${summary.total === 1 ? "" : "s"}${scope} — ${parts.join(", ")}`);
|
|
19609
|
+
}
|
|
19610
|
+
function renderDependabotAlerts(alerts, summary) {
|
|
19611
|
+
renderDependabotSummary(summary);
|
|
19612
|
+
if (alerts.length === 0) return;
|
|
19613
|
+
const columns = columnsFor(alerts.some((alert) => alert.repository !== void 0) && summary.repositories > 1);
|
|
19614
|
+
const widths = columns.map((column) => {
|
|
19615
|
+
let width = column.header.length;
|
|
19616
|
+
for (const alert of alerts) width = Math.max(width, column.value(alert).length);
|
|
19617
|
+
return Math.min(width, 44);
|
|
19618
|
+
});
|
|
19619
|
+
console.log(columns.map((column, index) => chalk.bold(column.header.padEnd(widths[index]))).join(" "));
|
|
19620
|
+
let separatorWidth = -2;
|
|
19621
|
+
for (const width of widths) separatorWidth += width + 2;
|
|
19622
|
+
console.log(chalk.gray("─".repeat(separatorWidth)));
|
|
19623
|
+
for (const alert of alerts) console.log(columns.map((column, index) => {
|
|
19624
|
+
const raw = column.value(alert).slice(0, widths[index]);
|
|
19625
|
+
return pad$3(raw, column.color(alert, raw), widths[index]);
|
|
19626
|
+
}).join(" "));
|
|
19627
|
+
}
|
|
19628
|
+
//#endregion
|
|
19629
|
+
//#region src/lib/secure/dependabot/summarizeDependabotAlerts.ts
|
|
19630
|
+
function filterDependabotAlerts(alerts, filter = {}) {
|
|
19631
|
+
const { relationship = "all", scope = "all" } = filter;
|
|
19632
|
+
return alerts.filter((alert) => {
|
|
19633
|
+
if (scope !== "all" && alert.scope !== scope) return false;
|
|
19634
|
+
if (relationship !== "all" && alert.relationship !== relationship) return false;
|
|
19635
|
+
return true;
|
|
19636
|
+
});
|
|
19637
|
+
}
|
|
19638
|
+
const SEVERITY_ORDER = new Map(DEPENDABOT_SEVERITIES.map((severity, index) => [severity, index]));
|
|
19639
|
+
function sortDependabotAlerts(alerts) {
|
|
19640
|
+
return [...alerts].toSorted((left, right) => {
|
|
19641
|
+
const severity = (SEVERITY_ORDER.get(left.severity) ?? 0) - (SEVERITY_ORDER.get(right.severity) ?? 0);
|
|
19642
|
+
if (severity !== 0) return severity;
|
|
19643
|
+
const repository = (left.repository ?? "").localeCompare(right.repository ?? "");
|
|
19644
|
+
if (repository !== 0) return repository;
|
|
19645
|
+
return left.packageName.localeCompare(right.packageName) || left.number - right.number;
|
|
19646
|
+
});
|
|
19647
|
+
}
|
|
19648
|
+
function summarizeDependabotAlerts(report) {
|
|
19649
|
+
const repositories = new Set(report.alerts.map((alert) => alert.repository).filter((name) => name !== void 0));
|
|
19650
|
+
return {
|
|
19651
|
+
availability: report.availability,
|
|
19652
|
+
bySeverity: DEPENDABOT_SEVERITIES.map((severity) => {
|
|
19653
|
+
const matching = report.alerts.filter((alert) => alert.severity === severity);
|
|
19654
|
+
return {
|
|
19655
|
+
count: matching.length,
|
|
19656
|
+
direct: matching.filter((alert) => alert.relationship === "direct").length,
|
|
19657
|
+
runtime: matching.filter((alert) => alert.scope === "runtime").length,
|
|
19658
|
+
severity
|
|
19659
|
+
};
|
|
19660
|
+
}),
|
|
19661
|
+
repositories: repositories.size,
|
|
19662
|
+
target: report.target,
|
|
19663
|
+
total: report.alerts.length
|
|
19664
|
+
};
|
|
19665
|
+
}
|
|
19666
|
+
//#endregion
|
|
19667
|
+
//#region src/lib/secure/dependabot/vulnerabilityAlerts.ts
|
|
19668
|
+
const VULNERABILITY_ALERTS_PATH = "repos/{owner}/{repo}/vulnerability-alerts";
|
|
19669
|
+
/**
|
|
19670
|
+
GitHub answers the disabled case with a 404 whose body says so. Match the
|
|
19671
|
+
message rather than the status, because a bare 404 also covers "no such repo"
|
|
19672
|
+
and "token cannot see it", which are not the same finding.
|
|
19673
|
+
*/
|
|
19674
|
+
function isExplicitlyDisabled(text) {
|
|
19675
|
+
return text.includes("Vulnerability alerts are disabled");
|
|
19676
|
+
}
|
|
19677
|
+
/**
|
|
19678
|
+
One `gh` subprocess, no body: 204 when alerts are on, 404 when off. Deliberately
|
|
19679
|
+
skips the three-call `githubIsAvailable` probe — `gh api` already fails cleanly
|
|
19680
|
+
when gh is absent or unauthenticated, and this runs inside `xy repo lint`.
|
|
19681
|
+
*/
|
|
19682
|
+
function dependabotAlertsStatus(cwd, runner = defaultGithubRunner) {
|
|
19683
|
+
const result = runner(["api", VULNERABILITY_ALERTS_PATH], { cwd });
|
|
19684
|
+
if (result.status === 0) return "enabled";
|
|
19685
|
+
return isExplicitlyDisabled(`${result.stderr}\n${result.stdout}`) ? "disabled" : "unknown";
|
|
19686
|
+
}
|
|
19687
|
+
/**
|
|
19688
|
+
Turn Dependabot alerts on. Requires admin on the repository; returns false
|
|
19689
|
+
rather than throwing when the token cannot make the change, so a fix pass
|
|
19690
|
+
reports the rule as still failing instead of claiming a fix it did not make.
|
|
19691
|
+
*/
|
|
19692
|
+
function enableDependabotAlerts(cwd, runner = defaultGithubRunner) {
|
|
19693
|
+
return runner([
|
|
19694
|
+
"api",
|
|
19695
|
+
"--method",
|
|
19696
|
+
"PUT",
|
|
19697
|
+
VULNERABILITY_ALERTS_PATH
|
|
19698
|
+
], { cwd }).status === 0;
|
|
19699
|
+
}
|
|
19700
|
+
//#endregion
|
|
19343
19701
|
//#region src/lib/secure/fetchPackageSecurityMetadata.ts
|
|
19344
19702
|
const REGISTRY_BASE$2 = "https://registry.npmjs.org";
|
|
19345
19703
|
const DOWNLOADS_BASE = "https://api.npmjs.org/downloads/point/last-week";
|
|
@@ -19510,6 +19868,24 @@ const columns = [
|
|
|
19510
19868
|
value: (row) => formatSecureDownloads(row.downloads)
|
|
19511
19869
|
}
|
|
19512
19870
|
];
|
|
19871
|
+
/**
|
|
19872
|
+
One-line overview for `xy secure`; the full table lives in `xy secure deps`.
|
|
19873
|
+
*/
|
|
19874
|
+
function renderSecureDepsSummary(rows) {
|
|
19875
|
+
if (rows.length === 0) {
|
|
19876
|
+
console.log(chalk.green("Deps: no external direct dependencies found."));
|
|
19877
|
+
return;
|
|
19878
|
+
}
|
|
19879
|
+
const red = rows.filter((row) => row.red).length;
|
|
19880
|
+
const oldPackages = rows.filter((row) => row.ageLevel === "red" || row.ageLevel === "yellow").length;
|
|
19881
|
+
const lowDownloads = rows.filter((row) => row.downloadsLevel === "red" || row.downloadsLevel === "yellow").length;
|
|
19882
|
+
const detail = [
|
|
19883
|
+
red > 0 ? chalk.red(`${red} red`) : chalk.green("0 red"),
|
|
19884
|
+
chalk.gray(`${oldPackages} aging`),
|
|
19885
|
+
chalk.gray(`${lowDownloads} low-download`)
|
|
19886
|
+
].join(", ");
|
|
19887
|
+
console.log(`Deps: ${chalk.bold(String(rows.length))} direct dependenc${rows.length === 1 ? "y" : "ies"} — ${detail}`);
|
|
19888
|
+
}
|
|
19513
19889
|
function renderSecurityAuditRows(rows) {
|
|
19514
19890
|
if (rows.length === 0) {
|
|
19515
19891
|
console.log(chalk.green("Secure: no external direct dependencies found."));
|
|
@@ -20175,7 +20551,7 @@ function getStore() {
|
|
|
20175
20551
|
if (!store) throw new HookError("[Inquirer] Hook functions can only be called from within a prompt");
|
|
20176
20552
|
return store;
|
|
20177
20553
|
}
|
|
20178
|
-
function readline$
|
|
20554
|
+
function readline$2() {
|
|
20179
20555
|
return getStore().rl;
|
|
20180
20556
|
}
|
|
20181
20557
|
function withUpdates(fn) {
|
|
@@ -20217,7 +20593,7 @@ const effectScheduler = {
|
|
|
20217
20593
|
const { index } = store;
|
|
20218
20594
|
store.hooksEffect.push(() => {
|
|
20219
20595
|
store.hooksCleanup[index]?.();
|
|
20220
|
-
const cleanFn = cb(readline$
|
|
20596
|
+
const cleanFn = cb(readline$2());
|
|
20221
20597
|
if (cleanFn != null && typeof cleanFn !== "function") throw new ValidationError("useEffect return value must be a cleanup function or nothing.");
|
|
20222
20598
|
store.hooksCleanup[index] = cleanFn;
|
|
20223
20599
|
});
|
|
@@ -20514,7 +20890,7 @@ const stringVisibleTrimSpacesRight$1 = (string) => {
|
|
|
20514
20890
|
if (last === words.length) return string;
|
|
20515
20891
|
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
20516
20892
|
};
|
|
20517
|
-
const exec$
|
|
20893
|
+
const exec$2 = (string, columns, options = {}) => {
|
|
20518
20894
|
if (options.trim !== false && string.trim() === "") return "";
|
|
20519
20895
|
let returnValue = "";
|
|
20520
20896
|
let escapeCode;
|
|
@@ -20599,7 +20975,7 @@ const exec$1 = (string, columns, options = {}) => {
|
|
|
20599
20975
|
};
|
|
20600
20976
|
const CRLF_OR_LF = /\r?\n/;
|
|
20601
20977
|
function wrapAnsi$1(string, columns, options) {
|
|
20602
|
-
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec$
|
|
20978
|
+
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec$2(line, columns, options)).join("\n");
|
|
20603
20979
|
}
|
|
20604
20980
|
//#endregion
|
|
20605
20981
|
//#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.2.0/node_modules/@inquirer/core/dist/lib/utils.js
|
|
@@ -20624,7 +21000,7 @@ function breakLines(content, width) {
|
|
|
20624
21000
|
function readlineWidth() {
|
|
20625
21001
|
return (0, import_cli_width.default)({
|
|
20626
21002
|
defaultWidth: 80,
|
|
20627
|
-
output: readline$
|
|
21003
|
+
output: readline$2().output
|
|
20628
21004
|
});
|
|
20629
21005
|
}
|
|
20630
21006
|
//#endregion
|
|
@@ -21041,7 +21417,7 @@ function createPrompt(view) {
|
|
|
21041
21417
|
const cleanups = /* @__PURE__ */ new Set();
|
|
21042
21418
|
const output = new import_lib.default();
|
|
21043
21419
|
output.pipe(context.output ?? process.stdout);
|
|
21044
|
-
const rl = readline.createInterface({
|
|
21420
|
+
const rl = readline$1.createInterface({
|
|
21045
21421
|
terminal: true,
|
|
21046
21422
|
input,
|
|
21047
21423
|
output
|
|
@@ -34044,45 +34420,45 @@ function cloneResolvedPublintRules(rules) {
|
|
|
34044
34420
|
};
|
|
34045
34421
|
}
|
|
34046
34422
|
//#endregion
|
|
34047
|
-
//#region ../../node_modules/.pnpm/tinyexec@1.
|
|
34048
|
-
function
|
|
34049
|
-
for (const
|
|
34050
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
34051
|
-
const
|
|
34052
|
-
if (!
|
|
34423
|
+
//#region ../../node_modules/.pnpm/tinyexec@1.3.0/node_modules/tinyexec/dist/main.mjs
|
|
34424
|
+
function getPathFromEnv(env) {
|
|
34425
|
+
for (const key in env) {
|
|
34426
|
+
if (!Object.prototype.hasOwnProperty.call(env, key) || !isPathLikePattern.test(key)) continue;
|
|
34427
|
+
const value = env[key];
|
|
34428
|
+
if (!value) return defaultEnvPathInfo;
|
|
34053
34429
|
return {
|
|
34054
|
-
key
|
|
34055
|
-
value
|
|
34430
|
+
key,
|
|
34431
|
+
value
|
|
34056
34432
|
};
|
|
34057
34433
|
}
|
|
34058
|
-
return
|
|
34434
|
+
return defaultEnvPathInfo;
|
|
34059
34435
|
}
|
|
34060
|
-
function
|
|
34061
|
-
const
|
|
34062
|
-
const
|
|
34063
|
-
let
|
|
34064
|
-
let
|
|
34436
|
+
function addNodeBinToPath(cwd, path) {
|
|
34437
|
+
const parts = path.value.split(delimiter);
|
|
34438
|
+
const nodeBinPaths = [];
|
|
34439
|
+
let currentPath = cwd;
|
|
34440
|
+
let lastPath;
|
|
34065
34441
|
do {
|
|
34066
|
-
|
|
34067
|
-
|
|
34068
|
-
|
|
34069
|
-
} while (
|
|
34070
|
-
|
|
34071
|
-
const
|
|
34442
|
+
nodeBinPaths.push(resolve(currentPath, "node_modules", ".bin"));
|
|
34443
|
+
lastPath = currentPath;
|
|
34444
|
+
currentPath = dirname(currentPath);
|
|
34445
|
+
} while (currentPath !== lastPath);
|
|
34446
|
+
nodeBinPaths.push(dirname(process.execPath));
|
|
34447
|
+
const newPath = nodeBinPaths.concat(parts).join(delimiter);
|
|
34072
34448
|
return {
|
|
34073
|
-
key:
|
|
34074
|
-
value:
|
|
34449
|
+
key: path.key,
|
|
34450
|
+
value: newPath
|
|
34075
34451
|
};
|
|
34076
34452
|
}
|
|
34077
|
-
function
|
|
34078
|
-
const
|
|
34453
|
+
function computeEnv(cwd, env, nodePath = true) {
|
|
34454
|
+
const envWithDefault = {
|
|
34079
34455
|
...process.env,
|
|
34080
|
-
...
|
|
34456
|
+
...env
|
|
34081
34457
|
};
|
|
34082
|
-
if (!
|
|
34083
|
-
const
|
|
34084
|
-
|
|
34085
|
-
return
|
|
34458
|
+
if (!nodePath) return envWithDefault;
|
|
34459
|
+
const envPathInfo = addNodeBinToPath(cwd, getPathFromEnv(envWithDefault));
|
|
34460
|
+
envWithDefault[envPathInfo.key] = envPathInfo.value;
|
|
34461
|
+
return envWithDefault;
|
|
34086
34462
|
}
|
|
34087
34463
|
/**
|
|
34088
34464
|
* Normalizes the command and arguments to work cross-platform.
|
|
@@ -34090,157 +34466,168 @@ function y(e, t, n = true) {
|
|
|
34090
34466
|
* `node_modules/.bin` commands, and escaping meta characters.
|
|
34091
34467
|
* On other platforms, it just returns the command and arguments as-is.
|
|
34092
34468
|
*/
|
|
34093
|
-
function
|
|
34094
|
-
if (
|
|
34095
|
-
command
|
|
34096
|
-
args
|
|
34097
|
-
options
|
|
34098
|
-
};
|
|
34099
|
-
let
|
|
34100
|
-
let
|
|
34101
|
-
if (
|
|
34102
|
-
const
|
|
34103
|
-
const
|
|
34104
|
-
let
|
|
34469
|
+
function normalizeSpawnCommand(command, args = [], options = {}) {
|
|
34470
|
+
if (options.shell === true || !isWindows) return {
|
|
34471
|
+
command,
|
|
34472
|
+
args,
|
|
34473
|
+
options
|
|
34474
|
+
};
|
|
34475
|
+
let file = resolveCommand(command, options);
|
|
34476
|
+
let shebang = null;
|
|
34477
|
+
if (file !== null) {
|
|
34478
|
+
const size = 150;
|
|
34479
|
+
const buffer = Buffer.alloc(size);
|
|
34480
|
+
let fd = null;
|
|
34105
34481
|
try {
|
|
34106
|
-
|
|
34107
|
-
readSync(
|
|
34482
|
+
fd = openSync(file, "r");
|
|
34483
|
+
readSync(fd, buffer, 0, size, 0);
|
|
34108
34484
|
} catch {} finally {
|
|
34109
|
-
if (
|
|
34110
|
-
}
|
|
34111
|
-
const
|
|
34112
|
-
if (
|
|
34113
|
-
const
|
|
34114
|
-
const
|
|
34115
|
-
const
|
|
34116
|
-
const
|
|
34117
|
-
const
|
|
34118
|
-
|
|
34119
|
-
}
|
|
34120
|
-
}
|
|
34121
|
-
if (
|
|
34122
|
-
|
|
34123
|
-
|
|
34124
|
-
|
|
34125
|
-
}
|
|
34126
|
-
if (
|
|
34127
|
-
const
|
|
34128
|
-
|
|
34129
|
-
|
|
34130
|
-
|
|
34131
|
-
|
|
34132
|
-
|
|
34133
|
-
|
|
34134
|
-
|
|
34135
|
-
if (
|
|
34136
|
-
return
|
|
34485
|
+
if (fd !== null) closeSync(fd);
|
|
34486
|
+
}
|
|
34487
|
+
const match = buffer.toString().match(shebangRegExp);
|
|
34488
|
+
if (match !== null) {
|
|
34489
|
+
const line = match[1].trim();
|
|
34490
|
+
const separatorIndex = line.indexOf(" ");
|
|
34491
|
+
const path = separatorIndex !== -1 ? line.slice(0, separatorIndex) : line;
|
|
34492
|
+
const argument = separatorIndex !== -1 ? line.slice(separatorIndex + 1) : "";
|
|
34493
|
+
const binary = basename(path);
|
|
34494
|
+
shebang = binary === "env" ? argument || null : binary;
|
|
34495
|
+
}
|
|
34496
|
+
}
|
|
34497
|
+
if (shebang !== null && file !== null) {
|
|
34498
|
+
args = [file, ...args];
|
|
34499
|
+
command = shebang;
|
|
34500
|
+
file = resolveCommand(command, options);
|
|
34501
|
+
}
|
|
34502
|
+
if (file === null || !isWindowsExecutableRegExp.test(file)) {
|
|
34503
|
+
const needsDoubleEscapeMetaChars = file !== null && isNodeModulesCmdRegExp.test(file);
|
|
34504
|
+
command = normalize(command);
|
|
34505
|
+
command = command.replace(metaCharsRegExp, "^$1");
|
|
34506
|
+
args = args.map((arg) => {
|
|
34507
|
+
arg = arg.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
|
|
34508
|
+
arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
|
|
34509
|
+
arg = `"${arg}"`;
|
|
34510
|
+
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
34511
|
+
if (needsDoubleEscapeMetaChars) arg = arg.replace(metaCharsRegExp, "^$1");
|
|
34512
|
+
return arg;
|
|
34137
34513
|
});
|
|
34138
|
-
|
|
34514
|
+
args = [
|
|
34139
34515
|
"/d",
|
|
34140
34516
|
"/s",
|
|
34141
34517
|
"/c",
|
|
34142
|
-
`"${[
|
|
34518
|
+
`"${[command, ...args].join(" ")}"`
|
|
34143
34519
|
];
|
|
34144
|
-
|
|
34145
|
-
|
|
34146
|
-
...
|
|
34520
|
+
command = options.env?.comspec ?? "cmd.exe";
|
|
34521
|
+
options = {
|
|
34522
|
+
...options,
|
|
34147
34523
|
windowsVerbatimArguments: true
|
|
34148
34524
|
};
|
|
34149
34525
|
}
|
|
34150
34526
|
return {
|
|
34151
|
-
command
|
|
34152
|
-
args
|
|
34153
|
-
options
|
|
34527
|
+
command,
|
|
34528
|
+
args,
|
|
34529
|
+
options
|
|
34154
34530
|
};
|
|
34155
34531
|
}
|
|
34156
34532
|
/**
|
|
34157
34533
|
* Resolves the command to an absolute path if possible.
|
|
34158
34534
|
* Handles things like traversing PATH and adding extensions from PATHEXT
|
|
34159
34535
|
*/
|
|
34160
|
-
function
|
|
34161
|
-
const
|
|
34162
|
-
const
|
|
34163
|
-
const
|
|
34164
|
-
const
|
|
34165
|
-
|
|
34166
|
-
if (
|
|
34167
|
-
for (const
|
|
34168
|
-
const
|
|
34169
|
-
for (const
|
|
34170
|
-
const
|
|
34536
|
+
function resolveCommand(command, options) {
|
|
34537
|
+
const cwd$3 = (options.cwd ?? cwd()).toString();
|
|
34538
|
+
const env = options.env ?? process.env;
|
|
34539
|
+
const PATH = getPathFromEnv(env).value;
|
|
34540
|
+
const pathEnv = command.includes("/") || command.includes("\\") ? [""] : [cwd$3, ...PATH.split(delimiter)];
|
|
34541
|
+
let pathExt = env.PATHEXT ? env.PATHEXT.split(delimiter) : defaultPathExt;
|
|
34542
|
+
if (command.includes(".") && pathExt[0] !== "") pathExt = ["", ...pathExt];
|
|
34543
|
+
for (const extensions of [pathExt, noPathExt]) for (const path of pathEnv) {
|
|
34544
|
+
const dest = resolve(cwd$3, path.startsWith("\"") && path.endsWith("\"") && path.length > 1 ? path.slice(1, -1) : path, command);
|
|
34545
|
+
for (const ext of extensions) {
|
|
34546
|
+
const destWithExt = dest + ext;
|
|
34171
34547
|
try {
|
|
34172
|
-
if (statSync(
|
|
34548
|
+
if (statSync(destWithExt).isFile()) return destWithExt;
|
|
34173
34549
|
} catch {}
|
|
34174
34550
|
}
|
|
34175
34551
|
}
|
|
34176
34552
|
return null;
|
|
34177
34553
|
}
|
|
34178
|
-
function
|
|
34179
|
-
const
|
|
34180
|
-
for (const
|
|
34181
|
-
if (
|
|
34182
|
-
|
|
34183
|
-
return
|
|
34554
|
+
function combineSignals(signals) {
|
|
34555
|
+
const controller = new AbortController();
|
|
34556
|
+
for (const signal of signals) {
|
|
34557
|
+
if (signal.aborted) {
|
|
34558
|
+
controller.abort();
|
|
34559
|
+
return signal;
|
|
34184
34560
|
}
|
|
34185
|
-
const
|
|
34186
|
-
|
|
34561
|
+
const onAbort = () => {
|
|
34562
|
+
controller.abort(signal.reason);
|
|
34187
34563
|
};
|
|
34188
|
-
|
|
34564
|
+
signal.addEventListener("abort", onAbort, { signal: controller.signal });
|
|
34189
34565
|
}
|
|
34190
|
-
return
|
|
34566
|
+
return controller.signal;
|
|
34191
34567
|
}
|
|
34192
|
-
async function
|
|
34193
|
-
let
|
|
34568
|
+
async function readStream(stream) {
|
|
34569
|
+
let output = "";
|
|
34194
34570
|
try {
|
|
34195
|
-
for await (const
|
|
34571
|
+
for await (const chunk of stream) output += chunk.toString();
|
|
34196
34572
|
} catch {}
|
|
34197
|
-
return
|
|
34573
|
+
return output;
|
|
34198
34574
|
}
|
|
34199
|
-
var
|
|
34575
|
+
var isPathLikePattern, defaultEnvPathInfo, combineStreams, metaCharsRegExp, shebangRegExp, isWindowsExecutableRegExp, isNodeModulesCmdRegExp, isWindows, defaultPathExt, noPathExt, NonZeroExitError, defaultOptions, defaultNodeOptions, ExecProcess, x, exec$1;
|
|
34200
34576
|
var init_main = __esmMin((() => {
|
|
34201
|
-
|
|
34202
|
-
|
|
34577
|
+
isPathLikePattern = /^path$/i;
|
|
34578
|
+
defaultEnvPathInfo = {
|
|
34203
34579
|
key: "PATH",
|
|
34204
34580
|
value: ""
|
|
34205
34581
|
};
|
|
34206
|
-
|
|
34207
|
-
let
|
|
34208
|
-
const
|
|
34209
|
-
const
|
|
34210
|
-
if (--
|
|
34582
|
+
combineStreams = (streams) => {
|
|
34583
|
+
let streamCount = streams.length;
|
|
34584
|
+
const combined = new PassThrough();
|
|
34585
|
+
const maybeEmitEnd = () => {
|
|
34586
|
+
if (--streamCount === 0) combined.end();
|
|
34211
34587
|
};
|
|
34212
|
-
for (const
|
|
34213
|
-
return
|
|
34214
|
-
};
|
|
34215
|
-
|
|
34216
|
-
|
|
34217
|
-
|
|
34218
|
-
|
|
34219
|
-
|
|
34220
|
-
|
|
34588
|
+
for (const stream of streams) pipeline(stream, combined, { end: false }).then(maybeEmitEnd).catch(maybeEmitEnd);
|
|
34589
|
+
return combined;
|
|
34590
|
+
};
|
|
34591
|
+
metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
|
|
34592
|
+
shebangRegExp = /^#!\s*(.+)/;
|
|
34593
|
+
isWindowsExecutableRegExp = /\.(?:com|exe)$/i;
|
|
34594
|
+
isNodeModulesCmdRegExp = /node_modules[\\/]\.bin[\\/][^\\/]+\.cmd$/i;
|
|
34595
|
+
isWindows = process.platform === "win32";
|
|
34596
|
+
defaultPathExt = [
|
|
34221
34597
|
".EXE",
|
|
34222
34598
|
".CMD",
|
|
34223
34599
|
".BAT",
|
|
34224
34600
|
".COM"
|
|
34225
34601
|
];
|
|
34226
|
-
|
|
34602
|
+
noPathExt = [""];
|
|
34603
|
+
NonZeroExitError = class extends Error {
|
|
34227
34604
|
result;
|
|
34228
34605
|
output;
|
|
34229
|
-
|
|
34230
|
-
|
|
34231
|
-
|
|
34232
|
-
|
|
34233
|
-
|
|
34234
|
-
|
|
34235
|
-
|
|
34606
|
+
exitCode;
|
|
34607
|
+
get signalCode() {
|
|
34608
|
+
return this.result.signalCode;
|
|
34609
|
+
}
|
|
34610
|
+
constructor(result, output, command, args) {
|
|
34611
|
+
let target = "The process";
|
|
34612
|
+
if (command) target = `The command \`${args?.length ? `${command} ${args.map((a) => /[ "'`()]/.test(a) ? JSON.stringify(a) : a).join(" ")}` : command}\``;
|
|
34613
|
+
const exitCode = result.exitCode ?? 1;
|
|
34614
|
+
super(result.signalCode !== null ? `${target} was killed by the signal ${result.signalCode}` : `${target} exited with a non-zero status (${exitCode})`);
|
|
34615
|
+
this.result = result;
|
|
34616
|
+
this.output = output;
|
|
34617
|
+
this.exitCode = exitCode;
|
|
34618
|
+
Object.defineProperty(this, "result", {
|
|
34619
|
+
enumerable: false,
|
|
34620
|
+
writable: false,
|
|
34621
|
+
configurable: false
|
|
34622
|
+
});
|
|
34236
34623
|
}
|
|
34237
34624
|
};
|
|
34238
|
-
|
|
34625
|
+
defaultOptions = {
|
|
34239
34626
|
timeout: void 0,
|
|
34240
34627
|
persist: false
|
|
34241
34628
|
};
|
|
34242
|
-
|
|
34243
|
-
|
|
34629
|
+
defaultNodeOptions = { windowsHide: true };
|
|
34630
|
+
ExecProcess = class {
|
|
34244
34631
|
_process;
|
|
34245
34632
|
_aborted = false;
|
|
34246
34633
|
_options;
|
|
@@ -34258,19 +34645,22 @@ var init_main = __esmMin((() => {
|
|
|
34258
34645
|
get exitCode() {
|
|
34259
34646
|
if (this._process && this._process.exitCode !== null) return this._process.exitCode;
|
|
34260
34647
|
}
|
|
34261
|
-
|
|
34648
|
+
get signalCode() {
|
|
34649
|
+
return this._process?.signalCode ?? null;
|
|
34650
|
+
}
|
|
34651
|
+
constructor(command, args, options) {
|
|
34262
34652
|
this._options = {
|
|
34263
|
-
...
|
|
34264
|
-
...
|
|
34653
|
+
...defaultOptions,
|
|
34654
|
+
...options
|
|
34265
34655
|
};
|
|
34266
|
-
this._command =
|
|
34267
|
-
this._args =
|
|
34268
|
-
this._processClosed = new Promise((
|
|
34269
|
-
this._resolveClose =
|
|
34656
|
+
this._command = command;
|
|
34657
|
+
this._args = args ?? [];
|
|
34658
|
+
this._processClosed = new Promise((resolve) => {
|
|
34659
|
+
this._resolveClose = resolve;
|
|
34270
34660
|
});
|
|
34271
34661
|
}
|
|
34272
|
-
kill(
|
|
34273
|
-
return this._process?.kill(
|
|
34662
|
+
kill(signal) {
|
|
34663
|
+
return this._process?.kill(signal) === true;
|
|
34274
34664
|
}
|
|
34275
34665
|
get aborted() {
|
|
34276
34666
|
return this._aborted;
|
|
@@ -34278,99 +34668,99 @@ var init_main = __esmMin((() => {
|
|
|
34278
34668
|
get killed() {
|
|
34279
34669
|
return this._process?.killed === true;
|
|
34280
34670
|
}
|
|
34281
|
-
pipe(
|
|
34282
|
-
return
|
|
34283
|
-
...
|
|
34671
|
+
pipe(command, args, options) {
|
|
34672
|
+
return exec$1(command, args, {
|
|
34673
|
+
...options,
|
|
34284
34674
|
stdin: this
|
|
34285
34675
|
});
|
|
34286
34676
|
}
|
|
34287
34677
|
async *[Symbol.asyncIterator]() {
|
|
34288
|
-
const
|
|
34289
|
-
if (!
|
|
34290
|
-
const
|
|
34291
|
-
if (this._streamErr)
|
|
34292
|
-
if (this._streamOut)
|
|
34293
|
-
const
|
|
34294
|
-
const
|
|
34295
|
-
for await (const
|
|
34678
|
+
const proc = this._process;
|
|
34679
|
+
if (!proc) return;
|
|
34680
|
+
const streams = [];
|
|
34681
|
+
if (this._streamErr) streams.push(this._streamErr);
|
|
34682
|
+
if (this._streamOut) streams.push(this._streamOut);
|
|
34683
|
+
const streamCombined = combineStreams(streams);
|
|
34684
|
+
const rl = readline.createInterface({ input: streamCombined });
|
|
34685
|
+
for await (const chunk of rl) yield chunk.toString();
|
|
34296
34686
|
await this._processClosed;
|
|
34297
|
-
|
|
34687
|
+
proc.removeAllListeners();
|
|
34298
34688
|
if (this._thrownError) throw this._thrownError;
|
|
34299
|
-
if (this._options?.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new
|
|
34689
|
+
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
34690
|
}
|
|
34301
34691
|
async _waitForOutput() {
|
|
34302
|
-
const
|
|
34303
|
-
if (!
|
|
34304
|
-
const [
|
|
34692
|
+
const proc = this._process;
|
|
34693
|
+
if (!proc) throw new Error("No process was started");
|
|
34694
|
+
const [stdout, stderr] = await Promise.all([this._streamOut ? readStream(this._streamOut) : "", this._streamErr ? readStream(this._streamErr) : ""]);
|
|
34305
34695
|
await this._processClosed;
|
|
34306
|
-
const { stdin
|
|
34307
|
-
if (
|
|
34308
|
-
|
|
34696
|
+
const { stdin } = this._options;
|
|
34697
|
+
if (stdin && typeof stdin !== "string") await stdin;
|
|
34698
|
+
proc.removeAllListeners();
|
|
34309
34699
|
if (this._thrownError) throw this._thrownError;
|
|
34310
|
-
const
|
|
34311
|
-
stderr
|
|
34312
|
-
stdout
|
|
34700
|
+
const result = {
|
|
34701
|
+
stderr,
|
|
34702
|
+
stdout,
|
|
34313
34703
|
exitCode: this.exitCode
|
|
34314
34704
|
};
|
|
34315
|
-
if (this._options.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new
|
|
34316
|
-
return
|
|
34705
|
+
if (this._options.throwOnError && (this.exitCode !== 0 && this.exitCode !== void 0 || this.signalCode !== null)) throw new NonZeroExitError(this, result, this._command, this._args);
|
|
34706
|
+
return result;
|
|
34317
34707
|
}
|
|
34318
|
-
then(
|
|
34319
|
-
return this._waitForOutput().then(
|
|
34708
|
+
then(onfulfilled, onrejected) {
|
|
34709
|
+
return this._waitForOutput().then(onfulfilled, onrejected);
|
|
34320
34710
|
}
|
|
34321
34711
|
_streamOut;
|
|
34322
34712
|
_streamErr;
|
|
34323
34713
|
spawn() {
|
|
34324
|
-
const
|
|
34325
|
-
const
|
|
34326
|
-
const
|
|
34327
|
-
...
|
|
34328
|
-
...
|
|
34714
|
+
const cwd$1 = cwd();
|
|
34715
|
+
const options = this._options;
|
|
34716
|
+
const nodeOptions = {
|
|
34717
|
+
...defaultNodeOptions,
|
|
34718
|
+
...options.nodeOptions
|
|
34329
34719
|
};
|
|
34330
|
-
const
|
|
34720
|
+
const signals = [];
|
|
34331
34721
|
this._resetState();
|
|
34332
|
-
if (
|
|
34333
|
-
if (
|
|
34334
|
-
if (
|
|
34335
|
-
if (
|
|
34336
|
-
|
|
34337
|
-
const
|
|
34338
|
-
const
|
|
34339
|
-
if (
|
|
34340
|
-
if (
|
|
34341
|
-
this._process =
|
|
34342
|
-
|
|
34343
|
-
|
|
34344
|
-
if (
|
|
34345
|
-
const { stdin
|
|
34346
|
-
if (typeof
|
|
34347
|
-
else
|
|
34722
|
+
if (options.timeout !== void 0) signals.push(AbortSignal.timeout(options.timeout));
|
|
34723
|
+
if (options.signal !== void 0) signals.push(options.signal);
|
|
34724
|
+
if (options.persist === true) nodeOptions.detached = true;
|
|
34725
|
+
if (signals.length > 0) nodeOptions.signal = combineSignals(signals);
|
|
34726
|
+
nodeOptions.env = computeEnv(cwd$1, nodeOptions.env, options.nodePath);
|
|
34727
|
+
const crossResult = normalizeSpawnCommand(this._command, this._args, nodeOptions);
|
|
34728
|
+
const handle = spawn(crossResult.command, crossResult.args, crossResult.options);
|
|
34729
|
+
if (handle.stderr) this._streamErr = handle.stderr;
|
|
34730
|
+
if (handle.stdout) this._streamOut = handle.stdout;
|
|
34731
|
+
this._process = handle;
|
|
34732
|
+
handle.once("error", this._onError);
|
|
34733
|
+
handle.once("close", this._onClose);
|
|
34734
|
+
if (handle.stdin) {
|
|
34735
|
+
const { stdin } = options;
|
|
34736
|
+
if (typeof stdin === "string") handle.stdin.end(stdin);
|
|
34737
|
+
else stdin?.process?.stdout?.pipe(handle.stdin);
|
|
34348
34738
|
}
|
|
34349
34739
|
}
|
|
34350
34740
|
_resetState() {
|
|
34351
34741
|
this._aborted = false;
|
|
34352
|
-
this._processClosed = new Promise((
|
|
34353
|
-
this._resolveClose =
|
|
34742
|
+
this._processClosed = new Promise((resolve) => {
|
|
34743
|
+
this._resolveClose = resolve;
|
|
34354
34744
|
});
|
|
34355
34745
|
this._thrownError = void 0;
|
|
34356
34746
|
}
|
|
34357
|
-
_onError = (
|
|
34358
|
-
if (
|
|
34747
|
+
_onError = (err) => {
|
|
34748
|
+
if (err.name === "AbortError" && (!(err.cause instanceof Error) || err.cause.name !== "TimeoutError")) {
|
|
34359
34749
|
this._aborted = true;
|
|
34360
34750
|
return;
|
|
34361
34751
|
}
|
|
34362
|
-
this._thrownError =
|
|
34752
|
+
this._thrownError = err;
|
|
34363
34753
|
};
|
|
34364
34754
|
_onClose = () => {
|
|
34365
34755
|
if (this._resolveClose) this._resolveClose();
|
|
34366
34756
|
};
|
|
34367
34757
|
};
|
|
34368
|
-
|
|
34369
|
-
const
|
|
34370
|
-
|
|
34371
|
-
return
|
|
34758
|
+
x = (command, args, userOptions) => {
|
|
34759
|
+
const proc = new ExecProcess(command, args, userOptions);
|
|
34760
|
+
proc.spawn();
|
|
34761
|
+
return proc;
|
|
34372
34762
|
};
|
|
34373
|
-
|
|
34763
|
+
exec$1 = x;
|
|
34374
34764
|
}));
|
|
34375
34765
|
//#endregion
|
|
34376
34766
|
//#region ../../node_modules/.pnpm/@publint+pack@0.1.6/node_modules/@publint/pack/src/node/utils.js
|
|
@@ -34419,7 +34809,7 @@ async function pack(dir, opts) {
|
|
|
34419
34809
|
case "yarn": break;
|
|
34420
34810
|
default: command.push("--ignore-scripts");
|
|
34421
34811
|
}
|
|
34422
|
-
const output = await
|
|
34812
|
+
const output = await exec$1(command[0], command.slice(1), { nodeOptions: { cwd: dir } });
|
|
34423
34813
|
const tarballFile = await fs$1.readdir(packDestination).then((files) => {
|
|
34424
34814
|
return files.find((file) => file.endsWith(".tgz") && output.stdout.includes(file));
|
|
34425
34815
|
});
|
|
@@ -34456,7 +34846,7 @@ async function packAsJson(dir, opts) {
|
|
|
34456
34846
|
case "yarn": break;
|
|
34457
34847
|
default: command.push("--ignore-scripts");
|
|
34458
34848
|
}
|
|
34459
|
-
let { stdout } = await
|
|
34849
|
+
let { stdout } = await exec$1(command[0], command.slice(1), { nodeOptions: { cwd: dir } });
|
|
34460
34850
|
try {
|
|
34461
34851
|
stdout = stdout.trim();
|
|
34462
34852
|
if (packageManager === "pnpm") stdout = fixPnpmStdout(stdout);
|
|
@@ -36121,7 +36511,7 @@ function createTarballVfs(files) {
|
|
|
36121
36511
|
}
|
|
36122
36512
|
var init_vfs_tarball = __esmMin((() => {}));
|
|
36123
36513
|
//#endregion
|
|
36124
|
-
//#region ../../node_modules/.pnpm/package-manager-detector@1.
|
|
36514
|
+
//#region ../../node_modules/.pnpm/package-manager-detector@1.8.0/node_modules/package-manager-detector/dist/constants.mjs
|
|
36125
36515
|
var AGENTS, LOCKS, INSTALL_METADATA;
|
|
36126
36516
|
var init_constants = __esmMin((() => {
|
|
36127
36517
|
AGENTS = [
|
|
@@ -36130,6 +36520,7 @@ var init_constants = __esmMin((() => {
|
|
|
36130
36520
|
"yarn@berry",
|
|
36131
36521
|
"pnpm",
|
|
36132
36522
|
"pnpm@6",
|
|
36523
|
+
"pnpm-rush",
|
|
36133
36524
|
"bun",
|
|
36134
36525
|
"deno",
|
|
36135
36526
|
"nub",
|
|
@@ -36141,6 +36532,7 @@ var init_constants = __esmMin((() => {
|
|
|
36141
36532
|
"bun.lock": "bun",
|
|
36142
36533
|
"bun.lockb": "bun",
|
|
36143
36534
|
"deno.lock": "deno",
|
|
36535
|
+
"nub.lock": "nub",
|
|
36144
36536
|
"pnpm-lock.yaml": "pnpm",
|
|
36145
36537
|
"pnpm-workspace.yaml": "pnpm",
|
|
36146
36538
|
"yarn.lock": "yarn",
|
|
@@ -36161,7 +36553,7 @@ var init_constants = __esmMin((() => {
|
|
|
36161
36553
|
};
|
|
36162
36554
|
}));
|
|
36163
36555
|
//#endregion
|
|
36164
|
-
//#region ../../node_modules/.pnpm/package-manager-detector@1.
|
|
36556
|
+
//#region ../../node_modules/.pnpm/package-manager-detector@1.8.0/node_modules/package-manager-detector/dist/detect.mjs
|
|
36165
36557
|
var detect_exports = /* @__PURE__ */ __exportAll({
|
|
36166
36558
|
detect: () => detect,
|
|
36167
36559
|
getUserAgent: () => getUserAgent
|
|
@@ -36206,6 +36598,10 @@ async function detect(options = {}) {
|
|
|
36206
36598
|
for (const directory of lookup(cwd)) {
|
|
36207
36599
|
for (const strategy of strategies) switch (strategy) {
|
|
36208
36600
|
case "lockfile":
|
|
36601
|
+
if (await pathExists(PATH.join(directory, "rush.json"), "file")) return {
|
|
36602
|
+
name: "pnpm",
|
|
36603
|
+
agent: "pnpm-rush"
|
|
36604
|
+
};
|
|
36209
36605
|
for (const lock of Object.keys(LOCKS)) if (await pathExists(PATH.join(directory, lock), "file")) {
|
|
36210
36606
|
const name = LOCKS[lock];
|
|
36211
36607
|
const result = await parsePackageJson(PATH.join(directory, "package.json"), options);
|
|
@@ -41874,12 +42270,19 @@ function setWorkspaceScalar(cwd, key, value, isSatisfied, successMessage) {
|
|
|
41874
42270
|
function fixPnpmMinimumReleaseAge(cwd) {
|
|
41875
42271
|
setWorkspaceScalar(cwd, "minimumReleaseAge", DEFAULT_MINIMUM_RELEASE_AGE_MINUTES, isMinimumReleaseAgeSatisfied, ` ✔ Fixed: set minimumReleaseAge: ${DEFAULT_MINIMUM_RELEASE_AGE_MINUTES} in pnpm-workspace.yaml`);
|
|
41876
42272
|
}
|
|
41877
|
-
|
|
42273
|
+
/**
|
|
42274
|
+
Rewrites `minimumReleaseAgeExclude` through the YAML document model rather than
|
|
42275
|
+
by splicing lines. Scoped patterns start with `@`, a YAML reserved indicator, so
|
|
42276
|
+
a hand-built ` - @scope/*` line is not valid YAML — the serializer quotes them.
|
|
42277
|
+
|
|
42278
|
+
Returns whether the file was updated.
|
|
42279
|
+
*/
|
|
42280
|
+
function fixPnpmReleaseAgeExcludes(cwd, workspaces = [], configuredPatterns) {
|
|
41878
42281
|
const doc = readPnpmWorkspaceDocument(cwd);
|
|
41879
|
-
if (!doc) return;
|
|
42282
|
+
if (!doc) return false;
|
|
41880
42283
|
if (!import_dist.isMap(doc.contents)) {
|
|
41881
42284
|
console.log(chalk.yellow(" ⚠ pnpm-workspace.yaml has no top-level map; skipping fix"));
|
|
41882
|
-
return;
|
|
42285
|
+
return false;
|
|
41883
42286
|
}
|
|
41884
42287
|
let seq = doc.get("minimumReleaseAgeExclude");
|
|
41885
42288
|
if (!import_dist.isSeq(seq)) {
|
|
@@ -41887,8 +42290,8 @@ function fixPnpmReleaseAgeExcludes(cwd, workspaces = []) {
|
|
|
41887
42290
|
doc.set("minimumReleaseAgeExclude", seq);
|
|
41888
42291
|
}
|
|
41889
42292
|
const seqNode = seq;
|
|
41890
|
-
const { missing, unnecessary } = diffReleaseAgeExcludePatterns(cwd, workspaces, readSequenceStrings(seqNode));
|
|
41891
|
-
if (missing.length === 0 && unnecessary.length === 0) return;
|
|
42293
|
+
const { missing, unnecessary } = diffReleaseAgeExcludePatterns(cwd, workspaces, readSequenceStrings(seqNode), configuredPatterns);
|
|
42294
|
+
if (missing.length === 0 && unnecessary.length === 0) return false;
|
|
41892
42295
|
const unnecessarySet = new Set(unnecessary.map(normalizeReleaseAgeExcludePattern));
|
|
41893
42296
|
seqNode.items = seqNode.items.filter((item) => {
|
|
41894
42297
|
const value = import_dist.isScalar(item) ? item.value : item;
|
|
@@ -41905,6 +42308,7 @@ function fixPnpmReleaseAgeExcludes(cwd, workspaces = []) {
|
|
|
41905
42308
|
writeFileSync(pnpmWorkspacePath(cwd), String(doc), "utf8");
|
|
41906
42309
|
if (missing.length > 0) console.log(chalk.green(` ✔ Fixed: added ${missing.join(", ")} to minimumReleaseAgeExclude in pnpm-workspace.yaml`));
|
|
41907
42310
|
if (unnecessary.length > 0) console.log(chalk.green(` ✔ Fixed: removed ${unnecessary.join(", ")} from minimumReleaseAgeExclude in pnpm-workspace.yaml`));
|
|
42311
|
+
return true;
|
|
41908
42312
|
}
|
|
41909
42313
|
//#endregion
|
|
41910
42314
|
//#region src/actions/package-lint-specs.ts
|
|
@@ -42083,7 +42487,7 @@ function checkWorkspaceGlobCoverage(pkg, cwd, pm, workspaces) {
|
|
|
42083
42487
|
}
|
|
42084
42488
|
return result;
|
|
42085
42489
|
}
|
|
42086
|
-
function lintResultDiagnostics(ruleId, result) {
|
|
42490
|
+
function lintResultDiagnostics(ruleId, ruleLevel, result) {
|
|
42087
42491
|
return [
|
|
42088
42492
|
...result.errors.map((message) => ({
|
|
42089
42493
|
level: "error",
|
|
@@ -42091,7 +42495,7 @@ function lintResultDiagnostics(ruleId, result) {
|
|
|
42091
42495
|
rule: ruleId
|
|
42092
42496
|
})),
|
|
42093
42497
|
...result.fixable.map((message) => ({
|
|
42094
|
-
level:
|
|
42498
|
+
level: ruleLevel,
|
|
42095
42499
|
message: `${message} (fixable)`,
|
|
42096
42500
|
rule: ruleId
|
|
42097
42501
|
})),
|
|
@@ -42102,30 +42506,136 @@ function lintResultDiagnostics(ruleId, result) {
|
|
|
42102
42506
|
}))
|
|
42103
42507
|
];
|
|
42104
42508
|
}
|
|
42105
|
-
function
|
|
42509
|
+
function repoLintRule({ check, description, fix, id, level = "error" }) {
|
|
42106
42510
|
return {
|
|
42107
|
-
check: ({
|
|
42108
|
-
const result =
|
|
42109
|
-
const
|
|
42511
|
+
check: (context, { fix: shouldFix, level: ruleLevel }) => {
|
|
42512
|
+
const result = check(context);
|
|
42513
|
+
const applied = shouldFix && fix !== void 0 && result.fixable.length > 0 ? fix(context) !== false : false;
|
|
42514
|
+
const diagnostics = lintResultDiagnostics(id, ruleLevel, {
|
|
42110
42515
|
errors: result.errors,
|
|
42111
|
-
fixable:
|
|
42516
|
+
fixable: applied ? [] : result.fixable,
|
|
42112
42517
|
warnings: result.warnings
|
|
42113
42518
|
});
|
|
42114
|
-
|
|
42115
|
-
|
|
42116
|
-
|
|
42117
|
-
|
|
42118
|
-
fixedCount: result.fixable.length
|
|
42119
|
-
};
|
|
42120
|
-
}
|
|
42121
|
-
return { diagnostics: nonFixableDiagnostics };
|
|
42519
|
+
return applied ? {
|
|
42520
|
+
diagnostics,
|
|
42521
|
+
fixedCount: result.fixable.length
|
|
42522
|
+
} : { diagnostics };
|
|
42122
42523
|
},
|
|
42123
|
-
defaultLevel:
|
|
42124
|
-
description
|
|
42125
|
-
fixable:
|
|
42126
|
-
id
|
|
42524
|
+
defaultLevel: level,
|
|
42525
|
+
description,
|
|
42526
|
+
fixable: fix !== void 0,
|
|
42527
|
+
id
|
|
42127
42528
|
};
|
|
42128
42529
|
}
|
|
42530
|
+
const REPO_LINT_RULES = [
|
|
42531
|
+
repoLintRule({
|
|
42532
|
+
check: ({ pkg }) => checkRootPrivate(pkg),
|
|
42533
|
+
description: "Root package is private",
|
|
42534
|
+
fix: ({ cwd, pkg }) => fixRootPrivate(cwd, pkg),
|
|
42535
|
+
id: "repo.root-private"
|
|
42536
|
+
}),
|
|
42537
|
+
repoLintRule({
|
|
42538
|
+
check: ({ pkg }) => checkNoPublishConfigOnPrivate(pkg),
|
|
42539
|
+
description: "Private root has no publishConfig",
|
|
42540
|
+
fix: ({ cwd, pkg }) => fixNoPublishConfigOnPrivate(cwd, pkg),
|
|
42541
|
+
id: "repo.no-private-publish-config"
|
|
42542
|
+
}),
|
|
42543
|
+
repoLintRule({
|
|
42544
|
+
check: ({ workspaces }) => checkPackagesFolder(workspaces),
|
|
42545
|
+
description: "Workspace packages live under packages/",
|
|
42546
|
+
id: "repo.packages-folder"
|
|
42547
|
+
}),
|
|
42548
|
+
repoLintRule({
|
|
42549
|
+
check: ({ cwd, workspaces }) => checkSpecFileLayout(cwd, workspaces),
|
|
42550
|
+
description: "Spec files live in spec/ folders",
|
|
42551
|
+
id: "repo.spec-layout"
|
|
42552
|
+
}),
|
|
42553
|
+
repoLintRule({
|
|
42554
|
+
check: ({ cwd, pm, workspaces }) => checkWorkspacesFieldPlacement(cwd, pm, workspaces),
|
|
42555
|
+
description: "Workspace fields are declared in the package-manager-specific location",
|
|
42556
|
+
fix: ({ cwd, pm, workspaces }) => fixWorkspacesFieldPlacement(cwd, pm, workspaces),
|
|
42557
|
+
id: "repo.workspaces-field-placement"
|
|
42558
|
+
}),
|
|
42559
|
+
repoLintRule({
|
|
42560
|
+
check: ({ cwd, pkg, pm, workspaces }) => checkWorkspaceGlobCoverage(pkg, cwd, pm, workspaces),
|
|
42561
|
+
description: "Workspace globs cover every package",
|
|
42562
|
+
id: "repo.workspace-glob-coverage"
|
|
42563
|
+
}),
|
|
42564
|
+
repoLintRule({
|
|
42565
|
+
check: ({ cwd, workspaces }) => checkNoPackageManagerInWorkspaces(cwd, workspaces),
|
|
42566
|
+
description: "Only the root package declares packageManager",
|
|
42567
|
+
fix: ({ cwd, pkg, workspaces }) => fixNoPackageManagerInWorkspaces(cwd, pkg, workspaces),
|
|
42568
|
+
id: "repo.no-package-manager-in-workspaces"
|
|
42569
|
+
}),
|
|
42570
|
+
repoLintRule({
|
|
42571
|
+
check: ({ cwd, workspaces }) => checkVoltaOnlyInRoot(cwd, workspaces),
|
|
42572
|
+
description: "Only the root package declares volta",
|
|
42573
|
+
fix: ({ cwd, pkg, workspaces }) => fixVoltaOnlyInRoot(cwd, pkg, workspaces),
|
|
42574
|
+
id: "repo.volta-only-root"
|
|
42575
|
+
}),
|
|
42576
|
+
repoLintRule({
|
|
42577
|
+
check: ({ cwd, workspaces }) => checkEnginesOnlyInNonTerminal(cwd, workspaces),
|
|
42578
|
+
description: "Only non-terminal packages declare engines",
|
|
42579
|
+
fix: ({ cwd, pkg, workspaces }) => fixEnginesOnlyInNonTerminal(cwd, pkg, workspaces),
|
|
42580
|
+
id: "repo.engines-non-terminal"
|
|
42581
|
+
}),
|
|
42582
|
+
repoLintRule({
|
|
42583
|
+
check: ({ cwd, workspaces }) => checkVersionsIncludeLts(cwd, workspaces),
|
|
42584
|
+
description: "Engine and volta versions include latest LTS",
|
|
42585
|
+
id: "repo.engines-lts"
|
|
42586
|
+
}),
|
|
42587
|
+
repoLintRule({
|
|
42588
|
+
check: ({ cwd, pkg, workspaces }) => checkVersionConsistency(cwd, pkg, workspaces),
|
|
42589
|
+
description: "Workspace versions are consistent",
|
|
42590
|
+
fix: ({ cwd, pkg, workspaces }) => fixVersionConsistency(cwd, pkg, writeRootPackageJson, workspaces),
|
|
42591
|
+
id: "repo.version-consistency"
|
|
42592
|
+
}),
|
|
42593
|
+
repoLintRule({
|
|
42594
|
+
check: ({ cwd, pm, workspaces }) => pm === "pnpm" ? checkWorkspaceProtocol(cwd, workspaces) : checkInternalDepVersions(cwd, workspaces),
|
|
42595
|
+
description: "Internal dependencies use the expected workspace/version protocol",
|
|
42596
|
+
fix: ({ cwd, pm, workspaces }) => pm === "pnpm" ? fixWorkspaceProtocol(cwd, workspaces) : fixInternalDepVersions(cwd, workspaces),
|
|
42597
|
+
id: "repo.internal-dependency-ranges"
|
|
42598
|
+
}),
|
|
42599
|
+
repoLintRule({
|
|
42600
|
+
check: ({ cwd, workspaces }) => checkInternalPeerVersions(cwd, workspaces),
|
|
42601
|
+
description: "Internal peerDependencies use publishable ranges",
|
|
42602
|
+
fix: ({ cwd, workspaces }) => fixInternalPeerVersions(cwd, workspaces),
|
|
42603
|
+
id: "repo.internal-peer-ranges"
|
|
42604
|
+
}),
|
|
42605
|
+
repoLintRule({
|
|
42606
|
+
check: ({ cwd, pm, workspaces }) => checkPnpmReleaseAgeExcludes(cwd, pm, workspaces),
|
|
42607
|
+
description: "pnpm minimumReleaseAgeExclude matches imported scopes",
|
|
42608
|
+
fix: ({ cwd, workspaces }) => fixPnpmReleaseAgeExcludes(cwd, workspaces),
|
|
42609
|
+
id: "repo.pnpm-release-age-excludes"
|
|
42610
|
+
}),
|
|
42611
|
+
repoLintRule({
|
|
42612
|
+
check: ({ cwd, pm }) => checkPnpmMinimumReleaseAge(cwd, pm),
|
|
42613
|
+
description: "pnpm minimumReleaseAge is configured",
|
|
42614
|
+
fix: ({ cwd }) => fixPnpmMinimumReleaseAge(cwd),
|
|
42615
|
+
id: "repo.pnpm-minimum-release-age"
|
|
42616
|
+
}),
|
|
42617
|
+
repoLintRule({
|
|
42618
|
+
check: ({ cwd, pkg, pm }) => checkPnpmDependencyOverrides(cwd, pm, pkg),
|
|
42619
|
+
description: "pnpm dependency overrides are not configured",
|
|
42620
|
+
id: "repo.pnpm-no-overrides",
|
|
42621
|
+
level: "warn"
|
|
42622
|
+
}),
|
|
42623
|
+
repoLintRule({
|
|
42624
|
+
check: ({ cwd, githubRunner }) => {
|
|
42625
|
+
const result = emptyResult();
|
|
42626
|
+
if (dependabotAlertsStatus(cwd, githubRunner) === "disabled") result.fixable.push("Dependabot alerts are disabled for this repository");
|
|
42627
|
+
return result;
|
|
42628
|
+
},
|
|
42629
|
+
description: "Dependabot security alerts are enabled for the repository",
|
|
42630
|
+
fix: ({ cwd, githubRunner }) => {
|
|
42631
|
+
if (enableDependabotAlerts(cwd, githubRunner)) return true;
|
|
42632
|
+
console.log(chalk.yellow(" ⚠ Could not enable Dependabot alerts — the token needs admin on this repository"));
|
|
42633
|
+
return false;
|
|
42634
|
+
},
|
|
42635
|
+
id: "repo.dependabot-enabled",
|
|
42636
|
+
level: "warn"
|
|
42637
|
+
})
|
|
42638
|
+
];
|
|
42129
42639
|
function logRuleDiagnostic(diagnostic) {
|
|
42130
42640
|
const color = diagnostic.level === "error" ? chalk.red : chalk.yellow;
|
|
42131
42641
|
const marker = diagnostic.level === "error" ? "✗" : "⚠";
|
|
@@ -42137,12 +42647,19 @@ function logRulePassed(rule) {
|
|
|
42137
42647
|
function logRuleFixed(rule, fixedCount) {
|
|
42138
42648
|
console.log(chalk.green(` ✔ Fixed ${fixedCount} issue(s): ${rule.description ?? rule.id}`));
|
|
42139
42649
|
}
|
|
42140
|
-
function logSummary(errors, fixed) {
|
|
42650
|
+
function logSummary(errors, warnings, fixed) {
|
|
42141
42651
|
if (fixed > 0) console.log(chalk.green(`\n Fixed ${fixed} issue(s)`));
|
|
42142
|
-
if (errors > 0)
|
|
42143
|
-
|
|
42652
|
+
if (errors > 0) {
|
|
42653
|
+
console.log(chalk.red(`\n ${errors} error(s) found`));
|
|
42654
|
+
return;
|
|
42655
|
+
}
|
|
42656
|
+
if (warnings > 0) {
|
|
42657
|
+
console.log(chalk.yellow(`\n ${warnings} warning(s) found`));
|
|
42658
|
+
return;
|
|
42659
|
+
}
|
|
42660
|
+
if (fixed === 0) console.log(chalk.green("\n All checks passed"));
|
|
42144
42661
|
}
|
|
42145
|
-
async function packageLintMonorepo(shouldFix = false) {
|
|
42662
|
+
async function packageLintMonorepo(shouldFix = false, options = {}) {
|
|
42146
42663
|
const cwd = INIT_CWD();
|
|
42147
42664
|
let pkg;
|
|
42148
42665
|
try {
|
|
@@ -42158,112 +42675,17 @@ async function packageLintMonorepo(shouldFix = false) {
|
|
|
42158
42675
|
console.log(chalk.green("Repo Lint"));
|
|
42159
42676
|
const pm = detectPackageManager$1();
|
|
42160
42677
|
const workspaces = getPackageManager().listWorkspaces();
|
|
42161
|
-
const
|
|
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
|
-
];
|
|
42678
|
+
const config = await loadWorkspaceCommandConfig(cwd, "repoLint");
|
|
42260
42679
|
const result = await runRuleChecks({
|
|
42261
|
-
commandName:
|
|
42262
|
-
configKey:
|
|
42263
|
-
config
|
|
42680
|
+
commandName: RULE_COMMANDS.repoLint.command,
|
|
42681
|
+
configKey: RULE_COMMANDS.repoLint.configKey,
|
|
42682
|
+
config,
|
|
42264
42683
|
context: {
|
|
42265
42684
|
cwd,
|
|
42266
|
-
pkg
|
|
42685
|
+
pkg,
|
|
42686
|
+
pm,
|
|
42687
|
+
workspaces,
|
|
42688
|
+
...options.githubRunner !== void 0 && { githubRunner: options.githubRunner }
|
|
42267
42689
|
},
|
|
42268
42690
|
fix: shouldFix,
|
|
42269
42691
|
reporter: {
|
|
@@ -42271,9 +42693,9 @@ async function packageLintMonorepo(shouldFix = false) {
|
|
|
42271
42693
|
fixed: logRuleFixed,
|
|
42272
42694
|
passed: logRulePassed
|
|
42273
42695
|
},
|
|
42274
|
-
rules:
|
|
42696
|
+
rules: REPO_LINT_RULES
|
|
42275
42697
|
});
|
|
42276
|
-
logSummary(result.envelope.errorCount, result.envelope.data.fixedCount);
|
|
42698
|
+
logSummary(result.envelope.errorCount, result.envelope.warningCount, result.envelope.data.fixedCount);
|
|
42277
42699
|
if (shouldFix && result.envelope.data.fixedCount > 0) shouldRunInstall();
|
|
42278
42700
|
return result;
|
|
42279
42701
|
}
|
|
@@ -43205,36 +43627,16 @@ function shouldCheckMinimumReleaseAgeExclude(cwd, config, isVerbose, isSilent) {
|
|
|
43205
43627
|
}
|
|
43206
43628
|
return false;
|
|
43207
43629
|
}
|
|
43630
|
+
/**
|
|
43631
|
+
Delegates to the shared YAML-document writer. Splicing ` - ${pattern}` lines by
|
|
43632
|
+
hand emitted invalid YAML for scoped patterns — `@` is a YAML reserved
|
|
43633
|
+
indicator, so a plain scalar cannot start with one and pnpm then failed to read
|
|
43634
|
+
its own workspace file.
|
|
43635
|
+
*/
|
|
43208
43636
|
function shouldFixMinimumReleaseAgeExclude(cwd, config) {
|
|
43209
43637
|
const content = readPnpmWorkspaceYaml(cwd);
|
|
43210
43638
|
if (content == null || content.length === 0) return false;
|
|
43211
|
-
|
|
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`));
|
|
43639
|
+
fixPnpmReleaseAgeExcludes(cwd, getPackageManager().listWorkspaces(), config.configuredReleaseAgeExclude ?? [...KNOWN_RELEASE_AGE_EXCLUDE_PATTERNS]);
|
|
43238
43640
|
return true;
|
|
43239
43641
|
}
|
|
43240
43642
|
function hasPnpmWorkspaceSetting(content, key) {
|
|
@@ -50426,6 +50828,51 @@ function ruleCatalogResult(rules, title) {
|
|
|
50426
50828
|
};
|
|
50427
50829
|
}
|
|
50428
50830
|
//#endregion
|
|
50831
|
+
//#region src/actions/secure/dependabotRules.ts
|
|
50832
|
+
/**
|
|
50833
|
+
Severity → default level. Alerts are overwhelmingly transitive lockfile
|
|
50834
|
+
findings, so nothing fails a build by default; raise these in
|
|
50835
|
+
`commands.dependabot.rules` to gate on them.
|
|
50836
|
+
*/
|
|
50837
|
+
const DEFAULT_LEVELS = {
|
|
50838
|
+
critical: "warn",
|
|
50839
|
+
high: "warn",
|
|
50840
|
+
low: "off",
|
|
50841
|
+
medium: "off"
|
|
50842
|
+
};
|
|
50843
|
+
function alertLabel(alert) {
|
|
50844
|
+
const where = alert.repository === void 0 ? "" : `${alert.repository} `;
|
|
50845
|
+
const kind = `${alert.relationship}/${alert.scope}`;
|
|
50846
|
+
const patched = alert.patchedVersion === void 0 ? "no patch available" : `patched in ${alert.patchedVersion}`;
|
|
50847
|
+
const advisory = alert.ghsaId.length > 0 ? ` ${alert.ghsaId}` : "";
|
|
50848
|
+
return `${where}${alert.packageName} ${alert.vulnerableVersionRange} (${kind}) — ${patched}${advisory}`;
|
|
50849
|
+
}
|
|
50850
|
+
function severityRule(severity) {
|
|
50851
|
+
return {
|
|
50852
|
+
check: ({ alerts }) => {
|
|
50853
|
+
return { diagnostics: alerts.filter((alert) => alert.severity === severity).map((alert) => ({
|
|
50854
|
+
message: alertLabel(alert),
|
|
50855
|
+
rule: `dependabot.${severity}`
|
|
50856
|
+
})) };
|
|
50857
|
+
},
|
|
50858
|
+
defaultLevel: DEFAULT_LEVELS[severity],
|
|
50859
|
+
description: `Open Dependabot alerts with ${severity} severity`,
|
|
50860
|
+
id: `dependabot.${severity}`
|
|
50861
|
+
};
|
|
50862
|
+
}
|
|
50863
|
+
const DEPENDABOT_RULES = [...DEPENDABOT_SEVERITIES.map((severity) => severityRule(severity)), {
|
|
50864
|
+
check: ({ availability, target }) => {
|
|
50865
|
+
if (availability !== "disabled") return {};
|
|
50866
|
+
return { diagnostics: [{
|
|
50867
|
+
message: `Dependabot alerts are disabled for ${target.length > 0 ? target : "this repository"} — enable them in Settings → Code security`,
|
|
50868
|
+
rule: "dependabot.alerts-enabled"
|
|
50869
|
+
}] };
|
|
50870
|
+
},
|
|
50871
|
+
defaultLevel: "warn",
|
|
50872
|
+
description: "Dependabot alerts are enabled for the repository",
|
|
50873
|
+
id: "dependabot.alerts-enabled"
|
|
50874
|
+
}];
|
|
50875
|
+
//#endregion
|
|
50429
50876
|
//#region src/actions/skills/detectProfile.ts
|
|
50430
50877
|
const XYLABS_SCOPE = "@xylabs/";
|
|
50431
50878
|
const ARIESTOOLS_SCOPE = "@ariestools/";
|
|
@@ -51178,34 +51625,11 @@ const XY_WORK_GITHUB_LABEL = "xy-work";
|
|
|
51178
51625
|
HTML comment marker embedded in issue bodies so we can recognize our issues.
|
|
51179
51626
|
*/
|
|
51180
51627
|
const XY_WORK_GITHUB_BODY_MARKER_PREFIX = "<!-- xy-work:";
|
|
51181
|
-
const defaultGithubWorkRunner =
|
|
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
|
-
};
|
|
51628
|
+
const defaultGithubWorkRunner = defaultGithubRunner;
|
|
51198
51629
|
const isRecord = (value) => {
|
|
51199
51630
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
51200
51631
|
};
|
|
51201
|
-
const runOrThrow =
|
|
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
|
-
};
|
|
51632
|
+
const runOrThrow = githubRunOrThrow;
|
|
51209
51633
|
const parseIssueUrl = (url) => {
|
|
51210
51634
|
const match = url.trim().match(/\/issues\/(\d+)\s*$/);
|
|
51211
51635
|
if (match === null) throw new Error(`Could not parse GitHub issue number from: ${url.trim()}`);
|
|
@@ -51393,17 +51817,7 @@ const createGithubWorkBridge = (runner = defaultGithubWorkRunner) => {
|
|
|
51393
51817
|
], cwd, "Failed to create GitHub issue");
|
|
51394
51818
|
return parseIssueUrl(stdout);
|
|
51395
51819
|
},
|
|
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
|
-
},
|
|
51820
|
+
isAvailable: (cwd) => githubIsAvailable(runner, cwd),
|
|
51407
51821
|
listIssues,
|
|
51408
51822
|
listOpenIssues: (cwd) => listIssues(cwd, "open"),
|
|
51409
51823
|
updateIssue: (cwd, issueNumber, update) => {
|
|
@@ -52136,109 +52550,6 @@ const workLint = async (options = {}) => {
|
|
|
52136
52550
|
};
|
|
52137
52551
|
//#endregion
|
|
52138
52552
|
//#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
52553
|
const NON_FIXABLE_DEAD_RULES = /* @__PURE__ */ new Set([
|
|
52243
52554
|
"dead.repo.deprecated-export",
|
|
52244
52555
|
"dead.workspace.deprecated-export",
|
|
@@ -52259,7 +52570,7 @@ async function loadCommandConfig(commandName, pkg) {
|
|
|
52259
52570
|
}
|
|
52260
52571
|
return loadWorkspaceCommandConfig(process.cwd(), commandName);
|
|
52261
52572
|
}
|
|
52262
|
-
function
|
|
52573
|
+
function runtimeRuleCatalog(command, configKey, definitions, config) {
|
|
52263
52574
|
const ruleSettings = config?.rules ?? {};
|
|
52264
52575
|
const known = new Set(definitions.flatMap((rule) => [rule.id, ...rule.aliases ?? []]));
|
|
52265
52576
|
const unknown = Object.keys(ruleSettings).filter((id) => !known.has(id));
|
|
@@ -52278,9 +52589,6 @@ function staticCatalog(command, configKey, definitions, config) {
|
|
|
52278
52589
|
level: parseRuleLevelSetting(ruleConfigPath(configKey, rule.id), resolveSetting(rule), rule.defaultLevel)
|
|
52279
52590
|
}));
|
|
52280
52591
|
}
|
|
52281
|
-
function runtimeRuleCatalog(command, configKey, definitions, config) {
|
|
52282
|
-
return staticCatalog(command, configKey, definitions, config);
|
|
52283
|
-
}
|
|
52284
52592
|
function commandPrefix(prefix, rules) {
|
|
52285
52593
|
return rules.map((rule) => ({
|
|
52286
52594
|
...rule,
|
|
@@ -52348,6 +52656,9 @@ async function getApiExposureRuleCatalog(pkg) {
|
|
|
52348
52656
|
};
|
|
52349
52657
|
});
|
|
52350
52658
|
}
|
|
52659
|
+
async function getDependabotRuleCatalog() {
|
|
52660
|
+
return runtimeRuleCatalog(RULE_COMMANDS.dependabot.command, RULE_COMMANDS.dependabot.configKey, DEPENDABOT_RULES, await loadCommandConfig("dependabot"));
|
|
52661
|
+
}
|
|
52351
52662
|
async function getGitlintRuleCatalog() {
|
|
52352
52663
|
return runtimeRuleCatalog(RULE_COMMANDS.gitLint.command, RULE_COMMANDS.gitLint.configKey, GITLINT_RULES, await loadCommandConfig("gitLint"));
|
|
52353
52664
|
}
|
|
@@ -52355,7 +52666,7 @@ async function getPackmanRuleCatalog() {
|
|
|
52355
52666
|
return runtimeRuleCatalog(RULE_COMMANDS.packman.command, RULE_COMMANDS.packman.configKey, PACKMAN_RULES, await loadCommandConfig("packman"));
|
|
52356
52667
|
}
|
|
52357
52668
|
async function getRepoLintRuleCatalog() {
|
|
52358
|
-
return
|
|
52669
|
+
return runtimeRuleCatalog(RULE_COMMANDS.repoLint.command, RULE_COMMANDS.repoLint.configKey, REPO_LINT_RULES, await loadCommandConfig("repoLint"));
|
|
52359
52670
|
}
|
|
52360
52671
|
async function getNodeLintRuleCatalog() {
|
|
52361
52672
|
return runtimeRuleCatalog(RULE_COMMANDS.nodeLint.command, RULE_COMMANDS.nodeLint.configKey, NODE_LINT_RULES, await loadCommandConfig("nodeLint"));
|
|
@@ -52449,54 +52760,187 @@ function getCycleRuleCatalog(depth = 25) {
|
|
|
52449
52760
|
level: "warn"
|
|
52450
52761
|
}];
|
|
52451
52762
|
}
|
|
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
52763
|
async function getCheckRuleCatalog() {
|
|
52469
|
-
|
|
52764
|
+
const groups = await Promise.all([
|
|
52470
52765
|
getGitlintRuleCatalog(),
|
|
52471
52766
|
getPackmanRuleCatalog(),
|
|
52472
52767
|
getPublintRuleCatalog(),
|
|
52473
52768
|
getRepoLintRuleCatalog(),
|
|
52474
52769
|
getLintlintRuleCatalog(),
|
|
52475
52770
|
getSkillsLintRuleCatalog()
|
|
52476
|
-
])
|
|
52771
|
+
]);
|
|
52772
|
+
return sortRules(commandPrefix(RULE_COMMANDS.check.command, groups.flat()));
|
|
52477
52773
|
}
|
|
52478
52774
|
async function getFixRuleCatalog() {
|
|
52479
|
-
|
|
52775
|
+
const groups = await Promise.all([
|
|
52480
52776
|
getGitlintRuleCatalog(),
|
|
52481
52777
|
getDeplintRuleCatalog(),
|
|
52482
52778
|
getRepoLintRuleCatalog(),
|
|
52483
52779
|
getPublintRuleCatalog(),
|
|
52484
|
-
getEslintRuleCatalog(
|
|
52780
|
+
getEslintRuleCatalog(RULE_COMMANDS.lint.command),
|
|
52485
52781
|
getLintlintRuleCatalog()
|
|
52486
|
-
])
|
|
52782
|
+
]);
|
|
52783
|
+
return sortRules(commandPrefix(RULE_COMMANDS.fix.command, groups.flat()));
|
|
52784
|
+
}
|
|
52785
|
+
/**
|
|
52786
|
+
* Every rule-bearing command, keyed by its `RULE_COMMANDS` entry. Declaring
|
|
52787
|
+
* this as a total `Record<RuleCommandKey, …>` makes the compiler reject a new
|
|
52788
|
+
* registry entry that has no catalog loader (and vice versa), so the root
|
|
52789
|
+
* `xy --rules` view cannot silently miss a command.
|
|
52790
|
+
*/
|
|
52791
|
+
const RULE_CATALOG_LOADERS = {
|
|
52792
|
+
apiExposure: () => getApiExposureRuleCatalog(),
|
|
52793
|
+
check: () => getCheckRuleCatalog(),
|
|
52794
|
+
clean: () => getCleanRuleCatalog(),
|
|
52795
|
+
cycle: () => getCycleRuleCatalog(),
|
|
52796
|
+
dead: () => getDeadRuleCatalog(),
|
|
52797
|
+
dependabot: () => getDependabotRuleCatalog(),
|
|
52798
|
+
deplint: () => getDeplintRuleCatalog(),
|
|
52799
|
+
fix: () => getFixRuleCatalog(),
|
|
52800
|
+
gitLint: () => getGitlintRuleCatalog(),
|
|
52801
|
+
lint: () => getEslintRuleCatalog(),
|
|
52802
|
+
lintLint: () => getLintlintRuleCatalog(),
|
|
52803
|
+
nodeLint: () => getNodeLintRuleCatalog(),
|
|
52804
|
+
packman: () => getPackmanRuleCatalog(),
|
|
52805
|
+
publint: () => getPublintRuleCatalog(),
|
|
52806
|
+
repoLint: () => getRepoLintRuleCatalog(),
|
|
52807
|
+
skillsLint: () => getSkillsLintRuleCatalog(),
|
|
52808
|
+
workLint: () => getWorkLintRuleCatalog()
|
|
52809
|
+
};
|
|
52810
|
+
function rootRuleCommandKeys() {
|
|
52811
|
+
return Object.keys(RULE_COMMANDS).filter((key) => RULE_COMMANDS[key].includeInRoot);
|
|
52812
|
+
}
|
|
52813
|
+
async function getDirectRuleCatalog() {
|
|
52814
|
+
return sortRules((await Promise.all(rootRuleCommandKeys().map((key) => RULE_CATALOG_LOADERS[key]()))).flat());
|
|
52487
52815
|
}
|
|
52488
52816
|
async function getMasterRuleCatalog() {
|
|
52489
|
-
return
|
|
52817
|
+
return getDirectRuleCatalog();
|
|
52490
52818
|
}
|
|
52491
52819
|
//#endregion
|
|
52492
|
-
//#region src/actions/secure.ts
|
|
52493
|
-
|
|
52820
|
+
//#region src/actions/secure/dependabot.ts
|
|
52821
|
+
/**
|
|
52822
|
+
Fetch and filter alerts without rendering — used by `xy secure` to build its
|
|
52823
|
+
per-tool summary, and by `xy secure dependabot` before rule evaluation.
|
|
52824
|
+
*/
|
|
52825
|
+
function collectDependabotAlerts(options = {}) {
|
|
52826
|
+
const report = fetchDependabotAlerts({
|
|
52827
|
+
cwd: options.cwd ?? INIT_CWD(),
|
|
52828
|
+
...options.org !== void 0 && { org: options.org },
|
|
52829
|
+
...options.runner !== void 0 && { runner: options.runner },
|
|
52830
|
+
...options.state !== void 0 && { state: options.state }
|
|
52831
|
+
});
|
|
52832
|
+
const filtered = {
|
|
52833
|
+
...report,
|
|
52834
|
+
alerts: sortDependabotAlerts(filterDependabotAlerts(report.alerts, {
|
|
52835
|
+
...options.relationship !== void 0 && { relationship: options.relationship },
|
|
52836
|
+
...options.scope !== void 0 && { scope: options.scope }
|
|
52837
|
+
}))
|
|
52838
|
+
};
|
|
52839
|
+
return {
|
|
52840
|
+
report: filtered,
|
|
52841
|
+
summary: summarizeDependabotAlerts(filtered)
|
|
52842
|
+
};
|
|
52843
|
+
}
|
|
52844
|
+
/**
|
|
52845
|
+
An org-wide sweep can match thousands of alerts. Cap what reaches the console
|
|
52846
|
+
and say how many were held back — the envelope always carries every one.
|
|
52847
|
+
*/
|
|
52848
|
+
const DIAGNOSTIC_DISPLAY_LIMIT = 50;
|
|
52849
|
+
function createCappedReporter() {
|
|
52850
|
+
let shown = 0;
|
|
52851
|
+
let suppressed = 0;
|
|
52852
|
+
return {
|
|
52853
|
+
diagnostic: (diagnostic) => {
|
|
52854
|
+
if (shown >= DIAGNOSTIC_DISPLAY_LIMIT) {
|
|
52855
|
+
suppressed += 1;
|
|
52856
|
+
return;
|
|
52857
|
+
}
|
|
52858
|
+
shown += 1;
|
|
52859
|
+
const color = diagnostic.level === "error" ? chalk.red : chalk.yellow;
|
|
52860
|
+
const marker = diagnostic.level === "error" ? "✗" : "⚠";
|
|
52861
|
+
console.log(color(` ${marker} ${diagnostic.message}`));
|
|
52862
|
+
},
|
|
52863
|
+
reportSuppressed: () => {
|
|
52864
|
+
if (suppressed === 0) return;
|
|
52865
|
+
console.log(chalk.gray(` … ${suppressed} more not shown — re-run with --json for the full list`));
|
|
52866
|
+
}
|
|
52867
|
+
};
|
|
52868
|
+
}
|
|
52869
|
+
async function dependabot(options = {}) {
|
|
52870
|
+
const cwd = options.cwd ?? INIT_CWD();
|
|
52871
|
+
const { report, summary } = collectDependabotAlerts(options);
|
|
52872
|
+
if (options.summaryOnly === true) renderDependabotAlerts([], summary);
|
|
52873
|
+
else renderDependabotAlerts(report.alerts, summary);
|
|
52874
|
+
const context = {
|
|
52875
|
+
alerts: report.alerts,
|
|
52876
|
+
availability: report.availability,
|
|
52877
|
+
target: report.target
|
|
52878
|
+
};
|
|
52879
|
+
const config = await loadWorkspaceCommandConfig(cwd, RULE_COMMANDS.dependabot.configKey);
|
|
52880
|
+
const reporter = createCappedReporter();
|
|
52881
|
+
const result = await runRuleChecks({
|
|
52882
|
+
commandName: RULE_COMMANDS.dependabot.command,
|
|
52883
|
+
config,
|
|
52884
|
+
configKey: RULE_COMMANDS.dependabot.configKey,
|
|
52885
|
+
context,
|
|
52886
|
+
reporter: options.summaryOnly === true ? {} : { diagnostic: reporter.diagnostic },
|
|
52887
|
+
rules: DEPENDABOT_RULES,
|
|
52888
|
+
...options.strict !== void 0 && { strict: options.strict }
|
|
52889
|
+
});
|
|
52890
|
+
if (options.summaryOnly === true) {
|
|
52891
|
+
const reportable = result.envelope.errorCount + result.envelope.warningCount;
|
|
52892
|
+
if (reportable > 0) console.log(chalk.gray(` ${reportable} alert(s) at or above the configured rule levels — re-run without --summary for detail`));
|
|
52893
|
+
} else reporter.reportSuppressed();
|
|
52894
|
+
return result;
|
|
52895
|
+
}
|
|
52896
|
+
//#endregion
|
|
52897
|
+
//#region src/actions/secure/deps.ts
|
|
52898
|
+
const secureDeps = async ({ jobs = 16, pkg, render, verbose = false } = {}) => {
|
|
52494
52899
|
return await runSecurityAudit(getPackageManager(), {
|
|
52495
52900
|
concurrency: jobs,
|
|
52496
52901
|
pkg,
|
|
52497
|
-
verbose
|
|
52902
|
+
verbose,
|
|
52903
|
+
...render !== void 0 && { render }
|
|
52498
52904
|
});
|
|
52499
52905
|
};
|
|
52906
|
+
/**
|
|
52907
|
+
Run the dependency audit purely to collect its rows — used by `xy secure` to
|
|
52908
|
+
build a summary without printing the full table.
|
|
52909
|
+
*/
|
|
52910
|
+
const collectSecureDepsRows = async (options = {}) => {
|
|
52911
|
+
let rows = [];
|
|
52912
|
+
return {
|
|
52913
|
+
exitCode: await secureDeps({
|
|
52914
|
+
...options,
|
|
52915
|
+
render: (collected) => {
|
|
52916
|
+
rows = collected;
|
|
52917
|
+
}
|
|
52918
|
+
}),
|
|
52919
|
+
rows
|
|
52920
|
+
};
|
|
52921
|
+
};
|
|
52922
|
+
//#endregion
|
|
52923
|
+
//#region src/actions/secure/secure.ts
|
|
52924
|
+
/**
|
|
52925
|
+
The `xy secure` overview: run both audits, print one summary line each, and
|
|
52926
|
+
point at the subcommands for the detail tables.
|
|
52927
|
+
*/
|
|
52928
|
+
const secure = async (options = {}) => {
|
|
52929
|
+
const { rows, exitCode } = await collectSecureDepsRows({
|
|
52930
|
+
jobs: options.jobs,
|
|
52931
|
+
pkg: options.pkg,
|
|
52932
|
+
verbose: options.verbose ?? false
|
|
52933
|
+
});
|
|
52934
|
+
renderSecureDepsSummary(rows);
|
|
52935
|
+
const { summary } = collectDependabotAlerts({
|
|
52936
|
+
...options.cwd !== void 0 && { cwd: options.cwd },
|
|
52937
|
+
...options.org !== void 0 && { org: options.org },
|
|
52938
|
+
...options.runner !== void 0 && { runner: options.runner }
|
|
52939
|
+
});
|
|
52940
|
+
renderDependabotSummary(summary);
|
|
52941
|
+
console.log(chalk.gray("\n Details: xy secure deps · xy secure dependabot"));
|
|
52942
|
+
return combineResults([resultFromExitCode(exitCode)]);
|
|
52943
|
+
};
|
|
52500
52944
|
//#endregion
|
|
52501
52945
|
//#region src/actions/sitemap.ts
|
|
52502
52946
|
const sitemap = () => {
|
|
@@ -53546,7 +53990,7 @@ const checkCommand = {
|
|
|
53546
53990
|
const jobs = argv.jobs;
|
|
53547
53991
|
if (isVerbose) console.log("Check");
|
|
53548
53992
|
if (argv.rules === true) {
|
|
53549
|
-
await withEnvelope("check rules", async () => ruleCatalogResult(await getCheckRuleCatalog(),
|
|
53993
|
+
await withEnvelope("check rules", async () => ruleCatalogResult(await getCheckRuleCatalog(), RULE_COMMANDS.check.title));
|
|
53550
53994
|
return;
|
|
53551
53995
|
}
|
|
53552
53996
|
await withEnvelope("check", async () => {
|
|
@@ -53632,7 +54076,7 @@ const deadCommand = {
|
|
|
53632
54076
|
const isFixRemove = argv["fix-remove"] === true;
|
|
53633
54077
|
const pkg = argv.package;
|
|
53634
54078
|
if (argv.rules === true) {
|
|
53635
|
-
await withEnvelope("dead rules", async () => ruleCatalogResult(await getDeadRuleCatalog(pkg, { deprecated: argv.deprecated === true }),
|
|
54079
|
+
await withEnvelope("dead rules", async () => ruleCatalogResult(await getDeadRuleCatalog(pkg, { deprecated: argv.deprecated === true }), RULE_COMMANDS.dead.title));
|
|
53636
54080
|
return;
|
|
53637
54081
|
}
|
|
53638
54082
|
await withEnvelope("dead", () => dead({
|
|
@@ -53812,7 +54256,7 @@ const lintCommand$3 = {
|
|
|
53812
54256
|
},
|
|
53813
54257
|
handler: async (argv) => {
|
|
53814
54258
|
if (argv.rules === true) {
|
|
53815
|
-
await withEnvelope("packman lint rules", async () => ruleCatalogResult(await getPackmanRuleCatalog(),
|
|
54259
|
+
await withEnvelope("packman lint rules", async () => ruleCatalogResult(await getPackmanRuleCatalog(), RULE_COMMANDS.packman.title));
|
|
53816
54260
|
return;
|
|
53817
54261
|
}
|
|
53818
54262
|
await withEnvelope("packman lint", () => packmanLint({
|
|
@@ -53944,7 +54388,7 @@ const lintCommand$2 = {
|
|
|
53944
54388
|
handler: async (argv) => {
|
|
53945
54389
|
if (Boolean(argv.verbose)) console.log("Repo Lint");
|
|
53946
54390
|
if (argv.rules === true) {
|
|
53947
|
-
await withEnvelope("repo lint rules", async () => ruleCatalogResult(await getRepoLintRuleCatalog(),
|
|
54391
|
+
await withEnvelope("repo lint rules", async () => ruleCatalogResult(await getRepoLintRuleCatalog(), RULE_COMMANDS.repoLint.title));
|
|
53948
54392
|
return;
|
|
53949
54393
|
}
|
|
53950
54394
|
await withEnvelope("repo lint", () => packageLintMonorepo(!!Boolean(argv.fix)));
|
|
@@ -53974,19 +54418,101 @@ const retestCommand = {
|
|
|
53974
54418
|
}
|
|
53975
54419
|
};
|
|
53976
54420
|
//#endregion
|
|
53977
|
-
//#region src/xy/common/
|
|
53978
|
-
const
|
|
54421
|
+
//#region src/xy/common/secure/dependabotCommand.ts
|
|
54422
|
+
const dependabotCommand = {
|
|
54423
|
+
builder: (yargs) => {
|
|
54424
|
+
return yargs.option("org", {
|
|
54425
|
+
description: "Report every repository in this GitHub org instead of the current repo",
|
|
54426
|
+
type: "string"
|
|
54427
|
+
}).option("relationship", {
|
|
54428
|
+
choices: [
|
|
54429
|
+
"all",
|
|
54430
|
+
"direct",
|
|
54431
|
+
"transitive"
|
|
54432
|
+
],
|
|
54433
|
+
default: "all",
|
|
54434
|
+
description: "Only report alerts for direct or transitive dependencies",
|
|
54435
|
+
type: "string"
|
|
54436
|
+
}).option("rules", {
|
|
54437
|
+
description: "List supported dependabot rules and their effective levels",
|
|
54438
|
+
type: "boolean"
|
|
54439
|
+
}).option("scope", {
|
|
54440
|
+
choices: [
|
|
54441
|
+
"all",
|
|
54442
|
+
"development",
|
|
54443
|
+
"runtime"
|
|
54444
|
+
],
|
|
54445
|
+
default: "all",
|
|
54446
|
+
description: "Only report alerts for runtime or development dependencies",
|
|
54447
|
+
type: "string"
|
|
54448
|
+
}).option("state", {
|
|
54449
|
+
choices: [
|
|
54450
|
+
"all",
|
|
54451
|
+
"dismissed",
|
|
54452
|
+
"fixed",
|
|
54453
|
+
"open"
|
|
54454
|
+
],
|
|
54455
|
+
default: "open",
|
|
54456
|
+
description: "Alert state to report",
|
|
54457
|
+
type: "string"
|
|
54458
|
+
}).option("summary", {
|
|
54459
|
+
description: "Print only the summary line, not the per-alert table",
|
|
54460
|
+
type: "boolean"
|
|
54461
|
+
});
|
|
54462
|
+
},
|
|
54463
|
+
command: "dependabot",
|
|
54464
|
+
describe: "Report GitHub Dependabot security alerts",
|
|
54465
|
+
handler: async (argv) => {
|
|
54466
|
+
if (argv.rules === true) {
|
|
54467
|
+
await withEnvelope("secure dependabot rules", async () => ruleCatalogResult(await getDependabotRuleCatalog(), RULE_COMMANDS.dependabot.title));
|
|
54468
|
+
return;
|
|
54469
|
+
}
|
|
54470
|
+
const options = {
|
|
54471
|
+
relationship: argv.relationship,
|
|
54472
|
+
scope: argv.scope,
|
|
54473
|
+
state: argv.state,
|
|
54474
|
+
strict: argv.strict === true,
|
|
54475
|
+
summaryOnly: argv.summary === true,
|
|
54476
|
+
...typeof argv.org === "string" && argv.org.length > 0 && { org: argv.org }
|
|
54477
|
+
};
|
|
54478
|
+
await withEnvelope("secure dependabot", () => dependabot(options));
|
|
54479
|
+
}
|
|
54480
|
+
};
|
|
54481
|
+
//#endregion
|
|
54482
|
+
//#region src/xy/common/secure/depsCommand.ts
|
|
54483
|
+
const depsCommand = {
|
|
53979
54484
|
builder: (yargs) => {
|
|
53980
54485
|
return packagePositionalParam(yargs);
|
|
53981
54486
|
},
|
|
54487
|
+
command: "deps [package]",
|
|
54488
|
+
describe: "Audit direct dependency age and downloads",
|
|
54489
|
+
handler: async (argv) => {
|
|
54490
|
+
if (Boolean(argv.verbose)) console.log(`Secure deps: ${argv.package ?? "all"}`);
|
|
54491
|
+
await withEnvelope("secure deps", () => secureDeps({
|
|
54492
|
+
jobs: argv.jobs,
|
|
54493
|
+
pkg: argv.package,
|
|
54494
|
+
verbose: !!Boolean(argv.verbose)
|
|
54495
|
+
}));
|
|
54496
|
+
}
|
|
54497
|
+
};
|
|
54498
|
+
//#endregion
|
|
54499
|
+
//#region src/xy/common/secure/index.ts
|
|
54500
|
+
const secureCommand = {
|
|
54501
|
+
builder: (yargs) => {
|
|
54502
|
+
return packagePositionalParam(yargs).command(dependabotCommand).command(depsCommand).option("org", {
|
|
54503
|
+
description: "Summarize Dependabot alerts for this GitHub org instead of the current repo",
|
|
54504
|
+
type: "string"
|
|
54505
|
+
});
|
|
54506
|
+
},
|
|
53982
54507
|
command: "secure [package]",
|
|
53983
|
-
describe: "Secure -
|
|
54508
|
+
describe: "Secure - Dependency and Dependabot security overview",
|
|
53984
54509
|
handler: async (argv) => {
|
|
53985
54510
|
if (Boolean(argv.verbose)) console.log(`Secure: ${argv.package ?? "all"}`);
|
|
53986
54511
|
await withEnvelope("secure", () => secure({
|
|
53987
54512
|
jobs: argv.jobs,
|
|
53988
54513
|
pkg: argv.package,
|
|
53989
|
-
verbose: !!Boolean(argv.verbose)
|
|
54514
|
+
verbose: !!Boolean(argv.verbose),
|
|
54515
|
+
...typeof argv.org === "string" && argv.org.length > 0 && { org: argv.org }
|
|
53990
54516
|
}));
|
|
53991
54517
|
}
|
|
53992
54518
|
};
|
|
@@ -54086,7 +54612,7 @@ const runSkillsTail = async (tail) => {
|
|
|
54086
54612
|
}
|
|
54087
54613
|
if (subcommand === "defaults") return skillsDefaults(args);
|
|
54088
54614
|
if (subcommand === "lint") {
|
|
54089
|
-
if (args.includes("--rules")) return ruleCatalogResult(await getSkillsLintRuleCatalog(),
|
|
54615
|
+
if (args.includes("--rules")) return ruleCatalogResult(await getSkillsLintRuleCatalog(), RULE_COMMANDS.skillsLint.title);
|
|
54090
54616
|
const lintArgs = args.filter((arg) => !LINT_FLAGS.has(arg) && !HELP_FLAGS.has(arg));
|
|
54091
54617
|
if (lintArgs.length > 0) {
|
|
54092
54618
|
console.error(`Unknown arguments for skills lint: ${lintArgs.join(", ")}`);
|
|
@@ -54634,9 +55160,16 @@ const cleanCommand = {
|
|
|
54634
55160
|
default: false,
|
|
54635
55161
|
description: "Like --full, but also ignores clean.exclude / default excludes (only .git is protected)",
|
|
54636
55162
|
type: "boolean"
|
|
55163
|
+
}).option("rules", {
|
|
55164
|
+
description: "List supported clean rules and their effective levels",
|
|
55165
|
+
type: "boolean"
|
|
54637
55166
|
});
|
|
54638
55167
|
},
|
|
54639
55168
|
handler: async (argv) => {
|
|
55169
|
+
if (argv.rules === true) {
|
|
55170
|
+
await withEnvelope("clean rules", async () => ruleCatalogResult(await getCleanRuleCatalog(argv.package), RULE_COMMANDS.clean.title));
|
|
55171
|
+
return;
|
|
55172
|
+
}
|
|
54640
55173
|
const fullMode = resolveFullMode(argv);
|
|
54641
55174
|
if (Boolean(argv.verbose)) console.log(`Cleaning: ${argv.package ?? "all"}${fullMode === "none" ? "" : ` (${fullMode})`}`);
|
|
54642
55175
|
await withEnvelope("clean", () => clean({
|
|
@@ -54765,7 +55298,7 @@ const apiExposureCommand = {
|
|
|
54765
55298
|
if (Boolean(argv.verbose)) console.log("API Exposure");
|
|
54766
55299
|
const pkg = typeof argv.package === "string" ? argv.package : void 0;
|
|
54767
55300
|
if (argv.rules === true) {
|
|
54768
|
-
await withEnvelope("api-exposure rules", async () => ruleCatalogResult(await getApiExposureRuleCatalog(pkg),
|
|
55301
|
+
await withEnvelope("api-exposure rules", async () => ruleCatalogResult(await getApiExposureRuleCatalog(pkg), RULE_COMMANDS.apiExposure.title));
|
|
54769
55302
|
return;
|
|
54770
55303
|
}
|
|
54771
55304
|
const dep = argv.dep?.flatMap((value) => value.split(",")).map((value) => value.trim()).filter(Boolean);
|
|
@@ -54807,7 +55340,7 @@ const cycleCommand = {
|
|
|
54807
55340
|
handler: async (argv) => {
|
|
54808
55341
|
if (Boolean(argv.verbose)) console.log("Cycle");
|
|
54809
55342
|
if (argv.rules === true) {
|
|
54810
|
-
await withEnvelope("cycle rules", async () => ruleCatalogResult(getCycleRuleCatalog(argv.depth),
|
|
55343
|
+
await withEnvelope("cycle rules", async () => ruleCatalogResult(getCycleRuleCatalog(argv.depth), RULE_COMMANDS.cycle.title));
|
|
54811
55344
|
return;
|
|
54812
55345
|
}
|
|
54813
55346
|
await withEnvelope("cycle", () => cycle({
|
|
@@ -54900,7 +55433,7 @@ const deplintRunCommand = {
|
|
|
54900
55433
|
if (Boolean(argv.verbose)) console.log("Deplint");
|
|
54901
55434
|
const pkg = typeof argv.package === "string" ? argv.package : void 0;
|
|
54902
55435
|
if (argv.rules === true) {
|
|
54903
|
-
await withEnvelope("deplint rules", async () => ruleCatalogResult(await getDeplintRuleCatalog(pkg),
|
|
55436
|
+
await withEnvelope("deplint rules", async () => ruleCatalogResult(await getDeplintRuleCatalog(pkg), RULE_COMMANDS.deplint.title));
|
|
54904
55437
|
return;
|
|
54905
55438
|
}
|
|
54906
55439
|
const cliExclude = argv.exclude?.flatMap((v) => v.split(",")).map((v) => v.trim()).filter(Boolean);
|
|
@@ -54944,7 +55477,7 @@ const fixCommand = {
|
|
|
54944
55477
|
handler: async (argv) => {
|
|
54945
55478
|
if (Boolean(argv.verbose)) console.log("Fix");
|
|
54946
55479
|
if (argv.rules === true) {
|
|
54947
|
-
await withEnvelope("fix rules", async () => ruleCatalogResult(await getFixRuleCatalog(),
|
|
55480
|
+
await withEnvelope("fix rules", async () => ruleCatalogResult(await getFixRuleCatalog(), RULE_COMMANDS.fix.title));
|
|
54948
55481
|
return;
|
|
54949
55482
|
}
|
|
54950
55483
|
await withEnvelope("fix", () => fix({
|
|
@@ -55093,7 +55626,7 @@ const runCommand = {
|
|
|
55093
55626
|
handler: async (argv) => {
|
|
55094
55627
|
if (Boolean(argv.verbose)) console.log(Boolean(argv.analyze) ? "Lint analyze" : "Lint");
|
|
55095
55628
|
if (argv.rules === true) {
|
|
55096
|
-
await withEnvelope("lint rules", async () => ruleCatalogResult(await getEslintRuleCatalog("lint"),
|
|
55629
|
+
await withEnvelope("lint rules", async () => ruleCatalogResult(await getEslintRuleCatalog("lint"), RULE_COMMANDS.lint.title));
|
|
55097
55630
|
return;
|
|
55098
55631
|
}
|
|
55099
55632
|
if (Boolean(argv.fresh)) {
|
|
@@ -60833,7 +61366,7 @@ const xyBase = async (plugins) => {
|
|
|
60833
61366
|
warnIfUnsupportedPackageManager();
|
|
60834
61367
|
if (isRootRulesRequest()) {
|
|
60835
61368
|
if (process.argv.some((arg) => isTruthyLongFlag(arg, "--json"))) setJsonMode(true);
|
|
60836
|
-
await withEnvelope("rules", async () => ruleCatalogResult(await getMasterRuleCatalog(),
|
|
61369
|
+
await withEnvelope("rules", async () => ruleCatalogResult(await getMasterRuleCatalog(), ROOT_RULES_TITLE));
|
|
60837
61370
|
return;
|
|
60838
61371
|
}
|
|
60839
61372
|
const options = xyParseOptions();
|