pr-review-agent 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -105,10 +105,21 @@ gh api repos/{OWNER/REPO}/pulls/{PR_NUMBER}/files --paginate --jq '.[] | select(
105
105
 
106
106
  2. Analyze against REVIEW-PLAN.md checklist categories.
107
107
 
108
- 3. For each finding, record:
109
- - file path, category, severity (critical/warning/suggestion)
110
- - title (short, descriptive), body (detailed explanation with code examples)
111
- - line number (approximate)
108
+ 3. For each finding, record a JSON object with exactly these fields:
109
+ - `file` (string): Full file path relative to repo root
110
+ - `line` (number): Line number where the issue starts (0 if not applicable)
111
+ - `severity` (string): One of `"critical"`, `"warning"`, `"suggestion"`
112
+ - `category` (string): Category key matching REVIEW-PLAN.md (e.g. `"architecture"`, `"security"`, `"i18n"`)
113
+ - `title` (string): Short, descriptive title (under 80 chars)
114
+ - `body` (string): Detailed explanation of the issue and why it matters. Can include HTML (`<code>`, `<ul>`, `<pre>`, `<strong>`)
115
+ - `snippet` (string): A concise code snippet showing **what the code looks like now → what it should look like**. Use `→` to separate current from expected. For structural issues, show the problematic pattern. Keep it short (1-5 lines). Example:
116
+ ```
117
+ "snippet": "bg-red-900/20 text-red-400 → bg-error-bg text-error"
118
+ ```
119
+ ```
120
+ "snippet": "const repo = new XRepository(handler);\n→ useExecuteUseCase(xUseCase)"
121
+ ```
122
+ If no clear code fix exists, show only the problematic code.
112
123
 
113
124
  **Deduplication rules:**
114
125
  - If the same pattern violation appears in 5+ files, consolidate into one finding referencing all files
@@ -119,7 +130,7 @@ gh api repos/{OWNER/REPO}/pulls/{PR_NUMBER}/files --paginate --jq '.[] | select(
119
130
  ## Step 3: Generate Review Output
120
131
 
121
132
  ### 3a. Write findings JSON
122
- Write the findings array to `$PR_REVIEW_DIR/findings.json`
133
+ Write the findings array to `$PR_REVIEW_DIR/findings.json`. Each finding MUST have all 7 fields: `file`, `line`, `severity`, `category`, `title`, `body`, `snippet`. Never omit `snippet` — every finding needs a code reference showing the issue or the fix.
123
134
 
124
135
  ### 3b. Update config.json
125
136
  Write/update `$PR_REVIEW_DIR/config.json` with PR metadata and category definitions.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pr-review-agent",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "AI-powered PR review agent for Claude Code, OpenCode, and other AI coding assistants. Analyzes pull requests against project-specific architectural patterns with an interactive preview UI.",
5
5
  "bin": {
6
6
  "pr-review-agent": "bin/install.js"
@@ -29,4 +29,4 @@
29
29
  "type": "git",
30
30
  "url": "https://github.com/TheRocketCodeMX/pr-review-agent"
31
31
  }
32
- }
32
+ }
@@ -107,6 +107,7 @@
107
107
  .comment-body strong { color: var(--text-primary); }
108
108
  .comment-body ul { padding-left: 20px; margin: 6px 0; }
109
109
  .comment-body li { margin: 3px 0; }
110
+ .comment-snippet { font-family: var(--font-mono); font-size: 12px; background: var(--bg-primary); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius); padding: 10px 14px; margin: 8px 0 0; overflow-x: auto; line-height: 1.6; color: var(--text-secondary); white-space: pre-wrap; word-break: break-word; }
110
111
  .line-ref { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); margin-left: auto; }
111
112
 
112
113
  /* Card hover actions */
@@ -360,6 +361,10 @@
360
361
  <textarea class="edit-textarea" id="comBody" placeholder="Detailed explanation (supports HTML: &lt;code&gt;, &lt;ul&gt;, &lt;pre&gt;, &lt;strong&gt;)" style="font-family:var(--font-mono);font-size:12px;min-height:120px" oninput="this.style.height='auto';this.style.height=this.scrollHeight+'px'"></textarea>
361
362
  <div class="edit-preview" id="comBodyPreview" style="display:none"></div>
362
363
  </div>
364
+ <div class="modal-field">
365
+ <label for="comSnippet">Snippet</label>
366
+ <textarea class="edit-textarea" id="comSnippet" placeholder="Code snippet: current → expected" style="font-family:var(--font-mono);font-size:12px;min-height:60px" oninput="this.style.height='auto';this.style.height=this.scrollHeight+'px'"></textarea>
367
+ </div>
363
368
  </div>
364
369
  <div class="modal-footer">
365
370
  <button class="btn" onclick="closeCommentModal()">Cancel</button>
@@ -653,6 +658,7 @@
653
658
  document.getElementById('comSeverity').value = 'warning';
654
659
  document.getElementById('comTitle').value = '';
655
660
  document.getElementById('comBody').value = '';
661
+ document.getElementById('comSnippet').value = '';
656
662
  document.getElementById('comBody').style.display = 'block';
657
663
  document.getElementById('comBodyPreview').style.display = 'none';
658
664
  // Reset tabs to Write
@@ -686,7 +692,8 @@
686
692
  severity: document.getElementById('comSeverity').value,
687
693
  category: document.getElementById('comCategory').value,
688
694
  title,
689
- body: document.getElementById('comBody').value
695
+ body: document.getElementById('comBody').value,
696
+ snippet: document.getElementById('comSnippet').value
690
697
  });
691
698
  closeCommentModal();
692
699
  activeFilters = { severity: null, category: null, file: null };
@@ -722,6 +729,7 @@
722
729
  reviewData[idx].severity = form.querySelector('[data-field="severity"]').value;
723
730
  reviewData[idx].category = form.querySelector('[data-field="category"]').value;
724
731
  reviewData[idx].line = parseInt(form.querySelector('[data-field="line"]').value) || 0;
732
+ reviewData[idx].snippet = form.querySelector('[data-field="snippet"]').value;
725
733
  editingIdx = null;
726
734
  render();
727
735
  await persistToDisk();
@@ -859,6 +867,7 @@
859
867
  ${i.line ? `<span class="line-ref">L${i.line}</span>` : ''}
860
868
  </div>
861
869
  <div class="comment-body">${i.body}</div>
870
+ ${i.snippet ? `<pre class="comment-snippet">${i.snippet.replace(/</g,'&lt;').replace(/>/g,'&gt;')}</pre>` : ''}
862
871
  </div>`;
863
872
  }
864
873
 
@@ -899,6 +908,7 @@
899
908
  <textarea class="edit-textarea" data-field="body" id="edit-body-${id}" placeholder="Detailed explanation (supports HTML: &lt;code&gt;, &lt;ul&gt;, &lt;pre&gt;, &lt;strong&gt;)" oninput="this.style.height='auto';this.style.height=this.scrollHeight+'px'">${bodyEscaped}</textarea>
900
909
  <div class="edit-preview" id="edit-preview-${id}" style="display:none"></div>
901
910
  </div>
911
+ <div class="edit-field"><label>Snippet</label><textarea class="edit-textarea" data-field="snippet" placeholder="Code snippet: current → expected" style="font-family:var(--font-mono);font-size:12px;min-height:60px" oninput="this.style.height='auto';this.style.height=this.scrollHeight+'px'">${(i.snippet||'').replace(/</g,'&lt;').replace(/>/g,'&gt;')}</textarea></div>
902
912
  </div>
903
913
  </div>
904
914
  <div class="edit-form-footer">