diffprism 0.11.2 → 0.12.1

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
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  startReview
4
- } from "./chunk-Z6JCMILV.js";
4
+ } from "./chunk-LOX6GE37.js";
5
5
 
6
6
  // cli/src/index.ts
7
7
  import { Command } from "commander";
@@ -254,7 +254,7 @@ async function setup(flags) {
254
254
 
255
255
  // cli/src/index.ts
256
256
  var program = new Command();
257
- program.name("diffprism").description("Local-first code review tool for agent-generated changes").version(true ? "0.11.2" : "0.0.0-dev");
257
+ program.name("diffprism").description("Local-first code review tool for agent-generated changes").version(true ? "0.12.1" : "0.0.0-dev");
258
258
  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);
259
259
  program.command("serve").description("Start the MCP server for Claude Code integration").action(serve);
260
260
  program.command("setup").description("Configure DiffPrism for Claude Code integration").option("--global", "Install skill globally (~/.claude/skills/)").option("--force", "Overwrite existing configuration files").action(setup);
@@ -597,6 +597,67 @@ function detectPatterns(files) {
597
597
  results.sort((a, b) => a.file.localeCompare(b.file) || a.line - b.line);
598
598
  return results;
599
599
  }
600
+ var SECURITY_MATCHERS = [
601
+ {
602
+ pattern: "eval",
603
+ severity: "critical",
604
+ test: (l) => /\beval\s*\(/.test(l)
605
+ },
606
+ {
607
+ pattern: "inner_html",
608
+ severity: "warning",
609
+ test: (l) => /\.innerHTML\b|dangerouslySetInnerHTML/.test(l)
610
+ },
611
+ {
612
+ pattern: "sql_injection",
613
+ severity: "critical",
614
+ test: (l) => /`[^`]*\b(SELECT|INSERT|UPDATE|DELETE)\b/i.test(l) || /\b(SELECT|INSERT|UPDATE|DELETE)\b[^`]*\$\{/i.test(l)
615
+ },
616
+ {
617
+ pattern: "exec",
618
+ severity: "critical",
619
+ test: (l) => /child_process/.test(l) || /\bexec\s*\(/.test(l) || /\bexecSync\s*\(/.test(l)
620
+ },
621
+ {
622
+ pattern: "hardcoded_secret",
623
+ severity: "critical",
624
+ test: (l) => /\b(token|secret|api_key|apikey|password|passwd|credential)\s*=\s*["']/i.test(l)
625
+ },
626
+ {
627
+ pattern: "insecure_url",
628
+ severity: "warning",
629
+ test: (l) => /http:\/\/(?!localhost|127\.0\.0\.1|0\.0\.0\.0)/.test(l)
630
+ }
631
+ ];
632
+ function detectSecurityPatterns(files) {
633
+ const results = [];
634
+ for (const file of files) {
635
+ for (const hunk of file.hunks) {
636
+ for (const change of hunk.changes) {
637
+ if (change.type !== "add") continue;
638
+ for (const matcher of SECURITY_MATCHERS) {
639
+ if (matcher.test(change.content)) {
640
+ results.push({
641
+ file: file.path,
642
+ line: change.lineNumber,
643
+ pattern: matcher.pattern,
644
+ content: change.content.trim(),
645
+ severity: matcher.severity
646
+ });
647
+ }
648
+ }
649
+ }
650
+ }
651
+ }
652
+ results.sort((a, b) => {
653
+ const severityOrder = { critical: 0, warning: 1 };
654
+ const aSev = severityOrder[a.severity];
655
+ const bSev = severityOrder[b.severity];
656
+ if (aSev !== bSev) return aSev - bSev;
657
+ return a.file.localeCompare(b.file) || a.line - b.line;
658
+ });
659
+ return results;
660
+ }
600
661
 
601
662
  // packages/analysis/src/index.ts
602
663
  function analyze(diffSet) {
@@ -609,7 +670,9 @@ function analyze(diffSet) {
609
670
  const summary = generateSummary(files);
610
671
  const complexity = computeComplexityScores(files);
611
672
  const testCoverage = detectTestCoverageGaps(files);
612
- const patterns = detectPatterns(files);
673
+ const codePatterns = detectPatterns(files);
674
+ const securityPatterns = detectSecurityPatterns(files);
675
+ const patterns = [...securityPatterns, ...codePatterns];
613
676
  return {
614
677
  summary,
615
678
  triage,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  startReview
3
- } from "./chunk-Z6JCMILV.js";
3
+ } from "./chunk-LOX6GE37.js";
4
4
 
5
5
  // packages/mcp-server/src/index.ts
6
6
  import fs from "fs";
@@ -11,7 +11,7 @@ import { z } from "zod";
11
11
  async function startMcpServer() {
12
12
  const server = new McpServer({
13
13
  name: "diffprism",
14
- version: true ? "0.11.2" : "0.0.0-dev"
14
+ version: true ? "0.12.1" : "0.0.0-dev"
15
15
  });
16
16
  server.tool(
17
17
  "open_review",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "diffprism",
3
- "version": "0.11.2",
3
+ "version": "0.12.1",
4
4
  "type": "module",
5
5
  "description": "Local-first code review tool for agent-generated code changes",
6
6
  "bin": {