From 65c3cccab85d89489dfbedbe6c63b141bb3af9ee Mon Sep 17 00:00:00 2001 From: 7000pctAUTO Date: Tue, 3 Feb 2026 10:29:58 +0000 Subject: [PATCH] Initial upload of ai-code-audit-cli project --- src/cli/options.py | 84 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 src/cli/options.py diff --git a/src/cli/options.py b/src/cli/options.py new file mode 100644 index 0000000..1f0e49b --- /dev/null +++ b/src/cli/options.py @@ -0,0 +1,84 @@ +"""Shared CLI options and enums for AI Code Audit CLI.""" + +from enum import Enum +from typing import Optional + + +class OutputFormat(Enum): + """Output format options.""" + + TERMINAL = "terminal" + JSON = "json" + MARKDOWN = "markdown" + + +class SeverityLevel(Enum): + """Severity levels for issues.""" + + LOW = "low" + MEDIUM = "medium" + HIGH = "high" + CRITICAL = "critical" + + +class LanguageType(Enum): + """Supported programming languages.""" + + PYTHON = "python" + JAVASCRIPT = "javascript" + TYPESCRIPT = "typescript" + + +class ScanOptions: + """Options for scanning operations.""" + + def __init__( + self, + output_format: OutputFormat = OutputFormat.TERMINAL, + language_filter: Optional[LanguageType] = None, + severity_filter: Optional[SeverityLevel] = None, + verbose: bool = False, + no_color: bool = False, + quiet: bool = False, + output_file: Optional[str] = None, + ): + self.output_format = output_format + self.language_filter = language_filter + self.severity_filter = severity_filter + self.verbose = verbose + self.no_color = no_color + self.quiet = quiet + self.output_file = output_file + + +def resolve_output_format(value: Optional[str]) -> OutputFormat: + """Resolve output format from string value.""" + if value is None: + return OutputFormat.TERMINAL + value_lower = value.lower() + for fmt in OutputFormat: + if fmt.value == value_lower: + return fmt + return OutputFormat.TERMINAL + + +def resolve_severity(value: Optional[str]) -> Optional[SeverityLevel]: + """Resolve severity level from string value.""" + if value is None: + return None + value_lower = value.lower() + for sev in SeverityLevel: + if sev.value == value_lower: + return sev + return None + + +def resolve_language(value: Optional[str]) -> Optional[LanguageType]: + """Resolve language type from string value.""" + if value is None: + return None + value_lower = value.lower() + for lang in LanguageType: + if lang.value == value_lower: + return lang + return None