@jwilger/pi-development-system 0.31.0 → 0.33.0
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/agents/reviewer.md +1 -1
- package/package.json +1 -1
- package/src/core/review-flow.ts +1 -1
- package/src/core/review-packet.ts +17 -4
- package/src/core/review.ts +5 -1
- package/src/review/digest.ts +1 -1
package/agents/reviewer.md
CHANGED
|
@@ -31,7 +31,7 @@ You are a reviewer. You find defects you can demonstrate from the code and propo
|
|
|
31
31
|
|
|
32
32
|
## What counts
|
|
33
33
|
|
|
34
|
-
Look for correctness bugs, regressions in existing behavior, security issues, and changed behavior with no test. Each finding needs a realistic triggering input or state. Before reporting, try to refute it: a covering test, a nearby guard, a type that rules the case out. Drop it if the refute holds; if it nearly holds, say what evidence is missing. Do not report untraced speculation or nits. Report style only if asked, labeled as style, after defects. The verdict is `blocking` when any finding is blocking or should-fix, otherwise `no-blocking`. Zero findings is a valid result: write `- none` under Findings.
|
|
34
|
+
Look for correctness bugs, regressions in existing behavior, security issues, and changed behavior with no test. Each finding needs a realistic triggering input or state. Before reporting, try to refute it: a covering test, a nearby guard, a type that rules the case out. Drop it if the refute holds; if it nearly holds, say what evidence is missing. Do not report untraced speculation or nits. Report style only if asked, labeled as style, after defects. The verdict is `blocking` when any finding is blocking or should-fix, otherwise `no-blocking`. Zero findings is a valid result: write `- none` under Findings. Findings holds only finding lines; put what you checked and refuted under Sources inspected.
|
|
35
35
|
|
|
36
36
|
A fix is the smallest local change or deletion that removes the demonstrated defect. Do not propose new abstractions, frameworks, or broad refactors.
|
|
37
37
|
|
package/package.json
CHANGED
package/src/core/review-flow.ts
CHANGED
|
@@ -177,6 +177,6 @@ export function reviewerTask(input: {
|
|
|
177
177
|
"### Verdict",
|
|
178
178
|
"no-blocking | blocking",
|
|
179
179
|
"",
|
|
180
|
-
"Severity: blocking = demonstrable defect or broken non-negotiable; should-fix = real defect or missing test with a realistic trigger; nit = style or report-only. The verdict is `blocking` when any finding is blocking or should-fix, otherwise `no-blocking`. With zero findings (a valid result) write `- none` under Findings.",
|
|
180
|
+
"Severity: blocking = demonstrable defect or broken non-negotiable; should-fix = real defect or missing test with a realistic trigger; nit = style or report-only. The verdict is `blocking` when any finding is blocking or should-fix, otherwise `no-blocking`. With zero findings (a valid result) write `- none` under Findings. Findings holds only finding lines: put what you checked and refuted under Sources inspected or after the verdict.",
|
|
181
181
|
].join("\n");
|
|
182
182
|
}
|
|
@@ -15,15 +15,21 @@ const HEADER = new RegExp(
|
|
|
15
15
|
`^##\\s+Review\\s+${SEP}\\s+(.+?)\\s+${SEP}\\s+round\\s+(\\S+)\\s+${SEP}\\s+lenses:\\s*(.*)$`,
|
|
16
16
|
"m",
|
|
17
17
|
);
|
|
18
|
-
|
|
18
|
+
// Reviewers add text after the location (`fn`, a second location); the first backticked one is the finding's.
|
|
19
|
+
const FINDING = /^-\s*\[([^\]]+)\]\s+(\S+)\s+(?:`([^`]+)`[^—–]*?\s+)?[—–-]\s+(.+)$/;
|
|
20
|
+
// An indented line under a finding is its detail (trigger, fix), unless it is itself a finding.
|
|
21
|
+
const isDetail = (line: string): boolean => /^\s+/.test(line) && !/^\s*-\s*\[/.test(line);
|
|
19
22
|
|
|
20
|
-
|
|
23
|
+
// `until` ends a section; by default any heading does. Findings ends only at a known section so a stray
|
|
24
|
+
// heading inside it (### Nits) makes its lines errors instead of silently cutting the findings off.
|
|
25
|
+
const section = (text: string, name: string, until = /^###?\s/m): string | undefined => {
|
|
21
26
|
const match = new RegExp(`^###\\s+${name}\\s*$`, "im").exec(text);
|
|
22
27
|
if (match === null) return undefined;
|
|
23
28
|
const rest = text.slice(match.index + match[0].length);
|
|
24
|
-
const next =
|
|
29
|
+
const next = until.exec(rest);
|
|
25
30
|
return next === null ? rest : rest.slice(0, next.index);
|
|
26
31
|
};
|
|
32
|
+
const AFTER_FINDINGS = /^###?\s+(?:Verdict|Sources inspected|Not verified)\b/im;
|
|
27
33
|
|
|
28
34
|
const isSeverity = (value: string): value is Severity =>
|
|
29
35
|
(SEVERITIES as readonly string[]).includes(value);
|
|
@@ -79,8 +85,15 @@ export function parseReviewPacket(text: string): ReviewPacket | ParseError {
|
|
|
79
85
|
);
|
|
80
86
|
}
|
|
81
87
|
const findings: Finding[] = [];
|
|
82
|
-
const
|
|
88
|
+
const findingsText = section(text, "Findings", AFTER_FINDINGS);
|
|
89
|
+
if (findingsText === undefined) {
|
|
90
|
+
return parseError(
|
|
91
|
+
'missing "### Findings" section: write "- none" under it when there are no findings',
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
const lines = findingsText
|
|
83
95
|
.split("\n")
|
|
96
|
+
.filter((l) => !isDetail(l))
|
|
84
97
|
.map((l) => l.trim())
|
|
85
98
|
.filter((l) => l !== "" && !/^(?:-\s*)?[([]?(?:none|no findings?)[)\]]?\.?$/i.test(l));
|
|
86
99
|
for (const [i, line] of lines.entries()) {
|
package/src/core/review.ts
CHANGED
|
@@ -71,7 +71,11 @@ export const startReview = (slice: SliceRef, required: number): ReviewState => (
|
|
|
71
71
|
|
|
72
72
|
export const addRound = (state: ReviewState, round: Omit<ReviewRound, "n">): ReviewState => ({
|
|
73
73
|
...state,
|
|
74
|
-
|
|
74
|
+
// Only the last round's per-file digests are ever compared, so earlier ones are not carried along.
|
|
75
|
+
rounds: [
|
|
76
|
+
...state.rounds.map(({ files: _files, ...earlier }) => earlier),
|
|
77
|
+
{ ...round, n: state.rounds.length + 1 },
|
|
78
|
+
],
|
|
75
79
|
});
|
|
76
80
|
|
|
77
81
|
/** Review lenses Jev can select (plan I6.2). A lens applies at probability ≥ LENS_THRESHOLD. */
|
package/src/review/digest.ts
CHANGED
|
@@ -69,7 +69,7 @@ export async function snapshotDiff(
|
|
|
69
69
|
const untracked = listed.filter((p) => !p.endsWith("/"));
|
|
70
70
|
if (untracked.length > MAX_UNTRACKED) {
|
|
71
71
|
return err(
|
|
72
|
-
`${untracked.length} untracked files (more than ${MAX_UNTRACKED});
|
|
72
|
+
`${untracked.length} untracked files (more than ${MAX_UNTRACKED}); stage (git add) or ignore some so they can be reviewed`,
|
|
73
73
|
);
|
|
74
74
|
}
|
|
75
75
|
const files: Record<string, string> = {};
|