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
  }
@@ -1914,6 +1914,10 @@ async function jiraApi(endpoint) {
1914
1914
  };
1915
1915
  const request = new Request(uri, options);
1916
1916
  const response = await fetch(request);
1917
+ if (!response.ok) {
1918
+ const text = await response.text();
1919
+ throw new Error(`Jira API ${endpoint} failed (${response.status}): ${text}`);
1920
+ }
1917
1921
  const result = await response.json();
1918
1922
  return result;
1919
1923
  }
@@ -1946,6 +1950,16 @@ function isMain(self) {
1946
1950
  const result = argv1Base === selfBase;
1947
1951
  return result;
1948
1952
  }
1953
+ async function runMain(self, create) {
1954
+ if (!isMain(self))
1955
+ return;
1956
+ try {
1957
+ await create().parseAsync(Bun.argv);
1958
+ } catch (err) {
1959
+ console.error(`error: ${err instanceof Error ? err.message : String(err)}`);
1960
+ process.exit(1);
1961
+ }
1962
+ }
1949
1963
 
1950
1964
  // bin/git-jira-issue-list.ts
1951
1965
  var version = await getPackageVersion();
@@ -1961,9 +1975,7 @@ function create() {
1961
1975
  return program2;
1962
1976
  }
1963
1977
  var git_jira_issue_list_default = create;
1964
- if (isMain("git-jira-issue-list")) {
1965
- await create().parseAsync(Bun.argv);
1966
- }
1978
+ await runMain("git-jira-issue-list", create);
1967
1979
  export {
1968
1980
  git_jira_issue_list_default as default,
1969
1981
  create
@@ -1914,6 +1914,10 @@ async function jiraApi(endpoint) {
1914
1914
  };
1915
1915
  const request = new Request(uri, options);
1916
1916
  const response = await fetch(request);
1917
+ if (!response.ok) {
1918
+ const text = await response.text();
1919
+ throw new Error(`Jira API ${endpoint} failed (${response.status}): ${text}`);
1920
+ }
1917
1921
  const result = await response.json();
1918
1922
  return result;
1919
1923
  }
@@ -1946,6 +1950,16 @@ function isMain(self) {
1946
1950
  const result = argv1Base === selfBase;
1947
1951
  return result;
1948
1952
  }
1953
+ async function runMain(self, create) {
1954
+ if (!isMain(self))
1955
+ return;
1956
+ try {
1957
+ await create().parseAsync(Bun.argv);
1958
+ } catch (err) {
1959
+ console.error(`error: ${err instanceof Error ? err.message : String(err)}`);
1960
+ process.exit(1);
1961
+ }
1962
+ }
1949
1963
 
1950
1964
  // bin/git-jira-issue-show.ts
1951
1965
  var version = await getPackageVersion();
@@ -1958,7 +1972,7 @@ function create() {
1958
1972
  process.exit(1);
1959
1973
  }
1960
1974
  if (options.verbose) {
1961
- console.log(issue);
1975
+ console.log(JSON.stringify(issue, null, 2));
1962
1976
  } else {
1963
1977
  const { host } = await getJiraConfig();
1964
1978
  const summary = issue.fields.summary;
@@ -1969,9 +1983,7 @@ function create() {
1969
1983
  return program2;
1970
1984
  }
1971
1985
  var git_jira_issue_show_default = create;
1972
- if (isMain("git-jira-issue-show")) {
1973
- await create().parseAsync(Bun.argv);
1974
- }
1986
+ await runMain("git-jira-issue-show", create);
1975
1987
  export {
1976
1988
  git_jira_issue_show_default as default,
1977
1989
  create
@@ -1914,6 +1914,10 @@ async function jiraApi(endpoint) {
1914
1914
  };
1915
1915
  const request = new Request(uri, options);
1916
1916
  const response = await fetch(request);
1917
+ if (!response.ok) {
1918
+ const text = await response.text();
1919
+ throw new Error(`Jira API ${endpoint} failed (${response.status}): ${text}`);
1920
+ }
1917
1921
  const result = await response.json();
1918
1922
  return result;
1919
1923
  }
@@ -1946,6 +1950,16 @@ function isMain(self) {
1946
1950
  const result = argv1Base === selfBase;
1947
1951
  return result;
1948
1952
  }
1953
+ async function runMain(self, create) {
1954
+ if (!isMain(self))
1955
+ return;
1956
+ try {
1957
+ await create().parseAsync(Bun.argv);
1958
+ } catch (err) {
1959
+ console.error(`error: ${err instanceof Error ? err.message : String(err)}`);
1960
+ process.exit(1);
1961
+ }
1962
+ }
1949
1963
 
1950
1964
  // bin/git-jira-issue-list.ts
1951
1965
  var version = await getPackageVersion();
@@ -1961,9 +1975,7 @@ function create() {
1961
1975
  return program2;
1962
1976
  }
1963
1977
  var git_jira_issue_list_default = create;
1964
- if (isMain("git-jira-issue-list")) {
1965
- await create().parseAsync(Bun.argv);
1966
- }
1978
+ await runMain("git-jira-issue-list", create);
1967
1979
 
1968
1980
  // bin/git-jira-issue-show.ts
1969
1981
  var version2 = await getPackageVersion();
@@ -1976,7 +1988,7 @@ function create2() {
1976
1988
  process.exit(1);
1977
1989
  }
1978
1990
  if (options.verbose) {
1979
- console.log(issue);
1991
+ console.log(JSON.stringify(issue, null, 2));
1980
1992
  } else {
1981
1993
  const { host } = await getJiraConfig();
1982
1994
  const summary = issue.fields.summary;
@@ -1987,9 +1999,7 @@ function create2() {
1987
1999
  return program2;
1988
2000
  }
1989
2001
  var git_jira_issue_show_default = create2;
1990
- if (isMain("git-jira-issue-show")) {
1991
- await create2().parseAsync(Bun.argv);
1992
- }
2002
+ await runMain("git-jira-issue-show", create2);
1993
2003
 
1994
2004
  // bin/git-jira-issue.ts
1995
2005
  var version3 = await getPackageVersion();
@@ -1999,9 +2009,7 @@ function create3() {
1999
2009
  return program2;
2000
2010
  }
2001
2011
  var git_jira_issue_default = create3;
2002
- if (isMain("git-jira-issue")) {
2003
- await create3().parseAsync(Bun.argv);
2004
- }
2012
+ await runMain("git-jira-issue", create3);
2005
2013
  export {
2006
2014
  git_jira_issue_default as default,
2007
2015
  create3 as create
@@ -1914,6 +1914,10 @@ async function jiraApi(endpoint) {
1914
1914
  };
1915
1915
  const request = new Request(uri, options);
1916
1916
  const response = await fetch(request);
1917
+ if (!response.ok) {
1918
+ const text = await response.text();
1919
+ throw new Error(`Jira API ${endpoint} failed (${response.status}): ${text}`);
1920
+ }
1917
1921
  const result = await response.json();
1918
1922
  return result;
1919
1923
  }
@@ -1946,11 +1950,21 @@ function isMain(self) {
1946
1950
  const result = argv1Base === selfBase;
1947
1951
  return result;
1948
1952
  }
1953
+ async function runMain(self, create) {
1954
+ if (!isMain(self))
1955
+ return;
1956
+ try {
1957
+ await create().parseAsync(Bun.argv);
1958
+ } catch (err) {
1959
+ console.error(`error: ${err instanceof Error ? err.message : String(err)}`);
1960
+ process.exit(1);
1961
+ }
1962
+ }
1949
1963
 
1950
1964
  // bin/git-jira-start.ts
1951
1965
  var version = await getPackageVersion();
1952
1966
  function toKebab(s) {
1953
- return s.replace(/([a-z]+)([A-Z]+)/g, "$1_2").toLowerCase().replace(/(\W+)/g, "-").replace(/-$/, "");
1967
+ return s.replace(/([a-z]+)([A-Z]+)/g, "$1_$2").toLowerCase().replace(/(\W+)/g, "-").replace(/-$/, "");
1954
1968
  }
1955
1969
  function create() {
1956
1970
  const program2 = new Command;
@@ -1967,9 +1981,7 @@ function create() {
1967
1981
  return program2;
1968
1982
  }
1969
1983
  var git_jira_start_default = create;
1970
- if (isMain("git-jira-start")) {
1971
- await create().parseAsync(Bun.argv);
1972
- }
1984
+ await runMain("git-jira-start", create);
1973
1985
  export {
1974
1986
  git_jira_start_default as default,
1975
1987
  create
@@ -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
  }
@@ -1914,6 +1914,10 @@ async function jiraApi(endpoint) {
1914
1914
  };
1915
1915
  const request = new Request(uri, options);
1916
1916
  const response = await fetch(request);
1917
+ if (!response.ok) {
1918
+ const text = await response.text();
1919
+ throw new Error(`Jira API ${endpoint} failed (${response.status}): ${text}`);
1920
+ }
1917
1921
  const result = await response.json();
1918
1922
  return result;
1919
1923
  }
@@ -1946,6 +1950,16 @@ function isMain(self) {
1946
1950
  const result = argv1Base === selfBase;
1947
1951
  return result;
1948
1952
  }
1953
+ async function runMain(self, create) {
1954
+ if (!isMain(self))
1955
+ return;
1956
+ try {
1957
+ await create().parseAsync(Bun.argv);
1958
+ } catch (err) {
1959
+ console.error(`error: ${err instanceof Error ? err.message : String(err)}`);
1960
+ process.exit(1);
1961
+ }
1962
+ }
1949
1963
 
1950
1964
  // bin/git-jira-whoami.ts
1951
1965
  var version = await getPackageVersion();
@@ -1954,7 +1968,7 @@ function create() {
1954
1968
  program2.version(version).name("whoami").description("Show the current Jira user").option("-v, --verbose", "Verbose output").action(async (options) => {
1955
1969
  const myself = await getMyself();
1956
1970
  if (options.verbose) {
1957
- console.log(myself);
1971
+ console.log(JSON.stringify(myself, null, 2));
1958
1972
  } else {
1959
1973
  const { displayName, emailAddress, accountId } = myself;
1960
1974
  console.log({ displayName, emailAddress, accountId });
@@ -1963,9 +1977,7 @@ function create() {
1963
1977
  return program2;
1964
1978
  }
1965
1979
  var git_jira_whoami_default = create;
1966
- if (isMain("git-jira-whoami")) {
1967
- await create().parseAsync(Bun.argv);
1968
- }
1980
+ await runMain("git-jira-whoami", create);
1969
1981
  export {
1970
1982
  git_jira_whoami_default as default,
1971
1983
  create
@@ -1914,6 +1914,10 @@ async function jiraApi(endpoint) {
1914
1914
  };
1915
1915
  const request = new Request(uri, options);
1916
1916
  const response = await fetch(request);
1917
+ if (!response.ok) {
1918
+ const text = await response.text();
1919
+ throw new Error(`Jira API ${endpoint} failed (${response.status}): ${text}`);
1920
+ }
1917
1921
  const result = await response.json();
1918
1922
  return result;
1919
1923
  }
@@ -1946,11 +1950,21 @@ function isMain(self) {
1946
1950
  const result = argv1Base === selfBase;
1947
1951
  return result;
1948
1952
  }
1953
+ async function runMain(self, create) {
1954
+ if (!isMain(self))
1955
+ return;
1956
+ try {
1957
+ await create().parseAsync(Bun.argv);
1958
+ } catch (err) {
1959
+ console.error(`error: ${err instanceof Error ? err.message : String(err)}`);
1960
+ process.exit(1);
1961
+ }
1962
+ }
1949
1963
 
1950
1964
  // bin/git-jira-start.ts
1951
1965
  var version = await getPackageVersion();
1952
1966
  function toKebab(s) {
1953
- return s.replace(/([a-z]+)([A-Z]+)/g, "$1_2").toLowerCase().replace(/(\W+)/g, "-").replace(/-$/, "");
1967
+ return s.replace(/([a-z]+)([A-Z]+)/g, "$1_$2").toLowerCase().replace(/(\W+)/g, "-").replace(/-$/, "");
1954
1968
  }
1955
1969
  function create() {
1956
1970
  const program2 = new Command;
@@ -1967,9 +1981,7 @@ function create() {
1967
1981
  return program2;
1968
1982
  }
1969
1983
  var git_jira_start_default = create;
1970
- if (isMain("git-jira-start")) {
1971
- await create().parseAsync(Bun.argv);
1972
- }
1984
+ await runMain("git-jira-start", create);
1973
1985
 
1974
1986
  // bin/git-jira-issue-list.ts
1975
1987
  var version2 = await getPackageVersion();
@@ -1985,9 +1997,7 @@ function create2() {
1985
1997
  return program2;
1986
1998
  }
1987
1999
  var git_jira_issue_list_default = create2;
1988
- if (isMain("git-jira-issue-list")) {
1989
- await create2().parseAsync(Bun.argv);
1990
- }
2000
+ await runMain("git-jira-issue-list", create2);
1991
2001
 
1992
2002
  // bin/git-jira-issue-show.ts
1993
2003
  var version3 = await getPackageVersion();
@@ -2000,7 +2010,7 @@ function create3() {
2000
2010
  process.exit(1);
2001
2011
  }
2002
2012
  if (options.verbose) {
2003
- console.log(issue);
2013
+ console.log(JSON.stringify(issue, null, 2));
2004
2014
  } else {
2005
2015
  const { host } = await getJiraConfig();
2006
2016
  const summary = issue.fields.summary;
@@ -2011,9 +2021,7 @@ function create3() {
2011
2021
  return program2;
2012
2022
  }
2013
2023
  var git_jira_issue_show_default = create3;
2014
- if (isMain("git-jira-issue-show")) {
2015
- await create3().parseAsync(Bun.argv);
2016
- }
2024
+ await runMain("git-jira-issue-show", create3);
2017
2025
 
2018
2026
  // bin/git-jira-issue.ts
2019
2027
  var version4 = await getPackageVersion();
@@ -2023,9 +2031,7 @@ function create4() {
2023
2031
  return program2;
2024
2032
  }
2025
2033
  var git_jira_issue_default = create4;
2026
- if (isMain("git-jira-issue")) {
2027
- await create4().parseAsync(Bun.argv);
2028
- }
2034
+ await runMain("git-jira-issue", create4);
2029
2035
 
2030
2036
  // bin/git-jira-whoami.ts
2031
2037
  var version5 = await getPackageVersion();
@@ -2034,7 +2040,7 @@ function create5() {
2034
2040
  program2.version(version5).name("whoami").description("Show the current Jira user").option("-v, --verbose", "Verbose output").action(async (options) => {
2035
2041
  const myself = await getMyself();
2036
2042
  if (options.verbose) {
2037
- console.log(myself);
2043
+ console.log(JSON.stringify(myself, null, 2));
2038
2044
  } else {
2039
2045
  const { displayName, emailAddress, accountId } = myself;
2040
2046
  console.log({ displayName, emailAddress, accountId });
@@ -2043,21 +2049,25 @@ function create5() {
2043
2049
  return program2;
2044
2050
  }
2045
2051
  var git_jira_whoami_default = create5;
2046
- if (isMain("git-jira-whoami")) {
2047
- await create5().parseAsync(Bun.argv);
2048
- }
2052
+ await runMain("git-jira-whoami", create5);
2049
2053
 
2050
2054
  // bin/git-jira.ts
2051
2055
  var version6 = await getPackageVersion();
2052
2056
  function create6() {
2053
2057
  const program2 = new Command;
2054
- program2.version(version6).name("jira").description("Commands for working with Jira").addCommand(git_jira_start_default()).addCommand(git_jira_issue_default()).addCommand(git_jira_issue_list_default()).addCommand(git_jira_whoami_default());
2058
+ program2.version(version6).name("jira").description("Commands for working with Jira").addCommand(git_jira_start_default()).addCommand(git_jira_issue_default()).addCommand(git_jira_issue_list_default()).addCommand(git_jira_whoami_default()).addHelpText("after", `
2059
+ Required git config:
2060
+ jira.host your Jira hostname (e.g. yourcompany.atlassian.net)
2061
+ jira.token your Atlassian API token
2062
+
2063
+ Optional git config:
2064
+ jira.user your Jira email (falls back to user.email)
2065
+
2066
+ Set with: git config --global jira.host <value>`);
2055
2067
  return program2;
2056
2068
  }
2057
2069
  var git_jira_default = create6;
2058
- if (isMain("git-jira")) {
2059
- await create6().parseAsync(Bun.argv);
2060
- }
2070
+ await runMain("git-jira", create6);
2061
2071
  export {
2062
2072
  git_jira_default as default,
2063
2073
  create6 as create