diffprism 0.10.0 → 0.10.2
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 +101 -63
- package/dist/bin.js +1 -1
- package/dist/mcp-server.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,97 +2,127 @@
|
|
|
2
2
|
|
|
3
3
|
Local-first code review tool for agent-generated code changes. Opens a browser-based diff viewer from the CLI or Claude Code (via MCP).
|
|
4
4
|
|
|
5
|
-
DiffPrism gives you a visual review step for AI-written code — stage your changes, run the tool, and a browser window opens with a
|
|
5
|
+
DiffPrism gives you a visual review step for AI-written code — stage your changes, run the tool, and a browser window opens with a full-featured diff viewer. Review inline, leave comments, and your decision is returned as structured JSON.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Syntax-highlighted diffs** — unified or split (side-by-side) view with toggle
|
|
10
|
+
- **Inline line-level commenting** — click any line to add comments typed as `must_fix`, `suggestion`, `question`, or `nitpick`
|
|
11
|
+
- **File-level review status** — mark each file as reviewed, approved, or needs changes
|
|
12
|
+
- **Review briefing bar** — summary stats, complexity scoring, test coverage gaps, pattern flags, and dependency tracking
|
|
13
|
+
- **Agent reasoning panel** — see why the AI made each change
|
|
14
|
+
- **Dark/light mode** — toggle with theme persistence
|
|
15
|
+
- **Keyboard shortcuts** — `j`/`k` navigate files, `Space`/`Enter` cycle file status
|
|
16
|
+
- **Three-way decisions** — approve, request changes, or approve with comments
|
|
17
|
+
- **Branch display** — current git branch shown in the review header
|
|
6
18
|
|
|
7
19
|
## Quick Start
|
|
8
20
|
|
|
9
|
-
|
|
10
|
-
# Clone and install
|
|
11
|
-
git clone <repo-url> && cd diffprism
|
|
12
|
-
pnpm install
|
|
21
|
+
### Use with Claude Code (recommended)
|
|
13
22
|
|
|
14
|
-
|
|
15
|
-
|
|
23
|
+
**1. Add the MCP server** — create `.mcp.json` in your project root:
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"mcpServers": {
|
|
28
|
+
"diffprism": {
|
|
29
|
+
"command": "npx",
|
|
30
|
+
"args": ["diffprism", "serve"]
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
16
34
|
```
|
|
17
35
|
|
|
18
|
-
|
|
36
|
+
**2. Auto-approve the tool** (optional) — add to `.claude/settings.json` so Claude can open reviews without prompting:
|
|
19
37
|
|
|
20
|
-
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"permissions": {
|
|
41
|
+
"allow": [
|
|
42
|
+
"mcp__diffprism__open_review"
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
21
47
|
|
|
22
|
-
|
|
48
|
+
**3. Tell Claude to use it** — add to your project's `CLAUDE.md`:
|
|
23
49
|
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
pnpm cli review
|
|
27
|
-
pnpm cli review --staged
|
|
50
|
+
```markdown
|
|
51
|
+
## Code Review
|
|
28
52
|
|
|
29
|
-
|
|
30
|
-
|
|
53
|
+
Before committing changes, use the diffprism MCP tool to open a review:
|
|
54
|
+
- Call `open_review` with the appropriate `diff_ref` (e.g. `"staged"`, `"HEAD~1..HEAD"`)
|
|
55
|
+
- Include a `title` and `description` summarizing the changes
|
|
56
|
+
- Wait for the user's review decision before proceeding
|
|
57
|
+
```
|
|
31
58
|
|
|
32
|
-
|
|
33
|
-
pnpm cli review HEAD~3
|
|
34
|
-
pnpm cli review main..feature-branch
|
|
59
|
+
That's it. Claude will now open a browser-based review before committing. You review the diff, leave comments, and the result goes back to Claude as structured JSON.
|
|
35
60
|
|
|
36
|
-
|
|
37
|
-
pnpm cli review --staged --title "Add auth middleware"
|
|
38
|
-
```
|
|
61
|
+
See the [full setup guide](docs/claude-setup.md) for Claude Desktop config, troubleshooting, and advanced options.
|
|
39
62
|
|
|
40
|
-
|
|
63
|
+
### Use from the CLI
|
|
41
64
|
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"comments": [],
|
|
46
|
-
"summary": ""
|
|
47
|
-
}
|
|
48
|
-
```
|
|
65
|
+
```bash
|
|
66
|
+
# Install globally (or use npx)
|
|
67
|
+
npm install -g diffprism
|
|
49
68
|
|
|
50
|
-
|
|
69
|
+
# Review all changes (staged + unstaged, default)
|
|
70
|
+
diffprism review
|
|
51
71
|
|
|
52
|
-
|
|
72
|
+
# Review staged changes only
|
|
73
|
+
diffprism review --staged
|
|
53
74
|
|
|
54
|
-
|
|
75
|
+
# Review unstaged changes only
|
|
76
|
+
diffprism review --unstaged
|
|
55
77
|
|
|
56
|
-
|
|
78
|
+
# Review a specific ref range
|
|
79
|
+
diffprism review HEAD~3
|
|
80
|
+
diffprism review main..feature-branch
|
|
57
81
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"mcpServers": {
|
|
61
|
-
"diffprism": {
|
|
62
|
-
"command": "npx",
|
|
63
|
-
"args": ["diffprism", "serve"]
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
82
|
+
# Add a title to the review
|
|
83
|
+
diffprism review --staged --title "Add auth middleware"
|
|
67
84
|
```
|
|
68
85
|
|
|
69
|
-
**
|
|
86
|
+
A browser window opens with the diff viewer. Review the changes and click **Approve**, **Request Changes**, or **Approve with Comments**.
|
|
70
87
|
|
|
71
|
-
|
|
72
|
-
|---------------|----------|--------------------------------------|
|
|
73
|
-
| `diff_ref` | yes | Git diff reference: `"staged"`, `"unstaged"`, or a ref range |
|
|
74
|
-
| `title` | no | Title shown in the review UI |
|
|
75
|
-
| `description` | no | Description of the changes |
|
|
76
|
-
| `reasoning` | no | Agent reasoning about why changes were made |
|
|
88
|
+
## MCP Tool Reference
|
|
77
89
|
|
|
78
|
-
The
|
|
90
|
+
The MCP server exposes one tool: **`open_review`**
|
|
79
91
|
|
|
80
|
-
|
|
92
|
+
| Parameter | Required | Description |
|
|
93
|
+
|---------------|----------|-------------------------------------------------------------------|
|
|
94
|
+
| `diff_ref` | Yes | `"staged"`, `"unstaged"`, or a git ref range (e.g. `"HEAD~3..HEAD"`, `"main..feature"`) |
|
|
95
|
+
| `title` | No | Title displayed in the review UI |
|
|
96
|
+
| `description` | No | Description of the changes |
|
|
97
|
+
| `reasoning` | No | Agent reasoning about why the changes were made (shown in the reasoning panel) |
|
|
98
|
+
|
|
99
|
+
**Returns:** A `ReviewResult` JSON object:
|
|
81
100
|
|
|
82
101
|
```json
|
|
83
102
|
{
|
|
84
|
-
"
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
103
|
+
"decision": "approved",
|
|
104
|
+
"comments": [
|
|
105
|
+
{
|
|
106
|
+
"file": "src/index.ts",
|
|
107
|
+
"line": 42,
|
|
108
|
+
"body": "Consider adding a null check here",
|
|
109
|
+
"type": "suggestion"
|
|
110
|
+
}
|
|
111
|
+
],
|
|
112
|
+
"summary": "Looks good, one minor suggestion."
|
|
89
113
|
}
|
|
90
114
|
```
|
|
91
115
|
|
|
116
|
+
| Field | Description |
|
|
117
|
+
|-------|-------------|
|
|
118
|
+
| `decision` | `approved`, `changes_requested`, or `approved_with_comments` |
|
|
119
|
+
| `comments` | Array of inline comments with file, line, body, and type (`must_fix`, `suggestion`, `question`, `nitpick`) |
|
|
120
|
+
| `summary` | Optional reviewer summary |
|
|
121
|
+
|
|
92
122
|
## How It Works
|
|
93
123
|
|
|
94
124
|
1. **Extract** — runs `git diff` and parses the output into a structured `DiffSet`
|
|
95
|
-
2. **Analyze** — generates a `ReviewBriefing
|
|
125
|
+
2. **Analyze** — generates a `ReviewBriefing`: file stats, complexity scores, test gap detection, pattern flags, dependency changes
|
|
96
126
|
3. **Serve** — starts a Vite dev server (React UI) and WebSocket bridge on random ports
|
|
97
127
|
4. **Review** — opens a browser to the diff viewer, waits for your decision
|
|
98
128
|
5. **Return** — cleans up servers and returns the `ReviewResult`
|
|
@@ -100,8 +130,12 @@ The tool opens a browser, blocks until you submit a review, and returns the `Rev
|
|
|
100
130
|
## Development
|
|
101
131
|
|
|
102
132
|
```bash
|
|
103
|
-
|
|
133
|
+
git clone https://github.com/CodeJonesW/diffprism.git
|
|
134
|
+
cd diffprism
|
|
135
|
+
pnpm install
|
|
104
136
|
pnpm test # Run all tests (Vitest)
|
|
137
|
+
pnpm run build # Build all packages
|
|
138
|
+
pnpm cli review --staged # Run CLI from source
|
|
105
139
|
npx tsc --noEmit -p packages/core/tsconfig.json # Type-check a package
|
|
106
140
|
```
|
|
107
141
|
|
|
@@ -110,15 +144,19 @@ npx tsc --noEmit -p packages/core/tsconfig.json # Type-check a package
|
|
|
110
144
|
```
|
|
111
145
|
packages/core — Shared types, pipeline orchestrator, WebSocket bridge
|
|
112
146
|
packages/git — Git diff extraction + unified diff parser
|
|
113
|
-
packages/analysis — Deterministic review briefing
|
|
114
|
-
packages/ui — React 19 + Vite + Tailwind diff viewer
|
|
147
|
+
packages/analysis — Deterministic review briefing (complexity, test gaps, patterns)
|
|
148
|
+
packages/ui — React 19 + Vite 6 + Tailwind + Zustand diff viewer
|
|
115
149
|
packages/mcp-server — MCP tool server (open_review)
|
|
116
|
-
packages/github — Placeholder (future GitHub integration)
|
|
117
150
|
cli/ — Commander CLI entry point
|
|
118
151
|
```
|
|
119
152
|
|
|
120
153
|
### Requirements
|
|
121
154
|
|
|
122
155
|
- Node.js >= 20
|
|
123
|
-
- pnpm
|
|
156
|
+
- pnpm (for development)
|
|
124
157
|
- Git
|
|
158
|
+
|
|
159
|
+
## Documentation
|
|
160
|
+
|
|
161
|
+
- [Claude Code / Claude Desktop Setup Guide](docs/claude-setup.md) — detailed MCP configuration, auto-approval, and troubleshooting
|
|
162
|
+
- [UX Design Notes](docs/ux-design-notes.md) — design decisions, CLI defaults rationale, and multi-agent workflow thinking
|
package/dist/bin.js
CHANGED
|
@@ -42,7 +42,7 @@ async function serve() {
|
|
|
42
42
|
|
|
43
43
|
// cli/src/index.ts
|
|
44
44
|
var program = new Command();
|
|
45
|
-
program.name("diffprism").description("Local-first code review tool for agent-generated changes").version(true ? "0.10.
|
|
45
|
+
program.name("diffprism").description("Local-first code review tool for agent-generated changes").version(true ? "0.10.2" : "0.0.0-dev");
|
|
46
46
|
program.command("review [ref]").description("Open a browser-based diff review").option("--staged", "Review staged changes").option("--unstaged", "Review unstaged changes").option("-t, --title <title>", "Review title").option("--dev", "Use Vite dev server with HMR instead of static files").action(review);
|
|
47
47
|
program.command("serve").description("Start the MCP server for Claude Code integration").action(serve);
|
|
48
48
|
program.parse();
|
package/dist/mcp-server.js
CHANGED