bdy 1.25.37-dev → 1.25.38-dev-pr

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 (110) hide show
  1. package/distTs/package.json +2 -1
  2. package/distTs/src/agent/agent.js +65 -6
  3. package/distTs/src/api/client.js +191 -1
  4. package/distTs/src/autocomplete.js +90 -0
  5. package/distTs/src/cliError.js +5 -0
  6. package/distTs/src/cliIndex.js +3 -0
  7. package/distTs/src/command/artifact/downloadDir.js +110 -0
  8. package/distTs/src/command/autocomplete/install.js +16 -0
  9. package/distTs/src/command/autocomplete/uninstall.js +16 -0
  10. package/distTs/src/command/autocomplete.js +14 -0
  11. package/distTs/src/command/environment/resolve.js +39 -0
  12. package/distTs/src/command/login.js +1 -1
  13. package/distTs/src/command/package/create.js +64 -0
  14. package/distTs/src/command/package/delete.js +38 -0
  15. package/distTs/src/command/package/docker/login.js +26 -0
  16. package/distTs/src/command/package/docker.js +11 -0
  17. package/distTs/src/command/package/download.js +138 -0
  18. package/distTs/src/command/package/get.js +36 -0
  19. package/distTs/src/command/package/list.js +31 -0
  20. package/distTs/src/command/package/publish.js +241 -0
  21. package/distTs/src/command/package/version/delete.js +39 -0
  22. package/distTs/src/command/package/version/get.js +45 -0
  23. package/distTs/src/command/package/version/list.js +47 -0
  24. package/distTs/src/command/package/version.js +16 -0
  25. package/distTs/src/command/package.js +26 -0
  26. package/distTs/src/command/pipeline/run/apply.js +62 -0
  27. package/distTs/src/command/pr/comment/add.js +66 -0
  28. package/distTs/src/command/pr/comment/list.js +169 -0
  29. package/distTs/src/command/pr/comment/status.js +48 -0
  30. package/distTs/src/command/pr/comment.js +19 -0
  31. package/distTs/src/command/pr/create.js +43 -0
  32. package/distTs/src/command/pr/diff.js +227 -0
  33. package/distTs/src/command/pr/file/list.js +124 -0
  34. package/distTs/src/command/pr/file/mark.js +45 -0
  35. package/distTs/src/command/pr/file.js +16 -0
  36. package/distTs/src/command/pr/get.js +29 -0
  37. package/distTs/src/command/pr/list.js +79 -0
  38. package/distTs/src/command/pr/merge.js +66 -0
  39. package/distTs/src/command/pr/review/request.js +29 -0
  40. package/distTs/src/command/pr/review/start.js +29 -0
  41. package/distTs/src/command/pr/review/verdict.js +81 -0
  42. package/distTs/src/command/pr/review.js +18 -0
  43. package/distTs/src/command/pr/shared.js +595 -0
  44. package/distTs/src/command/pr/state.js +38 -0
  45. package/distTs/src/command/pr/summary.js +316 -0
  46. package/distTs/src/command/pr/update.js +54 -0
  47. package/distTs/src/command/pr/updateBranch.js +22 -0
  48. package/distTs/src/command/pr/versions.js +42 -0
  49. package/distTs/src/command/pr.js +39 -0
  50. package/distTs/src/command/scrape/validation.js +154 -0
  51. package/distTs/src/command/scrape.js +144 -0
  52. package/distTs/src/command/suiteLink.js +14 -0
  53. package/distTs/src/command/tests/visual/result/download.js +31 -0
  54. package/distTs/src/command/tests/visual/result/get.js +68 -0
  55. package/distTs/src/command/tests/visual/result/list.js +49 -0
  56. package/distTs/src/command/tests/visual/result.js +23 -0
  57. package/distTs/src/command/tests/visual/session/get.js +70 -0
  58. package/distTs/src/command/tests/visual/session/list.js +69 -0
  59. package/distTs/src/command/tests/visual/session/open.js +22 -0
  60. package/distTs/src/command/tests/visual/session/reviewUrl.js +37 -0
  61. package/distTs/src/command/tests/visual/session/update.js +26 -0
  62. package/distTs/src/command/tests/visual/shared/context.js +144 -0
  63. package/distTs/src/command/tests/visual/shared/diffRegions.js +172 -0
  64. package/distTs/src/command/tests/visual/shared/format.js +21 -0
  65. package/distTs/src/command/tests/visual/shared/lookup.js +107 -0
  66. package/distTs/src/command/tests/visual/shared/options.js +90 -0
  67. package/distTs/src/command/tests/visual/shared/review.js +146 -0
  68. package/distTs/src/command/tests/visual/shared/reviewUrl.js +62 -0
  69. package/distTs/src/command/tests/visual/shared/session.js +217 -0
  70. package/distTs/src/command/tests/visual/snapshot/get.js +46 -0
  71. package/distTs/src/command/tests/visual/snapshot/list.js +68 -0
  72. package/distTs/src/command/tests/visual/snapshot/open.js +26 -0
  73. package/distTs/src/command/tests/visual/snapshot/reviewUrl.js +48 -0
  74. package/distTs/src/command/tests/visual/snapshot.js +28 -0
  75. package/distTs/src/command/tests/visual/suite/create.js +38 -0
  76. package/distTs/src/command/tests/visual/suite/delete.js +29 -0
  77. package/distTs/src/command/tests/visual/suite/get.js +43 -0
  78. package/distTs/src/command/tests/visual/suite/list.js +35 -0
  79. package/distTs/src/command/tests/visual/suite/open.js +20 -0
  80. package/distTs/src/command/tests/visual/suite/update.js +47 -0
  81. package/distTs/src/command/tests/visual/suite.js +30 -0
  82. package/distTs/src/command/tunnel/http.js +1 -1
  83. package/distTs/src/command/tunnel/start.js +1 -1
  84. package/distTs/src/command/tunnel/tcp.js +1 -1
  85. package/distTs/src/command/tunnel/tls.js +1 -1
  86. package/distTs/src/command/ut/upload.js +86 -0
  87. package/distTs/src/command/ut.js +12 -0
  88. package/distTs/src/command/vt/close.js +27 -0
  89. package/distTs/src/command/vt/compare/validation.js +46 -0
  90. package/distTs/src/command/vt/compare.js +100 -0
  91. package/distTs/src/command/vt/exec.js +82 -0
  92. package/distTs/src/command/vt/installBrowser.js +20 -0
  93. package/distTs/src/command/vt/shared/validation.js +145 -0
  94. package/distTs/src/command/vt/storybook.js +138 -0
  95. package/distTs/src/command/vt.js +20 -0
  96. package/distTs/src/command/yaml/agents.js +88 -0
  97. package/distTs/src/command/yaml/init.js +110 -0
  98. package/distTs/src/main.js +190 -0
  99. package/distTs/src/output/pipeline.js +54 -56
  100. package/distTs/src/output.js +83 -26
  101. package/distTs/src/texts.js +450 -1
  102. package/distTs/src/tunnel/output/interactive/tunnel.js +28 -11
  103. package/distTs/src/tunnel/output/noninteractive/tunnel.js +17 -1
  104. package/distTs/src/tunnel/output/noninteractive/tunnelJsonl.js +8 -0
  105. package/distTs/src/types/options.js +2 -0
  106. package/distTs/src/types/scrape.js +2 -0
  107. package/distTs/src/types/tunnel.js +6 -1
  108. package/distTs/src/types/visualTests.js +2 -0
  109. package/distTs/src/utils.js +134 -3
  110. package/package.json +2 -1
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.commandPrReviewRequestChanges = exports.commandPrReviewApprove = void 0;
7
+ const utils_1 = require("../../../utils");
8
+ const texts_1 = require("../../../texts");
9
+ const output_1 = __importDefault(require("../../../output"));
10
+ const cliError_1 = __importDefault(require("../../../cliError"));
11
+ const shared_1 = require("../shared");
12
+ /**
13
+ * The reasons of a refused approval, in a form an agent can act on: the
14
+ * threads not CLOSED, the unviewed MUST_REVIEW files (as the batches holding
15
+ * them when the list is split) and a pending triage.
16
+ */
17
+ const blockedError = async (scope, number, version, err) => {
18
+ const body = err.body || {};
19
+ const lines = [`${texts_1.ERR_PR_APPROVAL_BLOCKED}: ${err.message}`];
20
+ const threads = body.open_threads || [];
21
+ const threadsCount = body.open_threads_count ?? threads.length;
22
+ if (threadsCount > 0) {
23
+ lines.push(`${(0, texts_1.TXT_PR_APPROVAL_OPEN_THREADS)(threadsCount)}${threads.length ? ` (${threads.join(', ')})` : ''}`);
24
+ lines.push(` ${scope.cmd(`comment ls ${number} --threads${version ? ` --rev v${version}` : ''}`)}`);
25
+ }
26
+ const notViewed = body.must_review_not_viewed || [];
27
+ const notViewedCount = body.must_review_not_viewed_count ?? notViewed.length;
28
+ if (notViewedCount > 0) {
29
+ lines.push((0, texts_1.TXT_PR_APPROVAL_NOT_VIEWED)(notViewedCount));
30
+ const mustReview = await (0, shared_1.fetchMustReview)(scope, number, version).catch(() => null);
31
+ const shown = mustReview?.version ?? version;
32
+ const batches = (0, shared_1.buildBatches)(mustReview?.files || []);
33
+ const missing = new Set((mustReview?.files || []).filter((f) => !f.viewed).map((f) => f.file_name));
34
+ const open = batches.filter((b) => b.files.some((f) => missing.has(f.file_name)));
35
+ if (open.length > 0) {
36
+ lines.push(texts_1.TXT_PR_APPROVAL_BATCHES);
37
+ open.forEach((b) => lines.push(` ${(0, texts_1.TXT_PR_BATCH_LINE)(b.batch, b.files.length, b.tokens, scope.cmd(`file ls ${number} --batch ${b.batch}${shown ? ` --rev v${shown}` : ''}`))}`));
38
+ }
39
+ else {
40
+ const paths = missing.size > 0 ? [...missing] : notViewed;
41
+ paths.forEach((path) => lines.push(` ${path}`));
42
+ }
43
+ }
44
+ if (body.triage_pending)
45
+ lines.push(texts_1.TXT_PR_APPROVAL_TRIAGE_PENDING);
46
+ return new cliError_1.default('usage_error', lines.join('\n'), texts_1.TXT_PR_APPROVAL_FORCE_HINT);
47
+ };
48
+ const verdictCommand = (name, description, examples, verdict) => {
49
+ const command = (0, utils_1.newCommand)(name, description, {
50
+ requiredScopes: [utils_1.REST_API_SCOPE.REPOSITORY_WRITE],
51
+ examples,
52
+ });
53
+ (0, shared_1.addPrOptions)(command, true);
54
+ if (verdict === utils_1.PR_VERDICT.APPROVED)
55
+ command.option('--force', texts_1.OPTION_PR_APPROVE_FORCE);
56
+ command.argument('[N]', texts_1.OPTION_PR_NUMBER);
57
+ command.action(async (n, options) => {
58
+ const version = (0, shared_1.parseRev)(options.rev);
59
+ const scope = (0, shared_1.prScope)(options);
60
+ const number = await (0, shared_1.resolveNumber)(scope, n);
61
+ let review;
62
+ try {
63
+ review = await scope.client.submitPullRequestVerdict(scope.workspace, scope.project, number, { verdict, version, force: options.force ? true : undefined });
64
+ }
65
+ catch (err) {
66
+ if ((0, shared_1.isVersionConflict)(err)) {
67
+ throw new cliError_1.default('usage_error', (0, texts_1.TXT_PR_VERSION_CONFLICT)(scope.cmd, number, (0, shared_1.conflictVersion)(err)));
68
+ }
69
+ if (err instanceof cliError_1.default && err.status === 400 && err.body && (err.body.open_threads_count !== undefined ||
70
+ err.body.must_review_not_viewed_count !== undefined ||
71
+ err.body.triage_pending !== undefined)) {
72
+ throw await blockedError(scope, number, version, err);
73
+ }
74
+ throw err;
75
+ }
76
+ output_1.default.exitResult(options.format === 'json', review, (0, texts_1.TXT_PR_REVIEW_VERDICT)(review?.verdict ?? verdict, review?.version ?? version));
77
+ });
78
+ return command;
79
+ };
80
+ exports.commandPrReviewApprove = verdictCommand('approve', texts_1.DESC_COMMAND_PR_REVIEW_APPROVE, texts_1.EXAMPLE_PR_REVIEW_APPROVE, utils_1.PR_VERDICT.APPROVED);
81
+ exports.commandPrReviewRequestChanges = verdictCommand('request-changes', texts_1.DESC_COMMAND_PR_REVIEW_REQUEST_CHANGES, texts_1.EXAMPLE_PR_REVIEW_REQUEST_CHANGES, utils_1.PR_VERDICT.CHANGE_REQUESTED);
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const utils_1 = require("../../utils");
7
+ const texts_1 = require("../../texts");
8
+ const start_1 = __importDefault(require("./review/start"));
9
+ const verdict_1 = require("./review/verdict");
10
+ const request_1 = __importDefault(require("./review/request"));
11
+ const commandPrReview = (0, utils_1.newCommand)('review', texts_1.DESC_COMMAND_PR_REVIEW, {
12
+ examples: texts_1.EXAMPLE_PR_REVIEW,
13
+ });
14
+ commandPrReview.addCommand(start_1.default);
15
+ commandPrReview.addCommand(verdict_1.commandPrReviewApprove);
16
+ commandPrReview.addCommand(verdict_1.commandPrReviewRequestChanges);
17
+ commandPrReview.addCommand(request_1.default);
18
+ exports.default = commandPrReview;