@kaynooo/cli-probe 0.4.2 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/probe.js +348 -155
  2. package/package.json +5 -5
package/dist/probe.js CHANGED
@@ -1,21 +1,19 @@
1
1
  #!/usr/bin/env -S bun --no-env-file --config=/dev/null
2
2
  // @bun
3
+ var __esm = (fn, res, err) => () => {
4
+ if (fn)
5
+ try {
6
+ res = fn(fn = 0);
7
+ } catch (e) {
8
+ err = [e];
9
+ }
10
+ if (err)
11
+ throw err[0];
12
+ return res;
13
+ };
3
14
 
4
- // src/probe.ts
5
- import { isIP as isIP2 } from "net";
6
- import process15 from "process";
7
- // ../kit/src/args.ts
8
- import process9 from "process";
9
- import { parseArgs } from "util";
10
-
11
- // ../kit/src/format.ts
12
- import process7 from "process";
13
-
14
- // ../../node_modules/.bun/@kaynooo+utils@3.0.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/chunk-rxztfxgv.js
15
- var N = new Map;
16
- var Nt = /\s+\S*$/;
17
- var Y = /\s/;
18
- function ko(t, e, r = "...") {
15
+ // ../../node_modules/.bun/@kaynooo+utils@3.1.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/chunk-rkhsft4a.js
16
+ function Ao(t, e, r = "...") {
19
17
  let { suffix: n = "...", includeSuffix: s = false, wordBoundary: o = false } = typeof r === "string" ? { suffix: r } : r;
20
18
  if (t.length <= e)
21
19
  return t;
@@ -26,13 +24,22 @@ function ko(t, e, r = "...") {
26
24
  c = c.trimEnd();
27
25
  return s ? (c + n).slice(0, l) : c + n;
28
26
  }
29
- var 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));
30
- var z = new Map;
27
+ var N, Nt, Y, be, W;
28
+ var init_chunk_rkhsft4a = __esm(() => {
29
+ N = new Map;
30
+ Nt = /\s+\S*$/;
31
+ Y = /\s/;
32
+ 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));
33
+ W = new Map;
34
+ });
35
+
36
+ // ../../node_modules/.bun/@kaynooo+utils@3.1.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/text.js
37
+ var init_text = __esm(() => {
38
+ init_chunk_rkhsft4a();
39
+ });
31
40
 
32
41
  // ../kit/src/mode.ts
33
42
  import process2 from "process";
34
- var MODES = new Set(["terminal", "ci", "agent", "pipe"]);
35
- var AGENT_VARIABLES = ["CLAUDECODE", "AI_AGENT"];
36
43
  function isSet(value) {
37
44
  return value !== undefined && value !== "" && value !== "0" && value.toLowerCase() !== "false";
38
45
  }
@@ -46,12 +53,13 @@ function outputMode(stream = process2.stdout, env = process2.env) {
46
53
  return "terminal";
47
54
  return isSet(env.CI) ? "ci" : "pipe";
48
55
  }
56
+ var MODES, AGENT_VARIABLES;
57
+ var init_mode = __esm(() => {
58
+ MODES = new Set(["terminal", "ci", "agent", "pipe"]);
59
+ AGENT_VARIABLES = ["CLAUDECODE", "AI_AGENT"];
60
+ });
49
61
 
50
- // ../kit/src/style.ts
51
- import process6 from "process";
52
-
53
- // ../../node_modules/.bun/@kaynooo+utils@3.0.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/chunk-x450vn3m.js
54
- var G2 = /^[a-f0-9]+$/i;
62
+ // ../../node_modules/.bun/@kaynooo+utils@3.1.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/chunk-x450vn3m.js
55
63
  function b(r) {
56
64
  let e = r.startsWith("#") ? r.slice(1) : r;
57
65
  if (!G2.test(e))
@@ -62,11 +70,6 @@ function b(r) {
62
70
  throw Error(`Invalid hex color length: ${e.length}`);
63
71
  return [Number.parseInt(e.slice(0, 2), 16), Number.parseInt(e.slice(2, 4), 16), Number.parseInt(e.slice(4, 6), 16)];
64
72
  }
65
- var B2 = { 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") => {
66
- let [l, n, c] = b(r);
67
- return [`${e === "fg" ? 38 : 48};2;${l};${n};${c}`, e === "fg" ? 39 : 49];
68
- }, ansi256: (r, e = "fg") => [`${e === "fg" ? 38 : 48};5;${r}`, e === "fg" ? 39 : 49] };
69
- var h = new Set(["", "1", "2", "3", "true"]);
70
73
  function C(r, e = globalThis.process?.env ?? {}) {
71
74
  if (e.FORCE_COLOR !== undefined)
72
75
  return h.has(e.FORCE_COLOR);
@@ -80,7 +83,7 @@ function f(r, e = []) {
80
83
  l += `\x1B[${e[t][0]}m`, n = `\x1B[${e[t][1]}m${n}`;
81
84
  let c = (t) => C(r.stream ?? globalThis.process?.stdout, r.env) ? l + t + n : t, g = new Map;
82
85
  return new Proxy(c, { get(t, i) {
83
- let a = B2[i];
86
+ let a = B[i];
84
87
  if (Array.isArray(a)) {
85
88
  let s = g.get(i);
86
89
  if (s === undefined)
@@ -103,13 +106,21 @@ function f(r, e = []) {
103
106
  function Fe(r = {}) {
104
107
  return f(r);
105
108
  }
106
- var o = Fe();
109
+ var G2, B, h, o;
110
+ var init_chunk_x450vn3m = __esm(() => {
111
+ G2 = /^[a-f0-9]+$/i;
112
+ 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") => {
113
+ let [l, n, c] = b(r);
114
+ return [`${e === "fg" ? 38 : 48};2;${l};${n};${c}`, e === "fg" ? 39 : 49];
115
+ }, ansi256: (r, e = "fg") => [`${e === "fg" ? 38 : 48};5;${r}`, e === "fg" ? 39 : 49] };
116
+ h = new Set(["", "1", "2", "3", "true"]);
117
+ o = Fe();
118
+ });
107
119
 
108
- // ../kit/src/theme.ts
109
- import { existsSync as existsSync2, readFileSync, statSync } from "fs";
110
- import { homedir as homedir2 } from "os";
111
- import { join as join3, resolve as resolve2 } from "path";
112
- import process5 from "process";
120
+ // ../../node_modules/.bun/@kaynooo+utils@3.1.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/tools/colors.js
121
+ var init_colors = __esm(() => {
122
+ init_chunk_x450vn3m();
123
+ });
113
124
 
114
125
  // ../kit/src/config.ts
115
126
  import { existsSync } from "fs";
@@ -125,6 +136,9 @@ function findUp(names, from = process3.cwd(), stop = () => false) {
125
136
  return;
126
137
  }
127
138
  }
139
+ var init_config = __esm(() => {
140
+ init_args();
141
+ });
128
142
 
129
143
  // ../kit/src/user-config.ts
130
144
  import { homedir } from "os";
@@ -137,36 +151,18 @@ function configBase(where = {}) {
137
151
  function userConfigPath(bin, where = {}) {
138
152
  return join2(configBase(where), "kaynooo-cli", `${bin}.json`);
139
153
  }
154
+ var init_user_config = () => {};
140
155
 
141
156
  // ../kit/src/theme.ts
142
- var ENDS = new Map;
143
- var DEFAULT = {
144
- colors: { accent: "cyan", id: "yellow", path: "blue", label: "dim", value: "bold", ok: "green", warn: "yellow", problem: "red", note: "dim", plan: "magenta", passed: "green", failed: "red", running: "cyan", queued: "yellow", skipped: "dim" },
145
- glyphs: { ok: "\u2713", warn: "\u25B2", problem: "\u2717", note: "\u203A", plan: "\u25C7", passed: "\u2713", failed: "\u2717", running: "\u25CF", queued: "\u25CB", skipped: "-", bar: "\u2501", rule: "\u2500", corner: "\u256D", open: "\u2022", leaf: "\xB7", guide: "\u2502" },
146
- accents: ["cyan", "magenta", "green", "blue", "yellow", "redBright"],
147
- bins: {},
148
- gradient: ["#c084fc", "#67e8f9"]
149
- };
150
- var BRIGHT = { accent: "cyanBright", id: "yellowBright", path: "blueBright", label: "white", value: "bold whiteBright", ok: "greenBright", warn: "yellowBright", problem: "redBright", note: "white", plan: "magentaBright", passed: "greenBright", failed: "redBright", running: "cyanBright", queued: "yellowBright", skipped: "white" };
151
- var MONO = { accent: "bold", id: "bold", path: "underline", label: "dim", value: "bold", ok: "bold", warn: "bold", problem: "bold", note: "dim", plan: "dim", passed: "bold", failed: "bold", running: "bold", queued: "dim", skipped: "dim" };
152
- var ASCII = { ok: "+", warn: "!", problem: "x", note: ">", plan: "?", passed: "+", failed: "x", running: "*", queued: "o", skipped: "-", bar: "#", rule: "-", corner: "+", open: "*", leaf: "-", guide: "|" };
153
- var PRESETS = {
154
- default: {},
155
- "high-contrast": { colors: BRIGHT, accents: ["cyanBright", "magentaBright", "greenBright", "blueBright", "yellowBright", "redBright"], gradient: ["#d8b4fe", "#a5f3fc"] },
156
- mono: { colors: MONO, accents: ["bold"], gradient: undefined },
157
- ascii: { glyphs: ASCII }
158
- };
159
- var STYLES = new Set(["bold", "dim", "italic", "underline", "inverse", "strikethrough", "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white", "gray", "grey", "blackBright", "redBright", "greenBright", "yellowBright", "blueBright", "magentaBright", "cyanBright", "whiteBright"]);
160
- var HEX = /^#[0-9a-f]{6}$/i;
161
- var CONTROL = /\p{Cc}/u;
162
- var MAX_FILE_BYTES = 64 * 1024;
163
- var SPACES = /\s+/;
157
+ import { existsSync as existsSync2, readFileSync, statSync } from "fs";
158
+ import { homedir as homedir2 } from "os";
159
+ import { join as join3, resolve as resolve2 } from "path";
160
+ import process5 from "process";
164
161
  function isColorSpec(spec) {
165
162
  if (typeof spec === "number")
166
163
  return Number.isInteger(spec) && spec >= 0 && spec <= 255;
167
164
  return typeof spec === "string" && spec.trim() !== "" && spec.trim().split(SPACES).every((token) => STYLES.has(token) || HEX.test(token));
168
165
  }
169
- var CUBE = [0, 95, 135, 175, 215, 255];
170
166
  function cubeLevel(channel) {
171
167
  return CUBE.reduce((best, value, level) => Math.abs(value - channel) < Math.abs(CUBE[best] - channel) ? level : best, 0);
172
168
  }
@@ -271,7 +267,6 @@ function applyFile(theme, file, where, warn) {
271
267
  function endsWalk(home) {
272
268
  return (dir) => dir === resolve2(home) || existsSync2(join3(dir, ".git"));
273
269
  }
274
- var warned = new Set;
275
270
  function warnOnce(message) {
276
271
  if (warned.has(message))
277
272
  return;
@@ -308,8 +303,6 @@ function loadTheme({ env = process5.env, from = process5.cwd(), home = homedir2(
308
303
  }
309
304
  return { theme, sources, preset };
310
305
  }
311
- var current;
312
- var currentKey = "";
313
306
  function activeTheme() {
314
307
  const key = `${process5.cwd()}\x00${process5.env.KIT_THEME ?? ""}\x00${process5.env.XDG_CONFIG_HOME ?? ""}`;
315
308
  if (current === undefined || key !== currentKey) {
@@ -318,9 +311,38 @@ function activeTheme() {
318
311
  }
319
312
  return current;
320
313
  }
314
+ var ENDS, DEFAULT, BRIGHT, MONO, ASCII, PRESETS, STYLES, HEX, CONTROL, MAX_FILE_BYTES, SPACES, CUBE, warned, current, currentKey = "";
315
+ var init_theme = __esm(() => {
316
+ init_config();
317
+ init_user_config();
318
+ ENDS = new Map;
319
+ DEFAULT = {
320
+ colors: { accent: "cyan", id: "yellow", path: "blue", label: "dim", value: "bold", ok: "green", warn: "yellow", problem: "red", note: "dim", plan: "magenta", passed: "green", failed: "red", running: "cyan", queued: "yellow", skipped: "dim" },
321
+ glyphs: { ok: "\u2713", warn: "\u25B2", problem: "\u2717", note: "\u203A", plan: "\u25C7", passed: "\u2713", failed: "\u2717", running: "\u25CF", queued: "\u25CB", skipped: "-", bar: "\u2501", rule: "\u2500", corner: "\u256D", open: "\u2022", leaf: "\xB7", guide: "\u2502" },
322
+ accents: ["cyan", "magenta", "green", "blue", "yellow", "redBright"],
323
+ bins: {},
324
+ gradient: ["#c084fc", "#67e8f9"]
325
+ };
326
+ BRIGHT = { accent: "cyanBright", id: "yellowBright", path: "blueBright", label: "white", value: "bold whiteBright", ok: "greenBright", warn: "yellowBright", problem: "redBright", note: "white", plan: "magentaBright", passed: "greenBright", failed: "redBright", running: "cyanBright", queued: "yellowBright", skipped: "white" };
327
+ MONO = { accent: "bold", id: "bold", path: "underline", label: "dim", value: "bold", ok: "bold", warn: "bold", problem: "bold", note: "dim", plan: "dim", passed: "bold", failed: "bold", running: "bold", queued: "dim", skipped: "dim" };
328
+ ASCII = { ok: "+", warn: "!", problem: "x", note: ">", plan: "?", passed: "+", failed: "x", running: "*", queued: "o", skipped: "-", bar: "#", rule: "-", corner: "+", open: "*", leaf: "-", guide: "|" };
329
+ PRESETS = {
330
+ default: {},
331
+ "high-contrast": { colors: BRIGHT, accents: ["cyanBright", "magentaBright", "greenBright", "blueBright", "yellowBright", "redBright"], gradient: ["#d8b4fe", "#a5f3fc"] },
332
+ mono: { colors: MONO, accents: ["bold"], gradient: undefined },
333
+ ascii: { glyphs: ASCII }
334
+ };
335
+ STYLES = new Set(["bold", "dim", "italic", "underline", "inverse", "strikethrough", "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white", "gray", "grey", "blackBright", "redBright", "greenBright", "yellowBright", "blueBright", "magentaBright", "cyanBright", "whiteBright"]);
336
+ HEX = /^#[0-9a-f]{6}$/i;
337
+ CONTROL = /\p{Cc}/u;
338
+ MAX_FILE_BYTES = 64 * 1024;
339
+ SPACES = /\s+/;
340
+ CUBE = [0, 95, 135, 175, 215, 255];
341
+ warned = new Set;
342
+ });
321
343
 
322
344
  // ../kit/src/style.ts
323
- var MARK_WORDS = { ok: "ok:", warn: "warning:", problem: "error:", note: "note:", plan: "would:" };
345
+ import process6 from "process";
324
346
  function takesControlCodes(stream, env = process6.env) {
325
347
  return stream.isTTY === true && env.NO_COLOR === undefined && env.NODE_DISABLE_COLORS === undefined && env.TERM !== "dumb" && outputMode(stream, env) === "terminal";
326
348
  }
@@ -340,17 +362,24 @@ function role(name, stream, env = process6.env) {
340
362
  const colors = paint(stream, env);
341
363
  return takesControlCodes(stream, env) ? tinted(colors, activeTheme().theme.colors[name], env) : colors;
342
364
  }
343
- var STATUS_WORDS = {
344
- passed: ["passed", "success", "succeeded", "ok"],
345
- failed: ["failed", "failure", "error", "errored"],
346
- running: ["running", "in_progress", "started", "holding"],
347
- queued: ["queued", "waiting", "pending", "created", "blocked", "scheduled"],
348
- skipped: ["skipped", "cancelled", "canceled", "manual"]
349
- };
350
- var STATUS_OF = new Map(Object.entries(STATUS_WORDS).flatMap(([status, words]) => words.map((word) => [word, status])));
365
+ var MARK_WORDS, STATUS_WORDS, STATUS_OF;
366
+ var init_style = __esm(() => {
367
+ init_colors();
368
+ init_mode();
369
+ init_theme();
370
+ MARK_WORDS = { ok: "ok:", warn: "warning:", problem: "error:", note: "note:", plan: "would:" };
371
+ STATUS_WORDS = {
372
+ passed: ["passed", "success", "succeeded", "ok"],
373
+ failed: ["failed", "failure", "error", "errored"],
374
+ running: ["running", "in_progress", "started", "holding"],
375
+ queued: ["queued", "waiting", "pending", "created", "blocked", "scheduled"],
376
+ skipped: ["skipped", "cancelled", "canceled", "manual"]
377
+ };
378
+ STATUS_OF = new Map(Object.entries(STATUS_WORDS).flatMap(([status, words]) => words.map((word) => [word, status])));
379
+ });
351
380
 
352
381
  // ../kit/src/format.ts
353
- var UNITS = [["d", 86400], ["h", 3600], ["m", 60], ["s", 1]];
382
+ import process7 from "process";
354
383
  function formatSeconds(total) {
355
384
  let rest = Math.max(0, Math.round(total));
356
385
  const amounts = UNITS.map(([unit, size]) => {
@@ -372,10 +401,8 @@ function upTo(text, separator) {
372
401
  return end === -1 ? text : text.slice(0, end);
373
402
  }
374
403
  function truncate(text, width) {
375
- return ko(text, width, { suffix: "\u2026", includeSuffix: true });
404
+ return Ao(text, width, { suffix: "\u2026", includeSuffix: true });
376
405
  }
377
- var LINE_BREAKS = /\s*\n\s*/g;
378
- var ESCAPE = String.fromCharCode(27);
379
406
  function textWidth(text) {
380
407
  return Bun.stringWidth(text);
381
408
  }
@@ -424,14 +451,40 @@ function jsonText(value, replacer, { stream = process7.stdout, env = process7.en
424
451
  function printJson(value) {
425
452
  console.log(jsonText(value));
426
453
  }
454
+ var UNITS, LINE_BREAKS, ESCAPE;
455
+ var init_format = __esm(() => {
456
+ init_text();
457
+ init_mode();
458
+ init_style();
459
+ UNITS = [["d", 86400], ["h", 3600], ["m", 60], ["s", 1]];
460
+ LINE_BREAKS = /\s*\n\s*/g;
461
+ ESCAPE = String.fromCharCode(27);
462
+ });
427
463
 
428
464
  // ../kit/src/help.ts
429
465
  import process8 from "process";
430
- var OPTIONAL = /(?<!\x1B)\[[^\]]+\]/g;
431
- var USAGE_PREFIX = /^usage:\s*/i;
432
- var FULL_STOP = /\.$/;
433
466
  function usageLine(usage, colors = paint(process8.stdout)) {
434
- return `${colors.bold("Usage:")} ${usage.replace(USAGE_PREFIX, "").replaceAll(OPTIONAL, (part) => colors.dim(part))}`;
467
+ const lines = usage.replace(USAGE_PREFIX, "").split(`
468
+ `);
469
+ const blank = lines.indexOf("");
470
+ const synopses = blank === -1 ? lines : lines.slice(0, blank);
471
+ const details = blank === -1 ? [] : lines.slice(blank + 1);
472
+ const colon = synopses[0].indexOf(": ");
473
+ const inline = synopses[0].slice(colon + 2);
474
+ const summary = colon === -1 ? details.shift() : `${inline.charAt(0).toUpperCase()}${inline.slice(1)}`;
475
+ if (colon !== -1)
476
+ synopses[0] = synopses[0].slice(0, colon);
477
+ const head = `${colors.bold("Usage:")} ${synopses.map((line) => line.replaceAll(OPTIONAL, (part) => colors.dim(part))).join(`
478
+ `)}`;
479
+ const lead = summary === undefined ? [] : ["", colors.bold(prose(summary, colors))];
480
+ const rest = details.length === 0 ? [] : ["", ...details.map((line) => prose(line, colors))];
481
+ return [head, ...lead, ...rest].join(`
482
+ `);
483
+ }
484
+ function prose(line, colors) {
485
+ if (colors.cyan("x") === "x")
486
+ return line;
487
+ return line.replaceAll(PROSE_MARKS, (match, code, flag) => code === undefined ? colors.cyan(flag ?? match) : colors.bold(code));
435
488
  }
436
489
  function helpText(usage, options, colors = paint(process8.stdout), { examples = [], exits = [] } = {}) {
437
490
  return [usageLine(usage, colors), "", colors.bold("Options:"), ...optionRows(options, colors), ...exitRows(exits, colors), ...exampleRows(examples, colors)].join(`
@@ -466,7 +519,6 @@ function exampleRows(examples, colors = paint(process8.stdout)) {
466
519
  return [];
467
520
  return ["", colors.bold("Examples:"), ...examples.map((example) => typeof example === "string" ? ` ${example}` : ` ${example[0]} ${colors.dim(`# ${example[1]}`)}`)];
468
521
  }
469
- var MAX_INLINE_CHOICES = 24;
470
522
  function optionRows(options, colors = paint(process8.stdout)) {
471
523
  const rows = Object.entries(options).map(([name, option]) => {
472
524
  const short = option.short === undefined ? " " : `${colors.cyan(`-${option.short}`)}, `;
@@ -481,6 +533,15 @@ function optionRows(options, colors = paint(process8.stdout)) {
481
533
  const width = Math.max(0, ...rows.map((row) => row.width));
482
534
  return rows.map((row) => row.description === "" ? ` ${row.flag}` : ` ${row.flag}${" ".repeat(width - row.width)} ${colors.dim(row.description)}`);
483
535
  }
536
+ var OPTIONAL, USAGE_PREFIX, FULL_STOP, PROSE_MARKS, MAX_INLINE_CHOICES = 24;
537
+ var init_help = __esm(() => {
538
+ init_mode();
539
+ init_style();
540
+ OPTIONAL = /(?<!\x1B)\[[^\]]+\]/g;
541
+ USAGE_PREFIX = /^usage:\s*/i;
542
+ FULL_STOP = /\.$/;
543
+ PROSE_MARKS = /`([^`\n]+)`|(?<![\w-])(--[a-z][\w-]*|-[a-z](?![\w-]))/gi;
544
+ });
484
545
 
485
546
  // ../kit/src/text.ts
486
547
  function distance(a, b) {
@@ -508,9 +569,9 @@ function closest(name, names) {
508
569
  const [best] = names.map((known) => ({ known, far: distance(name, known) })).sort((a, b) => a.far - b.far);
509
570
  return best !== undefined && best.far <= (name.length < 4 ? 1 : 2) ? best.known : undefined;
510
571
  }
572
+ var init_text2 = () => {};
573
+
511
574
  // ../kit/src/input.ts
512
- var DURATION = /^(\d+(?:\.\d+)?)(ms|[smhd])?$/;
513
- var UNIT_MS = { ms: 1, s: 1000, m: 60000, h: 3600000, d: 86400000 };
514
575
  function duration(value, name, fallback, unit = "s") {
515
576
  if (value === undefined)
516
577
  return fallback;
@@ -520,40 +581,26 @@ function duration(value, name, fallback, unit = "s") {
520
581
  badUsage(`--${name} takes a duration such as 30s, 5m, 1h or 7d, not ${value}`);
521
582
  return ms;
522
583
  }
584
+ var DURATION, UNIT_MS;
585
+ var init_input = __esm(() => {
586
+ init_args();
587
+ DURATION = /^(\d+(?:\.\d+)?)(ms|[smhd])?$/;
588
+ UNIT_MS = { ms: 1, s: 1000, m: 60000, h: 3600000, d: 86400000 };
589
+ });
523
590
 
524
591
  // ../kit/src/args.ts
525
- var DASHES = /^-+/;
592
+ import process9 from "process";
593
+ import { parseArgs } from "util";
526
594
  function jsonOption(holds) {
527
595
  return { type: "boolean", description: holds === undefined ? "print JSON" : `print JSON: ${holds}` };
528
596
  }
529
- class Exit extends Error {
530
- code;
531
- hint;
532
- constructor(message, code, hint) {
533
- super(message);
534
- this.code = code;
535
- this.hint = hint;
536
- }
537
- }
538
597
  function fail(message, code = 2, hint) {
539
598
  throw new Exit(message, code, hint);
540
599
  }
541
-
542
- class UsageError extends Exit {
543
- constructor(message, hint) {
544
- super(message, 2, hint);
545
- }
546
- }
547
600
  function badUsage(message) {
548
601
  throw new UsageError(message);
549
602
  }
550
603
 
551
- class HelpShown extends Exit {
552
- constructor() {
553
- super("help shown", 0);
554
- }
555
- }
556
-
557
604
  class Completing {
558
605
  options;
559
606
  positionals;
@@ -564,11 +611,6 @@ class Completing {
564
611
  this.candidates = candidates;
565
612
  }
566
613
  }
567
- var completion = { active: false };
568
- var OUTPUT_OPTIONS = {
569
- color: { type: "string", choices: ["auto", "always", "never"], description: "auto (the default) colours on a terminal alone" },
570
- plain: { type: "boolean", description: "plain text, no colour or spinner: --color never" }
571
- };
572
614
  function applyOutput(color, plain, env = process9.env) {
573
615
  const when = plain === true ? "never" : color ?? "auto";
574
616
  if (when === "auto")
@@ -722,7 +764,6 @@ function parseError(error) {
722
764
  const message = upTo(error instanceof Error ? error.message : String(error), ". ");
723
765
  return `${message.charAt(0).toLowerCase()}${message.slice(1)}`;
724
766
  }
725
- var UNKNOWN_OPTION = /^unknown option '(-[^']+)'/;
726
767
  function nearestOption(message, options, allowNegative) {
727
768
  const typed = UNKNOWN_OPTION.exec(message)?.[1];
728
769
  if (typed === undefined)
@@ -738,6 +779,62 @@ function nearestOption(message, options, allowNegative) {
738
779
  const meant = closest(word, known.map((flag) => flag.replace(DASHES, "")));
739
780
  return meant === undefined ? undefined : `did you mean ${known.find((flag) => flag.replace(DASHES, "") === meant)}?`;
740
781
  }
782
+ var DASHES, EXIT, Exit, UsageError, HelpShown, completion, OUTPUT_OPTIONS, UNKNOWN_OPTION;
783
+ var init_args = __esm(() => {
784
+ init_format();
785
+ init_help();
786
+ init_text2();
787
+ init_help();
788
+ init_input();
789
+ DASHES = /^-+/;
790
+ EXIT = Symbol.for("@kaynooo/cli-kit/Exit");
791
+ Exit = class Exit extends Error {
792
+ code;
793
+ hint;
794
+ [EXIT] = true;
795
+ constructor(message, code, hint) {
796
+ super(message);
797
+ this.code = code;
798
+ this.hint = hint;
799
+ }
800
+ static [Symbol.hasInstance](value) {
801
+ if (this !== Exit)
802
+ return Function.prototype[Symbol.hasInstance].call(this, value);
803
+ return typeof value === "object" && value !== null && value[EXIT] === true;
804
+ }
805
+ };
806
+ UsageError = class UsageError extends Exit {
807
+ constructor(message, hint) {
808
+ super(message, 2, hint);
809
+ }
810
+ };
811
+ HelpShown = class HelpShown extends Exit {
812
+ constructor() {
813
+ super("help shown", 0);
814
+ }
815
+ };
816
+ completion = { active: false };
817
+ OUTPUT_OPTIONS = {
818
+ color: { type: "string", choices: ["auto", "always", "never"], description: "auto (the default) colours on a terminal alone" },
819
+ plain: { type: "boolean", description: "plain text, no colour or spinner: --color never" }
820
+ };
821
+ UNKNOWN_OPTION = /^unknown option '(-[^']+)'/;
822
+ });
823
+
824
+ // ../kit/src/folders.ts
825
+ var SKIPPED_FOLDERS;
826
+ var init_folders = __esm(() => {
827
+ init_user_config();
828
+ SKIPPED_FOLDERS = new Set(["node_modules", "vendor", "dist", "build", "target", "coverage", "venv", "__pycache__"]);
829
+ });
830
+
831
+ // src/probe.ts
832
+ import { isIP as isIP2 } from "net";
833
+ import process16 from "process";
834
+
835
+ // ../kit/src/index.ts
836
+ init_args();
837
+
741
838
  // ../kit/src/argv.ts
742
839
  import { readFileSync as readFileSync2, realpathSync } from "fs";
743
840
  import { resolve as resolve3 } from "path";
@@ -762,15 +859,73 @@ function scriptArgs(argv = process10.argv.slice(2), cmdline = commandLine(), scr
762
859
  const after = at === -1 ? [] : cmdline.slice(at + 1);
763
860
  return after[0] === "--" && after.length === argv.length + 1 && argv.every((word, index) => word === after[index + 1]) ? after : argv;
764
861
  }
862
+ // ../kit/src/chart.ts
863
+ init_format();
864
+ init_mode();
865
+ init_style();
866
+ init_theme();
867
+ // ../kit/src/ci.ts
868
+ init_args();
869
+ init_format();
870
+
765
871
  // ../kit/src/progress.ts
872
+ init_format();
873
+ init_style();
874
+ init_theme();
766
875
  var ESC = String.fromCharCode(27);
767
876
  var ESCAPE_CODE = new RegExp(`${ESC}(?:\\[[\\x30-\\x3F]*[\\x20-\\x2F]*[\\x40-\\x7E]|\\][^\\u0007${ESC}]*(?:\\u0007|${ESC}\\\\))`, "y");
768
877
  var RESET_STYLE = `${ESC}[0m`;
769
878
  var CLOSE_LINK = `${ESC}]8;;${ESC}\\`;
879
+
880
+ // ../kit/src/ci.ts
881
+ init_style();
882
+
883
+ // ../kit/src/tool.ts
884
+ init_format();
770
885
  // ../kit/src/cli.ts
886
+ init_args();
771
887
  import { readFileSync as readFileSync3, realpathSync as realpathSync2 } from "fs";
772
888
  import { dirname as dirname3, join as join5 } from "path";
773
- import process13 from "process";
889
+ import process14 from "process";
890
+
891
+ // ../kit/src/askpass.ts
892
+ import process11 from "process";
893
+ var SOCKET_VARIABLE = "KAYNOOO_ASKPASS_SOCKET";
894
+ async function askpassClient(argv) {
895
+ const socketPath = process11.env[SOCKET_VARIABLE];
896
+ if (socketPath === undefined)
897
+ return;
898
+ const request = { prompt: argv[0] ?? "", ...process11.env.SSH_ASKPASS_PROMPT === "none" ? { notice: true } : {} };
899
+ const { promise, resolve } = Promise.withResolvers();
900
+ let received = "";
901
+ try {
902
+ await Bun.connect({
903
+ unix: socketPath,
904
+ socket: {
905
+ open: (socket) => void socket.write(`${JSON.stringify(request)}
906
+ `),
907
+ data: (_, chunk) => {
908
+ received += chunk.toString();
909
+ },
910
+ close: () => resolve(received),
911
+ error: () => resolve("")
912
+ }
913
+ });
914
+ } catch {
915
+ return 1;
916
+ }
917
+ const reply = await promise;
918
+ if (reply === "")
919
+ return 1;
920
+ const { answer } = JSON.parse(reply);
921
+ if (request.notice === true)
922
+ return 0;
923
+ if (answer === undefined)
924
+ return 1;
925
+ process11.stdout.write(`${answer}
926
+ `);
927
+ return 0;
928
+ }
774
929
 
775
930
  // ../kit/src/completions.ts
776
931
  var COMPLETION_SHELLS = ["fish", "bash", "zsh"];
@@ -833,28 +988,34 @@ compdef __kaynooo_cli_complete ${bins.join(" ")}
833
988
  }
834
989
 
835
990
  // ../kit/src/notify.ts
836
- import process11 from "process";
991
+ init_format();
992
+ init_mode();
993
+ import process12 from "process";
837
994
  var NOTIFY_AFTER_MS = 1e4;
838
995
  var CANCELLED = 130;
839
996
  function base64(text) {
840
997
  return Buffer.from(text).toString("base64");
841
998
  }
842
- function notification(title, body, env = process11.env) {
843
- const id = `kit${process11.pid}`;
999
+ function notification(title, body, env = process12.env) {
1000
+ const id = `kit${process12.pid}`;
844
1001
  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\\`];
845
1002
  return codes.map((code) => env.TMUX === undefined || env.TMUX === "" ? code : `\x1BPtmux;${code.replaceAll("\x1B", "\x1B\x1B")}\x1B\\`).join("");
846
1003
  }
847
- function notifyEnd(command, code, ms, { stream = process11.stderr, env = process11.env } = {}) {
1004
+ function notifyEnd(command, code, ms, { stream = process12.stderr, env = process12.env } = {}) {
848
1005
  if (ms < NOTIFY_AFTER_MS || code === CANCELLED || outputMode(stream, env) !== "terminal")
849
1006
  return;
850
1007
  stream.write(notification(command, code === 0 ? `done in ${formatDuration(ms)}` : `failed with exit ${code} after ${formatDuration(ms)}`, env));
851
1008
  }
852
1009
 
1010
+ // ../kit/src/cli.ts
1011
+ init_style();
1012
+ init_text2();
1013
+
853
1014
  // ../kit/src/usage.ts
854
1015
  import { appendFileSync, mkdirSync } from "fs";
855
1016
  import { homedir as homedir3 } from "os";
856
1017
  import { dirname as dirname2, isAbsolute, join as join4 } from "path";
857
- import process12 from "process";
1018
+ import process13 from "process";
858
1019
 
859
1020
  // ../kit/src/logs.ts
860
1021
  var DAY_MS = 24 * 60 * 60 * 1000;
@@ -868,14 +1029,14 @@ var usageError;
868
1029
  function noteUsageError(message) {
869
1030
  usageError = message;
870
1031
  }
871
- function stateHome(env = process12.env) {
1032
+ function stateHome(env = process13.env) {
872
1033
  const dir = env.XDG_STATE_HOME;
873
1034
  return dir !== undefined && isAbsolute(dir) ? dir : join4(homedir3(), ".local", "state");
874
1035
  }
875
- function usagePath(env = process12.env) {
1036
+ function usagePath(env = process13.env) {
876
1037
  return join4(stateHome(env), CLI_FOLDER, "usage.jsonl");
877
1038
  }
878
- function usageRecorded(env = process12.env) {
1039
+ function usageRecorded(env = process13.env) {
879
1040
  const off = env.KAYNOOO_CLI_NO_USAGE;
880
1041
  return env.NODE_ENV !== "test" && (off === undefined || off === "" || off === "0");
881
1042
  }
@@ -884,12 +1045,12 @@ function flagNames(argv) {
884
1045
  const names = (end === -1 ? argv : argv.slice(0, end)).filter((word) => word.startsWith("-") && word !== "-").map((word) => word.includes("=") ? word.slice(0, word.indexOf("=")) : word);
885
1046
  return [...new Set(names)].filter((name) => name.length <= LONGEST_NAME && FLAG_NAME.test(name));
886
1047
  }
887
- function usageEntry(bin, command, argv, code, now = new Date) {
1048
+ function usageEntry(bin, command, argv, code, { ms, now = new Date } = {}) {
888
1049
  const unknown = code === 2 && usageError !== undefined ? UNKNOWN_OPTION2.exec(usageError)?.[1] : undefined;
889
1050
  usageError = undefined;
890
- return { at: now.toISOString(), bin, ...command === undefined ? {} : { command }, flags: flagNames(argv), code, ...unknown === undefined ? {} : { unknown } };
1051
+ return { at: now.toISOString(), bin, ...command === undefined ? {} : { command }, flags: flagNames(argv), code, ...unknown === undefined ? {} : { unknown }, ...ms === undefined ? {} : { ms: Math.round(ms) } };
891
1052
  }
892
- function recordUsage(entry, env = process12.env) {
1053
+ function recordUsage(entry, env = process13.env) {
893
1054
  if (!usageRecorded(env))
894
1055
  return;
895
1056
  try {
@@ -911,8 +1072,8 @@ var TOP_OPTIONS = {
911
1072
  completions: { type: "string", choices: COMPLETION_SHELLS, description: "print the shell completion script" }
912
1073
  };
913
1074
  function printError(prefix, message, hint, cause) {
914
- const colors = paint(process13.stderr);
915
- const styled = takesControlCodes(process13.stderr);
1075
+ const colors = paint(process14.stderr);
1076
+ const styled = takesControlCodes(process14.stderr);
916
1077
  const head = styled ? `${colors.red.bold("error")} ${colors.dim(`${prefix}:`)}` : `error: ${prefix}:`;
917
1078
  const under = (label, text, tint) => text === undefined ? "" : `
918
1079
  ${styled ? tint(label) : `${label}:`} ${text}`;
@@ -1023,6 +1184,9 @@ function packageVersion(entry = Bun.main) {
1023
1184
  }
1024
1185
  }
1025
1186
  async function runMain({ name, version, run, redact, usage }, argv = scriptArgs()) {
1187
+ const answered = await askpassClient(argv);
1188
+ if (answered !== undefined)
1189
+ return answered;
1026
1190
  if (argv[0] === COMPLETE)
1027
1191
  return printCandidates(leafCandidates(run, argv.slice(1)));
1028
1192
  if (argv[0] === COMPLETIONS || argv[0]?.startsWith(`${COMPLETIONS}=`) === true)
@@ -1041,19 +1205,52 @@ async function runMain({ name, version, run, redact, usage }, argv = scriptArgs(
1041
1205
  notifyEnd(name, code, performance.now() - started);
1042
1206
  if (usage !== false) {
1043
1207
  try {
1044
- recordUsage(usageEntry(name, undefined, argv, code));
1208
+ recordUsage(usageEntry(name, undefined, argv, code, { ms: performance.now() - started }));
1045
1209
  } catch {}
1046
1210
  }
1047
1211
  return code;
1048
1212
  }
1049
- // ../kit/src/folders.ts
1050
- var SKIPPED_FOLDERS = new Set(["node_modules", "vendor", "dist", "build", "target", "coverage", "venv", "__pycache__"]);
1213
+
1214
+ // ../kit/src/index.ts
1215
+ init_config();
1216
+
1217
+ // ../kit/src/excerpt.ts
1218
+ init_text2();
1219
+
1220
+ // ../kit/src/index.ts
1221
+ init_folders();
1222
+ init_format();
1223
+
1224
+ // ../kit/src/git.ts
1225
+ init_args();
1226
+ // ../kit/src/limit.ts
1227
+ init_args();
1228
+
1229
+ // ../kit/src/index.ts
1230
+ init_mode();
1231
+
1232
+ // ../kit/src/report.ts
1233
+ init_style();
1234
+ init_text2();
1051
1235
  // ../kit/src/secrets.ts
1052
1236
  var SECRET_WORDS = new Set(["key", "pass", "pwd", "auth", "salt", "cookie", "session", "jwt", "ssn", "iban", "card", "cvv", "otp"]);
1053
1237
  // ../kit/src/sessions.ts
1054
1238
  var {Glob } = globalThis.Bun;
1055
1239
  var SESSION_FILES = new Glob("*.json");
1056
1240
  var ACCOUNT_DIRS = new Glob("*/sessions");
1241
+
1242
+ // ../kit/src/index.ts
1243
+ init_style();
1244
+ init_text2();
1245
+ init_theme();
1246
+ init_user_config();
1247
+
1248
+ // ../kit/src/watch.ts
1249
+ init_args();
1250
+ init_input();
1251
+ init_style();
1252
+ // ../kit/src/workspace-root.ts
1253
+ init_user_config();
1057
1254
  // src/analyze.ts
1058
1255
  var SOON_DAYS = 14;
1059
1256
  var MAX_HOPS = 10;
@@ -1560,14 +1757,10 @@ async function tlsInfo(host, port, { address, timeoutS = CONNECT_TIMEOUT } = {})
1560
1757
  var LABEL_WIDTH = 13;
1561
1758
  var USAGE = `probe [options] <url|domain>...: reports each site's negotiated HTTP version, redirect chain, timings, addresses, TLS and certificate, the headers worth knowing and what warrants a warning
1562
1759
 
1563
- By default one line per target: the HTTP version, status, final URL, total time, redirects, certificate expiry, first address and the warnings. --verbose prints the whole table.
1564
- A bare domain is tried over https first and over http when that fails. Redirects are followed hop by hop (at most ${MAX_HOPS}), each hop's status and HTTP version listed. HTTP/3 is spoken only when the installed curl lists it, otherwise it is reported from alt-svc. The certificate is read even when it is not trusted, and --insecure also lets curl go on with it.
1565
- -H adds a header to every request, --resolve host:ip reaches a host at that address instead of the DNS answer (the certificate and the Host header stay the host's), both repeatable.
1566
-
1567
- Warns on a certificate with fewer than 14 days left or not trusted, and on an http:// twin that does not redirect to https (checked for a bare domain or an https URL on the default port).
1568
-
1569
- --dns makes no HTTP request: it asks the system resolver, Cloudflare, Google, Quad9 and each nameserver of the host's zone for its A, AAAA and CNAME records with their TTL, and warns on a resolver answering otherwise than the zone's nameservers, a change not reached it yet.
1570
- --cors <origin> sends the preflight a browser on that origin would send before a --method request carrying --cors-headers, and says whether the browser would go on, with each reason when it would not.`;
1760
+ A bare domain is tried over https first, then http, and redirects are followed hop by hop (at most ${MAX_HOPS}).
1761
+ Warns on a certificate with fewer than 14 days left or not trusted, and on an http:// twin that does not redirect to https.
1762
+ --dns makes no HTTP request and compares the records the system resolver, public resolvers and the zone's nameservers give.
1763
+ --cors <origin> sends the preflight a browser on that origin would send and says whether it would go on, with each reason when not.`;
1571
1764
  var EXITS = [[0, "every site answered, warnings or not"], [1, "a site could not be reached, a CORS preflight was refused, or no resolver knows a name"], [2, "a usage error"]];
1572
1765
  var OPTIONS = {
1573
1766
  insecure: { type: "boolean", short: "k", description: "let curl go on with a certificate it does not trust" },
@@ -1661,9 +1854,9 @@ function ms2(value) {
1661
1854
  return `${value}ms`;
1662
1855
  }
1663
1856
  function compact(report) {
1664
- const { dim } = paint(process15.stdout);
1857
+ const { dim } = paint(process16.stdout);
1665
1858
  const redirects = report.chain.length - 1;
1666
- const parts = [`${role("accent", process15.stdout)(versionLabel(report.version))} ${role("value", process15.stdout)(String(report.status))} ${role("path", process15.stdout)(report.url)}`, ms2(report.timings.total)];
1859
+ const parts = [`${role("accent", process16.stdout)(versionLabel(report.version))} ${role("value", process16.stdout)(String(report.status))} ${role("path", process16.stdout)(report.url)}`, ms2(report.timings.total)];
1667
1860
  const address = report.addresses.a[0] ?? report.addresses.aaaa[0];
1668
1861
  if (redirects > 0)
1669
1862
  parts.push(`${redirects} ${redirects === 1 ? "redirect" : "redirects"}`);
@@ -1672,14 +1865,14 @@ function compact(report) {
1672
1865
  if (address !== undefined)
1673
1866
  parts.push(address);
1674
1867
  const line = parts.join(dim(" "));
1675
- return report.warnings.length === 0 ? line : `${line} ${marked("warn", report.warnings.join("; "), process15.stdout)}`;
1868
+ return report.warnings.length === 0 ? line : `${line} ${marked("warn", report.warnings.join("; "), process16.stdout)}`;
1676
1869
  }
1677
1870
  function print(report) {
1678
- const label = role("label", process15.stdout);
1679
- const value = role("value", process15.stdout);
1680
- const accent = role("accent", process15.stdout);
1871
+ const label = role("label", process16.stdout);
1872
+ const value = role("value", process16.stdout);
1873
+ const accent = role("accent", process16.stdout);
1681
1874
  const row = (name, text) => console.log(`${label(name.padEnd(LABEL_WIDTH))} ${text}`);
1682
- console.log(`${accent(versionLabel(report.version))} ${value(String(report.status))} ${role("path", process15.stdout)(report.url)}`);
1875
+ console.log(`${accent(versionLabel(report.version))} ${value(String(report.status))} ${role("path", process16.stdout)(report.url)}`);
1683
1876
  console.log("");
1684
1877
  if (report.chain.length > 1) {
1685
1878
  console.log(table(report.chain.map((hop) => [String(hop.status), versionLabel(hop.version), ms2(hop.ms), hop.url]), { align: ["right", "left", "right", "left"] }));
@@ -1704,12 +1897,12 @@ function print(report) {
1704
1897
  if (report.httpRedirect !== null)
1705
1898
  row("http://", report.httpRedirect.toHttps ? `redirects to https (${report.httpRedirect.status})` : `answers ${report.httpRedirect.status}`);
1706
1899
  for (const warning of report.warnings)
1707
- console.log(marked("warn", warning, process15.stdout));
1900
+ console.log(marked("warn", warning, process16.stdout));
1708
1901
  }
1709
1902
  function printDns(report) {
1710
- const label = role("label", process15.stdout);
1903
+ const label = role("label", process16.stdout);
1711
1904
  const listed = (values) => values.length === 0 ? "-" : values.join(" ");
1712
- console.log(`${role("path", process15.stdout)(report.target)} ${label(report.zone === null ? "no zone found" : `zone ${report.zone}`)}`);
1905
+ console.log(`${role("path", process16.stdout)(report.target)} ${label(report.zone === null ? "no zone found" : `zone ${report.zone}`)}`);
1713
1906
  console.log(table([
1714
1907
  ["RESOLVER", "SERVER", "A", "AAAA", "CNAME", "TTL"],
1715
1908
  ...report.answers.map((answer) => [
@@ -1720,9 +1913,9 @@ function printDns(report) {
1720
1913
  ])
1721
1914
  ], { header: true }));
1722
1915
  if (report.agree)
1723
- console.log(marked("ok", "every resolver gives the same answer", process15.stdout));
1916
+ console.log(marked("ok", "every resolver gives the same answer", process16.stdout));
1724
1917
  for (const warning of report.warnings)
1725
- console.log(marked("warn", warning, process15.stdout));
1918
+ console.log(marked("warn", warning, process16.stdout));
1726
1919
  }
1727
1920
  async function dnsMain(inputs, timeoutMs, json) {
1728
1921
  const hosts = inputs.map((input) => {
@@ -1747,16 +1940,16 @@ async function dnsMain(inputs, timeoutMs, json) {
1747
1940
  return reports.every(known) ? 0 : 1;
1748
1941
  }
1749
1942
  function printCors(report) {
1750
- const label = role("label", process15.stdout);
1943
+ const label = role("label", process16.stdout);
1751
1944
  const { request } = report;
1752
1945
  const asked = `from ${request.origin}, ${request.method}${request.headers.length === 0 ? "" : ` with ${request.headers.join(", ")}`}`;
1753
- console.log(`${marked(report.allowed ? "ok" : "problem", report.allowed ? "allowed" : "refused", process15.stdout)} ${role("value", process15.stdout)(String(report.status))} ${role("path", process15.stdout)(report.url)} ${label(asked)}`);
1946
+ console.log(`${marked(report.allowed ? "ok" : "problem", report.allowed ? "allowed" : "refused", process16.stdout)} ${role("value", process16.stdout)(String(report.status))} ${role("path", process16.stdout)(report.url)} ${label(asked)}`);
1754
1947
  for (const [name, value] of Object.entries(report.headers))
1755
1948
  console.log(` ${label(name)} ${value}`);
1756
1949
  for (const reason of report.reasons)
1757
- console.log(marked("problem", reason, process15.stdout));
1950
+ console.log(marked("problem", reason, process16.stdout));
1758
1951
  for (const warning of report.warnings)
1759
- console.log(marked("warn", warning, process15.stdout));
1952
+ console.log(marked("warn", warning, process16.stdout));
1760
1953
  }
1761
1954
  async function corsMain(targets, request, { insecure, wire }, json) {
1762
1955
  const reports = await Promise.all(targets.map(async ({ input, target }) => {
@@ -1773,7 +1966,7 @@ async function corsMain(targets, request, { insecure, wire }, json) {
1773
1966
  } else {
1774
1967
  for (const report of reports) {
1775
1968
  if ("error" in report)
1776
- console.error(marked("problem", report.error, process15.stderr));
1969
+ console.error(marked("problem", report.error, process16.stderr));
1777
1970
  else
1778
1971
  printCors(report);
1779
1972
  }
@@ -1821,12 +2014,12 @@ async function main(args) {
1821
2014
  let first = true;
1822
2015
  for (const report of reports) {
1823
2016
  if ("error" in report) {
1824
- console.error(marked("problem", report.error, process15.stderr));
2017
+ console.error(marked("problem", report.error, process16.stderr));
1825
2018
  } else if (values.verbose === true) {
1826
2019
  if (!first)
1827
2020
  console.log("");
1828
2021
  if (reports.length > 1)
1829
- console.log(role("label", process15.stdout)(report.target));
2022
+ console.log(role("label", process16.stdout)(report.target));
1830
2023
  print(report);
1831
2024
  } else {
1832
2025
  console.log(compact(report));
@@ -1835,4 +2028,4 @@ async function main(args) {
1835
2028
  }
1836
2029
  return reports.some((report) => ("error" in report)) ? 1 : 0;
1837
2030
  }
1838
- process15.exitCode = await runMain({ name: "probe", run: main });
2031
+ process16.exitCode = await runMain({ name: "probe", run: main });
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@kaynooo/cli-probe",
3
3
  "type": "module",
4
- "version": "0.4.2",
4
+ "version": "0.4.4",
5
5
  "description": "probe: a site's HTTP version, redirect chain, timings, addresses, TLS certificate and notable headers in one call, with warnings.",
6
6
  "author": "Kaynooo <contact@kaynooo.fr>",
7
7
  "license": "MIT",
8
- "homepage": "https://git.kaynooo.fr/kaynooo/cli/src/branch/main/packages/probe#readme",
8
+ "homepage": "https://github.com/Kayno0o/cli/tree/main/packages/probe#readme",
9
9
  "repository": {
10
10
  "type": "git",
11
- "url": "git+https://git.kaynooo.fr/kaynooo/cli.git",
11
+ "url": "git+https://github.com/Kayno0o/cli.git",
12
12
  "directory": "packages/probe"
13
13
  },
14
- "bugs": "https://git.kaynooo.fr/kaynooo/cli/issues",
14
+ "bugs": "https://github.com/Kayno0o/cli/issues",
15
15
  "keywords": [
16
16
  "cli",
17
17
  "http",
@@ -35,6 +35,6 @@
35
35
  "probe": "$npm_execpath src/probe.ts"
36
36
  },
37
37
  "devDependencies": {
38
- "@kaynooo/cli-kit": "0.41.0"
38
+ "@kaynooo/cli-kit": "0.46.0"
39
39
  }
40
40
  }