opencode-azure-devops-pr-review 0.4.1 → 0.4.3
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 +193 -0
- package/README.md +209 -47
- package/package.json +11 -3
- package/src/attribution.mjs +16 -2
- package/src/azure.mjs +12 -2
- package/src/comment-work.mjs +5 -3
- package/src/config.mjs +66 -14
- package/src/runtime.mjs +81 -22
- package/src/session.mjs +13 -5
- package/src/setup.mjs +998 -86
- package/src/tui-model.mjs +566 -0
- package/src/tui-setup.mjs +344 -0
- package/src/tui-view.jsx +678 -0
- package/src/tui.js +989 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,198 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.3 — 2026-11-18
|
|
4
|
+
|
|
5
|
+
`/pr-setup` sets AZPR up in OpenCode's terminal UI: dialogs ask for the
|
|
6
|
+
organization, a proxy if the network needs one, the token and a model, check
|
|
7
|
+
the token with Azure DevOps and save it in a file only you can read; a first
|
|
8
|
+
setup needs no restart. Afterwards the same command lists the settings to
|
|
9
|
+
change. And after a review, the next thing you say in the same conversation
|
|
10
|
+
no longer costs one model request per AZPR notice. The reviewer, verifier and
|
|
11
|
+
comment-planning instructions are those of 0.4.2, and no setting is new.
|
|
12
|
+
|
|
13
|
+
Setup in the terminal UI:
|
|
14
|
+
|
|
15
|
+
- Until now a first setup meant creating the PAT file by hand in a terminal,
|
|
16
|
+
typing a model ID into `/pr-setup`, editing JSON for a proxy, and
|
|
17
|
+
restarting the OpenCode service. In OpenCode's terminal UI, `/pr-setup`
|
|
18
|
+
without options now opens dialogs for it: the organization (its name, or
|
|
19
|
+
the URL of a pull request), a proxy, the token, and a model picked from
|
|
20
|
+
OpenCode's list.
|
|
21
|
+
- The proxy is asked before the token, because the token is checked over the
|
|
22
|
+
network; Enter skips it. After a proxy, the CA certificate file of a
|
|
23
|
+
company that inspects HTTPS is asked the same way.
|
|
24
|
+
- The token is typed or pasted into a field that shows only how many
|
|
25
|
+
characters it holds. AZPR asks Azure DevOps once whether it works for the
|
|
26
|
+
organization and says what was refused: the token, the organization, or
|
|
27
|
+
the way there. When Azure DevOps cannot be reached, the proxy or the CA
|
|
28
|
+
file can be set right there and the same token tried again; it can also be
|
|
29
|
+
saved unchecked.
|
|
30
|
+
- The token is saved alone in a file only you can read (mode 600), in one
|
|
31
|
+
step: a file made for it, `${XDG_CONFIG_HOME:-~/.config}/azpr/pat-<organization>`
|
|
32
|
+
(with a number where that name is taken), which the settings then name;
|
|
33
|
+
or, for a new token of the same organization, the token file the settings
|
|
34
|
+
name already. Setup overwrites no other file: the default PAT file of
|
|
35
|
+
setup with options, `azpr/pat`, may be the PAT file of several settings
|
|
36
|
+
files, so the dialogs only read it. The token is in no conversation,
|
|
37
|
+
notice or log.
|
|
38
|
+
- With settings in place, `/pr-setup` lists them with their values:
|
|
39
|
+
organization, token, proxy, CA certificate file, the review, quick and deep
|
|
40
|
+
models, output language, what follows a review, the report in the
|
|
41
|
+
conversation, progress notices, the review panel and debug records. A
|
|
42
|
+
change is saved at once. Posting comments without a preview asks once
|
|
43
|
+
more, with "no" first. The command palette has the list too ("AZPR:
|
|
44
|
+
settings").
|
|
45
|
+
- A saved token belongs to the organization it was checked for: it is never
|
|
46
|
+
sent to another one, and another organization in the list asks for a token
|
|
47
|
+
of its own, which is checked and saved together with it, in a new file
|
|
48
|
+
beside the first. The earlier token's file is left as it is, and AZPR says
|
|
49
|
+
where it is.
|
|
50
|
+
- When AZPR has no usable settings, the terminal UI says so once after it
|
|
51
|
+
starts and names `/pr-setup`.
|
|
52
|
+
- The dialogs only ask: the plugin's server part checks every answer, writes
|
|
53
|
+
the two files, and is the only part that contacts Azure DevOps. Other
|
|
54
|
+
clients, such as the desktop app, do not load the dialogs; there
|
|
55
|
+
`/pr-setup` prints its instructions as before.
|
|
56
|
+
|
|
57
|
+
Setup, in every client:
|
|
58
|
+
|
|
59
|
+
- A first setup is loaded at once, with the dialogs and with options: the
|
|
60
|
+
review commands work without a restart of the OpenCode service, in the
|
|
61
|
+
project directory where setup ran. Another project directory that the same
|
|
62
|
+
OpenCode service had already opened without settings still needs the
|
|
63
|
+
restart, and its review commands say so. A change to settings that are in
|
|
64
|
+
use takes effect after a restart as before, and `/pr-setup` says so.
|
|
65
|
+
- `/pr-setup` takes options that change one setting each in existing
|
|
66
|
+
settings, without `--replace`: `--proxy`, `--ca-file`, `--review-model`,
|
|
67
|
+
`--quick-model`, `--deep-model`, `--language`, `--after-review`, `--report`,
|
|
68
|
+
`--progress`, `--panel` and `--debug`. They can be combined, also with the
|
|
69
|
+
options of a first setup (`--proxy` behind a company proxy, for example).
|
|
70
|
+
`/pr-setup --help` lists them.
|
|
71
|
+
- A source installation has one more file, `src/tui-setup.mjs`: 35 in all
|
|
72
|
+
for manual copying.
|
|
73
|
+
|
|
74
|
+
Notices and the conversation's model:
|
|
75
|
+
|
|
76
|
+
- AZPR's notices (`STARTED`, `PROGRESS`, the receipts) wait in the
|
|
77
|
+
conversation's inbox and start no response of its model. Until now, when
|
|
78
|
+
you then prompted that conversation, OpenCode 2.3.0 answered your prompt
|
|
79
|
+
and after it gave each waiting notice a turn of the conversation's model:
|
|
80
|
+
a review with its comment preview leaves about eight notices, so about
|
|
81
|
+
eight more requests, each carrying the whole conversation, and the model
|
|
82
|
+
replied to each notice. The notices are now left in the inbox the way
|
|
83
|
+
OpenCode leaves its own notices about background shells, and the
|
|
84
|
+
conversation's model reads all of them together with your prompt, in one
|
|
85
|
+
request. In the terminal fixture, a prompt after 16 notices made 17
|
|
86
|
+
requests of the conversation's model before and makes 1 now.
|
|
87
|
+
- A notice that arrives while the conversation's model is working is handed
|
|
88
|
+
to it at its next step, or in one request right after its answer; before,
|
|
89
|
+
each such notice took a request of its own after the answer.
|
|
90
|
+
- The notices themselves, the panel and the report session are as in 0.4.2,
|
|
91
|
+
and a conversation used only for AZPR's commands still costs no request of
|
|
92
|
+
its model. The text of the notices still enters the conversation's context
|
|
93
|
+
once, when its model next runs.
|
|
94
|
+
|
|
95
|
+
## 0.4.2 — 2026-11-17
|
|
96
|
+
|
|
97
|
+
A panel in OpenCode's terminal UI shows the report and the comment preview
|
|
98
|
+
rendered instead of as Markdown source, and lists the sessions of the review
|
|
99
|
+
so that you can open one. A PR that was completed or abandoned takes comments
|
|
100
|
+
like an active one, and a new version writes the settings it brings into your
|
|
101
|
+
settings file. The reviewer, verifier and comment-planning instructions are
|
|
102
|
+
those of 0.4.1. One setting is new: `terminalPanel`.
|
|
103
|
+
|
|
104
|
+
Terminal panel (OpenCode's terminal UI only):
|
|
105
|
+
|
|
106
|
+
- OpenCode shows what a plugin tells a conversation as plain text, so a report
|
|
107
|
+
or a comment preview appeared as Markdown source. A panel beside the
|
|
108
|
+
conversation now shows the newest one rendered: headings, emphasis, lists,
|
|
109
|
+
code and tables. A check's table is shown there too.
|
|
110
|
+
- The panel lists the sessions of the review with their state while they run,
|
|
111
|
+
and afterwards those that still exist, first the one that holds the report.
|
|
112
|
+
A click opens the session in a tab. Until now a reviewer session had to be
|
|
113
|
+
picked from OpenCode's session list.
|
|
114
|
+
- It opens by itself when a review or a comment run starts and when a report
|
|
115
|
+
or preview arrives, in the conversation on screen, and leaves the keyboard
|
|
116
|
+
with the prompt. `/pr-panel`, its only command, shows and hides it.
|
|
117
|
+
- New setting `terminalPanel`: `auto` (the default) as above; `manual` opens
|
|
118
|
+
the panel only with `/pr-panel`. The panel reads no settings file, so the
|
|
119
|
+
runtime sends this setting along with its notices, as metadata no model
|
|
120
|
+
sees; with the default nothing is added to them.
|
|
121
|
+
- A click inside the panel gives it the keyboard: the arrow keys or `j` and
|
|
122
|
+
`k`, Page Up and Page Down, Home and End scroll, and Escape or `q` closes it.
|
|
123
|
+
- In a terminal with fewer than 108 columns, where OpenCode shows a panel in
|
|
124
|
+
place of the conversation, it does not open by itself and says that
|
|
125
|
+
something is ready; `/pr-panel` shows it full screen.
|
|
126
|
+
- The panel only reads: AZPR's notices in the conversation, the report queued
|
|
127
|
+
to the review's session, and which sessions belong to the run. It sends no
|
|
128
|
+
prompt, starts nothing and posts nothing.
|
|
129
|
+
- A report or preview that a notice encloses is shown exactly as it was
|
|
130
|
+
written, also when it quotes the tag that ends the notice's block. For
|
|
131
|
+
that, text which already holds the escaped form of that tag
|
|
132
|
+
(`</azpr_report_data>`, `</azpr_comment_data>`) is now enclosed
|
|
133
|
+
with one more `&`; the tag itself is written as before.
|
|
134
|
+
- Other OpenCode clients, such as the desktop app, do not load the panel and
|
|
135
|
+
show AZPR's notices as before.
|
|
136
|
+
|
|
137
|
+
Comments on a PR that is no longer active:
|
|
138
|
+
|
|
139
|
+
- `/pr-comment --publish` refused a PR that was completed or abandoned
|
|
140
|
+
(`INCOMPLETE`, "The PR is completed; nothing was posted"), so a PR merged
|
|
141
|
+
before its review was commented on could be reviewed but not commented on.
|
|
142
|
+
The PR's status no longer stops a publication, typed or automatic: such a
|
|
143
|
+
PR takes the comments like an active one, and the receipt names the status
|
|
144
|
+
(`Publication (VERIFIED=3); the PR is completed:`). A changed source commit
|
|
145
|
+
is still refused (`STALE`), and nothing is posted twice.
|
|
146
|
+
- `/pr-check` no longer reports `NOT_READY` for such a PR: its `PR metadata`
|
|
147
|
+
row is a WARNING that names the status.
|
|
148
|
+
|
|
149
|
+
Settings:
|
|
150
|
+
|
|
151
|
+
- A version that brings a new setting now writes it into your settings file,
|
|
152
|
+
at its default, when OpenCode first loads that version. Until now only a
|
|
153
|
+
source installation added new settings; a settings file of the native
|
|
154
|
+
package kept what `/pr-setup` once wrote, and a new setting had to be
|
|
155
|
+
looked up and typed in. The defaults written are the ones that applied
|
|
156
|
+
anyway, so nothing changes in how AZPR behaves. Your values and their
|
|
157
|
+
order stay, the file is written with two-space indentation and readable by
|
|
158
|
+
its owner only (mode 600), and `/pr-check` lists what was added (a
|
|
159
|
+
`Settings` row).
|
|
160
|
+
- The file is replaced as `/pr-setup` replaces it: atomically, owner-only and
|
|
161
|
+
only when it is a regular file of your own in a directory no one else can
|
|
162
|
+
write to. What you save in an editor at that moment is kept. A settings
|
|
163
|
+
file that is a symbolic link, invalid or switched off (`enabled: false`) is
|
|
164
|
+
left as it is; where settings are missing and could not be added, the
|
|
165
|
+
`Settings` row of `/pr-check` is a WARNING that names them and the reason.
|
|
166
|
+
- A setup lock that a process left behind is now named: the message says
|
|
167
|
+
which file to delete when no setup is running.
|
|
168
|
+
- `/pr-setup` writes every setting from the start, those it does not ask for
|
|
169
|
+
at their defaults.
|
|
170
|
+
- Going back to an earlier version after 0.4.2 completed the file needs one
|
|
171
|
+
edit: remove `terminalPanel`, which earlier versions refuse as an unknown
|
|
172
|
+
setting.
|
|
173
|
+
|
|
174
|
+
Package:
|
|
175
|
+
|
|
176
|
+
- The package has a second entry, `./tui`, which OpenCode's terminal UI loads
|
|
177
|
+
by itself when the plugin is active. Installing and upgrading are as before;
|
|
178
|
+
the package still has no dependency and runs nothing at installation.
|
|
179
|
+
- OpenCode 2.3.0 does not compile the JSX of a package it installed (restored
|
|
180
|
+
in OpenTUI 0.9.0, which OpenCode has not shipped yet), so the package
|
|
181
|
+
carries the compiled view next to its source. Building it needs a
|
|
182
|
+
development dependency in the repository only.
|
|
183
|
+
- A source installation copies two more files, `tui-model.mjs` and `tui.js`;
|
|
184
|
+
the manual-copy list in the README has 34 files.
|
|
185
|
+
|
|
186
|
+
Documentation:
|
|
187
|
+
|
|
188
|
+
- The README's 15-second recording is a real review on OpenCode 2.3.0 with
|
|
189
|
+
the panel beside the conversation; the
|
|
190
|
+
[demonstration page](docs/DEMO.md#the-terminal-panel) says how it was made.
|
|
191
|
+
The recording of adjusting findings before publishing stays on that page.
|
|
192
|
+
- The recording tools write a GIF with Pillow alone where no FFmpeg is
|
|
193
|
+
installed, and the recording guide says what to look for in a cast before
|
|
194
|
+
publishing frames of the panel.
|
|
195
|
+
|
|
3
196
|
## 0.4.1 — 2026-11-16
|
|
4
197
|
|
|
5
198
|
AZPR is tested with OpenCode 2.3.0 instead of 2.2.4, and two things that went
|
package/README.md
CHANGED
|
@@ -52,12 +52,16 @@ is an actual capture excerpt with identifying UI removed and its text unchanged.
|
|
|
52
52
|
[company networks](docs/ENTERPRISE.md#company-networks) first):
|
|
53
53
|
|
|
54
54
|
```sh
|
|
55
|
-
opencode plugin add opencode-azure-devops-pr-review@0.4.
|
|
55
|
+
opencode plugin add opencode-azure-devops-pr-review@0.4.3
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
-
2.
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
2. In OpenCode's terminal UI, type `/pr-setup`. Dialogs ask for your Azure
|
|
59
|
+
DevOps organization, a proxy if your network needs one, your token (PAT) and
|
|
60
|
+
a model. AZPR checks the token with Azure DevOps, saves it in a file only
|
|
61
|
+
you can read, and is ready at once: no restart. The
|
|
62
|
+
[quickstart](docs/QUICKSTART.md) walks through it; in another client, such
|
|
63
|
+
as the desktop app, see
|
|
64
|
+
[without the terminal UI](docs/QUICKSTART.md#without-the-terminal-ui).
|
|
61
65
|
3. In one OpenCode conversation, check access, then review:
|
|
62
66
|
|
|
63
67
|
```text
|
|
@@ -247,11 +251,12 @@ runs and their limits are under
|
|
|
247
251
|
|
|
248
252
|
## Watch the workflow
|
|
249
253
|
|
|
250
|
-
[](docs/DEMO.md#the-terminal-panel)
|
|
251
255
|
|
|
252
|
-
*A 15-second edit of a real OpenCode 2.
|
|
256
|
+
*A 15-second edit of a real OpenCode 2.3.0 session on a dedicated test PR.
|
|
253
257
|
Waiting time is shortened, so the length is not the review duration.
|
|
254
|
-
[Recording details and
|
|
258
|
+
[Recording details and other walkthroughs](docs/DEMO.md), among them
|
|
259
|
+
[adjusting findings before publishing](docs/DEMO.md#adjust-findings-before-publishing).*
|
|
255
260
|
|
|
256
261
|
## Choose a review
|
|
257
262
|
|
|
@@ -305,6 +310,7 @@ models and runs.
|
|
|
305
310
|
| Operating system | **Ubuntu 22.04** (validation environment: WSL2). Other operating systems are not yet validated. |
|
|
306
311
|
| Azure | **Azure DevOps Services**, REST API **7.1**. Azure DevOps Server is not supported by the current URL handling. |
|
|
307
312
|
| Installation | OpenCode's plugin manager with the npm package or the versioned Git package, or the source installer with POSIX `sh` and Python 3; no plugin build step or npm dependencies. |
|
|
313
|
+
| Terminal UI | The [review panel](#terminal-panel) and the [setup dialogs](#setup-in-the-terminal-ui) need OpenCode's terminal UI. Other clients, such as the desktop app, show AZPR's notices as text and take `/pr-setup` with options. |
|
|
308
314
|
| Models | Your OpenCode provider/model IDs with tool support. Each mode checks the models it uses. Name a concrete model, not one that routes each session to another model (see [configuration](#configuration)). |
|
|
309
315
|
|
|
310
316
|
The npm package, the Git package and the release source archive contain the
|
|
@@ -378,7 +384,9 @@ regressions that the everyday model missed, at many times its cost and time
|
|
|
378
384
|
|
|
379
385
|
Readiness checks, reviews, comment planning, adjustments and publication
|
|
380
386
|
acknowledge `STARTED` and continue in the current OpenCode process; short
|
|
381
|
-
`PROGRESS` notices and a final receipt return to the invoking conversation.
|
|
387
|
+
`PROGRESS` notices and a final receipt return to the invoking conversation.
|
|
388
|
+
They start no response of that conversation's own model; when you prompt it
|
|
389
|
+
later, it reads them together with your prompt, in one request. Use
|
|
382
390
|
the displayed `/pr-stop <run-id>` to cancel. `/pr-setup` (including `--help`),
|
|
383
391
|
`/pr-stop`, `/pr-comment --show`, an adjustment that changes nothing and a
|
|
384
392
|
refused command answer directly, without a background run.
|
|
@@ -400,20 +408,21 @@ Azure DevOps REST API with the runtime's built-in `fetch`.
|
|
|
400
408
|
Install the npm package with OpenCode's plugin manager:
|
|
401
409
|
|
|
402
410
|
```sh
|
|
403
|
-
opencode plugin add opencode-azure-devops-pr-review@0.4.
|
|
411
|
+
opencode plugin add opencode-azure-devops-pr-review@0.4.3
|
|
404
412
|
```
|
|
405
413
|
|
|
406
414
|
The same release is also a versioned Git package, which needs Git but not the
|
|
407
415
|
npm registry:
|
|
408
416
|
|
|
409
417
|
```sh
|
|
410
|
-
opencode plugin add 'github:WTLAIB/opencode-azure-devops-pr-review-v2#v0.4.
|
|
418
|
+
opencode plugin add 'github:WTLAIB/opencode-azure-devops-pr-review-v2#v0.4.3'
|
|
411
419
|
```
|
|
412
420
|
|
|
413
421
|
Add only one of them. OpenCode 2.3.0 loads the plugin into a running OpenCode
|
|
414
422
|
service within a few seconds; if `/pr-setup` does not appear in a new
|
|
415
|
-
conversation, run `opencode service restart`. Then run `/pr-setup
|
|
416
|
-
instructions.
|
|
423
|
+
conversation, run `opencode service restart`. Then run `/pr-setup`: in the
|
|
424
|
+
terminal UI it asks for what it needs, elsewhere it prints the instructions.
|
|
425
|
+
Native packages
|
|
417
426
|
use `${XDG_CONFIG_HOME:-~/.config}/azpr/settings.json`; configuration and the
|
|
418
427
|
separate PAT file stay outside the package cache when the plugin is updated.
|
|
419
428
|
To select another configuration file, use an absolute path in the host config:
|
|
@@ -421,7 +430,7 @@ To select another configuration file, use an absolute path in the host config:
|
|
|
421
430
|
```json
|
|
422
431
|
{
|
|
423
432
|
"plugins": [{
|
|
424
|
-
"package": "opencode-azure-devops-pr-review@0.4.
|
|
433
|
+
"package": "opencode-azure-devops-pr-review@0.4.3",
|
|
425
434
|
"options": { "settingsFile": "/absolute/path/to/azpr/settings.json" }
|
|
426
435
|
}]
|
|
427
436
|
}
|
|
@@ -446,7 +455,7 @@ For an entry that `opencode plugin add` created, add the new version and,
|
|
|
446
455
|
only when that succeeds, remove the previous one:
|
|
447
456
|
|
|
448
457
|
```sh
|
|
449
|
-
opencode plugin add opencode-azure-devops-pr-review@0.4.
|
|
458
|
+
opencode plugin add opencode-azure-devops-pr-review@0.4.3 &&
|
|
450
459
|
opencode plugin remove opencode-azure-devops-pr-review@PREVIOUS_VERSION
|
|
451
460
|
```
|
|
452
461
|
|
|
@@ -465,11 +474,20 @@ AZPR's commands disappear until the package is available and the service
|
|
|
465
474
|
restarts.
|
|
466
475
|
|
|
467
476
|
External settings, the PAT file and review records stay in place; a working
|
|
468
|
-
configuration needs no new `/pr-setup`.
|
|
477
|
+
configuration needs no new `/pr-setup`. Settings that a new version brings
|
|
478
|
+
are written into your settings file, at their defaults, when OpenCode first
|
|
479
|
+
loads that version: AZPR behaves as it did, and each new setting is in the
|
|
480
|
+
file for you to change. `/pr-check` then lists what was added. Your values
|
|
481
|
+
and their order stay, and the file is written with two-space indentation and
|
|
482
|
+
readable by its owner only (mode 600). A settings file that is a symbolic
|
|
483
|
+
link, or in a directory other users can write to, is left as it is, and
|
|
484
|
+
`/pr-check` names the settings it leaves out. To go back to an earlier
|
|
485
|
+
version afterwards, remove the settings that version does not know: it names
|
|
486
|
+
the first one (`Unknown setting settings.terminalPanel`) instead of starting. `opencode plugin list` should then
|
|
469
487
|
show a single `azpr` row with the new version (from 0.3.1, `/pr-check` names
|
|
470
488
|
it too); if it still shows the previous one, run `opencode service restart`.
|
|
471
489
|
Exact versions stay pinned, so `opencode plugin update` leaves them unchanged.
|
|
472
|
-
See the [0.4.
|
|
490
|
+
See the [0.4.3 release notes](docs/releases/v0.4.3.md) for what changed, the
|
|
473
491
|
[0.4.0 release notes](docs/releases/v0.4.0.md) for commands without review IDs and the
|
|
474
492
|
[0.2.0 release notes](docs/releases/v0.2.0.md) for automatic comments. A
|
|
475
493
|
preview follows each COMPLETE review unless `afterReview` says otherwise;
|
|
@@ -481,8 +499,8 @@ review command flag.
|
|
|
481
499
|
<details>
|
|
482
500
|
<summary>Source installation and replacement</summary>
|
|
483
501
|
|
|
484
|
-
Download the [v0.4.
|
|
485
|
-
and extract it, or check out tag `v0.4.
|
|
502
|
+
Download the [v0.4.3 source archive](https://github.com/WTLAIB/opencode-azure-devops-pr-review-v2/archive/refs/tags/v0.4.3.tar.gz)
|
|
503
|
+
and extract it, or check out tag `v0.4.3`. The installer needs POSIX `sh` and
|
|
486
504
|
Python 3's standard library. From that source directory:
|
|
487
505
|
|
|
488
506
|
```sh
|
|
@@ -493,8 +511,9 @@ The installer creates `plugins/azpr-v2/` with a generated ESM `package.json`
|
|
|
493
511
|
and a `server.js` entry that re-exports `plugin.js`. It never edits the main
|
|
494
512
|
OpenCode configuration, provider choices or MCP connections, and it refuses
|
|
495
513
|
conflicting legacy files, reserved command names and unowned packages. Run
|
|
496
|
-
`/pr-setup
|
|
497
|
-
them yourself
|
|
514
|
+
`/pr-setup` in the terminal UI to complete the generated starter settings
|
|
515
|
+
(with options: `/pr-setup ... --replace`), or edit them yourself and restart
|
|
516
|
+
OpenCode.
|
|
498
517
|
|
|
499
518
|
To replace an existing source installation (current settings are kept, new defaults
|
|
500
519
|
are added, and a retired `mcp` section is moved into `azure`):
|
|
@@ -508,7 +527,7 @@ sh install.sh --config-dir /absolute/path/to/v2-opencode-config --replace
|
|
|
508
527
|
### Manual copying without Git
|
|
509
528
|
|
|
510
529
|
Keep these relative paths under one source directory, then run its installer.
|
|
511
|
-
These **
|
|
530
|
+
These **35 files** include the runtime and its license:
|
|
512
531
|
|
|
513
532
|
<details>
|
|
514
533
|
<summary>Show the required files</summary>
|
|
@@ -537,6 +556,9 @@ src/search.mjs
|
|
|
537
556
|
src/review-tools.mjs
|
|
538
557
|
src/review-work.mjs
|
|
539
558
|
src/store.mjs
|
|
559
|
+
src/tui-model.mjs
|
|
560
|
+
src/tui-setup.mjs
|
|
561
|
+
src/tui.js
|
|
540
562
|
src/prompts/common.md
|
|
541
563
|
src/prompts/functional.md
|
|
542
564
|
src/prompts/risk.md
|
|
@@ -555,15 +577,61 @@ Keep `LICENSE` with copied or redistributed packages.
|
|
|
555
577
|
|
|
556
578
|
## Configuration
|
|
557
579
|
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
580
|
+
`/pr-setup` sets AZPR up and changes its settings; what it answers names the
|
|
581
|
+
settings file. Native packages use the external configuration described
|
|
582
|
+
above; source installations retain their installed
|
|
583
|
+
`plugins/azpr-v2/settings.json`. The file names every setting, each at its
|
|
584
|
+
default until you change it (see [all settings](#all-settings-and-defaults)).
|
|
585
|
+
|
|
586
|
+
A first setup is loaded at once. A later change, made with `/pr-setup` or by
|
|
587
|
+
editing the file, takes effect when the OpenCode service restarts
|
|
588
|
+
(`opencode service restart`, or your own `opencode serve` process). A changed
|
|
589
|
+
file blocks new commands until the restart; running commands keep the settings
|
|
590
|
+
they started with.
|
|
591
|
+
|
|
592
|
+
### Setup in the terminal UI
|
|
593
|
+
|
|
594
|
+
In OpenCode's terminal UI, `/pr-setup` without options opens dialogs. The
|
|
595
|
+
command palette has them too ("AZPR: settings").
|
|
596
|
+
|
|
597
|
+
- **First setup.** Your organization (its name, or the URL of a pull request);
|
|
598
|
+
a proxy, only if your network needs one (Enter skips it; after a proxy, the
|
|
599
|
+
CA certificate file of a company that inspects HTTPS, which Enter skips
|
|
600
|
+
too); your token; and a model from OpenCode's list, which fills the review
|
|
601
|
+
roles and `/pr-quick`. The proxy is asked before the token because the token
|
|
602
|
+
is checked over the network.
|
|
603
|
+
- **The token** is typed or pasted into a field that shows only how many
|
|
604
|
+
characters it holds. AZPR asks Azure DevOps once whether the token works for
|
|
605
|
+
your organization, and says what was refused when it does not: the token,
|
|
606
|
+
the organization, or the way there. If Azure DevOps cannot be reached, you
|
|
607
|
+
can set the proxy or the CA file right there and try the same token again,
|
|
608
|
+
or save it unchecked. The token is then saved alone in a file only you can
|
|
609
|
+
read (mode 600): a new file, `${XDG_CONFIG_HOME:-~/.config}/azpr/pat-<organization>`
|
|
610
|
+
(with a number where that name is taken), or the token file your settings
|
|
611
|
+
name already for that organization. Setup overwrites no other file. The
|
|
612
|
+
token is in no conversation, notice or log, and is not shown again.
|
|
613
|
+
- **Afterwards** `/pr-setup` lists the settings with their values:
|
|
614
|
+
organization, token, proxy, CA certificate file, the review, quick and deep
|
|
615
|
+
models, output language, what follows a review, the report in the
|
|
616
|
+
conversation, progress notices, the review panel and debug records. Choose
|
|
617
|
+
one to change it. It is saved at once, and the list says that a restart is
|
|
618
|
+
needed. Posting comments without a preview asks once more, with "no" first.
|
|
619
|
+
Another organization asks for a token of its own, since the saved one was
|
|
620
|
+
saved for the organization it was checked for; the two are saved together,
|
|
621
|
+
the new token in a new file beside the first, and AZPR says where the
|
|
622
|
+
earlier token still is.
|
|
623
|
+
The other settings are in the settings file, which the list names.
|
|
624
|
+
|
|
625
|
+
The dialogs only ask. The plugin's server part checks every answer, writes
|
|
626
|
+
the two files, and is the only part that contacts Azure DevOps. Other OpenCode
|
|
627
|
+
clients, such as the desktop app, do not load the dialogs; there `/pr-setup`
|
|
628
|
+
prints the instructions and takes options.
|
|
629
|
+
|
|
630
|
+
### Setup with options
|
|
631
|
+
|
|
632
|
+
Without the terminal UI, or from a script, one command sets the organization,
|
|
633
|
+
an existing PAT file and the same model for review and quick roles, without
|
|
634
|
+
calling a model or Azure:
|
|
567
635
|
|
|
568
636
|
```text
|
|
569
637
|
/pr-setup --organization YOUR_ORG --model YOUR_PROVIDER/YOUR_MODEL --pat-file "/absolute/path/to/pat"
|
|
@@ -571,12 +639,37 @@ the same model for review and quick roles without calling a model or Azure:
|
|
|
571
639
|
|
|
572
640
|
`--organization` also accepts a PR or organization URL. Without `--pat-file`,
|
|
573
641
|
setup uses `${XDG_CONFIG_HOME:-~/.config}/azpr/pat`, the file the
|
|
574
|
-
[quickstart](docs/QUICKSTART.md#
|
|
642
|
+
[quickstart](docs/QUICKSTART.md#save-the-pat-in-a-private-file-terminal)
|
|
575
643
|
creates. An existing file requires `--replace`, which keeps the PAT file
|
|
576
644
|
already set unless you name another; unrelated advanced settings and deep
|
|
577
645
|
models are preserved. Setup checks the model catalog and PAT file before
|
|
578
|
-
saving. It never accepts the PAT itself as a command argument.
|
|
579
|
-
|
|
646
|
+
saving. It never accepts the PAT itself as a command argument. A first setup
|
|
647
|
+
is loaded at once; run `/pr-check` to verify Azure read access.
|
|
648
|
+
|
|
649
|
+
Each of these options changes one setting of existing settings, without
|
|
650
|
+
`--replace`, and several can be given together:
|
|
651
|
+
|
|
652
|
+
| Option | Sets |
|
|
653
|
+
| --- | --- |
|
|
654
|
+
| `--proxy URL` (or `none`) | `azure.proxy` |
|
|
655
|
+
| `--ca-file PATH` (or `none`) | `azure.caFile` |
|
|
656
|
+
| `--review-model PROVIDER/MODEL` | The three review roles |
|
|
657
|
+
| `--quick-model PROVIDER/MODEL` (or `off`) | `models.quick.reviewer` |
|
|
658
|
+
| `--deep-model PROVIDER/MODEL` (or `off`) | The three deep roles |
|
|
659
|
+
| `--language TAG` | `outputLanguage` |
|
|
660
|
+
| `--after-review preview`, `none` or `publish` | `afterReview` of every mode |
|
|
661
|
+
| `--report receipt` or `full` | `returnReport` |
|
|
662
|
+
| `--progress on` or `off` | `progressNotices` |
|
|
663
|
+
| `--panel auto` or `manual` | `terminalPanel` |
|
|
664
|
+
| `--debug on` or `off` | `debug.enabled` |
|
|
665
|
+
|
|
666
|
+
```text
|
|
667
|
+
/pr-setup --language zh-TW --deep-model YOUR_PROVIDER/YOUR_STRONGER_MODEL
|
|
668
|
+
```
|
|
669
|
+
|
|
670
|
+
They also go with the options of a first setup, for example `--proxy` behind
|
|
671
|
+
a company proxy. After a change to settings that are in use, restart the
|
|
672
|
+
OpenCode service. For separate models per role, edit the settings file:
|
|
580
673
|
|
|
581
674
|
```json
|
|
582
675
|
{
|
|
@@ -684,6 +777,7 @@ copies that different reviewers get can each produce a finding.
|
|
|
684
777
|
| `shell` | `deny`: private reviewers cannot run shell commands (the tool is hidden). `ask`: each command needs your approval in OpenCode. `inherit`: host permissions decide. |
|
|
685
778
|
| `progressNotices` | `true`: short PROGRESS notices in the invoking conversation. |
|
|
686
779
|
| `deletePrivateSessions` | `true`: when a command ends, AZPR deletes its private reviewer sessions except the one that holds the review's report (see [retention](#retention-and-privacy)); `false` keeps every session. |
|
|
780
|
+
| `terminalPanel` | `auto`: the [terminal panel](#terminal-panel) opens by itself when a review or comment run starts and when a report or preview arrives.<br>`manual`: it opens only with `/pr-panel`. |
|
|
687
781
|
| `afterReview.quick` / `.review` / `.deep` | What follows a COMPLETE review of that mode; `preview` each.<br>`preview`: plan a comment preview (a model runs; nothing is posted).<br>`none`: nothing follows; run `/pr-comment` yourself.<br>`publish`: plan the comments and post them as the PAT owner; a comment that a safeguard holds back waits for a person.<br>A flag after the PR URL (`--preview`, `--publish`, `--no-comment`) overrides it for one run. See [automatic comments](#automatic-comments). |
|
|
688
782
|
| `azure.organization` | Required. The `<org>` of `https://dev.azure.com/<org>`; PR URLs of other organizations are refused. |
|
|
689
783
|
| `azure.pat` | A personal access token for that organization with **Code (Read)** and **Pull Request Threads (Read & write)**, or `""` when `azure.patFile` is set. Sent only to `https://dev.azure.com/<org>` and never logged. |
|
|
@@ -719,10 +813,12 @@ a PAT scoped to **one organization** (global "all accessible organizations"
|
|
|
719
813
|
PATs stop working on 2026-12-01) with **Code: Read** and **Pull Request Threads:
|
|
720
814
|
Read & write**, which cover every call AZPR makes, and give it an expiry you
|
|
721
815
|
renew. Keep it alone in a file that only you can read and point `azure.patFile`
|
|
722
|
-
at it, so `settings.json` holds no secret
|
|
723
|
-
[
|
|
816
|
+
at it, so `settings.json` holds no secret. In the terminal UI, `/pr-setup`
|
|
817
|
+
does both for you (see [setup](#setup-in-the-terminal-ui)). Without it, the
|
|
818
|
+
[quickstart](docs/QUICKSTART.md#save-the-pat-in-a-private-file-terminal) shows
|
|
724
819
|
how to create that file without echoing the PAT, recording it in your shell
|
|
725
|
-
history or overwriting an existing file, and `/pr-setup` sets
|
|
820
|
+
history or overwriting an existing file, and `/pr-setup` with options sets
|
|
821
|
+
`azure.patFile`.
|
|
726
822
|
|
|
727
823
|
To set it by hand, put that file's absolute path (for example
|
|
728
824
|
`/home/you/.config/azpr/pat`) in `"patFile"`, leave `"pat"` empty in the
|
|
@@ -752,7 +848,7 @@ troubleshooting.
|
|
|
752
848
|
|
|
753
849
|
| Command | Behavior |
|
|
754
850
|
| --- | --- |
|
|
755
|
-
| `/pr-setup [options]` |
|
|
851
|
+
| `/pr-setup [options]` | Set AZPR up, or change its settings. Without options, the terminal UI asks in dialogs and checks the token with Azure DevOps (other clients get the instructions). With options: an organization, one model and an existing PAT file, or one setting per option, without an Azure request. No model request either way. A first setup is loaded at once; a later change needs a restart of the OpenCode service. |
|
|
756
852
|
| `/pr-check <PR URL> [context]` | Deterministic readiness check: PR metadata, changed files, a HEAD and BASE file read, discussions and model availability (configured quick and deep models only as warnings, and whether `/pr-deep` is off or would repeat `/pr-review`), and `afterReview` (the configured modes and posting identity, shown as information); warns when OpenCode has no permission hook to keep native read tools inside the project. No model is used. |
|
|
757
853
|
| `/pr-review <PR URL> [flag] [context]` | Sharded functional and risk reviews, then sharded verification. |
|
|
758
854
|
| `/pr-deep <PR URL> [flag] [context]` | The same review with the stronger models of `models.deep`; usually slower and costlier. |
|
|
@@ -810,8 +906,56 @@ publication follows (see [automatic comments](#automatic-comments)).
|
|
|
810
906
|
|
|
811
907
|
A failed final version recheck adds a warning; it does not by itself prevent
|
|
812
908
|
COMPLETE in any review mode. Read the receipt warnings. Publication separately
|
|
813
|
-
rechecks that the PR
|
|
814
|
-
|
|
909
|
+
rechecks that the PR's source commit is unchanged before posting.
|
|
910
|
+
|
|
911
|
+
In OpenCode's terminal UI, `/pr-panel` shows or hides the
|
|
912
|
+
[terminal panel](#terminal-panel); it runs no model and makes no Azure DevOps
|
|
913
|
+
request.
|
|
914
|
+
|
|
915
|
+
## Terminal panel
|
|
916
|
+
|
|
917
|
+
OpenCode shows what a plugin tells a conversation as plain text, so a report
|
|
918
|
+
or a comment preview appears there as Markdown source. In OpenCode's terminal
|
|
919
|
+
UI, AZPR therefore adds a panel beside the conversation: it shows the newest
|
|
920
|
+
report or preview rendered, and lists the sessions of the review so that you
|
|
921
|
+
can open one. The [recording of a real review](docs/DEMO.md#the-terminal-panel)
|
|
922
|
+
shows both side by side.
|
|
923
|
+
|
|
924
|
+
- **It opens by itself** when a review or a comment run starts and when a
|
|
925
|
+
report or preview arrives, in the conversation that is on screen. The
|
|
926
|
+
keyboard stays with the prompt, so the next command can be typed while the
|
|
927
|
+
report is in view. To have it open only when you ask, set `terminalPanel`
|
|
928
|
+
in the [settings](#all-settings-and-defaults):
|
|
929
|
+
|
|
930
|
+
```json
|
|
931
|
+
"terminalPanel": "manual"
|
|
932
|
+
```
|
|
933
|
+
|
|
934
|
+
- **Sessions.** While a review runs, each of its sessions is a row with its
|
|
935
|
+
state. Click a row to open that session; OpenCode opens it in a tab, and the
|
|
936
|
+
panel is there again when you return to the conversation. After the review
|
|
937
|
+
the rows are the sessions that still exist (see
|
|
938
|
+
[retention](#retention-and-privacy)), first the one that holds the report.
|
|
939
|
+
OpenCode's own session list has them too.
|
|
940
|
+
- **Report or preview.** Below the sessions: the report of the review, then
|
|
941
|
+
the comment preview once one is planned, and the saved preview again after
|
|
942
|
+
`/pr-comment --show`. A check (`/pr-check`) shows its table there too.
|
|
943
|
+
- **Keys.** `/pr-panel` shows and hides the panel; it is the panel's only
|
|
944
|
+
command. A click inside it gives it the keyboard: the arrow keys or `j` and
|
|
945
|
+
`k`, Page Up and Page Down, Home and End scroll, and Escape or `q` closes
|
|
946
|
+
it.
|
|
947
|
+
- **A narrow terminal** (fewer than 108 columns) has no room for two panes,
|
|
948
|
+
and OpenCode would show the panel in place of the conversation. There the
|
|
949
|
+
panel does not open by itself; it says that something is ready, and
|
|
950
|
+
`/pr-panel` shows it full screen.
|
|
951
|
+
|
|
952
|
+
The panel only reads what AZPR already put into your conversation and into the
|
|
953
|
+
session that holds a report. It sends no prompt, starts no review and posts
|
|
954
|
+
nothing; `/pr-comment --publish` is still a command you type. It comes with
|
|
955
|
+
the package and needs no setup; `terminalPanel` is its one setting. Other
|
|
956
|
+
OpenCode clients, such as the desktop app, do not load it and show AZPR's
|
|
957
|
+
notices as before. The same terminal part brings the
|
|
958
|
+
[setup dialogs](#setup-in-the-terminal-ui).
|
|
815
959
|
|
|
816
960
|
## Comments
|
|
817
961
|
|
|
@@ -927,15 +1071,18 @@ When every finding is already discussed on the PR, typically by AZPR's own
|
|
|
927
1071
|
comment from an earlier run, there is nothing new to post: the receipt says
|
|
928
1072
|
`NOTHING_TO_POST` and the plan is saved (the summary's marker follows the
|
|
929
1073
|
inline comments, so re-reviewing an unchanged PR would otherwise add a summary
|
|
930
|
-
each time). Publication itself still rechecks that the PR
|
|
1074
|
+
each time). Publication itself still rechecks that the PR's source commit is
|
|
931
1075
|
unchanged. A command you type, such as `/pr-comment --publish`, posts
|
|
932
1076
|
every item of the saved preview, held ones included.
|
|
933
1077
|
|
|
934
1078
|
### Publication
|
|
935
1079
|
|
|
936
|
-
Publication is runtime code: it refuses
|
|
937
|
-
|
|
938
|
-
|
|
1080
|
+
Publication is runtime code: it refuses a changed source commit, lists every
|
|
1081
|
+
existing thread, skips items whose hidden marker already exists, creates the
|
|
1082
|
+
rest with the exact saved text, and reads the markers back. The PR's status
|
|
1083
|
+
stops nothing: a PR that was completed or abandoned, such as one merged before
|
|
1084
|
+
its review was commented on, is reviewed and takes comments like an active
|
|
1085
|
+
one, and the receipt names that status.
|
|
939
1086
|
Markers are stable fingerprints of PR, file and anchored lines, so a later
|
|
940
1087
|
review of unchanged code does not post duplicates. A failed or uncertain item can
|
|
941
1088
|
simply be published again; a comment someone deleted on the PR is reported as
|
|
@@ -966,6 +1113,9 @@ every later run. While debug is enabled every session is kept until its
|
|
|
966
1113
|
review is evicted, so turn `debug.enabled` off for everyday use if the list
|
|
967
1114
|
gets long. A review that an OpenCode restart interrupts leaves its sessions in
|
|
968
1115
|
the list; delete those yourself. Your own conversations are never deleted.
|
|
1116
|
+
In the terminal UI you need not look for these sessions in the list: the
|
|
1117
|
+
[terminal panel](#terminal-panel) names those of the latest review and opens
|
|
1118
|
+
the one you click.
|
|
969
1119
|
|
|
970
1120
|
## Development and removal
|
|
971
1121
|
|
|
@@ -974,6 +1124,7 @@ See [Contributing](CONTRIBUTING.md) for bug reports and development checks,
|
|
|
974
1124
|
[code of conduct](CODE_OF_CONDUCT.md) for community conduct.
|
|
975
1125
|
|
|
976
1126
|
```sh
|
|
1127
|
+
npm ci
|
|
977
1128
|
npm run check
|
|
978
1129
|
npm test
|
|
979
1130
|
node tests/host-v2-smoke.mjs /absolute/path/to/opencode
|
|
@@ -981,18 +1132,29 @@ node tests/host-v2-smoke.mjs /absolute/path/to/opencode --replace
|
|
|
981
1132
|
node tests/host-v2-smoke.mjs /absolute/path/to/opencode --native
|
|
982
1133
|
node tests/host-v2-comment-scale.mjs /absolute/path/to/opencode
|
|
983
1134
|
node tests/host-v2-background-compaction.mjs /absolute/path/to/opencode
|
|
1135
|
+
node tests/host-v2-comment-scale.mjs /absolute/path/to/opencode --cleanup
|
|
1136
|
+
node tests/host-v2-background-compaction.mjs /absolute/path/to/opencode --cleanup
|
|
1137
|
+
node tests/host-v2-tui-panel.mjs /absolute/path/to/opencode
|
|
1138
|
+
node tests/host-v2-tui-panel.mjs /absolute/path/to/opencode --native
|
|
984
1139
|
sh uninstall.sh --config-dir /absolute/path/to/v2-opencode-config
|
|
985
1140
|
sh uninstall.sh --config-dir /absolute/path/to/v2-opencode-config --apply
|
|
986
1141
|
```
|
|
987
1142
|
|
|
988
1143
|
The host fixtures run a real OpenCode binary with a loopback fake model provider
|
|
989
1144
|
and a loopback fake Azure DevOps REST service in disposable directories under
|
|
990
|
-
`.local/`.
|
|
1145
|
+
`.local/`. They keep debug on to read its records, and debug keeps every
|
|
1146
|
+
private session; the two `--cleanup` runs turn it off, so that each run deletes
|
|
1147
|
+
its sessions as an installation with default settings does. The two
|
|
1148
|
+
`host-v2-tui-panel` runs drive the real terminal UI in `tmux`, which they need,
|
|
1149
|
+
once installed from source and once as OpenCode's plugin manager installs the
|
|
1150
|
+
package. `npm ci` installs the compiler of the terminal panel's JSX, which only
|
|
1151
|
+
`npm run check` and `npm run build:tui` use; the installed plugin has no
|
|
1152
|
+
dependency and is not built on your machine.
|
|
991
1153
|
Uninstall without `--apply` previews; `--apply` archives only this package under
|
|
992
1154
|
`azpr-v2-backups` and leaves the private state directory for you to delete.
|
|
993
1155
|
For a native installation, remove the entry you added, for example
|
|
994
|
-
`opencode plugin remove opencode-azure-devops-pr-review@0.4.
|
|
995
|
-
`opencode plugin remove 'github:WTLAIB/opencode-azure-devops-pr-review-v2#v0.4.
|
|
1156
|
+
`opencode plugin remove opencode-azure-devops-pr-review@0.4.3` or
|
|
1157
|
+
`opencode plugin remove 'github:WTLAIB/opencode-azure-devops-pr-review-v2#v0.4.3'`;
|
|
996
1158
|
the external settings, PAT file and private review state remain available.
|
|
997
1159
|
|
|
998
1160
|
[Architecture](docs/ARCHITECTURE.md), [commenting](docs/COMMENTING.md),
|
|
@@ -1005,7 +1167,7 @@ or personal model selections.
|
|
|
1005
1167
|
## License and releases
|
|
1006
1168
|
|
|
1007
1169
|
[MIT](LICENSE), copyright 2026 WTLAIB. See the [changelog](CHANGELOG.md) for the
|
|
1008
|
-
release scope, [v0.4.
|
|
1170
|
+
release scope, [v0.4.3](https://github.com/WTLAIB/opencode-azure-devops-pr-review-v2/releases/tag/v0.4.3)
|
|
1009
1171
|
for downloads, the [npm package](https://www.npmjs.com/package/opencode-azure-devops-pr-review),
|
|
1010
1172
|
[v0.2.0](https://github.com/WTLAIB/opencode-azure-devops-pr-review-v2/releases/tag/v0.2.0)
|
|
1011
1173
|
for the recorded demonstration, and [releasing](docs/RELEASING.md) for the
|