@staff0rd/assist 0.827.2 → 0.828.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.
|
|
9
|
+
version: "0.828.1",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -36636,10 +36636,22 @@ function submitPendingReview(body) {
|
|
|
36636
36636
|
runReviewSubmission(MUTATION7, body);
|
|
36637
36637
|
}
|
|
36638
36638
|
|
|
36639
|
-
// src/commands/review/
|
|
36640
|
-
function
|
|
36641
|
-
return
|
|
36639
|
+
// src/commands/review/appendCiFooter.ts
|
|
36640
|
+
function appendCiFooter(body, ciFooter) {
|
|
36641
|
+
return ciFooter ? `${body}
|
|
36642
|
+
|
|
36643
|
+
${ciFooter}` : body;
|
|
36644
|
+
}
|
|
36645
|
+
|
|
36646
|
+
// src/commands/review/buildReviewBody.ts
|
|
36647
|
+
function buildReviewBody(markdown, unanchored, ciFooter) {
|
|
36648
|
+
return appendCiFooter(
|
|
36649
|
+
sanitiseReviewerNames(buildReviewSummary(markdown, unanchored)),
|
|
36650
|
+
ciFooter
|
|
36651
|
+
);
|
|
36642
36652
|
}
|
|
36653
|
+
|
|
36654
|
+
// src/commands/review/postAndMaybeSubmit.ts
|
|
36643
36655
|
function submitReview(body, posted) {
|
|
36644
36656
|
if (posted > 0) submitPendingReview(body);
|
|
36645
36657
|
else submitBodyOnlyReview(body);
|
|
@@ -36658,11 +36670,14 @@ async function postAndMaybeSubmit(lineBound, unanchored, markdown, options2) {
|
|
|
36658
36670
|
const failedSuffix = result.failed > 0 ? `, ${result.failed} failed` : "";
|
|
36659
36671
|
console.log(`Posted ${result.posted} comment(s)${failedSuffix}.`);
|
|
36660
36672
|
const carried = carriedUnanchoredFindings(unanchored);
|
|
36661
|
-
if (result.posted === 0 && carried.length === 0)
|
|
36673
|
+
if (result.posted === 0 && carried.length === 0 && !options2.ciFooter)
|
|
36662
36674
|
return { posted: 0, submitted: false };
|
|
36663
36675
|
const shouldSubmit = await decideSubmit(options2);
|
|
36664
36676
|
if (shouldSubmit) {
|
|
36665
|
-
submitReview(
|
|
36677
|
+
submitReview(
|
|
36678
|
+
buildReviewBody(markdown, unanchored, options2.ciFooter),
|
|
36679
|
+
result.posted
|
|
36680
|
+
);
|
|
36666
36681
|
return { posted: result.posted, submitted: true };
|
|
36667
36682
|
}
|
|
36668
36683
|
console.log("Leaving the review unsubmitted.");
|
|
@@ -36689,14 +36704,26 @@ function stillOnReviewedPr(prNumber) {
|
|
|
36689
36704
|
return false;
|
|
36690
36705
|
}
|
|
36691
36706
|
|
|
36692
|
-
// src/commands/review/
|
|
36693
|
-
|
|
36707
|
+
// src/commands/review/submitNoFindingsReview.ts
|
|
36708
|
+
function submitNoFindingsReview(markdown, ciFooter) {
|
|
36709
|
+
const body = sanitiseReviewerNames(
|
|
36710
|
+
`${buildReviewSummary(markdown)}
|
|
36711
|
+
|
|
36712
|
+
No findings were raised.`
|
|
36713
|
+
);
|
|
36714
|
+
submitBodyOnlyReview(appendCiFooter(body, ciFooter));
|
|
36715
|
+
}
|
|
36716
|
+
|
|
36717
|
+
// src/commands/review/describeWork.ts
|
|
36694
36718
|
function describeWork(comments3, carried) {
|
|
36695
36719
|
const parts = [];
|
|
36696
36720
|
if (comments3 > 0) parts.push(`${comments3} line comment(s)`);
|
|
36697
36721
|
if (carried > 0) parts.push(`${carried} finding(s) in the review body`);
|
|
36698
36722
|
return parts.join(" and ");
|
|
36699
36723
|
}
|
|
36724
|
+
|
|
36725
|
+
// src/commands/review/postReviewToPr.ts
|
|
36726
|
+
var NOTHING_POSTED = { posted: 0, submitted: false };
|
|
36700
36727
|
async function confirmPost(prNumber, work, options2) {
|
|
36701
36728
|
if (!options2.prompt) return true;
|
|
36702
36729
|
return promptConfirm(`Post ${work} to PR #${prNumber}?`, false);
|
|
@@ -36705,7 +36732,11 @@ async function postFindingsToPr(prInfo, synthesisPath, options2) {
|
|
|
36705
36732
|
const markdown = readFileSync52(synthesisPath, "utf8");
|
|
36706
36733
|
const { inDiff, unanchored } = selectPostableFindings(markdown, prInfo);
|
|
36707
36734
|
const carried = carriedUnanchoredFindings(unanchored);
|
|
36708
|
-
if (inDiff.length === 0 && carried.length === 0)
|
|
36735
|
+
if (inDiff.length === 0 && carried.length === 0) {
|
|
36736
|
+
if (!options2.ciFooter) return NOTHING_POSTED;
|
|
36737
|
+
submitNoFindingsReview(markdown, options2.ciFooter);
|
|
36738
|
+
return { posted: 0, submitted: true };
|
|
36739
|
+
}
|
|
36709
36740
|
const work = describeWork(inDiff.length, carried.length);
|
|
36710
36741
|
console.log(`Found PR #${prInfo.prNumber} with ${work} to post.`);
|
|
36711
36742
|
const confirmed = await confirmPost(prInfo.prNumber, work, options2);
|
|
@@ -36829,7 +36860,8 @@ async function handlePostSynthesis(synthesisPath, prInfo, options2) {
|
|
|
36829
36860
|
prompt: options2.prompt,
|
|
36830
36861
|
submit: options2.submit,
|
|
36831
36862
|
addressComments: options2.addressComments,
|
|
36832
|
-
announce: options2.announce
|
|
36863
|
+
announce: options2.announce,
|
|
36864
|
+
ciFooter: options2.ciFooter
|
|
36833
36865
|
});
|
|
36834
36866
|
return;
|
|
36835
36867
|
}
|
|
@@ -38214,7 +38246,8 @@ function runPostSynthesis(synthesisPath, prInfo, options2) {
|
|
|
38214
38246
|
prompt: options2.prompt ?? true,
|
|
38215
38247
|
submit: options2.submit ?? false,
|
|
38216
38248
|
addressComments: options2.addressComments ?? false,
|
|
38217
|
-
announce: options2.announce ?? false
|
|
38249
|
+
announce: options2.announce ?? false,
|
|
38250
|
+
ciFooter: options2.ci?.footer
|
|
38218
38251
|
});
|
|
38219
38252
|
}
|
|
38220
38253
|
async function reviewPr(repoRoot2, options2) {
|