From 7820d586049db83d10eb246499d051434fadcf8f Mon Sep 17 00:00:00 2001 From: tduhamel42 Date: Wed, 12 Nov 2025 13:34:42 +0100 Subject: [PATCH] fix: resolve critical CLI command issues - Fix OptionInfo bug causing 'ff finding ' to crash - Add explicit limit=None, offset=0 parameters in main.py calls - Prevents OptionInfo objects from being used in arithmetic operations - Fix command suggestions after workflow completion - Change 'fuzzforge findings' to 'ff finding' (correct syntax) - Add missing 'View findings' suggestion after submission - Fix --fail-on help text - Change from 'severity' to 'SARIF level' (error,warning,note,info) - Matches actual implementation - Update CLI documentation - Fix 'ff finding show' parameter from --rule to --id - Mark unimplemented AI commands as 'Coming Soon' - Correct 'ff ingest' documentation to match actual implementation - Remove fake subcommands, document actual options --- .../fuzzforge_cli/commands/workflow_exec.py | 9 +++-- cli/src/fuzzforge_cli/main.py | 4 +- docs/docs/reference/cli-reference.md | 40 +++++++++++-------- 3 files changed, 31 insertions(+), 22 deletions(-) diff --git a/cli/src/fuzzforge_cli/commands/workflow_exec.py b/cli/src/fuzzforge_cli/commands/workflow_exec.py index 80db77d..9edbb3f 100644 --- a/cli/src/fuzzforge_cli/commands/workflow_exec.py +++ b/cli/src/fuzzforge_cli/commands/workflow_exec.py @@ -301,7 +301,7 @@ def execute_workflow( ), fail_on: Optional[str] = typer.Option( None, "--fail-on", - help="Fail build if findings match severity (critical,high,medium,low,all,none). Use with --wait" + help="Fail build if findings match SARIF level (error,warning,note,info,all,none). Use with --wait" ), export_sarif: Optional[str] = typer.Option( None, "--export-sarif", @@ -423,8 +423,9 @@ def execute_workflow( # Don't fail the whole operation if database save fails console.print(f"āš ļø Failed to save execution to database: {e}", style="yellow") - console.print(f"\nšŸ’” Monitor progress: [bold cyan]fuzzforge monitor live {response.run_id}[/bold cyan]") - console.print(f"šŸ’” Check status: [bold cyan]fuzzforge workflow status {response.run_id}[/bold cyan]") + console.print(f"\nšŸ’” Monitor progress: [bold cyan]ff monitor live {response.run_id}[/bold cyan]") + console.print(f"šŸ’” Check status: [bold cyan]ff workflow status {response.run_id}[/bold cyan]") + console.print(f"šŸ’” View findings: [bold cyan]ff finding {response.run_id}[/bold cyan]") # Suggest --live for fuzzing workflows if not live and not wait and "fuzzing" in workflow.lower(): @@ -501,7 +502,7 @@ def execute_workflow( console.print(f"āš ļø Failed to check findings: {e}", style="yellow") if not fail_on and not export_sarif: - console.print(f"šŸ’” View findings: [bold cyan]fuzzforge findings {response.run_id}[/bold cyan]") + console.print(f"šŸ’” View findings: [bold cyan]ff finding {response.run_id}[/bold cyan]") except KeyboardInterrupt: console.print("\nā¹ļø Monitoring cancelled (execution continues in background)", style="yellow") diff --git a/cli/src/fuzzforge_cli/main.py b/cli/src/fuzzforge_cli/main.py index 7f5aa54..239235e 100644 --- a/cli/src/fuzzforge_cli/main.py +++ b/cli/src/fuzzforge_cli/main.py @@ -316,7 +316,7 @@ def finding_main( console.print("āŒ No project database found", style="red") return - get_findings(run_id=finding_id, save=True, format="table") + get_findings(run_id=finding_id, save=True, format="table", limit=None, offset=0) except Exception as e: console.print(f"āŒ Failed to get findings: {e}", style="red") @@ -390,7 +390,7 @@ def main(): console.print(f"šŸ” Displaying finding: {finding_id}") try: - get_findings(run_id=finding_id, save=True, format="table") + get_findings(run_id=finding_id, save=True, format="table", limit=None, offset=0) return except Exception as e: console.print(f"āŒ Failed to get finding: {e}", style="red") diff --git a/docs/docs/reference/cli-reference.md b/docs/docs/reference/cli-reference.md index dd7b4d2..2f16006 100644 --- a/docs/docs/reference/cli-reference.md +++ b/docs/docs/reference/cli-reference.md @@ -304,15 +304,15 @@ View and analyze individual findings. **Usage:** ```bash -ff finding [id] # Show latest or specific finding -ff finding show --rule # Show specific finding detail +ff finding [id] # Show latest or specific finding +ff finding show --id # Show specific finding detail ``` **Examples:** ```bash -ff finding # Show latest finding -ff finding python_sast-abc123 # Show specific run findings -ff finding show python_sast-abc123 --rule f2cf5e3e # Show specific finding +ff finding # Show latest finding +ff finding python_sast-abc123 # Show specific run findings +ff finding show python_sast-abc123 --id f2cf5e3e # Show specific finding ``` --- @@ -445,15 +445,20 @@ ff ai [COMMAND] ``` **Subcommands:** +- `agent` — Start interactive AI agent +- `status` — Check AI agent status +- `server [--port]` — Start AI agent server + +**Planned Features (Coming Soon):** - `analyze ` — Analyze findings with AI - `explain ` — Get AI explanation of a finding - `remediate ` — Get remediation suggestions **Examples:** ```bash -ff ai analyze python_sast-abc123 # Analyze all findings -ff ai explain python_sast-abc123:finding1 # Explain specific finding -ff ai remediate python_sast-abc123:finding1 # Get fix suggestions +ff ai agent # Start interactive AI agent +ff ai status # Check agent status +ff ai server --port 8080 # Start server on custom port ``` --- @@ -466,19 +471,22 @@ Ingest knowledge into the AI knowledge base. **Usage:** ```bash -ff ingest [COMMAND] +ff ingest [path] [OPTIONS] ``` -**Subcommands:** -- `file ` — Ingest a file -- `directory ` — Ingest directory contents -- `workflow ` — Ingest workflow documentation +**Options:** +- `--recursive, -r` — Recursively ingest directory contents +- `--file-types, -t` — Comma-separated file types to ingest (e.g., "md,txt,py") +- `--exclude, -e` — Patterns to exclude +- `--dataset, -d` — Target dataset name +- `--force, -f` — Force reingest even if already processed **Examples:** ```bash -ff ingest file ./docs/security.md # Ingest single file -ff ingest directory ./docs # Ingest directory -ff ingest workflow python_sast # Ingest workflow docs +ff ingest ./docs/security.md # Ingest single file +ff ingest ./docs --recursive # Ingest directory recursively +ff ingest ./src -t "py,js" --exclude "test_*" # Ingest with filters +ff ingest ./docs -d security_docs # Ingest to specific dataset ``` ---