ya-git-jira 2.0.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/.dockerignore +8 -0
- package/.opencode/skills/git-confluence/SKILL.md +18 -18
- package/.opencode/skills/git-jira/SKILL.md +18 -18
- package/.opencode/skills/git-lab/SKILL.md +30 -30
- package/Dockerfile +58 -0
- package/README.md +31 -12
- 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 +15 -12
- 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/install-docker-gitj.sh +77 -0
- 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
|
@@ -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-page-search.ts
|
|
2039
2061
|
var version = await getPackageVersion();
|
|
@@ -2044,7 +2066,7 @@ function create() {
|
|
|
2044
2066
|
if (options.exact) {
|
|
2045
2067
|
const pages = await confluenceApi(`pages?title=${encodeURIComponent(query)}`);
|
|
2046
2068
|
if (options.verbose) {
|
|
2047
|
-
console.log(pages);
|
|
2069
|
+
console.log(JSON.stringify(pages, null, 2));
|
|
2048
2070
|
} else {
|
|
2049
2071
|
for (const page of pages) {
|
|
2050
2072
|
const url = `https://${host}/wiki/spaces/${page.spaceId}/pages/${page.id}`;
|
|
@@ -2057,7 +2079,7 @@ function create() {
|
|
|
2057
2079
|
const cql = `type=page AND ${field} ~ "${query}"`;
|
|
2058
2080
|
const results = await confluenceSearch(cql);
|
|
2059
2081
|
if (options.verbose) {
|
|
2060
|
-
console.log(results);
|
|
2082
|
+
console.log(JSON.stringify(results, null, 2));
|
|
2061
2083
|
} else {
|
|
2062
2084
|
for (const result of results) {
|
|
2063
2085
|
const id = result.content.id;
|
|
@@ -2070,9 +2092,7 @@ function create() {
|
|
|
2070
2092
|
return program2;
|
|
2071
2093
|
}
|
|
2072
2094
|
var git_confluence_page_search_default = create;
|
|
2073
|
-
|
|
2074
|
-
await create().parseAsync(Bun.argv);
|
|
2075
|
-
}
|
|
2095
|
+
await runMain("git-confluence-page-search", create);
|
|
2076
2096
|
|
|
2077
2097
|
// bin/git-confluence-page-show.ts
|
|
2078
2098
|
var version2 = await getPackageVersion();
|
|
@@ -2098,7 +2118,7 @@ function create2() {
|
|
|
2098
2118
|
process.exit(1);
|
|
2099
2119
|
}
|
|
2100
2120
|
} else if (options.verbose) {
|
|
2101
|
-
console.log(page);
|
|
2121
|
+
console.log(JSON.stringify(page, null, 2));
|
|
2102
2122
|
} else {
|
|
2103
2123
|
const { host } = await getConfluenceConfig();
|
|
2104
2124
|
const url = `https://${host}/wiki/spaces/${page.spaceId}/pages/${page.id}`;
|
|
@@ -2112,9 +2132,7 @@ function create2() {
|
|
|
2112
2132
|
return program2;
|
|
2113
2133
|
}
|
|
2114
2134
|
var git_confluence_page_show_default = create2;
|
|
2115
|
-
|
|
2116
|
-
await create2().parseAsync(Bun.argv);
|
|
2117
|
-
}
|
|
2135
|
+
await runMain("git-confluence-page-show", create2);
|
|
2118
2136
|
|
|
2119
2137
|
// bin/git-confluence-page-update.ts
|
|
2120
2138
|
var version3 = await getPackageVersion();
|
|
@@ -2157,7 +2175,7 @@ function create3() {
|
|
|
2157
2175
|
};
|
|
2158
2176
|
const result = await confluenceApiWrite(`pages/${id}`, "PUT", body);
|
|
2159
2177
|
if (options.verbose) {
|
|
2160
|
-
console.log(result);
|
|
2178
|
+
console.log(JSON.stringify(result, null, 2));
|
|
2161
2179
|
} else {
|
|
2162
2180
|
console.log(`Updated page ${result.id} "${result.title}" to version ${result.version.number}`);
|
|
2163
2181
|
}
|
|
@@ -2165,9 +2183,7 @@ function create3() {
|
|
|
2165
2183
|
return program2;
|
|
2166
2184
|
}
|
|
2167
2185
|
var git_confluence_page_update_default = create3;
|
|
2168
|
-
|
|
2169
|
-
await create3().parseAsync(Bun.argv);
|
|
2170
|
-
}
|
|
2186
|
+
await runMain("git-confluence-page-update", create3);
|
|
2171
2187
|
|
|
2172
2188
|
// bin/git-confluence-page.ts
|
|
2173
2189
|
var version4 = await getPackageVersion();
|
|
@@ -2177,9 +2193,7 @@ function create4() {
|
|
|
2177
2193
|
return program2;
|
|
2178
2194
|
}
|
|
2179
2195
|
var git_confluence_page_default = create4;
|
|
2180
|
-
|
|
2181
|
-
await create4().parseAsync(Bun.argv);
|
|
2182
|
-
}
|
|
2196
|
+
await runMain("git-confluence-page", create4);
|
|
2183
2197
|
export {
|
|
2184
2198
|
git_confluence_page_default as default,
|
|
2185
2199
|
create4 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-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
|
export {
|
|
2059
2079
|
git_confluence_space_list_default as default,
|
|
2060
2080
|
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-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
|