kafkacode 1.4.0 → 1.4.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/cli.js +9 -6
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -37,6 +37,13 @@ async function runScan(directory, options = {}) {
|
|
|
37
37
|
process.exit(1);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
// Validate the output format before doing any work
|
|
41
|
+
const format = (options.format || 'console').toLowerCase();
|
|
42
|
+
if (!['console', 'json', 'sarif'].includes(format)) {
|
|
43
|
+
console.error(`Error: unknown --format '${options.format}'. Use 'console', 'json', or 'sarif'.`);
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
|
|
40
47
|
if (verbose) {
|
|
41
48
|
console.log('🚀 Starting KafkaCode privacy scan...');
|
|
42
49
|
}
|
|
@@ -71,18 +78,14 @@ async function runScan(directory, options = {}) {
|
|
|
71
78
|
}
|
|
72
79
|
const findings = await analysisEngine.analyzeFiles(files);
|
|
73
80
|
|
|
74
|
-
// Render the findings in the requested format
|
|
75
|
-
const format = (options.format || 'console').toLowerCase();
|
|
81
|
+
// Render the findings in the requested format (validated above)
|
|
76
82
|
let output;
|
|
77
83
|
if (format === 'json') {
|
|
78
84
|
output = reportGenerator.generateJson(directory, findings, files.length);
|
|
79
85
|
} else if (format === 'sarif') {
|
|
80
86
|
output = reportGenerator.generateSarif(findings);
|
|
81
|
-
} else if (format === 'console') {
|
|
82
|
-
output = reportGenerator.generateReport(directory, findings, files.length);
|
|
83
87
|
} else {
|
|
84
|
-
|
|
85
|
-
process.exit(1);
|
|
88
|
+
output = reportGenerator.generateReport(directory, findings, files.length);
|
|
86
89
|
}
|
|
87
90
|
|
|
88
91
|
// Write to a file, or print to stdout
|
package/package.json
CHANGED