Agent 工具
使用 Jev、简单英文规则和 Agent Skills 进行语义代码审查。
Semantic code review with Jev, plain-English rules and Agent Skills.
/** TypeSafe's own REST API: POST https://api.typesafe.ai/v1/systemone. */链接指向我们抓取当天的那个 commit,行号是准的。
下面是从这个项目源码里原样取出来的 question 组合。
取自 packages/core/src/find.ts:45
edit选项Would carrying out `task` require editing the code shown in `hunk`?
true — This code implements, renders, computes or decides the behaviour `task` changes. Someone doing `task` would open this file and change these lines.false — The code is about something else, or it only mentions the same words while doing unrelated work.contract选项Does `hunk` define the specific value, limit, type, schema or interface that `task` turns on — the thing the new code would have to read or satisfy to work at all?
true — Without this declaration `task` could not be implemented correctly: it is where the bound, unit, shape, option or route that `task` depends on is actually defined.false — It is merely nearby infrastructure, a general-purpose type, or something `task` could be implemented without ever reading. Broad relevance is not enough — this facet is for the definition `task` hinges on.caller选项Does `hunk` call, render, navigate to or otherwise consume the behaviour that `task` would change, so that it would see the difference?
true — It uses the screen, function, hook, store or value that `task` changes, and would behave differently or need updating once `task` is done.false — It does not reach that behaviour, or it is the implementation rather than a consumer of it.test选项Does `hunk` test or exercise the screen, function or flow that `task` would change — so that it would need updating, or would catch a mistake made while doing `task`?
true — It asserts on, drives or provides fixtures for that area, including its edge cases and error paths. `task` has not been done yet, so a test of the surrounding behaviour counts; a test of the new behaviour cannot exist.false — It tests something else, or it is not a test at all.precedent选项Does `hunk` already solve the same kind of problem `task` describes, somewhere else in the codebase, closely enough to show the pattern to follow?
true — It is an existing, working example of the same kind of work — the same sort of validation, warning, limit, screen or flow — that someone doing `task` would copy the shape of.false — It is the place `task` changes rather than a precedent for it, or it solves a different kind of problem.import { experimental_evaluate as evaluate } from 'ai';
const { answers } = await evaluate({
model: 'typesafe-ai/jev',
state,
questions: {
edit: { type: 'choice', instructions: 'Would carrying out `task` require editing the code shown in `hunk`?',
criteria: { true: 'This code implements, renders, computes or decides the behaviour `task` changes. Someone doing `task` would open this file and change these lines.', false: 'The code is about something else, or it only mentions the same words while doing unrelated work.' } },
contract: { type: 'choice', instructions: 'Does `hunk` define the specific value, limit, type, schema or interface that `task` turns on — the thing the new code would have to read or satisfy to work at all?',
criteria: { true: 'Without this declaration `task` could not be implemented correctly: it is where the bound, unit, shape, option or route that `task` depends on is actually defined.', false: 'It is merely nearby infrastructure, a general-purpose type, or something `task` could be implemented without ever reading. Broad relevance is not enough — this facet is for the definition `task` hinges on.' } },
caller: { type: 'choice', instructions: 'Does `hunk` call, render, navigate to or otherwise consume the behaviour that `task` would change, so that it would see the difference?',
criteria: { true: 'It uses the screen, function, hook, store or value that `task` changes, and would behave differently or need updating once `task` is done.', false: 'It does not reach that behaviour, or it is the implementation rather than a consumer of it.' } },
test: { type: 'choice', instructions: 'Does `hunk` test or exercise the screen, function or flow that `task` would change — so that it would need updating, or would catch a mistake made while doing `task`?',
criteria: { true: 'It asserts on, drives or provides fixtures for that area, including its edge cases and error paths. `task` has not been done yet, so a test of the surrounding behaviour counts; a test of the new behaviour cannot exist.', false: 'It tests something else, or it is not a test at all.' } },
precedent: { type: 'choice', instructions: 'Does `hunk` already solve the same kind of problem `task` describes, somewhere else in the codebase, closely enough to show the pattern to follow?',
criteria: { true: 'It is an existing, working example of the same kind of work — the same sort of validation, warning, limit, screen or flow — that someone doing `task` would copy the shape of.', false: 'It is the place `task` changes rather than a precedent for it, or it solves a different kind of problem.' } },
},
});取自 packages/core/src/pulls.ts:71
duplicate是/否Does this pull request already implement what `task` describes? `task` has not been started. Judge the change in `diff` against what `task` asks for, using `title` and `body` for intent.
overlap是/否Would the work in `task` and the change in `diff` touch the same code, so that doing `task` now would conflict with this pull request or need rebasing onto it?
import { experimental_evaluate as evaluate } from 'ai';
const { answers } = await evaluate({
model: 'typesafe-ai/jev',
state,
questions: {
duplicate: { type: 'boolean', instructions: 'Does this pull request already implement what `task` describes? `task` has not been started. Judge the change in `diff` against what `task` asks for, using `title` and `body` for intent.' },
overlap: { type: 'boolean', instructions: 'Would the work in `task` and the change in `diff` touch the same code, so that doing `task` now would conflict with this pull request or need rebasing onto it?' },
},
});取自 packages/core/test/skills.test.ts:137
leak是/否Does `hunk` log a password?
import { experimental_evaluate as evaluate } from 'ai';
const { answers } = await evaluate({
model: 'typesafe-ai/jev',
state,
questions: {
leak: { type: 'boolean', instructions: 'Does `hunk` log a password?' },
},
});boolean是/否Does `text` say the sky is blue?
choice选项What color is the sky in `text`?
blue — Bluered — Redscore打分How clearly does `text` state the sky's color?
0 — No color stated1 — A color is stated explicitlyimport { experimental_evaluate as evaluate } from 'ai';
const { answers } = await evaluate({
model: 'typesafe-ai/jev',
state,
questions: {
boolean: { type: 'boolean', instructions: 'Does `text` say the sky is blue?' },
choice: { type: 'choice', instructions: 'What color is the sky in `text`?',
criteria: { blue: 'Blue', red: 'Red' } },
score: { type: 'score', instructions: 'How clearly does `text` state the sky\'s color?',
criteria: ['No color stated', 'A color is stated explicitly'] },
},
});