diffprism 0.44.0 → 0.47.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.
package/README.md CHANGED
@@ -1,30 +1,97 @@
1
1
  # DiffPrism
2
2
 
3
- Your AI writes code you need to review it before it ships. But terminal diffs
4
- are hard to read, and there's no way to leave structured feedback that the agent
5
- actually acts on.
6
-
7
- DiffPrism opens a code review UI in your browser with syntax-highlighted diffs,
8
- inline commenting, and structured decisions (approve / request changes) that
9
- Claude reads and responds to.
3
+ Review GitHub PRs with AI superpowers. Paste a PR URL, see the diff in your browser, and use Claude Code or Cursor to interrogate every line, file, and change. Your AI gets full codebase context from your local clone — not just the diff hunks.
10
4
 
11
5
  ## How It Works
12
6
 
13
- 1. Type `/review` in Claude Code your browser opens with the diff
14
- 2. Review the changes, leave inline comments, approve or request changes
15
- 3. Claude reads your decision and acts on it (commits, opens a PR, or fixes what you flagged)
7
+ 1. **Open a PR**`diffprism review https://github.com/owner/repo/pull/123`
8
+ 2. **See the diff** Browser opens with syntax-highlighted diffs, file browser, and analysis briefing
9
+ 3. **Ask your AI** In Claude Code or Cursor, ask questions about the changes. Your AI calls MCP tools to get context and posts findings inline on the diff.
10
+
11
+ ```
12
+ $ cd ~/dev/my-project
13
+ $ diffprism review https://github.com/owner/repo/pull/123
14
+ Fetching PR #123 from owner/repo...
15
+ Add retry logic to API client
16
+ 4 files changed
17
+ Local repo: /Users/you/dev/my-project
18
+
19
+ Review open in browser. Use Claude Code to ask questions about this PR.
20
+ ```
21
+
22
+ Then in Claude Code:
23
+
24
+ ```
25
+ > What does this PR change?
26
+ → calls get_pr_context → high-level overview
27
+
28
+ > Is the retry logic in client.ts correct?
29
+ → calls get_file_diff + get_file_context → full file from your local clone
30
+
31
+ > Flag line 47 as a concern
32
+ → calls add_review_comment → annotation appears on the diff in your browser
33
+ ```
16
34
 
17
- ## Setup for Claude Code
35
+ ## Setup
18
36
 
19
37
  ```bash
20
- npx diffprism setup
38
+ npm install -g diffprism
39
+ diffprism setup # Register MCP server with Claude Code
21
40
  ```
22
41
 
23
- Configures everything and opens a demo review so you can see it in action. Restart Claude Code afterward to load the MCP server.
42
+ Run the server from within your local clone so the AI gets full file context:
24
43
 
25
- ## Use from the CLI
44
+ ```bash
45
+ cd ~/dev/my-project
46
+ diffprism server # Or let it auto-start on first review
47
+ ```
26
48
 
27
- No setup needed — just run:
49
+ ## PR Review
50
+
51
+ ```bash
52
+ diffprism review https://github.com/owner/repo/pull/123 # Full GitHub URL
53
+ diffprism review owner/repo#123 # Shorthand format
54
+ ```
55
+
56
+ The server auto-detects your local clone by matching `git remote -v` against the PR's repo. Your AI can then read full files via `git show` — not just diff hunks.
57
+
58
+ ## MCP Tools
59
+
60
+ DiffPrism exposes 14 MCP tools to your AI:
61
+
62
+ ### PR Review
63
+ | Tool | Purpose |
64
+ |------|---------|
65
+ | `get_pr_context` | High-level PR overview: metadata, briefing, file list, local repo status |
66
+ | `get_file_diff` | Diff hunks for a specific file with triage category |
67
+ | `get_file_context` | Full file content from local repo via `git show` |
68
+ | `add_review_comment` | Post a comment that appears inline on the diff in real-time |
69
+ | `get_review_comments` | Read all comments and annotations on the session |
70
+ | `get_user_focus` | What file/line the user is currently viewing in the browser |
71
+
72
+ ### Review Lifecycle
73
+ | Tool | Purpose |
74
+ |------|---------|
75
+ | `open_review` | Open browser review UI for local changes or a GitHub PR |
76
+ | `get_review_result` | Fetch result from a previous review |
77
+ | `update_review_context` | Push updated reasoning/description to a running session |
78
+
79
+ ### Analysis
80
+ | Tool | Purpose |
81
+ |------|---------|
82
+ | `analyze_diff` | Returns analysis JSON (patterns, complexity, test gaps) |
83
+ | `get_diff` | Returns structured diff JSON (file-level and hunk-level changes) |
84
+
85
+ ### Annotation
86
+ | Tool | Purpose |
87
+ |------|---------|
88
+ | `add_annotation` | Post a structured finding on a specific line |
89
+ | `flag_for_attention` | Mark files for human attention |
90
+ | `get_review_state` | Get current state of a session including all annotations |
91
+
92
+ ## Local Agent Review
93
+
94
+ DiffPrism also works for reviewing local agent-generated changes:
28
95
 
29
96
  ```bash
30
97
  diffprism review # Review all changes (staged + unstaged)
@@ -33,35 +100,68 @@ diffprism review HEAD~3 # Last 3 commits
33
100
  diffprism review main..feature # Branch diff
34
101
  ```
35
102
 
36
- ## Multi-Agent Reviews
103
+ Running multiple Claude Code sessions? All reviews appear in one browser dashboard with status badges, branch info, and desktop notifications.
37
104
 
38
- Running multiple Claude Code sessions (e.g., in git worktrees)? All reviews appear in one browser tab.
105
+ ## Commit Gate
39
106
 
40
- The server starts automatically on first use no manual setup needed. Each review shows up as a session with status badges, branch info, and change stats. Click to switch between reviews. Desktop notifications alert you when new reviews arrive.
107
+ Review is only reliable if something other than memory triggers it. `diffprism hook`
108
+ wires the review into your pre-commit hook, so a substantial change opens a review
109
+ before it can land.
41
110
 
42
111
  ```bash
43
- diffprism server status # Check if server is running
44
- diffprism server stop # Stop the background server
112
+ diffprism hook install # Add the gate to this repo's pre-commit hook
113
+ diffprism hook uninstall # Remove it
45
114
  ```
46
115
 
116
+ By default a staged diff of **120+ changed lines** opens a review; anything smaller
117
+ commits untouched. A gate that stops every commit is one you learn to skip with
118
+ `--no-verify`, and a skipped gate is worse than none. Tune it per repo:
119
+
120
+ ```bash
121
+ git config diffprism.gate-lines 200
122
+ ```
123
+
124
+ Approve and the commit proceeds. Request changes and the commit is blocked — with
125
+ your comments printed in the output, so the agent that ran `git commit` can read
126
+ what you asked for and fix it without another round trip:
127
+
128
+ ```
129
+ 140 staged lines (gate at 120) — opening DiffPrism review...
130
+
131
+ feature.ts:12 [must_fix] these should be a single exported record
132
+ feature.ts:88 [question] is this range meant to be inclusive?
133
+
134
+ Commit blocked: the review requested changes.
135
+ ```
136
+
137
+ Install adds one line between markers, so uninstall removes exactly that and leaves
138
+ the rest of your hook alone. Repos using `core.hooksPath` are handled.
139
+
47
140
  ## Features
48
141
 
49
- - **Syntax-highlighted diffs** — unified or split (side-by-side) view
50
- - **Inline commenting** — click any line to add `must_fix`, `suggestion`, `question`, or `nitpick` comments
51
- - **Review briefing** — complexity scores, test coverage gaps, pattern flags, dependency tracking
52
- - **Agent reasoning panel** — see why the AI made each change
53
- - **Quick actions** — Approve & Commit or Approve, Commit & PR from the review UI
54
- - **Multi-session dashboard** — review multiple agents from one browser tab
55
- - **Desktop notifications** — get alerted when a new review arrives
56
- - **GitHub PR review** — review any GitHub PR in DiffPrism's UI
57
- - **Keyboard shortcuts** — `j`/`k` files, `n`/`p` hunks, `c` comment, `s` status, `?` help
58
- - **Dark/light mode** — toggle with persistence
142
+ - **AI-powered PR review** — Your AI gets full codebase context via 14 MCP tools
143
+ - **Live annotations** — AI findings appear inline on the diff in real-time
144
+ - **Local repo context** — Full file content from your clone, not just diff hunks
145
+ - **No vendor lock-in** — Works with Claude Code, Cursor, or any MCP client
146
+ - **Syntax-highlighted diffs** — Unified or split view with refractor
147
+ - **Multi-session dashboard** — Review multiple agents from one browser tab
148
+ - **Review briefing** — Complexity scores, test coverage gaps, pattern flags
149
+ - **Auto-detect local repo** — Matches `git remote -v` against the PR's repo
150
+ - **Keyboard shortcuts** — `j`/`k` files, `n`/`p` hunks, `s` status, `?` help
151
+ - **Dark/light mode** — Toggle with persistence
59
152
 
60
- ## Uninstall
153
+ ## CLI Reference
61
154
 
62
155
  ```bash
63
- npx diffprism teardown # Remove from current project
64
- npx diffprism teardown --global # Remove global config
156
+ diffprism review <ref> # Open a review (PR URL, git ref, or flags)
157
+ diffprism setup # Configure Claude Code integration
158
+ diffprism setup --global # Global setup (no git repo needed)
159
+ diffprism server # Start the background server
160
+ diffprism server status # Check server status
161
+ diffprism server stop # Stop the server
162
+ diffprism hook install # Gate commits on a review
163
+ diffprism hook uninstall # Remove the gate
164
+ diffprism teardown # Remove configuration
65
165
  ```
66
166
 
67
167
  ## Development
@@ -82,7 +182,7 @@ packages/core — Server, types, server-client utilities
82
182
  packages/git — Git diff extraction + parser
83
183
  packages/analysis — Deterministic review briefing
84
184
  packages/ui — React 19 + Vite 6 + Tailwind + Zustand
85
- packages/mcp-server — MCP tool server (9 tools)
185
+ packages/mcp-server — MCP tool server (14 tools)
86
186
  packages/github — GitHub PR fetching + review submission
87
187
  cli/ — Commander CLI
88
188
  ```