| 624 | |
| 625 | |
| 626 | def parse_args() -> argparse.Namespace: |
| 627 | parser = argparse.ArgumentParser( |
| 628 | description='Generate release-note CSV and Markdown between two commits in one command.' |
| 629 | ) |
| 630 | parser.add_argument('base_ref', help='Base git ref or commit') |
| 631 | parser.add_argument('head_ref', help='Head git ref or commit') |
| 632 | parser.add_argument( |
| 633 | '--output-dir', |
| 634 | default='results', |
| 635 | help='Directory for generated files (default: results)', |
| 636 | ) |
| 637 | parser.add_argument( |
| 638 | '--owner', |
| 639 | default=DEFAULT_OWNER, |
| 640 | help=f'GitHub owner (default: {DEFAULT_OWNER})', |
| 641 | ) |
| 642 | parser.add_argument( |
| 643 | '--repo', |
| 644 | default=DEFAULT_REPO, |
| 645 | help=f'GitHub repo (default: {DEFAULT_REPO})', |
| 646 | ) |
| 647 | parser.add_argument( |
| 648 | '--token', |
| 649 | help='GitHub token; falls back to env vars or ~/.gh_tokenrc', |
| 650 | ) |
| 651 | parser.add_argument( |
| 652 | '--cache-path', |
| 653 | default='results/pr_cache.json', |
| 654 | help='PR metadata cache path (default: results/pr_cache.json)', |
| 655 | ) |
| 656 | parser.add_argument( |
| 657 | '--batch-size', |
| 658 | type=int, |
| 659 | default=25, |
| 660 | help='How many PRs to fetch per GitHub GraphQL request (default: 25)', |
| 661 | ) |
| 662 | parser.add_argument( |
| 663 | '--workers', |
| 664 | type=int, |
| 665 | default=4, |
| 666 | help='How many GraphQL batches to fetch concurrently (default: 4)', |
| 667 | ) |
| 668 | parser.add_argument( |
| 669 | '--direct-range', |
| 670 | action='store_true', |
| 671 | help='Use base_ref..head_ref directly instead of merge-base(base_ref, head_ref)..head_ref', |
| 672 | ) |
| 673 | parser.add_argument( |
| 674 | '--local-only', |
| 675 | action='store_true', |
| 676 | help='Skip GitHub API calls and only use local git metadata', |
| 677 | ) |
| 678 | return parser.parse_args() |
| 679 | |
| 680 | |
| 681 | def main() -> int: |