@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jphutchins/code-review",
3
- "version": "0.1.0-alpha.7",
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`); a deterministic commenter renders it into a sticky summary comment and inline PR review comments. Agent- and provider-agnostic: any model driven by a compatible CLI adapter may produce it. Kept free of $ref/$defs so the same file works for both JSON-Schema validators and CLI structured-output enforcement.",
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\"). Lets a commenter detect a version mismatch rather than silently dropping fields."
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": "Markdown walkthrough of the change and the overall assessment; rendered as the body of the sticky summary comment."
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. Advisory only: a conforming commenter posts the GitHub review as COMMENT and never REQUEST_CHANGES, surfacing this value as a badge."
22
+ "description": "Overall stance."
23
23
  },
24
24
  "findings": {
25
25
  "type": "array",
26
- "description": "Zero or more specific findings. Each becomes one inline review comment when its line is inside the diff; otherwise it is demoted into the summary.",
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": "Markdown explanation of what is wrong; rendered as the inline comment body."
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": "Markdown prose describing what to do about the finding, in human terms — 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."
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": ["string", "null"],
99
- "description": "Single-hunk unified diff of a mechanical fix, against this file's post-change (RIGHT-side) content, or null when there is no mechanical fix. Validated exactly against the file and deterministically projected into a suggestion (or dropped) by the commenter, so it never posts with wrong indentation or an over-wide range."
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
  }
@@ -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/SPEC.md#62-price-map) price map to recompute from._
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 %>)<% } %>._
@@ -1,7 +1,7 @@
1
1
  <% if (it.findingsPointer) { -%>
2
2
  <%~ it.findingsPointer %>
3
3
  <% } -%>
4
- <%= it.severityEmoji(it.severity) %> **<%= it.severity %>** <%= it.title %>
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 %> at <%= it.confidence %> confidence.
24
+ > Generated by <%~ it.modelsText %>.
25
25
  > <details>
26
26
  > <summary>Reasoning</summary>
27
27
  >