ya-git-jira 1.3.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/git-bump.ts +7 -4
- package/bin/{git-jira-issues.ts → git-jira-issue-list.ts} +10 -7
- package/bin/git-jira-issue-show.ts +40 -0
- package/bin/git-jira-issue.ts +14 -25
- package/bin/git-jira-start.ts +8 -5
- package/bin/git-jira.ts +9 -6
- package/bin/git-lab-group-list.ts +35 -0
- package/bin/git-lab-group.ts +25 -0
- package/bin/git-lab-merge-active.ts +41 -0
- package/bin/git-lab-merge-todo.ts +36 -0
- package/bin/git-lab-merge-train-list.ts +26 -0
- package/bin/git-lab-merge-train.ts +25 -0
- package/bin/git-lab-merge.ts +29 -0
- package/bin/git-lab-namespace-list.ts +27 -0
- package/bin/git-lab-namespace.ts +24 -0
- package/bin/{git-lab-projects.ts → git-lab-project-list.ts} +13 -10
- package/bin/git-lab-project-pipeline-list.ts +46 -0
- package/bin/git-lab-project-pipeline.ts +24 -0
- package/bin/git-lab-project-whereami.ts +43 -0
- package/bin/git-lab-project.ts +28 -0
- package/bin/git-lab-whoami.ts +8 -5
- package/bin/git-lab.ts +18 -8
- package/bin/gitj.ts +7 -5
- package/build.ts +1 -1
- package/bun.lockb +0 -0
- package/dist/bin/git-bump.js +55 -17
- package/dist/bin/{git-jira-issues.js → git-jira-issue-list.js} +71 -28
- package/dist/bin/{git-lab-mergetrain.js → git-jira-issue-show.js} +100 -43
- package/dist/bin/git-jira-issue.js +106 -33
- package/dist/bin/git-jira-start.js +70 -27
- package/dist/bin/git-jira.js +117 -59
- package/dist/bin/git-lab-group-list.js +2793 -0
- package/dist/bin/git-lab-group.js +2805 -0
- package/dist/bin/git-lab-groups.js +1992 -0
- package/dist/bin/git-lab-merge-active.js +2798 -0
- package/dist/bin/git-lab-merge-todo.js +2793 -0
- package/dist/bin/git-lab-merge-train-list.js +2754 -0
- package/dist/bin/git-lab-merge-train.js +2766 -0
- package/dist/bin/git-lab-merge.js +2865 -0
- package/dist/bin/git-lab-namespace-list.js +1967 -0
- package/dist/bin/git-lab-namespace.js +1979 -0
- package/dist/bin/git-lab-namespaces.js +1984 -0
- package/dist/bin/git-lab-project-list.js +2761 -0
- package/dist/bin/git-lab-project-pipeline-list.js +2800 -0
- package/dist/bin/git-lab-project-pipeline.js +2812 -0
- package/dist/bin/git-lab-project-whereami.js +2764 -0
- package/dist/bin/git-lab-project.js +2805 -0
- package/dist/bin/git-lab-projects-list.js +1996 -0
- package/dist/bin/git-lab-projects-whereami.js +1999 -0
- package/dist/bin/git-lab-projects.js +138 -35
- package/dist/bin/git-lab-whoami.js +100 -56
- package/dist/bin/git-lab.js +1123 -58
- package/dist/bin/gitj.js +1260 -172
- package/dist/index.js +881 -35
- package/index.ts +1 -1
- package/lib/gitlab/api.ts +46 -0
- package/lib/gitlab/config.ts +21 -0
- package/lib/gitlab/dlog.ts +2 -0
- package/lib/gitlab/group.ts +12 -0
- package/lib/gitlab/index.ts +8 -0
- package/lib/gitlab/merge-request.ts +31 -0
- package/lib/gitlab/merge-trains.ts +19 -0
- package/lib/gitlab/namespace.ts +12 -0
- package/lib/gitlab/pipeline.ts +32 -0
- package/lib/gitlab/project.ts +78 -0
- package/lib/gitlab/user.ts +13 -0
- package/lib/is_main.ts +21 -2
- package/lib/jira.ts +12 -7
- package/lib/package.ts +35 -0
- package/package.json +21 -4
- package/tests/all-help.test.ts +46 -0
- package/tests/git.test.ts +8 -7
- package/tests/gitj.test.ts +1 -1
- package/lib/gitlab.ts +0 -86
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
|
|
3
|
+
import { Command } from 'commander'
|
|
4
|
+
import { getPackageVersion } from '../lib/package'
|
|
5
|
+
import { isMain } from '../lib/is_main'
|
|
6
|
+
import list from './git-lab-project-list'
|
|
7
|
+
import whereami from './git-lab-project-whereami'
|
|
8
|
+
const version = await getPackageVersion()
|
|
9
|
+
|
|
10
|
+
export function create(): Command {
|
|
11
|
+
const program: Command = new Command()
|
|
12
|
+
program
|
|
13
|
+
.version(version)
|
|
14
|
+
.name('projects')
|
|
15
|
+
.description('Commands for working with GitLab projects')
|
|
16
|
+
.addCommand(list())
|
|
17
|
+
.addCommand(whereami())
|
|
18
|
+
.action(() => {
|
|
19
|
+
program.help()
|
|
20
|
+
})
|
|
21
|
+
return program
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default create
|
|
25
|
+
|
|
26
|
+
if (isMain('git-lab-project')) {
|
|
27
|
+
await create().parseAsync(Bun.argv)
|
|
28
|
+
}
|
package/bin/git-lab-whoami.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
3
|
import { Command } from 'commander'
|
|
4
|
-
import {
|
|
4
|
+
import { getPackageVersion } from '../lib/package'
|
|
5
|
+
import { whoami, type User } from "../lib/gitlab/user"
|
|
5
6
|
import { isMain } from '../lib/is_main'
|
|
7
|
+
const version = await getPackageVersion()
|
|
6
8
|
|
|
7
9
|
export function create(): Command {
|
|
8
|
-
const program = new Command()
|
|
10
|
+
const program: Command = new Command()
|
|
9
11
|
program
|
|
12
|
+
.version(version)
|
|
10
13
|
.name('whoami')
|
|
11
14
|
.description('get GitLab user information for current user')
|
|
12
15
|
.option('-v, --verbose', 'Verbose output')
|
|
@@ -27,8 +30,8 @@ export function create(): Command {
|
|
|
27
30
|
return program
|
|
28
31
|
}
|
|
29
32
|
|
|
33
|
+
export default create
|
|
34
|
+
|
|
30
35
|
if (isMain('git-lab-whoami')) {
|
|
31
36
|
await create().parseAsync(Bun.argv)
|
|
32
37
|
}
|
|
33
|
-
|
|
34
|
-
export default create
|
package/bin/git-lab.ts
CHANGED
|
@@ -1,22 +1,32 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
3
|
import { Command } from 'commander'
|
|
4
|
+
import { getPackageVersion } from '../lib/package'
|
|
4
5
|
import { isMain } from '../lib/is_main'
|
|
6
|
+
import groups from './git-lab-group'
|
|
7
|
+
import merges from './git-lab-merge'
|
|
8
|
+
import namespaces from './git-lab-namespace'
|
|
9
|
+
import projects from './git-lab-project'
|
|
5
10
|
import whoami from './git-lab-whoami'
|
|
6
|
-
|
|
11
|
+
const version = await getPackageVersion()
|
|
7
12
|
|
|
8
13
|
export function create(): Command {
|
|
9
|
-
const program = new Command()
|
|
14
|
+
const program: Command = new Command()
|
|
10
15
|
program
|
|
16
|
+
.version(version)
|
|
11
17
|
.name('lab')
|
|
12
|
-
.description('
|
|
13
|
-
.addCommand(
|
|
18
|
+
.description('Commands for working with GitLab')
|
|
19
|
+
.addCommand(groups())
|
|
20
|
+
.addCommand(merges())
|
|
21
|
+
.addCommand(namespaces())
|
|
14
22
|
.addCommand(projects())
|
|
23
|
+
.addCommand(whoami())
|
|
24
|
+
.action(() => program.help())
|
|
15
25
|
return program
|
|
16
26
|
}
|
|
17
27
|
|
|
18
|
-
|
|
28
|
+
export default create
|
|
29
|
+
|
|
30
|
+
if (isMain('git-lab')) {
|
|
19
31
|
await create().parseAsync(Bun.argv)
|
|
20
32
|
}
|
|
21
|
-
|
|
22
|
-
export default create
|
package/bin/gitj.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
|
|
3
|
-
import bump from './git-bump'
|
|
4
|
-
import jira from './git-jira'
|
|
5
|
-
import lab from './git-lab'
|
|
1
|
+
#!/usr/bin/env bun
|
|
6
2
|
|
|
7
3
|
// This is the root of the CLI. It's a proxy for git and not strictly
|
|
8
4
|
// necessary, but it's useful to have for testing
|
|
@@ -10,10 +6,16 @@ import lab from './git-lab'
|
|
|
10
6
|
// from the command line and then call the appropriate subcommand.
|
|
11
7
|
|
|
12
8
|
import { Command } from 'commander'
|
|
9
|
+
import { getPackageVersion } from '../lib/package'
|
|
10
|
+
import bump from './git-bump'
|
|
11
|
+
import jira from './git-jira'
|
|
12
|
+
import lab from './git-lab'
|
|
13
|
+
const version = await getPackageVersion()
|
|
13
14
|
|
|
14
15
|
export function create(): Command {
|
|
15
16
|
const program: Command = new Command()
|
|
16
17
|
program
|
|
18
|
+
.version(version)
|
|
17
19
|
.addCommand(bump())
|
|
18
20
|
.addCommand(jira())
|
|
19
21
|
.addCommand(lab())
|
package/build.ts
CHANGED
package/bun.lockb
CHANGED
|
Binary file
|
package/dist/bin/git-bump.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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,7 @@ var require_commander = __commonJS((exports, module) => {
|
|
|
1783
1783
|
exports.Option = Option;
|
|
1784
1784
|
});
|
|
1785
1785
|
|
|
1786
|
-
//
|
|
1786
|
+
// bine_modules
|
|
1787
1787
|
async function spawn(args, options = defaultOptions) {
|
|
1788
1788
|
const proc = Bun.spawn(args, { stdout: "pipe", stderr: "pipe" });
|
|
1789
1789
|
const stdout = new Response(proc.stdout);
|
|
@@ -1808,7 +1808,7 @@ var defaultOptions = {
|
|
|
1808
1808
|
expectQuiet: false
|
|
1809
1809
|
};
|
|
1810
1810
|
|
|
1811
|
-
//
|
|
1811
|
+
// bine_modul
|
|
1812
1812
|
async function getConfig(key) {
|
|
1813
1813
|
return doCommand(["git", "config", "--get", key]);
|
|
1814
1814
|
}
|
|
@@ -1822,7 +1822,7 @@ async function getRemote() {
|
|
|
1822
1822
|
return doCommand(["git", "ls-remote", "--get-url", "origin"]);
|
|
1823
1823
|
}
|
|
1824
1824
|
|
|
1825
|
-
//
|
|
1825
|
+
// bine_modules/commander/lib/sug
|
|
1826
1826
|
var import_ = __toESM(require_commander(), 1);
|
|
1827
1827
|
var {
|
|
1828
1828
|
program,
|
|
@@ -1838,17 +1838,54 @@ var {
|
|
|
1838
1838
|
Help
|
|
1839
1839
|
} = import_.default;
|
|
1840
1840
|
|
|
1841
|
-
//
|
|
1841
|
+
// bine_modules/c
|
|
1842
1842
|
import path from "path";
|
|
1843
|
+
import fs from "fs";
|
|
1844
|
+
function findPackageJson() {
|
|
1845
|
+
const cwd = import.meta.dir;
|
|
1846
|
+
let dir = cwd;
|
|
1847
|
+
while (dir !== "/") {
|
|
1848
|
+
const packageJson = path.join(dir, "package.json");
|
|
1849
|
+
if (fs.existsSync(packageJson)) {
|
|
1850
|
+
return packageJson;
|
|
1851
|
+
}
|
|
1852
|
+
dir = path.dirname(dir);
|
|
1853
|
+
}
|
|
1854
|
+
return null;
|
|
1855
|
+
}
|
|
1856
|
+
async function getPackageJson() {
|
|
1857
|
+
const packagePath = findPackageJson();
|
|
1858
|
+
if (!packagePath) {
|
|
1859
|
+
throw new Error(`No package.json found in ${import.meta.dir} or any parent directory`);
|
|
1860
|
+
}
|
|
1861
|
+
const packageJsonText = fs.readFileSync(packagePath, "utf8");
|
|
1862
|
+
return JSON.parse(packageJsonText);
|
|
1863
|
+
}
|
|
1864
|
+
async function getPackageVersion() {
|
|
1865
|
+
const packageJson = await packageJsonPromise;
|
|
1866
|
+
return packageJson.version;
|
|
1867
|
+
}
|
|
1868
|
+
var packageJsonPromise = getPackageJson();
|
|
1869
|
+
|
|
1870
|
+
// bine_modules/c
|
|
1871
|
+
import path2 from "path";
|
|
1872
|
+
var justBase = function(filename) {
|
|
1873
|
+
const ext = path2.extname(filename);
|
|
1874
|
+
const base = path2.basename(filename, ext);
|
|
1875
|
+
return base;
|
|
1876
|
+
};
|
|
1843
1877
|
function isMain(self) {
|
|
1844
|
-
const
|
|
1845
|
-
|
|
1878
|
+
const arg1 = Bun.argv[1];
|
|
1879
|
+
const argv1Base = justBase(arg1);
|
|
1880
|
+
const selfBase = justBase(self);
|
|
1881
|
+
const result = argv1Base === selfBase;
|
|
1882
|
+
return result;
|
|
1846
1883
|
}
|
|
1847
1884
|
|
|
1848
|
-
//
|
|
1885
|
+
// bine_modules/co
|
|
1849
1886
|
function create() {
|
|
1850
1887
|
const program2 = new Command;
|
|
1851
|
-
program2.name("bump").description("Bump the version number in the current branch").action(async () => {
|
|
1888
|
+
program2.version(version).name("bump").description("Bump the version number in the current branch").action(async () => {
|
|
1852
1889
|
const currentBranch = await getCurrentBranch();
|
|
1853
1890
|
let stem = currentBranch;
|
|
1854
1891
|
let version = 1;
|
|
@@ -1862,10 +1899,11 @@ function create() {
|
|
|
1862
1899
|
});
|
|
1863
1900
|
return program2;
|
|
1864
1901
|
}
|
|
1902
|
+
var version = await getPackageVersion();
|
|
1903
|
+
var git_bump_default = create;
|
|
1865
1904
|
if (isMain("git-bump")) {
|
|
1866
1905
|
await create().parseAsync(Bun.argv);
|
|
1867
1906
|
}
|
|
1868
|
-
var git_bump_default = create;
|
|
1869
1907
|
export {
|
|
1870
1908
|
git_bump_default as default,
|
|
1871
1909
|
create
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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,7 @@ var require_commander = __commonJS((exports, module) => {
|
|
|
1783
1783
|
exports.Option = Option;
|
|
1784
1784
|
});
|
|
1785
1785
|
|
|
1786
|
-
//
|
|
1786
|
+
// bine_modules/commander/lib/sug
|
|
1787
1787
|
var import_ = __toESM(require_commander(), 1);
|
|
1788
1788
|
var {
|
|
1789
1789
|
program,
|
|
@@ -1799,7 +1799,36 @@ var {
|
|
|
1799
1799
|
Help
|
|
1800
1800
|
} = import_.default;
|
|
1801
1801
|
|
|
1802
|
-
//
|
|
1802
|
+
// bine_modules/c
|
|
1803
|
+
import path from "path";
|
|
1804
|
+
import fs from "fs";
|
|
1805
|
+
function findPackageJson() {
|
|
1806
|
+
const cwd = import.meta.dir;
|
|
1807
|
+
let dir = cwd;
|
|
1808
|
+
while (dir !== "/") {
|
|
1809
|
+
const packageJson = path.join(dir, "package.json");
|
|
1810
|
+
if (fs.existsSync(packageJson)) {
|
|
1811
|
+
return packageJson;
|
|
1812
|
+
}
|
|
1813
|
+
dir = path.dirname(dir);
|
|
1814
|
+
}
|
|
1815
|
+
return null;
|
|
1816
|
+
}
|
|
1817
|
+
async function getPackageJson() {
|
|
1818
|
+
const packagePath = findPackageJson();
|
|
1819
|
+
if (!packagePath) {
|
|
1820
|
+
throw new Error(`No package.json found in ${import.meta.dir} or any parent directory`);
|
|
1821
|
+
}
|
|
1822
|
+
const packageJsonText = fs.readFileSync(packagePath, "utf8");
|
|
1823
|
+
return JSON.parse(packageJsonText);
|
|
1824
|
+
}
|
|
1825
|
+
async function getPackageVersion() {
|
|
1826
|
+
const packageJson = await packageJsonPromise;
|
|
1827
|
+
return packageJson.version;
|
|
1828
|
+
}
|
|
1829
|
+
var packageJsonPromise = getPackageJson();
|
|
1830
|
+
|
|
1831
|
+
// bine_modules
|
|
1803
1832
|
async function spawn(args, options = defaultOptions) {
|
|
1804
1833
|
const proc = Bun.spawn(args, { stdout: "pipe", stderr: "pipe" });
|
|
1805
1834
|
const stdout = new Response(proc.stdout);
|
|
@@ -1824,7 +1853,7 @@ var defaultOptions = {
|
|
|
1824
1853
|
expectQuiet: false
|
|
1825
1854
|
};
|
|
1826
1855
|
|
|
1827
|
-
//
|
|
1856
|
+
// bine_modul
|
|
1828
1857
|
async function getConfig(key) {
|
|
1829
1858
|
return doCommand(["git", "config", "--get", key]);
|
|
1830
1859
|
}
|
|
@@ -1838,7 +1867,7 @@ async function getRemote() {
|
|
|
1838
1867
|
return doCommand(["git", "ls-remote", "--get-url", "origin"]);
|
|
1839
1868
|
}
|
|
1840
1869
|
|
|
1841
|
-
//
|
|
1870
|
+
// bine_module
|
|
1842
1871
|
async function getJiraConfig() {
|
|
1843
1872
|
const host = await getConfig("jira.host");
|
|
1844
1873
|
if (!host)
|
|
@@ -1852,11 +1881,14 @@ async function getJiraConfig() {
|
|
|
1852
1881
|
const token = Buffer.from(`${user}:${pat}`).toString("base64");
|
|
1853
1882
|
return { host, token };
|
|
1854
1883
|
}
|
|
1855
|
-
async function
|
|
1884
|
+
async function jiraApi(endpoint) {
|
|
1885
|
+
if (endpoint.startsWith("/")) {
|
|
1886
|
+
console.warn(`jiraApi: endpoint ${endpoint} starts with /`);
|
|
1887
|
+
endpoint = endpoint.slice(1);
|
|
1888
|
+
}
|
|
1856
1889
|
const method = "GET";
|
|
1857
1890
|
const { host, token } = await getJiraConfig();
|
|
1858
|
-
const
|
|
1859
|
-
const uri = `${base}/${endpoint}`;
|
|
1891
|
+
const uri = `https://${host}/rest/api/3/${endpoint}`;
|
|
1860
1892
|
const auth = `Basic ${token}`;
|
|
1861
1893
|
const headers = new Headers;
|
|
1862
1894
|
headers.append("Authorization", auth);
|
|
@@ -1867,33 +1899,43 @@ async function get(endpoint) {
|
|
|
1867
1899
|
};
|
|
1868
1900
|
const request = new Request(uri, options);
|
|
1869
1901
|
const response = await fetch(request);
|
|
1870
|
-
|
|
1902
|
+
const result = await response.json();
|
|
1903
|
+
return result;
|
|
1871
1904
|
}
|
|
1872
1905
|
async function getIssue(issue) {
|
|
1873
|
-
|
|
1906
|
+
const result = await jiraApi(`issue/${issue}`);
|
|
1907
|
+
return result;
|
|
1874
1908
|
}
|
|
1875
1909
|
async function getMyself() {
|
|
1876
|
-
return await
|
|
1910
|
+
return await jiraApi("/myself");
|
|
1877
1911
|
}
|
|
1878
1912
|
async function myUnresolvedIssues() {
|
|
1879
1913
|
const myself = await getMyself();
|
|
1880
1914
|
const myselfId = myself.accountId;
|
|
1881
1915
|
const jql = `assignee = ${myselfId} AND resolution = Unresolved`;
|
|
1882
|
-
const issues = await
|
|
1916
|
+
const issues = await jiraApi(`/search?jql=${encodeURIComponent(jql)}`);
|
|
1883
1917
|
return issues.issues;
|
|
1884
1918
|
}
|
|
1885
1919
|
|
|
1886
|
-
//
|
|
1887
|
-
import
|
|
1920
|
+
// bine_modules/c
|
|
1921
|
+
import path2 from "path";
|
|
1922
|
+
var justBase = function(filename) {
|
|
1923
|
+
const ext = path2.extname(filename);
|
|
1924
|
+
const base = path2.basename(filename, ext);
|
|
1925
|
+
return base;
|
|
1926
|
+
};
|
|
1888
1927
|
function isMain(self) {
|
|
1889
|
-
const
|
|
1890
|
-
|
|
1928
|
+
const arg1 = Bun.argv[1];
|
|
1929
|
+
const argv1Base = justBase(arg1);
|
|
1930
|
+
const selfBase = justBase(self);
|
|
1931
|
+
const result = argv1Base === selfBase;
|
|
1932
|
+
return result;
|
|
1891
1933
|
}
|
|
1892
1934
|
|
|
1893
|
-
//
|
|
1935
|
+
// bine_modules/commander/lib
|
|
1894
1936
|
function create() {
|
|
1895
1937
|
const program2 = new Command;
|
|
1896
|
-
program2.name("
|
|
1938
|
+
program2.version(version).name("list").description("List your unresolved issues").action(async () => {
|
|
1897
1939
|
const issues = await myUnresolvedIssues();
|
|
1898
1940
|
console.log(`You have ${issues.length} unresolved issues`);
|
|
1899
1941
|
issues.forEach((issue) => {
|
|
@@ -1902,11 +1944,12 @@ function create() {
|
|
|
1902
1944
|
});
|
|
1903
1945
|
return program2;
|
|
1904
1946
|
}
|
|
1905
|
-
|
|
1947
|
+
var version = await getPackageVersion();
|
|
1948
|
+
var git_jira_issue_list_default = create;
|
|
1949
|
+
if (isMain("git-jira-issue-list")) {
|
|
1906
1950
|
await create().parseAsync(Bun.argv);
|
|
1907
1951
|
}
|
|
1908
|
-
var git_jira_issues_default = create;
|
|
1909
1952
|
export {
|
|
1910
|
-
|
|
1953
|
+
git_jira_issue_list_default as default,
|
|
1911
1954
|
create
|
|
1912
1955
|
};
|