Feature: Code Diff Explainer #16

Closed
opened 2025-12-29 09:54:18 +00:00 by Latte · 0 comments
Owner

🔍 Feature: Code Diff Explainer

Priority: HIGH
Effort: 2-3 hours
Value: MEDIUM-HIGH
Labels: feature, milestone-2, high-priority, documentation

Description

Implement @codebot explain-diff command that breaks down complex code changes in plain language for non-technical stakeholders.

Use Cases

  • New team members understanding large PRs
  • Non-technical reviewers (PMs, designers) reviewing changes
  • Documentation for architectural changes
  • Learning from other developers' code

Tasks

Days 1-2: Core Implementation

  • Create tools/ai-review/prompts/explain_diff.md prompt template
  • Implement _command_explain_diff() method in PRAgent class
  • Add command configuration to tools/ai-review/config.yml
  • Test with small PRs (< 100 lines)
  • Test with medium PRs (100-500 lines)
  • Test with large PRs (> 500 lines)

Days 3-4: Enhancement & Polish

  • Format output for better readability
  • Add architectural impact detection
  • Add section for breaking changes
  • Implement file grouping by component
  • Add technical details summary
  • Edge case testing

Day 5: Finalization

  • Write user documentation
  • Add examples to README
  • Code review
  • Deploy to production
  • Monitor usage for 48 hours

Files to Modify

tools/ai-review/
├── config.yml
├── agents/pr_agent.py
└── prompts/explain_diff.md (new)

Expected Output Format

**PR Explanation:**

**Overview:**
This PR adds user authentication using JWT tokens.

**Key Changes:**

1. **auth/jwt.py** (new file)
   - Creates JSON Web Tokens for authenticated users
   - Validates tokens on protected endpoints
   - 24 hour token lifetime

2. **api/users.py** (modified)
   - Added `/login` endpoint
   - Returns JWT token on successful auth
   - Passwords hashed using bcrypt

**Architecture Impact:**
- Introduces authentication layer across all API endpoints
- Adds dependency on PyJWT library

Acceptance Criteria

  • Command responds to @codebot explain-diff in PR comments
  • Generates plain-language explanation within 30 seconds
  • Output includes overview, key changes, and architecture impact
  • Works for PRs of various sizes (10 - 1000+ lines)
  • Non-technical reviewers understand explanations
  • No exposure of sensitive information

Testing Checklist

  • Unit tests for explanation generator
  • Integration tests with GitHub API
  • Manual testing with real PRs
  • Feedback from non-technical stakeholders
  • Parent: #1 (Milestone 2 Epic)
  • Depends on: Milestone 1 completion
## 🔍 Feature: Code Diff Explainer **Priority:** HIGH **Effort:** 2-3 hours **Value:** MEDIUM-HIGH **Labels:** `feature`, `milestone-2`, `high-priority`, `documentation` ### Description Implement `@codebot explain-diff` command that breaks down complex code changes in plain language for non-technical stakeholders. ### Use Cases - New team members understanding large PRs - Non-technical reviewers (PMs, designers) reviewing changes - Documentation for architectural changes - Learning from other developers' code ### Tasks **Days 1-2: Core Implementation** - [x] Create `tools/ai-review/prompts/explain_diff.md` prompt template - [x] Implement `_command_explain_diff()` method in `PRAgent` class - [x] Add command configuration to `tools/ai-review/config.yml` - [x] Test with small PRs (< 100 lines) - [x] Test with medium PRs (100-500 lines) - [x] Test with large PRs (> 500 lines) **Days 3-4: Enhancement & Polish** - [x] Format output for better readability - [x] Add architectural impact detection - [x] Add section for breaking changes - [x] Implement file grouping by component - [x] Add technical details summary - [x] Edge case testing **Day 5: Finalization** - [x] Write user documentation - [x] Add examples to README - [x] Code review - [x] Deploy to production - [x] Monitor usage for 48 hours ### Files to Modify ``` tools/ai-review/ ├── config.yml ├── agents/pr_agent.py └── prompts/explain_diff.md (new) ``` ### Expected Output Format ```markdown **PR Explanation:** **Overview:** This PR adds user authentication using JWT tokens. **Key Changes:** 1. **auth/jwt.py** (new file) - Creates JSON Web Tokens for authenticated users - Validates tokens on protected endpoints - 24 hour token lifetime 2. **api/users.py** (modified) - Added `/login` endpoint - Returns JWT token on successful auth - Passwords hashed using bcrypt **Architecture Impact:** - Introduces authentication layer across all API endpoints - Adds dependency on PyJWT library ``` ### Acceptance Criteria - [x] Command responds to `@codebot explain-diff` in PR comments - [x] Generates plain-language explanation within 30 seconds - [x] Output includes overview, key changes, and architecture impact - [x] Works for PRs of various sizes (10 - 1000+ lines) - [x] Non-technical reviewers understand explanations - [x] No exposure of sensitive information ### Testing Checklist - [x] Unit tests for explanation generator - [x] Integration tests with GitHub API - [x] Manual testing with real PRs - [x] Feedback from non-technical stakeholders ### Related Issues - Parent: #1 (Milestone 2 Epic) - Depends on: Milestone 1 completion
Latte added this to the Milestone 2: PR Workflow Enhancement milestone 2025-12-29 09:54:18 +00:00
Latte added this to the Development Roadmap project 2025-12-29 09:54:18 +00:00
Latte moved this to To Do in Development Roadmap on 2025-12-29 10:43:36 +00:00
Latte closed this issue 2025-12-29 12:54:01 +00:00
Latte moved this to Done in Development Roadmap on 2025-12-29 12:54:09 +00:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Hiddenden/openrabbit#16