diffprism 0.13.3 → 0.13.4
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 +41 -1
- package/dist/mcp-server.js +1 -1
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -46,6 +46,7 @@ async function serve() {
|
|
|
46
46
|
import fs from "fs";
|
|
47
47
|
import path from "path";
|
|
48
48
|
import os from "os";
|
|
49
|
+
import readline from "readline";
|
|
49
50
|
|
|
50
51
|
// cli/src/templates/skill.ts
|
|
51
52
|
var skillContent = `---
|
|
@@ -268,6 +269,43 @@ function setupStopHook(gitRoot, force) {
|
|
|
268
269
|
writeJsonFile(filePath, { ...existing, hooks });
|
|
269
270
|
return { action, filePath: filePath + " (Stop hook)" };
|
|
270
271
|
}
|
|
272
|
+
async function promptUser(question) {
|
|
273
|
+
const rl = readline.createInterface({
|
|
274
|
+
input: process.stdin,
|
|
275
|
+
output: process.stdout
|
|
276
|
+
});
|
|
277
|
+
return new Promise((resolve) => {
|
|
278
|
+
rl.question(question, (answer) => {
|
|
279
|
+
rl.close();
|
|
280
|
+
resolve(answer.toLowerCase() !== "n");
|
|
281
|
+
});
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
async function setupGitignore(gitRoot) {
|
|
285
|
+
const filePath = path.join(gitRoot, ".gitignore");
|
|
286
|
+
const entry = ".diffprism";
|
|
287
|
+
if (fs.existsSync(filePath)) {
|
|
288
|
+
const content = fs.readFileSync(filePath, "utf-8");
|
|
289
|
+
const lines = content.split("\n").map((l) => l.trim());
|
|
290
|
+
if (lines.includes(entry)) {
|
|
291
|
+
return { action: "skipped", filePath };
|
|
292
|
+
}
|
|
293
|
+
const newContent = content.endsWith("\n") ? content + entry + "\n" : content + "\n" + entry + "\n";
|
|
294
|
+
fs.writeFileSync(filePath, newContent);
|
|
295
|
+
return { action: "updated", filePath };
|
|
296
|
+
}
|
|
297
|
+
const confirmed = await promptUser(
|
|
298
|
+
"No .gitignore found. Create one with .diffprism entry? (Y/n) "
|
|
299
|
+
);
|
|
300
|
+
if (!confirmed) {
|
|
301
|
+
console.log(
|
|
302
|
+
" Warning: .diffprism directory will appear in git status and may trigger watch-mode loops."
|
|
303
|
+
);
|
|
304
|
+
return { action: "skipped", filePath };
|
|
305
|
+
}
|
|
306
|
+
fs.writeFileSync(filePath, entry + "\n");
|
|
307
|
+
return { action: "created", filePath };
|
|
308
|
+
}
|
|
271
309
|
async function setup(flags) {
|
|
272
310
|
const gitRoot = findGitRoot(process.cwd());
|
|
273
311
|
if (!gitRoot) {
|
|
@@ -281,6 +319,8 @@ async function setup(flags) {
|
|
|
281
319
|
const global = flags.global ?? false;
|
|
282
320
|
console.log("Setting up DiffPrism for Claude Code...\n");
|
|
283
321
|
const result = { created: [], updated: [], skipped: [] };
|
|
322
|
+
const gitignore = await setupGitignore(gitRoot);
|
|
323
|
+
result[gitignore.action].push(gitignore.filePath);
|
|
284
324
|
const mcp = setupMcpJson(gitRoot, force);
|
|
285
325
|
result[mcp.action === "skipped" ? "skipped" : mcp.action === "created" ? "created" : "updated"].push(mcp.filePath);
|
|
286
326
|
const settings = setupClaudeSettings(gitRoot, force);
|
|
@@ -380,7 +420,7 @@ async function notifyStop() {
|
|
|
380
420
|
|
|
381
421
|
// cli/src/index.ts
|
|
382
422
|
var program = new Command();
|
|
383
|
-
program.name("diffprism").description("Local-first code review tool for agent-generated changes").version(true ? "0.13.
|
|
423
|
+
program.name("diffprism").description("Local-first code review tool for agent-generated changes").version(true ? "0.13.4" : "0.0.0-dev");
|
|
384
424
|
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);
|
|
385
425
|
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);
|
|
386
426
|
program.command("notify-stop").description("Signal the watch server to refresh (used by Claude Code hooks)").action(notifyStop);
|
package/dist/mcp-server.js
CHANGED