|
| 1 | +**Product Requirements Document (PRD) for RepoDiff UI (PyQt)** |
| 2 | + |
| 3 | +### 1. Overview |
| 4 | +This PRD outlines the requirements for a **modern, dark-mode enabled UI** for RepoDiff, built using **PyQt**. The UI should provide an intuitive interface for users to configure diff settings, select commits, and generate a structured diff file for LLM consumption. |
| 5 | + |
| 6 | +### 2. Key Objectives |
| 7 | +1. **Provide an intuitive UI** for configuring file filters, diff settings, and context rules. |
| 8 | +2. **Support dark mode** with modern aesthetics. |
| 9 | +3. **Enable commit selection** from a dropdown or interactive selection. |
| 10 | +4. **Allow easy export** of the processed diff to a file. |
| 11 | +5. **Ensure responsiveness** and usability across different screen sizes. |
| 12 | +6. **Keep UI simple** without embedding a diff viewer, as users will edit the output in their own text editor. |
| 13 | + |
| 14 | +### 3. UI Design |
| 15 | +#### **3.1. Main Window Components** |
| 16 | +1. **Commit Selection Panel** |
| 17 | + - Dropdowns to select `commit1` and `commit2`. |
| 18 | +2. **Configuration Panel** |
| 19 | + - File pattern selector (`*.cs`, `*.py`, etc.). |
| 20 | + - Toggle for `include_entire_file_with_signatures`. |
| 21 | + - Input field for `method_body_threshold`. |
| 22 | + - Context lines selection (`-U` value). |
| 23 | +3. **Export Options** |
| 24 | + - Output path. |
| 25 | + - “Pack” button to trigger diff generation and export output as `.md` file. |
| 26 | +4. **Dark Mode Toggle** |
| 27 | + - Integrated style switcher for light/dark themes. |
| 28 | + |
| 29 | +### 4. Dark Mode Implementation |
| 30 | +- Use **Qt’s Fusion theme** with a dark stylesheet. |
| 31 | +- Custom stylesheets for buttons, dropdowns, and text areas to ensure consistency. |
| 32 | +- Automatic detection of system theme (if possible). |
| 33 | + |
| 34 | +### 5. Interaction Flow |
| 35 | +1. **User selects two commits** from dropdowns. |
| 36 | +2. **User configures filters and options** (e.g., method body removal, context lines). |
| 37 | +3. **User clicks “Pack”** to generate the diff file. |
| 38 | +4. **File is automatically saved/exported**, ready for upload to an LLM. |
| 39 | + |
| 40 | +### 6. Sample Pseudocode |
| 41 | +```python |
| 42 | +from PyQt6.QtWidgets import QApplication, QMainWindow, QPushButton, QVBoxLayout, QFileDialog |
| 43 | +from PyQt6.QtGui import QPalette, QColor |
| 44 | + |
| 45 | +class RepoDiffUI(QMainWindow): |
| 46 | + def __init__(self): |
| 47 | + super().__init__() |
| 48 | + self.initUI() |
| 49 | + |
| 50 | + def initUI(self): |
| 51 | + self.setWindowTitle("RepoDiff") |
| 52 | + self.setGeometry(100, 100, 600, 400) |
| 53 | + |
| 54 | + # Dark mode setup |
| 55 | + palette = QPalette() |
| 56 | + palette.setColor(QPalette.ColorRole.Window, QColor(53, 53, 53)) |
| 57 | + palette.setColor(QPalette.ColorRole.WindowText, QColor(255, 255, 255)) |
| 58 | + self.setPalette(palette) |
| 59 | + |
| 60 | + # Main Layout |
| 61 | + layout = QVBoxLayout() |
| 62 | + |
| 63 | + # Pack Button |
| 64 | + self.pack_button = QPushButton("Pack") |
| 65 | + self.pack_button.clicked.connect(self.generate_diff) |
| 66 | + layout.addWidget(self.pack_button) |
| 67 | + |
| 68 | + self.setLayout(layout) |
| 69 | + |
| 70 | + def generate_diff(self): |
| 71 | + file_path, _ = QFileDialog.getSaveFileName(self, "Save Diff File", "", "Markdown Files (*.md);;All Files (*)") |
| 72 | + if file_path: |
| 73 | + with open(file_path, 'w') as f: |
| 74 | + f.write("Generated diff output...") |
| 75 | + |
| 76 | +app = QApplication([]) |
| 77 | +window = RepoDiffUI() |
| 78 | +window.show() |
| 79 | +app.exec() |
| 80 | +``` |
| 81 | + |
| 82 | +### 7. Expected Outcome |
| 83 | +- A modern UI with a **clean, structured layout**. |
| 84 | +- **Dark mode support** with clear text visibility. |
| 85 | +- **No embedded diff viewer**, only file export. |
| 86 | +- **Seamless interaction** for configuring and generating diffs. |
| 87 | +- **Optimized for LLMs and manual editing.** |
| 88 | + |
| 89 | +### 8. Summary |
| 90 | +RepoDiff’s UI will be developed in **PyQt**, providing a **modern, user-friendly interface** with dark mode support. The UI will enable easy configuration, commit selection, and diff generation, making RepoDiff an accessible and efficient tool for code review workflows. |
| 91 | + |
0 commit comments