@pilatos/bitbucket-cli 0.2.0 → 0.3.2
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 +5 -5
- package/dist/index.js +92 -24
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
</p>
|
|
14
14
|
|
|
15
15
|
<p align="center">
|
|
16
|
-
<a href="https://www.npmjs.com/package/bitbucket-cli"><img src="https://img.shields.io/npm/v/bitbucket-cli.svg?style=flat-square&color=blue" alt="npm version"></a>
|
|
17
|
-
<a href="https://www.npmjs.com/package/bitbucket-cli"><img src="https://img.shields.io/npm/dm/bitbucket-cli.svg?style=flat-square&color=blue" alt="npm downloads"></a>
|
|
16
|
+
<a href="https://www.npmjs.com/package/@pilatos/bitbucket-cli"><img src="https://img.shields.io/npm/v/@pilatos/bitbucket-cli.svg?style=flat-square&color=blue" alt="npm version"></a>
|
|
17
|
+
<a href="https://www.npmjs.com/package/@pilatos/bitbucket-cli"><img src="https://img.shields.io/npm/dm/@pilatos/bitbucket-cli.svg?style=flat-square&color=blue" alt="npm downloads"></a>
|
|
18
18
|
<a href="https://github.com/0pilatos0/bitbucket-cli/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="License"></a>
|
|
19
19
|
<a href="https://github.com/0pilatos0/bitbucket-cli/issues"><img src="https://img.shields.io/github/issues/0pilatos0/bitbucket-cli.svg?style=flat-square" alt="GitHub issues"></a>
|
|
20
20
|
</p>
|
|
@@ -66,19 +66,19 @@ If you've used GitHub's `gh` CLI and loved it, you've probably wished for someth
|
|
|
66
66
|
### Using npm (Recommended)
|
|
67
67
|
|
|
68
68
|
```bash
|
|
69
|
-
npm install -g bitbucket-cli
|
|
69
|
+
npm install -g @pilatos/bitbucket-cli
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
### Using Bun
|
|
73
73
|
|
|
74
74
|
```bash
|
|
75
|
-
bun install -g bitbucket-cli
|
|
75
|
+
bun install -g @pilatos/bitbucket-cli
|
|
76
76
|
```
|
|
77
77
|
|
|
78
78
|
### Using Yarn
|
|
79
79
|
|
|
80
80
|
```bash
|
|
81
|
-
yarn global add bitbucket-cli
|
|
81
|
+
yarn global add @pilatos/bitbucket-cli
|
|
82
82
|
```
|
|
83
83
|
|
|
84
84
|
### Verify Installation
|
package/dist/index.js
CHANGED
|
@@ -32837,7 +32837,7 @@ var require_constants = __commonJS((exports, module) => {
|
|
|
32837
32837
|
|
|
32838
32838
|
// node_modules/tabtab/lib/installer.js
|
|
32839
32839
|
var require_installer = __commonJS((exports, module) => {
|
|
32840
|
-
var __dirname = "/
|
|
32840
|
+
var __dirname = "/home/runner/work/bitbucket-cli/bitbucket-cli/node_modules/tabtab/lib";
|
|
32841
32841
|
var fs = __require("fs");
|
|
32842
32842
|
var path = __require("path");
|
|
32843
32843
|
var untildify = require_untildify();
|
|
@@ -34456,13 +34456,18 @@ class LoginCommand extends BaseCommand {
|
|
|
34456
34456
|
const username = options.username || process.env.BB_USERNAME;
|
|
34457
34457
|
const appPassword = options.password || process.env.BB_APP_PASSWORD;
|
|
34458
34458
|
if (!username) {
|
|
34459
|
-
|
|
34459
|
+
const error = Result.err(new ValidationError("username", "Username is required. Use --username option or set BB_USERNAME environment variable."));
|
|
34460
|
+
this.handleResult(error, context);
|
|
34461
|
+
return error;
|
|
34460
34462
|
}
|
|
34461
34463
|
if (!appPassword) {
|
|
34462
|
-
|
|
34464
|
+
const error = Result.err(new ValidationError("password", "App password is required. Use --password option or set BB_APP_PASSWORD environment variable."));
|
|
34465
|
+
this.handleResult(error, context);
|
|
34466
|
+
return error;
|
|
34463
34467
|
}
|
|
34464
34468
|
const setResult = await this.configService.setCredentials({ username, appPassword });
|
|
34465
34469
|
if (!setResult.success) {
|
|
34470
|
+
this.handleResult(setResult, context);
|
|
34466
34471
|
return setResult;
|
|
34467
34472
|
}
|
|
34468
34473
|
const userRepository = this.userRepositoryFactory(this.configService);
|
|
@@ -35573,106 +35578,169 @@ cli.name("bb").description("A command-line interface for Bitbucket Cloud").versi
|
|
|
35573
35578
|
var authCmd = new Command("auth").description("Authenticate with Bitbucket");
|
|
35574
35579
|
authCmd.command("login").description("Authenticate with Bitbucket using an app password").option("-u, --username <username>", "Bitbucket username").option("-p, --password <password>", "Bitbucket app password").action(async (options) => {
|
|
35575
35580
|
const cmd = container.resolve(ServiceTokens.LoginCommand);
|
|
35576
|
-
await cmd.execute(options, createContext(cli));
|
|
35581
|
+
const result = await cmd.execute(options, createContext(cli));
|
|
35582
|
+
if (!result.success) {
|
|
35583
|
+
process.exit(1);
|
|
35584
|
+
}
|
|
35577
35585
|
});
|
|
35578
35586
|
authCmd.command("logout").description("Log out of Bitbucket").action(async () => {
|
|
35579
35587
|
const cmd = container.resolve(ServiceTokens.LogoutCommand);
|
|
35580
|
-
await cmd.execute(undefined, createContext(cli));
|
|
35588
|
+
const result = await cmd.execute(undefined, createContext(cli));
|
|
35589
|
+
if (!result.success) {
|
|
35590
|
+
process.exit(1);
|
|
35591
|
+
}
|
|
35581
35592
|
});
|
|
35582
35593
|
authCmd.command("status").description("Show authentication status").action(async () => {
|
|
35583
35594
|
const cmd = container.resolve(ServiceTokens.StatusCommand);
|
|
35584
|
-
await cmd.execute(undefined, createContext(cli));
|
|
35595
|
+
const result = await cmd.execute(undefined, createContext(cli));
|
|
35596
|
+
if (!result.success) {
|
|
35597
|
+
process.exit(1);
|
|
35598
|
+
}
|
|
35585
35599
|
});
|
|
35586
35600
|
authCmd.command("token").description("Print the current access token").action(async () => {
|
|
35587
35601
|
const cmd = container.resolve(ServiceTokens.TokenCommand);
|
|
35588
|
-
await cmd.execute(undefined, createContext(cli));
|
|
35602
|
+
const result = await cmd.execute(undefined, createContext(cli));
|
|
35603
|
+
if (!result.success) {
|
|
35604
|
+
process.exit(1);
|
|
35605
|
+
}
|
|
35589
35606
|
});
|
|
35590
35607
|
cli.addCommand(authCmd);
|
|
35591
35608
|
var repoCmd = new Command("repo").description("Manage repositories");
|
|
35592
35609
|
repoCmd.command("clone <repository>").description("Clone a Bitbucket repository").option("-d, --directory <dir>", "Directory to clone into").action(async (repository, options) => {
|
|
35593
35610
|
const cmd = container.resolve(ServiceTokens.CloneCommand);
|
|
35594
|
-
await cmd.execute({ repository, ...options }, createContext(cli));
|
|
35611
|
+
const result = await cmd.execute({ repository, ...options }, createContext(cli));
|
|
35612
|
+
if (!result.success) {
|
|
35613
|
+
process.exit(1);
|
|
35614
|
+
}
|
|
35595
35615
|
});
|
|
35596
35616
|
repoCmd.command("create <name>").description("Create a new repository").option("-d, --description <description>", "Repository description").option("--private", "Create a private repository (default)").option("--public", "Create a public repository").option("-p, --project <project>", "Project key").action(async (name, options) => {
|
|
35597
35617
|
const cmd = container.resolve(ServiceTokens.CreateRepoCommand);
|
|
35598
35618
|
const context = createContext(cli);
|
|
35599
|
-
await cmd.execute(withGlobalOptions({ name, ...options }, context), context);
|
|
35619
|
+
const result = await cmd.execute(withGlobalOptions({ name, ...options }, context), context);
|
|
35620
|
+
if (!result.success) {
|
|
35621
|
+
process.exit(1);
|
|
35622
|
+
}
|
|
35600
35623
|
});
|
|
35601
35624
|
repoCmd.command("list").description("List repositories").option("--limit <number>", "Maximum number of repositories to list", "25").action(async (options) => {
|
|
35602
35625
|
const cmd = container.resolve(ServiceTokens.ListReposCommand);
|
|
35603
35626
|
const context = createContext(cli);
|
|
35604
|
-
await cmd.execute(withGlobalOptions(options, context), context);
|
|
35627
|
+
const result = await cmd.execute(withGlobalOptions(options, context), context);
|
|
35628
|
+
if (!result.success) {
|
|
35629
|
+
process.exit(1);
|
|
35630
|
+
}
|
|
35605
35631
|
});
|
|
35606
35632
|
repoCmd.command("view [repository]").description("View repository details").action(async (repository, options) => {
|
|
35607
35633
|
const cmd = container.resolve(ServiceTokens.ViewRepoCommand);
|
|
35608
35634
|
const context = createContext(cli);
|
|
35609
|
-
await cmd.execute(withGlobalOptions({ repository, ...options }, context), context);
|
|
35635
|
+
const result = await cmd.execute(withGlobalOptions({ repository, ...options }, context), context);
|
|
35636
|
+
if (!result.success) {
|
|
35637
|
+
process.exit(1);
|
|
35638
|
+
}
|
|
35610
35639
|
});
|
|
35611
35640
|
repoCmd.command("delete <repository>").description("Delete a repository").option("-y, --yes", "Skip confirmation prompt").action(async (repository, options) => {
|
|
35612
35641
|
const cmd = container.resolve(ServiceTokens.DeleteRepoCommand);
|
|
35613
35642
|
const context = createContext(cli);
|
|
35614
|
-
await cmd.execute(withGlobalOptions({ repository, ...options }, context), context);
|
|
35643
|
+
const result = await cmd.execute(withGlobalOptions({ repository, ...options }, context), context);
|
|
35644
|
+
if (!result.success) {
|
|
35645
|
+
process.exit(1);
|
|
35646
|
+
}
|
|
35615
35647
|
});
|
|
35616
35648
|
cli.addCommand(repoCmd);
|
|
35617
35649
|
var prCmd = new Command("pr").description("Manage pull requests");
|
|
35618
35650
|
prCmd.command("create").description("Create a pull request").option("-t, --title <title>", "Pull request title").option("-b, --body <body>", "Pull request description").option("-s, --source <branch>", "Source branch (default: current branch)").option("-d, --destination <branch>", "Destination branch (default: main)").option("--close-source-branch", "Close source branch after merge").action(async (options) => {
|
|
35619
35651
|
const cmd = container.resolve(ServiceTokens.CreatePRCommand);
|
|
35620
35652
|
const context = createContext(cli);
|
|
35621
|
-
await cmd.execute(withGlobalOptions(options, context), context);
|
|
35653
|
+
const result = await cmd.execute(withGlobalOptions(options, context), context);
|
|
35654
|
+
if (!result.success) {
|
|
35655
|
+
process.exit(1);
|
|
35656
|
+
}
|
|
35622
35657
|
});
|
|
35623
35658
|
prCmd.command("list").description("List pull requests").option("-s, --state <state>", "Filter by state (OPEN, MERGED, DECLINED, SUPERSEDED)", "OPEN").option("--limit <number>", "Maximum number of PRs to list", "25").action(async (options) => {
|
|
35624
35659
|
const cmd = container.resolve(ServiceTokens.ListPRsCommand);
|
|
35625
35660
|
const context = createContext(cli);
|
|
35626
|
-
await cmd.execute(withGlobalOptions(options, context), context);
|
|
35661
|
+
const result = await cmd.execute(withGlobalOptions(options, context), context);
|
|
35662
|
+
if (!result.success) {
|
|
35663
|
+
process.exit(1);
|
|
35664
|
+
}
|
|
35627
35665
|
});
|
|
35628
35666
|
prCmd.command("view <id>").description("View pull request details").action(async (id, options) => {
|
|
35629
35667
|
const cmd = container.resolve(ServiceTokens.ViewPRCommand);
|
|
35630
35668
|
const context = createContext(cli);
|
|
35631
|
-
await cmd.execute(withGlobalOptions({ id, ...options }, context), context);
|
|
35669
|
+
const result = await cmd.execute(withGlobalOptions({ id, ...options }, context), context);
|
|
35670
|
+
if (!result.success) {
|
|
35671
|
+
process.exit(1);
|
|
35672
|
+
}
|
|
35632
35673
|
});
|
|
35633
35674
|
prCmd.command("merge <id>").description("Merge a pull request").option("-m, --message <message>", "Merge commit message").option("--close-source-branch", "Delete the source branch after merging").option("--strategy <strategy>", "Merge strategy (merge_commit, squash, fast_forward)").action(async (id, options) => {
|
|
35634
35675
|
const cmd = container.resolve(ServiceTokens.MergePRCommand);
|
|
35635
35676
|
const context = createContext(cli);
|
|
35636
|
-
await cmd.execute(withGlobalOptions({ id, ...options }, context), context);
|
|
35677
|
+
const result = await cmd.execute(withGlobalOptions({ id, ...options }, context), context);
|
|
35678
|
+
if (!result.success) {
|
|
35679
|
+
process.exit(1);
|
|
35680
|
+
}
|
|
35637
35681
|
});
|
|
35638
35682
|
prCmd.command("approve <id>").description("Approve a pull request").action(async (id, options) => {
|
|
35639
35683
|
const cmd = container.resolve(ServiceTokens.ApprovePRCommand);
|
|
35640
35684
|
const context = createContext(cli);
|
|
35641
|
-
await cmd.execute(withGlobalOptions({ id, ...options }, context), context);
|
|
35685
|
+
const result = await cmd.execute(withGlobalOptions({ id, ...options }, context), context);
|
|
35686
|
+
if (!result.success) {
|
|
35687
|
+
process.exit(1);
|
|
35688
|
+
}
|
|
35642
35689
|
});
|
|
35643
35690
|
prCmd.command("decline <id>").description("Decline a pull request").action(async (id, options) => {
|
|
35644
35691
|
const cmd = container.resolve(ServiceTokens.DeclinePRCommand);
|
|
35645
35692
|
const context = createContext(cli);
|
|
35646
|
-
await cmd.execute(withGlobalOptions({ id, ...options }, context), context);
|
|
35693
|
+
const result = await cmd.execute(withGlobalOptions({ id, ...options }, context), context);
|
|
35694
|
+
if (!result.success) {
|
|
35695
|
+
process.exit(1);
|
|
35696
|
+
}
|
|
35647
35697
|
});
|
|
35648
35698
|
prCmd.command("checkout <id>").description("Checkout a pull request locally").action(async (id, options) => {
|
|
35649
35699
|
const cmd = container.resolve(ServiceTokens.CheckoutPRCommand);
|
|
35650
35700
|
const context = createContext(cli);
|
|
35651
|
-
await cmd.execute(withGlobalOptions({ id, ...options }, context), context);
|
|
35701
|
+
const result = await cmd.execute(withGlobalOptions({ id, ...options }, context), context);
|
|
35702
|
+
if (!result.success) {
|
|
35703
|
+
process.exit(1);
|
|
35704
|
+
}
|
|
35652
35705
|
});
|
|
35653
35706
|
cli.addCommand(prCmd);
|
|
35654
35707
|
var configCmd = new Command("config").description("Manage configuration");
|
|
35655
35708
|
configCmd.command("get <key>").description("Get a configuration value").action(async (key) => {
|
|
35656
35709
|
const cmd = container.resolve(ServiceTokens.GetConfigCommand);
|
|
35657
|
-
await cmd.execute({ key }, createContext(cli));
|
|
35710
|
+
const result = await cmd.execute({ key }, createContext(cli));
|
|
35711
|
+
if (!result.success) {
|
|
35712
|
+
process.exit(1);
|
|
35713
|
+
}
|
|
35658
35714
|
});
|
|
35659
35715
|
configCmd.command("set <key> <value>").description("Set a configuration value").action(async (key, value) => {
|
|
35660
35716
|
const cmd = container.resolve(ServiceTokens.SetConfigCommand);
|
|
35661
|
-
await cmd.execute({ key, value }, createContext(cli));
|
|
35717
|
+
const result = await cmd.execute({ key, value }, createContext(cli));
|
|
35718
|
+
if (!result.success) {
|
|
35719
|
+
process.exit(1);
|
|
35720
|
+
}
|
|
35662
35721
|
});
|
|
35663
35722
|
configCmd.command("list").description("List all configuration values").action(async () => {
|
|
35664
35723
|
const cmd = container.resolve(ServiceTokens.ListConfigCommand);
|
|
35665
|
-
await cmd.execute(undefined, createContext(cli));
|
|
35724
|
+
const result = await cmd.execute(undefined, createContext(cli));
|
|
35725
|
+
if (!result.success) {
|
|
35726
|
+
process.exit(1);
|
|
35727
|
+
}
|
|
35666
35728
|
});
|
|
35667
35729
|
cli.addCommand(configCmd);
|
|
35668
35730
|
var completionCmd = new Command("completion").description("Shell completion utilities");
|
|
35669
35731
|
completionCmd.command("install").description("Install shell completions for bash, zsh, or fish").action(async () => {
|
|
35670
35732
|
const cmd = container.resolve(ServiceTokens.InstallCompletionCommand);
|
|
35671
|
-
await cmd.execute(undefined, createContext(cli));
|
|
35733
|
+
const result = await cmd.execute(undefined, createContext(cli));
|
|
35734
|
+
if (!result.success) {
|
|
35735
|
+
process.exit(1);
|
|
35736
|
+
}
|
|
35672
35737
|
});
|
|
35673
35738
|
completionCmd.command("uninstall").description("Uninstall shell completions").action(async () => {
|
|
35674
35739
|
const cmd = container.resolve(ServiceTokens.UninstallCompletionCommand);
|
|
35675
|
-
await cmd.execute(undefined, createContext(cli));
|
|
35740
|
+
const result = await cmd.execute(undefined, createContext(cli));
|
|
35741
|
+
if (!result.success) {
|
|
35742
|
+
process.exit(1);
|
|
35743
|
+
}
|
|
35676
35744
|
});
|
|
35677
35745
|
cli.addCommand(completionCmd);
|
|
35678
35746
|
|