@staff0rd/assist 0.868.0 → 0.869.1

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
@@ -6,7 +6,7 @@ import { Command } from "commander";
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "@staff0rd/assist",
9
- version: "0.868.0",
9
+ version: "0.869.1",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -36929,7 +36929,8 @@ function formatSynthesisSummary(summary) {
36929
36929
  // src/commands/review/buildReviewSummary.ts
36930
36930
  var UNANCHOR_REASONS = {
36931
36931
  "out-of-diff": "its line falls outside the PR diff",
36932
- unlocated: "it has no parseable file:line"
36932
+ unlocated: "it has no parseable file:line",
36933
+ "comment-rejected": "GitHub rejected its line comment"
36933
36934
  };
36934
36935
  function formatFindingLine(finding) {
36935
36936
  const severity = finding.severity ?? "finding";
@@ -38785,7 +38786,7 @@ function buildCommentBody(finding) {
38785
38786
  }
38786
38787
  async function postFindings(findings) {
38787
38788
  let posted = 0;
38788
- let failed3 = 0;
38789
+ const failed3 = [];
38789
38790
  for (const finding of findings) {
38790
38791
  const body = buildCommentBody(finding);
38791
38792
  try {
@@ -38795,7 +38796,7 @@ async function postFindings(findings) {
38795
38796
  });
38796
38797
  posted++;
38797
38798
  } catch (error) {
38798
- failed3++;
38799
+ failed3.push(finding);
38799
38800
  const message3 = error instanceof Error ? error.message : String(error);
38800
38801
  console.error(
38801
38802
  `Failed to post comment on ${finding.file}:${finding.line}: ${message3}`
@@ -38829,6 +38830,19 @@ function submitPendingLeftByFailedThreads(body, result) {
38829
38830
  return result.failed > 0 && submitPendingReview(body);
38830
38831
  }
38831
38832
 
38833
+ // src/commands/review/withRejectedFindings.ts
38834
+ function withRejectedFindings(unanchored, rejected) {
38835
+ return [
38836
+ ...unanchored,
38837
+ ...rejected.map(
38838
+ (finding) => ({
38839
+ ...finding,
38840
+ reason: "comment-rejected"
38841
+ })
38842
+ )
38843
+ ];
38844
+ }
38845
+
38832
38846
  // src/commands/review/postAndMaybeSubmit.ts
38833
38847
  async function decideSubmit(options2) {
38834
38848
  if (!options2.prompt) return options2.submit;
@@ -38840,24 +38854,25 @@ async function decideSubmit(options2) {
38840
38854
  }
38841
38855
  }
38842
38856
  async function postAndMaybeSubmit(lineBound, unanchored, markdown, options2) {
38843
- const result = await postFindings(lineBound);
38844
- const failedSuffix = result.failed > 0 ? `, ${result.failed} failed` : "";
38845
- console.log(`Posted ${result.posted} comment(s)${failedSuffix}.`);
38846
- const carried = carriedUnanchoredFindings(unanchored);
38847
- if (result.posted === 0 && carried.length === 0 && !options2.ciFooter)
38857
+ const { posted, failed: failed3 } = await postFindings(lineBound);
38858
+ const failedSuffix = failed3.length > 0 ? `, ${failed3.length} failed` : "";
38859
+ console.log(`Posted ${posted} comment(s)${failedSuffix}.`);
38860
+ const withRejected = withRejectedFindings(unanchored, failed3);
38861
+ const carried = carriedUnanchoredFindings(withRejected);
38862
+ if (posted === 0 && carried.length === 0 && !options2.ciFooter)
38848
38863
  return { posted: 0, submitted: false };
38849
38864
  const shouldSubmit = await decideSubmit(options2);
38850
38865
  if (shouldSubmit) {
38851
38866
  const submitted = submitReview(
38852
- buildReviewBody(markdown, unanchored, options2.ciFooter),
38853
- result
38867
+ buildReviewBody(markdown, withRejected, options2.ciFooter),
38868
+ { posted, failed: failed3.length }
38854
38869
  );
38855
38870
  if (!submitted && options2.ciFooter)
38856
38871
  throw new Error("the review could not be submitted to the PR");
38857
- return { posted: result.posted, submitted };
38872
+ return { posted, submitted };
38858
38873
  }
38859
38874
  console.log("Leaving the review unsubmitted.");
38860
- return { posted: result.posted, submitted: false };
38875
+ return { posted, submitted: false };
38861
38876
  }
38862
38877
 
38863
38878
  // src/commands/review/stillOnReviewedPr.ts
@@ -38887,7 +38902,15 @@ function submitNoFindingsReview(markdown, ciFooter) {
38887
38902
 
38888
38903
  No findings were raised.`
38889
38904
  );
38890
- submitBodyOnlyReview(appendCiFooter(body, ciFooter));
38905
+ return submitBodyOnlyReview(appendCiFooter(body, ciFooter));
38906
+ }
38907
+
38908
+ // src/commands/review/postNoFindingsReview.ts
38909
+ function postNoFindingsReview(markdown, ciFooter) {
38910
+ if (!ciFooter) return { posted: 0, submitted: false };
38911
+ if (!submitNoFindingsReview(markdown, ciFooter))
38912
+ throw new Error("the review could not be submitted to the PR");
38913
+ return { posted: 0, submitted: true };
38891
38914
  }
38892
38915
 
38893
38916
  // src/commands/review/describeWork.ts
@@ -38908,11 +38931,8 @@ async function postFindingsToPr(prInfo, synthesisPath, options2) {
38908
38931
  const markdown = readFileSync53(synthesisPath, "utf8");
38909
38932
  const { inDiff, unanchored } = selectPostableFindings(markdown, prInfo);
38910
38933
  const carried = carriedUnanchoredFindings(unanchored);
38911
- if (inDiff.length === 0 && carried.length === 0) {
38912
- if (!options2.ciFooter) return NOTHING_POSTED;
38913
- submitNoFindingsReview(markdown, options2.ciFooter);
38914
- return { posted: 0, submitted: true };
38915
- }
38934
+ if (inDiff.length === 0 && carried.length === 0)
38935
+ return postNoFindingsReview(markdown, options2.ciFooter);
38916
38936
  const work = describeWork(inDiff.length, carried.length);
38917
38937
  console.log(`Found PR #${prInfo.prNumber} with ${work} to post.`);
38918
38938
  const confirmed = await confirmPost(prInfo.prNumber, work, options2);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.868.0",
3
+ "version": "0.869.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {