refactor(clarity-assist): extract skills from commands
Extract shared knowledge from clarify.md and quick-clarify.md into reusable skill files: - 4d-methodology.md: Core 4-phase clarification process - nd-accommodations.md: Neurodivergent-friendly question patterns - clarification-techniques.md: Anti-patterns and question templates - escalation-patterns.md: Mode switching guidelines Commands slimmed from 149/96 lines to 44/49 lines respectively. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,165 +2,47 @@
|
||||
|
||||
## Visual Output
|
||||
|
||||
When executing this command, display the plugin header:
|
||||
Display header: `PR-REVIEW - Diff Viewer`
|
||||
|
||||
```
|
||||
┌──────────────────────────────────────────────────────────────────┐
|
||||
│ 🔍 PR-REVIEW · Diff Viewer │
|
||||
└──────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
## Skills to Load
|
||||
|
||||
Then proceed with the diff display.
|
||||
|
||||
## Purpose
|
||||
|
||||
Display the PR diff with inline annotations from review comments, making it easy to see what feedback has been given alongside the code changes.
|
||||
- skills/mcp-tools-reference.md
|
||||
- skills/pr-analysis.md
|
||||
- skills/output-formats.md
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
/pr-diff <pr-number> [--repo owner/repo] [--context <lines>]
|
||||
/pr-diff <pr-number> [--repo owner/repo] [--context <n>] [--no-comments] [--file <pattern>]
|
||||
```
|
||||
|
||||
### Options
|
||||
## Workflow
|
||||
|
||||
```
|
||||
--repo <owner/repo> Override repository (default: from .env)
|
||||
--context <n> Lines of context around changes (default: 3)
|
||||
--no-comments Show diff without comment annotations
|
||||
--file <pattern> Filter to specific files (glob pattern)
|
||||
```
|
||||
### Step 1: Fetch Data
|
||||
|
||||
## Behavior
|
||||
|
||||
### Step 1: Fetch PR Data
|
||||
|
||||
Using Gitea MCP tools:
|
||||
1. `get_pr_diff` - Unified diff of all changes
|
||||
2. `get_pr_comments` - All review comments on the PR
|
||||
Load MCP tools, then: `get_pr_diff`, `get_pr_comments`
|
||||
|
||||
### Step 2: Parse and Annotate
|
||||
|
||||
Parse the diff and overlay comments at their respective file/line positions:
|
||||
Execute `skills/pr-analysis.md` Annotated Diff Display:
|
||||
- Overlay comments at file/line positions
|
||||
- Show commenter, timestamp, replies
|
||||
- Mark resolved vs open
|
||||
|
||||
```
|
||||
═══════════════════════════════════════════════════
|
||||
PR #123 Diff - Add user authentication
|
||||
═══════════════════════════════════════════════════
|
||||
### Step 3: Display
|
||||
|
||||
Branch: feat/user-auth → development
|
||||
Files: 12 changed (+234 / -45)
|
||||
|
||||
───────────────────────────────────────────────────
|
||||
src/api/users.ts (+85 / -12)
|
||||
───────────────────────────────────────────────────
|
||||
|
||||
@@ -42,6 +42,15 @@ export async function getUser(id: string) {
|
||||
42 │ const db = getDatabase();
|
||||
43 │
|
||||
44 │- const user = db.query("SELECT * FROM users WHERE id = " + id);
|
||||
│ ┌─────────────────────────────────────────────────────────────
|
||||
│ │ COMMENT by @reviewer (2h ago):
|
||||
│ │ This is a SQL injection vulnerability. Use parameterized
|
||||
│ │ queries instead: `db.query("SELECT * FROM users WHERE id = ?", [id])`
|
||||
│ └─────────────────────────────────────────────────────────────
|
||||
45 │+ const query = "SELECT * FROM users WHERE id = ?";
|
||||
46 │+ const user = db.query(query, [id]);
|
||||
47 │
|
||||
48 │ if (!user) {
|
||||
49 │ throw new NotFoundError("User not found");
|
||||
50 │ }
|
||||
|
||||
@@ -78,3 +87,12 @@ export async function updateUser(id: string, data: UserInput) {
|
||||
87 │+ // Validate input before update
|
||||
88 │+ validateUserInput(data);
|
||||
89 │+
|
||||
90 │+ const result = db.query(
|
||||
91 │+ "UPDATE users SET name = ?, email = ? WHERE id = ?",
|
||||
92 │+ [data.name, data.email, id]
|
||||
93 │+ );
|
||||
│ ┌─────────────────────────────────────────────────────────────
|
||||
│ │ COMMENT by @maintainer (1h ago):
|
||||
│ │ Good use of parameterized query here!
|
||||
│ │
|
||||
│ │ REPLY by @author (30m ago):
|
||||
│ │ Thanks! Applied the same pattern throughout.
|
||||
│ └─────────────────────────────────────────────────────────────
|
||||
|
||||
───────────────────────────────────────────────────
|
||||
src/components/LoginForm.tsx (+65 / -0) [NEW FILE]
|
||||
───────────────────────────────────────────────────
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
1 │+import React, { useState } from 'react';
|
||||
2 │+import { useAuth } from '../context/AuthContext';
|
||||
3 │+
|
||||
4 │+export function LoginForm() {
|
||||
5 │+ const [email, setEmail] = useState('');
|
||||
6 │+ const [password, setPassword] = useState('');
|
||||
7 │+ const { login } = useAuth();
|
||||
|
||||
... (remaining diff content)
|
||||
|
||||
═══════════════════════════════════════════════════
|
||||
Comment Summary: 5 comments, 2 resolved
|
||||
═══════════════════════════════════════════════════
|
||||
```
|
||||
|
||||
### Step 3: Filter by Confidence (Optional)
|
||||
|
||||
If `PR_REVIEW_CONFIDENCE_THRESHOLD` is set, also annotate with high-confidence findings from previous reviews:
|
||||
|
||||
```
|
||||
44 │- const user = db.query("SELECT * FROM users WHERE id = " + id);
|
||||
│ ┌─── REVIEW FINDING (0.95 HIGH) ─────────────────────────────
|
||||
│ │ [SEC-001] SQL Injection Vulnerability
|
||||
│ │ Use parameterized queries to prevent injection attacks.
|
||||
│ └─────────────────────────────────────────────────────────────
|
||||
│ ┌─── COMMENT by @reviewer ────────────────────────────────────
|
||||
│ │ This is a SQL injection vulnerability...
|
||||
│ └─────────────────────────────────────────────────────────────
|
||||
```
|
||||
|
||||
## Output Formats
|
||||
|
||||
### Default (Annotated Diff)
|
||||
|
||||
Full diff with inline comments as shown above.
|
||||
|
||||
### Plain (--no-comments)
|
||||
|
||||
```
|
||||
/pr-diff 123 --no-comments
|
||||
|
||||
# Standard unified diff output without annotations
|
||||
```
|
||||
|
||||
### File Filter (--file)
|
||||
|
||||
```
|
||||
/pr-diff 123 --file "src/api/*"
|
||||
|
||||
# Shows diff only for files matching pattern
|
||||
```
|
||||
Use annotated diff format from `skills/output-formats.md`
|
||||
|
||||
## Use Cases
|
||||
|
||||
- **Review preparation**: See the full context of changes with existing feedback
|
||||
- **Followup work**: Understand what was commented on and where
|
||||
- **Discussion context**: View threaded conversations alongside the code
|
||||
- **Progress tracking**: See which comments have been resolved
|
||||
|
||||
## Configuration
|
||||
|
||||
| Variable | Default | Description |
|
||||
|----------|---------|-------------|
|
||||
| `PR_REVIEW_CONFIDENCE_THRESHOLD` | `0.7` | Minimum confidence for showing review findings |
|
||||
- Review preparation with existing feedback
|
||||
- Followup work - see what was commented
|
||||
- Progress tracking on resolved comments
|
||||
|
||||
## Related Commands
|
||||
|
||||
| Command | Purpose |
|
||||
|---------|---------|
|
||||
| `/pr-summary` | Quick overview without diff |
|
||||
| `/pr-review` | Full multi-agent review |
|
||||
| `/pr-findings` | Filter review findings by category |
|
||||
| `/pr-summary` | Quick overview |
|
||||
| `/pr-review` | Full review |
|
||||
| `/pr-findings` | Filter findings |
|
||||
|
||||
Reference in New Issue
Block a user