ya-git-jira 1.5.0 → 2.0.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.
Files changed (89) hide show
  1. package/.opencode/skills/architecture/SKILL.md +45 -0
  2. package/.opencode/skills/code-style/SKILL.md +76 -0
  3. package/.opencode/skills/git-confluence/SKILL.md +82 -0
  4. package/.opencode/skills/git-jira/SKILL.md +63 -0
  5. package/.opencode/skills/git-lab/SKILL.md +102 -0
  6. package/AGENTS.md +50 -0
  7. package/README.md +121 -71
  8. package/bin/git-api.ts +70 -0
  9. package/bin/git-confluence-page-search.ts +58 -0
  10. package/bin/git-confluence-page-show.ts +61 -0
  11. package/bin/git-confluence-page-update.ts +77 -0
  12. package/bin/git-confluence-page.ts +28 -0
  13. package/bin/git-confluence-space-list.ts +34 -0
  14. package/bin/git-confluence-space.ts +24 -0
  15. package/bin/git-confluence-whoami.ts +33 -0
  16. package/bin/git-confluence.ts +27 -0
  17. package/bin/git-jira-start.ts +1 -1
  18. package/bin/git-jira-whoami.ts +32 -0
  19. package/bin/git-jira.ts +2 -0
  20. package/bin/git-lab-project-mr-list.ts +57 -0
  21. package/bin/git-lab-project-mr.ts +24 -0
  22. package/bin/git-lab-project-pipeline-jobs.ts +46 -0
  23. package/bin/git-lab-project-pipeline-latest.ts +47 -0
  24. package/bin/git-lab-project-pipeline-log.ts +49 -0
  25. package/bin/git-lab-project-pipeline.ts +6 -0
  26. package/bin/git-lab-project.ts +5 -1
  27. package/bin/gitj-install-skills.ts +126 -0
  28. package/bin/gitj.ts +12 -0
  29. package/dist/bin/git-api.js +2156 -0
  30. package/dist/bin/git-bump.js +136 -125
  31. package/dist/bin/git-confluence-page-search.js +2079 -0
  32. package/dist/bin/{git-lab-projects.js → git-confluence-page-show.js} +294 -250
  33. package/dist/bin/{git-lab-projects-whereami.js → git-confluence-page-update.js} +300 -206
  34. package/dist/bin/git-confluence-page.js +2186 -0
  35. package/dist/bin/{git-lab-groups.js → git-confluence-space-list.js} +279 -210
  36. package/dist/bin/git-confluence-space.js +2073 -0
  37. package/dist/bin/git-confluence-whoami.js +2060 -0
  38. package/dist/bin/git-confluence.js +2251 -0
  39. package/dist/bin/git-jira-issue-list.js +144 -129
  40. package/dist/bin/git-jira-issue-show.js +144 -129
  41. package/dist/bin/git-jira-issue.js +148 -133
  42. package/dist/bin/git-jira-start.js +146 -131
  43. package/dist/bin/{git-lab-namespaces.js → git-jira-whoami.js} +214 -226
  44. package/dist/bin/git-jira.js +178 -143
  45. package/dist/bin/git-lab-group-list.js +326 -394
  46. package/dist/bin/git-lab-group.js +328 -396
  47. package/dist/bin/git-lab-merge-active.js +326 -394
  48. package/dist/bin/git-lab-merge-todo.js +326 -394
  49. package/dist/bin/git-lab-merge-train-list.js +294 -388
  50. package/dist/bin/git-lab-merge-train.js +296 -390
  51. package/dist/bin/git-lab-merge.js +335 -403
  52. package/dist/bin/git-lab-namespace-list.js +145 -135
  53. package/dist/bin/git-lab-namespace.js +147 -137
  54. package/dist/bin/git-lab-project-list.js +293 -387
  55. package/dist/bin/git-lab-project-mr-list.js +2740 -0
  56. package/dist/bin/git-lab-project-mr.js +2752 -0
  57. package/dist/bin/git-lab-project-pipeline-jobs.js +2734 -0
  58. package/dist/bin/git-lab-project-pipeline-latest.js +2736 -0
  59. package/dist/bin/git-lab-project-pipeline-list.js +328 -396
  60. package/dist/bin/git-lab-project-pipeline-log.js +2739 -0
  61. package/dist/bin/git-lab-project-pipeline.js +442 -407
  62. package/dist/bin/git-lab-project-whereami.js +297 -391
  63. package/dist/bin/git-lab-project.js +568 -403
  64. package/dist/bin/git-lab-whoami.js +149 -139
  65. package/dist/bin/git-lab.js +581 -454
  66. package/dist/bin/{git-lab-projects-list.js → gitj-install-skills.js} +226 -268
  67. package/dist/bin/gitj.js +1384 -578
  68. package/dist/index.js +379 -300
  69. package/index.ts +1 -0
  70. package/lib/api.ts +177 -0
  71. package/lib/confluence/api.ts +132 -0
  72. package/lib/confluence/config.ts +25 -0
  73. package/lib/confluence/index.ts +3 -0
  74. package/lib/confluence/types.ts +59 -0
  75. package/lib/git.ts +3 -3
  76. package/lib/gitlab/config.ts +5 -5
  77. package/lib/gitlab/index.ts +1 -0
  78. package/lib/gitlab/job.ts +31 -0
  79. package/lib/gitlab/merge-request.ts +20 -0
  80. package/lib/gitlab/pipeline.ts +28 -1
  81. package/lib/gitlab/project.ts +14 -5
  82. package/lib/help.ts +40 -0
  83. package/lib/jira.ts +11 -6
  84. package/lib/spawn.ts +3 -3
  85. package/package.json +18 -2
  86. package/tests/all-help.test.ts +6 -1
  87. package/tests/gitj.test.ts +1 -1
  88. package/tests/help-all.test.ts +29 -0
  89. package/bun.lockb +0 -0
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
3
  var __getProtoOf = Object.getPrototypeOf;
4
+ var __defProp = Object.defineProperty;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __toESM = (mod, isNodeMode, target) => {
@@ -16,13 +16,27 @@ var __toESM = (mod, isNodeMode, target) => {
16
16
  return to;
17
17
  };
18
18
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
19
- var __require = (id) => {
20
- return import.meta.require(id);
21
- };
19
+ var __require = import.meta.require;
22
20
 
23
- // bine_modules/commander/l
21
+ // node_modules/ms/index.js
24
22
  var require_ms = __commonJS((exports, module) => {
25
- var parse = function(str) {
23
+ var s = 1000;
24
+ var m = s * 60;
25
+ var h = m * 60;
26
+ var d = h * 24;
27
+ var w = d * 7;
28
+ var y = d * 365.25;
29
+ module.exports = function(val, options) {
30
+ options = options || {};
31
+ var type = typeof val;
32
+ if (type === "string" && val.length > 0) {
33
+ return parse(val);
34
+ } else if (type === "number" && isFinite(val)) {
35
+ return options.long ? fmtLong(val) : fmtShort(val);
36
+ }
37
+ throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val));
38
+ };
39
+ function parse(str) {
26
40
  str = String(str);
27
41
  if (str.length > 100) {
28
42
  return;
@@ -75,8 +89,8 @@ var require_ms = __commonJS((exports, module) => {
75
89
  default:
76
90
  return;
77
91
  }
78
- };
79
- var fmtShort = function(ms) {
92
+ }
93
+ function fmtShort(ms) {
80
94
  var msAbs = Math.abs(ms);
81
95
  if (msAbs >= d) {
82
96
  return Math.round(ms / d) + "d";
@@ -91,8 +105,8 @@ var require_ms = __commonJS((exports, module) => {
91
105
  return Math.round(ms / s) + "s";
92
106
  }
93
107
  return ms + "ms";
94
- };
95
- var fmtLong = function(ms) {
108
+ }
109
+ function fmtLong(ms) {
96
110
  var msAbs = Math.abs(ms);
97
111
  if (msAbs >= d) {
98
112
  return plural(ms, msAbs, d, "day");
@@ -107,32 +121,16 @@ var require_ms = __commonJS((exports, module) => {
107
121
  return plural(ms, msAbs, s, "second");
108
122
  }
109
123
  return ms + " ms";
110
- };
111
- var plural = function(ms, msAbs, n, name) {
124
+ }
125
+ function plural(ms, msAbs, n, name) {
112
126
  var isPlural = msAbs >= n * 1.5;
113
127
  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
- };
128
+ }
131
129
  });
132
130
 
133
- // bine_modules/commander/lib/sugge
131
+ // node_modules/debug/src/common.js
134
132
  var require_common = __commonJS((exports, module) => {
135
- var setup = function(env) {
133
+ function setup(env) {
136
134
  createDebug.debug = createDebug;
137
135
  createDebug.default = createDebug;
138
136
  createDebug.coerce = coerce;
@@ -287,68 +285,12 @@ var require_common = __commonJS((exports, module) => {
287
285
  }
288
286
  createDebug.enable(createDebug.load());
289
287
  return createDebug;
290
- };
288
+ }
291
289
  module.exports = setup;
292
290
  });
293
291
 
294
- // bine_modules/commander/lib/sugges
292
+ // node_modules/debug/src/browser.js
295
293
  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
294
  exports.formatArgs = formatArgs;
353
295
  exports.save = save;
354
296
  exports.load = load;
@@ -441,184 +383,85 @@ var require_browser = __commonJS((exports, module) => {
441
383
  "#FFCC00",
442
384
  "#FFCC33"
443
385
  ];
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;
386
+ function useColors() {
387
+ if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
388
+ return true;
453
389
  }
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) {
390
+ if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
471
391
  return false;
472
392
  }
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;
393
+ 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+)/);
394
+ }
395
+ function formatArgs(args) {
396
+ args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
397
+ if (!this.useColors) {
398
+ return;
496
399
  }
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;
400
+ const c = "color: " + this.color;
401
+ args.splice(1, 0, c, "color: inherit");
402
+ let index = 0;
403
+ let lastC = 0;
404
+ args[0].replace(/%[a-zA-Z%]/g, (match) => {
405
+ if (match === "%%") {
406
+ return;
501
407
  }
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;
408
+ index++;
409
+ if (match === "%c") {
410
+ lastC = index;
507
411
  }
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;
412
+ });
413
+ args.splice(lastC, 0, c);
414
+ }
415
+ exports.log = console.debug || console.log || (() => {});
416
+ function save(namespaces) {
417
+ try {
418
+ if (namespaces) {
419
+ exports.storage.setItem("debug", namespaces);
420
+ } else {
421
+ exports.storage.removeItem("debug");
523
422
  }
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;
423
+ } catch (error) {}
549
424
  }
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);
425
+ function load() {
426
+ let r;
427
+ try {
428
+ r = exports.storage.getItem("debug");
429
+ } catch (error) {}
430
+ if (!r && typeof process !== "undefined" && "env" in process) {
431
+ r = process.env.DEBUG;
557
432
  }
433
+ return r;
558
434
  }
559
- module.exports = {
560
- supportsColor: getSupportLevel,
561
- stdout: translateLevel(supportsColor(true, tty.isatty(1))),
562
- stderr: translateLevel(supportsColor(true, tty.isatty(2)))
435
+ function localstorage() {
436
+ try {
437
+ return localStorage;
438
+ } catch (error) {}
439
+ }
440
+ module.exports = require_common()(exports);
441
+ var { formatters } = module.exports;
442
+ formatters.j = function(v) {
443
+ try {
444
+ return JSON.stringify(v);
445
+ } catch (error) {
446
+ return "[UnexpectedJSONParseError]: " + error.message;
447
+ }
563
448
  };
564
449
  });
565
450
 
566
- // bine_modules/commander/lib/sug
451
+ // node_modules/debug/src/node.js
567
452
  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");
453
+ var tty = __require("tty");
454
+ var util = __require("util");
611
455
  exports.init = init;
612
456
  exports.log = log;
613
457
  exports.formatArgs = formatArgs;
614
458
  exports.save = save;
615
459
  exports.load = load;
616
460
  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`.");
461
+ exports.destroy = util.deprecate(() => {}, "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
619
462
  exports.colors = [6, 2, 3, 4, 5, 1];
620
463
  try {
621
- const supportsColor = require_supports_color();
464
+ const supportsColor = (()=>{throw new Error("Cannot require module "+"supports-color");})();
622
465
  if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
623
466
  exports.colors = [
624
467
  20,
@@ -699,8 +542,7 @@ var require_node = __commonJS((exports, module) => {
699
542
  221
700
543
  ];
701
544
  }
702
- } catch (error) {
703
- }
545
+ } catch (error) {}
704
546
  exports.inspectOpts = Object.keys(process.env).filter((key) => {
705
547
  return /^debug_/i.test(key);
706
548
  }).reduce((obj, key) => {
@@ -720,11 +562,56 @@ var require_node = __commonJS((exports, module) => {
720
562
  obj[prop] = val;
721
563
  return obj;
722
564
  }, {});
565
+ function useColors() {
566
+ return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
567
+ }
568
+ function formatArgs(args) {
569
+ const { namespace: name, useColors: useColors2 } = this;
570
+ if (useColors2) {
571
+ const c = this.color;
572
+ const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
573
+ const prefix = ` ${colorCode};1m${name} \x1B[0m`;
574
+ args[0] = prefix + args[0].split(`
575
+ `).join(`
576
+ ` + prefix);
577
+ args.push(colorCode + "m+" + module.exports.humanize(this.diff) + "\x1B[0m");
578
+ } else {
579
+ args[0] = getDate() + name + " " + args[0];
580
+ }
581
+ }
582
+ function getDate() {
583
+ if (exports.inspectOpts.hideDate) {
584
+ return "";
585
+ }
586
+ return new Date().toISOString() + " ";
587
+ }
588
+ function log(...args) {
589
+ return process.stderr.write(util.format(...args) + `
590
+ `);
591
+ }
592
+ function save(namespaces) {
593
+ if (namespaces) {
594
+ process.env.DEBUG = namespaces;
595
+ } else {
596
+ delete process.env.DEBUG;
597
+ }
598
+ }
599
+ function load() {
600
+ return process.env.DEBUG;
601
+ }
602
+ function init(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
+ }
723
609
  module.exports = require_common()(exports);
724
610
  var { formatters } = module.exports;
725
611
  formatters.o = function(v) {
726
612
  this.inspectOpts.colors = this.useColors;
727
- return util.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
613
+ return util.inspect(v, this.inspectOpts).split(`
614
+ `).map((str) => str.trim()).join(" ");
728
615
  };
729
616
  formatters.O = function(v) {
730
617
  this.inspectOpts.colors = this.useColors;
@@ -732,7 +619,7 @@ var require_node = __commonJS((exports, module) => {
732
619
  };
733
620
  });
734
621
 
735
- // bine_modules/commander/lib/sugg
622
+ // node_modules/debug/src/index.js
736
623
  var require_src = __commonJS((exports, module) => {
737
624
  if (typeof process === "undefined" || process.type === "renderer" || false || process.__nwjs) {
738
625
  module.exports = require_browser();
@@ -740,7 +627,10 @@ var require_src = __commonJS((exports, module) => {
740
627
  module.exports = require_node();
741
628
  }
742
629
  });
743
- // bine_modules
630
+ // lib/spawn.ts
631
+ var defaultOptions = {
632
+ expectQuiet: false
633
+ };
744
634
  async function spawn(args, options = defaultOptions) {
745
635
  const proc = Bun.spawn(args, { stdout: "pipe", stderr: "pipe" });
746
636
  const stdout = new Response(proc.stdout);
@@ -755,19 +645,16 @@ async function spawn(args, options = defaultOptions) {
755
645
  }
756
646
  return { out: out.trim(), err: err.trim(), code };
757
647
  }
758
- async function doCommand(args) {
759
- const { out, err } = await spawn(args);
648
+ async function doCommand(args, options = defaultOptions) {
649
+ const { out, err } = await spawn(args, options);
760
650
  if (err)
761
651
  console.error(err);
762
652
  return out;
763
653
  }
764
- var defaultOptions = {
765
- expectQuiet: false
766
- };
767
654
 
768
- // bine_modul
769
- async function getConfig(key) {
770
- return doCommand(["git", "config", "--get", key]);
655
+ // lib/git.ts
656
+ async function getConfig(key, options = defaultOptions) {
657
+ return doCommand(["git", "config", "--get", key], options);
771
658
  }
772
659
  async function createBranch(name) {
773
660
  return doCommand(["git", "checkout", "-b", name]);
@@ -778,25 +665,167 @@ async function getCurrentBranch() {
778
665
  async function getRemote() {
779
666
  return doCommand(["git", "ls-remote", "--get-url", "origin"]);
780
667
  }
781
- // bine_modules/command
782
- async function getGitlabConfig() {
783
- const host = await hostP;
668
+
669
+ // lib/confluence/config.ts
670
+ var gitEmailP = getConfig("user.email");
671
+ var jiraEmailP = getConfig("jira.user");
672
+ var confluenceEmailP = getConfig("confluence.user", { expectQuiet: true });
673
+ var jiraHostP = getConfig("jira.host");
674
+ var confluenceHostP = getConfig("confluence.host", { expectQuiet: true });
675
+ var jiraTokenP = getConfig("jira.token");
676
+ var confluenceTokenP = getConfig("confluence.token", { expectQuiet: true });
677
+ async function getConfluenceConfig() {
678
+ const host = await confluenceHostP || await jiraHostP;
784
679
  if (!host)
785
- throw new Error("gitlab.host not in git config");
786
- const user = await userP;
680
+ throw new Error("confluence.host or jira.host not in git config");
681
+ const user = await confluenceEmailP || await jiraEmailP || await gitEmailP;
787
682
  if (!user)
788
- throw new Error("user.email not in git config");
683
+ throw new Error("confluence.user, jira.user, or user.email not in git config");
684
+ const pat = await confluenceTokenP || await jiraTokenP;
685
+ if (!pat)
686
+ throw new Error("confluence.token or jira.token not in git config");
687
+ const token = Buffer.from(`${user}:${pat}`).toString("base64");
688
+ return { host, token };
689
+ }
690
+
691
+ // lib/confluence/api.ts
692
+ function getNextLink(link) {
693
+ if (!link) {
694
+ return;
695
+ }
696
+ const regex = /<([^>]+)>; rel="next"/;
697
+ const match = link.match(regex);
698
+ const next = match ? match[1] : undefined;
699
+ return next;
700
+ }
701
+ async function confluenceApi(endpoint) {
702
+ if (endpoint.startsWith("/")) {
703
+ console.warn(`confluenceApi: endpoint ${endpoint} starts with /, removing it`);
704
+ endpoint = endpoint.slice(1);
705
+ }
706
+ const method = "GET";
707
+ const { host, token } = await getConfluenceConfig();
708
+ const base = `https://${host}/wiki/api/v2`;
709
+ const uri = `${base}/${endpoint}`;
710
+ const auth = `Basic ${token}`;
711
+ const headers = new Headers;
712
+ headers.append("Authorization", auth);
713
+ headers.append("Accept", "application/json");
714
+ const options = {
715
+ method,
716
+ headers
717
+ };
718
+ let request = new Request(uri, options);
719
+ const response = await fetch(request);
720
+ let link = getNextLink(response.headers.get("Link"));
721
+ const body = await response.json();
722
+ if (!body.results) {
723
+ return body;
724
+ }
725
+ let result = body.results;
726
+ const origin = `https://${host}`;
727
+ while (link) {
728
+ const url = link.startsWith("/") ? `${origin}${link}` : link;
729
+ let request2 = new Request(url, options);
730
+ const next_response = await fetch(request2);
731
+ link = getNextLink(next_response.headers.get("Link"));
732
+ const next_body = await next_response.json();
733
+ if (next_body.results) {
734
+ result = result.concat(next_body.results);
735
+ }
736
+ }
737
+ return result;
738
+ }
739
+ async function confluenceApiWrite(endpoint, method, body) {
740
+ if (endpoint.startsWith("/")) {
741
+ console.warn(`confluenceApiWrite: endpoint ${endpoint} starts with /, removing it`);
742
+ endpoint = endpoint.slice(1);
743
+ }
744
+ const { host, token } = await getConfluenceConfig();
745
+ const base = `https://${host}/wiki/api/v2`;
746
+ const uri = `${base}/${endpoint}`;
747
+ const auth = `Basic ${token}`;
748
+ const headers = new Headers;
749
+ headers.append("Authorization", auth);
750
+ headers.append("Accept", "application/json");
751
+ headers.append("Content-Type", "application/json");
752
+ const options = {
753
+ method,
754
+ headers,
755
+ body: JSON.stringify(body)
756
+ };
757
+ const request = new Request(uri, options);
758
+ const response = await fetch(request);
759
+ if (!response.ok) {
760
+ const text = await response.text();
761
+ throw new Error(`Confluence API ${method} ${endpoint} failed (${response.status}): ${text}`);
762
+ }
763
+ const result = await response.json();
764
+ return result;
765
+ }
766
+ async function confluenceSearch(cql) {
767
+ const { host, token } = await getConfluenceConfig();
768
+ const base = `https://${host}/wiki/rest/api`;
769
+ const auth = `Basic ${token}`;
770
+ const headers = new Headers;
771
+ headers.append("Authorization", auth);
772
+ headers.append("Accept", "application/json");
773
+ const options = { method: "GET", headers };
774
+ const origin = `https://${host}`;
775
+ let uri = `${base}/search?cql=${encodeURIComponent(cql)}&limit=25`;
776
+ let allResults = [];
777
+ while (uri) {
778
+ const request = new Request(uri, options);
779
+ const response = await fetch(request);
780
+ const body = await response.json();
781
+ if (body.results) {
782
+ allResults = allResults.concat(body.results);
783
+ }
784
+ const next = body._links?.next;
785
+ uri = next ? next.startsWith("/") ? `${origin}${next}` : next : "";
786
+ }
787
+ return allResults;
788
+ }
789
+ async function confluenceApiV1(endpoint) {
790
+ if (endpoint.startsWith("/")) {
791
+ console.warn(`confluenceApiV1: endpoint ${endpoint} starts with /, removing it`);
792
+ endpoint = endpoint.slice(1);
793
+ }
794
+ const method = "GET";
795
+ const { host, token } = await getConfluenceConfig();
796
+ const base = `https://${host}/wiki/rest/api`;
797
+ const uri = `${base}/${endpoint}`;
798
+ const auth = `Basic ${token}`;
799
+ const headers = new Headers;
800
+ headers.append("Authorization", auth);
801
+ headers.append("Accept", "application/json");
802
+ const options = {
803
+ method,
804
+ headers
805
+ };
806
+ const request = new Request(uri, options);
807
+ const response = await fetch(request);
808
+ const result = await response.json();
809
+ return result;
810
+ }
811
+ // lib/gitlab/config.ts
812
+ var gitEmailP2 = getConfig("user.email");
813
+ var gitlabEmailP = getConfig("gitlab.user", { expectQuiet: true });
814
+ var hostP = getConfig("gitlab.host");
815
+ var tokenP = getConfig("gitlab.token");
816
+ async function getGitlabConfig() {
817
+ const host = await hostP || "gitlab.com";
818
+ const user = await gitEmailP2 || await gitlabEmailP;
819
+ if (!user)
820
+ throw new Error("Neither user.email nor gitlab.email in git config");
789
821
  const token = await tokenP;
790
822
  if (!token)
791
823
  throw new Error("gitlab.token not in git config");
792
824
  return { host, user, token };
793
825
  }
794
- var hostP = getConfig("gitlab.host");
795
- var userP = getConfig("user.email");
796
- var tokenP = getConfig("gitlab.token");
797
826
 
798
- // bine_modules/comm
799
- var getNextLink = function(link) {
827
+ // lib/gitlab/api.ts
828
+ function getNextLink2(link) {
800
829
  if (!link) {
801
830
  return;
802
831
  }
@@ -804,7 +833,7 @@ var getNextLink = function(link) {
804
833
  const match = link.match(regex);
805
834
  const next = match ? match[1] : undefined;
806
835
  return next;
807
- };
836
+ }
808
837
  async function gitlabApi(endpoint) {
809
838
  if (endpoint.startsWith("/")) {
810
839
  console.warn(`gitlabApi: endpoint ${endpoint} starts with /, removing it`);
@@ -825,30 +854,28 @@ async function gitlabApi(endpoint) {
825
854
  };
826
855
  let request = new Request(uri, options);
827
856
  const response = await fetch(request);
828
- let link = getNextLink(response.headers.get("Link"));
857
+ let link = getNextLink2(response.headers.get("Link"));
829
858
  let partial = await response.json();
830
859
  let result = partial;
831
860
  while (partial.length == requested && link) {
832
861
  let request2 = new Request(link, options);
833
862
  const next_response = await fetch(request2);
834
- link = getNextLink(next_response.headers.get("Link"));
863
+ link = getNextLink2(next_response.headers.get("Link"));
835
864
  partial = await next_response.json();
836
865
  result = result.concat(partial);
837
866
  }
838
867
  return result;
839
868
  }
840
- // bine_modules/comman
869
+ // lib/gitlab/group.ts
841
870
  async function getGroups() {
842
871
  return await gitlabApi(`groups`);
843
872
  }
844
- // bine_modules/commande
845
- import path from "path";
846
-
847
- // bine_modules/comma
873
+ // lib/gitlab/dlog.ts
848
874
  var import_debug = __toESM(require_src(), 1);
849
875
  var dlog = import_debug.default("gitlab");
850
876
 
851
- // bine_modules/commande
877
+ // lib/gitlab/project.ts
878
+ import path from "path";
852
879
  async function getProjects(match) {
853
880
  let search = "";
854
881
  if (match) {
@@ -880,7 +907,7 @@ async function findProject(ssh_url) {
880
907
  });
881
908
  return project;
882
909
  }
883
- async function projectScopedGet(endpoint) {
910
+ async function projectScopedRequest(endpoint) {
884
911
  if (endpoint.startsWith("/")) {
885
912
  console.warn(`gitlabApi: endpoint ${endpoint} starts with /, removing it`);
886
913
  endpoint = endpoint.slice(1);
@@ -893,26 +920,46 @@ async function projectScopedGet(endpoint) {
893
920
  throw new Error(`Could not find project for remote ${remote}`);
894
921
  }
895
922
  const base = `https://${host}/api/v4/projects/${project.id}`;
896
- const uri = `${base}/${endpoint}`;
897
- dlog(`projectScopedGet uri: ${uri}`);
923
+ const sep = endpoint.includes("?") ? "&" : "?";
924
+ const uri = `${base}/${endpoint}${sep}per_page=100`;
925
+ dlog(`projectScopedRequest uri: ${uri}`);
898
926
  const headers = new Headers;
899
- headers.append("Accept", "application/json");
900
927
  headers.append("Private-Token", token);
901
928
  const options = {
902
929
  method,
903
930
  headers
904
931
  };
905
932
  const request = new Request(uri, options);
906
- const response = await fetch(request);
933
+ return await fetch(request);
934
+ }
935
+ async function projectScopedGet(endpoint) {
936
+ const response = await projectScopedRequest(endpoint);
907
937
  return await response.json();
908
938
  }
939
+ async function projectScopedGetText(endpoint) {
940
+ const response = await projectScopedRequest(endpoint);
941
+ return await response.text();
942
+ }
909
943
 
910
- // bine_modules/comma
944
+ // lib/gitlab/job.ts
945
+ async function getPipelineJobs(pipelineId) {
946
+ dlog(`getPipelineJobs pipelineId: ${pipelineId}`);
947
+ return await projectScopedGet(`pipelines/${pipelineId}/jobs`);
948
+ }
949
+ async function getJob(jobId) {
950
+ dlog(`getJob jobId: ${jobId}`);
951
+ return await projectScopedGet(`jobs/${jobId}`);
952
+ }
953
+ async function getJobLog(jobId) {
954
+ dlog(`getJobLog jobId: ${jobId}`);
955
+ return await projectScopedGetText(`jobs/${jobId}/trace`);
956
+ }
957
+ // lib/gitlab/user.ts
911
958
  async function whoami() {
912
959
  return await gitlabApi("user");
913
960
  }
914
961
 
915
- // bine_modules/commander/lib/
962
+ // lib/gitlab/merge-request.ts
916
963
  async function getMergeRequest(id) {
917
964
  return await projectScopedGet(`merge_requests/${id}`);
918
965
  }
@@ -924,11 +971,16 @@ async function getMyMergeRequestsToReview() {
924
971
  const me = await whoami();
925
972
  return await gitlabApi(`merge_requests?state=opened&reviewer_id=${me.id}`);
926
973
  }
927
- // bine_modules/commander/
974
+ async function getMergeRequestsByBranch(projectPath, sourceBranch) {
975
+ const project = encodeURIComponent(projectPath);
976
+ const branch = encodeURIComponent(sourceBranch);
977
+ return await gitlabApi(`projects/${project}/merge_requests?state=opened&source_branch=${branch}`);
978
+ }
979
+ // lib/gitlab/namespace.ts
928
980
  async function getNamespaces() {
929
981
  return await gitlabApi(`namespaces`);
930
982
  }
931
- // bine_modules/commander
983
+ // lib/gitlab/pipeline.ts
932
984
  async function getProjectPipelines(options) {
933
985
  const { days, status } = options;
934
986
  const me = await whoami();
@@ -940,13 +992,23 @@ async function getProjectPipelines(options) {
940
992
  dlog(`updated: ${updated}`);
941
993
  return await projectScopedGet(`pipelines?status=${status}&username=${username}&updated_after=${updated}`);
942
994
  }
943
- // bine_modules/c
995
+ async function getMergeRequestPipelines(projectPath, mrIid) {
996
+ const project = encodeURIComponent(projectPath);
997
+ return await gitlabApi(`projects/${project}/merge_requests/${mrIid}/pipelines`);
998
+ }
999
+ async function getLatestPipeline() {
1000
+ const ref = await getCurrentBranch();
1001
+ dlog(`getLatestPipeline ref: ${ref}`);
1002
+ const pipelines = await projectScopedGet(`pipelines?ref=${encodeURIComponent(ref)}&per_page=1&order_by=id&sort=desc`);
1003
+ return pipelines.length > 0 ? pipelines[0] : undefined;
1004
+ }
1005
+ // lib/is_main.ts
944
1006
  import path2 from "path";
945
- var justBase = function(filename) {
1007
+ function justBase(filename) {
946
1008
  const ext = path2.extname(filename);
947
1009
  const base = path2.basename(filename, ext);
948
1010
  return base;
949
- };
1011
+ }
950
1012
  function isMain(self) {
951
1013
  const arg1 = Bun.argv[1];
952
1014
  const argv1Base = justBase(arg1);
@@ -954,18 +1016,22 @@ function isMain(self) {
954
1016
  const result = argv1Base === selfBase;
955
1017
  return result;
956
1018
  }
957
- // bine_module
1019
+ // lib/jira.ts
1020
+ var gitEmailP3 = getConfig("user.email");
1021
+ var jiraEmailP2 = getConfig("jira.user");
1022
+ var hostP2 = getConfig("jira.host");
1023
+ var tokenP2 = getConfig("jira.token");
958
1024
  async function getJiraConfig() {
959
- const host = await getConfig("jira.host");
1025
+ const host = await hostP2;
960
1026
  if (!host)
961
1027
  throw new Error("jira.host not in git config");
962
- const user4 = await getConfig("jira.user") || await getConfig("user.email");
963
- if (!user4)
1028
+ const user2 = await jiraEmailP2 || await gitEmailP3;
1029
+ if (!user2)
964
1030
  throw new Error("jira.user or user.email not in git config");
965
- const pat = await getConfig("jira.pat");
1031
+ const pat = await tokenP2;
966
1032
  if (!pat)
967
- throw new Error("jira.pat not in git config");
968
- const token = Buffer.from(`${user4}:${pat}`).toString("base64");
1033
+ throw new Error("jira.token not in git config");
1034
+ const token = Buffer.from(`${user2}:${pat}`).toString("base64");
969
1035
  return { host, token };
970
1036
  }
971
1037
  async function jiraApi(endpoint) {
@@ -994,18 +1060,19 @@ async function getIssue(issue) {
994
1060
  return result;
995
1061
  }
996
1062
  async function getMyself() {
997
- return await jiraApi("/myself");
1063
+ return await jiraApi("myself");
998
1064
  }
999
1065
  async function myUnresolvedIssues() {
1000
1066
  const myself = await getMyself();
1001
1067
  const myselfId = myself.accountId;
1002
1068
  const jql = `assignee = ${myselfId} AND resolution = Unresolved`;
1003
- const issues = await jiraApi(`/search?jql=${encodeURIComponent(jql)}`);
1069
+ const issues = await jiraApi(`search/jql?jql=${encodeURIComponent(jql)}&fields=summary`);
1004
1070
  return issues.issues;
1005
1071
  }
1006
1072
  export {
1007
1073
  whoami,
1008
1074
  spawn,
1075
+ projectScopedGetText,
1009
1076
  projectScopedGet,
1010
1077
  myUnresolvedIssues,
1011
1078
  jiraApi,
@@ -1014,18 +1081,30 @@ export {
1014
1081
  getRemote,
1015
1082
  getProjects,
1016
1083
  getProjectPipelines,
1084
+ getPipelineJobs,
1017
1085
  getNamespaces,
1018
1086
  getMyself,
1019
1087
  getMyMergeRequestsToReview,
1020
1088
  getMyMergeRequestsInProgress,
1089
+ getMergeRequestsByBranch,
1090
+ getMergeRequestPipelines,
1021
1091
  getMergeRequest,
1092
+ getLatestPipeline,
1093
+ getJobLog,
1094
+ getJob,
1022
1095
  getJiraConfig,
1023
1096
  getIssue,
1024
1097
  getGroups,
1025
1098
  getGitlabConfig,
1026
1099
  getCurrentBranch,
1100
+ getConfluenceConfig,
1027
1101
  getConfig,
1028
1102
  findProject,
1029
1103
  doCommand,
1030
- createBranch
1104
+ defaultOptions,
1105
+ createBranch,
1106
+ confluenceSearch,
1107
+ confluenceApiWrite,
1108
+ confluenceApiV1,
1109
+ confluenceApi
1031
1110
  };