-
Notifications
You must be signed in to change notification settings - Fork 373
feat: enhance GitHub PR reading with code context and suggestions #688
Copy link
Copy link
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Overview
Improve the built-in GitHub PR reading capability in gptme/util/gh.py to match the feature set of the standalone scripts (scripts/gh-pr-view-with-pr-comments.py and .sh).
Current State
The built-in get_github_pr_content() provides:
- ✅ Basic PR metadata (title, state, author, reviewers, etc.)
- ✅ PR description and comments
- ✅ Unresolved review comments (filtered)
- ✅ GitHub Actions status with emoji indicators
⚠️ Simple file:line references for review comments- ❌ Missing code context snippets
- ❌ Missing code suggestions (diff format)
Proposed Enhancements
1. Add Code Context Snippets
Show the actual code being commented on for each review comment:
**@ErikBjare** on gptme/lessons/commands.py:29:
Duplicated with _lesson_help below
Referenced code in gptme/lessons/commands.py:29:
Context:
```gptme/lessons/commands.py
def lesson(ctx: "CommandContext") -> Generator["Message", None, None]:
"""Lesson system commands.
Usage:
/lesson list [category] List available lessons
```
2. Include Code Suggestions
When reviewers provide code suggestions, show them in diff format:
**@ellipsis-dev[bot]** on gptme/tools/lessons.py:91:
Use logger.exception to log the full stack trace instead of logger.warning in the exception block.
```suggestion
logger.exception(f"Failed to include lessons: {e}")
```
3. Better Thread Organization
Group review comments by file/thread with clear visual separation.
Implementation Notes
- Use GraphQL API to fetch review comment context (diff hunks)
- Extract code suggestions from comment bodies (GitHub suggestion syntax)
- Maintain current filtering of resolved comments
- Keep GitHub Actions status (already implemented)
Related
- Scripts:
scripts/gh-pr-view-with-pr-comments.py,scripts/gh-pr-view-with-pr-comments.sh - Code:
gptme/util/gh.py
Success Criteria
- Review comments show code context (3-10 lines around commented line, or selected lines if several)
- Code suggestions are displayed in diff format
- All existing functionality preserved (resolved comment filtering, GitHub Actions status)
- Clean, readable output format
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request