ya-git-jira 1.0.0 → 1.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.
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env bun
2
+
3
+ import { createBranch, getCurrentBranch } from "../lib/git"
4
+ import { program } from 'commander'
5
+
6
+ program
7
+ .action(async () => {
8
+ const currentBranch = await getCurrentBranch()
9
+
10
+ let stem = currentBranch
11
+ let version = 1
12
+
13
+ const match = currentBranch.match(/^(.+)[-\.]v(\d+)$/)
14
+ if (match) {
15
+ stem = match[1]
16
+ version = parseInt(match[2]) + 1
17
+ }
18
+
19
+ const nextBranch = `${stem}.v${version}`
20
+ await createBranch(nextBranch)
21
+ })
22
+ .parse(process.argv)
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env bun
2
+
3
+ import { program } from 'commander'
4
+ import { myUnresolvedIssues } from "../lib/jira"
5
+
6
+ program
7
+ .action(async (options) => {
8
+
9
+ const issues = await myUnresolvedIssues()
10
+ console.log(`You have ${issues.length} unresolved issues`)
11
+ issues.forEach(issue => {
12
+ console.log(`${issue.key}: ${issue.fields.summary}`)
13
+ })
14
+ })
15
+ .parse(process.argv)
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env bun
2
+
3
+ import { program } from 'commander'
4
+ import { createBranch } from "../lib/git"
5
+ import { getIssue } from "../lib/jira"
6
+
7
+ function toKebab(s: string): string {
8
+ return s.replace(/([a-z]+)([A-Z]+)/g, "$1_2").toLowerCase()
9
+ .replace(/(\W+)/g, "-")
10
+ .replace(/-$/, "")
11
+ }
12
+
13
+ program
14
+ .argument('<issue>', 'Issue ID')
15
+ .action(async (issueId: string, options) => {
16
+
17
+ const issue = await getIssue(issueId)
18
+ if (!issue) {
19
+ console.error(`Issue ${issueId} not found`)
20
+ process.exit(1)
21
+ }
22
+ const summary = issue.fields.summary
23
+
24
+ const branchName = `${issueId}-${toKebab(summary)}`
25
+ await createBranch(branchName)
26
+ })
27
+ .parse(process.argv)
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env bun
2
+
3
+ // This is the root for the jira commands CLI. It's job is to parse the command
4
+ // from the command line and then call the appropriate jira subcommand.
5
+
6
+ import { program } from 'commander'
7
+
8
+ program
9
+ .command('start', 'Create a new branch for a given Jira issue')
10
+ .command('issues', 'List your unresolved Jira issues')
11
+
12
+ program
13
+ .action(() => {
14
+ program.help()
15
+ })
16
+ .parse(process.argv)
package/bin/gitj.ts ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env bun
2
+
3
+ // This is the root of the CLI. It's job is to parse the command
4
+ // from the command line and then call the appropriate subcommand.
5
+
6
+ import { program } from 'commander'
7
+
8
+ program
9
+ .executableDir('./bin')
10
+ .command('bump', 'Create a new branch with an incremented version number', { executableFile: 'git-bump' })
11
+ .command('jira', 'A collection of jira utility commands', { executableFile: 'git-jira' })
12
+
13
+ program
14
+ .action(() => {
15
+ program.help()
16
+ })
17
+ .parse(process.argv)
package/bun.lockb CHANGED
Binary file