vettcode-cli 1.0.0 ā 1.0.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/cli.js +83 -14
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -55,7 +55,7 @@ program
|
|
|
55
55
|
.description("AI-powered codebase security and quality scanner")
|
|
56
56
|
.version("1.0.0");
|
|
57
57
|
program
|
|
58
|
-
.argument("
|
|
58
|
+
.argument("[directory]", "Directory to scan")
|
|
59
59
|
.option("-o, --output <file>", "Output report to JSON file")
|
|
60
60
|
.option("-i, --ignore <patterns>", "Comma-separated ignore patterns")
|
|
61
61
|
.option("--json", "Output JSON format")
|
|
@@ -65,11 +65,16 @@ program
|
|
|
65
65
|
try {
|
|
66
66
|
// Load environment variables
|
|
67
67
|
dotenv.config();
|
|
68
|
-
|
|
68
|
+
// If no directory provided, show home screen
|
|
69
|
+
if (!directory) {
|
|
70
|
+
showHomeScreen();
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
console.log(chalk_1.default.bold.cyan("\n[+] VettCode CLI - Security Scanner\n"));
|
|
69
74
|
// Validate directory
|
|
70
75
|
const resolvedPath = path.resolve(directory);
|
|
71
76
|
if (!fs.existsSync(resolvedPath)) {
|
|
72
|
-
console.error(chalk_1.default.red(
|
|
77
|
+
console.error(chalk_1.default.red(`[X] Error: Directory not found: ${directory}`));
|
|
73
78
|
process.exit(1);
|
|
74
79
|
}
|
|
75
80
|
// Parse ignore patterns
|
|
@@ -81,7 +86,7 @@ program
|
|
|
81
86
|
const files = (0, file_collector_1.collectFiles)(resolvedPath, ignorePatterns);
|
|
82
87
|
collectSpinner.succeed(`Collected ${files.length} files`);
|
|
83
88
|
if (files.length === 0) {
|
|
84
|
-
console.warn(chalk_1.default.yellow("
|
|
89
|
+
console.warn(chalk_1.default.yellow("[!] No code files found to scan"));
|
|
85
90
|
process.exit(0);
|
|
86
91
|
}
|
|
87
92
|
const projectName = path.basename(resolvedPath);
|
|
@@ -103,7 +108,7 @@ program
|
|
|
103
108
|
if (options.output) {
|
|
104
109
|
const outputPath = path.resolve(options.output);
|
|
105
110
|
fs.writeFileSync(outputPath, JSON.stringify(report, null, 2));
|
|
106
|
-
console.log(chalk_1.default.green(`\n
|
|
111
|
+
console.log(chalk_1.default.green(`\n[*] Report saved to: ${outputPath}`));
|
|
107
112
|
}
|
|
108
113
|
// Exit with error code if critical issues found
|
|
109
114
|
const criticalCount = report.findings.filter(f => f.severity === "critical").length;
|
|
@@ -112,11 +117,75 @@ program
|
|
|
112
117
|
}
|
|
113
118
|
}
|
|
114
119
|
catch (error) {
|
|
115
|
-
console.error(chalk_1.default.red(`\n
|
|
120
|
+
console.error(chalk_1.default.red(`\n[X] Error: ${error instanceof Error ? error.message : String(error)}`));
|
|
116
121
|
process.exit(1);
|
|
117
122
|
}
|
|
118
123
|
});
|
|
119
124
|
program.parse();
|
|
125
|
+
function showHomeScreen() {
|
|
126
|
+
console.log("\n" + chalk_1.default.bold.cyan("ā".repeat(70)));
|
|
127
|
+
console.log(chalk_1.default.bold.cyan(" VettCode CLI - Enterprise-Grade Code Security Scanner"));
|
|
128
|
+
console.log(chalk_1.default.bold.cyan("ā".repeat(70)));
|
|
129
|
+
console.log(chalk_1.default.bold.white("\n Advanced static analysis powered by state-of-the-art AI models\n"));
|
|
130
|
+
// Hero section with impressive stats
|
|
131
|
+
const heroTable = new cli_table3_1.default({
|
|
132
|
+
head: [
|
|
133
|
+
chalk_1.default.bold("Capability"),
|
|
134
|
+
chalk_1.default.bold("Impact")
|
|
135
|
+
],
|
|
136
|
+
colWidths: [35, 33],
|
|
137
|
+
wordWrap: true,
|
|
138
|
+
});
|
|
139
|
+
heroTable.push([
|
|
140
|
+
chalk_1.default.cyan.bold("350+ Security Patterns"),
|
|
141
|
+
chalk_1.default.white("Comprehensive vulnerability detection")
|
|
142
|
+
]);
|
|
143
|
+
heroTable.push([
|
|
144
|
+
chalk_1.default.cyan.bold("AST-Based Analysis"),
|
|
145
|
+
chalk_1.default.white("Intelligent code extraction")
|
|
146
|
+
]);
|
|
147
|
+
heroTable.push([
|
|
148
|
+
chalk_1.default.cyan.bold("<3% False Positive Rate"),
|
|
149
|
+
chalk_1.default.white("Multi-layer verification system")
|
|
150
|
+
]);
|
|
151
|
+
heroTable.push([
|
|
152
|
+
chalk_1.default.cyan.bold("Data Flow Tracking"),
|
|
153
|
+
chalk_1.default.white("End-to-end input analysis")
|
|
154
|
+
]);
|
|
155
|
+
heroTable.push([
|
|
156
|
+
chalk_1.default.cyan.bold("Control Flow Analysis"),
|
|
157
|
+
chalk_1.default.white("Error handling validation")
|
|
158
|
+
]);
|
|
159
|
+
heroTable.push([
|
|
160
|
+
chalk_1.default.cyan.bold("Cross-File Reference Graph"),
|
|
161
|
+
chalk_1.default.white("Context-aware security checks")
|
|
162
|
+
]);
|
|
163
|
+
console.log(heroTable.toString());
|
|
164
|
+
console.log(chalk_1.default.bold.cyan("\n Quick Start:\n"));
|
|
165
|
+
console.log(chalk_1.default.white(" vettcode <directory> ") + chalk_1.default.gray("# Scan a directory"));
|
|
166
|
+
console.log(chalk_1.default.white(" vettcode <directory> --mode deep ") + chalk_1.default.gray("# Deep scan mode"));
|
|
167
|
+
console.log(chalk_1.default.white(" vettcode <directory> --no-ai ") + chalk_1.default.gray("# Static analysis only"));
|
|
168
|
+
console.log(chalk_1.default.white(" vettcode <directory> -o report.json") + chalk_1.default.gray("# Save report to file"));
|
|
169
|
+
console.log(chalk_1.default.bold.cyan("\n All Commands:\n"));
|
|
170
|
+
console.log(chalk_1.default.white(" vettcode <directory> ") + chalk_1.default.gray("# Scan a directory"));
|
|
171
|
+
console.log(chalk_1.default.white(" vettcode <directory> -o <file> ") + chalk_1.default.gray("# Output report to JSON file"));
|
|
172
|
+
console.log(chalk_1.default.white(" vettcode <directory> -i <patterns>") + chalk_1.default.gray("# Comma-separated ignore patterns"));
|
|
173
|
+
console.log(chalk_1.default.white(" vettcode <directory> --json ") + chalk_1.default.gray("# Output JSON format to stdout"));
|
|
174
|
+
console.log(chalk_1.default.white(" vettcode <directory> --mode <mode>") + chalk_1.default.gray("# Scan mode: quick or deep"));
|
|
175
|
+
console.log(chalk_1.default.white(" vettcode <directory> --no-ai ") + chalk_1.default.gray("# Disable AI analysis"));
|
|
176
|
+
console.log(chalk_1.default.white(" vettcode --help ") + chalk_1.default.gray("# Show help information"));
|
|
177
|
+
console.log(chalk_1.default.white(" vettcode --version ") + chalk_1.default.gray("# Show version number"));
|
|
178
|
+
console.log(chalk_1.default.bold.cyan("\n AI Enhancement (Optional):\n"));
|
|
179
|
+
console.log(chalk_1.default.gray(" Enable advanced AI analysis by configuring your API key in .env"));
|
|
180
|
+
console.log(chalk_1.default.gray(" Uses latest generation AI models for enhanced detection capabilities"));
|
|
181
|
+
console.log(chalk_1.default.gray(" Supports custom model configurations for specialized analysis"));
|
|
182
|
+
console.log(chalk_1.default.bold.cyan("\n Support & Resources:\n"));
|
|
183
|
+
console.log(chalk_1.default.white(" GitHub Repository: ") + chalk_1.default.cyan("https://github.com/mixifys33/vettcode-cli"));
|
|
184
|
+
console.log(chalk_1.default.white(" npm Package: ") + chalk_1.default.cyan("https://www.npmjs.com/package/vettcode-cli"));
|
|
185
|
+
console.log(chalk_1.default.white(" Report Issues: ") + chalk_1.default.cyan("https://github.com/mixifys33/vettcode-cli/issues"));
|
|
186
|
+
console.log(chalk_1.default.white(" Documentation: ") + chalk_1.default.cyan("https://github.com/mixifys33/vettcode-cli#readme"));
|
|
187
|
+
console.log(chalk_1.default.bold.cyan("\nā".repeat(70) + "\n"));
|
|
188
|
+
}
|
|
120
189
|
function displayReport(report, stats) {
|
|
121
190
|
// Score header
|
|
122
191
|
console.log("\n" + chalk_1.default.bold("ā".repeat(60)));
|
|
@@ -128,7 +197,7 @@ function displayReport(report, stats) {
|
|
|
128
197
|
// Summary
|
|
129
198
|
console.log(chalk_1.default.gray(`\n${report.summary}`));
|
|
130
199
|
// Executive verdict
|
|
131
|
-
console.log(chalk_1.default.bold.cyan(`\n
|
|
200
|
+
console.log(chalk_1.default.bold.cyan(`\n[*] Executive Verdict:`));
|
|
132
201
|
console.log(chalk_1.default.white(report.executiveVerdict));
|
|
133
202
|
// Findings by severity
|
|
134
203
|
const findingsBySeverity = {
|
|
@@ -138,7 +207,7 @@ function displayReport(report, stats) {
|
|
|
138
207
|
low: report.findings.filter(f => f.severity === "low"),
|
|
139
208
|
info: report.findings.filter(f => f.severity === "info"),
|
|
140
209
|
};
|
|
141
|
-
console.log(chalk_1.default.bold.cyan(`\n
|
|
210
|
+
console.log(chalk_1.default.bold.cyan(`\n[*] Findings by Severity:`));
|
|
142
211
|
console.log(` ${chalk_1.default.red.bold(findingsBySeverity.critical.length)} Critical`);
|
|
143
212
|
console.log(` ${chalk_1.default.red(findingsBySeverity.high.length)} High`);
|
|
144
213
|
console.log(` ${chalk_1.default.yellow(findingsBySeverity.medium.length)} Medium`);
|
|
@@ -146,21 +215,21 @@ function displayReport(report, stats) {
|
|
|
146
215
|
console.log(` ${chalk_1.default.gray(findingsBySeverity.info.length)} Info`);
|
|
147
216
|
// Critical blockers
|
|
148
217
|
if (report.criticalBlockers.length > 0) {
|
|
149
|
-
console.log(chalk_1.default.bold.red(`\n
|
|
218
|
+
console.log(chalk_1.default.bold.red(`\n[!] Critical Blockers:`));
|
|
150
219
|
report.criticalBlockers.forEach(blocker => {
|
|
151
|
-
console.log(chalk_1.default.red(`
|
|
220
|
+
console.log(chalk_1.default.red(` - ${blocker}`));
|
|
152
221
|
});
|
|
153
222
|
}
|
|
154
223
|
// Strengths
|
|
155
224
|
if (report.strengths.length > 0) {
|
|
156
|
-
console.log(chalk_1.default.bold.green(`\n
|
|
225
|
+
console.log(chalk_1.default.bold.green(`\n[+] Strengths:`));
|
|
157
226
|
report.strengths.forEach(strength => {
|
|
158
|
-
console.log(chalk_1.default.green(`
|
|
227
|
+
console.log(chalk_1.default.green(` - ${strength}`));
|
|
159
228
|
});
|
|
160
229
|
}
|
|
161
230
|
// Detailed findings table
|
|
162
231
|
if (report.findings.length > 0) {
|
|
163
|
-
console.log(chalk_1.default.bold.cyan(`\n
|
|
232
|
+
console.log(chalk_1.default.bold.cyan(`\n[*] Detailed Findings:`));
|
|
164
233
|
const table = new cli_table3_1.default({
|
|
165
234
|
head: [
|
|
166
235
|
chalk_1.default.bold("Severity"),
|
|
@@ -191,7 +260,7 @@ function displayReport(report, stats) {
|
|
|
191
260
|
}
|
|
192
261
|
}
|
|
193
262
|
// Metadata
|
|
194
|
-
console.log(chalk_1.default.bold.gray(`\n
|
|
263
|
+
console.log(chalk_1.default.bold.gray(`\n[*] Scan Metadata:`));
|
|
195
264
|
console.log(chalk_1.default.gray(` Project: ${report.metadata?.projectName}`));
|
|
196
265
|
console.log(chalk_1.default.gray(` Files Scanned: ${stats?.filesScanned || report.metadata?.filesScanned}`));
|
|
197
266
|
console.log(chalk_1.default.gray(` Lines Scanned: ${stats?.linesScanned || report.metadata?.linesScanned}`));
|