co-maintainer 0.7.0-beta.3 → 0.7.0-beta.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "co-maintainer",
3
- "version": "0.7.0-beta.3",
3
+ "version": "0.7.0-beta.4",
4
4
  "description": "An imitator of yours, A PR review tool like co-maintainer.",
5
5
  "keywords": [
6
6
  "ai",
@@ -208,6 +208,17 @@ export async function readGuide(repo, name) {
208
208
  return "";
209
209
  }
210
210
  }
211
+ /** `Promise.all`, except that when several fail the error is the first in
212
+ * list order, not the first in time. For a pull request that does not exist
213
+ * every read fails, and only the read of the pull request itself says so:
214
+ * the comments read is an `issues/N` endpoint, which names the repository. */
215
+ async function allInOrder(values) {
216
+ const settled = await Promise.allSettled(values);
217
+ const failed = settled.find((item) => item.status === "rejected");
218
+ if (failed)
219
+ throw failed.reason;
220
+ return settled.map((item) => item.value);
221
+ }
211
222
  export async function reviewPullRequest(client, options, usage, snapshot, ai, progress, extras) {
212
223
  if (!options.prNumber)
213
224
  throw new Error("review requires a PR number");
@@ -215,7 +226,7 @@ export async function reviewPullRequest(client, options, usage, snapshot, ai, pr
215
226
  const report = progress ?? (() => { });
216
227
  report(modelSummary(options));
217
228
  report(`loading PR context for ${options.repo}#${number}`);
218
- const [pr, allComments, allReviews, guides] = await Promise.all([
229
+ const [pr, allComments, allReviews, guides] = await allInOrder([
219
230
  extras?.prefetched?.pull ??
220
231
  client.request(`repos/${options.repo}/pulls/${number}`),
221
232
  client.pages(`repos/${options.repo}/issues/${number}/comments`),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "co-maintainer",
3
- "version": "0.7.0-beta.3",
3
+ "version": "0.7.0-beta.4",
4
4
  "description": "An imitator of yours, A PR review tool like co-maintainer.",
5
5
  "keywords": [
6
6
  "ai",