@pilatos/bitbucket-cli 1.17.0 → 1.18.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 CHANGED
@@ -18785,8 +18785,9 @@ class OutputService {
18785
18785
  if (rows.length === 0) {
18786
18786
  return;
18787
18787
  }
18788
- const sanitizedHeaders = headers.map(stripControl);
18789
- const sanitizedRows = rows.map((row) => row.map((cell) => stripControl(cell || "")));
18788
+ const sanitizeCell = (cell) => stripControl(cell).replace(/[\t\n\r]+/g, " ");
18789
+ const sanitizedHeaders = headers.map(sanitizeCell);
18790
+ const sanitizedRows = rows.map((row) => row.map((cell) => sanitizeCell(cell || "")));
18790
18791
  const widths = sanitizedHeaders.map((header, index) => {
18791
18792
  const maxRowWidth = Math.max(...sanitizedRows.map((row) => (row[index] || "").length));
18792
18793
  return Math.max(header.length, maxRowWidth);
@@ -23570,11 +23571,14 @@ function parseLimit(limit, fallback = DEFAULT_LIMIT) {
23570
23571
  }
23571
23572
  return parsed;
23572
23573
  }
23573
- async function collectPages(options) {
23574
+ function resolveLimit(options) {
23575
+ return options.all ? Number.POSITIVE_INFINITY : parseLimit(options.limit);
23576
+ }
23577
+ async function collectPagesWithMeta(options) {
23574
23578
  const { fetchPage, shouldInclude } = options;
23575
23579
  const limit = Math.max(0, options.limit);
23576
23580
  if (limit === 0) {
23577
- return [];
23581
+ return { items: [], hasMore: false };
23578
23582
  }
23579
23583
  const requestedPageSize = options.pageSize ?? limit;
23580
23584
  const pagelen = Math.max(1, Math.min(requestedPageSize, MAX_PAGE_LENGTH));
@@ -23586,13 +23590,15 @@ async function collectPages(options) {
23586
23590
  if (pageValues.length === 0) {
23587
23591
  break;
23588
23592
  }
23589
- for (const value of pageValues) {
23593
+ for (let i = 0;i < pageValues.length; i += 1) {
23594
+ const value = pageValues[i];
23590
23595
  if (shouldInclude && !shouldInclude(value)) {
23591
23596
  continue;
23592
23597
  }
23593
23598
  items.push(value);
23594
23599
  if (items.length >= limit) {
23595
- return items;
23600
+ const moreOnThisPage = pageValues.slice(i + 1).some((rest) => !shouldInclude || shouldInclude(rest));
23601
+ return { items, hasMore: moreOnThisPage || Boolean(data.next) };
23596
23602
  }
23597
23603
  }
23598
23604
  if (!data.next) {
@@ -23600,7 +23606,10 @@ async function collectPages(options) {
23600
23606
  }
23601
23607
  page += 1;
23602
23608
  }
23603
- return items;
23609
+ return { items, hasMore: false };
23610
+ }
23611
+ async function collectPages(options) {
23612
+ return (await collectPagesWithMeta(options)).items;
23604
23613
  }
23605
23614
 
23606
23615
  // src/services/default-reviewer.service.ts
@@ -27584,6 +27593,11 @@ class BaseCommand {
27584
27593
  }
27585
27594
  return this.output.truncate(text, maxLength);
27586
27595
  }
27596
+ printMoreHint(shown, hasMore, noun = "results") {
27597
+ if (!hasMore)
27598
+ return;
27599
+ this.output.text(this.output.dim(`Showing ${shown} ${noun}. Use --limit <n> or --all to see more.`));
27600
+ }
27587
27601
  requireConfirmation(confirmed, warning) {
27588
27602
  if (confirmed)
27589
27603
  return;
@@ -28278,8 +28292,8 @@ class ListReposCommand extends BaseCommand {
28278
28292
  }
28279
28293
  async execute(options, context) {
28280
28294
  const workspace = await this.contextService.requireWorkspace(options.workspace ?? context.globalOptions.workspace);
28281
- const limit = parseLimit(options.limit);
28282
- const repos = await collectPages({
28295
+ const limit = resolveLimit(options);
28296
+ const { items: repos, hasMore } = await collectPagesWithMeta({
28283
28297
  limit,
28284
28298
  fetchPage: async (page, pagelen) => {
28285
28299
  const response = await this.repositoriesApi.repositoriesWorkspaceGet({
@@ -28308,6 +28322,7 @@ class ListReposCommand extends BaseCommand {
28308
28322
  this.truncateText(repo.description ?? "", 50, context.globalOptions)
28309
28323
  ]);
28310
28324
  this.output.table(["REPOSITORY", "VISIBILITY", "DESCRIPTION"], rows);
28325
+ this.printMoreHint(repos.length, hasMore, "repositories");
28311
28326
  }
28312
28327
  }
28313
28328
 
@@ -28675,9 +28690,9 @@ class ListPRsCommand extends BaseCommand {
28675
28690
  async execute(options, context) {
28676
28691
  const repoContext = await this.contextService.requireRepoContextFor(options, context);
28677
28692
  const state = options.state ? this.parseEnumOption(options.state, "state", PR_STATES) : "OPEN";
28678
- const limit = parseLimit(options.limit);
28693
+ const limit = resolveLimit(options);
28679
28694
  const reviewerQuery = options.mine ? await this.buildMineFilter() : undefined;
28680
- const values = await collectPages({
28695
+ const { items: values, hasMore } = await collectPagesWithMeta({
28681
28696
  limit,
28682
28697
  fetchPage: async (page, pagelen) => {
28683
28698
  const response = await this.pullrequestsApi.repositoriesWorkspaceRepoSlugPullrequestsGet({
@@ -28724,6 +28739,7 @@ class ListPRsCommand extends BaseCommand {
28724
28739
  ];
28725
28740
  });
28726
28741
  this.output.table(["ID", "TITLE", "AUTHOR", "BRANCHES"], rows);
28742
+ this.printMoreHint(values.length, hasMore, "pull requests");
28727
28743
  }
28728
28744
  async buildMineFilter() {
28729
28745
  const response = await this.usersApi.userGet();
@@ -29421,8 +29437,8 @@ class ActivityPRCommand extends BaseCommand {
29421
29437
  const repoContext = await this.contextService.requireRepoContextFor(options, context);
29422
29438
  const prId = this.parsePositiveInt(options.id, "id");
29423
29439
  const filterTypes = this.parseTypeFilter(options.type);
29424
- const limit = parseLimit(options.limit);
29425
- const activities = await collectPages({
29440
+ const limit = resolveLimit(options);
29441
+ const { items: activities, hasMore } = await collectPagesWithMeta({
29426
29442
  limit,
29427
29443
  fetchPage: async (page, pagelen) => {
29428
29444
  const response = await this.pullrequestsApi.repositoriesWorkspaceRepoSlugPullrequestsPullRequestIdActivityGet({
@@ -29472,6 +29488,7 @@ class ActivityPRCommand extends BaseCommand {
29472
29488
  ];
29473
29489
  });
29474
29490
  this.output.table(["TYPE", "ACTOR", "DATE", "DETAILS"], rows);
29491
+ this.printMoreHint(activities.length, hasMore, "activity entries");
29475
29492
  }
29476
29493
  parseTypeFilter(typeOption) {
29477
29494
  if (!typeOption) {
@@ -29658,8 +29675,8 @@ class ListCommentsPRCommand extends BaseCommand {
29658
29675
  async execute(options, context) {
29659
29676
  const repoContext = await this.contextService.requireRepoContextFor(options, context);
29660
29677
  const prId = this.parsePositiveInt(options.id, "id");
29661
- const limit = parseLimit(options.limit);
29662
- const values = await collectPages({
29678
+ const limit = resolveLimit(options);
29679
+ const { items: values, hasMore } = await collectPagesWithMeta({
29663
29680
  limit,
29664
29681
  fetchPage: async (page, pagelen) => {
29665
29682
  const response = await this.pullrequestsApi.repositoriesWorkspaceRepoSlugPullrequestsPullRequestIdCommentsGet({
@@ -29696,6 +29713,7 @@ class ListCommentsPRCommand extends BaseCommand {
29696
29713
  ];
29697
29714
  });
29698
29715
  this.output.table(["ID", "Author", "Content", "Date"], rows);
29716
+ this.printMoreHint(values.length, hasMore, "comments");
29699
29717
  }
29700
29718
  }
29701
29719
 
@@ -30025,9 +30043,9 @@ class ListSnippetsCommand extends BaseCommand {
30025
30043
  }
30026
30044
  async execute(options, context) {
30027
30045
  const workspace = await this.contextService.requireWorkspace(options.workspace ?? context.globalOptions.workspace);
30028
- const limit = parseLimit(options.limit);
30046
+ const limit = resolveLimit(options);
30029
30047
  const role = options.role ? this.parseEnumOption(options.role, "role", VALID_ROLES) : undefined;
30030
- const snippets = await collectPages({
30048
+ const { items: snippets, hasMore } = await collectPagesWithMeta({
30031
30049
  limit,
30032
30050
  fetchPage: async (page, pagelen) => {
30033
30051
  const response = await this.snippetsApi.snippetsWorkspaceGet({
@@ -30059,6 +30077,7 @@ class ListSnippetsCommand extends BaseCommand {
30059
30077
  this.output.formatDate(snippet.updated_on ?? "")
30060
30078
  ]);
30061
30079
  this.output.table(["ID", "TITLE", "VISIBILITY", "CREATOR", "UPDATED"], rows);
30080
+ this.printMoreHint(snippets.length, hasMore, "snippets");
30062
30081
  }
30063
30082
  }
30064
30083
 
@@ -30383,8 +30402,8 @@ class ListSnippetCommentsCommand extends BaseCommand {
30383
30402
  }
30384
30403
  async execute(options, context) {
30385
30404
  const workspace = await this.contextService.requireWorkspace(options.workspace ?? context.globalOptions.workspace);
30386
- const limit = parseLimit(options.limit);
30387
- const comments = await collectPages({
30405
+ const limit = resolveLimit(options);
30406
+ const { items: comments, hasMore } = await collectPagesWithMeta({
30388
30407
  limit,
30389
30408
  fetchPage: async (page, pagelen) => {
30390
30409
  const response = await this.snippetsApi.snippetsWorkspaceEncodedIdCommentsGet({
@@ -30419,6 +30438,7 @@ class ListSnippetCommentsCommand extends BaseCommand {
30419
30438
  ];
30420
30439
  });
30421
30440
  this.output.table(["ID", "AUTHOR", "DATE", "CONTENT"], rows);
30441
+ this.printMoreHint(comments.length, hasMore, "comments");
30422
30442
  }
30423
30443
  }
30424
30444
 
@@ -31586,10 +31606,11 @@ repoCmd.command("create <name>").description("Create a new repository").option("
31586
31606
  const context = createContext(cli);
31587
31607
  await runCommand(ServiceTokens.CreateRepoCommand, withGlobalOptions({ name, ...options }, context), cli, context);
31588
31608
  });
31589
- repoCmd.command("list").description("List repositories").option("--limit <number>", "Maximum number of repositories to list", "25").addHelpText("after", buildHelpText({
31609
+ repoCmd.command("list").description("List repositories").option("--limit <number>", "Maximum number of repositories to list", "25").option("--all", "List all repositories (overrides --limit)").addHelpText("after", buildHelpText({
31590
31610
  examples: [
31591
31611
  "bb repo list",
31592
31612
  "bb repo list --limit 50",
31613
+ "bb repo list --all",
31593
31614
  "bb repo list --json"
31594
31615
  ],
31595
31616
  defaults: { limit: "25" }
@@ -31675,10 +31696,11 @@ prCmd.command("create").description("Create a pull request").option("-t, --title
31675
31696
  const context = createContext(cli);
31676
31697
  await runCommand(ServiceTokens.CreatePRCommand, withGlobalOptions(options, context), cli, context);
31677
31698
  });
31678
- prCmd.command("list").description("List pull requests").option("-s, --state <state>", `Filter by state (${PR_STATES.join(", ")})`, "OPEN").option("--limit <number>", "Maximum number of PRs to list", "25").option("--mine", "Show only PRs where you are a reviewer (not authored by you)").addHelpText("after", buildHelpText({
31699
+ prCmd.command("list").description("List pull requests").option("-s, --state <state>", `Filter by state (${PR_STATES.join(", ")})`, "OPEN").option("--limit <number>", "Maximum number of PRs to list", "25").option("--all", "List all pull requests (overrides --limit)").option("--mine", "Show only PRs where you are a reviewer (not authored by you)").addHelpText("after", buildHelpText({
31679
31700
  examples: [
31680
31701
  "bb pr list",
31681
31702
  "bb pr list -s MERGED --limit 10",
31703
+ "bb pr list --all",
31682
31704
  "bb pr list --mine",
31683
31705
  "bb pr list --json"
31684
31706
  ],
@@ -31706,10 +31728,11 @@ prCmd.command("view <id>").description("View pull request details").addHelpText(
31706
31728
  const context = createContext(cli);
31707
31729
  await runCommand(ServiceTokens.ViewPRCommand, withGlobalOptions({ id, ...options }, context), cli, context);
31708
31730
  });
31709
- 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({
31731
+ prCmd.command("activity <id>").description("Show pull request activity log").option("--limit <number>", "Maximum number of activity entries", "25").option("--all", "Show all activity entries (overrides --limit)").option("--type <types>", "Filter activity by type (comma-separated)").addHelpText("after", buildHelpText({
31710
31732
  examples: [
31711
31733
  "bb pr activity 42",
31712
31734
  "bb pr activity 42 --type comment,approval",
31735
+ "bb pr activity 42 --all",
31713
31736
  "bb pr activity 42 --limit 10 --json"
31714
31737
  ],
31715
31738
  validValues: {
@@ -31824,10 +31847,11 @@ prCmd.command("diff [id]").description("View pull request diff").option("--color
31824
31847
  await runCommand(ServiceTokens.DiffPRCommand, withGlobalOptions({ id, ...options }, context), cli, context);
31825
31848
  });
31826
31849
  var prCommentsCmd = new Command("comments").description("Manage pull request comments");
31827
- prCommentsCmd.command("list <id>").description("List comments on a pull request").option("--limit <number>", "Maximum number of comments (default: 25)").addHelpText("after", buildHelpText({
31850
+ prCommentsCmd.command("list <id>").description("List comments on a pull request").option("--limit <number>", "Maximum number of comments (default: 25)").option("--all", "List all comments (overrides --limit)").addHelpText("after", buildHelpText({
31828
31851
  examples: [
31829
31852
  "bb pr comments list 42",
31830
31853
  "bb pr comments list 42 --no-truncate",
31854
+ "bb pr comments list 42 --all",
31831
31855
  "bb pr comments list 42 --limit 50 --json"
31832
31856
  ],
31833
31857
  defaults: { limit: "25" }
@@ -31891,10 +31915,11 @@ cli.addCommand(prCmd);
31891
31915
  prCmd.addCommand(prCommentsCmd);
31892
31916
  prCmd.addCommand(prReviewersCmd);
31893
31917
  var snippetCmd = new Command("snippet").description("Manage snippets");
31894
- snippetCmd.command("list").description("List snippets in a workspace").option("--role <role>", "Filter by role (owner, contributor, member)").option("--limit <number>", "Maximum number of snippets to list", "25").addHelpText("after", buildHelpText({
31918
+ snippetCmd.command("list").description("List snippets in a workspace").option("--role <role>", "Filter by role (owner, contributor, member)").option("--limit <number>", "Maximum number of snippets to list", "25").option("--all", "List all snippets (overrides --limit)").addHelpText("after", buildHelpText({
31895
31919
  examples: [
31896
31920
  "bb snippet list",
31897
31921
  "bb snippet list --role owner",
31922
+ "bb snippet list --all",
31898
31923
  "bb snippet list --limit 50 --json"
31899
31924
  ],
31900
31925
  validValues: {
@@ -31958,9 +31983,10 @@ snippetCmd.command("unwatch <id>").description("Stop watching a snippet").addHel
31958
31983
  await runCommand(ServiceTokens.UnwatchSnippetCommand, withGlobalOptions({ id, ...options }, context), cli, context);
31959
31984
  });
31960
31985
  var snippetCommentsCmd = new Command("comments").description("Manage snippet comments");
31961
- snippetCommentsCmd.command("list <id>").description("List comments on a snippet").option("--limit <number>", "Maximum number of comments", "25").addHelpText("after", buildHelpText({
31986
+ snippetCommentsCmd.command("list <id>").description("List comments on a snippet").option("--limit <number>", "Maximum number of comments", "25").option("--all", "List all comments (overrides --limit)").addHelpText("after", buildHelpText({
31962
31987
  examples: [
31963
31988
  "bb snippet comments list kypj",
31989
+ "bb snippet comments list kypj --all",
31964
31990
  "bb snippet comments list kypj --limit 50 --json"
31965
31991
  ],
31966
31992
  defaults: { limit: "25" }
@@ -32092,5 +32118,5 @@ if (typeof Bun === "undefined") {
32092
32118
  }
32093
32119
  cli.parse(process.argv);
32094
32120
 
32095
- //# debugId=1F677A9695E119AD64756E2164756E21
32121
+ //# debugId=B7A5A47929AA84A364756E2164756E21
32096
32122
  //# sourceMappingURL=index.js.map