Skip to content

proxy

Class info

Classes

Name Children Inherits
Repository
githarbor.core.proxy
Proxy class that forwards all method calls to a repository instance.

    🛈 DocStrings

    Module containing repository proxy implementation.

    Repository

    Bases: BaseRepository

    Proxy class that forwards all method calls to a repository instance.

    Source code in src/githarbor/core/proxy.py
      34
      35
      36
      37
      38
      39
      40
      41
      42
      43
      44
      45
      46
      47
      48
      49
      50
      51
      52
      53
      54
      55
      56
      57
      58
      59
      60
      61
      62
      63
      64
      65
      66
      67
      68
      69
      70
      71
      72
      73
      74
      75
      76
      77
      78
      79
      80
      81
      82
      83
      84
      85
      86
      87
      88
      89
      90
      91
      92
      93
      94
      95
      96
      97
      98
      99
     100
     101
     102
     103
     104
     105
     106
     107
     108
     109
     110
     111
     112
     113
     114
     115
     116
     117
     118
     119
     120
     121
     122
     123
     124
     125
     126
     127
     128
     129
     130
     131
     132
     133
     134
     135
     136
     137
     138
     139
     140
     141
     142
     143
     144
     145
     146
     147
     148
     149
     150
     151
     152
     153
     154
     155
     156
     157
     158
     159
     160
     161
     162
     163
     164
     165
     166
     167
     168
     169
     170
     171
     172
     173
     174
     175
     176
     177
     178
     179
     180
     181
     182
     183
     184
     185
     186
     187
     188
     189
     190
     191
     192
     193
     194
     195
     196
     197
     198
     199
     200
     201
     202
     203
     204
     205
     206
     207
     208
     209
     210
     211
     212
     213
     214
     215
     216
     217
     218
     219
     220
     221
     222
     223
     224
     225
     226
     227
     228
     229
     230
     231
     232
     233
     234
     235
     236
     237
     238
     239
     240
     241
     242
     243
     244
     245
     246
     247
     248
     249
     250
     251
     252
     253
     254
     255
     256
     257
     258
     259
     260
     261
     262
     263
     264
     265
     266
     267
     268
     269
     270
     271
     272
     273
     274
     275
     276
     277
     278
     279
     280
     281
     282
     283
     284
     285
     286
     287
     288
     289
     290
     291
     292
     293
     294
     295
     296
     297
     298
     299
     300
     301
     302
     303
     304
     305
     306
     307
     308
     309
     310
     311
     312
     313
     314
     315
     316
     317
     318
     319
     320
     321
     322
     323
     324
     325
     326
     327
     328
     329
     330
     331
     332
     333
     334
     335
     336
     337
     338
     339
     340
     341
     342
     343
     344
     345
     346
     347
     348
     349
     350
     351
     352
     353
     354
     355
     356
     357
     358
     359
     360
     361
     362
     363
     364
     365
     366
     367
     368
     369
     370
     371
     372
     373
     374
     375
     376
     377
     378
     379
     380
     381
     382
     383
     384
     385
     386
     387
     388
     389
     390
     391
     392
     393
     394
     395
     396
     397
     398
     399
     400
     401
     402
     403
     404
     405
     406
     407
     408
     409
     410
     411
     412
     413
     414
     415
     416
     417
     418
     419
     420
     421
     422
     423
     424
     425
     426
     427
     428
     429
     430
     431
     432
     433
     434
     435
     436
     437
     438
     439
     440
     441
     442
     443
     444
     445
     446
     447
     448
     449
     450
     451
     452
     453
     454
     455
     456
     457
     458
     459
     460
     461
     462
     463
     464
     465
     466
     467
     468
     469
     470
     471
     472
     473
     474
     475
     476
     477
     478
     479
     480
     481
     482
     483
     484
     485
     486
     487
     488
     489
     490
     491
     492
     493
     494
     495
     496
     497
     498
     499
     500
     501
     502
     503
     504
     505
     506
     507
     508
     509
     510
     511
     512
     513
     514
     515
     516
     517
     518
     519
     520
     521
     522
     523
     524
     525
     526
     527
     528
     529
     530
     531
     532
     533
     534
     535
     536
     537
     538
     539
     540
     541
     542
     543
     544
     545
     546
     547
     548
     549
     550
     551
     552
     553
     554
     555
     556
     557
     558
     559
     560
     561
     562
     563
     564
     565
     566
     567
     568
     569
     570
     571
     572
     573
     574
     575
     576
     577
     578
     579
     580
     581
     582
     583
     584
     585
     586
     587
     588
     589
     590
     591
     592
     593
     594
     595
     596
     597
     598
     599
     600
     601
     602
     603
     604
     605
     606
     607
     608
     609
     610
     611
     612
     613
     614
     615
     616
     617
     618
     619
     620
     621
     622
     623
     624
     625
     626
     627
     628
     629
     630
     631
     632
     633
     634
     635
     636
     637
     638
     639
     640
     641
     642
     643
     644
     645
     646
     647
     648
     649
     650
     651
     652
     653
     654
     655
     656
     657
     658
     659
     660
     661
     662
     663
     664
     665
     666
     667
     668
     669
     670
     671
     672
     673
     674
     675
     676
     677
     678
     679
     680
     681
     682
     683
     684
     685
     686
     687
     688
     689
     690
     691
     692
     693
     694
     695
     696
     697
     698
     699
     700
     701
     702
     703
     704
     705
     706
     707
     708
     709
     710
     711
     712
     713
     714
     715
     716
     717
     718
     719
     720
     721
     722
     723
     724
     725
     726
     727
     728
     729
     730
     731
     732
     733
     734
     735
     736
     737
     738
     739
     740
     741
     742
     743
     744
     745
     746
     747
     748
     749
     750
     751
     752
     753
     754
     755
     756
     757
     758
     759
     760
     761
     762
     763
     764
     765
     766
     767
     768
     769
     770
     771
     772
     773
     774
     775
     776
     777
     778
     779
     780
     781
     782
     783
     784
     785
     786
     787
     788
     789
     790
     791
     792
     793
     794
     795
     796
     797
     798
     799
     800
     801
     802
     803
     804
     805
     806
     807
     808
     809
     810
     811
     812
     813
     814
     815
     816
     817
     818
     819
     820
     821
     822
     823
     824
     825
     826
     827
     828
     829
     830
     831
     832
     833
     834
     835
     836
     837
     838
     839
     840
     841
     842
     843
     844
     845
     846
     847
     848
     849
     850
     851
     852
     853
     854
     855
     856
     857
     858
     859
     860
     861
     862
     863
     864
     865
     866
     867
     868
     869
     870
     871
     872
     873
     874
     875
     876
     877
     878
     879
     880
     881
     882
     883
     884
     885
     886
     887
     888
     889
     890
     891
     892
     893
     894
     895
     896
     897
     898
     899
     900
     901
     902
     903
     904
     905
     906
     907
     908
     909
     910
     911
     912
     913
     914
     915
     916
     917
     918
     919
     920
     921
     922
     923
     924
     925
     926
     927
     928
     929
     930
     931
     932
     933
     934
     935
     936
     937
     938
     939
     940
     941
     942
     943
     944
     945
     946
     947
     948
     949
     950
     951
     952
     953
     954
     955
     956
     957
     958
     959
     960
     961
     962
     963
     964
     965
     966
     967
     968
     969
     970
     971
     972
     973
     974
     975
     976
     977
     978
     979
     980
     981
     982
     983
     984
     985
     986
     987
     988
     989
     990
     991
     992
     993
     994
     995
     996
     997
     998
     999
    1000
    1001
    1002
    1003
    1004
    1005
    1006
    1007
    1008
    1009
    1010
    1011
    1012
    1013
    1014
    1015
    1016
    1017
    1018
    1019
    1020
    1021
    1022
    1023
    1024
    1025
    1026
    1027
    1028
    1029
    1030
    1031
    1032
    1033
    1034
    1035
    1036
    1037
    1038
    1039
    1040
    1041
    1042
    1043
    1044
    1045
    1046
    1047
    1048
    1049
    1050
    1051
    1052
    1053
    1054
    1055
    1056
    1057
    1058
    1059
    1060
    1061
    1062
    1063
    1064
    1065
    1066
    1067
    1068
    1069
    1070
    1071
    1072
    1073
    1074
    1075
    1076
    1077
    1078
    1079
    1080
    1081
    1082
    1083
    1084
    1085
    1086
    1087
    1088
    1089
    1090
    1091
    1092
    1093
    1094
    1095
    1096
    1097
    1098
    1099
    1100
    1101
    1102
    1103
    1104
    1105
    1106
    1107
    1108
    1109
    1110
    1111
    1112
    1113
    1114
    1115
    1116
    1117
    1118
    1119
    1120
    1121
    1122
    1123
    1124
    1125
    1126
    1127
    1128
    1129
    1130
    1131
    1132
    1133
    1134
    1135
    1136
    1137
    1138
    1139
    1140
    1141
    1142
    1143
    1144
    1145
    1146
    1147
    1148
    1149
    1150
    1151
    1152
    1153
    1154
    1155
    1156
    1157
    1158
    1159
    1160
    1161
    1162
    1163
    1164
    1165
    1166
    1167
    1168
    1169
    1170
    1171
    1172
    1173
    1174
    1175
    1176
    1177
    1178
    1179
    1180
    1181
    1182
    1183
    1184
    1185
    1186
    1187
    1188
    1189
    1190
    1191
    1192
    1193
    1194
    1195
    1196
    1197
    1198
    1199
    1200
    1201
    1202
    1203
    1204
    1205
    1206
    1207
    1208
    1209
    1210
    1211
    1212
    1213
    class Repository(BaseRepository):
        """Proxy class that forwards all method calls to a repository instance."""
    
        def __init__(self, repository: BaseRepository) -> None:
            """Initialize proxy with repository instance.
    
            Args:
                repository: Repository instance to forward calls to.
            """
            self._repository = repository
            self.repository_type = type(repository).__name__.removesuffix("Repository")
    
        def __repr__(self) -> str:
            return f"<{self.repository_type} {self.owner}/{self.name}>"
    
        @property
        def owner(self):
            return self._repository.owner
    
        @property
        def name(self) -> str:
            """Return repository name.
    
            Returns:
                Name of the repository.
            """
            return self._repository.name
    
        @property
        def edit_base_uri(self):
            return self._repository.edit_base_uri
    
        @property
        def repository(self):
            return self._repository
    
        @property
        def default_branch(self) -> str:
            """Return default branch name.
    
            Returns:
                Name of the default branch.
            """
            return self._repository.default_branch
    
        def get_repo_user(self) -> User:
            """Get information about the repository user.
    
            Returns:
                User information.
            """
            if self._repository.is_async:
                return asyncio.run(self._repository.get_repo_user_async())
            return self._repository.get_repo_user()
    
        def get_branch(self, name: str) -> Branch:
            """Get information about a specific branch.
    
            Args:
                name: Name of the branch.
    
            Returns:
                Branch information.
            """
            if self._repository.is_async:
                return asyncio.run(self._repository.get_branch_async(name))
            return self._repository.get_branch(name)
    
        def get_pull_request(self, number: int) -> PullRequest:
            """Get information about a specific pull request.
    
            Args:
                number: PR number.
    
            Returns:
                Pull request information.
            """
            if self._repository.is_async:
                return asyncio.run(self._repository.get_pull_request_async(number))
            return self._repository.get_pull_request(number)
    
        def list_pull_requests(self, state: PullRequestState = "open") -> list[PullRequest]:
            """List pull requests.
    
            Args:
                state: State filter ('open', 'closed', 'all').
    
            Returns:
                List of pull requests.
            """
            if self._repository.is_async:
                return asyncio.run(self._repository.list_pull_requests_async(state))
            return self._repository.list_pull_requests(state)
    
        def get_issue(self, issue_id: int) -> Issue:
            """Get information about a specific issue.
    
            Args:
                issue_id: Issue number.
    
            Returns:
                Issue information.
            """
            if self._repository.is_async:
                return asyncio.run(self._repository.get_issue_async(issue_id))
            return self._repository.get_issue(issue_id)
    
        def list_issues(self, state: IssueState = "open") -> list[Issue]:
            """List issues.
    
            Args:
                state: State filter ('open', 'closed', 'all').
    
            Returns:
                List of issues.
            """
            if self._repository.is_async:
                return asyncio.run(self._repository.list_issues_async(state))
            return self._repository.list_issues(state)
    
        def create_issue(
            self,
            title: str,
            body: str,
            labels: list[str] | None = None,
            assignees: list[str] | None = None,
        ) -> Issue:
            """Create an issue.
    
            Args:
                title: Issue title
                body: Issue description/content
                labels: List of label names to apply
                assignees: List of usernames to assign
    
            Returns:
                Created issue
            """
            if self._repository.is_async:
                return asyncio.run(
                    self._repository.create_issue_async(
                        title=title,
                        body=body,
                        labels=labels,
                        assignees=assignees,
                    )
                )
            return self._repository.create_issue(
                title=title,
                body=body,
                labels=labels,
                assignees=assignees,
            )
    
        def get_commit(self, sha: str) -> Commit:
            """Get information about a specific commit.
    
            Args:
                sha: Commit SHA.
    
            Returns:
                Commit information.
            """
            if self._repository.is_async:
                return asyncio.run(self._repository.get_commit_async(sha))
            return self._repository.get_commit(sha)
    
        def list_commits(
            self,
            branch: str | None = None,
            since: datetime | None = None,
            until: datetime | None = None,
            author: str | None = None,
            path: str | None = None,
            max_results: int | None = None,
        ) -> NiceReprList[Commit]:
            """List commits with optional filters.
    
            Args:
                branch: Branch to list commits from.
                since: Only show commits after this date.
                until: Only show commits before this date.
                author: Filter by author.
                path: Filter by file path.
                max_results: Maximum number of results to return.
    
            Returns:
                List of commits.
            """
            if self._repository.is_async:
                return NiceReprList(
                    asyncio.run(
                        self._repository.list_commits_async(
                            branch=branch,
                            since=since,
                            until=until,
                            author=author,
                            path=path,
                            max_results=max_results,
                        )
                    )
                )
            return NiceReprList(
                self._repository.list_commits(
                    branch=branch,
                    since=since,
                    until=until,
                    author=author,
                    path=path,
                    max_results=max_results,
                )
            )
    
        def get_workflow(self, workflow_id: str) -> Workflow:
            """Get information about a specific workflow.
    
            Args:
                workflow_id: Workflow ID.
    
            Returns:
                Workflow information.
            """
            if self._repository.is_async:
                return asyncio.run(self._repository.get_workflow_async(workflow_id))
            return self._repository.get_workflow(workflow_id)
    
        def list_workflows(self) -> list[Workflow]:
            """List all workflows.
    
            Returns:
                List of workflows.
            """
            if self._repository.is_async:
                return asyncio.run(self._repository.list_workflows_async())
            return self._repository.list_workflows()
    
        def get_workflow_run(self, run_id: str) -> WorkflowRun:
            """Get information about a specific workflow run.
    
            Args:
                run_id: Workflow run ID.
    
            Returns:
                Workflow run information.
            """
            if self._repository.is_async:
                return asyncio.run(self._repository.get_workflow_run_async(run_id))
            return self._repository.get_workflow_run(run_id)
    
        def download(self, path: str, destination: JoinablePathLike, recursive: bool = False):
            """Download repository content.
    
            Args:
                path: Path to download.
                destination: Where to save the downloaded content.
                recursive: Whether to download recursively.
            """
            if self._repository.is_async:
                return asyncio.run(self._repository.download_async(path, destination, recursive))
            return self._repository.download(path, destination, recursive)
    
        def search_commits(
            self,
            query: str,
            branch: str | None = None,
            path: str | None = None,
            max_results: int | None = None,
        ) -> list[Commit]:
            """Search commits.
    
            Default implementation that filters commits based on message content.
    
            Args:
                query: Search query string
                branch: Branch to search in
                path: Filter by file path
                max_results: Maximum number of results to return
    
            Returns:
                List of matching commits
            """
            if self._repository.is_async:
                return NiceReprList(
                    asyncio.run(
                        self._repository.search_commits_async(
                            query=query,
                            branch=branch,
                            path=path,
                            max_results=max_results,
                        )
                    )
                )
            return NiceReprList(
                self._repository.search_commits(
                    query=query,
                    branch=branch,
                    path=path,
                    max_results=max_results,
                )
            )
    
        def iter_files(
            self,
            path: str = "",
            ref: str | None = None,
            pattern: str | None = None,
        ) -> Iterator[str]:
            """Iterate over repository files.
    
            Default implementation using recursive directory traversal.
    
            Args:
                path: Base path to start from
                ref: Git reference (branch/tag/commit)
                pattern: File pattern to match
    
            Yields:
                File paths
            """
            yield from self._repository.iter_files(path, ref, pattern)
            # try:
            #     yield from self._repository.iter_files(path, ref, pattern)
            # except NotImplementedError:
    
            #     def _should_include(file_path: str) -> bool:
            #         return not pattern or fnmatch.fnmatch(file_path, pattern)
    
            #     # This assumes repository provides some basic file listing capability
            #     try:
            #         contents = self._repository.list_directory(path, ref=ref)
            #         for item in contents:
            #             if isinstance(item, dict):
            #                 # Assuming item has 'path' and 'type' keys
            #                 if item["type"] == "dir":
            #                     yield from self.iter_files(
            #                         item["path"], ref=ref, pattern=pattern
            #                     )
            #                 elif _should_include(item["path"]):
            #                     yield item["path"]
            #             # Assuming item is a path string
            #             elif _should_include(str(item)):
            #                 yield str(item)
            #     except (NotImplementedError, AttributeError):
            #         # If even basic file listing is not available, raise NotImplementedError
            #         msg = "Repository does not support file iteration"
            #         raise NotImplementedError(msg)
    
        def get_contributors(
            self,
            sort_by: Literal["commits", "name", "date"] = "commits",
            limit: int | None = None,
        ) -> list[User]:
            """Get repository contributors.
    
            Args:
                sort_by: How to sort contributors.
                limit: Maximum number of contributors to return.
    
            Returns:
                List of contributors.
            """
            if self._repository.is_async:
                return asyncio.run(self._repository.get_contributors_async(sort_by, limit))
            return self._repository.get_contributors(sort_by, limit)
    
        def get_languages(self) -> dict[str, int]:
            """Get repository language statistics.
    
            Returns:
                Dictionary mapping language names to byte counts.
            """
            if self._repository.is_async:
                return asyncio.run(self._repository.get_languages_async())
            return self._repository.get_languages()
    
        def compare_branches(
            self,
            base: str,
            head: str,
            include_commits: bool = True,
            include_files: bool = True,
            include_stats: bool = True,
        ) -> dict[str, Any]:
            """Compare two branches.
    
            Default implementation using commit history comparison.
    
            Args:
                base: Base branch name
                head: Head branch name
                include_commits: Whether to include commit information
                include_files: Whether to include changed files
                include_stats: Whether to include statistics
    
            Returns:
                Dictionary containing comparison information
            """
            try:
                if self._repository.is_async:
                    return asyncio.run(
                        self._repository.compare_branches_async(
                            base, head, include_commits, include_files, include_stats
                        )
                    )
                return self._repository.compare_branches(
                    base, head, include_commits, include_files, include_stats
                )
            except NotImplementedError:
                # Get commits from both branches
                base_commits = {c.sha for c in self.list_commits(branch=base)}
                head_commits = self.list_commits(branch=head)
    
                # Find commits in head that aren't in base
                unique_commits = [c for c in head_commits if c.sha not in base_commits]
    
                result: dict[str, Any] = {"ahead_by": len(unique_commits)}
    
                if include_commits:
                    result["commits"] = unique_commits
    
                if include_files or include_stats:
                    # Get changed files by comparing each commit
                    all_changes: set[str] = set()
                    total_additions = 0
                    total_deletions = 0
    
                    for commit in unique_commits:
                        # This assumes repository provides file change info in commits
                        if hasattr(commit, "changed_files"):
                            all_changes.update(commit.changed_files)  # pyright: ignore  # ty: ignore[invalid-argument-type]
                        if hasattr(commit, "stats"):
                            total_additions += commit.stats.get("additions", 0)
                            total_deletions += commit.stats.get("deletions", 0)
    
                    if include_files:
                        result["files"] = sorted(all_changes)
    
                    if include_stats:
                        result["stats"] = {
                            "additions": total_additions,
                            "deletions": total_deletions,
                            "changes": len(all_changes),
                        }
    
                return result
    
        def get_latest_release(
            self,
            include_drafts: bool = False,
            include_prereleases: bool = False,
        ) -> Release:
            """Get latest release.
    
            Default implementation using list_releases.
    
            Args:
                include_drafts: Whether to include draft releases
                include_prereleases: Whether to include pre-releases
    
            Returns:
                Latest release information
    
            Raises:
                ResourceNotFoundError: If no matching releases are found
            """
            try:
                if self._repository.is_async:
                    return asyncio.run(
                        self._repository.get_latest_release_async(include_drafts, include_prereleases)
                    )
                return self._repository.get_latest_release(include_drafts, include_prereleases)
            except NotImplementedError as e:
                releases = self.list_releases(
                    include_drafts=include_drafts,
                    include_prereleases=include_prereleases,
                    limit=1,
                )
                if not releases:
                    msg = "No matching releases found"
                    raise ResourceNotFoundError(msg) from e
                return releases[0]
    
        def list_releases(
            self,
            include_drafts: bool = False,
            include_prereleases: bool = False,
            limit: int | None = None,
        ) -> list[Release]:
            """List releases.
    
            Args:
                include_drafts: Whether to include draft releases.
                include_prereleases: Whether to include pre-releases.
                limit: Maximum number of releases to return.
    
            Returns:
                List of releases.
            """
            if self._repository.is_async:
                return asyncio.run(
                    self._repository.list_releases_async(include_drafts, include_prereleases, limit)
                )
            return self._repository.list_releases(include_drafts, include_prereleases, limit)
    
        def get_release(self, tag: str) -> Release:
            """Get release by tag.
    
            Args:
                tag: Release tag name.
    
            Returns:
                Release information.
            """
            if self._repository.is_async:
                return asyncio.run(self._repository.get_release_async(tag))
            return self._repository.get_release(tag)
    
        def get_tag(self, name: str) -> Tag:
            """Get tag information.
    
            Args:
                name: Tag name.
    
            Returns:
                Tag information.
            """
            if self._repository.is_async:
                return asyncio.run(self._repository.get_tag_async(name))
            return self._repository.get_tag(name)
    
        def create_pull_request(
            self,
            title: str,
            body: str,
            head_branch: str,
            base_branch: str,
            draft: bool = False,
        ) -> PullRequest:
            """Create a new pull request.
    
            Args:
                title: Pull request title
                body: Pull request description
                head_branch: Source branch containing the changes
                base_branch: Target branch for the changes
                draft: Whether to create a draft pull request
    
            Returns:
                Newly created pull request
            """
            if self._repository.is_async:
                return asyncio.run(
                    self._repository.create_pull_request_async(
                        title=title,
                        body=body,
                        head_branch=head_branch,
                        base_branch=base_branch,
                        draft=draft,
                    )
                )
            return self._repository.create_pull_request(
                title=title,
                body=body,
                head_branch=head_branch,
                base_branch=base_branch,
                draft=draft,
            )
    
        def list_tags(self) -> list[Tag]:
            """List all tags.
    
            Returns:
                List of tags.
            """
            if self._repository.is_async:
                return asyncio.run(self._repository.list_tags_async())
            return self._repository.list_tags()
    
        def list_branches(self) -> list[Branch]:
            """List all branches in the repository.
    
            Returns:
                List of branches.
            """
            if self._repository.is_async:
                return asyncio.run(self._repository.list_branches_async())
            return self._repository.list_branches()
    
        def create_branch(
            self,
            name: str,
            base_commit: str,
        ) -> Branch:
            """Create a new branch at the specified commit.
    
            Args:
                name: Name of the branch to create
                base_commit: SHA of the commit to base the branch on
    
            Returns:
                Created branch
            """
            if self._repository.is_async:
                return asyncio.run(
                    self._repository.create_branch_async(
                        name=name,
                        base_commit=base_commit,
                    )
                )
            return self._repository.create_branch(
                name=name,
                base_commit=base_commit,
            )
    
        def add_pull_request_comment(
            self,
            number: int,
            body: str,
        ) -> Comment:
            """Add a general comment to a pull request.
    
            Args:
                number: Pull request number
                body: Comment text
    
            Returns:
                Created comment
            """
            if self._repository.is_async:
                return asyncio.run(self._repository.add_pull_request_comment_async(number, body))
            return self._repository.add_pull_request_comment(number, body)
    
        def add_pull_request_review_comment(
            self,
            number: int,
            body: str,
            commit_id: str,
            path: str,
            position: int,
        ) -> Comment:
            """Add a review comment to specific line in a pull request.
    
            Args:
                number: Pull request number
                body: Comment text
                commit_id: The SHA of the commit to comment on
                path: The relative path to the file to comment on
                position: Line number in the file to comment on
    
            Returns:
                Created comment
            """
            if self._repository.is_async:
                return asyncio.run(
                    self._repository.add_pull_request_review_comment_async(
                        number, body, commit_id, path, position
                    )
                )
            return self._repository.add_pull_request_review_comment(
                number, body, commit_id, path, position
            )
    
        def create_pull_request_from_diff(
            self,
            title: str,
            body: str,
            base_branch: str,
            diff: str,
            head_branch: str | None = None,
            draft: bool = False,
        ) -> PullRequest:
            """Create a pull request from a diff string.
    
            Args:
                title: Pull request title
                body: Pull request description
                base_branch: Target branch for the changes
                diff: Git diff string
                head_branch: Name of the branch to create. Auto-generated if not provided.
                draft: Whether to create a draft pull request
    
            Returns:
                Created pull request
            """
            if self._repository.is_async:
                return asyncio.run(
                    self._repository.create_pull_request_from_diff_async(
                        title=title,
                        body=body,
                        base_branch=base_branch,
                        diff=diff,
                        head_branch=head_branch,
                        draft=draft,
                    )
                )
            return self._repository.create_pull_request_from_diff(
                title=title,
                body=body,
                base_branch=base_branch,
                diff=diff,
                head_branch=head_branch,
                draft=draft,
            )
    
        def get_recent_activity(
            self,
            days: int = 30,
            include_commits: bool = True,
            include_prs: bool = True,
            include_issues: bool = True,
        ) -> dict[str, int]:
            """Get recent repository activity.
    
            This is a default implementation that composes results from other API calls.
            Repository implementations can override this if they have a more efficient way.
    
            Args:
                days: Number of days to look back.
                include_commits: Whether to include commit counts.
                include_prs: Whether to include PR counts.
                include_issues: Whether to include issue counts.
    
            Returns:
                Activity statistics with keys for 'commits', 'pull_requests', and 'issues'.
            """
            try:
                # First try the repository's native implementation
                return self._repository.get_recent_activity(  # ty: ignore[missing-attribute]
                    days, include_commits, include_prs, include_issues
                )
            except NotImplementedError, AttributeError:
                # Fall back to our composite implementation
                from datetime import UTC, datetime, timedelta
    
                since = datetime.now(UTC) - timedelta(days=days)
                activity: dict[str, int] = {}
    
                if include_commits:
                    commits = self.list_commits(since=since)
                    activity["commits"] = len(commits)
    
                if include_prs:
                    # Get all PRs and filter by update date
                    prs = self.list_pull_requests(state="all")
                    activity["pull_requests"] = sum(
                        1 for pr in prs if pr.updated_at and pr.updated_at >= since
                    )
    
                if include_issues:
                    # Get all issues and filter by update date
                    issues = self.list_issues(state="all")
                    activity["issues"] = sum(
                        1
                        for issue in issues
                        if issue.updated_at
                        and issue.updated_at >= since
                        and not hasattr(issue, "pull_request")  # Exclude PRs
                    )
    
                return activity
    
        async def get_repo_user_async(self) -> User:
            """See get_repo_user."""
            if self._repository.is_async:
                return await self._repository.get_repo_user_async()
            return await asyncio.to_thread(self._repository.get_repo_user)
    
        async def get_branch_async(self, name: str) -> Branch:
            """See get_branch."""
            if self._repository.is_async:
                return await self._repository.get_branch_async(name)
            return await asyncio.to_thread(self._repository.get_branch, name)
    
        async def get_pull_request_async(self, number: int) -> PullRequest:
            """See get_pull_request."""
            if self._repository.is_async:
                return await self._repository.get_pull_request_async(number)
            return await asyncio.to_thread(self._repository.get_pull_request, number)
    
        async def list_pull_requests_async(
            self,
            state: PullRequestState = "open",
        ) -> list[PullRequest]:
            """See list_pull_requests."""
            if self._repository.is_async:
                return await self._repository.list_pull_requests_async(state)
            return await asyncio.to_thread(self._repository.list_pull_requests, state)
    
        async def get_issue_async(self, issue_id: int) -> Issue:
            """See get_issue."""
            if self._repository.is_async:
                return await self._repository.get_issue_async(issue_id)
            return await asyncio.to_thread(self._repository.get_issue, issue_id)
    
        async def list_issues_async(self, state: IssueState = "open") -> list[Issue]:
            """See list_issues."""
            if self._repository.is_async:
                return await self._repository.list_issues_async(state)
            return await asyncio.to_thread(self._repository.list_issues, state)
    
        async def create_issue_async(
            self,
            title: str,
            body: str,
            labels: list[str] | None = None,
            assignees: list[str] | None = None,
        ) -> Issue:
            """See create_issue."""
            if self._repository.is_async:
                return await self._repository.create_issue_async(
                    title=title,
                    body=body,
                    labels=labels,
                    assignees=assignees,
                )
            return await asyncio.to_thread(
                self._repository.create_issue,
                title=title,
                body=body,
                labels=labels,
                assignees=assignees,
            )
    
        async def get_commit_async(self, sha: str) -> Commit:
            """See get_commit."""
            if self._repository.is_async:
                return await self._repository.get_commit_async(sha)
            return await asyncio.to_thread(self._repository.get_commit, sha)
    
        async def list_commits_async(
            self,
            branch: str | None = None,
            since: datetime | None = None,
            until: datetime | None = None,
            author: str | None = None,
            path: str | None = None,
            max_results: int | None = None,
        ) -> list[Commit]:
            """See list_commits."""
            if self._repository.is_async:
                return await self._repository.list_commits_async(
                    branch, since, until, author, path, max_results
                )
            return await asyncio.to_thread(
                self._repository.list_commits,
                branch,
                since,
                until,
                author,
                path,
                max_results,
            )
    
        async def get_workflow_async(self, workflow_id: str) -> Workflow:
            """See get_workflow."""
            if self._repository.is_async:
                return await self._repository.get_workflow_async(workflow_id)
            return await asyncio.to_thread(self._repository.get_workflow, workflow_id)
    
        async def list_workflows_async(self) -> list[Workflow]:
            """See list_workflows."""
            if self._repository.is_async:
                return await self._repository.list_workflows_async()
            return await asyncio.to_thread(self._repository.list_workflows)
    
        async def get_workflow_run_async(self, run_id: str) -> WorkflowRun:
            """See get_workflow_run."""
            if self._repository.is_async:
                return await self._repository.get_workflow_run_async(run_id)
            return await asyncio.to_thread(self._repository.get_workflow_run, run_id)
    
        async def download_async(
            self,
            path: str,
            destination: JoinablePathLike,
            recursive: bool = False,
        ) -> None:
            """See download."""
            if self._repository.is_async:
                await self._repository.download(path, destination, recursive)  # type: ignore
            await asyncio.to_thread(self._repository.download, path, destination, recursive)
    
        async def search_commits_async(
            self,
            query: str,
            branch: str | None = None,
            path: str | None = None,
            max_results: int | None = None,
        ) -> list[Commit]:
            """See search_commits."""
            if self._repository.is_async:
                return await self._repository.search_commits_async(query, branch, path, max_results)
            return await asyncio.to_thread(
                self._repository.search_commits, query, branch, path, max_results
            )
    
        async def get_contributors_async(
            self,
            sort_by: Literal["commits", "name", "date"] = "commits",
            limit: int | None = None,
        ) -> list[User]:
            """See get_contributors."""
            if self._repository.is_async:
                return await self._repository.get_contributors_async(sort_by, limit)
            return await asyncio.to_thread(self._repository.get_contributors, sort_by, limit)
    
        async def get_languages_async(self) -> dict[str, int]:
            """See get_languages."""
            if self._repository.is_async:
                return await self._repository.get_languages_async()
            return await asyncio.to_thread(self._repository.get_languages)
    
        async def compare_branches_async(
            self,
            base: str,
            head: str,
            include_commits: bool = True,
            include_files: bool = True,
            include_stats: bool = True,
        ) -> dict[str, Any]:
            """See compare_branches."""
            if self._repository.is_async:
                return await self._repository.compare_branches_async(
                    base, head, include_commits, include_files, include_stats
                )
            return await asyncio.to_thread(
                self._repository.compare_branches,
                base,
                head,
                include_commits,
                include_files,
                include_stats,
            )
    
        async def get_latest_release_async(
            self,
            include_drafts: bool = False,
            include_prereleases: bool = False,
        ) -> Release:
            """See get_latest_release."""
            if self._repository.is_async:
                return await self._repository.get_latest_release_async(
                    include_drafts, include_prereleases
                )
            return await asyncio.to_thread(
                self._repository.get_latest_release, include_drafts, include_prereleases
            )
    
        async def list_releases_async(
            self,
            include_drafts: bool = False,
            include_prereleases: bool = False,
            limit: int | None = None,
        ) -> list[Release]:
            """See list_releases."""
            if self._repository.is_async:
                return await self._repository.list_releases_async(
                    include_drafts, include_prereleases, limit
                )
            return await asyncio.to_thread(
                self._repository.list_releases, include_drafts, include_prereleases, limit
            )
    
        async def get_release_async(self, tag: str) -> Release:
            """See get_release."""
            if self._repository.is_async:
                return await self._repository.get_release_async(tag)
            return await asyncio.to_thread(self._repository.get_release, tag)
    
        async def get_tag_async(self, name: str) -> Tag:
            """See get_tag."""
            if self._repository.is_async:
                return await self._repository.get_tag_async(name)
            return await asyncio.to_thread(self._repository.get_tag, name)
    
        async def create_pull_request_async(
            self,
            title: str,
            body: str,
            head_branch: str,
            base_branch: str,
            draft: bool = False,
        ) -> PullRequest:
            """See create_pull_request."""
            if self._repository.is_async:
                return await self._repository.create_pull_request_async(
                    title=title,
                    body=body,
                    head_branch=head_branch,
                    base_branch=base_branch,
                    draft=draft,
                )
            return await asyncio.to_thread(
                self._repository.create_pull_request,
                title=title,
                body=body,
                head_branch=head_branch,
                base_branch=base_branch,
                draft=draft,
            )
    
        async def create_branch_async(
            self,
            name: str,
            base_commit: str,
        ) -> Branch:
            """Create a new branch at the specified commit asynchronously.
    
            Args:
                name: Name of the branch to create
                base_commit: SHA of the commit to base the branch on
    
            Returns:
                Created branch
            """
            if self._repository.is_async:
                return await self._repository.create_branch_async(
                    name=name,
                    base_commit=base_commit,
                )
            return await asyncio.to_thread(
                self._repository.create_branch,
                name=name,
                base_commit=base_commit,
            )
    
        async def list_tags_async(self) -> list[Tag]:
            """See list_tags."""
            if self._repository.is_async:
                return await self._repository.list_tags_async()
            return await asyncio.to_thread(self._repository.list_tags)
    
        async def list_branches_async(self) -> list[Branch]:
            """List all branches in the repository asynchronously.
    
            Returns:
                List of branches.
            """
            if self._repository.is_async:
                return await self._repository.list_branches_async()
            return await asyncio.to_thread(self._repository.list_branches)
    
        async def create_pull_request_from_diff_async(
            self,
            title: str,
            body: str,
            base_branch: str,
            diff: str,
            head_branch: str | None = None,
            draft: bool = False,
        ) -> PullRequest:
            """Create a pull request from a diff string asynchronously.
    
            Args:
                title: Pull request title
                body: Pull request description
                base_branch: Target branch for the changes
                diff: Git diff string
                head_branch: Name of the branch to create. Auto-generated if not provided.
                draft: Whether to create a draft pull request
    
            Returns:
                Created pull request
            """
            if self._repository.is_async:
                return await self._repository.create_pull_request_from_diff_async(
                    title=title,
                    body=body,
                    base_branch=base_branch,
                    diff=diff,
                    head_branch=head_branch,
                    draft=draft,
                )
            return await asyncio.to_thread(
                self._repository.create_pull_request_from_diff,
                title=title,
                body=body,
                base_branch=base_branch,
                diff=diff,
                head_branch=head_branch,
                draft=draft,
            )
    
        async def add_pull_request_comment_async(
            self,
            number: int,
            body: str,
        ) -> Comment:
            """See add_pull_request_comment."""
            if self._repository.is_async:
                return await self._repository.add_pull_request_comment_async(number, body)
            return await asyncio.to_thread(self._repository.add_pull_request_comment, number, body)
    
        async def add_pull_request_review_comment_async(
            self,
            number: int,
            body: str,
            commit_id: str,
            path: str,
            position: int,
        ) -> Comment:
            """See add_pull_request_review_comment."""
            if self._repository.is_async:
                return await self._repository.add_pull_request_review_comment_async(
                    number, body, commit_id, path, position
                )
            return await asyncio.to_thread(
                self._repository.add_pull_request_review_comment,
                number,
                body,
                commit_id,
                path,
                position,
            )
    
        def get_sync_methods(self) -> list[Callable]:
            """Return list of all synchronous methods."""
            return [
                self.get_repo_user,
                self.create_branch,
                self.get_branch,
                self.list_branches,
                self.create_pull_request,
                self.create_pull_request_from_diff,
                self.get_pull_request,
                self.list_pull_requests,
                self.get_issue,
                self.list_issues,
                self.create_issue,
                self.get_commit,
                self.list_commits,
                self.get_workflow,
                self.list_workflows,
                self.get_workflow_run,
                self.download,
                self.search_commits,
                self.get_contributors,
                self.add_pull_request_comment,
                self.add_pull_request_review_comment,
                self.get_languages,
                self.compare_branches,
                self.get_latest_release,
                self.list_releases,
                self.get_release,
                self.get_tag,
                self.list_tags,
            ]
    
        def get_async_methods(self) -> list[Callable]:
            """Return list of all asynchronous methods."""
            return [
                self.get_repo_user_async,
                self.create_branch_async,
                self.get_branch_async,
                self.list_branches_async,
                self.create_pull_request_async,
                self.create_pull_request_from_diff_async,
                self.get_pull_request_async,
                self.list_pull_requests_async,
                self.get_issue_async,
                self.list_issues_async,
                self.get_commit_async,
                self.create_issue_async,
                self.list_commits_async,
                self.get_workflow_async,
                self.list_workflows_async,
                self.get_workflow_run_async,
                self.download_async,
                self.search_commits_async,
                self.get_contributors_async,
                self.add_pull_request_comment_async,
                self.add_pull_request_review_comment_async,
                self.get_languages_async,
                self.compare_branches_async,
                self.get_latest_release_async,
                self.list_releases_async,
                self.get_release_async,
                self.get_tag_async,
                self.list_tags_async,
            ]
    

    default_branch property

    default_branch: str
    

    Return default branch name.

    Returns:

    Type Description
    str

    Name of the default branch.

    name property

    name: str
    

    Return repository name.

    Returns:

    Type Description
    str

    Name of the repository.

    __init__

    __init__(repository: BaseRepository) -> None
    

    Initialize proxy with repository instance.

    Parameters:

    Name Type Description Default
    repository BaseRepository

    Repository instance to forward calls to.

    required
    Source code in src/githarbor/core/proxy.py
    def __init__(self, repository: BaseRepository) -> None:
        """Initialize proxy with repository instance.
    
        Args:
            repository: Repository instance to forward calls to.
        """
        self._repository = repository
        self.repository_type = type(repository).__name__.removesuffix("Repository")
    

    add_pull_request_comment

    add_pull_request_comment(number: int, body: str) -> Comment
    

    Add a general comment to a pull request.

    Parameters:

    Name Type Description Default
    number int

    Pull request number

    required
    body str

    Comment text

    required

    Returns:

    Type Description
    Comment

    Created comment

    Source code in src/githarbor/core/proxy.py
    def add_pull_request_comment(
        self,
        number: int,
        body: str,
    ) -> Comment:
        """Add a general comment to a pull request.
    
        Args:
            number: Pull request number
            body: Comment text
    
        Returns:
            Created comment
        """
        if self._repository.is_async:
            return asyncio.run(self._repository.add_pull_request_comment_async(number, body))
        return self._repository.add_pull_request_comment(number, body)
    

    add_pull_request_comment_async async

    add_pull_request_comment_async(number: int, body: str) -> Comment
    

    See add_pull_request_comment.

    Source code in src/githarbor/core/proxy.py
    async def add_pull_request_comment_async(
        self,
        number: int,
        body: str,
    ) -> Comment:
        """See add_pull_request_comment."""
        if self._repository.is_async:
            return await self._repository.add_pull_request_comment_async(number, body)
        return await asyncio.to_thread(self._repository.add_pull_request_comment, number, body)
    

    add_pull_request_review_comment

    add_pull_request_review_comment(
        number: int, body: str, commit_id: str, path: str, position: int
    ) -> Comment
    

    Add a review comment to specific line in a pull request.

    Parameters:

    Name Type Description Default
    number int

    Pull request number

    required
    body str

    Comment text

    required
    commit_id str

    The SHA of the commit to comment on

    required
    path str

    The relative path to the file to comment on

    required
    position int

    Line number in the file to comment on

    required

    Returns:

    Type Description
    Comment

    Created comment

    Source code in src/githarbor/core/proxy.py
    def add_pull_request_review_comment(
        self,
        number: int,
        body: str,
        commit_id: str,
        path: str,
        position: int,
    ) -> Comment:
        """Add a review comment to specific line in a pull request.
    
        Args:
            number: Pull request number
            body: Comment text
            commit_id: The SHA of the commit to comment on
            path: The relative path to the file to comment on
            position: Line number in the file to comment on
    
        Returns:
            Created comment
        """
        if self._repository.is_async:
            return asyncio.run(
                self._repository.add_pull_request_review_comment_async(
                    number, body, commit_id, path, position
                )
            )
        return self._repository.add_pull_request_review_comment(
            number, body, commit_id, path, position
        )
    

    add_pull_request_review_comment_async async

    add_pull_request_review_comment_async(
        number: int, body: str, commit_id: str, path: str, position: int
    ) -> Comment
    

    See add_pull_request_review_comment.

    Source code in src/githarbor/core/proxy.py
    async def add_pull_request_review_comment_async(
        self,
        number: int,
        body: str,
        commit_id: str,
        path: str,
        position: int,
    ) -> Comment:
        """See add_pull_request_review_comment."""
        if self._repository.is_async:
            return await self._repository.add_pull_request_review_comment_async(
                number, body, commit_id, path, position
            )
        return await asyncio.to_thread(
            self._repository.add_pull_request_review_comment,
            number,
            body,
            commit_id,
            path,
            position,
        )
    

    compare_branches

    compare_branches(
        base: str,
        head: str,
        include_commits: bool = True,
        include_files: bool = True,
        include_stats: bool = True,
    ) -> dict[str, Any]
    

    Compare two branches.

    Default implementation using commit history comparison.

    Parameters:

    Name Type Description Default
    base str

    Base branch name

    required
    head str

    Head branch name

    required
    include_commits bool

    Whether to include commit information

    True
    include_files bool

    Whether to include changed files

    True
    include_stats bool

    Whether to include statistics

    True

    Returns:

    Type Description
    dict[str, Any]

    Dictionary containing comparison information

    Source code in src/githarbor/core/proxy.py
    def compare_branches(
        self,
        base: str,
        head: str,
        include_commits: bool = True,
        include_files: bool = True,
        include_stats: bool = True,
    ) -> dict[str, Any]:
        """Compare two branches.
    
        Default implementation using commit history comparison.
    
        Args:
            base: Base branch name
            head: Head branch name
            include_commits: Whether to include commit information
            include_files: Whether to include changed files
            include_stats: Whether to include statistics
    
        Returns:
            Dictionary containing comparison information
        """
        try:
            if self._repository.is_async:
                return asyncio.run(
                    self._repository.compare_branches_async(
                        base, head, include_commits, include_files, include_stats
                    )
                )
            return self._repository.compare_branches(
                base, head, include_commits, include_files, include_stats
            )
        except NotImplementedError:
            # Get commits from both branches
            base_commits = {c.sha for c in self.list_commits(branch=base)}
            head_commits = self.list_commits(branch=head)
    
            # Find commits in head that aren't in base
            unique_commits = [c for c in head_commits if c.sha not in base_commits]
    
            result: dict[str, Any] = {"ahead_by": len(unique_commits)}
    
            if include_commits:
                result["commits"] = unique_commits
    
            if include_files or include_stats:
                # Get changed files by comparing each commit
                all_changes: set[str] = set()
                total_additions = 0
                total_deletions = 0
    
                for commit in unique_commits:
                    # This assumes repository provides file change info in commits
                    if hasattr(commit, "changed_files"):
                        all_changes.update(commit.changed_files)  # pyright: ignore  # ty: ignore[invalid-argument-type]
                    if hasattr(commit, "stats"):
                        total_additions += commit.stats.get("additions", 0)
                        total_deletions += commit.stats.get("deletions", 0)
    
                if include_files:
                    result["files"] = sorted(all_changes)
    
                if include_stats:
                    result["stats"] = {
                        "additions": total_additions,
                        "deletions": total_deletions,
                        "changes": len(all_changes),
                    }
    
            return result
    

    compare_branches_async async

    compare_branches_async(
        base: str,
        head: str,
        include_commits: bool = True,
        include_files: bool = True,
        include_stats: bool = True,
    ) -> dict[str, Any]
    

    See compare_branches.

    Source code in src/githarbor/core/proxy.py
    async def compare_branches_async(
        self,
        base: str,
        head: str,
        include_commits: bool = True,
        include_files: bool = True,
        include_stats: bool = True,
    ) -> dict[str, Any]:
        """See compare_branches."""
        if self._repository.is_async:
            return await self._repository.compare_branches_async(
                base, head, include_commits, include_files, include_stats
            )
        return await asyncio.to_thread(
            self._repository.compare_branches,
            base,
            head,
            include_commits,
            include_files,
            include_stats,
        )
    

    create_branch

    create_branch(name: str, base_commit: str) -> Branch
    

    Create a new branch at the specified commit.

    Parameters:

    Name Type Description Default
    name str

    Name of the branch to create

    required
    base_commit str

    SHA of the commit to base the branch on

    required

    Returns:

    Type Description
    Branch

    Created branch

    Source code in src/githarbor/core/proxy.py
    def create_branch(
        self,
        name: str,
        base_commit: str,
    ) -> Branch:
        """Create a new branch at the specified commit.
    
        Args:
            name: Name of the branch to create
            base_commit: SHA of the commit to base the branch on
    
        Returns:
            Created branch
        """
        if self._repository.is_async:
            return asyncio.run(
                self._repository.create_branch_async(
                    name=name,
                    base_commit=base_commit,
                )
            )
        return self._repository.create_branch(
            name=name,
            base_commit=base_commit,
        )
    

    create_branch_async async

    create_branch_async(name: str, base_commit: str) -> Branch
    

    Create a new branch at the specified commit asynchronously.

    Parameters:

    Name Type Description Default
    name str

    Name of the branch to create

    required
    base_commit str

    SHA of the commit to base the branch on

    required

    Returns:

    Type Description
    Branch

    Created branch

    Source code in src/githarbor/core/proxy.py
    async def create_branch_async(
        self,
        name: str,
        base_commit: str,
    ) -> Branch:
        """Create a new branch at the specified commit asynchronously.
    
        Args:
            name: Name of the branch to create
            base_commit: SHA of the commit to base the branch on
    
        Returns:
            Created branch
        """
        if self._repository.is_async:
            return await self._repository.create_branch_async(
                name=name,
                base_commit=base_commit,
            )
        return await asyncio.to_thread(
            self._repository.create_branch,
            name=name,
            base_commit=base_commit,
        )
    

    create_issue

    create_issue(
        title: str, body: str, labels: list[str] | None = None, assignees: list[str] | None = None
    ) -> Issue
    

    Create an issue.

    Parameters:

    Name Type Description Default
    title str

    Issue title

    required
    body str

    Issue description/content

    required
    labels list[str] | None

    List of label names to apply

    None
    assignees list[str] | None

    List of usernames to assign

    None

    Returns:

    Type Description
    Issue

    Created issue

    Source code in src/githarbor/core/proxy.py
    def create_issue(
        self,
        title: str,
        body: str,
        labels: list[str] | None = None,
        assignees: list[str] | None = None,
    ) -> Issue:
        """Create an issue.
    
        Args:
            title: Issue title
            body: Issue description/content
            labels: List of label names to apply
            assignees: List of usernames to assign
    
        Returns:
            Created issue
        """
        if self._repository.is_async:
            return asyncio.run(
                self._repository.create_issue_async(
                    title=title,
                    body=body,
                    labels=labels,
                    assignees=assignees,
                )
            )
        return self._repository.create_issue(
            title=title,
            body=body,
            labels=labels,
            assignees=assignees,
        )
    

    create_issue_async async

    create_issue_async(
        title: str, body: str, labels: list[str] | None = None, assignees: list[str] | None = None
    ) -> Issue
    

    See create_issue.

    Source code in src/githarbor/core/proxy.py
    async def create_issue_async(
        self,
        title: str,
        body: str,
        labels: list[str] | None = None,
        assignees: list[str] | None = None,
    ) -> Issue:
        """See create_issue."""
        if self._repository.is_async:
            return await self._repository.create_issue_async(
                title=title,
                body=body,
                labels=labels,
                assignees=assignees,
            )
        return await asyncio.to_thread(
            self._repository.create_issue,
            title=title,
            body=body,
            labels=labels,
            assignees=assignees,
        )
    

    create_pull_request

    create_pull_request(
        title: str, body: str, head_branch: str, base_branch: str, draft: bool = False
    ) -> PullRequest
    

    Create a new pull request.

    Parameters:

    Name Type Description Default
    title str

    Pull request title

    required
    body str

    Pull request description

    required
    head_branch str

    Source branch containing the changes

    required
    base_branch str

    Target branch for the changes

    required
    draft bool

    Whether to create a draft pull request

    False

    Returns:

    Type Description
    PullRequest

    Newly created pull request

    Source code in src/githarbor/core/proxy.py
    def create_pull_request(
        self,
        title: str,
        body: str,
        head_branch: str,
        base_branch: str,
        draft: bool = False,
    ) -> PullRequest:
        """Create a new pull request.
    
        Args:
            title: Pull request title
            body: Pull request description
            head_branch: Source branch containing the changes
            base_branch: Target branch for the changes
            draft: Whether to create a draft pull request
    
        Returns:
            Newly created pull request
        """
        if self._repository.is_async:
            return asyncio.run(
                self._repository.create_pull_request_async(
                    title=title,
                    body=body,
                    head_branch=head_branch,
                    base_branch=base_branch,
                    draft=draft,
                )
            )
        return self._repository.create_pull_request(
            title=title,
            body=body,
            head_branch=head_branch,
            base_branch=base_branch,
            draft=draft,
        )
    

    create_pull_request_async async

    create_pull_request_async(
        title: str, body: str, head_branch: str, base_branch: str, draft: bool = False
    ) -> PullRequest
    

    See create_pull_request.

    Source code in src/githarbor/core/proxy.py
    async def create_pull_request_async(
        self,
        title: str,
        body: str,
        head_branch: str,
        base_branch: str,
        draft: bool = False,
    ) -> PullRequest:
        """See create_pull_request."""
        if self._repository.is_async:
            return await self._repository.create_pull_request_async(
                title=title,
                body=body,
                head_branch=head_branch,
                base_branch=base_branch,
                draft=draft,
            )
        return await asyncio.to_thread(
            self._repository.create_pull_request,
            title=title,
            body=body,
            head_branch=head_branch,
            base_branch=base_branch,
            draft=draft,
        )
    

    create_pull_request_from_diff

    create_pull_request_from_diff(
        title: str,
        body: str,
        base_branch: str,
        diff: str,
        head_branch: str | None = None,
        draft: bool = False,
    ) -> PullRequest
    

    Create a pull request from a diff string.

    Parameters:

    Name Type Description Default
    title str

    Pull request title

    required
    body str

    Pull request description

    required
    base_branch str

    Target branch for the changes

    required
    diff str

    Git diff string

    required
    head_branch str | None

    Name of the branch to create. Auto-generated if not provided.

    None
    draft bool

    Whether to create a draft pull request

    False

    Returns:

    Type Description
    PullRequest

    Created pull request

    Source code in src/githarbor/core/proxy.py
    def create_pull_request_from_diff(
        self,
        title: str,
        body: str,
        base_branch: str,
        diff: str,
        head_branch: str | None = None,
        draft: bool = False,
    ) -> PullRequest:
        """Create a pull request from a diff string.
    
        Args:
            title: Pull request title
            body: Pull request description
            base_branch: Target branch for the changes
            diff: Git diff string
            head_branch: Name of the branch to create. Auto-generated if not provided.
            draft: Whether to create a draft pull request
    
        Returns:
            Created pull request
        """
        if self._repository.is_async:
            return asyncio.run(
                self._repository.create_pull_request_from_diff_async(
                    title=title,
                    body=body,
                    base_branch=base_branch,
                    diff=diff,
                    head_branch=head_branch,
                    draft=draft,
                )
            )
        return self._repository.create_pull_request_from_diff(
            title=title,
            body=body,
            base_branch=base_branch,
            diff=diff,
            head_branch=head_branch,
            draft=draft,
        )
    

    create_pull_request_from_diff_async async

    create_pull_request_from_diff_async(
        title: str,
        body: str,
        base_branch: str,
        diff: str,
        head_branch: str | None = None,
        draft: bool = False,
    ) -> PullRequest
    

    Create a pull request from a diff string asynchronously.

    Parameters:

    Name Type Description Default
    title str

    Pull request title

    required
    body str

    Pull request description

    required
    base_branch str

    Target branch for the changes

    required
    diff str

    Git diff string

    required
    head_branch str | None

    Name of the branch to create. Auto-generated if not provided.

    None
    draft bool

    Whether to create a draft pull request

    False

    Returns:

    Type Description
    PullRequest

    Created pull request

    Source code in src/githarbor/core/proxy.py
    async def create_pull_request_from_diff_async(
        self,
        title: str,
        body: str,
        base_branch: str,
        diff: str,
        head_branch: str | None = None,
        draft: bool = False,
    ) -> PullRequest:
        """Create a pull request from a diff string asynchronously.
    
        Args:
            title: Pull request title
            body: Pull request description
            base_branch: Target branch for the changes
            diff: Git diff string
            head_branch: Name of the branch to create. Auto-generated if not provided.
            draft: Whether to create a draft pull request
    
        Returns:
            Created pull request
        """
        if self._repository.is_async:
            return await self._repository.create_pull_request_from_diff_async(
                title=title,
                body=body,
                base_branch=base_branch,
                diff=diff,
                head_branch=head_branch,
                draft=draft,
            )
        return await asyncio.to_thread(
            self._repository.create_pull_request_from_diff,
            title=title,
            body=body,
            base_branch=base_branch,
            diff=diff,
            head_branch=head_branch,
            draft=draft,
        )
    

    download

    download(path: str, destination: JoinablePathLike, recursive: bool = False)
    

    Download repository content.

    Parameters:

    Name Type Description Default
    path str

    Path to download.

    required
    destination JoinablePathLike

    Where to save the downloaded content.

    required
    recursive bool

    Whether to download recursively.

    False
    Source code in src/githarbor/core/proxy.py
    def download(self, path: str, destination: JoinablePathLike, recursive: bool = False):
        """Download repository content.
    
        Args:
            path: Path to download.
            destination: Where to save the downloaded content.
            recursive: Whether to download recursively.
        """
        if self._repository.is_async:
            return asyncio.run(self._repository.download_async(path, destination, recursive))
        return self._repository.download(path, destination, recursive)
    

    download_async async

    download_async(path: str, destination: JoinablePathLike, recursive: bool = False) -> None
    

    See download.

    Source code in src/githarbor/core/proxy.py
    async def download_async(
        self,
        path: str,
        destination: JoinablePathLike,
        recursive: bool = False,
    ) -> None:
        """See download."""
        if self._repository.is_async:
            await self._repository.download(path, destination, recursive)  # type: ignore
        await asyncio.to_thread(self._repository.download, path, destination, recursive)
    

    get_async_methods

    get_async_methods() -> list[Callable]
    

    Return list of all asynchronous methods.

    Source code in src/githarbor/core/proxy.py
    def get_async_methods(self) -> list[Callable]:
        """Return list of all asynchronous methods."""
        return [
            self.get_repo_user_async,
            self.create_branch_async,
            self.get_branch_async,
            self.list_branches_async,
            self.create_pull_request_async,
            self.create_pull_request_from_diff_async,
            self.get_pull_request_async,
            self.list_pull_requests_async,
            self.get_issue_async,
            self.list_issues_async,
            self.get_commit_async,
            self.create_issue_async,
            self.list_commits_async,
            self.get_workflow_async,
            self.list_workflows_async,
            self.get_workflow_run_async,
            self.download_async,
            self.search_commits_async,
            self.get_contributors_async,
            self.add_pull_request_comment_async,
            self.add_pull_request_review_comment_async,
            self.get_languages_async,
            self.compare_branches_async,
            self.get_latest_release_async,
            self.list_releases_async,
            self.get_release_async,
            self.get_tag_async,
            self.list_tags_async,
        ]
    

    get_branch

    get_branch(name: str) -> Branch
    

    Get information about a specific branch.

    Parameters:

    Name Type Description Default
    name str

    Name of the branch.

    required

    Returns:

    Type Description
    Branch

    Branch information.

    Source code in src/githarbor/core/proxy.py
    def get_branch(self, name: str) -> Branch:
        """Get information about a specific branch.
    
        Args:
            name: Name of the branch.
    
        Returns:
            Branch information.
        """
        if self._repository.is_async:
            return asyncio.run(self._repository.get_branch_async(name))
        return self._repository.get_branch(name)
    

    get_branch_async async

    get_branch_async(name: str) -> Branch
    

    See get_branch.

    Source code in src/githarbor/core/proxy.py
    async def get_branch_async(self, name: str) -> Branch:
        """See get_branch."""
        if self._repository.is_async:
            return await self._repository.get_branch_async(name)
        return await asyncio.to_thread(self._repository.get_branch, name)
    

    get_commit

    get_commit(sha: str) -> Commit
    

    Get information about a specific commit.

    Parameters:

    Name Type Description Default
    sha str

    Commit SHA.

    required

    Returns:

    Type Description
    Commit

    Commit information.

    Source code in src/githarbor/core/proxy.py
    def get_commit(self, sha: str) -> Commit:
        """Get information about a specific commit.
    
        Args:
            sha: Commit SHA.
    
        Returns:
            Commit information.
        """
        if self._repository.is_async:
            return asyncio.run(self._repository.get_commit_async(sha))
        return self._repository.get_commit(sha)
    

    get_commit_async async

    get_commit_async(sha: str) -> Commit
    

    See get_commit.

    Source code in src/githarbor/core/proxy.py
    async def get_commit_async(self, sha: str) -> Commit:
        """See get_commit."""
        if self._repository.is_async:
            return await self._repository.get_commit_async(sha)
        return await asyncio.to_thread(self._repository.get_commit, sha)
    

    get_contributors

    get_contributors(
        sort_by: Literal["commits", "name", "date"] = "commits", limit: int | None = None
    ) -> list[User]
    

    Get repository contributors.

    Parameters:

    Name Type Description Default
    sort_by Literal['commits', 'name', 'date']

    How to sort contributors.

    'commits'
    limit int | None

    Maximum number of contributors to return.

    None

    Returns:

    Type Description
    list[User]

    List of contributors.

    Source code in src/githarbor/core/proxy.py
    def get_contributors(
        self,
        sort_by: Literal["commits", "name", "date"] = "commits",
        limit: int | None = None,
    ) -> list[User]:
        """Get repository contributors.
    
        Args:
            sort_by: How to sort contributors.
            limit: Maximum number of contributors to return.
    
        Returns:
            List of contributors.
        """
        if self._repository.is_async:
            return asyncio.run(self._repository.get_contributors_async(sort_by, limit))
        return self._repository.get_contributors(sort_by, limit)
    

    get_contributors_async async

    get_contributors_async(
        sort_by: Literal["commits", "name", "date"] = "commits", limit: int | None = None
    ) -> list[User]
    

    See get_contributors.

    Source code in src/githarbor/core/proxy.py
    async def get_contributors_async(
        self,
        sort_by: Literal["commits", "name", "date"] = "commits",
        limit: int | None = None,
    ) -> list[User]:
        """See get_contributors."""
        if self._repository.is_async:
            return await self._repository.get_contributors_async(sort_by, limit)
        return await asyncio.to_thread(self._repository.get_contributors, sort_by, limit)
    

    get_issue

    get_issue(issue_id: int) -> Issue
    

    Get information about a specific issue.

    Parameters:

    Name Type Description Default
    issue_id int

    Issue number.

    required

    Returns:

    Type Description
    Issue

    Issue information.

    Source code in src/githarbor/core/proxy.py
    def get_issue(self, issue_id: int) -> Issue:
        """Get information about a specific issue.
    
        Args:
            issue_id: Issue number.
    
        Returns:
            Issue information.
        """
        if self._repository.is_async:
            return asyncio.run(self._repository.get_issue_async(issue_id))
        return self._repository.get_issue(issue_id)
    

    get_issue_async async

    get_issue_async(issue_id: int) -> Issue
    

    See get_issue.

    Source code in src/githarbor/core/proxy.py
    async def get_issue_async(self, issue_id: int) -> Issue:
        """See get_issue."""
        if self._repository.is_async:
            return await self._repository.get_issue_async(issue_id)
        return await asyncio.to_thread(self._repository.get_issue, issue_id)
    

    get_languages

    get_languages() -> dict[str, int]
    

    Get repository language statistics.

    Returns:

    Type Description
    dict[str, int]

    Dictionary mapping language names to byte counts.

    Source code in src/githarbor/core/proxy.py
    def get_languages(self) -> dict[str, int]:
        """Get repository language statistics.
    
        Returns:
            Dictionary mapping language names to byte counts.
        """
        if self._repository.is_async:
            return asyncio.run(self._repository.get_languages_async())
        return self._repository.get_languages()
    

    get_languages_async async

    get_languages_async() -> dict[str, int]
    

    See get_languages.

    Source code in src/githarbor/core/proxy.py
    async def get_languages_async(self) -> dict[str, int]:
        """See get_languages."""
        if self._repository.is_async:
            return await self._repository.get_languages_async()
        return await asyncio.to_thread(self._repository.get_languages)
    

    get_latest_release

    get_latest_release(include_drafts: bool = False, include_prereleases: bool = False) -> Release
    

    Get latest release.

    Default implementation using list_releases.

    Parameters:

    Name Type Description Default
    include_drafts bool

    Whether to include draft releases

    False
    include_prereleases bool

    Whether to include pre-releases

    False

    Returns:

    Type Description
    Release

    Latest release information

    Raises:

    Type Description
    ResourceNotFoundError

    If no matching releases are found

    Source code in src/githarbor/core/proxy.py
    def get_latest_release(
        self,
        include_drafts: bool = False,
        include_prereleases: bool = False,
    ) -> Release:
        """Get latest release.
    
        Default implementation using list_releases.
    
        Args:
            include_drafts: Whether to include draft releases
            include_prereleases: Whether to include pre-releases
    
        Returns:
            Latest release information
    
        Raises:
            ResourceNotFoundError: If no matching releases are found
        """
        try:
            if self._repository.is_async:
                return asyncio.run(
                    self._repository.get_latest_release_async(include_drafts, include_prereleases)
                )
            return self._repository.get_latest_release(include_drafts, include_prereleases)
        except NotImplementedError as e:
            releases = self.list_releases(
                include_drafts=include_drafts,
                include_prereleases=include_prereleases,
                limit=1,
            )
            if not releases:
                msg = "No matching releases found"
                raise ResourceNotFoundError(msg) from e
            return releases[0]
    

    get_latest_release_async async

    get_latest_release_async(
        include_drafts: bool = False, include_prereleases: bool = False
    ) -> Release
    

    See get_latest_release.

    Source code in src/githarbor/core/proxy.py
    async def get_latest_release_async(
        self,
        include_drafts: bool = False,
        include_prereleases: bool = False,
    ) -> Release:
        """See get_latest_release."""
        if self._repository.is_async:
            return await self._repository.get_latest_release_async(
                include_drafts, include_prereleases
            )
        return await asyncio.to_thread(
            self._repository.get_latest_release, include_drafts, include_prereleases
        )
    

    get_pull_request

    get_pull_request(number: int) -> PullRequest
    

    Get information about a specific pull request.

    Parameters:

    Name Type Description Default
    number int

    PR number.

    required

    Returns:

    Type Description
    PullRequest

    Pull request information.

    Source code in src/githarbor/core/proxy.py
    def get_pull_request(self, number: int) -> PullRequest:
        """Get information about a specific pull request.
    
        Args:
            number: PR number.
    
        Returns:
            Pull request information.
        """
        if self._repository.is_async:
            return asyncio.run(self._repository.get_pull_request_async(number))
        return self._repository.get_pull_request(number)
    

    get_pull_request_async async

    get_pull_request_async(number: int) -> PullRequest
    

    See get_pull_request.

    Source code in src/githarbor/core/proxy.py
    async def get_pull_request_async(self, number: int) -> PullRequest:
        """See get_pull_request."""
        if self._repository.is_async:
            return await self._repository.get_pull_request_async(number)
        return await asyncio.to_thread(self._repository.get_pull_request, number)
    

    get_recent_activity

    get_recent_activity(
        days: int = 30,
        include_commits: bool = True,
        include_prs: bool = True,
        include_issues: bool = True,
    ) -> dict[str, int]
    

    Get recent repository activity.

    This is a default implementation that composes results from other API calls. Repository implementations can override this if they have a more efficient way.

    Parameters:

    Name Type Description Default
    days int

    Number of days to look back.

    30
    include_commits bool

    Whether to include commit counts.

    True
    include_prs bool

    Whether to include PR counts.

    True
    include_issues bool

    Whether to include issue counts.

    True

    Returns:

    Type Description
    dict[str, int]

    Activity statistics with keys for 'commits', 'pull_requests', and 'issues'.

    Source code in src/githarbor/core/proxy.py
    def get_recent_activity(
        self,
        days: int = 30,
        include_commits: bool = True,
        include_prs: bool = True,
        include_issues: bool = True,
    ) -> dict[str, int]:
        """Get recent repository activity.
    
        This is a default implementation that composes results from other API calls.
        Repository implementations can override this if they have a more efficient way.
    
        Args:
            days: Number of days to look back.
            include_commits: Whether to include commit counts.
            include_prs: Whether to include PR counts.
            include_issues: Whether to include issue counts.
    
        Returns:
            Activity statistics with keys for 'commits', 'pull_requests', and 'issues'.
        """
        try:
            # First try the repository's native implementation
            return self._repository.get_recent_activity(  # ty: ignore[missing-attribute]
                days, include_commits, include_prs, include_issues
            )
        except NotImplementedError, AttributeError:
            # Fall back to our composite implementation
            from datetime import UTC, datetime, timedelta
    
            since = datetime.now(UTC) - timedelta(days=days)
            activity: dict[str, int] = {}
    
            if include_commits:
                commits = self.list_commits(since=since)
                activity["commits"] = len(commits)
    
            if include_prs:
                # Get all PRs and filter by update date
                prs = self.list_pull_requests(state="all")
                activity["pull_requests"] = sum(
                    1 for pr in prs if pr.updated_at and pr.updated_at >= since
                )
    
            if include_issues:
                # Get all issues and filter by update date
                issues = self.list_issues(state="all")
                activity["issues"] = sum(
                    1
                    for issue in issues
                    if issue.updated_at
                    and issue.updated_at >= since
                    and not hasattr(issue, "pull_request")  # Exclude PRs
                )
    
            return activity
    

    get_release

    get_release(tag: str) -> Release
    

    Get release by tag.

    Parameters:

    Name Type Description Default
    tag str

    Release tag name.

    required

    Returns:

    Type Description
    Release

    Release information.

    Source code in src/githarbor/core/proxy.py
    def get_release(self, tag: str) -> Release:
        """Get release by tag.
    
        Args:
            tag: Release tag name.
    
        Returns:
            Release information.
        """
        if self._repository.is_async:
            return asyncio.run(self._repository.get_release_async(tag))
        return self._repository.get_release(tag)
    

    get_release_async async

    get_release_async(tag: str) -> Release
    

    See get_release.

    Source code in src/githarbor/core/proxy.py
    async def get_release_async(self, tag: str) -> Release:
        """See get_release."""
        if self._repository.is_async:
            return await self._repository.get_release_async(tag)
        return await asyncio.to_thread(self._repository.get_release, tag)
    

    get_repo_user

    get_repo_user() -> User
    

    Get information about the repository user.

    Returns:

    Type Description
    User

    User information.

    Source code in src/githarbor/core/proxy.py
    def get_repo_user(self) -> User:
        """Get information about the repository user.
    
        Returns:
            User information.
        """
        if self._repository.is_async:
            return asyncio.run(self._repository.get_repo_user_async())
        return self._repository.get_repo_user()
    

    get_repo_user_async async

    get_repo_user_async() -> User
    

    See get_repo_user.

    Source code in src/githarbor/core/proxy.py
    async def get_repo_user_async(self) -> User:
        """See get_repo_user."""
        if self._repository.is_async:
            return await self._repository.get_repo_user_async()
        return await asyncio.to_thread(self._repository.get_repo_user)
    

    get_sync_methods

    get_sync_methods() -> list[Callable]
    

    Return list of all synchronous methods.

    Source code in src/githarbor/core/proxy.py
    def get_sync_methods(self) -> list[Callable]:
        """Return list of all synchronous methods."""
        return [
            self.get_repo_user,
            self.create_branch,
            self.get_branch,
            self.list_branches,
            self.create_pull_request,
            self.create_pull_request_from_diff,
            self.get_pull_request,
            self.list_pull_requests,
            self.get_issue,
            self.list_issues,
            self.create_issue,
            self.get_commit,
            self.list_commits,
            self.get_workflow,
            self.list_workflows,
            self.get_workflow_run,
            self.download,
            self.search_commits,
            self.get_contributors,
            self.add_pull_request_comment,
            self.add_pull_request_review_comment,
            self.get_languages,
            self.compare_branches,
            self.get_latest_release,
            self.list_releases,
            self.get_release,
            self.get_tag,
            self.list_tags,
        ]
    

    get_tag

    get_tag(name: str) -> Tag
    

    Get tag information.

    Parameters:

    Name Type Description Default
    name str

    Tag name.

    required

    Returns:

    Type Description
    Tag

    Tag information.

    Source code in src/githarbor/core/proxy.py
    def get_tag(self, name: str) -> Tag:
        """Get tag information.
    
        Args:
            name: Tag name.
    
        Returns:
            Tag information.
        """
        if self._repository.is_async:
            return asyncio.run(self._repository.get_tag_async(name))
        return self._repository.get_tag(name)
    

    get_tag_async async

    get_tag_async(name: str) -> Tag
    

    See get_tag.

    Source code in src/githarbor/core/proxy.py
    async def get_tag_async(self, name: str) -> Tag:
        """See get_tag."""
        if self._repository.is_async:
            return await self._repository.get_tag_async(name)
        return await asyncio.to_thread(self._repository.get_tag, name)
    

    get_workflow

    get_workflow(workflow_id: str) -> Workflow
    

    Get information about a specific workflow.

    Parameters:

    Name Type Description Default
    workflow_id str

    Workflow ID.

    required

    Returns:

    Type Description
    Workflow

    Workflow information.

    Source code in src/githarbor/core/proxy.py
    def get_workflow(self, workflow_id: str) -> Workflow:
        """Get information about a specific workflow.
    
        Args:
            workflow_id: Workflow ID.
    
        Returns:
            Workflow information.
        """
        if self._repository.is_async:
            return asyncio.run(self._repository.get_workflow_async(workflow_id))
        return self._repository.get_workflow(workflow_id)
    

    get_workflow_async async

    get_workflow_async(workflow_id: str) -> Workflow
    

    See get_workflow.

    Source code in src/githarbor/core/proxy.py
    async def get_workflow_async(self, workflow_id: str) -> Workflow:
        """See get_workflow."""
        if self._repository.is_async:
            return await self._repository.get_workflow_async(workflow_id)
        return await asyncio.to_thread(self._repository.get_workflow, workflow_id)
    

    get_workflow_run

    get_workflow_run(run_id: str) -> WorkflowRun
    

    Get information about a specific workflow run.

    Parameters:

    Name Type Description Default
    run_id str

    Workflow run ID.

    required

    Returns:

    Type Description
    WorkflowRun

    Workflow run information.

    Source code in src/githarbor/core/proxy.py
    def get_workflow_run(self, run_id: str) -> WorkflowRun:
        """Get information about a specific workflow run.
    
        Args:
            run_id: Workflow run ID.
    
        Returns:
            Workflow run information.
        """
        if self._repository.is_async:
            return asyncio.run(self._repository.get_workflow_run_async(run_id))
        return self._repository.get_workflow_run(run_id)
    

    get_workflow_run_async async

    get_workflow_run_async(run_id: str) -> WorkflowRun
    

    See get_workflow_run.

    Source code in src/githarbor/core/proxy.py
    async def get_workflow_run_async(self, run_id: str) -> WorkflowRun:
        """See get_workflow_run."""
        if self._repository.is_async:
            return await self._repository.get_workflow_run_async(run_id)
        return await asyncio.to_thread(self._repository.get_workflow_run, run_id)
    

    iter_files

    iter_files(path: str = '', ref: str | None = None, pattern: str | None = None) -> Iterator[str]
    

    Iterate over repository files.

    Default implementation using recursive directory traversal.

    Parameters:

    Name Type Description Default
    path str

    Base path to start from

    ''
    ref str | None

    Git reference (branch/tag/commit)

    None
    pattern str | None

    File pattern to match

    None

    Yields:

    Type Description
    str

    File paths

    Source code in src/githarbor/core/proxy.py
    def iter_files(
        self,
        path: str = "",
        ref: str | None = None,
        pattern: str | None = None,
    ) -> Iterator[str]:
        """Iterate over repository files.
    
        Default implementation using recursive directory traversal.
    
        Args:
            path: Base path to start from
            ref: Git reference (branch/tag/commit)
            pattern: File pattern to match
    
        Yields:
            File paths
        """
        yield from self._repository.iter_files(path, ref, pattern)
    

    list_branches

    list_branches() -> list[Branch]
    

    List all branches in the repository.

    Returns:

    Type Description
    list[Branch]

    List of branches.

    Source code in src/githarbor/core/proxy.py
    def list_branches(self) -> list[Branch]:
        """List all branches in the repository.
    
        Returns:
            List of branches.
        """
        if self._repository.is_async:
            return asyncio.run(self._repository.list_branches_async())
        return self._repository.list_branches()
    

    list_branches_async async

    list_branches_async() -> list[Branch]
    

    List all branches in the repository asynchronously.

    Returns:

    Type Description
    list[Branch]

    List of branches.

    Source code in src/githarbor/core/proxy.py
    async def list_branches_async(self) -> list[Branch]:
        """List all branches in the repository asynchronously.
    
        Returns:
            List of branches.
        """
        if self._repository.is_async:
            return await self._repository.list_branches_async()
        return await asyncio.to_thread(self._repository.list_branches)
    

    list_commits

    list_commits(
        branch: str | None = None,
        since: datetime | None = None,
        until: datetime | None = None,
        author: str | None = None,
        path: str | None = None,
        max_results: int | None = None,
    ) -> NiceReprList[Commit]
    

    List commits with optional filters.

    Parameters:

    Name Type Description Default
    branch str | None

    Branch to list commits from.

    None
    since datetime | None

    Only show commits after this date.

    None
    until datetime | None

    Only show commits before this date.

    None
    author str | None

    Filter by author.

    None
    path str | None

    Filter by file path.

    None
    max_results int | None

    Maximum number of results to return.

    None

    Returns:

    Type Description
    NiceReprList[Commit]

    List of commits.

    Source code in src/githarbor/core/proxy.py
    def list_commits(
        self,
        branch: str | None = None,
        since: datetime | None = None,
        until: datetime | None = None,
        author: str | None = None,
        path: str | None = None,
        max_results: int | None = None,
    ) -> NiceReprList[Commit]:
        """List commits with optional filters.
    
        Args:
            branch: Branch to list commits from.
            since: Only show commits after this date.
            until: Only show commits before this date.
            author: Filter by author.
            path: Filter by file path.
            max_results: Maximum number of results to return.
    
        Returns:
            List of commits.
        """
        if self._repository.is_async:
            return NiceReprList(
                asyncio.run(
                    self._repository.list_commits_async(
                        branch=branch,
                        since=since,
                        until=until,
                        author=author,
                        path=path,
                        max_results=max_results,
                    )
                )
            )
        return NiceReprList(
            self._repository.list_commits(
                branch=branch,
                since=since,
                until=until,
                author=author,
                path=path,
                max_results=max_results,
            )
        )
    

    list_commits_async async

    list_commits_async(
        branch: str | None = None,
        since: datetime | None = None,
        until: datetime | None = None,
        author: str | None = None,
        path: str | None = None,
        max_results: int | None = None,
    ) -> list[Commit]
    

    See list_commits.

    Source code in src/githarbor/core/proxy.py
    async def list_commits_async(
        self,
        branch: str | None = None,
        since: datetime | None = None,
        until: datetime | None = None,
        author: str | None = None,
        path: str | None = None,
        max_results: int | None = None,
    ) -> list[Commit]:
        """See list_commits."""
        if self._repository.is_async:
            return await self._repository.list_commits_async(
                branch, since, until, author, path, max_results
            )
        return await asyncio.to_thread(
            self._repository.list_commits,
            branch,
            since,
            until,
            author,
            path,
            max_results,
        )
    

    list_issues

    list_issues(state: IssueState = 'open') -> list[Issue]
    

    List issues.

    Parameters:

    Name Type Description Default
    state IssueState

    State filter ('open', 'closed', 'all').

    'open'

    Returns:

    Type Description
    list[Issue]

    List of issues.

    Source code in src/githarbor/core/proxy.py
    def list_issues(self, state: IssueState = "open") -> list[Issue]:
        """List issues.
    
        Args:
            state: State filter ('open', 'closed', 'all').
    
        Returns:
            List of issues.
        """
        if self._repository.is_async:
            return asyncio.run(self._repository.list_issues_async(state))
        return self._repository.list_issues(state)
    

    list_issues_async async

    list_issues_async(state: IssueState = 'open') -> list[Issue]
    

    See list_issues.

    Source code in src/githarbor/core/proxy.py
    async def list_issues_async(self, state: IssueState = "open") -> list[Issue]:
        """See list_issues."""
        if self._repository.is_async:
            return await self._repository.list_issues_async(state)
        return await asyncio.to_thread(self._repository.list_issues, state)
    

    list_pull_requests

    list_pull_requests(state: PullRequestState = 'open') -> list[PullRequest]
    

    List pull requests.

    Parameters:

    Name Type Description Default
    state PullRequestState

    State filter ('open', 'closed', 'all').

    'open'

    Returns:

    Type Description
    list[PullRequest]

    List of pull requests.

    Source code in src/githarbor/core/proxy.py
    def list_pull_requests(self, state: PullRequestState = "open") -> list[PullRequest]:
        """List pull requests.
    
        Args:
            state: State filter ('open', 'closed', 'all').
    
        Returns:
            List of pull requests.
        """
        if self._repository.is_async:
            return asyncio.run(self._repository.list_pull_requests_async(state))
        return self._repository.list_pull_requests(state)
    

    list_pull_requests_async async

    list_pull_requests_async(state: PullRequestState = 'open') -> list[PullRequest]
    

    See list_pull_requests.

    Source code in src/githarbor/core/proxy.py
    async def list_pull_requests_async(
        self,
        state: PullRequestState = "open",
    ) -> list[PullRequest]:
        """See list_pull_requests."""
        if self._repository.is_async:
            return await self._repository.list_pull_requests_async(state)
        return await asyncio.to_thread(self._repository.list_pull_requests, state)
    

    list_releases

    list_releases(
        include_drafts: bool = False, include_prereleases: bool = False, limit: int | None = None
    ) -> list[Release]
    

    List releases.

    Parameters:

    Name Type Description Default
    include_drafts bool

    Whether to include draft releases.

    False
    include_prereleases bool

    Whether to include pre-releases.

    False
    limit int | None

    Maximum number of releases to return.

    None

    Returns:

    Type Description
    list[Release]

    List of releases.

    Source code in src/githarbor/core/proxy.py
    def list_releases(
        self,
        include_drafts: bool = False,
        include_prereleases: bool = False,
        limit: int | None = None,
    ) -> list[Release]:
        """List releases.
    
        Args:
            include_drafts: Whether to include draft releases.
            include_prereleases: Whether to include pre-releases.
            limit: Maximum number of releases to return.
    
        Returns:
            List of releases.
        """
        if self._repository.is_async:
            return asyncio.run(
                self._repository.list_releases_async(include_drafts, include_prereleases, limit)
            )
        return self._repository.list_releases(include_drafts, include_prereleases, limit)
    

    list_releases_async async

    list_releases_async(
        include_drafts: bool = False, include_prereleases: bool = False, limit: int | None = None
    ) -> list[Release]
    

    See list_releases.

    Source code in src/githarbor/core/proxy.py
    async def list_releases_async(
        self,
        include_drafts: bool = False,
        include_prereleases: bool = False,
        limit: int | None = None,
    ) -> list[Release]:
        """See list_releases."""
        if self._repository.is_async:
            return await self._repository.list_releases_async(
                include_drafts, include_prereleases, limit
            )
        return await asyncio.to_thread(
            self._repository.list_releases, include_drafts, include_prereleases, limit
        )
    

    list_tags

    list_tags() -> list[Tag]
    

    List all tags.

    Returns:

    Type Description
    list[Tag]

    List of tags.

    Source code in src/githarbor/core/proxy.py
    def list_tags(self) -> list[Tag]:
        """List all tags.
    
        Returns:
            List of tags.
        """
        if self._repository.is_async:
            return asyncio.run(self._repository.list_tags_async())
        return self._repository.list_tags()
    

    list_tags_async async

    list_tags_async() -> list[Tag]
    

    See list_tags.

    Source code in src/githarbor/core/proxy.py
    async def list_tags_async(self) -> list[Tag]:
        """See list_tags."""
        if self._repository.is_async:
            return await self._repository.list_tags_async()
        return await asyncio.to_thread(self._repository.list_tags)
    

    list_workflows

    list_workflows() -> list[Workflow]
    

    List all workflows.

    Returns:

    Type Description
    list[Workflow]

    List of workflows.

    Source code in src/githarbor/core/proxy.py
    def list_workflows(self) -> list[Workflow]:
        """List all workflows.
    
        Returns:
            List of workflows.
        """
        if self._repository.is_async:
            return asyncio.run(self._repository.list_workflows_async())
        return self._repository.list_workflows()
    

    list_workflows_async async

    list_workflows_async() -> list[Workflow]
    

    See list_workflows.

    Source code in src/githarbor/core/proxy.py
    async def list_workflows_async(self) -> list[Workflow]:
        """See list_workflows."""
        if self._repository.is_async:
            return await self._repository.list_workflows_async()
        return await asyncio.to_thread(self._repository.list_workflows)
    

    search_commits

    search_commits(
        query: str, branch: str | None = None, path: str | None = None, max_results: int | None = None
    ) -> list[Commit]
    

    Search commits.

    Default implementation that filters commits based on message content.

    Parameters:

    Name Type Description Default
    query str

    Search query string

    required
    branch str | None

    Branch to search in

    None
    path str | None

    Filter by file path

    None
    max_results int | None

    Maximum number of results to return

    None

    Returns:

    Type Description
    list[Commit]

    List of matching commits

    Source code in src/githarbor/core/proxy.py
    def search_commits(
        self,
        query: str,
        branch: str | None = None,
        path: str | None = None,
        max_results: int | None = None,
    ) -> list[Commit]:
        """Search commits.
    
        Default implementation that filters commits based on message content.
    
        Args:
            query: Search query string
            branch: Branch to search in
            path: Filter by file path
            max_results: Maximum number of results to return
    
        Returns:
            List of matching commits
        """
        if self._repository.is_async:
            return NiceReprList(
                asyncio.run(
                    self._repository.search_commits_async(
                        query=query,
                        branch=branch,
                        path=path,
                        max_results=max_results,
                    )
                )
            )
        return NiceReprList(
            self._repository.search_commits(
                query=query,
                branch=branch,
                path=path,
                max_results=max_results,
            )
        )
    

    search_commits_async async

    search_commits_async(
        query: str, branch: str | None = None, path: str | None = None, max_results: int | None = None
    ) -> list[Commit]
    

    See search_commits.

    Source code in src/githarbor/core/proxy.py
    async def search_commits_async(
        self,
        query: str,
        branch: str | None = None,
        path: str | None = None,
        max_results: int | None = None,
    ) -> list[Commit]:
        """See search_commits."""
        if self._repository.is_async:
            return await self._repository.search_commits_async(query, branch, path, max_results)
        return await asyncio.to_thread(
            self._repository.search_commits, query, branch, path, max_results
        )