@kaynooo/cli-pkg 0.16.0 → 0.17.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 +2 -2
- package/dist/cli.js +355 -90
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ pkg outdated
|
|
|
15
15
|
|
|
16
16
|
- Whether the name exists, the version the request resolves to (an exact version, a dist-tag or a range), the latest version, and the highest stable version at least two weeks old (`safe`), each with its publish date.
|
|
17
17
|
- Weekly downloads (public registry only), licence and repository.
|
|
18
|
-
- Warnings for a version under the minimum age (with the `safe` version to use instead; a fresh version clear of an advisory at `blockSeverity` or above that `safe` has is let through, with a warning naming the GHSAs it fixes), `preinstall`, `install` and `postinstall` scripts, a deprecated version, and a name that is a near miss of a popular package (one or two edits, other separators or case, or the same name under another scope).
|
|
18
|
+
- Warnings for a version under the minimum age (with the `safe` version to use instead; a fresh version clear of an advisory at `blockSeverity` or above that `safe` has is let through, with a warning naming the GHSAs it fixes), `preinstall`, `install` and `postinstall` scripts, a deprecated version, a version whose publisher differs from the previous release's or whose provenance attestation is gone, and a name that is a near miss of a popular package (one or two edits, other separators or case, or the same name under another scope).
|
|
19
19
|
|
|
20
20
|
`pkg` exits 1 when a package is blocked (missing, the request matches no version or is not a valid range, the resolved version is too fresh (unless it fixes an advisory of the safe version at the threshold) or has no publish date on npmjs.org, its licence is outside the allowlist, or an advisory reaches the threshold), 2 when it could not check (the registry unreachable, slower than 10 s or answering badly, a broken `.pkgrc.json`, `bunfig.toml` or `.npmrc`) or on a usage error; other warnings exit 0. `--json` prints one report, or an array for several names, `--min-age <days>` changes the 14 days.
|
|
21
21
|
|
|
@@ -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);
|
|
@@ -553,7 +587,27 @@ var init_format = __esm(() => {
|
|
|
553
587
|
// ../kit/src/help.ts
|
|
554
588
|
import process8 from "process";
|
|
555
589
|
function usageLine(usage, colors = paint(process8.stdout)) {
|
|
556
|
-
|
|
590
|
+
const lines = usage.replace(USAGE_PREFIX, "").split(`
|
|
591
|
+
`);
|
|
592
|
+
const blank = lines.indexOf("");
|
|
593
|
+
const synopses = blank === -1 ? lines : lines.slice(0, blank);
|
|
594
|
+
const details = blank === -1 ? [] : lines.slice(blank + 1);
|
|
595
|
+
const colon = synopses[0].indexOf(": ");
|
|
596
|
+
const inline = synopses[0].slice(colon + 2);
|
|
597
|
+
const summary = colon === -1 ? details.shift() : `${inline.charAt(0).toUpperCase()}${inline.slice(1)}`;
|
|
598
|
+
if (colon !== -1)
|
|
599
|
+
synopses[0] = synopses[0].slice(0, colon);
|
|
600
|
+
const head = `${colors.bold("Usage:")} ${synopses.map((line) => line.replaceAll(OPTIONAL, (part) => colors.dim(part))).join(`
|
|
601
|
+
`)}`;
|
|
602
|
+
const lead = summary === undefined ? [] : ["", colors.bold(prose(summary, colors))];
|
|
603
|
+
const rest = details.length === 0 ? [] : ["", ...details.map((line) => prose(line, colors))];
|
|
604
|
+
return [head, ...lead, ...rest].join(`
|
|
605
|
+
`);
|
|
606
|
+
}
|
|
607
|
+
function prose(line, colors) {
|
|
608
|
+
if (colors.cyan("x") === "x")
|
|
609
|
+
return line;
|
|
610
|
+
return line.replaceAll(PROSE_MARKS, (match, code, flag) => code === undefined ? colors.cyan(flag ?? match) : colors.bold(code));
|
|
557
611
|
}
|
|
558
612
|
function helpText(usage, options, colors = paint(process8.stdout), { examples = [], exits = [] } = {}) {
|
|
559
613
|
return [usageLine(usage, colors), "", colors.bold("Options:"), ...optionRows(options, colors), ...exitRows(exits, colors), ...exampleRows(examples, colors)].join(`
|
|
@@ -602,13 +656,14 @@ function optionRows(options, colors = paint(process8.stdout)) {
|
|
|
602
656
|
const width = Math.max(0, ...rows.map((row) => row.width));
|
|
603
657
|
return rows.map((row) => row.description === "" ? ` ${row.flag}` : ` ${row.flag}${" ".repeat(width - row.width)} ${colors.dim(row.description)}`);
|
|
604
658
|
}
|
|
605
|
-
var OPTIONAL, USAGE_PREFIX, FULL_STOP, MAX_INLINE_CHOICES = 24;
|
|
659
|
+
var OPTIONAL, USAGE_PREFIX, FULL_STOP, PROSE_MARKS, MAX_INLINE_CHOICES = 24;
|
|
606
660
|
var init_help = __esm(() => {
|
|
607
661
|
init_mode();
|
|
608
662
|
init_style();
|
|
609
663
|
OPTIONAL = /(?<!\x1B)\[[^\]]+\]/g;
|
|
610
664
|
USAGE_PREFIX = /^usage:\s*/i;
|
|
611
665
|
FULL_STOP = /\.$/;
|
|
666
|
+
PROSE_MARKS = /`([^`\n]+)`|(?<![\w-])(--[a-z][\w-]*|-[a-z](?![\w-]))/gi;
|
|
612
667
|
});
|
|
613
668
|
|
|
614
669
|
// ../kit/src/text.ts
|
|
@@ -873,7 +928,7 @@ function nearestOption(message, options, allowNegative) {
|
|
|
873
928
|
const meant = closest(word, known.map((flag) => flag.replace(DASHES, "")));
|
|
874
929
|
return meant === undefined ? undefined : `did you mean ${known.find((flag) => flag.replace(DASHES, "") === meant)}?`;
|
|
875
930
|
}
|
|
876
|
-
var DASHES, Exit, UsageError, HelpShown, completion, OUTPUT_OPTIONS, UNKNOWN_OPTION;
|
|
931
|
+
var DASHES, EXIT, Exit, UsageError, HelpShown, completion, OUTPUT_OPTIONS, UNKNOWN_OPTION;
|
|
877
932
|
var init_args = __esm(() => {
|
|
878
933
|
init_format();
|
|
879
934
|
init_help();
|
|
@@ -881,14 +936,21 @@ var init_args = __esm(() => {
|
|
|
881
936
|
init_help();
|
|
882
937
|
init_input();
|
|
883
938
|
DASHES = /^-+/;
|
|
939
|
+
EXIT = Symbol.for("@kaynooo/cli-kit/Exit");
|
|
884
940
|
Exit = class Exit extends Error {
|
|
885
941
|
code;
|
|
886
942
|
hint;
|
|
943
|
+
[EXIT] = true;
|
|
887
944
|
constructor(message, code, hint) {
|
|
888
945
|
super(message);
|
|
889
946
|
this.code = code;
|
|
890
947
|
this.hint = hint;
|
|
891
948
|
}
|
|
949
|
+
static [Symbol.hasInstance](value) {
|
|
950
|
+
if (this !== Exit)
|
|
951
|
+
return Function.prototype[Symbol.hasInstance].call(this, value);
|
|
952
|
+
return typeof value === "object" && value !== null && value[EXIT] === true;
|
|
953
|
+
}
|
|
892
954
|
};
|
|
893
955
|
UsageError = class UsageError extends Exit {
|
|
894
956
|
constructor(message, hint) {
|
|
@@ -902,7 +964,7 @@ var init_args = __esm(() => {
|
|
|
902
964
|
};
|
|
903
965
|
completion = { active: false };
|
|
904
966
|
OUTPUT_OPTIONS = {
|
|
905
|
-
color: { type: "string", description: "auto (on a terminal alone
|
|
967
|
+
color: { type: "string", choices: ["auto", "always", "never"], description: "auto (the default) colours on a terminal alone" },
|
|
906
968
|
plain: { type: "boolean", description: "plain text, no colour or spinner: --color never" }
|
|
907
969
|
};
|
|
908
970
|
UNKNOWN_OPTION = /^unknown option '(-[^']+)'/;
|
|
@@ -983,10 +1045,10 @@ function holdSignals(cleanup) {
|
|
|
983
1045
|
process12.on(signal, onSignal);
|
|
984
1046
|
return held;
|
|
985
1047
|
}
|
|
986
|
-
async function runCommand(argv, { cwd, env, stdin = "ignore", timeoutMs, signal, maxBytes = Infinity, onChunk, onStart } = {}) {
|
|
1048
|
+
async function runCommand(argv, { cwd, env, stdin = "ignore", input, timeoutMs, signal, maxBytes = Infinity, onChunk, onStart } = {}) {
|
|
987
1049
|
const chunks = [];
|
|
988
1050
|
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 } : {} });
|
|
1051
|
+
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
1052
|
const state = { kept: 0, truncated: false, timedOut: false, failure: undefined, done: false };
|
|
991
1053
|
const timers = [];
|
|
992
1054
|
const killGroup = (killing) => {
|
|
@@ -1075,10 +1137,14 @@ function liveRegion(render, stream = process13.stderr, env = process13.env) {
|
|
|
1075
1137
|
}, print: (text) => void stream.write(`${text}
|
|
1076
1138
|
`), stop: () => {
|
|
1077
1139
|
return;
|
|
1140
|
+
}, pause: () => () => {
|
|
1141
|
+
return;
|
|
1078
1142
|
} };
|
|
1079
1143
|
const write = stream.write.bind(stream);
|
|
1080
1144
|
let frame = 0;
|
|
1081
1145
|
let drawn = false;
|
|
1146
|
+
let paused = false;
|
|
1147
|
+
let stopped = false;
|
|
1082
1148
|
const columns = () => {
|
|
1083
1149
|
const now = stream.getWindowSize?.()[0] ?? stream.columns;
|
|
1084
1150
|
return now === undefined || now === 0 ? 80 : now;
|
|
@@ -1089,6 +1155,8 @@ function liveRegion(render, stream = process13.stderr, env = process13.env) {
|
|
|
1089
1155
|
drawn = false;
|
|
1090
1156
|
};
|
|
1091
1157
|
const draw = () => {
|
|
1158
|
+
if (paused)
|
|
1159
|
+
return;
|
|
1092
1160
|
const width = columns() - 1;
|
|
1093
1161
|
const height = stream.rows === undefined || stream.rows === 0 ? 24 : stream.rows;
|
|
1094
1162
|
const lines = render(FRAMES[frame++ % FRAMES.length]).slice(0, Math.max(1, height - 1)).map((line) => cutToWidth(line, width));
|
|
@@ -1100,16 +1168,17 @@ function liveRegion(render, stream = process13.stderr, env = process13.env) {
|
|
|
1100
1168
|
`)}${lines.length > 1 ? `\x1B[${lines.length - 1}A` : ""}\r`);
|
|
1101
1169
|
drawn = true;
|
|
1102
1170
|
};
|
|
1103
|
-
|
|
1171
|
+
let timer = setInterval(draw, FRAME_MS);
|
|
1104
1172
|
stream.on?.("resize", draw);
|
|
1105
|
-
|
|
1106
|
-
|
|
1173
|
+
let restore = interceptOutput(clear);
|
|
1174
|
+
let release = swallowInput();
|
|
1107
1175
|
const onExit = () => {
|
|
1108
1176
|
clear();
|
|
1109
1177
|
release();
|
|
1110
1178
|
};
|
|
1111
1179
|
const signals = holdSignals(stop);
|
|
1112
1180
|
function stop() {
|
|
1181
|
+
stopped = true;
|
|
1113
1182
|
clearInterval(timer);
|
|
1114
1183
|
stream.off?.("resize", draw);
|
|
1115
1184
|
clear();
|
|
@@ -1118,6 +1187,29 @@ function liveRegion(render, stream = process13.stderr, env = process13.env) {
|
|
|
1118
1187
|
process13.off("exit", onExit);
|
|
1119
1188
|
signals.release();
|
|
1120
1189
|
}
|
|
1190
|
+
function pause() {
|
|
1191
|
+
if (paused || stopped)
|
|
1192
|
+
return () => {
|
|
1193
|
+
return;
|
|
1194
|
+
};
|
|
1195
|
+
paused = true;
|
|
1196
|
+
clearInterval(timer);
|
|
1197
|
+
stream.off?.("resize", draw);
|
|
1198
|
+
clear();
|
|
1199
|
+
restore();
|
|
1200
|
+
release();
|
|
1201
|
+
return () => {
|
|
1202
|
+
if (!paused || stopped)
|
|
1203
|
+
return;
|
|
1204
|
+
paused = false;
|
|
1205
|
+
timer = setInterval(draw, FRAME_MS);
|
|
1206
|
+
timer.unref();
|
|
1207
|
+
stream.on?.("resize", draw);
|
|
1208
|
+
restore = interceptOutput(clear);
|
|
1209
|
+
release = swallowInput();
|
|
1210
|
+
draw();
|
|
1211
|
+
};
|
|
1212
|
+
}
|
|
1121
1213
|
timer.unref();
|
|
1122
1214
|
process13.on("exit", onExit);
|
|
1123
1215
|
return {
|
|
@@ -1128,9 +1220,54 @@ function liveRegion(render, stream = process13.stderr, env = process13.env) {
|
|
|
1128
1220
|
`);
|
|
1129
1221
|
draw();
|
|
1130
1222
|
},
|
|
1131
|
-
stop
|
|
1223
|
+
stop,
|
|
1224
|
+
pause
|
|
1225
|
+
};
|
|
1226
|
+
}
|
|
1227
|
+
function progressLine(stream = process13.stderr, env = process13.env) {
|
|
1228
|
+
const colors = paint(stream, env);
|
|
1229
|
+
const write = stream.write.bind(stream);
|
|
1230
|
+
const begun = performance.now();
|
|
1231
|
+
let started = begun;
|
|
1232
|
+
let current;
|
|
1233
|
+
const region = liveRegion((spinner) => current === undefined ? [] : [tintedParts(progressParts(current, spinner, performance.now() - started), colors)], stream, env);
|
|
1234
|
+
const end = (line) => {
|
|
1235
|
+
region.stop();
|
|
1236
|
+
write(`${line}
|
|
1237
|
+
`);
|
|
1238
|
+
};
|
|
1239
|
+
return {
|
|
1240
|
+
update: (progress) => {
|
|
1241
|
+
const step = current?.step;
|
|
1242
|
+
current = progress;
|
|
1243
|
+
if (progress.step !== step) {
|
|
1244
|
+
started = performance.now();
|
|
1245
|
+
region.redraw();
|
|
1246
|
+
}
|
|
1247
|
+
},
|
|
1248
|
+
stop: region.stop,
|
|
1249
|
+
pause: region.pause,
|
|
1250
|
+
done: (text) => end(marked("ok", text, stream, formatDuration(performance.now() - begun), env)),
|
|
1251
|
+
failed: (text) => end(marked("problem", text, stream, undefined, env))
|
|
1132
1252
|
};
|
|
1133
1253
|
}
|
|
1254
|
+
function progressParts({ step, done, total, unit }, spinner, ms) {
|
|
1255
|
+
const { theme } = activeTheme();
|
|
1256
|
+
const parts = [{ text: spinner, tint: (colors) => tinted(colors, theme.colors.accent) }, { text: ` ${step}`, tint: () => plain }];
|
|
1257
|
+
if (total !== undefined && total > 0) {
|
|
1258
|
+
const counted = Math.min(done ?? 0, total);
|
|
1259
|
+
const filled = Math.round(counted / total * BAR_WIDTH);
|
|
1260
|
+
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 });
|
|
1261
|
+
}
|
|
1262
|
+
parts.push({ text: ` ${formatElapsed(ms)}`, tint: (colors) => colors.dim });
|
|
1263
|
+
return parts;
|
|
1264
|
+
}
|
|
1265
|
+
function plain(text) {
|
|
1266
|
+
return text;
|
|
1267
|
+
}
|
|
1268
|
+
function tintedParts(parts, colors) {
|
|
1269
|
+
return parts.map(({ text, tint }) => tint(colors)(text)).join("");
|
|
1270
|
+
}
|
|
1134
1271
|
function cutToWidth(line, width) {
|
|
1135
1272
|
if (Bun.stringWidth(line) <= width)
|
|
1136
1273
|
return line;
|
|
@@ -1198,7 +1335,7 @@ function interceptOutput(clear) {
|
|
|
1198
1335
|
}
|
|
1199
1336
|
};
|
|
1200
1337
|
}
|
|
1201
|
-
var FRAMES, FRAME_MS = 200, CLEAR_BELOW = "\r\x1B[J", ESC, ESCAPE_CODE, RESET_STYLE, CTRL_C = 3, CLOSE_LINK, CONSOLE_METHODS;
|
|
1338
|
+
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
1339
|
var init_progress = __esm(() => {
|
|
1203
1340
|
init_format();
|
|
1204
1341
|
init_process();
|
|
@@ -1227,17 +1364,117 @@ var init_ci = __esm(() => {
|
|
|
1227
1364
|
init_tool();
|
|
1228
1365
|
});
|
|
1229
1366
|
|
|
1230
|
-
// ../kit/src/
|
|
1367
|
+
// ../kit/src/askpass.ts
|
|
1231
1368
|
import process14 from "process";
|
|
1369
|
+
async function askpassClient(argv) {
|
|
1370
|
+
const socketPath = process14.env[SOCKET_VARIABLE];
|
|
1371
|
+
if (socketPath === undefined)
|
|
1372
|
+
return;
|
|
1373
|
+
const request = { prompt: argv[0] ?? "", ...process14.env.SSH_ASKPASS_PROMPT === "none" ? { notice: true } : {} };
|
|
1374
|
+
const { promise, resolve } = Promise.withResolvers();
|
|
1375
|
+
let received = "";
|
|
1376
|
+
try {
|
|
1377
|
+
await Bun.connect({
|
|
1378
|
+
unix: socketPath,
|
|
1379
|
+
socket: {
|
|
1380
|
+
open: (socket) => void socket.write(`${JSON.stringify(request)}
|
|
1381
|
+
`),
|
|
1382
|
+
data: (_, chunk) => {
|
|
1383
|
+
received += chunk.toString();
|
|
1384
|
+
},
|
|
1385
|
+
close: () => resolve(received),
|
|
1386
|
+
error: () => resolve("")
|
|
1387
|
+
}
|
|
1388
|
+
});
|
|
1389
|
+
} catch {
|
|
1390
|
+
return 1;
|
|
1391
|
+
}
|
|
1392
|
+
const reply = await promise;
|
|
1393
|
+
if (reply === "")
|
|
1394
|
+
return 1;
|
|
1395
|
+
const { answer } = JSON.parse(reply);
|
|
1396
|
+
if (request.notice === true)
|
|
1397
|
+
return 0;
|
|
1398
|
+
if (answer === undefined)
|
|
1399
|
+
return 1;
|
|
1400
|
+
process14.stdout.write(`${answer}
|
|
1401
|
+
`);
|
|
1402
|
+
return 0;
|
|
1403
|
+
}
|
|
1404
|
+
var SOCKET_VARIABLE = "KAYNOOO_ASKPASS_SOCKET";
|
|
1405
|
+
var init_askpass = () => {};
|
|
1406
|
+
|
|
1407
|
+
// ../kit/src/completions.ts
|
|
1408
|
+
function completionScript(shell, bins, header = `# Generated by \`${bins[0]} --completions ${shell}\``) {
|
|
1409
|
+
if (shell === "fish")
|
|
1410
|
+
return `${header}
|
|
1411
|
+
${FISH_FUNCTION}
|
|
1412
|
+
${bins.map((bin) => `complete -c ${bin} -f -a '(__kaynooo_cli_complete ${bin})'
|
|
1413
|
+
`).join("")}`;
|
|
1414
|
+
if (shell === "bash")
|
|
1415
|
+
return `${header}
|
|
1416
|
+
${BASH_FUNCTION}
|
|
1417
|
+
complete -F __kaynooo_cli_complete ${bins.join(" ")}
|
|
1418
|
+
`;
|
|
1419
|
+
return `${header}
|
|
1420
|
+
${ZSH_FUNCTION}
|
|
1421
|
+
compdef __kaynooo_cli_complete ${bins.join(" ")}
|
|
1422
|
+
`;
|
|
1423
|
+
}
|
|
1424
|
+
var COMPLETION_SHELLS, FISH_FUNCTION = `functions -q __kaynooo_cli_complete; or function __kaynooo_cli_complete --argument-names bin --description 'what a @kaynooo/cli-kit bin offers for the word being typed'
|
|
1425
|
+
set -l tokens (commandline -xpc 2>/dev/null; or commandline -opc)
|
|
1426
|
+
set -l current (commandline -ct)
|
|
1427
|
+
for line in ($bin __complete $tokens[2..-1] $current 2>/dev/null)
|
|
1428
|
+
if test "$line" = __files__
|
|
1429
|
+
__fish_complete_path $current
|
|
1430
|
+
else
|
|
1431
|
+
echo $line
|
|
1432
|
+
end
|
|
1433
|
+
end
|
|
1434
|
+
end`, BASH_FUNCTION = `__kaynooo_cli_complete() {
|
|
1435
|
+
local IFS=$'\\n' cur=\${COMP_WORDS[COMP_CWORD]} line words=
|
|
1436
|
+
local -a lines
|
|
1437
|
+
COMPREPLY=()
|
|
1438
|
+
lines=($("\${COMP_WORDS[0]}" __complete "\${COMP_WORDS[@]:1:COMP_CWORD}" 2>/dev/null))
|
|
1439
|
+
for line in "\${lines[@]}"; do
|
|
1440
|
+
if [[ $line == __files__ ]]; then
|
|
1441
|
+
COMPREPLY+=($(compgen -f -- "$cur"))
|
|
1442
|
+
else
|
|
1443
|
+
words+="\${line%%$'\\t'*}"$'\\n'
|
|
1444
|
+
fi
|
|
1445
|
+
done
|
|
1446
|
+
COMPREPLY+=($(compgen -W "$words" -- "$cur"))
|
|
1447
|
+
}`, ZSH_FUNCTION = `__kaynooo_cli_complete() {
|
|
1448
|
+
local line
|
|
1449
|
+
local -a described plain
|
|
1450
|
+
for line in \${(f)"$("\${words[1]}" __complete "\${(@)words[2,CURRENT]}" 2>/dev/null)"}; do
|
|
1451
|
+
if [[ $line == __files__ ]]; then
|
|
1452
|
+
_files
|
|
1453
|
+
elif [[ $line == *$'\\t'* ]]; then
|
|
1454
|
+
described+=("\${\${line%%$'\\t'*}//:/\\\\:}:\${line#*$'\\t'}")
|
|
1455
|
+
else
|
|
1456
|
+
plain+=("$line")
|
|
1457
|
+
fi
|
|
1458
|
+
done
|
|
1459
|
+
(( \${#described} )) && _describe -V value described
|
|
1460
|
+
(( \${#plain} )) && compadd -- "\${plain[@]}"
|
|
1461
|
+
return 0
|
|
1462
|
+
}`;
|
|
1463
|
+
var init_completions = __esm(() => {
|
|
1464
|
+
COMPLETION_SHELLS = ["fish", "bash", "zsh"];
|
|
1465
|
+
});
|
|
1466
|
+
|
|
1467
|
+
// ../kit/src/notify.ts
|
|
1468
|
+
import process15 from "process";
|
|
1232
1469
|
function base64(text) {
|
|
1233
1470
|
return Buffer.from(text).toString("base64");
|
|
1234
1471
|
}
|
|
1235
|
-
function notification(title, body, env =
|
|
1236
|
-
const id = `kit${
|
|
1472
|
+
function notification(title, body, env = process15.env) {
|
|
1473
|
+
const id = `kit${process15.pid}`;
|
|
1237
1474
|
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\\`];
|
|
1238
1475
|
return codes.map((code) => env.TMUX === undefined || env.TMUX === "" ? code : `\x1BPtmux;${code.replaceAll("\x1B", "\x1B\x1B")}\x1B\\`).join("");
|
|
1239
1476
|
}
|
|
1240
|
-
function notifyEnd(command, code, ms, { stream =
|
|
1477
|
+
function notifyEnd(command, code, ms, { stream = process15.stderr, env = process15.env } = {}) {
|
|
1241
1478
|
if (ms < NOTIFY_AFTER_MS || code === CANCELLED || outputMode(stream, env) !== "terminal")
|
|
1242
1479
|
return;
|
|
1243
1480
|
stream.write(notification(command, code === 0 ? `done in ${formatDuration(ms)}` : `failed with exit ${code} after ${formatDuration(ms)}`, env));
|
|
@@ -1258,18 +1495,18 @@ var init_logs = __esm(() => {
|
|
|
1258
1495
|
import { appendFileSync, mkdirSync } from "fs";
|
|
1259
1496
|
import { homedir as homedir3 } from "os";
|
|
1260
1497
|
import { dirname as dirname2, isAbsolute, join as join4 } from "path";
|
|
1261
|
-
import
|
|
1498
|
+
import process16 from "process";
|
|
1262
1499
|
function noteUsageError(message) {
|
|
1263
1500
|
usageError = message;
|
|
1264
1501
|
}
|
|
1265
|
-
function stateHome(env =
|
|
1502
|
+
function stateHome(env = process16.env) {
|
|
1266
1503
|
const dir = env.XDG_STATE_HOME;
|
|
1267
1504
|
return dir !== undefined && isAbsolute(dir) ? dir : join4(homedir3(), ".local", "state");
|
|
1268
1505
|
}
|
|
1269
|
-
function usagePath(env =
|
|
1506
|
+
function usagePath(env = process16.env) {
|
|
1270
1507
|
return join4(stateHome(env), CLI_FOLDER, "usage.jsonl");
|
|
1271
1508
|
}
|
|
1272
|
-
function usageRecorded(env =
|
|
1509
|
+
function usageRecorded(env = process16.env) {
|
|
1273
1510
|
const off = env.KAYNOOO_CLI_NO_USAGE;
|
|
1274
1511
|
return env.NODE_ENV !== "test" && (off === undefined || off === "" || off === "0");
|
|
1275
1512
|
}
|
|
@@ -1278,12 +1515,12 @@ function flagNames(argv) {
|
|
|
1278
1515
|
const names = (end === -1 ? argv : argv.slice(0, end)).filter((word) => word.startsWith("-") && word !== "-").map((word) => word.includes("=") ? word.slice(0, word.indexOf("=")) : word);
|
|
1279
1516
|
return [...new Set(names)].filter((name) => name.length <= LONGEST_NAME && FLAG_NAME.test(name));
|
|
1280
1517
|
}
|
|
1281
|
-
function usageEntry(bin, command, argv, code, now = new Date) {
|
|
1518
|
+
function usageEntry(bin, command, argv, code, { ms, now = new Date } = {}) {
|
|
1282
1519
|
const unknown = code === 2 && usageError !== undefined ? UNKNOWN_OPTION2.exec(usageError)?.[1] : undefined;
|
|
1283
1520
|
usageError = undefined;
|
|
1284
|
-
return { at: now.toISOString(), bin, ...command === undefined ? {} : { command }, flags: flagNames(argv), code, ...unknown === undefined ? {} : { unknown } };
|
|
1521
|
+
return { at: now.toISOString(), bin, ...command === undefined ? {} : { command }, flags: flagNames(argv), code, ...unknown === undefined ? {} : { unknown }, ...ms === undefined ? {} : { ms: Math.round(ms) } };
|
|
1285
1522
|
}
|
|
1286
|
-
function recordUsage(entry, env =
|
|
1523
|
+
function recordUsage(entry, env = process16.env) {
|
|
1287
1524
|
if (!usageRecorded(env))
|
|
1288
1525
|
return;
|
|
1289
1526
|
try {
|
|
@@ -1303,7 +1540,7 @@ var init_usage = __esm(() => {
|
|
|
1303
1540
|
// ../kit/src/cli.ts
|
|
1304
1541
|
import { readFileSync as readFileSync4, realpathSync as realpathSync2 } from "fs";
|
|
1305
1542
|
import { dirname as dirname3, join as join5 } from "path";
|
|
1306
|
-
import
|
|
1543
|
+
import process17 from "process";
|
|
1307
1544
|
async function commandRows(all, colors) {
|
|
1308
1545
|
const commands = shown(all);
|
|
1309
1546
|
const width = Math.max(0, ...Object.keys(commands).map((name) => name.length));
|
|
@@ -1377,8 +1614,8 @@ async function help2({ path, header, summary: lazySummary, commands, defaultComm
|
|
|
1377
1614
|
`);
|
|
1378
1615
|
}
|
|
1379
1616
|
function printError(prefix, message, hint, cause) {
|
|
1380
|
-
const colors = paint(
|
|
1381
|
-
const styled = takesControlCodes(
|
|
1617
|
+
const colors = paint(process17.stderr);
|
|
1618
|
+
const styled = takesControlCodes(process17.stderr);
|
|
1382
1619
|
const head = styled ? `${colors.red.bold("error")} ${colors.dim(`${prefix}:`)}` : `error: ${prefix}:`;
|
|
1383
1620
|
const under = (label, text, tint) => text === undefined ? "" : `
|
|
1384
1621
|
${styled ? tint(label) : `${label}:`} ${text}`;
|
|
@@ -1421,11 +1658,11 @@ async function dispatch(level, typed, { version, redact }) {
|
|
|
1421
1658
|
}
|
|
1422
1659
|
}
|
|
1423
1660
|
if (name === undefined && level.path.length > 1) {
|
|
1424
|
-
console.error(await help2(await expand(level, [...level.path.slice(1), ...argv]),
|
|
1661
|
+
console.error(await help2(await expand(level, [...level.path.slice(1), ...argv]), process17.stderr));
|
|
1425
1662
|
return 2;
|
|
1426
1663
|
}
|
|
1427
1664
|
if (name === undefined || name === "help" || name === "--help" || name === "-h") {
|
|
1428
|
-
console.log(await help2(await expand(level, [...level.path.slice(1), ...argv]),
|
|
1665
|
+
console.log(await help2(await expand(level, [...level.path.slice(1), ...argv]), process17.stdout));
|
|
1429
1666
|
return 0;
|
|
1430
1667
|
}
|
|
1431
1668
|
if (level.path.length === 1 && (name === "--version" || name === "-v")) {
|
|
@@ -1534,6 +1771,18 @@ async function candidates(scope, defaultCommand, words, before = []) {
|
|
|
1534
1771
|
}
|
|
1535
1772
|
return "commands" in command ? candidates(scopeOf(command.commands, command.extraCommands, command.aliases), undefined, rest, [...before, word]) : leafCandidates(command.run, rest);
|
|
1536
1773
|
}
|
|
1774
|
+
function flagValue([flag = "", ...rest]) {
|
|
1775
|
+
return flag.includes("=") ? [flag.slice(flag.indexOf("=") + 1), ...rest] : rest;
|
|
1776
|
+
}
|
|
1777
|
+
function printCompletionScript(name, args) {
|
|
1778
|
+
const shell = COMPLETION_SHELLS.find((each) => each === args[0]);
|
|
1779
|
+
if (shell === undefined || args.length !== 1) {
|
|
1780
|
+
printError(name, `${COMPLETIONS} takes one of ${COMPLETION_SHELLS.join(", ")}`, `${name} ${COMPLETIONS} fish`);
|
|
1781
|
+
return 2;
|
|
1782
|
+
}
|
|
1783
|
+
console.log(completionScript(shell, [name]).trimEnd());
|
|
1784
|
+
return 0;
|
|
1785
|
+
}
|
|
1537
1786
|
async function printCandidates(found) {
|
|
1538
1787
|
for (const line of await found)
|
|
1539
1788
|
console.log(line);
|
|
@@ -1556,15 +1805,20 @@ function packageVersion(entry = Bun.main) {
|
|
|
1556
1805
|
}
|
|
1557
1806
|
async function runCli(cli, argv = scriptArgs()) {
|
|
1558
1807
|
const version = cli.version ?? packageVersion();
|
|
1808
|
+
const answered = await askpassClient(argv);
|
|
1809
|
+
if (answered !== undefined)
|
|
1810
|
+
return answered;
|
|
1559
1811
|
if (argv[0] === COMPLETE)
|
|
1560
1812
|
return printCandidates(candidates(scopeOf(cli.commands, cli.extraCommands, cli.aliases), cli.defaultCommand, argv.slice(1)));
|
|
1813
|
+
if (argv[0] === COMPLETIONS || argv[0]?.startsWith(`${COMPLETIONS}=`) === true)
|
|
1814
|
+
return printCompletionScript(cli.name, flagValue(argv));
|
|
1561
1815
|
const started = performance.now();
|
|
1562
1816
|
const code = await dispatch({ path: [cli.name], header: (colors, about) => `${colors.bold(cli.name)} ${colors.dim(version)} ${about}`, summary: cli.about, ...scopeOf(cli.commands, cli.extraCommands, cli.aliases), defaultCommand: cli.defaultCommand, runBare: cli.runBare === true, examples: cli.examples, replaces: cli.replaces }, argv, { version, redact: cli.redact });
|
|
1563
1817
|
const command = commandPath(scopeOf(cli.commands, cli.extraCommands, cli.aliases), argv);
|
|
1564
1818
|
notifyEnd(command === undefined ? cli.name : `${cli.name} ${command}`, code, performance.now() - started);
|
|
1565
1819
|
if (cli.usage !== false) {
|
|
1566
1820
|
try {
|
|
1567
|
-
recordUsage(usageEntry(cli.name, command, argv, code));
|
|
1821
|
+
recordUsage(usageEntry(cli.name, command, argv, code, { ms: performance.now() - started }));
|
|
1568
1822
|
} catch {}
|
|
1569
1823
|
}
|
|
1570
1824
|
return code;
|
|
@@ -1584,10 +1838,12 @@ function commandPath(scope, argv) {
|
|
|
1584
1838
|
}
|
|
1585
1839
|
return path.length === 0 ? undefined : path.join(" ");
|
|
1586
1840
|
}
|
|
1587
|
-
var LEVEL_OPTIONS, TOP_OPTIONS, COMPLETE = "__complete", FILES = "__files__";
|
|
1841
|
+
var LEVEL_OPTIONS, TOP_OPTIONS, COMPLETE = "__complete", FILES = "__files__", COMPLETIONS = "--completions";
|
|
1588
1842
|
var init_cli = __esm(() => {
|
|
1589
1843
|
init_args();
|
|
1590
1844
|
init_argv();
|
|
1845
|
+
init_askpass();
|
|
1846
|
+
init_completions();
|
|
1591
1847
|
init_notify();
|
|
1592
1848
|
init_style();
|
|
1593
1849
|
init_text2();
|
|
@@ -1596,7 +1852,11 @@ var init_cli = __esm(() => {
|
|
|
1596
1852
|
...OUTPUT_OPTIONS,
|
|
1597
1853
|
help: { type: "boolean", short: "h", description: "show this help" }
|
|
1598
1854
|
};
|
|
1599
|
-
TOP_OPTIONS = {
|
|
1855
|
+
TOP_OPTIONS = {
|
|
1856
|
+
...LEVEL_OPTIONS,
|
|
1857
|
+
version: { type: "boolean", short: "v", description: "print the version" },
|
|
1858
|
+
completions: { type: "string", choices: COMPLETION_SHELLS, description: "print the shell completion script" }
|
|
1859
|
+
};
|
|
1600
1860
|
});
|
|
1601
1861
|
// ../kit/src/excerpt.ts
|
|
1602
1862
|
var init_excerpt = __esm(() => {
|
|
@@ -1647,13 +1907,15 @@ var init_limit = __esm(() => {
|
|
|
1647
1907
|
});
|
|
1648
1908
|
|
|
1649
1909
|
// ../kit/src/pool.ts
|
|
1650
|
-
async function pool(items, limit, task) {
|
|
1910
|
+
async function pool(items, limit, task, onDone) {
|
|
1651
1911
|
const results = Array.from({ length: items.length });
|
|
1652
1912
|
let next = 0;
|
|
1913
|
+
let done = 0;
|
|
1653
1914
|
async function worker() {
|
|
1654
1915
|
while (next < items.length) {
|
|
1655
1916
|
const index = next++;
|
|
1656
1917
|
results[index] = await task(items[index]);
|
|
1918
|
+
onDone?.(++done, items.length);
|
|
1657
1919
|
}
|
|
1658
1920
|
}
|
|
1659
1921
|
await Promise.all(Array.from({ length: Math.min(limit, items.length) }, worker));
|
|
@@ -1694,7 +1956,7 @@ var init_watch = __esm(() => {
|
|
|
1694
1956
|
// ../kit/src/workspace-root.ts
|
|
1695
1957
|
import { homedir as homedir4 } from "os";
|
|
1696
1958
|
import { dirname as dirname4, join as join6, resolve as resolve4 } from "path";
|
|
1697
|
-
import
|
|
1959
|
+
import process18 from "process";
|
|
1698
1960
|
function expandHome(path, home) {
|
|
1699
1961
|
if (path === "~")
|
|
1700
1962
|
return home;
|
|
@@ -1704,7 +1966,7 @@ function configured(env, home) {
|
|
|
1704
1966
|
const folder = readUserConfig("config", { home, xdg: env.XDG_CONFIG_HOME }).workspace;
|
|
1705
1967
|
return typeof folder === "string" && folder !== "" ? folder : undefined;
|
|
1706
1968
|
}
|
|
1707
|
-
function workspaceRoot({ given, env =
|
|
1969
|
+
function workspaceRoot({ given, env = process18.env, home = homedir4() } = {}) {
|
|
1708
1970
|
const fromEnv = env.KAYNOOO_WORKSPACE === "" ? undefined : env.KAYNOOO_WORKSPACE;
|
|
1709
1971
|
return resolve4(expandHome(given ?? fromEnv ?? configured(env, home) ?? join6(home, "Workspace"), home));
|
|
1710
1972
|
}
|
|
@@ -1721,6 +1983,7 @@ var init_src = __esm(() => {
|
|
|
1721
1983
|
init_chart();
|
|
1722
1984
|
init_ci();
|
|
1723
1985
|
init_cli();
|
|
1986
|
+
init_completions();
|
|
1724
1987
|
init_config();
|
|
1725
1988
|
init_folders();
|
|
1726
1989
|
init_format();
|
|
@@ -2491,7 +2754,7 @@ function ageDays(published, now) {
|
|
|
2491
2754
|
return Number.isNaN(at) ? undefined : (now - at) / DAY;
|
|
2492
2755
|
}
|
|
2493
2756
|
function daysAgo(age) {
|
|
2494
|
-
return age < 1 ? "less than a day" :
|
|
2757
|
+
return age < 1 ? "less than a day" : bo(Math.floor(age), "day");
|
|
2495
2758
|
}
|
|
2496
2759
|
function installScriptsOf(version) {
|
|
2497
2760
|
return Object.fromEntries(INSTALL_SCRIPTS.flatMap((name) => version?.scripts?.[name] === undefined ? [] : [[name, version.scripts[name]]]));
|
|
@@ -2601,7 +2864,7 @@ var init_analyze = __esm(() => {
|
|
|
2601
2864
|
// src/config.ts
|
|
2602
2865
|
import { homedir as homedir5 } from "os";
|
|
2603
2866
|
import { dirname as dirname5, join as join7 } from "path";
|
|
2604
|
-
import
|
|
2867
|
+
import process20 from "process";
|
|
2605
2868
|
function expand2(value, env) {
|
|
2606
2869
|
let missing = false;
|
|
2607
2870
|
const expanded = value.replace(ENV_REFERENCE, (_, braced, bare) => {
|
|
@@ -2690,7 +2953,7 @@ async function readIfThere(path) {
|
|
|
2690
2953
|
const file = Bun.file(path);
|
|
2691
2954
|
return await file.exists() ? file.text() : undefined;
|
|
2692
2955
|
}
|
|
2693
|
-
async function loadConfigs(cwd =
|
|
2956
|
+
async function loadConfigs(cwd = process20.cwd(), env = process20.env, home = homedir5()) {
|
|
2694
2957
|
const directories = [];
|
|
2695
2958
|
for (let dir = cwd;!directories.includes(dir); dir = dirname5(dir))
|
|
2696
2959
|
directories.push(dir);
|
|
@@ -2723,7 +2986,7 @@ function parseSettings(text) {
|
|
|
2723
2986
|
settings.concurrency = raw.concurrency;
|
|
2724
2987
|
return settings;
|
|
2725
2988
|
}
|
|
2726
|
-
async function loadSettings(cwd =
|
|
2989
|
+
async function loadSettings(cwd = process20.cwd(), home) {
|
|
2727
2990
|
const files = [];
|
|
2728
2991
|
for (let dir = cwd;!files.includes(join7(dir, SETTINGS_FILE)); dir = dirname5(dir))
|
|
2729
2992
|
files.push(join7(dir, SETTINGS_FILE));
|
|
@@ -3022,11 +3285,9 @@ ${usage2}` : `${values.from} has no registry dependency to check`);
|
|
|
3022
3285
|
}
|
|
3023
3286
|
var usage2 = `pkg [check] <name>[@version]... | --from <package.json> | -
|
|
3024
3287
|
|
|
3025
|
-
Checks npm packages before they are added:
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
A \`.pkgrc.json\` (or ~/.config/kaynooo-cli/pkg.json) with \`licenses\` (SPDX ids) refuses a licence outside the list or a missing one, and \`blockSeverity\` (low, moderate, high, critical; high when unset) refuses a version with an advisory at that level or above.`, EXITS, options, WORDS;
|
|
3288
|
+
Checks npm packages before they are added: the name exists, the newest version at least two weeks old, downloads, licence, install scripts, a near miss of a popular name, and a changed publisher or lost provenance attestation.
|
|
3289
|
+
Names come from the arguments, from a package.json with --from, or from stdin.
|
|
3290
|
+
A \`.pkgrc.json\` with \`licenses\` refuses a licence outside the list, and \`blockSeverity\` a version with an advisory at that level or above.`, EXITS, options, WORDS;
|
|
3030
3291
|
var init_check = __esm(() => {
|
|
3031
3292
|
init_src();
|
|
3032
3293
|
init_advisories();
|
|
@@ -3114,7 +3375,7 @@ __export(exports_audit, {
|
|
|
3114
3375
|
audit: () => audit
|
|
3115
3376
|
});
|
|
3116
3377
|
import { join as join9, resolve as resolve6 } from "path";
|
|
3117
|
-
import
|
|
3378
|
+
import process21 from "process";
|
|
3118
3379
|
function hasFinding(audited) {
|
|
3119
3380
|
return audited.blocked || audited.warnings.length > 0 || audited.advisories.length > 0;
|
|
3120
3381
|
}
|
|
@@ -3130,7 +3391,8 @@ async function auditPackages(packages, context) {
|
|
|
3130
3391
|
const registry = registryFor(name, context.configs);
|
|
3131
3392
|
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 };
|
|
3132
3393
|
return { name, version, registry, input, safe: analyze(input).safe?.version };
|
|
3133
|
-
});
|
|
3394
|
+
}, (done, total) => context.onProgress?.({ step: "looking up", done, total, unit: "packages" }));
|
|
3395
|
+
context.onProgress?.({ step: "reading the advisories" });
|
|
3134
3396
|
const registries = new Map;
|
|
3135
3397
|
for (const { name, version, registry, safe } of looked) {
|
|
3136
3398
|
const group = registries.get(registry.url) ?? { registry, versions: {} };
|
|
@@ -3154,7 +3416,7 @@ async function auditPackages(packages, context) {
|
|
|
3154
3416
|
});
|
|
3155
3417
|
return { audited, unavailable };
|
|
3156
3418
|
}
|
|
3157
|
-
function renderAudit(findings, total, stream =
|
|
3419
|
+
function renderAudit(findings, total, stream = process21.stdout, env = process21.env) {
|
|
3158
3420
|
const id = role("id", stream, env);
|
|
3159
3421
|
const label = role("label", stream, env);
|
|
3160
3422
|
const warning = role("warn", stream, env);
|
|
@@ -3172,10 +3434,8 @@ function renderAudit(findings, total, stream = process20.stdout, env = process20
|
|
|
3172
3434
|
}
|
|
3173
3435
|
async function audit(args) {
|
|
3174
3436
|
const { values, positionals: [asked] } = parse(args, usage3, options2, { positionals: ["[dir]"], exits: EXITS2 });
|
|
3175
|
-
const level = values
|
|
3176
|
-
|
|
3177
|
-
fail(`--level takes ${SEVERITIES.join(", ")}, not ${level}`);
|
|
3178
|
-
const dir = resolve6(asked ?? process20.cwd());
|
|
3437
|
+
const { level } = values;
|
|
3438
|
+
const dir = resolve6(asked ?? process21.cwd());
|
|
3179
3439
|
const lock = Bun.file(join9(dir, "bun.lock"));
|
|
3180
3440
|
if (!await lock.exists())
|
|
3181
3441
|
fail(`no bun.lock in ${dir}`);
|
|
@@ -3190,7 +3450,14 @@ async function audit(args) {
|
|
|
3190
3450
|
level,
|
|
3191
3451
|
ignore: values.ignore ?? []
|
|
3192
3452
|
};
|
|
3193
|
-
const
|
|
3453
|
+
const progress = progressLine();
|
|
3454
|
+
let result;
|
|
3455
|
+
try {
|
|
3456
|
+
result = await auditPackages(packages, { ...context, onProgress: progress.update });
|
|
3457
|
+
} finally {
|
|
3458
|
+
progress.stop();
|
|
3459
|
+
}
|
|
3460
|
+
const { audited, unavailable } = result;
|
|
3194
3461
|
const findings = audited.filter(hasFinding);
|
|
3195
3462
|
if (values.json === true)
|
|
3196
3463
|
printJson(findings);
|
|
@@ -3204,11 +3471,11 @@ async function audit(args) {
|
|
|
3204
3471
|
}
|
|
3205
3472
|
var usage3 = `pkg audit [dir]
|
|
3206
3473
|
|
|
3207
|
-
Reads the bun.lock
|
|
3208
|
-
|
|
3209
|
-
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;
|
|
3474
|
+
Reads the bun.lock of the folder and runs on every registry package it pins the checks \`pkg check\` runs before an add, and lists the known advisories of each version, with the GHSA, the severity and the fixed version.
|
|
3475
|
+
Reach for it to vet one repository in depth; \`audit\` sweeps many repositories for advisories only.`, EXITS2, options2, BATCH = 8, HIGH_SEVERITIES;
|
|
3210
3476
|
var init_audit = __esm(() => {
|
|
3211
3477
|
init_src();
|
|
3478
|
+
init_progress();
|
|
3212
3479
|
init_advisories();
|
|
3213
3480
|
init_analyze();
|
|
3214
3481
|
init_config2();
|
|
@@ -3218,7 +3485,7 @@ var init_audit = __esm(() => {
|
|
|
3218
3485
|
options2 = {
|
|
3219
3486
|
json: jsonOption("[{name, version, license, blocked, warnings, advisories}] for the packages with a finding"),
|
|
3220
3487
|
"min-age": { type: "string", description: `days a version must be old (${DEFAULT_MIN_AGE_DAYS}, or the minAge setting)` },
|
|
3221
|
-
level: { type: "string", description: "lowest advisory severity listed and failing
|
|
3488
|
+
level: { type: "string", choices: SEVERITIES, default: "moderate", description: "lowest advisory severity listed and failing (moderate)" },
|
|
3222
3489
|
prod: { type: "boolean", description: "only the packages a production dependency or an optional one of a workspace reaches" },
|
|
3223
3490
|
ignore: { type: "string", multiple: true, description: "an advisory skipped by GHSA or numeric id, repeatable" }
|
|
3224
3491
|
};
|
|
@@ -3284,7 +3551,7 @@ async function outdatedCommand(args) {
|
|
|
3284
3551
|
}
|
|
3285
3552
|
var usage4 = `pkg outdated [dir]
|
|
3286
3553
|
|
|
3287
|
-
Lists the dependencies of the package.json
|
|
3554
|
+
Lists the dependencies of the package.json of the folder that have a newer version safe to take: the highest stable one at least --min-age days old, the \`safe\` of \`pkg check\`.
|
|
3288
3555
|
It reads only the registry's metadata, no advisories, and changes nothing: \`bun add --exact name@version\` adopts a row.`, EXITS3, OUTDATED_LIMIT = 50, BATCH2 = 8, FIRST_VERSION, DOT, options3;
|
|
3289
3556
|
var init_outdated = __esm(() => {
|
|
3290
3557
|
init_src();
|
|
@@ -3309,9 +3576,9 @@ var init_answers = __esm(() => {
|
|
|
3309
3576
|
});
|
|
3310
3577
|
|
|
3311
3578
|
// ../kit/src/job.ts
|
|
3312
|
-
import
|
|
3579
|
+
import process22 from "process";
|
|
3313
3580
|
function stopJob() {
|
|
3314
|
-
|
|
3581
|
+
process22.kill(0, "SIGTSTP");
|
|
3315
3582
|
}
|
|
3316
3583
|
var init_job = () => {};
|
|
3317
3584
|
|
|
@@ -3533,7 +3800,7 @@ var init_redraw = __esm(() => {
|
|
|
3533
3800
|
});
|
|
3534
3801
|
|
|
3535
3802
|
// ../kit/src/prompt.ts
|
|
3536
|
-
import
|
|
3803
|
+
import process23 from "process";
|
|
3537
3804
|
function readKeys(input, paste = { active: false }) {
|
|
3538
3805
|
return parseKeys(input, paste).filter((key) => typeof key === "object" ? "text" in key : PROMPT_KEYS.has(key) || isEditKey(key));
|
|
3539
3806
|
}
|
|
@@ -3661,7 +3928,7 @@ function asking(colors, question, typed, keys) {
|
|
|
3661
3928
|
function answer(colors, question, state, picked) {
|
|
3662
3929
|
return state === "enter" ? `${colors.green("\u2713")} ${question} ${colors.cyan(picked)}` : `${colors.red("\u2717")} ${question} ${colors.dim("cancelled")}`;
|
|
3663
3930
|
}
|
|
3664
|
-
async function ask(question, { hint, terminal =
|
|
3931
|
+
async function ask(question, { hint, terminal = process23 }, render, press) {
|
|
3665
3932
|
const { stdin, stderr } = terminal;
|
|
3666
3933
|
if (!isInteractive(terminal))
|
|
3667
3934
|
fail(`cannot ask "${question}" off a terminal`, 2, hint);
|
|
@@ -3677,7 +3944,7 @@ async function ask(question, { hint, terminal = process22 }, render, press) {
|
|
|
3677
3944
|
};
|
|
3678
3945
|
const redraw = () => draw(current);
|
|
3679
3946
|
const paste = { active: false };
|
|
3680
|
-
const stop = terminal.stop ?? (terminal ===
|
|
3947
|
+
const stop = terminal.stop ?? (terminal === process23 ? stopJob : undefined);
|
|
3681
3948
|
const suspend = () => {
|
|
3682
3949
|
if (stop === undefined)
|
|
3683
3950
|
return;
|
|
@@ -3895,10 +4162,10 @@ async function bumpConsumers(name, version, settings) {
|
|
|
3895
4162
|
const similar = similarDependencies(name, settings.root);
|
|
3896
4163
|
note(`nothing under ${settings.root} depends on ${name}`, similar.length === 0 ? undefined : `did you mean ${similar.join(", ")}`);
|
|
3897
4164
|
} else if (left > 0) {
|
|
3898
|
-
note(`${
|
|
4165
|
+
note(`${bo(left, "folder")} left out by --only or --except`);
|
|
3899
4166
|
}
|
|
3900
4167
|
if (declined.size > 0)
|
|
3901
|
-
note(`${
|
|
4168
|
+
note(`${bo(declined.size, "folder")} left out by your choice`);
|
|
3902
4169
|
if (local > 0)
|
|
3903
4170
|
note(`${local} non-registry dependenc${local === 1 ? "y" : "ies"} (workspace:, file:, git, URL, alias, catalog:)`, "left as they are");
|
|
3904
4171
|
for (const consumer of consumers) {
|
|
@@ -3959,7 +4226,7 @@ async function choosePlan(name, version, settings, chooser = terminalChooser, ho
|
|
|
3959
4226
|
const chosen = plans.filter((plan) => picked.has(plan.dir));
|
|
3960
4227
|
for (const plan of chosen)
|
|
3961
4228
|
note("plan", plan.line);
|
|
3962
|
-
if (chosen.length === 0 || await chooser.confirm(`bump ${name} to ${version} in ${
|
|
4229
|
+
if (chosen.length === 0 || await chooser.confirm(`bump ${name} to ${version} in ${bo(chosen.length, "folder")}?`) !== true)
|
|
3963
4230
|
return { chosen: [], declined: plans.map((plan) => plan.dir) };
|
|
3964
4231
|
const declined = plans.filter((plan) => !picked.has(plan.dir)).map((plan) => plan.dir);
|
|
3965
4232
|
saveExcluded(name, [...excluded].filter((dir) => !plans.some((plan) => plan.dir === dir)).concat(declined), home);
|
|
@@ -3994,12 +4261,10 @@ async function bump(args) {
|
|
|
3994
4261
|
}
|
|
3995
4262
|
var usage5 = `pkg bump <name> [version]
|
|
3996
4263
|
|
|
3997
|
-
Waits until the registry serves the version
|
|
3998
|
-
A version
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
On a terminal with no --only or --except, a checklist asks which consumers to bump (those left out last time are unchecked, and what is unchecked is remembered in ~/.config/kaynooo-cli/pkg-excluded.json), then the plan is printed and confirmed; --yes skips both, as a pipe or --dry-run does.
|
|
4002
|
-
With --all-consumers a folder whose package.json or lockfile already has uncommitted changes is left alone, and each folder whose install went through then runs its own \`check\` (the check bin) and is committed with \`gc 'chore(deps): bump <name> to <version>' -- package.json <lockfile>\` only when that passes; a failing one is left uncommitted and listed in the summary with the skipped ones, and nothing is ever pushed.`, EXITS4, ROOT_OPTION, options4, POLL = 5000, terminalChooser;
|
|
4264
|
+
Waits until the registry serves the version, vets it as \`pkg check\` does, then runs \`bun add --exact --no-cache\` in each folder under --root whose package.json depends on the package, the kind of dependency kept; a version the vetting blocks is refused before any folder is touched, unless --force is given.
|
|
4265
|
+
A dependency that is not a registry version (\`workspace:\`, \`link:\`, \`file:\`, git, a URL, \`catalog:\`), a peer range, a folder already on the version and one whose lockfile pins another manager are left as they are, each said so.
|
|
4266
|
+
On a terminal with no --only or --except, a checklist asks which consumers to bump, then the plan is printed and confirmed.
|
|
4267
|
+
With --all-consumers, a folder with uncommitted changes in its package.json or lockfile is left alone, and each folder whose install went through runs its own \`check\` and is committed with \`gc\` only when that passes; nothing is ever pushed.`, EXITS4, ROOT_OPTION, options4, POLL = 5000, terminalChooser;
|
|
4003
4268
|
var init_bump = __esm(() => {
|
|
4004
4269
|
init_src();
|
|
4005
4270
|
init_progress();
|
|
@@ -4102,7 +4367,7 @@ var exports_manager = {};
|
|
|
4102
4367
|
__export(exports_manager, {
|
|
4103
4368
|
manager: () => manager
|
|
4104
4369
|
});
|
|
4105
|
-
import
|
|
4370
|
+
import process24 from "process";
|
|
4106
4371
|
function manager(args) {
|
|
4107
4372
|
const { values, positionals } = parse(args, usage7, options6, {
|
|
4108
4373
|
exits: EXITS6,
|
|
@@ -4112,7 +4377,7 @@ function manager(args) {
|
|
|
4112
4377
|
examples: ["pkg manager dev", ["pkg manager exec", "bunx, npx, pnpm dlx... for this folder"]]
|
|
4113
4378
|
});
|
|
4114
4379
|
const action = oneOf(positionals[0] ?? "", "<action>", ACTIONS2);
|
|
4115
|
-
const found = detectManager(
|
|
4380
|
+
const found = detectManager(process24.cwd());
|
|
4116
4381
|
const command = commandFor(action, found);
|
|
4117
4382
|
if (values.json === true)
|
|
4118
4383
|
printJson({ manager: found, action, command });
|
|
@@ -4134,8 +4399,8 @@ var init_manager2 = __esm(() => {
|
|
|
4134
4399
|
|
|
4135
4400
|
// src/cli.ts
|
|
4136
4401
|
init_src();
|
|
4137
|
-
import
|
|
4138
|
-
|
|
4402
|
+
import process25 from "process";
|
|
4403
|
+
process25.exitCode = await runCli({
|
|
4139
4404
|
name: "pkg",
|
|
4140
4405
|
about: "checks npm packages before they are added, and moves a lib's consumers onto a new release",
|
|
4141
4406
|
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.1",
|
|
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.46.0"
|
|
37
37
|
}
|
|
38
38
|
}
|