opencode-azure-devops-pr-review 0.4.4 → 0.4.6
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/CHANGELOG.md +121 -0
- package/README.md +82 -27
- package/package.json +1 -1
- package/src/attribution.mjs +92 -1
- package/src/azure.mjs +12 -0
- package/src/comment-work.mjs +192 -16
- package/src/comments.mjs +364 -20
- package/src/config.mjs +4 -3
- package/src/prompts/comment-plan.md +46 -3
- package/src/prompts/comment-policy.md +2 -0
- package/src/runtime.mjs +24 -8
- package/src/tui-actions.mjs +43 -15
- package/src/tui-model.mjs +26 -5
- package/src/tui-view.jsx +25 -10
- package/src/tui.js +39 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,126 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.6 — 2026-11-21
|
|
4
|
+
|
|
5
|
+
One defect that a pull request makes at several places now gets one inline
|
|
6
|
+
comment that lists the other places, where each place had a thread of its own.
|
|
7
|
+
The reviewer and verifier instructions are those of 0.4.5, so a review finds
|
|
8
|
+
and verifies as before; the comment planner's instructions changed, and no
|
|
9
|
+
setting is new.
|
|
10
|
+
|
|
11
|
+
Comments:
|
|
12
|
+
|
|
13
|
+
- A mistake repeated in several places (the same wrong call in each handler,
|
|
14
|
+
the same stale text in each copy) is one finding per place, since each place
|
|
15
|
+
needs its own correction. Each of them used to get an inline thread with
|
|
16
|
+
much the same text: twelve moved files with one inherited defect were twelve
|
|
17
|
+
threads to read and resolve. The comment planner may now write one comment
|
|
18
|
+
for such findings, at the place that shows the mistake most clearly.
|
|
19
|
+
- AZPR lists every other place under that comment, in a section
|
|
20
|
+
`**📍 Also at** (the same defect; fix these places with it):` (in Chinese
|
|
21
|
+
`**📍 其他位置**`): one row per other finding with its file, its lines and
|
|
22
|
+
its ID. The rows are the findings' own locations, not text the planner
|
|
23
|
+
wrote, and the list is plain: nothing is collapsed or linked, so its own
|
|
24
|
+
markup holds nothing back in automatic publication (a file name is checked
|
|
25
|
+
like any other text of the comment).
|
|
26
|
+
- Findings share a comment only when they have the same severity (high or
|
|
27
|
+
medium), lie on different lines of files the pull request changes, and the
|
|
28
|
+
planner says they are the same mistake with the same correction. Places
|
|
29
|
+
that need different corrections keep their own comments, and when unsure
|
|
30
|
+
the planner keeps findings apart. The preview shows a shared comment with
|
|
31
|
+
all its findings and the planner's reason.
|
|
32
|
+
- A place is listed as its finding states it. The runtime therefore offers a
|
|
33
|
+
finding only when the file has those lines at the reviewed commit and its
|
|
34
|
+
name can stand in a list unchanged, and it accepts a shared comment only
|
|
35
|
+
when its anchor touches the lines of exactly one of its findings, which is
|
|
36
|
+
where the comment stands. A text that ends inside a code fence or a raw
|
|
37
|
+
HTML block, which would take the list in, is sent back for correction.
|
|
38
|
+
- The review is unchanged: it still has one finding per place. Each keeps
|
|
39
|
+
its row in the summary index, its ID, and can be left out or given another
|
|
40
|
+
severity after a preview.
|
|
41
|
+
- A shared comment has a marker of its own, made of its file, the lines it
|
|
42
|
+
quotes and the other places it lists. Publication skips it only when that
|
|
43
|
+
marker is on the pull request, so `ALREADY_PRESENT` means that this very
|
|
44
|
+
comment, with every place, is there. The markers of comments for one place
|
|
45
|
+
are unchanged, and so is publication.
|
|
46
|
+
- Which findings may be such repeats is settled before the planning pages are
|
|
47
|
+
made, and only when at least two of them have one severity and lie at
|
|
48
|
+
different places. When all findings fit one page (at most four, within a
|
|
49
|
+
page's text), that page is offered its findings of equal severity at
|
|
50
|
+
different places. Otherwise, where two of them fit one page together, a
|
|
51
|
+
grouping pass runs first: one more stage of the comment planner, usually
|
|
52
|
+
one request, whose input is the findings that could share a page with
|
|
53
|
+
another one of their severity, and which says which are one mistake at
|
|
54
|
+
several places. A group then shares a
|
|
55
|
+
page, which can hold more than four findings. A pass that fails costs only
|
|
56
|
+
the grouping (a progress notice says so, and the comments are planned one
|
|
57
|
+
per place), and a run that is stopped during it plans nothing more.
|
|
58
|
+
- Nothing posted is ever changed, and an item the PR already has is skipped
|
|
59
|
+
as always. When a pull request with a shared comment is planned again, the
|
|
60
|
+
planner is told which other places that thread says it covers, so they get
|
|
61
|
+
no thread of their own; the list is read back only where AZPR wrote it, in
|
|
62
|
+
the comment that opened the thread.
|
|
63
|
+
- A shared comment and a comment for one place are not put on the same
|
|
64
|
+
quoted lines (a thread per place from an earlier version, say): when
|
|
65
|
+
planning, the comment is sent back and the planner is asked for another
|
|
66
|
+
place or to skip the finding as discussed, and a comment that still stands
|
|
67
|
+
there is not planned, with the reason shown in the preview.
|
|
68
|
+
|
|
69
|
+
The README's benchmark section now says what each precision measures: the
|
|
70
|
+
share of comments on Martian's list of issues, next to the share of findings
|
|
71
|
+
that ReviewBench's judge rated valid.
|
|
72
|
+
|
|
73
|
+
## 0.4.5 — 2026-11-20
|
|
74
|
+
|
|
75
|
+
While a run is under way, the terminal panel offers to stop it. The reviewer,
|
|
76
|
+
verifier and comment-planning instructions are those of 0.4.4, and no setting
|
|
77
|
+
is new.
|
|
78
|
+
|
|
79
|
+
The terminal panel:
|
|
80
|
+
|
|
81
|
+
- A `STARTED` notice says how its run is stopped (`/pr-stop <run-id>`), but
|
|
82
|
+
in the conversation, which a person who reads the panel does not watch, and
|
|
83
|
+
with an ID to copy. While a run is under way (a review, a preview that is
|
|
84
|
+
being planned, a publication, a check) the row at the panel's foot now
|
|
85
|
+
offers **Stop this run…** (`s`), and nothing else.
|
|
86
|
+
- Stopping asks first, in a list whose first row is "No, let it run" and
|
|
87
|
+
names the run. "Yes, stop it" sends `/pr-stop` with that run's ID to the
|
|
88
|
+
session on screen, and AZPR takes it like a typed command; the run ends
|
|
89
|
+
with its `CANCELLED` receipt, and requests that were already sent may still
|
|
90
|
+
be billed.
|
|
91
|
+
- What is typed into such a question finds a row by the beginning of its
|
|
92
|
+
title: `y` finds "Yes" and `n` "No". The key that opened the question,
|
|
93
|
+
pressed once more than meant, is typed into it, and OpenCode's own search
|
|
94
|
+
would find `s` in "Yes, stop it" alone and select it; now it leaves no row
|
|
95
|
+
for Enter to take. The question before posting answers the same way.
|
|
96
|
+
- An answer is acted on only while the panel still shows that run as under
|
|
97
|
+
way. If the run has ended, or the next run has started, while the question
|
|
98
|
+
was open, nothing is sent and the panel says so; a step that reaches AZPR
|
|
99
|
+
after its run has ended stops nothing, and no other run.
|
|
100
|
+
- That a run can be stopped comes from the runtime, like every other step: in
|
|
101
|
+
the metadata of the run's `STARTED` notice, which no model reads (the run's
|
|
102
|
+
ID). The text of that notice is unchanged, and progress notices and
|
|
103
|
+
receipts are sent as before. A run that an earlier version started offers
|
|
104
|
+
nothing; it is stopped by typing the command its notice shows.
|
|
105
|
+
- Where the panel has no report or preview to show, it said "No report or
|
|
106
|
+
preview yet." also of a run that had ended, such as one that was stopped.
|
|
107
|
+
Once the run has its receipt it now says "This run ended with no report or
|
|
108
|
+
preview to show."
|
|
109
|
+
- A click on a step at the panel's foot could be lost (since 0.4.4). The
|
|
110
|
+
steps were drawn anew whenever the panel worked its content out again,
|
|
111
|
+
which every notice and every answer of the server causes, and OpenTUI finds
|
|
112
|
+
what lies under the pointer in the frame it drew last: a press or a release
|
|
113
|
+
that came before the next frame went nowhere. Each step now keeps its
|
|
114
|
+
element, as the session rows do, and its highlight under the pointer.
|
|
115
|
+
|
|
116
|
+
Documentation:
|
|
117
|
+
|
|
118
|
+
- The recording at the top of the README and the pictures of the panel in
|
|
119
|
+
the demonstration are new: a real review with the row at the panel's foot
|
|
120
|
+
(the step that stops a run, then posting and adjusting), a review stopped
|
|
121
|
+
from the panel, and the whole terminal in every frame. They showed the
|
|
122
|
+
panel of 0.4.2.
|
|
123
|
+
|
|
3
124
|
## 0.4.4 — 2026-11-19
|
|
4
125
|
|
|
5
126
|
After a comment preview, the terminal panel lists what you can do next at its
|
package/README.md
CHANGED
|
@@ -12,7 +12,8 @@ and choose what gets published. No MCP server or CI pipeline setup is required.
|
|
|
12
12
|
|
|
13
13
|
On Martian's open [Code Review Bench](#benchmark-results), `/pr-deep` found
|
|
14
14
|
more of the listed issues in 50 real pull requests than any of the 21 tools on
|
|
15
|
-
the benchmark's dashboard.
|
|
15
|
+
the benchmark's dashboard. On ReviewBench's test set, which scores each finding
|
|
16
|
+
on its own merits, 97.4% of its findings were judged valid.
|
|
16
17
|
|
|
17
18
|
AZPR is an independent community project. It is not built by or affiliated with
|
|
18
19
|
the OpenCode team.
|
|
@@ -47,7 +48,7 @@ is an actual capture excerpt with identifying UI removed and its text unchanged.
|
|
|
47
48
|
|
|
48
49
|
## Watch the workflow
|
|
49
50
|
|
|
50
|
-
[](docs/DEMO.md#the-terminal-panel)
|
|
51
52
|
|
|
52
53
|
*A 15-second edit of a real OpenCode 2.3.0 session on a dedicated test PR.
|
|
53
54
|
Waiting time is shortened, so the length is not the review duration.
|
|
@@ -61,7 +62,7 @@ Waiting time is shortened, so the length is not the review duration.
|
|
|
61
62
|
[company networks](docs/ENTERPRISE.md#company-networks) first):
|
|
62
63
|
|
|
63
64
|
```sh
|
|
64
|
-
opencode plugin add opencode-azure-devops-pr-review@0.4.
|
|
65
|
+
opencode plugin add opencode-azure-devops-pr-review@0.4.6
|
|
65
66
|
```
|
|
66
67
|
|
|
67
68
|
2. In OpenCode's terminal UI, type `/pr-setup`. Dialogs ask for your Azure
|
|
@@ -92,9 +93,10 @@ without a model.
|
|
|
92
93
|
|
|
93
94
|
In OpenCode's terminal UI a [panel](#terminal-panel) opens beside the
|
|
94
95
|
conversation: it shows the report and the preview rendered, and at its foot
|
|
95
|
-
what you can do next
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
what you can do next, without typing a command. While the review runs that is
|
|
97
|
+
**Stop this run…**. After the preview, pick **Post N comments…** there, or
|
|
98
|
+
leave findings out first with **Adjust findings…**. Stopping and posting
|
|
99
|
+
always ask once more.
|
|
98
100
|
|
|
99
101
|
<details>
|
|
100
102
|
<summary>Optional: adjust findings and publish after reading the preview</summary>
|
|
@@ -196,8 +198,14 @@ tools on its public dashboard.**
|
|
|
196
198
|
- **Built for interactive triage (F2 54.1, would rank 6th):** `/pr-deep`
|
|
197
199
|
reports every defect it confirms instead of holding findings back, and you
|
|
198
200
|
choose which ones to publish.
|
|
199
|
-
|
|
200
|
-
|
|
201
|
+
- **Findings that hold up when checked (95.6% judged valid):** this
|
|
202
|
+
benchmark's precision is the share of comments that are on its list of about
|
|
203
|
+
three issues per PR, so it counts an accurate comment outside that list as
|
|
204
|
+
wrong. [ReviewBench](#checked-on-a-second-benchmark) scores each finding on
|
|
205
|
+
its own merits instead: it judged 95.6% of this release's findings valid, and
|
|
206
|
+
97.4% of 0.3.7's.
|
|
207
|
+
|
|
208
|
+
| Tool | Issues found (recall) | High and Critical found | Comments on the benchmark's list (precision) | F2 |
|
|
201
209
|
| :--- | ---: | ---: | ---: | ---: |
|
|
202
210
|
| **AZPR 0.3.5 (`/pr-deep`, Claude Opus 5.5)** | **67.7%** 🏆 | **74.2%** 🏆 | **30.0%** | **54.1** |
|
|
203
211
|
| copilot-v2 | 66.5% | 71.2% | 38.5% | 58.0 |
|
|
@@ -231,6 +239,12 @@ The benchmark's precision also counts accurate comments it does not list:
|
|
|
231
239
|
AZPR findings that matched no expected issue against the source code:
|
|
232
240
|
**36 were accurate**, and **18 were genuine defects** introduced or exposed
|
|
233
241
|
by the PR that the benchmark's list does not include.
|
|
242
|
+
3. **A judge that checks each finding found them valid.** ReviewBench does not
|
|
243
|
+
compare findings with a list alone: its judge checks every finding that
|
|
244
|
+
matches no listed issue against the code. On its 25-PR test set it judged
|
|
245
|
+
**95.6%** of this release's findings valid, and **97.4%** of 0.3.7's
|
|
246
|
+
([the runs](#checked-on-a-second-benchmark)). We ran its scoring pipeline
|
|
247
|
+
ourselves, so this is not a leaderboard result.
|
|
234
248
|
|
|
235
249
|
### Model and effort recommendations
|
|
236
250
|
|
|
@@ -412,7 +426,8 @@ acknowledge `STARTED` and continue in the current OpenCode process; short
|
|
|
412
426
|
`PROGRESS` notices and a final receipt return to the invoking conversation.
|
|
413
427
|
They start no response of that conversation's own model; when you prompt it
|
|
414
428
|
later, it reads them together with your prompt, in one request. Use
|
|
415
|
-
the displayed `/pr-stop <run-id>` to cancel
|
|
429
|
+
the displayed `/pr-stop <run-id>` to cancel, or **Stop this run…** at the
|
|
430
|
+
foot of the [terminal panel](#terminal-panel). `/pr-setup` (including `--help`),
|
|
416
431
|
`/pr-stop`, `/pr-comment --show`, an adjustment that changes nothing and a
|
|
417
432
|
refused command answer directly, without a background run.
|
|
418
433
|
Completed reviews, previews and publication ledgers are saved privately and
|
|
@@ -433,14 +448,14 @@ Azure DevOps REST API with the runtime's built-in `fetch`.
|
|
|
433
448
|
Install the npm package with OpenCode's plugin manager:
|
|
434
449
|
|
|
435
450
|
```sh
|
|
436
|
-
opencode plugin add opencode-azure-devops-pr-review@0.4.
|
|
451
|
+
opencode plugin add opencode-azure-devops-pr-review@0.4.6
|
|
437
452
|
```
|
|
438
453
|
|
|
439
454
|
The same release is also a versioned Git package, which needs Git but not the
|
|
440
455
|
npm registry:
|
|
441
456
|
|
|
442
457
|
```sh
|
|
443
|
-
opencode plugin add 'github:WTLAIB/opencode-azure-devops-pr-review-v2#v0.4.
|
|
458
|
+
opencode plugin add 'github:WTLAIB/opencode-azure-devops-pr-review-v2#v0.4.6'
|
|
444
459
|
```
|
|
445
460
|
|
|
446
461
|
Add only one of them. OpenCode 2.3.0 loads the plugin into a running OpenCode
|
|
@@ -455,7 +470,7 @@ To select another configuration file, use an absolute path in the host config:
|
|
|
455
470
|
```json
|
|
456
471
|
{
|
|
457
472
|
"plugins": [{
|
|
458
|
-
"package": "opencode-azure-devops-pr-review@0.4.
|
|
473
|
+
"package": "opencode-azure-devops-pr-review@0.4.6",
|
|
459
474
|
"options": { "settingsFile": "/absolute/path/to/azpr/settings.json" }
|
|
460
475
|
}]
|
|
461
476
|
}
|
|
@@ -480,7 +495,7 @@ For an entry that `opencode plugin add` created, add the new version and,
|
|
|
480
495
|
only when that succeeds, remove the previous one:
|
|
481
496
|
|
|
482
497
|
```sh
|
|
483
|
-
opencode plugin add opencode-azure-devops-pr-review@0.4.
|
|
498
|
+
opencode plugin add opencode-azure-devops-pr-review@0.4.6 &&
|
|
484
499
|
opencode plugin remove opencode-azure-devops-pr-review@PREVIOUS_VERSION
|
|
485
500
|
```
|
|
486
501
|
|
|
@@ -512,7 +527,9 @@ the first one (`Unknown setting settings.terminalPanel`) instead of starting. `o
|
|
|
512
527
|
show a single `azpr` row with the new version (from 0.3.1, `/pr-check` names
|
|
513
528
|
it too); if it still shows the previous one, run `opencode service restart`.
|
|
514
529
|
Exact versions stay pinned, so `opencode plugin update` leaves them unchanged.
|
|
515
|
-
See the [0.4.
|
|
530
|
+
See the [0.4.6 release notes](docs/releases/v0.4.6.md) for what changed, the
|
|
531
|
+
[0.4.5 release notes](docs/releases/v0.4.5.md) for stopping a run from the panel, the
|
|
532
|
+
[0.4.4 release notes](docs/releases/v0.4.4.md) for the steps at the panel's foot, the
|
|
516
533
|
[0.4.3 release notes](docs/releases/v0.4.3.md) for setup in the terminal UI, the
|
|
517
534
|
[0.4.0 release notes](docs/releases/v0.4.0.md) for commands without review IDs and the
|
|
518
535
|
[0.2.0 release notes](docs/releases/v0.2.0.md) for automatic comments. A
|
|
@@ -525,8 +542,8 @@ review command flag.
|
|
|
525
542
|
<details>
|
|
526
543
|
<summary>Source installation and replacement</summary>
|
|
527
544
|
|
|
528
|
-
Download the [v0.4.
|
|
529
|
-
and extract it, or check out tag `v0.4.
|
|
545
|
+
Download the [v0.4.6 source archive](https://github.com/WTLAIB/opencode-azure-devops-pr-review-v2/archive/refs/tags/v0.4.6.tar.gz)
|
|
546
|
+
and extract it, or check out tag `v0.4.6`. The installer needs POSIX `sh` and
|
|
530
547
|
Python 3's standard library. From that source directory:
|
|
531
548
|
|
|
532
549
|
```sh
|
|
@@ -903,7 +920,7 @@ troubleshooting.
|
|
|
903
920
|
| `/pr-review <PR URL> [flag] [context]` | Sharded functional and risk reviews, then sharded verification. |
|
|
904
921
|
| `/pr-deep <PR URL> [flag] [context]` | The same review with the stronger models of `models.deep`; usually slower and costlier. |
|
|
905
922
|
| `/pr-quick <PR URL> [flag] [context]` | One reviewer per shard for both focuses, no verification; findings are reported, not verified. |
|
|
906
|
-
| `/pr-stop [run-id]` | Cancel this conversation's active command. |
|
|
923
|
+
| `/pr-stop [run-id]` | Cancel this conversation's active command. The terminal panel offers the same while a run is under way (**Stop this run…**). |
|
|
907
924
|
| `/pr-comment [review-id]` | Preview comments for this conversation's current review. |
|
|
908
925
|
| `/pr-comment [review-id] --publish` | Post the saved preview. A review that was never adjusted is planned first if needed; an adjusted one needs its new preview. Safe to repeat. |
|
|
909
926
|
| `/pr-comment [review-id] --show` | Show the saved preview again; no model or Azure DevOps request. |
|
|
@@ -972,8 +989,9 @@ OpenCode shows what a plugin tells a conversation as plain text, so a report
|
|
|
972
989
|
or a comment preview appears there as Markdown source. In OpenCode's terminal
|
|
973
990
|
UI, AZPR therefore adds a panel beside the conversation: it shows the newest
|
|
974
991
|
report or preview rendered, lists the sessions of the review so that you can
|
|
975
|
-
open one, and
|
|
976
|
-
|
|
992
|
+
open one, and lists at its foot what you can do next (stop a run that is
|
|
993
|
+
under way; after a preview, post it or adjust its findings), so that you pick
|
|
994
|
+
a step instead of typing its command. The
|
|
977
995
|
[recording of a real review](docs/DEMO.md#the-terminal-panel) shows the report
|
|
978
996
|
and the conversation side by side.
|
|
979
997
|
|
|
@@ -1025,10 +1043,24 @@ and the conversation side by side.
|
|
|
1025
1043
|
when they are others by now, for instance after a command typed in the
|
|
1026
1044
|
review's own session or in another client: nothing is posted that you have
|
|
1027
1045
|
not read.
|
|
1046
|
+
|
|
1047
|
+
While a run is under way (a review, a preview that is being planned, a
|
|
1048
|
+
publication), the row offers one thing instead:
|
|
1049
|
+
|
|
1050
|
+
```text
|
|
1051
|
+
[s] Stop this run…
|
|
1052
|
+
```
|
|
1053
|
+
|
|
1054
|
+
It asks first, with "No, let it run" first, and then sends `/pr-stop` for
|
|
1055
|
+
that run, as if you had typed it: the run ends with its `CANCELLED`
|
|
1056
|
+
receipt, and requests that were already sent may still be billed. If the
|
|
1057
|
+
run has ended while the question was open, nothing is sent and the panel
|
|
1058
|
+
says so. A run that an earlier AZPR started is stopped by typing the
|
|
1059
|
+
command its STARTED notice shows.
|
|
1028
1060
|
- **Keys.** `/pr-panel` shows and hides the panel; it is the panel's only
|
|
1029
1061
|
command. A click inside its text gives it the keyboard: the arrow keys or
|
|
1030
|
-
`j` and `k`, Page Up and Page Down, Home and End scroll, `p`, `a`, `u
|
|
1031
|
-
`c` pick what the foot offers, and Escape or `q` closes it.
|
|
1062
|
+
`j` and `k`, Page Up and Page Down, Home and End scroll, `p`, `a`, `u`,
|
|
1063
|
+
`c` and `s` pick what the foot offers, and Escape or `q` closes it.
|
|
1032
1064
|
- **A narrow terminal** (fewer than 108 columns) has no room for two panes,
|
|
1033
1065
|
and OpenCode would show the panel in place of the conversation. There the
|
|
1034
1066
|
panel does not open by itself; it says that something is ready, and
|
|
@@ -1036,8 +1068,9 @@ and the conversation side by side.
|
|
|
1036
1068
|
|
|
1037
1069
|
The panel shows what AZPR already put into your conversation and into the
|
|
1038
1070
|
session that holds a report. It sends nothing by itself and never a prompt:
|
|
1039
|
-
the one thing it sends is the
|
|
1040
|
-
AZPR takes like a typed one, and
|
|
1071
|
+
the one thing it sends is the command of a step you pick (`/pr-comment`, or
|
|
1072
|
+
`/pr-stop` for a run under way), which AZPR takes like a typed one, and
|
|
1073
|
+
posting and stopping always ask first. It comes with
|
|
1041
1074
|
the package and needs no setup; `terminalPanel` is its one setting. Other
|
|
1042
1075
|
OpenCode clients, such as the desktop app, do not load it and show AZPR's
|
|
1043
1076
|
notices as before. The same terminal part brings the
|
|
@@ -1047,7 +1080,8 @@ notices as before. The same terminal part brings the
|
|
|
1047
1080
|
|
|
1048
1081
|
`/pr-comment` plans one general summary plus inline comments for confirmed high
|
|
1049
1082
|
and medium findings (low findings stay in the summary index). Planning runs in
|
|
1050
|
-
pages of at most four findings
|
|
1083
|
+
pages of at most four findings (more only where one defect at several places
|
|
1084
|
+
keeps its findings together), two pages at a time, and the pages are joined
|
|
1051
1085
|
in page order, so the result does not depend on which page finishes first; each
|
|
1052
1086
|
page may get a correction turn, and an item that still cannot be posted
|
|
1053
1087
|
faithfully is skipped with a reason instead of failing the command. Inline
|
|
@@ -1060,6 +1094,27 @@ coverage), and their inline comments need a location on a changed HEAD file.
|
|
|
1060
1094
|
When two shards of a quick review report one defect, the planner may combine
|
|
1061
1095
|
them into one comment under fixed rules (see [commenting](docs/COMMENTING.md)).
|
|
1062
1096
|
|
|
1097
|
+
One mistake is often made at several places of a pull request: the same wrong
|
|
1098
|
+
call in each handler, the same stale text in each copy. Each place is a
|
|
1099
|
+
finding of its own, and the planner may give such findings one inline comment
|
|
1100
|
+
instead of a thread per place. The comment stands at the place that shows the
|
|
1101
|
+
mistake most clearly, and AZPR lists every other place under it:
|
|
1102
|
+
|
|
1103
|
+
```text
|
|
1104
|
+
**📍 Also at** (the same defect; fix these places with it):
|
|
1105
|
+
- `/src/orders/refund.ts:41-44` (F-3)
|
|
1106
|
+
- `/src/orders/cancel.ts:18` (F-5)
|
|
1107
|
+
```
|
|
1108
|
+
|
|
1109
|
+
The findings must have the same severity and need the same correction; places
|
|
1110
|
+
that need different corrections keep their own comments. Every place keeps
|
|
1111
|
+
its row in the summary index, and you can still exclude or regrade each one
|
|
1112
|
+
after a preview. A shared comment has a marker of its own, so it counts as
|
|
1113
|
+
already posted only when this very comment, with every place, is on the pull
|
|
1114
|
+
request; and a shared comment and a comment for one place are not planned
|
|
1115
|
+
onto the same quoted lines (see
|
|
1116
|
+
[one defect at several places](docs/COMMENTING.md#one-defect-at-several-places)).
|
|
1117
|
+
|
|
1063
1118
|
### Adjusting findings after a preview
|
|
1064
1119
|
|
|
1065
1120
|
When a preview contains findings you disagree with, leave them out or change
|
|
@@ -1262,8 +1317,8 @@ dependency and is not built on your machine.
|
|
|
1262
1317
|
Uninstall without `--apply` previews; `--apply` archives only this package under
|
|
1263
1318
|
`azpr-v2-backups` and leaves the private state directory for you to delete.
|
|
1264
1319
|
For a native installation, remove the entry you added, for example
|
|
1265
|
-
`opencode plugin remove opencode-azure-devops-pr-review@0.4.
|
|
1266
|
-
`opencode plugin remove 'github:WTLAIB/opencode-azure-devops-pr-review-v2#v0.4.
|
|
1320
|
+
`opencode plugin remove opencode-azure-devops-pr-review@0.4.6` or
|
|
1321
|
+
`opencode plugin remove 'github:WTLAIB/opencode-azure-devops-pr-review-v2#v0.4.6'`;
|
|
1267
1322
|
the external settings, PAT file and private review state remain available.
|
|
1268
1323
|
|
|
1269
1324
|
[Architecture](docs/ARCHITECTURE.md), [commenting](docs/COMMENTING.md),
|
|
@@ -1276,7 +1331,7 @@ or personal model selections.
|
|
|
1276
1331
|
## License and releases
|
|
1277
1332
|
|
|
1278
1333
|
[MIT](LICENSE), copyright 2026 WTLAIB. See the [changelog](CHANGELOG.md) for the
|
|
1279
|
-
release scope, [v0.4.
|
|
1334
|
+
release scope, [v0.4.6](https://github.com/WTLAIB/opencode-azure-devops-pr-review-v2/releases/tag/v0.4.6)
|
|
1280
1335
|
for downloads, the [npm package](https://www.npmjs.com/package/opencode-azure-devops-pr-review),
|
|
1281
1336
|
[v0.2.0](https://github.com/WTLAIB/opencode-azure-devops-pr-review-v2/releases/tag/v0.2.0)
|
|
1282
1337
|
for the recorded demonstration, and [releasing](docs/RELEASING.md) for the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-azure-devops-pr-review",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Azure DevOps PR reviews from a URL in OpenCode, with no checkout, configurable models, separate verification, and comment previews you can adjust before posting",
|
|
6
6
|
"scripts": {
|
package/src/attribution.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ROLES, MAX_ARCHIVE_MEGABYTES } from './config.mjs';
|
|
1
|
+
import { ROLES, MAX_ARCHIVE_MEGABYTES, isModelReference } from './config.mjs';
|
|
2
2
|
// Deterministic attribution from invoked reviewer stages, not model-authored claims.
|
|
3
3
|
const vocabulary = {
|
|
4
4
|
en: { title: 'AI review provenance', disclaimer: 'AI-generated review, not human approval. Posting through a user account does not imply that person verified these conclusions.', method: 'Independent initial reviews, followed by source-based verification, duplicate merging, and rejection of unsupported findings; not majority voting.', roles: ['Source check', 'Functional review', 'Risk review', 'Verification', 'Duplicate check', 'Quick review', 'Severity rating'], stage: 'Stage', model: 'Selected provider/model ID', sessions: 'Sessions', count: 'Initial findings', dispositions: 'Finding dispositions', finding: 'Finding', result: 'Result', merged: 'Merged into', extra: 'New verifier findings', note: 'IDs identify the models selected in OpenCode, not independently verified provider backend identities. Host auxiliary models and the original chat model are not part of this ledger.', comment: 'AI-generated review; not human review or approval. Models:',
|
|
@@ -142,6 +142,97 @@ function displayLocation(value) {
|
|
|
142
142
|
return value;
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
+
/** The heading of the list of other places in each language it is written in; what reads the list back knows it by these lines. */
|
|
146
|
+
export const OTHER_PLACES_HEADINGS = Object.freeze(['**📍 Also at** (the same defect; fix these places with it):', '**📍 其他位置**(同一個問題,請一併修正):', '**📍 其他位置**(同一个问题,请一并修正):']);
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* The other places of one defect that a comment covers, as the runtime adds
|
|
150
|
+
* them under the comment's own text: one row per finding with its file and
|
|
151
|
+
* lines, from the findings' own locations, never from text a model wrote.
|
|
152
|
+
* A plain list: nothing here is collapsed or linked.
|
|
153
|
+
* @param {{findingId: string, place: string}[]} places
|
|
154
|
+
*/
|
|
155
|
+
export function renderOtherPlaces(places, language) {
|
|
156
|
+
const [english, traditional, simplified] = OTHER_PLACES_HEADINGS;
|
|
157
|
+
const heading = pick(language, english, traditional, simplified);
|
|
158
|
+
return `${heading}\n${places.map(({ findingId, place }) => placeRow(place, findingId, pick(language, ROW_BRACKETS[0], ROW_BRACKETS[1], ROW_BRACKETS[1]))).join('\n')}`;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// How a row puts its finding ID in brackets: in English, and in Chinese.
|
|
162
|
+
const ROW_BRACKETS = [[' (', ')'], ['(', ')']];
|
|
163
|
+
|
|
164
|
+
/** One row of that list: the place in a code span that holds any text (longer than the longest run of backticks inside it), then the finding ID. */
|
|
165
|
+
function placeRow(place, findingId, [open, close]) {
|
|
166
|
+
const text = String(place).replace(/[\r\n\t]+/g, ' ');
|
|
167
|
+
const run = Math.max(0, ...(text.match(/`+/g) ?? []).map(match => match.length));
|
|
168
|
+
const fence = '`'.repeat(run + 1);
|
|
169
|
+
return `- ${run ? `${fence} ${text} ${fence}` : `\`${text}\``}${open}${String(findingId).replace(/[^A-Za-z0-9_-]/g, '')}${close}`;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Whether a place can be written into that list and read back as it is: its
|
|
174
|
+
* text holds no control character, no line separator and neither end of an
|
|
175
|
+
* HTML comment, which the posted text would have to change.
|
|
176
|
+
*/
|
|
177
|
+
export const listablePlace = place => typeof place === 'string' && !/[\u0000-\u001f\u007f-\u009f\u2028\u2029]|<!--|-->/.test(place);
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* The places a posted comment of AZPR's lists, read back from its text for a
|
|
181
|
+
* later plan (`alsoAt` in the digest of a thread): the rows under the heading
|
|
182
|
+
* `renderOtherPlaces` writes, where they end the comment's own text as
|
|
183
|
+
* `assemblePlan` writes it. A row counts only when writing its place and its
|
|
184
|
+
* finding ID again gives the very line (so a row is one a finding's place
|
|
185
|
+
* could have produced: a path, its lines in order, an ID). After the rows
|
|
186
|
+
* comes a blank line, then the attribution if there is one (a rule, the line
|
|
187
|
+
* `commentAttribution` writes for a comment, and a blank line), then the two
|
|
188
|
+
* markers of such a comment (`linesMarker`, then its own) with a blank line
|
|
189
|
+
* between them.
|
|
190
|
+
* [] for any other text: one that merely holds such a heading or such rows,
|
|
191
|
+
* one whose row has another form, one that was continued after the list.
|
|
192
|
+
* What is read here tells a planner what a thread says it covers, as the
|
|
193
|
+
* start of the thread's text does; nothing is posted or skipped because of it.
|
|
194
|
+
*/
|
|
195
|
+
export function listedPlaces(content) {
|
|
196
|
+
// Line by line as written: only the line ends a service may return differ from what the runtime wrote.
|
|
197
|
+
const lines = String(content ?? '').split(/\r?\n/);
|
|
198
|
+
while (lines.length && lines.at(-1) === '') lines.pop();
|
|
199
|
+
const heading = lines.findLastIndex(line => OTHER_PLACES_HEADINGS.includes(line));
|
|
200
|
+
if (heading < 0) return [];
|
|
201
|
+
// The rows are written in the heading's language: English brackets under the English heading, Chinese ones otherwise.
|
|
202
|
+
const brackets = ROW_BRACKETS[OTHER_PLACES_HEADINGS.indexOf(lines[heading]) ? 1 : 0];
|
|
203
|
+
const places = [];
|
|
204
|
+
let next = heading + 1;
|
|
205
|
+
for (; next < lines.length && lines[next].startsWith('- `'); next++) {
|
|
206
|
+
// The row's parts, each read once: the opening code-span delimiter, the finding ID at the end, the place
|
|
207
|
+
// between them. Writing the row again must give the very line, so nothing else passes.
|
|
208
|
+
const line = lines[next], fence = /^`+/.exec(line.slice(2))[0], id = /[((]([A-Za-z]+-\d+)[))]$/.exec(line);
|
|
209
|
+
const inner = id && line.slice(2 + fence.length, id.index).trimEnd();
|
|
210
|
+
const place = inner && inner.endsWith(fence) ? inner.slice(0, -fence.length).trim() : '';
|
|
211
|
+
const at = /^\/[^:]+:([1-9]\d*)(?:-([1-9]\d*))?$/.exec(place);
|
|
212
|
+
// A place as a finding's is written (lines in order), in the row the runtime writes for it under this heading.
|
|
213
|
+
if (!at || Number(at[2] ?? at[1]) < Number(at[1]) || !listablePlace(place) || placeRow(place, id[1], brackets) !== line) return [];
|
|
214
|
+
places.push(place);
|
|
215
|
+
}
|
|
216
|
+
const rest = lines.slice(next);
|
|
217
|
+
const marker = /^<!-- azpr-comment:[a-f0-9]{32} -->$/;
|
|
218
|
+
// The end of a comment for several places: the marker of its lines, a blank line, its own marker.
|
|
219
|
+
if (!places.length || rest.shift() !== '' || !marker.test(rest.pop() ?? '') || rest.pop() !== '' || !marker.test(rest.pop() ?? '')) return [];
|
|
220
|
+
if (!rest.length) return places;
|
|
221
|
+
// The attribution: a rule, the line the runtime writes for a comment, and a blank line.
|
|
222
|
+
return rest.length === 3 && rest[0] === '---' && commentAttributionLine(rest[1]) && rest[2] === '' ? places : [];
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Whether a line is the attribution `commentAttribution` writes for an inline
|
|
227
|
+
* comment, in any language: its fixed wording for a verified or a quick
|
|
228
|
+
* review, then the models (references as settings take them), each in a code
|
|
229
|
+
* span, and nothing else.
|
|
230
|
+
*/
|
|
231
|
+
function commentAttributionLine(line) {
|
|
232
|
+
return Object.values(vocabulary).flatMap(words => [`${words.comment} `, `${words.lead}${words.quick}${words.end}${words.models} `])
|
|
233
|
+
.some(wording => line.startsWith(wording) && line.slice(wording.length).split(', ').every(span => /^`[^`]+`$/.test(span) && isModelReference(span.slice(1, -1))));
|
|
234
|
+
}
|
|
235
|
+
|
|
145
236
|
/** A compact index of existing claims, not another model-authored assessment. */
|
|
146
237
|
export function renderReviewSummary(findings, language, introduction = '', { verification = 'independent', groups = [] } = {}) {
|
|
147
238
|
const w = reportWords(language);
|
package/src/azure.mjs
CHANGED
|
@@ -238,6 +238,18 @@ export function markersInThreads(threads) {
|
|
|
238
238
|
return found;
|
|
239
239
|
}
|
|
240
240
|
|
|
241
|
+
/** The AZPR markers each live thread holds in its live comments, by thread: AZPR's comments on the PR, thread by thread. */
|
|
242
|
+
export function threadMarkers(threads) {
|
|
243
|
+
const found = new Map();
|
|
244
|
+
for (const thread of threads) {
|
|
245
|
+
if (thread?.isDeleted === true) continue;
|
|
246
|
+
const markers = (Array.isArray(thread?.comments) ? thread.comments : []).filter(comment => comment?.isDeleted !== true && typeof comment?.content === 'string')
|
|
247
|
+
.flatMap(comment => [...comment.content.matchAll(MARKER_PATTERN)].map(match => match[0]));
|
|
248
|
+
if (markers.length) found.set(thread.id, new Set(markers));
|
|
249
|
+
}
|
|
250
|
+
return found;
|
|
251
|
+
}
|
|
252
|
+
|
|
241
253
|
/** The text of the live comment that carries each marker, found as markersInThreads finds its thread. */
|
|
242
254
|
export function markerTexts(threads) {
|
|
243
255
|
const found = new Map();
|