deepscan-cli 1.0.0

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.
Files changed (47) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +419 -0
  3. package/dist/bin/deepscan.d.ts +1 -0
  4. package/dist/bin/deepscan.js +393 -0
  5. package/dist/bin/deepscan.js.map +1 -0
  6. package/dist/chunk-OSYJXVNF.js +7268 -0
  7. package/dist/chunk-OSYJXVNF.js.map +1 -0
  8. package/dist/index.d.ts +470 -0
  9. package/dist/index.js +21 -0
  10. package/dist/index.js.map +1 -0
  11. package/package.json +68 -0
  12. package/rules/built-in/converted-semgrep.yml +37 -0
  13. package/rules/built-in/default-config.yml +59 -0
  14. package/rules/built-in/quality.yml +117 -0
  15. package/rules/built-in/security.yml +383 -0
  16. package/rules/built-in/semgrep-apex.yml +336 -0
  17. package/rules/built-in/semgrep-bash.yml +362 -0
  18. package/rules/built-in/semgrep-c.yml +429 -0
  19. package/rules/built-in/semgrep-clojure.yml +166 -0
  20. package/rules/built-in/semgrep-csharp.yml +1260 -0
  21. package/rules/built-in/semgrep-dart.yml +21 -0
  22. package/rules/built-in/semgrep-dockerfile.yml +874 -0
  23. package/rules/built-in/semgrep-elixir.yml +146 -0
  24. package/rules/built-in/semgrep-generic.yml +2945 -0
  25. package/rules/built-in/semgrep-go.yml +2898 -0
  26. package/rules/built-in/semgrep-hcl.yml +8181 -0
  27. package/rules/built-in/semgrep-html.yml +94 -0
  28. package/rules/built-in/semgrep-java.yml +4219 -0
  29. package/rules/built-in/semgrep-javascript.yml +6243 -0
  30. package/rules/built-in/semgrep-json.yml +360 -0
  31. package/rules/built-in/semgrep-kotlin.yml +540 -0
  32. package/rules/built-in/semgrep-lua.yml +46 -0
  33. package/rules/built-in/semgrep-ocaml.yml +773 -0
  34. package/rules/built-in/semgrep-php.yml +1638 -0
  35. package/rules/built-in/semgrep-python.yml +11240 -0
  36. package/rules/built-in/semgrep-regex.yml +6444 -0
  37. package/rules/built-in/semgrep-ruby.yml +2687 -0
  38. package/rules/built-in/semgrep-rust.yml +278 -0
  39. package/rules/built-in/semgrep-scala.yml +807 -0
  40. package/rules/built-in/semgrep-sh.yml +46 -0
  41. package/rules/built-in/semgrep-solidity.yml +1046 -0
  42. package/rules/built-in/semgrep-swift.yml +200 -0
  43. package/rules/built-in/semgrep-terraform.yml +147 -0
  44. package/rules/built-in/semgrep-typescript.yml +6212 -0
  45. package/rules/built-in/semgrep-xml.yml +31 -0
  46. package/rules/built-in/semgrep-yaml.yml +2785 -0
  47. package/rules/examples/custom-api-security.yml +66 -0
@@ -0,0 +1,393 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ CVEScanner,
4
+ DEFAULT_CONFIG,
5
+ QualityScanner,
6
+ RuleEngine,
7
+ ScanPipeline,
8
+ SecurityScanner,
9
+ getReporter,
10
+ loadConfig
11
+ } from "../chunk-OSYJXVNF.js";
12
+
13
+ // src/cli/index.ts
14
+ import { Command as Command5 } from "commander";
15
+
16
+ // src/cli/commands/scan.ts
17
+ import { Command } from "commander";
18
+ import { resolve } from "path";
19
+ import { consola } from "consola";
20
+ function createScanCommand() {
21
+ const scan = new Command("scan");
22
+ scan.description("Scan source code for security vulnerabilities and quality issues").argument("[path]", "Path to scan (default: current directory)", ".").option("-s, --scanners <scanners>", "Scanner engines to use (comma-separated: security,quality,cve) [default: security]").option("--security", "Run security scanner only").option("--quality", "Run quality scanner only").option("--cve", "Run CVE/dependency scanner only").option("-f, --format <format>", "Output format: json, csv, html, sarif, console", "console").option("-o, --output <file>", "Output file path").option("--severity <levels>", "Filter by severity (comma-separated: critical,error,warning,info)").option("--include <patterns>", "Include file patterns (comma-separated)").option("--exclude <patterns>", "Exclude file patterns (comma-separated)").option("--deep", "Enable deep analysis (taint tracking, semantic analysis)").option("--ai", "Enable AI-assisted validation (requires API key)").option("--ai-provider <provider>", "AI provider: openai, anthropic, ollama, google").option("--rules <path>", "Path to custom rules directory").option("--parallel <n>", "Number of parallel workers", "4").option("--incremental", "Only scan changed files (git-based)").option("--preset <name>", "Use a preset configuration (node-api, python-web, java-spring, minimal)").option("--config <path>", "Path to configuration file").action(async (targetPath, options) => {
23
+ try {
24
+ const absolutePath = resolve(targetPath);
25
+ const cliOverrides = {};
26
+ const hasExplicitFlag = options.security || options.quality || options.cve;
27
+ if (hasExplicitFlag) {
28
+ cliOverrides.scanners = {
29
+ security: { enabled: !!options.security },
30
+ quality: { enabled: !!options.quality },
31
+ cve: { enabled: !!options.cve }
32
+ };
33
+ } else if (options.scanners) {
34
+ const scannerList = options.scanners.split(",");
35
+ cliOverrides.scanners = {
36
+ security: { enabled: scannerList.includes("security") },
37
+ quality: { enabled: scannerList.includes("quality") },
38
+ cve: { enabled: scannerList.includes("cve") }
39
+ };
40
+ }
41
+ if (options.format) {
42
+ cliOverrides.output = { format: options.format };
43
+ }
44
+ if (options.severity) {
45
+ const severities = options.severity.split(",");
46
+ if (!cliOverrides.scanners) cliOverrides.scanners = {};
47
+ cliOverrides.scanners.security = { severity: severities };
48
+ }
49
+ if (options.include) {
50
+ cliOverrides.paths = {
51
+ ...cliOverrides.paths || {},
52
+ include: options.include.split(",")
53
+ };
54
+ }
55
+ if (options.exclude) {
56
+ cliOverrides.paths = {
57
+ ...cliOverrides.paths || {},
58
+ exclude: options.exclude.split(",")
59
+ };
60
+ }
61
+ if (options.deep) cliOverrides.deep = true;
62
+ if (options.incremental) cliOverrides.incremental = true;
63
+ if (options.parallel) cliOverrides.parallel = parseInt(options.parallel, 10);
64
+ if (options.ai) {
65
+ cliOverrides.ai = {
66
+ enabled: true,
67
+ provider: options.aiProvider || "openai"
68
+ };
69
+ }
70
+ if (options.rules) {
71
+ cliOverrides.rules = { custom: [options.rules] };
72
+ }
73
+ const config = await loadConfig({
74
+ configPath: options.config,
75
+ targetPath: absolutePath,
76
+ cliOverrides,
77
+ preset: options.preset
78
+ });
79
+ if (options.format) {
80
+ config.output.format = options.format;
81
+ }
82
+ const pipeline = new ScanPipeline(config);
83
+ if (config.scanners.security.enabled) {
84
+ pipeline.addScanner(new SecurityScanner());
85
+ }
86
+ if (config.scanners.quality.enabled) {
87
+ pipeline.addScanner(new QualityScanner());
88
+ }
89
+ if (config.scanners.cve.enabled) {
90
+ pipeline.addScanner(new CVEScanner());
91
+ }
92
+ const result = await pipeline.run({
93
+ config,
94
+ targetPath: absolutePath,
95
+ onProgress: (current, total, file) => {
96
+ if (!options.quiet) {
97
+ const pct = Math.round(current / total * 100);
98
+ const fileDisplay = file.length > 50 ? "..." + file.slice(-47) : file;
99
+ process.stderr.write(`\r Scanning... ${pct}% (${current}/${total}) ${fileDisplay.padEnd(50)}`);
100
+ }
101
+ }
102
+ });
103
+ if (!options.quiet) {
104
+ process.stderr.write("\r" + " ".repeat(120) + "\r");
105
+ }
106
+ const reporter = getReporter(config.output.format);
107
+ const output = await reporter.generate(result);
108
+ if (options.output) {
109
+ await reporter.writeToFile(result, options.output);
110
+ consola.success(`Report written to: ${options.output}`);
111
+ } else if (config.output.format === "html") {
112
+ const defaultPath = "report.html";
113
+ await reporter.writeToFile(result, defaultPath);
114
+ consola.success(`Report written to: ${defaultPath}`);
115
+ } else if (config.output.format !== "console") {
116
+ process.stdout.write(output);
117
+ } else {
118
+ process.stdout.write(output);
119
+ }
120
+ const hasErrors = result.summary.bySeverity.critical > 0 || result.summary.bySeverity.high > 0;
121
+ if (hasErrors) {
122
+ process.exitCode = 1;
123
+ }
124
+ } catch (error) {
125
+ consola.error("Scan failed:", error);
126
+ process.exitCode = 2;
127
+ }
128
+ });
129
+ return scan;
130
+ }
131
+
132
+ // src/cli/commands/init.ts
133
+ import { Command as Command2 } from "commander";
134
+ import { writeFileSync } from "fs";
135
+ import { resolve as resolve2 } from "path";
136
+ import yaml from "js-yaml";
137
+ import { consola as consola2 } from "consola";
138
+ function createInitCommand() {
139
+ const init = new Command2("init");
140
+ init.description("Initialize a .deepscan.yml configuration file in the current directory").option("--preset <name>", "Use a preset: node-api, python-web, java-spring, minimal").option("--format <format>", "Config file format: yml, json", "yml").action(async (options) => {
141
+ try {
142
+ const config = {
143
+ version: "1.0",
144
+ scanners: {
145
+ security: {
146
+ enabled: true,
147
+ severity: ["critical", "high", "medium", "low"]
148
+ },
149
+ quality: {
150
+ enabled: true,
151
+ thresholds: {
152
+ maxComplexity: 15,
153
+ maxFileLength: 500,
154
+ maxFunctionLength: 50
155
+ }
156
+ },
157
+ cve: {
158
+ enabled: true,
159
+ sources: ["osv"]
160
+ }
161
+ },
162
+ rules: {
163
+ include: ["*"],
164
+ exclude: [],
165
+ custom: []
166
+ },
167
+ paths: {
168
+ include: ["**/*"],
169
+ exclude: [
170
+ "node_modules/",
171
+ "vendor/",
172
+ "dist/",
173
+ "build/",
174
+ ".git/",
175
+ "storage/",
176
+ "bootstrap/cache/",
177
+ "public/build/",
178
+ "assets/",
179
+ "**/node_modules/**",
180
+ "**/vendor/**",
181
+ "**/dist/**",
182
+ "**/build/**",
183
+ "**/.git/**",
184
+ "**/storage/**",
185
+ "**/bootstrap/cache/**",
186
+ "**/public/build/**",
187
+ "**/assets/**"
188
+ ]
189
+ },
190
+ output: {
191
+ format: "console"
192
+ },
193
+ ai: {
194
+ enabled: false
195
+ }
196
+ };
197
+ const format = options.format || "yml";
198
+ const fileName = format === "json" ? ".deepscan.json" : ".deepscan.yml";
199
+ const filePath = resolve2(process.cwd(), fileName);
200
+ let content;
201
+ if (format === "json") {
202
+ content = JSON.stringify(config, null, 2);
203
+ } else {
204
+ content = "# DeepScan Configuration\n# https://github.com/deepscan/deepscan-cli\n\n" + yaml.dump(config, { indent: 2, lineWidth: 100, quotingType: '"' });
205
+ }
206
+ writeFileSync(filePath, content, "utf-8");
207
+ consola2.success(`Created ${fileName}`);
208
+ consola2.info("Customize the configuration and run: deepscan scan");
209
+ } catch (error) {
210
+ consola2.error("Init failed:", error);
211
+ process.exitCode = 1;
212
+ }
213
+ });
214
+ return init;
215
+ }
216
+
217
+ // src/cli/commands/rules.ts
218
+ import { Command as Command3 } from "commander";
219
+ import { consola as consola3 } from "consola";
220
+ import chalk from "chalk";
221
+
222
+ // src/types/rule.ts
223
+ var RULE_CATEGORIES = [
224
+ // Security categories
225
+ { id: "injection", name: "Injection", description: "SQL, Command, LDAP, XPath injection vulnerabilities", scanner: "security" },
226
+ { id: "xss", name: "Cross-Site Scripting", description: "XSS vulnerabilities including DOM-based and reflected", scanner: "security" },
227
+ { id: "secrets", name: "Secrets & Credentials", description: "Hardcoded passwords, API keys, tokens", scanner: "security" },
228
+ { id: "auth", name: "Authentication & Authorization", description: "Weak auth patterns, missing authorization", scanner: "security" },
229
+ { id: "crypto", name: "Cryptography", description: "Weak algorithms, insecure random, hardcoded keys", scanner: "security" },
230
+ { id: "file-ops", name: "File Operations", description: "Path traversal, unsafe uploads, directory listing", scanner: "security" },
231
+ // Quality categories
232
+ { id: "complexity", name: "Complexity", description: "Cyclomatic and cognitive complexity issues", scanner: "quality" },
233
+ { id: "duplication", name: "Code Duplication", description: "Duplicated code blocks", scanner: "quality" },
234
+ { id: "code-smells", name: "Code Smells", description: "Long methods, large files, dead code", scanner: "quality" },
235
+ { id: "naming", name: "Naming Conventions", description: "Inconsistent or unclear naming", scanner: "quality" },
236
+ { id: "metrics", name: "Code Metrics", description: "Lines of code, comment ratio, maintainability", scanner: "quality" }
237
+ ];
238
+
239
+ // src/cli/commands/rules.ts
240
+ function createRulesCommand() {
241
+ const rules = new Command3("rules");
242
+ rules.description("Manage and inspect scanning rules");
243
+ rules.command("list").description("List all available rules").option("-c, --category <category>", "Filter by category").option("-s, --severity <severity>", "Filter by severity").option("-l, --language <language>", "Filter by language").option("--scanner <type>", "Filter by scanner type (security, quality)").action(async (options) => {
244
+ try {
245
+ const ruleEngine = new RuleEngine(DEFAULT_CONFIG);
246
+ await ruleEngine.initialize();
247
+ let allRules = ruleEngine.getAllRules();
248
+ if (options.category) {
249
+ allRules = allRules.filter((r) => r.category === options.category);
250
+ }
251
+ if (options.severity) {
252
+ allRules = allRules.filter((r) => r.severity === options.severity);
253
+ }
254
+ if (options.language) {
255
+ allRules = allRules.filter((r) => r.languages.includes(options.language) || r.languages.includes("*"));
256
+ }
257
+ if (options.scanner) {
258
+ const secCategories = ["injection", "xss", "secrets", "auth", "crypto", "file-ops"];
259
+ if (options.scanner === "security") {
260
+ allRules = allRules.filter((r) => secCategories.includes(r.category));
261
+ } else {
262
+ allRules = allRules.filter((r) => !secCategories.includes(r.category));
263
+ }
264
+ }
265
+ console.log(chalk.bold(`
266
+ \u{1F4CB} DeepScan Rules (${allRules.length} rules)
267
+ `));
268
+ const severityColors = {
269
+ critical: chalk.bgRed.white,
270
+ error: chalk.red,
271
+ warning: chalk.yellow,
272
+ info: chalk.blue
273
+ };
274
+ for (const rule of allRules) {
275
+ const sevColor = severityColors[rule.severity] || chalk.white;
276
+ const id = chalk.cyan(rule.id.padEnd(35));
277
+ const sev = sevColor(rule.severity.padEnd(10));
278
+ const langs = chalk.gray(rule.languages.join(", "));
279
+ console.log(` ${id} ${sev} ${rule.name}`);
280
+ console.log(` ${" ".repeat(35)} ${chalk.dim(rule.description.slice(0, 80))}`);
281
+ console.log(` ${" ".repeat(35)} Languages: ${langs}`);
282
+ console.log();
283
+ }
284
+ } catch (error) {
285
+ consola3.error("Failed to list rules:", error);
286
+ }
287
+ });
288
+ rules.command("info <ruleId>").description("Show detailed information about a specific rule").action(async (ruleId) => {
289
+ try {
290
+ const ruleEngine = new RuleEngine(DEFAULT_CONFIG);
291
+ await ruleEngine.initialize();
292
+ const rule = ruleEngine.getRule(ruleId);
293
+ if (!rule) {
294
+ consola3.error(`Rule not found: ${ruleId}`);
295
+ return;
296
+ }
297
+ console.log(chalk.bold(`
298
+ \u{1F50D} Rule: ${rule.id}
299
+ `));
300
+ console.log(` ${chalk.bold("Name:")} ${rule.name}`);
301
+ console.log(` ${chalk.bold("Category:")} ${rule.category}`);
302
+ console.log(` ${chalk.bold("Severity:")} ${rule.severity}`);
303
+ console.log(` ${chalk.bold("Confidence:")} ${rule.confidence}`);
304
+ console.log(` ${chalk.bold("Languages:")} ${rule.languages.join(", ")}`);
305
+ console.log(` ${chalk.bold("Description:")} ${rule.description}`);
306
+ if (rule.cwe?.length) {
307
+ console.log(` ${chalk.bold("CWE:")} ${rule.cwe.join(", ")}`);
308
+ }
309
+ if (rule.owasp?.length) {
310
+ console.log(` ${chalk.bold("OWASP:")} ${rule.owasp.join(", ")}`);
311
+ }
312
+ if (rule.fix) {
313
+ console.log(` ${chalk.bold("Fix:")} ${rule.fix.description}`);
314
+ }
315
+ if (rule.references?.length) {
316
+ console.log(` ${chalk.bold("References:")}`);
317
+ for (const ref of rule.references) {
318
+ console.log(` - ${chalk.underline(ref)}`);
319
+ }
320
+ }
321
+ if (rule.tags?.length) {
322
+ console.log(` ${chalk.bold("Tags:")} ${rule.tags.join(", ")}`);
323
+ }
324
+ console.log();
325
+ } catch (error) {
326
+ consola3.error("Failed to get rule info:", error);
327
+ }
328
+ });
329
+ rules.command("categories").description("List all rule categories").action(async () => {
330
+ console.log(chalk.bold("\n\u{1F4C2} Rule Categories\n"));
331
+ for (const cat of RULE_CATEGORIES) {
332
+ const scanner = cat.scanner === "security" ? chalk.red("\u{1F6E1} Security") : chalk.blue("\u{1F4CA} Quality");
333
+ console.log(` ${chalk.cyan(cat.id.padEnd(20))} ${scanner} ${cat.name}`);
334
+ console.log(` ${" ".repeat(20)} ${chalk.dim(cat.description)}`);
335
+ console.log();
336
+ }
337
+ });
338
+ return rules;
339
+ }
340
+
341
+ // src/cli/commands/report.ts
342
+ import { Command as Command4 } from "commander";
343
+ import { readFileSync, writeFileSync as writeFileSync2 } from "fs";
344
+ import { resolve as resolve3 } from "path";
345
+ import { consola as consola4 } from "consola";
346
+ function createReportCommand() {
347
+ const report = new Command4("report");
348
+ report.description("Convert and manage scan reports");
349
+ report.command("convert <input>").description("Convert scan results between formats").requiredOption("--to <format>", "Target format: json, csv, html, sarif").option("-o, --output <file>", "Output file path").action(async (input, options) => {
350
+ try {
351
+ const inputPath = resolve3(input);
352
+ const content = readFileSync(inputPath, "utf-8");
353
+ const scanResult = JSON.parse(content);
354
+ const reporter = getReporter(options.to);
355
+ const output = await reporter.generate(scanResult);
356
+ if (options.output) {
357
+ const outputPath = resolve3(options.output);
358
+ writeFileSync2(outputPath, output, "utf-8");
359
+ consola4.success(`Report converted to ${options.to}: ${outputPath}`);
360
+ } else if (options.to === "html") {
361
+ const outputPath = resolve3("report.html");
362
+ writeFileSync2(outputPath, output, "utf-8");
363
+ consola4.success(`Report converted to ${options.to}: ${outputPath}`);
364
+ } else {
365
+ process.stdout.write(output);
366
+ }
367
+ } catch (error) {
368
+ consola4.error("Report conversion failed:", error);
369
+ process.exitCode = 1;
370
+ }
371
+ });
372
+ return report;
373
+ }
374
+
375
+ // src/cli/index.ts
376
+ var VERSION = "1.0.0";
377
+ function createCLI() {
378
+ const program = new Command5();
379
+ program.name("deepscan").description("\u{1F50D} DeepScan - Open-source security & code quality scanner").version(VERSION, "-v, --version", "Display version number").option("--config <path>", "Path to configuration file").option("--verbose", "Enable verbose output").option("--quiet", "Suppress all output except errors").option("--no-color", "Disable colored output");
380
+ program.addCommand(createScanCommand());
381
+ program.addCommand(createInitCommand());
382
+ program.addCommand(createRulesCommand());
383
+ program.addCommand(createReportCommand());
384
+ program.action(() => {
385
+ program.outputHelp();
386
+ });
387
+ return program;
388
+ }
389
+
390
+ // src/bin/deepscan.ts
391
+ var cli = createCLI();
392
+ cli.parse(process.argv);
393
+ //# sourceMappingURL=deepscan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/cli/index.ts","../../src/cli/commands/scan.ts","../../src/cli/commands/init.ts","../../src/cli/commands/rules.ts","../../src/types/rule.ts","../../src/cli/commands/report.ts","../../src/bin/deepscan.ts"],"sourcesContent":["import { Command } from 'commander';\nimport { createScanCommand } from './commands/scan.js';\nimport { createInitCommand } from './commands/init.js';\nimport { createRulesCommand } from './commands/rules.js';\nimport { createReportCommand } from './commands/report.js';\n\nconst VERSION = '1.0.0';\n\n/**\n * Create the DeepScan CLI application\n */\nexport function createCLI(): Command {\n const program = new Command();\n\n program\n .name('deepscan')\n .description('šŸ” DeepScan - Open-source security & code quality scanner')\n .version(VERSION, '-v, --version', 'Display version number')\n .option('--config <path>', 'Path to configuration file')\n .option('--verbose', 'Enable verbose output')\n .option('--quiet', 'Suppress all output except errors')\n .option('--no-color', 'Disable colored output');\n\n // Register commands\n program.addCommand(createScanCommand());\n program.addCommand(createInitCommand());\n program.addCommand(createRulesCommand());\n program.addCommand(createReportCommand());\n\n // Default action (no subcommand) → show help\n program.action(() => {\n program.outputHelp();\n });\n\n return program;\n}\n","import { Command } from 'commander';\nimport { resolve } from 'node:path';\nimport { consola } from 'consola';\nimport { loadConfig } from '../../config/loader.js';\nimport { ScanPipeline, generateFingerprint } from '../../core/pipeline.js';\nimport { SecurityScanner } from '../../scanners/security/index.js';\nimport { QualityScanner } from '../../scanners/quality/index.js';\nimport { CVEScanner } from '../../scanners/cve/index.js';\nimport { getReporter } from '../../reporters/index.js';\nimport type { OutputFormat } from '../../types/config.js';\n\n/**\n * Create the 'scan' command\n * Usage: deepscan scan [path] [options]\n */\nexport function createScanCommand(): Command {\n const scan = new Command('scan');\n\n scan\n .description('Scan source code for security vulnerabilities and quality issues')\n .argument('[path]', 'Path to scan (default: current directory)', '.')\n .option('-s, --scanners <scanners>', 'Scanner engines to use (comma-separated: security,quality,cve) [default: security]')\n .option('--security', 'Run security scanner only')\n .option('--quality', 'Run quality scanner only')\n .option('--cve', 'Run CVE/dependency scanner only')\n .option('-f, --format <format>', 'Output format: json, csv, html, sarif, console', 'console')\n .option('-o, --output <file>', 'Output file path')\n .option('--severity <levels>', 'Filter by severity (comma-separated: critical,error,warning,info)')\n .option('--include <patterns>', 'Include file patterns (comma-separated)')\n .option('--exclude <patterns>', 'Exclude file patterns (comma-separated)')\n .option('--deep', 'Enable deep analysis (taint tracking, semantic analysis)')\n .option('--ai', 'Enable AI-assisted validation (requires API key)')\n .option('--ai-provider <provider>', 'AI provider: openai, anthropic, ollama, google')\n .option('--rules <path>', 'Path to custom rules directory')\n .option('--parallel <n>', 'Number of parallel workers', '4')\n .option('--incremental', 'Only scan changed files (git-based)')\n .option('--preset <name>', 'Use a preset configuration (node-api, python-web, java-spring, minimal)')\n .option('--config <path>', 'Path to configuration file')\n .action(async (targetPath: string, options: Record<string, string | boolean | undefined>) => {\n try {\n const absolutePath = resolve(targetPath);\n\n // Build CLI overrides from options\n const cliOverrides: Record<string, unknown> = {};\n\n const hasExplicitFlag = options.security || options.quality || options.cve;\n if (hasExplicitFlag) {\n cliOverrides.scanners = {\n security: { enabled: !!options.security },\n quality: { enabled: !!options.quality },\n cve: { enabled: !!options.cve },\n };\n } else if (options.scanners) {\n const scannerList = (options.scanners as string).split(',');\n cliOverrides.scanners = {\n security: { enabled: scannerList.includes('security') },\n quality: { enabled: scannerList.includes('quality') },\n cve: { enabled: scannerList.includes('cve') },\n };\n }\n\n if (options.format) {\n cliOverrides.output = { format: options.format };\n }\n\n if (options.severity) {\n const severities = (options.severity as string).split(',');\n if (!cliOverrides.scanners) cliOverrides.scanners = {};\n (cliOverrides.scanners as Record<string, unknown>).security = { severity: severities };\n }\n\n if (options.include) {\n cliOverrides.paths = {\n ...(cliOverrides.paths as Record<string, unknown> || {}),\n include: (options.include as string).split(','),\n };\n }\n\n if (options.exclude) {\n cliOverrides.paths = {\n ...(cliOverrides.paths as Record<string, unknown> || {}),\n exclude: (options.exclude as string).split(','),\n };\n }\n\n if (options.deep) cliOverrides.deep = true;\n if (options.incremental) cliOverrides.incremental = true;\n if (options.parallel) cliOverrides.parallel = parseInt(options.parallel as string, 10);\n\n if (options.ai) {\n cliOverrides.ai = {\n enabled: true,\n provider: options.aiProvider || 'openai',\n };\n }\n\n if (options.rules) {\n cliOverrides.rules = { custom: [(options.rules as string)] };\n }\n\n // Load configuration\n const config = await loadConfig({\n configPath: options.config as string,\n targetPath: absolutePath,\n cliOverrides: cliOverrides as any,\n preset: options.preset as string,\n });\n\n // Override output format from CLI\n if (options.format) {\n config.output.format = options.format as OutputFormat;\n }\n\n // Create pipeline\n const pipeline = new ScanPipeline(config);\n\n // Register enabled scanners\n if (config.scanners.security.enabled) {\n pipeline.addScanner(new SecurityScanner());\n }\n if (config.scanners.quality.enabled) {\n pipeline.addScanner(new QualityScanner());\n }\n if (config.scanners.cve.enabled) {\n pipeline.addScanner(new CVEScanner());\n }\n\n // Run scan with progress\n const result = await pipeline.run({\n config,\n targetPath: absolutePath,\n onProgress: (current, total, file) => {\n if (!options.quiet) {\n const pct = Math.round((current / total) * 100);\n const fileDisplay = file.length > 50 ? '...' + file.slice(-47) : file;\n process.stderr.write(`\\r Scanning... ${pct}% (${current}/${total}) ${fileDisplay.padEnd(50)}`);\n }\n },\n });\n\n // Clear progress line\n if (!options.quiet) {\n process.stderr.write('\\r' + ' '.repeat(120) + '\\r');\n }\n\n // Generate report\n const reporter = getReporter(config.output.format);\n const output = await reporter.generate(result);\n\n // Write to file or stdout\n if (options.output) {\n await reporter.writeToFile(result, options.output as string);\n consola.success(`Report written to: ${options.output}`);\n } else if (config.output.format === 'html') {\n const defaultPath = 'report.html';\n await reporter.writeToFile(result, defaultPath);\n consola.success(`Report written to: ${defaultPath}`);\n } else if (config.output.format !== 'console') {\n // For non-console formats, write to stdout\n process.stdout.write(output);\n } else {\n // Console format already printed\n process.stdout.write(output);\n }\n\n // Exit with error code if critical/error findings found\n const hasErrors = result.summary.bySeverity.critical > 0 || result.summary.bySeverity.high > 0;\n if (hasErrors) {\n process.exitCode = 1;\n }\n } catch (error) {\n consola.error('Scan failed:', error);\n process.exitCode = 2;\n }\n });\n\n return scan;\n}\n","import { Command } from 'commander';\nimport { writeFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport yaml from 'js-yaml';\nimport { consola } from 'consola';\nimport { DEFAULT_CONFIG } from '../../config/defaults.js';\n\n/**\n * Create the 'init' command\n * Usage: deepscan init\n */\nexport function createInitCommand(): Command {\n const init = new Command('init');\n\n init\n .description('Initialize a .deepscan.yml configuration file in the current directory')\n .option('--preset <name>', 'Use a preset: node-api, python-web, java-spring, minimal')\n .option('--format <format>', 'Config file format: yml, json', 'yml')\n .action(async (options: Record<string, string | undefined>) => {\n try {\n const config = {\n version: '1.0',\n scanners: {\n security: {\n enabled: true,\n severity: ['critical', 'high', 'medium', 'low'],\n },\n quality: {\n enabled: true,\n thresholds: {\n maxComplexity: 15,\n maxFileLength: 500,\n maxFunctionLength: 50,\n },\n },\n cve: {\n enabled: true,\n sources: ['osv'],\n },\n },\n rules: {\n include: ['*'],\n exclude: [],\n custom: [],\n },\n paths: {\n include: ['**/*'],\n exclude: [\n 'node_modules/',\n 'vendor/',\n 'dist/',\n 'build/',\n '.git/',\n 'storage/',\n 'bootstrap/cache/',\n 'public/build/',\n 'assets/',\n '**/node_modules/**',\n '**/vendor/**',\n '**/dist/**',\n '**/build/**',\n '**/.git/**',\n '**/storage/**',\n '**/bootstrap/cache/**',\n '**/public/build/**',\n '**/assets/**',\n ],\n },\n output: {\n format: 'console',\n },\n ai: {\n enabled: false,\n },\n };\n\n const format = options.format || 'yml';\n const fileName = format === 'json' ? '.deepscan.json' : '.deepscan.yml';\n const filePath = resolve(process.cwd(), fileName);\n\n let content: string;\n if (format === 'json') {\n content = JSON.stringify(config, null, 2);\n } else {\n content = '# DeepScan Configuration\\n# https://github.com/deepscan/deepscan-cli\\n\\n'\n + yaml.dump(config, { indent: 2, lineWidth: 100, quotingType: '\"' });\n }\n\n writeFileSync(filePath, content, 'utf-8');\n consola.success(`Created ${fileName}`);\n consola.info('Customize the configuration and run: deepscan scan');\n } catch (error) {\n consola.error('Init failed:', error);\n process.exitCode = 1;\n }\n });\n\n return init;\n}\n","import { Command } from 'commander';\nimport { consola } from 'consola';\nimport chalk from 'chalk';\nimport { RuleEngine } from '../../rules/rule-engine.js';\nimport { DEFAULT_CONFIG } from '../../config/defaults.js';\nimport type { DeepScanConfig } from '../../types/config.js';\nimport { RULE_CATEGORIES } from '../../types/rule.js';\n\n/**\n * Create the 'rules' command group\n * Usage: deepscan rules list|info\n */\nexport function createRulesCommand(): Command {\n const rules = new Command('rules');\n rules.description('Manage and inspect scanning rules');\n\n // Subcommand: list\n rules\n .command('list')\n .description('List all available rules')\n .option('-c, --category <category>', 'Filter by category')\n .option('-s, --severity <severity>', 'Filter by severity')\n .option('-l, --language <language>', 'Filter by language')\n .option('--scanner <type>', 'Filter by scanner type (security, quality)')\n .action(async (options: Record<string, string | undefined>) => {\n try {\n const ruleEngine = new RuleEngine(DEFAULT_CONFIG as DeepScanConfig);\n await ruleEngine.initialize();\n\n let allRules = ruleEngine.getAllRules();\n\n // Apply filters\n if (options.category) {\n allRules = allRules.filter(r => r.category === options.category);\n }\n if (options.severity) {\n allRules = allRules.filter(r => r.severity === options.severity);\n }\n if (options.language) {\n allRules = allRules.filter(r => r.languages.includes(options.language!) || r.languages.includes('*'));\n }\n if (options.scanner) {\n const secCategories = ['injection', 'xss', 'secrets', 'auth', 'crypto', 'file-ops'];\n if (options.scanner === 'security') {\n allRules = allRules.filter(r => secCategories.includes(r.category));\n } else {\n allRules = allRules.filter(r => !secCategories.includes(r.category));\n }\n }\n\n // Display results\n console.log(chalk.bold(`\\nšŸ“‹ DeepScan Rules (${allRules.length} rules)\\n`));\n\n const severityColors: Record<string, (s: string) => string> = {\n critical: chalk.bgRed.white,\n error: chalk.red,\n warning: chalk.yellow,\n info: chalk.blue,\n };\n\n for (const rule of allRules) {\n const sevColor = severityColors[rule.severity] || chalk.white;\n const id = chalk.cyan(rule.id.padEnd(35));\n const sev = sevColor(rule.severity.padEnd(10));\n const langs = chalk.gray(rule.languages.join(', '));\n console.log(` ${id} ${sev} ${rule.name}`);\n console.log(` ${' '.repeat(35)} ${chalk.dim(rule.description.slice(0, 80))}`);\n console.log(` ${' '.repeat(35)} Languages: ${langs}`);\n console.log();\n }\n } catch (error) {\n consola.error('Failed to list rules:', error);\n }\n });\n\n // Subcommand: info\n rules\n .command('info <ruleId>')\n .description('Show detailed information about a specific rule')\n .action(async (ruleId: string) => {\n try {\n const ruleEngine = new RuleEngine(DEFAULT_CONFIG as DeepScanConfig);\n await ruleEngine.initialize();\n\n const rule = ruleEngine.getRule(ruleId);\n if (!rule) {\n consola.error(`Rule not found: ${ruleId}`);\n return;\n }\n\n console.log(chalk.bold(`\\nšŸ” Rule: ${rule.id}\\n`));\n console.log(` ${chalk.bold('Name:')} ${rule.name}`);\n console.log(` ${chalk.bold('Category:')} ${rule.category}`);\n console.log(` ${chalk.bold('Severity:')} ${rule.severity}`);\n console.log(` ${chalk.bold('Confidence:')} ${rule.confidence}`);\n console.log(` ${chalk.bold('Languages:')} ${rule.languages.join(', ')}`);\n console.log(` ${chalk.bold('Description:')} ${rule.description}`);\n\n if (rule.cwe?.length) {\n console.log(` ${chalk.bold('CWE:')} ${rule.cwe.join(', ')}`);\n }\n if (rule.owasp?.length) {\n console.log(` ${chalk.bold('OWASP:')} ${rule.owasp.join(', ')}`);\n }\n if (rule.fix) {\n console.log(` ${chalk.bold('Fix:')} ${rule.fix.description}`);\n }\n if (rule.references?.length) {\n console.log(` ${chalk.bold('References:')}`);\n for (const ref of rule.references) {\n console.log(` - ${chalk.underline(ref)}`);\n }\n }\n if (rule.tags?.length) {\n console.log(` ${chalk.bold('Tags:')} ${rule.tags.join(', ')}`);\n }\n console.log();\n } catch (error) {\n consola.error('Failed to get rule info:', error);\n }\n });\n\n // Subcommand: categories\n rules\n .command('categories')\n .description('List all rule categories')\n .action(async () => {\n console.log(chalk.bold('\\nšŸ“‚ Rule Categories\\n'));\n for (const cat of RULE_CATEGORIES) {\n const scanner = cat.scanner === 'security' ? chalk.red('šŸ›” Security') : chalk.blue('šŸ“Š Quality');\n console.log(` ${chalk.cyan(cat.id.padEnd(20))} ${scanner} ${cat.name}`);\n console.log(` ${' '.repeat(20)} ${chalk.dim(cat.description)}`);\n console.log();\n }\n });\n\n return rules;\n}\n","import type { Severity, Confidence } from './finding.js';\n\n// ─── Rule Types ────────────────────────────────────────────────────────────\n\n/** Pattern definition within a rule */\nexport interface RulePattern {\n /** Tree-sitter query or code pattern */\n pattern?: string;\n /** Message to display when this pattern matches */\n message?: string;\n /** Regex pattern (for non-AST matching) */\n regex?: string;\n /** Flags for regex */\n regexFlags?: string;\n}\n\n/** Condition for advanced rule logic */\nexport interface RuleCondition {\n type: 'taint-check' | 'context-check' | 'scope-check' | 'ast-check';\n /** For taint-check: source type */\n source?: string;\n /** For taint-check: sink variable */\n sink?: string;\n /** For context-check: contexts to include/exclude */\n in?: string[];\n notIn?: string[];\n /** For scope-check */\n scope?: string;\n}\n\n/** Fix suggestion within a rule */\nexport interface RuleFix {\n description: string;\n replacement?: string;\n}\n\n/** A single rule definition */\nexport interface Rule {\n id: string;\n name: string;\n description: string;\n category: string;\n subcategory?: string;\n severity: Severity;\n confidence: Confidence;\n cwe?: string[];\n owasp?: string[];\n languages: string[];\n patterns: RulePattern[];\n conditions?: RuleCondition[];\n fix?: RuleFix;\n tags?: string[];\n references?: string[];\n enabled?: boolean;\n}\n\n/** Collection of rules in a YAML file */\nexport interface RuleFile {\n rules: Rule[];\n}\n\n/** Rule category for organization */\nexport interface RuleCategory {\n id: string;\n name: string;\n description: string;\n scanner: 'security' | 'quality';\n}\n\n/** Default rule categories */\nexport const RULE_CATEGORIES: RuleCategory[] = [\n // Security categories\n { id: 'injection', name: 'Injection', description: 'SQL, Command, LDAP, XPath injection vulnerabilities', scanner: 'security' },\n { id: 'xss', name: 'Cross-Site Scripting', description: 'XSS vulnerabilities including DOM-based and reflected', scanner: 'security' },\n { id: 'secrets', name: 'Secrets & Credentials', description: 'Hardcoded passwords, API keys, tokens', scanner: 'security' },\n { id: 'auth', name: 'Authentication & Authorization', description: 'Weak auth patterns, missing authorization', scanner: 'security' },\n { id: 'crypto', name: 'Cryptography', description: 'Weak algorithms, insecure random, hardcoded keys', scanner: 'security' },\n { id: 'file-ops', name: 'File Operations', description: 'Path traversal, unsafe uploads, directory listing', scanner: 'security' },\n // Quality categories\n { id: 'complexity', name: 'Complexity', description: 'Cyclomatic and cognitive complexity issues', scanner: 'quality' },\n { id: 'duplication', name: 'Code Duplication', description: 'Duplicated code blocks', scanner: 'quality' },\n { id: 'code-smells', name: 'Code Smells', description: 'Long methods, large files, dead code', scanner: 'quality' },\n { id: 'naming', name: 'Naming Conventions', description: 'Inconsistent or unclear naming', scanner: 'quality' },\n { id: 'metrics', name: 'Code Metrics', description: 'Lines of code, comment ratio, maintainability', scanner: 'quality' },\n];\n","import { Command } from 'commander';\nimport { readFileSync, writeFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport { consola } from 'consola';\nimport type { ScanResult } from '../../types/finding.js';\nimport type { OutputFormat } from '../../types/config.js';\nimport { getReporter } from '../../reporters/index.js';\n\n/**\n * Create the 'report' command\n * Usage: deepscan report convert <input> --to <format> --output <file>\n */\nexport function createReportCommand(): Command {\n const report = new Command('report');\n report.description('Convert and manage scan reports');\n\n report\n .command('convert <input>')\n .description('Convert scan results between formats')\n .requiredOption('--to <format>', 'Target format: json, csv, html, sarif')\n .option('-o, --output <file>', 'Output file path')\n .action(async (input: string, options: { to: string; output?: string }) => {\n try {\n const inputPath = resolve(input);\n const content = readFileSync(inputPath, 'utf-8');\n const scanResult: ScanResult = JSON.parse(content);\n\n const reporter = getReporter(options.to as OutputFormat);\n const output = await reporter.generate(scanResult);\n\n if (options.output) {\n const outputPath = resolve(options.output);\n writeFileSync(outputPath, output, 'utf-8');\n consola.success(`Report converted to ${options.to}: ${outputPath}`);\n } else if (options.to === 'html') {\n const outputPath = resolve('report.html');\n writeFileSync(outputPath, output, 'utf-8');\n consola.success(`Report converted to ${options.to}: ${outputPath}`);\n } else {\n process.stdout.write(output);\n }\n } catch (error) {\n consola.error('Report conversion failed:', error);\n process.exitCode = 1;\n }\n });\n\n return report;\n}\n","#!/usr/bin/env node\nimport { createRequire } from 'node:module';\nimport { createCLI } from '../cli/index.js';\n\n// Run the CLI\nconst cli = createCLI();\ncli.parse(process.arg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;AAEjD,YAAM,WAAW,YAAY,QAAQ,EAAkB;AACvD,YAAM,SAAS,MAAM,SAAS,SAAS,UAAU;AAEjD,UAAI,QAAQ,QAAQ;AAClB,cAAM,aAAaA,SAAQ,QAAQ,MAAM;AACzC,QAAAC,eAAc,YAAY,QAAQ,OAAO;AACzC,QAAAC,SAAQ,QAAQ,uBAAuB,QAAQ,EAAE,KAAK,UAAU,EAAE;AAAA,MACpE,WAAW,QAAQ,OAAO,QAAQ;AAChC,cAAM,aAAaF,SAAQ,aAAa;AACxC,QAAAC,eAAc,YAAY,QAAQ,OAAO;AACzC,QAAAC,SAAQ,QAAQ,uBAAuB,QAAQ,EAAE,KAAK,UAAU,EAAE;AAAA,MACpE,OAAO;AACL,gBAAQ,OAAO,MAAM,MAAM;AAAA,MAC7B;AAAA,IACF,SAAS,OAAO;AACd,MAAAA,SAAQ,MAAM,6BAA6B,KAAK;AAChD,cAAQ,WAAW;AAAA,IACrB;AAAA,EACF,CAAC;AAEH,SAAO;AACT;;;AL1CA,IAAM,UAAU;AAKT,SAAS,YAAqB;AACnC,QAAM,UAAU,IAAIC,SAAQ;AAE5B,UACG,KAAK,UAAU,EACf,YAAY,kEAA2D,EACvE,QAAQ,SAAS,iBAAiB,wBAAwB,EAC1D,OAAO,mBAAmB,4BAA4B,EACtD,OAAO,aAAa,uBAAuB,EAC3C,OAAO,WAAW,mCAAmC,EACrD,OAAO,cAAc,wBAAwB;AAGhD,UAAQ,WAAW,kBAAkB,CAAC;AACtC,UAAQ,WAAW,kBAAkB,CAAC;AACtC,UAAQ,WAAW,mBAAmB,CAAC;AACvC,UAAQ,WAAW,oBAAoB,CAAC;AAGxC,UAAQ,OAAO,MAAM;AACnB,YAAQ,WAAW;AAAA,EACrB,CAAC;AAED,SAAO;AACT;;;AM9BA,IAAM,MAAM,UAAU;AACtB,IAAI,MAAM,QAAQ,IAAI;","names":["Command","Command","resolve","consola","Command","consola","Command","consola","Command","writeFileSync","resolve","consola","Command","resolve","writeFileSync","consola","Command"]}