opencode-azure-devops-pr-review 0.2.3 → 0.3.1
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.md +12 -0
- package/CHANGELOG.md +50 -0
- package/CODE_OF_CONDUCT.md +83 -0
- package/README.md +136 -56
- package/docs/ARCHITECTURE.md +34 -3
- package/docs/AZURE_DEVOPS.md +17 -14
- package/docs/COMMENTING.md +79 -0
- package/docs/DEBUGGING.md +7 -5
- package/docs/DEMO.md +45 -1
- package/docs/ENTERPRISE.md +37 -6
- package/docs/QUICKSTART.md +113 -68
- package/docs/ROADMAP.md +8 -0
- package/docs/VALIDATION.md +252 -38
- package/docs/VALIDATION_HISTORY.md +42 -2
- package/docs/assets/RECORDING.md +9 -2
- package/docs/assets/adjust-findings-teaser.gif +0 -0
- package/docs/assets/adjust-preview.png +0 -0
- package/docs/assets/adjust-publication.png +0 -0
- package/docs/assets/render-terminal-demo.py +1 -1
- package/docs/releases/v0.3.0.md +125 -0
- package/docs/releases/v0.3.1.md +87 -0
- package/package.json +3 -2
- package/src/attribution.mjs +1 -1
- package/src/azure.mjs +33 -3
- package/src/comment-work.mjs +30 -9
- package/src/comments.mjs +184 -4
- package/src/config.mjs +5 -0
- package/src/host.mjs +44 -0
- package/src/output.mjs +71 -0
- package/src/plugin.js +2 -1
- package/src/runtime.mjs +128 -25
- package/src/setup.mjs +49 -21
package/docs/COMMENTING.md
CHANGED
|
@@ -227,6 +227,85 @@ Every page is validated item by item:
|
|
|
227
227
|
A low finding never becomes an inline comment, and the verified severity always
|
|
228
228
|
wins over the planner's label.
|
|
229
229
|
|
|
230
|
+
## Adjusting findings after a preview
|
|
231
|
+
|
|
232
|
+
After reading a preview, a person can leave findings out of publication or
|
|
233
|
+
change their severity, and plan the preview again:
|
|
234
|
+
|
|
235
|
+
```text
|
|
236
|
+
/pr-comment <review-id> --exclude F-1,R-2
|
|
237
|
+
/pr-comment <review-id> --severity F-3=low,Q-1001=medium
|
|
238
|
+
/pr-comment <review-id> --exclude F-1 --severity F-3=low
|
|
239
|
+
/pr-comment <review-id> --reset
|
|
240
|
+
/pr-comment [review-id] --show
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
- The review ID is required: every review has its own F-1. IDs are those of
|
|
244
|
+
the review report (`f1` reads as F-1). Only findings the review can publish
|
|
245
|
+
are accepted: confirmed and verifier-added ones of a review or deep review,
|
|
246
|
+
reported ones of a quick review. A merged duplicate names the finding it was
|
|
247
|
+
merged into; any other ID refuses the whole command and changes nothing.
|
|
248
|
+
- Each list is complete and replaces the saved one (`none` empties it): after
|
|
249
|
+
`--exclude F-1`, a later `--exclude F-2` excludes only F-2 and restores F-1,
|
|
250
|
+
so name both (`--exclude F-1,F-2`) to keep both out; the receipt lists what
|
|
251
|
+
was excluded and restored. The other list is kept, except that excluding a
|
|
252
|
+
finding drops its severity change and a severity for an excluded finding
|
|
253
|
+
restores it. A finding named in both lists is refused, and a severity equal
|
|
254
|
+
to the review's is no change. `--reset` clears both.
|
|
255
|
+
- A changed severity changes how a finding is published (its title, whether it
|
|
256
|
+
can get an inline comment, the summary counts); it does not verify the
|
|
257
|
+
finding again or change its evidence, trigger or impact. When the finding
|
|
258
|
+
itself is wrong, exclude it.
|
|
259
|
+
- Each change plans the preview again with a model. The planner receives the
|
|
260
|
+
adjusted findings (without the excluded ones, with the new severities) and an
|
|
261
|
+
`adjustments` field that states them; the summary index and its counts
|
|
262
|
+
follow them. A finding set to low stays in the summary only, and a raised one
|
|
263
|
+
becomes eligible for an inline comment (it still needs a location that can
|
|
264
|
+
carry one and no live thread that covers it). The other comments are written
|
|
265
|
+
again, so their wording may change: read the whole preview before
|
|
266
|
+
publishing. The review itself, its findings and its report are not changed.
|
|
267
|
+
- An excluded finding is never assigned to a page, so it gets no comment of its
|
|
268
|
+
own. Any published text that names the ID of an excluded finding (the body of
|
|
269
|
+
any inline comment, combined ones included, the summary note or
|
|
270
|
+
`summaryDetails`) gets a correction turn; after the last one the comment is
|
|
271
|
+
skipped (its finding stays in the summary index) and the note or details are
|
|
272
|
+
dropped. The assembled preview is checked as well: a summary row is the
|
|
273
|
+
review's own text for its finding, so when a kept finding's summary names an
|
|
274
|
+
excluded one, the preview says which row and publication is held until you
|
|
275
|
+
exclude that finding as well or restore the excluded one. A reference
|
|
276
|
+
without the ID cannot be detected; the preview shows it.
|
|
277
|
+
- Excluding every finding plans nothing and posts nothing: the result is
|
|
278
|
+
`NOTHING_TO_POST`, not the summary of a review without defects.
|
|
279
|
+
`--exclude none` brings the findings back.
|
|
280
|
+
- Adjustments are saved with the review, with the time of each change, survive
|
|
281
|
+
a restart and apply to a later `/pr-comment <review-id>` until `--reset`. The
|
|
282
|
+
preview and the receipt list them; nothing posted to the PR mentions them.
|
|
283
|
+
- A review that was adjusted, also one reset since, is posted only from a
|
|
284
|
+
preview planned after its latest adjustment: every adjustment discards the
|
|
285
|
+
earlier preview in the same save, and `--publish` never plans and posts such
|
|
286
|
+
a review in one step (for example after a failed new preview, or a restart
|
|
287
|
+
while it was planned). An adjustment that cannot be saved changes nothing and
|
|
288
|
+
the receipt says so; a new preview that cannot be saved is dropped and has
|
|
289
|
+
to be planned again.
|
|
290
|
+
- Once publication of an adjusted preview has started (an item was sent, may
|
|
291
|
+
have landed or was found on the PR), the review is neither adjusted nor
|
|
292
|
+
planned again: `--publish` retries the same preview and `--show` shows it;
|
|
293
|
+
run a new review to change what is posted.
|
|
294
|
+
- Adjustments shape only what a publication adds; AZPR never changes or
|
|
295
|
+
replaces a posted comment. An item the PR already has (the same marker, from
|
|
296
|
+
an earlier publication; inline markers follow the anchored lines, not the
|
|
297
|
+
commit) is skipped as for any review and keeps its earlier text. For an
|
|
298
|
+
adjusted review the receipt names those items whose text differs from the
|
|
299
|
+
preview (also when a comment appears only as publication reads the threads
|
|
300
|
+
back), marks the summary and the comments whose severity you changed, and
|
|
301
|
+
counts the other AZPR comments on the PR, where a finding you excluded may
|
|
302
|
+
still be visible; edit them on the PR if they should change.
|
|
303
|
+
- `--show` prints the saved preview, with its adjustments, without a model or
|
|
304
|
+
an Azure DevOps request.
|
|
305
|
+
|
|
306
|
+
Without these options `/pr-comment` works as before: the planner's input and
|
|
307
|
+
system prompt, the saved review and the receipts are unchanged.
|
|
308
|
+
|
|
230
309
|
## Publication
|
|
231
310
|
|
|
232
311
|
Publication is deterministic runtime code using the Azure DevOps REST API
|
package/docs/DEBUGGING.md
CHANGED
|
@@ -42,7 +42,7 @@ packages, or installed `plugins/azpr-v2/settings.json` for source installs):
|
|
|
42
42
|
{ "debug": { "enabled": true, "directory": "", "keepRuns": 20 }, "returnReport": "full" }
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
Restart OpenCode after editing. An empty directory selects
|
|
45
|
+
Restart the OpenCode service (`opencode service restart`) after editing. An empty directory selects
|
|
46
46
|
`${XDG_STATE_HOME:-~/.local/state}/opencode/azpr-v2-debug/`; a relative path is
|
|
47
47
|
resolved against the active project. Each run creates a unique owner-only
|
|
48
48
|
directory named in the receipt. Debug data can contain source, PR details and
|
|
@@ -117,16 +117,16 @@ Common receipts:
|
|
|
117
117
|
|
|
118
118
|
| Message | Next step |
|
|
119
119
|
| --- | --- |
|
|
120
|
-
| `Azure DevOps rejected the PAT for organization …` | Renew or correct the PAT in `azure.pat` or the file named by `azure.patFile` (organization-scoped, Code Read, Pull Request Threads Read & write) and restart OpenCode. |
|
|
120
|
+
| `Azure DevOps rejected the PAT for organization …` | Renew or correct the PAT in `azure.pat` or the file named by `azure.patFile` (organization-scoped, Code Read, Pull Request Threads Read & write) and restart the OpenCode service. |
|
|
121
121
|
| `The provider reports the usage quota as used up (provider.quota)` / `OpenCode reports the free model's usage limit as reached (provider.free-limit)` | The stage failed without a new-session retry, which would fail the same way. Choose another model in the settings, or wait until the provider's quota or the free limit resets. |
|
|
122
|
-
| `azure.patFile could not be used …` / `azure.patFile changed since OpenCode loaded it` | Make it a regular file you own with only the PAT (`chmod 600`), or restart OpenCode after replacing it. |
|
|
122
|
+
| `azure.patFile could not be used …` / `azure.patFile changed since OpenCode loaded it` | Make it a regular file you own with only the PAT (`chmod 600`), or restart the OpenCode service after replacing it. |
|
|
123
123
|
| `Azure DevOps refused … (HTTP 403 …)` | Add the missing PAT scope or project/repository access. |
|
|
124
124
|
| `network error (ConnectionRefused)` with a hint to set `azure.proxy` | dev.azure.com is reachable only through a proxy; set `azure.proxy` (see [proxies](AZURE_DEVOPS.md#proxies-and-tls-inspection)). |
|
|
125
125
|
| `the server's TLS certificate was not accepted (…)` | The proxy inspects HTTPS; set `azure.caFile` to its root CA certificate. |
|
|
126
126
|
| `A proxy refused … (HTTP 407)` / `A proxy or gateway answered …` | The proxy wants credentials in `azure.proxy`, or it blocks dev.azure.com. |
|
|
127
127
|
| `azpr_read_file failed: …` in a stage's tool errors | The model asked for a missing path or invalid range; the review continues and reports the gap. |
|
|
128
128
|
| `permission.rejected` … `cannot use paths outside the local OpenCode project` | A reviewer used a native tool on a repository path; it was refused instead of waiting for an approval and the model was pointed to the azpr tools. |
|
|
129
|
-
| `settings.json changed since OpenCode loaded it` | Restart OpenCode. Running commands were unaffected. |
|
|
129
|
+
| `settings.json changed since OpenCode loaded it` | Restart the OpenCode service. Running commands were unaffected. |
|
|
130
130
|
| `Host configuration changed private agent …` | Another config or plugin changed an `azpr-*` agent; resolve it and reload. |
|
|
131
131
|
| `No completed review is available for this conversation` | Run the comment command in the review's conversation, or run a new review. |
|
|
132
132
|
| `PR source commit changed after the review` | The PR got new commits; run a new review before commenting. |
|
|
@@ -138,7 +138,9 @@ Common receipts:
|
|
|
138
138
|
| `Automatic … skipped: another AZPR command is running in this conversation or on this PR` | Wait for that command, then run the `/pr-comment` command the notice names. |
|
|
139
139
|
| `Automatic comments are off for this review (stopped: …)` on a COMPLETE receipt | `/pr-stop`, a timeout or an unload arrived while the finished review's report was delivered. The review is kept; no comment step started. Run `/pr-comment <id>` to preview it. |
|
|
140
140
|
| `Unknown option after the PR URL` / `Use at most one of --preview, --publish or --no-comment` | Only these flags may follow the URL, at most one; start your context with a word. Nothing was started. |
|
|
141
|
-
| `SETUP REQUIRED` … `could not be used when OpenCode loaded AZPR: …` | The reason names the problem (no file yet, an unreadable file, invalid JSON, a setting that fails validation or an unusable PAT file) without its value. Fix it, then restart OpenCode. |
|
|
141
|
+
| `SETUP REQUIRED` … `could not be used when OpenCode loaded AZPR: …` | The reason names the problem (no file yet, an unreadable file, invalid JSON, a setting that fails validation or an unusable PAT file) without its value. Fix it, then restart the OpenCode service. |
|
|
142
|
+
| `No --pat-file was given, and the default PAT file … could not be used` | `/pr-setup` looked for the PAT in `${XDG_CONFIG_HOME:-~/.config}/azpr/pat` (or, with `--replace`, the PAT file already set). Create it as the [quickstart](QUICKSTART.md#2-save-the-pat-in-a-private-file-terminal) shows, or name your file with `--pat-file`. Nothing was saved. |
|
|
143
|
+
| `/pr-check` row `AZPR` WARNING: `Another AZPR entry is configured but not running` | Two `plugins` entries load AZPR, usually after `opencode plugin add` with a new version; OpenCode runs the first and lists the other as a duplicate. Remove the one you do not want (see [upgrading](../README.md#upgrading)). |
|
|
142
144
|
| `This review's private data is no longer available` | The review was evicted or its data removed; run a new review. |
|
|
143
145
|
| Skipped finding: `The comment planner repeated a checkpoint without progress` or `did not finish the page in 4 sessions` | The planner kept asking for more reading on that page; the finding has no inline comment but stays in the summary index, and the other comments were planned as usual. Inspect the page's planning stages; `/pr-comment <id>` (a preview) plans again. |
|
|
144
146
|
| `Stage inactivity watchdog stopped this stage: no activity for … s after …` (`failure=idle`, plus an inactivity notice) | The model stream, a tool or OpenCode stopped responding for `workflow.stageIdleSeconds`; the stage ran again in a new session. Repeated stops after `model request N was sent` point at the provider. Raise the setting only if a model really needs longer for one answer (live stages so far stayed under 151 s without any event). |
|
package/docs/DEMO.md
CHANGED
|
@@ -1,6 +1,50 @@
|
|
|
1
1
|
# See a review before installing
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Adjust findings before publishing
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
The 15-second teaser uses a **real OpenCode 2.1.4 session, real configured
|
|
8
|
+
model calls and real Azure DevOps publication** on the same dedicated test PR
|
|
9
|
+
as the earlier recording below: one `fulfillment.py` file with three
|
|
10
|
+
deliberately seeded regressions. It demonstrates the workflow; it is not a
|
|
11
|
+
benchmark of review accuracy or a promise about the time or cost of another PR.
|
|
12
|
+
|
|
13
|
+
Recorded on **2026-10-26**, on Ubuntu 22.04 under WSL2, using
|
|
14
|
+
`openai/gpt-6-luna` for the functional reviewer, risk reviewer, verifier and
|
|
15
|
+
comment planner. The installed plugin matched all 27 runtime and prompt files
|
|
16
|
+
in public Git commit [`dfba561`](https://github.com/WTLAIB/opencode-azure-devops-pr-review-v2/commit/dfba561840c0d61be6f8fc2e921507da8bbcbb11)
|
|
17
|
+
of the 0.3.0 release candidate. Model IDs identify the configured selection,
|
|
18
|
+
not an independently attested provider backend.
|
|
19
|
+
|
|
20
|
+
The recording follows one conversation:
|
|
21
|
+
|
|
22
|
+
1. `/pr-review <test-pr-url> --preview` completes the review in 66 seconds. The
|
|
23
|
+
verifier confirms three medium findings and merges two duplicate candidates.
|
|
24
|
+
The automatic preview, 14 seconds later, prepares a summary and three inline
|
|
25
|
+
comments; nothing is posted.
|
|
26
|
+
2. `/pr-comment 63f7d3d6 --exclude F-3 --severity F-2=low` plans a new preview
|
|
27
|
+
in 8 seconds. F-3 is left out, F-2 is listed as low in the summary with no
|
|
28
|
+
inline comment, and the preview names both adjustments.
|
|
29
|
+
3. `/pr-comment 63f7d3d6 --publish` posts the summary and the F-1 comment; both
|
|
30
|
+
are read back from Azure DevOps as `VERIFIED`.
|
|
31
|
+
4. Repeating the command reports `ALREADY_PRESENT=2`; nothing is posted twice.
|
|
32
|
+
The two demonstration comments are retained on the test PR.
|
|
33
|
+
|
|
34
|
+

|
|
35
|
+
|
|
36
|
+

|
|
37
|
+
|
|
38
|
+
These are faithful rendered frames from one terminal capture, **not Azure
|
|
39
|
+
DevOps browser screenshots**. Commands were submitted through OpenCode's native
|
|
40
|
+
command API to the session shown in the attached TUI, so they appear as AZPR
|
|
41
|
+
notices and segment captions rather than as typed input. The TUI sidebar was
|
|
42
|
+
hidden before the segments shown, and the bottom seven rows (the empty input
|
|
43
|
+
box with the conversation's chat model, and the status/path bar) are cropped.
|
|
44
|
+
Segments that showed the local debug directory were left out. The original
|
|
45
|
+
private cast is unchanged.
|
|
46
|
+
|
|
47
|
+
## Earlier recording: review, preview and publication
|
|
4
48
|
|
|
5
49
|
[Watch the 73-second walkthrough (MP4)](https://github.com/WTLAIB/opencode-azure-devops-pr-review-v2/releases/download/v0.2.0/azpr-live-demo.mp4)
|
|
6
50
|
|
package/docs/ENTERPRISE.md
CHANGED
|
@@ -45,10 +45,11 @@ diagnostic settings. With `azure.patFile`, `settings.json` holds no secret:
|
|
|
45
45
|
AZPR opens the PAT file without following symbolic links and refuses it unless
|
|
46
46
|
it is a regular file owned by the OpenCode user with no group or other access,
|
|
47
47
|
and it reads the file at start and before each command, so a replaced PAT
|
|
48
|
-
needs a restart. The installer and `/pr-setup` create
|
|
49
|
-
`600`; source replacement preserves it, and native
|
|
50
|
-
write to it. Keep it outside shared profiles and Git,
|
|
51
|
-
restart OpenCode
|
|
48
|
+
needs a restart of the OpenCode service. The installer and `/pr-setup` create
|
|
49
|
+
`settings.json` with mode `600`; source replacement preserves it, and native
|
|
50
|
+
package updates do not write to it. Keep it outside shared profiles and Git,
|
|
51
|
+
and restart the OpenCode service (`opencode service restart`) after changing
|
|
52
|
+
it. A file only its owner can read protects the
|
|
52
53
|
PAT from other accounts, not from programs that run as the same user (an
|
|
53
54
|
agent's shell commands, for example), so keep the PAT's scopes minimal and its
|
|
54
55
|
lifetime short, and keep it out of environment variables that child processes
|
|
@@ -186,7 +187,37 @@ leaves review state in place. To remove local copies, stop OpenCode and handle
|
|
|
186
187
|
the installed settings/backups, state, diagnostics and OpenCode conversations
|
|
187
188
|
according to your team's retention needs.
|
|
188
189
|
|
|
189
|
-
##
|
|
190
|
+
## Company networks
|
|
191
|
+
|
|
192
|
+
Three kinds of connection leave your machine, and each is configured where it
|
|
193
|
+
is made. Set up the first before `opencode plugin add`:
|
|
194
|
+
|
|
195
|
+
| Connection | Made by | Configure |
|
|
196
|
+
| --- | --- | --- |
|
|
197
|
+
| Package download for `opencode plugin add` | The `opencode` command in your terminal | `HTTPS_PROXY` (and `HTTP_PROXY`, `NO_PROXY`) in that terminal, or `https-proxy` in your user `~/.npmrc`. OpenCode does not read a project's `.npmrc` or, by default, npm's global configuration. |
|
|
198
|
+
| Package download when a changed `plugins` entry or a start finds a version that is not installed yet | The OpenCode background service | The service's environment, set with `opencode service set env` |
|
|
199
|
+
| Model providers | The OpenCode background service | The service's environment, as in OpenCode's [network guide](https://opencode.ai/v2/docs/network) |
|
|
200
|
+
| Azure DevOps | AZPR, inside the OpenCode service | `azure.proxy` and `azure.caFile` below; with an empty `azure.proxy`, the service environment's proxy variables apply |
|
|
201
|
+
|
|
202
|
+
- When a terminal sets a proxy, keep `localhost,127.0.0.1,::1` in its
|
|
203
|
+
`NO_PROXY`: the `opencode` command reaches the background service over the
|
|
204
|
+
loopback interface. Keep your organization's existing exceptions too.
|
|
205
|
+
- A variable set with `opencode service set env` applies when the service
|
|
206
|
+
starts; setting one stops the running service, so start it again with
|
|
207
|
+
`opencode service start`. Exports in a terminal do not change a service that
|
|
208
|
+
is already running. Do not share the output of `opencode service get env`:
|
|
209
|
+
it shows the values, including proxy credentials.
|
|
210
|
+
- For a company CA, OpenCode reads a PEM file named by `NODE_EXTRA_CA_CERTS`
|
|
211
|
+
(in the terminal, and in the service environment); see OpenCode's
|
|
212
|
+
[network guide](https://opencode.ai/v2/docs/network). `azure.caFile` applies
|
|
213
|
+
only to AZPR's Azure DevOps requests and cannot fix a package-download
|
|
214
|
+
certificate error.
|
|
215
|
+
- Keep TLS verification on. A failed package download leaves nothing changed
|
|
216
|
+
when `opencode plugin add` makes it; when the service makes it, AZPR's
|
|
217
|
+
commands disappear until the package is available and the service restarts
|
|
218
|
+
(see [upgrading](../README.md#upgrading)).
|
|
219
|
+
|
|
220
|
+
### Azure DevOps requests
|
|
190
221
|
|
|
191
222
|
The following settings affect **AZPR's Azure DevOps requests only**. Configure
|
|
192
223
|
model-provider connectivity separately in the OpenCode environment.
|
|
@@ -197,7 +228,7 @@ model-provider connectivity separately in the OpenCode environment.
|
|
|
197
228
|
| `azure.caFile` | Absolute path to PEM CA certificates, added to the built-in trusted roots. Use this for your organization's TLS inspection CA. |
|
|
198
229
|
| `azure.verifyTls` | Defaults to `true`. Disabling certificate verification exposes the PAT to intercepted connections and produces a `/pr-check` warning. |
|
|
199
230
|
|
|
200
|
-
Restart OpenCode after changing transport settings or the CA file. These
|
|
231
|
+
Restart the OpenCode service after changing transport settings or the CA file. These
|
|
201
232
|
options depend on Bun's per-request transport support; an unsupported runtime
|
|
202
233
|
refuses to load them. If `azure.proxy` is empty, process-wide proxy environment
|
|
203
234
|
settings can still apply. A TLS-inspecting proxy can see the PAT and source
|
package/docs/QUICKSTART.md
CHANGED
|
@@ -1,60 +1,34 @@
|
|
|
1
1
|
# Your first review
|
|
2
2
|
|
|
3
3
|
This guide gets you from a clean installation to a private comment preview.
|
|
4
|
-
Use a small, active Azure DevOps Services PR for the first run.
|
|
4
|
+
Use a small, active Azure DevOps Services PR for the first run. Steps 1–3 and
|
|
5
|
+
5 run in a terminal; steps 4, 6 and 7 run in OpenCode.
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
Already using an earlier version? Follow [upgrading](../README.md#upgrading)
|
|
8
|
+
instead, to keep your configuration and one AZPR installation.
|
|
9
|
+
|
|
10
|
+
## 1. Check the prerequisites (terminal)
|
|
7
11
|
|
|
8
12
|
- **OpenCode CLI 2.1.4** (`@opencode/cli`, V2 plugin API), tested on **Ubuntu
|
|
9
13
|
22.04.5 LTS (WSL2)**. Other host versions and operating systems are not
|
|
10
14
|
validated; see [validation](VALIDATION.md). OpenCode 1.x is not supported.
|
|
11
|
-
- An authenticated OpenCode model with tool support
|
|
12
|
-
`provider/model` ID from your host's model selection
|
|
15
|
+
- An authenticated OpenCode model with tool support, and its exact
|
|
16
|
+
`provider/model` ID from `opencode models` or your host's model selection.
|
|
13
17
|
AZPR uses your existing provider account.
|
|
14
|
-
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
- An organization-scoped Azure DevOps PAT. The recommended scopes are **Code:
|
|
18
|
-
Read** and **Pull Request Threads: Read & write**; see
|
|
18
|
+
- Your Azure DevOps organization (the `<org>` in `https://dev.azure.com/<org>`)
|
|
19
|
+
and an organization-scoped PAT. The recommended scopes are **Code: Read** and
|
|
20
|
+
**Pull Request Threads: Read & write**; see
|
|
19
21
|
[access and validation limits](ENTERPRISE.md).
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
- Access to the npm registry for the npm package, or Git for the Git package.
|
|
23
|
+
AZPR has no build step or npm dependencies. Behind a company proxy, set up
|
|
24
|
+
the terminal first: see [company networks](ENTERPRISE.md#company-networks).
|
|
22
25
|
|
|
23
26
|
```sh
|
|
24
27
|
opencode --version
|
|
28
|
+
opencode models
|
|
25
29
|
```
|
|
26
30
|
|
|
27
|
-
## 2.
|
|
28
|
-
|
|
29
|
-
Already using an earlier version? Follow the [upgrade instructions](releases/v0.2.3.md#upgrading)
|
|
30
|
-
to preserve your current configuration and use one AZPR installation.
|
|
31
|
-
|
|
32
|
-
In your terminal:
|
|
33
|
-
|
|
34
|
-
```sh
|
|
35
|
-
opencode plugin add opencode-azure-devops-pr-review@0.2.3
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
Restart OpenCode and open an ordinary conversation. This is the host's native
|
|
39
|
-
package installation; no npm account or separate build is needed. The
|
|
40
|
-
plugin exposes `/pr-setup` even before its review configuration exists.
|
|
41
|
-
|
|
42
|
-
To install the same release from Git instead of the npm registry, use
|
|
43
|
-
`opencode plugin add 'github:WTLAIB/opencode-azure-devops-pr-review-v2#v0.2.3'`.
|
|
44
|
-
Add only one of the two.
|
|
45
|
-
|
|
46
|
-
For an existing source installation, keep using `install.sh --replace`, or
|
|
47
|
-
follow the migration notes in [installation](../README.md#native-package-npm-or-git).
|
|
48
|
-
Do not load both copies in the same OpenCode profile.
|
|
49
|
-
|
|
50
|
-
Prefer a source archive? Download and extract the
|
|
51
|
-
[v0.2.3 archive](https://github.com/WTLAIB/opencode-azure-devops-pr-review-v2/archive/refs/tags/v0.2.3.tar.gz),
|
|
52
|
-
then run `sh install.sh --config-dir /absolute/path/to/your/opencode-config`
|
|
53
|
-
inside it. That directory must be the one your OpenCode actually loads. The
|
|
54
|
-
source installer creates starter settings; add `--replace` to the setup
|
|
55
|
-
command below to configure that existing file.
|
|
56
|
-
|
|
57
|
-
## 3. Configure one model and your Azure organization
|
|
31
|
+
## 2. Save the PAT in a private file (terminal)
|
|
58
32
|
|
|
59
33
|
Put the PAT alone in a file only you can read. The following **Bash** example
|
|
60
34
|
creates a new file and refuses to overwrite an existing one. Input is hidden
|
|
@@ -73,26 +47,52 @@ mkdir -p "$AZPR_USER_DIR"
|
|
|
73
47
|
printf 'PAT file: %s\n' "$AZPR_USER_DIR/pat"
|
|
74
48
|
```
|
|
75
49
|
|
|
76
|
-
|
|
77
|
-
|
|
50
|
+
This is the default PAT file that `/pr-setup` uses. If the file already
|
|
51
|
+
exists, reuse your existing owner-only PAT file, or choose another unused path
|
|
52
|
+
and name it with `--pat-file` in step 4. Do not paste a PAT into a
|
|
53
|
+
conversation or command argument.
|
|
54
|
+
|
|
55
|
+
## 3. Install the package (terminal)
|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
opencode plugin add opencode-azure-devops-pr-review@0.3.1
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
This is the host's native package installation; no npm account or separate
|
|
62
|
+
build is needed. OpenCode 2.1.4 loads the plugin into a running OpenCode
|
|
63
|
+
service within a few seconds, and otherwise when OpenCode next starts. The
|
|
64
|
+
plugin exposes `/pr-setup` even before its review configuration exists.
|
|
65
|
+
|
|
66
|
+
To install the same release from Git instead of the npm registry, use
|
|
67
|
+
`opencode plugin add 'github:WTLAIB/opencode-azure-devops-pr-review-v2#v0.3.1'`.
|
|
68
|
+
Add only one of the two. For a source archive or an existing source
|
|
69
|
+
installation, see [other installation methods](#other-installation-methods).
|
|
70
|
+
|
|
71
|
+
## 4. Configure one model and your Azure organization (OpenCode)
|
|
72
|
+
|
|
73
|
+
Open OpenCode and start an ordinary conversation. If `/pr-setup` is not
|
|
74
|
+
listed, run `opencode service restart` in your terminal and reopen OpenCode.
|
|
78
75
|
|
|
79
|
-
|
|
80
|
-
Then replace
|
|
76
|
+
Run `/pr-setup` alone to see the settings path, the default PAT file and the
|
|
77
|
+
available model IDs. Then replace both placeholders in this command:
|
|
81
78
|
|
|
82
79
|
```text
|
|
83
|
-
/pr-setup --organization YOUR_ORGANIZATION --model YOUR_PROVIDER/YOUR_MODEL
|
|
80
|
+
/pr-setup --organization YOUR_ORGANIZATION --model YOUR_PROVIDER/YOUR_MODEL
|
|
84
81
|
```
|
|
85
82
|
|
|
86
|
-
Use the organization name from `https://dev.azure.com/<organization
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
83
|
+
Use the organization name from `https://dev.azure.com/<organization>`;
|
|
84
|
+
`--organization` also accepts your PR's URL. Add
|
|
85
|
+
`--pat-file "/absolute/path/to/pat"` when your PAT file is not the default one
|
|
86
|
+
from step 2. The command checks the model catalog and the PAT file, then saves
|
|
87
|
+
configuration with owner-only permissions. It makes no model request and does
|
|
88
|
+
not contact Azure.
|
|
90
89
|
|
|
91
90
|
One model selection configures the quick reviewer and all three review roles.
|
|
92
91
|
`/pr-quick` still runs only its own reviewer; `/pr-review` uses separate reviewer
|
|
93
92
|
and verifier sessions. Deep models remain unset until you choose stronger
|
|
94
93
|
models for that mode. Setup preserves other settings when explicitly replacing
|
|
95
|
-
an existing file with `--replace
|
|
94
|
+
an existing file with `--replace`, and then keeps the PAT file already set
|
|
95
|
+
unless you name another one.
|
|
96
96
|
|
|
97
97
|
Native installations save settings outside the package cache at
|
|
98
98
|
`${XDG_CONFIG_HOME:-~/.config}/azpr/settings.json`. Source installations keep
|
|
@@ -100,24 +100,29 @@ Native installations save settings outside the package cache at
|
|
|
100
100
|
`options.settingsFile` can select a different absolute path; see
|
|
101
101
|
[configuration](../README.md#configuration).
|
|
102
102
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
Make any other changes to that settings file now, before the restart in step 5:
|
|
104
|
+
behind a company proxy, AZPR's Azure DevOps requests need `azure.proxy` (and
|
|
105
|
+
`azure.caFile` for a company CA) as described in
|
|
106
|
+
[company networks](ENTERPRISE.md#company-networks); leave `shell: "deny"` and TLS
|
|
107
|
+
verification enabled. See [all settings](../README.md#all-settings-and-defaults)
|
|
108
|
+
for output language and other options, and
|
|
109
|
+
[model configuration](../README.md#configuration) for model variants and
|
|
110
|
+
separate models for each role.
|
|
111
|
+
|
|
112
|
+
## 5. Restart the OpenCode service (terminal)
|
|
113
|
+
|
|
114
|
+
Settings are read when OpenCode loads AZPR, so restart the service once after
|
|
115
|
+
saving them:
|
|
107
116
|
|
|
108
117
|
```sh
|
|
109
118
|
opencode service restart
|
|
110
119
|
```
|
|
111
120
|
|
|
112
|
-
If you run `opencode serve` yourself, restart that process instead.
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
`shell: "deny"` and TLS verification enabled. See
|
|
116
|
-
[all settings](../README.md#all-settings-and-defaults) for output language and
|
|
117
|
-
other options, and [model configuration](../README.md#configuration) for model
|
|
118
|
-
variants and separate models for each role.
|
|
121
|
+
If you run `opencode serve` yourself, restart that process instead. Closing a
|
|
122
|
+
conversation or reopening the terminal UI alone does not reload a running
|
|
123
|
+
background service.
|
|
119
124
|
|
|
120
|
-
##
|
|
125
|
+
## 6. Check access without a model request (OpenCode)
|
|
121
126
|
|
|
122
127
|
In OpenCode, replace this sample with your PR's URL:
|
|
123
128
|
|
|
@@ -131,14 +136,15 @@ it neither runs a review nor tests model-provider authentication or Azure write
|
|
|
131
136
|
permissions. Fix any `NOT_READY` result before continuing. A **Quick model
|
|
132
137
|
WARNING** also needs fixing before `/pr-quick`, even if the overall result is
|
|
133
138
|
`READY`; a **Deep model** WARNING likewise before `/pr-deep`. The **Deep models**
|
|
134
|
-
row says whether `/pr-deep` is set up (see below)
|
|
139
|
+
row says whether `/pr-deep` is set up (see below), and the **AZPR** row names
|
|
140
|
+
the installation that answered.
|
|
135
141
|
|
|
136
142
|
On a host without `permission.hook`, **Project boundary WARNING** means the
|
|
137
143
|
host's own permission rules control where native read tools can read; reviews
|
|
138
144
|
remain available. The tested OpenCode 2.1.4 host has that hook. `READY` is an
|
|
139
145
|
access check, not a security audit or an approval of the PR.
|
|
140
146
|
|
|
141
|
-
##
|
|
147
|
+
## 7. Run a review and preview its comments (OpenCode)
|
|
142
148
|
|
|
143
149
|
```text
|
|
144
150
|
/pr-review https://dev.azure.com/YOUR_ORGANIZATION/YOUR_PROJECT/_git/YOUR_REPO/pullrequest/123 --preview
|
|
@@ -171,6 +177,26 @@ and cost. Refreshing a preview with `/pr-comment <review-id>` runs planning
|
|
|
171
177
|
again. Use the displayed `/pr-stop <run-id>` to cancel an active command; no
|
|
172
178
|
cost cap is configured by default.
|
|
173
179
|
|
|
180
|
+
## Optional: adjust findings before publishing
|
|
181
|
+
|
|
182
|
+
Use finding IDs from your report to leave findings out or change their severity:
|
|
183
|
+
|
|
184
|
+
```text
|
|
185
|
+
/pr-comment 1a2b3c4d --exclude F-1 --severity F-2=low
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
In this example, F-1 is excluded from the new preview; F-2 appears as low in the
|
|
189
|
+
summary, with no new inline comment. The original review is preserved. A changed
|
|
190
|
+
severity does not verify the finding again; exclude a finding when it is wrong.
|
|
191
|
+
|
|
192
|
+
AZPR uses a model to plan the comments again without rerunning the review, so
|
|
193
|
+
read the whole new preview. Each option replaces its own saved list:
|
|
194
|
+
`--exclude F-1` followed by `--exclude F-2` excludes only F-2; use
|
|
195
|
+
`--exclude F-1,F-2` to keep both out. `--reset` clears both adjustment lists
|
|
196
|
+
and plans again; `--show` displays the saved preview without a model or Azure
|
|
197
|
+
request. See [adjusting findings](COMMENTING.md#adjusting-findings-after-a-preview)
|
|
198
|
+
for the full rules.
|
|
199
|
+
|
|
174
200
|
## Optional: publish after inspecting the preview
|
|
175
201
|
|
|
176
202
|
```text
|
|
@@ -180,8 +206,14 @@ cost cap is configured by default.
|
|
|
180
206
|
This explicit command posts the saved preview through your PAT after checking
|
|
181
207
|
the PR is active and its source commit is unchanged. Existing markers are
|
|
182
208
|
skipped. Check the publication receipt for failures or incomplete read-back.
|
|
183
|
-
|
|
184
|
-
|
|
209
|
+
An adjusted review needs a saved preview planned after its latest adjustment,
|
|
210
|
+
also after `--reset`; `--publish` refuses if that preview is missing. Once
|
|
211
|
+
publication starts, its adjustments and preview are fixed, and `--publish`
|
|
212
|
+
retries the saved content. Earlier comments on the PR are never edited; the
|
|
213
|
+
receipt names those whose text differs from an adjusted preview.
|
|
214
|
+
|
|
215
|
+
For a review that has never been adjusted, `--publish` plans first if no preview
|
|
216
|
+
exists; use `/pr-comment <review-id>` to prepare and inspect a preview first. See
|
|
185
217
|
[automatic comments](COMMENTING.md#automatic-comments-after-a-review) for
|
|
186
218
|
`afterReview` and the flags that override it for one review.
|
|
187
219
|
|
|
@@ -191,3 +223,16 @@ in all three deep slots and keep it for changes that justify the cost; with
|
|
|
191
223
|
the review's models it would only repeat `/pr-review`, and `/pr-check` warns
|
|
192
224
|
about that. All modes produce AI findings that require human judgment; see
|
|
193
225
|
[commands](../README.md#commands).
|
|
226
|
+
|
|
227
|
+
## Other installation methods
|
|
228
|
+
|
|
229
|
+
For an existing source installation, keep using `install.sh --replace`, or
|
|
230
|
+
follow the migration notes in [installation](../README.md#native-package-npm-or-git).
|
|
231
|
+
Do not load both copies in the same OpenCode profile.
|
|
232
|
+
|
|
233
|
+
Prefer a source archive? Download and extract the
|
|
234
|
+
[v0.3.1 archive](https://github.com/WTLAIB/opencode-azure-devops-pr-review-v2/archive/refs/tags/v0.3.1.tar.gz),
|
|
235
|
+
then run `sh install.sh --config-dir /absolute/path/to/your/opencode-config`
|
|
236
|
+
inside it. That directory must be the one your OpenCode actually loads. The
|
|
237
|
+
source installer creates starter settings, so add `--replace` to the setup
|
|
238
|
+
command in step 4, then restart the OpenCode service as in step 5.
|
package/docs/ROADMAP.md
CHANGED
|
@@ -6,6 +6,14 @@ with; [validation history](VALIDATION_HISTORY.md) keeps earlier results.
|
|
|
6
6
|
|
|
7
7
|
## Implemented (stability revision)
|
|
8
8
|
|
|
9
|
+
- **Adjust findings before publishing.** After reading a preview, use
|
|
10
|
+
`/pr-comment <review-id> --exclude` or `--severity` to choose which findings
|
|
11
|
+
to publish and at what severity. The model plans a new preview while the
|
|
12
|
+
original review stays intact. Each list replaces the saved one; `--reset`
|
|
13
|
+
clears both, and `--show` displays the saved preview without a model or Azure
|
|
14
|
+
request. Adjusted reviews require a saved preview and cannot be adjusted or
|
|
15
|
+
planned again once publication starts. Earlier PR comments keep their text;
|
|
16
|
+
the receipt reports differences. See [commenting](COMMENTING.md#adjusting-findings-after-a-preview).
|
|
9
17
|
- **Optional automatic comments.** `afterReview` selects `none` (default),
|
|
10
18
|
`preview` or `publish` for each mode; a flag after the PR URL overrides it
|
|
11
19
|
for one review. A COMPLETE review hands off to a separate, cancellable
|