@jphutchins/code-review 0.1.0-alpha.7 → 0.1.0-alpha.8
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/README.md +11 -9
- package/dist/index.js +28 -14
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/schema/findings.schema.json +9 -9
- package/templates/comment.eta +5 -2
- package/templates/inline.eta +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jphutchins/code-review",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.8",
|
|
4
4
|
"description": "Deterministic commenter for agentic PR review — gather, render, inline, post, adapt, extract, cost, validate, print-schema",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"eslint-config-prettier": "^10.1.8",
|
|
49
49
|
"prettier": "^3.9.4",
|
|
50
50
|
"tsup": "^8.3.5",
|
|
51
|
+
"tsx": "^4.23.0",
|
|
51
52
|
"typescript": "^5.7.3",
|
|
52
53
|
"typescript-eslint": "^8.62.1",
|
|
53
54
|
"vitest": "^3.0.4"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"$id": "https://raw.githubusercontent.com/JPHutchins/code-review/main/schema/findings.schema.json",
|
|
4
4
|
"title": "Code Review — findings",
|
|
5
|
-
"description": "Structured output of an agentic PR review. The review agent emits this object (e.g. via a coding-agent CLI's structured-output mode, such as Claude Code's `--json-schema`, whose result lands in `.structured_output
|
|
5
|
+
"description": "Structured output of an agentic PR code review. The review agent emits this object (e.g. via a coding-agent CLI's structured-output mode, such as Claude Code's `--json-schema`, whose result lands in `.structured_output`, or a file).",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"additionalProperties": false,
|
|
8
8
|
"required": ["schema_version", "summary", "verdict", "findings"],
|
|
@@ -10,20 +10,20 @@
|
|
|
10
10
|
"schema_version": {
|
|
11
11
|
"type": "string",
|
|
12
12
|
"pattern": "^(0|[1-9]\\d*)\\.(\\d+)\\.(\\d+)(?:-[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?(?:\\+[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?$",
|
|
13
|
-
"description": "Semver version of this findings schema the object conforms to (e.g. \"0.1.0\").
|
|
13
|
+
"description": "Semver version of this findings schema the object conforms to (e.g. \"0.1.0\")."
|
|
14
14
|
},
|
|
15
15
|
"summary": {
|
|
16
16
|
"type": "string",
|
|
17
|
-
"description": "
|
|
17
|
+
"description": "1-4 sentence markdown walkthrough of the overall assessment."
|
|
18
18
|
},
|
|
19
19
|
"verdict": {
|
|
20
20
|
"type": "string",
|
|
21
21
|
"enum": ["approve", "comment", "changes"],
|
|
22
|
-
"description": "Overall stance.
|
|
22
|
+
"description": "Overall stance."
|
|
23
23
|
},
|
|
24
24
|
"findings": {
|
|
25
25
|
"type": "array",
|
|
26
|
-
"description": "Zero or more specific findings.
|
|
26
|
+
"description": "Zero or more specific findings.",
|
|
27
27
|
"items": {
|
|
28
28
|
"type": "object",
|
|
29
29
|
"additionalProperties": false,
|
|
@@ -78,11 +78,11 @@
|
|
|
78
78
|
},
|
|
79
79
|
"description": {
|
|
80
80
|
"type": "string",
|
|
81
|
-
"description": "
|
|
81
|
+
"description": "1-3 sentence markdown explanation of what is wrong. Details belong in `reasoning`."
|
|
82
82
|
},
|
|
83
83
|
"recommendation": {
|
|
84
84
|
"type": "string",
|
|
85
|
-
"description": "
|
|
85
|
+
"description": "1-2 sentence markdown prose describing what to do about the finding — distinct from `patch`, which is a machine-applicable unified diff. Use this when the fix is best explained rather than mechanically applied, or to accompany a `patch` with rationale."
|
|
86
86
|
},
|
|
87
87
|
"confidence": {
|
|
88
88
|
"type": "number",
|
|
@@ -95,8 +95,8 @@
|
|
|
95
95
|
"description": "Rationale/evidence for why the finding holds, so a human or downstream agent can judge its soundness — distinct from `description`, which explains the finding to the reader."
|
|
96
96
|
},
|
|
97
97
|
"patch": {
|
|
98
|
-
"type":
|
|
99
|
-
"description": "
|
|
98
|
+
"type": "string",
|
|
99
|
+
"description": "Optional single-hunk unified diff of one mechanical fix to this file, expressed against its current (post-change) content — e.g. the `git diff` of just that edit after you apply it. It MUST be exactly one hunk and one contiguous change, and its context and removed lines MUST match the file verbatim so it applies cleanly. Omit this field when there is no clean mechanical fix — never invent one; put prose guidance in `recommendation` instead."
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
}
|
package/templates/comment.eta
CHANGED
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
<% } -%>
|
|
6
6
|
|
|
7
7
|
### <%= it.verdictBadge(it.findings.verdict) %>
|
|
8
|
+
<% if (it.postedAt) { -%>
|
|
9
|
+
Reviewed `<%= it.reviewedSha.slice(0, 7) %>` · <%= it.postedAt %>
|
|
10
|
+
<% } -%>
|
|
8
11
|
|
|
9
12
|
<% const meta = [] %><% if (it.route) { meta.push('**Route:** ' + it.route) } %><% if (it.effort) { meta.push('**effort:** ' + it.effort) } %><% if (it.usageAvailable) { meta.push('**turns:** ' + it.envelope.turns); meta.push('**wall:** ' + it.formatDuration(it.envelope.duration_ms)); meta.push('**models:** ' + it.modelNames); meta.push('**cost:** ' + it.formatCost(it.costReport.totalCostUSD)) } else { meta.push('_usage unavailable_') } %><%~ meta.join(' · ') %>
|
|
10
13
|
|
|
@@ -34,7 +37,7 @@ _No findings — clean review._
|
|
|
34
37
|
These findings are on lines not in the diff, so they can't be anchored as inline comments:
|
|
35
38
|
|
|
36
39
|
<% it.strays.forEach(function(f) { -%>
|
|
37
|
-
- <%= it.severityEmoji(f.severity) %> `<%= f.path %>:<%= f.start_line %><% if (f.start_line !== f.end_line) { %>–<%= f.end_line %><% } %>` — <%= f.title %> · confidence <%= f.confidence %>
|
|
40
|
+
- <%= it.severityEmoji(f.severity) %> `<%= f.path %>:<%= f.start_line %><% if (f.start_line !== f.end_line) { %>–<%= f.end_line %><% } %>` — <%= f.title %> · confidence <%= it.formatConfidence(f.confidence) %>
|
|
38
41
|
<details><summary>Reasoning</summary>
|
|
39
42
|
|
|
40
43
|
<% f.reasoning.split("\n").forEach(function(rl) { -%>
|
|
@@ -96,7 +99,7 @@ All <%= it.testReport.total %> tests passed.
|
|
|
96
99
|
<% } -%>
|
|
97
100
|
<% if (it.usageAvailable && !it.pricesProvided) { -%>
|
|
98
101
|
>
|
|
99
|
-
> _Cost shown as **N/A** — [No `.github/prices.json`](https://github.com/JPHutchins/code-review/blob/main/
|
|
102
|
+
> _Cost shown as **N/A** — [No `.github/prices.json`](https://github.com/JPHutchins/code-review/blob/main/schema/prices.example.json) price map to recompute from._
|
|
100
103
|
<% } -%>
|
|
101
104
|
>
|
|
102
105
|
> _Generated by [code-review](https://github.com/JPHutchins/code-review)<% if (it.runUrl) { %> · [view the run & traces](<%~ it.runUrl %>)<% } %>._
|
package/templates/inline.eta
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<% if (it.findingsPointer) { -%>
|
|
2
2
|
<%~ it.findingsPointer %>
|
|
3
3
|
<% } -%>
|
|
4
|
-
<%= it.severityEmoji(it.severity) %>
|
|
4
|
+
<%= it.severityEmoji(it.severity) %> <%= it.severity.charAt(0).toUpperCase() + it.severity.slice(1) %>: **<%= it.title %>** · <%= it.formatConfidence(it.confidence) %> confidence
|
|
5
5
|
|
|
6
6
|
<%~ it.description %>
|
|
7
7
|
<% if (it.recommendation) { -%>
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
<% } -%>
|
|
22
22
|
|
|
23
23
|
> [!TIP]
|
|
24
|
-
> Generated by <%~ it.modelsText
|
|
24
|
+
> Generated by <%~ it.modelsText %>.
|
|
25
25
|
> <details>
|
|
26
26
|
> <summary>Reasoning</summary>
|
|
27
27
|
>
|