@kaynooo/cli-pkg 0.16.1 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cli.js +229 -65
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -44,7 +44,7 @@ pkg audit ~/Workspace/app --level high --prod --ignore GHSA-238p-pmpm-9mq7 --jso
|
|
|
44
44
|
- `--level <low|moderate|high|critical>` (`moderate`) keeps only the advisories at that severity or above, `--prod` audits only the packages a production or optional dependency of a workspace reaches, and `--ignore <GHSA or id>` (repeatable) skips an advisory; `blockSeverity` is for `pkg check` and does not apply here. The three flags are the ones of `audit`.
|
|
45
45
|
- `--json` prints a flat array, one `{name, version, license, blocked, warnings, advisories}` per package with a finding, each advisory being `{id, ghsa, url, title, severity, vulnerable, fixed}`. `audit --json` nests the same advisory rows (without `vulnerable`) in `{repo, path, findings, error}` per repository.
|
|
46
46
|
- `--min-age <days>` changes the 14 days.
|
|
47
|
-
- Use `pkg audit` to vet one repository in depth (age, install scripts, licences and advisories, with the registry as the source); use `audit` to sweep many repositories for advisories only, through `bun audit`.
|
|
47
|
+
- Use `pkg audit` to vet one repository in depth (age, install scripts, licences and advisories, with the registry as the source); use `ws audit` to sweep many repositories for advisories only, through `bun audit`.
|
|
48
48
|
- A pin under the minimum age fixing an advisory of the `safe` version at `blockSeverity` or above (not one `--ignore` skips) is let through as `pkg check` lets it, a warning naming the GHSAs.
|
|
49
49
|
- It exits 1 when a package is missing, too fresh or outside the allowlist, or an advisory remains after the level and the ignores; install scripts and near misses alone exit 0. When the advisories of a registry could not be read it warns which, never prints a clean result for them, and exits 2 unless something already blocks.
|
|
50
50
|
- An `npm:` alias (`"lodash": "npm:other@1.0.0"`) is audited as the package it names.
|
package/dist/cli.js
CHANGED
|
@@ -38,8 +38,8 @@ var init_advisory = __esm(() => {
|
|
|
38
38
|
SEVERITIES = ["low", "moderate", "high", "critical"];
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
-
// ../../node_modules/.bun/@kaynooo+utils@3.
|
|
42
|
-
function
|
|
41
|
+
// ../../node_modules/.bun/@kaynooo+utils@3.1.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/chunk-rkhsft4a.js
|
|
42
|
+
function G(t, e, { plural: r, zero: n = "singular" } = {}) {
|
|
43
43
|
if (e === 1 || e === 0 && n === "singular")
|
|
44
44
|
return t;
|
|
45
45
|
if (r !== undefined)
|
|
@@ -52,10 +52,10 @@ function K(t, e, { plural: r, zero: n = "singular" } = {}) {
|
|
|
52
52
|
return `${t.slice(0, -1)}ves`;
|
|
53
53
|
return Gt.test(t) ? `${t.slice(0, -2)}ves` : `${t}s`;
|
|
54
54
|
}
|
|
55
|
-
function
|
|
56
|
-
return `${t} ${
|
|
55
|
+
function bo(t, e, { zero: r = "plural", ...n } = {}) {
|
|
56
|
+
return `${t} ${G(e, t, { ...n, zero: r })}`;
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function Ao(t, e, r = "...") {
|
|
59
59
|
let { suffix: n = "...", includeSuffix: s = false, wordBoundary: o = false } = typeof r === "string" ? { suffix: r } : r;
|
|
60
60
|
if (t.length <= e)
|
|
61
61
|
return t;
|
|
@@ -66,8 +66,8 @@ function ko(t, e, r = "...") {
|
|
|
66
66
|
c = c.trimEnd();
|
|
67
67
|
return s ? (c + n).slice(0, l) : c + n;
|
|
68
68
|
}
|
|
69
|
-
var ct, N, Ot, Gt, Nt, Y, be,
|
|
70
|
-
var
|
|
69
|
+
var ct, N, Ot, Gt, Nt, Y, be, W;
|
|
70
|
+
var init_chunk_rkhsft4a = __esm(() => {
|
|
71
71
|
ct = /[aeiou]y$/;
|
|
72
72
|
N = new Map;
|
|
73
73
|
Ot = /(?:leaf|loaf|thief|wolf|half|calf|elf|sheaf|scarf|dwarf|hoof|wharf)$/;
|
|
@@ -75,12 +75,12 @@ var init_chunk_rxztfxgv = __esm(() => {
|
|
|
75
75
|
Nt = /\s+\S*$/;
|
|
76
76
|
Y = /\s/;
|
|
77
77
|
be = new Map(["\u20AC", "", "\u201A", "\u0192", "\u201E", "\u2026", "\u2020", "\u2021", "\u02C6", "\u2030", "\u0160", "\u2039", "\u0152", "", "\u017D", "", "", "\u2018", "\u2019", "\u201C", "\u201D", "\u2022", "\u2013", "\u2014", "\u02DC", "\u2122", "\u0161", "\u203A", "\u0153", "", "\u017E", "\u0178"].map((t, e) => [t, 128 + e]).filter(([t]) => t));
|
|
78
|
-
|
|
78
|
+
W = new Map;
|
|
79
79
|
});
|
|
80
80
|
|
|
81
|
-
// ../../node_modules/.bun/@kaynooo+utils@3.
|
|
81
|
+
// ../../node_modules/.bun/@kaynooo+utils@3.1.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/text.js
|
|
82
82
|
var init_text = __esm(() => {
|
|
83
|
-
|
|
83
|
+
init_chunk_rkhsft4a();
|
|
84
84
|
});
|
|
85
85
|
|
|
86
86
|
// ../kit/src/mode.ts
|
|
@@ -107,7 +107,7 @@ var init_mode = __esm(() => {
|
|
|
107
107
|
AGENT_VARIABLES = ["CLAUDECODE", "AI_AGENT"];
|
|
108
108
|
});
|
|
109
109
|
|
|
110
|
-
// ../../node_modules/.bun/@kaynooo+utils@3.
|
|
110
|
+
// ../../node_modules/.bun/@kaynooo+utils@3.1.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/chunk-x450vn3m.js
|
|
111
111
|
function b(r) {
|
|
112
112
|
let e = r.startsWith("#") ? r.slice(1) : r;
|
|
113
113
|
if (!G2.test(e))
|
|
@@ -131,7 +131,7 @@ function f(r, e = []) {
|
|
|
131
131
|
l += `\x1B[${e[t][0]}m`, n = `\x1B[${e[t][1]}m${n}`;
|
|
132
132
|
let c = (t) => C(r.stream ?? globalThis.process?.stdout, r.env) ? l + t + n : t, g = new Map;
|
|
133
133
|
return new Proxy(c, { get(t, i) {
|
|
134
|
-
let a =
|
|
134
|
+
let a = B[i];
|
|
135
135
|
if (Array.isArray(a)) {
|
|
136
136
|
let s = g.get(i);
|
|
137
137
|
if (s === undefined)
|
|
@@ -154,10 +154,10 @@ function f(r, e = []) {
|
|
|
154
154
|
function Fe(r = {}) {
|
|
155
155
|
return f(r);
|
|
156
156
|
}
|
|
157
|
-
var G2,
|
|
157
|
+
var G2, B, h, o;
|
|
158
158
|
var init_chunk_x450vn3m = __esm(() => {
|
|
159
159
|
G2 = /^[a-f0-9]+$/i;
|
|
160
|
-
|
|
160
|
+
B = { reset: [0, 0], bold: [1, 22], dim: [2, 22], italic: [3, 23], underline: [4, 24], inverse: [7, 27], hidden: [8, 28], strikethrough: [9, 29], black: [30, 39], red: [31, 39], green: [32, 39], yellow: [33, 39], blue: [34, 39], magenta: [35, 39], cyan: [36, 39], white: [37, 39], gray: [90, 39], grey: [90, 39], blackBright: [90, 39], redBright: [91, 39], greenBright: [92, 39], yellowBright: [93, 39], blueBright: [94, 39], magentaBright: [95, 39], cyanBright: [96, 39], whiteBright: [97, 39], bgBlack: [40, 49], bgRed: [41, 49], bgGreen: [42, 49], bgYellow: [43, 49], bgBlue: [44, 49], bgMagenta: [45, 49], bgCyan: [46, 49], bgWhite: [47, 49], bgBlackBright: [100, 49], bgRedBright: [101, 49], bgGreenBright: [102, 49], bgYellowBright: [103, 49], bgBlueBright: [104, 49], bgMagentaBright: [105, 49], bgCyanBright: [106, 49], bgWhiteBright: [107, 49], rgb: (r, e, l, n = "fg") => [`${n === "fg" ? 38 : 48};2;${r};${e};${l}`, n === "fg" ? 39 : 49], hex: (r, e = "fg") => {
|
|
161
161
|
let [l, n, c] = b(r);
|
|
162
162
|
return [`${e === "fg" ? 38 : 48};2;${l};${n};${c}`, e === "fg" ? 39 : 49];
|
|
163
163
|
}, ansi256: (r, e = "fg") => [`${e === "fg" ? 38 : 48};5;${r}`, e === "fg" ? 39 : 49] };
|
|
@@ -165,7 +165,7 @@ var init_chunk_x450vn3m = __esm(() => {
|
|
|
165
165
|
o = Fe();
|
|
166
166
|
});
|
|
167
167
|
|
|
168
|
-
// ../../node_modules/.bun/@kaynooo+utils@3.
|
|
168
|
+
// ../../node_modules/.bun/@kaynooo+utils@3.1.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/tools/colors.js
|
|
169
169
|
var init_colors = __esm(() => {
|
|
170
170
|
init_chunk_x450vn3m();
|
|
171
171
|
});
|
|
@@ -225,6 +225,37 @@ import { existsSync as existsSync3, readFileSync as readFileSync2, statSync } fr
|
|
|
225
225
|
import { homedir as homedir2 } from "os";
|
|
226
226
|
import { join as join3, resolve as resolve2 } from "path";
|
|
227
227
|
import process5 from "process";
|
|
228
|
+
function toLinear(channel) {
|
|
229
|
+
const value = channel / 255;
|
|
230
|
+
return value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;
|
|
231
|
+
}
|
|
232
|
+
function toOklab(hex) {
|
|
233
|
+
const [r, g, b] = [1, 3, 5].map((at) => toLinear(Number.parseInt(hex.slice(at, at + 2), 16)));
|
|
234
|
+
const l = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b);
|
|
235
|
+
const m = Math.cbrt(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b);
|
|
236
|
+
const s = Math.cbrt(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b);
|
|
237
|
+
return [0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s, 1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s, 0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s];
|
|
238
|
+
}
|
|
239
|
+
function fromOklab([lightness, a, b]) {
|
|
240
|
+
const l = (lightness + 0.3963377774 * a + 0.2158037573 * b) ** 3;
|
|
241
|
+
const m = (lightness - 0.1055613458 * a - 0.0638541728 * b) ** 3;
|
|
242
|
+
const s = (lightness - 0.0894841775 * a - 1.291485548 * b) ** 3;
|
|
243
|
+
const channels = [4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s, -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s, -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s];
|
|
244
|
+
return `#${channels.map((channel) => fromLinear(channel).toString(16).padStart(2, "0")).join("")}`;
|
|
245
|
+
}
|
|
246
|
+
function gradientAt(theme, ratio) {
|
|
247
|
+
if (theme.gradient === undefined)
|
|
248
|
+
return;
|
|
249
|
+
const key = theme.gradient.join();
|
|
250
|
+
let ends = ENDS.get(key);
|
|
251
|
+
if (ends === undefined) {
|
|
252
|
+
ends = [toOklab(theme.gradient[0]), toOklab(theme.gradient[1])];
|
|
253
|
+
ENDS.set(key, ends);
|
|
254
|
+
}
|
|
255
|
+
const at = Math.min(1, Math.max(0, ratio));
|
|
256
|
+
const [from, to] = ends;
|
|
257
|
+
return fromOklab(from.map((start, index) => start + (to[index] - start) * at));
|
|
258
|
+
}
|
|
228
259
|
function isColorSpec(spec) {
|
|
229
260
|
if (typeof spec === "number")
|
|
230
261
|
return Number.isInteger(spec) && spec >= 0 && spec <= 255;
|
|
@@ -254,6 +285,9 @@ function tinted(colors, spec, env = process5.env) {
|
|
|
254
285
|
return chain[token] ?? chain;
|
|
255
286
|
}, colors);
|
|
256
287
|
}
|
|
288
|
+
function shaded(theme, colors, glyph, cells, width, env = process5.env) {
|
|
289
|
+
return Array.from({ length: cells }, (_, index) => tinted(colors, gradientAt(theme, width <= 1 ? 0 : index / (width - 1)) ?? theme.colors.accent, env)(glyph)).join("");
|
|
290
|
+
}
|
|
257
291
|
function isRecord(value) {
|
|
258
292
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
259
293
|
}
|
|
@@ -378,7 +412,7 @@ function activeTheme() {
|
|
|
378
412
|
}
|
|
379
413
|
return current;
|
|
380
414
|
}
|
|
381
|
-
var ENDS, DEFAULT, BRIGHT, MONO, ASCII, PRESETS, STYLES, HEX, CONTROL, MAX_FILE_BYTES, SPACES, CUBE, warned, current, currentKey = "";
|
|
415
|
+
var fromLinear = (value) => Math.round(255 * Math.min(1, Math.max(0, value <= 0.0031308 ? value * 12.92 : 1.055 * value ** (1 / 2.4) - 0.055))), ENDS, DEFAULT, BRIGHT, MONO, ASCII, PRESETS, STYLES, HEX, CONTROL, MAX_FILE_BYTES, SPACES, CUBE, warned, current, currentKey = "";
|
|
382
416
|
var init_theme = __esm(() => {
|
|
383
417
|
init_config();
|
|
384
418
|
init_user_config();
|
|
@@ -490,7 +524,7 @@ function formatAge(date, now = Date.now()) {
|
|
|
490
524
|
return seconds < 60 ? "just now" : `${upTo(formatSeconds(seconds), " ")} ago`;
|
|
491
525
|
}
|
|
492
526
|
function truncate(text, width) {
|
|
493
|
-
return
|
|
527
|
+
return Ao(text, width, { suffix: "\u2026", includeSuffix: true });
|
|
494
528
|
}
|
|
495
529
|
function textWidth(text) {
|
|
496
530
|
return Bun.stringWidth(text);
|
|
@@ -983,10 +1017,10 @@ function holdSignals(cleanup) {
|
|
|
983
1017
|
process12.on(signal, onSignal);
|
|
984
1018
|
return held;
|
|
985
1019
|
}
|
|
986
|
-
async function runCommand(argv, { cwd, env, stdin = "ignore", timeoutMs, signal, maxBytes = Infinity, onChunk, onStart } = {}) {
|
|
1020
|
+
async function runCommand(argv, { cwd, env, stdin = "ignore", input, timeoutMs, signal, maxBytes = Infinity, onChunk, onStart } = {}) {
|
|
987
1021
|
const chunks = [];
|
|
988
1022
|
const grouped = timeoutMs !== undefined || signal !== undefined || onStart !== undefined || onChunk !== undefined;
|
|
989
|
-
const proc = Bun.spawn(argv, { ...cwd === undefined ? {} : { cwd }, ...env === undefined ? {} : { env }, stdin, stdout: "pipe", stderr: "pipe", ...grouped ? { detached: true } : {} });
|
|
1023
|
+
const proc = Bun.spawn(argv, { ...cwd === undefined ? {} : { cwd }, ...env === undefined ? {} : { env }, stdin: input === undefined ? stdin : new TextEncoder().encode(input), stdout: "pipe", stderr: "pipe", ...grouped ? { detached: true } : {} });
|
|
990
1024
|
const state = { kept: 0, truncated: false, timedOut: false, failure: undefined, done: false };
|
|
991
1025
|
const timers = [];
|
|
992
1026
|
const killGroup = (killing) => {
|
|
@@ -1075,10 +1109,14 @@ function liveRegion(render, stream = process13.stderr, env = process13.env) {
|
|
|
1075
1109
|
}, print: (text) => void stream.write(`${text}
|
|
1076
1110
|
`), stop: () => {
|
|
1077
1111
|
return;
|
|
1112
|
+
}, pause: () => () => {
|
|
1113
|
+
return;
|
|
1078
1114
|
} };
|
|
1079
1115
|
const write = stream.write.bind(stream);
|
|
1080
1116
|
let frame = 0;
|
|
1081
1117
|
let drawn = false;
|
|
1118
|
+
let paused = false;
|
|
1119
|
+
let stopped = false;
|
|
1082
1120
|
const columns = () => {
|
|
1083
1121
|
const now = stream.getWindowSize?.()[0] ?? stream.columns;
|
|
1084
1122
|
return now === undefined || now === 0 ? 80 : now;
|
|
@@ -1089,6 +1127,8 @@ function liveRegion(render, stream = process13.stderr, env = process13.env) {
|
|
|
1089
1127
|
drawn = false;
|
|
1090
1128
|
};
|
|
1091
1129
|
const draw = () => {
|
|
1130
|
+
if (paused)
|
|
1131
|
+
return;
|
|
1092
1132
|
const width = columns() - 1;
|
|
1093
1133
|
const height = stream.rows === undefined || stream.rows === 0 ? 24 : stream.rows;
|
|
1094
1134
|
const lines = render(FRAMES[frame++ % FRAMES.length]).slice(0, Math.max(1, height - 1)).map((line) => cutToWidth(line, width));
|
|
@@ -1100,16 +1140,17 @@ function liveRegion(render, stream = process13.stderr, env = process13.env) {
|
|
|
1100
1140
|
`)}${lines.length > 1 ? `\x1B[${lines.length - 1}A` : ""}\r`);
|
|
1101
1141
|
drawn = true;
|
|
1102
1142
|
};
|
|
1103
|
-
|
|
1143
|
+
let timer = setInterval(draw, FRAME_MS);
|
|
1104
1144
|
stream.on?.("resize", draw);
|
|
1105
|
-
|
|
1106
|
-
|
|
1145
|
+
let restore = interceptOutput(clear);
|
|
1146
|
+
let release = swallowInput();
|
|
1107
1147
|
const onExit = () => {
|
|
1108
1148
|
clear();
|
|
1109
1149
|
release();
|
|
1110
1150
|
};
|
|
1111
1151
|
const signals = holdSignals(stop);
|
|
1112
1152
|
function stop() {
|
|
1153
|
+
stopped = true;
|
|
1113
1154
|
clearInterval(timer);
|
|
1114
1155
|
stream.off?.("resize", draw);
|
|
1115
1156
|
clear();
|
|
@@ -1118,6 +1159,29 @@ function liveRegion(render, stream = process13.stderr, env = process13.env) {
|
|
|
1118
1159
|
process13.off("exit", onExit);
|
|
1119
1160
|
signals.release();
|
|
1120
1161
|
}
|
|
1162
|
+
function pause() {
|
|
1163
|
+
if (paused || stopped)
|
|
1164
|
+
return () => {
|
|
1165
|
+
return;
|
|
1166
|
+
};
|
|
1167
|
+
paused = true;
|
|
1168
|
+
clearInterval(timer);
|
|
1169
|
+
stream.off?.("resize", draw);
|
|
1170
|
+
clear();
|
|
1171
|
+
restore();
|
|
1172
|
+
release();
|
|
1173
|
+
return () => {
|
|
1174
|
+
if (!paused || stopped)
|
|
1175
|
+
return;
|
|
1176
|
+
paused = false;
|
|
1177
|
+
timer = setInterval(draw, FRAME_MS);
|
|
1178
|
+
timer.unref();
|
|
1179
|
+
stream.on?.("resize", draw);
|
|
1180
|
+
restore = interceptOutput(clear);
|
|
1181
|
+
release = swallowInput();
|
|
1182
|
+
draw();
|
|
1183
|
+
};
|
|
1184
|
+
}
|
|
1121
1185
|
timer.unref();
|
|
1122
1186
|
process13.on("exit", onExit);
|
|
1123
1187
|
return {
|
|
@@ -1128,9 +1192,54 @@ function liveRegion(render, stream = process13.stderr, env = process13.env) {
|
|
|
1128
1192
|
`);
|
|
1129
1193
|
draw();
|
|
1130
1194
|
},
|
|
1131
|
-
stop
|
|
1195
|
+
stop,
|
|
1196
|
+
pause
|
|
1197
|
+
};
|
|
1198
|
+
}
|
|
1199
|
+
function progressLine(stream = process13.stderr, env = process13.env) {
|
|
1200
|
+
const colors = paint(stream, env);
|
|
1201
|
+
const write = stream.write.bind(stream);
|
|
1202
|
+
const begun = performance.now();
|
|
1203
|
+
let started = begun;
|
|
1204
|
+
let current;
|
|
1205
|
+
const region = liveRegion((spinner) => current === undefined ? [] : [tintedParts(progressParts(current, spinner, performance.now() - started), colors)], stream, env);
|
|
1206
|
+
const end = (line) => {
|
|
1207
|
+
region.stop();
|
|
1208
|
+
write(`${line}
|
|
1209
|
+
`);
|
|
1210
|
+
};
|
|
1211
|
+
return {
|
|
1212
|
+
update: (progress) => {
|
|
1213
|
+
const step = current?.step;
|
|
1214
|
+
current = progress;
|
|
1215
|
+
if (progress.step !== step) {
|
|
1216
|
+
started = performance.now();
|
|
1217
|
+
region.redraw();
|
|
1218
|
+
}
|
|
1219
|
+
},
|
|
1220
|
+
stop: region.stop,
|
|
1221
|
+
pause: region.pause,
|
|
1222
|
+
done: (text) => end(marked("ok", text, stream, formatDuration(performance.now() - begun), env)),
|
|
1223
|
+
failed: (text) => end(marked("problem", text, stream, undefined, env))
|
|
1132
1224
|
};
|
|
1133
1225
|
}
|
|
1226
|
+
function progressParts({ step, done, total, unit }, spinner, ms) {
|
|
1227
|
+
const { theme } = activeTheme();
|
|
1228
|
+
const parts = [{ text: spinner, tint: (colors) => tinted(colors, theme.colors.accent) }, { text: ` ${step}`, tint: () => plain }];
|
|
1229
|
+
if (total !== undefined && total > 0) {
|
|
1230
|
+
const counted = Math.min(done ?? 0, total);
|
|
1231
|
+
const filled = Math.round(counted / total * BAR_WIDTH);
|
|
1232
|
+
parts.push({ text: " ", tint: () => plain }, { text: theme.glyphs.bar.repeat(filled), tint: (colors) => () => shaded(theme, colors, theme.glyphs.bar, filled, BAR_WIDTH) }, { text: theme.glyphs.bar.repeat(BAR_WIDTH - filled), tint: (colors) => colors.dim }, { text: ` ${counted}/${total}${unit === undefined ? "" : ` ${unit}`}`, tint: (colors) => colors.dim });
|
|
1233
|
+
}
|
|
1234
|
+
parts.push({ text: ` ${formatElapsed(ms)}`, tint: (colors) => colors.dim });
|
|
1235
|
+
return parts;
|
|
1236
|
+
}
|
|
1237
|
+
function plain(text) {
|
|
1238
|
+
return text;
|
|
1239
|
+
}
|
|
1240
|
+
function tintedParts(parts, colors) {
|
|
1241
|
+
return parts.map(({ text, tint }) => tint(colors)(text)).join("");
|
|
1242
|
+
}
|
|
1134
1243
|
function cutToWidth(line, width) {
|
|
1135
1244
|
if (Bun.stringWidth(line) <= width)
|
|
1136
1245
|
return line;
|
|
@@ -1198,7 +1307,7 @@ function interceptOutput(clear) {
|
|
|
1198
1307
|
}
|
|
1199
1308
|
};
|
|
1200
1309
|
}
|
|
1201
|
-
var FRAMES, FRAME_MS = 200, CLEAR_BELOW = "\r\x1B[J", ESC, ESCAPE_CODE, RESET_STYLE, CTRL_C = 3, CLOSE_LINK, CONSOLE_METHODS;
|
|
1310
|
+
var FRAMES, FRAME_MS = 200, BAR_WIDTH = 20, CLEAR_BELOW = "\r\x1B[J", ESC, ESCAPE_CODE, RESET_STYLE, CTRL_C = 3, CLOSE_LINK, CONSOLE_METHODS;
|
|
1202
1311
|
var init_progress = __esm(() => {
|
|
1203
1312
|
init_format();
|
|
1204
1313
|
init_process();
|
|
@@ -1227,6 +1336,46 @@ var init_ci = __esm(() => {
|
|
|
1227
1336
|
init_tool();
|
|
1228
1337
|
});
|
|
1229
1338
|
|
|
1339
|
+
// ../kit/src/askpass.ts
|
|
1340
|
+
import process14 from "process";
|
|
1341
|
+
async function askpassClient(argv) {
|
|
1342
|
+
const socketPath = process14.env[SOCKET_VARIABLE];
|
|
1343
|
+
if (socketPath === undefined)
|
|
1344
|
+
return;
|
|
1345
|
+
const request = { prompt: argv[0] ?? "", ...process14.env.SSH_ASKPASS_PROMPT === "none" ? { notice: true } : {} };
|
|
1346
|
+
const { promise, resolve } = Promise.withResolvers();
|
|
1347
|
+
let received = "";
|
|
1348
|
+
try {
|
|
1349
|
+
await Bun.connect({
|
|
1350
|
+
unix: socketPath,
|
|
1351
|
+
socket: {
|
|
1352
|
+
open: (socket) => void socket.write(`${JSON.stringify(request)}
|
|
1353
|
+
`),
|
|
1354
|
+
data: (_, chunk) => {
|
|
1355
|
+
received += chunk.toString();
|
|
1356
|
+
},
|
|
1357
|
+
close: () => resolve(received),
|
|
1358
|
+
error: () => resolve("")
|
|
1359
|
+
}
|
|
1360
|
+
});
|
|
1361
|
+
} catch {
|
|
1362
|
+
return 1;
|
|
1363
|
+
}
|
|
1364
|
+
const reply = await promise;
|
|
1365
|
+
if (reply === "")
|
|
1366
|
+
return 1;
|
|
1367
|
+
const { answer } = JSON.parse(reply);
|
|
1368
|
+
if (request.notice === true)
|
|
1369
|
+
return 0;
|
|
1370
|
+
if (answer === undefined)
|
|
1371
|
+
return 1;
|
|
1372
|
+
process14.stdout.write(`${answer}
|
|
1373
|
+
`);
|
|
1374
|
+
return 0;
|
|
1375
|
+
}
|
|
1376
|
+
var SOCKET_VARIABLE = "KAYNOOO_ASKPASS_SOCKET";
|
|
1377
|
+
var init_askpass = () => {};
|
|
1378
|
+
|
|
1230
1379
|
// ../kit/src/completions.ts
|
|
1231
1380
|
function completionScript(shell, bins, header = `# Generated by \`${bins[0]} --completions ${shell}\``) {
|
|
1232
1381
|
if (shell === "fish")
|
|
@@ -1288,16 +1437,16 @@ var init_completions = __esm(() => {
|
|
|
1288
1437
|
});
|
|
1289
1438
|
|
|
1290
1439
|
// ../kit/src/notify.ts
|
|
1291
|
-
import
|
|
1440
|
+
import process15 from "process";
|
|
1292
1441
|
function base64(text) {
|
|
1293
1442
|
return Buffer.from(text).toString("base64");
|
|
1294
1443
|
}
|
|
1295
|
-
function notification(title, body, env =
|
|
1296
|
-
const id = `kit${
|
|
1444
|
+
function notification(title, body, env = process15.env) {
|
|
1445
|
+
const id = `kit${process15.pid}`;
|
|
1297
1446
|
const codes = [`\x1B]99;i=${id}:d=0:o=unfocused:e=1;${base64(title)}\x1B\\`, `\x1B]99;i=${id}:p=body:e=1;${base64(body)}\x1B\\`];
|
|
1298
1447
|
return codes.map((code) => env.TMUX === undefined || env.TMUX === "" ? code : `\x1BPtmux;${code.replaceAll("\x1B", "\x1B\x1B")}\x1B\\`).join("");
|
|
1299
1448
|
}
|
|
1300
|
-
function notifyEnd(command, code, ms, { stream =
|
|
1449
|
+
function notifyEnd(command, code, ms, { stream = process15.stderr, env = process15.env } = {}) {
|
|
1301
1450
|
if (ms < NOTIFY_AFTER_MS || code === CANCELLED || outputMode(stream, env) !== "terminal")
|
|
1302
1451
|
return;
|
|
1303
1452
|
stream.write(notification(command, code === 0 ? `done in ${formatDuration(ms)}` : `failed with exit ${code} after ${formatDuration(ms)}`, env));
|
|
@@ -1318,18 +1467,18 @@ var init_logs = __esm(() => {
|
|
|
1318
1467
|
import { appendFileSync, mkdirSync } from "fs";
|
|
1319
1468
|
import { homedir as homedir3 } from "os";
|
|
1320
1469
|
import { dirname as dirname2, isAbsolute, join as join4 } from "path";
|
|
1321
|
-
import
|
|
1470
|
+
import process16 from "process";
|
|
1322
1471
|
function noteUsageError(message) {
|
|
1323
1472
|
usageError = message;
|
|
1324
1473
|
}
|
|
1325
|
-
function stateHome(env =
|
|
1474
|
+
function stateHome(env = process16.env) {
|
|
1326
1475
|
const dir = env.XDG_STATE_HOME;
|
|
1327
1476
|
return dir !== undefined && isAbsolute(dir) ? dir : join4(homedir3(), ".local", "state");
|
|
1328
1477
|
}
|
|
1329
|
-
function usagePath(env =
|
|
1478
|
+
function usagePath(env = process16.env) {
|
|
1330
1479
|
return join4(stateHome(env), CLI_FOLDER, "usage.jsonl");
|
|
1331
1480
|
}
|
|
1332
|
-
function usageRecorded(env =
|
|
1481
|
+
function usageRecorded(env = process16.env) {
|
|
1333
1482
|
const off = env.KAYNOOO_CLI_NO_USAGE;
|
|
1334
1483
|
return env.NODE_ENV !== "test" && (off === undefined || off === "" || off === "0");
|
|
1335
1484
|
}
|
|
@@ -1338,12 +1487,12 @@ function flagNames(argv) {
|
|
|
1338
1487
|
const names = (end === -1 ? argv : argv.slice(0, end)).filter((word) => word.startsWith("-") && word !== "-").map((word) => word.includes("=") ? word.slice(0, word.indexOf("=")) : word);
|
|
1339
1488
|
return [...new Set(names)].filter((name) => name.length <= LONGEST_NAME && FLAG_NAME.test(name));
|
|
1340
1489
|
}
|
|
1341
|
-
function usageEntry(bin, command, argv, code, now = new Date) {
|
|
1490
|
+
function usageEntry(bin, command, argv, code, { ms, now = new Date } = {}) {
|
|
1342
1491
|
const unknown = code === 2 && usageError !== undefined ? UNKNOWN_OPTION2.exec(usageError)?.[1] : undefined;
|
|
1343
1492
|
usageError = undefined;
|
|
1344
|
-
return { at: now.toISOString(), bin, ...command === undefined ? {} : { command }, flags: flagNames(argv), code, ...unknown === undefined ? {} : { unknown } };
|
|
1493
|
+
return { at: now.toISOString(), bin, ...command === undefined ? {} : { command }, flags: flagNames(argv), code, ...unknown === undefined ? {} : { unknown }, ...ms === undefined ? {} : { ms: Math.round(ms) } };
|
|
1345
1494
|
}
|
|
1346
|
-
function recordUsage(entry, env =
|
|
1495
|
+
function recordUsage(entry, env = process16.env) {
|
|
1347
1496
|
if (!usageRecorded(env))
|
|
1348
1497
|
return;
|
|
1349
1498
|
try {
|
|
@@ -1363,7 +1512,7 @@ var init_usage = __esm(() => {
|
|
|
1363
1512
|
// ../kit/src/cli.ts
|
|
1364
1513
|
import { readFileSync as readFileSync4, realpathSync as realpathSync2 } from "fs";
|
|
1365
1514
|
import { dirname as dirname3, join as join5 } from "path";
|
|
1366
|
-
import
|
|
1515
|
+
import process17 from "process";
|
|
1367
1516
|
async function commandRows(all, colors) {
|
|
1368
1517
|
const commands = shown(all);
|
|
1369
1518
|
const width = Math.max(0, ...Object.keys(commands).map((name) => name.length));
|
|
@@ -1437,8 +1586,8 @@ async function help2({ path, header, summary: lazySummary, commands, defaultComm
|
|
|
1437
1586
|
`);
|
|
1438
1587
|
}
|
|
1439
1588
|
function printError(prefix, message, hint, cause) {
|
|
1440
|
-
const colors = paint(
|
|
1441
|
-
const styled = takesControlCodes(
|
|
1589
|
+
const colors = paint(process17.stderr);
|
|
1590
|
+
const styled = takesControlCodes(process17.stderr);
|
|
1442
1591
|
const head = styled ? `${colors.red.bold("error")} ${colors.dim(`${prefix}:`)}` : `error: ${prefix}:`;
|
|
1443
1592
|
const under = (label, text, tint) => text === undefined ? "" : `
|
|
1444
1593
|
${styled ? tint(label) : `${label}:`} ${text}`;
|
|
@@ -1481,11 +1630,11 @@ async function dispatch(level, typed, { version, redact }) {
|
|
|
1481
1630
|
}
|
|
1482
1631
|
}
|
|
1483
1632
|
if (name === undefined && level.path.length > 1) {
|
|
1484
|
-
console.error(await help2(await expand(level, [...level.path.slice(1), ...argv]),
|
|
1633
|
+
console.error(await help2(await expand(level, [...level.path.slice(1), ...argv]), process17.stderr));
|
|
1485
1634
|
return 2;
|
|
1486
1635
|
}
|
|
1487
1636
|
if (name === undefined || name === "help" || name === "--help" || name === "-h") {
|
|
1488
|
-
console.log(await help2(await expand(level, [...level.path.slice(1), ...argv]),
|
|
1637
|
+
console.log(await help2(await expand(level, [...level.path.slice(1), ...argv]), process17.stdout));
|
|
1489
1638
|
return 0;
|
|
1490
1639
|
}
|
|
1491
1640
|
if (level.path.length === 1 && (name === "--version" || name === "-v")) {
|
|
@@ -1628,6 +1777,9 @@ function packageVersion(entry = Bun.main) {
|
|
|
1628
1777
|
}
|
|
1629
1778
|
async function runCli(cli, argv = scriptArgs()) {
|
|
1630
1779
|
const version = cli.version ?? packageVersion();
|
|
1780
|
+
const answered = await askpassClient(argv);
|
|
1781
|
+
if (answered !== undefined)
|
|
1782
|
+
return answered;
|
|
1631
1783
|
if (argv[0] === COMPLETE)
|
|
1632
1784
|
return printCandidates(candidates(scopeOf(cli.commands, cli.extraCommands, cli.aliases), cli.defaultCommand, argv.slice(1)));
|
|
1633
1785
|
if (argv[0] === COMPLETIONS || argv[0]?.startsWith(`${COMPLETIONS}=`) === true)
|
|
@@ -1638,7 +1790,7 @@ async function runCli(cli, argv = scriptArgs()) {
|
|
|
1638
1790
|
notifyEnd(command === undefined ? cli.name : `${cli.name} ${command}`, code, performance.now() - started);
|
|
1639
1791
|
if (cli.usage !== false) {
|
|
1640
1792
|
try {
|
|
1641
|
-
recordUsage(usageEntry(cli.name, command, argv, code));
|
|
1793
|
+
recordUsage(usageEntry(cli.name, command, argv, code, { ms: performance.now() - started }));
|
|
1642
1794
|
} catch {}
|
|
1643
1795
|
}
|
|
1644
1796
|
return code;
|
|
@@ -1662,6 +1814,7 @@ var LEVEL_OPTIONS, TOP_OPTIONS, COMPLETE = "__complete", FILES = "__files__", CO
|
|
|
1662
1814
|
var init_cli = __esm(() => {
|
|
1663
1815
|
init_args();
|
|
1664
1816
|
init_argv();
|
|
1817
|
+
init_askpass();
|
|
1665
1818
|
init_completions();
|
|
1666
1819
|
init_notify();
|
|
1667
1820
|
init_style();
|
|
@@ -1726,13 +1879,15 @@ var init_limit = __esm(() => {
|
|
|
1726
1879
|
});
|
|
1727
1880
|
|
|
1728
1881
|
// ../kit/src/pool.ts
|
|
1729
|
-
async function pool(items, limit, task) {
|
|
1882
|
+
async function pool(items, limit, task, onDone) {
|
|
1730
1883
|
const results = Array.from({ length: items.length });
|
|
1731
1884
|
let next = 0;
|
|
1885
|
+
let done = 0;
|
|
1732
1886
|
async function worker() {
|
|
1733
1887
|
while (next < items.length) {
|
|
1734
1888
|
const index = next++;
|
|
1735
1889
|
results[index] = await task(items[index]);
|
|
1890
|
+
onDone?.(++done, items.length);
|
|
1736
1891
|
}
|
|
1737
1892
|
}
|
|
1738
1893
|
await Promise.all(Array.from({ length: Math.min(limit, items.length) }, worker));
|
|
@@ -1773,7 +1928,7 @@ var init_watch = __esm(() => {
|
|
|
1773
1928
|
// ../kit/src/workspace-root.ts
|
|
1774
1929
|
import { homedir as homedir4 } from "os";
|
|
1775
1930
|
import { dirname as dirname4, join as join6, resolve as resolve4 } from "path";
|
|
1776
|
-
import
|
|
1931
|
+
import process18 from "process";
|
|
1777
1932
|
function expandHome(path, home) {
|
|
1778
1933
|
if (path === "~")
|
|
1779
1934
|
return home;
|
|
@@ -1783,7 +1938,7 @@ function configured(env, home) {
|
|
|
1783
1938
|
const folder = readUserConfig("config", { home, xdg: env.XDG_CONFIG_HOME }).workspace;
|
|
1784
1939
|
return typeof folder === "string" && folder !== "" ? folder : undefined;
|
|
1785
1940
|
}
|
|
1786
|
-
function workspaceRoot({ given, env =
|
|
1941
|
+
function workspaceRoot({ given, env = process18.env, home = homedir4() } = {}) {
|
|
1787
1942
|
const fromEnv = env.KAYNOOO_WORKSPACE === "" ? undefined : env.KAYNOOO_WORKSPACE;
|
|
1788
1943
|
return resolve4(expandHome(given ?? fromEnv ?? configured(env, home) ?? join6(home, "Workspace"), home));
|
|
1789
1944
|
}
|
|
@@ -2571,7 +2726,7 @@ function ageDays(published, now) {
|
|
|
2571
2726
|
return Number.isNaN(at) ? undefined : (now - at) / DAY;
|
|
2572
2727
|
}
|
|
2573
2728
|
function daysAgo(age) {
|
|
2574
|
-
return age < 1 ? "less than a day" :
|
|
2729
|
+
return age < 1 ? "less than a day" : bo(Math.floor(age), "day");
|
|
2575
2730
|
}
|
|
2576
2731
|
function installScriptsOf(version) {
|
|
2577
2732
|
return Object.fromEntries(INSTALL_SCRIPTS.flatMap((name) => version?.scripts?.[name] === undefined ? [] : [[name, version.scripts[name]]]));
|
|
@@ -2681,7 +2836,7 @@ var init_analyze = __esm(() => {
|
|
|
2681
2836
|
// src/config.ts
|
|
2682
2837
|
import { homedir as homedir5 } from "os";
|
|
2683
2838
|
import { dirname as dirname5, join as join7 } from "path";
|
|
2684
|
-
import
|
|
2839
|
+
import process20 from "process";
|
|
2685
2840
|
function expand2(value, env) {
|
|
2686
2841
|
let missing = false;
|
|
2687
2842
|
const expanded = value.replace(ENV_REFERENCE, (_, braced, bare) => {
|
|
@@ -2770,7 +2925,7 @@ async function readIfThere(path) {
|
|
|
2770
2925
|
const file = Bun.file(path);
|
|
2771
2926
|
return await file.exists() ? file.text() : undefined;
|
|
2772
2927
|
}
|
|
2773
|
-
async function loadConfigs(cwd =
|
|
2928
|
+
async function loadConfigs(cwd = process20.cwd(), env = process20.env, home = homedir5()) {
|
|
2774
2929
|
const directories = [];
|
|
2775
2930
|
for (let dir = cwd;!directories.includes(dir); dir = dirname5(dir))
|
|
2776
2931
|
directories.push(dir);
|
|
@@ -2803,7 +2958,7 @@ function parseSettings(text) {
|
|
|
2803
2958
|
settings.concurrency = raw.concurrency;
|
|
2804
2959
|
return settings;
|
|
2805
2960
|
}
|
|
2806
|
-
async function loadSettings(cwd =
|
|
2961
|
+
async function loadSettings(cwd = process20.cwd(), home) {
|
|
2807
2962
|
const files = [];
|
|
2808
2963
|
for (let dir = cwd;!files.includes(join7(dir, SETTINGS_FILE)); dir = dirname5(dir))
|
|
2809
2964
|
files.push(join7(dir, SETTINGS_FILE));
|
|
@@ -3194,7 +3349,7 @@ __export(exports_audit, {
|
|
|
3194
3349
|
audit: () => audit
|
|
3195
3350
|
});
|
|
3196
3351
|
import { join as join9, resolve as resolve6 } from "path";
|
|
3197
|
-
import
|
|
3352
|
+
import process21 from "process";
|
|
3198
3353
|
function hasFinding(audited) {
|
|
3199
3354
|
return audited.blocked || audited.warnings.length > 0 || audited.advisories.length > 0;
|
|
3200
3355
|
}
|
|
@@ -3210,7 +3365,8 @@ async function auditPackages(packages, context) {
|
|
|
3210
3365
|
const registry = registryFor(name, context.configs);
|
|
3211
3366
|
const input = { spec: { name, request: version }, packument: await lookup(name, registry), registry: new URL(registry.url).host, now: context.now, minAgeDays: context.minAgeDays, licenses: context.settings.licenses };
|
|
3212
3367
|
return { name, version, registry, input, safe: analyze(input).safe?.version };
|
|
3213
|
-
});
|
|
3368
|
+
}, (done, total) => context.onProgress?.({ step: "looking up", done, total, unit: "packages" }));
|
|
3369
|
+
context.onProgress?.({ step: "reading the advisories" });
|
|
3214
3370
|
const registries = new Map;
|
|
3215
3371
|
for (const { name, version, registry, safe } of looked) {
|
|
3216
3372
|
const group = registries.get(registry.url) ?? { registry, versions: {} };
|
|
@@ -3234,7 +3390,7 @@ async function auditPackages(packages, context) {
|
|
|
3234
3390
|
});
|
|
3235
3391
|
return { audited, unavailable };
|
|
3236
3392
|
}
|
|
3237
|
-
function renderAudit(findings, total, stream =
|
|
3393
|
+
function renderAudit(findings, total, stream = process21.stdout, env = process21.env) {
|
|
3238
3394
|
const id = role("id", stream, env);
|
|
3239
3395
|
const label = role("label", stream, env);
|
|
3240
3396
|
const warning = role("warn", stream, env);
|
|
@@ -3253,7 +3409,7 @@ function renderAudit(findings, total, stream = process20.stdout, env = process20
|
|
|
3253
3409
|
async function audit(args) {
|
|
3254
3410
|
const { values, positionals: [asked] } = parse(args, usage3, options2, { positionals: ["[dir]"], exits: EXITS2 });
|
|
3255
3411
|
const { level } = values;
|
|
3256
|
-
const dir = resolve6(asked ??
|
|
3412
|
+
const dir = resolve6(asked ?? process21.cwd());
|
|
3257
3413
|
const lock = Bun.file(join9(dir, "bun.lock"));
|
|
3258
3414
|
if (!await lock.exists())
|
|
3259
3415
|
fail(`no bun.lock in ${dir}`);
|
|
@@ -3268,7 +3424,14 @@ async function audit(args) {
|
|
|
3268
3424
|
level,
|
|
3269
3425
|
ignore: values.ignore ?? []
|
|
3270
3426
|
};
|
|
3271
|
-
const
|
|
3427
|
+
const progress = progressLine();
|
|
3428
|
+
let result;
|
|
3429
|
+
try {
|
|
3430
|
+
result = await auditPackages(packages, { ...context, onProgress: progress.update });
|
|
3431
|
+
} finally {
|
|
3432
|
+
progress.stop();
|
|
3433
|
+
}
|
|
3434
|
+
const { audited, unavailable } = result;
|
|
3272
3435
|
const findings = audited.filter(hasFinding);
|
|
3273
3436
|
if (values.json === true)
|
|
3274
3437
|
printJson(findings);
|
|
@@ -3287,6 +3450,7 @@ Findings are grouped per package, each registry package looked up once per run.
|
|
|
3287
3450
|
Reach for it to vet one repository in depth; \`audit\` sweeps many repositories for advisories only, and shares --level, --prod and --ignore.`, EXITS2, options2, BATCH = 8, HIGH_SEVERITIES;
|
|
3288
3451
|
var init_audit = __esm(() => {
|
|
3289
3452
|
init_src();
|
|
3453
|
+
init_progress();
|
|
3290
3454
|
init_advisories();
|
|
3291
3455
|
init_analyze();
|
|
3292
3456
|
init_config2();
|
|
@@ -3387,9 +3551,9 @@ var init_answers = __esm(() => {
|
|
|
3387
3551
|
});
|
|
3388
3552
|
|
|
3389
3553
|
// ../kit/src/job.ts
|
|
3390
|
-
import
|
|
3554
|
+
import process22 from "process";
|
|
3391
3555
|
function stopJob() {
|
|
3392
|
-
|
|
3556
|
+
process22.kill(0, "SIGTSTP");
|
|
3393
3557
|
}
|
|
3394
3558
|
var init_job = () => {};
|
|
3395
3559
|
|
|
@@ -3611,7 +3775,7 @@ var init_redraw = __esm(() => {
|
|
|
3611
3775
|
});
|
|
3612
3776
|
|
|
3613
3777
|
// ../kit/src/prompt.ts
|
|
3614
|
-
import
|
|
3778
|
+
import process23 from "process";
|
|
3615
3779
|
function readKeys(input, paste = { active: false }) {
|
|
3616
3780
|
return parseKeys(input, paste).filter((key) => typeof key === "object" ? "text" in key : PROMPT_KEYS.has(key) || isEditKey(key));
|
|
3617
3781
|
}
|
|
@@ -3739,7 +3903,7 @@ function asking(colors, question, typed, keys) {
|
|
|
3739
3903
|
function answer(colors, question, state, picked) {
|
|
3740
3904
|
return state === "enter" ? `${colors.green("\u2713")} ${question} ${colors.cyan(picked)}` : `${colors.red("\u2717")} ${question} ${colors.dim("cancelled")}`;
|
|
3741
3905
|
}
|
|
3742
|
-
async function ask(question, { hint, terminal =
|
|
3906
|
+
async function ask(question, { hint, terminal = process23 }, render, press) {
|
|
3743
3907
|
const { stdin, stderr } = terminal;
|
|
3744
3908
|
if (!isInteractive(terminal))
|
|
3745
3909
|
fail(`cannot ask "${question}" off a terminal`, 2, hint);
|
|
@@ -3755,7 +3919,7 @@ async function ask(question, { hint, terminal = process22 }, render, press) {
|
|
|
3755
3919
|
};
|
|
3756
3920
|
const redraw = () => draw(current);
|
|
3757
3921
|
const paste = { active: false };
|
|
3758
|
-
const stop = terminal.stop ?? (terminal ===
|
|
3922
|
+
const stop = terminal.stop ?? (terminal === process23 ? stopJob : undefined);
|
|
3759
3923
|
const suspend = () => {
|
|
3760
3924
|
if (stop === undefined)
|
|
3761
3925
|
return;
|
|
@@ -3973,10 +4137,10 @@ async function bumpConsumers(name, version, settings) {
|
|
|
3973
4137
|
const similar = similarDependencies(name, settings.root);
|
|
3974
4138
|
note(`nothing under ${settings.root} depends on ${name}`, similar.length === 0 ? undefined : `did you mean ${similar.join(", ")}`);
|
|
3975
4139
|
} else if (left > 0) {
|
|
3976
|
-
note(`${
|
|
4140
|
+
note(`${bo(left, "folder")} left out by --only or --except`);
|
|
3977
4141
|
}
|
|
3978
4142
|
if (declined.size > 0)
|
|
3979
|
-
note(`${
|
|
4143
|
+
note(`${bo(declined.size, "folder")} left out by your choice`);
|
|
3980
4144
|
if (local > 0)
|
|
3981
4145
|
note(`${local} non-registry dependenc${local === 1 ? "y" : "ies"} (workspace:, file:, git, URL, alias, catalog:)`, "left as they are");
|
|
3982
4146
|
for (const consumer of consumers) {
|
|
@@ -4037,7 +4201,7 @@ async function choosePlan(name, version, settings, chooser = terminalChooser, ho
|
|
|
4037
4201
|
const chosen = plans.filter((plan) => picked.has(plan.dir));
|
|
4038
4202
|
for (const plan of chosen)
|
|
4039
4203
|
note("plan", plan.line);
|
|
4040
|
-
if (chosen.length === 0 || await chooser.confirm(`bump ${name} to ${version} in ${
|
|
4204
|
+
if (chosen.length === 0 || await chooser.confirm(`bump ${name} to ${version} in ${bo(chosen.length, "folder")}?`) !== true)
|
|
4041
4205
|
return { chosen: [], declined: plans.map((plan) => plan.dir) };
|
|
4042
4206
|
const declined = plans.filter((plan) => !picked.has(plan.dir)).map((plan) => plan.dir);
|
|
4043
4207
|
saveExcluded(name, [...excluded].filter((dir) => !plans.some((plan) => plan.dir === dir)).concat(declined), home);
|
|
@@ -4180,7 +4344,7 @@ var exports_manager = {};
|
|
|
4180
4344
|
__export(exports_manager, {
|
|
4181
4345
|
manager: () => manager
|
|
4182
4346
|
});
|
|
4183
|
-
import
|
|
4347
|
+
import process24 from "process";
|
|
4184
4348
|
function manager(args) {
|
|
4185
4349
|
const { values, positionals } = parse(args, usage7, options6, {
|
|
4186
4350
|
exits: EXITS6,
|
|
@@ -4190,7 +4354,7 @@ function manager(args) {
|
|
|
4190
4354
|
examples: ["pkg manager dev", ["pkg manager exec", "bunx, npx, pnpm dlx... for this folder"]]
|
|
4191
4355
|
});
|
|
4192
4356
|
const action = oneOf(positionals[0] ?? "", "<action>", ACTIONS2);
|
|
4193
|
-
const found = detectManager(
|
|
4357
|
+
const found = detectManager(process24.cwd());
|
|
4194
4358
|
const command = commandFor(action, found);
|
|
4195
4359
|
if (values.json === true)
|
|
4196
4360
|
printJson({ manager: found, action, command });
|
|
@@ -4212,8 +4376,8 @@ var init_manager2 = __esm(() => {
|
|
|
4212
4376
|
|
|
4213
4377
|
// src/cli.ts
|
|
4214
4378
|
init_src();
|
|
4215
|
-
import
|
|
4216
|
-
|
|
4379
|
+
import process25 from "process";
|
|
4380
|
+
process25.exitCode = await runCli({
|
|
4217
4381
|
name: "pkg",
|
|
4218
4382
|
about: "checks npm packages before they are added, and moves a lib's consumers onto a new release",
|
|
4219
4383
|
replaces: "bun add on trust, and a bun info and sleep loop then a bun add per consumer",
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaynooo/cli-pkg",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.17.0",
|
|
5
5
|
"description": "pkg: check an npm package before it is added, for a guessed name, a version under two weeks old and install scripts.",
|
|
6
6
|
"author": "Kaynooo <contact@kaynooo.fr>",
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"homepage": "https://
|
|
8
|
+
"homepage": "https://github.com/Kayno0o/cli/tree/main/packages/pkg#readme",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
|
-
"url": "git+https://
|
|
11
|
+
"url": "git+https://github.com/Kayno0o/cli.git",
|
|
12
12
|
"directory": "packages/pkg"
|
|
13
13
|
},
|
|
14
|
-
"bugs": "https://
|
|
14
|
+
"bugs": "https://github.com/Kayno0o/cli/issues",
|
|
15
15
|
"keywords": ["npm", "package", "typosquat", "supply-chain", "dependencies"],
|
|
16
16
|
"bin": {
|
|
17
17
|
"pkg": "./dist/cli.js"
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"record": "$npm_execpath scripts/record.ts"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@kaynooo/utils": "3.
|
|
33
|
+
"@kaynooo/utils": "3.1.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@kaynooo/cli-kit": "0.
|
|
36
|
+
"@kaynooo/cli-kit": "0.45.0"
|
|
37
37
|
}
|
|
38
38
|
}
|