mobbdev 1.0.81 → 1.0.83
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.mjs +52 -15
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -891,11 +891,12 @@ var GitReferenceDocument = `
|
|
|
891
891
|
}
|
|
892
892
|
`;
|
|
893
893
|
var AutoPrAnalysisDocument = `
|
|
894
|
-
mutation autoPrAnalysis($analysisId: String!, $commitDirectly: Boolean, $prId: Int) {
|
|
894
|
+
mutation autoPrAnalysis($analysisId: String!, $commitDirectly: Boolean, $prId: Int, $prStrategy: PRStrategy) {
|
|
895
895
|
autoPrAnalysis(
|
|
896
896
|
analysisId: $analysisId
|
|
897
897
|
sameBranchCommit: $commitDirectly
|
|
898
898
|
prId: $prId
|
|
899
|
+
prStrategy: $prStrategy
|
|
899
900
|
) {
|
|
900
901
|
__typename
|
|
901
902
|
... on AutoPrSuccess {
|
|
@@ -7318,16 +7319,17 @@ async function convertFprToSarif(inputFilePath, outputFilePath, codePathPatterns
|
|
|
7318
7319
|
"results": [
|
|
7319
7320
|
`
|
|
7320
7321
|
);
|
|
7321
|
-
vulnerabilityParser.getVulnerabilities().map(
|
|
7322
|
+
const filteredVulns = vulnerabilityParser.getVulnerabilities().map(
|
|
7322
7323
|
(vulnerability) => fortifyVulnerabilityToSarifResult(
|
|
7323
7324
|
vulnerability,
|
|
7324
7325
|
auditMetadataParser,
|
|
7325
7326
|
reportMetadataParser,
|
|
7326
7327
|
unifiedNodePoolParser
|
|
7327
7328
|
)
|
|
7328
|
-
).filter((sarifResult) => filterSarifResult(sarifResult, codePathPatterns))
|
|
7329
|
+
).filter((sarifResult) => filterSarifResult(sarifResult, codePathPatterns));
|
|
7330
|
+
filteredVulns.forEach((sarifResult, index) => {
|
|
7329
7331
|
fs3.appendFileSync(outputFilePath, JSON.stringify(sarifResult, null, 2));
|
|
7330
|
-
if (index !==
|
|
7332
|
+
if (index !== filteredVulns.length - 1) {
|
|
7331
7333
|
fs3.appendFileSync(outputFilePath, ",\n");
|
|
7332
7334
|
}
|
|
7333
7335
|
});
|
|
@@ -7562,6 +7564,13 @@ var autoPrOption = {
|
|
|
7562
7564
|
type: "boolean",
|
|
7563
7565
|
default: false
|
|
7564
7566
|
};
|
|
7567
|
+
var createOnePrOption = {
|
|
7568
|
+
describe: chalk2.bold(
|
|
7569
|
+
"Create a single unified PR for all fixes (requires --auto-pr)"
|
|
7570
|
+
),
|
|
7571
|
+
type: "boolean",
|
|
7572
|
+
default: false
|
|
7573
|
+
};
|
|
7565
7574
|
var commitDirectlyOption = {
|
|
7566
7575
|
describe: chalk2.bold(
|
|
7567
7576
|
"Commit directly to the scanned branch instead of creating a pull request"
|
|
@@ -8242,7 +8251,14 @@ ${contextString}` : description;
|
|
|
8242
8251
|
import Debug9 from "debug";
|
|
8243
8252
|
var debug9 = Debug9("mobbdev:handleAutoPr");
|
|
8244
8253
|
async function handleAutoPr(params) {
|
|
8245
|
-
const {
|
|
8254
|
+
const {
|
|
8255
|
+
gqlClient,
|
|
8256
|
+
analysisId,
|
|
8257
|
+
commitDirectly,
|
|
8258
|
+
prId,
|
|
8259
|
+
createSpinner: createSpinner5,
|
|
8260
|
+
createOnePr
|
|
8261
|
+
} = params;
|
|
8246
8262
|
const createAutoPrSpinner = createSpinner5(
|
|
8247
8263
|
"\u{1F504} Waiting for the analysis to finish before initiating automatic pull request creation"
|
|
8248
8264
|
).start();
|
|
@@ -8251,11 +8267,12 @@ async function handleAutoPr(params) {
|
|
|
8251
8267
|
analysisId
|
|
8252
8268
|
},
|
|
8253
8269
|
callback: async (analysisId2) => {
|
|
8254
|
-
const autoPrAnalysisRes = await gqlClient.autoPrAnalysis(
|
|
8255
|
-
analysisId2,
|
|
8270
|
+
const autoPrAnalysisRes = await gqlClient.autoPrAnalysis({
|
|
8271
|
+
analysisId: analysisId2,
|
|
8256
8272
|
commitDirectly,
|
|
8257
|
-
prId
|
|
8258
|
-
|
|
8273
|
+
prId,
|
|
8274
|
+
prStrategy: createOnePr ? "CONDENSE" /* Condense */ : "SPREAD" /* Spread */
|
|
8275
|
+
});
|
|
8259
8276
|
debug9("auto pr analysis res %o", autoPrAnalysisRes);
|
|
8260
8277
|
if (autoPrAnalysisRes.autoPrAnalysis?.__typename === "AutoPrError") {
|
|
8261
8278
|
createAutoPrSpinner.error({
|
|
@@ -8804,11 +8821,17 @@ var GQLClient = class {
|
|
|
8804
8821
|
}
|
|
8805
8822
|
return res.analysis;
|
|
8806
8823
|
}
|
|
8807
|
-
async autoPrAnalysis(
|
|
8824
|
+
async autoPrAnalysis({
|
|
8825
|
+
analysisId,
|
|
8826
|
+
commitDirectly,
|
|
8827
|
+
prId,
|
|
8828
|
+
prStrategy
|
|
8829
|
+
}) {
|
|
8808
8830
|
return this._clientSdk.autoPrAnalysis({
|
|
8809
8831
|
analysisId,
|
|
8810
8832
|
commitDirectly,
|
|
8811
|
-
prId
|
|
8833
|
+
prId,
|
|
8834
|
+
prStrategy
|
|
8812
8835
|
});
|
|
8813
8836
|
}
|
|
8814
8837
|
async getFixes(fixIds) {
|
|
@@ -9486,6 +9509,7 @@ async function _scan(params, { skipPrompts = false } = {}) {
|
|
|
9486
9509
|
command,
|
|
9487
9510
|
organizationId: userOrganizationId,
|
|
9488
9511
|
autoPr,
|
|
9512
|
+
createOnePr,
|
|
9489
9513
|
commitDirectly,
|
|
9490
9514
|
pullRequest
|
|
9491
9515
|
} = params;
|
|
@@ -9629,7 +9653,8 @@ async function _scan(params, { skipPrompts = false } = {}) {
|
|
|
9629
9653
|
analysisId: reportUploadInfo.fixReportId,
|
|
9630
9654
|
commitDirectly,
|
|
9631
9655
|
prId: pullRequest,
|
|
9632
|
-
createSpinner: createSpinner5
|
|
9656
|
+
createSpinner: createSpinner5,
|
|
9657
|
+
createOnePr
|
|
9633
9658
|
});
|
|
9634
9659
|
}
|
|
9635
9660
|
await askToOpenAnalysis();
|
|
@@ -9792,7 +9817,8 @@ async function _scan(params, { skipPrompts = false } = {}) {
|
|
|
9792
9817
|
analysisId: reportUploadInfo.fixReportId,
|
|
9793
9818
|
commitDirectly,
|
|
9794
9819
|
prId: pullRequest,
|
|
9795
|
-
createSpinner: createSpinner5
|
|
9820
|
+
createSpinner: createSpinner5,
|
|
9821
|
+
createOnePr
|
|
9796
9822
|
});
|
|
9797
9823
|
}
|
|
9798
9824
|
await askToOpenAnalysis();
|
|
@@ -10192,7 +10218,7 @@ function analyzeBuilder(yargs2) {
|
|
|
10192
10218
|
alias: "commit-hash",
|
|
10193
10219
|
describe: chalk8.bold("Hash of the commit"),
|
|
10194
10220
|
type: "string"
|
|
10195
|
-
}).option("mobb-project-name", mobbProjectNameOption).option("y", yesOption).option("ci", ciOption).option("org", organizationIdOptions).option("api-key", apiKeyOption).option("commit-hash", commitHashOption).option("auto-pr", autoPrOption).option("commit-directly", commitDirectlyOption).option("pull-request", {
|
|
10221
|
+
}).option("mobb-project-name", mobbProjectNameOption).option("y", yesOption).option("ci", ciOption).option("org", organizationIdOptions).option("api-key", apiKeyOption).option("commit-hash", commitHashOption).option("auto-pr", autoPrOption).option("create-one-pr", createOnePrOption).option("commit-directly", commitDirectlyOption).option("pull-request", {
|
|
10196
10222
|
alias: ["pr", "pr-number", "pr-id"],
|
|
10197
10223
|
describe: chalk8.bold("Number of the pull request"),
|
|
10198
10224
|
type: "number",
|
|
@@ -10203,6 +10229,7 @@ function analyzeBuilder(yargs2) {
|
|
|
10203
10229
|
).help();
|
|
10204
10230
|
}
|
|
10205
10231
|
function validateAnalyzeOptions(argv) {
|
|
10232
|
+
console.log("argv", argv);
|
|
10206
10233
|
if (!fs7.existsSync(argv.f)) {
|
|
10207
10234
|
throw new CliError(`
|
|
10208
10235
|
Can't access ${chalk8.bold(argv.f)}`);
|
|
@@ -10222,7 +10249,17 @@ Can't access ${chalk8.bold(argv.f)}`);
|
|
|
10222
10249
|
"--commit-directly flag requires --auto-pr to be provided as well"
|
|
10223
10250
|
);
|
|
10224
10251
|
}
|
|
10225
|
-
if (argv
|
|
10252
|
+
if (argv["create-one-pr"] && !argv["auto-pr"]) {
|
|
10253
|
+
throw new CliError(
|
|
10254
|
+
"--create-one-pr flag requires --auto-pr to be provided as well"
|
|
10255
|
+
);
|
|
10256
|
+
}
|
|
10257
|
+
if (argv["create-one-pr"] && argv.commitDirectly) {
|
|
10258
|
+
throw new CliError(
|
|
10259
|
+
"--create-one-pr and --commit-directly cannot be provided at the same time"
|
|
10260
|
+
);
|
|
10261
|
+
}
|
|
10262
|
+
if (argv.pullRequest && !argv.commitDirectly) {
|
|
10226
10263
|
throw new CliError(
|
|
10227
10264
|
"--pull-request flag requires --commit-directly to be provided as well"
|
|
10228
10265
|
);
|