Skip to content

Commit 1ec3dfe

Browse files
fix: improve audit command implementation
- Remove unused audit_click_group import - Add path existence validation to scan/fix/check options - Move agent_centric import to module level for performance - Use Typer Path type with exists=True validation Co-authored-by: Mervin Praison <MervinPraison@users.noreply.github.com>
1 parent 7fce75c commit 1ec3dfe

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

  • src/praisonai/praisonai/cli

src/praisonai/praisonai/cli/app.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
from enum import Enum
88
from typing import Optional
9+
from pathlib import Path
910

1011
import typer
1112

@@ -310,7 +311,7 @@ def register_commands():
310311
from .commands.profile import app as profile_app
311312
from .commands.benchmark import app as benchmark_app
312313
from .commands.paths import app as paths_app
313-
from .commands.audit import audit as audit_click_group
314+
from .commands.audit import agent_centric
314315

315316
# Import new command modules - Previously legacy-only commands
316317
from .commands.chat import app as chat_app
@@ -400,9 +401,9 @@ def register_commands():
400401

401402
@audit_typer.command("agent-centric")
402403
def audit_agent_centric(
403-
scan: str = typer.Option(None, "--scan", help="Scan path for compliance"),
404-
fix: str = typer.Option(None, "--fix", help="Fix non-compliant files"),
405-
check: str = typer.Option(None, "--check", help="Check and fail if non-compliant"),
404+
scan: Optional[Path] = typer.Option(None, "--scan", exists=True, help="Scan path for compliance"),
405+
fix: Optional[Path] = typer.Option(None, "--fix", exists=True, help="Fix non-compliant files"),
406+
check: Optional[Path] = typer.Option(None, "--check", exists=True, help="Check and fail if non-compliant"),
406407
json_output: bool = typer.Option(False, "--json", help="Output as JSON"),
407408
line_limit: int = typer.Option(40, "--line-limit", help="Line limit for header scan"),
408409
only_examples: bool = typer.Option(False, "--only-examples", help="Only scan Python examples"),
@@ -411,11 +412,10 @@ def audit_agent_centric(
411412
):
412413
"""Audit agent-centric compliance for examples and docs."""
413414
# Call the original Click function directly
414-
from .commands.audit import agent_centric
415415
agent_centric.callback(
416-
scan_path=scan,
417-
fix_path=fix,
418-
check_path=check,
416+
scan_path=str(scan) if scan else None,
417+
fix_path=str(fix) if fix else None,
418+
check_path=str(check) if check else None,
419419
output_json=json_output,
420420
line_limit=line_limit,
421421
only_examples=only_examples,

0 commit comments

Comments
 (0)