@quantracode/vibecheck 0.4.1 → 0.4.2
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.d.ts +1 -1
- package/dist/index.js +43 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -659,7 +659,7 @@ function validateArtifact(json) {
|
|
|
659
659
|
}
|
|
660
660
|
|
|
661
661
|
// src/constants.ts
|
|
662
|
-
var CLI_VERSION = "0.4.
|
|
662
|
+
var CLI_VERSION = "0.4.2";
|
|
663
663
|
|
|
664
664
|
// src/utils/file-utils.ts
|
|
665
665
|
import fs from "fs";
|
|
@@ -865,6 +865,7 @@ async function applyPatches(findings, baseDir, options = {}) {
|
|
|
865
865
|
applied: 0,
|
|
866
866
|
failed: 0,
|
|
867
867
|
skipped: 0,
|
|
868
|
+
noAutomatedPatch: 0,
|
|
868
869
|
results: []
|
|
869
870
|
};
|
|
870
871
|
}
|
|
@@ -890,8 +891,12 @@ Found ${patchableFindings.length} finding(s) with patches.
|
|
|
890
891
|
findingId: finding.id,
|
|
891
892
|
file: targetFile,
|
|
892
893
|
success: false,
|
|
893
|
-
error: "
|
|
894
|
-
patch
|
|
894
|
+
error: "No automated patch available for this finding",
|
|
895
|
+
patch,
|
|
896
|
+
ruleId: finding.ruleId,
|
|
897
|
+
title: finding.title,
|
|
898
|
+
recommendedFix: finding.remediation.recommendedFix,
|
|
899
|
+
noAutomatedPatch: true
|
|
895
900
|
});
|
|
896
901
|
continue;
|
|
897
902
|
}
|
|
@@ -965,13 +970,15 @@ Found ${patchableFindings.length} finding(s) with patches.
|
|
|
965
970
|
}
|
|
966
971
|
}
|
|
967
972
|
const applied = results.filter((r) => r.success).length;
|
|
968
|
-
const failed = results.filter((r) => !r.success && r.error !== "User declined").length;
|
|
973
|
+
const failed = results.filter((r) => !r.success && r.error !== "User declined" && !r.noAutomatedPatch).length;
|
|
969
974
|
const skipped = results.filter((r) => r.error === "User declined").length;
|
|
975
|
+
const noAutomatedPatch = results.filter((r) => r.noAutomatedPatch).length;
|
|
970
976
|
return {
|
|
971
977
|
totalPatchable: patchableFindings.length,
|
|
972
978
|
applied,
|
|
973
979
|
failed,
|
|
974
980
|
skipped,
|
|
981
|
+
noAutomatedPatch,
|
|
975
982
|
results
|
|
976
983
|
};
|
|
977
984
|
}
|
|
@@ -9251,14 +9258,45 @@ async function executeScan(targetDir, options) {
|
|
|
9251
9258
|
if (patchSummary.skipped > 0) {
|
|
9252
9259
|
console.log(`\x1B[90mSkipped: ${patchSummary.skipped}\x1B[0m`);
|
|
9253
9260
|
}
|
|
9261
|
+
if (patchSummary.noAutomatedPatch > 0) {
|
|
9262
|
+
console.log(`\x1B[33mNo automated patch: ${patchSummary.noAutomatedPatch}\x1B[0m`);
|
|
9263
|
+
}
|
|
9254
9264
|
if (patchSummary.failed > 0) {
|
|
9255
9265
|
console.log("\nFailed patches:");
|
|
9256
9266
|
for (const result of patchSummary.results) {
|
|
9257
|
-
if (!result.success && result.error !== "User declined") {
|
|
9267
|
+
if (!result.success && result.error !== "User declined" && !result.noAutomatedPatch) {
|
|
9258
9268
|
console.log(` \x1B[31m\u2717\x1B[0m ${result.file}: ${result.error}`);
|
|
9259
9269
|
}
|
|
9260
9270
|
}
|
|
9261
9271
|
}
|
|
9272
|
+
if (patchSummary.noAutomatedPatch > 0) {
|
|
9273
|
+
console.log("\nFindings without automated patches:");
|
|
9274
|
+
console.log(`\x1B[90mThese findings require manual review and fixing.\x1B[0m
|
|
9275
|
+
`);
|
|
9276
|
+
for (const result of patchSummary.results) {
|
|
9277
|
+
if (result.noAutomatedPatch) {
|
|
9278
|
+
console.log(` \x1B[33m\u25CF\x1B[0m \x1B[36m[${result.ruleId}]\x1B[0m ${result.title}`);
|
|
9279
|
+
console.log(` File: ${result.file}`);
|
|
9280
|
+
if (result.recommendedFix) {
|
|
9281
|
+
const maxWidth = 70;
|
|
9282
|
+
const words = result.recommendedFix.split(" ");
|
|
9283
|
+
let line = " ";
|
|
9284
|
+
for (const word of words) {
|
|
9285
|
+
if (line.length + word.length + 1 > maxWidth) {
|
|
9286
|
+
console.log(`\x1B[90m${line}\x1B[0m`);
|
|
9287
|
+
line = " " + word;
|
|
9288
|
+
} else {
|
|
9289
|
+
line += (line.length > 4 ? " " : "") + word;
|
|
9290
|
+
}
|
|
9291
|
+
}
|
|
9292
|
+
if (line.length > 4) {
|
|
9293
|
+
console.log(`\x1B[90m${line}\x1B[0m`);
|
|
9294
|
+
}
|
|
9295
|
+
}
|
|
9296
|
+
console.log("");
|
|
9297
|
+
}
|
|
9298
|
+
}
|
|
9299
|
+
}
|
|
9262
9300
|
console.log("");
|
|
9263
9301
|
}
|
|
9264
9302
|
if (shouldFail(findings, failOn)) {
|