@kaynooo/cli-stack 0.4.0 → 0.4.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.
Files changed (2) hide show
  1. package/dist/cli.js +333 -124
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -2,16 +2,16 @@
2
2
  // @bun
3
3
 
4
4
  // src/cli.ts
5
- import process8 from "process";
5
+ import process10 from "process";
6
6
 
7
7
  // ../kit/src/args.ts
8
- import process2 from "process";
8
+ import process3 from "process";
9
9
  import { parseArgs } from "util";
10
10
 
11
11
  // ../kit/src/style.ts
12
12
  import process from "process";
13
13
 
14
- // ../../node_modules/.bun/@kaynooo+utils@2.31.0+d0769e28dc4dad16/node_modules/@kaynooo/utils/dist/chunk-mtetydvc.js
14
+ // ../../node_modules/.bun/@kaynooo+utils@2.31.2+d0769e28dc4dad16/node_modules/@kaynooo/utils/dist/chunk-mtetydvc.js
15
15
  function x(s) {
16
16
  let r = s.startsWith("#") ? s.slice(1).toLowerCase() : s.toLowerCase();
17
17
  if (!/^[a-f0-9]+$/.test(r))
@@ -231,7 +231,7 @@ class e {
231
231
  }
232
232
  }
233
233
 
234
- // ../../node_modules/.bun/@kaynooo+utils@2.31.0+d0769e28dc4dad16/node_modules/@kaynooo/utils/dist/chunk-y1msbssb.js
234
+ // ../../node_modules/.bun/@kaynooo+utils@2.31.2+d0769e28dc4dad16/node_modules/@kaynooo/utils/dist/chunk-y1msbssb.js
235
235
  var r = 39;
236
236
  var o = 49;
237
237
  var f2 = "\x1B[";
@@ -310,6 +310,55 @@ function printJson(value) {
310
310
  console.log(JSON.stringify(value, undefined, 2));
311
311
  }
312
312
 
313
+ // ../kit/src/help.ts
314
+ import process2 from "process";
315
+ var OPTIONAL = /\[[^\]]+\]/g;
316
+ var USAGE_PREFIX = /^usage:\s*/i;
317
+ var FULL_STOP = /\.$/;
318
+ function usageLine(usage, colors = paint(process2.stdout)) {
319
+ return `${colors.bold("Usage:")} ${usage.replace(USAGE_PREFIX, "").replaceAll(OPTIONAL, (part) => colors.dim(part))}`;
320
+ }
321
+ function helpText(usage, options, colors = paint(process2.stdout), { examples = [], replaces } = {}) {
322
+ return [usageLine(usage, colors), ...replacesRows(replaces, colors), "", colors.bold("Options:"), ...optionRows(options, colors), ...exampleRows(examples, colors)].join(`
323
+ `);
324
+ }
325
+ function replacesRows(replaces, colors = paint(process2.stdout)) {
326
+ return replaces === undefined ? [] : ["", `${colors.bold("Instead of:")} ${replaces}`];
327
+ }
328
+ function wantsHelpJson(env = process2.env) {
329
+ return env.KIT_HELP === "json";
330
+ }
331
+ function description(usage, { examples = [], replaces } = {}) {
332
+ const lines = usage.replace(USAGE_PREFIX, "").split(`
333
+ `);
334
+ const first = lines[0];
335
+ const colon = first.indexOf(": ");
336
+ const prose = lines[lines.indexOf("") + 1] ?? "";
337
+ const fallback = lines.includes("") ? `${prose.charAt(0).toLowerCase()}${prose.slice(1)}`.replace(FULL_STOP, "") : "";
338
+ return {
339
+ synopsis: colon === -1 ? first : first.slice(0, colon),
340
+ summary: colon === -1 ? fallback : first.slice(colon + 2),
341
+ ...replaces === undefined ? {} : { replaces },
342
+ examples: examples.map((example) => typeof example === "string" ? { line: example } : { line: example[0], note: example[1] })
343
+ };
344
+ }
345
+ function exampleRows(examples, colors = paint(process2.stdout)) {
346
+ if (examples.length === 0)
347
+ return [];
348
+ return ["", colors.bold("Examples:"), ...examples.map((example) => typeof example === "string" ? ` ${example}` : ` ${example[0]} ${colors.dim(`# ${example[1]}`)}`)];
349
+ }
350
+ function optionRows(options, colors = paint(process2.stdout)) {
351
+ const rows = Object.entries(options).map(([name, option]) => {
352
+ const short = option.short === undefined ? " " : `${colors.cyan(`-${option.short}`)}, `;
353
+ const named = option.choices === undefined ? "<value>" : `<${option.choices.join("|")}>`;
354
+ const placeholder = option.optional === undefined ? named : `[${named}]`;
355
+ const value = option.type === "string" ? ` ${colors.dim(placeholder)}` : "";
356
+ return { flag: `${short}${colors.cyan(`--${name}`)}${value}`, width: `-x, --${name}`.length + (option.type === "string" ? placeholder.length + 1 : 0), description: option.description ?? "" };
357
+ });
358
+ const width = Math.max(0, ...rows.map((row) => row.width));
359
+ return rows.map((row) => row.description === "" ? ` ${row.flag}` : ` ${row.flag}${" ".repeat(width - row.width)} ${colors.dim(row.description)}`);
360
+ }
361
+
313
362
  // ../kit/src/text.ts
314
363
  var ANSI = new RegExp(`${String.fromCharCode(27)}\\[[\\d;?]*[a-z]`, "gi");
315
364
  function distance(a, b) {
@@ -329,8 +378,19 @@ function closest(name, names) {
329
378
  const [best] = names.map((known) => ({ known, far: distance(name, known) })).sort((a, b) => a.far - b.far);
330
379
  return best !== undefined && best.far <= (name.length < 4 ? 1 : 2) ? best.known : undefined;
331
380
  }
381
+ // ../kit/src/input.ts
382
+ var WHOLE = /^\d+$/;
383
+ function wholeNumber(value, name, fallback, min = 1) {
384
+ if (value === undefined)
385
+ return fallback;
386
+ const number = Number(value);
387
+ if (!WHOLE.test(value) || !Number.isSafeInteger(number) || number < min)
388
+ badUsage(`${name.startsWith("<") ? name : `--${name}`} takes a whole number from ${min}, not ${value}`);
389
+ return number;
390
+ }
332
391
 
333
392
  // ../kit/src/args.ts
393
+ var DASHES = /^-+/;
334
394
  function jsonOption(holds) {
335
395
  return { type: "boolean", description: holds === undefined ? "print JSON" : `print JSON: ${holds}` };
336
396
  }
@@ -365,61 +425,20 @@ class HelpShown extends Exit {
365
425
 
366
426
  class Completing {
367
427
  options;
368
- constructor(options) {
428
+ positionals;
429
+ candidates;
430
+ constructor(options, positionals = [], candidates = {}) {
369
431
  this.options = options;
432
+ this.positionals = positionals;
433
+ this.candidates = candidates;
370
434
  }
371
435
  }
372
436
  var completion = { active: false };
373
- var OPTIONAL = /\[[^\]]+\]/g;
374
- var USAGE_PREFIX = /^usage:\s*/i;
375
- var FULL_STOP = /\.$/;
376
- var DASHES = /^-+/;
377
- function usageLine(usage, colors = paint(process2.stdout)) {
378
- return `${colors.bold("Usage:")} ${usage.replace(USAGE_PREFIX, "").replaceAll(OPTIONAL, (part) => colors.dim(part))}`;
379
- }
380
- function helpText(usage, options, colors = paint(process2.stdout), { examples = [], replaces } = {}) {
381
- return [usageLine(usage, colors), ...replacesRows(replaces, colors), "", colors.bold("Options:"), ...optionRows(options, colors), ...exampleRows(examples, colors)].join(`
382
- `);
383
- }
384
- function replacesRows(replaces, colors = paint(process2.stdout)) {
385
- return replaces === undefined ? [] : ["", `${colors.bold("Instead of:")} ${replaces}`];
386
- }
387
- function wantsHelpJson(env = process2.env) {
388
- return env.KIT_HELP === "json";
389
- }
390
- function description(usage, { examples = [], replaces } = {}) {
391
- const lines = usage.replace(USAGE_PREFIX, "").split(`
392
- `);
393
- const first = lines[0];
394
- const colon = first.indexOf(": ");
395
- const prose = lines[lines.indexOf("") + 1] ?? "";
396
- const fallback = lines.includes("") ? `${prose.charAt(0).toLowerCase()}${prose.slice(1)}`.replace(FULL_STOP, "") : "";
397
- return {
398
- synopsis: colon === -1 ? first : first.slice(0, colon),
399
- summary: colon === -1 ? fallback : first.slice(colon + 2),
400
- ...replaces === undefined ? {} : { replaces },
401
- examples: examples.map((example) => typeof example === "string" ? { line: example } : { line: example[0], note: example[1] })
402
- };
403
- }
404
- function exampleRows(examples, colors = paint(process2.stdout)) {
405
- if (examples.length === 0)
406
- return [];
407
- return ["", colors.bold("Examples:"), ...examples.map((example) => typeof example === "string" ? ` ${example}` : ` ${example[0]} ${colors.dim(`# ${example[1]}`)}`)];
408
- }
409
- function optionRows(options, colors = paint(process2.stdout)) {
410
- const rows = Object.entries(options).map(([name, option]) => {
411
- const short = option.short === undefined ? " " : `${colors.cyan(`-${option.short}`)}, `;
412
- const value = option.type === "string" ? ` ${colors.dim("<value>")}` : "";
413
- return { flag: `${short}${colors.cyan(`--${name}`)}${value}`, width: `-x, --${name}`.length + (option.type === "string" ? " <value>".length : 0), description: option.description ?? "" };
414
- });
415
- const width = Math.max(0, ...rows.map((row) => row.width));
416
- return rows.map((row) => row.description === "" ? ` ${row.flag}` : ` ${row.flag}${" ".repeat(width - row.width)} ${colors.dim(row.description)}`);
417
- }
418
437
  var OUTPUT_OPTIONS = {
419
438
  color: { type: "string", description: "auto (on a terminal alone), always or never" },
420
439
  plain: { type: "boolean", description: "plain text, no colour or spinner: --color never" }
421
440
  };
422
- function applyOutput(color, plain, env = process2.env) {
441
+ function applyOutput(color, plain, env = process3.env) {
423
442
  const when = plain === true ? "never" : color ?? "auto";
424
443
  if (when === "auto")
425
444
  return;
@@ -436,14 +455,13 @@ function applyOutput(color, plain, env = process2.env) {
436
455
  function parse(args, usage, options, settings = {}) {
437
456
  const output = Object.fromEntries(Object.entries(OUTPUT_OPTIONS).filter(([name]) => !(name in options)));
438
457
  const all = { ...options, ...output, help: { type: "boolean", short: "h", description: "show this help" } };
458
+ const listing = listed(all, settings.allowNegative === true);
439
459
  if (completion.active)
440
- throw new Completing(all);
441
- const separator = settings.rest === true ? args.indexOf("--") : -1;
442
- const own = separator === -1 ? args : args.slice(0, separator);
443
- const rest = separator === -1 ? undefined : args.slice(separator + 1);
460
+ throw new Completing(listing, settings.positionals, settings.candidates);
461
+ const { own, rest } = settings.trailing === true ? splitTrailing(args, all, settings.positionals?.length ?? 0) : splitRest(args, settings.rest === true);
444
462
  let parsed;
445
463
  try {
446
- parsed = parseArgs({ args: joinDashValues(own, all), options: all, allowPositionals: true, allowNegative: settings.allowNegative === true, strict: true });
464
+ parsed = parseArgs({ args: joinDashValues(withBare(own, all), all), options: all, allowPositionals: true, allowNegative: settings.allowNegative === true, strict: true });
447
465
  } catch (error) {
448
466
  const message = parseError(error);
449
467
  throw new UsageError(message, nearestOption(message, all, settings.allowNegative === true));
@@ -451,12 +469,84 @@ function parse(args, usage, options, settings = {}) {
451
469
  const values = parsed.values;
452
470
  applyOutput("color" in output ? values.color : undefined, "plain" in output ? values.plain : undefined);
453
471
  if (values.help === true) {
454
- console.log(wantsHelpJson() ? JSON.stringify(description(usage, settings)) : helpText(usage, all, undefined, settings));
472
+ console.log(wantsHelpJson() ? JSON.stringify(description(usage, settings)) : helpText(usage, listing, undefined, settings));
455
473
  throw new HelpShown;
456
474
  }
475
+ checkChoices(parsed.values, all);
476
+ checkConflicts(parsed.values, all);
457
477
  if (settings.positionals !== undefined)
458
478
  checkPositionals(parsed.positionals, settings.positionals);
459
- return { ...parsed, positionals: parsed.positionals, rest };
479
+ return { ...parsed, values: parsed.values, positionals: parsed.positionals, rest };
480
+ }
481
+ function splitRest(args, passes) {
482
+ const separator = passes ? args.indexOf("--") : -1;
483
+ return { own: separator === -1 ? args : args.slice(0, separator), rest: separator === -1 ? undefined : args.slice(separator + 1) };
484
+ }
485
+ function splitTrailing(args, options, count) {
486
+ const takesValue = (word) => !word.includes("=") && Object.entries(options).some(([name, { short, type }]) => type === "string" && (word === `--${name}` || word === `-${short}`));
487
+ let seen = 0;
488
+ if (count === 0)
489
+ return { own: args, rest: undefined };
490
+ for (let at = 0;at < args.length; at++) {
491
+ const word = args[at];
492
+ if (word === "--")
493
+ break;
494
+ if (word.startsWith("-")) {
495
+ if (takesValue(word))
496
+ at++;
497
+ continue;
498
+ }
499
+ seen++;
500
+ if (seen === count)
501
+ return { own: args.slice(0, at + 1), rest: args.slice(at + 1) };
502
+ }
503
+ return { own: args, rest: undefined };
504
+ }
505
+ function listed(options, allowNegative) {
506
+ if (!allowNegative)
507
+ return options;
508
+ return Object.fromEntries(Object.entries(options).flatMap(([name, option]) => {
509
+ if (option.type !== "boolean" || option.negative === undefined)
510
+ return [[name, option]];
511
+ return [...option.description === undefined ? [] : [[name, option]], [`no-${name}`, { type: "boolean", description: option.negative }]];
512
+ }));
513
+ }
514
+ function withBare(args, options) {
515
+ const bare = new Map(Object.entries(options).flatMap(([name, { short, optional }]) => optional === undefined ? [] : [[`--${name}`, optional], ...short === undefined ? [] : [[`-${short}`, optional]]]));
516
+ if (bare.size === 0)
517
+ return args;
518
+ const separator = args.indexOf("--");
519
+ const own = separator === -1 ? args : args.slice(0, separator);
520
+ return [...own.flatMap((arg, index) => {
521
+ const optional = bare.get(arg);
522
+ const next = own[index + 1];
523
+ const value = next !== undefined && (optional?.accepts === undefined ? !next.startsWith("-") : optional.accepts.test(next));
524
+ return optional === undefined || value ? [arg] : [arg, optional.bare];
525
+ }), ...separator === -1 ? [] : args.slice(separator)];
526
+ }
527
+ function checkConflicts(values, options) {
528
+ const given = (name) => values[name] !== undefined && values[name] !== false;
529
+ for (const [name, { conflicts = [] }] of Object.entries(options)) {
530
+ const other = given(name) ? conflicts.find(given) : undefined;
531
+ if (other !== undefined)
532
+ badUsage(`--${name} cannot be used with --${other}`);
533
+ }
534
+ }
535
+ function checkChoices(values, options) {
536
+ for (const [name, option] of Object.entries(options)) {
537
+ if (option.choices === undefined)
538
+ continue;
539
+ const given = values[name];
540
+ for (const value of Array.isArray(given) ? given : [given]) {
541
+ if (typeof value === "string")
542
+ oneOf(value, name, option.choices);
543
+ }
544
+ }
545
+ }
546
+ function oneOf(value, name, choices) {
547
+ if (!choices.includes(value))
548
+ badUsage(`${name.startsWith("<") ? name : `--${name}`} takes one of ${choices.join(", ")}, not ${value}`);
549
+ return value;
460
550
  }
461
551
  function checkPositionals(given, names) {
462
552
  const variadic = names.at(-1)?.replace("]", "").endsWith("...") === true;
@@ -505,29 +595,73 @@ function nearestOption(message, options, allowNegative) {
505
595
  const meant = closest(word, known.map((flag) => flag.replace(DASHES, "")));
506
596
  return meant === undefined ? undefined : `did you mean ${known.find((flag) => flag.replace(DASHES, "") === meant)}?`;
507
597
  }
508
- var WHOLE = /^\d+$/;
509
- function wholeNumber(value, name, fallback, min = 1) {
510
- if (value === undefined)
511
- return fallback;
512
- const number = Number(value);
513
- if (!WHOLE.test(value) || !Number.isSafeInteger(number) || number < min)
514
- badUsage(`${name.startsWith("<") ? name : `--${name}`} takes a whole number from ${min}, not ${value}`);
515
- return number;
516
- }
517
598
  // ../kit/src/progress.ts
518
599
  var ESC = String.fromCharCode(27);
519
600
  var ESCAPE_CODE = new RegExp(`${ESC}(?:\\[[\\x30-\\x3F]*[\\x20-\\x2F]*[\\x40-\\x7E]|\\][^\\u0007${ESC}]*(?:\\u0007|${ESC}\\\\))`, "y");
520
601
  var RESET_STYLE = `${ESC}[0m`;
521
602
  var CLOSE_LINK = `${ESC}]8;;${ESC}\\`;
522
603
  // ../kit/src/cli.ts
523
- import process3 from "process";
604
+ import process5 from "process";
605
+
606
+ // ../kit/src/usage.ts
607
+ import { appendFileSync, mkdirSync } from "fs";
608
+ import { homedir } from "os";
609
+ import { dirname, isAbsolute, join } from "path";
610
+ import process4 from "process";
611
+
612
+ // ../kit/src/logs.ts
613
+ var DAY_MS = 24 * 60 * 60 * 1000;
614
+ var CLI_FOLDER = "kaynooo-cli";
615
+
616
+ // ../kit/src/usage.ts
617
+ var UNKNOWN_OPTION2 = /unknown option '(--[a-z][a-z0-9-]*)[=']/;
618
+ var FLAG_NAME = /^(?:--[a-z][a-z0-9-]*|-[a-zA-Z])$/;
619
+ var LONGEST_NAME = 40;
620
+ var usageError;
621
+ function noteUsageError(message) {
622
+ usageError = message;
623
+ }
624
+ function stateHome(env = process4.env) {
625
+ const dir = env.XDG_STATE_HOME;
626
+ return dir !== undefined && isAbsolute(dir) ? dir : join(homedir(), ".local", "state");
627
+ }
628
+ function usagePath(env = process4.env) {
629
+ return join(stateHome(env), CLI_FOLDER, "usage.jsonl");
630
+ }
631
+ function usageRecorded(env = process4.env) {
632
+ const off = env.KAYNOOO_CLI_NO_USAGE;
633
+ return env.NODE_ENV !== "test" && (off === undefined || off === "" || off === "0");
634
+ }
635
+ function flagNames(argv) {
636
+ const end = argv.indexOf("--");
637
+ const names = (end === -1 ? argv : argv.slice(0, end)).filter((word) => word.startsWith("-") && word !== "-").map((word) => word.includes("=") ? word.slice(0, word.indexOf("=")) : word);
638
+ return [...new Set(names)].filter((name) => name.length <= LONGEST_NAME && FLAG_NAME.test(name));
639
+ }
640
+ function usageEntry(bin, command, argv, code, now = new Date) {
641
+ const unknown = code === 2 && usageError !== undefined ? UNKNOWN_OPTION2.exec(usageError)?.[1] : undefined;
642
+ usageError = undefined;
643
+ return { at: now.toISOString(), bin, ...command === undefined ? {} : { command }, flags: flagNames(argv), code, ...unknown === undefined ? {} : { unknown } };
644
+ }
645
+ function recordUsage(entry, env = process4.env) {
646
+ if (!usageRecorded(env))
647
+ return;
648
+ try {
649
+ const path = usagePath(env);
650
+ mkdirSync(dirname(path), { recursive: true, mode: 448 });
651
+ appendFileSync(path, `${JSON.stringify(entry)}
652
+ `, { mode: 384 });
653
+ } catch {}
654
+ }
655
+
656
+ // ../kit/src/cli.ts
524
657
  var LEVEL_OPTIONS = {
525
658
  ...OUTPUT_OPTIONS,
526
659
  help: { type: "boolean", short: "h", description: "show this help" }
527
660
  };
528
661
  var TOP_OPTIONS = { ...LEVEL_OPTIONS, version: { type: "boolean", short: "v", description: "print the version" } };
529
- async function commandRows(commands, colors) {
530
- const width = Math.max(...Object.keys(commands).map((name) => name.length));
662
+ async function commandRows(all, colors) {
663
+ const commands = shown(all);
664
+ const width = Math.max(0, ...Object.keys(commands).map((name) => name.length));
531
665
  const groups = new Map([["Commands:", []]]);
532
666
  const summaries = await Promise.all(Object.values(commands).map(async ({ summary }) => resolveSummary(summary)));
533
667
  for (const [index, [name, { group }]] of Object.entries(commands).entries()) {
@@ -538,6 +672,9 @@ async function commandRows(commands, colors) {
538
672
  }
539
673
  return [...groups].filter(([, rows]) => rows.length > 0).flatMap(([heading, rows], index) => [...index === 0 ? [] : [""], colors.bold(heading), ...rows]);
540
674
  }
675
+ function shown(commands) {
676
+ return Object.fromEntries(Object.entries(commands).filter(([, { hidden }]) => hidden !== true));
677
+ }
541
678
  function takeOutputFlags(argv) {
542
679
  let index = 0;
543
680
  for (;index < argv.length; index++) {
@@ -569,7 +706,7 @@ async function expand(scope, words) {
569
706
  }
570
707
  return { ...scope, commands, lazy: [] };
571
708
  }
572
- async function help({ path, header, summary: lazySummary, commands, defaultCommand, examples, replaces }, stream) {
709
+ async function help2({ path, header, summary: lazySummary, commands, defaultCommand, examples, replaces }, stream) {
573
710
  const colors = paint(stream);
574
711
  const prefix = path.join(" ");
575
712
  const summary = await resolveSummary(lazySummary);
@@ -596,8 +733,8 @@ async function help({ path, header, summary: lazySummary, commands, defaultComma
596
733
  `);
597
734
  }
598
735
  function printError(prefix, message, hint, cause) {
599
- const colors = paint(process3.stderr);
600
- const styled = takesControlCodes(process3.stderr);
736
+ const colors = paint(process5.stderr);
737
+ const styled = takesControlCodes(process5.stderr);
601
738
  const head = styled ? `${colors.red.bold("error")} ${colors.dim(`${prefix}:`)}` : `error: ${prefix}:`;
602
739
  const under = (label, text, tint) => text === undefined ? "" : `
603
740
  ${styled ? tint(label) : `${label}:`} ${text}`;
@@ -616,6 +753,8 @@ function reportThrown(prefix, error, redact = (text) => text, json = false) {
616
753
  const help = error instanceof UsageError ? `run ${prefix} --help for its options` : undefined;
617
754
  const named = error instanceof Error && !(error instanceof Exit) && error.name !== "Error" ? `${error.name}: ${error.message}` : undefined;
618
755
  const cause = error instanceof Error && error.cause instanceof Error ? redact(error.cause.message) : undefined;
756
+ if (error instanceof UsageError)
757
+ noteUsageError(error.message);
619
758
  const report = json ? printJsonError : (message, hint, causeText) => printError(prefix, message, hint, causeText);
620
759
  report(redact(named ?? (error instanceof Error ? error.message : String(error))), error instanceof Exit ? error.hint ?? help : undefined, cause);
621
760
  return error instanceof Exit ? error.code : 1;
@@ -629,12 +768,20 @@ async function dispatch(level, typed, { version, redact }) {
629
768
  return reportThrown(prefix, error);
630
769
  }
631
770
  const [name, ...args] = argv;
771
+ const fallback = level.defaultCommand === undefined ? undefined : level.commands[level.defaultCommand];
772
+ if (name === undefined && level.runBare && fallback !== undefined && "run" in fallback) {
773
+ try {
774
+ return await fallback.run([]);
775
+ } catch (error) {
776
+ return reportThrown(`${prefix} ${level.defaultCommand}`, error, redact, false);
777
+ }
778
+ }
632
779
  if (name === undefined && level.path.length > 1) {
633
- console.error(await help(await expand(level, [...level.path.slice(1), ...argv]), process3.stderr));
780
+ console.error(await help2(await expand(level, [...level.path.slice(1), ...argv]), process5.stderr));
634
781
  return 2;
635
782
  }
636
783
  if (name === undefined || name === "help" || name === "--help" || name === "-h") {
637
- console.log(await help(await expand(level, [...level.path.slice(1), ...argv]), process3.stdout));
784
+ console.log(await help2(await expand(level, [...level.path.slice(1), ...argv]), process5.stdout));
638
785
  return 0;
639
786
  }
640
787
  if (level.path.length === 1 && (name === "--version" || name === "-v")) {
@@ -643,6 +790,7 @@ async function dispatch(level, typed, { version, redact }) {
643
790
  }
644
791
  let command = level.commands[level.aliases?.[name] ?? name];
645
792
  let rest = args;
793
+ let ran = name;
646
794
  if (command === undefined && level.lazy.length > 0) {
647
795
  level = await expand(level, [...level.path.slice(1), ...argv]);
648
796
  command = level.commands[level.aliases?.[name] ?? name];
@@ -650,40 +798,77 @@ async function dispatch(level, typed, { version, redact }) {
650
798
  if (command === undefined && level.defaultCommand !== undefined) {
651
799
  command = level.commands[level.defaultCommand];
652
800
  rest = argv;
801
+ ran = level.defaultCommand;
653
802
  }
654
803
  if (command === undefined) {
655
- const meant = closest(name, Object.keys(level.commands));
804
+ const meant = closest(name, Object.keys(shown(level.commands)));
656
805
  printError(prefix, `no command ${name}`, meant === undefined ? `run ${prefix} --help for its commands` : `did you mean ${meant}?`);
657
806
  return 2;
658
807
  }
659
808
  if ("commands" in command) {
660
809
  const { summary } = command;
661
- return dispatch({ path: [...level.path, name], header: (colors, text) => `${colors.bold(`${prefix} ${name}`)} ${text}`, summary, ...scopeOf(command.commands, command.extraCommands, command.aliases), defaultCommand: undefined, examples: command.examples, replaces: undefined }, rest, { version, redact });
810
+ return dispatch({ path: [...level.path, name], header: (colors, text) => `${colors.bold(`${prefix} ${name}`)} ${text}`, summary, ...scopeOf(command.commands, command.extraCommands, command.aliases), defaultCommand: undefined, runBare: false, examples: command.examples, replaces: undefined }, rest, { version, redact });
662
811
  }
663
812
  try {
664
813
  return await command.run(rest);
665
814
  } catch (error) {
666
- return reportThrown(`${prefix} ${name}`, error, redact, wantsJson(rest));
815
+ return reportThrown(`${prefix} ${ran}`, error, redact, wantsJson(rest));
667
816
  }
668
817
  }
669
818
  var COMPLETE = "__complete";
670
819
  var FILES = "__files__";
671
- async function optionsOf(run) {
820
+ async function completingOf(run) {
672
821
  completion.active = true;
673
822
  try {
674
823
  await run([]);
675
824
  } catch (error) {
676
825
  if (error instanceof Completing)
677
- return error.options;
826
+ return error;
678
827
  } finally {
679
828
  completion.active = false;
680
829
  }
681
- return {};
830
+ return new Completing({});
831
+ }
832
+ async function optionsOf(run) {
833
+ return (await completingOf(run)).options;
834
+ }
835
+ function candidateLine(candidate) {
836
+ return typeof candidate === "string" ? candidate : candidate.join("\t");
837
+ }
838
+ function positionalBeingTyped(before, { options, positionals }) {
839
+ const takesValue = (word) => !word.includes("=") && Object.entries(options).some(([name, { short, type }]) => type === "string" && (word === `--${name}` || word === `-${short}`));
840
+ let index = 0;
841
+ let at = 0;
842
+ while (at < before.length) {
843
+ const word = before[at];
844
+ if (word === "--") {
845
+ index += before.length - at - 1;
846
+ break;
847
+ }
848
+ if (!word.startsWith("-"))
849
+ index++;
850
+ else if (takesValue(word))
851
+ at++;
852
+ at++;
853
+ }
854
+ const last = positionals.at(-1);
855
+ if (index < positionals.length)
856
+ return positionals[index];
857
+ return last?.replace("]", "").endsWith("...") === true ? last : undefined;
682
858
  }
683
859
  async function leafCandidates(run, words) {
684
- if (!(words.at(-1) ?? "").startsWith("-"))
685
- return [FILES];
686
- return Object.entries(await optionsOf(run)).map(([name, option]) => option.description === undefined ? `--${name}` : `--${name} ${option.description}`);
860
+ const completing = await completingOf(run);
861
+ if ((words.at(-1) ?? "").startsWith("-"))
862
+ return Object.entries(completing.options).map(([name, option]) => option.description === undefined ? `--${name}` : `--${name} ${option.description}`);
863
+ const flag = words.at(-2);
864
+ const option = flag?.startsWith("-") === true ? Object.entries(completing.options).find(([name, { short }]) => flag === `--${name}` || flag === `-${short}`)?.[1] : undefined;
865
+ if (option?.type === "string") {
866
+ const values = option.choices === undefined ? await option.candidates?.() : option.choices;
867
+ return values === undefined ? [FILES] : values.map(candidateLine);
868
+ }
869
+ const name = positionalBeingTyped(words.slice(0, -1), completing);
870
+ const values = name === undefined ? undefined : await completing.candidates[name]?.();
871
+ return values === undefined ? [FILES] : values.map(candidateLine);
687
872
  }
688
873
  async function candidates(scope, defaultCommand, words, before = []) {
689
874
  const [word = "", ...rest] = words;
@@ -694,8 +879,13 @@ async function candidates(scope, defaultCommand, words, before = []) {
694
879
  ({ commands, aliases } = await expand(scope, [...before, ...words]));
695
880
  command = commands[aliases?.[word] ?? word];
696
881
  }
697
- if (listing)
698
- return Promise.all(Object.entries(commands).map(async ([name, { summary }]) => `${name} ${await resolveSummary(summary)}`));
882
+ if (listing) {
883
+ const own = await Promise.all(Object.entries(shown(commands)).map(async ([name, { summary }]) => `${name} ${await resolveSummary(summary)}`));
884
+ const fallback = defaultCommand === undefined ? undefined : commands[defaultCommand];
885
+ const values = fallback !== undefined && "run" in fallback ? await leafCandidates(fallback.run, [word]) : [];
886
+ const valueOf = (line) => line.slice(0, line.includes("\t") ? line.indexOf("\t") : undefined);
887
+ return [...own, ...values.filter((line) => line !== FILES && !(valueOf(line) in commands))];
888
+ }
699
889
  if (command === undefined) {
700
890
  const fallback = defaultCommand === undefined ? undefined : commands[defaultCommand];
701
891
  return fallback !== undefined && "run" in fallback ? leafCandidates(fallback.run, words) : [];
@@ -707,15 +897,36 @@ async function printCandidates(found) {
707
897
  console.log(line);
708
898
  return 0;
709
899
  }
710
- async function runCli(cli, argv = process3.argv.slice(2)) {
900
+ async function runCli(cli, argv = process5.argv.slice(2)) {
711
901
  if (argv[0] === COMPLETE)
712
902
  return printCandidates(candidates(scopeOf(cli.commands, cli.extraCommands, cli.aliases), cli.defaultCommand, argv.slice(1)));
713
- return dispatch({ path: [cli.name], header: (colors, about) => `${colors.bold(cli.name)} ${colors.dim(cli.version)} ${about}`, summary: cli.about, ...scopeOf(cli.commands, cli.extraCommands, cli.aliases), defaultCommand: cli.defaultCommand, examples: cli.examples, replaces: cli.replaces }, argv, { version: cli.version, redact: cli.redact });
903
+ const code = await dispatch({ path: [cli.name], header: (colors, about) => `${colors.bold(cli.name)} ${colors.dim(cli.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: cli.version, redact: cli.redact });
904
+ if (cli.usage !== false) {
905
+ try {
906
+ recordUsage(usageEntry(cli.name, commandPath(scopeOf(cli.commands, cli.extraCommands, cli.aliases), argv), argv, code));
907
+ } catch {}
908
+ }
909
+ return code;
910
+ }
911
+ function commandPath(scope, argv) {
912
+ const path = [];
913
+ let level = scope;
914
+ for (const word of argv.filter((each) => !each.startsWith("-"))) {
915
+ const name = level.aliases !== undefined && Object.hasOwn(level.aliases, word) ? level.aliases[word] ?? word : word;
916
+ const command = Object.hasOwn(level.commands, name) ? level.commands[name] : undefined;
917
+ if (command === undefined)
918
+ break;
919
+ path.push(word);
920
+ if (!("commands" in command))
921
+ break;
922
+ level = scopeOf(command.commands, command.extraCommands, command.aliases);
923
+ }
924
+ return path.length === 0 ? undefined : path.join(" ");
714
925
  }
715
926
  // ../kit/src/limit.ts
716
927
  function limitOptions(fallback) {
717
928
  return {
718
- limit: { type: "string", description: `show at most this many rows, the rest counted (${fallback})` },
929
+ limit: { type: "string", short: "n", description: `show at most this many rows, the rest counted (${fallback})` },
719
930
  full: { type: "boolean", description: "show every row" }
720
931
  };
721
932
  }
@@ -733,8 +944,6 @@ function capped(rows, limit) {
733
944
  const more = rows.length - limit;
734
945
  return more > 0 ? { shown: rows.slice(0, limit), footer: moreFooter(more) } : { shown: [...rows], footer: undefined };
735
946
  }
736
- // ../kit/src/logs.ts
737
- var DAY_MS = 24 * 60 * 60 * 1000;
738
947
  // ../kit/src/secrets.ts
739
948
  var SECRET_WORDS = new Set(["key", "pass", "pwd", "auth", "salt", "cookie", "session", "jwt", "ssn", "iban", "card", "cvv", "otp"]);
740
949
  // ../kit/src/sessions.ts
@@ -742,19 +951,19 @@ var {Glob } = globalThis.Bun;
742
951
  var SESSION_FILES = new Glob("*.json");
743
952
  var ACCOUNT_DIRS = new Glob("*/sessions");
744
953
  // package.json
745
- var version = "0.4.0";
954
+ var version = "0.4.1";
746
955
 
747
956
  // src/commands/audit.ts
748
- import { homedir } from "os";
957
+ import { homedir as homedir2 } from "os";
749
958
  import { resolve as resolve2 } from "path";
750
- import process7 from "process";
959
+ import process9 from "process";
751
960
 
752
961
  // src/audit/compose.ts
753
- import { join } from "path";
754
- import process5 from "process";
962
+ import { join as join2 } from "path";
963
+ import process7 from "process";
755
964
  var dockerCompose = async (root, files) => {
756
- const args = ["docker", "compose", "--project-directory", root, ...files.flatMap((file) => ["-f", join(root, file)]), "config", "--no-interpolate", "--format", "json"];
757
- const run = Bun.spawn(args, { stdout: "pipe", stderr: "pipe", env: { ...process5.env, COMPOSE_FILE: "" } });
965
+ const args = ["docker", "compose", "--project-directory", root, ...files.flatMap((file) => ["-f", join2(root, file)]), "config", "--no-interpolate", "--format", "json"];
966
+ const run = Bun.spawn(args, { stdout: "pipe", stderr: "pipe", env: { ...process7.env, COMPOSE_FILE: "" } });
758
967
  const [out, err, code] = await Promise.all([run.stdout.text(), run.stderr.text(), run.exited]);
759
968
  const last = err.trim().split(`
760
969
  `).at(-1) ?? "";
@@ -765,8 +974,8 @@ var dockerCompose = async (root, files) => {
765
974
 
766
975
  // src/audit/render.ts
767
976
  import { basename } from "path";
768
- import process6 from "process";
769
- var line = (finding) => ` ${marked(finding.level === "error" ? "problem" : "warn", `[${finding.check}] ${finding.message}`, process6.stdout)}`;
977
+ import process8 from "process";
978
+ var line = (finding) => ` ${marked(finding.level === "error" ? "problem" : "warn", `[${finding.check}] ${finding.message}`, process8.stdout)}`;
770
979
  function errorsOf(result) {
771
980
  return result.findings.filter((finding) => finding.level === "error");
772
981
  }
@@ -778,7 +987,7 @@ function render(result, limit = Number.POSITIVE_INFINITY) {
778
987
  const errors = errorsOf(result);
779
988
  const warnings = result.findings.filter((finding) => finding.level === "warn");
780
989
  if (result.findings.length === 0)
781
- return marked("ok", `${basename(result.root)}: compose ${result.composeFiles.join(", ")} and release.config.ts agree.`, process6.stdout);
990
+ return marked("ok", `${basename(result.root)}: compose ${result.composeFiles.join(", ")} and release.config.ts agree.`, process8.stdout);
782
991
  return [
783
992
  ...section("Errors", errors, limit),
784
993
  ...section("Warnings", warnings, limit),
@@ -789,11 +998,11 @@ function render(result, limit = Number.POSITIVE_INFINITY) {
789
998
 
790
999
  // src/audit/run.ts
791
1000
  import { existsSync as existsSync3 } from "fs";
792
- import { join as join4 } from "path";
1001
+ import { join as join5 } from "path";
793
1002
 
794
1003
  // src/audit/checks.ts
795
1004
  import { existsSync, readFileSync } from "fs";
796
- import { isAbsolute, join as join2, relative, resolve } from "path";
1005
+ import { isAbsolute as isAbsolute2, join as join3, relative, resolve } from "path";
797
1006
  var ENV_REF = /(?<!\$)\$(?:\{([A-Z_]\w*)(\s*:?[-?+][^}]*)?\}|([A-Z_]\w*))/gi;
798
1007
  var REQUIRED_OPERATOR = /^\s*:?\?/;
799
1008
  var COMMENT_START = /(?:^|\s)#.*$/;
@@ -809,18 +1018,18 @@ function before(text, separator) {
809
1018
  }
810
1019
  var stripDotSlash = (file) => file.replace(LEADING_DOT_SLASH, "");
811
1020
  function composeLayout(root, config) {
812
- const composeFiles = (config.deploySyncFiles ?? []).map(stripDotSlash).filter((file) => YAML_FILE.test(file) && existsSync(join2(root, file)));
1021
+ const composeFiles = (config.deploySyncFiles ?? []).map(stripDotSlash).filter((file) => YAML_FILE.test(file) && existsSync(join3(root, file)));
813
1022
  const [base] = composeFiles.toSorted((a, b) => a.length - b.length);
814
1023
  return { composeFiles, base, overlays: composeFiles.filter((file) => file !== base) };
815
1024
  }
816
1025
  function syncFindings(root, config) {
817
- return (config.deploySyncFiles ?? []).filter((file) => !existsSync(join2(root, stripDotSlash(file)))).map((file) => ({ level: "error", check: "sync", message: `deploySyncFiles entry does not exist: ${file}` }));
1026
+ return (config.deploySyncFiles ?? []).filter((file) => !existsSync(join3(root, stripDotSlash(file)))).map((file) => ({ level: "error", check: "sync", message: `deploySyncFiles entry does not exist: ${file}` }));
818
1027
  }
819
1028
  function buildFindings(root, releases, env, home) {
820
1029
  const findings = [];
821
1030
  const missing = (release, key) => {
822
1031
  const path = release[key];
823
- if (path !== undefined && path !== "" && !existsSync(join2(root, path)))
1032
+ if (path !== undefined && path !== "" && !existsSync(join3(root, path)))
824
1033
  findings.push({ level: "error", check: "build", message: `${release.slug}: ${key} does not exist: ${path}` });
825
1034
  };
826
1035
  for (const release of releases) {
@@ -829,7 +1038,7 @@ function buildFindings(root, releases, env, home) {
829
1038
  missing(release, "dockerfile");
830
1039
  for (const secret of release.buildSecrets ?? []) {
831
1040
  if (secret.src !== undefined && secret.src !== "") {
832
- const path = secret.src.startsWith("~") ? join2(home, secret.src.slice(1)) : resolve(root, secret.src);
1041
+ const path = secret.src.startsWith("~") ? join3(home, secret.src.slice(1)) : resolve(root, secret.src);
833
1042
  if (!existsSync(path))
834
1043
  findings.push({ level: "error", check: "build", message: `${release.slug}: buildSecret "${secret.id}" src does not exist: ${secret.src}` });
835
1044
  }
@@ -847,7 +1056,7 @@ function withoutComment(line) {
847
1056
  }
848
1057
  function envRefs(root, composeFiles) {
849
1058
  return composeFiles.flatMap((file) => {
850
- const text = readFileSync(join2(root, file), "utf8").split(`
1059
+ const text = readFileSync(join3(root, file), "utf8").split(`
851
1060
  `).map(withoutComment).join(`
852
1061
  `);
853
1062
  return [...text.matchAll(ENV_REF)].map((match) => ({ name: match[1] ?? match[3], defaulted: match[2] !== undefined && !REQUIRED_OPERATOR.test(match[2]), file }));
@@ -959,12 +1168,12 @@ function relativeSource(root, source) {
959
1168
  if (source.startsWith("."))
960
1169
  return source;
961
1170
  const inRoot = relative(resolve(root), source);
962
- return isAbsolute(source) && inRoot !== "" && !inRoot.startsWith("..") ? `./${inRoot}` : undefined;
1171
+ return isAbsolute2(source) && inRoot !== "" && !inRoot.startsWith("..") ? `./${inRoot}` : undefined;
963
1172
  }
964
1173
  function layoutFindings(root, base, model) {
965
1174
  if (base === undefined)
966
1175
  return [];
967
- const header = readFileSync(join2(root, base), "utf8").split(SERVICES_KEY)[0] ?? "";
1176
+ const header = readFileSync(join3(root, base), "utf8").split(SERVICES_KEY)[0] ?? "";
968
1177
  const findings = [];
969
1178
  for (const [name, service] of services(model)) {
970
1179
  for (const volume of service.volumes ?? []) {
@@ -976,14 +1185,14 @@ function layoutFindings(root, base, model) {
976
1185
  return findings;
977
1186
  }
978
1187
  function gitignoreFindings(root) {
979
- const path = join2(root, ".gitignore");
1188
+ const path = join3(root, ".gitignore");
980
1189
  const text = existsSync(path) ? readFileSync(path, "utf8") : "";
981
1190
  return [".release-logs", ".release-worktrees"].filter((entry) => !text.includes(entry)).map((entry) => ({ level: "warn", check: "gitignore", message: `${entry}/ is not in .gitignore` }));
982
1191
  }
983
1192
 
984
1193
  // src/audit/nuxt.ts
985
1194
  import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
986
- import { basename as basename2, join as join3 } from "path";
1195
+ import { basename as basename2, join as join4 } from "path";
987
1196
  var CAMEL_BOUNDARY = /([a-z0-9])([A-Z])/g;
988
1197
  var KEY = /([A-Z_]\w*)\s*(?:\?\s*)?:/gi;
989
1198
  var OPENS_BRACE = /^\s*\{/;
@@ -1026,9 +1235,9 @@ function schemaEnvNames(schema, iface, prefix) {
1026
1235
  }
1027
1236
  function nuxtFindings(root, releases, model) {
1028
1237
  const findings = [];
1029
- const dirs = [...new Set(releases.map((release) => release.buildContext).filter((context) => context !== undefined && context !== ""))].map((dir) => join3(root, dir)).filter((dir) => existsSync2(join3(dir, "nuxt.config.ts")));
1238
+ const dirs = [...new Set(releases.map((release) => release.buildContext).filter((context) => context !== undefined && context !== ""))].map((dir) => join4(root, dir)).filter((dir) => existsSync2(join4(dir, "nuxt.config.ts")));
1030
1239
  for (const dir of dirs) {
1031
- const schemaPath = [join3(dir, ".nuxt/types/schema.d.ts"), join3(dir, ".nuxt/types/runtime-config.d.ts")].find((path) => existsSync2(path));
1240
+ const schemaPath = [join4(dir, ".nuxt/types/schema.d.ts"), join4(dir, ".nuxt/types/runtime-config.d.ts")].find((path) => existsSync2(path));
1032
1241
  let allowed;
1033
1242
  let level = "error";
1034
1243
  let source;
@@ -1040,7 +1249,7 @@ function nuxtFindings(root, releases, model) {
1040
1249
  ]);
1041
1250
  source = `${basename2(dir)}/${schemaPath.slice(dir.length + 1)}`;
1042
1251
  } else {
1043
- const config = readFileSync2(join3(dir, "nuxt.config.ts"), "utf8");
1252
+ const config = readFileSync2(join4(dir, "nuxt.config.ts"), "utf8");
1044
1253
  const at = config.indexOf("runtimeConfig:");
1045
1254
  const block = at < 0 ? undefined : braceBody(config, at);
1046
1255
  if (block === undefined)
@@ -1071,7 +1280,7 @@ function installed(specifier, root) {
1071
1280
  }
1072
1281
  }
1073
1282
  async function loadConfig(root) {
1074
- const specifier = DEFINE_CONFIG_IMPORT.exec(await Bun.file(join4(root, CONFIG_FILE)).text())?.[1];
1283
+ const specifier = DEFINE_CONFIG_IMPORT.exec(await Bun.file(join5(root, CONFIG_FILE)).text())?.[1];
1075
1284
  if (specifier !== undefined && !installed(specifier, root)) {
1076
1285
  Bun.plugin({
1077
1286
  name: "release-stand-in",
@@ -1080,7 +1289,7 @@ async function loadConfig(root) {
1080
1289
  }
1081
1290
  });
1082
1291
  }
1083
- const config = (await import(join4(root, CONFIG_FILE))).default;
1292
+ const config = (await import(join5(root, CONFIG_FILE))).default;
1084
1293
  if (config === undefined)
1085
1294
  fail(`${CONFIG_FILE} has no default export`);
1086
1295
  return config;
@@ -1129,10 +1338,10 @@ async function audit(config, options) {
1129
1338
  ];
1130
1339
  return { root, composeFiles, findings };
1131
1340
  }
1132
- var hasConfig = (root) => existsSync3(join4(root, CONFIG_FILE));
1341
+ var hasConfig = (root) => existsSync3(join5(root, CONFIG_FILE));
1133
1342
 
1134
1343
  // src/commands/audit.ts
1135
- var usage = `stack audit [dir]
1344
+ var usage2 = `stack audit [dir]
1136
1345
 
1137
1346
  Cross-checks ${CONFIG_FILE} in dir (the current directory) against the compose files it syncs: sync files and build inputs exist, env variables are required or defaulted, versionEnv matches the compose interpolation, restart and post-deploy services exist, healthchecks, routing in overlays, bind mounts documented in the header, Nuxt runtimeConfig keys and .gitignore.
1138
1347
  Lists at most 25 errors and 25 warnings, the count of the rest after them (--limit <n>, --full for all); --json is never cut.
@@ -1145,13 +1354,13 @@ var options = {
1145
1354
  json: jsonOption("{ root, composeFiles, findings }")
1146
1355
  };
1147
1356
  async function audit2(args, overrides = {}) {
1148
- const parsed = parse(args, usage, options);
1357
+ const parsed = parse(args, usage2, options);
1149
1358
  const root = resolve2(parsed.positionals[0] ?? ".");
1150
1359
  if (!hasConfig(root)) {
1151
1360
  console.error(`no ${CONFIG_FILE} in ${root}`);
1152
1361
  return 2;
1153
1362
  }
1154
- const result = await audit(await loadConfig(root), { root, loadCompose: dockerCompose, env: process7.env, home: homedir(), ...overrides });
1363
+ const result = await audit(await loadConfig(root), { root, loadCompose: dockerCompose, env: process9.env, home: homedir2(), ...overrides });
1155
1364
  if (parsed.values.json === true)
1156
1365
  printJson(result);
1157
1366
  else
@@ -1183,7 +1392,7 @@ function isListening(port) {
1183
1392
  }
1184
1393
 
1185
1394
  // src/commands/port.ts
1186
- var usage2 = `stack port <name>
1395
+ var usage3 = `stack port <name>
1187
1396
 
1188
1397
  Prints the port a name always hashes to (32-bit FNV-1a, ${MIN_PORT}-${DEFAULT_MAX_PORT} by default, below Linux's ephemeral range), so a service keeps the same port on every machine.
1189
1398
  Says on stderr when something already listens on it; the exit code stays 0.
@@ -1195,7 +1404,7 @@ var options2 = {
1195
1404
  json: jsonOption("{name, port, listening}")
1196
1405
  };
1197
1406
  async function port(args) {
1198
- const parsed = parse(args, usage2, options2);
1407
+ const parsed = parse(args, usage3, options2);
1199
1408
  const [name] = parsed.positionals;
1200
1409
  if (name === undefined)
1201
1410
  fail("a name is needed");
@@ -1215,7 +1424,7 @@ async function port(args) {
1215
1424
  }
1216
1425
 
1217
1426
  // src/cli.ts
1218
- process8.exitCode = await runCli({
1427
+ process10.exitCode = await runCli({
1219
1428
  name: "stack",
1220
1429
  version,
1221
1430
  about: "a stable port per service name, and a compose release audit",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kaynooo/cli-stack",
3
3
  "type": "module",
4
- "version": "0.4.0",
4
+ "version": "0.4.1",
5
5
  "description": "stack: a stable port per service name, and an audit of a compose release setup against its release.config.ts.",
6
6
  "author": "Kaynooo <contact@kaynooo.fr>",
7
7
  "license": "MIT",
@@ -28,6 +28,6 @@
28
28
  "stack": "$npm_execpath src/cli.ts"
29
29
  },
30
30
  "devDependencies": {
31
- "@kaynooo/cli-kit": "0.15.0"
31
+ "@kaynooo/cli-kit": "0.20.0"
32
32
  }
33
33
  }