ya-git-jira 2.1.0 → 2.1.1

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 (87) hide show
  1. package/bin/git-api.ts +2 -4
  2. package/bin/git-bump.ts +2 -4
  3. package/bin/git-confluence-page-search.ts +4 -6
  4. package/bin/git-confluence-page-show.ts +3 -5
  5. package/bin/git-confluence-page-update.ts +3 -5
  6. package/bin/git-confluence-page.ts +2 -4
  7. package/bin/git-confluence-space-list.ts +3 -5
  8. package/bin/git-confluence-space.ts +2 -4
  9. package/bin/git-confluence-whoami.ts +3 -5
  10. package/bin/git-confluence.ts +11 -4
  11. package/bin/git-jira-issue-list.ts +2 -4
  12. package/bin/git-jira-issue-show.ts +3 -5
  13. package/bin/git-jira-issue.ts +2 -4
  14. package/bin/git-jira-start.ts +2 -4
  15. package/bin/git-jira-whoami.ts +3 -5
  16. package/bin/git-jira.ts +11 -4
  17. package/bin/git-lab-group-list.ts +4 -6
  18. package/bin/git-lab-group.ts +2 -4
  19. package/bin/git-lab-merge-active.ts +4 -6
  20. package/bin/git-lab-merge-todo.ts +4 -6
  21. package/bin/git-lab-merge-train-list.ts +3 -5
  22. package/bin/git-lab-merge-train.ts +2 -4
  23. package/bin/git-lab-merge.ts +2 -4
  24. package/bin/git-lab-namespace-list.ts +3 -5
  25. package/bin/git-lab-namespace.ts +2 -4
  26. package/bin/git-lab-project-list.ts +4 -6
  27. package/bin/git-lab-project-mr-list.ts +4 -6
  28. package/bin/git-lab-project-mr.ts +2 -4
  29. package/bin/git-lab-project-pipeline-jobs.ts +2 -4
  30. package/bin/git-lab-project-pipeline-latest.ts +2 -4
  31. package/bin/git-lab-project-pipeline-list.ts +4 -6
  32. package/bin/git-lab-project-pipeline-log.ts +2 -4
  33. package/bin/git-lab-project-pipeline.ts +2 -4
  34. package/bin/git-lab-project-whereami.ts +3 -5
  35. package/bin/git-lab-project.ts +2 -4
  36. package/bin/git-lab-whoami.ts +3 -5
  37. package/bin/git-lab.ts +11 -4
  38. package/bin/gitj-install-skills.ts +2 -4
  39. package/bin/gitj.ts +6 -1
  40. package/dist/bin/git-api.js +33 -5
  41. package/dist/bin/git-bump.js +32 -24
  42. package/dist/bin/git-confluence-page-search.js +46 -26
  43. package/dist/bin/git-confluence-page-show.js +24 -4
  44. package/dist/bin/git-confluence-page-update.js +24 -4
  45. package/dist/bin/git-confluence-page.js +30 -16
  46. package/dist/bin/git-confluence-space-list.js +45 -25
  47. package/dist/bin/git-confluence-space.js +46 -28
  48. package/dist/bin/git-confluence-whoami.js +45 -25
  49. package/dist/bin/git-confluence.js +45 -31
  50. package/dist/bin/git-jira-issue-list.js +36 -24
  51. package/dist/bin/git-jira-issue-show.js +16 -4
  52. package/dist/bin/git-jira-issue.js +18 -10
  53. package/dist/bin/git-jira-start.js +16 -4
  54. package/dist/bin/git-jira-whoami.js +37 -25
  55. package/dist/bin/git-jira.js +32 -22
  56. package/dist/bin/git-lab-group-list.js +18 -6
  57. package/dist/bin/git-lab-group.js +19 -9
  58. package/dist/bin/git-lab-merge-active.js +18 -6
  59. package/dist/bin/git-lab-merge-todo.js +18 -6
  60. package/dist/bin/git-lab-merge-train-list.js +17 -5
  61. package/dist/bin/git-lab-merge-train.js +18 -8
  62. package/dist/bin/git-lab-merge.js +25 -21
  63. package/dist/bin/git-lab-namespace-list.js +38 -26
  64. package/dist/bin/git-lab-namespace.js +39 -29
  65. package/dist/bin/git-lab-project-list.js +18 -6
  66. package/dist/bin/git-lab-project-mr-list.js +18 -6
  67. package/dist/bin/git-lab-project-mr.js +19 -9
  68. package/dist/bin/git-lab-project-pipeline-jobs.js +16 -4
  69. package/dist/bin/git-lab-project-pipeline-latest.js +16 -4
  70. package/dist/bin/git-lab-project-pipeline-list.js +18 -6
  71. package/dist/bin/git-lab-project-pipeline-log.js +16 -4
  72. package/dist/bin/git-lab-project-pipeline.js +22 -18
  73. package/dist/bin/git-lab-project-whereami.js +17 -5
  74. package/dist/bin/git-lab-project.js +32 -38
  75. package/dist/bin/git-lab-whoami.js +17 -5
  76. package/dist/bin/git-lab.js +61 -81
  77. package/dist/bin/gitj-install-skills.js +21 -11
  78. package/dist/bin/gitj.js +154 -153
  79. package/dist/index.js +32 -1
  80. package/lib/api.ts +19 -1
  81. package/lib/confluence/api.ts +12 -0
  82. package/lib/confluence/config.ts +3 -3
  83. package/lib/gitlab/api.ts +4 -0
  84. package/lib/gitlab/config.ts +2 -2
  85. package/lib/is_main.ts +11 -0
  86. package/lib/jira.ts +7 -3
  87. package/package.json +1 -1
package/bin/git-api.ts CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { Command } from 'commander'
4
4
  import { getPackageVersion } from '../lib/package'
5
- import { isMain } from '../lib/is_main'
5
+ import { runMain } from '../lib/is_main'
6
6
  import { apiRequest, apiPaginate, serviceNames } from '../lib/api.ts'
7
7
 
8
8
  const version = await getPackageVersion()
@@ -65,6 +65,4 @@ export function create(): Command {
65
65
 
66
66
  export default create
67
67
 
68
- if (isMain('git-api')) {
69
- await create().parseAsync(Bun.argv)
70
- }
68
+ await runMain('git-api', create)
package/bin/git-bump.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  import { createBranch, getCurrentBranch } from "../lib/git"
4
4
  import { Command } from 'commander'
5
5
  import { getPackageVersion } from '../lib/package'
6
- import { isMain } from '../lib/is_main'
6
+ import { runMain } from '../lib/is_main'
7
7
  const version = await getPackageVersion()
8
8
 
9
9
  export function create(): Command {
@@ -32,6 +32,4 @@ export function create(): Command {
32
32
 
33
33
  export default create
34
34
 
35
- if (isMain('git-bump')) {
36
- await create().parseAsync(Bun.argv)
37
- }
35
+ await runMain('git-bump', create)
@@ -5,7 +5,7 @@ import { getPackageVersion } from '../lib/package'
5
5
  import { confluenceApi, confluenceSearch } from '../lib/confluence'
6
6
  import { getConfluenceConfig } from '../lib/confluence'
7
7
  import type { Page, SearchResult } from '../lib/confluence'
8
- import { isMain } from '../lib/is_main'
8
+ import { runMain } from '../lib/is_main'
9
9
  const version = await getPackageVersion()
10
10
 
11
11
  export function create(): Command {
@@ -24,7 +24,7 @@ export function create(): Command {
24
24
  if (options.exact) {
25
25
  const pages = await confluenceApi(`pages?title=${encodeURIComponent(query)}`) as Array<Page>
26
26
  if (options.verbose) {
27
- console.log(pages)
27
+ console.log(JSON.stringify(pages, null, 2))
28
28
  } else {
29
29
  for (const page of pages) {
30
30
  const url = `https://${host}/wiki/spaces/${page.spaceId}/pages/${page.id}`
@@ -38,7 +38,7 @@ export function create(): Command {
38
38
  const cql = `type=page AND ${field} ~ "${query}"`
39
39
  const results = await confluenceSearch(cql) as Array<SearchResult>
40
40
  if (options.verbose) {
41
- console.log(results)
41
+ console.log(JSON.stringify(results, null, 2))
42
42
  } else {
43
43
  for (const result of results) {
44
44
  const id = result.content.id
@@ -53,6 +53,4 @@ export function create(): Command {
53
53
 
54
54
  export default create
55
55
 
56
- if (isMain('git-confluence-page-search')) {
57
- await create().parseAsync(Bun.argv)
58
- }
56
+ await runMain('git-confluence-page-search', create)
@@ -5,7 +5,7 @@ import { getPackageVersion } from '../lib/package'
5
5
  import { confluenceApi } from '../lib/confluence'
6
6
  import { getConfluenceConfig } from '../lib/confluence'
7
7
  import type { Page } from '../lib/confluence'
8
- import { isMain } from '../lib/is_main'
8
+ import { runMain } from '../lib/is_main'
9
9
  const version = await getPackageVersion()
10
10
 
11
11
  export function create(): Command {
@@ -40,7 +40,7 @@ export function create(): Command {
40
40
  process.exit(1)
41
41
  }
42
42
  } else if (options.verbose) {
43
- console.log(page)
43
+ console.log(JSON.stringify(page, null, 2))
44
44
  } else {
45
45
  const { host } = await getConfluenceConfig()
46
46
  const url = `https://${host}/wiki/spaces/${page.spaceId}/pages/${page.id}`
@@ -56,6 +56,4 @@ export function create(): Command {
56
56
 
57
57
  export default create
58
58
 
59
- if (isMain('git-confluence-page-show')) {
60
- await create().parseAsync(Bun.argv)
61
- }
59
+ await runMain('git-confluence-page-show', create)
@@ -5,7 +5,7 @@ import { getPackageVersion } from '../lib/package'
5
5
  import { confluenceApi, confluenceApiWrite } from '../lib/confluence'
6
6
  import type { Page } from '../lib/confluence'
7
7
  import type { JSONValue } from '../lib/json'
8
- import { isMain } from '../lib/is_main'
8
+ import { runMain } from '../lib/is_main'
9
9
  const version = await getPackageVersion()
10
10
 
11
11
  async function readStdin(): Promise<string> {
@@ -62,7 +62,7 @@ export function create(): Command {
62
62
 
63
63
  const result = await confluenceApiWrite(`pages/${id}`, 'PUT', body) as Page
64
64
  if (options.verbose) {
65
- console.log(result)
65
+ console.log(JSON.stringify(result, null, 2))
66
66
  } else {
67
67
  console.log(`Updated page ${result.id} "${result.title}" to version ${result.version.number}`)
68
68
  }
@@ -72,6 +72,4 @@ export function create(): Command {
72
72
 
73
73
  export default create
74
74
 
75
- if (isMain('git-confluence-page-update')) {
76
- await create().parseAsync(Bun.argv)
77
- }
75
+ await runMain('git-confluence-page-update', create)
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { Command } from 'commander'
4
4
  import { getPackageVersion } from '../lib/package'
5
- import { isMain } from '../lib/is_main'
5
+ import { runMain } from '../lib/is_main'
6
6
  import search from './git-confluence-page-search'
7
7
  import show from './git-confluence-page-show'
8
8
  import update from './git-confluence-page-update'
@@ -23,6 +23,4 @@ export function create(): Command {
23
23
 
24
24
  export default create
25
25
 
26
- if (isMain('git-confluence-page')) {
27
- await create().parseAsync(Bun.argv)
28
- }
26
+ await runMain('git-confluence-page', create)
@@ -4,7 +4,7 @@ import { Command } from 'commander'
4
4
  import { getPackageVersion } from '../lib/package'
5
5
  import { confluenceApi } from '../lib/confluence'
6
6
  import type { Space } from '../lib/confluence'
7
- import { isMain } from '../lib/is_main'
7
+ import { runMain } from '../lib/is_main'
8
8
  const version = await getPackageVersion()
9
9
 
10
10
  export function create(): Command {
@@ -17,7 +17,7 @@ export function create(): Command {
17
17
  .action(async (options) => {
18
18
  const spaces = await confluenceApi('spaces') as Array<Space>
19
19
  if (options.verbose) {
20
- console.log(spaces)
20
+ console.log(JSON.stringify(spaces, null, 2))
21
21
  } else {
22
22
  for (const space of spaces) {
23
23
  console.log(`${space.key}\t${space.name}`)
@@ -29,6 +29,4 @@ export function create(): Command {
29
29
 
30
30
  export default create
31
31
 
32
- if (isMain('git-confluence-space-list')) {
33
- await create().parseAsync(Bun.argv)
34
- }
32
+ await runMain('git-confluence-space-list', create)
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { Command } from 'commander'
4
4
  import { getPackageVersion } from '../lib/package'
5
- import { isMain } from '../lib/is_main'
5
+ import { runMain } from '../lib/is_main'
6
6
  import list from './git-confluence-space-list'
7
7
  const version = await getPackageVersion()
8
8
 
@@ -19,6 +19,4 @@ export function create(): Command {
19
19
 
20
20
  export default create
21
21
 
22
- if (isMain('git-confluence-space')) {
23
- await create().parseAsync(Bun.argv)
24
- }
22
+ await runMain('git-confluence-space', create)
@@ -4,7 +4,7 @@ import { Command } from 'commander'
4
4
  import { getPackageVersion } from '../lib/package'
5
5
  import { confluenceApiV1 } from '../lib/confluence'
6
6
  import type { ConfluenceUser } from '../lib/confluence'
7
- import { isMain } from '../lib/is_main'
7
+ import { runMain } from '../lib/is_main'
8
8
  const version = await getPackageVersion()
9
9
 
10
10
  export function create(): Command {
@@ -17,7 +17,7 @@ export function create(): Command {
17
17
  .action(async (options) => {
18
18
  const myself = await confluenceApiV1('user/current') as ConfluenceUser
19
19
  if (options.verbose) {
20
- console.log(myself)
20
+ console.log(JSON.stringify(myself, null, 2))
21
21
  } else {
22
22
  const { displayName, email, accountId } = myself
23
23
  console.log({ displayName, email, accountId })
@@ -28,6 +28,4 @@ export function create(): Command {
28
28
 
29
29
  export default create
30
30
 
31
- if (isMain('git-confluence-whoami')) {
32
- await create().parseAsync(Bun.argv)
33
- }
31
+ await runMain('git-confluence-whoami', create)
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { Command } from 'commander'
4
4
  import { getPackageVersion } from '../lib/package'
5
- import { isMain } from '../lib/is_main'
5
+ import { runMain } from '../lib/is_main'
6
6
  import whoami from './git-confluence-whoami'
7
7
  import space from './git-confluence-space'
8
8
  import page from './git-confluence-page'
@@ -17,11 +17,18 @@ export function create(): Command {
17
17
  .addCommand(whoami())
18
18
  .addCommand(space())
19
19
  .addCommand(page())
20
+ .addHelpText('after', `
21
+ Required git config:
22
+ confluence.host your Confluence hostname (or jira.host as fallback)
23
+ confluence.token your Atlassian API token (or jira.token as fallback)
24
+
25
+ Optional git config:
26
+ confluence.user your Confluence email (falls back to jira.user, then user.email)
27
+
28
+ Set with: git config --global confluence.host <value>`)
20
29
  return program
21
30
  }
22
31
 
23
32
  export default create
24
33
 
25
- if (isMain('git-confluence')) {
26
- await create().parseAsync(Bun.argv)
27
- }
34
+ await runMain('git-confluence', create)
@@ -3,7 +3,7 @@
3
3
  import { Command } from 'commander'
4
4
  import { getPackageVersion } from '../lib/package'
5
5
  import { myUnresolvedIssues } from "../lib/jira"
6
- import { isMain } from '../lib/is_main'
6
+ import { runMain } from '../lib/is_main'
7
7
  const version = await getPackageVersion()
8
8
 
9
9
  export function create(): Command {
@@ -24,6 +24,4 @@ export function create(): Command {
24
24
 
25
25
  export default create
26
26
 
27
- if (isMain('git-jira-issue-list')) {
28
- await create().parseAsync(Bun.argv)
29
- }
27
+ await runMain('git-jira-issue-list', create)
@@ -3,7 +3,7 @@
3
3
  import { Command } from 'commander'
4
4
  import { getPackageVersion } from '../lib/package'
5
5
  import { getIssue } from "../lib/jira"
6
- import { isMain } from '../lib/is_main'
6
+ import { runMain } from '../lib/is_main'
7
7
  import { getJiraConfig } from '../lib/jira'
8
8
  const version = await getPackageVersion()
9
9
 
@@ -22,7 +22,7 @@ export function create(): Command {
22
22
  process.exit(1)
23
23
  }
24
24
  if (options.verbose) {
25
- console.log(issue)
25
+ console.log(JSON.stringify(issue, null, 2))
26
26
  } else {
27
27
  const { host } = await getJiraConfig()
28
28
  const summary = issue.fields.summary
@@ -35,6 +35,4 @@ export function create(): Command {
35
35
 
36
36
  export default create
37
37
 
38
- if (isMain('git-jira-issue-show')) {
39
- await create().parseAsync(Bun.argv)
40
- }
38
+ await runMain('git-jira-issue-show', create)
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { Command } from 'commander'
4
4
  import { getPackageVersion } from '../lib/package'
5
- import { isMain } from '../lib/is_main'
5
+ import { runMain } from '../lib/is_main'
6
6
  import list from './git-jira-issue-list'
7
7
  import show from './git-jira-issue-show'
8
8
  const version = await getPackageVersion()
@@ -22,6 +22,4 @@ export function create(): Command {
22
22
 
23
23
  export default create
24
24
 
25
- if (isMain('git-jira-issue')) {
26
- await create().parseAsync(Bun.argv)
27
- }
25
+ await runMain('git-jira-issue', create)
@@ -4,7 +4,7 @@ import { Command } from 'commander'
4
4
  import { getPackageVersion } from '../lib/package'
5
5
  import { createBranch } from "../lib/git"
6
6
  import { getIssue } from "../lib/jira"
7
- import { isMain } from '../lib/is_main'
7
+ import { runMain } from '../lib/is_main'
8
8
  const version = await getPackageVersion()
9
9
 
10
10
  function toKebab(s: string): string {
@@ -37,6 +37,4 @@ export function create(): Command {
37
37
 
38
38
  export default create
39
39
 
40
- if (isMain('git-jira-start')) {
41
- await create().parseAsync(Bun.argv)
42
- }
40
+ await runMain('git-jira-start', create)
@@ -3,7 +3,7 @@
3
3
  import { Command } from 'commander'
4
4
  import { getPackageVersion } from '../lib/package'
5
5
  import { getMyself } from '../lib/jira'
6
- import { isMain } from '../lib/is_main'
6
+ import { runMain } from '../lib/is_main'
7
7
  const version = await getPackageVersion()
8
8
 
9
9
  export function create(): Command {
@@ -16,7 +16,7 @@ export function create(): Command {
16
16
  .action(async (options) => {
17
17
  const myself = await getMyself()
18
18
  if (options.verbose) {
19
- console.log(myself)
19
+ console.log(JSON.stringify(myself, null, 2))
20
20
  } else {
21
21
  const { displayName, emailAddress, accountId } = myself as any
22
22
  console.log({ displayName, emailAddress, accountId })
@@ -27,6 +27,4 @@ export function create(): Command {
27
27
 
28
28
  export default create
29
29
 
30
- if (isMain('git-jira-whoami')) {
31
- await create().parseAsync(Bun.argv)
32
- }
30
+ await runMain('git-jira-whoami', create)
package/bin/git-jira.ts CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { Command } from 'commander'
4
4
  import { getPackageVersion } from '../lib/package'
5
- import { isMain } from '../lib/is_main'
5
+ import { runMain } from '../lib/is_main'
6
6
  import start from './git-jira-start'
7
7
  import issue from './git-jira-issue'
8
8
  import issues from './git-jira-issue-list'
@@ -19,11 +19,18 @@ export function create(): Command {
19
19
  .addCommand(issue())
20
20
  .addCommand(issues())
21
21
  .addCommand(whoami())
22
+ .addHelpText('after', `
23
+ Required git config:
24
+ jira.host your Jira hostname (e.g. yourcompany.atlassian.net)
25
+ jira.token your Atlassian API token
26
+
27
+ Optional git config:
28
+ jira.user your Jira email (falls back to user.email)
29
+
30
+ Set with: git config --global jira.host <value>`)
22
31
  return program
23
32
  }
24
33
 
25
34
  export default create
26
35
 
27
- if (isMain('git-jira')) {
28
- await create().parseAsync(Bun.argv)
29
- }
36
+ await runMain('git-jira', create)
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { Command } from 'commander'
4
4
  import { getPackageVersion } from '../lib/package'
5
- import { isMain } from '../lib/is_main'
5
+ import { runMain } from '../lib/is_main'
6
6
  import { getGroups } from '../lib/gitlab'
7
7
  const version = await getPackageVersion()
8
8
 
@@ -16,13 +16,13 @@ export function create(): Command {
16
16
  .action(async (options) => {
17
17
  const groups = await getGroups()
18
18
  if (options.verbose)
19
- console.log(groups)
19
+ console.log(JSON.stringify(groups, null, 2))
20
20
  else {
21
21
  const filtered = groups.map(g => {
22
22
  const { id, name, full_path } = g
23
23
  return { id, name, full_path }
24
24
  })
25
- console.log(filtered)
25
+ console.log(JSON.stringify(filtered, null, 2))
26
26
  }
27
27
  })
28
28
  return program
@@ -30,6 +30,4 @@ export function create(): Command {
30
30
 
31
31
  export default create
32
32
 
33
- if (isMain('git-lab-group-list')) {
34
- await create().parseAsync(Bun.argv)
35
- }
33
+ await runMain('git-lab-group-list', create)
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { Command } from 'commander'
4
4
  import { getPackageVersion } from '../lib/package'
5
- import { isMain } from '../lib/is_main'
5
+ import { runMain } from '../lib/is_main'
6
6
  const version = await getPackageVersion()
7
7
 
8
8
  import list from './git-lab-group-list'
@@ -20,6 +20,4 @@ export function create(): Command {
20
20
 
21
21
  export default create
22
22
 
23
- if (isMain('git-lab-group')) {
24
- await create().parseAsync(Bun.argv)
25
- }
23
+ await runMain('git-lab-group', create)
@@ -3,7 +3,7 @@
3
3
  import { Command } from 'commander'
4
4
  import { getPackageVersion } from '../lib/package'
5
5
  import { getMyMergeRequestsInProgress } from "../lib/gitlab"
6
- import { isMain } from '../lib/is_main'
6
+ import { runMain } from '../lib/is_main'
7
7
  const version = await getPackageVersion()
8
8
 
9
9
  export function create(): Command {
@@ -20,7 +20,7 @@ export function create(): Command {
20
20
  process.exit(1)
21
21
  }
22
22
  if (options.verbose) {
23
- console.log(merges)
23
+ console.log(JSON.stringify(merges, null, 2))
24
24
  process.exit(0)
25
25
  }
26
26
  else {
@@ -28,7 +28,7 @@ export function create(): Command {
28
28
  const { title, web_url, source_branch, target_branch } = m
29
29
  return { title, web_url, source_branch, target_branch }
30
30
  })
31
- console.log(filtered)
31
+ console.log(JSON.stringify(filtered, null, 2))
32
32
  }
33
33
  })
34
34
  return program
@@ -36,6 +36,4 @@ export function create(): Command {
36
36
 
37
37
  export default create
38
38
 
39
- if (isMain('git-lab-merge-active')) {
40
- await create().parseAsync(Bun.argv)
41
- }
39
+ await runMain('git-lab-merge-active', create)
@@ -3,7 +3,7 @@
3
3
  import { Command } from 'commander'
4
4
  import { getPackageVersion } from '../lib/package'
5
5
  import { getMyMergeRequestsToReview, type MergeRequest } from "../lib/gitlab"
6
- import { isMain } from '../lib/is_main'
6
+ import { runMain } from '../lib/is_main'
7
7
  const version = await getPackageVersion()
8
8
 
9
9
  export function create(): Command {
@@ -16,14 +16,14 @@ export function create(): Command {
16
16
  .action(async (options) => {
17
17
  const mrs: MergeRequest[] = await getMyMergeRequestsToReview()
18
18
  if (options.verbose) {
19
- console.log(mrs)
19
+ console.log(JSON.stringify(mrs, null, 2))
20
20
  }
21
21
  else {
22
22
  const filtered = mrs.map(mr => {
23
23
  const { title, web_url, source_branch, target_branch } = mr
24
24
  return { title, web_url, source_branch, target_branch }
25
25
  })
26
- console.log(filtered)
26
+ console.log(JSON.stringify(filtered, null, 2))
27
27
  }
28
28
  })
29
29
  return program
@@ -31,6 +31,4 @@ export function create(): Command {
31
31
 
32
32
  export default create
33
33
 
34
- if (isMain('git-lab-merge-todo')) {
35
- await create().parseAsync(Bun.argv)
36
- }
34
+ await runMain('git-lab-merge-todo', create)
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { Command } from 'commander'
4
4
  import { getPackageVersion } from '../lib/package'
5
- import { isMain } from '../lib/is_main'
5
+ import { runMain } from '../lib/is_main'
6
6
  import { getMergeTrains } from '../lib/gitlab/merge-trains'
7
7
  const version = await getPackageVersion()
8
8
 
@@ -14,13 +14,11 @@ export function create(): Command {
14
14
  .description('List merge trains for the current project')
15
15
  .action(async () => {
16
16
  const trains = await getMergeTrains()
17
- console.log(trains)
17
+ console.log(JSON.stringify(trains, null, 2))
18
18
  })
19
19
  return program
20
20
  }
21
21
 
22
22
  export default create
23
23
 
24
- if (isMain('git-lab-merge-train-list')) {
25
- await create().parseAsync(Bun.argv)
26
- }
24
+ await runMain('git-lab-merge-train-list', create)
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { Command } from 'commander'
4
4
  import { getPackageVersion } from '../lib/package'
5
- import { isMain } from '../lib/is_main'
5
+ import { runMain } from '../lib/is_main'
6
6
  const version = await getPackageVersion()
7
7
 
8
8
  import list from './git-lab-merge-train-list'
@@ -20,6 +20,4 @@ export function create(): Command {
20
20
 
21
21
  export default create
22
22
 
23
- if (isMain('git-lab-merge-train')) {
24
- await create().parseAsync(Bun.argv)
25
- }
23
+ await runMain('git-lab-merge-train', create)
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { Command } from 'commander'
4
4
  import { getPackageVersion } from '../lib/package'
5
- import { isMain } from '../lib/is_main'
5
+ import { runMain } from '../lib/is_main'
6
6
  import todo from './git-lab-merge-todo'
7
7
  import active from './git-lab-merge-active'
8
8
  import train from './git-lab-merge-train'
@@ -24,6 +24,4 @@ export function create(): Command {
24
24
 
25
25
  export default create
26
26
 
27
- if (isMain('git-lab-merge')) {
28
- await create().parseAsync(Bun.argv)
29
- }
27
+ await runMain('git-lab-merge', create)
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { Command } from 'commander'
4
4
  import { getPackageVersion } from '../lib/package'
5
- import { isMain } from '../lib/is_main'
5
+ import { runMain } from '../lib/is_main'
6
6
  import { getNamespaces } from '../lib/gitlab/namespace'
7
7
 
8
8
  const version = await getPackageVersion()
@@ -15,13 +15,11 @@ export function create(): Command {
15
15
  .description('List namespaces for the current user')
16
16
  .action(async () => {
17
17
  const namespaces = await getNamespaces()
18
- console.log(namespaces)
18
+ console.log(JSON.stringify(namespaces, null, 2))
19
19
  })
20
20
  return program
21
21
  }
22
22
 
23
23
  export default create
24
24
 
25
- if (isMain('git-lab-namespace-list')) {
26
- await create().parseAsync(Bun.argv)
27
- }
25
+ await runMain('git-lab-namespace-list', create)
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { Command } from 'commander'
4
4
  import { getPackageVersion } from '../lib/package'
5
- import { isMain } from '../lib/is_main'
5
+ import { runMain } from '../lib/is_main'
6
6
  import list from './git-lab-namespace-list'
7
7
  const version = await getPackageVersion()
8
8
 
@@ -19,6 +19,4 @@ export function create(): Command {
19
19
 
20
20
  export default create
21
21
 
22
- if (isMain('git-lab-namespace')) {
23
- await create().parseAsync(Bun.argv)
24
- }
22
+ await runMain('git-lab-namespace', create)
@@ -3,7 +3,7 @@
3
3
  import { Command } from 'commander'
4
4
  import { getPackageVersion } from '../lib/package'
5
5
  import { getProjects, type Project } from "../lib/gitlab/project"
6
- import { isMain } from '../lib/is_main'
6
+ import { runMain } from '../lib/is_main'
7
7
  const version = await getPackageVersion()
8
8
 
9
9
  export function create(): Command {
@@ -21,14 +21,14 @@ export function create(): Command {
21
21
  process.exit(1)
22
22
  }
23
23
  if (options.verbose) {
24
- console.log(projects)
24
+ console.log(JSON.stringify(projects, null, 2))
25
25
  }
26
26
  else {
27
27
  let filtered = projects.map((p: Project) => {
28
28
  const { id, name, path_with_namespace, ssh_url_to_repo } = p
29
29
  return { id, name, path_with_namespace, ssh_url_to_repo }
30
30
  })
31
- console.log(filtered)
31
+ console.log(JSON.stringify(filtered, null, 2))
32
32
  }
33
33
  })
34
34
  return program
@@ -36,6 +36,4 @@ export function create(): Command {
36
36
 
37
37
  export default create
38
38
 
39
- if (isMain('git-lab-project-list')) {
40
- await create().parseAsync(Bun.argv)
41
- }
39
+ await runMain('git-lab-project-list', create)