@pilatos/bitbucket-cli 1.8.4 → 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.
Files changed (2) hide show
  1. package/dist/index.js +25 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -21964,12 +21964,14 @@ class CreatePRCommand extends BaseCommand {
21964
21964
  // src/commands/pr/list.command.ts
21965
21965
  class ListPRsCommand extends BaseCommand {
21966
21966
  pullrequestsApi;
21967
+ usersApi;
21967
21968
  contextService;
21968
21969
  name = "list";
21969
21970
  description = "List pull requests";
21970
- constructor(pullrequestsApi, contextService, output) {
21971
+ constructor(pullrequestsApi, usersApi, contextService, output) {
21971
21972
  super(output);
21972
21973
  this.pullrequestsApi = pullrequestsApi;
21974
+ this.usersApi = usersApi;
21973
21975
  this.contextService = contextService;
21974
21976
  }
21975
21977
  async execute(options, context) {
@@ -21979,6 +21981,7 @@ class ListPRsCommand extends BaseCommand {
21979
21981
  });
21980
21982
  const state = options.state || "OPEN";
21981
21983
  const limit = parseLimit(options.limit);
21984
+ const reviewerQuery = options.mine ? await this.buildMineFilter() : undefined;
21982
21985
  const values = await collectPages({
21983
21986
  limit,
21984
21987
  fetchPage: async (page, pagelen) => {
@@ -21987,7 +21990,11 @@ class ListPRsCommand extends BaseCommand {
21987
21990
  repoSlug: repoContext.repoSlug,
21988
21991
  state
21989
21992
  }, {
21990
- params: { page, pagelen }
21993
+ params: {
21994
+ page,
21995
+ pagelen,
21996
+ ...reviewerQuery ? { q: reviewerQuery } : {}
21997
+ }
21991
21998
  });
21992
21999
  return response.data;
21993
22000
  }
@@ -21997,6 +22004,9 @@ class ListPRsCommand extends BaseCommand {
21997
22004
  workspace: repoContext.workspace,
21998
22005
  repoSlug: repoContext.repoSlug,
21999
22006
  state,
22007
+ filters: {
22008
+ mine: options.mine === true
22009
+ },
22000
22010
  count: values.length,
22001
22011
  pullRequests: values
22002
22012
  });
@@ -22025,6 +22035,15 @@ class ListPRsCommand extends BaseCommand {
22025
22035
  }
22026
22036
  return text.substring(0, maxLength - 3) + "...";
22027
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
+ }
22028
22047
  }
22029
22048
 
22030
22049
  // src/commands/pr/view.command.ts
@@ -23673,9 +23692,10 @@ function bootstrap(options = {}) {
23673
23692
  });
23674
23693
  container.register(ServiceTokens.ListPRsCommand, () => {
23675
23694
  const pullrequestsApi = container.resolve(ServiceTokens.PullrequestsApi);
23695
+ const usersApi = container.resolve(ServiceTokens.UsersApi);
23676
23696
  const contextService = container.resolve(ServiceTokens.ContextService);
23677
23697
  const output = container.resolve(ServiceTokens.OutputService);
23678
- return new ListPRsCommand(pullrequestsApi, contextService, output);
23698
+ return new ListPRsCommand(pullrequestsApi, usersApi, contextService, output);
23679
23699
  });
23680
23700
  container.register(ServiceTokens.ViewPRCommand, () => {
23681
23701
  const pullrequestsApi = container.resolve(ServiceTokens.PullrequestsApi);
@@ -24061,10 +24081,11 @@ prCmd.command("create").description("Create a pull request").option("-t, --title
24061
24081
  const context = createContext(cli);
24062
24082
  await runCommand(ServiceTokens.CreatePRCommand, withGlobalOptions(options, context), cli, context);
24063
24083
  });
24064
- 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").addHelpText("after", buildHelpText({
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({
24065
24085
  examples: [
24066
24086
  "bb pr list",
24067
24087
  "bb pr list -s MERGED --limit 10",
24088
+ "bb pr list --mine",
24068
24089
  "bb pr list --json"
24069
24090
  ],
24070
24091
  validValues: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pilatos/bitbucket-cli",
3
- "version": "1.8.4",
3
+ "version": "1.9.0",
4
4
  "description": "A command-line interface for Bitbucket Cloud",
5
5
  "author": "",
6
6
  "license": "MIT",