@kaynooo/cli-proc 0.7.0 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ports-cli.js CHANGED
@@ -2,13 +2,14 @@
2
2
  // @bun
3
3
 
4
4
  // src/ports-cli.ts
5
- import process14 from "process";
5
+ import process18 from "process";
6
6
  // ../kit/src/args.ts
7
- import process6 from "process";
7
+ import process9 from "process";
8
8
  import { parseArgs } from "util";
9
9
 
10
10
  // ../kit/src/format.ts
11
- import process4 from "process";
11
+ import process7 from "process";
12
+
12
13
  // ../../node_modules/.bun/@kaynooo+utils@3.0.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/chunk-rxztfxgv.js
13
14
  var N = new Map;
14
15
  var Nt = /\s+\S*$/;
@@ -26,6 +27,7 @@ function ko(t, e, r = "...") {
26
27
  }
27
28
  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));
28
29
  var z = new Map;
30
+
29
31
  // ../kit/src/mode.ts
30
32
  import process2 from "process";
31
33
  var MODES = new Set(["terminal", "ci", "agent", "pipe"]);
@@ -48,7 +50,7 @@ function isInteractive(streams = process2) {
48
50
  }
49
51
 
50
52
  // ../kit/src/style.ts
51
- import process3 from "process";
53
+ import process6 from "process";
52
54
 
53
55
  // ../../node_modules/.bun/@kaynooo+utils@3.0.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/chunk-x450vn3m.js
54
56
  var G2 = /^[a-f0-9]+$/i;
@@ -74,7 +76,7 @@ function C(r, e = globalThis.process?.env ?? {}) {
74
76
  return false;
75
77
  return r?.isTTY === true;
76
78
  }
77
- function f2(r, e = []) {
79
+ function f(r, e = []) {
78
80
  let l = "", n = "";
79
81
  for (let t = 0, i = e.length;t < i; t++)
80
82
  l += `\x1B[${e[t][0]}m`, n = `\x1B[${e[t][1]}m${n}`;
@@ -84,7 +86,7 @@ function f2(r, e = []) {
84
86
  if (Array.isArray(a)) {
85
87
  let s = g.get(i);
86
88
  if (s === undefined)
87
- s = f2(r, [...e, a]), g.set(i, s);
89
+ s = f(r, [...e, a]), g.set(i, s);
88
90
  return s;
89
91
  }
90
92
  if (typeof a === "function")
@@ -93,30 +95,251 @@ function f2(r, e = []) {
93
95
  if (u === undefined) {
94
96
  if (g.size >= 64)
95
97
  g.clear();
96
- u = f2(r, [...e, a(...s)]), g.set(y, u);
98
+ u = f(r, [...e, a(...s)]), g.set(y, u);
97
99
  }
98
100
  return u;
99
101
  };
100
102
  throw Error(`Unknown style: ${String(i)}`);
101
103
  } });
102
104
  }
103
- function Fe2(r = {}) {
104
- return f2(r);
105
+ function Fe(r = {}) {
106
+ return f(r);
107
+ }
108
+ var o = Fe();
109
+
110
+ // ../kit/src/theme.ts
111
+ import { existsSync as existsSync2, readFileSync, statSync } from "fs";
112
+ import { homedir as homedir2 } from "os";
113
+ import { join as join3, resolve as resolve2 } from "path";
114
+ import process5 from "process";
115
+
116
+ // ../kit/src/config.ts
117
+ import { existsSync } from "fs";
118
+ import { dirname, join, resolve } from "path";
119
+ import process3 from "process";
120
+ function findUp(names, from = process3.cwd(), stop = () => false) {
121
+ const wanted = typeof names === "string" ? [names] : names;
122
+ for (let dir = resolve(from);; dir = dirname(dir)) {
123
+ const found = wanted.map((name) => join(dir, name)).find((path) => existsSync(path));
124
+ if (found !== undefined)
125
+ return found;
126
+ if (stop(dir) || dirname(dir) === dir)
127
+ return;
128
+ }
129
+ }
130
+
131
+ // ../kit/src/user-config.ts
132
+ import { homedir } from "os";
133
+ import { join as join2 } from "path";
134
+ import process4 from "process";
135
+ function configBase(where = {}) {
136
+ const xdg = where.xdg ?? (where.home === undefined ? process4.env.XDG_CONFIG_HOME : undefined);
137
+ return xdg !== undefined && xdg !== "" ? xdg : join2(where.home ?? homedir(), ".config");
138
+ }
139
+ function userConfigPath(bin, where = {}) {
140
+ return join2(configBase(where), "kaynooo-cli", `${bin}.json`);
105
141
  }
106
- var o2 = Fe2();
107
142
 
108
143
  // ../kit/src/theme.ts
109
144
  var ENDS = new Map;
145
+ var DEFAULT = {
146
+ 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" },
147
+ 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" },
148
+ accents: ["cyan", "magenta", "green", "blue", "yellow", "redBright"],
149
+ bins: {},
150
+ gradient: ["#c084fc", "#67e8f9"]
151
+ };
152
+ 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" };
153
+ 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" };
154
+ var ASCII = { ok: "+", warn: "!", problem: "x", note: ">", plan: "?", passed: "+", failed: "x", running: "*", queued: "o", skipped: "-", bar: "#", rule: "-", corner: "+", open: "*", leaf: "-", guide: "|" };
155
+ var PRESETS = {
156
+ default: {},
157
+ "high-contrast": { colors: BRIGHT, accents: ["cyanBright", "magentaBright", "greenBright", "blueBright", "yellowBright", "redBright"], gradient: ["#d8b4fe", "#a5f3fc"] },
158
+ mono: { colors: MONO, accents: ["bold"], gradient: undefined },
159
+ ascii: { glyphs: ASCII }
160
+ };
110
161
  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"]);
162
+ var HEX = /^#[0-9a-f]{6}$/i;
163
+ var CONTROL = /\p{Cc}/u;
111
164
  var MAX_FILE_BYTES = 64 * 1024;
165
+ var SPACES = /\s+/;
166
+ function isColorSpec(spec) {
167
+ if (typeof spec === "number")
168
+ return Number.isInteger(spec) && spec >= 0 && spec <= 255;
169
+ return typeof spec === "string" && spec.trim() !== "" && spec.trim().split(SPACES).every((token) => STYLES.has(token) || HEX.test(token));
170
+ }
171
+ var CUBE = [0, 95, 135, 175, 215, 255];
172
+ function cubeLevel(channel) {
173
+ return CUBE.reduce((best, value, level) => Math.abs(value - channel) < Math.abs(CUBE[best] - channel) ? level : best, 0);
174
+ }
175
+ function nearest256(hex) {
176
+ const rgb = [1, 3, 5].map((at) => Number.parseInt(hex.slice(at, at + 2), 16));
177
+ const levels = rgb.map(cubeLevel);
178
+ const cube = levels.map((level) => CUBE[level]);
179
+ const grey = Math.min(23, Math.max(0, Math.round((rgb.reduce((sum, channel) => sum + channel, 0) / 3 - 8) / 10)));
180
+ const greyValue = 8 + grey * 10;
181
+ const distance = (colour) => colour.reduce((sum, channel, at) => sum + (channel - rgb[at]) ** 2, 0);
182
+ return distance([greyValue, greyValue, greyValue]) < distance(cube) ? 232 + grey : 16 + 36 * levels[0] + 6 * levels[1] + levels[2];
183
+ }
184
+ function hasTrueColor(env) {
185
+ return env.COLORTERM === "truecolor" || env.COLORTERM === "24bit";
186
+ }
187
+ function tinted(colors, spec, env = process5.env) {
188
+ if (typeof spec === "number")
189
+ return colors.ansi256(spec);
190
+ return spec.trim().split(SPACES).reduce((chain, token) => {
191
+ if (HEX.test(token))
192
+ return hasTrueColor(env) ? chain.hex(token) : chain.ansi256(nearest256(token));
193
+ return chain[token] ?? chain;
194
+ }, colors);
195
+ }
196
+ function isRecord(value) {
197
+ return typeof value === "object" && value !== null && !Array.isArray(value);
198
+ }
199
+ function readThemeFile(path, warn) {
200
+ try {
201
+ const stat = statSync(path, { throwIfNoEntry: false });
202
+ if (stat === undefined)
203
+ return;
204
+ if (!stat.isFile() || stat.size > MAX_FILE_BYTES) {
205
+ warn(`${path} is not a regular file under ${MAX_FILE_BYTES / 1024} KiB, theme ignored`);
206
+ return;
207
+ }
208
+ const parsed = JSON.parse(readFileSync(path, "utf8"));
209
+ if (isRecord(parsed))
210
+ return parsed;
211
+ warn(`${path} is not a JSON object, theme ignored`);
212
+ } catch (error) {
213
+ warn(`${path} does not parse (${error instanceof Error ? error.message : String(error)}), theme ignored`);
214
+ }
215
+ return;
216
+ }
217
+ function applyPreset(theme, name, warn, where) {
218
+ if (name === undefined)
219
+ return;
220
+ if (typeof name !== "string" || !Object.hasOwn(PRESETS, name)) {
221
+ warn(`${where}: no preset ${String(name)}, one of ${Object.keys(PRESETS).join(", ")}`);
222
+ return;
223
+ }
224
+ const preset = PRESETS[name];
225
+ Object.assign(theme.colors, preset.colors);
226
+ Object.assign(theme.glyphs, preset.glyphs);
227
+ if (preset.accents !== undefined)
228
+ theme.accents = [...preset.accents];
229
+ if (Object.hasOwn(preset, "gradient"))
230
+ theme.gradient = preset.gradient;
231
+ return name;
232
+ }
233
+ function applyFile(theme, file, where, warn) {
234
+ if (isRecord(file.colors)) {
235
+ for (const [key, value] of Object.entries(file.colors)) {
236
+ if (!Object.hasOwn(DEFAULT.colors, key))
237
+ warn(`${where}: no colour ${key}, one of ${Object.keys(DEFAULT.colors).join(", ")}`);
238
+ else if (!isColorSpec(value))
239
+ warn(`${where}: colour ${key} is not an ANSI name, \`#rrggbb\` or a number up to 255`);
240
+ else
241
+ theme.colors[key] = value;
242
+ }
243
+ }
244
+ if (isRecord(file.glyphs)) {
245
+ for (const [key, value] of Object.entries(file.glyphs)) {
246
+ if (!Object.hasOwn(DEFAULT.glyphs, key))
247
+ warn(`${where}: no glyph ${key}, one of ${Object.keys(DEFAULT.glyphs).join(", ")}`);
248
+ else if (typeof value !== "string" || CONTROL.test(value) || Bun.stringWidth(value) !== 1)
249
+ warn(`${where}: glyph ${key} must be one visible character wide, with no control character`);
250
+ else
251
+ theme.glyphs[key] = value;
252
+ }
253
+ }
254
+ if (Array.isArray(file.accents) && file.accents.length > 0 && file.accents.every(isColorSpec))
255
+ theme.accents = [...file.accents];
256
+ else if (file.accents !== undefined)
257
+ warn(`${where}: accents must be a non-empty list of colours`);
258
+ if (file.gradient === null)
259
+ theme.gradient = undefined;
260
+ else if (Array.isArray(file.gradient) && file.gradient.length === 2 && file.gradient.every((end) => typeof end === "string" && HEX.test(end)))
261
+ theme.gradient = [file.gradient[0], file.gradient[1]];
262
+ else if (file.gradient !== undefined)
263
+ warn(`${where}: gradient must be two \`#rrggbb\` colours, or null for none`);
264
+ if (isRecord(file.bins)) {
265
+ for (const [bin, value] of Object.entries(file.bins)) {
266
+ if (isColorSpec(value))
267
+ theme.bins[bin] = value;
268
+ else
269
+ warn(`${where}: bin ${bin} has no valid colour`);
270
+ }
271
+ }
272
+ }
273
+ function endsWalk(home) {
274
+ return (dir) => dir === resolve2(home) || existsSync2(join3(dir, ".git"));
275
+ }
112
276
  var warned = new Set;
277
+ function warnOnce(message) {
278
+ if (warned.has(message))
279
+ return;
280
+ warned.add(message);
281
+ console.error(`warning: theme ${message}`);
282
+ }
283
+ function isPath(chosen) {
284
+ return chosen.includes("/") || chosen.endsWith(".json");
285
+ }
286
+ function loadTheme({ env = process5.env, from = process5.cwd(), home = homedir2(), warn = warnOnce } = {}) {
287
+ const theme = { colors: { ...DEFAULT.colors }, glyphs: { ...DEFAULT.glyphs }, accents: [...DEFAULT.accents], bins: Object.create(null), gradient: DEFAULT.gradient };
288
+ const sources = [];
289
+ const chosen = env.KIT_THEME ?? "";
290
+ const wanted = chosen === "" ? [userConfigPath("theme", { home, xdg: env.XDG_CONFIG_HOME }), findUp(join3(".kaynooo", "theme.json"), from, endsWalk(home))] : [];
291
+ if (isPath(chosen))
292
+ wanted.push(resolve2(from, chosen));
293
+ const files = [];
294
+ for (const path of wanted) {
295
+ const file = path === undefined ? undefined : readThemeFile(path, warn);
296
+ if (path !== undefined && file !== undefined)
297
+ files.push({ path, file });
298
+ }
299
+ let preset = "default";
300
+ if (chosen !== "" && !isPath(chosen)) {
301
+ preset = applyPreset(theme, chosen, warn, "KIT_THEME") ?? preset;
302
+ } else {
303
+ const named = files.findLast(({ file }) => file.preset !== undefined);
304
+ if (named !== undefined)
305
+ preset = applyPreset(theme, named.file.preset, warn, named.path) ?? preset;
306
+ }
307
+ for (const { path, file } of files) {
308
+ applyFile(theme, file, path, warn);
309
+ sources.push(path);
310
+ }
311
+ return { theme, sources, preset };
312
+ }
313
+ var current;
314
+ var currentKey = "";
315
+ function activeTheme() {
316
+ const key = `${process5.cwd()}\x00${process5.env.KIT_THEME ?? ""}\x00${process5.env.XDG_CONFIG_HOME ?? ""}`;
317
+ if (current === undefined || key !== currentKey) {
318
+ current = loadTheme();
319
+ currentKey = key;
320
+ }
321
+ return current;
322
+ }
113
323
 
114
324
  // ../kit/src/style.ts
115
- function takesControlCodes(stream, env = process3.env) {
325
+ var MARK_WORDS = { ok: "ok:", warn: "warning:", problem: "error:", note: "note:", plan: "would:" };
326
+ function takesControlCodes(stream, env = process6.env) {
116
327
  return stream.isTTY === true && env.NO_COLOR === undefined && env.NODE_DISABLE_COLORS === undefined && env.TERM !== "dumb" && outputMode(stream, env) === "terminal";
117
328
  }
118
- function paint(stream, env = process3.env) {
119
- return Fe2({ stream: { isTTY: takesControlCodes(stream, env) }, env });
329
+ function paint(stream, env = process6.env) {
330
+ return Fe({ stream: { isTTY: takesControlCodes(stream, env) }, env });
331
+ }
332
+ function marked(mark, text, stream, detail, env = process6.env) {
333
+ const colors = paint(stream, env);
334
+ let head = MARK_WORDS[mark];
335
+ if (takesControlCodes(stream, env)) {
336
+ const { theme } = activeTheme();
337
+ head = tinted(colors.bold, theme.colors[mark], env)(theme.glyphs[mark]);
338
+ }
339
+ return `${head} ${text}${detail === undefined ? "" : ` ${colors.dim(detail)}`}`;
340
+ }
341
+ function problem(text, detail) {
342
+ console.error(marked("problem", text, process6.stderr, detail));
120
343
  }
121
344
  var STATUS_WORDS = {
122
345
  passed: ["passed", "success", "succeeded", "ok"],
@@ -154,7 +377,7 @@ var ESCAPE = String.fromCharCode(27);
154
377
  function textWidth(text) {
155
378
  return Bun.stringWidth(text);
156
379
  }
157
- function table(rows, { cellWidth, header = false, align = [], fit, stream = process4.stdout, env = process4.env } = {}) {
380
+ function table(rows, { cellWidth, header = false, align = [], fit, stream = process7.stdout, env = process7.env } = {}) {
158
381
  const cells = cellWidth === undefined ? rows : rows.map((row) => row.map((cell) => truncate(cell.replaceAll(LINE_BREAKS, " "), cellWidth)));
159
382
  if (outputMode(stream, env) === "agent")
160
383
  return cells.map((row) => row.map((cell) => Bun.stripANSI(cell).replaceAll(/[\t\r\n]+/g, " ")).join("\t")).join(`
@@ -193,7 +416,7 @@ function narrow(rows, widths, limit) {
193
416
  }
194
417
  return rows.map((row) => row.map((cell, index) => textWidth(cell) > (widths[index] ?? 0) ? truncate(cell, widths[index] ?? 0) : cell));
195
418
  }
196
- function jsonText(value, replacer, { stream = process4.stdout, env = process4.env } = {}) {
419
+ function jsonText(value, replacer, { stream = process7.stdout, env = process7.env } = {}) {
197
420
  return JSON.stringify(value, replacer, outputMode(stream, env) === "agent" ? undefined : 2);
198
421
  }
199
422
  function printJson(value) {
@@ -201,27 +424,23 @@ function printJson(value) {
201
424
  }
202
425
 
203
426
  // ../kit/src/help.ts
204
- import process5 from "process";
427
+ import process8 from "process";
205
428
  var OPTIONAL = /\[[^\]]+\]/g;
206
429
  var USAGE_PREFIX = /^usage:\s*/i;
207
430
  var FULL_STOP = /\.$/;
208
- function usageLine(usage, colors = paint(process5.stdout)) {
431
+ function usageLine(usage, colors = paint(process8.stdout)) {
209
432
  return `${colors.bold("Usage:")} ${usage.replace(USAGE_PREFIX, "").replaceAll(OPTIONAL, (part) => colors.dim(part))}`;
210
433
  }
211
- function helpText(usage, options, colors = paint(process5.stdout), { examples = [], replaces, exits = [] } = {}) {
212
- return [usageLine(usage, colors), ...replacesRows(replaces, colors), "", colors.bold("Options:"), ...optionRows(options, colors), ...exitRows(exits, colors), ...exampleRows(examples, colors)].join(`
434
+ function helpText(usage, options, colors = paint(process8.stdout), { examples = [], exits = [] } = {}) {
435
+ return [usageLine(usage, colors), "", colors.bold("Options:"), ...optionRows(options, colors), ...exitRows(exits, colors), ...exampleRows(examples, colors)].join(`
213
436
  `);
214
437
  }
215
- function exitRows(exits, colors = paint(process5.stdout)) {
438
+ function exitRows(exits, colors = paint(process8.stdout)) {
216
439
  if (exits.length === 0)
217
440
  return [];
218
- const width = Math.max(...exits.map(([code]) => String(code).length));
219
- return ["", colors.bold("Exits:"), ...exits.map(([code, meaning]) => ` ${colors.cyan(String(code).padEnd(width))} ${meaning}`)];
220
- }
221
- function replacesRows(replaces, colors = paint(process5.stdout)) {
222
- return replaces === undefined || outputMode() === "agent" ? [] : ["", `${colors.bold("Instead of:")} ${replaces}`];
441
+ return ["", `${colors.bold("Exit codes:")} ${exits.map(([code, meaning]) => `${colors.cyan(String(code))} ${meaning}`).join(", ")}`];
223
442
  }
224
- function wantsHelpJson(env = process5.env) {
443
+ function wantsHelpJson(env = process8.env) {
225
444
  return env.KIT_HELP === "json";
226
445
  }
227
446
  function description(usage, { examples = [], replaces, exits } = {}, options) {
@@ -240,12 +459,12 @@ function description(usage, { examples = [], replaces, exits } = {}, options) {
240
459
  ...options === undefined ? {} : { options: Object.entries(options).map(([name, { short, description }]) => ({ name, ...short === undefined ? {} : { short }, ...description === undefined ? {} : { description } })) }
241
460
  };
242
461
  }
243
- function exampleRows(examples, colors = paint(process5.stdout)) {
462
+ function exampleRows(examples, colors = paint(process8.stdout)) {
244
463
  if (examples.length === 0 || outputMode() === "agent")
245
464
  return [];
246
465
  return ["", colors.bold("Examples:"), ...examples.map((example) => typeof example === "string" ? ` ${example}` : ` ${example[0]} ${colors.dim(`# ${example[1]}`)}`)];
247
466
  }
248
- function optionRows(options, colors = paint(process5.stdout)) {
467
+ function optionRows(options, colors = paint(process8.stdout)) {
249
468
  const rows = Object.entries(options).map(([name, option]) => {
250
469
  const short = option.short === undefined ? " " : `${colors.cyan(`-${option.short}`)}, `;
251
470
  const named = option.choices === undefined ? "<value>" : `<${option.choices.join("|")}>`;
@@ -346,7 +565,7 @@ var OUTPUT_OPTIONS = {
346
565
  color: { type: "string", description: "auto (on a terminal alone), always or never" },
347
566
  plain: { type: "boolean", description: "plain text, no colour or spinner: --color never" }
348
567
  };
349
- function applyOutput(color, plain, env = process6.env) {
568
+ function applyOutput(color, plain, env = process9.env) {
350
569
  const when = plain === true ? "never" : color ?? "auto";
351
570
  if (when === "auto")
352
571
  return;
@@ -515,9 +734,33 @@ function nearestOption(message, options, allowNegative) {
515
734
  const meant = closest(word, known.map((flag) => flag.replace(DASHES, "")));
516
735
  return meant === undefined ? undefined : `did you mean ${known.find((flag) => flag.replace(DASHES, "") === meant)}?`;
517
736
  }
737
+ // ../kit/src/argv.ts
738
+ import { readFileSync as readFileSync2, realpathSync } from "fs";
739
+ import { resolve as resolve3 } from "path";
740
+ import process10 from "process";
741
+ function commandLine() {
742
+ try {
743
+ return readFileSync2("/proc/self/cmdline", "utf8").split("\x00").slice(0, -1);
744
+ } catch {
745
+ return;
746
+ }
747
+ }
748
+ function realPath(word) {
749
+ try {
750
+ return realpathSync(resolve3(word));
751
+ } catch {
752
+ return;
753
+ }
754
+ }
755
+ function scriptArgs(argv = process10.argv.slice(2), cmdline = commandLine(), script = process10.argv[1]) {
756
+ const target = script === undefined ? undefined : realPath(script) ?? script;
757
+ const at = cmdline === undefined || target === undefined ? -1 : cmdline.findIndex((word, index) => index > 0 && (resolve3(word) === script || realPath(word) === target));
758
+ const after = at === -1 ? [] : cmdline.slice(at + 1);
759
+ return after[0] === "--" && after.length === argv.length + 1 && argv.every((word, index) => word === after[index + 1]) ? after : argv;
760
+ }
518
761
  // ../kit/src/process.ts
519
762
  import { constants } from "os";
520
- import process7 from "process";
763
+ import process11 from "process";
521
764
  var KILL_GRACE_MS = 2000;
522
765
  function exitCodeOf(code, signal) {
523
766
  if (code !== null)
@@ -537,7 +780,7 @@ async function runCommand(argv, { cwd, env, stdin = "ignore", timeoutMs, signal,
537
780
  return;
538
781
  try {
539
782
  if (grouped)
540
- process7.kill(-proc.pid, killing);
783
+ process11.kill(-proc.pid, killing);
541
784
  else
542
785
  proc.kill(killing);
543
786
  } catch {}
@@ -611,15 +854,15 @@ var ESCAPE_CODE = new RegExp(`${ESC}(?:\\[[\\x30-\\x3F]*[\\x20-\\x2F]*[\\x40-\\x
611
854
  var RESET_STYLE = `${ESC}[0m`;
612
855
  var CLOSE_LINK = `${ESC}]8;;${ESC}\\`;
613
856
  // ../kit/src/cli.ts
614
- import { readFileSync, realpathSync } from "fs";
615
- import { dirname as dirname2, join as join2 } from "path";
616
- import process9 from "process";
857
+ import { readFileSync as readFileSync3, realpathSync as realpathSync2 } from "fs";
858
+ import { dirname as dirname3, join as join5 } from "path";
859
+ import process13 from "process";
617
860
 
618
861
  // ../kit/src/usage.ts
619
862
  import { appendFileSync, mkdirSync } from "fs";
620
- import { homedir } from "os";
621
- import { dirname, isAbsolute, join } from "path";
622
- import process8 from "process";
863
+ import { homedir as homedir3 } from "os";
864
+ import { dirname as dirname2, isAbsolute, join as join4 } from "path";
865
+ import process12 from "process";
623
866
 
624
867
  // ../kit/src/logs.ts
625
868
  var DAY_MS = 24 * 60 * 60 * 1000;
@@ -633,14 +876,14 @@ var usageError;
633
876
  function noteUsageError(message) {
634
877
  usageError = message;
635
878
  }
636
- function stateHome(env = process8.env) {
879
+ function stateHome(env = process12.env) {
637
880
  const dir = env.XDG_STATE_HOME;
638
- return dir !== undefined && isAbsolute(dir) ? dir : join(homedir(), ".local", "state");
881
+ return dir !== undefined && isAbsolute(dir) ? dir : join4(homedir3(), ".local", "state");
639
882
  }
640
- function usagePath(env = process8.env) {
641
- return join(stateHome(env), CLI_FOLDER, "usage.jsonl");
883
+ function usagePath(env = process12.env) {
884
+ return join4(stateHome(env), CLI_FOLDER, "usage.jsonl");
642
885
  }
643
- function usageRecorded(env = process8.env) {
886
+ function usageRecorded(env = process12.env) {
644
887
  const off = env.KAYNOOO_CLI_NO_USAGE;
645
888
  return env.NODE_ENV !== "test" && (off === undefined || off === "" || off === "0");
646
889
  }
@@ -654,12 +897,12 @@ function usageEntry(bin, command, argv, code, now = new Date) {
654
897
  usageError = undefined;
655
898
  return { at: now.toISOString(), bin, ...command === undefined ? {} : { command }, flags: flagNames(argv), code, ...unknown === undefined ? {} : { unknown } };
656
899
  }
657
- function recordUsage(entry, env = process8.env) {
900
+ function recordUsage(entry, env = process12.env) {
658
901
  if (!usageRecorded(env))
659
902
  return;
660
903
  try {
661
904
  const path = usagePath(env);
662
- mkdirSync(dirname(path), { recursive: true, mode: 448 });
905
+ mkdirSync(dirname2(path), { recursive: true, mode: 448 });
663
906
  appendFileSync(path, `${JSON.stringify(entry)}
664
907
  `, { mode: 384 });
665
908
  } catch {}
@@ -731,7 +974,6 @@ async function help2({ path, header, summary: lazySummary, commands, defaultComm
731
974
  header(colors, summary),
732
975
  "",
733
976
  usageLine(`${prefix} ${defaultCommand === undefined ? colors.cyan("<command>") : `[${colors.cyan("<command>")}]`} [options]`, colors),
734
- ...replacesRows(replaces, colors),
735
977
  "",
736
978
  ...await commandRows(commands, colors),
737
979
  ...own.length === 0 ? [] : ["", `${colors.bold(`Options of ${defaultCommand}:`)} ${colors.dim("the command run when none is named")}`, ...optionRows(Object.fromEntries(own), colors)],
@@ -745,8 +987,8 @@ async function help2({ path, header, summary: lazySummary, commands, defaultComm
745
987
  `);
746
988
  }
747
989
  function printError(prefix, message, hint, cause) {
748
- const colors = paint(process9.stderr);
749
- const styled = takesControlCodes(process9.stderr);
990
+ const colors = paint(process13.stderr);
991
+ const styled = takesControlCodes(process13.stderr);
750
992
  const head = styled ? `${colors.red.bold("error")} ${colors.dim(`${prefix}:`)}` : `error: ${prefix}:`;
751
993
  const under = (label, text, tint) => text === undefined ? "" : `
752
994
  ${styled ? tint(label) : `${label}:`} ${text}`;
@@ -789,11 +1031,11 @@ async function dispatch(level, typed, { version, redact }) {
789
1031
  }
790
1032
  }
791
1033
  if (name === undefined && level.path.length > 1) {
792
- console.error(await help2(await expand(level, [...level.path.slice(1), ...argv]), process9.stderr));
1034
+ console.error(await help2(await expand(level, [...level.path.slice(1), ...argv]), process13.stderr));
793
1035
  return 2;
794
1036
  }
795
1037
  if (name === undefined || name === "help" || name === "--help" || name === "-h") {
796
- console.log(await help2(await expand(level, [...level.path.slice(1), ...argv]), process9.stdout));
1038
+ console.log(await help2(await expand(level, [...level.path.slice(1), ...argv]), process13.stdout));
797
1039
  return 0;
798
1040
  }
799
1041
  if (level.path.length === 1 && (name === "--version" || name === "-v")) {
@@ -849,24 +1091,24 @@ function candidateLine(candidate) {
849
1091
  }
850
1092
  function positionalBeingTyped(before, { options, positionals }) {
851
1093
  const takesValue = (word) => !word.includes("=") && Object.entries(options).some(([name, { short, type }]) => type === "string" && (word === `--${name}` || word === `-${short}`));
852
- let index = 0;
1094
+ const typed = [];
853
1095
  let at = 0;
854
1096
  while (at < before.length) {
855
1097
  const word = before[at];
856
1098
  if (word === "--") {
857
- index += before.length - at - 1;
1099
+ typed.push(...before.slice(at + 1));
858
1100
  break;
859
1101
  }
860
1102
  if (!word.startsWith("-"))
861
- index++;
1103
+ typed.push(word);
862
1104
  else if (takesValue(word))
863
1105
  at++;
864
1106
  at++;
865
1107
  }
866
1108
  const last = positionals.at(-1);
867
- if (index < positionals.length)
868
- return positionals[index];
869
- return last?.replace("]", "").endsWith("...") === true ? last : undefined;
1109
+ if (typed.length < positionals.length)
1110
+ return { name: positionals[typed.length], typed };
1111
+ return { name: last?.replace("]", "").endsWith("...") === true ? last : undefined, typed };
870
1112
  }
871
1113
  async function leafCandidates(run, words) {
872
1114
  const completing = await completingOf(run);
@@ -874,12 +1116,12 @@ async function leafCandidates(run, words) {
874
1116
  return Object.entries(completing.options).map(([name, option]) => option.description === undefined ? `--${name}` : `--${name} ${option.description}`);
875
1117
  const flag = words.at(-2);
876
1118
  const option = flag?.startsWith("-") === true ? Object.entries(completing.options).find(([name, { short }]) => flag === `--${name}` || flag === `-${short}`)?.[1] : undefined;
1119
+ const { name, typed } = positionalBeingTyped(words.slice(0, -1), completing);
877
1120
  if (option?.type === "string") {
878
- const values = option.choices === undefined ? await option.candidates?.() : option.choices;
1121
+ const values = option.choices === undefined ? await option.candidates?.(typed) : option.choices;
879
1122
  return values === undefined ? [FILES] : values.map(candidateLine);
880
1123
  }
881
- const name = positionalBeingTyped(words.slice(0, -1), completing);
882
- const values = name === undefined ? undefined : await completing.candidates[name]?.();
1124
+ const values = name === undefined ? undefined : await completing.candidates[name]?.(typed);
883
1125
  return values === undefined ? [FILES] : values.map(candidateLine);
884
1126
  }
885
1127
  async function candidates(scope, defaultCommand, words, before = []) {
@@ -910,17 +1152,21 @@ async function printCandidates(found) {
910
1152
  return 0;
911
1153
  }
912
1154
  function packageVersion(entry = Bun.main) {
913
- for (let dir = dirname2(realpathSync(entry));; dir = dirname2(dir)) {
1155
+ let resolved = entry;
1156
+ try {
1157
+ resolved = realpathSync2(entry);
1158
+ } catch {}
1159
+ for (let dir = dirname3(resolved);; dir = dirname3(dir)) {
914
1160
  try {
915
- const { version } = JSON.parse(readFileSync(join2(dir, "package.json"), "utf8"));
1161
+ const { version } = JSON.parse(readFileSync3(join5(dir, "package.json"), "utf8"));
916
1162
  if (typeof version === "string")
917
1163
  return version;
918
1164
  } catch {}
919
- if (dirname2(dir) === dir)
1165
+ if (dirname3(dir) === dir)
920
1166
  return "0.0.0";
921
1167
  }
922
1168
  }
923
- async function runCli(cli, argv = process9.argv.slice(2)) {
1169
+ async function runCli(cli, argv = scriptArgs()) {
924
1170
  const version = cli.version ?? packageVersion();
925
1171
  if (argv[0] === COMPLETE)
926
1172
  return printCandidates(candidates(scopeOf(cli.commands, cli.extraCommands, cli.aliases), cli.defaultCommand, argv.slice(1)));
@@ -947,7 +1193,7 @@ function commandPath(scope, argv) {
947
1193
  }
948
1194
  return path.length === 0 ? undefined : path.join(" ");
949
1195
  }
950
- async function runMain({ name, version, run, redact, usage }, argv = process9.argv.slice(2)) {
1196
+ async function runMain({ name, version, run, redact, usage }, argv = scriptArgs()) {
951
1197
  if (argv[0] === COMPLETE)
952
1198
  return printCandidates(leafCandidates(run, argv.slice(1)));
953
1199
  if (argv.length === 1 && (argv[0] === "--version" || argv[0] === "-v")) {
@@ -991,7 +1237,7 @@ function parseSize(text, bareUnit = 1) {
991
1237
  return Math.round(Number(match[1]) * (suffix === "" ? bareUnit : 1024 ** POWERS[suffix]));
992
1238
  }
993
1239
  // ../kit/src/watch.ts
994
- import process10 from "process";
1240
+ import process14 from "process";
995
1241
  import { format } from "util";
996
1242
  var CLEAR_SCREEN = "\x1B[H\x1B[2J";
997
1243
  var DEFAULT_SECONDS = 2;
@@ -1013,7 +1259,7 @@ function withoutWatch(args) {
1013
1259
  }
1014
1260
  return rest;
1015
1261
  }
1016
- async function watching(value, step, stream = process10.stdout, sleep = Bun.sleep, rounds = Number.POSITIVE_INFINITY) {
1262
+ async function watching(value, step, stream = process14.stdout, sleep = Bun.sleep, rounds = Number.POSITIVE_INFINITY) {
1017
1263
  const interval = value === "" ? DEFAULT_SECONDS * 1000 : duration(value, "watch", DEFAULT_SECONDS * 1000);
1018
1264
  if (!takesControlCodes(stream))
1019
1265
  badUsage("--watch redraws the screen, so it needs a terminal");
@@ -1021,12 +1267,12 @@ async function watching(value, step, stream = process10.stdout, sleep = Bun.slee
1021
1267
  for (let round = 0;round < rounds; round++) {
1022
1268
  const held = [];
1023
1269
  const { log, info } = console;
1024
- const write = process10.stdout.write.bind(process10.stdout);
1270
+ const write = process14.stdout.write.bind(process14.stdout);
1025
1271
  const hold = (...parts) => void held.push(`${format(...parts)}
1026
1272
  `);
1027
1273
  console.log = hold;
1028
1274
  console.info = hold;
1029
- process10.stdout.write = (text) => {
1275
+ process14.stdout.write = (text) => {
1030
1276
  held.push(typeof text === "string" ? text : Buffer.from(text).toString());
1031
1277
  return true;
1032
1278
  };
@@ -1035,7 +1281,7 @@ async function watching(value, step, stream = process10.stdout, sleep = Bun.slee
1035
1281
  } finally {
1036
1282
  console.log = log;
1037
1283
  console.info = info;
1038
- process10.stdout.write = write;
1284
+ process14.stdout.write = write;
1039
1285
  }
1040
1286
  stream.write(`${CLEAR_SCREEN}${held.join("")}`);
1041
1287
  await sleep(interval);
@@ -1044,10 +1290,10 @@ async function watching(value, step, stream = process10.stdout, sleep = Bun.slee
1044
1290
  }
1045
1291
  // src/ports.ts
1046
1292
  import { basename as basename2 } from "path";
1047
- import process13 from "process";
1293
+ import process17 from "process";
1048
1294
 
1049
1295
  // ../kit/src/prompt.ts
1050
- import process12 from "process";
1296
+ import process16 from "process";
1051
1297
 
1052
1298
  // ../kit/src/picker/score.ts
1053
1299
  var BOUNDARY_AFTER = new Set([" ", "/", "-", "_", ".", ":", "\\", "(", "[", ",", "\t"]);
@@ -1057,7 +1303,9 @@ var NONE = Number.NEGATIVE_INFINITY;
1057
1303
  var IS_CONTROL = /[\x00-\x1F\x7F-\x9F]/;
1058
1304
  var PASTE_START = "\x1B[200~";
1059
1305
  var PASTE_END = "\x1B[201~";
1060
- var KEY_SEQUENCES = /\x1B\[[0-9;]*[A-Z~]|\x1BO[A-Z]|\x1B[\s\S]|[\s\S]/gu;
1306
+ var KEY_SEQUENCES = /\x1B\[<[0-9;]*[A-Za-z]|\x1B\[[0-9;]*[A-Z~]|\x1BO[A-Z]|\x1B[\s\S]|[\s\S]/gu;
1307
+ var MOUSE = /^\x1B\[<(\d+);\d+;\d+[a-z]$/i;
1308
+ var WHEEL_LINES = 3;
1061
1309
  var KEYS = {
1062
1310
  "\x1B[A": "up",
1063
1311
  "\x1BOA": "up",
@@ -1086,9 +1334,15 @@ var KEYS = {
1086
1334
  "\x1BOP": "help",
1087
1335
  "\x1B[11~": "help"
1088
1336
  };
1337
+ function repeat(value, count) {
1338
+ return Array.from({ length: count }).fill(value);
1339
+ }
1089
1340
  function parseKeys(input, paste = { active: false }, ctrls = []) {
1090
1341
  const codes = new Map(ctrls.map((name) => [String.fromCharCode(name.codePointAt(name.length - 1) - 96), name]));
1091
1342
  return (input.match(KEY_SEQUENCES) ?? []).flatMap((sequence) => {
1343
+ const wheel = MOUSE.exec(sequence)?.[1];
1344
+ if (wheel !== undefined)
1345
+ return repeat(wheel === "64" ? "up" : "down", wheel === "64" || wheel === "65" ? WHEEL_LINES : 0);
1092
1346
  const named = codes.get(sequence);
1093
1347
  const key = named === undefined ? KEYS[sequence] : { ctrl: named };
1094
1348
  if (sequence === PASTE_START || sequence === PASTE_END) {
@@ -1131,21 +1385,18 @@ function asking(colors, question, typed, keys) {
1131
1385
  function answer(colors, question, state, picked) {
1132
1386
  return state === "enter" ? `${colors.green("\u2713")} ${question} ${colors.cyan(picked)}` : `${colors.red("\u2717")} ${question} ${colors.dim("cancelled")}`;
1133
1387
  }
1134
- async function ask(question, { hint, terminal = process12 }, render, press) {
1388
+ async function ask(question, { hint, terminal = process16 }, render, press) {
1135
1389
  const { stdin, stderr } = terminal;
1136
1390
  if (!isInteractive(terminal))
1137
1391
  fail(`cannot ask "${question}" off a terminal`, 2, hint);
1138
1392
  const colors = paint(stderr);
1139
- let drawn = [];
1140
1393
  let current = "asking";
1141
1394
  let outcome;
1142
1395
  const columns = () => stderr.columns || 80;
1143
- const draw = (state) => {
1396
+ const draw = (state, last = false) => {
1144
1397
  const frame = render(colors, state, { columns: columns(), rows: stderr.rows || 24 });
1145
- const rows = drawn.reduce((sum, line) => sum + Math.max(1, Math.ceil(Bun.stringWidth(line) / columns())), 0);
1146
- stderr.write(`${rows > 1 ? `\x1B[${rows - 1}A` : ""}\r\x1B[0J${frame.join(`
1147
- `)}`);
1148
- drawn = frame;
1398
+ stderr.write(`\r\x1B[0J${frame.join(`
1399
+ `)}${last || frame.length < 2 ? "" : `\x1B[${frame.length - 1}A`}${last ? "" : "\r"}`);
1149
1400
  current = state;
1150
1401
  };
1151
1402
  const redraw = () => draw(current);
@@ -1181,7 +1432,7 @@ async function ask(question, { hint, terminal = process12 }, render, press) {
1181
1432
  });
1182
1433
  } finally {
1183
1434
  stderr.off?.("resize", redraw);
1184
- draw(outcome ?? "cancel");
1435
+ draw(outcome ?? "cancel", true);
1185
1436
  stderr.write(`
1186
1437
  \x1B[?25h\x1B[?2004l`);
1187
1438
  stdin.setRawMode(false);
@@ -1580,15 +1831,15 @@ var usage2 = `ports [port]
1580
1831
 
1581
1832
  Lists what listens on this machine, TCP and UDP over IPv4 and IPv6, one row per port with its bound address, the owning process, its command and its working directory. A port Docker publishes is held by docker-proxy, and shows as its compose project and service when docker is installed; the owner of a socket of another user cannot be read and shows as -.
1582
1833
  \`ports <port>\` keeps that port alone and exits 1 when nothing listens on it.
1583
- \`ports <port> --kill\` stops its owner with SIGTERM, and with --force SIGKILL once --grace has passed, after asking on a terminal unless --yes is given. It refuses processes of other users, pid 1, this command and its ancestors, and docker-proxy, for which it names the container to stop instead.
1584
-
1585
- Exits 0 when it listed or stopped, 1 when nothing listens on the given port or the owner could not be stopped, 2 on a usage error.`;
1834
+ \`ports <port> --kill\` stops its owner with SIGTERM, and with --force SIGKILL once --grace has passed, after asking on a terminal unless --yes is given. It refuses processes of other users, pid 1, this command and its ancestors, and docker-proxy, for which it names the container to stop instead.`;
1835
+ var EXITS = [[0, "it listed or stopped"], [1, "nothing listens on the given port or the owner could not be stopped"], [2, "a usage error"]];
1586
1836
  var options = {
1587
1837
  json: jsonOption("[{ port, protocol, addresses, pid, command, cwd, container }]"),
1588
1838
  kill: { type: "boolean", conflicts: ["watch"], description: "stop the owner of the given port" },
1589
1839
  watch: watchOption("the ports"),
1590
1840
  force: { type: "boolean", description: "with --kill, SIGKILL what SIGTERM did not stop within --grace" },
1591
1841
  yes: { type: "boolean", short: "y", description: "with --kill, do not ask first" },
1842
+ quiet: { type: "boolean", short: "q", description: "with --kill, print nothing about what was stopped" },
1592
1843
  grace: { type: "string", description: "with --force, how long SIGTERM gets before SIGKILL (5s)" }
1593
1844
  };
1594
1845
  function buildRows(sockets, owners, procs, containers) {
@@ -1630,7 +1881,7 @@ function refusal(row, proc, guard) {
1630
1881
  return reason === undefined ? undefined : `pid ${row.pid} is ${reason}`;
1631
1882
  }
1632
1883
  function render(rows) {
1633
- const colors = paint(process13.stdout);
1884
+ const colors = paint(process17.stdout);
1634
1885
  const cells = rows.map((row) => [
1635
1886
  colors.cyan(String(row.port)),
1636
1887
  row.protocol,
@@ -1642,12 +1893,12 @@ function render(rows) {
1642
1893
  return table([["PORT", "PROTO", "ADDRESS", "PID", "COMMAND", "CWD"], ...cells], { header: true });
1643
1894
  }
1644
1895
  async function stop(port, rows, procs, values) {
1645
- const guard = { uid: process13.getuid?.() ?? -1, mine: new Set(ancestry(process13.pid, procs)) };
1896
+ const guard = { uid: process17.getuid?.() ?? -1, mine: new Set(ancestry(process17.pid, procs)) };
1646
1897
  const targets = new Map;
1647
1898
  for (const row of rows) {
1648
1899
  const reason = refusal(row, row.pid === undefined ? undefined : procs.get(row.pid), guard);
1649
1900
  if (reason !== undefined)
1650
- console.error(`port ${port}: ${reason}`);
1901
+ problem(`port ${port}: ${reason}`);
1651
1902
  else if (row.pid !== undefined)
1652
1903
  targets.set(row.pid, row);
1653
1904
  }
@@ -1655,20 +1906,21 @@ async function stop(port, rows, procs, values) {
1655
1906
  return 1;
1656
1907
  const names = [...targets].map(([pid, row]) => `${pid} (${truncate(row.command ?? "", 40)})`).join(", ");
1657
1908
  if (values.yes !== true) {
1658
- if (!process13.stdin.isTTY)
1909
+ if (!process17.stdin.isTTY)
1659
1910
  fail(`stopping ${names} needs a terminal to ask on: pass --yes`, 2);
1660
1911
  if (await confirm(`Stop ${names}?`, { default: false }) !== true)
1661
1912
  return 1;
1662
1913
  }
1663
1914
  const outcome = await terminate([...targets.keys()], { escalate: values.force === true, graceMs: duration(values.grace, "grace", 5000) });
1664
- for (const pid of [...outcome.terminated, ...outcome.killed])
1915
+ for (const pid of values.quiet === true ? [] : [...outcome.terminated, ...outcome.killed])
1665
1916
  console.log(`stopped ${pid}${outcome.killed.includes(pid) ? " (SIGKILL)" : ""}`);
1666
1917
  for (const pid of outcome.survived)
1667
- console.error(`${pid} is still running${values.force === true ? "" : ", pass --force to SIGKILL it"}`);
1918
+ problem(`${pid} is still running${values.force === true ? "" : ", pass --force to SIGKILL it"}`);
1668
1919
  return outcome.survived.length === 0 ? 0 : 1;
1669
1920
  }
1670
1921
  async function ports(args) {
1671
1922
  const { values, positionals } = parse(args, usage2, options, {
1923
+ exits: EXITS,
1672
1924
  positionals: ["[port]"],
1673
1925
  replaces: "ss -ltnp | grep, lsof -i, fuser -k and lookups of docker-proxy by hand",
1674
1926
  examples: [
@@ -1686,7 +1938,7 @@ async function ports(args) {
1686
1938
  badUsage(`<port> takes a whole number from 1 to 65535, not ${given}`);
1687
1939
  if (values.kill === true && port === undefined)
1688
1940
  badUsage("--kill takes the port to free: ports <port> --kill");
1689
- const [sockets, owners, procs] = await Promise.all([readSockets(), socketOwners(), snapshot("/proc", (uid) => uid === process13.getuid?.())]);
1941
+ const [sockets, owners, procs] = await Promise.all([readSockets(), socketOwners(), snapshot("/proc", (uid) => uid === process17.getuid?.())]);
1690
1942
  const byPid = new Map(procs.map((proc) => [proc.pid, proc]));
1691
1943
  const wanted = sockets.filter((socket) => port === undefined || socket.port === port);
1692
1944
  const needsDocker = wanted.some((socket) => {
@@ -1695,7 +1947,7 @@ async function ports(args) {
1695
1947
  });
1696
1948
  const rows = buildRows(wanted, owners, byPid, needsDocker ? await dockerContainers() : []);
1697
1949
  if (port !== undefined && rows.length === 0) {
1698
- console.error(`nothing listens on port ${port}`);
1950
+ problem(`nothing listens on port ${port}`);
1699
1951
  return 1;
1700
1952
  }
1701
1953
  if (values.kill === true && port !== undefined)
@@ -1707,9 +1959,9 @@ async function ports(args) {
1707
1959
  console.log(render(rows));
1708
1960
  const unknown = rows.filter((row) => row.pid === undefined && row.container === undefined).length;
1709
1961
  if (unknown > 0)
1710
- console.error(paint(process13.stderr).dim(`${unknown} ${unknown === 1 ? "port has" : "ports have"} an owner this user cannot read, shown as -`));
1962
+ console.error(paint(process17.stderr).dim(`${unknown} ${unknown === 1 ? "port has" : "ports have"} an owner this user cannot read, shown as -`));
1711
1963
  return 0;
1712
1964
  }
1713
1965
 
1714
1966
  // src/ports-cli.ts
1715
- process14.exitCode = await runMain({ name: "ports", run: ports });
1967
+ process18.exitCode = await runMain({ name: "ports", run: ports });