ya-git-jira 2.0.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 (94) hide show
  1. package/.dockerignore +8 -0
  2. package/.opencode/skills/git-confluence/SKILL.md +18 -18
  3. package/.opencode/skills/git-jira/SKILL.md +18 -18
  4. package/.opencode/skills/git-lab/SKILL.md +30 -30
  5. package/Dockerfile +58 -0
  6. package/README.md +31 -12
  7. package/bin/git-api.ts +2 -4
  8. package/bin/git-bump.ts +2 -4
  9. package/bin/git-confluence-page-search.ts +4 -6
  10. package/bin/git-confluence-page-show.ts +3 -5
  11. package/bin/git-confluence-page-update.ts +3 -5
  12. package/bin/git-confluence-page.ts +2 -4
  13. package/bin/git-confluence-space-list.ts +3 -5
  14. package/bin/git-confluence-space.ts +2 -4
  15. package/bin/git-confluence-whoami.ts +3 -5
  16. package/bin/git-confluence.ts +11 -4
  17. package/bin/git-jira-issue-list.ts +2 -4
  18. package/bin/git-jira-issue-show.ts +3 -5
  19. package/bin/git-jira-issue.ts +2 -4
  20. package/bin/git-jira-start.ts +2 -4
  21. package/bin/git-jira-whoami.ts +3 -5
  22. package/bin/git-jira.ts +11 -4
  23. package/bin/git-lab-group-list.ts +4 -6
  24. package/bin/git-lab-group.ts +2 -4
  25. package/bin/git-lab-merge-active.ts +4 -6
  26. package/bin/git-lab-merge-todo.ts +4 -6
  27. package/bin/git-lab-merge-train-list.ts +3 -5
  28. package/bin/git-lab-merge-train.ts +2 -4
  29. package/bin/git-lab-merge.ts +2 -4
  30. package/bin/git-lab-namespace-list.ts +3 -5
  31. package/bin/git-lab-namespace.ts +2 -4
  32. package/bin/git-lab-project-list.ts +4 -6
  33. package/bin/git-lab-project-mr-list.ts +4 -6
  34. package/bin/git-lab-project-mr.ts +2 -4
  35. package/bin/git-lab-project-pipeline-jobs.ts +2 -4
  36. package/bin/git-lab-project-pipeline-latest.ts +2 -4
  37. package/bin/git-lab-project-pipeline-list.ts +4 -6
  38. package/bin/git-lab-project-pipeline-log.ts +2 -4
  39. package/bin/git-lab-project-pipeline.ts +2 -4
  40. package/bin/git-lab-project-whereami.ts +3 -5
  41. package/bin/git-lab-project.ts +2 -4
  42. package/bin/git-lab-whoami.ts +3 -5
  43. package/bin/git-lab.ts +11 -4
  44. package/bin/gitj-install-skills.ts +15 -12
  45. package/bin/gitj.ts +6 -1
  46. package/dist/bin/git-api.js +33 -5
  47. package/dist/bin/git-bump.js +32 -24
  48. package/dist/bin/git-confluence-page-search.js +46 -26
  49. package/dist/bin/git-confluence-page-show.js +24 -4
  50. package/dist/bin/git-confluence-page-update.js +24 -4
  51. package/dist/bin/git-confluence-page.js +30 -16
  52. package/dist/bin/git-confluence-space-list.js +45 -25
  53. package/dist/bin/git-confluence-space.js +46 -28
  54. package/dist/bin/git-confluence-whoami.js +45 -25
  55. package/dist/bin/git-confluence.js +45 -31
  56. package/dist/bin/git-jira-issue-list.js +36 -24
  57. package/dist/bin/git-jira-issue-show.js +16 -4
  58. package/dist/bin/git-jira-issue.js +18 -10
  59. package/dist/bin/git-jira-start.js +16 -4
  60. package/dist/bin/git-jira-whoami.js +37 -25
  61. package/dist/bin/git-jira.js +32 -22
  62. package/dist/bin/git-lab-group-list.js +18 -6
  63. package/dist/bin/git-lab-group.js +19 -9
  64. package/dist/bin/git-lab-merge-active.js +18 -6
  65. package/dist/bin/git-lab-merge-todo.js +18 -6
  66. package/dist/bin/git-lab-merge-train-list.js +17 -5
  67. package/dist/bin/git-lab-merge-train.js +18 -8
  68. package/dist/bin/git-lab-merge.js +25 -21
  69. package/dist/bin/git-lab-namespace-list.js +38 -26
  70. package/dist/bin/git-lab-namespace.js +39 -29
  71. package/dist/bin/git-lab-project-list.js +18 -6
  72. package/dist/bin/git-lab-project-mr-list.js +18 -6
  73. package/dist/bin/git-lab-project-mr.js +19 -9
  74. package/dist/bin/git-lab-project-pipeline-jobs.js +16 -4
  75. package/dist/bin/git-lab-project-pipeline-latest.js +16 -4
  76. package/dist/bin/git-lab-project-pipeline-list.js +18 -6
  77. package/dist/bin/git-lab-project-pipeline-log.js +16 -4
  78. package/dist/bin/git-lab-project-pipeline.js +22 -18
  79. package/dist/bin/git-lab-project-whereami.js +17 -5
  80. package/dist/bin/git-lab-project.js +32 -38
  81. package/dist/bin/git-lab-whoami.js +17 -5
  82. package/dist/bin/git-lab.js +61 -81
  83. package/dist/bin/gitj-install-skills.js +21 -11
  84. package/dist/bin/gitj.js +154 -153
  85. package/dist/index.js +32 -1
  86. package/install-docker-gitj.sh +77 -0
  87. package/lib/api.ts +19 -1
  88. package/lib/confluence/api.ts +12 -0
  89. package/lib/confluence/config.ts +3 -3
  90. package/lib/gitlab/api.ts +4 -0
  91. package/lib/gitlab/config.ts +2 -2
  92. package/lib/is_main.ts +11 -0
  93. package/lib/jira.ts +7 -3
  94. package/package.json +1 -1
@@ -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)
@@ -5,7 +5,7 @@ import { getPackageVersion } from '../lib/package'
5
5
  import { getMergeRequestsByBranch, type MergeRequest } from "../lib/gitlab"
6
6
  import { findProject } from '../lib/gitlab/project'
7
7
  import { getRemote, getCurrentBranch } from '../lib/git'
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 {
@@ -37,14 +37,14 @@ export function create(): Command {
37
37
  process.exit(0)
38
38
  }
39
39
  if (options.verbose) {
40
- console.log(mrs)
40
+ console.log(JSON.stringify(mrs, null, 2))
41
41
  }
42
42
  else {
43
43
  const filtered = mrs.map(m => {
44
44
  const { iid, title, web_url, source_branch, target_branch, state, draft } = m
45
45
  return { iid, title, web_url, source_branch, target_branch, state, draft }
46
46
  })
47
- console.log(filtered)
47
+ console.log(JSON.stringify(filtered, null, 2))
48
48
  }
49
49
  })
50
50
  return program
@@ -52,6 +52,4 @@ export function create(): Command {
52
52
 
53
53
  export default create
54
54
 
55
- if (isMain('git-lab-project-mr-list')) {
56
- await create().parseAsync(Bun.argv)
57
- }
55
+ await runMain('git-lab-project-mr-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-project-mr-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-project-mr')) {
23
- await create().parseAsync(Bun.argv)
24
- }
22
+ await runMain('git-lab-project-mr', create)
@@ -3,7 +3,7 @@
3
3
  import { Command } from 'commander'
4
4
  import { getPackageVersion } from '../lib/package'
5
5
  import { getPipelineJobs, type Job } from '../lib/gitlab'
6
- import { isMain } from '../lib/is_main'
6
+ import { runMain } from '../lib/is_main'
7
7
 
8
8
  const version = await getPackageVersion()
9
9
 
@@ -41,6 +41,4 @@ export function create(): Command {
41
41
 
42
42
  export default create
43
43
 
44
- if (isMain('git-lab-project-pipeline-jobs')) {
45
- await create().parseAsync(Bun.argv)
46
- }
44
+ await runMain('git-lab-project-pipeline-jobs', create)
@@ -3,7 +3,7 @@
3
3
  import { Command } from 'commander'
4
4
  import { getPackageVersion } from '../lib/package'
5
5
  import { getLatestPipeline, type Pipeline, getPipelineJobs, type Job } from '../lib/gitlab'
6
- import { isMain } from '../lib/is_main'
6
+ import { runMain } from '../lib/is_main'
7
7
 
8
8
  const version = await getPackageVersion()
9
9
 
@@ -42,6 +42,4 @@ export function create(): Command {
42
42
 
43
43
  export default create
44
44
 
45
- if (isMain('git-lab-project-pipeline-latest')) {
46
- await create().parseAsync(Bun.argv)
47
- }
45
+ await runMain('git-lab-project-pipeline-latest', create)
@@ -3,7 +3,7 @@
3
3
  import { Command } from 'commander'
4
4
  import { getPackageVersion } from '../lib/package'
5
5
  import { getProjectPipelines, type Pipeline } from "../lib/gitlab"
6
- import { isMain } from '../lib/is_main'
6
+ import { runMain } from '../lib/is_main'
7
7
  import debug from 'debug'
8
8
 
9
9
  const version = await getPackageVersion()
@@ -26,14 +26,14 @@ export function create(): Command {
26
26
  process.exit(1)
27
27
  }
28
28
  if (options.verbose) {
29
- console.log(pipelines)
29
+ console.log(JSON.stringify(pipelines, null, 2))
30
30
  }
31
31
  else {
32
32
  let filtered = pipelines.map((p: Pipeline) => {
33
33
  const { id, web_url, updated_at, ref, sha } = p
34
34
  return { id, web_url, updated_at, ref, sha }
35
35
  })
36
- console.log(filtered)
36
+ console.log(JSON.stringify(filtered, null, 2))
37
37
  }
38
38
  })
39
39
  return program
@@ -41,6 +41,4 @@ export function create(): Command {
41
41
 
42
42
  export default create
43
43
 
44
- if (isMain('git-lab-project-pipeline-list')) {
45
- await create().parseAsync(Bun.argv)
46
- }
44
+ await runMain('git-lab-project-pipeline-list', create)
@@ -3,7 +3,7 @@
3
3
  import { Command } from 'commander'
4
4
  import { getPackageVersion } from '../lib/package'
5
5
  import { getJobLog } from '../lib/gitlab'
6
- import { isMain } from '../lib/is_main'
6
+ import { runMain } from '../lib/is_main'
7
7
 
8
8
  const version = await getPackageVersion()
9
9
 
@@ -44,6 +44,4 @@ export function create(): Command {
44
44
 
45
45
  export default create
46
46
 
47
- if (isMain('git-lab-project-pipeline-log')) {
48
- await create().parseAsync(Bun.argv)
49
- }
47
+ await runMain('git-lab-project-pipeline-log', 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 jobs from './git-lab-project-pipeline-jobs'
7
7
  import latest from './git-lab-project-pipeline-latest'
8
8
  import list from './git-lab-project-pipeline-list'
@@ -25,6 +25,4 @@ export function create(): Command {
25
25
 
26
26
  export default create
27
27
 
28
- if (isMain('git-lab-project-pipeline')) {
29
- await create().parseAsync(Bun.argv)
30
- }
28
+ await runMain('git-lab-project-pipeline', create)
@@ -4,7 +4,7 @@ import { Command } from 'commander'
4
4
  import { getPackageVersion } from '../lib/package'
5
5
  import { findProject } from "../lib/gitlab/project"
6
6
  import { getRemote } from '../lib/git'
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 {
@@ -27,7 +27,7 @@ export function create(): Command {
27
27
  process.exit(1)
28
28
  }
29
29
  if (options.verbose) {
30
- console.log(project)
30
+ console.log(JSON.stringify(project, null, 2))
31
31
  } else {
32
32
  const { id, name, path_with_namespace, ssh_url_to_repo } = project
33
33
  console.log({id, name, path_with_namespace, ssh_url_to_repo })
@@ -38,6 +38,4 @@ export function create(): Command {
38
38
 
39
39
  export default create
40
40
 
41
- if (isMain('git-lab-project-whereami')) {
42
- await create().parseAsync(Bun.argv)
43
- }
41
+ await runMain('git-lab-project-whereami', 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-project-list'
7
7
  import mr from './git-lab-project-mr'
8
8
  import pipeline from './git-lab-project-pipeline'
@@ -27,6 +27,4 @@ export function create(): Command {
27
27
 
28
28
  export default create
29
29
 
30
- if (isMain('git-lab-project')) {
31
- await create().parseAsync(Bun.argv)
32
- }
30
+ await runMain('git-lab-project', create)
@@ -3,7 +3,7 @@
3
3
  import { Command } from 'commander'
4
4
  import { getPackageVersion } from '../lib/package'
5
5
  import { whoami, type User } from "../lib/gitlab/user"
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(user)
23
+ console.log(JSON.stringify(user, null, 2))
24
24
  process.exit(0)
25
25
  }
26
26
  else {
@@ -32,6 +32,4 @@ export function create(): Command {
32
32
 
33
33
  export default create
34
34
 
35
- if (isMain('git-lab-whoami')) {
36
- await create().parseAsync(Bun.argv)
37
- }
35
+ await runMain('git-lab-whoami', create)
package/bin/git-lab.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 groups from './git-lab-group'
7
7
  import merges from './git-lab-merge'
8
8
  import namespaces from './git-lab-namespace'
@@ -22,11 +22,18 @@ export function create(): Command {
22
22
  .addCommand(projects())
23
23
  .addCommand(whoami())
24
24
  .action(() => program.help())
25
+ .addHelpText('after', `
26
+ Required git config:
27
+ gitlab.token your GitLab personal access token
28
+
29
+ Optional git config:
30
+ gitlab.host your GitLab hostname (defaults to gitlab.com)
31
+ gitlab.user your GitLab email (falls back to user.email)
32
+
33
+ Set with: git config --global gitlab.token <value>`)
25
34
  return program
26
35
  }
27
36
 
28
37
  export default create
29
38
 
30
- if (isMain('git-lab')) {
31
- await create().parseAsync(Bun.argv)
32
- }
39
+ await runMain('git-lab', create)