mirror of
https://github.com/FuzzingLabs/fuzzforge_ai.git
synced 2026-05-16 23:33:28 +02:00
feat: Add LLM analysis workflow and ruff linter fixes
LLM Analysis Workflow: - Add llm_analyzer module for AI-powered code security analysis - Add llm_analysis workflow with SARIF output support - Mount AI module in Python worker for A2A wrapper access - Add a2a-sdk dependency to Python worker requirements - Fix workflow parameter ordering in Temporal manager Ruff Linter Fixes: - Fix bare except clauses (E722) across AI and CLI modules - Add noqa comments for intentional late imports (E402) - Replace undefined get_ai_status_async with TODO placeholder - Remove unused imports and variables - Remove container diagnostics display from exception handler MCP Configuration: - Reactivate FUZZFORGE_MCP_URL with default value - Set default MCP URL to http://localhost:8010/mcp in init
This commit is contained in:
@@ -18,7 +18,6 @@ import os
|
||||
|
||||
import typer
|
||||
from rich.console import Console
|
||||
from rich.table import Table
|
||||
|
||||
|
||||
console = Console()
|
||||
@@ -49,41 +48,15 @@ def ai_agent() -> None:
|
||||
@app.command("status")
|
||||
def ai_status() -> None:
|
||||
"""Show AI system health and configuration."""
|
||||
try:
|
||||
status = asyncio.run(get_ai_status_async())
|
||||
except Exception as exc: # pragma: no cover
|
||||
console.print(f"[red]Failed to get AI status:[/red] {exc}")
|
||||
raise typer.Exit(1) from exc
|
||||
|
||||
console.print("[bold cyan]🤖 FuzzForge AI System Status[/bold cyan]\n")
|
||||
|
||||
config_table = Table(title="Configuration", show_header=True, header_style="bold magenta")
|
||||
config_table.add_column("Setting", style="bold")
|
||||
config_table.add_column("Value", style="cyan")
|
||||
config_table.add_column("Status", style="green")
|
||||
|
||||
for key, info in status["config"].items():
|
||||
status_icon = "✅" if info["configured"] else "❌"
|
||||
display_value = info["value"] if info["value"] else "-"
|
||||
config_table.add_row(key, display_value, f"{status_icon}")
|
||||
|
||||
console.print(config_table)
|
||||
console.print()
|
||||
|
||||
components_table = Table(title="AI Components", show_header=True, header_style="bold magenta")
|
||||
components_table.add_column("Component", style="bold")
|
||||
components_table.add_column("Status", style="green")
|
||||
components_table.add_column("Details", style="dim")
|
||||
|
||||
for component, info in status["components"].items():
|
||||
status_icon = "🟢" if info["available"] else "🔴"
|
||||
components_table.add_row(component, status_icon, info["details"])
|
||||
|
||||
console.print(components_table)
|
||||
|
||||
if status["agents"]:
|
||||
console.print()
|
||||
console.print(f"[bold green]✓[/bold green] {len(status['agents'])} agents registered")
|
||||
# TODO: Implement AI status checking
|
||||
# This command is a placeholder for future health monitoring functionality
|
||||
console.print("🚧 [yellow]AI status command is not yet implemented.[/yellow]")
|
||||
console.print("\nPlanned features:")
|
||||
console.print(" • LLM provider connectivity")
|
||||
console.print(" • API key validation")
|
||||
console.print(" • Registered agents status")
|
||||
console.print(" • Memory/session persistence health")
|
||||
console.print("\nFor now, use [cyan]ff ai agent[/cyan] to launch the AI agent.")
|
||||
|
||||
|
||||
@app.command("server")
|
||||
|
||||
@@ -205,9 +205,6 @@ def _ensure_env_file(fuzzforge_dir: Path, force: bool) -> None:
|
||||
console=console,
|
||||
)
|
||||
|
||||
enable_cognee = False
|
||||
cognee_url = ""
|
||||
|
||||
session_db_path = fuzzforge_dir / "fuzzforge_sessions.db"
|
||||
session_db_rel = session_db_path.relative_to(fuzzforge_dir.parent)
|
||||
|
||||
@@ -219,7 +216,7 @@ def _ensure_env_file(fuzzforge_dir: Path, force: bool) -> None:
|
||||
f"LLM_MODEL={llm_model}",
|
||||
f"LITELLM_MODEL={llm_model}",
|
||||
f"OPENAI_API_KEY={api_key}",
|
||||
f"FUZZFORGE_MCP_URL={os.getenv('FUZZFORGE_MCP_URL', 'http://localhost:8010/mcp')}",
|
||||
"FUZZFORGE_MCP_URL=http://localhost:8010/mcp",
|
||||
"",
|
||||
"# Cognee configuration mirrors the primary LLM by default",
|
||||
f"LLM_COGNEE_PROVIDER={llm_provider}",
|
||||
|
||||
@@ -403,12 +403,12 @@ class ProjectConfigManager:
|
||||
if max_tokens:
|
||||
os.environ["LLM_MAX_TOKENS"] = str(max_tokens)
|
||||
|
||||
# Disabled - FuzzForge MCP backend connection
|
||||
# if not os.getenv("FUZZFORGE_MCP_URL"):
|
||||
# os.environ["FUZZFORGE_MCP_URL"] = os.getenv(
|
||||
# "FUZZFORGE_DEFAULT_MCP_URL",
|
||||
# "http://localhost:8010/mcp",
|
||||
# )
|
||||
# FuzzForge MCP backend connection - fallback if not in .env
|
||||
if not os.getenv("FUZZFORGE_MCP_URL"):
|
||||
os.environ["FUZZFORGE_MCP_URL"] = os.getenv(
|
||||
"FUZZFORGE_DEFAULT_MCP_URL",
|
||||
"http://localhost:8010/mcp",
|
||||
)
|
||||
|
||||
def refresh(self) -> None:
|
||||
"""Reload configuration from disk."""
|
||||
|
||||
@@ -152,7 +152,7 @@ class FuzzForgeDatabase:
|
||||
if conn:
|
||||
try:
|
||||
conn.rollback()
|
||||
except:
|
||||
except Exception:
|
||||
pass # Connection might be broken
|
||||
if "database is locked" in str(e).lower():
|
||||
raise sqlite3.OperationalError(
|
||||
@@ -167,14 +167,14 @@ class FuzzForgeDatabase:
|
||||
if conn:
|
||||
try:
|
||||
conn.rollback()
|
||||
except:
|
||||
except Exception:
|
||||
pass # Connection might be broken
|
||||
raise
|
||||
finally:
|
||||
if conn:
|
||||
try:
|
||||
conn.close()
|
||||
except:
|
||||
except Exception:
|
||||
pass # Ensure cleanup even if close fails
|
||||
|
||||
# Run management methods
|
||||
|
||||
@@ -259,12 +259,6 @@ def handle_error(error: Exception, context: str = "") -> None:
|
||||
if hasattr(error, 'context') and error.context:
|
||||
ctx = error.context
|
||||
|
||||
# Container diagnostics
|
||||
if ctx.container_diagnostics:
|
||||
console.print("\n[bold]Container Diagnostics:[/bold]")
|
||||
display_container_diagnostics(ctx.container_diagnostics)
|
||||
display_container_logs(ctx.container_diagnostics)
|
||||
|
||||
# Error patterns
|
||||
if ctx.error_patterns:
|
||||
display_error_patterns(ctx.error_patterns)
|
||||
|
||||
@@ -20,7 +20,6 @@ from typing import Optional, List
|
||||
import sys
|
||||
|
||||
from .commands import (
|
||||
init,
|
||||
workflows,
|
||||
workflow_exec,
|
||||
findings,
|
||||
|
||||
Reference in New Issue
Block a user