-
Notifications
You must be signed in to change notification settings - Fork 0
Ai domain #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces AI-powered features and enhanced UI capabilities to OpenAuditKit, along with a comprehensive rebrand to the NeuralForge.one domain. The changes add streaming support for AI interactions, improve the user experience with Rich console components, and update documentation to reflect the tool's AI capabilities.
Key Changes:
- Added streaming AI capabilities for real-time code explanations
- Introduced a centralized UI module using Rich for better terminal output
- Enhanced secret detection with improved JSON parsing and error handling
- Updated branding from openauditkit.org to neuralforge.one
Reviewed changes
Copilot reviewed 14 out of 18 changed files in this pull request and generated 21 comments.
Show a summary per file
| File | Description |
|---|---|
| requirements.txt | Added openai>=1.0.0 dependency for AI features |
| pyproject.toml | Updated contact email to neuralforge.one domain and added dev dependencies |
| openaudit/main.py | Removed debug print statement |
| openaudit/interface/cli/ui.py | New centralized UI handler with Rich console integration and markdown streaming |
| openaudit/interface/cli/commands.py | Integrated UI module, improved AI agent workflow with progress indicators and status messages |
| openaudit/features/secrets/agent.py | Enhanced JSON response parsing for AI secret validation with markdown cleanup |
| openaudit/features/explain/agent.py | Added streaming method for real-time code explanations |
| openaudit/ai/engine.py | Implemented chat_completion_stream for streaming AI responses |
| openaudit.egg-info/requires.txt | Updated package requirements (build artifact - should not be committed) |
| openaudit.egg-info/PKG-INFO | Updated package metadata with new branding (build artifact - should not be committed) |
| dist/* | Built distribution files (build artifacts - should not be committed) |
| build/* | Compilation artifacts (build artifacts - should not be committed) |
| README.md | Comprehensive documentation rewrite with AI feature highlights and modern formatting |
| .gitignore | Added entries to ignore build artifacts and egg-info directories |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| | **⚙️ Config Audit** | Discovers misconfigurations in `Dockerfile`, `.env`, `Kubernetes`, and more. | | ||
| | **🧠 AI Advisory** | **(New)** Integrated AI Agents explain vulnerabilities and suggest fixes. | | ||
| | **🏗️ Architecture Analysis** | AI agents analyze your project structure for design flaws. | | ||
| | **🛡️ Threat Modeling** | auto-generates STRIDE threat models based on your codebase. | |
Copilot
AI
Dec 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent capitalization: "auto-generates" should be capitalized consistently with the rest of the table entries. The other feature descriptions start with capital letters after the emoji ("Detects", "Discovers", "Integrated", "AI agents analyze"), so this should be "Auto-generates" or "Automatically generates".
| | **🛡️ Threat Modeling** | auto-generates STRIDE threat models based on your codebase. | | |
| | **🛡️ Threat Modeling** | Auto-generates STRIDE threat models based on your codebase. | |
| ```bash | ||
| openaudit scan . | ||
| ``` | ||
| ## � What is OpenAuditKit? |
Copilot
AI
Dec 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The emoji appears to be corrupted or missing. The text shows "## � What is OpenAuditKit?" where the � indicates a character encoding issue. This same issue appears in the README.md file.
| ## � What is OpenAuditKit? | |
| ## What is OpenAuditKit? |
| | **⚙️ Config Audit** | Discovers misconfigurations in `Dockerfile`, `.env`, `Kubernetes`, and more. | | ||
| | **🧠 AI Advisory** | **(New)** Integrated AI Agents explain vulnerabilities and suggest fixes. | | ||
| | **🏗️ Architecture Analysis** | AI agents analyze your project structure for design flaws. | | ||
| | **🛡️ Threat Modeling** | auto-generates STRIDE threat models based on your codebase. | |
Copilot
AI
Dec 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent capitalization: "auto-generates" should start with a capital letter to match the style of other feature descriptions in the table. This should be "Auto-generates" or "Automatically generates".
| | **🛡️ Threat Modeling** | auto-generates STRIDE threat models based on your codebase. | | |
| | **🛡️ Threat Modeling** | Auto-generates STRIDE threat models based on your codebase. | |
| class UI: | ||
| """ | ||
| Centralized UI handler using Rich. | ||
| """ | ||
| console = Console() | ||
|
|
||
| @staticmethod | ||
| def print(text: str, style: str = None): | ||
| UI.console.print(text, style=style) | ||
|
|
||
| @staticmethod | ||
| def header(title: str): | ||
| UI.console.rule(f"[bold blue]{title}[/bold blue]") | ||
|
|
||
| @staticmethod | ||
| def success(message: str): | ||
| UI.console.print(f"[bold green]✓[/bold green] {message}") | ||
|
|
||
| @staticmethod | ||
| def error(message: str): | ||
| UI.console.print(f"[bold red]✗[/bold red] {message}") | ||
|
|
||
| @staticmethod | ||
| def warning(message: str): | ||
| UI.console.print(f"[bold yellow]![/bold yellow] {message}") | ||
|
|
||
| @staticmethod | ||
| def create_progress(): | ||
| return Progress( | ||
| SpinnerColumn(), | ||
| TextColumn("[progress.description]{task.description}"), | ||
| BarColumn(), | ||
| TaskProgressColumn(), | ||
| console=UI.console | ||
| ) | ||
|
|
||
| @staticmethod | ||
| def stream_markdown(content_generator: Generator[str, None, None], title: str = "Analysis"): | ||
| """ | ||
| Streams markdown content nicely. | ||
| """ | ||
| with Live(console=UI.console, refresh_per_second=10) as live: | ||
| accumulated_text = "" | ||
| for chunk in content_generator: | ||
| accumulated_text += chunk | ||
| markdown = Markdown(accumulated_text) | ||
| panel = Panel(markdown, title=title, border_style="blue") | ||
| live.update(panel) | ||
|
|
||
| # Final render | ||
| markdown = Markdown(accumulated_text) | ||
| panel = Panel(markdown, title=title, border_style="green") | ||
| live.update(panel) | ||
| return accumulated_text |
Copilot
AI
Dec 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new UI class lacks test coverage. Given that the repository enforces a 90% test coverage threshold (mentioned in the removed README section) and has comprehensive tests for other modules like scanners, this new UI module should have corresponding tests to verify the Rich console integration, progress bars, and markdown streaming functionality.
| ```bash | ||
| openaudit scan . | ||
| ``` | ||
| ## � What is OpenAuditKit? |
Copilot
AI
Dec 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The emoji appears to be corrupted or missing. The text shows "## � What is OpenAuditKit?" where the � indicates a character encoding issue or a missing/unsupported emoji. This also appears in the PKG-INFO file. Verify that the emoji renders correctly across different terminals and platforms, or replace it with a text-safe alternative.
| ## � What is OpenAuditKit? | |
| ## What is OpenAuditKit? |
| for chunk in content_generator: | ||
| accumulated_text += chunk | ||
| markdown = Markdown(accumulated_text) | ||
| panel = Panel(markdown, title=title, border_style="blue") | ||
| live.update(panel) | ||
|
|
||
| # Final render | ||
| markdown = Markdown(accumulated_text) | ||
| panel = Panel(markdown, title=title, border_style="green") | ||
| live.update(panel) |
Copilot
AI
Dec 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The stream_markdown method doesn't handle exceptions from the generator. If the AI streaming fails mid-stream (e.g., network error, API timeout), the exception will propagate up without any cleanup of the Live display context. Consider wrapping the iteration in a try-except block to ensure graceful error handling and proper display cleanup.
| for chunk in content_generator: | |
| accumulated_text += chunk | |
| markdown = Markdown(accumulated_text) | |
| panel = Panel(markdown, title=title, border_style="blue") | |
| live.update(panel) | |
| # Final render | |
| markdown = Markdown(accumulated_text) | |
| panel = Panel(markdown, title=title, border_style="green") | |
| live.update(panel) | |
| try: | |
| for chunk in content_generator: | |
| accumulated_text += chunk | |
| markdown = Markdown(accumulated_text) | |
| panel = Panel(markdown, title=title, border_style="blue") | |
| live.update(panel) | |
| except Exception as exc: | |
| # Render an error panel if streaming is interrupted | |
| error_markdown = Markdown( | |
| f"**Streaming interrupted:** {exc}" | |
| ) | |
| error_panel = Panel(error_markdown, title=title, border_style="red") | |
| live.update(error_panel) | |
| else: | |
| # Final render on successful completion | |
| markdown = Markdown(accumulated_text) | |
| panel = Panel(markdown, title=title, border_style="green") | |
| live.update(panel) |
| def chat_completion_stream(self, system_prompt: str, user_prompt: str, model: str = "gpt-4o"): | ||
| """ | ||
| Executes a chat completion request with streaming. | ||
| Yields chunks of the response content. | ||
| """ | ||
| if not self.client: | ||
| self._initialize_client() | ||
| if not self.client: | ||
| raise RuntimeError("OpenAI API key not configured. Run 'openaudit config set-key <KEY>' or set OPENAI_API_KEY env var.") | ||
|
|
||
| try: | ||
| stream = self.client.chat.completions.create( | ||
| model=model, | ||
| messages=[ | ||
| {"role": "system", "content": system_prompt}, | ||
| {"role": "user", "content": user_prompt} | ||
| ], | ||
| temperature=0.2, | ||
| stream=True | ||
| ) | ||
| for chunk in stream: | ||
| if chunk.choices[0].delta.content: | ||
| yield chunk.choices[0].delta.content | ||
| except OpenAIError as e: | ||
| raise RuntimeError(f"OpenAI API Error: {str(e)}") | ||
|
|
Copilot
AI
Dec 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new chat_completion_stream method lacks test coverage. Since the repository has comprehensive testing for the existing chat_completion method, this new streaming functionality should have corresponding tests to verify streaming behavior, error handling, and edge cases like empty streams or connection failures.
| if chunk.choices[0].delta.content: | ||
| yield chunk.choices[0].delta.content |
Copilot
AI
Dec 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The streaming implementation doesn't handle the case where chunk.choices[0].delta.content might be None for some chunks (e.g., the first chunk often contains role information). While the current code checks for truthiness which handles None, it may skip empty strings. Consider explicitly checking for is not None if you want to preserve empty string chunks, or document that empty chunks are intentionally skipped.
| if chunk.choices[0].delta.content: | |
| yield chunk.choices[0].delta.content | |
| content = chunk.choices[0].delta.content | |
| if content is not None: | |
| yield content |
| df_results = cross_agent.run_on_graph(df_graph) | ||
|
|
||
| for res in df_results: | ||
| if res.is_advisory: |
Copilot
AI
Dec 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indentation is inconsistent here. Line 147 has an extra space before the if statement (note the spacing in if res.is_advisory:). This inconsistency can cause subtle issues with Python's indentation-based syntax and makes the code harder to read. Ensure consistent indentation (typically 4 spaces per level) throughout the block.
| if ai_result: | ||
| # Enrich Finding | ||
| finding.description += f" [AI: {ai_result.analysis}]" | ||
| finding.is_ai_generated = True # Tag enriched findings too |
Copilot
AI
Dec 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting is_ai_generated = True on a finding that was originally detected by rule-based scanners is misleading. The finding is AI-enriched, not AI-generated. Consider using a separate field like is_ai_enriched or ai_verified, or documenting that is_ai_generated actually means "touched by AI" rather than "originally generated by AI".
| finding.is_ai_generated = True # Tag enriched findings too |
No description provided.