pubm 0.0.4 → 0.1.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/bin/cli.js CHANGED
@@ -453,7 +453,7 @@ __export(base_exports, {
453
453
  scrollDown: () => scrollDown,
454
454
  scrollUp: () => scrollUp
455
455
  });
456
- import process2 from "node:process";
456
+ import process6 from "node:process";
457
457
  var ESC, OSC, BEL, SEP, isTerminalApp, isWindows3, cwdFunction, cursorTo, cursorMove, cursorUp, cursorDown, cursorForward, cursorBackward, cursorLeft, cursorSavePosition, cursorRestorePosition, cursorGetPosition, cursorNextLine, cursorPrevLine, cursorHide, cursorShow, eraseLines, eraseEndLine, eraseStartLine, eraseLine, eraseDown, eraseUp, eraseScreen, scrollUp, scrollDown, clearScreen, clearTerminal, enterAlternativeScreen, exitAlternativeScreen, beep, link, image, iTerm;
458
458
  var init_base = __esm({
459
459
  "node_modules/.pnpm/ansi-escapes@7.0.0/node_modules/ansi-escapes/base.js"() {
@@ -463,11 +463,11 @@ var init_base = __esm({
463
463
  OSC = "\x1B]";
464
464
  BEL = "\x07";
465
465
  SEP = ";";
466
- isTerminalApp = !isBrowser && process2.env.TERM_PROGRAM === "Apple_Terminal";
467
- isWindows3 = !isBrowser && process2.platform === "win32";
466
+ isTerminalApp = !isBrowser && process6.env.TERM_PROGRAM === "Apple_Terminal";
467
+ isWindows3 = !isBrowser && process6.platform === "win32";
468
468
  cwdFunction = isBrowser ? () => {
469
469
  throw new Error("`process.cwd()` only works in Node.js, not the browser.");
470
- } : process2.cwd;
470
+ } : process6.cwd;
471
471
  cursorTo = (x, y) => {
472
472
  if (typeof x !== "number") {
473
473
  throw new TypeError("The `x` argument is required");
@@ -543,32 +543,32 @@ var init_base = __esm({
543
543
  SEP,
544
544
  BEL
545
545
  ].join("");
546
- image = (data, options2 = {}) => {
546
+ image = (data, options = {}) => {
547
547
  let returnValue = `${OSC}1337;File=inline=1`;
548
- if (options2.width) {
549
- returnValue += `;width=${options2.width}`;
548
+ if (options.width) {
549
+ returnValue += `;width=${options.width}`;
550
550
  }
551
- if (options2.height) {
552
- returnValue += `;height=${options2.height}`;
551
+ if (options.height) {
552
+ returnValue += `;height=${options.height}`;
553
553
  }
554
- if (options2.preserveAspectRatio === false) {
554
+ if (options.preserveAspectRatio === false) {
555
555
  returnValue += ";preserveAspectRatio=0";
556
556
  }
557
557
  return returnValue + ":" + Buffer.from(data).toString("base64") + BEL;
558
558
  };
559
559
  iTerm = {
560
560
  setCwd: (cwd = cwdFunction()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,
561
- annotation(message, options2 = {}) {
561
+ annotation(message, options = {}) {
562
562
  let returnValue = `${OSC}1337;`;
563
- const hasX = options2.x !== void 0;
564
- const hasY = options2.y !== void 0;
565
- if ((hasX || hasY) && !(hasX && hasY && options2.length !== void 0)) {
563
+ const hasX = options.x !== void 0;
564
+ const hasY = options.y !== void 0;
565
+ if ((hasX || hasY) && !(hasX && hasY && options.length !== void 0)) {
566
566
  throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");
567
567
  }
568
568
  message = message.replaceAll("|", "");
569
- returnValue += options2.isHidden ? "AddHiddenAnnotation=" : "AddAnnotation=";
570
- if (options2.length > 0) {
571
- returnValue += (hasX ? [message, options2.length, options2.x, options2.y] : [options2.length, message]).join("|");
569
+ returnValue += options.isHidden ? "AddHiddenAnnotation=" : "AddAnnotation=";
570
+ if (options.length > 0) {
571
+ returnValue += (hasX ? [message, options.length, options.x, options.y] : [options.length, message]).join("|");
572
572
  } else {
573
573
  returnValue += message;
574
574
  }
@@ -646,7 +646,7 @@ var init_onetime = __esm({
646
646
  "use strict";
647
647
  init_mimic_function();
648
648
  calledFunctions = /* @__PURE__ */ new WeakMap();
649
- onetime = (function_, options2 = {}) => {
649
+ onetime = (function_, options = {}) => {
650
650
  if (typeof function_ !== "function") {
651
651
  throw new TypeError("Expected a function");
652
652
  }
@@ -658,7 +658,7 @@ var init_onetime = __esm({
658
658
  if (callCount === 1) {
659
659
  returnValue = function_.apply(this, arguments_);
660
660
  function_ = void 0;
661
- } else if (options2.throw === true) {
661
+ } else if (options.throw === true) {
662
662
  throw new Error(`Function \`${functionName}\` can only be called once`);
663
663
  }
664
664
  return returnValue;
@@ -708,12 +708,12 @@ var init_signals = __esm({
708
708
  });
709
709
 
710
710
  // node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
711
- var processOk, kExitEmitter, global, ObjectDefineProperty, Emitter, SignalExitBase, signalExitWrap, SignalExitFallback, _hupSig, _emitter, _process, _originalProcessEmit, _originalProcessReallyExit, _sigListeners, _loaded, _SignalExit_instances, processReallyExit_fn, processEmit_fn, SignalExit, process3, onExit, load, unload;
711
+ var processOk, kExitEmitter, global, ObjectDefineProperty, Emitter, SignalExitBase, signalExitWrap, SignalExitFallback, _hupSig, _emitter, _process, _originalProcessEmit, _originalProcessReallyExit, _sigListeners, _loaded, _SignalExit_instances, processReallyExit_fn, processEmit_fn, SignalExit, process7, onExit, load, unload;
712
712
  var init_mjs = __esm({
713
713
  "node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js"() {
714
714
  "use strict";
715
715
  init_signals();
716
- processOk = (process11) => !!process11 && typeof process11 === "object" && typeof process11.removeListener === "function" && typeof process11.emit === "function" && typeof process11.reallyExit === "function" && typeof process11.listeners === "function" && typeof process11.kill === "function" && typeof process11.pid === "number" && typeof process11.on === "function";
716
+ processOk = (process16) => !!process16 && typeof process16 === "object" && typeof process16.removeListener === "function" && typeof process16.emit === "function" && typeof process16.reallyExit === "function" && typeof process16.listeners === "function" && typeof process16.kill === "function" && typeof process16.pid === "number" && typeof process16.on === "function";
717
717
  kExitEmitter = Symbol.for("signal-exit emitter");
718
718
  global = globalThis;
719
719
  ObjectDefineProperty = Object.defineProperty.bind(Object);
@@ -795,13 +795,13 @@ var init_mjs = __esm({
795
795
  }
796
796
  };
797
797
  SignalExit = class extends SignalExitBase {
798
- constructor(process11) {
798
+ constructor(process16) {
799
799
  super();
800
800
  __privateAdd(this, _SignalExit_instances);
801
801
  // "SIGHUP" throws an `ENOSYS` error on Windows,
802
802
  // so use a supported signal instead
803
803
  /* c8 ignore start */
804
- __privateAdd(this, _hupSig, process3.platform === "win32" ? "SIGINT" : "SIGHUP");
804
+ __privateAdd(this, _hupSig, process7.platform === "win32" ? "SIGINT" : "SIGHUP");
805
805
  /* c8 ignore stop */
806
806
  __privateAdd(this, _emitter, new Emitter());
807
807
  __privateAdd(this, _process);
@@ -809,13 +809,13 @@ var init_mjs = __esm({
809
809
  __privateAdd(this, _originalProcessReallyExit);
810
810
  __privateAdd(this, _sigListeners, {});
811
811
  __privateAdd(this, _loaded, false);
812
- __privateSet(this, _process, process11);
812
+ __privateSet(this, _process, process16);
813
813
  __privateSet(this, _sigListeners, {});
814
814
  for (const sig of signals) {
815
815
  __privateGet(this, _sigListeners)[sig] = () => {
816
816
  const listeners = __privateGet(this, _process).listeners(sig);
817
817
  let { count } = __privateGet(this, _emitter);
818
- const p = process11;
818
+ const p = process16;
819
819
  if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
820
820
  count += p.__signal_exit_emitter__.count;
821
821
  }
@@ -824,12 +824,12 @@ var init_mjs = __esm({
824
824
  const ret = __privateGet(this, _emitter).emit("exit", null, sig);
825
825
  const s = sig === "SIGHUP" ? __privateGet(this, _hupSig) : sig;
826
826
  if (!ret)
827
- process11.kill(process11.pid, s);
827
+ process16.kill(process16.pid, s);
828
828
  }
829
829
  };
830
830
  }
831
- __privateSet(this, _originalProcessReallyExit, process11.reallyExit);
832
- __privateSet(this, _originalProcessEmit, process11.emit);
831
+ __privateSet(this, _originalProcessReallyExit, process16.reallyExit);
832
+ __privateSet(this, _originalProcessEmit, process16.emit);
833
833
  }
834
834
  onExit(cb, opts) {
835
835
  if (!processOk(__privateGet(this, _process))) {
@@ -918,7 +918,7 @@ var init_mjs = __esm({
918
918
  return og.call(__privateGet(this, _process), ev, ...args);
919
919
  }
920
920
  };
921
- process3 = globalThis.process;
921
+ process7 = globalThis.process;
922
922
  ({
923
923
  onExit: (
924
924
  /**
@@ -952,19 +952,19 @@ var init_mjs = __esm({
952
952
  */
953
953
  unload
954
954
  )
955
- } = signalExitWrap(processOk(process3) ? new SignalExit(process3) : new SignalExitFallback()));
955
+ } = signalExitWrap(processOk(process7) ? new SignalExit(process7) : new SignalExitFallback()));
956
956
  }
957
957
  });
958
958
 
959
959
  // node_modules/.pnpm/restore-cursor@5.1.0/node_modules/restore-cursor/index.js
960
- import process4 from "node:process";
960
+ import process8 from "node:process";
961
961
  var terminal, restoreCursor, restore_cursor_default;
962
962
  var init_restore_cursor = __esm({
963
963
  "node_modules/.pnpm/restore-cursor@5.1.0/node_modules/restore-cursor/index.js"() {
964
964
  "use strict";
965
965
  init_onetime();
966
966
  init_mjs();
967
- terminal = process4.stderr.isTTY ? process4.stderr : process4.stdout.isTTY ? process4.stdout : void 0;
967
+ terminal = process8.stderr.isTTY ? process8.stderr : process8.stdout.isTTY ? process8.stdout : void 0;
968
968
  restoreCursor = terminal ? onetime_default(() => {
969
969
  onExit(() => {
970
970
  terminal.write("\x1B[?25h");
@@ -976,7 +976,7 @@ var init_restore_cursor = __esm({
976
976
  });
977
977
 
978
978
  // node_modules/.pnpm/cli-cursor@5.0.0/node_modules/cli-cursor/index.js
979
- import process5 from "node:process";
979
+ import process9 from "node:process";
980
980
  var isHidden, cliCursor, cli_cursor_default;
981
981
  var init_cli_cursor = __esm({
982
982
  "node_modules/.pnpm/cli-cursor@5.0.0/node_modules/cli-cursor/index.js"() {
@@ -984,14 +984,14 @@ var init_cli_cursor = __esm({
984
984
  init_restore_cursor();
985
985
  isHidden = false;
986
986
  cliCursor = {};
987
- cliCursor.show = (writableStream = process5.stderr) => {
987
+ cliCursor.show = (writableStream = process9.stderr) => {
988
988
  if (!writableStream.isTTY) {
989
989
  return;
990
990
  }
991
991
  isHidden = false;
992
992
  writableStream.write("\x1B[?25h");
993
993
  };
994
- cliCursor.hide = (writableStream = process5.stderr) => {
994
+ cliCursor.hide = (writableStream = process9.stderr) => {
995
995
  if (!writableStream.isTTY) {
996
996
  return;
997
997
  }
@@ -1092,14 +1092,14 @@ var init_emoji_regex = __esm({
1092
1092
  });
1093
1093
 
1094
1094
  // node_modules/.pnpm/string-width@7.2.0/node_modules/string-width/index.js
1095
- function stringWidth(string, options2 = {}) {
1095
+ function stringWidth(string, options = {}) {
1096
1096
  if (typeof string !== "string" || string.length === 0) {
1097
1097
  return 0;
1098
1098
  }
1099
1099
  const {
1100
1100
  ambiguousIsNarrow = true,
1101
1101
  countAnsiEscapeCodes = false
1102
- } = options2;
1102
+ } = options;
1103
1103
  if (!countAnsiEscapeCodes) {
1104
1104
  string = stripAnsi(string);
1105
1105
  }
@@ -1345,8 +1345,8 @@ var wrap_ansi_exports = {};
1345
1345
  __export(wrap_ansi_exports, {
1346
1346
  default: () => wrapAnsi
1347
1347
  });
1348
- function wrapAnsi(string, columns, options2) {
1349
- return String(string).normalize().replaceAll("\r\n", "\n").split("\n").map((line) => exec(line, columns, options2)).join("\n");
1348
+ function wrapAnsi(string, columns, options) {
1349
+ return String(string).normalize().replaceAll("\r\n", "\n").split("\n").map((line) => exec(line, columns, options)).join("\n");
1350
1350
  }
1351
1351
  var ESCAPES, END_CODE, ANSI_ESCAPE_BELL, ANSI_CSI, ANSI_OSC, ANSI_SGR_TERMINATOR, ANSI_ESCAPE_LINK, wrapAnsiCode, wrapAnsiHyperlink, wordLengths, wrapWord, stringVisibleTrimSpacesRight, exec;
1352
1352
  var init_wrap_ansi = __esm({
@@ -1421,8 +1421,8 @@ var init_wrap_ansi = __esm({
1421
1421
  }
1422
1422
  return words.slice(0, last).join(" ") + words.slice(last).join("");
1423
1423
  };
1424
- exec = (string, columns, options2 = {}) => {
1425
- if (options2.trim !== false && string.trim() === "") {
1424
+ exec = (string, columns, options = {}) => {
1425
+ if (options.trim !== false && string.trim() === "") {
1426
1426
  return "";
1427
1427
  }
1428
1428
  let returnValue = "";
@@ -1431,21 +1431,21 @@ var init_wrap_ansi = __esm({
1431
1431
  const lengths = wordLengths(string);
1432
1432
  let rows = [""];
1433
1433
  for (const [index, word] of string.split(" ").entries()) {
1434
- if (options2.trim !== false) {
1434
+ if (options.trim !== false) {
1435
1435
  rows[rows.length - 1] = rows.at(-1).trimStart();
1436
1436
  }
1437
1437
  let rowLength = stringWidth(rows.at(-1));
1438
1438
  if (index !== 0) {
1439
- if (rowLength >= columns && (options2.wordWrap === false || options2.trim === false)) {
1439
+ if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
1440
1440
  rows.push("");
1441
1441
  rowLength = 0;
1442
1442
  }
1443
- if (rowLength > 0 || options2.trim === false) {
1443
+ if (rowLength > 0 || options.trim === false) {
1444
1444
  rows[rows.length - 1] += " ";
1445
1445
  rowLength++;
1446
1446
  }
1447
1447
  }
1448
- if (options2.hard && lengths[index] > columns) {
1448
+ if (options.hard && lengths[index] > columns) {
1449
1449
  const remainingColumns = columns - rowLength;
1450
1450
  const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns);
1451
1451
  const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns);
@@ -1456,19 +1456,19 @@ var init_wrap_ansi = __esm({
1456
1456
  continue;
1457
1457
  }
1458
1458
  if (rowLength + lengths[index] > columns && rowLength > 0 && lengths[index] > 0) {
1459
- if (options2.wordWrap === false && rowLength < columns) {
1459
+ if (options.wordWrap === false && rowLength < columns) {
1460
1460
  wrapWord(rows, word, columns);
1461
1461
  continue;
1462
1462
  }
1463
1463
  rows.push("");
1464
1464
  }
1465
- if (rowLength + lengths[index] > columns && options2.wordWrap === false) {
1465
+ if (rowLength + lengths[index] > columns && options.wordWrap === false) {
1466
1466
  wrapWord(rows, word, columns);
1467
1467
  continue;
1468
1468
  }
1469
1469
  rows[rows.length - 1] += word;
1470
1470
  }
1471
- if (options2.trim !== false) {
1471
+ if (options.trim !== false) {
1472
1472
  rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
1473
1473
  }
1474
1474
  const preString = rows.join("\n");
@@ -1667,7 +1667,7 @@ __export(log_update_exports, {
1667
1667
  default: () => log_update_default,
1668
1668
  logUpdateStderr: () => logUpdateStderr
1669
1669
  });
1670
- import process6 from "node:process";
1670
+ import process10 from "node:process";
1671
1671
  function createLogUpdate(stream, { showCursor = false } = {}) {
1672
1672
  let previousLineCount = 0;
1673
1673
  let previousWidth = getWidth(stream);
@@ -1721,9 +1721,9 @@ var init_log_update = __esm({
1721
1721
  const toRemove = Math.max(0, lines.length - terminalHeight);
1722
1722
  return toRemove ? sliceAnsi(text, stripAnsi(lines.slice(0, toRemove).join("\n")).length + 1) : text;
1723
1723
  };
1724
- logUpdate = createLogUpdate(process6.stdout);
1724
+ logUpdate = createLogUpdate(process10.stdout);
1725
1725
  log_update_default = logUpdate;
1726
- logUpdateStderr = createLogUpdate(process6.stderr);
1726
+ logUpdateStderr = createLogUpdate(process10.stderr);
1727
1727
  }
1728
1728
  });
1729
1729
 
@@ -1864,13 +1864,13 @@ function getIndexOfNearestSpace(string, wantedIndex, shouldSearchRight) {
1864
1864
  }
1865
1865
  return wantedIndex;
1866
1866
  }
1867
- function cliTruncate(text, columns, options2 = {}) {
1867
+ function cliTruncate(text, columns, options = {}) {
1868
1868
  const {
1869
1869
  position = "end",
1870
1870
  space = false,
1871
1871
  preferTruncationOnSpace = false
1872
- } = options2;
1873
- let { truncationCharacter = "\u2026" } = options2;
1872
+ } = options;
1873
+ let { truncationCharacter = "\u2026" } = options;
1874
1874
  if (typeof text !== "string") {
1875
1875
  throw new TypeError(`Expected \`input\` to be a string, got ${typeof text}`);
1876
1876
  }
@@ -1934,6 +1934,469 @@ import cac from "cac";
1934
1934
  import semver3 from "semver";
1935
1935
  import { isCI as isCI3 } from "std-env";
1936
1936
 
1937
+ // src/changeset/writer.ts
1938
+ import { mkdirSync, writeFileSync } from "node:fs";
1939
+ import path from "node:path";
1940
+ import process2 from "node:process";
1941
+ import { stringify as stringifyYaml } from "yaml";
1942
+ var adjectives = [
1943
+ "brave",
1944
+ "calm",
1945
+ "dark",
1946
+ "eager",
1947
+ "fair",
1948
+ "glad",
1949
+ "happy",
1950
+ "idle",
1951
+ "jolly",
1952
+ "keen",
1953
+ "lame",
1954
+ "mild",
1955
+ "neat",
1956
+ "odd",
1957
+ "pale",
1958
+ "quick",
1959
+ "rare",
1960
+ "safe",
1961
+ "tall",
1962
+ "ugly",
1963
+ "vast",
1964
+ "warm",
1965
+ "young",
1966
+ "zany",
1967
+ "bold",
1968
+ "cool",
1969
+ "dry",
1970
+ "fast",
1971
+ "good",
1972
+ "hot",
1973
+ "icy",
1974
+ "loud"
1975
+ ];
1976
+ var nouns = [
1977
+ "ant",
1978
+ "bear",
1979
+ "cat",
1980
+ "dog",
1981
+ "elk",
1982
+ "fox",
1983
+ "goat",
1984
+ "hawk",
1985
+ "ibis",
1986
+ "jay",
1987
+ "kite",
1988
+ "lion",
1989
+ "mole",
1990
+ "newt",
1991
+ "owl",
1992
+ "puma",
1993
+ "quail",
1994
+ "ram",
1995
+ "seal",
1996
+ "toad",
1997
+ "urchin",
1998
+ "vole",
1999
+ "wolf",
2000
+ "yak",
2001
+ "zebra",
2002
+ "ape",
2003
+ "bat",
2004
+ "cow",
2005
+ "deer",
2006
+ "emu",
2007
+ "frog",
2008
+ "gull"
2009
+ ];
2010
+ function generateChangesetId() {
2011
+ const adjective = adjectives[Math.floor(Math.random() * adjectives.length)];
2012
+ const noun = nouns[Math.floor(Math.random() * nouns.length)];
2013
+ const suffix = Math.random().toString(36).slice(2, 6);
2014
+ return `${adjective}-${noun}-${suffix}`;
2015
+ }
2016
+ function generateChangesetContent(releases, summary) {
2017
+ let content = "---\n";
2018
+ if (releases.length > 0) {
2019
+ const yamlObj = {};
2020
+ for (const release of releases) {
2021
+ yamlObj[release.name] = release.type;
2022
+ }
2023
+ content += stringifyYaml(yamlObj);
2024
+ }
2025
+ content += "---\n";
2026
+ if (summary) {
2027
+ content += `
2028
+ ${summary}
2029
+ `;
2030
+ }
2031
+ return content;
2032
+ }
2033
+ function writeChangeset(releases, summary, cwd = process2.cwd()) {
2034
+ const changesetsDir = path.join(cwd, ".pubm", "changesets");
2035
+ mkdirSync(changesetsDir, { recursive: true });
2036
+ const id = generateChangesetId();
2037
+ const fileName = `${id}.md`;
2038
+ const filePath = path.join(changesetsDir, fileName);
2039
+ const content = generateChangesetContent(releases, summary);
2040
+ writeFileSync(filePath, content, "utf-8");
2041
+ return filePath;
2042
+ }
2043
+
2044
+ // src/commands/add.ts
2045
+ function registerAddCommand(cli2) {
2046
+ cli2.command("add", "Create a new changeset").option("--empty", "Create an empty changeset").option("--packages <list>", "Comma-separated package names").option("--bump <type>", "Bump type: patch, minor, major").option("--message <text>", "Changeset summary").action(
2047
+ async (options) => {
2048
+ if (options.empty) {
2049
+ const filePath = writeChangeset([], "");
2050
+ console.log(`Created empty changeset: ${filePath}`);
2051
+ return;
2052
+ }
2053
+ if (options.packages && options.bump && options.message) {
2054
+ const VALID_BUMP_TYPES2 = /* @__PURE__ */ new Set(["patch", "minor", "major"]);
2055
+ if (!VALID_BUMP_TYPES2.has(options.bump)) {
2056
+ throw new Error(
2057
+ `Invalid bump type "${options.bump}". Expected: patch, minor, or major.`
2058
+ );
2059
+ }
2060
+ const packages = options.packages.split(",").map((p) => p.trim());
2061
+ const releases = packages.map((name) => ({
2062
+ name,
2063
+ type: options.bump
2064
+ }));
2065
+ const filePath = writeChangeset(releases, options.message);
2066
+ console.log(`Created changeset: ${filePath}`);
2067
+ return;
2068
+ }
2069
+ console.log(
2070
+ "Interactive changeset creation coming soon. Use --packages, --bump, and --message flags for now."
2071
+ );
2072
+ }
2073
+ );
2074
+ }
2075
+
2076
+ // src/commands/init.ts
2077
+ import { existsSync, mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "node:fs";
2078
+ import path2 from "node:path";
2079
+ function registerInitCommand(cli2) {
2080
+ cli2.command("init", "Initialize pubm configuration").action(async () => {
2081
+ const pubmDir = path2.resolve(".pubm", "changesets");
2082
+ if (!existsSync(pubmDir)) {
2083
+ mkdirSync2(pubmDir, { recursive: true });
2084
+ console.log("Created .pubm/changesets/");
2085
+ }
2086
+ const configPath = path2.resolve("pubm.config.ts");
2087
+ if (!existsSync(configPath)) {
2088
+ writeFileSync2(
2089
+ configPath,
2090
+ [
2091
+ "import { defineConfig } from 'pubm'",
2092
+ "",
2093
+ "export default defineConfig({})",
2094
+ ""
2095
+ ].join("\n")
2096
+ );
2097
+ console.log("Created pubm.config.ts");
2098
+ }
2099
+ console.log("pubm initialized successfully.");
2100
+ });
2101
+ }
2102
+
2103
+ // src/changeset/migrate.ts
2104
+ import { copyFileSync, existsSync as existsSync2, mkdirSync as mkdirSync3, readdirSync } from "node:fs";
2105
+ import path3 from "node:path";
2106
+ import process3 from "node:process";
2107
+ var SKIPPED_FILES = /* @__PURE__ */ new Set(["config.json", "README.md"]);
2108
+ function migrateFromChangesets(cwd = process3.cwd()) {
2109
+ const changesetDir = path3.join(cwd, ".changeset");
2110
+ if (!existsSync2(changesetDir)) {
2111
+ return {
2112
+ success: false,
2113
+ error: ".changeset/ directory not found",
2114
+ migratedFiles: [],
2115
+ configMigrated: false
2116
+ };
2117
+ }
2118
+ const pubmDir = path3.join(cwd, ".pubm", "changesets");
2119
+ mkdirSync3(pubmDir, { recursive: true });
2120
+ const files = readdirSync(changesetDir);
2121
+ const migratedFiles = [];
2122
+ let configMigrated = false;
2123
+ for (const file of files) {
2124
+ if (file === "config.json") {
2125
+ configMigrated = true;
2126
+ continue;
2127
+ }
2128
+ if (SKIPPED_FILES.has(file)) {
2129
+ continue;
2130
+ }
2131
+ if (file === "pre.json") {
2132
+ copyFileSync(
2133
+ path3.join(changesetDir, file),
2134
+ path3.resolve(cwd, ".pubm", "pre.json")
2135
+ );
2136
+ migratedFiles.push(file);
2137
+ continue;
2138
+ }
2139
+ if (file.endsWith(".md")) {
2140
+ const src = path3.join(changesetDir, file);
2141
+ const dest = path3.join(pubmDir, file);
2142
+ copyFileSync(src, dest);
2143
+ migratedFiles.push(file);
2144
+ }
2145
+ }
2146
+ return {
2147
+ success: true,
2148
+ migratedFiles,
2149
+ configMigrated
2150
+ };
2151
+ }
2152
+
2153
+ // src/commands/migrate.ts
2154
+ function registerMigrateCommand(cli2) {
2155
+ cli2.command("migrate", "Migrate from .changeset/ to .pubm/").action(async () => {
2156
+ const result = migrateFromChangesets();
2157
+ if (!result.success) {
2158
+ console.error(result.error);
2159
+ process.exit(1);
2160
+ }
2161
+ console.log(`Migrated ${result.migratedFiles.length} changeset files.`);
2162
+ if (result.configMigrated) {
2163
+ console.log(
2164
+ "Note: .changeset/config.json detected. Please manually create pubm.config.ts."
2165
+ );
2166
+ }
2167
+ });
2168
+ }
2169
+
2170
+ // src/prerelease/pre.ts
2171
+ import {
2172
+ existsSync as existsSync3,
2173
+ mkdirSync as mkdirSync4,
2174
+ readFileSync,
2175
+ rmSync,
2176
+ writeFileSync as writeFileSync3
2177
+ } from "node:fs";
2178
+ import path4 from "node:path";
2179
+ function getPreStatePath(cwd) {
2180
+ return path4.resolve(cwd ?? process.cwd(), ".pubm", "pre.json");
2181
+ }
2182
+ function enterPreMode(tag, cwd) {
2183
+ const filePath = getPreStatePath(cwd);
2184
+ if (existsSync3(filePath)) {
2185
+ throw new Error(
2186
+ "Already in pre mode. Exit pre mode first before entering a new one."
2187
+ );
2188
+ }
2189
+ const dir = path4.dirname(filePath);
2190
+ if (!existsSync3(dir)) {
2191
+ mkdirSync4(dir, { recursive: true });
2192
+ }
2193
+ const state = {
2194
+ mode: "pre",
2195
+ tag,
2196
+ packages: {}
2197
+ };
2198
+ writeFileSync3(filePath, JSON.stringify(state, null, 2), "utf-8");
2199
+ }
2200
+ function exitPreMode(cwd) {
2201
+ const filePath = getPreStatePath(cwd);
2202
+ if (!existsSync3(filePath)) {
2203
+ throw new Error("Not in pre mode. Enter pre mode first before exiting.");
2204
+ }
2205
+ rmSync(filePath);
2206
+ }
2207
+
2208
+ // src/commands/pre.ts
2209
+ function registerPreCommand(cli2) {
2210
+ cli2.command("pre <action> [tag]", "Manage pre-release mode").action(async (action, tag) => {
2211
+ if (action === "enter") {
2212
+ if (!tag) {
2213
+ console.error("Usage: pubm pre enter <tag>");
2214
+ process.exit(1);
2215
+ }
2216
+ enterPreMode(tag);
2217
+ console.log(`Entered pre-release mode (${tag})`);
2218
+ } else if (action === "exit") {
2219
+ exitPreMode();
2220
+ console.log("Exited pre-release mode");
2221
+ } else {
2222
+ console.error(`Unknown pre action: ${action}. Use "enter" or "exit".`);
2223
+ process.exit(1);
2224
+ }
2225
+ });
2226
+ }
2227
+
2228
+ // src/commands/snapshot.ts
2229
+ function registerSnapshotCommand(cli2) {
2230
+ cli2.command("snapshot [tag]", "Create a snapshot release").action(async (tag) => {
2231
+ console.log(`pubm snapshot ${tag ?? ""} \u2014 coming in next phase`);
2232
+ });
2233
+ }
2234
+
2235
+ // src/changeset/status.ts
2236
+ import process5 from "node:process";
2237
+
2238
+ // src/changeset/bump-utils.ts
2239
+ var BUMP_ORDER = {
2240
+ patch: 0,
2241
+ minor: 1,
2242
+ major: 2
2243
+ };
2244
+ function maxBump(a2, b) {
2245
+ return BUMP_ORDER[a2] >= BUMP_ORDER[b] ? a2 : b;
2246
+ }
2247
+
2248
+ // src/changeset/reader.ts
2249
+ import { existsSync as existsSync4, readdirSync as readdirSync2, readFileSync as readFileSync2 } from "node:fs";
2250
+ import path5 from "node:path";
2251
+ import process4 from "node:process";
2252
+
2253
+ // src/changeset/parser.ts
2254
+ import { parse as parseYaml } from "yaml";
2255
+ var VALID_BUMP_TYPES = /* @__PURE__ */ new Set(["patch", "minor", "major"]);
2256
+ function parseChangeset(content, fileName) {
2257
+ const frontmatterRegex = /^---\n([\s\S]*?)---/;
2258
+ const match = content.match(frontmatterRegex);
2259
+ if (!match) {
2260
+ throw new Error(
2261
+ `Invalid changeset format in "${fileName}": missing frontmatter`
2262
+ );
2263
+ }
2264
+ const yamlContent = match[1];
2265
+ const body = content.slice(match[0].length).trim();
2266
+ const parsed = parseYaml(yamlContent);
2267
+ const releases = [];
2268
+ if (parsed) {
2269
+ for (const [name, type] of Object.entries(parsed)) {
2270
+ if (!VALID_BUMP_TYPES.has(type)) {
2271
+ throw new Error(
2272
+ `Invalid bump type "${type}" for package "${name}" in "${fileName}". Expected: patch, minor, or major.`
2273
+ );
2274
+ }
2275
+ releases.push({ name, type });
2276
+ }
2277
+ }
2278
+ const id = fileName.replace(/\.md$/, "");
2279
+ return {
2280
+ id,
2281
+ summary: body,
2282
+ releases
2283
+ };
2284
+ }
2285
+
2286
+ // src/changeset/reader.ts
2287
+ function readChangesets(cwd = process4.cwd()) {
2288
+ const changesetsDir = path5.join(cwd, ".pubm", "changesets");
2289
+ if (!existsSync4(changesetsDir)) {
2290
+ return [];
2291
+ }
2292
+ const files = readdirSync2(changesetsDir);
2293
+ const changesets = [];
2294
+ for (const file of files) {
2295
+ if (!file.endsWith(".md") || file === "README.md") {
2296
+ continue;
2297
+ }
2298
+ const filePath = path5.join(changesetsDir, file);
2299
+ const content = readFileSync2(filePath, "utf-8");
2300
+ changesets.push(parseChangeset(content, file));
2301
+ }
2302
+ return changesets;
2303
+ }
2304
+
2305
+ // src/changeset/status.ts
2306
+ function getStatus(cwd = process5.cwd()) {
2307
+ const changesets = readChangesets(cwd);
2308
+ const packages = /* @__PURE__ */ new Map();
2309
+ for (const changeset of changesets) {
2310
+ for (const release of changeset.releases) {
2311
+ const existing = packages.get(release.name);
2312
+ if (existing) {
2313
+ existing.bumpType = maxBump(existing.bumpType, release.type);
2314
+ existing.changesetCount += 1;
2315
+ existing.summaries.push(changeset.summary);
2316
+ } else {
2317
+ packages.set(release.name, {
2318
+ bumpType: release.type,
2319
+ changesetCount: 1,
2320
+ summaries: [changeset.summary]
2321
+ });
2322
+ }
2323
+ }
2324
+ }
2325
+ return {
2326
+ packages,
2327
+ changesets,
2328
+ hasChangesets: changesets.length > 0
2329
+ };
2330
+ }
2331
+
2332
+ // src/commands/status.ts
2333
+ function registerStatusCommand(cli2) {
2334
+ cli2.command("status", "Show pending changeset status").option("--verbose", "Show full changeset contents").option("--since <ref>", "Only check changesets since git ref").action(async (options) => {
2335
+ const status = getStatus();
2336
+ if (!status.hasChangesets) {
2337
+ if (options.since) {
2338
+ console.log("No changesets found.");
2339
+ process.exit(1);
2340
+ }
2341
+ console.log("No pending changesets.");
2342
+ return;
2343
+ }
2344
+ console.log("Pending changesets:");
2345
+ for (const [name, info] of status.packages) {
2346
+ console.log(
2347
+ ` ${name}: ${info.bumpType} (${info.changesetCount} changeset${info.changesetCount > 1 ? "s" : ""})`
2348
+ );
2349
+ if (options.verbose) {
2350
+ for (const summary of info.summaries) {
2351
+ console.log(` - ${summary}`);
2352
+ }
2353
+ }
2354
+ }
2355
+ });
2356
+ }
2357
+
2358
+ // src/commands/update.ts
2359
+ import { UpdateKit } from "update-kit";
2360
+ function registerUpdateCommand(cli2) {
2361
+ cli2.command("update", "Update pubm to the latest version").action(async () => {
2362
+ const kit = await UpdateKit.create({
2363
+ sources: [{ type: "npm", packageName: "pubm" }],
2364
+ delegateMode: "execute"
2365
+ });
2366
+ const result = await kit.autoUpdate({
2367
+ onProgress: (p) => {
2368
+ if (p.phase === "downloading" && p.totalBytes) {
2369
+ const pct = Math.round(p.bytesDownloaded / p.totalBytes * 100);
2370
+ process.stderr.write(`\rDownloading... ${pct}%`);
2371
+ } else {
2372
+ console.error(`${p.phase}...`);
2373
+ }
2374
+ }
2375
+ });
2376
+ switch (result.kind) {
2377
+ case "success":
2378
+ console.log(
2379
+ `Updated from ${result.fromVersion} to ${result.toVersion}`
2380
+ );
2381
+ break;
2382
+ case "needs-restart":
2383
+ console.log(result.message);
2384
+ break;
2385
+ case "failed":
2386
+ console.error(`Update failed: ${result.error.message}`);
2387
+ process.exitCode = 1;
2388
+ break;
2389
+ }
2390
+ });
2391
+ }
2392
+
2393
+ // src/commands/version-cmd.ts
2394
+ function registerVersionCommand(cli2) {
2395
+ cli2.command("version", "Consume changesets and bump versions").action(async () => {
2396
+ console.log("pubm version \u2014 coming in next phase");
2397
+ });
2398
+ }
2399
+
1937
2400
  // node_modules/.pnpm/eventemitter3@5.0.1/node_modules/eventemitter3/index.mjs
1938
2401
  var import_index = __toESM(require_eventemitter3(), 1);
1939
2402
  var eventemitter3_default = import_index.default;
@@ -2244,39 +2707,39 @@ var LISTR_LOGGER_STDERR_LEVELS = [
2244
2707
  ];
2245
2708
  var _a3;
2246
2709
  var ListrLogger = (_a3 = class {
2247
- constructor(options2) {
2710
+ constructor(options) {
2248
2711
  __publicField(this, "process");
2249
2712
  var _a24, _b, _c;
2250
- this.options = options2;
2713
+ this.options = options;
2251
2714
  this.options = {
2252
2715
  useIcons: true,
2253
2716
  toStderr: [],
2254
- ...options2 ?? {}
2717
+ ...options ?? {}
2255
2718
  };
2256
2719
  (_a24 = this.options).fields ?? (_a24.fields = {});
2257
2720
  (_b = this.options.fields).prefix ?? (_b.prefix = []);
2258
2721
  (_c = this.options.fields).suffix ?? (_c.suffix = []);
2259
2722
  this.process = this.options.processOutput ?? new ProcessOutput();
2260
2723
  }
2261
- log(level, message, options2) {
2262
- const output = this.format(level, message, options2);
2724
+ log(level, message, options) {
2725
+ const output = this.format(level, message, options);
2263
2726
  if (this.options.toStderr.includes(level)) {
2264
2727
  this.process.toStderr(output);
2265
2728
  return;
2266
2729
  }
2267
2730
  this.process.toStdout(output);
2268
2731
  }
2269
- toStdout(message, options2, eol = true) {
2270
- this.process.toStdout(this.format(null, message, options2), eol);
2732
+ toStdout(message, options, eol = true) {
2733
+ this.process.toStdout(this.format(null, message, options), eol);
2271
2734
  }
2272
- toStderr(message, options2, eol = true) {
2273
- this.process.toStderr(this.format(null, message, options2), eol);
2735
+ toStderr(message, options, eol = true) {
2736
+ this.process.toStderr(this.format(null, message, options), eol);
2274
2737
  }
2275
- wrap(message, options2) {
2738
+ wrap(message, options) {
2276
2739
  if (!message) {
2277
2740
  return message;
2278
2741
  }
2279
- return this.applyFormat(`[${message}]`, options2);
2742
+ return this.applyFormat(`[${message}]`, options);
2280
2743
  }
2281
2744
  splat(...args) {
2282
2745
  const message = args.shift() ?? "";
@@ -2316,15 +2779,15 @@ var ListrLogger = (_a3 = class {
2316
2779
  });
2317
2780
  return message;
2318
2781
  }
2319
- fields(message, options2) {
2782
+ fields(message, options) {
2320
2783
  if (this.options?.fields?.prefix) {
2321
2784
  message = this.prefix(message, ...this.options.fields.prefix);
2322
2785
  }
2323
- if (options2?.prefix) {
2324
- message = this.prefix(message, ...options2.prefix);
2786
+ if (options?.prefix) {
2787
+ message = this.prefix(message, ...options.prefix);
2325
2788
  }
2326
- if (options2?.suffix) {
2327
- message = this.suffix(message, ...options2.suffix);
2789
+ if (options?.suffix) {
2790
+ message = this.suffix(message, ...options.suffix);
2328
2791
  }
2329
2792
  if (this.options?.fields?.suffix) {
2330
2793
  message = this.suffix(message, ...this.options.fields.suffix);
@@ -2342,7 +2805,7 @@ var ListrLogger = (_a3 = class {
2342
2805
  }
2343
2806
  return icon;
2344
2807
  }
2345
- format(level, message, options2) {
2808
+ format(level, message, options) {
2346
2809
  if (!Array.isArray(message)) {
2347
2810
  message = [message];
2348
2811
  }
@@ -2350,8 +2813,8 @@ var ListrLogger = (_a3 = class {
2350
2813
  return this.style(
2351
2814
  level,
2352
2815
  this.fields(m, {
2353
- prefix: Array.isArray(options2?.prefix) ? options2.prefix : [options2?.prefix],
2354
- suffix: Array.isArray(options2?.suffix) ? options2.suffix : [options2?.suffix]
2816
+ prefix: Array.isArray(options?.prefix) ? options.prefix : [options?.prefix],
2817
+ suffix: Array.isArray(options?.suffix) ? options.suffix : [options?.suffix]
2355
2818
  })
2356
2819
  );
2357
2820
  }).join(EOL);
@@ -2367,9 +2830,9 @@ var ListrLogger = (_a3 = class {
2367
2830
  }
2368
2831
  return message;
2369
2832
  }
2370
- applyFormat(message, options2) {
2371
- if (options2?.format) {
2372
- return options2.format(message);
2833
+ applyFormat(message, options) {
2834
+ if (options?.format) {
2835
+ return options.format(message);
2373
2836
  }
2374
2837
  return message;
2375
2838
  }
@@ -2379,10 +2842,10 @@ var ListrLogger = (_a3 = class {
2379
2842
  }, __name(_a3, "ListrLogger"), _a3);
2380
2843
  var _a4;
2381
2844
  var ProcessOutputBuffer = (_a4 = class {
2382
- constructor(options2) {
2845
+ constructor(options) {
2383
2846
  __publicField(this, "buffer", []);
2384
2847
  __publicField(this, "decoder", new StringDecoder());
2385
- this.options = options2;
2848
+ this.options = options;
2386
2849
  }
2387
2850
  get all() {
2388
2851
  return this.buffer;
@@ -2441,10 +2904,10 @@ var ProcessOutputStream = (_a5 = class {
2441
2904
  }, __name(_a5, "ProcessOutputStream"), _a5);
2442
2905
  var _a6;
2443
2906
  var ProcessOutput = (_a6 = class {
2444
- constructor(stdout, stderr, options2) {
2907
+ constructor(stdout, stderr, options) {
2445
2908
  __publicField(this, "stream");
2446
2909
  __publicField(this, "active");
2447
- this.options = options2;
2910
+ this.options = options;
2448
2911
  this.stream = {
2449
2912
  stdout: new ProcessOutputStream(stdout ?? process.stdout),
2450
2913
  stderr: new ProcessOutputStream(stderr ?? process.stderr)
@@ -2452,7 +2915,7 @@ var ProcessOutput = (_a6 = class {
2452
2915
  this.options = {
2453
2916
  dump: ["stdout", "stderr"],
2454
2917
  leaveEmptyLine: true,
2455
- ...options2
2918
+ ...options
2456
2919
  };
2457
2920
  }
2458
2921
  get stdout() {
@@ -2716,7 +3179,7 @@ function parseTimestamp() {
2716
3179
  __name(parseTimestamp, "parseTimestamp");
2717
3180
  var _a9;
2718
3181
  var DefaultRenderer = (_a9 = class {
2719
- constructor(tasks, options2, events) {
3182
+ constructor(tasks, options, events) {
2720
3183
  __publicField(this, "prompt");
2721
3184
  __publicField(this, "activePrompt");
2722
3185
  __publicField(this, "spinner");
@@ -2734,18 +3197,18 @@ var DefaultRenderer = (_a9 = class {
2734
3197
  rendererTaskOptions: /* @__PURE__ */ new Map()
2735
3198
  });
2736
3199
  this.tasks = tasks;
2737
- this.options = options2;
3200
+ this.options = options;
2738
3201
  this.events = events;
2739
3202
  this.options = {
2740
3203
  ..._a9.rendererOptions,
2741
3204
  ...this.options,
2742
3205
  icon: {
2743
3206
  ...LISTR_DEFAULT_RENDERER_STYLE.icon,
2744
- ...options2?.icon ?? {}
3207
+ ...options?.icon ?? {}
2745
3208
  },
2746
3209
  color: {
2747
3210
  ...LISTR_DEFAULT_RENDERER_STYLE.color,
2748
- ...options2?.color ?? {}
3211
+ ...options?.color ?? {}
2749
3212
  }
2750
3213
  };
2751
3214
  this.spinner = this.options.spinner ?? new Spinner();
@@ -2782,27 +3245,27 @@ var DefaultRenderer = (_a9 = class {
2782
3245
  }
2783
3246
  this.logger.process.release();
2784
3247
  }
2785
- create(options2) {
2786
- options2 = {
3248
+ create(options) {
3249
+ options = {
2787
3250
  tasks: true,
2788
3251
  bottomBar: true,
2789
3252
  prompt: true,
2790
- ...options2
3253
+ ...options
2791
3254
  };
2792
3255
  const render = [];
2793
3256
  const renderTasks = this.renderer(this.tasks);
2794
3257
  const renderBottomBar = this.renderBottomBar();
2795
3258
  const renderPrompt = this.renderPrompt();
2796
- if (options2.tasks && renderTasks.length > 0) {
3259
+ if (options.tasks && renderTasks.length > 0) {
2797
3260
  render.push(...renderTasks);
2798
3261
  }
2799
- if (options2.bottomBar && renderBottomBar.length > 0) {
3262
+ if (options.bottomBar && renderBottomBar.length > 0) {
2800
3263
  if (render.length > 0) {
2801
3264
  render.push("");
2802
3265
  }
2803
3266
  render.push(...renderBottomBar);
2804
3267
  }
2805
- if (options2.prompt && renderPrompt.length > 0) {
3268
+ if (options.prompt && renderPrompt.length > 0) {
2806
3269
  if (render.length > 0) {
2807
3270
  render.push("");
2808
3271
  }
@@ -3183,9 +3646,9 @@ var DefaultRenderer = (_a9 = class {
3183
3646
  }), _a9);
3184
3647
  var _a10;
3185
3648
  var SilentRenderer = (_a10 = class {
3186
- constructor(tasks, options2) {
3649
+ constructor(tasks, options) {
3187
3650
  this.tasks = tasks;
3188
- this.options = options2;
3651
+ this.options = options;
3189
3652
  }
3190
3653
  render() {
3191
3654
  return;
@@ -3196,24 +3659,24 @@ var SilentRenderer = (_a10 = class {
3196
3659
  }, __name(_a10, "SilentRenderer"), __publicField(_a10, "nonTTY", true), __publicField(_a10, "rendererOptions"), __publicField(_a10, "rendererTaskOptions"), _a10);
3197
3660
  var _a11;
3198
3661
  var SimpleRenderer = (_a11 = class {
3199
- constructor(tasks, options2) {
3662
+ constructor(tasks, options) {
3200
3663
  __publicField(this, "logger");
3201
3664
  __publicField(this, "cache", {
3202
3665
  rendererOptions: /* @__PURE__ */ new Map(),
3203
3666
  rendererTaskOptions: /* @__PURE__ */ new Map()
3204
3667
  });
3205
3668
  this.tasks = tasks;
3206
- this.options = options2;
3669
+ this.options = options;
3207
3670
  this.options = {
3208
3671
  ..._a11.rendererOptions,
3209
- ...options2,
3672
+ ...options,
3210
3673
  icon: {
3211
3674
  ...LISTR_LOGGER_STYLE.icon,
3212
- ...options2?.icon ?? {}
3675
+ ...options?.icon ?? {}
3213
3676
  },
3214
3677
  color: {
3215
3678
  ...LISTR_LOGGER_STYLE.color,
3216
- ...options2?.color ?? {}
3679
+ ...options?.color ?? {}
3217
3680
  }
3218
3681
  };
3219
3682
  this.logger = this.options.logger ?? new ListrLogger({ useIcons: true, toStderr: LISTR_LOGGER_STDERR_LEVELS });
@@ -3349,8 +3812,8 @@ var SimpleRenderer = (_a11 = class {
3349
3812
  }), __publicField(_a11, "rendererTaskOptions", {}), _a11);
3350
3813
  var _a12;
3351
3814
  var TestRendererSerializer = (_a12 = class {
3352
- constructor(options2) {
3353
- this.options = options2;
3815
+ constructor(options) {
3816
+ this.options = options;
3354
3817
  }
3355
3818
  serialize(event, data, task) {
3356
3819
  return JSON.stringify(this.generate(event, data, task));
@@ -3379,11 +3842,11 @@ var TestRendererSerializer = (_a12 = class {
3379
3842
  }, __name(_a12, "TestRendererSerializer"), _a12);
3380
3843
  var _a13;
3381
3844
  var TestRenderer = (_a13 = class {
3382
- constructor(tasks, options2) {
3845
+ constructor(tasks, options) {
3383
3846
  __publicField(this, "logger");
3384
3847
  __publicField(this, "serializer");
3385
3848
  this.tasks = tasks;
3386
- this.options = options2;
3849
+ this.options = options;
3387
3850
  this.options = { ..._a13.rendererOptions, ...this.options };
3388
3851
  this.logger = this.options.logger ?? new ListrLogger({ useIcons: false });
3389
3852
  this.serializer = new TestRendererSerializer(this.options);
@@ -3472,24 +3935,24 @@ var TestRenderer = (_a13 = class {
3472
3935
  }), __publicField(_a13, "rendererTaskOptions"), _a13);
3473
3936
  var _a14;
3474
3937
  var VerboseRenderer = (_a14 = class {
3475
- constructor(tasks, options2) {
3938
+ constructor(tasks, options) {
3476
3939
  __publicField(this, "logger");
3477
3940
  __publicField(this, "cache", {
3478
3941
  rendererOptions: /* @__PURE__ */ new Map(),
3479
3942
  rendererTaskOptions: /* @__PURE__ */ new Map()
3480
3943
  });
3481
3944
  this.tasks = tasks;
3482
- this.options = options2;
3945
+ this.options = options;
3483
3946
  this.options = {
3484
3947
  ..._a14.rendererOptions,
3485
3948
  ...this.options,
3486
3949
  icon: {
3487
3950
  ...LISTR_LOGGER_STYLE.icon,
3488
- ...options2?.icon ?? {}
3951
+ ...options?.icon ?? {}
3489
3952
  },
3490
3953
  color: {
3491
3954
  ...LISTR_LOGGER_STYLE.color,
3492
- ...options2?.color ?? {}
3955
+ ...options?.color ?? {}
3493
3956
  }
3494
3957
  };
3495
3958
  this.logger = this.options.logger ?? new ListrLogger({ useIcons: false, toStderr: LISTR_LOGGER_STDERR_LEVELS });
@@ -3621,8 +4084,8 @@ function getRendererClass(renderer) {
3621
4084
  return typeof renderer === "function" ? renderer : RENDERERS.default;
3622
4085
  }
3623
4086
  __name(getRendererClass, "getRendererClass");
3624
- function getRenderer(options2) {
3625
- if (assertFunctionOrSelf(options2?.silentRendererCondition)) {
4087
+ function getRenderer(options) {
4088
+ if (assertFunctionOrSelf(options?.silentRendererCondition)) {
3626
4089
  return {
3627
4090
  renderer: getRendererClass("silent"),
3628
4091
  selection: "SILENT"
@@ -3630,15 +4093,15 @@ function getRenderer(options2) {
3630
4093
  };
3631
4094
  }
3632
4095
  const r = {
3633
- renderer: getRendererClass(options2.renderer),
3634
- options: options2.rendererOptions,
4096
+ renderer: getRendererClass(options.renderer),
4097
+ options: options.rendererOptions,
3635
4098
  selection: "PRIMARY"
3636
4099
  /* PRIMARY */
3637
4100
  };
3638
- if (!isRendererSupported(r.renderer) || assertFunctionOrSelf(options2?.fallbackRendererCondition)) {
4101
+ if (!isRendererSupported(r.renderer) || assertFunctionOrSelf(options?.fallbackRendererCondition)) {
3639
4102
  return {
3640
- renderer: getRendererClass(options2.fallbackRenderer),
3641
- options: options2.fallbackRendererOptions,
4103
+ renderer: getRendererClass(options.fallbackRenderer),
4104
+ options: options.fallbackRendererOptions,
3642
4105
  selection: "SECONDARY"
3643
4106
  /* SECONDARY */
3644
4107
  };
@@ -3661,11 +4124,11 @@ function cloneObject(obj) {
3661
4124
  __name(cloneObject, "cloneObject");
3662
4125
  var _a15;
3663
4126
  var Concurrency = (_a15 = class {
3664
- constructor(options2) {
4127
+ constructor(options) {
3665
4128
  __publicField(this, "concurrency");
3666
4129
  __publicField(this, "count");
3667
4130
  __publicField(this, "queue");
3668
- this.concurrency = options2.concurrency;
4131
+ this.concurrency = options.concurrency;
3669
4132
  this.count = 0;
3670
4133
  this.queue = /* @__PURE__ */ new Set();
3671
4134
  }
@@ -3772,14 +4235,14 @@ var TaskWrapper = (_a19 = class {
3772
4235
  *
3773
4236
  * @see {@link https://listr2.kilic.dev/task/subtasks.html}
3774
4237
  */
3775
- newListr(task, options2) {
4238
+ newListr(task, options) {
3776
4239
  let tasks;
3777
4240
  if (typeof task === "function") {
3778
4241
  tasks = task(this);
3779
4242
  } else {
3780
4243
  tasks = task;
3781
4244
  }
3782
- return new Listr(tasks, options2, this.task);
4245
+ return new Listr(tasks, options, this.task);
3783
4246
  }
3784
4247
  /**
3785
4248
  * Report an error that has to be collected and handled.
@@ -3853,7 +4316,7 @@ var ListrTaskEventManager = (_a20 = class extends EventManager {
3853
4316
  }, __name(_a20, "ListrTaskEventManager"), _a20);
3854
4317
  var _a21;
3855
4318
  var Task = (_a21 = class extends ListrTaskEventManager {
3856
- constructor(listr, task, options2, rendererOptions, rendererTaskOptions) {
4319
+ constructor(listr, task, options, rendererOptions, rendererTaskOptions) {
3857
4320
  super();
3858
4321
  /** Unique id per task, can be used for identifying a Task. */
3859
4322
  __publicField(this, "id", randomUUID());
@@ -3887,7 +4350,7 @@ var Task = (_a21 = class extends ListrTaskEventManager {
3887
4350
  __publicField(this, "closed");
3888
4351
  this.listr = listr;
3889
4352
  this.task = task;
3890
- this.options = options2;
4353
+ this.options = options;
3891
4354
  this.rendererOptions = rendererOptions;
3892
4355
  this.rendererTaskOptions = rendererTaskOptions;
3893
4356
  if (task.title) {
@@ -4204,7 +4667,7 @@ var ListrEventManager = (_a22 = class extends EventManager {
4204
4667
  }, __name(_a22, "ListrEventManager"), _a22);
4205
4668
  var _a23;
4206
4669
  var Listr = (_a23 = class {
4207
- constructor(task, options2, parentTask) {
4670
+ constructor(task, options, parentTask) {
4208
4671
  __publicField(this, "tasks", []);
4209
4672
  __publicField(this, "errors", []);
4210
4673
  __publicField(this, "ctx");
@@ -4217,7 +4680,7 @@ var Listr = (_a23 = class {
4217
4680
  __publicField(this, "concurrency");
4218
4681
  __publicField(this, "renderer");
4219
4682
  this.task = task;
4220
- this.options = options2;
4683
+ this.options = options;
4221
4684
  this.parentTask = parentTask;
4222
4685
  this.options = {
4223
4686
  concurrent: false,
@@ -4228,7 +4691,7 @@ var Listr = (_a23 = class {
4228
4691
  collectErrors: false,
4229
4692
  registerSignalListeners: true,
4230
4693
  ...this.parentTask?.options ?? {},
4231
- ...options2
4694
+ ...options
4232
4695
  };
4233
4696
  if (this.options.concurrent === true) {
4234
4697
  this.options.concurrent = Infinity;
@@ -4376,10 +4839,13 @@ function replaceCode(code) {
4376
4839
  }
4377
4840
  function formatError(error) {
4378
4841
  if (!(error instanceof Error)) return `${error}`;
4379
- const message = typeof error.message === "string" ? replaceCode(error.message) : formatError(error);
4842
+ const message = typeof error.message === "string" ? replaceCode(error.message) : (
4843
+ /* v8 ignore next */
4844
+ formatError(error)
4845
+ );
4380
4846
  let stringifyError = `${color.bgRed(` ${error.name} `)}${color.reset("")} ${message}
4381
4847
  `;
4382
- stringifyError += error.stack?.split("\n").slice(1).join("\n").replace(/at/g, color.dim("at")).replace(/\(([^\(].+)\)/g, `(${color.blue("$1")})`);
4848
+ stringifyError += error.stack?.split("\n").slice(1).join("\n").replace(/at/g, color.dim("at")).replace(/\(([^(].+)\)/g, `(${color.blue("$1")})`);
4383
4849
  if (error.cause) {
4384
4850
  stringifyError += "\n\nCaused: ";
4385
4851
  stringifyError += formatError(error.cause);
@@ -4410,8 +4876,7 @@ var GitError = class extends AbstractError {
4410
4876
  };
4411
4877
  var Git = class {
4412
4878
  async git(args) {
4413
- const { stdout, stderr } = await exec2("git", args);
4414
- if (stderr) throw stderr;
4879
+ const { stdout } = await exec2("git", args, { throwOnError: true });
4415
4880
  return stdout;
4416
4881
  }
4417
4882
  async userName() {
@@ -4432,7 +4897,7 @@ var Git = class {
4432
4897
  }
4433
4898
  async tags() {
4434
4899
  try {
4435
- return (await this.git(["tag", "-l"])).trim().split("\n").map((v) => v.slice(1)).sort(semver.compareIdentifiers);
4900
+ return (await this.git(["tag", "-l"])).trim().split("\n").sort(semver.compareIdentifiers);
4436
4901
  } catch (error) {
4437
4902
  throw new GitError("Failed to run `git config --get user.name`", {
4438
4903
  cause: error
@@ -4442,7 +4907,8 @@ var Git = class {
4442
4907
  async previousTag(tag) {
4443
4908
  try {
4444
4909
  const tags = await this.tags();
4445
- return tags.at(tags.findIndex((t) => t === tag) - 1) ?? null;
4910
+ const strip = (t) => t.replace(/^v/, "");
4911
+ return tags.at(tags.findIndex((t) => strip(t) === strip(tag)) - 1) ?? null;
4446
4912
  } catch {
4447
4913
  return null;
4448
4914
  }
@@ -4547,13 +5013,8 @@ var Git = class {
4547
5013
  async checkTagExist(tag) {
4548
5014
  try {
4549
5015
  return (await this.git(["rev-parse", "-q", "--verify", `refs/tags/${tag}`])).trim() !== "";
4550
- } catch (error) {
4551
- throw new GitError(
4552
- `Failed to run \`git rev-parse -q --verify refs/tags/${tag}\``,
4553
- {
4554
- cause: error
4555
- }
4556
- );
5016
+ } catch {
5017
+ return false;
4557
5018
  }
4558
5019
  }
4559
5020
  async deleteTag(tag) {
@@ -4665,8 +5126,8 @@ var Git = class {
4665
5126
  });
4666
5127
  }
4667
5128
  }
4668
- async push(options2) {
4669
- const args = ["push", options2].filter((v) => v);
5129
+ async push(options) {
5130
+ const args = ["push", options].filter((v) => v);
4670
5131
  try {
4671
5132
  const { stderr } = await exec2("git", args, { throwOnError: true });
4672
5133
  if (`${stderr}`.includes("GH006")) {
@@ -4692,17 +5153,17 @@ var defaultOptions = {
4692
5153
  tag: "latest",
4693
5154
  registries: ["npm", "jsr"]
4694
5155
  };
4695
- function resolveOptions(options2) {
4696
- const nextOptions = { ...options2, ...defaultOptions };
5156
+ function resolveOptions(options) {
5157
+ const nextOptions = { ...options, ...defaultOptions };
4697
5158
  return nextOptions;
4698
5159
  }
4699
5160
 
4700
5161
  // src/tasks/runner.ts
4701
- import process10 from "node:process";
5162
+ import process14 from "node:process";
4702
5163
  import npmCli from "@npmcli/promise-spawn";
4703
5164
  import SemVer from "semver";
4704
5165
  import { isCI as isCI2 } from "std-env";
4705
- import { exec as exec6 } from "tinyexec";
5166
+ import { exec as exec7 } from "tinyexec";
4706
5167
 
4707
5168
  // src/utils/cli.ts
4708
5169
  var warningBadge = color.bgYellow(" Warning ");
@@ -4735,32 +5196,32 @@ function createListr(...args) {
4735
5196
 
4736
5197
  // src/utils/package.ts
4737
5198
  import { readFile, stat, writeFile } from "node:fs/promises";
4738
- import path from "node:path";
4739
- import process7 from "node:process";
5199
+ import path6 from "node:path";
5200
+ import process11 from "node:process";
4740
5201
  var cachedPackageJson = {};
4741
5202
  var cachedJsrJson = {};
4742
- function patchCachedJsrJson(contents, { cwd = process7.cwd() } = {}) {
5203
+ function patchCachedJsrJson(contents, { cwd = process11.cwd() } = {}) {
4743
5204
  cachedJsrJson[cwd] = { ...cachedJsrJson[cwd], ...contents };
4744
5205
  }
4745
- async function findOutFile(file, { cwd = process7.cwd() } = {}) {
5206
+ async function findOutFile(file, { cwd = process11.cwd() } = {}) {
4746
5207
  let directory = cwd;
4747
5208
  let filePath = "";
4748
- const { root } = path.parse(cwd);
5209
+ const { root } = path6.parse(cwd);
4749
5210
  while (directory) {
4750
- filePath = path.join(directory, file);
5211
+ filePath = path6.join(directory, file);
4751
5212
  try {
4752
5213
  if ((await stat(filePath)).isFile()) {
4753
5214
  break;
4754
5215
  }
4755
5216
  } catch {
4756
5217
  }
4757
- directory = path.dirname(directory);
5218
+ directory = path6.dirname(directory);
4758
5219
  if (directory === root) return null;
4759
5220
  }
4760
5221
  return filePath;
4761
5222
  }
4762
5223
  async function getPackageJson({
4763
- cwd = process7.cwd(),
5224
+ cwd = process11.cwd(),
4764
5225
  fallbackJsr = true
4765
5226
  } = {}) {
4766
5227
  if (cachedPackageJson[cwd]) return cachedPackageJson[cwd];
@@ -4793,7 +5254,7 @@ async function getPackageJson({
4793
5254
  }
4794
5255
  }
4795
5256
  async function getJsrJson({
4796
- cwd = process7.cwd(),
5257
+ cwd = process11.cwd(),
4797
5258
  fallbackPackage = true
4798
5259
  } = {}) {
4799
5260
  if (cachedJsrJson[cwd]) return cachedJsrJson[cwd];
@@ -4871,7 +5332,7 @@ function jsrJsonToPackageJson(jsrJson) {
4871
5332
  return convertedExports;
4872
5333
  }
4873
5334
  }
4874
- async function version({ cwd = process7.cwd() } = {}) {
5335
+ async function version({ cwd = process11.cwd() } = {}) {
4875
5336
  let version2 = (await getPackageJson({ cwd }))?.version;
4876
5337
  if (!version2) {
4877
5338
  version2 = (await getJsrJson({ cwd }))?.version;
@@ -4924,17 +5385,222 @@ async function getPackageManager() {
4924
5385
  return "npm";
4925
5386
  }
4926
5387
 
5388
+ // src/ecosystem/rust.ts
5389
+ import { readFile as readFile2, stat as stat2, writeFile as writeFile2 } from "node:fs/promises";
5390
+ import path7 from "node:path";
5391
+ import { parse, stringify } from "smol-toml";
5392
+
5393
+ // src/ecosystem/ecosystem.ts
5394
+ var Ecosystem = class {
5395
+ constructor(packagePath) {
5396
+ this.packagePath = packagePath;
5397
+ }
5398
+ };
5399
+
5400
+ // src/ecosystem/rust.ts
5401
+ var RustEcosystem = class extends Ecosystem {
5402
+ static async detect(packagePath) {
5403
+ try {
5404
+ return (await stat2(path7.join(packagePath, "Cargo.toml"))).isFile();
5405
+ } catch {
5406
+ return false;
5407
+ }
5408
+ }
5409
+ async readCargoToml() {
5410
+ const raw = await readFile2(
5411
+ path7.join(this.packagePath, "Cargo.toml"),
5412
+ "utf-8"
5413
+ );
5414
+ return parse(raw);
5415
+ }
5416
+ async packageName() {
5417
+ const cargo = await this.readCargoToml();
5418
+ const pkg = cargo.package;
5419
+ return pkg.name;
5420
+ }
5421
+ async readVersion() {
5422
+ const cargo = await this.readCargoToml();
5423
+ const pkg = cargo.package;
5424
+ return pkg.version;
5425
+ }
5426
+ async writeVersion(newVersion) {
5427
+ const filePath = path7.join(this.packagePath, "Cargo.toml");
5428
+ const raw = await readFile2(filePath, "utf-8");
5429
+ const cargo = parse(raw);
5430
+ const pkg = cargo.package;
5431
+ pkg.version = newVersion;
5432
+ await writeFile2(filePath, stringify(cargo));
5433
+ }
5434
+ manifestFiles() {
5435
+ return ["Cargo.toml"];
5436
+ }
5437
+ defaultTestCommand() {
5438
+ return "cargo test";
5439
+ }
5440
+ defaultBuildCommand() {
5441
+ return "cargo build --release";
5442
+ }
5443
+ supportedRegistries() {
5444
+ return ["crates"];
5445
+ }
5446
+ };
5447
+
5448
+ // src/registry/crates.ts
5449
+ import { exec as exec3 } from "tinyexec";
5450
+
5451
+ // src/registry/registry.ts
5452
+ var Registry = class {
5453
+ constructor(packageName, registry) {
5454
+ this.packageName = packageName;
5455
+ this.registry = registry;
5456
+ }
5457
+ };
5458
+
5459
+ // src/registry/crates.ts
5460
+ var CratesError = class extends AbstractError {
5461
+ constructor() {
5462
+ super(...arguments);
5463
+ __publicField(this, "name", "crates.io Error");
5464
+ }
5465
+ };
5466
+ var USER_AGENT = "pubm (https://github.com/syi0808/pubm)";
5467
+ var CratesRegistry = class extends Registry {
5468
+ constructor() {
5469
+ super(...arguments);
5470
+ __publicField(this, "registry", "https://crates.io");
5471
+ }
5472
+ get headers() {
5473
+ return { "User-Agent": USER_AGENT };
5474
+ }
5475
+ async ping() {
5476
+ try {
5477
+ const response = await fetch(`${this.registry}/api/v1`, {
5478
+ headers: this.headers
5479
+ });
5480
+ return response.ok;
5481
+ } catch (error) {
5482
+ throw new CratesError("Failed to ping crates.io", { cause: error });
5483
+ }
5484
+ }
5485
+ async isInstalled() {
5486
+ try {
5487
+ await exec3("cargo", ["--version"]);
5488
+ return true;
5489
+ } catch {
5490
+ return false;
5491
+ }
5492
+ }
5493
+ async distTags() {
5494
+ return [];
5495
+ }
5496
+ async version() {
5497
+ try {
5498
+ const response = await fetch(
5499
+ `${this.registry}/api/v1/crates/${this.packageName}`,
5500
+ { headers: this.headers }
5501
+ );
5502
+ if (!response.ok) {
5503
+ throw new Error(`Crate '${this.packageName}' not found`);
5504
+ }
5505
+ const data = await response.json();
5506
+ return data.crate.max_version;
5507
+ } catch (error) {
5508
+ throw new CratesError(
5509
+ `Failed to fetch version for crate '${this.packageName}'`,
5510
+ { cause: error }
5511
+ );
5512
+ }
5513
+ }
5514
+ async publish() {
5515
+ try {
5516
+ await exec3("cargo", ["publish"], { throwOnError: true });
5517
+ return true;
5518
+ } catch (error) {
5519
+ throw new CratesError("Failed to run `cargo publish`", {
5520
+ cause: error
5521
+ });
5522
+ }
5523
+ }
5524
+ async isPublished() {
5525
+ try {
5526
+ const response = await fetch(
5527
+ `${this.registry}/api/v1/crates/${this.packageName}`,
5528
+ { headers: this.headers }
5529
+ );
5530
+ return response.ok;
5531
+ } catch {
5532
+ return false;
5533
+ }
5534
+ }
5535
+ async hasPermission() {
5536
+ if (process.env.CARGO_REGISTRY_TOKEN) return true;
5537
+ return this.isInstalled();
5538
+ }
5539
+ async isPackageNameAvaliable() {
5540
+ try {
5541
+ const response = await fetch(
5542
+ `${this.registry}/api/v1/crates/${this.packageName}`,
5543
+ { headers: this.headers }
5544
+ );
5545
+ return !response.ok;
5546
+ } catch {
5547
+ return true;
5548
+ }
5549
+ }
5550
+ };
5551
+ async function cratesRegistry(packageName) {
5552
+ return new CratesRegistry(packageName);
5553
+ }
5554
+
5555
+ // src/tasks/crates.ts
5556
+ var CratesError2 = class extends AbstractError {
5557
+ constructor(message, { cause } = {}) {
5558
+ super(message, { cause });
5559
+ __publicField(this, "name", "crates.io Error");
5560
+ this.stack = "";
5561
+ }
5562
+ };
5563
+ async function getCrateName() {
5564
+ const eco = new RustEcosystem(process.cwd());
5565
+ return await eco.packageName();
5566
+ }
5567
+ var cratesAvailableCheckTasks = {
5568
+ title: "Checking crates.io availability",
5569
+ task: async () => {
5570
+ const packageName = await getCrateName();
5571
+ const registry = new CratesRegistry(packageName);
5572
+ if (!await registry.isInstalled()) {
5573
+ throw new CratesError2(
5574
+ "cargo is not installed. Please install Rust toolchain to proceed."
5575
+ );
5576
+ }
5577
+ if (!await registry.hasPermission()) {
5578
+ throw new CratesError2(
5579
+ "No crates.io credentials found. Run `cargo login` or set CARGO_REGISTRY_TOKEN."
5580
+ );
5581
+ }
5582
+ }
5583
+ };
5584
+ var cratesPublishTasks = {
5585
+ title: "Publishing to crates.io",
5586
+ task: async () => {
5587
+ const packageName = await getCrateName();
5588
+ const registry = new CratesRegistry(packageName);
5589
+ await registry.publish();
5590
+ }
5591
+ };
5592
+
4927
5593
  // src/tasks/jsr.ts
4928
- import process8 from "node:process";
5594
+ import process12 from "node:process";
4929
5595
  import { ListrEnquirerPromptAdapter } from "@listr2/prompt-adapter-enquirer";
4930
5596
 
4931
5597
  // src/registry/jsr.ts
4932
- import { exec as exec3 } from "tinyexec";
5598
+ import { NonZeroExitError, exec as exec4 } from "tinyexec";
4933
5599
 
4934
5600
  // src/utils/db.ts
4935
5601
  import { createCipheriv, createDecipheriv, createHash } from "node:crypto";
4936
- import { mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
4937
- import path2 from "node:path";
5602
+ import { mkdirSync as mkdirSync5, readFileSync as readFileSync3, statSync, writeFileSync as writeFileSync4 } from "node:fs";
5603
+ import path8 from "node:path";
4938
5604
  var a = "aes-256-cbc";
4939
5605
  var n = statSync(import.meta.dirname);
4940
5606
  var k = `${n.rdev}${n.birthtimeMs}${n.nlink}${n.gid}`;
@@ -4949,18 +5615,18 @@ function d(g, h) {
4949
5615
  }
4950
5616
  var Db = class {
4951
5617
  constructor() {
4952
- __publicField(this, "path", path2.resolve(import.meta.dirname, ".pubm"));
5618
+ __publicField(this, "path", path8.resolve(import.meta.dirname, ".pubm"));
4953
5619
  try {
4954
5620
  if (!statSync(this.path).isDirectory()) {
4955
- mkdirSync(this.path);
5621
+ mkdirSync5(this.path);
4956
5622
  }
4957
5623
  } catch {
4958
- mkdirSync(this.path);
5624
+ mkdirSync5(this.path);
4959
5625
  }
4960
5626
  }
4961
5627
  set(field, value) {
4962
- writeFileSync(
4963
- path2.resolve(this.path, Buffer.from(e(field, field)).toString("base64")),
5628
+ writeFileSync4(
5629
+ path8.resolve(this.path, Buffer.from(e(field, field)).toString("base64")),
4964
5630
  Buffer.from(e(`${value}`, field)),
4965
5631
  { encoding: "binary" }
4966
5632
  );
@@ -4969,8 +5635,8 @@ var Db = class {
4969
5635
  try {
4970
5636
  return d(
4971
5637
  Buffer.from(
4972
- readFileSync(
4973
- path2.resolve(
5638
+ readFileSync3(
5639
+ path8.resolve(
4974
5640
  this.path,
4975
5641
  Buffer.from(e(field, field)).toString("base64")
4976
5642
  )
@@ -5025,14 +5691,6 @@ function isValidPackageName(packageName) {
5025
5691
  return true;
5026
5692
  }
5027
5693
 
5028
- // src/registry/registry.ts
5029
- var Registry = class {
5030
- constructor(packageName, registry) {
5031
- this.packageName = packageName;
5032
- this.registry = registry;
5033
- }
5034
- };
5035
-
5036
5694
  // src/registry/jsr.ts
5037
5695
  var JsrError = class extends AbstractError {
5038
5696
  constructor() {
@@ -5053,13 +5711,12 @@ var JsrRegisry = class extends Registry {
5053
5711
  this.client = new JsrClient(getApiEndpoint(this.registry));
5054
5712
  }
5055
5713
  async jsr(args) {
5056
- const { stdout, stderr } = await exec3("jsr", args);
5057
- if (stderr) throw stderr;
5714
+ const { stdout } = await exec4("jsr", args, { throwOnError: true });
5058
5715
  return stdout;
5059
5716
  }
5060
5717
  async isInstalled() {
5061
5718
  try {
5062
- await this.jsr(["--help"]);
5719
+ await this.jsr(["--version"]);
5063
5720
  return true;
5064
5721
  } catch {
5065
5722
  return false;
@@ -5070,12 +5727,11 @@ var JsrRegisry = class extends Registry {
5070
5727
  }
5071
5728
  async ping() {
5072
5729
  try {
5073
- const { stdout, stderr } = await exec3("ping", [
5074
- new URL(this.registry).hostname,
5075
- "-c",
5076
- "1"
5077
- ]);
5078
- if (stderr) throw stderr;
5730
+ const { stdout } = await exec4(
5731
+ "ping",
5732
+ [new URL(this.registry).hostname, "-c", "1"],
5733
+ { throwOnError: true }
5734
+ );
5079
5735
  return stdout.includes("1 packets transmitted");
5080
5736
  } catch (error) {
5081
5737
  throw new JsrError(
@@ -5086,7 +5742,7 @@ var JsrRegisry = class extends Registry {
5086
5742
  }
5087
5743
  async publish() {
5088
5744
  try {
5089
- await exec3(
5745
+ await exec4(
5090
5746
  "jsr",
5091
5747
  ["publish", "--allow-dirty", "--token", `${JsrClient.token}`],
5092
5748
  {
@@ -5095,8 +5751,10 @@ var JsrRegisry = class extends Registry {
5095
5751
  );
5096
5752
  return true;
5097
5753
  } catch (error) {
5754
+ const stderr = error instanceof NonZeroExitError ? error.output?.stderr : void 0;
5098
5755
  throw new JsrError(
5099
- "Failed to run `jsr publish --allow-dirty --token ***`",
5756
+ `Failed to run \`jsr publish --allow-dirty --token ***\`${stderr ? `
5757
+ ${stderr}` : ""}`,
5100
5758
  {
5101
5759
  cause: error
5102
5760
  }
@@ -5277,7 +5935,7 @@ async function jsrRegistry() {
5277
5935
  }
5278
5936
 
5279
5937
  // src/registry/npm.ts
5280
- import { exec as exec4 } from "tinyexec";
5938
+ import { NonZeroExitError as NonZeroExitError2, exec as exec5 } from "tinyexec";
5281
5939
  var NpmError = class extends AbstractError {
5282
5940
  constructor() {
5283
5941
  super(...arguments);
@@ -5290,13 +5948,12 @@ var NpmRegistry = class extends Registry {
5290
5948
  __publicField(this, "registry", "https://registry.npmjs.org");
5291
5949
  }
5292
5950
  async npm(args) {
5293
- const { stdout, stderr } = await exec4("npm", args);
5294
- if (stderr) throw stderr;
5951
+ const { stdout } = await exec5("npm", args, { throwOnError: true });
5295
5952
  return stdout;
5296
5953
  }
5297
5954
  async isInstalled() {
5298
5955
  try {
5299
- await this.npm(["--help"]);
5956
+ await this.npm(["--version"]);
5300
5957
  return true;
5301
5958
  } catch {
5302
5959
  return false;
@@ -5335,7 +5992,7 @@ var NpmRegistry = class extends Registry {
5335
5992
  await this.npm(["whoami"]);
5336
5993
  return true;
5337
5994
  } catch (error) {
5338
- if (`${error}`.includes("ENEEDAUTH")) {
5995
+ if (error instanceof NonZeroExitError2 && error.output?.stderr.includes("ENEEDAUTH")) {
5339
5996
  return false;
5340
5997
  }
5341
5998
  throw new NpmError("Failed to run `npm whoami`", { cause: error });
@@ -5387,7 +6044,7 @@ var NpmRegistry = class extends Registry {
5387
6044
  }
5388
6045
  async ping() {
5389
6046
  try {
5390
- await exec4("npm", ["ping"], { throwOnError: true });
6047
+ await exec5("npm", ["ping"], { throwOnError: true });
5391
6048
  return true;
5392
6049
  } catch (error) {
5393
6050
  throw new NpmError("Failed to run `npm ping`", { cause: error });
@@ -5395,15 +6052,12 @@ var NpmRegistry = class extends Registry {
5395
6052
  }
5396
6053
  async publishProvenance() {
5397
6054
  try {
5398
- try {
5399
- await this.npm(["publish", "--provenance", "--access", "public"]);
5400
- } catch (error) {
5401
- if (`${error}`.includes("EOTP")) {
5402
- return false;
5403
- }
5404
- }
6055
+ await this.npm(["publish", "--provenance", "--access", "public"]);
5405
6056
  return true;
5406
6057
  } catch (error) {
6058
+ if (error instanceof NonZeroExitError2 && error.output?.stderr.includes("EOTP")) {
6059
+ return false;
6060
+ }
5407
6061
  throw new NpmError(
5408
6062
  "Failed to run `npm publish --provenance --access public`",
5409
6063
  {
@@ -5415,15 +6069,12 @@ var NpmRegistry = class extends Registry {
5415
6069
  async publish(otp) {
5416
6070
  const args = otp ? ["publish", "--otp", otp] : ["publish"];
5417
6071
  try {
5418
- try {
5419
- await this.npm(args);
5420
- } catch (error) {
5421
- if (`${error}`.includes("EOTP")) {
5422
- return false;
5423
- }
5424
- }
6072
+ await this.npm(args);
5425
6073
  return true;
5426
6074
  } catch (error) {
6075
+ if (error instanceof NonZeroExitError2 && error.output?.stderr.includes("EOTP")) {
6076
+ return false;
6077
+ }
5427
6078
  throw new NpmError(`Failed to run \`npm ${args.join(" ")}\``, {
5428
6079
  cause: error
5429
6080
  });
@@ -5477,7 +6128,7 @@ Generate a token from ${color.bold(link2("jsr.io", "https://jsr.io/account/token
5477
6128
  }
5478
6129
  }
5479
6130
  } else {
5480
- const jsrTokenEnv = process8.env.JSR_TOKEN;
6131
+ const jsrTokenEnv = process12.env.JSR_TOKEN;
5481
6132
  if (!jsrTokenEnv)
5482
6133
  throw new JsrAvailableError(
5483
6134
  "JSR_TOKEN not found in the environment variables. Please set the token and try again."
@@ -5594,7 +6245,7 @@ var jsrPublishTasks = {
5594
6245
  const jsr = await jsrRegistry();
5595
6246
  task.output = "Publishing on jsr...";
5596
6247
  if (!JsrClient.token && !ctx.promptEnabled) {
5597
- const jsrTokenEnv = process8.env.JSR_TOKEN;
6248
+ const jsrTokenEnv = process12.env.JSR_TOKEN;
5598
6249
  if (!jsrTokenEnv) {
5599
6250
  throw new JsrAvailableError(
5600
6251
  "JSR_TOKEN not found in the environment variables. Please set the token and try again."
@@ -5607,7 +6258,7 @@ var jsrPublishTasks = {
5607
6258
  };
5608
6259
 
5609
6260
  // src/tasks/npm.ts
5610
- import process9 from "node:process";
6261
+ import process13 from "node:process";
5611
6262
  import { ListrEnquirerPromptAdapter as ListrEnquirerPromptAdapter2 } from "@listr2/prompt-adapter-enquirer";
5612
6263
  var NpmAvailableError = class extends AbstractError {
5613
6264
  constructor(message, { cause } = {}) {
@@ -5666,7 +6317,7 @@ var npmPublishTasks = {
5666
6317
  task.title = "Running npm publish (2FA passed)";
5667
6318
  }
5668
6319
  } else {
5669
- const npmTokenEnv = process9.env.NODE_AUTH_TOKEN;
6320
+ const npmTokenEnv = process13.env.NODE_AUTH_TOKEN;
5670
6321
  if (!npmTokenEnv) {
5671
6322
  throw new NpmAvailableError(
5672
6323
  "NODE_AUTH_TOKEN not found in the environment variables. Please set the token and try again."
@@ -5691,10 +6342,10 @@ var PrerequisitesCheckError = class extends AbstractError {
5691
6342
  this.stack = "";
5692
6343
  }
5693
6344
  };
5694
- var prerequisitesCheckTask = (options2) => {
6345
+ var prerequisitesCheckTask = (options) => {
5695
6346
  const git = new Git();
5696
6347
  return createListr({
5697
- ...options2,
6348
+ ...options,
5698
6349
  exitOnError: true,
5699
6350
  title: "Prerequisites check (for deployment reliability)",
5700
6351
  task: (_, parentTask) => parentTask.newListr([
@@ -5831,14 +6482,14 @@ var prerequisitesCheckTask = (options2) => {
5831
6482
  import { ListrEnquirerPromptAdapter as ListrEnquirerPromptAdapter4 } from "@listr2/prompt-adapter-enquirer";
5832
6483
 
5833
6484
  // src/registry/custom-registry.ts
5834
- import { exec as exec5 } from "tinyexec";
6485
+ import { exec as exec6 } from "tinyexec";
5835
6486
  var CustomRegistry = class extends NpmRegistry {
5836
6487
  async npm(args) {
5837
- const { stdout, stderr } = await exec5(
6488
+ const { stdout } = await exec6(
5838
6489
  "npm",
5839
- args.concat("--registry", this.registry)
6490
+ args.concat("--registry", this.registry),
6491
+ { throwOnError: true }
5840
6492
  );
5841
- if (stderr) throw stderr;
5842
6493
  return stdout;
5843
6494
  }
5844
6495
  };
@@ -5852,7 +6503,10 @@ var registryMap = {
5852
6503
  npm: npmRegistry,
5853
6504
  jsr: jsrRegistry
5854
6505
  };
5855
- async function getRegistry(registryKey) {
6506
+ async function getRegistry(registryKey, packageName) {
6507
+ if (registryKey === "crates") {
6508
+ return await cratesRegistry(packageName ?? "unknown");
6509
+ }
5856
6510
  const registry = registryMap[registryKey];
5857
6511
  if (!registry) {
5858
6512
  return await customRegistry();
@@ -5879,8 +6533,8 @@ var RequiredConditionCheckError = class extends AbstractError {
5879
6533
  this.stack = "";
5880
6534
  }
5881
6535
  };
5882
- var requiredConditionsCheckTask = (options2) => createListr({
5883
- ...options2,
6536
+ var requiredConditionsCheckTask = (options) => createListr({
6537
+ ...options,
5884
6538
  title: "Required conditions check (for pubm tasks)",
5885
6539
  task: (_, parentTask) => parentTask.newListr(
5886
6540
  [
@@ -5982,6 +6636,8 @@ var requiredConditionsCheckTask = (options2) => createListr({
5982
6636
  return npmAvailableCheckTasks;
5983
6637
  case "jsr":
5984
6638
  return jsrAvailableCheckTasks;
6639
+ case "crates":
6640
+ return cratesAvailableCheckTasks;
5985
6641
  default:
5986
6642
  return npmAvailableCheckTasks;
5987
6643
  }
@@ -6001,25 +6657,25 @@ var requiredConditionsCheckTask = (options2) => createListr({
6001
6657
  // src/tasks/runner.ts
6002
6658
  var { open } = npmCli;
6003
6659
  var { prerelease } = SemVer;
6004
- async function run(options2) {
6660
+ async function run(options) {
6005
6661
  const ctx = {
6006
- ...options2,
6007
- promptEnabled: !isCI2 && process10.stdin.isTTY,
6008
- npmOnly: options2.registries.every((registry) => registry !== "jsr"),
6009
- jsrOnly: options2.registries.every((registry) => registry === "jsr")
6662
+ ...options,
6663
+ promptEnabled: !isCI2 && process14.stdin.isTTY,
6664
+ npmOnly: options.registries.every((registry) => registry !== "jsr"),
6665
+ jsrOnly: options.registries.every((registry) => registry === "jsr")
6010
6666
  };
6011
6667
  try {
6012
- if (options2.contents) process10.chdir(options2.contents);
6013
- if (!options2.publishOnly) {
6668
+ if (options.contents) process14.chdir(options.contents);
6669
+ if (!options.publishOnly) {
6014
6670
  await prerequisitesCheckTask({
6015
- skip: options2.skipPrerequisitesCheck
6671
+ skip: options.skipPrerequisitesCheck
6016
6672
  }).run(ctx);
6017
6673
  await requiredConditionsCheckTask({
6018
- skip: options2.skipConditionsCheck
6674
+ skip: options.skipConditionsCheck
6019
6675
  }).run(ctx);
6020
6676
  }
6021
6677
  await createListr(
6022
- options2.publishOnly ? {
6678
+ options.publishOnly ? {
6023
6679
  title: "Publishing",
6024
6680
  task: (ctx2, parentTask) => parentTask.newListr(
6025
6681
  ctx2.registries.map((registry) => {
@@ -6028,6 +6684,8 @@ async function run(options2) {
6028
6684
  return npmPublishTasks;
6029
6685
  case "jsr":
6030
6686
  return jsrPublishTasks;
6687
+ case "crates":
6688
+ return cratesPublishTasks;
6031
6689
  default:
6032
6690
  return npmPublishTasks;
6033
6691
  }
@@ -6036,29 +6694,22 @@ async function run(options2) {
6036
6694
  )
6037
6695
  } : [
6038
6696
  {
6039
- skip: options2.skipTests,
6697
+ skip: options.skipTests,
6040
6698
  title: "Running tests",
6041
6699
  task: async (ctx2) => {
6042
6700
  const packageManager = await getPackageManager();
6043
- const { stderr } = await exec6(packageManager, [
6044
- "run",
6045
- ctx2.testScript
6046
- ]);
6047
- if (stderr) {
6048
- throw new AbstractError(
6049
- `Failed to run \`${packageManager} run ${ctx2.testScript}\``,
6050
- { cause: stderr }
6051
- );
6052
- }
6701
+ await exec7(packageManager, ["run", ctx2.testScript], {
6702
+ throwOnError: true
6703
+ });
6053
6704
  }
6054
6705
  },
6055
6706
  {
6056
- skip: options2.skipBuild,
6707
+ skip: options.skipBuild,
6057
6708
  title: "Building the project",
6058
6709
  task: async (ctx2) => {
6059
6710
  const packageManager = await getPackageManager();
6060
6711
  try {
6061
- await exec6(packageManager, ["run", ctx2.buildScript], {
6712
+ await exec7(packageManager, ["run", ctx2.buildScript], {
6062
6713
  throwOnError: true
6063
6714
  });
6064
6715
  } catch (error) {
@@ -6103,7 +6754,7 @@ async function run(options2) {
6103
6754
  }
6104
6755
  },
6105
6756
  {
6106
- skip: (ctx2) => options2.skipPublish || !!ctx2.preview,
6757
+ skip: (ctx2) => options.skipPublish || !!ctx2.preview,
6107
6758
  title: "Publishing",
6108
6759
  task: (ctx2, parentTask) => parentTask.newListr(
6109
6760
  ctx2.registries.map((registry) => {
@@ -6112,6 +6763,8 @@ async function run(options2) {
6112
6763
  return npmPublishTasks;
6113
6764
  case "jsr":
6114
6765
  return jsrPublishTasks;
6766
+ case "crates":
6767
+ return cratesPublishTasks;
6115
6768
  default:
6116
6769
  return npmPublishTasks;
6117
6770
  }
@@ -6132,7 +6785,7 @@ async function run(options2) {
6132
6785
  }
6133
6786
  },
6134
6787
  {
6135
- skip: (ctx2) => options2.skipReleaseDraft || !!ctx2.preview,
6788
+ skip: (ctx2) => options.skipReleaseDraft || !!ctx2.preview,
6136
6789
  title: "Creating release draft on GitHub",
6137
6790
  task: async (ctx2, task) => {
6138
6791
  const git = new Git();
@@ -6173,13 +6826,36 @@ ${repositoryUrl}/compare/${lastRev}...${latestTag}`;
6173
6826
  } catch (e2) {
6174
6827
  consoleError(e2);
6175
6828
  await rollback();
6176
- process10.exit(1);
6829
+ process14.exit(1);
6177
6830
  }
6178
6831
  }
6179
6832
 
6833
+ // src/changeset/version.ts
6834
+ import process15 from "node:process";
6835
+ import { inc } from "semver";
6836
+
6837
+ // src/config/loader.ts
6838
+ import { stat as stat3 } from "node:fs/promises";
6839
+ import path9 from "node:path";
6840
+
6841
+ // src/monorepo/groups.ts
6842
+ import micromatch from "micromatch";
6843
+
6844
+ // src/monorepo/workspace.ts
6845
+ import { existsSync as existsSync5, readFileSync as readFileSync4 } from "node:fs";
6846
+ import { join } from "node:path";
6847
+ import { parse as parse2 } from "yaml";
6848
+
6849
+ // src/validate/entry-points.ts
6850
+ import { existsSync as existsSync6 } from "node:fs";
6851
+ import path10 from "node:path";
6852
+
6853
+ // src/validate/extraneous-files.ts
6854
+ import micromatch2 from "micromatch";
6855
+
6180
6856
  // src/index.ts
6181
- async function pubm(options2) {
6182
- const resolvedOptions = resolveOptions({ ...options2 });
6857
+ async function pubm(options) {
6858
+ const resolvedOptions = resolveOptions({ ...options });
6183
6859
  await run(resolvedOptions);
6184
6860
  }
6185
6861
 
@@ -6187,8 +6863,8 @@ async function pubm(options2) {
6187
6863
  import { ListrEnquirerPromptAdapter as ListrEnquirerPromptAdapter5 } from "@listr2/prompt-adapter-enquirer";
6188
6864
  import semver2 from "semver";
6189
6865
  var { RELEASE_TYPES, SemVer: SemVer2, prerelease: prerelease2 } = semver2;
6190
- var requiredMissingInformationTasks = (options2) => createListr({
6191
- ...options2,
6866
+ var requiredMissingInformationTasks = (options) => createListr({
6867
+ ...options,
6192
6868
  title: "Checking required information",
6193
6869
  task: (_, parentTask) => parentTask.newListr([
6194
6870
  {
@@ -6259,63 +6935,18 @@ var requiredMissingInformationTasks = (options2) => createListr({
6259
6935
  });
6260
6936
 
6261
6937
  // src/utils/notify-new-version.ts
6262
- import { exec as exec7 } from "tinyexec";
6938
+ import { UpdateKit as UpdateKit2 } from "update-kit";
6263
6939
  async function notifyNewVersion() {
6264
- const currentVersion = await version({ cwd: import.meta.dirname });
6265
- await Promise.all([
6266
- (async () => {
6267
- try {
6268
- const packageJson = await findOutFile("package.json", {
6269
- cwd: import.meta.dirname
6270
- });
6271
- if (!packageJson) return void 0;
6272
- const { name } = await getPackageJson({
6273
- cwd: import.meta.dirname,
6274
- fallbackJsr: false
6275
- });
6276
- const { stdout } = await exec7("npm", ["info", name, "version"]);
6277
- const newVersion = stdout.trim();
6278
- if (newVersion !== currentVersion) {
6279
- console.log(
6280
- `
6281
- Update available! \`${name}\` ${color.red(currentVersion)} \u2192 ${color.green(newVersion)}
6282
- `
6283
- );
6284
- }
6285
- } catch {
6286
- }
6287
- })(),
6288
- (async () => {
6289
- try {
6290
- const jsrJson = await findOutFile("jsr.json", {
6291
- cwd: import.meta.dirname
6292
- });
6293
- if (!jsrJson) return void 0;
6294
- const { name } = await getJsrJson({
6295
- cwd: import.meta.dirname,
6296
- fallbackPackage: false
6297
- });
6298
- const [scope, packageName] = getScopeAndName(name);
6299
- const response = await fetch(
6300
- `https://api.jsr.io/scopes/${scope}/packages/${packageName}/versions`
6301
- );
6302
- const newVersion = (await response.json())?.[0]?.version;
6303
- if (newVersion && newVersion !== currentVersion) {
6304
- console.log(
6305
- `
6306
- Update available! \`${name}\` ${color.red(currentVersion)} \u2192 ${color.green(newVersion)}
6307
- `
6308
- );
6309
- }
6310
- } catch {
6311
- }
6312
- })()
6313
- ]);
6940
+ const kit = await UpdateKit2.create({
6941
+ sources: [{ type: "npm", packageName: "pubm" }]
6942
+ });
6943
+ const banner = await kit.checkAndNotify();
6944
+ if (banner) console.error(banner);
6314
6945
  }
6315
6946
 
6316
6947
  // src/cli.ts
6317
6948
  var { RELEASE_TYPES: RELEASE_TYPES2, valid } = semver3;
6318
- var options = [
6949
+ var publishOptions = [
6319
6950
  {
6320
6951
  rawName: "--test-script <script>",
6321
6952
  description: "The npm script to run tests before publishing",
@@ -6338,7 +6969,7 @@ var options = [
6338
6969
  },
6339
6970
  {
6340
6971
  rawName: "-a, --any-branch",
6341
- description: "Show tasks without actually executing publish",
6972
+ description: "Allow publishing from any branch",
6342
6973
  options: { type: Boolean }
6343
6974
  },
6344
6975
  {
@@ -6397,35 +7028,44 @@ var options = [
6397
7028
  options: { type: String, default: "npm,jsr" }
6398
7029
  }
6399
7030
  ];
6400
- var cli = cac("pubm");
6401
- for (const option of options) {
6402
- cli.option(option.rawName, option.description, option.options);
6403
- }
6404
- function resolveCliOptions(options2) {
7031
+ function resolveCliOptions(options) {
6405
7032
  return {
6406
- ...options2,
6407
- skipPublish: !options2.publish,
6408
- skipReleaseDraft: !options2.releaseDraft,
6409
- skipTests: !options2.tests,
6410
- skipBuild: !options2.build,
6411
- registries: options2.registry?.split(","),
6412
- skipPrerequisitesCheck: !options2.preCheck,
6413
- skipConditionsCheck: !options2.conditionCheck
7033
+ ...options,
7034
+ skipPublish: !options.publish,
7035
+ skipReleaseDraft: !options.releaseDraft,
7036
+ skipTests: !options.tests,
7037
+ skipBuild: !options.build,
7038
+ registries: options.registry?.split(","),
7039
+ skipPrerequisitesCheck: !options.preCheck,
7040
+ skipConditionsCheck: !options.conditionCheck
6414
7041
  };
6415
7042
  }
6416
- cli.command("[version]").action(
6417
- async (nextVersion, options2) => {
7043
+ var cli = cac("pubm");
7044
+ registerAddCommand(cli);
7045
+ registerVersionCommand(cli);
7046
+ registerStatusCommand(cli);
7047
+ registerPreCommand(cli);
7048
+ registerSnapshotCommand(cli);
7049
+ registerInitCommand(cli);
7050
+ registerMigrateCommand(cli);
7051
+ registerUpdateCommand(cli);
7052
+ var defaultCmd = cli.command("[version]", "Publish packages to registries");
7053
+ for (const option of publishOptions) {
7054
+ defaultCmd.option(option.rawName, option.description, option.options);
7055
+ }
7056
+ defaultCmd.action(
7057
+ async (nextVersion, options) => {
6418
7058
  console.clear();
6419
7059
  if (!isCI3) {
6420
7060
  await notifyNewVersion();
6421
7061
  }
6422
7062
  const context = {
6423
7063
  version: nextVersion,
6424
- tag: options2.tag
7064
+ tag: options.tag
6425
7065
  };
6426
7066
  try {
6427
7067
  if (isCI3) {
6428
- if (options2.publishOnly) {
7068
+ if (options.publishOnly) {
6429
7069
  const git = new Git();
6430
7070
  const latestVersion = (await git.latestTag())?.slice(1);
6431
7071
  if (!latestVersion) {
@@ -6449,7 +7089,7 @@ cli.command("[version]").action(
6449
7089
  }
6450
7090
  await pubm(
6451
7091
  resolveCliOptions({
6452
- ...options2,
7092
+ ...options,
6453
7093
  version: context.version,
6454
7094
  tag: context.tag
6455
7095
  })
@@ -6474,3 +7114,6 @@ cli.help((sections) => {
6474
7114
  cli.version(await version({ cwd: import.meta.dirname }));
6475
7115
  cli.parse();
6476
7116
  })();
7117
+ export {
7118
+ resolveCliOptions
7119
+ };