@pilatos/bitbucket-cli 1.8.3 → 1.9.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/dist/index.js +282 -37
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14337,6 +14337,12 @@ var applyOptions = (object, options = {}) => {
|
|
|
14337
14337
|
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
14338
14338
|
object.level = options.level === undefined ? colorLevel : options.level;
|
|
14339
14339
|
};
|
|
14340
|
+
|
|
14341
|
+
class Chalk {
|
|
14342
|
+
constructor(options) {
|
|
14343
|
+
return chalkFactory(options);
|
|
14344
|
+
}
|
|
14345
|
+
}
|
|
14340
14346
|
var chalkFactory = (options) => {
|
|
14341
14347
|
const chalk = (...strings) => strings.join(" ");
|
|
14342
14348
|
applyOptions(chalk, options);
|
|
@@ -21958,12 +21964,14 @@ class CreatePRCommand extends BaseCommand {
|
|
|
21958
21964
|
// src/commands/pr/list.command.ts
|
|
21959
21965
|
class ListPRsCommand extends BaseCommand {
|
|
21960
21966
|
pullrequestsApi;
|
|
21967
|
+
usersApi;
|
|
21961
21968
|
contextService;
|
|
21962
21969
|
name = "list";
|
|
21963
21970
|
description = "List pull requests";
|
|
21964
|
-
constructor(pullrequestsApi, contextService, output) {
|
|
21971
|
+
constructor(pullrequestsApi, usersApi, contextService, output) {
|
|
21965
21972
|
super(output);
|
|
21966
21973
|
this.pullrequestsApi = pullrequestsApi;
|
|
21974
|
+
this.usersApi = usersApi;
|
|
21967
21975
|
this.contextService = contextService;
|
|
21968
21976
|
}
|
|
21969
21977
|
async execute(options, context) {
|
|
@@ -21973,6 +21981,7 @@ class ListPRsCommand extends BaseCommand {
|
|
|
21973
21981
|
});
|
|
21974
21982
|
const state = options.state || "OPEN";
|
|
21975
21983
|
const limit = parseLimit(options.limit);
|
|
21984
|
+
const reviewerQuery = options.mine ? await this.buildMineFilter() : undefined;
|
|
21976
21985
|
const values = await collectPages({
|
|
21977
21986
|
limit,
|
|
21978
21987
|
fetchPage: async (page, pagelen) => {
|
|
@@ -21981,7 +21990,11 @@ class ListPRsCommand extends BaseCommand {
|
|
|
21981
21990
|
repoSlug: repoContext.repoSlug,
|
|
21982
21991
|
state
|
|
21983
21992
|
}, {
|
|
21984
|
-
params: {
|
|
21993
|
+
params: {
|
|
21994
|
+
page,
|
|
21995
|
+
pagelen,
|
|
21996
|
+
...reviewerQuery ? { q: reviewerQuery } : {}
|
|
21997
|
+
}
|
|
21985
21998
|
});
|
|
21986
21999
|
return response.data;
|
|
21987
22000
|
}
|
|
@@ -21991,6 +22004,9 @@ class ListPRsCommand extends BaseCommand {
|
|
|
21991
22004
|
workspace: repoContext.workspace,
|
|
21992
22005
|
repoSlug: repoContext.repoSlug,
|
|
21993
22006
|
state,
|
|
22007
|
+
filters: {
|
|
22008
|
+
mine: options.mine === true
|
|
22009
|
+
},
|
|
21994
22010
|
count: values.length,
|
|
21995
22011
|
pullRequests: values
|
|
21996
22012
|
});
|
|
@@ -22019,6 +22035,15 @@ class ListPRsCommand extends BaseCommand {
|
|
|
22019
22035
|
}
|
|
22020
22036
|
return text.substring(0, maxLength - 3) + "...";
|
|
22021
22037
|
}
|
|
22038
|
+
async buildMineFilter() {
|
|
22039
|
+
const response = await this.usersApi.userGet();
|
|
22040
|
+
const userUuid = response.data.uuid;
|
|
22041
|
+
if (!userUuid) {
|
|
22042
|
+
this.output.warning("Could not determine your user UUID. Showing all pull requests.");
|
|
22043
|
+
return;
|
|
22044
|
+
}
|
|
22045
|
+
return `reviewers.uuid="${userUuid}"`;
|
|
22046
|
+
}
|
|
22022
22047
|
}
|
|
22023
22048
|
|
|
22024
22049
|
// src/commands/pr/view.command.ts
|
|
@@ -23667,9 +23692,10 @@ function bootstrap(options = {}) {
|
|
|
23667
23692
|
});
|
|
23668
23693
|
container.register(ServiceTokens.ListPRsCommand, () => {
|
|
23669
23694
|
const pullrequestsApi = container.resolve(ServiceTokens.PullrequestsApi);
|
|
23695
|
+
const usersApi = container.resolve(ServiceTokens.UsersApi);
|
|
23670
23696
|
const contextService = container.resolve(ServiceTokens.ContextService);
|
|
23671
23697
|
const output = container.resolve(ServiceTokens.OutputService);
|
|
23672
|
-
return new ListPRsCommand(pullrequestsApi, contextService, output);
|
|
23698
|
+
return new ListPRsCommand(pullrequestsApi, usersApi, contextService, output);
|
|
23673
23699
|
});
|
|
23674
23700
|
container.register(ServiceTokens.ViewPRCommand, () => {
|
|
23675
23701
|
const pullrequestsApi = container.resolve(ServiceTokens.PullrequestsApi);
|
|
@@ -23808,6 +23834,51 @@ function bootstrap(options = {}) {
|
|
|
23808
23834
|
return container;
|
|
23809
23835
|
}
|
|
23810
23836
|
|
|
23837
|
+
// src/help-text.ts
|
|
23838
|
+
function createHelpTextBuilder(noColor) {
|
|
23839
|
+
const passthrough = (t) => t;
|
|
23840
|
+
const chalk2 = new Chalk({ level: noColor ? 0 : 1 });
|
|
23841
|
+
const c = noColor ? { bold: passthrough, dim: passthrough, cyan: passthrough } : { bold: chalk2.bold, dim: chalk2.dim, cyan: chalk2.cyan };
|
|
23842
|
+
return function buildHelpText(config) {
|
|
23843
|
+
const sections = [];
|
|
23844
|
+
if (config.examples?.length) {
|
|
23845
|
+
sections.push(c.bold("Examples:"));
|
|
23846
|
+
for (const example of config.examples) {
|
|
23847
|
+
sections.push(` ${c.dim("$")} ${example}`);
|
|
23848
|
+
}
|
|
23849
|
+
}
|
|
23850
|
+
if (config.validValues) {
|
|
23851
|
+
for (const [label, values] of Object.entries(config.validValues)) {
|
|
23852
|
+
if (sections.length)
|
|
23853
|
+
sections.push("");
|
|
23854
|
+
sections.push(c.bold(`${label}:`));
|
|
23855
|
+
sections.push(` ${c.cyan(values.join(", "))}`);
|
|
23856
|
+
}
|
|
23857
|
+
}
|
|
23858
|
+
if (config.defaults) {
|
|
23859
|
+
if (sections.length)
|
|
23860
|
+
sections.push("");
|
|
23861
|
+
sections.push(c.bold("Defaults:"));
|
|
23862
|
+
for (const [key, value] of Object.entries(config.defaults)) {
|
|
23863
|
+
sections.push(` ${c.bold(`--${key}`)} ${c.cyan(value)}`);
|
|
23864
|
+
}
|
|
23865
|
+
}
|
|
23866
|
+
if (config.envVars) {
|
|
23867
|
+
if (sections.length)
|
|
23868
|
+
sections.push("");
|
|
23869
|
+
sections.push(c.bold("Environment variables:"));
|
|
23870
|
+
const maxLen = Math.max(...Object.keys(config.envVars).map((k) => k.length));
|
|
23871
|
+
for (const [name, desc] of Object.entries(config.envVars)) {
|
|
23872
|
+
sections.push(` ${c.bold(name.padEnd(maxLen + 2))}${c.dim(desc)}`);
|
|
23873
|
+
}
|
|
23874
|
+
}
|
|
23875
|
+
return `
|
|
23876
|
+
` + sections.join(`
|
|
23877
|
+
`) + `
|
|
23878
|
+
`;
|
|
23879
|
+
};
|
|
23880
|
+
}
|
|
23881
|
+
|
|
23811
23882
|
// src/cli.ts
|
|
23812
23883
|
import tabtab3 from "tabtab";
|
|
23813
23884
|
var require3 = createRequire2(import.meta.url);
|
|
@@ -23862,6 +23933,7 @@ function resolveNoColorSetting(argv, env2) {
|
|
|
23862
23933
|
return hasNoColorEnv;
|
|
23863
23934
|
}
|
|
23864
23935
|
var noColor = resolveNoColorSetting(process.argv, process.env);
|
|
23936
|
+
var buildHelpText = createHelpTextBuilder(noColor);
|
|
23865
23937
|
var container = bootstrap({ noColor });
|
|
23866
23938
|
function createContext(program2) {
|
|
23867
23939
|
const opts = program2.opts();
|
|
@@ -23891,7 +23963,15 @@ function withGlobalOptions(options, context) {
|
|
|
23891
23963
|
};
|
|
23892
23964
|
}
|
|
23893
23965
|
var cli = new Command;
|
|
23894
|
-
cli.name("bb").description("A command-line interface for Bitbucket Cloud").version(pkg2.version).option("--json", "Output as JSON").option("--no-color", "Disable color output").option("-w, --workspace <workspace>", "Specify workspace").option("-r, --repo <repo>", "Specify repository").
|
|
23966
|
+
cli.name("bb").description("A command-line interface for Bitbucket Cloud").version(pkg2.version).option("--json", "Output as JSON").option("--no-color", "Disable color output").option("-w, --workspace <workspace>", "Specify workspace").option("-r, --repo <repo>", "Specify repository").addHelpText("after", buildHelpText({
|
|
23967
|
+
envVars: {
|
|
23968
|
+
BB_USERNAME: "Bitbucket username (fallback for auth login)",
|
|
23969
|
+
BB_API_TOKEN: "Bitbucket API token (fallback for auth login)",
|
|
23970
|
+
NO_COLOR: "Disable color output when set",
|
|
23971
|
+
FORCE_COLOR: "Force color output when set (and not '0')",
|
|
23972
|
+
DEBUG: "Enable HTTP debug logging when 'true'"
|
|
23973
|
+
}
|
|
23974
|
+
})).action(async () => {
|
|
23895
23975
|
cli.outputHelp();
|
|
23896
23976
|
const versionService = container.resolve(ServiceTokens.VersionService);
|
|
23897
23977
|
const output = container.resolve(ServiceTokens.OutputService);
|
|
@@ -23908,116 +23988,256 @@ cli.name("bb").description("A command-line interface for Bitbucket Cloud").versi
|
|
|
23908
23988
|
} catch {}
|
|
23909
23989
|
});
|
|
23910
23990
|
var authCmd = new Command("auth").description("Authenticate with Bitbucket");
|
|
23911
|
-
authCmd.command("login").description("Authenticate with Bitbucket using an API token").option("-u, --username <username>", "Bitbucket username").option("-p, --password <password>", "Bitbucket API token").
|
|
23991
|
+
authCmd.command("login").description("Authenticate with Bitbucket using an API token").option("-u, --username <username>", "Bitbucket username").option("-p, --password <password>", "Bitbucket API token").addHelpText("after", buildHelpText({
|
|
23992
|
+
examples: [
|
|
23993
|
+
"bb auth login -u myuser -p mytoken",
|
|
23994
|
+
"BB_USERNAME=myuser BB_API_TOKEN=mytoken bb auth login"
|
|
23995
|
+
],
|
|
23996
|
+
envVars: {
|
|
23997
|
+
BB_USERNAME: "Used when --username is not provided",
|
|
23998
|
+
BB_API_TOKEN: "Used when --password is not provided"
|
|
23999
|
+
}
|
|
24000
|
+
})).action(async (options) => {
|
|
23912
24001
|
await runCommand(ServiceTokens.LoginCommand, options, cli);
|
|
23913
24002
|
});
|
|
23914
|
-
authCmd.command("logout").description("Log out of Bitbucket").action(async () => {
|
|
24003
|
+
authCmd.command("logout").description("Log out of Bitbucket").addHelpText("after", buildHelpText({ examples: ["bb auth logout"] })).action(async () => {
|
|
23915
24004
|
await runCommand(ServiceTokens.LogoutCommand, undefined, cli);
|
|
23916
24005
|
});
|
|
23917
|
-
authCmd.command("status").description("Show authentication status").
|
|
24006
|
+
authCmd.command("status").description("Show authentication status").addHelpText("after", buildHelpText({
|
|
24007
|
+
examples: ["bb auth status", "bb auth status --json"]
|
|
24008
|
+
})).action(async () => {
|
|
23918
24009
|
await runCommand(ServiceTokens.StatusCommand, undefined, cli);
|
|
23919
24010
|
});
|
|
23920
|
-
authCmd.command("token").description("Print the current access token").
|
|
24011
|
+
authCmd.command("token").description("Print the current access token").addHelpText("after", buildHelpText({
|
|
24012
|
+
examples: ["bb auth token", "bb auth token | pbcopy"]
|
|
24013
|
+
})).action(async () => {
|
|
23921
24014
|
await runCommand(ServiceTokens.TokenCommand, undefined, cli);
|
|
23922
24015
|
});
|
|
23923
24016
|
cli.addCommand(authCmd);
|
|
23924
24017
|
var repoCmd = new Command("repo").description("Manage repositories");
|
|
23925
|
-
repoCmd.command("clone <repository>").description("Clone a Bitbucket repository").option("-d, --directory <dir>", "Directory to clone into").
|
|
24018
|
+
repoCmd.command("clone <repository>").description("Clone a Bitbucket repository").option("-d, --directory <dir>", "Directory to clone into").addHelpText("after", buildHelpText({
|
|
24019
|
+
examples: [
|
|
24020
|
+
"bb repo clone workspace/repo-name",
|
|
24021
|
+
"bb repo clone workspace/repo-name -d my-directory"
|
|
24022
|
+
]
|
|
24023
|
+
})).action(async (repository, options) => {
|
|
23926
24024
|
await runCommand(ServiceTokens.CloneCommand, { repository, ...options }, cli);
|
|
23927
24025
|
});
|
|
23928
|
-
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").
|
|
24026
|
+
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").addHelpText("after", buildHelpText({
|
|
24027
|
+
examples: [
|
|
24028
|
+
"bb repo create my-repo",
|
|
24029
|
+
"bb repo create my-repo --public -p PROJ",
|
|
24030
|
+
'bb repo create my-repo -d "My new repository"'
|
|
24031
|
+
],
|
|
24032
|
+
defaults: { private: "true (visibility is private unless --public)" }
|
|
24033
|
+
})).action(async (name, options) => {
|
|
23929
24034
|
const context = createContext(cli);
|
|
23930
24035
|
await runCommand(ServiceTokens.CreateRepoCommand, withGlobalOptions({ name, ...options }, context), cli, context);
|
|
23931
24036
|
});
|
|
23932
|
-
repoCmd.command("list").description("List repositories").option("--limit <number>", "Maximum number of repositories to list", "25").
|
|
24037
|
+
repoCmd.command("list").description("List repositories").option("--limit <number>", "Maximum number of repositories to list", "25").addHelpText("after", buildHelpText({
|
|
24038
|
+
examples: [
|
|
24039
|
+
"bb repo list",
|
|
24040
|
+
"bb repo list --limit 50",
|
|
24041
|
+
"bb repo list --json"
|
|
24042
|
+
],
|
|
24043
|
+
defaults: { limit: "25" }
|
|
24044
|
+
})).action(async (options) => {
|
|
23933
24045
|
const context = createContext(cli);
|
|
23934
24046
|
await runCommand(ServiceTokens.ListReposCommand, withGlobalOptions(options, context), cli, context);
|
|
23935
24047
|
});
|
|
23936
|
-
repoCmd.command("view [repository]").description("View repository details").
|
|
24048
|
+
repoCmd.command("view [repository]").description("View repository details").addHelpText("after", buildHelpText({
|
|
24049
|
+
examples: [
|
|
24050
|
+
"bb repo view",
|
|
24051
|
+
"bb repo view workspace/repo-name",
|
|
24052
|
+
"bb repo view workspace/repo-name --json"
|
|
24053
|
+
]
|
|
24054
|
+
})).action(async (repository, options) => {
|
|
23937
24055
|
const context = createContext(cli);
|
|
23938
24056
|
await runCommand(ServiceTokens.ViewRepoCommand, withGlobalOptions({ repository, ...options }, context), cli, context);
|
|
23939
24057
|
});
|
|
23940
|
-
repoCmd.command("delete <repository>").description("Delete a repository").option("-y, --yes", "Skip confirmation prompt").
|
|
24058
|
+
repoCmd.command("delete <repository>").description("Delete a repository").option("-y, --yes", "Skip confirmation prompt").addHelpText("after", buildHelpText({
|
|
24059
|
+
examples: [
|
|
24060
|
+
"bb repo delete workspace/repo-name",
|
|
24061
|
+
"bb repo delete workspace/repo-name --yes"
|
|
24062
|
+
]
|
|
24063
|
+
})).action(async (repository, options) => {
|
|
23941
24064
|
const context = createContext(cli);
|
|
23942
24065
|
await runCommand(ServiceTokens.DeleteRepoCommand, withGlobalOptions({ repository, ...options }, context), cli, context);
|
|
23943
24066
|
});
|
|
23944
24067
|
cli.addCommand(repoCmd);
|
|
23945
24068
|
var prCmd = new Command("pr").description("Manage pull requests");
|
|
23946
|
-
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").option("--draft", "Create the pull request as draft").
|
|
24069
|
+
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").option("--draft", "Create the pull request as draft").addHelpText("after", buildHelpText({
|
|
24070
|
+
examples: [
|
|
24071
|
+
'bb pr create -t "My PR" -b "Description"',
|
|
24072
|
+
'bb pr create -t "My PR" --draft',
|
|
24073
|
+
'bb pr create -t "My PR" -s feature -d develop',
|
|
24074
|
+
'bb pr create -t "My PR" --close-source-branch'
|
|
24075
|
+
],
|
|
24076
|
+
defaults: {
|
|
24077
|
+
source: "current git branch",
|
|
24078
|
+
destination: "main"
|
|
24079
|
+
}
|
|
24080
|
+
})).action(async (options) => {
|
|
23947
24081
|
const context = createContext(cli);
|
|
23948
24082
|
await runCommand(ServiceTokens.CreatePRCommand, withGlobalOptions(options, context), cli, context);
|
|
23949
24083
|
});
|
|
23950
|
-
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").
|
|
24084
|
+
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").option("--mine", "Show only PRs where you are a reviewer").addHelpText("after", buildHelpText({
|
|
24085
|
+
examples: [
|
|
24086
|
+
"bb pr list",
|
|
24087
|
+
"bb pr list -s MERGED --limit 10",
|
|
24088
|
+
"bb pr list --mine",
|
|
24089
|
+
"bb pr list --json"
|
|
24090
|
+
],
|
|
24091
|
+
validValues: {
|
|
24092
|
+
"Valid states": ["OPEN", "MERGED", "DECLINED", "SUPERSEDED"]
|
|
24093
|
+
},
|
|
24094
|
+
defaults: { state: "OPEN", limit: "25" }
|
|
24095
|
+
})).action(async (options) => {
|
|
23951
24096
|
const context = createContext(cli);
|
|
23952
24097
|
await runCommand(ServiceTokens.ListPRsCommand, withGlobalOptions(options, context), cli, context);
|
|
23953
24098
|
});
|
|
23954
|
-
prCmd.command("view <id>").description("View pull request details").
|
|
24099
|
+
prCmd.command("view <id>").description("View pull request details").addHelpText("after", buildHelpText({
|
|
24100
|
+
examples: ["bb pr view 42", "bb pr view 42 --json"]
|
|
24101
|
+
})).action(async (id, options) => {
|
|
23955
24102
|
const context = createContext(cli);
|
|
23956
24103
|
await runCommand(ServiceTokens.ViewPRCommand, withGlobalOptions({ id, ...options }, context), cli, context);
|
|
23957
24104
|
});
|
|
23958
|
-
prCmd.command("activity <id>").description("Show pull request activity log").option("--limit <number>", "Maximum number of activity entries", "25").option("--type <types>", "Filter activity by type (comma-separated)").
|
|
24105
|
+
prCmd.command("activity <id>").description("Show pull request activity log").option("--limit <number>", "Maximum number of activity entries", "25").option("--type <types>", "Filter activity by type (comma-separated)").addHelpText("after", buildHelpText({
|
|
24106
|
+
examples: [
|
|
24107
|
+
"bb pr activity 42",
|
|
24108
|
+
"bb pr activity 42 --type comment,approval",
|
|
24109
|
+
"bb pr activity 42 --limit 10 --json"
|
|
24110
|
+
],
|
|
24111
|
+
validValues: {
|
|
24112
|
+
"Valid activity types (comma-separated)": [
|
|
24113
|
+
"comment",
|
|
24114
|
+
"approval",
|
|
24115
|
+
"changes_requested",
|
|
24116
|
+
"merge",
|
|
24117
|
+
"decline",
|
|
24118
|
+
"commit",
|
|
24119
|
+
"update"
|
|
24120
|
+
]
|
|
24121
|
+
},
|
|
24122
|
+
defaults: { limit: "25" }
|
|
24123
|
+
})).action(async (id, options) => {
|
|
23959
24124
|
const context = createContext(cli);
|
|
23960
24125
|
await runCommand(ServiceTokens.ActivityPRCommand, withGlobalOptions({ id, ...options }, context), cli, context);
|
|
23961
24126
|
});
|
|
23962
|
-
prCmd.command("checks <id>").description("Show CI/CD checks and build status for a pull request").option("--json", "Output as JSON").
|
|
24127
|
+
prCmd.command("checks <id>").description("Show CI/CD checks and build status for a pull request").option("--json", "Output as JSON").addHelpText("after", buildHelpText({
|
|
24128
|
+
examples: ["bb pr checks 42", "bb pr checks 42 --json"]
|
|
24129
|
+
})).action(async (id, options) => {
|
|
23963
24130
|
const context = createContext(cli);
|
|
23964
24131
|
await runCommand(ServiceTokens.ChecksPRCommand, withGlobalOptions({ id, ...options }, context), cli, context);
|
|
23965
24132
|
});
|
|
23966
|
-
prCmd.command("edit [id]").description("Edit a pull request").option("-t, --title <title>", "New pull request title").option("-b, --body <body>", "New pull request description").option("-F, --body-file <file>", "Read description from file").
|
|
24133
|
+
prCmd.command("edit [id]").description("Edit a pull request").option("-t, --title <title>", "New pull request title").option("-b, --body <body>", "New pull request description").option("-F, --body-file <file>", "Read description from file").addHelpText("after", buildHelpText({
|
|
24134
|
+
examples: [
|
|
24135
|
+
'bb pr edit 42 -t "New title"',
|
|
24136
|
+
'bb pr edit 42 -b "Updated description"',
|
|
24137
|
+
"bb pr edit 42 -F description.md",
|
|
24138
|
+
"bb pr edit"
|
|
24139
|
+
]
|
|
24140
|
+
})).action(async (id, options) => {
|
|
23967
24141
|
const context = createContext(cli);
|
|
23968
24142
|
await runCommand(ServiceTokens.EditPRCommand, withGlobalOptions({ id, ...options }, context), cli, context);
|
|
23969
24143
|
});
|
|
23970
|
-
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
|
|
24144
|
+
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").addHelpText("after", buildHelpText({
|
|
24145
|
+
examples: [
|
|
24146
|
+
"bb pr merge 42",
|
|
24147
|
+
"bb pr merge 42 --strategy squash --close-source-branch",
|
|
24148
|
+
'bb pr merge 42 -m "Merge feature X"'
|
|
24149
|
+
],
|
|
24150
|
+
validValues: {
|
|
24151
|
+
"Valid merge strategies": [
|
|
24152
|
+
"merge_commit",
|
|
24153
|
+
"squash",
|
|
24154
|
+
"fast_forward",
|
|
24155
|
+
"squash_fast_forward",
|
|
24156
|
+
"rebase_fast_forward",
|
|
24157
|
+
"rebase_merge"
|
|
24158
|
+
]
|
|
24159
|
+
}
|
|
24160
|
+
})).action(async (id, options) => {
|
|
23971
24161
|
const context = createContext(cli);
|
|
23972
24162
|
await runCommand(ServiceTokens.MergePRCommand, withGlobalOptions({ id, ...options }, context), cli, context);
|
|
23973
24163
|
});
|
|
23974
|
-
prCmd.command("approve <id>").description("Approve a pull request").action(async (id, options) => {
|
|
24164
|
+
prCmd.command("approve <id>").description("Approve a pull request").addHelpText("after", buildHelpText({ examples: ["bb pr approve 42"] })).action(async (id, options) => {
|
|
23975
24165
|
const context = createContext(cli);
|
|
23976
24166
|
await runCommand(ServiceTokens.ApprovePRCommand, withGlobalOptions({ id, ...options }, context), cli, context);
|
|
23977
24167
|
});
|
|
23978
|
-
prCmd.command("decline <id>").description("Decline a pull request").action(async (id, options) => {
|
|
24168
|
+
prCmd.command("decline <id>").description("Decline a pull request").addHelpText("after", buildHelpText({ examples: ["bb pr decline 42"] })).action(async (id, options) => {
|
|
23979
24169
|
const context = createContext(cli);
|
|
23980
24170
|
await runCommand(ServiceTokens.DeclinePRCommand, withGlobalOptions({ id, ...options }, context), cli, context);
|
|
23981
24171
|
});
|
|
23982
|
-
prCmd.command("ready <id>").description("Mark a draft pull request as ready for review").action(async (id, options) => {
|
|
24172
|
+
prCmd.command("ready <id>").description("Mark a draft pull request as ready for review").addHelpText("after", buildHelpText({ examples: ["bb pr ready 42"] })).action(async (id, options) => {
|
|
23983
24173
|
const context = createContext(cli);
|
|
23984
24174
|
await runCommand(ServiceTokens.ReadyPRCommand, withGlobalOptions({ id, ...options }, context), cli, context);
|
|
23985
24175
|
});
|
|
23986
|
-
prCmd.command("checkout <id>").description("Checkout a pull request locally").action(async (id, options) => {
|
|
24176
|
+
prCmd.command("checkout <id>").description("Checkout a pull request locally").addHelpText("after", buildHelpText({ examples: ["bb pr checkout 42"] })).action(async (id, options) => {
|
|
23987
24177
|
const context = createContext(cli);
|
|
23988
24178
|
await runCommand(ServiceTokens.CheckoutPRCommand, withGlobalOptions({ id, ...options }, context), cli, context);
|
|
23989
24179
|
});
|
|
23990
|
-
prCmd.command("diff [id]").description("View pull request diff").option("--color <when>", "Colorize output
|
|
24180
|
+
prCmd.command("diff [id]").description("View pull request diff").option("--color <when>", "Colorize output", "auto").option("--name-only", "Show only names of changed files").option("--stat", "Show diffstat").option("--web", "Open diff in web browser").addHelpText("after", buildHelpText({
|
|
24181
|
+
examples: [
|
|
24182
|
+
"bb pr diff 42",
|
|
24183
|
+
"bb pr diff 42 --stat",
|
|
24184
|
+
"bb pr diff 42 --name-only",
|
|
24185
|
+
"bb pr diff --web",
|
|
24186
|
+
"bb pr diff 42 --color always"
|
|
24187
|
+
],
|
|
24188
|
+
validValues: {
|
|
24189
|
+
"Valid --color values": ["auto", "always", "never"]
|
|
24190
|
+
},
|
|
24191
|
+
defaults: { color: "auto" }
|
|
24192
|
+
})).action(async (id, options) => {
|
|
23991
24193
|
const context = createContext(cli);
|
|
23992
24194
|
await runCommand(ServiceTokens.DiffPRCommand, withGlobalOptions({ id, ...options }, context), cli, context);
|
|
23993
24195
|
});
|
|
23994
24196
|
var prCommentsCmd = new Command("comments").description("Manage pull request comments");
|
|
23995
|
-
prCommentsCmd.command("list <id>").description("List comments on a pull request").option("--limit <number>", "Maximum number of comments (default: 25)").option("--no-truncate", "Show full comment content without truncation").
|
|
24197
|
+
prCommentsCmd.command("list <id>").description("List comments on a pull request").option("--limit <number>", "Maximum number of comments (default: 25)").option("--no-truncate", "Show full comment content without truncation").addHelpText("after", buildHelpText({
|
|
24198
|
+
examples: [
|
|
24199
|
+
"bb pr comments list 42",
|
|
24200
|
+
"bb pr comments list 42 --no-truncate",
|
|
24201
|
+
"bb pr comments list 42 --limit 50 --json"
|
|
24202
|
+
],
|
|
24203
|
+
defaults: { limit: "25" }
|
|
24204
|
+
})).action(async (id, options) => {
|
|
23996
24205
|
const context = createContext(cli);
|
|
23997
24206
|
await runCommand(ServiceTokens.ListCommentsPRCommand, withGlobalOptions({ id, ...options }, context), cli, context);
|
|
23998
24207
|
});
|
|
23999
|
-
prCommentsCmd.command("add <id> <message>").description("Add a comment to a pull request").option("--file <path>", "File path in the diff for inline comment").option("--line-to <number>", "Line number in the new file version").option("--line-from <number>", "Line number in the old file version").
|
|
24208
|
+
prCommentsCmd.command("add <id> <message>").description("Add a comment to a pull request").option("--file <path>", "File path in the diff for inline comment").option("--line-to <number>", "Line number in the new file version").option("--line-from <number>", "Line number in the old file version").addHelpText("after", buildHelpText({
|
|
24209
|
+
examples: [
|
|
24210
|
+
'bb pr comments add 42 "LGTM"',
|
|
24211
|
+
'bb pr comments add 42 "Fix this" --file src/main.ts --line-to 10'
|
|
24212
|
+
]
|
|
24213
|
+
})).action(async (id, message, options) => {
|
|
24000
24214
|
const context = createContext(cli);
|
|
24001
24215
|
await runCommand(ServiceTokens.CommentPRCommand, withGlobalOptions({ id, message, ...options }, context), cli, context);
|
|
24002
24216
|
});
|
|
24003
|
-
prCommentsCmd.command("edit <pr-id> <comment-id> <message>").description("Edit a comment on a pull request").
|
|
24217
|
+
prCommentsCmd.command("edit <pr-id> <comment-id> <message>").description("Edit a comment on a pull request").addHelpText("after", buildHelpText({
|
|
24218
|
+
examples: ['bb pr comments edit 42 12345 "Updated comment"']
|
|
24219
|
+
})).action(async (prId, commentId, message, options) => {
|
|
24004
24220
|
const context = createContext(cli);
|
|
24005
24221
|
await runCommand(ServiceTokens.EditCommentPRCommand, withGlobalOptions({ prId, commentId, message }, context), cli, context);
|
|
24006
24222
|
});
|
|
24007
|
-
prCommentsCmd.command("delete <pr-id> <comment-id>").description("Delete a comment on a pull request").
|
|
24223
|
+
prCommentsCmd.command("delete <pr-id> <comment-id>").description("Delete a comment on a pull request").addHelpText("after", buildHelpText({
|
|
24224
|
+
examples: ["bb pr comments delete 42 12345"]
|
|
24225
|
+
})).action(async (prId, commentId, options) => {
|
|
24008
24226
|
const context = createContext(cli);
|
|
24009
24227
|
await runCommand(ServiceTokens.DeleteCommentPRCommand, withGlobalOptions({ prId, commentId }, context), cli, context);
|
|
24010
24228
|
});
|
|
24011
24229
|
var prReviewersCmd = new Command("reviewers").description("Manage pull request reviewers");
|
|
24012
|
-
prReviewersCmd.command("list <id>").description("List reviewers on a pull request").
|
|
24230
|
+
prReviewersCmd.command("list <id>").description("List reviewers on a pull request").addHelpText("after", buildHelpText({
|
|
24231
|
+
examples: ["bb pr reviewers list 42", "bb pr reviewers list 42 --json"]
|
|
24232
|
+
})).action(async (id, options) => {
|
|
24013
24233
|
const context = createContext(cli);
|
|
24014
24234
|
await runCommand(ServiceTokens.ListReviewersPRCommand, withGlobalOptions({ id, ...options }, context), cli, context);
|
|
24015
24235
|
});
|
|
24016
|
-
prReviewersCmd.command("add <id> <username>").description("Add a reviewer to a pull request").action(async (id, username, options) => {
|
|
24236
|
+
prReviewersCmd.command("add <id> <username>").description("Add a reviewer to a pull request").addHelpText("after", buildHelpText({ examples: ["bb pr reviewers add 42 jdoe"] })).action(async (id, username, options) => {
|
|
24017
24237
|
const context = createContext(cli);
|
|
24018
24238
|
await runCommand(ServiceTokens.AddReviewerPRCommand, withGlobalOptions({ id, username, ...options }, context), cli, context);
|
|
24019
24239
|
});
|
|
24020
|
-
prReviewersCmd.command("remove <id> <username>").description("Remove a reviewer from a pull request").action(async (id, username, options) => {
|
|
24240
|
+
prReviewersCmd.command("remove <id> <username>").description("Remove a reviewer from a pull request").addHelpText("after", buildHelpText({ examples: ["bb pr reviewers remove 42 jdoe"] })).action(async (id, username, options) => {
|
|
24021
24241
|
const context = createContext(cli);
|
|
24022
24242
|
await runCommand(ServiceTokens.RemoveReviewerPRCommand, withGlobalOptions({ id, username, ...options }, context), cli, context);
|
|
24023
24243
|
});
|
|
@@ -24025,21 +24245,46 @@ cli.addCommand(prCmd);
|
|
|
24025
24245
|
prCmd.addCommand(prCommentsCmd);
|
|
24026
24246
|
prCmd.addCommand(prReviewersCmd);
|
|
24027
24247
|
var configCmd = new Command("config").description("Manage configuration");
|
|
24028
|
-
configCmd.command("get <key>").description("Get a configuration value").
|
|
24248
|
+
configCmd.command("get <key>").description("Get a configuration value").addHelpText("after", buildHelpText({
|
|
24249
|
+
examples: ["bb config get defaultWorkspace"],
|
|
24250
|
+
validValues: {
|
|
24251
|
+
"Readable config keys": [
|
|
24252
|
+
"username",
|
|
24253
|
+
"defaultWorkspace",
|
|
24254
|
+
"skipVersionCheck",
|
|
24255
|
+
"versionCheckInterval"
|
|
24256
|
+
]
|
|
24257
|
+
}
|
|
24258
|
+
})).action(async (key) => {
|
|
24029
24259
|
await runCommand(ServiceTokens.GetConfigCommand, { key }, cli);
|
|
24030
24260
|
});
|
|
24031
|
-
configCmd.command("set <key> <value>").description("Set a configuration value").
|
|
24261
|
+
configCmd.command("set <key> <value>").description("Set a configuration value").addHelpText("after", buildHelpText({
|
|
24262
|
+
examples: [
|
|
24263
|
+
"bb config set defaultWorkspace my-workspace",
|
|
24264
|
+
"bb config set skipVersionCheck true",
|
|
24265
|
+
"bb config set versionCheckInterval 86400"
|
|
24266
|
+
],
|
|
24267
|
+
validValues: {
|
|
24268
|
+
"Settable config keys": [
|
|
24269
|
+
"defaultWorkspace (string)",
|
|
24270
|
+
"skipVersionCheck (true/false)",
|
|
24271
|
+
"versionCheckInterval (positive integer, seconds)"
|
|
24272
|
+
]
|
|
24273
|
+
}
|
|
24274
|
+
})).action(async (key, value) => {
|
|
24032
24275
|
await runCommand(ServiceTokens.SetConfigCommand, { key, value }, cli);
|
|
24033
24276
|
});
|
|
24034
|
-
configCmd.command("list").description("List all configuration values").
|
|
24277
|
+
configCmd.command("list").description("List all configuration values").addHelpText("after", buildHelpText({
|
|
24278
|
+
examples: ["bb config list", "bb config list --json"]
|
|
24279
|
+
})).action(async () => {
|
|
24035
24280
|
await runCommand(ServiceTokens.ListConfigCommand, undefined, cli);
|
|
24036
24281
|
});
|
|
24037
24282
|
cli.addCommand(configCmd);
|
|
24038
24283
|
var completionCmd = new Command("completion").description("Shell completion utilities");
|
|
24039
|
-
completionCmd.command("install").description("Install shell completions for bash, zsh, or fish").action(async () => {
|
|
24284
|
+
completionCmd.command("install").description("Install shell completions for bash, zsh, or fish").addHelpText("after", buildHelpText({ examples: ["bb completion install"] })).action(async () => {
|
|
24040
24285
|
await runCommand(ServiceTokens.InstallCompletionCommand, undefined, cli);
|
|
24041
24286
|
});
|
|
24042
|
-
completionCmd.command("uninstall").description("Uninstall shell completions").action(async () => {
|
|
24287
|
+
completionCmd.command("uninstall").description("Uninstall shell completions").addHelpText("after", buildHelpText({ examples: ["bb completion uninstall"] })).action(async () => {
|
|
24043
24288
|
await runCommand(ServiceTokens.UninstallCompletionCommand, undefined, cli);
|
|
24044
24289
|
});
|
|
24045
24290
|
cli.addCommand(completionCmd);
|