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.
- package/bin/git-api.ts +2 -4
- package/bin/git-bump.ts +2 -4
- package/bin/git-confluence-page-search.ts +4 -6
- package/bin/git-confluence-page-show.ts +3 -5
- package/bin/git-confluence-page-update.ts +3 -5
- package/bin/git-confluence-page.ts +2 -4
- package/bin/git-confluence-space-list.ts +3 -5
- package/bin/git-confluence-space.ts +2 -4
- package/bin/git-confluence-whoami.ts +3 -5
- package/bin/git-confluence.ts +11 -4
- package/bin/git-jira-issue-list.ts +2 -4
- package/bin/git-jira-issue-show.ts +3 -5
- package/bin/git-jira-issue.ts +2 -4
- package/bin/git-jira-start.ts +2 -4
- package/bin/git-jira-whoami.ts +3 -5
- package/bin/git-jira.ts +11 -4
- package/bin/git-lab-group-list.ts +4 -6
- package/bin/git-lab-group.ts +2 -4
- package/bin/git-lab-merge-active.ts +4 -6
- package/bin/git-lab-merge-todo.ts +4 -6
- package/bin/git-lab-merge-train-list.ts +3 -5
- package/bin/git-lab-merge-train.ts +2 -4
- package/bin/git-lab-merge.ts +2 -4
- package/bin/git-lab-namespace-list.ts +3 -5
- package/bin/git-lab-namespace.ts +2 -4
- package/bin/git-lab-project-list.ts +4 -6
- package/bin/git-lab-project-mr-list.ts +4 -6
- package/bin/git-lab-project-mr.ts +2 -4
- package/bin/git-lab-project-pipeline-jobs.ts +2 -4
- package/bin/git-lab-project-pipeline-latest.ts +2 -4
- package/bin/git-lab-project-pipeline-list.ts +4 -6
- package/bin/git-lab-project-pipeline-log.ts +2 -4
- package/bin/git-lab-project-pipeline.ts +2 -4
- package/bin/git-lab-project-whereami.ts +3 -5
- package/bin/git-lab-project.ts +2 -4
- package/bin/git-lab-whoami.ts +3 -5
- package/bin/git-lab.ts +11 -4
- package/bin/gitj-install-skills.ts +2 -4
- package/bin/gitj.ts +6 -1
- package/dist/bin/git-api.js +33 -5
- package/dist/bin/git-bump.js +32 -24
- package/dist/bin/git-confluence-page-search.js +46 -26
- package/dist/bin/git-confluence-page-show.js +24 -4
- package/dist/bin/git-confluence-page-update.js +24 -4
- package/dist/bin/git-confluence-page.js +30 -16
- package/dist/bin/git-confluence-space-list.js +45 -25
- package/dist/bin/git-confluence-space.js +46 -28
- package/dist/bin/git-confluence-whoami.js +45 -25
- package/dist/bin/git-confluence.js +45 -31
- package/dist/bin/git-jira-issue-list.js +36 -24
- package/dist/bin/git-jira-issue-show.js +16 -4
- package/dist/bin/git-jira-issue.js +18 -10
- package/dist/bin/git-jira-start.js +16 -4
- package/dist/bin/git-jira-whoami.js +37 -25
- package/dist/bin/git-jira.js +32 -22
- package/dist/bin/git-lab-group-list.js +18 -6
- package/dist/bin/git-lab-group.js +19 -9
- package/dist/bin/git-lab-merge-active.js +18 -6
- package/dist/bin/git-lab-merge-todo.js +18 -6
- package/dist/bin/git-lab-merge-train-list.js +17 -5
- package/dist/bin/git-lab-merge-train.js +18 -8
- package/dist/bin/git-lab-merge.js +25 -21
- package/dist/bin/git-lab-namespace-list.js +38 -26
- package/dist/bin/git-lab-namespace.js +39 -29
- package/dist/bin/git-lab-project-list.js +18 -6
- package/dist/bin/git-lab-project-mr-list.js +18 -6
- package/dist/bin/git-lab-project-mr.js +19 -9
- package/dist/bin/git-lab-project-pipeline-jobs.js +16 -4
- package/dist/bin/git-lab-project-pipeline-latest.js +16 -4
- package/dist/bin/git-lab-project-pipeline-list.js +18 -6
- package/dist/bin/git-lab-project-pipeline-log.js +16 -4
- package/dist/bin/git-lab-project-pipeline.js +22 -18
- package/dist/bin/git-lab-project-whereami.js +17 -5
- package/dist/bin/git-lab-project.js +32 -38
- package/dist/bin/git-lab-whoami.js +17 -5
- package/dist/bin/git-lab.js +61 -81
- package/dist/bin/gitj-install-skills.js +21 -11
- package/dist/bin/gitj.js +154 -153
- package/dist/index.js +32 -1
- package/lib/api.ts +19 -1
- package/lib/confluence/api.ts +12 -0
- package/lib/confluence/config.ts +3 -3
- package/lib/gitlab/api.ts +4 -0
- package/lib/gitlab/config.ts +2 -2
- package/lib/is_main.ts +11 -0
- package/lib/jira.ts +7 -3
- 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
|
|
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) =>
|
|
645
|
-
writeErr: (str) =>
|
|
646
|
-
getOutHelpWidth: () =>
|
|
647
|
-
getErrHelpWidth: () =>
|
|
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
|
-
|
|
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 =
|
|
995
|
-
if (
|
|
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 (
|
|
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 (
|
|
1076
|
+
if (process2.platform !== "win32") {
|
|
1077
1077
|
if (launchWithNode) {
|
|
1078
1078
|
args.unshift(executableFile);
|
|
1079
|
-
args = incrementNodeInspectorPort(
|
|
1080
|
-
proc = childProcess.spawn(
|
|
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(
|
|
1087
|
-
proc = childProcess.spawn(
|
|
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
|
-
|
|
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",
|
|
1101
|
+
proc.on("close", process2.exit.bind(process2));
|
|
1102
1102
|
} else {
|
|
1103
1103
|
proc.on("close", () => {
|
|
1104
|
-
exitCallback(new CommanderError(
|
|
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
|
-
|
|
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
|
|
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()}`,
|
|
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 =
|
|
1705
|
+
let exitCode = process2.exitCode || 0;
|
|
1706
1706
|
if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
|
|
1707
1707
|
exitCode = 1;
|
|
1708
1708
|
}
|
|
@@ -1929,6 +1929,10 @@ async function confluenceApi(endpoint) {
|
|
|
1929
1929
|
};
|
|
1930
1930
|
let request = new Request(uri, options);
|
|
1931
1931
|
const response = await fetch(request);
|
|
1932
|
+
if (!response.ok) {
|
|
1933
|
+
const text = await response.text();
|
|
1934
|
+
throw new Error(`Confluence API ${endpoint} failed (${response.status}): ${text}`);
|
|
1935
|
+
}
|
|
1932
1936
|
let link = getNextLink(response.headers.get("Link"));
|
|
1933
1937
|
const body = await response.json();
|
|
1934
1938
|
if (!body.results) {
|
|
@@ -1989,6 +1993,10 @@ async function confluenceSearch(cql) {
|
|
|
1989
1993
|
while (uri) {
|
|
1990
1994
|
const request = new Request(uri, options);
|
|
1991
1995
|
const response = await fetch(request);
|
|
1996
|
+
if (!response.ok) {
|
|
1997
|
+
const text = await response.text();
|
|
1998
|
+
throw new Error(`Confluence search failed (${response.status}): ${text}`);
|
|
1999
|
+
}
|
|
1992
2000
|
const body = await response.json();
|
|
1993
2001
|
if (body.results) {
|
|
1994
2002
|
allResults = allResults.concat(body.results);
|
|
@@ -2017,6 +2025,10 @@ async function confluenceApiV1(endpoint) {
|
|
|
2017
2025
|
};
|
|
2018
2026
|
const request = new Request(uri, options);
|
|
2019
2027
|
const response = await fetch(request);
|
|
2028
|
+
if (!response.ok) {
|
|
2029
|
+
const text = await response.text();
|
|
2030
|
+
throw new Error(`Confluence API v1 ${endpoint} failed (${response.status}): ${text}`);
|
|
2031
|
+
}
|
|
2020
2032
|
const result = await response.json();
|
|
2021
2033
|
return result;
|
|
2022
2034
|
}
|
|
@@ -2034,6 +2046,16 @@ function isMain(self) {
|
|
|
2034
2046
|
const result = argv1Base === selfBase;
|
|
2035
2047
|
return result;
|
|
2036
2048
|
}
|
|
2049
|
+
async function runMain(self, create) {
|
|
2050
|
+
if (!isMain(self))
|
|
2051
|
+
return;
|
|
2052
|
+
try {
|
|
2053
|
+
await create().parseAsync(Bun.argv);
|
|
2054
|
+
} catch (err) {
|
|
2055
|
+
console.error(`error: ${err instanceof Error ? err.message : String(err)}`);
|
|
2056
|
+
process.exit(1);
|
|
2057
|
+
}
|
|
2058
|
+
}
|
|
2037
2059
|
|
|
2038
2060
|
// bin/git-confluence-space-list.ts
|
|
2039
2061
|
var version = await getPackageVersion();
|
|
@@ -2042,7 +2064,7 @@ function create() {
|
|
|
2042
2064
|
program2.version(version).name("list").description("List Confluence spaces").option("-v, --verbose", "Verbose output").action(async (options) => {
|
|
2043
2065
|
const spaces = await confluenceApi("spaces");
|
|
2044
2066
|
if (options.verbose) {
|
|
2045
|
-
console.log(spaces);
|
|
2067
|
+
console.log(JSON.stringify(spaces, null, 2));
|
|
2046
2068
|
} else {
|
|
2047
2069
|
for (const space of spaces) {
|
|
2048
2070
|
console.log(`${space.key} ${space.name}`);
|
|
@@ -2052,9 +2074,7 @@ function create() {
|
|
|
2052
2074
|
return program2;
|
|
2053
2075
|
}
|
|
2054
2076
|
var git_confluence_space_list_default = create;
|
|
2055
|
-
|
|
2056
|
-
await create().parseAsync(Bun.argv);
|
|
2057
|
-
}
|
|
2077
|
+
await runMain("git-confluence-space-list", create);
|
|
2058
2078
|
|
|
2059
2079
|
// bin/git-confluence-space.ts
|
|
2060
2080
|
var version2 = await getPackageVersion();
|
|
@@ -2064,9 +2084,7 @@ function create2() {
|
|
|
2064
2084
|
return program2;
|
|
2065
2085
|
}
|
|
2066
2086
|
var git_confluence_space_default = create2;
|
|
2067
|
-
|
|
2068
|
-
await create2().parseAsync(Bun.argv);
|
|
2069
|
-
}
|
|
2087
|
+
await runMain("git-confluence-space", create2);
|
|
2070
2088
|
export {
|
|
2071
2089
|
git_confluence_space_default as default,
|
|
2072
2090
|
create2 as 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
|
|
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) =>
|
|
645
|
-
writeErr: (str) =>
|
|
646
|
-
getOutHelpWidth: () =>
|
|
647
|
-
getErrHelpWidth: () =>
|
|
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
|
-
|
|
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 =
|
|
995
|
-
if (
|
|
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 (
|
|
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 (
|
|
1076
|
+
if (process2.platform !== "win32") {
|
|
1077
1077
|
if (launchWithNode) {
|
|
1078
1078
|
args.unshift(executableFile);
|
|
1079
|
-
args = incrementNodeInspectorPort(
|
|
1080
|
-
proc = childProcess.spawn(
|
|
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(
|
|
1087
|
-
proc = childProcess.spawn(
|
|
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
|
-
|
|
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",
|
|
1101
|
+
proc.on("close", process2.exit.bind(process2));
|
|
1102
1102
|
} else {
|
|
1103
1103
|
proc.on("close", () => {
|
|
1104
|
-
exitCallback(new CommanderError(
|
|
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
|
-
|
|
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
|
|
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()}`,
|
|
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 =
|
|
1705
|
+
let exitCode = process2.exitCode || 0;
|
|
1706
1706
|
if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
|
|
1707
1707
|
exitCode = 1;
|
|
1708
1708
|
}
|
|
@@ -1929,6 +1929,10 @@ async function confluenceApi(endpoint) {
|
|
|
1929
1929
|
};
|
|
1930
1930
|
let request = new Request(uri, options);
|
|
1931
1931
|
const response = await fetch(request);
|
|
1932
|
+
if (!response.ok) {
|
|
1933
|
+
const text = await response.text();
|
|
1934
|
+
throw new Error(`Confluence API ${endpoint} failed (${response.status}): ${text}`);
|
|
1935
|
+
}
|
|
1932
1936
|
let link = getNextLink(response.headers.get("Link"));
|
|
1933
1937
|
const body = await response.json();
|
|
1934
1938
|
if (!body.results) {
|
|
@@ -1989,6 +1993,10 @@ async function confluenceSearch(cql) {
|
|
|
1989
1993
|
while (uri) {
|
|
1990
1994
|
const request = new Request(uri, options);
|
|
1991
1995
|
const response = await fetch(request);
|
|
1996
|
+
if (!response.ok) {
|
|
1997
|
+
const text = await response.text();
|
|
1998
|
+
throw new Error(`Confluence search failed (${response.status}): ${text}`);
|
|
1999
|
+
}
|
|
1992
2000
|
const body = await response.json();
|
|
1993
2001
|
if (body.results) {
|
|
1994
2002
|
allResults = allResults.concat(body.results);
|
|
@@ -2017,6 +2025,10 @@ async function confluenceApiV1(endpoint) {
|
|
|
2017
2025
|
};
|
|
2018
2026
|
const request = new Request(uri, options);
|
|
2019
2027
|
const response = await fetch(request);
|
|
2028
|
+
if (!response.ok) {
|
|
2029
|
+
const text = await response.text();
|
|
2030
|
+
throw new Error(`Confluence API v1 ${endpoint} failed (${response.status}): ${text}`);
|
|
2031
|
+
}
|
|
2020
2032
|
const result = await response.json();
|
|
2021
2033
|
return result;
|
|
2022
2034
|
}
|
|
@@ -2034,6 +2046,16 @@ function isMain(self) {
|
|
|
2034
2046
|
const result = argv1Base === selfBase;
|
|
2035
2047
|
return result;
|
|
2036
2048
|
}
|
|
2049
|
+
async function runMain(self, create) {
|
|
2050
|
+
if (!isMain(self))
|
|
2051
|
+
return;
|
|
2052
|
+
try {
|
|
2053
|
+
await create().parseAsync(Bun.argv);
|
|
2054
|
+
} catch (err) {
|
|
2055
|
+
console.error(`error: ${err instanceof Error ? err.message : String(err)}`);
|
|
2056
|
+
process.exit(1);
|
|
2057
|
+
}
|
|
2058
|
+
}
|
|
2037
2059
|
|
|
2038
2060
|
// bin/git-confluence-whoami.ts
|
|
2039
2061
|
var version = await getPackageVersion();
|
|
@@ -2042,7 +2064,7 @@ function create() {
|
|
|
2042
2064
|
program2.version(version).name("whoami").description("Show the current Confluence user").option("-v, --verbose", "Verbose output").action(async (options) => {
|
|
2043
2065
|
const myself = await confluenceApiV1("user/current");
|
|
2044
2066
|
if (options.verbose) {
|
|
2045
|
-
console.log(myself);
|
|
2067
|
+
console.log(JSON.stringify(myself, null, 2));
|
|
2046
2068
|
} else {
|
|
2047
2069
|
const { displayName, email, accountId } = myself;
|
|
2048
2070
|
console.log({ displayName, email, accountId });
|
|
@@ -2051,9 +2073,7 @@ function create() {
|
|
|
2051
2073
|
return program2;
|
|
2052
2074
|
}
|
|
2053
2075
|
var git_confluence_whoami_default = create;
|
|
2054
|
-
|
|
2055
|
-
await create().parseAsync(Bun.argv);
|
|
2056
|
-
}
|
|
2076
|
+
await runMain("git-confluence-whoami", create);
|
|
2057
2077
|
export {
|
|
2058
2078
|
git_confluence_whoami_default as default,
|
|
2059
2079
|
create
|
|
@@ -1929,6 +1929,10 @@ async function confluenceApi(endpoint) {
|
|
|
1929
1929
|
};
|
|
1930
1930
|
let request = new Request(uri, options);
|
|
1931
1931
|
const response = await fetch(request);
|
|
1932
|
+
if (!response.ok) {
|
|
1933
|
+
const text = await response.text();
|
|
1934
|
+
throw new Error(`Confluence API ${endpoint} failed (${response.status}): ${text}`);
|
|
1935
|
+
}
|
|
1932
1936
|
let link = getNextLink(response.headers.get("Link"));
|
|
1933
1937
|
const body = await response.json();
|
|
1934
1938
|
if (!body.results) {
|
|
@@ -1989,6 +1993,10 @@ async function confluenceSearch(cql) {
|
|
|
1989
1993
|
while (uri) {
|
|
1990
1994
|
const request = new Request(uri, options);
|
|
1991
1995
|
const response = await fetch(request);
|
|
1996
|
+
if (!response.ok) {
|
|
1997
|
+
const text = await response.text();
|
|
1998
|
+
throw new Error(`Confluence search failed (${response.status}): ${text}`);
|
|
1999
|
+
}
|
|
1992
2000
|
const body = await response.json();
|
|
1993
2001
|
if (body.results) {
|
|
1994
2002
|
allResults = allResults.concat(body.results);
|
|
@@ -2017,6 +2025,10 @@ async function confluenceApiV1(endpoint) {
|
|
|
2017
2025
|
};
|
|
2018
2026
|
const request = new Request(uri, options);
|
|
2019
2027
|
const response = await fetch(request);
|
|
2028
|
+
if (!response.ok) {
|
|
2029
|
+
const text = await response.text();
|
|
2030
|
+
throw new Error(`Confluence API v1 ${endpoint} failed (${response.status}): ${text}`);
|
|
2031
|
+
}
|
|
2020
2032
|
const result = await response.json();
|
|
2021
2033
|
return result;
|
|
2022
2034
|
}
|
|
@@ -2034,6 +2046,16 @@ function isMain(self) {
|
|
|
2034
2046
|
const result = argv1Base === selfBase;
|
|
2035
2047
|
return result;
|
|
2036
2048
|
}
|
|
2049
|
+
async function runMain(self, create) {
|
|
2050
|
+
if (!isMain(self))
|
|
2051
|
+
return;
|
|
2052
|
+
try {
|
|
2053
|
+
await create().parseAsync(Bun.argv);
|
|
2054
|
+
} catch (err) {
|
|
2055
|
+
console.error(`error: ${err instanceof Error ? err.message : String(err)}`);
|
|
2056
|
+
process.exit(1);
|
|
2057
|
+
}
|
|
2058
|
+
}
|
|
2037
2059
|
|
|
2038
2060
|
// bin/git-confluence-space-list.ts
|
|
2039
2061
|
var version = await getPackageVersion();
|
|
@@ -2042,7 +2064,7 @@ function create() {
|
|
|
2042
2064
|
program2.version(version).name("list").description("List Confluence spaces").option("-v, --verbose", "Verbose output").action(async (options) => {
|
|
2043
2065
|
const spaces = await confluenceApi("spaces");
|
|
2044
2066
|
if (options.verbose) {
|
|
2045
|
-
console.log(spaces);
|
|
2067
|
+
console.log(JSON.stringify(spaces, null, 2));
|
|
2046
2068
|
} else {
|
|
2047
2069
|
for (const space of spaces) {
|
|
2048
2070
|
console.log(`${space.key} ${space.name}`);
|
|
@@ -2052,9 +2074,7 @@ function create() {
|
|
|
2052
2074
|
return program2;
|
|
2053
2075
|
}
|
|
2054
2076
|
var git_confluence_space_list_default = create;
|
|
2055
|
-
|
|
2056
|
-
await create().parseAsync(Bun.argv);
|
|
2057
|
-
}
|
|
2077
|
+
await runMain("git-confluence-space-list", create);
|
|
2058
2078
|
|
|
2059
2079
|
// bin/git-confluence-page-search.ts
|
|
2060
2080
|
var version2 = await getPackageVersion();
|
|
@@ -2065,7 +2085,7 @@ function create2() {
|
|
|
2065
2085
|
if (options.exact) {
|
|
2066
2086
|
const pages = await confluenceApi(`pages?title=${encodeURIComponent(query)}`);
|
|
2067
2087
|
if (options.verbose) {
|
|
2068
|
-
console.log(pages);
|
|
2088
|
+
console.log(JSON.stringify(pages, null, 2));
|
|
2069
2089
|
} else {
|
|
2070
2090
|
for (const page of pages) {
|
|
2071
2091
|
const url = `https://${host}/wiki/spaces/${page.spaceId}/pages/${page.id}`;
|
|
@@ -2078,7 +2098,7 @@ function create2() {
|
|
|
2078
2098
|
const cql = `type=page AND ${field} ~ "${query}"`;
|
|
2079
2099
|
const results = await confluenceSearch(cql);
|
|
2080
2100
|
if (options.verbose) {
|
|
2081
|
-
console.log(results);
|
|
2101
|
+
console.log(JSON.stringify(results, null, 2));
|
|
2082
2102
|
} else {
|
|
2083
2103
|
for (const result of results) {
|
|
2084
2104
|
const id = result.content.id;
|
|
@@ -2091,9 +2111,7 @@ function create2() {
|
|
|
2091
2111
|
return program2;
|
|
2092
2112
|
}
|
|
2093
2113
|
var git_confluence_page_search_default = create2;
|
|
2094
|
-
|
|
2095
|
-
await create2().parseAsync(Bun.argv);
|
|
2096
|
-
}
|
|
2114
|
+
await runMain("git-confluence-page-search", create2);
|
|
2097
2115
|
|
|
2098
2116
|
// bin/git-confluence-page-show.ts
|
|
2099
2117
|
var version3 = await getPackageVersion();
|
|
@@ -2119,7 +2137,7 @@ function create3() {
|
|
|
2119
2137
|
process.exit(1);
|
|
2120
2138
|
}
|
|
2121
2139
|
} else if (options.verbose) {
|
|
2122
|
-
console.log(page);
|
|
2140
|
+
console.log(JSON.stringify(page, null, 2));
|
|
2123
2141
|
} else {
|
|
2124
2142
|
const { host } = await getConfluenceConfig();
|
|
2125
2143
|
const url = `https://${host}/wiki/spaces/${page.spaceId}/pages/${page.id}`;
|
|
@@ -2133,9 +2151,7 @@ function create3() {
|
|
|
2133
2151
|
return program2;
|
|
2134
2152
|
}
|
|
2135
2153
|
var git_confluence_page_show_default = create3;
|
|
2136
|
-
|
|
2137
|
-
await create3().parseAsync(Bun.argv);
|
|
2138
|
-
}
|
|
2154
|
+
await runMain("git-confluence-page-show", create3);
|
|
2139
2155
|
|
|
2140
2156
|
// bin/git-confluence-page-update.ts
|
|
2141
2157
|
var version4 = await getPackageVersion();
|
|
@@ -2178,7 +2194,7 @@ function create4() {
|
|
|
2178
2194
|
};
|
|
2179
2195
|
const result = await confluenceApiWrite(`pages/${id}`, "PUT", body);
|
|
2180
2196
|
if (options.verbose) {
|
|
2181
|
-
console.log(result);
|
|
2197
|
+
console.log(JSON.stringify(result, null, 2));
|
|
2182
2198
|
} else {
|
|
2183
2199
|
console.log(`Updated page ${result.id} "${result.title}" to version ${result.version.number}`);
|
|
2184
2200
|
}
|
|
@@ -2186,9 +2202,7 @@ function create4() {
|
|
|
2186
2202
|
return program2;
|
|
2187
2203
|
}
|
|
2188
2204
|
var git_confluence_page_update_default = create4;
|
|
2189
|
-
|
|
2190
|
-
await create4().parseAsync(Bun.argv);
|
|
2191
|
-
}
|
|
2205
|
+
await runMain("git-confluence-page-update", create4);
|
|
2192
2206
|
|
|
2193
2207
|
// bin/git-confluence-page.ts
|
|
2194
2208
|
var version5 = await getPackageVersion();
|
|
@@ -2198,9 +2212,7 @@ function create5() {
|
|
|
2198
2212
|
return program2;
|
|
2199
2213
|
}
|
|
2200
2214
|
var git_confluence_page_default = create5;
|
|
2201
|
-
|
|
2202
|
-
await create5().parseAsync(Bun.argv);
|
|
2203
|
-
}
|
|
2215
|
+
await runMain("git-confluence-page", create5);
|
|
2204
2216
|
|
|
2205
2217
|
// bin/git-confluence-space.ts
|
|
2206
2218
|
var version6 = await getPackageVersion();
|
|
@@ -2210,9 +2222,7 @@ function create6() {
|
|
|
2210
2222
|
return program2;
|
|
2211
2223
|
}
|
|
2212
2224
|
var git_confluence_space_default = create6;
|
|
2213
|
-
|
|
2214
|
-
await create6().parseAsync(Bun.argv);
|
|
2215
|
-
}
|
|
2225
|
+
await runMain("git-confluence-space", create6);
|
|
2216
2226
|
|
|
2217
2227
|
// bin/git-confluence-whoami.ts
|
|
2218
2228
|
var version7 = await getPackageVersion();
|
|
@@ -2221,7 +2231,7 @@ function create7() {
|
|
|
2221
2231
|
program2.version(version7).name("whoami").description("Show the current Confluence user").option("-v, --verbose", "Verbose output").action(async (options) => {
|
|
2222
2232
|
const myself = await confluenceApiV1("user/current");
|
|
2223
2233
|
if (options.verbose) {
|
|
2224
|
-
console.log(myself);
|
|
2234
|
+
console.log(JSON.stringify(myself, null, 2));
|
|
2225
2235
|
} else {
|
|
2226
2236
|
const { displayName, email, accountId } = myself;
|
|
2227
2237
|
console.log({ displayName, email, accountId });
|
|
@@ -2230,21 +2240,25 @@ function create7() {
|
|
|
2230
2240
|
return program2;
|
|
2231
2241
|
}
|
|
2232
2242
|
var git_confluence_whoami_default = create7;
|
|
2233
|
-
|
|
2234
|
-
await create7().parseAsync(Bun.argv);
|
|
2235
|
-
}
|
|
2243
|
+
await runMain("git-confluence-whoami", create7);
|
|
2236
2244
|
|
|
2237
2245
|
// bin/git-confluence.ts
|
|
2238
2246
|
var version8 = await getPackageVersion();
|
|
2239
2247
|
function create8() {
|
|
2240
2248
|
const program2 = new Command;
|
|
2241
|
-
program2.version(version8).name("confluence").description("Commands for working with Confluence").addCommand(git_confluence_whoami_default()).addCommand(git_confluence_space_default()).addCommand(git_confluence_page_default())
|
|
2249
|
+
program2.version(version8).name("confluence").description("Commands for working with Confluence").addCommand(git_confluence_whoami_default()).addCommand(git_confluence_space_default()).addCommand(git_confluence_page_default()).addHelpText("after", `
|
|
2250
|
+
Required git config:
|
|
2251
|
+
confluence.host your Confluence hostname (or jira.host as fallback)
|
|
2252
|
+
confluence.token your Atlassian API token (or jira.token as fallback)
|
|
2253
|
+
|
|
2254
|
+
Optional git config:
|
|
2255
|
+
confluence.user your Confluence email (falls back to jira.user, then user.email)
|
|
2256
|
+
|
|
2257
|
+
Set with: git config --global confluence.host <value>`);
|
|
2242
2258
|
return program2;
|
|
2243
2259
|
}
|
|
2244
2260
|
var git_confluence_default = create8;
|
|
2245
|
-
|
|
2246
|
-
await create8().parseAsync(Bun.argv);
|
|
2247
|
-
}
|
|
2261
|
+
await runMain("git-confluence", create8);
|
|
2248
2262
|
export {
|
|
2249
2263
|
git_confluence_default as default,
|
|
2250
2264
|
create8 as create
|