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.
Files changed (74) hide show
  1. package/bin/git-bump.ts +7 -4
  2. package/bin/{git-jira-issues.ts → git-jira-issue-list.ts} +10 -7
  3. package/bin/git-jira-issue-show.ts +40 -0
  4. package/bin/git-jira-issue.ts +14 -25
  5. package/bin/git-jira-start.ts +8 -5
  6. package/bin/git-jira.ts +9 -6
  7. package/bin/git-lab-group-list.ts +35 -0
  8. package/bin/git-lab-group.ts +25 -0
  9. package/bin/git-lab-merge-active.ts +41 -0
  10. package/bin/git-lab-merge-todo.ts +36 -0
  11. package/bin/git-lab-merge-train-list.ts +26 -0
  12. package/bin/git-lab-merge-train.ts +25 -0
  13. package/bin/git-lab-merge.ts +29 -0
  14. package/bin/git-lab-namespace-list.ts +27 -0
  15. package/bin/git-lab-namespace.ts +24 -0
  16. package/bin/{git-lab-projects.ts → git-lab-project-list.ts} +13 -10
  17. package/bin/git-lab-project-pipeline-list.ts +46 -0
  18. package/bin/git-lab-project-pipeline.ts +24 -0
  19. package/bin/git-lab-project-whereami.ts +43 -0
  20. package/bin/git-lab-project.ts +28 -0
  21. package/bin/git-lab-whoami.ts +8 -5
  22. package/bin/git-lab.ts +18 -8
  23. package/bin/gitj.ts +7 -5
  24. package/build.ts +1 -1
  25. package/bun.lockb +0 -0
  26. package/dist/bin/git-bump.js +55 -17
  27. package/dist/bin/{git-jira-issues.js → git-jira-issue-list.js} +71 -28
  28. package/dist/bin/{git-lab-mergetrain.js → git-jira-issue-show.js} +100 -43
  29. package/dist/bin/git-jira-issue.js +106 -33
  30. package/dist/bin/git-jira-start.js +70 -27
  31. package/dist/bin/git-jira.js +117 -59
  32. package/dist/bin/git-lab-group-list.js +2793 -0
  33. package/dist/bin/git-lab-group.js +2805 -0
  34. package/dist/bin/git-lab-groups.js +1992 -0
  35. package/dist/bin/git-lab-merge-active.js +2798 -0
  36. package/dist/bin/git-lab-merge-todo.js +2793 -0
  37. package/dist/bin/git-lab-merge-train-list.js +2754 -0
  38. package/dist/bin/git-lab-merge-train.js +2766 -0
  39. package/dist/bin/git-lab-merge.js +2865 -0
  40. package/dist/bin/git-lab-namespace-list.js +1967 -0
  41. package/dist/bin/git-lab-namespace.js +1979 -0
  42. package/dist/bin/git-lab-namespaces.js +1984 -0
  43. package/dist/bin/git-lab-project-list.js +2761 -0
  44. package/dist/bin/git-lab-project-pipeline-list.js +2800 -0
  45. package/dist/bin/git-lab-project-pipeline.js +2812 -0
  46. package/dist/bin/git-lab-project-whereami.js +2764 -0
  47. package/dist/bin/git-lab-project.js +2805 -0
  48. package/dist/bin/git-lab-projects-list.js +1996 -0
  49. package/dist/bin/git-lab-projects-whereami.js +1999 -0
  50. package/dist/bin/git-lab-projects.js +138 -35
  51. package/dist/bin/git-lab-whoami.js +100 -56
  52. package/dist/bin/git-lab.js +1123 -58
  53. package/dist/bin/gitj.js +1260 -172
  54. package/dist/index.js +881 -35
  55. package/index.ts +1 -1
  56. package/lib/gitlab/api.ts +46 -0
  57. package/lib/gitlab/config.ts +21 -0
  58. package/lib/gitlab/dlog.ts +2 -0
  59. package/lib/gitlab/group.ts +12 -0
  60. package/lib/gitlab/index.ts +8 -0
  61. package/lib/gitlab/merge-request.ts +31 -0
  62. package/lib/gitlab/merge-trains.ts +19 -0
  63. package/lib/gitlab/namespace.ts +12 -0
  64. package/lib/gitlab/pipeline.ts +32 -0
  65. package/lib/gitlab/project.ts +78 -0
  66. package/lib/gitlab/user.ts +13 -0
  67. package/lib/is_main.ts +21 -2
  68. package/lib/jira.ts +12 -7
  69. package/lib/package.ts +35 -0
  70. package/package.json +21 -4
  71. package/tests/all-help.test.ts +46 -0
  72. package/tests/git.test.ts +8 -7
  73. package/tests/gitj.test.ts +1 -1
  74. package/lib/gitlab.ts +0 -86
package/dist/bin/gitj.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env bun run
1
+ #!/usr/bin/env bun
2
2
  // @bun
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
@@ -21,7 +21,7 @@ var __require = (id) => {
21
21
  return import.meta.require(id);
22
22
  };
23
23
 
24
- // node_modules/commander/lib/error.js
24
+ // bine_modules/commander/lib/suggestS
25
25
  var require_error = __commonJS((exports) => {
26
26
  class CommanderError extends Error {
27
27
  constructor(exitCode, code, message) {
@@ -45,7 +45,7 @@ var require_error = __commonJS((exports) => {
45
45
  exports.InvalidArgumentError = InvalidArgumentError;
46
46
  });
47
47
 
48
- // node_modules/commander/lib/argument.js
48
+ // bine_modules/commander/lib/suggestSimi
49
49
  var require_argument = __commonJS((exports) => {
50
50
  var humanReadableArgName = function(arg) {
51
51
  const nameOutput = arg.name() + (arg.variadic === true ? "..." : "");
@@ -124,7 +124,7 @@ var require_argument = __commonJS((exports) => {
124
124
  exports.humanReadableArgName = humanReadableArgName;
125
125
  });
126
126
 
127
- // node_modules/commander/lib/help.js
127
+ // bine_modules/commander/lib/suggest
128
128
  var require_help = __commonJS((exports) => {
129
129
  var { humanReadableArgName } = require_argument();
130
130
 
@@ -364,7 +364,7 @@ var require_help = __commonJS((exports) => {
364
364
  exports.Help = Help;
365
365
  });
366
366
 
367
- // node_modules/commander/lib/option.js
367
+ // bine_modules/commander/lib/suggestSi
368
368
  var require_option = __commonJS((exports) => {
369
369
  var camelcase = function(str) {
370
370
  return str.split("-").reduce((str2, word) => {
@@ -516,7 +516,7 @@ var require_option = __commonJS((exports) => {
516
516
  exports.DualOptions = DualOptions;
517
517
  });
518
518
 
519
- // node_modules/commander/lib/suggestSimilar.js
519
+ // bine_modules/commander/lib/suggestSimilar.js
520
520
  var require_suggestSimilar = __commonJS((exports) => {
521
521
  var editDistance = function(a, b) {
522
522
  if (Math.abs(a.length - b.length) > maxDistance)
@@ -587,7 +587,7 @@ var require_suggestSimilar = __commonJS((exports) => {
587
587
  exports.suggestSimilar = suggestSimilar;
588
588
  });
589
589
 
590
- // node_modules/commander/lib/command.js
590
+ // bine_modules/commander/lib/suggestSim
591
591
  var require_command = __commonJS((exports) => {
592
592
  var outputHelpIfRequested = function(cmd, args) {
593
593
  const helpOption = cmd._hasHelpOption && args.find((arg) => arg === cmd._helpLongFlag || arg === cmd._helpShortFlag);
@@ -1765,7 +1765,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1765
1765
  exports.Command = Command;
1766
1766
  });
1767
1767
 
1768
- // node_modules/commander/index.js
1768
+ // bine_modules/commander/lib/sugg
1769
1769
  var require_commander = __commonJS((exports, module) => {
1770
1770
  var { Argument } = require_argument();
1771
1771
  var { Command } = require_command();
@@ -1783,7 +1783,728 @@ var require_commander = __commonJS((exports, module) => {
1783
1783
  exports.Option = Option;
1784
1784
  });
1785
1785
 
1786
- // node_modules/commander/esm.mjs
1786
+ // bine_modules/commander/l
1787
+ var require_ms = __commonJS((exports, module) => {
1788
+ var parse = function(str) {
1789
+ str = String(str);
1790
+ if (str.length > 100) {
1791
+ return;
1792
+ }
1793
+ 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);
1794
+ if (!match) {
1795
+ return;
1796
+ }
1797
+ var n = parseFloat(match[1]);
1798
+ var type = (match[2] || "ms").toLowerCase();
1799
+ switch (type) {
1800
+ case "years":
1801
+ case "year":
1802
+ case "yrs":
1803
+ case "yr":
1804
+ case "y":
1805
+ return n * y;
1806
+ case "weeks":
1807
+ case "week":
1808
+ case "w":
1809
+ return n * w;
1810
+ case "days":
1811
+ case "day":
1812
+ case "d":
1813
+ return n * d;
1814
+ case "hours":
1815
+ case "hour":
1816
+ case "hrs":
1817
+ case "hr":
1818
+ case "h":
1819
+ return n * h;
1820
+ case "minutes":
1821
+ case "minute":
1822
+ case "mins":
1823
+ case "min":
1824
+ case "m":
1825
+ return n * m;
1826
+ case "seconds":
1827
+ case "second":
1828
+ case "secs":
1829
+ case "sec":
1830
+ case "s":
1831
+ return n * s;
1832
+ case "milliseconds":
1833
+ case "millisecond":
1834
+ case "msecs":
1835
+ case "msec":
1836
+ case "ms":
1837
+ return n;
1838
+ default:
1839
+ return;
1840
+ }
1841
+ };
1842
+ var fmtShort = function(ms) {
1843
+ var msAbs = Math.abs(ms);
1844
+ if (msAbs >= d) {
1845
+ return Math.round(ms / d) + "d";
1846
+ }
1847
+ if (msAbs >= h) {
1848
+ return Math.round(ms / h) + "h";
1849
+ }
1850
+ if (msAbs >= m) {
1851
+ return Math.round(ms / m) + "m";
1852
+ }
1853
+ if (msAbs >= s) {
1854
+ return Math.round(ms / s) + "s";
1855
+ }
1856
+ return ms + "ms";
1857
+ };
1858
+ var fmtLong = function(ms) {
1859
+ var msAbs = Math.abs(ms);
1860
+ if (msAbs >= d) {
1861
+ return plural(ms, msAbs, d, "day");
1862
+ }
1863
+ if (msAbs >= h) {
1864
+ return plural(ms, msAbs, h, "hour");
1865
+ }
1866
+ if (msAbs >= m) {
1867
+ return plural(ms, msAbs, m, "minute");
1868
+ }
1869
+ if (msAbs >= s) {
1870
+ return plural(ms, msAbs, s, "second");
1871
+ }
1872
+ return ms + " ms";
1873
+ };
1874
+ var plural = function(ms, msAbs, n, name) {
1875
+ var isPlural = msAbs >= n * 1.5;
1876
+ return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
1877
+ };
1878
+ var s = 1000;
1879
+ var m = s * 60;
1880
+ var h = m * 60;
1881
+ var d = h * 24;
1882
+ var w = d * 7;
1883
+ var y = d * 365.25;
1884
+ module.exports = function(val, options) {
1885
+ options = options || {};
1886
+ var type = typeof val;
1887
+ if (type === "string" && val.length > 0) {
1888
+ return parse(val);
1889
+ } else if (type === "number" && isFinite(val)) {
1890
+ return options.long ? fmtLong(val) : fmtShort(val);
1891
+ }
1892
+ throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val));
1893
+ };
1894
+ });
1895
+
1896
+ // bine_modules/commander/lib/sugge
1897
+ var require_common = __commonJS((exports, module) => {
1898
+ var setup = function(env) {
1899
+ createDebug.debug = createDebug;
1900
+ createDebug.default = createDebug;
1901
+ createDebug.coerce = coerce;
1902
+ createDebug.disable = disable;
1903
+ createDebug.enable = enable;
1904
+ createDebug.enabled = enabled;
1905
+ createDebug.humanize = require_ms();
1906
+ createDebug.destroy = destroy;
1907
+ Object.keys(env).forEach((key) => {
1908
+ createDebug[key] = env[key];
1909
+ });
1910
+ createDebug.names = [];
1911
+ createDebug.skips = [];
1912
+ createDebug.formatters = {};
1913
+ function selectColor(namespace) {
1914
+ let hash = 0;
1915
+ for (let i = 0;i < namespace.length; i++) {
1916
+ hash = (hash << 5) - hash + namespace.charCodeAt(i);
1917
+ hash |= 0;
1918
+ }
1919
+ return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
1920
+ }
1921
+ createDebug.selectColor = selectColor;
1922
+ function createDebug(namespace) {
1923
+ let prevTime;
1924
+ let enableOverride = null;
1925
+ let namespacesCache;
1926
+ let enabledCache;
1927
+ function debug(...args) {
1928
+ if (!debug.enabled) {
1929
+ return;
1930
+ }
1931
+ const self = debug;
1932
+ const curr = Number(new Date);
1933
+ const ms = curr - (prevTime || curr);
1934
+ self.diff = ms;
1935
+ self.prev = prevTime;
1936
+ self.curr = curr;
1937
+ prevTime = curr;
1938
+ args[0] = createDebug.coerce(args[0]);
1939
+ if (typeof args[0] !== "string") {
1940
+ args.unshift("%O");
1941
+ }
1942
+ let index = 0;
1943
+ args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
1944
+ if (match === "%%") {
1945
+ return "%";
1946
+ }
1947
+ index++;
1948
+ const formatter = createDebug.formatters[format];
1949
+ if (typeof formatter === "function") {
1950
+ const val = args[index];
1951
+ match = formatter.call(self, val);
1952
+ args.splice(index, 1);
1953
+ index--;
1954
+ }
1955
+ return match;
1956
+ });
1957
+ createDebug.formatArgs.call(self, args);
1958
+ const logFn = self.log || createDebug.log;
1959
+ logFn.apply(self, args);
1960
+ }
1961
+ debug.namespace = namespace;
1962
+ debug.useColors = createDebug.useColors();
1963
+ debug.color = createDebug.selectColor(namespace);
1964
+ debug.extend = extend;
1965
+ debug.destroy = createDebug.destroy;
1966
+ Object.defineProperty(debug, "enabled", {
1967
+ enumerable: true,
1968
+ configurable: false,
1969
+ get: () => {
1970
+ if (enableOverride !== null) {
1971
+ return enableOverride;
1972
+ }
1973
+ if (namespacesCache !== createDebug.namespaces) {
1974
+ namespacesCache = createDebug.namespaces;
1975
+ enabledCache = createDebug.enabled(namespace);
1976
+ }
1977
+ return enabledCache;
1978
+ },
1979
+ set: (v) => {
1980
+ enableOverride = v;
1981
+ }
1982
+ });
1983
+ if (typeof createDebug.init === "function") {
1984
+ createDebug.init(debug);
1985
+ }
1986
+ return debug;
1987
+ }
1988
+ function extend(namespace, delimiter) {
1989
+ const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
1990
+ newDebug.log = this.log;
1991
+ return newDebug;
1992
+ }
1993
+ function enable(namespaces) {
1994
+ createDebug.save(namespaces);
1995
+ createDebug.namespaces = namespaces;
1996
+ createDebug.names = [];
1997
+ createDebug.skips = [];
1998
+ let i;
1999
+ const split = (typeof namespaces === "string" ? namespaces : "").split(/[\s,]+/);
2000
+ const len = split.length;
2001
+ for (i = 0;i < len; i++) {
2002
+ if (!split[i]) {
2003
+ continue;
2004
+ }
2005
+ namespaces = split[i].replace(/\*/g, ".*?");
2006
+ if (namespaces[0] === "-") {
2007
+ createDebug.skips.push(new RegExp("^" + namespaces.slice(1) + "$"));
2008
+ } else {
2009
+ createDebug.names.push(new RegExp("^" + namespaces + "$"));
2010
+ }
2011
+ }
2012
+ }
2013
+ function disable() {
2014
+ const namespaces = [
2015
+ ...createDebug.names.map(toNamespace),
2016
+ ...createDebug.skips.map(toNamespace).map((namespace) => "-" + namespace)
2017
+ ].join(",");
2018
+ createDebug.enable("");
2019
+ return namespaces;
2020
+ }
2021
+ function enabled(name) {
2022
+ if (name[name.length - 1] === "*") {
2023
+ return true;
2024
+ }
2025
+ let i;
2026
+ let len;
2027
+ for (i = 0, len = createDebug.skips.length;i < len; i++) {
2028
+ if (createDebug.skips[i].test(name)) {
2029
+ return false;
2030
+ }
2031
+ }
2032
+ for (i = 0, len = createDebug.names.length;i < len; i++) {
2033
+ if (createDebug.names[i].test(name)) {
2034
+ return true;
2035
+ }
2036
+ }
2037
+ return false;
2038
+ }
2039
+ function toNamespace(regexp) {
2040
+ return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, "*");
2041
+ }
2042
+ function coerce(val) {
2043
+ if (val instanceof Error) {
2044
+ return val.stack || val.message;
2045
+ }
2046
+ return val;
2047
+ }
2048
+ function destroy() {
2049
+ console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
2050
+ }
2051
+ createDebug.enable(createDebug.load());
2052
+ return createDebug;
2053
+ };
2054
+ module.exports = setup;
2055
+ });
2056
+
2057
+ // bine_modules/commander/lib/sugges
2058
+ var require_browser = __commonJS((exports, module) => {
2059
+ var useColors = function() {
2060
+ if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
2061
+ return true;
2062
+ }
2063
+ if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
2064
+ return false;
2065
+ }
2066
+ 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+)/);
2067
+ };
2068
+ var formatArgs = function(args) {
2069
+ args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + exports.humanize(this.diff);
2070
+ if (!this.useColors) {
2071
+ return;
2072
+ }
2073
+ const c = "color: " + this.color;
2074
+ args.splice(1, 0, c, "color: inherit");
2075
+ let index = 0;
2076
+ let lastC = 0;
2077
+ args[0].replace(/%[a-zA-Z%]/g, (match) => {
2078
+ if (match === "%%") {
2079
+ return;
2080
+ }
2081
+ index++;
2082
+ if (match === "%c") {
2083
+ lastC = index;
2084
+ }
2085
+ });
2086
+ args.splice(lastC, 0, c);
2087
+ };
2088
+ var save = function(namespaces) {
2089
+ try {
2090
+ if (namespaces) {
2091
+ exports.storage.setItem("debug", namespaces);
2092
+ } else {
2093
+ exports.storage.removeItem("debug");
2094
+ }
2095
+ } catch (error) {
2096
+ }
2097
+ };
2098
+ var load = function() {
2099
+ let r;
2100
+ try {
2101
+ r = exports.storage.getItem("debug");
2102
+ } catch (error) {
2103
+ }
2104
+ if (!r && typeof process !== "undefined" && ("env" in process)) {
2105
+ r = process.env.DEBUG;
2106
+ }
2107
+ return r;
2108
+ };
2109
+ var localstorage = function() {
2110
+ try {
2111
+ return localStorage;
2112
+ } catch (error) {
2113
+ }
2114
+ };
2115
+ exports.formatArgs = formatArgs;
2116
+ exports.save = save;
2117
+ exports.load = load;
2118
+ exports.useColors = useColors;
2119
+ exports.storage = localstorage();
2120
+ exports.destroy = (() => {
2121
+ let warned = false;
2122
+ return () => {
2123
+ if (!warned) {
2124
+ warned = true;
2125
+ console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
2126
+ }
2127
+ };
2128
+ })();
2129
+ exports.colors = [
2130
+ "#0000CC",
2131
+ "#0000FF",
2132
+ "#0033CC",
2133
+ "#0033FF",
2134
+ "#0066CC",
2135
+ "#0066FF",
2136
+ "#0099CC",
2137
+ "#0099FF",
2138
+ "#00CC00",
2139
+ "#00CC33",
2140
+ "#00CC66",
2141
+ "#00CC99",
2142
+ "#00CCCC",
2143
+ "#00CCFF",
2144
+ "#3300CC",
2145
+ "#3300FF",
2146
+ "#3333CC",
2147
+ "#3333FF",
2148
+ "#3366CC",
2149
+ "#3366FF",
2150
+ "#3399CC",
2151
+ "#3399FF",
2152
+ "#33CC00",
2153
+ "#33CC33",
2154
+ "#33CC66",
2155
+ "#33CC99",
2156
+ "#33CCCC",
2157
+ "#33CCFF",
2158
+ "#6600CC",
2159
+ "#6600FF",
2160
+ "#6633CC",
2161
+ "#6633FF",
2162
+ "#66CC00",
2163
+ "#66CC33",
2164
+ "#9900CC",
2165
+ "#9900FF",
2166
+ "#9933CC",
2167
+ "#9933FF",
2168
+ "#99CC00",
2169
+ "#99CC33",
2170
+ "#CC0000",
2171
+ "#CC0033",
2172
+ "#CC0066",
2173
+ "#CC0099",
2174
+ "#CC00CC",
2175
+ "#CC00FF",
2176
+ "#CC3300",
2177
+ "#CC3333",
2178
+ "#CC3366",
2179
+ "#CC3399",
2180
+ "#CC33CC",
2181
+ "#CC33FF",
2182
+ "#CC6600",
2183
+ "#CC6633",
2184
+ "#CC9900",
2185
+ "#CC9933",
2186
+ "#CCCC00",
2187
+ "#CCCC33",
2188
+ "#FF0000",
2189
+ "#FF0033",
2190
+ "#FF0066",
2191
+ "#FF0099",
2192
+ "#FF00CC",
2193
+ "#FF00FF",
2194
+ "#FF3300",
2195
+ "#FF3333",
2196
+ "#FF3366",
2197
+ "#FF3399",
2198
+ "#FF33CC",
2199
+ "#FF33FF",
2200
+ "#FF6600",
2201
+ "#FF6633",
2202
+ "#FF9900",
2203
+ "#FF9933",
2204
+ "#FFCC00",
2205
+ "#FFCC33"
2206
+ ];
2207
+ exports.log = console.debug || console.log || (() => {
2208
+ });
2209
+ module.exports = require_common()(exports);
2210
+ var { formatters } = module.exports;
2211
+ formatters.j = function(v) {
2212
+ try {
2213
+ return JSON.stringify(v);
2214
+ } catch (error) {
2215
+ return "[UnexpectedJSONParseError]: " + error.message;
2216
+ }
2217
+ };
2218
+ });
2219
+
2220
+ // /home/jim/node_modules/has-flag/index.js
2221
+ var require_has_flag = __commonJS((exports, module) => {
2222
+ module.exports = (flag, argv = process.argv) => {
2223
+ const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
2224
+ const position = argv.indexOf(prefix + flag);
2225
+ const terminatorPosition = argv.indexOf("--");
2226
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
2227
+ };
2228
+ });
2229
+
2230
+ // /home/jim/node_modules/supports-color/index.js
2231
+ var require_supports_color = __commonJS((exports, module) => {
2232
+ var translateLevel = function(level) {
2233
+ if (level === 0) {
2234
+ return false;
2235
+ }
2236
+ return {
2237
+ level,
2238
+ hasBasic: true,
2239
+ has256: level >= 2,
2240
+ has16m: level >= 3
2241
+ };
2242
+ };
2243
+ var supportsColor = function(haveStream, streamIsTTY) {
2244
+ if (forceColor === 0) {
2245
+ return 0;
2246
+ }
2247
+ if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
2248
+ return 3;
2249
+ }
2250
+ if (hasFlag("color=256")) {
2251
+ return 2;
2252
+ }
2253
+ if (haveStream && !streamIsTTY && forceColor === undefined) {
2254
+ return 0;
2255
+ }
2256
+ const min = forceColor || 0;
2257
+ if (env.TERM === "dumb") {
2258
+ return min;
2259
+ }
2260
+ if (process.platform === "win32") {
2261
+ const osRelease = os.release().split(".");
2262
+ if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
2263
+ return Number(osRelease[2]) >= 14931 ? 3 : 2;
2264
+ }
2265
+ return 1;
2266
+ }
2267
+ if ("CI" in env) {
2268
+ if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE"].some((sign) => (sign in env)) || env.CI_NAME === "codeship") {
2269
+ return 1;
2270
+ }
2271
+ return min;
2272
+ }
2273
+ if ("TEAMCITY_VERSION" in env) {
2274
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
2275
+ }
2276
+ if (env.COLORTERM === "truecolor") {
2277
+ return 3;
2278
+ }
2279
+ if ("TERM_PROGRAM" in env) {
2280
+ const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
2281
+ switch (env.TERM_PROGRAM) {
2282
+ case "iTerm.app":
2283
+ return version >= 3 ? 3 : 2;
2284
+ case "Apple_Terminal":
2285
+ return 2;
2286
+ }
2287
+ }
2288
+ if (/-256(color)?$/i.test(env.TERM)) {
2289
+ return 2;
2290
+ }
2291
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
2292
+ return 1;
2293
+ }
2294
+ if ("COLORTERM" in env) {
2295
+ return 1;
2296
+ }
2297
+ return min;
2298
+ };
2299
+ var getSupportLevel = function(stream) {
2300
+ const level = supportsColor(stream, stream && stream.isTTY);
2301
+ return translateLevel(level);
2302
+ };
2303
+ var os = import.meta.require("os");
2304
+ var tty = import.meta.require("tty");
2305
+ var hasFlag = require_has_flag();
2306
+ var { env } = process;
2307
+ var forceColor;
2308
+ if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
2309
+ forceColor = 0;
2310
+ } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
2311
+ forceColor = 1;
2312
+ }
2313
+ if ("FORCE_COLOR" in env) {
2314
+ if (env.FORCE_COLOR === "true") {
2315
+ forceColor = 1;
2316
+ } else if (env.FORCE_COLOR === "false") {
2317
+ forceColor = 0;
2318
+ } else {
2319
+ forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
2320
+ }
2321
+ }
2322
+ module.exports = {
2323
+ supportsColor: getSupportLevel,
2324
+ stdout: translateLevel(supportsColor(true, tty.isatty(1))),
2325
+ stderr: translateLevel(supportsColor(true, tty.isatty(2)))
2326
+ };
2327
+ });
2328
+
2329
+ // bine_modules/commander/lib/sug
2330
+ var require_node = __commonJS((exports, module) => {
2331
+ var useColors = function() {
2332
+ return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
2333
+ };
2334
+ var formatArgs = function(args) {
2335
+ const { namespace: name, useColors: useColors2 } = this;
2336
+ if (useColors2) {
2337
+ const c = this.color;
2338
+ const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
2339
+ const prefix = ` ${colorCode};1m${name} \x1B[0m`;
2340
+ args[0] = prefix + args[0].split("\n").join("\n" + prefix);
2341
+ args.push(colorCode + "m+" + exports.humanize(this.diff) + "\x1B[0m");
2342
+ } else {
2343
+ args[0] = getDate() + name + " " + args[0];
2344
+ }
2345
+ };
2346
+ var getDate = function() {
2347
+ if (exports.inspectOpts.hideDate) {
2348
+ return "";
2349
+ }
2350
+ return new Date().toISOString() + " ";
2351
+ };
2352
+ var log = function(...args) {
2353
+ return process.stderr.write(util.format(...args) + "\n");
2354
+ };
2355
+ var save = function(namespaces) {
2356
+ if (namespaces) {
2357
+ process.env.DEBUG = namespaces;
2358
+ } else {
2359
+ delete process.env.DEBUG;
2360
+ }
2361
+ };
2362
+ var load = function() {
2363
+ return process.env.DEBUG;
2364
+ };
2365
+ var init = function(debug) {
2366
+ debug.inspectOpts = {};
2367
+ const keys = Object.keys(exports.inspectOpts);
2368
+ for (let i = 0;i < keys.length; i++) {
2369
+ debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
2370
+ }
2371
+ };
2372
+ var tty = import.meta.require("tty");
2373
+ var util = import.meta.require("util");
2374
+ exports.init = init;
2375
+ exports.log = log;
2376
+ exports.formatArgs = formatArgs;
2377
+ exports.save = save;
2378
+ exports.load = load;
2379
+ exports.useColors = useColors;
2380
+ exports.destroy = util.deprecate(() => {
2381
+ }, "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
2382
+ exports.colors = [6, 2, 3, 4, 5, 1];
2383
+ try {
2384
+ const supportsColor = require_supports_color();
2385
+ if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
2386
+ exports.colors = [
2387
+ 20,
2388
+ 21,
2389
+ 26,
2390
+ 27,
2391
+ 32,
2392
+ 33,
2393
+ 38,
2394
+ 39,
2395
+ 40,
2396
+ 41,
2397
+ 42,
2398
+ 43,
2399
+ 44,
2400
+ 45,
2401
+ 56,
2402
+ 57,
2403
+ 62,
2404
+ 63,
2405
+ 68,
2406
+ 69,
2407
+ 74,
2408
+ 75,
2409
+ 76,
2410
+ 77,
2411
+ 78,
2412
+ 79,
2413
+ 80,
2414
+ 81,
2415
+ 92,
2416
+ 93,
2417
+ 98,
2418
+ 99,
2419
+ 112,
2420
+ 113,
2421
+ 128,
2422
+ 129,
2423
+ 134,
2424
+ 135,
2425
+ 148,
2426
+ 149,
2427
+ 160,
2428
+ 161,
2429
+ 162,
2430
+ 163,
2431
+ 164,
2432
+ 165,
2433
+ 166,
2434
+ 167,
2435
+ 168,
2436
+ 169,
2437
+ 170,
2438
+ 171,
2439
+ 172,
2440
+ 173,
2441
+ 178,
2442
+ 179,
2443
+ 184,
2444
+ 185,
2445
+ 196,
2446
+ 197,
2447
+ 198,
2448
+ 199,
2449
+ 200,
2450
+ 201,
2451
+ 202,
2452
+ 203,
2453
+ 204,
2454
+ 205,
2455
+ 206,
2456
+ 207,
2457
+ 208,
2458
+ 209,
2459
+ 214,
2460
+ 215,
2461
+ 220,
2462
+ 221
2463
+ ];
2464
+ }
2465
+ } catch (error) {
2466
+ }
2467
+ exports.inspectOpts = Object.keys(process.env).filter((key) => {
2468
+ return /^debug_/i.test(key);
2469
+ }).reduce((obj, key) => {
2470
+ const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
2471
+ return k.toUpperCase();
2472
+ });
2473
+ let val = process.env[key];
2474
+ if (/^(yes|on|true|enabled)$/i.test(val)) {
2475
+ val = true;
2476
+ } else if (/^(no|off|false|disabled)$/i.test(val)) {
2477
+ val = false;
2478
+ } else if (val === "null") {
2479
+ val = null;
2480
+ } else {
2481
+ val = Number(val);
2482
+ }
2483
+ obj[prop] = val;
2484
+ return obj;
2485
+ }, {});
2486
+ module.exports = require_common()(exports);
2487
+ var { formatters } = module.exports;
2488
+ formatters.o = function(v) {
2489
+ this.inspectOpts.colors = this.useColors;
2490
+ return util.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
2491
+ };
2492
+ formatters.O = function(v) {
2493
+ this.inspectOpts.colors = this.useColors;
2494
+ return util.inspect(v, this.inspectOpts);
2495
+ };
2496
+ });
2497
+
2498
+ // bine_modules/commander/lib/sugg
2499
+ var require_src = __commonJS((exports, module) => {
2500
+ if (typeof process === "undefined" || process.type === "renderer" || false || process.__nwjs) {
2501
+ module.exports = require_browser();
2502
+ } else {
2503
+ module.exports = require_node();
2504
+ }
2505
+ });
2506
+
2507
+ // bine_modules/commander/lib/sug
1787
2508
  var import_ = __toESM(require_commander(), 1);
1788
2509
  var {
1789
2510
  program,
@@ -1799,7 +2520,36 @@ var {
1799
2520
  Help
1800
2521
  } = import_.default;
1801
2522
 
1802
- // lib/spawn.ts
2523
+ // bine_modules/c
2524
+ import path from "path";
2525
+ import fs from "fs";
2526
+ function findPackageJson() {
2527
+ const cwd = import.meta.dir;
2528
+ let dir = cwd;
2529
+ while (dir !== "/") {
2530
+ const packageJson = path.join(dir, "package.json");
2531
+ if (fs.existsSync(packageJson)) {
2532
+ return packageJson;
2533
+ }
2534
+ dir = path.dirname(dir);
2535
+ }
2536
+ return null;
2537
+ }
2538
+ async function getPackageJson() {
2539
+ const packagePath = findPackageJson();
2540
+ if (!packagePath) {
2541
+ throw new Error(`No package.json found in ${import.meta.dir} or any parent directory`);
2542
+ }
2543
+ const packageJsonText = fs.readFileSync(packagePath, "utf8");
2544
+ return JSON.parse(packageJsonText);
2545
+ }
2546
+ async function getPackageVersion() {
2547
+ const packageJson = await packageJsonPromise;
2548
+ return packageJson.version;
2549
+ }
2550
+ var packageJsonPromise = getPackageJson();
2551
+
2552
+ // bine_modules
1803
2553
  async function spawn(args, options = defaultOptions) {
1804
2554
  const proc = Bun.spawn(args, { stdout: "pipe", stderr: "pipe" });
1805
2555
  const stdout = new Response(proc.stdout);
@@ -1824,7 +2574,7 @@ var defaultOptions = {
1824
2574
  expectQuiet: false
1825
2575
  };
1826
2576
 
1827
- // lib/git.ts
2577
+ // bine_modul
1828
2578
  async function getConfig(key) {
1829
2579
  return doCommand(["git", "config", "--get", key]);
1830
2580
  }
@@ -1838,29 +2588,126 @@ async function getRemote() {
1838
2588
  return doCommand(["git", "ls-remote", "--get-url", "origin"]);
1839
2589
  }
1840
2590
 
1841
- // lib/jira.ts
1842
- async function getJiraConfig() {
1843
- const host = await getConfig("jira.host");
2591
+ // bine_modules/command
2592
+ async function getGitlabConfig() {
2593
+ const host = await hostP;
1844
2594
  if (!host)
1845
- throw new Error("jira.host not in git config");
1846
- const user = await getConfig("jira.user") || await getConfig("user.email");
2595
+ throw new Error("gitlab.host not in git config");
2596
+ const user = await userP;
1847
2597
  if (!user)
1848
- throw new Error("jira.user or user.email not in git config");
1849
- const pat = await getConfig("jira.pat");
1850
- if (!pat)
1851
- throw new Error("jira.pat not in git config");
1852
- const token = Buffer.from(`${user}:${pat}`).toString("base64");
1853
- return { host, token };
2598
+ throw new Error("user.email not in git config");
2599
+ const token = await tokenP;
2600
+ if (!token)
2601
+ throw new Error("gitlab.token not in git config");
2602
+ return { host, user, token };
1854
2603
  }
1855
- async function get(endpoint) {
2604
+ var hostP = getConfig("gitlab.host");
2605
+ var userP = getConfig("user.email");
2606
+ var tokenP = getConfig("gitlab.token");
2607
+
2608
+ // bine_modules/comm
2609
+ var getNextLink = function(link) {
2610
+ if (!link) {
2611
+ return;
2612
+ }
2613
+ const regex = /<([^>]+)>; rel="next"/;
2614
+ const match = link.match(regex);
2615
+ const next = match ? match[1] : undefined;
2616
+ return next;
2617
+ };
2618
+ async function gitlabApi(endpoint) {
2619
+ if (endpoint.startsWith("/")) {
2620
+ console.warn(`gitlabApi: endpoint ${endpoint} starts with /, removing it`);
2621
+ endpoint = endpoint.slice(1);
2622
+ }
1856
2623
  const method = "GET";
1857
- const { host, token } = await getJiraConfig();
1858
- const base = `https://${host}/rest/api/3`;
2624
+ const { host, token } = await getGitlabConfig();
2625
+ const base = `https://${host}/api/v4`;
2626
+ const requested = 100;
2627
+ const sep = endpoint.includes("?") ? "&" : "?";
2628
+ const uri = `${base}/${endpoint}${sep}per_page=${requested}`;
2629
+ const headers = new Headers;
2630
+ headers.append("Accept", "application/json");
2631
+ headers.append("Private-Token", token);
2632
+ const options = {
2633
+ method,
2634
+ headers
2635
+ };
2636
+ let request = new Request(uri, options);
2637
+ const response = await fetch(request);
2638
+ let link = getNextLink(response.headers.get("Link"));
2639
+ let partial = await response.json();
2640
+ let result = partial;
2641
+ while (partial.length == requested && link) {
2642
+ let request2 = new Request(link, options);
2643
+ const next_response = await fetch(request2);
2644
+ link = getNextLink(next_response.headers.get("Link"));
2645
+ partial = await next_response.json();
2646
+ result = result.concat(partial);
2647
+ }
2648
+ return result;
2649
+ }
2650
+ // bine_modules/comman
2651
+ async function getGroups() {
2652
+ return await gitlabApi(`groups`);
2653
+ }
2654
+ // bine_modules/commande
2655
+ import path2 from "path";
2656
+
2657
+ // bine_modules/comma
2658
+ var import_debug = __toESM(require_src(), 1);
2659
+ var dlog = import_debug.default("gitlab");
2660
+
2661
+ // bine_modules/commande
2662
+ async function getProjects(match) {
2663
+ let search = "";
2664
+ if (match) {
2665
+ const m = encodeURIComponent(match);
2666
+ search = `&search=${m}`;
2667
+ }
2668
+ const projects = await gitlabApi(`projects?membership=true&simple=true${search}`);
2669
+ if (!projects) {
2670
+ throw new Error(`No projects!`);
2671
+ } else if (!Array.isArray(projects)) {
2672
+ console.log(projects);
2673
+ throw new Error(`Projects is not an array!`);
2674
+ }
2675
+ const projs = projects;
2676
+ const filtered = projs.filter((p) => {
2677
+ return p.path_with_namespace.toLowerCase().includes(match.toLowerCase());
2678
+ });
2679
+ return filtered;
2680
+ }
2681
+ async function findProject(ssh_url) {
2682
+ const parts = ssh_url.split(":");
2683
+ if (parts.length != 2) {
2684
+ throw new Error(`${ssh_url} is invalid, could not be split into two parts at :`);
2685
+ }
2686
+ const name = path2.basename(parts[1], ".git");
2687
+ const projects = await getProjects(name);
2688
+ const project = projects.find((p) => {
2689
+ return p.ssh_url_to_repo === ssh_url;
2690
+ });
2691
+ return project;
2692
+ }
2693
+ async function projectScopedGet(endpoint) {
2694
+ if (endpoint.startsWith("/")) {
2695
+ console.warn(`gitlabApi: endpoint ${endpoint} starts with /, removing it`);
2696
+ endpoint = endpoint.slice(1);
2697
+ }
2698
+ const method = "GET";
2699
+ const { host, token } = await getGitlabConfig();
2700
+ const remote = await getRemote();
2701
+ const project = await findProject(remote);
2702
+ if (!project) {
2703
+ throw new Error(`Could not find project for remote ${remote}`);
2704
+ }
2705
+ const base = `https://${host}/api/v4/projects/${project.id}`;
1859
2706
  const uri = `${base}/${endpoint}`;
1860
- const auth = `Basic ${token}`;
2707
+ dlog(`projectScopedGet uri: ${uri}`);
1861
2708
  const headers = new Headers;
1862
- headers.append("Authorization", auth);
1863
2709
  headers.append("Accept", "application/json");
2710
+ headers.append("Private-Token", token);
1864
2711
  const options = {
1865
2712
  method,
1866
2713
  headers
@@ -1869,167 +2716,182 @@ async function get(endpoint) {
1869
2716
  const response = await fetch(request);
1870
2717
  return await response.json();
1871
2718
  }
1872
- async function getIssue(issue) {
1873
- return await get(`/issue/${issue}`);
2719
+
2720
+ // bine_modules/comma
2721
+ async function whoami() {
2722
+ return await gitlabApi("user");
1874
2723
  }
1875
- async function getMyself() {
1876
- return await get("/myself");
2724
+
2725
+ // bine_modules/commander/lib/
2726
+ async function getMergeRequest(id) {
2727
+ return await projectScopedGet(`merge_requests/${id}`);
1877
2728
  }
1878
- async function myUnresolvedIssues() {
1879
- const myself = await getMyself();
1880
- const myselfId = myself.accountId;
1881
- const jql = `assignee = ${myselfId} AND resolution = Unresolved`;
1882
- const issues = await get(`/search?jql=${encodeURIComponent(jql)}`);
1883
- return issues.issues;
2729
+ async function getMyMergeRequestsInProgress() {
2730
+ const me = await whoami();
2731
+ return await gitlabApi(`merge_requests?state=opened&author_id=${me.id}`);
1884
2732
  }
1885
-
1886
- // lib/is_main.ts
1887
- import path from "path";
2733
+ async function getMyMergeRequestsToReview() {
2734
+ const me = await whoami();
2735
+ return await gitlabApi(`merge_requests?state=opened&reviewer_id=${me.id}`);
2736
+ }
2737
+ // bine_modules/commander/
2738
+ async function getNamespaces() {
2739
+ return await gitlabApi(`namespaces`);
2740
+ }
2741
+ // bine_modules/commander
2742
+ async function getProjectPipelines(options) {
2743
+ const { days, status } = options;
2744
+ const me = await whoami();
2745
+ const username = me.username;
2746
+ const date = new Date;
2747
+ const pastDate = date.getDate() - days;
2748
+ date.setDate(pastDate);
2749
+ const updated = date.toISOString();
2750
+ dlog(`updated: ${updated}`);
2751
+ return await projectScopedGet(`pipelines?status=${status}&username=${username}&updated_after=${updated}`);
2752
+ }
2753
+ // bine_modules/c
2754
+ import path3 from "path";
2755
+ var justBase = function(filename) {
2756
+ const ext = path3.extname(filename);
2757
+ const base = path3.basename(filename, ext);
2758
+ return base;
2759
+ };
1888
2760
  function isMain(self) {
1889
- const exe = path.basename(Bun.argv[1]).split(".")[0];
1890
- return exe == self || import.meta.main;
2761
+ const arg1 = Bun.argv[1];
2762
+ const argv1Base = justBase(arg1);
2763
+ const selfBase = justBase(self);
2764
+ const result = argv1Base === selfBase;
2765
+ return result;
1891
2766
  }
1892
2767
 
1893
- // bin/git-jira-issues.ts
2768
+ // bine_modules/commander/lib/
1894
2769
  function create() {
1895
2770
  const program2 = new Command;
1896
- program2.name("issues").description("List your unresolved issues").action(async (options) => {
1897
- const issues = await myUnresolvedIssues();
1898
- console.log(`You have ${issues.length} unresolved issues`);
1899
- issues.forEach((issue) => {
1900
- console.log(`${issue.key}: ${issue.fields.summary}`);
1901
- });
2771
+ program2.version(version).name("active").description("List my MRs in progress").option("-v, --verbose", "Verbose output").action(async (options) => {
2772
+ const merges = await getMyMergeRequestsInProgress();
2773
+ if (!merges) {
2774
+ console.error(`No MRs!`);
2775
+ process.exit(1);
2776
+ }
2777
+ if (options.verbose) {
2778
+ console.log(merges);
2779
+ process.exit(0);
2780
+ } else {
2781
+ const filtered = merges.map((m) => {
2782
+ const { title, web_url, source_branch, target_branch } = m;
2783
+ return { title, web_url, source_branch, target_branch };
2784
+ });
2785
+ console.log(filtered);
2786
+ }
1902
2787
  });
1903
2788
  return program2;
1904
2789
  }
1905
- if (isMain("git-jira-issues")) {
2790
+ var version = await getPackageVersion();
2791
+ var git_lab_merge_active_default = create;
2792
+ if (isMain("git-lab-merge-active")) {
1906
2793
  await create().parseAsync(Bun.argv);
1907
2794
  }
1908
- var git_jira_issues_default = create;
1909
2795
 
1910
- // bin/git-jira-start.ts
1911
- var toKebab = function(s) {
1912
- return s.replace(/([a-z]+)([A-Z]+)/g, "$1_2").toLowerCase().replace(/(\W+)/g, "-").replace(/-$/, "");
1913
- };
2796
+ // bine_modules/commander/li
1914
2797
  function create2() {
1915
2798
  const program2 = new Command;
1916
- program2.name("start").description("Start working on an issue by creating a branch").argument("issue", "Issue ID").action(async (issueId) => {
1917
- const issue = await getIssue(issueId);
1918
- if (!issue) {
1919
- console.error(`Issue ${issueId} not found`);
1920
- process.exit(1);
2799
+ program2.version(version2).name("todo").description("MRs needing my review").option("-v, --verbose", "Verbose output").action(async (options) => {
2800
+ const mrs = await getMyMergeRequestsToReview();
2801
+ if (options.verbose) {
2802
+ console.log(mrs);
2803
+ } else {
2804
+ const filtered = mrs.map((mr) => {
2805
+ const { title, web_url, source_branch, target_branch } = mr;
2806
+ return { title, web_url, source_branch, target_branch };
2807
+ });
2808
+ console.log(filtered);
1921
2809
  }
1922
- const summary = issue.fields.summary;
1923
- const branchName = `${issueId}-${toKebab(summary)}`;
1924
- await createBranch(branchName);
1925
2810
  });
1926
2811
  return program2;
1927
2812
  }
1928
- if (isMain("git-jira-issues")) {
2813
+ var version2 = await getPackageVersion();
2814
+ var git_lab_merge_todo_default = create2;
2815
+ if (isMain("git-lab-merge-todo")) {
1929
2816
  await create2().parseAsync(Bun.argv);
1930
2817
  }
1931
- var git_jira_start_default = create2;
1932
2818
 
1933
- // bin/git-jira-issue.ts
2819
+ // bine_modules/commander/lib
2820
+ async function getMergeTrains() {
2821
+ return await projectScopedGet(`merge_trains`);
2822
+ }
2823
+
2824
+ // bine_modules/commander/lib/sugg
1934
2825
  function create3() {
1935
2826
  const program2 = new Command;
1936
- program2.name("issue").description("Get information about an issue").argument("issue", "Issue ID").option("-v, --verbose", "Verbose output").option("-u, --url", "Show the URL of the issue").action(async (issueId, options) => {
1937
- const { host } = await getJiraConfig();
1938
- const issue = await getIssue(issueId);
1939
- if (!issue) {
1940
- console.error(`Issue ${issueId} not found`);
1941
- process.exit(1);
1942
- }
1943
- if (options.verbose) {
1944
- console.log(issue);
1945
- process.exit(0);
1946
- }
1947
- if (options.url) {
1948
- console.log(`https://${host}/browse/${issueId}`);
1949
- }
2827
+ program2.version(version3).name("list").description("List merge trains for the current project").action(async () => {
2828
+ const trains = await getMergeTrains();
2829
+ console.log(trains);
1950
2830
  });
1951
2831
  return program2;
1952
2832
  }
1953
- if (isMain("git-jira-issue")) {
2833
+ var version3 = await getPackageVersion();
2834
+ var git_lab_merge_train_list_default = create3;
2835
+ if (isMain("git-lab-merge-train-list")) {
1954
2836
  await create3().parseAsync(Bun.argv);
1955
2837
  }
1956
- var git_jira_issue_default = create3;
1957
2838
 
1958
- // bin/git-jira.ts
2839
+ // bine_modules/commander/lib
1959
2840
  function create4() {
1960
2841
  const program2 = new Command;
1961
- program2.name("jira").description("A set of commands for working with Jira").addCommand(git_jira_start_default()).addCommand(git_jira_issue_default()).addCommand(git_jira_issues_default());
2842
+ program2.version(version4).name("train").description("Commands for working with GitLab merge trains.").addCommand(git_lab_merge_train_list_default()).action(() => program2.help());
1962
2843
  return program2;
1963
2844
  }
1964
- if (isMain("git-jira")) {
2845
+ var version4 = await getPackageVersion();
2846
+ var git_lab_merge_train_default = create4;
2847
+ if (isMain("git-lab-merge-train")) {
1965
2848
  await create4().parseAsync(Bun.argv);
1966
2849
  }
1967
- var git_jira_default = create4;
1968
2850
 
1969
- // lib/gitlab.ts
1970
- import path2 from "path";
1971
- async function getGitlabConfig() {
1972
- const host = await getConfig("gitlab.host");
1973
- if (!host)
1974
- throw new Error("gitlab.host not in git config");
1975
- const user = await getConfig("user.email");
1976
- if (!user)
1977
- throw new Error("user.email not in git config");
1978
- const token = await getConfig("gitlab.token");
1979
- if (!token)
1980
- throw new Error("gitlab.token not in git config");
1981
- return { host, user, token };
2851
+ // bine_modules/command
2852
+ function create5() {
2853
+ const program2 = new Command;
2854
+ program2.version(version5).name("merge").description("Commands for working with GitLab merge requests").addCommand(git_lab_merge_active_default()).addCommand(git_lab_merge_todo_default()).addCommand(git_lab_merge_train_default()).action(() => program2.help());
2855
+ return program2;
1982
2856
  }
1983
- async function get2(endpoint) {
1984
- const method = "GET";
1985
- const { host, token } = await getGitlabConfig();
1986
- const base = `https://${host}/api/v4`;
1987
- const uri = `${base}/${endpoint}`;
1988
- const headers = new Headers;
1989
- headers.append("Accept", "application/json");
1990
- headers.append("Private-Token", token);
1991
- const options = {
1992
- method,
1993
- headers
1994
- };
1995
- const request = new Request(uri, options);
1996
- const response = await fetch(request);
1997
- return await response.json();
2857
+ var version5 = await getPackageVersion();
2858
+ var git_lab_merge_default = create5;
2859
+ if (isMain("git-lab-merge")) {
2860
+ await create5().parseAsync(Bun.argv);
1998
2861
  }
1999
- async function whoami() {
2000
- return await get2("/user");
2862
+
2863
+ // bine_modules/commander/lib/su
2864
+ function create6() {
2865
+ const program2 = new Command;
2866
+ program2.version(version6).name("list").description("List namespaces for the current user").action(async () => {
2867
+ const namespaces = await getNamespaces();
2868
+ console.log(namespaces);
2869
+ });
2870
+ return program2;
2001
2871
  }
2002
- async function getProjects(paths) {
2003
- let search = "";
2004
- if (paths.length > 0) {
2005
- search = "&search=" + paths.join(",");
2006
- }
2007
- return await get2(`/projects?visibility=private&membership=true&simple=true${search}`);
2872
+ var version6 = await getPackageVersion();
2873
+ var git_lab_namespace_list_default = create6;
2874
+ if (isMain("git-lab-namespace-list")) {
2875
+ await create6().parseAsync(Bun.argv);
2008
2876
  }
2009
- async function findProject(ssh_url) {
2010
- const parts = ssh_url.split(":");
2011
- if (parts.length != 2) {
2012
- throw new Error(`${ssh_url} is invalid, could not be split into two parts at :`);
2013
- }
2014
- const name = path2.basename(parts[1], ".git");
2015
- const projects = await getProjects([name]);
2016
- const project = projects.find((p) => {
2017
- return p.ssh_url_to_repo === ssh_url;
2018
- });
2019
- if (!project) {
2020
- throw new Error(`No project with ssh_url_to_repo ${ssh_url} found`);
2021
- }
2022
- return project;
2877
+
2878
+ // bine_modules/commander/l
2879
+ function create7() {
2880
+ const program2 = new Command;
2881
+ program2.version(version7).name("namespace").description("Commands for working with GitLab namespaces").addCommand(git_lab_namespace_list_default()).action(() => program2.help());
2882
+ return program2;
2023
2883
  }
2024
- async function getMergeRequest(id) {
2025
- return await get2(`/merge_requests/${id}`);
2884
+ var version7 = await getPackageVersion();
2885
+ var git_lab_namespace_default = create7;
2886
+ if (isMain("git-lab-namespace")) {
2887
+ await create7().parseAsync(Bun.argv);
2026
2888
  }
2027
2889
 
2028
- // bin/git-lab-projects.ts
2029
- function create5() {
2890
+ // bine_modules/commander/lib/
2891
+ function create8() {
2030
2892
  const program2 = new Command;
2031
- program2.name("projects").description("List projects for current user").option("-v, --verbose", "Verbose output").argument("[path...]", "Namespace paths to filter by").action(async (paths, options) => {
2032
- const projects = await getProjects(paths);
2893
+ program2.version(version8).name("list").description("List projects for current user").option("-v, --verbose", "Verbose output").option("-m, --match <match>", "Match projects with paths containing <match>").action(async (options) => {
2894
+ const projects = await getProjects(options.match);
2033
2895
  if (!projects) {
2034
2896
  console.error(`No projects!`);
2035
2897
  process.exit(1);
@@ -2046,77 +2908,303 @@ function create5() {
2046
2908
  });
2047
2909
  return program2;
2048
2910
  }
2049
- if (isMain("git-lab-projects")) {
2050
- await create5().parseAsync(Bun.argv);
2911
+ var version8 = await getPackageVersion();
2912
+ var git_lab_project_list_default = create8;
2913
+ if (isMain("git-lab-project-list")) {
2914
+ await create8().parseAsync(Bun.argv);
2051
2915
  }
2052
- var git_lab_projects_default = create5;
2053
2916
 
2054
- // bin/git-bump.ts
2055
- function create6() {
2917
+ // bine_modules/commander/lib/sugg
2918
+ function create9() {
2919
+ const program2 = new Command;
2920
+ program2.version(version9).name("whereami").description("Show current project based on current directory").option("-v, --verbose", "Verbose output").action(async (options) => {
2921
+ const ssh_url = await getRemote();
2922
+ if (!ssh_url) {
2923
+ console.error(`No remote!`);
2924
+ process.exit(1);
2925
+ }
2926
+ console.log(`Remote: ${ssh_url}`);
2927
+ const project7 = await findProject(ssh_url);
2928
+ if (!project7) {
2929
+ console.error(`No project!`);
2930
+ process.exit(1);
2931
+ }
2932
+ if (options.verbose) {
2933
+ console.log(project7);
2934
+ } else {
2935
+ const { id, name, path_with_namespace, ssh_url_to_repo } = project7;
2936
+ console.log({ id, name, path_with_namespace, ssh_url_to_repo });
2937
+ }
2938
+ });
2939
+ return program2;
2940
+ }
2941
+ var version9 = await getPackageVersion();
2942
+ var git_lab_project_whereami_default = create9;
2943
+ if (isMain("git-lab-project-whereami")) {
2944
+ await create9().parseAsync(Bun.argv);
2945
+ }
2946
+
2947
+ // bine_modules/commander
2948
+ function create10() {
2949
+ const program2 = new Command;
2950
+ program2.version(version10).name("projects").description("Commands for working with GitLab projects").addCommand(git_lab_project_list_default()).addCommand(git_lab_project_whereami_default()).action(() => {
2951
+ program2.help();
2952
+ });
2953
+ return program2;
2954
+ }
2955
+ var version10 = await getPackageVersion();
2956
+ var git_lab_project_default = create10;
2957
+ if (isMain("git-lab-project")) {
2958
+ await create10().parseAsync(Bun.argv);
2959
+ }
2960
+
2961
+ // bine_modules/co
2962
+ function create11() {
2056
2963
  const program2 = new Command;
2057
- program2.name("bump").description("Bump the version number in the current branch").action(async () => {
2964
+ program2.version(version11).name("bump").description("Bump the version number in the current branch").action(async () => {
2058
2965
  const currentBranch = await getCurrentBranch();
2059
2966
  let stem = currentBranch;
2060
- let version = 1;
2967
+ let version11 = 1;
2061
2968
  const match = currentBranch.match(/^(.+)[-\.]v(\d+)$/);
2062
2969
  if (match) {
2063
2970
  stem = match[1];
2064
- version = parseInt(match[2]) + 1;
2971
+ version11 = parseInt(match[2]) + 1;
2065
2972
  }
2066
- const nextBranch = `${stem}.v${version}`;
2973
+ const nextBranch = `${stem}.v${version11}`;
2067
2974
  await createBranch(nextBranch);
2068
2975
  });
2069
2976
  return program2;
2070
2977
  }
2978
+ var version11 = await getPackageVersion();
2979
+ var git_bump_default = create11;
2071
2980
  if (isMain("git-bump")) {
2072
- await create6().parseAsync(Bun.argv);
2981
+ await create11().parseAsync(Bun.argv);
2073
2982
  }
2074
- var git_bump_default = create6;
2075
2983
 
2076
- // bin/git-lab-whoami.ts
2077
- function create7() {
2984
+ // bine_module
2985
+ async function getJiraConfig() {
2986
+ const host = await getConfig("jira.host");
2987
+ if (!host)
2988
+ throw new Error("jira.host not in git config");
2989
+ const user4 = await getConfig("jira.user") || await getConfig("user.email");
2990
+ if (!user4)
2991
+ throw new Error("jira.user or user.email not in git config");
2992
+ const pat = await getConfig("jira.pat");
2993
+ if (!pat)
2994
+ throw new Error("jira.pat not in git config");
2995
+ const token = Buffer.from(`${user4}:${pat}`).toString("base64");
2996
+ return { host, token };
2997
+ }
2998
+ async function jiraApi(endpoint) {
2999
+ if (endpoint.startsWith("/")) {
3000
+ console.warn(`jiraApi: endpoint ${endpoint} starts with /`);
3001
+ endpoint = endpoint.slice(1);
3002
+ }
3003
+ const method = "GET";
3004
+ const { host, token } = await getJiraConfig();
3005
+ const uri = `https://${host}/rest/api/3/${endpoint}`;
3006
+ const auth = `Basic ${token}`;
3007
+ const headers = new Headers;
3008
+ headers.append("Authorization", auth);
3009
+ headers.append("Accept", "application/json");
3010
+ const options = {
3011
+ method,
3012
+ headers
3013
+ };
3014
+ const request = new Request(uri, options);
3015
+ const response = await fetch(request);
3016
+ const result = await response.json();
3017
+ return result;
3018
+ }
3019
+ async function getIssue(issue) {
3020
+ const result = await jiraApi(`issue/${issue}`);
3021
+ return result;
3022
+ }
3023
+ async function getMyself() {
3024
+ return await jiraApi("/myself");
3025
+ }
3026
+ async function myUnresolvedIssues() {
3027
+ const myself = await getMyself();
3028
+ const myselfId = myself.accountId;
3029
+ const jql = `assignee = ${myselfId} AND resolution = Unresolved`;
3030
+ const issues = await jiraApi(`/search?jql=${encodeURIComponent(jql)}`);
3031
+ return issues.issues;
3032
+ }
3033
+
3034
+ // bine_modules/commande
3035
+ var toKebab = function(s) {
3036
+ return s.replace(/([a-z]+)([A-Z]+)/g, "$1_2").toLowerCase().replace(/(\W+)/g, "-").replace(/-$/, "");
3037
+ };
3038
+ function create12() {
2078
3039
  const program2 = new Command;
2079
- program2.name("whoami").description("get GitLab user information for current user").option("-v, --verbose", "Verbose output").action(async (options) => {
2080
- const user = await whoami();
2081
- if (!user) {
3040
+ program2.version(version12).name("start").description("Start working on an issue by creating a branch").argument("issue", "Issue ID").action(async (issueId) => {
3041
+ const issue = await getIssue(issueId);
3042
+ if (!issue) {
3043
+ console.error(`Issue ${issueId} not found`);
3044
+ process.exit(1);
3045
+ }
3046
+ const summary = issue.fields.summary;
3047
+ const branchName = `${issueId}-${toKebab(summary)}`;
3048
+ await createBranch(branchName);
3049
+ });
3050
+ return program2;
3051
+ }
3052
+ var version12 = await getPackageVersion();
3053
+ var git_jira_start_default = create12;
3054
+ if (isMain("git-jira-start")) {
3055
+ await create12().parseAsync(Bun.argv);
3056
+ }
3057
+
3058
+ // bine_modules/commander/li
3059
+ function create13() {
3060
+ const program2 = new Command;
3061
+ program2.version(version13).name("list").description("List groups for the current user").option("-v, --verbose", "Verbose output").action(async (options) => {
3062
+ const groups = await getGroups();
3063
+ if (options.verbose)
3064
+ console.log(groups);
3065
+ else {
3066
+ const filtered = groups.map((g) => {
3067
+ const { id, name, full_path } = g;
3068
+ return { id, name, full_path };
3069
+ });
3070
+ console.log(filtered);
3071
+ }
3072
+ });
3073
+ return program2;
3074
+ }
3075
+ var version13 = await getPackageVersion();
3076
+ var git_lab_group_list_default = create13;
3077
+ if (isMain("git-lab-group-list")) {
3078
+ await create13().parseAsync(Bun.argv);
3079
+ }
3080
+
3081
+ // bine_modules/commander/lib
3082
+ function create14() {
3083
+ const program2 = new Command;
3084
+ program2.version(version14).name("list").description("List your unresolved issues").action(async () => {
3085
+ const issues = await myUnresolvedIssues();
3086
+ console.log(`You have ${issues.length} unresolved issues`);
3087
+ issues.forEach((issue) => {
3088
+ console.log(`${issue.key}: ${issue.fields.summary}`);
3089
+ });
3090
+ });
3091
+ return program2;
3092
+ }
3093
+ var version14 = await getPackageVersion();
3094
+ var git_jira_issue_list_default = create14;
3095
+ if (isMain("git-jira-issue-list")) {
3096
+ await create14().parseAsync(Bun.argv);
3097
+ }
3098
+
3099
+ // bine_modules/commander/lib
3100
+ function create15() {
3101
+ const program2 = new Command;
3102
+ program2.version(version15).name("show").description("Show information about one issue").argument("issue", "Issue ID").option("-v, --verbose", "Verbose output").action(async (issueId, options) => {
3103
+ const issue = await getIssue(issueId);
3104
+ if (!issue) {
3105
+ console.error(`Issue ${issueId} not found`);
3106
+ process.exit(1);
3107
+ }
3108
+ if (options.verbose) {
3109
+ console.log(issue);
3110
+ } else {
3111
+ const { host } = await getJiraConfig();
3112
+ const summary = issue.fields.summary;
3113
+ const url = `https://${host}/browse/${issueId}`;
3114
+ console.log({ issueId, summary, url });
3115
+ }
3116
+ });
3117
+ return program2;
3118
+ }
3119
+ var version15 = await getPackageVersion();
3120
+ var git_jira_issue_show_default = create15;
3121
+ if (isMain("git-jira-issue-show")) {
3122
+ await create15().parseAsync(Bun.argv);
3123
+ }
3124
+
3125
+ // bine_modules/commande
3126
+ function create16() {
3127
+ const program2 = new Command;
3128
+ program2.version(version16).name("issue").description("Commands for working with issues").addCommand(git_jira_issue_list_default()).addCommand(git_jira_issue_show_default()).action(() => program2.help());
3129
+ return program2;
3130
+ }
3131
+ var version16 = await getPackageVersion();
3132
+ var git_jira_issue_default = create16;
3133
+ if (isMain("git-jira-issue")) {
3134
+ await create16().parseAsync(Bun.argv);
3135
+ }
3136
+
3137
+ // bine_modules/command
3138
+ function create17() {
3139
+ const program2 = new Command;
3140
+ program2.version(version17).name("group").description("Commands for working with GitLab groups").addCommand(git_lab_group_list_default()).action(() => program2.help());
3141
+ return program2;
3142
+ }
3143
+ var version17 = await getPackageVersion();
3144
+ var git_lab_group_default = create17;
3145
+ if (isMain("git-lab-group")) {
3146
+ await create17().parseAsync(Bun.argv);
3147
+ }
3148
+
3149
+ // bine_modules/commande
3150
+ function create18() {
3151
+ const program2 = new Command;
3152
+ program2.version(version18).name("whoami").description("get GitLab user information for current user").option("-v, --verbose", "Verbose output").action(async (options) => {
3153
+ const user5 = await whoami();
3154
+ if (!user5) {
2082
3155
  console.error(`No user!`);
2083
3156
  process.exit(1);
2084
3157
  }
2085
3158
  if (options.verbose) {
2086
- console.log(user);
3159
+ console.log(user5);
2087
3160
  process.exit(0);
2088
3161
  } else {
2089
- console.log(user.username);
3162
+ console.log(user5.username);
2090
3163
  }
2091
3164
  });
2092
3165
  return program2;
2093
3166
  }
3167
+ var version18 = await getPackageVersion();
3168
+ var git_lab_whoami_default = create18;
2094
3169
  if (isMain("git-lab-whoami")) {
2095
- await create7().parseAsync(Bun.argv);
3170
+ await create18().parseAsync(Bun.argv);
2096
3171
  }
2097
- var git_lab_whoami_default = create7;
2098
3172
 
2099
- // bin/git-lab.ts
2100
- function create8() {
3173
+ // bine_modules/c
3174
+ function create19() {
2101
3175
  const program2 = new Command;
2102
- program2.name("lab").description("A set of commands for working with GitLab").addCommand(git_lab_whoami_default()).addCommand(git_lab_projects_default());
3176
+ program2.version(version19).name("lab").description("Commands for working with GitLab").addCommand(git_lab_group_default()).addCommand(git_lab_merge_default()).addCommand(git_lab_namespace_default()).addCommand(git_lab_project_default()).addCommand(git_lab_whoami_default()).action(() => program2.help());
2103
3177
  return program2;
2104
3178
  }
3179
+ var version19 = await getPackageVersion();
3180
+ var git_lab_default = create19;
3181
+ if (isMain("git-lab")) {
3182
+ await create19().parseAsync(Bun.argv);
3183
+ }
3184
+
3185
+ // bine_modules/co
3186
+ function create20() {
3187
+ const program2 = new Command;
3188
+ program2.version(version20).name("jira").description("Commands for working with Jira").addCommand(git_jira_start_default()).addCommand(git_jira_issue_default()).addCommand(git_jira_issue_list_default());
3189
+ return program2;
3190
+ }
3191
+ var version20 = await getPackageVersion();
3192
+ var git_jira_default = create20;
2105
3193
  if (isMain("git-jira")) {
2106
- await create8().parseAsync(Bun.argv);
3194
+ await create20().parseAsync(Bun.argv);
2107
3195
  }
2108
- var git_lab_default = create8;
2109
3196
 
2110
- // bin/gitj.ts
2111
- function create9() {
3197
+ // bine_module
3198
+ function create21() {
2112
3199
  const program2 = new Command;
2113
- program2.addCommand(git_bump_default()).addCommand(git_jira_default()).addCommand(git_lab_default()).action(() => {
3200
+ program2.version(version21).addCommand(git_bump_default()).addCommand(git_jira_default()).addCommand(git_lab_default()).action(() => {
2114
3201
  program2.help();
2115
3202
  });
2116
3203
  return program2;
2117
3204
  }
2118
- var command = create9();
3205
+ var version21 = await getPackageVersion();
3206
+ var command = create21();
2119
3207
  await command.parseAsync(Bun.argv);
2120
3208
  export {
2121
- create9 as create
3209
+ create21 as create
2122
3210
  };