ya-git-jira 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin/gitj.js CHANGED
@@ -20,50 +20,6 @@ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports,
20
20
  var __require = (id) => {
21
21
  return import.meta.require(id);
22
22
  };
23
- var __export = (target, all) => {
24
- for (var name in all)
25
- __defProp(target, name, {
26
- get: all[name],
27
- enumerable: true,
28
- configurable: true,
29
- set: (newValue) => all[name] = () => newValue
30
- });
31
- };
32
- var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
33
-
34
- // lib/spawn.ts
35
- async function doCommand(args) {
36
- const proc = Bun.spawn(args);
37
- const stdout = new Response(proc.stdout);
38
- const stderr = new Response(proc.stderr);
39
- const [out, err] = await Promise.all([stdout.text(), stderr.text()]);
40
- if (err)
41
- console.error(err);
42
- return out.trim();
43
- }
44
- var init_spawn = __esm(() => {
45
- });
46
-
47
- // lib/git.ts
48
- async function getConfig(key) {
49
- return doCommand(["git", "config", "--get", key]);
50
- }
51
- async function getJiraConfig() {
52
- const host = await getConfig("jira.host");
53
- const user = await getConfig("jira.user") || await getConfig("user.email");
54
- const pat = await getConfig("jira.pat");
55
- const token = Buffer.from(`${user}:${pat}`).toString("base64");
56
- return { host, token };
57
- }
58
- async function createBranch(name) {
59
- return doCommand(["git", "checkout", "-b", name]);
60
- }
61
- async function getCurrentBranch() {
62
- return doCommand(["git", "rev-parse", "--abbrev-ref", "HEAD"]);
63
- }
64
- var init_git = __esm(() => {
65
- init_spawn();
66
- });
67
23
 
68
24
  // node_modules/commander/lib/error.js
69
25
  var require_error = __commonJS((exports) => {
@@ -1828,23 +1784,104 @@ var require_commander = __commonJS((exports, module) => {
1828
1784
  });
1829
1785
 
1830
1786
  // node_modules/commander/esm.mjs
1831
- var import_, program, createCommand, createArgument, createOption, CommanderError, InvalidArgumentError, InvalidOptionArgumentError, Command, Argument, Option, Help;
1832
- var init_esm = __esm(() => {
1833
- import_ = __toESM(require_commander(), 1);
1834
- ({
1835
- program,
1836
- createCommand,
1837
- createArgument,
1838
- createOption,
1839
- CommanderError,
1840
- InvalidArgumentError,
1841
- InvalidOptionArgumentError,
1842
- Command,
1843
- Argument,
1844
- Option,
1845
- Help
1846
- } = import_.default);
1847
- });
1787
+ var import_ = __toESM(require_commander(), 1);
1788
+ var {
1789
+ program,
1790
+ createCommand,
1791
+ createArgument,
1792
+ createOption,
1793
+ CommanderError,
1794
+ InvalidArgumentError,
1795
+ InvalidOptionArgumentError,
1796
+ Command,
1797
+ Argument,
1798
+ Option,
1799
+ Help
1800
+ } = import_.default;
1801
+
1802
+ // lib/spawn.ts
1803
+ async function spawn(args, options = defaultOptions) {
1804
+ const proc = Bun.spawn(args, { stdout: "pipe", stderr: "pipe" });
1805
+ const stdout = new Response(proc.stdout);
1806
+ const stderr = new Response(proc.stderr);
1807
+ const [out, err, exitCode, signal] = await Promise.all([stdout.text(), stderr.text(), proc.exitCode, proc.signalCode]);
1808
+ let code = 0;
1809
+ if (exitCode !== null) {
1810
+ code = exitCode;
1811
+ }
1812
+ if (!out && !err && !options.expectQuiet) {
1813
+ console.warn(`No output from ${args.join(" ")}`);
1814
+ }
1815
+ return { out: out.trim(), err: err.trim(), code };
1816
+ }
1817
+ async function doCommand(args) {
1818
+ const { out, err } = await spawn(args);
1819
+ if (err)
1820
+ console.error(err);
1821
+ return out;
1822
+ }
1823
+ var defaultOptions = {
1824
+ expectQuiet: false
1825
+ };
1826
+
1827
+ // lib/git.ts
1828
+ async function getConfig(key) {
1829
+ return doCommand(["git", "config", "--get", key]);
1830
+ }
1831
+ async function createBranch(name) {
1832
+ return doCommand(["git", "checkout", "-b", name]);
1833
+ }
1834
+ async function getCurrentBranch() {
1835
+ return doCommand(["git", "rev-parse", "--abbrev-ref", "HEAD"]);
1836
+ }
1837
+ async function getRemote() {
1838
+ return doCommand(["git", "ls-remote", "--get-url", "origin"]);
1839
+ }
1840
+
1841
+ // lib/jira.ts
1842
+ async function getJiraConfig() {
1843
+ const host = await getConfig("jira.host");
1844
+ if (!host)
1845
+ throw new Error("jira.host not in git config");
1846
+ const user = await getConfig("jira.user") || await getConfig("user.email");
1847
+ 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 };
1854
+ }
1855
+ async function get(endpoint) {
1856
+ const method = "GET";
1857
+ const { host, token } = await getJiraConfig();
1858
+ const base = `https://${host}/rest/api/3`;
1859
+ const uri = `${base}/${endpoint}`;
1860
+ const auth = `Basic ${token}`;
1861
+ const headers = new Headers;
1862
+ headers.append("Authorization", auth);
1863
+ headers.append("Accept", "application/json");
1864
+ const options = {
1865
+ method,
1866
+ headers
1867
+ };
1868
+ const request = new Request(uri, options);
1869
+ const response = await fetch(request);
1870
+ return await response.json();
1871
+ }
1872
+ async function getIssue(issue) {
1873
+ return await get(`/issue/${issue}`);
1874
+ }
1875
+ async function getMyself() {
1876
+ return await get("/myself");
1877
+ }
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;
1884
+ }
1848
1885
 
1849
1886
  // lib/is_main.ts
1850
1887
  import path from "path";
@@ -1852,26 +1889,172 @@ function isMain(self) {
1852
1889
  const exe = path.basename(Bun.argv[1]).split(".")[0];
1853
1890
  return exe == self || import.meta.main;
1854
1891
  }
1855
- var init_is_main = __esm(() => {
1856
- });
1857
1892
 
1858
- // bin/git-bump.ts
1859
- var exports_git_bump = {};
1860
- __export(exports_git_bump, {
1861
- default: () => {
1862
- {
1863
- return git_bump_default;
1893
+ // bin/git-jira-issues.ts
1894
+ function create() {
1895
+ 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
+ });
1902
+ });
1903
+ return program2;
1904
+ }
1905
+ if (isMain("git-jira-issues")) {
1906
+ await create().parseAsync(Bun.argv);
1907
+ }
1908
+ var git_jira_issues_default = create;
1909
+
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
+ };
1914
+ function create2() {
1915
+ 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);
1921
+ }
1922
+ const summary = issue.fields.summary;
1923
+ const branchName = `${issueId}-${toKebab(summary)}`;
1924
+ await createBranch(branchName);
1925
+ });
1926
+ return program2;
1927
+ }
1928
+ if (isMain("git-jira-issues")) {
1929
+ await create2().parseAsync(Bun.argv);
1930
+ }
1931
+ var git_jira_start_default = create2;
1932
+
1933
+ // bin/git-jira-issue.ts
1934
+ function create3() {
1935
+ 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);
1864
1942
  }
1865
- },
1866
- create: () => {
1867
- {
1868
- return create;
1943
+ if (options.verbose) {
1944
+ console.log(issue);
1945
+ process.exit(0);
1869
1946
  }
1947
+ if (options.url) {
1948
+ console.log(`https://${host}/browse/${issueId}`);
1949
+ }
1950
+ });
1951
+ return program2;
1952
+ }
1953
+ if (isMain("git-jira-issue")) {
1954
+ await create3().parseAsync(Bun.argv);
1955
+ }
1956
+ var git_jira_issue_default = create3;
1957
+
1958
+ // bin/git-jira.ts
1959
+ function create4() {
1960
+ 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());
1962
+ return program2;
1963
+ }
1964
+ if (isMain("git-jira")) {
1965
+ await create4().parseAsync(Bun.argv);
1966
+ }
1967
+ var git_jira_default = create4;
1968
+
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 };
1982
+ }
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();
1998
+ }
1999
+ async function whoami() {
2000
+ return await get2("/user");
2001
+ }
2002
+ async function getProjects(paths) {
2003
+ let search = "";
2004
+ if (paths.length > 0) {
2005
+ search = "&search=" + paths.join(",");
1870
2006
  }
1871
- });
1872
- function create() {
2007
+ return await get2(`/projects?visibility=private&membership=true&simple=true${search}`);
2008
+ }
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;
2023
+ }
2024
+ async function getMergeRequest(id) {
2025
+ return await get2(`/merge_requests/${id}`);
2026
+ }
2027
+
2028
+ // bin/git-lab-projects.ts
2029
+ function create5() {
1873
2030
  const program2 = new Command;
1874
- program2.name("bump").action(async () => {
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);
2033
+ if (!projects) {
2034
+ console.error(`No projects!`);
2035
+ process.exit(1);
2036
+ }
2037
+ if (options.verbose) {
2038
+ console.log(projects);
2039
+ } else {
2040
+ let filtered = projects.map((p) => {
2041
+ const { id, name, path_with_namespace, ssh_url_to_repo } = p;
2042
+ return { id, name, path_with_namespace, ssh_url_to_repo };
2043
+ });
2044
+ console.log(filtered);
2045
+ }
2046
+ });
2047
+ return program2;
2048
+ }
2049
+ if (isMain("git-lab-projects")) {
2050
+ await create5().parseAsync(Bun.argv);
2051
+ }
2052
+ var git_lab_projects_default = create5;
2053
+
2054
+ // bin/git-bump.ts
2055
+ function create6() {
2056
+ const program2 = new Command;
2057
+ program2.name("bump").description("Bump the version number in the current branch").action(async () => {
1875
2058
  const currentBranch = await getCurrentBranch();
1876
2059
  let stem = currentBranch;
1877
2060
  let version = 1;
@@ -1885,25 +2068,55 @@ function create() {
1885
2068
  });
1886
2069
  return program2;
1887
2070
  }
1888
- var git_bump_default;
1889
- var init_git_bump = __esm(() => {
1890
- init_git();
1891
- init_esm();
1892
- init_is_main();
1893
- if (isMain("git-bump")) {
1894
- create().parse(process.argv);
1895
- }
1896
- git_bump_default = create;
1897
- });
2071
+ if (isMain("git-bump")) {
2072
+ await create6().parseAsync(Bun.argv);
2073
+ }
2074
+ var git_bump_default = create6;
2075
+
2076
+ // bin/git-lab-whoami.ts
2077
+ function create7() {
2078
+ 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) {
2082
+ console.error(`No user!`);
2083
+ process.exit(1);
2084
+ }
2085
+ if (options.verbose) {
2086
+ console.log(user);
2087
+ process.exit(0);
2088
+ } else {
2089
+ console.log(user.username);
2090
+ }
2091
+ });
2092
+ return program2;
2093
+ }
2094
+ if (isMain("git-lab-whoami")) {
2095
+ await create7().parseAsync(Bun.argv);
2096
+ }
2097
+ var git_lab_whoami_default = create7;
2098
+
2099
+ // bin/git-lab.ts
2100
+ function create8() {
2101
+ 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());
2103
+ return program2;
2104
+ }
2105
+ if (isMain("git-jira")) {
2106
+ await create8().parseAsync(Bun.argv);
2107
+ }
2108
+ var git_lab_default = create8;
1898
2109
 
1899
2110
  // bin/gitj.ts
1900
- init_esm();
1901
- init_is_main();
1902
- if (isMain("gitj")) {
2111
+ function create9() {
1903
2112
  const program2 = new Command;
1904
- const bump = (await Promise.resolve().then(() => (init_git_bump(), exports_git_bump))).create();
1905
- program2.executableDir("./bin").addCommand(bump).command("jira", "A collection of jira utility commands", { executableFile: "git-jira" });
1906
- program2.action(() => {
2113
+ program2.addCommand(git_bump_default()).addCommand(git_jira_default()).addCommand(git_lab_default()).action(() => {
1907
2114
  program2.help();
1908
- }).parse(Bun.argv);
2115
+ });
2116
+ return program2;
1909
2117
  }
2118
+ var command = create9();
2119
+ await command.parseAsync(Bun.argv);
2120
+ export {
2121
+ create9 as create
2122
+ };
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ // @bun
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getProtoOf = Object.getPrototypeOf;
@@ -18,62 +19,123 @@ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports,
18
19
  var __require = (id) => {
19
20
  return import.meta.require(id);
20
21
  };
21
- var __export = (target, all) => {
22
- for (var name in all)
23
- __defProp(target, name, {
24
- get: all[name],
25
- enumerable: true,
26
- configurable: true,
27
- set: (newValue) => all[name] = () => newValue
28
- });
29
- };
30
- var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
31
-
32
22
  // lib/spawn.ts
33
- async function doCommand(args) {
34
- const proc = Bun.spawn(args);
23
+ async function spawn(args, options = defaultOptions) {
24
+ const proc = Bun.spawn(args, { stdout: "pipe", stderr: "pipe" });
35
25
  const stdout = new Response(proc.stdout);
36
26
  const stderr = new Response(proc.stderr);
37
- const [out, err] = await Promise.all([stdout.text(), stderr.text()]);
27
+ const [out, err, exitCode, signal] = await Promise.all([stdout.text(), stderr.text(), proc.exitCode, proc.signalCode]);
28
+ let code = 0;
29
+ if (exitCode !== null) {
30
+ code = exitCode;
31
+ }
32
+ if (!out && !err && !options.expectQuiet) {
33
+ console.warn(`No output from ${args.join(" ")}`);
34
+ }
35
+ return { out: out.trim(), err: err.trim(), code };
36
+ }
37
+ async function doCommand(args) {
38
+ const { out, err } = await spawn(args);
38
39
  if (err)
39
40
  console.error(err);
40
- return out.trim();
41
+ return out;
41
42
  }
42
- var init_spawn = __esm(() => {
43
- });
43
+ var defaultOptions = {
44
+ expectQuiet: false
45
+ };
44
46
 
45
47
  // lib/git.ts
46
48
  async function getConfig(key) {
47
49
  return doCommand(["git", "config", "--get", key]);
48
50
  }
49
- async function getJiraConfig() {
50
- const host = await getConfig("jira.host");
51
- const user = await getConfig("jira.user") || await getConfig("user.email");
52
- const pat = await getConfig("jira.pat");
53
- const token = Buffer.from(`${user}:${pat}`).toString("base64");
54
- return { host, token };
55
- }
56
51
  async function createBranch(name) {
57
52
  return doCommand(["git", "checkout", "-b", name]);
58
53
  }
59
54
  async function getCurrentBranch() {
60
55
  return doCommand(["git", "rev-parse", "--abbrev-ref", "HEAD"]);
61
56
  }
62
- var init_git = __esm(() => {
63
- init_spawn();
64
- });
65
-
66
- // lib/is_main.ts
57
+ async function getRemote() {
58
+ return doCommand(["git", "ls-remote", "--get-url", "origin"]);
59
+ }
60
+ // lib/gitlab.ts
67
61
  import path from "path";
62
+ async function getGitlabConfig() {
63
+ const host = await getConfig("gitlab.host");
64
+ if (!host)
65
+ throw new Error("gitlab.host not in git config");
66
+ const user = await getConfig("user.email");
67
+ if (!user)
68
+ throw new Error("user.email not in git config");
69
+ const token = await getConfig("gitlab.token");
70
+ if (!token)
71
+ throw new Error("gitlab.token not in git config");
72
+ return { host, user, token };
73
+ }
74
+ async function get(endpoint) {
75
+ const method = "GET";
76
+ const { host, token } = await getGitlabConfig();
77
+ const base = `https://${host}/api/v4`;
78
+ const uri = `${base}/${endpoint}`;
79
+ const headers = new Headers;
80
+ headers.append("Accept", "application/json");
81
+ headers.append("Private-Token", token);
82
+ const options = {
83
+ method,
84
+ headers
85
+ };
86
+ const request = new Request(uri, options);
87
+ const response = await fetch(request);
88
+ return await response.json();
89
+ }
90
+ async function whoami() {
91
+ return await get("/user");
92
+ }
93
+ async function getProjects(paths) {
94
+ let search = "";
95
+ if (paths.length > 0) {
96
+ search = "&search=" + paths.join(",");
97
+ }
98
+ return await get(`/projects?visibility=private&membership=true&simple=true${search}`);
99
+ }
100
+ async function findProject(ssh_url) {
101
+ const parts = ssh_url.split(":");
102
+ if (parts.length != 2) {
103
+ throw new Error(`${ssh_url} is invalid, could not be split into two parts at :`);
104
+ }
105
+ const name = path.basename(parts[1], ".git");
106
+ const projects = await getProjects([name]);
107
+ const project = projects.find((p) => {
108
+ return p.ssh_url_to_repo === ssh_url;
109
+ });
110
+ if (!project) {
111
+ throw new Error(`No project with ssh_url_to_repo ${ssh_url} found`);
112
+ }
113
+ return project;
114
+ }
115
+ async function getMergeRequest(id) {
116
+ return await get(`/merge_requests/${id}`);
117
+ }
118
+ // lib/is_main.ts
119
+ import path2 from "path";
68
120
  function isMain(self) {
69
- const exe = path.basename(Bun.argv[1]).split(".")[0];
121
+ const exe = path2.basename(Bun.argv[1]).split(".")[0];
70
122
  return exe == self || import.meta.main;
71
123
  }
72
- var init_is_main = __esm(() => {
73
- });
74
-
75
124
  // lib/jira.ts
76
- async function get(endpoint) {
125
+ async function getJiraConfig() {
126
+ const host = await getConfig("jira.host");
127
+ if (!host)
128
+ throw new Error("jira.host not in git config");
129
+ const user = await getConfig("jira.user") || await getConfig("user.email");
130
+ if (!user)
131
+ throw new Error("jira.user or user.email not in git config");
132
+ const pat = await getConfig("jira.pat");
133
+ if (!pat)
134
+ throw new Error("jira.pat not in git config");
135
+ const token = Buffer.from(`${user}:${pat}`).toString("base64");
136
+ return { host, token };
137
+ }
138
+ async function get2(endpoint) {
77
139
  const method = "GET";
78
140
  const { host, token } = await getJiraConfig();
79
141
  const base = `https://${host}/rest/api/3`;
@@ -91,36 +153,33 @@ async function get(endpoint) {
91
153
  return await response.json();
92
154
  }
93
155
  async function getIssue(issue) {
94
- return await get(`/issue/${issue}`);
156
+ return await get2(`/issue/${issue}`);
95
157
  }
96
158
  async function getMyself() {
97
- return await get("/myself");
159
+ return await get2("/myself");
98
160
  }
99
161
  async function myUnresolvedIssues() {
100
162
  const myself = await getMyself();
101
163
  const myselfId = myself.accountId;
102
164
  const jql = `assignee = ${myselfId} AND resolution = Unresolved`;
103
- const issues = await get(`/search?jql=${encodeURIComponent(jql)}`);
165
+ const issues = await get2(`/search?jql=${encodeURIComponent(jql)}`);
104
166
  return issues.issues;
105
167
  }
106
- var init_jira = __esm(() => {
107
- init_git();
108
- });
109
-
110
- // index.ts
111
- init_git();
112
- init_is_main();
113
- init_jira();
114
- init_spawn();
115
168
  export {
169
+ whoami,
170
+ spawn,
116
171
  myUnresolvedIssues,
117
172
  isMain,
173
+ getRemote,
174
+ getProjects,
118
175
  getMyself,
176
+ getMergeRequest,
119
177
  getJiraConfig,
120
178
  getIssue,
179
+ getGitlabConfig,
121
180
  getCurrentBranch,
122
181
  getConfig,
123
- get,
182
+ findProject,
124
183
  doCommand,
125
184
  createBranch
126
185
  };
package/index.ts CHANGED
@@ -1,4 +1,6 @@
1
+ export * from "./lib/json.ts"
1
2
  export * from "./lib/git.ts"
3
+ export * from "./lib/gitlab.ts"
2
4
  export * from "./lib/is_main.ts"
3
5
  export * from "./lib/jira.ts"
4
6
  export * from "./lib/spawn.ts"
package/lib/git.ts CHANGED
@@ -4,19 +4,6 @@ export async function getConfig(key: string): Promise<string> {
4
4
  return doCommand(["git", "config", "--get", key])
5
5
  }
6
6
 
7
- export interface JiraConfig {
8
- host: string
9
- token: string
10
- }
11
-
12
- export async function getJiraConfig(): Promise<JiraConfig> {
13
- const host = await getConfig("jira.host")
14
- const user = await getConfig("jira.user") || await getConfig("user.email")
15
- const pat = await getConfig("jira.pat")
16
- const token = Buffer.from(`${user}:${pat}`).toString('base64')
17
- return { host, token }
18
- }
19
-
20
7
  export async function createBranch(name: string): Promise<string> {
21
8
  return doCommand(["git", "checkout", "-b", name])
22
9
  }
@@ -24,3 +11,7 @@ export async function createBranch(name: string): Promise<string> {
24
11
  export async function getCurrentBranch(): Promise<string> {
25
12
  return doCommand(["git", "rev-parse", "--abbrev-ref", "HEAD"])
26
13
  }
14
+
15
+ export async function getRemote(): Promise<string> {
16
+ return doCommand(['git', "ls-remote", "--get-url", "origin"])
17
+ }