ya-git-jira 1.3.0 → 1.5.0
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-bump.ts +7 -4
- package/bin/{git-jira-issues.ts → git-jira-issue-list.ts} +10 -7
- package/bin/git-jira-issue-show.ts +40 -0
- package/bin/git-jira-issue.ts +14 -25
- package/bin/git-jira-start.ts +8 -5
- package/bin/git-jira.ts +9 -6
- package/bin/git-lab-group-list.ts +35 -0
- package/bin/git-lab-group.ts +25 -0
- package/bin/git-lab-merge-active.ts +41 -0
- package/bin/git-lab-merge-todo.ts +36 -0
- package/bin/git-lab-merge-train-list.ts +26 -0
- package/bin/git-lab-merge-train.ts +25 -0
- package/bin/git-lab-merge.ts +29 -0
- package/bin/git-lab-namespace-list.ts +27 -0
- package/bin/git-lab-namespace.ts +24 -0
- package/bin/{git-lab-projects.ts → git-lab-project-list.ts} +13 -10
- package/bin/git-lab-project-pipeline-list.ts +46 -0
- package/bin/git-lab-project-pipeline.ts +24 -0
- package/bin/git-lab-project-whereami.ts +43 -0
- package/bin/git-lab-project.ts +28 -0
- package/bin/git-lab-whoami.ts +8 -5
- package/bin/git-lab.ts +18 -8
- package/bin/gitj.ts +7 -5
- package/build.ts +1 -1
- package/bun.lockb +0 -0
- package/dist/bin/git-bump.js +55 -17
- package/dist/bin/{git-jira-issues.js → git-jira-issue-list.js} +71 -28
- package/dist/bin/{git-lab-mergetrain.js → git-jira-issue-show.js} +100 -43
- package/dist/bin/git-jira-issue.js +106 -33
- package/dist/bin/git-jira-start.js +70 -27
- package/dist/bin/git-jira.js +117 -59
- package/dist/bin/git-lab-group-list.js +2793 -0
- package/dist/bin/git-lab-group.js +2805 -0
- package/dist/bin/git-lab-groups.js +1992 -0
- package/dist/bin/git-lab-merge-active.js +2798 -0
- package/dist/bin/git-lab-merge-todo.js +2793 -0
- package/dist/bin/git-lab-merge-train-list.js +2754 -0
- package/dist/bin/git-lab-merge-train.js +2766 -0
- package/dist/bin/git-lab-merge.js +2865 -0
- package/dist/bin/git-lab-namespace-list.js +1967 -0
- package/dist/bin/git-lab-namespace.js +1979 -0
- package/dist/bin/git-lab-namespaces.js +1984 -0
- package/dist/bin/git-lab-project-list.js +2761 -0
- package/dist/bin/git-lab-project-pipeline-list.js +2800 -0
- package/dist/bin/git-lab-project-pipeline.js +2812 -0
- package/dist/bin/git-lab-project-whereami.js +2764 -0
- package/dist/bin/git-lab-project.js +2805 -0
- package/dist/bin/git-lab-projects-list.js +1996 -0
- package/dist/bin/git-lab-projects-whereami.js +1999 -0
- package/dist/bin/git-lab-projects.js +138 -35
- package/dist/bin/git-lab-whoami.js +100 -56
- package/dist/bin/git-lab.js +1123 -58
- package/dist/bin/gitj.js +1260 -172
- package/dist/index.js +881 -35
- package/index.ts +1 -1
- package/lib/gitlab/api.ts +46 -0
- package/lib/gitlab/config.ts +21 -0
- package/lib/gitlab/dlog.ts +2 -0
- package/lib/gitlab/group.ts +12 -0
- package/lib/gitlab/index.ts +8 -0
- package/lib/gitlab/merge-request.ts +31 -0
- package/lib/gitlab/merge-trains.ts +19 -0
- package/lib/gitlab/namespace.ts +12 -0
- package/lib/gitlab/pipeline.ts +32 -0
- package/lib/gitlab/project.ts +78 -0
- package/lib/gitlab/user.ts +13 -0
- package/lib/is_main.ts +21 -2
- package/lib/jira.ts +12 -7
- package/lib/package.ts +35 -0
- package/package.json +21 -4
- package/tests/all-help.test.ts +46 -0
- package/tests/git.test.ts +8 -7
- package/tests/gitj.test.ts +1 -1
- package/lib/gitlab.ts +0 -86
package/dist/index.js
CHANGED
|
@@ -19,7 +19,728 @@ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports,
|
|
|
19
19
|
var __require = (id) => {
|
|
20
20
|
return import.meta.require(id);
|
|
21
21
|
};
|
|
22
|
-
|
|
22
|
+
|
|
23
|
+
// bine_modules/commander/l
|
|
24
|
+
var require_ms = __commonJS((exports, module) => {
|
|
25
|
+
var parse = function(str) {
|
|
26
|
+
str = String(str);
|
|
27
|
+
if (str.length > 100) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str);
|
|
31
|
+
if (!match) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
var n = parseFloat(match[1]);
|
|
35
|
+
var type = (match[2] || "ms").toLowerCase();
|
|
36
|
+
switch (type) {
|
|
37
|
+
case "years":
|
|
38
|
+
case "year":
|
|
39
|
+
case "yrs":
|
|
40
|
+
case "yr":
|
|
41
|
+
case "y":
|
|
42
|
+
return n * y;
|
|
43
|
+
case "weeks":
|
|
44
|
+
case "week":
|
|
45
|
+
case "w":
|
|
46
|
+
return n * w;
|
|
47
|
+
case "days":
|
|
48
|
+
case "day":
|
|
49
|
+
case "d":
|
|
50
|
+
return n * d;
|
|
51
|
+
case "hours":
|
|
52
|
+
case "hour":
|
|
53
|
+
case "hrs":
|
|
54
|
+
case "hr":
|
|
55
|
+
case "h":
|
|
56
|
+
return n * h;
|
|
57
|
+
case "minutes":
|
|
58
|
+
case "minute":
|
|
59
|
+
case "mins":
|
|
60
|
+
case "min":
|
|
61
|
+
case "m":
|
|
62
|
+
return n * m;
|
|
63
|
+
case "seconds":
|
|
64
|
+
case "second":
|
|
65
|
+
case "secs":
|
|
66
|
+
case "sec":
|
|
67
|
+
case "s":
|
|
68
|
+
return n * s;
|
|
69
|
+
case "milliseconds":
|
|
70
|
+
case "millisecond":
|
|
71
|
+
case "msecs":
|
|
72
|
+
case "msec":
|
|
73
|
+
case "ms":
|
|
74
|
+
return n;
|
|
75
|
+
default:
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
var fmtShort = function(ms) {
|
|
80
|
+
var msAbs = Math.abs(ms);
|
|
81
|
+
if (msAbs >= d) {
|
|
82
|
+
return Math.round(ms / d) + "d";
|
|
83
|
+
}
|
|
84
|
+
if (msAbs >= h) {
|
|
85
|
+
return Math.round(ms / h) + "h";
|
|
86
|
+
}
|
|
87
|
+
if (msAbs >= m) {
|
|
88
|
+
return Math.round(ms / m) + "m";
|
|
89
|
+
}
|
|
90
|
+
if (msAbs >= s) {
|
|
91
|
+
return Math.round(ms / s) + "s";
|
|
92
|
+
}
|
|
93
|
+
return ms + "ms";
|
|
94
|
+
};
|
|
95
|
+
var fmtLong = function(ms) {
|
|
96
|
+
var msAbs = Math.abs(ms);
|
|
97
|
+
if (msAbs >= d) {
|
|
98
|
+
return plural(ms, msAbs, d, "day");
|
|
99
|
+
}
|
|
100
|
+
if (msAbs >= h) {
|
|
101
|
+
return plural(ms, msAbs, h, "hour");
|
|
102
|
+
}
|
|
103
|
+
if (msAbs >= m) {
|
|
104
|
+
return plural(ms, msAbs, m, "minute");
|
|
105
|
+
}
|
|
106
|
+
if (msAbs >= s) {
|
|
107
|
+
return plural(ms, msAbs, s, "second");
|
|
108
|
+
}
|
|
109
|
+
return ms + " ms";
|
|
110
|
+
};
|
|
111
|
+
var plural = function(ms, msAbs, n, name) {
|
|
112
|
+
var isPlural = msAbs >= n * 1.5;
|
|
113
|
+
return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
|
|
114
|
+
};
|
|
115
|
+
var s = 1000;
|
|
116
|
+
var m = s * 60;
|
|
117
|
+
var h = m * 60;
|
|
118
|
+
var d = h * 24;
|
|
119
|
+
var w = d * 7;
|
|
120
|
+
var y = d * 365.25;
|
|
121
|
+
module.exports = function(val, options) {
|
|
122
|
+
options = options || {};
|
|
123
|
+
var type = typeof val;
|
|
124
|
+
if (type === "string" && val.length > 0) {
|
|
125
|
+
return parse(val);
|
|
126
|
+
} else if (type === "number" && isFinite(val)) {
|
|
127
|
+
return options.long ? fmtLong(val) : fmtShort(val);
|
|
128
|
+
}
|
|
129
|
+
throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val));
|
|
130
|
+
};
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// bine_modules/commander/lib/sugge
|
|
134
|
+
var require_common = __commonJS((exports, module) => {
|
|
135
|
+
var setup = function(env) {
|
|
136
|
+
createDebug.debug = createDebug;
|
|
137
|
+
createDebug.default = createDebug;
|
|
138
|
+
createDebug.coerce = coerce;
|
|
139
|
+
createDebug.disable = disable;
|
|
140
|
+
createDebug.enable = enable;
|
|
141
|
+
createDebug.enabled = enabled;
|
|
142
|
+
createDebug.humanize = require_ms();
|
|
143
|
+
createDebug.destroy = destroy;
|
|
144
|
+
Object.keys(env).forEach((key) => {
|
|
145
|
+
createDebug[key] = env[key];
|
|
146
|
+
});
|
|
147
|
+
createDebug.names = [];
|
|
148
|
+
createDebug.skips = [];
|
|
149
|
+
createDebug.formatters = {};
|
|
150
|
+
function selectColor(namespace) {
|
|
151
|
+
let hash = 0;
|
|
152
|
+
for (let i = 0;i < namespace.length; i++) {
|
|
153
|
+
hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
|
154
|
+
hash |= 0;
|
|
155
|
+
}
|
|
156
|
+
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
157
|
+
}
|
|
158
|
+
createDebug.selectColor = selectColor;
|
|
159
|
+
function createDebug(namespace) {
|
|
160
|
+
let prevTime;
|
|
161
|
+
let enableOverride = null;
|
|
162
|
+
let namespacesCache;
|
|
163
|
+
let enabledCache;
|
|
164
|
+
function debug(...args) {
|
|
165
|
+
if (!debug.enabled) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
const self = debug;
|
|
169
|
+
const curr = Number(new Date);
|
|
170
|
+
const ms = curr - (prevTime || curr);
|
|
171
|
+
self.diff = ms;
|
|
172
|
+
self.prev = prevTime;
|
|
173
|
+
self.curr = curr;
|
|
174
|
+
prevTime = curr;
|
|
175
|
+
args[0] = createDebug.coerce(args[0]);
|
|
176
|
+
if (typeof args[0] !== "string") {
|
|
177
|
+
args.unshift("%O");
|
|
178
|
+
}
|
|
179
|
+
let index = 0;
|
|
180
|
+
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
|
181
|
+
if (match === "%%") {
|
|
182
|
+
return "%";
|
|
183
|
+
}
|
|
184
|
+
index++;
|
|
185
|
+
const formatter = createDebug.formatters[format];
|
|
186
|
+
if (typeof formatter === "function") {
|
|
187
|
+
const val = args[index];
|
|
188
|
+
match = formatter.call(self, val);
|
|
189
|
+
args.splice(index, 1);
|
|
190
|
+
index--;
|
|
191
|
+
}
|
|
192
|
+
return match;
|
|
193
|
+
});
|
|
194
|
+
createDebug.formatArgs.call(self, args);
|
|
195
|
+
const logFn = self.log || createDebug.log;
|
|
196
|
+
logFn.apply(self, args);
|
|
197
|
+
}
|
|
198
|
+
debug.namespace = namespace;
|
|
199
|
+
debug.useColors = createDebug.useColors();
|
|
200
|
+
debug.color = createDebug.selectColor(namespace);
|
|
201
|
+
debug.extend = extend;
|
|
202
|
+
debug.destroy = createDebug.destroy;
|
|
203
|
+
Object.defineProperty(debug, "enabled", {
|
|
204
|
+
enumerable: true,
|
|
205
|
+
configurable: false,
|
|
206
|
+
get: () => {
|
|
207
|
+
if (enableOverride !== null) {
|
|
208
|
+
return enableOverride;
|
|
209
|
+
}
|
|
210
|
+
if (namespacesCache !== createDebug.namespaces) {
|
|
211
|
+
namespacesCache = createDebug.namespaces;
|
|
212
|
+
enabledCache = createDebug.enabled(namespace);
|
|
213
|
+
}
|
|
214
|
+
return enabledCache;
|
|
215
|
+
},
|
|
216
|
+
set: (v) => {
|
|
217
|
+
enableOverride = v;
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
if (typeof createDebug.init === "function") {
|
|
221
|
+
createDebug.init(debug);
|
|
222
|
+
}
|
|
223
|
+
return debug;
|
|
224
|
+
}
|
|
225
|
+
function extend(namespace, delimiter) {
|
|
226
|
+
const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
|
|
227
|
+
newDebug.log = this.log;
|
|
228
|
+
return newDebug;
|
|
229
|
+
}
|
|
230
|
+
function enable(namespaces) {
|
|
231
|
+
createDebug.save(namespaces);
|
|
232
|
+
createDebug.namespaces = namespaces;
|
|
233
|
+
createDebug.names = [];
|
|
234
|
+
createDebug.skips = [];
|
|
235
|
+
let i;
|
|
236
|
+
const split = (typeof namespaces === "string" ? namespaces : "").split(/[\s,]+/);
|
|
237
|
+
const len = split.length;
|
|
238
|
+
for (i = 0;i < len; i++) {
|
|
239
|
+
if (!split[i]) {
|
|
240
|
+
continue;
|
|
241
|
+
}
|
|
242
|
+
namespaces = split[i].replace(/\*/g, ".*?");
|
|
243
|
+
if (namespaces[0] === "-") {
|
|
244
|
+
createDebug.skips.push(new RegExp("^" + namespaces.slice(1) + "$"));
|
|
245
|
+
} else {
|
|
246
|
+
createDebug.names.push(new RegExp("^" + namespaces + "$"));
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
function disable() {
|
|
251
|
+
const namespaces = [
|
|
252
|
+
...createDebug.names.map(toNamespace),
|
|
253
|
+
...createDebug.skips.map(toNamespace).map((namespace) => "-" + namespace)
|
|
254
|
+
].join(",");
|
|
255
|
+
createDebug.enable("");
|
|
256
|
+
return namespaces;
|
|
257
|
+
}
|
|
258
|
+
function enabled(name) {
|
|
259
|
+
if (name[name.length - 1] === "*") {
|
|
260
|
+
return true;
|
|
261
|
+
}
|
|
262
|
+
let i;
|
|
263
|
+
let len;
|
|
264
|
+
for (i = 0, len = createDebug.skips.length;i < len; i++) {
|
|
265
|
+
if (createDebug.skips[i].test(name)) {
|
|
266
|
+
return false;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
for (i = 0, len = createDebug.names.length;i < len; i++) {
|
|
270
|
+
if (createDebug.names[i].test(name)) {
|
|
271
|
+
return true;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
return false;
|
|
275
|
+
}
|
|
276
|
+
function toNamespace(regexp) {
|
|
277
|
+
return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, "*");
|
|
278
|
+
}
|
|
279
|
+
function coerce(val) {
|
|
280
|
+
if (val instanceof Error) {
|
|
281
|
+
return val.stack || val.message;
|
|
282
|
+
}
|
|
283
|
+
return val;
|
|
284
|
+
}
|
|
285
|
+
function destroy() {
|
|
286
|
+
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
287
|
+
}
|
|
288
|
+
createDebug.enable(createDebug.load());
|
|
289
|
+
return createDebug;
|
|
290
|
+
};
|
|
291
|
+
module.exports = setup;
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
// bine_modules/commander/lib/sugges
|
|
295
|
+
var require_browser = __commonJS((exports, module) => {
|
|
296
|
+
var useColors = function() {
|
|
297
|
+
if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
|
|
298
|
+
return true;
|
|
299
|
+
}
|
|
300
|
+
if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
301
|
+
return false;
|
|
302
|
+
}
|
|
303
|
+
return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
304
|
+
};
|
|
305
|
+
var formatArgs = function(args) {
|
|
306
|
+
args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + exports.humanize(this.diff);
|
|
307
|
+
if (!this.useColors) {
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
const c = "color: " + this.color;
|
|
311
|
+
args.splice(1, 0, c, "color: inherit");
|
|
312
|
+
let index = 0;
|
|
313
|
+
let lastC = 0;
|
|
314
|
+
args[0].replace(/%[a-zA-Z%]/g, (match) => {
|
|
315
|
+
if (match === "%%") {
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
index++;
|
|
319
|
+
if (match === "%c") {
|
|
320
|
+
lastC = index;
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
args.splice(lastC, 0, c);
|
|
324
|
+
};
|
|
325
|
+
var save = function(namespaces) {
|
|
326
|
+
try {
|
|
327
|
+
if (namespaces) {
|
|
328
|
+
exports.storage.setItem("debug", namespaces);
|
|
329
|
+
} else {
|
|
330
|
+
exports.storage.removeItem("debug");
|
|
331
|
+
}
|
|
332
|
+
} catch (error) {
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
var load = function() {
|
|
336
|
+
let r;
|
|
337
|
+
try {
|
|
338
|
+
r = exports.storage.getItem("debug");
|
|
339
|
+
} catch (error) {
|
|
340
|
+
}
|
|
341
|
+
if (!r && typeof process !== "undefined" && ("env" in process)) {
|
|
342
|
+
r = process.env.DEBUG;
|
|
343
|
+
}
|
|
344
|
+
return r;
|
|
345
|
+
};
|
|
346
|
+
var localstorage = function() {
|
|
347
|
+
try {
|
|
348
|
+
return localStorage;
|
|
349
|
+
} catch (error) {
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
exports.formatArgs = formatArgs;
|
|
353
|
+
exports.save = save;
|
|
354
|
+
exports.load = load;
|
|
355
|
+
exports.useColors = useColors;
|
|
356
|
+
exports.storage = localstorage();
|
|
357
|
+
exports.destroy = (() => {
|
|
358
|
+
let warned = false;
|
|
359
|
+
return () => {
|
|
360
|
+
if (!warned) {
|
|
361
|
+
warned = true;
|
|
362
|
+
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
})();
|
|
366
|
+
exports.colors = [
|
|
367
|
+
"#0000CC",
|
|
368
|
+
"#0000FF",
|
|
369
|
+
"#0033CC",
|
|
370
|
+
"#0033FF",
|
|
371
|
+
"#0066CC",
|
|
372
|
+
"#0066FF",
|
|
373
|
+
"#0099CC",
|
|
374
|
+
"#0099FF",
|
|
375
|
+
"#00CC00",
|
|
376
|
+
"#00CC33",
|
|
377
|
+
"#00CC66",
|
|
378
|
+
"#00CC99",
|
|
379
|
+
"#00CCCC",
|
|
380
|
+
"#00CCFF",
|
|
381
|
+
"#3300CC",
|
|
382
|
+
"#3300FF",
|
|
383
|
+
"#3333CC",
|
|
384
|
+
"#3333FF",
|
|
385
|
+
"#3366CC",
|
|
386
|
+
"#3366FF",
|
|
387
|
+
"#3399CC",
|
|
388
|
+
"#3399FF",
|
|
389
|
+
"#33CC00",
|
|
390
|
+
"#33CC33",
|
|
391
|
+
"#33CC66",
|
|
392
|
+
"#33CC99",
|
|
393
|
+
"#33CCCC",
|
|
394
|
+
"#33CCFF",
|
|
395
|
+
"#6600CC",
|
|
396
|
+
"#6600FF",
|
|
397
|
+
"#6633CC",
|
|
398
|
+
"#6633FF",
|
|
399
|
+
"#66CC00",
|
|
400
|
+
"#66CC33",
|
|
401
|
+
"#9900CC",
|
|
402
|
+
"#9900FF",
|
|
403
|
+
"#9933CC",
|
|
404
|
+
"#9933FF",
|
|
405
|
+
"#99CC00",
|
|
406
|
+
"#99CC33",
|
|
407
|
+
"#CC0000",
|
|
408
|
+
"#CC0033",
|
|
409
|
+
"#CC0066",
|
|
410
|
+
"#CC0099",
|
|
411
|
+
"#CC00CC",
|
|
412
|
+
"#CC00FF",
|
|
413
|
+
"#CC3300",
|
|
414
|
+
"#CC3333",
|
|
415
|
+
"#CC3366",
|
|
416
|
+
"#CC3399",
|
|
417
|
+
"#CC33CC",
|
|
418
|
+
"#CC33FF",
|
|
419
|
+
"#CC6600",
|
|
420
|
+
"#CC6633",
|
|
421
|
+
"#CC9900",
|
|
422
|
+
"#CC9933",
|
|
423
|
+
"#CCCC00",
|
|
424
|
+
"#CCCC33",
|
|
425
|
+
"#FF0000",
|
|
426
|
+
"#FF0033",
|
|
427
|
+
"#FF0066",
|
|
428
|
+
"#FF0099",
|
|
429
|
+
"#FF00CC",
|
|
430
|
+
"#FF00FF",
|
|
431
|
+
"#FF3300",
|
|
432
|
+
"#FF3333",
|
|
433
|
+
"#FF3366",
|
|
434
|
+
"#FF3399",
|
|
435
|
+
"#FF33CC",
|
|
436
|
+
"#FF33FF",
|
|
437
|
+
"#FF6600",
|
|
438
|
+
"#FF6633",
|
|
439
|
+
"#FF9900",
|
|
440
|
+
"#FF9933",
|
|
441
|
+
"#FFCC00",
|
|
442
|
+
"#FFCC33"
|
|
443
|
+
];
|
|
444
|
+
exports.log = console.debug || console.log || (() => {
|
|
445
|
+
});
|
|
446
|
+
module.exports = require_common()(exports);
|
|
447
|
+
var { formatters } = module.exports;
|
|
448
|
+
formatters.j = function(v) {
|
|
449
|
+
try {
|
|
450
|
+
return JSON.stringify(v);
|
|
451
|
+
} catch (error) {
|
|
452
|
+
return "[UnexpectedJSONParseError]: " + error.message;
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
// /home/jim/node_modules/has-flag/index.js
|
|
458
|
+
var require_has_flag = __commonJS((exports, module) => {
|
|
459
|
+
module.exports = (flag, argv = process.argv) => {
|
|
460
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
461
|
+
const position = argv.indexOf(prefix + flag);
|
|
462
|
+
const terminatorPosition = argv.indexOf("--");
|
|
463
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
464
|
+
};
|
|
465
|
+
});
|
|
466
|
+
|
|
467
|
+
// /home/jim/node_modules/supports-color/index.js
|
|
468
|
+
var require_supports_color = __commonJS((exports, module) => {
|
|
469
|
+
var translateLevel = function(level) {
|
|
470
|
+
if (level === 0) {
|
|
471
|
+
return false;
|
|
472
|
+
}
|
|
473
|
+
return {
|
|
474
|
+
level,
|
|
475
|
+
hasBasic: true,
|
|
476
|
+
has256: level >= 2,
|
|
477
|
+
has16m: level >= 3
|
|
478
|
+
};
|
|
479
|
+
};
|
|
480
|
+
var supportsColor = function(haveStream, streamIsTTY) {
|
|
481
|
+
if (forceColor === 0) {
|
|
482
|
+
return 0;
|
|
483
|
+
}
|
|
484
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
485
|
+
return 3;
|
|
486
|
+
}
|
|
487
|
+
if (hasFlag("color=256")) {
|
|
488
|
+
return 2;
|
|
489
|
+
}
|
|
490
|
+
if (haveStream && !streamIsTTY && forceColor === undefined) {
|
|
491
|
+
return 0;
|
|
492
|
+
}
|
|
493
|
+
const min = forceColor || 0;
|
|
494
|
+
if (env.TERM === "dumb") {
|
|
495
|
+
return min;
|
|
496
|
+
}
|
|
497
|
+
if (process.platform === "win32") {
|
|
498
|
+
const osRelease = os.release().split(".");
|
|
499
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
500
|
+
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
501
|
+
}
|
|
502
|
+
return 1;
|
|
503
|
+
}
|
|
504
|
+
if ("CI" in env) {
|
|
505
|
+
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE"].some((sign) => (sign in env)) || env.CI_NAME === "codeship") {
|
|
506
|
+
return 1;
|
|
507
|
+
}
|
|
508
|
+
return min;
|
|
509
|
+
}
|
|
510
|
+
if ("TEAMCITY_VERSION" in env) {
|
|
511
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
512
|
+
}
|
|
513
|
+
if (env.COLORTERM === "truecolor") {
|
|
514
|
+
return 3;
|
|
515
|
+
}
|
|
516
|
+
if ("TERM_PROGRAM" in env) {
|
|
517
|
+
const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
518
|
+
switch (env.TERM_PROGRAM) {
|
|
519
|
+
case "iTerm.app":
|
|
520
|
+
return version >= 3 ? 3 : 2;
|
|
521
|
+
case "Apple_Terminal":
|
|
522
|
+
return 2;
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
if (/-256(color)?$/i.test(env.TERM)) {
|
|
526
|
+
return 2;
|
|
527
|
+
}
|
|
528
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
529
|
+
return 1;
|
|
530
|
+
}
|
|
531
|
+
if ("COLORTERM" in env) {
|
|
532
|
+
return 1;
|
|
533
|
+
}
|
|
534
|
+
return min;
|
|
535
|
+
};
|
|
536
|
+
var getSupportLevel = function(stream) {
|
|
537
|
+
const level = supportsColor(stream, stream && stream.isTTY);
|
|
538
|
+
return translateLevel(level);
|
|
539
|
+
};
|
|
540
|
+
var os = import.meta.require("os");
|
|
541
|
+
var tty = import.meta.require("tty");
|
|
542
|
+
var hasFlag = require_has_flag();
|
|
543
|
+
var { env } = process;
|
|
544
|
+
var forceColor;
|
|
545
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
546
|
+
forceColor = 0;
|
|
547
|
+
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
548
|
+
forceColor = 1;
|
|
549
|
+
}
|
|
550
|
+
if ("FORCE_COLOR" in env) {
|
|
551
|
+
if (env.FORCE_COLOR === "true") {
|
|
552
|
+
forceColor = 1;
|
|
553
|
+
} else if (env.FORCE_COLOR === "false") {
|
|
554
|
+
forceColor = 0;
|
|
555
|
+
} else {
|
|
556
|
+
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
module.exports = {
|
|
560
|
+
supportsColor: getSupportLevel,
|
|
561
|
+
stdout: translateLevel(supportsColor(true, tty.isatty(1))),
|
|
562
|
+
stderr: translateLevel(supportsColor(true, tty.isatty(2)))
|
|
563
|
+
};
|
|
564
|
+
});
|
|
565
|
+
|
|
566
|
+
// bine_modules/commander/lib/sug
|
|
567
|
+
var require_node = __commonJS((exports, module) => {
|
|
568
|
+
var useColors = function() {
|
|
569
|
+
return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
|
|
570
|
+
};
|
|
571
|
+
var formatArgs = function(args) {
|
|
572
|
+
const { namespace: name, useColors: useColors2 } = this;
|
|
573
|
+
if (useColors2) {
|
|
574
|
+
const c = this.color;
|
|
575
|
+
const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
|
|
576
|
+
const prefix = ` ${colorCode};1m${name} \x1B[0m`;
|
|
577
|
+
args[0] = prefix + args[0].split("\n").join("\n" + prefix);
|
|
578
|
+
args.push(colorCode + "m+" + exports.humanize(this.diff) + "\x1B[0m");
|
|
579
|
+
} else {
|
|
580
|
+
args[0] = getDate() + name + " " + args[0];
|
|
581
|
+
}
|
|
582
|
+
};
|
|
583
|
+
var getDate = function() {
|
|
584
|
+
if (exports.inspectOpts.hideDate) {
|
|
585
|
+
return "";
|
|
586
|
+
}
|
|
587
|
+
return new Date().toISOString() + " ";
|
|
588
|
+
};
|
|
589
|
+
var log = function(...args) {
|
|
590
|
+
return process.stderr.write(util.format(...args) + "\n");
|
|
591
|
+
};
|
|
592
|
+
var save = function(namespaces) {
|
|
593
|
+
if (namespaces) {
|
|
594
|
+
process.env.DEBUG = namespaces;
|
|
595
|
+
} else {
|
|
596
|
+
delete process.env.DEBUG;
|
|
597
|
+
}
|
|
598
|
+
};
|
|
599
|
+
var load = function() {
|
|
600
|
+
return process.env.DEBUG;
|
|
601
|
+
};
|
|
602
|
+
var init = function(debug) {
|
|
603
|
+
debug.inspectOpts = {};
|
|
604
|
+
const keys = Object.keys(exports.inspectOpts);
|
|
605
|
+
for (let i = 0;i < keys.length; i++) {
|
|
606
|
+
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
|
607
|
+
}
|
|
608
|
+
};
|
|
609
|
+
var tty = import.meta.require("tty");
|
|
610
|
+
var util = import.meta.require("util");
|
|
611
|
+
exports.init = init;
|
|
612
|
+
exports.log = log;
|
|
613
|
+
exports.formatArgs = formatArgs;
|
|
614
|
+
exports.save = save;
|
|
615
|
+
exports.load = load;
|
|
616
|
+
exports.useColors = useColors;
|
|
617
|
+
exports.destroy = util.deprecate(() => {
|
|
618
|
+
}, "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
619
|
+
exports.colors = [6, 2, 3, 4, 5, 1];
|
|
620
|
+
try {
|
|
621
|
+
const supportsColor = require_supports_color();
|
|
622
|
+
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
|
623
|
+
exports.colors = [
|
|
624
|
+
20,
|
|
625
|
+
21,
|
|
626
|
+
26,
|
|
627
|
+
27,
|
|
628
|
+
32,
|
|
629
|
+
33,
|
|
630
|
+
38,
|
|
631
|
+
39,
|
|
632
|
+
40,
|
|
633
|
+
41,
|
|
634
|
+
42,
|
|
635
|
+
43,
|
|
636
|
+
44,
|
|
637
|
+
45,
|
|
638
|
+
56,
|
|
639
|
+
57,
|
|
640
|
+
62,
|
|
641
|
+
63,
|
|
642
|
+
68,
|
|
643
|
+
69,
|
|
644
|
+
74,
|
|
645
|
+
75,
|
|
646
|
+
76,
|
|
647
|
+
77,
|
|
648
|
+
78,
|
|
649
|
+
79,
|
|
650
|
+
80,
|
|
651
|
+
81,
|
|
652
|
+
92,
|
|
653
|
+
93,
|
|
654
|
+
98,
|
|
655
|
+
99,
|
|
656
|
+
112,
|
|
657
|
+
113,
|
|
658
|
+
128,
|
|
659
|
+
129,
|
|
660
|
+
134,
|
|
661
|
+
135,
|
|
662
|
+
148,
|
|
663
|
+
149,
|
|
664
|
+
160,
|
|
665
|
+
161,
|
|
666
|
+
162,
|
|
667
|
+
163,
|
|
668
|
+
164,
|
|
669
|
+
165,
|
|
670
|
+
166,
|
|
671
|
+
167,
|
|
672
|
+
168,
|
|
673
|
+
169,
|
|
674
|
+
170,
|
|
675
|
+
171,
|
|
676
|
+
172,
|
|
677
|
+
173,
|
|
678
|
+
178,
|
|
679
|
+
179,
|
|
680
|
+
184,
|
|
681
|
+
185,
|
|
682
|
+
196,
|
|
683
|
+
197,
|
|
684
|
+
198,
|
|
685
|
+
199,
|
|
686
|
+
200,
|
|
687
|
+
201,
|
|
688
|
+
202,
|
|
689
|
+
203,
|
|
690
|
+
204,
|
|
691
|
+
205,
|
|
692
|
+
206,
|
|
693
|
+
207,
|
|
694
|
+
208,
|
|
695
|
+
209,
|
|
696
|
+
214,
|
|
697
|
+
215,
|
|
698
|
+
220,
|
|
699
|
+
221
|
|
700
|
+
];
|
|
701
|
+
}
|
|
702
|
+
} catch (error) {
|
|
703
|
+
}
|
|
704
|
+
exports.inspectOpts = Object.keys(process.env).filter((key) => {
|
|
705
|
+
return /^debug_/i.test(key);
|
|
706
|
+
}).reduce((obj, key) => {
|
|
707
|
+
const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
|
|
708
|
+
return k.toUpperCase();
|
|
709
|
+
});
|
|
710
|
+
let val = process.env[key];
|
|
711
|
+
if (/^(yes|on|true|enabled)$/i.test(val)) {
|
|
712
|
+
val = true;
|
|
713
|
+
} else if (/^(no|off|false|disabled)$/i.test(val)) {
|
|
714
|
+
val = false;
|
|
715
|
+
} else if (val === "null") {
|
|
716
|
+
val = null;
|
|
717
|
+
} else {
|
|
718
|
+
val = Number(val);
|
|
719
|
+
}
|
|
720
|
+
obj[prop] = val;
|
|
721
|
+
return obj;
|
|
722
|
+
}, {});
|
|
723
|
+
module.exports = require_common()(exports);
|
|
724
|
+
var { formatters } = module.exports;
|
|
725
|
+
formatters.o = function(v) {
|
|
726
|
+
this.inspectOpts.colors = this.useColors;
|
|
727
|
+
return util.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
|
|
728
|
+
};
|
|
729
|
+
formatters.O = function(v) {
|
|
730
|
+
this.inspectOpts.colors = this.useColors;
|
|
731
|
+
return util.inspect(v, this.inspectOpts);
|
|
732
|
+
};
|
|
733
|
+
});
|
|
734
|
+
|
|
735
|
+
// bine_modules/commander/lib/sugg
|
|
736
|
+
var require_src = __commonJS((exports, module) => {
|
|
737
|
+
if (typeof process === "undefined" || process.type === "renderer" || false || process.__nwjs) {
|
|
738
|
+
module.exports = require_browser();
|
|
739
|
+
} else {
|
|
740
|
+
module.exports = require_node();
|
|
741
|
+
}
|
|
742
|
+
});
|
|
743
|
+
// bine_modules
|
|
23
744
|
async function spawn(args, options = defaultOptions) {
|
|
24
745
|
const proc = Bun.spawn(args, { stdout: "pipe", stderr: "pipe" });
|
|
25
746
|
const stdout = new Response(proc.stdout);
|
|
@@ -44,7 +765,7 @@ var defaultOptions = {
|
|
|
44
765
|
expectQuiet: false
|
|
45
766
|
};
|
|
46
767
|
|
|
47
|
-
//
|
|
768
|
+
// bine_modul
|
|
48
769
|
async function getConfig(key) {
|
|
49
770
|
return doCommand(["git", "config", "--get", key]);
|
|
50
771
|
}
|
|
@@ -57,25 +778,44 @@ async function getCurrentBranch() {
|
|
|
57
778
|
async function getRemote() {
|
|
58
779
|
return doCommand(["git", "ls-remote", "--get-url", "origin"]);
|
|
59
780
|
}
|
|
60
|
-
//
|
|
61
|
-
import path from "path";
|
|
781
|
+
// bine_modules/command
|
|
62
782
|
async function getGitlabConfig() {
|
|
63
|
-
const host = await
|
|
783
|
+
const host = await hostP;
|
|
64
784
|
if (!host)
|
|
65
785
|
throw new Error("gitlab.host not in git config");
|
|
66
|
-
const user = await
|
|
786
|
+
const user = await userP;
|
|
67
787
|
if (!user)
|
|
68
788
|
throw new Error("user.email not in git config");
|
|
69
|
-
const token = await
|
|
789
|
+
const token = await tokenP;
|
|
70
790
|
if (!token)
|
|
71
791
|
throw new Error("gitlab.token not in git config");
|
|
72
792
|
return { host, user, token };
|
|
73
793
|
}
|
|
74
|
-
|
|
794
|
+
var hostP = getConfig("gitlab.host");
|
|
795
|
+
var userP = getConfig("user.email");
|
|
796
|
+
var tokenP = getConfig("gitlab.token");
|
|
797
|
+
|
|
798
|
+
// bine_modules/comm
|
|
799
|
+
var getNextLink = function(link) {
|
|
800
|
+
if (!link) {
|
|
801
|
+
return;
|
|
802
|
+
}
|
|
803
|
+
const regex = /<([^>]+)>; rel="next"/;
|
|
804
|
+
const match = link.match(regex);
|
|
805
|
+
const next = match ? match[1] : undefined;
|
|
806
|
+
return next;
|
|
807
|
+
};
|
|
808
|
+
async function gitlabApi(endpoint) {
|
|
809
|
+
if (endpoint.startsWith("/")) {
|
|
810
|
+
console.warn(`gitlabApi: endpoint ${endpoint} starts with /, removing it`);
|
|
811
|
+
endpoint = endpoint.slice(1);
|
|
812
|
+
}
|
|
75
813
|
const method = "GET";
|
|
76
814
|
const { host, token } = await getGitlabConfig();
|
|
77
815
|
const base = `https://${host}/api/v4`;
|
|
78
|
-
const
|
|
816
|
+
const requested = 100;
|
|
817
|
+
const sep = endpoint.includes("?") ? "&" : "?";
|
|
818
|
+
const uri = `${base}/${endpoint}${sep}per_page=${requested}`;
|
|
79
819
|
const headers = new Headers;
|
|
80
820
|
headers.append("Accept", "application/json");
|
|
81
821
|
headers.append("Private-Token", token);
|
|
@@ -83,19 +823,50 @@ async function get(endpoint) {
|
|
|
83
823
|
method,
|
|
84
824
|
headers
|
|
85
825
|
};
|
|
86
|
-
|
|
826
|
+
let request = new Request(uri, options);
|
|
87
827
|
const response = await fetch(request);
|
|
88
|
-
|
|
828
|
+
let link = getNextLink(response.headers.get("Link"));
|
|
829
|
+
let partial = await response.json();
|
|
830
|
+
let result = partial;
|
|
831
|
+
while (partial.length == requested && link) {
|
|
832
|
+
let request2 = new Request(link, options);
|
|
833
|
+
const next_response = await fetch(request2);
|
|
834
|
+
link = getNextLink(next_response.headers.get("Link"));
|
|
835
|
+
partial = await next_response.json();
|
|
836
|
+
result = result.concat(partial);
|
|
837
|
+
}
|
|
838
|
+
return result;
|
|
89
839
|
}
|
|
90
|
-
|
|
91
|
-
|
|
840
|
+
// bine_modules/comman
|
|
841
|
+
async function getGroups() {
|
|
842
|
+
return await gitlabApi(`groups`);
|
|
92
843
|
}
|
|
93
|
-
|
|
844
|
+
// bine_modules/commande
|
|
845
|
+
import path from "path";
|
|
846
|
+
|
|
847
|
+
// bine_modules/comma
|
|
848
|
+
var import_debug = __toESM(require_src(), 1);
|
|
849
|
+
var dlog = import_debug.default("gitlab");
|
|
850
|
+
|
|
851
|
+
// bine_modules/commande
|
|
852
|
+
async function getProjects(match) {
|
|
94
853
|
let search = "";
|
|
95
|
-
if (
|
|
96
|
-
|
|
854
|
+
if (match) {
|
|
855
|
+
const m = encodeURIComponent(match);
|
|
856
|
+
search = `&search=${m}`;
|
|
857
|
+
}
|
|
858
|
+
const projects = await gitlabApi(`projects?membership=true&simple=true${search}`);
|
|
859
|
+
if (!projects) {
|
|
860
|
+
throw new Error(`No projects!`);
|
|
861
|
+
} else if (!Array.isArray(projects)) {
|
|
862
|
+
console.log(projects);
|
|
863
|
+
throw new Error(`Projects is not an array!`);
|
|
97
864
|
}
|
|
98
|
-
|
|
865
|
+
const projs = projects;
|
|
866
|
+
const filtered = projs.filter((p) => {
|
|
867
|
+
return p.path_with_namespace.toLowerCase().includes(match.toLowerCase());
|
|
868
|
+
});
|
|
869
|
+
return filtered;
|
|
99
870
|
}
|
|
100
871
|
async function findProject(ssh_url) {
|
|
101
872
|
const parts = ssh_url.split(":");
|
|
@@ -103,43 +874,108 @@ async function findProject(ssh_url) {
|
|
|
103
874
|
throw new Error(`${ssh_url} is invalid, could not be split into two parts at :`);
|
|
104
875
|
}
|
|
105
876
|
const name = path.basename(parts[1], ".git");
|
|
106
|
-
const projects = await getProjects(
|
|
877
|
+
const projects = await getProjects(name);
|
|
107
878
|
const project = projects.find((p) => {
|
|
108
879
|
return p.ssh_url_to_repo === ssh_url;
|
|
109
880
|
});
|
|
881
|
+
return project;
|
|
882
|
+
}
|
|
883
|
+
async function projectScopedGet(endpoint) {
|
|
884
|
+
if (endpoint.startsWith("/")) {
|
|
885
|
+
console.warn(`gitlabApi: endpoint ${endpoint} starts with /, removing it`);
|
|
886
|
+
endpoint = endpoint.slice(1);
|
|
887
|
+
}
|
|
888
|
+
const method = "GET";
|
|
889
|
+
const { host, token } = await getGitlabConfig();
|
|
890
|
+
const remote = await getRemote();
|
|
891
|
+
const project = await findProject(remote);
|
|
110
892
|
if (!project) {
|
|
111
|
-
throw new Error(`
|
|
893
|
+
throw new Error(`Could not find project for remote ${remote}`);
|
|
112
894
|
}
|
|
113
|
-
|
|
895
|
+
const base = `https://${host}/api/v4/projects/${project.id}`;
|
|
896
|
+
const uri = `${base}/${endpoint}`;
|
|
897
|
+
dlog(`projectScopedGet uri: ${uri}`);
|
|
898
|
+
const headers = new Headers;
|
|
899
|
+
headers.append("Accept", "application/json");
|
|
900
|
+
headers.append("Private-Token", token);
|
|
901
|
+
const options = {
|
|
902
|
+
method,
|
|
903
|
+
headers
|
|
904
|
+
};
|
|
905
|
+
const request = new Request(uri, options);
|
|
906
|
+
const response = await fetch(request);
|
|
907
|
+
return await response.json();
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
// bine_modules/comma
|
|
911
|
+
async function whoami() {
|
|
912
|
+
return await gitlabApi("user");
|
|
114
913
|
}
|
|
914
|
+
|
|
915
|
+
// bine_modules/commander/lib/
|
|
115
916
|
async function getMergeRequest(id) {
|
|
116
|
-
return await
|
|
917
|
+
return await projectScopedGet(`merge_requests/${id}`);
|
|
918
|
+
}
|
|
919
|
+
async function getMyMergeRequestsInProgress() {
|
|
920
|
+
const me = await whoami();
|
|
921
|
+
return await gitlabApi(`merge_requests?state=opened&author_id=${me.id}`);
|
|
922
|
+
}
|
|
923
|
+
async function getMyMergeRequestsToReview() {
|
|
924
|
+
const me = await whoami();
|
|
925
|
+
return await gitlabApi(`merge_requests?state=opened&reviewer_id=${me.id}`);
|
|
926
|
+
}
|
|
927
|
+
// bine_modules/commander/
|
|
928
|
+
async function getNamespaces() {
|
|
929
|
+
return await gitlabApi(`namespaces`);
|
|
930
|
+
}
|
|
931
|
+
// bine_modules/commander
|
|
932
|
+
async function getProjectPipelines(options) {
|
|
933
|
+
const { days, status } = options;
|
|
934
|
+
const me = await whoami();
|
|
935
|
+
const username = me.username;
|
|
936
|
+
const date = new Date;
|
|
937
|
+
const pastDate = date.getDate() - days;
|
|
938
|
+
date.setDate(pastDate);
|
|
939
|
+
const updated = date.toISOString();
|
|
940
|
+
dlog(`updated: ${updated}`);
|
|
941
|
+
return await projectScopedGet(`pipelines?status=${status}&username=${username}&updated_after=${updated}`);
|
|
117
942
|
}
|
|
118
|
-
//
|
|
943
|
+
// bine_modules/c
|
|
119
944
|
import path2 from "path";
|
|
945
|
+
var justBase = function(filename) {
|
|
946
|
+
const ext = path2.extname(filename);
|
|
947
|
+
const base = path2.basename(filename, ext);
|
|
948
|
+
return base;
|
|
949
|
+
};
|
|
120
950
|
function isMain(self) {
|
|
121
|
-
const
|
|
122
|
-
|
|
951
|
+
const arg1 = Bun.argv[1];
|
|
952
|
+
const argv1Base = justBase(arg1);
|
|
953
|
+
const selfBase = justBase(self);
|
|
954
|
+
const result = argv1Base === selfBase;
|
|
955
|
+
return result;
|
|
123
956
|
}
|
|
124
|
-
//
|
|
957
|
+
// bine_module
|
|
125
958
|
async function getJiraConfig() {
|
|
126
959
|
const host = await getConfig("jira.host");
|
|
127
960
|
if (!host)
|
|
128
961
|
throw new Error("jira.host not in git config");
|
|
129
|
-
const
|
|
130
|
-
if (!
|
|
962
|
+
const user4 = await getConfig("jira.user") || await getConfig("user.email");
|
|
963
|
+
if (!user4)
|
|
131
964
|
throw new Error("jira.user or user.email not in git config");
|
|
132
965
|
const pat = await getConfig("jira.pat");
|
|
133
966
|
if (!pat)
|
|
134
967
|
throw new Error("jira.pat not in git config");
|
|
135
|
-
const token = Buffer.from(`${
|
|
968
|
+
const token = Buffer.from(`${user4}:${pat}`).toString("base64");
|
|
136
969
|
return { host, token };
|
|
137
970
|
}
|
|
138
|
-
async function
|
|
971
|
+
async function jiraApi(endpoint) {
|
|
972
|
+
if (endpoint.startsWith("/")) {
|
|
973
|
+
console.warn(`jiraApi: endpoint ${endpoint} starts with /`);
|
|
974
|
+
endpoint = endpoint.slice(1);
|
|
975
|
+
}
|
|
139
976
|
const method = "GET";
|
|
140
977
|
const { host, token } = await getJiraConfig();
|
|
141
|
-
const
|
|
142
|
-
const uri = `${base}/${endpoint}`;
|
|
978
|
+
const uri = `https://${host}/rest/api/3/${endpoint}`;
|
|
143
979
|
const auth = `Basic ${token}`;
|
|
144
980
|
const headers = new Headers;
|
|
145
981
|
headers.append("Authorization", auth);
|
|
@@ -150,32 +986,42 @@ async function get2(endpoint) {
|
|
|
150
986
|
};
|
|
151
987
|
const request = new Request(uri, options);
|
|
152
988
|
const response = await fetch(request);
|
|
153
|
-
|
|
989
|
+
const result = await response.json();
|
|
990
|
+
return result;
|
|
154
991
|
}
|
|
155
992
|
async function getIssue(issue) {
|
|
156
|
-
|
|
993
|
+
const result = await jiraApi(`issue/${issue}`);
|
|
994
|
+
return result;
|
|
157
995
|
}
|
|
158
996
|
async function getMyself() {
|
|
159
|
-
return await
|
|
997
|
+
return await jiraApi("/myself");
|
|
160
998
|
}
|
|
161
999
|
async function myUnresolvedIssues() {
|
|
162
1000
|
const myself = await getMyself();
|
|
163
1001
|
const myselfId = myself.accountId;
|
|
164
1002
|
const jql = `assignee = ${myselfId} AND resolution = Unresolved`;
|
|
165
|
-
const issues = await
|
|
1003
|
+
const issues = await jiraApi(`/search?jql=${encodeURIComponent(jql)}`);
|
|
166
1004
|
return issues.issues;
|
|
167
1005
|
}
|
|
168
1006
|
export {
|
|
169
1007
|
whoami,
|
|
170
1008
|
spawn,
|
|
1009
|
+
projectScopedGet,
|
|
171
1010
|
myUnresolvedIssues,
|
|
1011
|
+
jiraApi,
|
|
172
1012
|
isMain,
|
|
1013
|
+
gitlabApi,
|
|
173
1014
|
getRemote,
|
|
174
1015
|
getProjects,
|
|
1016
|
+
getProjectPipelines,
|
|
1017
|
+
getNamespaces,
|
|
175
1018
|
getMyself,
|
|
1019
|
+
getMyMergeRequestsToReview,
|
|
1020
|
+
getMyMergeRequestsInProgress,
|
|
176
1021
|
getMergeRequest,
|
|
177
1022
|
getJiraConfig,
|
|
178
1023
|
getIssue,
|
|
1024
|
+
getGroups,
|
|
179
1025
|
getGitlabConfig,
|
|
180
1026
|
getCurrentBranch,
|
|
181
1027
|
getConfig,
|