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
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
import { Command } from 'commander'
|
|
4
4
|
import { getPackageVersion } from '../lib/package'
|
|
5
5
|
import { findPackageJson } from '../lib/package'
|
|
6
|
-
import {
|
|
6
|
+
import { runMain } from '../lib/is_main'
|
|
7
7
|
import fs from 'node:fs'
|
|
8
8
|
import path from 'node:path'
|
|
9
|
-
import os from 'node:os'
|
|
10
9
|
|
|
11
10
|
const version = await getPackageVersion()
|
|
12
11
|
|
|
@@ -29,14 +28,14 @@ function getSkillsSourceDir(): string {
|
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
function getTargetDir(framework: Framework): string {
|
|
32
|
-
const
|
|
31
|
+
const cwd = process.cwd()
|
|
33
32
|
switch (framework) {
|
|
34
33
|
case 'opencode':
|
|
35
|
-
return path.join(
|
|
34
|
+
return path.join(cwd, '.opencode', 'skills')
|
|
36
35
|
case 'copilot':
|
|
37
|
-
return path.join(
|
|
36
|
+
return path.join(cwd, '.github', 'skills')
|
|
38
37
|
case 'claude':
|
|
39
|
-
return path.join(
|
|
38
|
+
return path.join(cwd, '.claude', 'skills')
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
41
|
|
|
@@ -101,7 +100,7 @@ export function create(): Command {
|
|
|
101
100
|
.name('install-skills')
|
|
102
101
|
.description('Install AI agent skills for a coding framework')
|
|
103
102
|
.argument('<framework>', `framework to install for (${frameworks.join(', ')})`)
|
|
104
|
-
.option('--copy', 'copy files instead of creating symlinks')
|
|
103
|
+
.option('--copy', 'copy files instead of creating symlinks (automatic in Docker)')
|
|
105
104
|
.option('--force', 'overwrite existing skill directories')
|
|
106
105
|
.action(async (framework: string, options: { copy?: boolean; force?: boolean }) => {
|
|
107
106
|
if (!frameworks.includes(framework as Framework)) {
|
|
@@ -110,10 +109,16 @@ export function create(): Command {
|
|
|
110
109
|
process.exit(1)
|
|
111
110
|
}
|
|
112
111
|
|
|
112
|
+
// When running in Docker, source files live inside the container
|
|
113
|
+
// so symlinks would be broken on the host. Force copy mode.
|
|
114
|
+
const sourceDir = getSkillsSourceDir()
|
|
115
|
+
const inDocker = sourceDir.startsWith('/app/')
|
|
116
|
+
const copy = !!(options.copy || inDocker)
|
|
117
|
+
|
|
113
118
|
if (options.force) {
|
|
114
|
-
forceInstallSkills(framework as Framework,
|
|
119
|
+
forceInstallSkills(framework as Framework, copy)
|
|
115
120
|
} else {
|
|
116
|
-
installSkills(framework as Framework,
|
|
121
|
+
installSkills(framework as Framework, copy)
|
|
117
122
|
}
|
|
118
123
|
})
|
|
119
124
|
return program
|
|
@@ -121,6 +126,4 @@ export function create(): Command {
|
|
|
121
126
|
|
|
122
127
|
export default create
|
|
123
128
|
|
|
124
|
-
|
|
125
|
-
await create().parseAsync(Bun.argv)
|
|
126
|
-
}
|
|
129
|
+
await runMain('gitj-install-skills', create)
|
package/bin/gitj.ts
CHANGED
|
@@ -38,4 +38,9 @@ export function create(): Command {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
const command = create()
|
|
41
|
-
|
|
41
|
+
try {
|
|
42
|
+
await command.parseAsync(Bun.argv)
|
|
43
|
+
} catch (err) {
|
|
44
|
+
console.error(`error: ${err instanceof Error ? err.message : String(err)}`)
|
|
45
|
+
process.exit(1)
|
|
46
|
+
}
|
package/dist/bin/git-api.js
CHANGED
|
@@ -1853,6 +1853,16 @@ function isMain(self) {
|
|
|
1853
1853
|
const result = argv1Base === selfBase;
|
|
1854
1854
|
return result;
|
|
1855
1855
|
}
|
|
1856
|
+
async function runMain(self, create) {
|
|
1857
|
+
if (!isMain(self))
|
|
1858
|
+
return;
|
|
1859
|
+
try {
|
|
1860
|
+
await create().parseAsync(Bun.argv);
|
|
1861
|
+
} catch (err) {
|
|
1862
|
+
console.error(`error: ${err instanceof Error ? err.message : String(err)}`);
|
|
1863
|
+
process.exit(1);
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1856
1866
|
|
|
1857
1867
|
// lib/spawn.ts
|
|
1858
1868
|
var defaultOptions = {
|
|
@@ -1902,7 +1912,7 @@ async function getGitlabConfig() {
|
|
|
1902
1912
|
const host = await hostP || "gitlab.com";
|
|
1903
1913
|
const user = await gitEmailP || await gitlabEmailP;
|
|
1904
1914
|
if (!user)
|
|
1905
|
-
throw new Error("Neither user.email nor gitlab.
|
|
1915
|
+
throw new Error("Neither user.email nor gitlab.user in git config");
|
|
1906
1916
|
const token = await tokenP;
|
|
1907
1917
|
if (!token)
|
|
1908
1918
|
throw new Error("gitlab.token not in git config");
|
|
@@ -1945,6 +1955,10 @@ async function jiraApi(endpoint) {
|
|
|
1945
1955
|
};
|
|
1946
1956
|
const request = new Request(uri, options);
|
|
1947
1957
|
const response = await fetch(request);
|
|
1958
|
+
if (!response.ok) {
|
|
1959
|
+
const text = await response.text();
|
|
1960
|
+
throw new Error(`Jira API ${endpoint} failed (${response.status}): ${text}`);
|
|
1961
|
+
}
|
|
1948
1962
|
const result = await response.json();
|
|
1949
1963
|
return result;
|
|
1950
1964
|
}
|
|
@@ -2035,6 +2049,16 @@ async function apiRequest(serviceName, method, endpoint, options) {
|
|
|
2035
2049
|
}
|
|
2036
2050
|
const request = new Request(url, fetchOptions);
|
|
2037
2051
|
const response = await fetch(request);
|
|
2052
|
+
if (!response.ok) {
|
|
2053
|
+
const text = await response.text();
|
|
2054
|
+
let body2;
|
|
2055
|
+
try {
|
|
2056
|
+
body2 = JSON.parse(text);
|
|
2057
|
+
} catch {
|
|
2058
|
+
throw new Error(`${serviceName} API ${method} ${endpoint} failed (${response.status}): ${text}`);
|
|
2059
|
+
}
|
|
2060
|
+
return { status: response.status, headers: response.headers, body: body2 };
|
|
2061
|
+
}
|
|
2038
2062
|
const body = await response.json();
|
|
2039
2063
|
return {
|
|
2040
2064
|
status: response.status,
|
|
@@ -2078,7 +2102,13 @@ async function apiPaginate(serviceName, endpoint, options) {
|
|
|
2078
2102
|
lastStatus = response.status;
|
|
2079
2103
|
lastHeaders = response.headers;
|
|
2080
2104
|
if (!response.ok) {
|
|
2081
|
-
const
|
|
2105
|
+
const text = await response.text();
|
|
2106
|
+
let body2;
|
|
2107
|
+
try {
|
|
2108
|
+
body2 = JSON.parse(text);
|
|
2109
|
+
} catch {
|
|
2110
|
+
throw new Error(`${serviceName} API paginate ${endpoint} failed (${response.status}): ${text}`);
|
|
2111
|
+
}
|
|
2082
2112
|
return { status: response.status, headers: response.headers, body: body2 };
|
|
2083
2113
|
}
|
|
2084
2114
|
const body = await response.json();
|
|
@@ -2147,9 +2177,7 @@ function create() {
|
|
|
2147
2177
|
return program2;
|
|
2148
2178
|
}
|
|
2149
2179
|
var git_api_default = create;
|
|
2150
|
-
|
|
2151
|
-
await create().parseAsync(Bun.argv);
|
|
2152
|
-
}
|
|
2180
|
+
await runMain("git-api", create);
|
|
2153
2181
|
export {
|
|
2154
2182
|
git_api_default as default,
|
|
2155
2183
|
create
|
package/dist/bin/git-bump.js
CHANGED
|
@@ -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
|
}
|
|
@@ -1892,6 +1892,16 @@ function isMain(self) {
|
|
|
1892
1892
|
const result = argv1Base === selfBase;
|
|
1893
1893
|
return result;
|
|
1894
1894
|
}
|
|
1895
|
+
async function runMain(self, create) {
|
|
1896
|
+
if (!isMain(self))
|
|
1897
|
+
return;
|
|
1898
|
+
try {
|
|
1899
|
+
await create().parseAsync(Bun.argv);
|
|
1900
|
+
} catch (err) {
|
|
1901
|
+
console.error(`error: ${err instanceof Error ? err.message : String(err)}`);
|
|
1902
|
+
process.exit(1);
|
|
1903
|
+
}
|
|
1904
|
+
}
|
|
1895
1905
|
|
|
1896
1906
|
// bin/git-bump.ts
|
|
1897
1907
|
var version = await getPackageVersion();
|
|
@@ -1912,9 +1922,7 @@ function create() {
|
|
|
1912
1922
|
return program2;
|
|
1913
1923
|
}
|
|
1914
1924
|
var git_bump_default = create;
|
|
1915
|
-
|
|
1916
|
-
await create().parseAsync(Bun.argv);
|
|
1917
|
-
}
|
|
1925
|
+
await runMain("git-bump", create);
|
|
1918
1926
|
export {
|
|
1919
1927
|
git_bump_default as default,
|
|
1920
1928
|
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-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
|
export {
|
|
2077
2097
|
git_confluence_page_search_default as default,
|
|
2078
2098
|
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-page-show.ts
|
|
2039
2061
|
var version = await getPackageVersion();
|
|
@@ -2059,7 +2081,7 @@ function create() {
|
|
|
2059
2081
|
process.exit(1);
|
|
2060
2082
|
}
|
|
2061
2083
|
} else if (options.verbose) {
|
|
2062
|
-
console.log(page);
|
|
2084
|
+
console.log(JSON.stringify(page, null, 2));
|
|
2063
2085
|
} else {
|
|
2064
2086
|
const { host } = await getConfluenceConfig();
|
|
2065
2087
|
const url = `https://${host}/wiki/spaces/${page.spaceId}/pages/${page.id}`;
|
|
@@ -2073,9 +2095,7 @@ function create() {
|
|
|
2073
2095
|
return program2;
|
|
2074
2096
|
}
|
|
2075
2097
|
var git_confluence_page_show_default = create;
|
|
2076
|
-
|
|
2077
|
-
await create().parseAsync(Bun.argv);
|
|
2078
|
-
}
|
|
2098
|
+
await runMain("git-confluence-page-show", create);
|
|
2079
2099
|
export {
|
|
2080
2100
|
git_confluence_page_show_default as default,
|
|
2081
2101
|
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-page-update.ts
|
|
2039
2061
|
var version = await getPackageVersion();
|
|
@@ -2076,7 +2098,7 @@ function create() {
|
|
|
2076
2098
|
};
|
|
2077
2099
|
const result = await confluenceApiWrite(`pages/${id}`, "PUT", body);
|
|
2078
2100
|
if (options.verbose) {
|
|
2079
|
-
console.log(result);
|
|
2101
|
+
console.log(JSON.stringify(result, null, 2));
|
|
2080
2102
|
} else {
|
|
2081
2103
|
console.log(`Updated page ${result.id} "${result.title}" to version ${result.version.number}`);
|
|
2082
2104
|
}
|
|
@@ -2084,9 +2106,7 @@ function create() {
|
|
|
2084
2106
|
return program2;
|
|
2085
2107
|
}
|
|
2086
2108
|
var git_confluence_page_update_default = create;
|
|
2087
|
-
|
|
2088
|
-
await create().parseAsync(Bun.argv);
|
|
2089
|
-
}
|
|
2109
|
+
await runMain("git-confluence-page-update", create);
|
|
2090
2110
|
export {
|
|
2091
2111
|
git_confluence_page_update_default as default,
|
|
2092
2112
|
create
|