Compare commits
No commits in common. "e56463d20710dcc85761fb8dbe620db7eb65121b" and "a4f7caf125886613ca58f73c26cbe483a4eb8e7f" have entirely different histories.
e56463d207
...
a4f7caf125
|
@ -521,7 +521,6 @@ def solve_issues_in_repository(
|
||||||
handle_pr_comments(
|
handle_pr_comments(
|
||||||
repository_config,
|
repository_config,
|
||||||
issue_resolution.pull_request_id,
|
issue_resolution.pull_request_id,
|
||||||
branch_name,
|
|
||||||
Path(repository_path),
|
Path(repository_path),
|
||||||
client,
|
client,
|
||||||
seen_issues_db,
|
seen_issues_db,
|
||||||
|
@ -538,46 +537,3 @@ def solve_issues_in_repository(
|
||||||
issue_resolution.pull_request_id,
|
issue_resolution.pull_request_id,
|
||||||
issue_number,
|
issue_number,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def handle_pr_comments(
|
|
||||||
repository_config,
|
|
||||||
pr_number,
|
|
||||||
branch_name,
|
|
||||||
repository_path,
|
|
||||||
client,
|
|
||||||
seen_issues_db,
|
|
||||||
issue_url,
|
|
||||||
):
|
|
||||||
"""Fetch unresolved PR comments and resolve them via aider."""
|
|
||||||
comments = client.get_pull_request_comments(
|
|
||||||
repository_config.owner,
|
|
||||||
repository_config.repo,
|
|
||||||
pr_number,
|
|
||||||
)
|
|
||||||
for comment in comments:
|
|
||||||
path = comment.get('path')
|
|
||||||
line = comment.get('line') or comment.get('position') or 0
|
|
||||||
file_path = repository_path / path
|
|
||||||
try:
|
|
||||||
lines = file_path.read_text().splitlines()
|
|
||||||
start = max(0, line - 3)
|
|
||||||
end = min(len(lines), line + 2)
|
|
||||||
context = '\n'.join(lines[start:end])
|
|
||||||
except Exception:
|
|
||||||
context = ''
|
|
||||||
body = comment.get('body', '')
|
|
||||||
issue = (
|
|
||||||
f'Resolve the following reviewer comment:\n{body}\n\n'
|
|
||||||
f'File: {path}\n\nContext:\n{context}'
|
|
||||||
)
|
|
||||||
# invoke aider on the comment context
|
|
||||||
issue_solution_round(repository_path, issue)
|
|
||||||
# commit and push changes for this comment
|
|
||||||
run_cmd(['git', 'add', path], repository_path, check=False)
|
|
||||||
run_cmd(
|
|
||||||
['git', 'commit', '-m', f'Resolve comment {comment.get("id")}'],
|
|
||||||
repository_path,
|
|
||||||
check=False,
|
|
||||||
)
|
|
||||||
run_cmd(['git', 'push', 'origin', branch_name], repository_path, check=False)
|
|
||||||
|
|
|
@ -170,10 +170,7 @@ class GiteaClient:
|
||||||
return response.json()
|
return response.json()
|
||||||
|
|
||||||
def get_pull_request_comments(
|
def get_pull_request_comments(
|
||||||
self,
|
self, owner: str, repo: str, pr_number: str,
|
||||||
owner: str,
|
|
||||||
repo: str,
|
|
||||||
pr_number: str,
|
|
||||||
) -> list[dict]:
|
) -> list[dict]:
|
||||||
"""
|
"""
|
||||||
Fetch comments for a pull request.
|
Fetch comments for a pull request.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user