@@ -465,10 +465,14 @@ def analyze_pr(
465465 github_token : Optional [str ] = typer .Option (None , "--github-token" , help = "GitHub token" ),
466466 verbose : bool = typer .Option (False , "--verbose" , "-v" , help = "Enable verbose logging" ),
467467 provider : Optional [str ] = typer .Option (
468- None , "--provider" , help = "LLM provider: openai, anthropic, or bedrock (auto-detected from .env if not set)"
468+ None ,
469+ "--provider" ,
470+ help = "LLM provider: openai, anthropic, or bedrock (auto-detected from .env if not set)" ,
469471 ),
470472 bedrock_model : Optional [str ] = typer .Option (
471- None , "--bedrock-model" , help = "Bedrock model ID (e.g. anthropic.claude-sonnet-4-5-20250929-v1:0)"
473+ None ,
474+ "--bedrock-model" ,
475+ help = "Bedrock model ID (e.g. anthropic.claude-sonnet-4-5-20250929-v1:0)" ,
472476 ),
473477 bedrock_region : Optional [str ] = typer .Option (
474478 None , "--bedrock-region" , help = "AWS region for Bedrock (default: AWS_REGION or us-east-1)"
@@ -518,10 +522,15 @@ def batch_analyze(
518522 None , "--input-file" , "-i" , help = "File containing PR URLs (one per line)"
519523 ),
520524 repos_file : Optional [Path ] = typer .Option (
521- None , "--repos-file" , "-r" , help = "File containing repo names (owner/repo per line) for date range search"
525+ None ,
526+ "--repos-file" ,
527+ "-r" ,
528+ help = "File containing repo names (owner/repo per line) for date range search" ,
522529 ),
523530 all_repos : bool = typer .Option (
524- False , "--all-repos" , help = "Dynamically scan all repos the authenticated user has access to (use with --since/--until or --days)"
531+ False ,
532+ "--all-repos" ,
533+ help = "Dynamically scan all repos the authenticated user has access to (use with --since/--until or --days)" ,
525534 ),
526535 org : Optional [str ] = typer .Option (
527536 None , "--org" , help = "Organization name (for date range search)"
@@ -533,7 +542,10 @@ def batch_analyze(
533542 None , "--until" , help = "End date (YYYY-MM-DD) for date range search"
534543 ),
535544 days : Optional [int ] = typer .Option (
536- None , "--days" , "-d" , help = "Shortcut: last N days (e.g. --days 5 for last 5 days). Use with --all-repos."
545+ None ,
546+ "--days" ,
547+ "-d" ,
548+ help = "Shortcut: last N days (e.g. --days 5 for last 5 days). Use with --all-repos." ,
537549 ),
538550 output_file : Optional [Path ] = typer .Option (
539551 None , "--output" , "-o" , help = "Output CSV file path (required unless --label is used)"
@@ -579,11 +591,11 @@ def batch_analyze(
579591 "Can also be set via GH_TOKENS or GITHUB_TOKENS environment variables." ,
580592 ),
581593 provider : Optional [str ] = typer .Option (
582- None , "--provider" , help = "LLM provider: openai, anthropic, or bedrock (auto-detected from .env if not set)"
583- ),
584- bedrock_model : Optional [str ] = typer .Option (
585- None , "--bedrock-model" , help = "Bedrock model ID"
594+ None ,
595+ "--provider" ,
596+ help = "LLM provider: openai, anthropic, or bedrock (auto-detected from .env if not set)" ,
586597 ),
598+ bedrock_model : Optional [str ] = typer .Option (None , "--bedrock-model" , help = "Bedrock model ID" ),
587599 bedrock_region : Optional [str ] = typer .Option (
588600 None , "--bedrock-region" , help = "AWS region for Bedrock"
589601 ),
@@ -594,7 +606,10 @@ def batch_analyze(
594606 None , "--limit" , "-n" , help = "Maximum number of PRs to process (e.g. --limit 10)"
595607 ),
596608 overwrite : bool = typer .Option (
597- False , "--overwrite" , "--full-sync" , help = "Ignore existing CSV; fetch full date range (default: incremental fetch from latest CSV data)"
609+ False ,
610+ "--overwrite" ,
611+ "--full-sync" ,
612+ help = "Ignore existing CSV; fetch full date range (default: incremental fetch from latest CSV data)" ,
598613 ),
599614 fetch_only : bool = typer .Option (
600615 False , "--fetch-only" , help = "Only fetch PR URLs to cache; skip analysis and labeling"
@@ -637,13 +652,24 @@ def batch_analyze(
637652 raise typer .Exit (1 )
638653
639654 if sum (bool (x ) for x in [org , repos_file , all_repos ]) > 1 :
640- typer .echo ("Error: Cannot specify more than one of --org, --repos-file, --all-repos" , err = True )
655+ typer .echo (
656+ "Error: Cannot specify more than one of --org, --repos-file, --all-repos" , err = True
657+ )
641658 raise typer .Exit (1 )
642659
643660 has_date_range = org and (bool (since and until ) or (days is not None and days > 0 ))
644- has_repos_date_range = repos_file and (bool (since and until ) or (days is not None and days > 0 ))
645- has_all_repos_date_range = all_repos and (bool (since and until ) or (days is not None and days > 0 ))
646- if not input_file and not has_date_range and not has_repos_date_range and not has_all_repos_date_range :
661+ has_repos_date_range = repos_file and (
662+ bool (since and until ) or (days is not None and days > 0 )
663+ )
664+ has_all_repos_date_range = all_repos and (
665+ bool (since and until ) or (days is not None and days > 0 )
666+ )
667+ if (
668+ not input_file
669+ and not has_date_range
670+ and not has_repos_date_range
671+ and not has_all_repos_date_range
672+ ):
647673 typer .echo (
648674 "Error: Must specify either --input-file OR (--org, --since/--until or --days) OR (--repos-file, --since/--until or --days) OR (--all-repos, --since/--until or --days)" ,
649675 err = True ,
@@ -652,7 +678,9 @@ def batch_analyze(
652678
653679 # Require output_file unless --label or --fetch-only is used
654680 if not label and not output_file and not fetch_only :
655- typer .echo ("Error: --output is required unless --label or --fetch-only is used" , err = True )
681+ typer .echo (
682+ "Error: --output is required unless --label or --fetch-only is used" , err = True
683+ )
656684 raise typer .Exit (1 )
657685
658686 # When labeling, default to writing CSV as well (override with --output)
@@ -663,14 +691,19 @@ def batch_analyze(
663691 openai_key = get_openai_api_key () if not fetch_only else None
664692
665693 if not fetch_only and provider == "openai" and not openai_key :
666- typer .echo ("Error: OPENAI_API_KEY environment variable is required for openai provider" , err = True )
694+ typer .echo (
695+ "Error: OPENAI_API_KEY environment variable is required for openai provider" ,
696+ err = True ,
697+ )
667698 typer .echo ("Set it with: export OPENAI_API_KEY='your-key'" , err = True )
668699 raise typer .Exit (1 )
669700 if not fetch_only and provider == "anthropic" and not get_anthropic_api_key ():
670701 typer .echo ("Error: ANTHROPIC_API_KEY is required for anthropic provider" , err = True )
671702 raise typer .Exit (1 )
672703 if not fetch_only and provider == "bedrock" :
673- typer .echo ("Using Bedrock provider. Ensure AWS_PROFILE and AWS_REGION are set." , err = True )
704+ typer .echo (
705+ "Using Bedrock provider. Ensure AWS_PROFILE and AWS_REGION are set." , err = True
706+ )
674707
675708 # Get GitHub tokens - CLI option takes precedence over environment
676709 token_list : List [str ] = []
@@ -758,7 +791,10 @@ def batch_analyze(
758791
759792 if all_repos :
760793 if not github_token :
761- typer .echo ("Error: GitHub token required for --all-repos. Set GH_TOKEN or run `gh auth login`" , err = True )
794+ typer .echo (
795+ "Error: GitHub token required for --all-repos. Set GH_TOKEN or run `gh auth login`" ,
796+ err = True ,
797+ )
762798 raise typer .Exit (1 )
763799 pr_urls = generate_pr_list_from_all_repos (
764800 since = since_dt ,
@@ -887,7 +923,10 @@ def export_labels(
887923 DEFAULT_SLEEP_SECONDS , "--sleep-seconds" , help = "Sleep between GitHub API calls"
888924 ),
889925 overwrite : bool = typer .Option (
890- False , "--overwrite" , "--full-sync" , help = "Ignore existing CSV; fetch full date range (default: incremental fetch from latest CSV data)"
926+ False ,
927+ "--overwrite" ,
928+ "--full-sync" ,
929+ help = "Ignore existing CSV; fetch full date range (default: incremental fetch from latest CSV data)" ,
891930 ),
892931):
893932 """
@@ -921,7 +960,9 @@ def export_labels(
921960
922961 github_token = get_github_token ()
923962 if not github_token :
924- typer .echo ("Error: GitHub token required. Set GH_TOKEN or run `gh auth login`" , err = True )
963+ typer .echo (
964+ "Error: GitHub token required. Set GH_TOKEN or run `gh auth login`" , err = True
965+ )
925966 raise typer .Exit (1 )
926967
927968 if input_file :
@@ -1026,9 +1067,7 @@ def export_labels(
10261067
10271068@app .command (name = "generate-reports" )
10281069def generate_reports (
1029- csv_path : Path = typer .Option (
1030- "complexity-report.csv" , "--input" , "-i" , help = "Input CSV path"
1031- ),
1070+ csv_path : Path = typer .Option ("complexity-report.csv" , "--input" , "-i" , help = "Input CSV path" ),
10321071 output_dir : Path = typer .Option (
10331072 "reports" , "--output" , "-o" , help = "Output directory for report images"
10341073 ),
@@ -1065,7 +1104,10 @@ def migrate_csv(
10651104 "complexity-report.csv" , "--output" , "-o" , help = "Output CSV path (can be same as input)"
10661105 ),
10671106 background : bool = typer .Option (
1068- False , "--background" , "-b" , help = "Run migration in background, log to reports/migration.log"
1107+ False ,
1108+ "--background" ,
1109+ "-b" ,
1110+ help = "Run migration in background, log to reports/migration.log" ,
10691111 ),
10701112 sleep_seconds : float = typer .Option (
10711113 DEFAULT_SLEEP_SECONDS , "--sleep-seconds" , help = "Sleep between GitHub API calls"
@@ -1082,7 +1124,9 @@ def migrate_csv(
10821124
10831125 github_token = get_github_token ()
10841126 if not github_token :
1085- typer .echo ("Warning: GH_TOKEN not set. GitHub API calls may fail for private repos." , err = True )
1127+ typer .echo (
1128+ "Warning: GH_TOKEN not set. GitHub API calls may fail for private repos." , err = True
1129+ )
10861130
10871131 if background :
10881132 pid = run_migration_background (
@@ -1123,9 +1167,7 @@ def verify_settings(
11231167 csv_path : Optional [Path ] = typer .Option (
11241168 None , "--csv" , "-c" , help = "Path to complexity CSV (default: complexity-report.csv)"
11251169 ),
1126- csv_required : bool = typer .Option (
1127- False , "--csv-required" , help = "Fail when CSV is missing"
1128- ),
1170+ csv_required : bool = typer .Option (False , "--csv-required" , help = "Fail when CSV is missing" ),
11291171):
11301172 """
11311173 Verify settings required to pull data and generate reports.
@@ -1150,7 +1192,10 @@ def verify_settings(
11501192
11511193 failed = sum (1 for _ , ok , _ in results if not ok )
11521194 if failed > 0 :
1153- typer .echo (f"{ failed } check(s) failed. Fix missing settings before running batch-analyze or generate-reports." , err = True )
1195+ typer .echo (
1196+ f"{ failed } check(s) failed. Fix missing settings before running batch-analyze or generate-reports." ,
1197+ err = True ,
1198+ )
11541199 raise typer .Exit (1 )
11551200 except typer .Exit :
11561201 raise
@@ -1244,11 +1289,11 @@ def label_pr(
12441289 openai_api_key : Optional [str ] = typer .Option (None , "--openai-api-key" , help = "OpenAI API key" ),
12451290 github_token : Optional [str ] = typer .Option (None , "--github-token" , help = "GitHub token" ),
12461291 provider : Optional [str ] = typer .Option (
1247- None , "--provider" , help = "LLM provider: openai, anthropic, or bedrock (auto-detected from .env if not set)"
1248- ),
1249- bedrock_model : Optional [str ] = typer .Option (
1250- None , "--bedrock-model" , help = "Bedrock model ID"
1292+ None ,
1293+ "--provider" ,
1294+ help = "LLM provider: openai, anthropic, or bedrock (auto-detected from .env if not set)" ,
12511295 ),
1296+ bedrock_model : Optional [str ] = typer .Option (None , "--bedrock-model" , help = "Bedrock model ID" ),
12521297 bedrock_region : Optional [str ] = typer .Option (
12531298 None , "--bedrock-region" , help = "AWS region for Bedrock"
12541299 ),
0 commit comments