ya-git-jira 1.1.1 → 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/README.md CHANGED
@@ -1,13 +1,32 @@
1
1
  # ya-git-jira - Yet Another Git Jira
2
2
 
3
- This package installs two applications (for now) that are written to be
3
+ This package installs several scripts that are written to be
4
4
  usable as `git` extensions, i.e. sub-commands of the `git` command.
5
5
  The extensions faciliate workflow when using `git` for source control and `jira`
6
6
  for issue tracking. Other similar packages exist -- thus the "yet another"
7
7
  in the name.
8
8
 
9
- This package will likely evolve over time to include some other workflow cases.
10
- For now, the two commands are:
9
+ This package will likely evolve over time to include more workflow cases.
10
+
11
+ ## gitj -- A test driver to use instead of `git <command>`
12
+
13
+ It can be useful to run these commands as if they were being invoked through
14
+ `git` but using a proxy for `git` than can only execute the commands in this
15
+ package.
16
+
17
+ For example, to see the available top level commands, run `gitj --help`:
18
+
19
+ ```
20
+ $ gitj ---help
21
+ Usage: gitj [options] [command]
22
+
23
+ Options:
24
+ -h, --help display help for command
25
+
26
+ Commands:
27
+ bump
28
+ jira A collection of jira utility commands
29
+ ```
11
30
 
12
31
  ## git-jira-start -- Create a new topic branch for work on an issue
13
32
 
package/bin/git-bump.ts CHANGED
@@ -1,22 +1,34 @@
1
- #!/usr/bin/env bun
1
+ #!/usr/bin/env bun run
2
2
 
3
3
  import { createBranch, getCurrentBranch } from "../lib/git"
4
- import { program } from 'commander'
4
+ import { Command } from 'commander'
5
+ import { isMain } from '../lib/is_main'
5
6
 
6
- program
7
- .action(async () => {
8
- const currentBranch = await getCurrentBranch()
7
+ export function create(): Command {
8
+ const program = new Command()
9
+ program
10
+ .name('bump')
11
+ .description('Bump the version number in the current branch')
12
+ .action(async () => {
13
+ const currentBranch = await getCurrentBranch()
9
14
 
10
- let stem = currentBranch
11
- let version = 1
15
+ let stem = currentBranch
16
+ let version = 1
12
17
 
13
- const match = currentBranch.match(/^(.+)[-\.]v(\d+)$/)
14
- if (match) {
15
- stem = match[1]
16
- version = parseInt(match[2]) + 1
17
- }
18
+ const match = currentBranch.match(/^(.+)[-\.]v(\d+)$/)
19
+ if (match) {
20
+ stem = match[1]
21
+ version = parseInt(match[2]) + 1
22
+ }
18
23
 
19
- const nextBranch = `${stem}.v${version}`
20
- await createBranch(nextBranch)
21
- })
22
- .parse(process.argv)
24
+ const nextBranch = `${stem}.v${version}`
25
+ await createBranch(nextBranch)
26
+ })
27
+ return program
28
+ }
29
+
30
+ if (isMain('git-bump')) {
31
+ await create().parseAsync(Bun.argv)
32
+ }
33
+
34
+ export default create
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env bun run
2
+
3
+ import { Command } from 'commander'
4
+ import { getIssue } from "../lib/jira"
5
+ import { isMain } from '../lib/is_main'
6
+ import { getJiraConfig } from '../lib/jira'
7
+
8
+ export function create(): Command {
9
+ const program = new Command()
10
+ program
11
+ .name('issue')
12
+ .description('Get information about an issue')
13
+ .argument('issue', 'Issue ID')
14
+ .option('-v, --verbose', 'Verbose output')
15
+ .option('-u, --url', 'Show the URL of the issue')
16
+ .action(async (issueId: string, options) => {
17
+ const { host } = await getJiraConfig()
18
+ const issue = await getIssue(issueId)
19
+ if (!issue) {
20
+ console.error(`Issue ${issueId} not found`)
21
+ process.exit(1)
22
+ }
23
+ if (options.verbose) {
24
+ console.log(issue)
25
+ process.exit(0)
26
+ }
27
+ if (options.url) {
28
+ console.log(`https://${host}/browse/${issueId}`)
29
+ }
30
+ })
31
+ return program
32
+ }
33
+
34
+ if (isMain('git-jira-issue')) {
35
+ await create().parseAsync(Bun.argv)
36
+ }
37
+
38
+ export default create
@@ -1,15 +1,26 @@
1
- #!/usr/bin/env bun
1
+ #!/usr/bin/env bun run
2
2
 
3
- import { program } from 'commander'
3
+ import { Command } from 'commander'
4
4
  import { myUnresolvedIssues } from "../lib/jira"
5
+ import { isMain } from '../lib/is_main'
5
6
 
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}`)
7
+ export function create(): Command {
8
+ const program = new Command()
9
+ program
10
+ .name('issues')
11
+ .description('List your unresolved issues')
12
+ .action(async (options) => {
13
+ const issues = await myUnresolvedIssues()
14
+ console.log(`You have ${issues.length} unresolved issues`)
15
+ issues.forEach(issue => {
16
+ console.log(`${issue.key}: ${issue.fields.summary}`)
17
+ })
13
18
  })
14
- })
15
- .parse(process.argv)
19
+ return program
20
+ }
21
+
22
+ if (isMain('git-jira-issues')) {
23
+ await create().parseAsync(Bun.argv)
24
+ }
25
+
26
+ export default create
@@ -1,8 +1,9 @@
1
- #!/usr/bin/env bun
1
+ #!/usr/bin/env bun run
2
2
 
3
- import { program } from 'commander'
3
+ import { Command } from 'commander'
4
4
  import { createBranch } from "../lib/git"
5
5
  import { getIssue } from "../lib/jira"
6
+ import { isMain } from '../lib/is_main'
6
7
 
7
8
  function toKebab(s: string): string {
8
9
  return s.replace(/([a-z]+)([A-Z]+)/g, "$1_2").toLowerCase()
@@ -10,18 +11,29 @@ function toKebab(s: string): string {
10
11
  .replace(/-$/, "")
11
12
  }
12
13
 
13
- program
14
- .argument('<issue>', 'Issue ID')
15
- .action(async (issueId: string, options) => {
14
+ export function create(): Command {
15
+ const program = new Command()
16
+ program
17
+ .name('start')
18
+ .description('Start working on an issue by creating a branch')
19
+ .argument('issue', 'Issue ID')
20
+ .action(async (issueId: string) => {
21
+ const issue = await getIssue(issueId)
22
+ if (!issue) {
23
+ console.error(`Issue ${issueId} not found`)
24
+ process.exit(1)
25
+ }
26
+ const summary = issue.fields.summary
16
27
 
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
28
+ const branchName = `${issueId}-${toKebab(summary)}`
29
+ await createBranch(branchName)
30
+ })
23
31
 
24
- const branchName = `${issueId}-${toKebab(summary)}`
25
- await createBranch(branchName)
26
- })
27
- .parse(process.argv)
32
+ return program
33
+ }
34
+
35
+ if (isMain('git-jira-issues')) {
36
+ await create().parseAsync(Bun.argv)
37
+ }
38
+
39
+ export default create
package/bin/git-jira.ts CHANGED
@@ -1,16 +1,24 @@
1
- #!/usr/bin/env bun
1
+ #!/usr/bin/env bun run
2
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.
3
+ import { Command } from 'commander'
4
+ import { isMain } from '../lib/is_main'
5
+ import start from './git-jira-start'
6
+ import issue from './git-jira-issue'
7
+ import issues from './git-jira-issues'
5
8
 
6
- import { program } from 'commander'
9
+ export function create(): Command {
10
+ const program = new Command()
11
+ program
12
+ .name('jira')
13
+ .description('A set of commands for working with Jira')
14
+ .addCommand(start())
15
+ .addCommand(issue())
16
+ .addCommand(issues())
17
+ return program
18
+ }
7
19
 
8
- program
9
- .command('start', 'Create a new branch for a given Jira issue')
10
- .command('issues', 'List your unresolved Jira issues')
20
+ if (isMain('git-jira')) {
21
+ await create().parseAsync(Bun.argv)
22
+ }
11
23
 
12
- program
13
- .action(() => {
14
- program.help()
15
- })
16
- .parse(process.argv)
24
+ export default create
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env bun run
2
+
3
+ import { Command } from 'commander'
4
+ import { getProjects, type Project } from "../lib/gitlab"
5
+ import { isMain } from '../lib/is_main'
6
+
7
+ export function create(): Command {
8
+ const program = new Command()
9
+ program
10
+ .name('projects')
11
+ .description('List projects for current user')
12
+ .option('-v, --verbose', 'Verbose output')
13
+ .argument('[path...]', 'Namespace paths to filter by')
14
+ .action(async (paths: string[], options) => {
15
+ const projects: Array<Project> = await getProjects(paths)
16
+ if (!projects) {
17
+ console.error(`No projects!`)
18
+ process.exit(1)
19
+ }
20
+ if (options.verbose) {
21
+ console.log(projects)
22
+ }
23
+ else {
24
+ let filtered = projects.map((p: Project) => {
25
+ const { id, name, path_with_namespace, ssh_url_to_repo } = p
26
+ return { id, name, path_with_namespace, ssh_url_to_repo }
27
+ })
28
+ console.log(filtered)
29
+ }
30
+ })
31
+ return program
32
+ }
33
+
34
+ if (isMain('git-lab-projects')) {
35
+ await create().parseAsync(Bun.argv)
36
+ }
37
+
38
+ export default create
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env bun run
2
+
3
+ import { Command } from 'commander'
4
+ import { whoami, type User } from "../lib/gitlab"
5
+ import { isMain } from '../lib/is_main'
6
+
7
+ export function create(): Command {
8
+ const program = new Command()
9
+ program
10
+ .name('whoami')
11
+ .description('get GitLab user information for current user')
12
+ .option('-v, --verbose', 'Verbose output')
13
+ .action(async (options) => {
14
+ const user: User = await whoami()
15
+ if (!user) {
16
+ console.error(`No user!`)
17
+ process.exit(1)
18
+ }
19
+ if (options.verbose) {
20
+ console.log(user)
21
+ process.exit(0)
22
+ }
23
+ else {
24
+ console.log(user.username)
25
+ }
26
+ })
27
+ return program
28
+ }
29
+
30
+ if (isMain('git-lab-whoami')) {
31
+ await create().parseAsync(Bun.argv)
32
+ }
33
+
34
+ export default create
package/bin/git-lab.ts ADDED
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env bun run
2
+
3
+ import { Command } from 'commander'
4
+ import { isMain } from '../lib/is_main'
5
+ import whoami from './git-lab-whoami'
6
+ import projects from './git-lab-projects'
7
+
8
+ export function create(): Command {
9
+ const program = new Command()
10
+ program
11
+ .name('lab')
12
+ .description('A set of commands for working with GitLab')
13
+ .addCommand(whoami())
14
+ .addCommand(projects())
15
+ return program
16
+ }
17
+
18
+ if (isMain('git-jira')) {
19
+ await create().parseAsync(Bun.argv)
20
+ }
21
+
22
+ export default create
package/bin/gitj.ts CHANGED
@@ -1,17 +1,27 @@
1
- #!/usr/bin/env bun
1
+ #!/usr/bin/env bun run
2
2
 
3
- // This is the root of the CLI. It's job is to parse the command
3
+ import bump from './git-bump'
4
+ import jira from './git-jira'
5
+ import lab from './git-lab'
6
+
7
+ // This is the root of the CLI. It's a proxy for git and not strictly
8
+ // necessary, but it's useful to have for testing
9
+ // It's job is to parse the first command
4
10
  // from the command line and then call the appropriate subcommand.
5
11
 
6
- import { program } from 'commander'
12
+ import { Command } from 'commander'
7
13
 
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' })
14
+ export function create(): Command {
15
+ const program: Command = new Command()
16
+ program
17
+ .addCommand(bump())
18
+ .addCommand(jira())
19
+ .addCommand(lab())
20
+ .action(() => {
21
+ program.help()
22
+ })
23
+ return program
24
+ }
12
25
 
13
- program
14
- .action(() => {
15
- program.help()
16
- })
17
- .parse(process.argv)
26
+ const command = create()
27
+ await command.parseAsync(Bun.argv)
package/build.ts ADDED
@@ -0,0 +1,17 @@
1
+ import { BuildOutput } from 'bun'
2
+ import { glob } from 'glob'
3
+
4
+ const result: BuildOutput = await Bun.build({
5
+ entrypoints: ['./index.ts', ...glob.sync('./bin/*.ts')],
6
+ outdir: './dist',
7
+ target: 'bun'
8
+ })
9
+
10
+ if (result.success) {
11
+ console.log('Build succeeded')
12
+ process.exit(0)
13
+ } else {
14
+ console.error('Build failed')
15
+ console.log(result)
16
+ process.exit(1)
17
+ }
package/bun.lockb CHANGED
Binary file
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env bun
1
+ #!/usr/bin/env bun run
2
2
  // @bun
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
@@ -636,7 +636,7 @@ var require_command = __commonJS((exports) => {
636
636
  var childProcess = import.meta.require("child_process");
637
637
  var path = import.meta.require("path");
638
638
  var fs = import.meta.require("fs");
639
- var process2 = import.meta.require("process");
639
+ var process = import.meta.require("process");
640
640
  var { Argument, humanReadableArgName } = require_argument();
641
641
  var { CommanderError } = require_error();
642
642
  var { Help } = require_help();
@@ -677,10 +677,10 @@ var require_command = __commonJS((exports) => {
677
677
  this._showHelpAfterError = false;
678
678
  this._showSuggestionAfterError = true;
679
679
  this._outputConfiguration = {
680
- writeOut: (str) => process2.stdout.write(str),
681
- writeErr: (str) => process2.stderr.write(str),
682
- getOutHelpWidth: () => process2.stdout.isTTY ? process2.stdout.columns : undefined,
683
- getErrHelpWidth: () => process2.stderr.isTTY ? process2.stderr.columns : undefined,
680
+ writeOut: (str) => process.stdout.write(str),
681
+ writeErr: (str) => process.stderr.write(str),
682
+ getOutHelpWidth: () => process.stdout.isTTY ? process.stdout.columns : undefined,
683
+ getErrHelpWidth: () => process.stderr.isTTY ? process.stderr.columns : undefined,
684
684
  outputError: (str, write) => write(str)
685
685
  };
686
686
  this._hidden = false;
@@ -863,7 +863,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
863
863
  if (this._exitCallback) {
864
864
  this._exitCallback(new CommanderError(exitCode, code, message));
865
865
  }
866
- process2.exit(exitCode);
866
+ process.exit(exitCode);
867
867
  }
868
868
  action(fn) {
869
869
  const listener = (args) => {
@@ -1028,8 +1028,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
1028
1028
  }
1029
1029
  parseOptions = parseOptions || {};
1030
1030
  if (argv === undefined) {
1031
- argv = process2.argv;
1032
- if (process2.versions && process2.versions.electron) {
1031
+ argv = process.argv;
1032
+ if (process.versions && process.versions.electron) {
1033
1033
  parseOptions.from = "electron";
1034
1034
  }
1035
1035
  }
@@ -1042,7 +1042,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1042
1042
  userArgs = argv.slice(2);
1043
1043
  break;
1044
1044
  case "electron":
1045
- if (process2.defaultApp) {
1045
+ if (process.defaultApp) {
1046
1046
  this._scriptPath = argv[1];
1047
1047
  userArgs = argv.slice(2);
1048
1048
  } else {
@@ -1110,23 +1110,23 @@ Expecting one of '${allowedValues.join("', '")}'`);
1110
1110
  }
1111
1111
  launchWithNode = sourceExt.includes(path.extname(executableFile));
1112
1112
  let proc;
1113
- if (process2.platform !== "win32") {
1113
+ if (process.platform !== "win32") {
1114
1114
  if (launchWithNode) {
1115
1115
  args.unshift(executableFile);
1116
- args = incrementNodeInspectorPort(process2.execArgv).concat(args);
1117
- proc = childProcess.spawn(process2.argv[0], args, { stdio: "inherit" });
1116
+ args = incrementNodeInspectorPort(process.execArgv).concat(args);
1117
+ proc = childProcess.spawn(process.argv[0], args, { stdio: "inherit" });
1118
1118
  } else {
1119
1119
  proc = childProcess.spawn(executableFile, args, { stdio: "inherit" });
1120
1120
  }
1121
1121
  } else {
1122
1122
  args.unshift(executableFile);
1123
- args = incrementNodeInspectorPort(process2.execArgv).concat(args);
1124
- proc = childProcess.spawn(process2.execPath, args, { stdio: "inherit" });
1123
+ args = incrementNodeInspectorPort(process.execArgv).concat(args);
1124
+ proc = childProcess.spawn(process.execPath, args, { stdio: "inherit" });
1125
1125
  }
1126
1126
  if (!proc.killed) {
1127
1127
  const signals = ["SIGUSR1", "SIGUSR2", "SIGTERM", "SIGINT", "SIGHUP"];
1128
1128
  signals.forEach((signal) => {
1129
- process2.on(signal, () => {
1129
+ process.on(signal, () => {
1130
1130
  if (proc.killed === false && proc.exitCode === null) {
1131
1131
  proc.kill(signal);
1132
1132
  }
@@ -1135,10 +1135,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
1135
1135
  }
1136
1136
  const exitCallback = this._exitCallback;
1137
1137
  if (!exitCallback) {
1138
- proc.on("close", process2.exit.bind(process2));
1138
+ proc.on("close", process.exit.bind(process));
1139
1139
  } else {
1140
1140
  proc.on("close", () => {
1141
- exitCallback(new CommanderError(process2.exitCode || 0, "commander.executeSubCommandAsync", "(close)"));
1141
+ exitCallback(new CommanderError(process.exitCode || 0, "commander.executeSubCommandAsync", "(close)"));
1142
1142
  });
1143
1143
  }
1144
1144
  proc.on("error", (err) => {
@@ -1153,7 +1153,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1153
1153
  throw new Error(`'${executableFile}' not executable`);
1154
1154
  }
1155
1155
  if (!exitCallback) {
1156
- process2.exit(1);
1156
+ process.exit(1);
1157
1157
  } else {
1158
1158
  const wrappedError = new CommanderError(1, "commander.executeSubCommandAsync", "(error)");
1159
1159
  wrappedError.nestedError = err;
@@ -1505,11 +1505,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
1505
1505
  }
1506
1506
  _parseOptionsEnv() {
1507
1507
  this.options.forEach((option) => {
1508
- if (option.envVar && (option.envVar in process2.env)) {
1508
+ if (option.envVar && (option.envVar in process.env)) {
1509
1509
  const optionKey = option.attributeName();
1510
1510
  if (this.getOptionValue(optionKey) === undefined || ["default", "config", "env"].includes(this.getOptionValueSource(optionKey))) {
1511
1511
  if (option.required || option.optional) {
1512
- this.emit(`optionEnv:${option.name()}`, process2.env[option.envVar]);
1512
+ this.emit(`optionEnv:${option.name()}`, process.env[option.envVar]);
1513
1513
  } else {
1514
1514
  this.emit(`optionEnv:${option.name()}`);
1515
1515
  }
@@ -1735,7 +1735,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1735
1735
  }
1736
1736
  help(contextOptions) {
1737
1737
  this.outputHelp(contextOptions);
1738
- let exitCode = process2.exitCode || 0;
1738
+ let exitCode = process.exitCode || 0;
1739
1739
  if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
1740
1740
  exitCode = 1;
1741
1741
  }
@@ -1783,32 +1783,44 @@ var require_commander = __commonJS((exports, module) => {
1783
1783
  exports.Option = Option;
1784
1784
  });
1785
1785
 
1786
- // lib/git.ts
1787
- async function doCommand(args) {
1788
- const proc = Bun.spawn(args);
1786
+ // lib/spawn.ts
1787
+ async function spawn(args, options = defaultOptions) {
1788
+ const proc = Bun.spawn(args, { stdout: "pipe", stderr: "pipe" });
1789
1789
  const stdout = new Response(proc.stdout);
1790
1790
  const stderr = new Response(proc.stderr);
1791
- const [out, err] = await Promise.all([stdout.text(), stderr.text()]);
1791
+ const [out, err, exitCode, signal] = await Promise.all([stdout.text(), stderr.text(), proc.exitCode, proc.signalCode]);
1792
+ let code = 0;
1793
+ if (exitCode !== null) {
1794
+ code = exitCode;
1795
+ }
1796
+ if (!out && !err && !options.expectQuiet) {
1797
+ console.warn(`No output from ${args.join(" ")}`);
1798
+ }
1799
+ return { out: out.trim(), err: err.trim(), code };
1800
+ }
1801
+ async function doCommand(args) {
1802
+ const { out, err } = await spawn(args);
1792
1803
  if (err)
1793
1804
  console.error(err);
1794
- return out.trim();
1805
+ return out;
1795
1806
  }
1807
+ var defaultOptions = {
1808
+ expectQuiet: false
1809
+ };
1810
+
1811
+ // lib/git.ts
1796
1812
  async function getConfig(key) {
1797
1813
  return doCommand(["git", "config", "--get", key]);
1798
1814
  }
1799
- async function getJiraConfig() {
1800
- const host = await getConfig("jira.host");
1801
- const user = await getConfig("jira.user") || await getConfig("user.email");
1802
- const pat = await getConfig("jira.pat");
1803
- const token = Buffer.from(`${user}:${pat}`).toString("base64");
1804
- return { host, token };
1805
- }
1806
1815
  async function createBranch(name) {
1807
1816
  return doCommand(["git", "checkout", "-b", name]);
1808
1817
  }
1809
1818
  async function getCurrentBranch() {
1810
1819
  return doCommand(["git", "rev-parse", "--abbrev-ref", "HEAD"]);
1811
1820
  }
1821
+ async function getRemote() {
1822
+ return doCommand(["git", "ls-remote", "--get-url", "origin"]);
1823
+ }
1812
1824
 
1813
1825
  // node_modules/commander/esm.mjs
1814
1826
  var import_ = __toESM(require_commander(), 1);
@@ -1826,16 +1838,35 @@ var {
1826
1838
  Help
1827
1839
  } = import_.default;
1828
1840
 
1841
+ // lib/is_main.ts
1842
+ import path from "path";
1843
+ function isMain(self) {
1844
+ const exe = path.basename(Bun.argv[1]).split(".")[0];
1845
+ return exe == self || import.meta.main;
1846
+ }
1847
+
1829
1848
  // bin/git-bump.ts
1830
- program.action(async () => {
1831
- const currentBranch = await getCurrentBranch();
1832
- let stem = currentBranch;
1833
- let version = 1;
1834
- const match = currentBranch.match(/^(.+)[-\.]v(\d+)$/);
1835
- if (match) {
1836
- stem = match[1];
1837
- version = parseInt(match[2]) + 1;
1838
- }
1839
- const nextBranch = `${stem}.v${version}`;
1840
- await createBranch(nextBranch);
1841
- }).parse(process.argv);
1849
+ function create() {
1850
+ const program2 = new Command;
1851
+ program2.name("bump").description("Bump the version number in the current branch").action(async () => {
1852
+ const currentBranch = await getCurrentBranch();
1853
+ let stem = currentBranch;
1854
+ let version = 1;
1855
+ const match = currentBranch.match(/^(.+)[-\.]v(\d+)$/);
1856
+ if (match) {
1857
+ stem = match[1];
1858
+ version = parseInt(match[2]) + 1;
1859
+ }
1860
+ const nextBranch = `${stem}.v${version}`;
1861
+ await createBranch(nextBranch);
1862
+ });
1863
+ return program2;
1864
+ }
1865
+ if (isMain("git-bump")) {
1866
+ await create().parseAsync(Bun.argv);
1867
+ }
1868
+ var git_bump_default = create;
1869
+ export {
1870
+ git_bump_default as default,
1871
+ create
1872
+ };