diffprism 0.27.0 → 0.30.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/dist/bin.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
startGlobalServer,
|
|
7
7
|
startReview,
|
|
8
8
|
startWatch
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-OJ723D6Z.js";
|
|
10
10
|
|
|
11
11
|
// cli/src/index.ts
|
|
12
12
|
import { Command } from "commander";
|
|
@@ -140,10 +140,46 @@ Use this pattern:
|
|
|
140
140
|
|
|
141
141
|
You can also check for feedback without blocking by calling \`get_review_result\` without \`wait\` at natural breakpoints (between tasks, before committing, etc.).
|
|
142
142
|
|
|
143
|
+
## Self-Review: Headless Analysis Tools
|
|
144
|
+
|
|
145
|
+
DiffPrism provides two headless tools that return analysis data as JSON without opening a browser. Use these to check your own work before requesting human review.
|
|
146
|
+
|
|
147
|
+
### Available Headless Tools
|
|
148
|
+
|
|
149
|
+
- **\`mcp__diffprism__get_diff\`** \u2014 Returns a structured \`DiffSet\` (files, hunks, additions/deletions) for a given diff ref. Use this to inspect exactly what changed.
|
|
150
|
+
- **\`mcp__diffprism__analyze_diff\`** \u2014 Returns a \`ReviewBriefing\` with summary, file triage, impact detection, complexity scores, test coverage gaps, and pattern flags (security issues, TODOs, console.logs left in, etc.).
|
|
151
|
+
|
|
152
|
+
Both accept a \`diff_ref\` parameter: \`"staged"\`, \`"unstaged"\`, \`"working-copy"\`, or a git range like \`"HEAD~3..HEAD"\`.
|
|
153
|
+
|
|
154
|
+
### Self-Review Loop
|
|
155
|
+
|
|
156
|
+
When you've finished writing code and before requesting human review, use this pattern:
|
|
157
|
+
|
|
158
|
+
1. **Analyze your changes:** Call \`mcp__diffprism__analyze_diff\` with \`diff_ref: "working-copy"\`
|
|
159
|
+
2. **Check the briefing for issues:**
|
|
160
|
+
- \`patterns\` \u2014 Look for console.logs, TODOs, security flags, disabled tests
|
|
161
|
+
- \`testCoverage\` \u2014 Check if changed source files have corresponding test changes
|
|
162
|
+
- \`complexity\` \u2014 Review high-complexity scores
|
|
163
|
+
- \`impact.newDependencies\` \u2014 Verify any new deps are intentional
|
|
164
|
+
- \`impact.breakingChanges\` \u2014 Confirm breaking changes are expected
|
|
165
|
+
3. **Fix any issues found** \u2014 Remove debug statements, add missing tests, address security flags
|
|
166
|
+
4. **Re-analyze** \u2014 Run \`analyze_diff\` again to confirm the issues are resolved
|
|
167
|
+
5. **Open for human review** \u2014 Once clean, use \`/review\` or \`open_review\` for final human sign-off
|
|
168
|
+
|
|
169
|
+
This loop catches common issues (leftover console.logs, missing tests, security anti-patterns) before the human reviewer sees them, making reviews faster and more focused.
|
|
170
|
+
|
|
171
|
+
### When to Use Headless Tools
|
|
172
|
+
|
|
173
|
+
- **After completing a coding task** \u2014 Self-check before requesting review
|
|
174
|
+
- **During implementation** \u2014 Periodically check for patterns and issues as you work
|
|
175
|
+
- **Before committing** \u2014 Quick sanity check on what's about to be committed
|
|
176
|
+
- **Do NOT use these as a replacement for human review** \u2014 They complement, not replace, \`/review\`
|
|
177
|
+
|
|
143
178
|
## Behavior Rules
|
|
144
179
|
|
|
145
180
|
- **IMPORTANT: Do NOT open reviews automatically.** Only open a review when the user explicitly invokes \`/review\` or directly asks for a review.
|
|
146
181
|
- Do NOT open reviews before commits, after code changes, or at any other time unless the user requests it.
|
|
182
|
+
- Headless tools (\`get_diff\`, \`analyze_diff\`) can be used proactively during development without explicit user request \u2014 they don't open a browser or interrupt the user.
|
|
147
183
|
- Power users can create \`diffprism.config.json\` manually to customize defaults (diff scope, reasoning).
|
|
148
184
|
`;
|
|
149
185
|
|
|
@@ -203,7 +239,9 @@ function setupClaudeSettings(baseDir, force) {
|
|
|
203
239
|
const toolNames = [
|
|
204
240
|
"mcp__diffprism__open_review",
|
|
205
241
|
"mcp__diffprism__update_review_context",
|
|
206
|
-
"mcp__diffprism__get_review_result"
|
|
242
|
+
"mcp__diffprism__get_review_result",
|
|
243
|
+
"mcp__diffprism__get_diff",
|
|
244
|
+
"mcp__diffprism__analyze_diff"
|
|
207
245
|
];
|
|
208
246
|
const allPresent = toolNames.every((t) => allow.includes(t));
|
|
209
247
|
if (allPresent && !force) {
|
|
@@ -433,7 +471,9 @@ function isGlobalSetupDone() {
|
|
|
433
471
|
const toolNames = [
|
|
434
472
|
"mcp__diffprism__open_review",
|
|
435
473
|
"mcp__diffprism__update_review_context",
|
|
436
|
-
"mcp__diffprism__get_review_result"
|
|
474
|
+
"mcp__diffprism__get_review_result",
|
|
475
|
+
"mcp__diffprism__get_diff",
|
|
476
|
+
"mcp__diffprism__analyze_diff"
|
|
437
477
|
];
|
|
438
478
|
return toolNames.every((t) => allow.includes(t));
|
|
439
479
|
}
|
|
@@ -476,7 +516,9 @@ function teardownClaudePermissions(baseDir) {
|
|
|
476
516
|
const toolNames = [
|
|
477
517
|
"mcp__diffprism__open_review",
|
|
478
518
|
"mcp__diffprism__update_review_context",
|
|
479
|
-
"mcp__diffprism__get_review_result"
|
|
519
|
+
"mcp__diffprism__get_review_result",
|
|
520
|
+
"mcp__diffprism__get_diff",
|
|
521
|
+
"mcp__diffprism__analyze_diff"
|
|
480
522
|
];
|
|
481
523
|
const filtered = allow.filter((t) => !toolNames.includes(t));
|
|
482
524
|
if (filtered.length === allow.length) {
|
|
@@ -836,7 +878,7 @@ async function serverStop() {
|
|
|
836
878
|
|
|
837
879
|
// cli/src/index.ts
|
|
838
880
|
var program = new Command();
|
|
839
|
-
program.name("diffprism").description("Local-first code review tool for agent-generated changes").version(true ? "0.
|
|
881
|
+
program.name("diffprism").description("Local-first code review tool for agent-generated changes").version(true ? "0.30.0" : "0.0.0-dev");
|
|
840
882
|
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);
|
|
841
883
|
program.command("start [ref]").description("Set up DiffPrism and start watching for changes").option("--staged", "Watch staged changes").option("--unstaged", "Watch unstaged changes").option("-t, --title <title>", "Review title").option("--interval <ms>", "Poll interval in milliseconds (default: 1000)").option("--dev", "Use Vite dev server with HMR instead of static files").option("--global", "Install skill globally (~/.claude/skills/)").option("--force", "Overwrite existing configuration files").action(start);
|
|
842
884
|
program.command("watch [ref]").description("Start a persistent diff watcher with live-updating browser UI").option("--staged", "Watch staged changes").option("--unstaged", "Watch unstaged changes").option("-t, --title <title>", "Review title").option("--interval <ms>", "Poll interval in milliseconds (default: 1000)").option("--dev", "Use Vite dev server with HMR instead of static files").action(watch);
|