ya-git-jira 2.1.0 → 2.1.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 (87) hide show
  1. package/bin/git-api.ts +2 -4
  2. package/bin/git-bump.ts +2 -4
  3. package/bin/git-confluence-page-search.ts +4 -6
  4. package/bin/git-confluence-page-show.ts +3 -5
  5. package/bin/git-confluence-page-update.ts +3 -5
  6. package/bin/git-confluence-page.ts +2 -4
  7. package/bin/git-confluence-space-list.ts +3 -5
  8. package/bin/git-confluence-space.ts +2 -4
  9. package/bin/git-confluence-whoami.ts +3 -5
  10. package/bin/git-confluence.ts +11 -4
  11. package/bin/git-jira-issue-list.ts +2 -4
  12. package/bin/git-jira-issue-show.ts +3 -5
  13. package/bin/git-jira-issue.ts +2 -4
  14. package/bin/git-jira-start.ts +2 -4
  15. package/bin/git-jira-whoami.ts +3 -5
  16. package/bin/git-jira.ts +11 -4
  17. package/bin/git-lab-group-list.ts +4 -6
  18. package/bin/git-lab-group.ts +2 -4
  19. package/bin/git-lab-merge-active.ts +4 -6
  20. package/bin/git-lab-merge-todo.ts +4 -6
  21. package/bin/git-lab-merge-train-list.ts +3 -5
  22. package/bin/git-lab-merge-train.ts +2 -4
  23. package/bin/git-lab-merge.ts +2 -4
  24. package/bin/git-lab-namespace-list.ts +3 -5
  25. package/bin/git-lab-namespace.ts +2 -4
  26. package/bin/git-lab-project-list.ts +4 -6
  27. package/bin/git-lab-project-mr-list.ts +4 -6
  28. package/bin/git-lab-project-mr.ts +2 -4
  29. package/bin/git-lab-project-pipeline-jobs.ts +2 -4
  30. package/bin/git-lab-project-pipeline-latest.ts +2 -4
  31. package/bin/git-lab-project-pipeline-list.ts +4 -6
  32. package/bin/git-lab-project-pipeline-log.ts +2 -4
  33. package/bin/git-lab-project-pipeline.ts +2 -4
  34. package/bin/git-lab-project-whereami.ts +3 -5
  35. package/bin/git-lab-project.ts +2 -4
  36. package/bin/git-lab-whoami.ts +3 -5
  37. package/bin/git-lab.ts +11 -4
  38. package/bin/gitj-install-skills.ts +2 -4
  39. package/bin/gitj.ts +6 -1
  40. package/dist/bin/git-api.js +33 -5
  41. package/dist/bin/git-bump.js +32 -24
  42. package/dist/bin/git-confluence-page-search.js +46 -26
  43. package/dist/bin/git-confluence-page-show.js +24 -4
  44. package/dist/bin/git-confluence-page-update.js +24 -4
  45. package/dist/bin/git-confluence-page.js +30 -16
  46. package/dist/bin/git-confluence-space-list.js +45 -25
  47. package/dist/bin/git-confluence-space.js +46 -28
  48. package/dist/bin/git-confluence-whoami.js +45 -25
  49. package/dist/bin/git-confluence.js +45 -31
  50. package/dist/bin/git-jira-issue-list.js +36 -24
  51. package/dist/bin/git-jira-issue-show.js +16 -4
  52. package/dist/bin/git-jira-issue.js +18 -10
  53. package/dist/bin/git-jira-start.js +16 -4
  54. package/dist/bin/git-jira-whoami.js +37 -25
  55. package/dist/bin/git-jira.js +32 -22
  56. package/dist/bin/git-lab-group-list.js +18 -6
  57. package/dist/bin/git-lab-group.js +19 -9
  58. package/dist/bin/git-lab-merge-active.js +18 -6
  59. package/dist/bin/git-lab-merge-todo.js +18 -6
  60. package/dist/bin/git-lab-merge-train-list.js +17 -5
  61. package/dist/bin/git-lab-merge-train.js +18 -8
  62. package/dist/bin/git-lab-merge.js +25 -21
  63. package/dist/bin/git-lab-namespace-list.js +38 -26
  64. package/dist/bin/git-lab-namespace.js +39 -29
  65. package/dist/bin/git-lab-project-list.js +18 -6
  66. package/dist/bin/git-lab-project-mr-list.js +18 -6
  67. package/dist/bin/git-lab-project-mr.js +19 -9
  68. package/dist/bin/git-lab-project-pipeline-jobs.js +16 -4
  69. package/dist/bin/git-lab-project-pipeline-latest.js +16 -4
  70. package/dist/bin/git-lab-project-pipeline-list.js +18 -6
  71. package/dist/bin/git-lab-project-pipeline-log.js +16 -4
  72. package/dist/bin/git-lab-project-pipeline.js +22 -18
  73. package/dist/bin/git-lab-project-whereami.js +17 -5
  74. package/dist/bin/git-lab-project.js +32 -38
  75. package/dist/bin/git-lab-whoami.js +17 -5
  76. package/dist/bin/git-lab.js +61 -81
  77. package/dist/bin/gitj-install-skills.js +21 -11
  78. package/dist/bin/gitj.js +154 -153
  79. package/dist/index.js +32 -1
  80. package/lib/api.ts +19 -1
  81. package/lib/confluence/api.ts +12 -0
  82. package/lib/confluence/config.ts +3 -3
  83. package/lib/gitlab/api.ts +4 -0
  84. package/lib/gitlab/config.ts +2 -2
  85. package/lib/is_main.ts +11 -0
  86. package/lib/jira.ts +7 -3
  87. package/package.json +1 -1
@@ -600,7 +600,7 @@ var require_command = __commonJS((exports) => {
600
600
  var childProcess = __require("child_process");
601
601
  var path = __require("path");
602
602
  var fs = __require("fs");
603
- var process = __require("process");
603
+ var process2 = __require("process");
604
604
  var { Argument, humanReadableArgName } = require_argument();
605
605
  var { CommanderError } = require_error();
606
606
  var { Help } = require_help();
@@ -641,10 +641,10 @@ var require_command = __commonJS((exports) => {
641
641
  this._showHelpAfterError = false;
642
642
  this._showSuggestionAfterError = true;
643
643
  this._outputConfiguration = {
644
- writeOut: (str) => process.stdout.write(str),
645
- writeErr: (str) => process.stderr.write(str),
646
- getOutHelpWidth: () => process.stdout.isTTY ? process.stdout.columns : undefined,
647
- getErrHelpWidth: () => process.stderr.isTTY ? process.stderr.columns : undefined,
644
+ writeOut: (str) => process2.stdout.write(str),
645
+ writeErr: (str) => process2.stderr.write(str),
646
+ getOutHelpWidth: () => process2.stdout.isTTY ? process2.stdout.columns : undefined,
647
+ getErrHelpWidth: () => process2.stderr.isTTY ? process2.stderr.columns : undefined,
648
648
  outputError: (str, write) => write(str)
649
649
  };
650
650
  this._hidden = false;
@@ -826,7 +826,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
826
826
  if (this._exitCallback) {
827
827
  this._exitCallback(new CommanderError(exitCode, code, message));
828
828
  }
829
- process.exit(exitCode);
829
+ process2.exit(exitCode);
830
830
  }
831
831
  action(fn) {
832
832
  const listener = (args) => {
@@ -991,8 +991,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
991
991
  }
992
992
  parseOptions = parseOptions || {};
993
993
  if (argv === undefined) {
994
- argv = process.argv;
995
- if (process.versions && process.versions.electron) {
994
+ argv = process2.argv;
995
+ if (process2.versions && process2.versions.electron) {
996
996
  parseOptions.from = "electron";
997
997
  }
998
998
  }
@@ -1005,7 +1005,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1005
1005
  userArgs = argv.slice(2);
1006
1006
  break;
1007
1007
  case "electron":
1008
- if (process.defaultApp) {
1008
+ if (process2.defaultApp) {
1009
1009
  this._scriptPath = argv[1];
1010
1010
  userArgs = argv.slice(2);
1011
1011
  } else {
@@ -1073,23 +1073,23 @@ Expecting one of '${allowedValues.join("', '")}'`);
1073
1073
  }
1074
1074
  launchWithNode = sourceExt.includes(path.extname(executableFile));
1075
1075
  let proc;
1076
- if (process.platform !== "win32") {
1076
+ if (process2.platform !== "win32") {
1077
1077
  if (launchWithNode) {
1078
1078
  args.unshift(executableFile);
1079
- args = incrementNodeInspectorPort(process.execArgv).concat(args);
1080
- proc = childProcess.spawn(process.argv[0], args, { stdio: "inherit" });
1079
+ args = incrementNodeInspectorPort(process2.execArgv).concat(args);
1080
+ proc = childProcess.spawn(process2.argv[0], args, { stdio: "inherit" });
1081
1081
  } else {
1082
1082
  proc = childProcess.spawn(executableFile, args, { stdio: "inherit" });
1083
1083
  }
1084
1084
  } else {
1085
1085
  args.unshift(executableFile);
1086
- args = incrementNodeInspectorPort(process.execArgv).concat(args);
1087
- proc = childProcess.spawn(process.execPath, args, { stdio: "inherit" });
1086
+ args = incrementNodeInspectorPort(process2.execArgv).concat(args);
1087
+ proc = childProcess.spawn(process2.execPath, args, { stdio: "inherit" });
1088
1088
  }
1089
1089
  if (!proc.killed) {
1090
1090
  const signals = ["SIGUSR1", "SIGUSR2", "SIGTERM", "SIGINT", "SIGHUP"];
1091
1091
  signals.forEach((signal) => {
1092
- process.on(signal, () => {
1092
+ process2.on(signal, () => {
1093
1093
  if (proc.killed === false && proc.exitCode === null) {
1094
1094
  proc.kill(signal);
1095
1095
  }
@@ -1098,10 +1098,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
1098
1098
  }
1099
1099
  const exitCallback = this._exitCallback;
1100
1100
  if (!exitCallback) {
1101
- proc.on("close", process.exit.bind(process));
1101
+ proc.on("close", process2.exit.bind(process2));
1102
1102
  } else {
1103
1103
  proc.on("close", () => {
1104
- exitCallback(new CommanderError(process.exitCode || 0, "commander.executeSubCommandAsync", "(close)"));
1104
+ exitCallback(new CommanderError(process2.exitCode || 0, "commander.executeSubCommandAsync", "(close)"));
1105
1105
  });
1106
1106
  }
1107
1107
  proc.on("error", (err) => {
@@ -1116,7 +1116,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1116
1116
  throw new Error(`'${executableFile}' not executable`);
1117
1117
  }
1118
1118
  if (!exitCallback) {
1119
- process.exit(1);
1119
+ process2.exit(1);
1120
1120
  } else {
1121
1121
  const wrappedError = new CommanderError(1, "commander.executeSubCommandAsync", "(error)");
1122
1122
  wrappedError.nestedError = err;
@@ -1471,11 +1471,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
1471
1471
  }
1472
1472
  _parseOptionsEnv() {
1473
1473
  this.options.forEach((option) => {
1474
- if (option.envVar && option.envVar in process.env) {
1474
+ if (option.envVar && option.envVar in process2.env) {
1475
1475
  const optionKey = option.attributeName();
1476
1476
  if (this.getOptionValue(optionKey) === undefined || ["default", "config", "env"].includes(this.getOptionValueSource(optionKey))) {
1477
1477
  if (option.required || option.optional) {
1478
- this.emit(`optionEnv:${option.name()}`, process.env[option.envVar]);
1478
+ this.emit(`optionEnv:${option.name()}`, process2.env[option.envVar]);
1479
1479
  } else {
1480
1480
  this.emit(`optionEnv:${option.name()}`);
1481
1481
  }
@@ -1702,7 +1702,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1702
1702
  }
1703
1703
  help(contextOptions) {
1704
1704
  this.outputHelp(contextOptions);
1705
- let exitCode = process.exitCode || 0;
1705
+ let exitCode = process2.exitCode || 0;
1706
1706
  if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
1707
1707
  exitCode = 1;
1708
1708
  }
@@ -1853,6 +1853,16 @@ function isMain(self) {
1853
1853
  const result = argv1Base === selfBase;
1854
1854
  return result;
1855
1855
  }
1856
+ async function runMain(self, create) {
1857
+ if (!isMain(self))
1858
+ return;
1859
+ try {
1860
+ await create().parseAsync(Bun.argv);
1861
+ } catch (err) {
1862
+ console.error(`error: ${err instanceof Error ? err.message : String(err)}`);
1863
+ process.exit(1);
1864
+ }
1865
+ }
1856
1866
 
1857
1867
  // lib/spawn.ts
1858
1868
  var defaultOptions = {
@@ -1902,7 +1912,7 @@ async function getGitlabConfig() {
1902
1912
  const host = await hostP || "gitlab.com";
1903
1913
  const user = await gitEmailP || await gitlabEmailP;
1904
1914
  if (!user)
1905
- throw new Error("Neither user.email nor gitlab.email in git config");
1915
+ throw new Error("Neither user.email nor gitlab.user in git config");
1906
1916
  const token = await tokenP;
1907
1917
  if (!token)
1908
1918
  throw new Error("gitlab.token not in git config");
@@ -1939,6 +1949,10 @@ async function gitlabApi(endpoint) {
1939
1949
  };
1940
1950
  let request = new Request(uri, options);
1941
1951
  const response = await fetch(request);
1952
+ if (!response.ok) {
1953
+ const text = await response.text();
1954
+ throw new Error(`GitLab API ${endpoint} failed (${response.status}): ${text}`);
1955
+ }
1942
1956
  let link = getNextLink(response.headers.get("Link"));
1943
1957
  let partial = await response.json();
1944
1958
  let result = partial;
@@ -1963,14 +1977,12 @@ function create() {
1963
1977
  const program2 = new Command;
1964
1978
  program2.version(version).name("list").description("List namespaces for the current user").action(async () => {
1965
1979
  const namespaces = await getNamespaces();
1966
- console.log(namespaces);
1980
+ console.log(JSON.stringify(namespaces, null, 2));
1967
1981
  });
1968
1982
  return program2;
1969
1983
  }
1970
1984
  var git_lab_namespace_list_default = create;
1971
- if (isMain("git-lab-namespace-list")) {
1972
- await create().parseAsync(Bun.argv);
1973
- }
1985
+ await runMain("git-lab-namespace-list", create);
1974
1986
 
1975
1987
  // bin/git-lab-namespace.ts
1976
1988
  var version2 = await getPackageVersion();
@@ -1980,9 +1992,7 @@ function create2() {
1980
1992
  return program2;
1981
1993
  }
1982
1994
  var git_lab_namespace_default = create2;
1983
- if (isMain("git-lab-namespace")) {
1984
- await create2().parseAsync(Bun.argv);
1985
- }
1995
+ await runMain("git-lab-namespace", create2);
1986
1996
  export {
1987
1997
  git_lab_namespace_default as default,
1988
1998
  create2 as create
@@ -2497,7 +2497,7 @@ async function getGitlabConfig() {
2497
2497
  const host = await hostP || "gitlab.com";
2498
2498
  const user = await gitEmailP || await gitlabEmailP;
2499
2499
  if (!user)
2500
- throw new Error("Neither user.email nor gitlab.email in git config");
2500
+ throw new Error("Neither user.email nor gitlab.user in git config");
2501
2501
  const token = await tokenP;
2502
2502
  if (!token)
2503
2503
  throw new Error("gitlab.token not in git config");
@@ -2534,6 +2534,10 @@ async function gitlabApi(endpoint) {
2534
2534
  };
2535
2535
  let request = new Request(uri, options);
2536
2536
  const response = await fetch(request);
2537
+ if (!response.ok) {
2538
+ const text = await response.text();
2539
+ throw new Error(`GitLab API ${endpoint} failed (${response.status}): ${text}`);
2540
+ }
2537
2541
  let link = getNextLink(response.headers.get("Link"));
2538
2542
  let partial = await response.json();
2539
2543
  let result = partial;
@@ -2634,6 +2638,16 @@ function isMain(self) {
2634
2638
  const result = argv1Base === selfBase;
2635
2639
  return result;
2636
2640
  }
2641
+ async function runMain(self, create) {
2642
+ if (!isMain(self))
2643
+ return;
2644
+ try {
2645
+ await create().parseAsync(Bun.argv);
2646
+ } catch (err) {
2647
+ console.error(`error: ${err instanceof Error ? err.message : String(err)}`);
2648
+ process.exit(1);
2649
+ }
2650
+ }
2637
2651
 
2638
2652
  // bin/git-lab-project-list.ts
2639
2653
  var version = await getPackageVersion();
@@ -2646,21 +2660,19 @@ function create() {
2646
2660
  process.exit(1);
2647
2661
  }
2648
2662
  if (options.verbose) {
2649
- console.log(projects);
2663
+ console.log(JSON.stringify(projects, null, 2));
2650
2664
  } else {
2651
2665
  let filtered = projects.map((p) => {
2652
2666
  const { id, name, path_with_namespace, ssh_url_to_repo } = p;
2653
2667
  return { id, name, path_with_namespace, ssh_url_to_repo };
2654
2668
  });
2655
- console.log(filtered);
2669
+ console.log(JSON.stringify(filtered, null, 2));
2656
2670
  }
2657
2671
  });
2658
2672
  return program2;
2659
2673
  }
2660
2674
  var git_lab_project_list_default = create;
2661
- if (isMain("git-lab-project-list")) {
2662
- await create().parseAsync(Bun.argv);
2663
- }
2675
+ await runMain("git-lab-project-list", create);
2664
2676
  export {
2665
2677
  git_lab_project_list_default as default,
2666
2678
  create
@@ -2497,7 +2497,7 @@ async function getGitlabConfig() {
2497
2497
  const host = await hostP || "gitlab.com";
2498
2498
  const user = await gitEmailP || await gitlabEmailP;
2499
2499
  if (!user)
2500
- throw new Error("Neither user.email nor gitlab.email in git config");
2500
+ throw new Error("Neither user.email nor gitlab.user in git config");
2501
2501
  const token = await tokenP;
2502
2502
  if (!token)
2503
2503
  throw new Error("gitlab.token not in git config");
@@ -2534,6 +2534,10 @@ async function gitlabApi(endpoint) {
2534
2534
  };
2535
2535
  let request = new Request(uri, options);
2536
2536
  const response = await fetch(request);
2537
+ if (!response.ok) {
2538
+ const text = await response.text();
2539
+ throw new Error(`GitLab API ${endpoint} failed (${response.status}): ${text}`);
2540
+ }
2537
2541
  let link = getNextLink(response.headers.get("Link"));
2538
2542
  let partial = await response.json();
2539
2543
  let result = partial;
@@ -2696,6 +2700,16 @@ function isMain(self) {
2696
2700
  const result = argv1Base === selfBase;
2697
2701
  return result;
2698
2702
  }
2703
+ async function runMain(self, create) {
2704
+ if (!isMain(self))
2705
+ return;
2706
+ try {
2707
+ await create().parseAsync(Bun.argv);
2708
+ } catch (err) {
2709
+ console.error(`error: ${err instanceof Error ? err.message : String(err)}`);
2710
+ process.exit(1);
2711
+ }
2712
+ }
2699
2713
 
2700
2714
  // bin/git-lab-project-mr-list.ts
2701
2715
  var version = await getPackageVersion();
@@ -2719,21 +2733,19 @@ function create() {
2719
2733
  process.exit(0);
2720
2734
  }
2721
2735
  if (options.verbose) {
2722
- console.log(mrs);
2736
+ console.log(JSON.stringify(mrs, null, 2));
2723
2737
  } else {
2724
2738
  const filtered = mrs.map((m) => {
2725
2739
  const { iid, title, web_url, source_branch, target_branch, state, draft } = m;
2726
2740
  return { iid, title, web_url, source_branch, target_branch, state, draft };
2727
2741
  });
2728
- console.log(filtered);
2742
+ console.log(JSON.stringify(filtered, null, 2));
2729
2743
  }
2730
2744
  });
2731
2745
  return program2;
2732
2746
  }
2733
2747
  var git_lab_project_mr_list_default = create;
2734
- if (isMain("git-lab-project-mr-list")) {
2735
- await create().parseAsync(Bun.argv);
2736
- }
2748
+ await runMain("git-lab-project-mr-list", create);
2737
2749
  export {
2738
2750
  git_lab_project_mr_list_default as default,
2739
2751
  create
@@ -2497,7 +2497,7 @@ async function getGitlabConfig() {
2497
2497
  const host = await hostP || "gitlab.com";
2498
2498
  const user = await gitEmailP || await gitlabEmailP;
2499
2499
  if (!user)
2500
- throw new Error("Neither user.email nor gitlab.email in git config");
2500
+ throw new Error("Neither user.email nor gitlab.user in git config");
2501
2501
  const token = await tokenP;
2502
2502
  if (!token)
2503
2503
  throw new Error("gitlab.token not in git config");
@@ -2534,6 +2534,10 @@ async function gitlabApi(endpoint) {
2534
2534
  };
2535
2535
  let request = new Request(uri, options);
2536
2536
  const response = await fetch(request);
2537
+ if (!response.ok) {
2538
+ const text = await response.text();
2539
+ throw new Error(`GitLab API ${endpoint} failed (${response.status}): ${text}`);
2540
+ }
2537
2541
  let link = getNextLink(response.headers.get("Link"));
2538
2542
  let partial = await response.json();
2539
2543
  let result = partial;
@@ -2696,6 +2700,16 @@ function isMain(self) {
2696
2700
  const result = argv1Base === selfBase;
2697
2701
  return result;
2698
2702
  }
2703
+ async function runMain(self, create) {
2704
+ if (!isMain(self))
2705
+ return;
2706
+ try {
2707
+ await create().parseAsync(Bun.argv);
2708
+ } catch (err) {
2709
+ console.error(`error: ${err instanceof Error ? err.message : String(err)}`);
2710
+ process.exit(1);
2711
+ }
2712
+ }
2699
2713
 
2700
2714
  // bin/git-lab-project-mr-list.ts
2701
2715
  var version = await getPackageVersion();
@@ -2719,21 +2733,19 @@ function create() {
2719
2733
  process.exit(0);
2720
2734
  }
2721
2735
  if (options.verbose) {
2722
- console.log(mrs);
2736
+ console.log(JSON.stringify(mrs, null, 2));
2723
2737
  } else {
2724
2738
  const filtered = mrs.map((m) => {
2725
2739
  const { iid, title, web_url, source_branch, target_branch, state, draft } = m;
2726
2740
  return { iid, title, web_url, source_branch, target_branch, state, draft };
2727
2741
  });
2728
- console.log(filtered);
2742
+ console.log(JSON.stringify(filtered, null, 2));
2729
2743
  }
2730
2744
  });
2731
2745
  return program2;
2732
2746
  }
2733
2747
  var git_lab_project_mr_list_default = create;
2734
- if (isMain("git-lab-project-mr-list")) {
2735
- await create().parseAsync(Bun.argv);
2736
- }
2748
+ await runMain("git-lab-project-mr-list", create);
2737
2749
 
2738
2750
  // bin/git-lab-project-mr.ts
2739
2751
  var version2 = await getPackageVersion();
@@ -2743,9 +2755,7 @@ function create2() {
2743
2755
  return program2;
2744
2756
  }
2745
2757
  var git_lab_project_mr_default = create2;
2746
- if (isMain("git-lab-project-mr")) {
2747
- await create2().parseAsync(Bun.argv);
2748
- }
2758
+ await runMain("git-lab-project-mr", create2);
2749
2759
  export {
2750
2760
  git_lab_project_mr_default as default,
2751
2761
  create2 as create
@@ -2497,7 +2497,7 @@ async function getGitlabConfig() {
2497
2497
  const host = await hostP || "gitlab.com";
2498
2498
  const user = await gitEmailP || await gitlabEmailP;
2499
2499
  if (!user)
2500
- throw new Error("Neither user.email nor gitlab.email in git config");
2500
+ throw new Error("Neither user.email nor gitlab.user in git config");
2501
2501
  const token = await tokenP;
2502
2502
  if (!token)
2503
2503
  throw new Error("gitlab.token not in git config");
@@ -2534,6 +2534,10 @@ async function gitlabApi(endpoint) {
2534
2534
  };
2535
2535
  let request = new Request(uri, options);
2536
2536
  const response = await fetch(request);
2537
+ if (!response.ok) {
2538
+ const text = await response.text();
2539
+ throw new Error(`GitLab API ${endpoint} failed (${response.status}): ${text}`);
2540
+ }
2537
2541
  let link = getNextLink(response.headers.get("Link"));
2538
2542
  let partial = await response.json();
2539
2543
  let result = partial;
@@ -2696,6 +2700,16 @@ function isMain(self) {
2696
2700
  const result = argv1Base === selfBase;
2697
2701
  return result;
2698
2702
  }
2703
+ async function runMain(self, create) {
2704
+ if (!isMain(self))
2705
+ return;
2706
+ try {
2707
+ await create().parseAsync(Bun.argv);
2708
+ } catch (err) {
2709
+ console.error(`error: ${err instanceof Error ? err.message : String(err)}`);
2710
+ process.exit(1);
2711
+ }
2712
+ }
2699
2713
 
2700
2714
  // bin/git-lab-project-pipeline-jobs.ts
2701
2715
  var version = await getPackageVersion();
@@ -2725,9 +2739,7 @@ function create() {
2725
2739
  return program2;
2726
2740
  }
2727
2741
  var git_lab_project_pipeline_jobs_default = create;
2728
- if (isMain("git-lab-project-pipeline-jobs")) {
2729
- await create().parseAsync(Bun.argv);
2730
- }
2742
+ await runMain("git-lab-project-pipeline-jobs", create);
2731
2743
  export {
2732
2744
  git_lab_project_pipeline_jobs_default as default,
2733
2745
  create
@@ -2497,7 +2497,7 @@ async function getGitlabConfig() {
2497
2497
  const host = await hostP || "gitlab.com";
2498
2498
  const user = await gitEmailP || await gitlabEmailP;
2499
2499
  if (!user)
2500
- throw new Error("Neither user.email nor gitlab.email in git config");
2500
+ throw new Error("Neither user.email nor gitlab.user in git config");
2501
2501
  const token = await tokenP;
2502
2502
  if (!token)
2503
2503
  throw new Error("gitlab.token not in git config");
@@ -2534,6 +2534,10 @@ async function gitlabApi(endpoint) {
2534
2534
  };
2535
2535
  let request = new Request(uri, options);
2536
2536
  const response = await fetch(request);
2537
+ if (!response.ok) {
2538
+ const text = await response.text();
2539
+ throw new Error(`GitLab API ${endpoint} failed (${response.status}): ${text}`);
2540
+ }
2537
2541
  let link = getNextLink(response.headers.get("Link"));
2538
2542
  let partial = await response.json();
2539
2543
  let result = partial;
@@ -2696,6 +2700,16 @@ function isMain(self) {
2696
2700
  const result = argv1Base === selfBase;
2697
2701
  return result;
2698
2702
  }
2703
+ async function runMain(self, create) {
2704
+ if (!isMain(self))
2705
+ return;
2706
+ try {
2707
+ await create().parseAsync(Bun.argv);
2708
+ } catch (err) {
2709
+ console.error(`error: ${err instanceof Error ? err.message : String(err)}`);
2710
+ process.exit(1);
2711
+ }
2712
+ }
2699
2713
 
2700
2714
  // bin/git-lab-project-pipeline-latest.ts
2701
2715
  var version = await getPackageVersion();
@@ -2727,9 +2741,7 @@ function create() {
2727
2741
  return program2;
2728
2742
  }
2729
2743
  var git_lab_project_pipeline_latest_default = create;
2730
- if (isMain("git-lab-project-pipeline-latest")) {
2731
- await create().parseAsync(Bun.argv);
2732
- }
2744
+ await runMain("git-lab-project-pipeline-latest", create);
2733
2745
  export {
2734
2746
  git_lab_project_pipeline_latest_default as default,
2735
2747
  create
@@ -2497,7 +2497,7 @@ async function getGitlabConfig() {
2497
2497
  const host = await hostP || "gitlab.com";
2498
2498
  const user = await gitEmailP || await gitlabEmailP;
2499
2499
  if (!user)
2500
- throw new Error("Neither user.email nor gitlab.email in git config");
2500
+ throw new Error("Neither user.email nor gitlab.user in git config");
2501
2501
  const token = await tokenP;
2502
2502
  if (!token)
2503
2503
  throw new Error("gitlab.token not in git config");
@@ -2534,6 +2534,10 @@ async function gitlabApi(endpoint) {
2534
2534
  };
2535
2535
  let request = new Request(uri, options);
2536
2536
  const response = await fetch(request);
2537
+ if (!response.ok) {
2538
+ const text = await response.text();
2539
+ throw new Error(`GitLab API ${endpoint} failed (${response.status}): ${text}`);
2540
+ }
2537
2541
  let link = getNextLink(response.headers.get("Link"));
2538
2542
  let partial = await response.json();
2539
2543
  let result = partial;
@@ -2696,6 +2700,16 @@ function isMain(self) {
2696
2700
  const result = argv1Base === selfBase;
2697
2701
  return result;
2698
2702
  }
2703
+ async function runMain(self, create) {
2704
+ if (!isMain(self))
2705
+ return;
2706
+ try {
2707
+ await create().parseAsync(Bun.argv);
2708
+ } catch (err) {
2709
+ console.error(`error: ${err instanceof Error ? err.message : String(err)}`);
2710
+ process.exit(1);
2711
+ }
2712
+ }
2699
2713
 
2700
2714
  // bin/git-lab-project-pipeline-list.ts
2701
2715
  var import_debug2 = __toESM(require_src(), 1);
@@ -2711,21 +2725,19 @@ function create() {
2711
2725
  process.exit(1);
2712
2726
  }
2713
2727
  if (options.verbose) {
2714
- console.log(pipelines);
2728
+ console.log(JSON.stringify(pipelines, null, 2));
2715
2729
  } else {
2716
2730
  let filtered = pipelines.map((p) => {
2717
2731
  const { id, web_url, updated_at, ref, sha } = p;
2718
2732
  return { id, web_url, updated_at, ref, sha };
2719
2733
  });
2720
- console.log(filtered);
2734
+ console.log(JSON.stringify(filtered, null, 2));
2721
2735
  }
2722
2736
  });
2723
2737
  return program2;
2724
2738
  }
2725
2739
  var git_lab_project_pipeline_list_default = create;
2726
- if (isMain("git-lab-project-pipeline-list")) {
2727
- await create().parseAsync(Bun.argv);
2728
- }
2740
+ await runMain("git-lab-project-pipeline-list", create);
2729
2741
  export {
2730
2742
  git_lab_project_pipeline_list_default as default,
2731
2743
  create
@@ -2497,7 +2497,7 @@ async function getGitlabConfig() {
2497
2497
  const host = await hostP || "gitlab.com";
2498
2498
  const user = await gitEmailP || await gitlabEmailP;
2499
2499
  if (!user)
2500
- throw new Error("Neither user.email nor gitlab.email in git config");
2500
+ throw new Error("Neither user.email nor gitlab.user in git config");
2501
2501
  const token = await tokenP;
2502
2502
  if (!token)
2503
2503
  throw new Error("gitlab.token not in git config");
@@ -2534,6 +2534,10 @@ async function gitlabApi(endpoint) {
2534
2534
  };
2535
2535
  let request = new Request(uri, options);
2536
2536
  const response = await fetch(request);
2537
+ if (!response.ok) {
2538
+ const text = await response.text();
2539
+ throw new Error(`GitLab API ${endpoint} failed (${response.status}): ${text}`);
2540
+ }
2537
2541
  let link = getNextLink(response.headers.get("Link"));
2538
2542
  let partial = await response.json();
2539
2543
  let result = partial;
@@ -2696,6 +2700,16 @@ function isMain(self) {
2696
2700
  const result = argv1Base === selfBase;
2697
2701
  return result;
2698
2702
  }
2703
+ async function runMain(self, create) {
2704
+ if (!isMain(self))
2705
+ return;
2706
+ try {
2707
+ await create().parseAsync(Bun.argv);
2708
+ } catch (err) {
2709
+ console.error(`error: ${err instanceof Error ? err.message : String(err)}`);
2710
+ process.exit(1);
2711
+ }
2712
+ }
2699
2713
 
2700
2714
  // bin/git-lab-project-pipeline-log.ts
2701
2715
  var version = await getPackageVersion();
@@ -2730,9 +2744,7 @@ function create() {
2730
2744
  return program2;
2731
2745
  }
2732
2746
  var git_lab_project_pipeline_log_default = create;
2733
- if (isMain("git-lab-project-pipeline-log")) {
2734
- await create().parseAsync(Bun.argv);
2735
- }
2747
+ await runMain("git-lab-project-pipeline-log", create);
2736
2748
  export {
2737
2749
  git_lab_project_pipeline_log_default as default,
2738
2750
  create