Skip to content

Commit a0933ac

Browse files
authored
Added Enriched --help output (#75)
Closes #74 Added the key scan/watch options (`--ai`, `--severity`, `--format`, `--config`, `--output`, `--url`, `--supply-chain`, `--stats`, `--debug`, `--wizard`) directly to the root CLI group so they appear under Options: in the top-level help output. Values set at the group level are propagated to `scan` and `watch` as defaults via `ctx.default_map`, so both invocation styles work identically: pyspector --ai scan path/ pyspector scan --ai path/ # unchanged, still works
1 parent 70eac6a commit a0933ac

1 file changed

Lines changed: 61 additions & 1 deletion

File tree

src/pyspector/cli.py

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,11 +447,71 @@ def _fmt_watch_issue(issue, tag: str, tag_color: str) -> str:
447447
# --- Main CLI Logic ---
448448

449449
@click.group()
450-
def cli():
450+
@click.option('--ai', 'ai_scan', is_flag=True, default=False,
451+
help="Enable the specialized ruleset for AI/LLM vulnerability scanning.")
452+
@click.option('-s', '--severity', 'severity_level',
453+
type=click.Choice(['LOW', 'MEDIUM', 'HIGH', 'CRITICAL']),
454+
default='LOW', show_default=True,
455+
help="Minimum severity level to report.")
456+
@click.option('-f', '--format', 'report_format',
457+
type=click.Choice(['console', 'json', 'sarif', 'html']),
458+
default='console', show_default=True,
459+
help="Output format: console, json, sarif, or html.")
460+
@click.option('-c', '--config', 'config_path',
461+
type=click.Path(path_type=Path),
462+
help="Path to a pyspector.toml configuration file.")
463+
@click.option('-o', '--output', 'output_file',
464+
type=click.Path(path_type=Path),
465+
help="Path to write the report to (default: stdout).")
466+
@click.option('-u', '--url', 'repo_url', type=str,
467+
help="URL of a public GitHub or GitLab repository to clone and scan.")
468+
@click.option('--supply-chain', is_flag=True, default=False,
469+
help="Check project dependencies against the OSV database for known CVEs.")
470+
@click.option('--stats', 'show_stats', is_flag=True, default=False,
471+
help="Print a performance and findings statistics table after the scan.")
472+
@click.option('--debug', is_flag=True, default=False,
473+
help="Show all informational/progress messages.")
474+
@click.option('--wizard', is_flag=True, default=False,
475+
help="Launch interactive guided scan mode — ideal for first-time users.")
476+
@click.pass_context
477+
def cli(
478+
ctx: click.Context,
479+
ai_scan: bool,
480+
severity_level: str,
481+
report_format: str,
482+
config_path: Optional[Path],
483+
output_file: Optional[Path],
484+
repo_url: Optional[str],
485+
supply_chain: bool,
486+
show_stats: bool,
487+
debug: bool,
488+
wizard: bool,
489+
):
451490
"""
452491
PySpector: A high-performance, security-focused static analysis tool
453492
for Python, powered by Rust.
454493
"""
494+
ctx.ensure_object(dict)
495+
ctx.default_map = {
496+
'scan': {
497+
'ai_scan': ai_scan,
498+
'severity_level': severity_level,
499+
'report_format': report_format,
500+
'config_path': config_path,
501+
'output_file': output_file,
502+
'repo_url': repo_url,
503+
'supply_chain': supply_chain,
504+
'show_stats': show_stats,
505+
'debug': debug,
506+
'wizard': wizard,
507+
},
508+
'watch': {
509+
'ai_scan': ai_scan,
510+
'severity_level': severity_level,
511+
'config_path': config_path,
512+
'debug': debug,
513+
},
514+
}
455515

456516

457517
def run_wizard():

0 commit comments

Comments
 (0)