AI代码评估服务

一个提供45个专业评审员评估AI生成代码质量的MCP服务器,结合确定性模式匹配、AST分析和LLM驱动的深度评审提示。

  • by KevinRabun
  • TypeScript
  • 本地部署
  • 7 星标
  • 更新于
在 GitHub 查看 KevinRabun/judges

使用说明

评审团

MCP(模型上下文协议)服务器,提供以下面板 45名专业法官 评估人工智能生成的代码——无论审查哪个项目,都充当独立的质量门。联合 确定性模式匹配和AST分析 (即时、离线、零LLM呼叫) LLM驱动的深度审查提示 让你的人工智能助手在所有45个领域进行专家角色分析。

亮点:

  • 包括 App Builder工作流(3步) 发布决策演示、简明语言风险总结和优先级修复——请参阅 尝试演示.
  • 包含 V2上下文感知评估 通过政策简介、证据校准、专业反馈、置信度评分和不确定性报告。
  • 包含 公共存储库URL报告 克隆一个回购,运行完整的仲裁庭,并输出一份合并的降价报告。
  • 200+确定性自动修复补丁 (参见 src/patches/index.ts)加上LLM支持的深度审查。

🧪 许多命令 printHelp 是实验性的/路线图。默认情况下,我们只显示GA命令。集 JUDGES_SHOW_EXPERIMENTAL=1 揭露存根;这些可能还没有连接。

🔰 包裹

  • 命令行界面: @kevinrabun/judges-cli → 二进制 judges (使用 npx @kevinrabun/judges-cli eval --file app.ts).
  • MCP/neneneba API: @kevinrabun/judges → 程序化API+MCP服务器(npm install @kevinrabun/judges).
  • VS代码扩展:参见 vscode-extension/.
  • GitHub行动: uses: KevinRabun/judges@main (参见 CI快速入门).

快速入门

CLI(一次性)

# Using the CLI package (recommended)
npx @kevinrabun/judges-cli eval --file src/app.ts

# Show GA commands only (default)
npx @kevinrabun/judges-cli --help

# Show experimental/roadmap commands
echo "JUDGES_SHOW_EXPERIMENTAL=1" >> $GITHUB_ENV
npx @kevinrabun/judges-cli --help

# License scan (supply-chain & license compliance)
npx @kevinrabun/judges-cli license-scan --dir .

CLI与API: 如果您想在应用程序(MCP/neneneba API)中嵌入Judges,请安装 @kevinrabun/judges。对于命令行,请使用 @kevinrabun/judges-cli (二进制 judges).

GitHub行动

name: Judges
on: [pull_request, push]
jobs:
  judges:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: KevinRabun/judges@main
        with:
          path: .
          diff-only: true           # evaluate only changed lines in PRs (default true)
          fail-on-findings: true    # fail on critical/high findings
          upload-sarif: true        # upload SARIF to GitHub Code Scanning

编程API(包括MCP服务器)

npm install @kevinrabun/judges
import { evaluateCode } from "@kevinrabun/judges/api";
const verdict = evaluateCode("const password = 'ProdSecret';", "typescript");
console.log(verdict.overallVerdict, verdict.overallScore);

MCP服务器

MCP服务器在stdio上运行,由您的MCP客户端(VS Code、Claude Desktop等)启动。 在MCP设置中配置它(例如。 mcp.json):

{
  "servers": {
    "judges": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@kevinrabun/judges"]
    }
  }
}

或者直接运行服务器:

npx @kevinrabun/judges
# Starts the MCP server on stdio

配置文件: .judgesrc.json (支持 ${ENV_VAR} 替代通过 expandEnvPlaceholders).看 配置.


为什么是法官?

AI代码生成器(Copilot、Cursor、Claude、ChatGPT等)编写代码很快,但它们通常会生成 不安全的默认值、缺少身份验证、硬编码的秘密和糟糕的错误处理人类审查员捕捉到了其中的一些,但没有人能始终如一地审查45个维度。

ESLint/Biome SonarQube Semgrep/CodeQL 士师记
范围 风格+一些bug bug+代码气味 安全模式 45个域名:安全性、成本、合规性、a11y、API设计、云、UX
AI生成的代码焦点 否 否 部分 专门建造的 用于AI输出故障模式
设置 按项目配置 服务器+扫描仪 云或本地 一个命令: npx @kevinrabun/judges-cli eval file.ts
自动修复补丁 有些 没有 没有 200+确定性补丁 --即时、离线
非技术产出 否 仪表板 否 简明的语言发现 什么/为什么/下一步
MCP本地 否 否 否 是 --在Copilot、Claude、Cursor内部工作
SARIF输出 否 是 是 是 --上传到GitHub代码扫描
成本 免费 $$$$ 免费/付费 免费/MIT

法官不会更换门楣 --它涵盖了linters没有的维度:身份验证策略、数据主权、成本模式、可访问性、特定于框架的反模式以及跨多个文件的架构问题。


快速开始

前提条件:Node.js >=18 (建议>=20), npx 可用。这 judges CLI二进制文件随附 @凯文拉布/法官cli (首选),也可通过以下方式工作 npx @kevinrabun/judges.

包装:

  • CLI: npm install -g @kevinrabun/judges-cli (或 npx @kevinrabun/judges-cli ...)
  • MCP/neneneba API: npm install @kevinrabun/judges

使用 @kevinrabun/judges 用于MCP服务器和编程API。使用 @kevinrabun/judges-cli 当你想要 judges 终端命令。

立即尝试(无需克隆)

# Install the CLI globally
npm install -g @kevinrabun/judges-cli

# Evaluate any file
judges eval src/app.ts

# Pipe from stdin
cat api.py | judges eval --language python

# Single judge
judges eval --judge cybersecurity server.ts

# SARIF output for CI
judges eval --file app.ts --format sarif > results.sarif

# HTML report with severity filters and dark/light theme
judges eval --file app.ts --format html > report.html

# Fail CI on findings (exit code 1)
judges eval --fail-on-findings src/api.ts

# Suppress known findings via baseline
judges eval --baseline baseline.json src/api.ts

# Use a named preset
judges eval --preset security-only src/api.ts

# Use a config file
judges eval --config .judgesrc.json src/api.ts

# Set a minimum score threshold (exit 1 if below)
judges eval --min-score 80 src/api.ts

# One-line summary for scripts
judges eval --summary src/api.ts

# Agentic skills (orchestrated judge sets)
judges skill ai-code-review --file src/app.ts
judges skill security-review --file src/api.ts --format json
judges skill release-gate --file src/app.ts
judges skills   # list available skills

> Full catalog: [`docs/skills.md`](docs/skills.md)


# List all 45 judges
judges list

其他CLI命令

# Interactive project setup wizard
judges init

# Preview auto-fix patches (dry run)
judges fix src/app.ts

# Apply patches directly
judges fix src/app.ts --apply

# License compliance scan (copyleft/unknown detection)
judges license-scan --format json --risk high

# Watch mode — re-evaluate on file save
judges watch src/

# Project-level report (local directory)
judges report . --format html --output report.html

# Evaluate a unified diff (pipe from git diff)
git diff HEAD~1 | judges diff

# Analyze dependencies for supply-chain risks
judges deps --path . --format json

# Run GitHub App server (zero-config PR reviews)
judges app serve --port 4567

# Run GitHub PR review (gh CLI required)
judges review --pr 123 --repo owner/name --diff-only

# Auto-tune presets and configs
judges tune --dir . --apply

# Create a baseline file to suppress known findings
judges baseline create --file src/api.ts -o baseline.json

# Generate CI template files
judges ci-templates --provider github
judges ci-templates --provider gitlab
judges ci-templates --provider azure
judges ci-templates --provider bitbucket

# Generate per-judge rule documentation
judges docs
judges docs --judge cybersecurity
judges docs --output docs/

# Install shell completions
judges completions bash   # eval "$(judges completions bash)"
judges completions zsh
judges completions fish
judges completions powershell

# Install pre-commit hook
judges hook install

# Uninstall pre-commit hook
judges hook uninstall

🔎 提示:CLI帮助现在默认为 仅GA命令。要查看实验/路线图命令,请运行:

JUDGES_SHOW_EXPERIMENTAL=1 judges --help

GitHub应用程序(自托管webhook)

以GitHub应用程序的身份运行零配置PR审阅器:

# Run the webhook server locally
judges app serve --port 4567

必需的环境变量:

  • JUDGES_APP_ID –GitHub应用程序ID
  • JUDGES_PRIVATE_KEY 或 JUDGES_PRIVATE_KEY_PATH –PEM私钥
  • JUDGES_WEBHOOK_SECRET –签名验证密钥

可选:

  • JUDGES_MIN_SEVERITY (默认值: medium)
  • JUDGES_MAX_COMMENTS (默认值:25)
  • JUDGES_TEST_DRY_RUN=1 避免在测试期间进行实时网络呼叫

对于本地测试,您可以公开 http://localhost:4567/webhook 通过 韩国http 4567 并相应地配置GitHub App webhook URL。

在GitHub操作中使用

使用零配置将Judges添加到您的CI管道中:

# .github/workflows/judges.yml
name: Judges Code Review
on: [pull_request]

jobs:
  judges:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      security-events: write  # only if using upload-sarif
    steps:
      - uses: actions/checkout@v4
      - uses: KevinRabun/judges@main
        with:
          path: src/api.ts        # file or directory
          format: text             # text | json | sarif | markdown
          upload-sarif: true       # upload to GitHub Code Scanning
          fail-on-findings: true   # fail CI on critical/high findings

输出 可用于下游步骤: verdict, score, findings, critical, high, sarif-file.

与Docker一起使用(不需要Node.js)

# Build the image
docker build -t judges .

# Evaluate a local file
docker run --rm -v $(pwd):/code judges eval --file /code/app.ts

# Pipe from stdin
cat api.py | docker run --rm -i judges eval --language python

# List judges
docker run --rm judges list

或用作MCP服务器

1.安装和构建

git clone https://github.com/KevinRabun/judges.git
cd judges
npm install
npm run build

2.尝试演示

运行附带的演示,查看所有45位评委评估一个故意有缺陷的API服务器:

npm run demo

这评估 examples/sample-vulnerable-api.ts --一个故意填充安全漏洞、性能反模式和代码质量问题的文件,并打印一份包含每位法官得分和调查结果的完整判决。

演示现在还包括 App Builder工作流(3步) 部分。在一次运行中,您将获得仲裁庭输出和工作流输出:

  • 释放决定(Ship now / Ship with caution / Do not ship)
  • 主要风险的简明语言总结
  • 优先补救任务和AI可修复 P0/P1 物品

示例工作流输出(截断):

╔══════════════════════════════════════════════════════════════╗
║             App Builder Workflow Demo (3-Step)             ║
╚══════════════════════════════════════════════════════════════╝

  Decision       : Do not ship
  Verdict        : FAIL (47/100)
  Risk Counts    : Critical 24 | High 27 | Medium 55

  Step 2 — Plain-Language Findings:
  - [CRITICAL] DATA-001: Hardcoded password detected
      What: ...
      Why : ...
      Next: ...

  Step 3 — Prioritized Tasks:
  - P0 | DEVELOPER | Effort L | DATA-001
      Task: ...
      Done: ...

  AI-Fixable Now (P0/P1):
  - P0 DATA-001: ...

仲裁庭输出示例(截断):

╔══════════════════════════════════════════════════════════════╗
║           Judges Panel — Full Tribunal Demo                 ║
╚══════════════════════════════════════════════════════════════╝

  Overall Verdict : FAIL
  Overall Score   : 43/100
  Critical Issues : 15
  High Issues     : 17
  Total Findings  : 83
  Judges Run      : 33

  Per-Judge Breakdown:
  ────────────────────────────────────────────────────────────────
  ❌ Judge Data Security              0/100    7 finding(s)
  ❌ Judge Cybersecurity              0/100    7 finding(s)
  ❌ Judge Cost Effectiveness        52/100    5 finding(s)
  ⚠️  Judge Scalability              65/100    4 finding(s)
  ❌ Judge Cloud Readiness           61/100    4 finding(s)
  ❌ Judge Software Practices        45/100    6 finding(s)
  ❌ Judge Accessibility              0/100    8 finding(s)
  ❌ Judge API Design                 0/100    9 finding(s)
  ❌ Judge Reliability               54/100    3 finding(s)
  ❌ Judge Observability             45/100    5 finding(s)
  ❌ Judge Performance               27/100    5 finding(s)
  ❌ Judge Compliance                 0/100    4 finding(s)
  ⚠️  Judge Testing                  90/100    1 finding(s)
  ⚠️  Judge Documentation            70/100    4 finding(s)
  ⚠️  Judge Internationalization     65/100    4 finding(s)
  ⚠️  Judge Dependency Health        90/100    1 finding(s)
  ❌ Judge Concurrency               44/100    4 finding(s)
  ❌ Judge Ethics & Bias             65/100    2 finding(s)
  ❌ Judge Maintainability           52/100    4 finding(s)
  ❌ Judge Error Handling            27/100    3 finding(s)
  ❌ Judge Authentication             0/100    4 finding(s)
  ❌ Judge Database                   0/100    5 finding(s)
  ❌ Judge Caching                   62/100    3 finding(s)
  ❌ Judge Configuration Mgmt         0/100    3 finding(s)
  ⚠️  Judge Backwards Compat         80/100    2 finding(s)
  ⚠️  Judge Portability              72/100    2 finding(s)
  ❌ Judge UX                        52/100    4 finding(s)
  ❌ Judge Logging Privacy            0/100    4 finding(s)
  ❌ Judge Rate Limiting             27/100    4 finding(s)
  ⚠️  Judge CI/CD                    80/100    2 finding(s)

3.运行测试

npm test

运行涵盖所有判断器、AST解析器、markdown格式化器和边缘情况的自动化测试。

4.连接到编辑器

VS代码(推荐--零配置)

安装 评审团 从市场扩展。它提供:

  • 在线诊断和快速修复 每次保存文件时
  • @judges 聊天参与者 --类型 @judges 在Copilot聊天中,或者只要求“评委小组评审”,Copilot就会自动路由
  • 自动配置MCP服务器 --Copilot无需设置即可使用所有45个专家角色提示
code --install-extension kevinrabun.judges-panel

VS代码——手动MCP配置

如果您更喜欢显式的工作区配置(或希望没有扩展的队友受益),请创建 .vscode/mcp.json:

{
  "servers": {
    "judges": {
      "command": "npx",
      "args": ["-y", "@kevinrabun/judges"]
    }
  }
}

克劳德桌面

增添 claude_desktop_config.json:

{
  "mcpServers": {
    "judges": {
      "command": "npx",
      "args": ["-y", "@kevinrabun/judges"]
    }
  }
}

游标/其他MCP客户端

使用相同 npx 适用于任何MCP兼容客户端的命令:

{
  "command": "npx",
  "args": ["-y", "@kevinrabun/judges"]
}

5.在GitHub Copilot PR评论中使用评委

是的,用户可以将Judges作为基于GitHub的审核工作流程的一部分,但有一个重要的警告:

  • 主办 copilot-pull-request-reviewer GitHub上目前不允许您像VS Code那样直接连接任意本地MCP服务器。
  • 实际模式是在每个PR上运行CI中的Judges,发布报告/检查,并让Copilot+人工审阅者在审阅过程中使用该输出。

选项A(推荐):PR工作流检查+报告工件

创建 .github/workflows/judges-pr-review.yml:

name: Judges PR Review

on:
  pull_request:
    types: [opened, synchronize, reopened]

jobs:
  judges:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: write

    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Setup Node
        uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: npm

      - name: Install
        run: npm ci

      - name: Generate Judges report
        run: |
          npx tsx -e "import { generateRepoReportFromLocalPath } from './src/reports/public-repo-report.ts';
          const result = generateRepoReportFromLocalPath({
            repoPath: process.cwd(),
            outputPath: 'judges-pr-report.md',
            maxFiles: 600,
            maxFindingsInReport: 150,
          });
          console.log('Overall:', result.overallVerdict, result.averageScore);"

      - name: Upload report artifact
        uses: actions/upload-artifact@v4
        with:
          name: judges-pr-report
          path: judges-pr-report.md

这为每个PR提供了一个可重复的评审输出,您的团队(和副驾驶)可以参考。

选项B:在仓库中添加Copilot自定义指令

添加 .github/instructions/judges.instructions.md 在以下指导下:

When reviewing pull requests:
1. Read the latest Judges report artifact/check output first.
2. Prioritize CRITICAL and HIGH findings in remediation guidance.
3. If findings conflict, defer to security/compliance-related Judges.
4. Include rule IDs (e.g., DATA-001, CYBER-004) in suggested fixes.

这有助于使副驾驶的反馈与法官的调查结果保持一致。


CLI 参考

所有命令支持 --help 了解使用详情。

judges eval

与所有45名法官或一名法官一起评估一份文件。

标志 描述
--file <path> /position 要评估的文件
--judge <id> / -j <id> 单判模式
--language <lang> / -l <lang> 语言提示(从扩展自动检测)
--format <fmt> / -f <fmt> 输出格式: text, json, sarif, markdown, html, pdf, junit, codeclimate, github-actions
--output <path> / -o <path> 将输出写入文件
--fail-on-findings 如果判定为失败,则以代码1退出
--baseline <path> / -b <path> JSON基线文件——抑制已知发现
--summary 打印一行摘要(非常适合脚本)
--config <path> 加载a .judgesrc / .judgesrc.json 配置文件
--preset <name> 使用命名预设(请参见 命名预设 对于所有22个选项)
--min-score <n> 如果总分低于此阈值,则以代码1退出
--verbose 打印定时和调试信息
--quiet 抑制非必要输出
--no-color 禁用ANSI颜色

judges init

生成项目配置的交互式向导:

  • .judgesrc.json --规则自定义、禁用判断、严重性阈值
  • .github/workflows/judges.yml --GitHub操作CI工作流
  • .gitlab-ci.judges.yml --GitLab CI管道(可选)
  • azure-pipelines.judges.yml --Azure管道(可选)

judges fix

预览或应用来自确定性发现的自动修复补丁。

标志 描述
position 要修复的文件
--apply 将补丁写入磁盘(默认:干运行)
--judge <id> 仅限于一名法官的裁决

judges watch

保存时不断重新评估文件。

标志 描述
position 要监视的文件或目录(默认值: .)
--judge <id> 单判模式
--fail-on-findings 如果任何评估失败,则退出非零

judges report

在本地目录上运行一个完整的项目级仲裁庭。

标志 描述
position 目录路径(默认值: .)
--format <fmt> 输出格式: text, json, html, markdown
--output <path> 将报告写入文件
--max-files <n> 要分析的最大文件数(默认值:600)
--max-file-bytes <n> 跳过大于此值的文件(默认值:300000)

judges hook

管理一个Git预提交钩子,对暂存文件运行Judges。

judges hook install    # add pre-commit hook
judges hook uninstall  # remove pre-commit hook

检测赫斯基(.husky/pre-commit)并回落到 .git/hooks/pre-commit。使用基于标记的注射,因此不会破坏现有的钩子。

judges diff

仅评估来自统一差分的变化线(例如。, git diff 输出)。

标志 描述
--file <path> 从文件而不是stdin读取diff
--format <fmt> 输出格式: text, json, sarif, junit, codeclimate
--output <path> 将输出写入文件
git diff HEAD~1 | judges diff
judges diff --file changes.patch --format sarif

judges deps

分析供应链风险的项目依赖关系。

标志 描述
--path <dir> 要扫描的项目根目录(默认值: .)
--format <fmt> 输出格式: text, json
judges deps --path .
judges deps --path ./backend --format json

judges baseline

创建一个基线文件,以在未来的评估中抑制已知的发现。

judges baseline create --file src/api.ts
judges baseline create --file src/api.ts -o .judges-baseline.json

judges ci-templates

为常用提供商生成CI/CD配置模板。

judges ci-templates --provider github   # .github/workflows/judges.yml
judges ci-templates --provider gitlab   # .gitlab-ci.judges.yml
judges ci-templates --provider azure    # azure-pipelines.judges.yml
judges ci-templates --provider bitbucket # bitbucket-pipelines.yml (snippet)

judges docs

在Markdown中生成每个法官的规则文档。

标志 描述
--judge <id> 为单个法官生成文档
--output <dir> 写个人 .md 每位法官的档案
judges docs                          # all judges to stdout
judges docs --judge cybersecurity    # single judge
judges docs --output docs/judges/    # write files to directory

judges completions

生成shell完成脚本。

eval "$(judges completions bash)"        # Bash
eval "$(judges completions zsh)"         # Zsh
judges completions fish | source         # Fish
judges completions powershell            # PowerShell (Register-ArgumentCompleter)

命名预设

使用 --preset 要应用预配置的评估设置,请执行以下操作:

预设 描述
strict 所有的严厉,所有的法官——最大的彻底性
lenient 只有高度和关键的发现——快速和集中
security-only 以安全为重点——禁用非安全判断(成本、可扩展性、文档、a11y、i18n、UX等)
startup 跳过合规、主权、i18n法官——快速行动
compliance 只有合规性、数据主权、身份验证——监管重点
performance 只有性能、可扩展性、缓存、成本效益
react 针对React/Next.js应用程序进行了调优——支持可访问性、XSS保护
express 针对Express.js API进行了调优——中间件安全、身份验证、CORS、速率限制
fastapi 针对Python FastAPI进行了调整-输入验证、异步模式、API安全性
django 针对Django应用程序进行了调优——模板安全、ORM滥用、CSRF
spring-boot 针对Java Spring Boot进行了调优——注入、配置、执行器安全
rails 针对Ruby on Rails进行了调优——批量分配、CSRF、SQL注入
nextjs 针对Next.js进行了调整-服务器/客户端安全、API路由、SSR/ISR
terraform 针对Terraform/OpenTofu IaC进行了调整——基础设施安全、合规性
kubernetes 针对K8s清单进行了调整——安全上下文、RBAC、资源限制
onboarding 首次采用的智能默认值——抑制嘈杂的规则
fintech 金融服务——PCI DSS、密码学、身份验证、审计
healthtech 医疗保健——HIPAA合规性、数据主权、加密、审计跟踪
saas 多租户SaaS——租户隔离、速率限制、可扩展性
government 政府/公共部门----合规、主权、认证
open-source 开源项目——文档、向后兼容性、安全性、依赖关系健康
ai-review 人工智能生成的代码审查——幻觉检测、安全性、身份验证、正确性
judges eval --preset security-only src/api.ts
judges eval --preset strict --format sarif src/app.ts > results.sarif

CI输出格式

JUnit XML

为Jenkins、Azure DevOps、GitHub Actions或GitLab测试结果查看器生成JUnit XML:

judges eval --format junit src/api.ts > results.xml

每个裁判都会映射到一个 <testsuite>,每个发现都成为 <testcase> 和 <failure> 严重/高度严重。

CodeClimate/GitLab代码质量

为GitLab代码质量或类似工具生成CodeClimate JSON:

judges eval --format codeclimate src/api.ts > codequality.json

分数徽章

为您的自述文件生成SVG或文本徽章:

import { generateBadgeSvg, generateBadgeText } from "@kevinrabun/judges/badge";

const svg = generateBadgeSvg(85);          // shields.io-style SVG
const text = generateBadgeText(85);        // "✓ judges 85/100"
const svg2 = generateBadgeSvg(75, "quality"); // custom label

法官小组

判断 域 规则前缀 它评估什么
数据安全 数据安全与隐私 DATA- 加密、PII处理、机密管理、访问控制
网络安全 网络安全与威胁防御 CYBER- 注入攻击、XSS、CSRF、身份验证漏洞、OWASP Top 10
成本效益 成本优化和资源效率 COST- 算法效率、N+1查询、内存浪费、缓存策略
可扩展性 可扩展性和性能 SCALE- 无状态、水平扩展、并发、瓶颈
云就绪 云原生架构和DevOps CLOUD- 12因素合规性、容器化、优雅关机、IaC
软件实践 软件工程最佳实践和安全SDLC SWDEV- SOLID原则、类型安全、错误处理、输入验证
无障碍 无障碍(a11y) A11Y- WCAG合规性、屏幕阅读器支持、键盘导航、ARIA
API设计 API设计与合同 API- REST约定、版本控制、分页、错误响应
可靠性 可靠性和弹性 REL- 错误处理、超时、重试、断路器
可观测性 监测和诊断 OBS- 结构化日志记录、健康检查、指标、跟踪
演出 运行时性能 PERF- N+1查询、同步I/O、缓存、内存泄漏
合规 监管和许可证合规 COMP- GDPR/CCPA、PII保护、同意、数据保留、审计跟踪
数据主权 数据、技术和运营主权 SOV- 数据驻留、跨境传输、供应商密钥管理、AI模型可移植性、身份联合、断路器、审计跟踪、数据导出
测试 测试质量和覆盖范围 TEST- 测试覆盖率、断言、测试隔离、命名
文档 文档和开发人员经验 DOC- JSDoc/docstring、幻数、TODO、代码注释
国际化 i18n和本地化 I18N- 硬编码字符串、区域设置处理、货币格式
依赖健康 供应链和依赖关系 DEPS- 版本固定、弃用的软件包、供应链
并发 并发和线程安全 CONC- 竞赛条件、无限并行性、缺失等待
伦理与偏见 AI/ML公平与道德 ETHICS- 人口逻辑、黑暗模式、包容性语言
可维护性 代码可维护性和技术债务 MAINT- 任何类型、幻数、深度嵌套、死代码、文件长度
错误处理 错误处理和容错 ERR- 空捕获块、缺少错误处理程序、吞下错误
认证 身份验证和授权 AUTH- 硬编码的证书、缺少身份验证中间件、查询参数中的令牌
数据库 数据库设计与查询效率 DB- SQL注入、N+1查询、连接池、事务
缓存 缓存策略和数据新鲜度 CACHE- 无边界缓存、缺少TTL、没有HTTP缓存标头
配置管理 配置和秘密管理 CFG- 硬编码的秘密、缺少环境变量、配置验证
向后兼容 向后兼容性和版本控制 COMPAT- API版本控制、中断更改、响应一致性
可移植性 平台可移植性和供应商独立性 PORTA- 特定于操作系统的路径、供应商锁定、硬编码主机
用户体验 用户体验和界面质量 UX- 加载状态、错误消息、分页、破坏性操作
日志隐私 日志隐私和数据修改 LOGPRIV- 日志中的PII、令牌日志、结构化日志、编辑
速率限制 速率限制和节流 RATE- 缺少速率限制、无限查询、回退策略
CI/CD CI/CD管道和部署安全 CICD- 测试基础设施、lint配置、Docker标签、构建脚本
代码结构 结构分析 STRUCT- 圈复杂度、嵌套深度、函数长度、死代码、类型安全
代理说明 代理指令Markdown质量与安全 AGENT- 指令层次结构、冲突检测、不安全覆盖、范围、验证、策略指导
AI代码安全 人工智能生成的代码质量和安全 AICS- 快速注入、不安全的LLM输出处理、调试默认值、缺少验证、AI响应的不安全反序列化
框架安全 特定于框架的安全和最佳实践 FW- React钩子排序、Express中间件链、Next.js SSR/SSG陷阱、Angular/Vue生命周期模式、Django/Flask/FastAPI安全、Spring Boot安全、ASP。NET核心认证和CORS,Go Gin/Echox/Fiber模式
IaC安全 基础设施即代码 IAC- 地形、二头肌、ARM模板配置错误、硬编码秘密、缺少加密、过于宽松的网络/IAM规则
安全 总体安全态势 SEC- 整体安全评估——不安全的数据流、弱加密、不安全的反序列化
幻觉检测 AI-引入API和进口验证 HALLU- 检测AI代码生成器中的幻觉API、伪造导入和不存在的模块
意图对齐 代码-注释对齐和存根检测 INTENT- 检测所述意图和实现、占位符存根、仅TODO功能之间的不匹配
API合同合规性 API设计和REST最佳实践 API- API端点输入验证、REST一致性、请求/响应合同一致性
多转弯连贯性 代码连贯性和一致性 COH- 自相矛盾的模式、重复的定义、死代码、不一致的命名
模型指纹检测 AI代码来源和模型归因 MFPR- 检测特定AI代码生成器的风格指纹特征
过度工程 简单与实用主义 OVER- 不必要的抽象、包装狂热、过早概括、过于复杂的模式
逻辑回顾 语义正确性和逻辑完整性 LOGIC- 反向条件、死代码、名称体不匹配、逐一关闭、控制流不完整
假阳性评论 假阳性检测和发现准确性 FPR- 元法官审查基于模式的假阳性发现:字符串文字上下文、注释/docstring匹配、测试脚手架、IaC模板门控

运作原理

该法庭分三层运作:

  1. 基于模式的分析 --所有工具(evaluate_code, evaluate_code_single_judge, evaluate_project, evaluate_diff)使用正则表达式模式匹配进行启发式分析,以捕捉常见的反模式。该层是即时的、确定性的,并且完全离线运行,没有任何外部API调用。

  2. 基于AST的结构分析 --代码结构判断(STRUCT-* rules)使用真正的抽象语法树解析来测量圈复杂度、嵌套深度、函数长度、参数计数、死代码和类型安全性,其精度是正则表达式无法达到的。所有支持的语言-- TypeScript、JavaScript、Python、Rust、Go、Java、C#和C++ --通过以下方式解析 树保姆WASM语法 (编译为WebAssembly的真实语法树,进程内,零本机依赖)。当WASM语法不可用时,会保留一个范围跟踪结构解析器作为后备。不需要外部AST服务器。

  3. LLM驱动的深度分析(提示) --服务器公开MCP提示(例如。, judge-data-security, judge-cybersecurity)提供每个法官的专家角色作为系统提示。当由基于LLM的客户端(Copilot、Claude、Cursor等)使用时,主机LLM会执行超出静态模式检测范围的更深入、上下文感知的概率分析。这就是 systemPrompt 每个评委都很活跃——评委本身不会打法学硕士电话,但它提供了专家标准,这样你的人工智能助理就可以充当45名专业评审员。


可组合设计

评审团是 双层 审核系统:即时 确定性工具 (离线,没有API键)用于模式和AST分析,以及 45个专家角色MCP提示 当连接到AI客户端时,解锁LLM驱动的深度分析。它并不试图成为CVE扫描器或linter。这些功能属于专用的MCP服务器,AI代理可以与Judges一起编排。

内置AST分析

与建议单独使用AST MCP服务器的早期版本不同,Judges Panel现在包括 基于真实AST的结构分析 开箱即用:

  • TypeScript、JavaScript、Python、Rust、Go、Java、C#、C++ --全部用a解析 统一树保姆WASM引擎 用于完整的语法树分析(函数、复杂性、嵌套、死代码、类型安全)。当WASM语法不可用时,回退到范围跟踪结构解析器

代码结构判断(STRUCT-*)使用这些解析器来精确测量:

规则 度量 阈值
STRUCT-001 圈复杂度 >每个函数10(高)
STRUCT-002 嵌套深度 >4级(中等)
STRUCT-003 函数长度 >50行(中等)
STRUCT-004 参数计数 >5个参数(中等)
STRUCT-005 死代码 无法访问的语句(低)
STRUCT-006 弱类型 any, dynamic, Object, interface{}, unsafe (中等)
STRUCT-007 文件复杂度 >40总圈复杂度(高)
STRUCT-008 极端复杂性 >每个功能20个(关键)
STRUCT-009 极端参数 >8个参数(高)
STRUCT-010 极限函数长度 >150行(高)

推荐的MCP堆栈

当你的AI编码助手连接到多个MCP服务器时,每个服务器都贡献了自己的专长:

┌─────────────────────────────────────────────────────────┐
│                   AI Coding Assistant                   │
│              (Claude, Copilot, Cursor, etc.)            │
└──────┬──────────────────┬──────────┬───────────────────┘
       │                  │          │
       ▼                  ▼          ▼
  ┌──────────────┐  ┌────────┐  ┌────────┐
  │   Judges     │  │  CVE / │  │ Linter │
  │   Panel      │  │  SBOM  │  │ Server │
  │ ─────────────│  └────────┘  └────────┘
  │ 44 Heuristic │   Vuln DB     Style &
  │   judges     │   scanning    correctness
  │ + AST judge  │
  └──────────────┘
   Patterns +
   structural
   analysis
层 它做什么 示例服务器
评审团 45个判断质量门——安全模式、AST分析、成本、可扩展性、a11y、合规性、主权、道德、依赖健康、代理指令治理、AI代码安全、框架安全 此服务器
CVE / SBOM 针对实时数据库的漏洞扫描——已知CVE、许可证风险、供应链 OSV、Snyk、Trivy、Grype MCP服务器
代码检查 特定语言风格和正确性规则 ESLint、Ruff、Clippy MCP服务器
运行时分析 内存、CPU、运行代码的延迟测量 自定义分析MCP服务器

这在实践中意味着什么

当你问你的人工智能助手时 “代码生产准备好了吗?”,代理人可以:

  1. 评审团 → 扫描硬编码的秘密、缺失的错误处理、N+1查询、可访问性差距、合规性问题, 加 分析圈复杂度,检测死代码,并通过AST标记深度嵌套函数
  2. CVE服务器 → 检查中的每个依赖项 package.json 针对已知漏洞
  3. Linter服务器 → 执行团队风格规则,抓住特定语言的陷阱

每个服务器返回结构化的结果。人工智能将所有内容综合成一个单一的、可操作的审查——没有一台服务器需要完成所有工作。


MCP工具

evaluate_v2

跑 V2情境感知法庭评估 旨在提高首席工程师/建筑师级审查的反馈质量:

  • 策略配置文件校准(default, startup, regulated, healthcare, fintech, public-sector)
  • 上下文摄取(架构注释、约束、标准、已知风险、数据边界模型)
  • 运行时证据挂钩(测试、覆盖率、延迟、错误率、漏洞计数)
  • 按法官/领域汇总专业反馈
  • 信心评分和明确的不确定性报告

支持:

  • 代码模式: code + language
  • 项目模式: files[]
参数 类型 必填 说明
code string 条件 单文件模式的源代码
language string 条件 单文件模式的编程语言
files array 条件 { path, content, language }[] 对于项目模式
context string 否 高级审阅上下文
includeAstFindings boolean 否 包括AST/代码结构发现(默认值:true)
minConfidence number no 要包含的最小查找置信度(0-1,默认值:0)
policyProfile enum 否 default, startup, regulated, healthcare, fintech, public-sector
evaluationContext object 否 结构化体系结构/约束上下文
evidence object no 置信度校准的运行时/操作证据

evaluate_app_builder_flow

跑 三步应用构建器工作流程 对于技术和非技术利益相关者:

  1. 法庭审查(代码/项目/差异)
  2. 顶级风险的简明语言翻译
  3. 通过AI可修复的P0/P1提取,优先处理修复任务

支持:

  • 代码模式: code + language
  • 项目模式: files[]
  • Diff模式: code + language + changedLines[]
参数 类型 必填 说明
code string 条件 完整源代码内容(代码/差异模式)
language string 条件 编程语言(代码/差异模式)
files array 条件 { path, content, language }[] 对于项目模式
changedLines number[] no 1基于diff模式的更改行
context string no 可选业务/技术上下文
maxFindings number no 最大翻译结果(默认值:10)
maxTasks number no 最大生成任务数(默认值:20)
includeAstFindings boolean 否 包括AST/代码结构发现(默认值:true)
minConfidence number no 要包含的最小查找置信度(0-1,默认值:0)

evaluate_public_repo_report

克隆a 公共存储库URL,在符合条件的源文件中运行完整的评判小组,并生成一份合并的降价报告。

参数 类型 必填 说明
repoUrl string yes 公共存储库URL(https://...)
branch string no 可选分支名称
outputPath string no 写入报表标记的可选路径
maxFiles number no 分析的最大文件数(默认值:600)
maxFileBytes number no 最大文件大小(字节)(默认值:300000)
maxFindingsInReport number no 输出中的最大详细结果(默认值:150)
credentialMode string no 凭据检测模式: standard (默认)或 strict
includeAstFindings boolean 否 包括AST/代码结构发现(默认值:true)
minConfidence number no 要包含的最小查找置信度(0-1,默认值:0)
enableMustFixGate boolean no 启用必须修复高置信度危险发现的门摘要(默认值:false)
mustFixMinConfidence number no 必须修复的门触发器的置信阈值(0-1,默认值:0.85)
mustFixDangerousRulePrefixes string[] no 可选的门匹配危险规则前缀(例如。, AUTH, CYBER, DATA)
keepClone boolean 否 将克隆的仓库保存在磁盘上以供检查

快速示例

从CLI生成报告:

npm run report:public-repo -- --repoUrl https://github.com/microsoft/vscode --output reports/vscode-judges-report.md

# stricter credential-signal mode (optional)
npm run report:public-repo -- --repoUrl https://github.com/openclaw/openclaw --credentialMode strict --output reports/openclaw-judges-report-strict.md

# judge findings only (exclude AST/code-structure findings)
npm run report:public-repo -- --repoUrl https://github.com/openclaw/openclaw --includeAstFindings false --output reports/openclaw-judges-report-no-ast.md

# show only findings at 80%+ confidence
npm run report:public-repo -- --repoUrl https://github.com/openclaw/openclaw --minConfidence 0.8 --output reports/openclaw-judges-report-high-confidence.md

# include must-fix gate summary in the generated report
npm run report:public-repo -- --repoUrl https://github.com/openclaw/openclaw --enableMustFixGate true --mustFixMinConfidence 0.9 --mustFixDangerousPrefix AUTH --mustFixDangerousPrefix CYBER --output reports/openclaw-judges-report-mustfix.md

# opinionated quick-start mode (recommended first run)
npm run report:quickstart -- --repoUrl https://github.com/openclaw/openclaw --output reports/openclaw-quickstart.md

来自MCP客户端的呼叫:

{
  "tool": "evaluate_public_repo_report",
  "arguments": {
    "repoUrl": "https://github.com/microsoft/vscode",
    "branch": "main",
    "maxFiles": 400,
    "maxFindingsInReport": 120,
    "credentialMode": "strict",
    "includeAstFindings": false,
    "minConfidence": 0.8,
    "enableMustFixGate": true,
    "mustFixMinConfidence": 0.9,
    "mustFixDangerousRulePrefixes": ["AUTH", "CYBER", "DATA"],
    "outputPath": "reports/vscode-judges-report.md"
  }
}

典型的响应摘要包括:

  • 总体评价和平均得分
  • 分析文件数量和总发现
  • 每位裁判评分表
  • 最高风险发现和最低评分文件

示例报告片段:

# Public Repository Full Judges Report

Generated from https://github.com/microsoft/vscode on 2026-02-21T12:00:00.000Z.

## Executive Summary
- Overall verdict: WARNING
- Average file score: 78/100
- Total findings: 412 (critical 3, high 29, medium 114, low 185, info 81)

get_judges

列出所有可用的法官及其域名和描述。

evaluate_code

将代码提交给 全体评委小组所有45名法官独立评估并作出合并判决。

参数 类型 必填 说明
code string yes 要评估的源代码
language string yes 编程语言(例如。, typescript, python)
context string no 关于代码的其他上下文
includeAstFindings boolean 否 包括AST/代码结构发现(默认值:true)
minConfidence number no 要包含的最小查找置信度(0-1,默认值:0)
config object no 内联配置(请参见 配置)

evaluate_code_single_judge

将代码提交给 具体法官 进行有针对性的审查。

参数 类型 必填 说明
code string yes 要评估的源代码
language string yes 编程语言
judgeId string yes 请参见 法官ID 在......下面
context string no 其他上下文
minConfidence number no 要包含的最小查找置信度(0-1,默认值:0)
config object no 内联配置(请参见 配置)

evaluate_project

提交多个文件 项目级分析所有45名法官都会评估每个文件,加上跨文件架构分析,可以检测代码重复、不一致的错误处理和依赖循环。

参数 类型 必填 说明
files array yes 数组 { path, content, language } 物体
context string no 可选项目上下文
includeAstFindings boolean 否 包括AST/代码结构发现(默认值:true)
minConfidence number no 要包含的最小查找置信度(0-1,默认值:0)
config object no 内联配置(请参见 配置)

evaluate_diff

仅评估 变线 在代码diff中。对整个文件运行所有45个判断,但将结果过滤到您指定的行。非常适合公关审查和增量分析。

参数 类型 必填 说明
code string yes 完整文件内容(更改后)
language string yes 编程语言
changedLines number[] 是 1已更改的行号
context string no 关于更改的可选上下文
includeAstFindings boolean 否 包括AST/代码结构发现(默认值:true)
minConfidence number no 要包含的最小查找置信度(0-1,默认值:0)
config object no 内联配置(请参见 配置)

analyze_dependencies

分析依赖清单文件,了解供应链风险、版本固定问题、拼写错误指示符和依赖卫生。支持 package.json, requirements.txt, Cargo.toml, go.mod, pom.xml,以及 .csproj 文件夹。

参数 类型 必填 说明
manifest string yes 依赖清单文件的内容
manifestType string yes 文件类型: package.json, requirements.txt等等。
context string no 可选上下文

evaluate_git_diff

仅评估 变线 从git diff.提供 repoPath 对于实时git diff或 diffText 对于预先计算的统一微分。

参数 类型 必填 说明
repoPath string conditional git存储库的绝对路径
base string no Git参考diff(默认值: HEAD~1)
diffText string 条件 预先计算的统一差异文本
confidenceFilter number no 发现的最小置信阈值(0-1)
autoTune boolean 否 应用反馈驱动的自动调整(默认值:false)
maxPromptChars number no LLM提示的最大字符预算(默认值:100000,0=无限制)
config object 否 内联配置

re_evaluate_with_context

重新运行法庭 作为背景的先前发现 用于迭代细化。支持争议解决、开发人员上下文注入和焦点区域过滤。

参数 类型 必填 说明
code string yes 要重新评估的源代码
language string yes 编程语言
disputedRuleIds string[] no 开发人员认为规则ID为误报
acceptedRuleIds string[] no 开发人员接受的规则ID
developerContext string no 开发者意图的自由形式解释
focusAreas string[] no 要关注的特定区域(例如。, ["security"])
confidenceFilter number no 最小置信阈值(默认值:0.5)
filePath string no 上下文感知评估的文件路径
deepReview boolean 否 包括LLM深度审查提示部分
relatedFiles array 否 跨文件上下文 { path, snippet, relationship? }[]
maxPromptChars number no LLM提示的最大字符预算(默认值:100000,0=无限制)

其他MCP工具

工具 说明
evaluate_file 从磁盘读取文件并将其提交给整个面板。自动检测扩展名中的语言。
evaluate_code_streaming 流式评估——当每个法官完成运行聚合时,返回每个法官的结果。
evaluate_focused 只运行指定的裁判。在初步全面评估后使用,以重新检查特定区域。
evaluate_batch 在一次调用中评估多个代码文件。返回每个文件的判断结果和汇总统计数据。
evaluate_then_fix 评估代码,并通过自动修复支持为所有发现自动生成修复补丁。
evaluate_with_progress 对于长时间运行的评估,使用进度回调进行评估。
evaluate_policy_aware 具有命名配置文件的政策意识评估(初创企业、受监管企业、医疗保健、金融科技、公共部门)。
fix_code 评估代码并应用所有可用的自动修复补丁。返回已应用/剩余摘要的固定代码。
explain_finding 使用OWASP/CWE参考、风险背景和补救指导,用通俗易懂的语言解释发现。
triage_finding 设置发现的分类状态(可接受风险、延迟、无法修复、假阳性)并注明归因。
record_feedback 记录用户反馈(真阳性、假阳性、无法修复)以校准置信度得分。
get_finding_stats 查找生命周期统计数据:开放、固定、重复和分类计数以及趋势。
get_suppression_analytics 分析抑制模式:按规则分析FP率、抑制率、自动抑制候选者。
list_triaged_findings 列出分类结果,可选择按分类状态过滤。
benchmark_gate 根据质量阈值运行基准测试。使用F1、精度、召回率指标返回通过/失败。
run_benchmark 运行完整的基准测试套件,包括每个评委、每个类别、每个难度的细分。
scaffold_judge 生成样板文件以添加新的判断:定义、评估器骨架和注册。
scaffold_plugin 生成一个带有自定义规则、判断和生命周期挂钩的入门插件模板。
session_status 当前评估会话状态:评估计数、框架、判决历史、稳定性。
list_files 列出工作区中的文件和目录以进行项目探索。
read_file 从工作区读取文件内容。

法官ID

data-security · cybersecurity · security · cost-effectiveness · scalability · cloud-readiness · software-practices · accessibility · api-design · api-contract · reliability · observability · performance · compliance · data-sovereignty · testing · documentation · internationalization · dependency-health · concurrency · ethics-bias · maintainability · error-handling · authentication · database · caching · configuration-management · backwards-compatibility · portability · ux · logging-privacy · rate-limiting · ci-cd · code-structure · agent-instructions · ai-code-safety · framework-safety · iac-security · hallucination-detection · intent-alignment · multi-turn-coherence · model-fingerprint · over-engineering · logic-review · false-positive-review


MCP提示

每位评委都有相应的LLM深度分析提示:

提示 描述
judge-data-security 深度数据安全审查
judge-cybersecurity 深度网络安全审查
judge-cost-effectiveness 深入的成本优化审查
judge-scalability 深入的可扩展性审查
judge-cloud-readiness 深度云就绪性审查
judge-software-practices 深入的软件实践审查
judge-accessibility 深度可访问性/WCAG审查
judge-api-design 深入API设计审查
judge-reliability 深入的可靠性和弹性审查
judge-observability 深入的可观察性和监控审查
judge-performance 深入的性能优化审查
judge-compliance 深入的监管合规审查
judge-data-sovereignty 深度数据、技术和运营主权审查
judge-testing 深度测试质量审查
judge-documentation 深入的文档质量审查
judge-internationalization 深入的i18n评论
judge-dependency-health 深度依赖健康评估
judge-concurrency 深度并发和异步安全审查
judge-ethics-bias 深入的伦理和偏见审查
judge-maintainability 深度可维护性和技术债务审查
judge-error-handling 深度错误处理审查
judge-authentication 深度身份验证和授权审查
judge-database 深度数据库设计和查询审查
judge-caching 深度缓存策略回顾
judge-configuration-management 深入配置和机密审查
judge-backwards-compatibility 深入的向后兼容性审查
judge-portability 深度平台可移植性审查
judge-ux 深入的用户体验评估
judge-logging-privacy 深度日志隐私审查
judge-rate-limiting 深度限速审查
judge-ci-cd 深入的CI/CD管道审查
judge-code-structure 基于AST的深度结构分析综述
judge-agent-instructions 代理指令降价质量与安全的深入探讨
judge-ai-code-safety 深入审查人工智能生成的代码风险:及时注入、不安全的LLM输出处理、调试默认值、缺少验证
judge-framework-safety 深入审查特定框架的安全性:React钩子、Express中间件、Next.js SSR/SSG、Angular/Vue、Django、Spring Boot、ASP。NET Core、Flask、FastAPI、Go框架
judge-iac-security 对基础设施作为代码安全的深入审查:Terraform、二头肌、ARM模板配置错误
judge-security 深入的整体安全态势评估:不安全的数据流、弱加密、不安全的反序列化
judge-hallucination-detection 深入审查AI幻觉API、伪造进口、不存在的模块
judge-intent-alignment 深入审查代码——注释对齐、存根检测、占位符函数
judge-api-contract 深入审查API合同合规性、输入验证、REST最佳实践
judge-multi-turn-coherence 代码一致性的深入回顾:自相矛盾、重复定义、死代码
judge-model-fingerprint 人工智能代码来源和模型归因指纹的深入回顾
judge-over-engineering 对不必要的抽象、包装狂热、过早概括的深入回顾
judge-logic-review 深入审查AI生成代码中的逻辑正确性、语义不匹配和死代码
judge-false-positive-review 基于模式的假阳性检测结果和准确性的元判断综述

配置

创建一个 .judgesrc.json (或 .judgesrc)项目根目录中的文件,用于自定义评估行为。看 .judgesrc.example.json 对于可复制粘贴的模板,或参考 JSON 模式 用于完整的IDE自动补全。

{
  "$schema": "https://github.com/KevinRabun/judges/blob/main/judgesrc.schema.json",
  "preset": "strict",
  "minSeverity": "medium",
  "disabledRules": ["COST-*", "I18N-001"],
  "disabledJudges": ["accessibility", "ethics-bias"],
  "ruleOverrides": {
    "SEC-003": { "severity": "critical" },
    "DOC-*": { "disabled": true }
  },
  "languages": ["typescript", "python"],
  "format": "text",
  "failOnFindings": false,
  "baseline": "",
  "regulatoryScope": ["GDPR", "PCI-DSS", "SOC2"],
  "consensusThreshold": 0.7
}
字段 类型 默认值 描述
$schema string -- IDE验证的JSON模式URL
preset string -- 命名预设(请参见 命名预设 对于所有22个选项)
minSeverity string "info" 要报告的最低严重程度: critical · high · medium · low · info
disabledRules string[] [] 要抑制的规则ID或前缀通配符(例如。 "COST-*", "SEC-003")
disabledJudges string[] [] 判断ID是否完全跳过(例如。 "cost-effectiveness")
ruleOverrides object {} 按规则覆盖由规则ID或通配符键入-- { disabled?: boolean, severity?: string }
languages string[] [] 将分析限制为特定语言(空=全部)
format string "text" 默认输出格式: text · json · sarif · markdown · html · pdf · junit · codeclimate · github-actions
failOnFindings boolean false 当判决为时退出代码1 fail --适用于CI门
baseline string "" 基线JSON文件的路径——匹配结果被抑制
plugins string[] [] 导出自定义判断的插件模块说明符(npm包或相对路径)
judgeWeights object {} 每位法官对综合评分的加权重要性(例如。 { "cybersecurity": 2.0 })
failOnScoreBelow number —— 跑步通过的最低分数(0-100);补充物 failOnFindings
regulatoryScope string[] -- 范围内的监管框架(例如。 ["GDPR", "PCI-DSS"]).仅引用范围外框架的调查结果被压制。跑 judges list --frameworks 支持的值。
consensusThreshold number -- 共识抑制(0–1)。如果这部分法官报告的调查结果为零,那么少数人的调查结果就会被压制。推荐: 0.7 对于CI
escalationThreshold number -- 置信阈值(0-1),低于该阈值的发现将被标记为人工审查
overrides array [] 路径范围的配置覆盖(例如。 [{ "files": "**/*.test.ts", "disabledJudges": ["documentation"] }])
customRules array [] 用户定义的基于正则表达式的业务逻辑验证规则

所有评估工具(CLI和MCP)通过以下方式接受相同的配置字段 --config <path> 或内联 config 参数。


高级功能

内联抑制

使用注释指令直接在源代码中抑制特定发现:

const x = eval(input); // judges-ignore SEC-001
// judges-ignore-next-line CYBER-002
const y = dangerousOperation();
// judges-file-ignore DOC-*    ← suppress globally for this file

支持的评论样式: //, #, /* */.支持逗号分隔的规则ID和通配符(*, SEC-*).

自动修复补丁

某些发现包括机器适用的补丁 patch 字段:

图案 自动修复
new Buffer(x) → Buffer.from(x)
http:// URL(非本地主机) → https://
Math.random() → crypto.randomUUID()

补丁包括 oldText, newText, startLine,以及 endLine 用于自动化应用。

交叉计算器重复数据删除

当多个判断者标记同一问题时(例如,数据安全和网络安全都在第15行检测到SQL注入),结果会自动进行重复数据消除。最高严重性发现获胜。, “另标识为:CYBER-003”).

人类焦点指南

每次法庭评估都包括 humanFocusGuide 它将研究结果分为三类,供人类审阅者使用:

Bucket 描述 何时使用
✅ 信任 高置信度(≥80%),证据支持的发现,AST/污染确认 直接行动——这些有强有力的自动化证据
🔍 验证 较低的置信度或基于缺席的调查结果 运用你的判断——问题可能存在于项目的其他地方
🔦 盲点 自动分析无法评估的领域 将手动审查时间集中在这里

盲点是从代码特征中检测出来的:复杂的分支逻辑、外部服务调用、财务计算、PII处理、状态机和复杂的正则表达式。该指南出现在CLI文本/markdown输出、JSON/SARIF输出和GitHub操作步骤摘要中。

监管范围

在中配置哪些监管框架适用于您的项目 .judgesrc:

{ "regulatoryScope": ["GDPR", "PCI-DSS", "SOC2"] }

仅引用范围外框架的调查结果被压制。始终保留没有监管参考(一般代码质量)的发现。跑 judges list --frameworks 查看所有17个支持的框架(GDPR、CCPA、HIPAA、PCI-DSS、SOC2、SOX、COPPA、FedRAMP、NIST、ISO27001、ePrivacy、DORA、NIS2、欧盟人工智能法案等)。

自学修正案

LLM基准系统自动为假阳性率较高的法官生成精确修正。修正是数据驱动的修正,注入到提示中,以提高连续基准运行的准确性。

自学循环:

  1. 运行基准测试→ 分析仪识别精度低于70%的判断
  2. 生成有针对性的修改(例如,“判断ERR:不要用框架错误中间件标记干净的Express代码”)
  3. 下一次基准运行负载修正→ 精度提高
  4. 跑 judges codify-amendments 将修正案永久性地烘烤到分发的包中

湍流分析

该引擎执行程序间污染跟踪,以跟踪来自用户控制源的数据(例如。, req.body, process.env)通过向安全敏感接收器的转换(例如。, eval(), exec(),SQL查询)。Taint流用于增强对真阳性结果的信心,并在检测到消毒的情况下抑制假阳性。

阳性信号检测

展示良好实践的代码将获得分数奖励(上限为+15):

信号 奖金
参数化查询 +3
安全帽 +3
身份验证中间件(护照等) +3
正确的错误处理 +2
输入验证库(zod、joi等) +2
速率限制 +2
结构化日志记录(皮诺、温斯顿) +2
CORS配置 +1
严格模式/strictNullChecks +1
测试模式(描述/它/期望) +1

框架感知规则

评判标准包括Express、Django、Flask、FastAPI、Spring、ASP的框架特定检测。NET、Rails等。框架中间件(例如。, helmet(), express-rate-limit, passport.authenticate())被认为是减少误报的缓解措施。

跨文件导入解决方案

在项目级分析中,导入是跨文件解析的。如果一个文件从项目中的另一个文件导入安全中间件模块,则关于缺少安全控制的发现会自动调整,但可信度会降低。


评分

每位评委对以下代码进行评分 0到100:

严重程度 分数扣减
关键 -30分
高点 -18分
中等 -10分
低 -5分
信息 −2分

判决逻辑:

  • 失败 --任何关键发现或得分<60
  • 警告 --任何高发现、任何中等发现或得分<80
  • 通过 --得分≥80,无严重、严重或中等发现

这 仲裁庭总得分 是所有45名法官的平均值。如果出现以下情况,则整体判决失败 任何 法官失败了。


项目结构

judges/
├── src/
│   ├── index.ts              # MCP server entry point — tools, prompts, transport
│   ├── api.ts                # Programmatic API entry point
│   ├── cli.ts                # CLI argument parser and command router
│   ├── types.ts              # TypeScript interfaces (Finding, JudgeEvaluation, etc.)
│   ├── config.ts             # .judgesrc configuration parser and validation
│   ├── errors.ts             # Custom error types (ConfigError, EvaluationError, ParseError)
│   ├── language-patterns.ts  # Multi-language regex pattern constants and helpers
│   ├── judge-registry.ts     # Unified JudgeRegistry — single source of truth for all judges
│   ├── plugins.ts            # Plugin API façade (delegates to JudgeRegistry)
│   ├── scoring.ts            # Confidence scoring and calibration
│   ├── dedup.ts              # Finding deduplication engine
│   ├── fingerprint.ts        # Finding fingerprint generation
│   ├── comparison.ts         # Tool comparison benchmark data
│   ├── cache.ts              # Evaluation result caching
│   ├── calibration.ts        # Confidence calibration from feedback data
│   ├── fix-history.ts        # Auto-fix application history tracking
│   ├── ast/                  # AST analysis engine (built-in, no external deps)
│   │   ├── index.ts          # analyzeStructure() — routes to correct parser
│   │   ├── types.ts          # FunctionInfo, CodeStructure interfaces
│   │   ├── tree-sitter-ast.ts    # Tree-sitter WASM parser (all 8 languages)
│   │   ├── structural-parser.ts  # Fallback scope-tracking parser
│   │   ├── cross-file-taint.ts   # Cross-file taint propagation analysis
│   │   └── taint-tracker.ts      # Single-file taint flow tracking
│   ├── evaluators/           # Analysis engine for each judge
│   │   ├── index.ts          # evaluateWithJudge(), evaluateWithTribunal(), evaluateProject(), etc.
│   │   ├── shared.ts         # Scoring, verdict logic, markdown formatters
│   │   └── *.ts              # One analyzer per judge (45 files)
│   ├── formatters/           # Output formatters
│   │   ├── sarif.ts              # SARIF 2.1.0 output
│   │   ├── html.ts               # Self-contained HTML report (dark/light theme, filters)
│   │   ├── junit.ts              # JUnit XML output (Jenkins, Azure DevOps, GitHub Actions)
│   │   ├── codeclimate.ts        # CodeClimate/GitLab Code Quality JSON
│   │   ├── diagnostics.ts        # Diagnostics formatter
│   │   └── badge.ts              # SVG and text badge generator
│   ├── commands/             # CLI subcommands
│   │   ├── init.ts               # Interactive project setup wizard
│   │   ├── fix.ts                # Auto-fix patch preview and application
│   │   ├── watch.ts              # Watch mode — re-evaluate on save
│   │   ├── report.ts             # Project-level local report
│   │   ├── hook.ts               # Pre-commit hook install/uninstall
│   │   ├── ci-templates.ts       # GitLab, Azure, Bitbucket CI templates
│   │   ├── diff.ts               # Evaluate unified diff (git diff)
│   │   ├── deps.ts               # Dependency supply-chain analysis
│   │   ├── baseline.ts           # Create baseline for finding suppression
│   │   ├── completions.ts        # Shell completions (bash/zsh/fish/PowerShell)
│   │   ├── docs.ts               # Per-judge rule documentation generator
│   │   ├── feedback.ts           # False-positive tracking & finding feedback
│   │   ├── benchmark.ts          # Detection accuracy benchmark suite
│   │   ├── rule.ts               # Custom rule authoring wizard
│   │   ├── language-packs.ts     # Language-specific rule pack presets
│   │   └── config-share.ts       # Shareable team/org configuration
│   ├── presets.ts            # Named evaluation presets (strict, lenient, security-only, …)
│   ├── patches/
│   │   └── index.ts              # 201 deterministic auto-fix patch rules
│   ├── tools/                # MCP tool registrations
│   │   ├── register.ts           # Tool registration orchestrator
│   │   ├── register-evaluation.ts    # Evaluation tools (evaluate_code, etc.)
│   │   ├── register-workflow.ts      # Workflow tools (app builder, reports, etc.)
│   │   ├── prompts.ts            # MCP prompt registrations (per-judge prompts)
│   │   └── schemas.ts            # Zod schemas for tool parameters
│   ├── reports/
│   │   └── public-repo-report.ts   # Public repo clone + full tribunal report generation
│   └── judges/               # Judge definitions (id, name, domain, system prompt)
│       ├── index.ts          # Side-effect imports + re-exports (JUDGES, getJudge, getJudgeSummaries)
│       └── *.ts              # One self-registering definition per judge (45 files)
├── scripts/
│   ├── generate-public-repo-report.ts  # Run: npm run report:public-repo -- --repoUrl <url>
│   ├── daily-popular-repo-autofix.ts   # Run: npm run automation:daily-popular
│   └── debug-fp.ts                     # Debug false-positive findings
├── examples/
│   ├── sample-vulnerable-api.ts  # Intentionally flawed code (triggers all judges)
│   ├── demo.ts                   # Run: npm run demo
│   └── quickstart.ts             # Quick-start evaluation example
├── tests/
│   ├── judges.test.ts            # Core judge evaluation tests
│   ├── negative.test.ts          # Negative / FP-avoidance tests
│   ├── subsystems.test.ts        # Subsystem integration tests
│   ├── extension-logic.test.ts   # VS Code extension logic tests
│   └── tool-routing.test.ts      # MCP tool routing tests
├── grammars/                 # Tree-sitter WASM grammar files
│   ├── tree-sitter-typescript.wasm
│   ├── tree-sitter-cpp.wasm
│   ├── tree-sitter-python.wasm
│   ├── tree-sitter-go.wasm
│   ├── tree-sitter-rust.wasm
│   ├── tree-sitter-java.wasm
│   └── tree-sitter-c_sharp.wasm
├── judgesrc.schema.json      # JSON Schema for .judgesrc config files
├── server.json               # MCP Registry manifest
├── package.json
├── tsconfig.json
└── README.md

脚本

命令 描述
npm run build 将TypeScript编译为 dist/
npm run dev 监视模式--保存时重新编译
npm test 运行完整的测试套件
npm run demo 运行示例法庭演示
npm run report:public-repo -- --repoUrl <url> 为公共存储库URL生成完整的仲裁庭报告
npm run report:quickstart -- --repoUrl <url> 运行固执己见的高信号报告默认值,以快速采用
npm run automation:daily-popular 每天分析多达10个轮换热门回购,每个回购最多打开5个补救PR
npm start 启动MCP服务器
npm run clean 删除 dist/
judges init 交互式项目设置向导
judges fix <file> 预览自动修复补丁(添加 --apply 写作)
judges watch <dir> 监视模式——文件保存时重新评估
judges report <dir> 关于当地目录的完整法庭报告
judges hook install 安装Git预提交钩子
judges diff 从统一差异评估更改的线路
judges deps 分析供应链风险的依赖关系
judges baseline create 创建用于查找抑制的基线
judges ci-templates 生成CI管道模板
judges docs 生成每位法官的规则文档
judges completions <shell> Shell完成脚本
judges feedback submit 将发现标记为真阳性、假阳性或无法修复
judges feedback stats 显示假阳性率统计数据
judges benchmark run 运行检测精度基准套件
judges rule create 交互式自定义规则创建向导
judges rule list 列出自定义评估规则
judges pack list 列出可用的语言包
judges config export 将配置导出为可共享包
judges config import <src> 导入共享配置
judges compare 将法官与其他代码审查工具进行比较
judges list 列出所有45位带有域名和描述的评委
judges list --frameworks 列出支持的监管框架和 .judgesrc 用法
judges codify-amendments 将自学修正案写入裁判源文件

每日热门回购自动化

此仓库包括一个预定的工作流 .github/workflows/daily-popular-repo-autofix.yml 即:

  • 每天从100多个流行存储库(或手动提供的目标)的默认池中选择多达10个存储库,
  • 在支持的源语言中运行完整的Judges评估,
  • 仅应用减少匹配查找计数的保守的单行补救措施,
  • 每个存储库最多打开5个PR,并将其归因于Judges和目标存储库,
  • 跳过存储库,除非它们是公共的,并且可以使用现有的GitHub身份验证创建PR(没有额外的身份验证流)。
  • 强制执行10个存储库/天和5个PR/存储库的硬运行时上限。

每次运行都会写入 daily-autofix-summary.json (或 SUMMARY_PATH)使用每个存储库的遥测技术,包括:

  • runAggregate --紧凑的运行级别总计和跨回购最高优先级规则,
  • runAggregate.totalCandidatesDiscovered 和 runAggregate.totalCandidatesAfterLocationDedupe --指示在尝试修复之前去除了多少重叠,
  • runAggregate.totalCandidatesAfterPriorityThreshold --在应用最小优先级分数后留下的候选人,
  • runAggregate.dedupeReductionPercent --从位置重复数据消除中减少百分比,以实现快速运行时效率跟踪,
  • runAggregate.priorityThresholdReductionPercent --重复数据消除后最低优先级过滤的减少百分比,
  • priorityRulePrefixesUsed --在优先级排序过程中使用的危险规则前缀,
  • minPriorityScoreUsed --最小值 candidatePriorityScore 申请候选人入选,
  • candidatesDiscovered, candidatesAfterLocationDedupe,以及 candidatesAfterPriorityThreshold --在每个过滤阶段之后,每个回购候选计数,
  • topPrioritizedRuleCounts --排名候选人中最常见的规则ID,
  • topPrioritizedCandidates --排名靠前的候选样本(规则、严重性、置信度、文件、行、优先级得分)。

可选运行时控制:

  • AUTOFIX_MIN_PRIORITY_SCORE --重复数据消除后所需的最低候选优先级分数(默认值: 0,残疾)。

所需机密:

  • JUDGES_AUTOFIX_GH_TOKEN --GitHub令牌,具有为目标存储库分叉/推送/创建PR的权限。

手动运行:

gh workflow run "Judges Daily Full-Run Autofix PRs" -f targetRepoUrl=https://github.com/owner/repo

程序化API

法官可以作为一个库使用(而不仅仅是通过MCP)。导入自 @kevinrabun/judges/api:

import {
  evaluateCode,
  evaluateProject,
  evaluateCodeSingleJudge,
  getJudge,
  JUDGES,
  findingsToSarif,
} from "@kevinrabun/judges/api";

// Full tribunal evaluation
const verdict = evaluateCode("const x = eval(input);", "typescript");
console.log(verdict.overallScore, verdict.overallVerdict);

// Single judge
const result = evaluateCodeSingleJudge("cybersecurity", code, "typescript");

// SARIF output for CI integration
const sarif = findingsToSarif(verdict.evaluations.flatMap(e => e.findings));

包装出口

入口点 描述
@kevinrabun/judges/api 程序化API(默认)
@kevinrabun/judges/server MCP服务器入口点
@kevinrabun/judges/sarif SARIF 2.1.0格式化程序
@kevinrabun/judges/junit JUnit XML格式化程序
@kevinrabun/judges/codeclimate CodeClimate/GitLab代码质量JSON
@kevinrabun/judges/badge SVG和文本徽章生成器
@kevinrabun/judges/diagnostics 诊断格式化程序
@kevinrabun/judges/plugins 插件系统API(请参阅 插件指南)
@kevinrabun/judges/fingerprint 查找指纹实用程序
@kevinrabun/judges/comparison 工具比较基准

SARIF输出

将调查结果转换为 沙林2.1.0 对于GitHub代码扫描、Azure DevOps和其他CI/CD工具:

import { findingsToSarif, evaluationToSarif, verdictToSarif } from "@kevinrabun/judges/sarif";

const sarif = verdictToSarif(verdict, "src/app.ts");
fs.writeFileSync("results.sarif", JSON.stringify(sarif, null, 2));

自定义错误类型

所有抛出的错误都会扩展 JudgesError 使用机器可读 code 财产:

错误类别 代码 何时
ConfigError JUDGES_CONFIG_INVALID 畸形 .judgesrc 或内联配置无效
EvaluationError JUDGES_EVALUATION_FAILED 未知法官,分析仪崩溃
ParseError JUDGES_PARSE_FAILED 无法解析的源代码或输入数据
import { ConfigError, EvaluationError } from "@kevinrabun/judges/api";
try {
  evaluateCode(code, "typescript");
} catch (e) {
  if (e instanceof ConfigError) console.error("Config issue:", e.code);
}

许可证

麻省理工学院