护栏与审查
基于 GitHub Action,使用 Jev 通过 Vercel AI Gateway 低成本筛选 pull request,减少昂贵的 LLM 或人工审核。
GitHub Action that uses Jev (TypeSafe AI via Vercel AI Gateway) to cheaply triage pull requests before expensive LLM/human review
// `experimental_evaluate` (typed decisions), since FR-006's secondary链接指向我们抓取当天的那个 commit,行号是准的。
下面是从这个项目源码里原样取出来的 question 组合。
should_review是/否Does this pull request need a human or LLM code review at all, or is it trivial
risk选项How risky is this change, based on the diff content and changed files?
cosmetic — Docs, comments, formatting, or other non-functional changes.moderate — Ordinary code changes with limited blast radius.blocking — Touches authentication, database migrations, CI/CD configuration, or other sensitive surface area.route选项Given the risk above, how should this PR be routed?
auto-approve — Safe to merge without further review.human-review — A human should review this before it is merged.block — This must not be merged until a human explicitly approves it.touches_secrets是/否Does the diff contain content that looks like an API key, password, or other credential?
import { experimental_evaluate as evaluate } from 'ai';
const { answers } = await evaluate({
model: 'typesafe-ai/jev',
state,
questions: {
should_review: { type: 'boolean', instructions: 'Does this pull request need a human or LLM code review at all, or is it trivial' },
risk: { type: 'choice', instructions: 'How risky is this change, based on the diff content and changed files?',
criteria: { cosmetic: 'Docs, comments, formatting, or other non-functional changes.', moderate: 'Ordinary code changes with limited blast radius.', blocking: 'Touches authentication, database migrations, CI/CD configuration, or other sensitive surface area.' } },
route: { type: 'choice', instructions: 'Given the risk above, how should this PR be routed?',
criteria: { auto-approve: 'Safe to merge without further review.', human-review: 'A human should review this before it is merged.', block: 'This must not be merged until a human explicitly approves it.' } },
touches_secrets: { type: 'boolean', instructions: 'Does the diff contain content that looks like an API key, password, or other credential?' },
},
});