opencode-azure-devops-pr-review 0.4.1 → 0.4.2
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 +101 -0
- package/README.md +105 -24
- package/package.json +11 -3
- package/src/attribution.mjs +16 -2
- package/src/comment-work.mjs +5 -3
- package/src/config.mjs +63 -14
- package/src/runtime.mjs +50 -13
- package/src/session.mjs +7 -2
- package/src/setup.mjs +120 -27
- package/src/tui-model.mjs +566 -0
- package/src/tui-view.jsx +438 -0
- package/src/tui.js +716 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,106 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.2 — 2026-11-17
|
|
4
|
+
|
|
5
|
+
A panel in OpenCode's terminal UI shows the report and the comment preview
|
|
6
|
+
rendered instead of as Markdown source, and lists the sessions of the review
|
|
7
|
+
so that you can open one. A PR that was completed or abandoned takes comments
|
|
8
|
+
like an active one, and a new version writes the settings it brings into your
|
|
9
|
+
settings file. The reviewer, verifier and comment-planning instructions are
|
|
10
|
+
those of 0.4.1. One setting is new: `terminalPanel`.
|
|
11
|
+
|
|
12
|
+
Terminal panel (OpenCode's terminal UI only):
|
|
13
|
+
|
|
14
|
+
- OpenCode shows what a plugin tells a conversation as plain text, so a report
|
|
15
|
+
or a comment preview appeared as Markdown source. A panel beside the
|
|
16
|
+
conversation now shows the newest one rendered: headings, emphasis, lists,
|
|
17
|
+
code and tables. A check's table is shown there too.
|
|
18
|
+
- The panel lists the sessions of the review with their state while they run,
|
|
19
|
+
and afterwards those that still exist, first the one that holds the report.
|
|
20
|
+
A click opens the session in a tab. Until now a reviewer session had to be
|
|
21
|
+
picked from OpenCode's session list.
|
|
22
|
+
- It opens by itself when a review or a comment run starts and when a report
|
|
23
|
+
or preview arrives, in the conversation on screen, and leaves the keyboard
|
|
24
|
+
with the prompt. `/pr-panel`, its only command, shows and hides it.
|
|
25
|
+
- New setting `terminalPanel`: `auto` (the default) as above; `manual` opens
|
|
26
|
+
the panel only with `/pr-panel`. The panel reads no settings file, so the
|
|
27
|
+
runtime sends this setting along with its notices, as metadata no model
|
|
28
|
+
sees; with the default nothing is added to them.
|
|
29
|
+
- A click inside the panel gives it the keyboard: the arrow keys or `j` and
|
|
30
|
+
`k`, Page Up and Page Down, Home and End scroll, and Escape or `q` closes it.
|
|
31
|
+
- In a terminal with fewer than 108 columns, where OpenCode shows a panel in
|
|
32
|
+
place of the conversation, it does not open by itself and says that
|
|
33
|
+
something is ready; `/pr-panel` shows it full screen.
|
|
34
|
+
- The panel only reads: AZPR's notices in the conversation, the report queued
|
|
35
|
+
to the review's session, and which sessions belong to the run. It sends no
|
|
36
|
+
prompt, starts nothing and posts nothing.
|
|
37
|
+
- A report or preview that a notice encloses is shown exactly as it was
|
|
38
|
+
written, also when it quotes the tag that ends the notice's block. For
|
|
39
|
+
that, text which already holds the escaped form of that tag
|
|
40
|
+
(`</azpr_report_data>`, `</azpr_comment_data>`) is now enclosed
|
|
41
|
+
with one more `&`; the tag itself is written as before.
|
|
42
|
+
- Other OpenCode clients, such as the desktop app, do not load the panel and
|
|
43
|
+
show AZPR's notices as before.
|
|
44
|
+
|
|
45
|
+
Comments on a PR that is no longer active:
|
|
46
|
+
|
|
47
|
+
- `/pr-comment --publish` refused a PR that was completed or abandoned
|
|
48
|
+
(`INCOMPLETE`, "The PR is completed; nothing was posted"), so a PR merged
|
|
49
|
+
before its review was commented on could be reviewed but not commented on.
|
|
50
|
+
The PR's status no longer stops a publication, typed or automatic: such a
|
|
51
|
+
PR takes the comments like an active one, and the receipt names the status
|
|
52
|
+
(`Publication (VERIFIED=3); the PR is completed:`). A changed source commit
|
|
53
|
+
is still refused (`STALE`), and nothing is posted twice.
|
|
54
|
+
- `/pr-check` no longer reports `NOT_READY` for such a PR: its `PR metadata`
|
|
55
|
+
row is a WARNING that names the status.
|
|
56
|
+
|
|
57
|
+
Settings:
|
|
58
|
+
|
|
59
|
+
- A version that brings a new setting now writes it into your settings file,
|
|
60
|
+
at its default, when OpenCode first loads that version. Until now only a
|
|
61
|
+
source installation added new settings; a settings file of the native
|
|
62
|
+
package kept what `/pr-setup` once wrote, and a new setting had to be
|
|
63
|
+
looked up and typed in. The defaults written are the ones that applied
|
|
64
|
+
anyway, so nothing changes in how AZPR behaves. Your values and their
|
|
65
|
+
order stay, the file is written with two-space indentation and readable by
|
|
66
|
+
its owner only (mode 600), and `/pr-check` lists what was added (a
|
|
67
|
+
`Settings` row).
|
|
68
|
+
- The file is replaced as `/pr-setup` replaces it: atomically, owner-only and
|
|
69
|
+
only when it is a regular file of your own in a directory no one else can
|
|
70
|
+
write to. What you save in an editor at that moment is kept. A settings
|
|
71
|
+
file that is a symbolic link, invalid or switched off (`enabled: false`) is
|
|
72
|
+
left as it is; where settings are missing and could not be added, the
|
|
73
|
+
`Settings` row of `/pr-check` is a WARNING that names them and the reason.
|
|
74
|
+
- A setup lock that a process left behind is now named: the message says
|
|
75
|
+
which file to delete when no setup is running.
|
|
76
|
+
- `/pr-setup` writes every setting from the start, those it does not ask for
|
|
77
|
+
at their defaults.
|
|
78
|
+
- Going back to an earlier version after 0.4.2 completed the file needs one
|
|
79
|
+
edit: remove `terminalPanel`, which earlier versions refuse as an unknown
|
|
80
|
+
setting.
|
|
81
|
+
|
|
82
|
+
Package:
|
|
83
|
+
|
|
84
|
+
- The package has a second entry, `./tui`, which OpenCode's terminal UI loads
|
|
85
|
+
by itself when the plugin is active. Installing and upgrading are as before;
|
|
86
|
+
the package still has no dependency and runs nothing at installation.
|
|
87
|
+
- OpenCode 2.3.0 does not compile the JSX of a package it installed (restored
|
|
88
|
+
in OpenTUI 0.9.0, which OpenCode has not shipped yet), so the package
|
|
89
|
+
carries the compiled view next to its source. Building it needs a
|
|
90
|
+
development dependency in the repository only.
|
|
91
|
+
- A source installation copies two more files, `tui-model.mjs` and `tui.js`;
|
|
92
|
+
the manual-copy list in the README has 34 files.
|
|
93
|
+
|
|
94
|
+
Documentation:
|
|
95
|
+
|
|
96
|
+
- The README's 15-second recording is a real review on OpenCode 2.3.0 with
|
|
97
|
+
the panel beside the conversation; the
|
|
98
|
+
[demonstration page](docs/DEMO.md#the-terminal-panel) says how it was made.
|
|
99
|
+
The recording of adjusting findings before publishing stays on that page.
|
|
100
|
+
- The recording tools write a GIF with Pillow alone where no FFmpeg is
|
|
101
|
+
installed, and the recording guide says what to look for in a cast before
|
|
102
|
+
publishing frames of the panel.
|
|
103
|
+
|
|
3
104
|
## 0.4.1 — 2026-11-16
|
|
4
105
|
|
|
5
106
|
AZPR is tested with OpenCode 2.3.0 instead of 2.2.4, and two things that went
|
package/README.md
CHANGED
|
@@ -52,7 +52,7 @@ 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.2
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
2. Follow the [quickstart](docs/QUICKSTART.md) to save your PAT in a private
|
|
@@ -247,11 +247,12 @@ runs and their limits are under
|
|
|
247
247
|
|
|
248
248
|
## Watch the workflow
|
|
249
249
|
|
|
250
|
-
[](docs/DEMO.md#the-terminal-panel)
|
|
251
251
|
|
|
252
|
-
*A 15-second edit of a real OpenCode 2.
|
|
252
|
+
*A 15-second edit of a real OpenCode 2.3.0 session on a dedicated test PR.
|
|
253
253
|
Waiting time is shortened, so the length is not the review duration.
|
|
254
|
-
[Recording details and
|
|
254
|
+
[Recording details and other walkthroughs](docs/DEMO.md), among them
|
|
255
|
+
[adjusting findings before publishing](docs/DEMO.md#adjust-findings-before-publishing).*
|
|
255
256
|
|
|
256
257
|
## Choose a review
|
|
257
258
|
|
|
@@ -305,6 +306,7 @@ models and runs.
|
|
|
305
306
|
| Operating system | **Ubuntu 22.04** (validation environment: WSL2). Other operating systems are not yet validated. |
|
|
306
307
|
| Azure | **Azure DevOps Services**, REST API **7.1**. Azure DevOps Server is not supported by the current URL handling. |
|
|
307
308
|
| 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. |
|
|
309
|
+
| Terminal panel | OpenCode's terminal UI (see [terminal panel](#terminal-panel)). Other clients, such as the desktop app, show AZPR's notices as before. |
|
|
308
310
|
| 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
311
|
|
|
310
312
|
The npm package, the Git package and the release source archive contain the
|
|
@@ -400,14 +402,14 @@ Azure DevOps REST API with the runtime's built-in `fetch`.
|
|
|
400
402
|
Install the npm package with OpenCode's plugin manager:
|
|
401
403
|
|
|
402
404
|
```sh
|
|
403
|
-
opencode plugin add opencode-azure-devops-pr-review@0.4.
|
|
405
|
+
opencode plugin add opencode-azure-devops-pr-review@0.4.2
|
|
404
406
|
```
|
|
405
407
|
|
|
406
408
|
The same release is also a versioned Git package, which needs Git but not the
|
|
407
409
|
npm registry:
|
|
408
410
|
|
|
409
411
|
```sh
|
|
410
|
-
opencode plugin add 'github:WTLAIB/opencode-azure-devops-pr-review-v2#v0.4.
|
|
412
|
+
opencode plugin add 'github:WTLAIB/opencode-azure-devops-pr-review-v2#v0.4.2'
|
|
411
413
|
```
|
|
412
414
|
|
|
413
415
|
Add only one of them. OpenCode 2.3.0 loads the plugin into a running OpenCode
|
|
@@ -421,7 +423,7 @@ To select another configuration file, use an absolute path in the host config:
|
|
|
421
423
|
```json
|
|
422
424
|
{
|
|
423
425
|
"plugins": [{
|
|
424
|
-
"package": "opencode-azure-devops-pr-review@0.4.
|
|
426
|
+
"package": "opencode-azure-devops-pr-review@0.4.2",
|
|
425
427
|
"options": { "settingsFile": "/absolute/path/to/azpr/settings.json" }
|
|
426
428
|
}]
|
|
427
429
|
}
|
|
@@ -446,7 +448,7 @@ For an entry that `opencode plugin add` created, add the new version and,
|
|
|
446
448
|
only when that succeeds, remove the previous one:
|
|
447
449
|
|
|
448
450
|
```sh
|
|
449
|
-
opencode plugin add opencode-azure-devops-pr-review@0.4.
|
|
451
|
+
opencode plugin add opencode-azure-devops-pr-review@0.4.2 &&
|
|
450
452
|
opencode plugin remove opencode-azure-devops-pr-review@PREVIOUS_VERSION
|
|
451
453
|
```
|
|
452
454
|
|
|
@@ -465,11 +467,20 @@ AZPR's commands disappear until the package is available and the service
|
|
|
465
467
|
restarts.
|
|
466
468
|
|
|
467
469
|
External settings, the PAT file and review records stay in place; a working
|
|
468
|
-
configuration needs no new `/pr-setup`.
|
|
470
|
+
configuration needs no new `/pr-setup`. Settings that a new version brings
|
|
471
|
+
are written into your settings file, at their defaults, when OpenCode first
|
|
472
|
+
loads that version: AZPR behaves as it did, and each new setting is in the
|
|
473
|
+
file for you to change. `/pr-check` then lists what was added. Your values
|
|
474
|
+
and their order stay, and the file is written with two-space indentation and
|
|
475
|
+
readable by its owner only (mode 600). A settings file that is a symbolic
|
|
476
|
+
link, or in a directory other users can write to, is left as it is, and
|
|
477
|
+
`/pr-check` names the settings it leaves out. To go back to an earlier
|
|
478
|
+
version afterwards, remove the settings that version does not know: it names
|
|
479
|
+
the first one (`Unknown setting settings.terminalPanel`) instead of starting. `opencode plugin list` should then
|
|
469
480
|
show a single `azpr` row with the new version (from 0.3.1, `/pr-check` names
|
|
470
481
|
it too); if it still shows the previous one, run `opencode service restart`.
|
|
471
482
|
Exact versions stay pinned, so `opencode plugin update` leaves them unchanged.
|
|
472
|
-
See the [0.4.
|
|
483
|
+
See the [0.4.2 release notes](docs/releases/v0.4.2.md) for what changed, the
|
|
473
484
|
[0.4.0 release notes](docs/releases/v0.4.0.md) for commands without review IDs and the
|
|
474
485
|
[0.2.0 release notes](docs/releases/v0.2.0.md) for automatic comments. A
|
|
475
486
|
preview follows each COMPLETE review unless `afterReview` says otherwise;
|
|
@@ -481,8 +492,8 @@ review command flag.
|
|
|
481
492
|
<details>
|
|
482
493
|
<summary>Source installation and replacement</summary>
|
|
483
494
|
|
|
484
|
-
Download the [v0.4.
|
|
485
|
-
and extract it, or check out tag `v0.4.
|
|
495
|
+
Download the [v0.4.2 source archive](https://github.com/WTLAIB/opencode-azure-devops-pr-review-v2/archive/refs/tags/v0.4.2.tar.gz)
|
|
496
|
+
and extract it, or check out tag `v0.4.2`. The installer needs POSIX `sh` and
|
|
486
497
|
Python 3's standard library. From that source directory:
|
|
487
498
|
|
|
488
499
|
```sh
|
|
@@ -508,7 +519,7 @@ sh install.sh --config-dir /absolute/path/to/v2-opencode-config --replace
|
|
|
508
519
|
### Manual copying without Git
|
|
509
520
|
|
|
510
521
|
Keep these relative paths under one source directory, then run its installer.
|
|
511
|
-
These **
|
|
522
|
+
These **34 files** include the runtime and its license:
|
|
512
523
|
|
|
513
524
|
<details>
|
|
514
525
|
<summary>Show the required files</summary>
|
|
@@ -537,6 +548,8 @@ src/search.mjs
|
|
|
537
548
|
src/review-tools.mjs
|
|
538
549
|
src/review-work.mjs
|
|
539
550
|
src/store.mjs
|
|
551
|
+
src/tui-model.mjs
|
|
552
|
+
src/tui.js
|
|
540
553
|
src/prompts/common.md
|
|
541
554
|
src/prompts/functional.md
|
|
542
555
|
src/prompts/risk.md
|
|
@@ -557,7 +570,9 @@ Keep `LICENSE` with copied or redistributed packages.
|
|
|
557
570
|
|
|
558
571
|
Run `/pr-setup` to see the active settings path. Native packages use the
|
|
559
572
|
external configuration described above; source installations retain their
|
|
560
|
-
installed `plugins/azpr-v2/settings.json`.
|
|
573
|
+
installed `plugins/azpr-v2/settings.json`. The file names every setting, each
|
|
574
|
+
at its default until you change it (see
|
|
575
|
+
[all settings](#all-settings-and-defaults)). Edit that file and restart the
|
|
561
576
|
OpenCode service (`opencode service restart`, or your own `opencode serve`
|
|
562
577
|
process). A changed file blocks new commands until the restart; running
|
|
563
578
|
commands keep the settings they started with.
|
|
@@ -684,6 +699,7 @@ copies that different reviewers get can each produce a finding.
|
|
|
684
699
|
| `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
700
|
| `progressNotices` | `true`: short PROGRESS notices in the invoking conversation. |
|
|
686
701
|
| `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. |
|
|
702
|
+
| `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
703
|
| `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
704
|
| `azure.organization` | Required. The `<org>` of `https://dev.azure.com/<org>`; PR URLs of other organizations are refused. |
|
|
689
705
|
| `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. |
|
|
@@ -810,8 +826,55 @@ publication follows (see [automatic comments](#automatic-comments)).
|
|
|
810
826
|
|
|
811
827
|
A failed final version recheck adds a warning; it does not by itself prevent
|
|
812
828
|
COMPLETE in any review mode. Read the receipt warnings. Publication separately
|
|
813
|
-
rechecks that the PR
|
|
814
|
-
|
|
829
|
+
rechecks that the PR's source commit is unchanged before posting.
|
|
830
|
+
|
|
831
|
+
In OpenCode's terminal UI, `/pr-panel` shows or hides the
|
|
832
|
+
[terminal panel](#terminal-panel); it runs no model and makes no Azure DevOps
|
|
833
|
+
request.
|
|
834
|
+
|
|
835
|
+
## Terminal panel
|
|
836
|
+
|
|
837
|
+
OpenCode shows what a plugin tells a conversation as plain text, so a report
|
|
838
|
+
or a comment preview appears there as Markdown source. In OpenCode's terminal
|
|
839
|
+
UI, AZPR therefore adds a panel beside the conversation: it shows the newest
|
|
840
|
+
report or preview rendered, and lists the sessions of the review so that you
|
|
841
|
+
can open one. The [recording of a real review](docs/DEMO.md#the-terminal-panel)
|
|
842
|
+
shows both side by side.
|
|
843
|
+
|
|
844
|
+
- **It opens by itself** when a review or a comment run starts and when a
|
|
845
|
+
report or preview arrives, in the conversation that is on screen. The
|
|
846
|
+
keyboard stays with the prompt, so the next command can be typed while the
|
|
847
|
+
report is in view. To have it open only when you ask, set `terminalPanel`
|
|
848
|
+
in the [settings](#all-settings-and-defaults):
|
|
849
|
+
|
|
850
|
+
```json
|
|
851
|
+
"terminalPanel": "manual"
|
|
852
|
+
```
|
|
853
|
+
|
|
854
|
+
- **Sessions.** While a review runs, each of its sessions is a row with its
|
|
855
|
+
state. Click a row to open that session; OpenCode opens it in a tab, and the
|
|
856
|
+
panel is there again when you return to the conversation. After the review
|
|
857
|
+
the rows are the sessions that still exist (see
|
|
858
|
+
[retention](#retention-and-privacy)), first the one that holds the report.
|
|
859
|
+
OpenCode's own session list has them too.
|
|
860
|
+
- **Report or preview.** Below the sessions: the report of the review, then
|
|
861
|
+
the comment preview once one is planned, and the saved preview again after
|
|
862
|
+
`/pr-comment --show`. A check (`/pr-check`) shows its table there too.
|
|
863
|
+
- **Keys.** `/pr-panel` shows and hides the panel; it is the panel's only
|
|
864
|
+
command. A click inside it gives it the keyboard: the arrow keys or `j` and
|
|
865
|
+
`k`, Page Up and Page Down, Home and End scroll, and Escape or `q` closes
|
|
866
|
+
it.
|
|
867
|
+
- **A narrow terminal** (fewer than 108 columns) has no room for two panes,
|
|
868
|
+
and OpenCode would show the panel in place of the conversation. There the
|
|
869
|
+
panel does not open by itself; it says that something is ready, and
|
|
870
|
+
`/pr-panel` shows it full screen.
|
|
871
|
+
|
|
872
|
+
The panel only reads what AZPR already put into your conversation and into the
|
|
873
|
+
session that holds a report. It sends no prompt, starts no review and posts
|
|
874
|
+
nothing; `/pr-comment --publish` is still a command you type. It comes with
|
|
875
|
+
the package and needs no setup; `terminalPanel` is its one setting. Other
|
|
876
|
+
OpenCode clients, such as the desktop app, do not load it and show AZPR's
|
|
877
|
+
notices as before.
|
|
815
878
|
|
|
816
879
|
## Comments
|
|
817
880
|
|
|
@@ -927,15 +990,18 @@ When every finding is already discussed on the PR, typically by AZPR's own
|
|
|
927
990
|
comment from an earlier run, there is nothing new to post: the receipt says
|
|
928
991
|
`NOTHING_TO_POST` and the plan is saved (the summary's marker follows the
|
|
929
992
|
inline comments, so re-reviewing an unchanged PR would otherwise add a summary
|
|
930
|
-
each time). Publication itself still rechecks that the PR
|
|
993
|
+
each time). Publication itself still rechecks that the PR's source commit is
|
|
931
994
|
unchanged. A command you type, such as `/pr-comment --publish`, posts
|
|
932
995
|
every item of the saved preview, held ones included.
|
|
933
996
|
|
|
934
997
|
### Publication
|
|
935
998
|
|
|
936
|
-
Publication is runtime code: it refuses
|
|
937
|
-
|
|
938
|
-
|
|
999
|
+
Publication is runtime code: it refuses a changed source commit, lists every
|
|
1000
|
+
existing thread, skips items whose hidden marker already exists, creates the
|
|
1001
|
+
rest with the exact saved text, and reads the markers back. The PR's status
|
|
1002
|
+
stops nothing: a PR that was completed or abandoned, such as one merged before
|
|
1003
|
+
its review was commented on, is reviewed and takes comments like an active
|
|
1004
|
+
one, and the receipt names that status.
|
|
939
1005
|
Markers are stable fingerprints of PR, file and anchored lines, so a later
|
|
940
1006
|
review of unchanged code does not post duplicates. A failed or uncertain item can
|
|
941
1007
|
simply be published again; a comment someone deleted on the PR is reported as
|
|
@@ -966,6 +1032,9 @@ every later run. While debug is enabled every session is kept until its
|
|
|
966
1032
|
review is evicted, so turn `debug.enabled` off for everyday use if the list
|
|
967
1033
|
gets long. A review that an OpenCode restart interrupts leaves its sessions in
|
|
968
1034
|
the list; delete those yourself. Your own conversations are never deleted.
|
|
1035
|
+
In the terminal UI you need not look for these sessions in the list: the
|
|
1036
|
+
[terminal panel](#terminal-panel) names those of the latest review and opens
|
|
1037
|
+
the one you click.
|
|
969
1038
|
|
|
970
1039
|
## Development and removal
|
|
971
1040
|
|
|
@@ -974,6 +1043,7 @@ See [Contributing](CONTRIBUTING.md) for bug reports and development checks,
|
|
|
974
1043
|
[code of conduct](CODE_OF_CONDUCT.md) for community conduct.
|
|
975
1044
|
|
|
976
1045
|
```sh
|
|
1046
|
+
npm ci
|
|
977
1047
|
npm run check
|
|
978
1048
|
npm test
|
|
979
1049
|
node tests/host-v2-smoke.mjs /absolute/path/to/opencode
|
|
@@ -981,18 +1051,29 @@ node tests/host-v2-smoke.mjs /absolute/path/to/opencode --replace
|
|
|
981
1051
|
node tests/host-v2-smoke.mjs /absolute/path/to/opencode --native
|
|
982
1052
|
node tests/host-v2-comment-scale.mjs /absolute/path/to/opencode
|
|
983
1053
|
node tests/host-v2-background-compaction.mjs /absolute/path/to/opencode
|
|
1054
|
+
node tests/host-v2-comment-scale.mjs /absolute/path/to/opencode --cleanup
|
|
1055
|
+
node tests/host-v2-background-compaction.mjs /absolute/path/to/opencode --cleanup
|
|
1056
|
+
node tests/host-v2-tui-panel.mjs /absolute/path/to/opencode
|
|
1057
|
+
node tests/host-v2-tui-panel.mjs /absolute/path/to/opencode --native
|
|
984
1058
|
sh uninstall.sh --config-dir /absolute/path/to/v2-opencode-config
|
|
985
1059
|
sh uninstall.sh --config-dir /absolute/path/to/v2-opencode-config --apply
|
|
986
1060
|
```
|
|
987
1061
|
|
|
988
1062
|
The host fixtures run a real OpenCode binary with a loopback fake model provider
|
|
989
1063
|
and a loopback fake Azure DevOps REST service in disposable directories under
|
|
990
|
-
`.local/`.
|
|
1064
|
+
`.local/`. They keep debug on to read its records, and debug keeps every
|
|
1065
|
+
private session; the two `--cleanup` runs turn it off, so that each run deletes
|
|
1066
|
+
its sessions as an installation with default settings does. The two
|
|
1067
|
+
`host-v2-tui-panel` runs drive the real terminal UI in `tmux`, which they need,
|
|
1068
|
+
once installed from source and once as OpenCode's plugin manager installs the
|
|
1069
|
+
package. `npm ci` installs the compiler of the terminal panel's JSX, which only
|
|
1070
|
+
`npm run check` and `npm run build:tui` use; the installed plugin has no
|
|
1071
|
+
dependency and is not built on your machine.
|
|
991
1072
|
Uninstall without `--apply` previews; `--apply` archives only this package under
|
|
992
1073
|
`azpr-v2-backups` and leaves the private state directory for you to delete.
|
|
993
1074
|
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.
|
|
1075
|
+
`opencode plugin remove opencode-azure-devops-pr-review@0.4.2` or
|
|
1076
|
+
`opencode plugin remove 'github:WTLAIB/opencode-azure-devops-pr-review-v2#v0.4.2'`;
|
|
996
1077
|
the external settings, PAT file and private review state remain available.
|
|
997
1078
|
|
|
998
1079
|
[Architecture](docs/ARCHITECTURE.md), [commenting](docs/COMMENTING.md),
|
|
@@ -1005,7 +1086,7 @@ or personal model selections.
|
|
|
1005
1086
|
## License and releases
|
|
1006
1087
|
|
|
1007
1088
|
[MIT](LICENSE), copyright 2026 WTLAIB. See the [changelog](CHANGELOG.md) for the
|
|
1008
|
-
release scope, [v0.4.
|
|
1089
|
+
release scope, [v0.4.2](https://github.com/WTLAIB/opencode-azure-devops-pr-review-v2/releases/tag/v0.4.2)
|
|
1009
1090
|
for downloads, the [npm package](https://www.npmjs.com/package/opencode-azure-devops-pr-review),
|
|
1010
1091
|
[v0.2.0](https://github.com/WTLAIB/opencode-azure-devops-pr-review-v2/releases/tag/v0.2.0)
|
|
1011
1092
|
for the recorded demonstration, and [releasing](docs/RELEASING.md) for the
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-azure-devops-pr-review",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
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": {
|
|
7
7
|
"test": "node --test tests/*.test.mjs",
|
|
8
|
-
"check": "node --check src/session.mjs && node --check src/runtime.mjs && node --check src/comment-data.mjs && node --check src/comment-work.mjs && node --check src/comments.mjs && node --check src/config.mjs && node --check src/output.mjs && node --check src/diagnostics.mjs && node --check src/attribution.mjs && node --check src/host.mjs && node --check src/tool-queue.mjs && node --check src/azure.mjs && node --check src/diff.mjs && node --check src/search.mjs && node --check src/review-tools.mjs && node --check src/review-work.mjs && node --check src/store.mjs && node --check src/plugin.js && node --check src/setup.mjs && node --check server.js && sh -n install.sh && sh -n uninstall.sh"
|
|
8
|
+
"check": "node --check src/session.mjs && node --check src/runtime.mjs && node --check src/comment-data.mjs && node --check src/comment-work.mjs && node --check src/comments.mjs && node --check src/config.mjs && node --check src/output.mjs && node --check src/diagnostics.mjs && node --check src/attribution.mjs && node --check src/host.mjs && node --check src/tool-queue.mjs && node --check src/azure.mjs && node --check src/diff.mjs && node --check src/search.mjs && node --check src/review-tools.mjs && node --check src/review-work.mjs && node --check src/store.mjs && node --check src/plugin.js && node --check src/setup.mjs && node --check src/tui-model.mjs && node --check src/tui.js && node --check server.js && node --check scripts/build-tui.mjs && node scripts/build-tui.mjs --check && sh -n install.sh && sh -n uninstall.sh",
|
|
9
|
+
"build:tui": "node scripts/build-tui.mjs"
|
|
9
10
|
},
|
|
10
11
|
"engines": {
|
|
11
12
|
"node": ">=22.12.0"
|
|
@@ -30,7 +31,10 @@
|
|
|
30
31
|
"ai-code-review"
|
|
31
32
|
],
|
|
32
33
|
"license": "MIT",
|
|
33
|
-
"exports":
|
|
34
|
+
"exports": {
|
|
35
|
+
".": "./server.js",
|
|
36
|
+
"./tui": "./src/tui.js"
|
|
37
|
+
},
|
|
34
38
|
"files": [
|
|
35
39
|
"server.js",
|
|
36
40
|
"src/",
|
|
@@ -40,5 +44,9 @@
|
|
|
40
44
|
],
|
|
41
45
|
"publishConfig": {
|
|
42
46
|
"access": "public"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@babel/core": "7.29.7",
|
|
50
|
+
"babel-preset-solid": "1.9.16"
|
|
43
51
|
}
|
|
44
52
|
}
|
package/src/attribution.mjs
CHANGED
|
@@ -251,12 +251,26 @@ export function renderCheckReport(snapshot, checks, readiness) {
|
|
|
251
251
|
return `## Source readiness\n\n${snapshot ? `${snapshot.organization}/${snapshot.project}/${snapshot.repository} · PR #${snapshot.prId} · ${snapshot.status}${snapshot.title ? ` · "${snapshot.title}"` : ''}\n\n- head: \`${snapshot.head}\`\n- base: \`${snapshot.base}\`${snapshot.baseKind === 'target' ? ' (target branch tip; no merge base reported)' : ' (merge base)'}\n- changed files: ${snapshot.files.length} (${snapshot.filesComplete ? 'complete list' : 'partial list; reviewers will look for the rest'})\n\n` : ''}| Check | Result | Detail |\n| --- | --- | --- |\n${rows}${models}\n\nREADY means AZPR can read this PR through the Azure DevOps REST API with the configured PAT; it is not a review or an approval.`;
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
+
/**
|
|
255
|
+
* Text for the `<azpr_NAME_data>` block of a notice (`report` or `comment`). The block ends at its closing
|
|
256
|
+
* tag, so that tag must not occur in the text: it is written as `</azpr_NAME_data>`. Text that already
|
|
257
|
+
* holds that entity form, or one escaped further, gets one more level of `&`, so that nothing is
|
|
258
|
+
* ambiguous: a reader takes exactly one level off again and has the text as it was (the terminal panel does,
|
|
259
|
+
* see `disclose` in tui-model.mjs). Everything else is left as it is.
|
|
260
|
+
*/
|
|
261
|
+
export function enclose(name, text) {
|
|
262
|
+
const tag = `/azpr_${name}_data`;
|
|
263
|
+
return String(text ?? '').replace(new RegExp(`<${tag}>|&((?:amp;)*)lt;${tag}&((?:amp;)*)gt;`, 'g'),
|
|
264
|
+
(found, left, right) => (left === undefined ? `<${tag}>` : `&${left}lt;${tag}&${right}gt;`));
|
|
265
|
+
}
|
|
266
|
+
|
|
254
267
|
/** Publication ledger rows for receipts. */
|
|
255
268
|
export function renderPublication(review, result) {
|
|
256
269
|
const rows = [...(review.publication ?? new Map()).values()].map(entry =>
|
|
257
270
|
`- ${entry.kind === 'summary' ? 'PR summary' : `${(entry.findingIds ?? [entry.findingId]).join(', ')} (${entry.path}:${entry.startLine})`}: ${entry.state}${entry.threadId ? `; thread=${entry.threadId}` : ''}${entry.error ? `; error=${entry.error}` : ''}${entry.contentMismatch ? '; returned text differs' : ''}${entry.earlierText ? '; the PR keeps its earlier text' : ''}`).join('\n');
|
|
258
271
|
const counts = result?.counts ? Object.entries(result.counts).map(([state, count]) => `${state}=${count}`).join(', ') : '';
|
|
259
|
-
|
|
272
|
+
// A PR that is not active takes comments all the same; its status is named, so a wrong PR shows.
|
|
273
|
+
return `Publication${counts ? ` (${counts})` : ''}${result?.readBack && result.readBack !== 'complete' ? `; read-back ${result.readBack}` : ''}${result?.prStatus ? `; the PR is ${result.prStatus}` : ''}:\n${rows || '- Nothing recorded.'}\n\nPOSTED/VERIFIED entries were created by AZPR and VERIFIED ones were read back from Azure DevOps. ALREADY_PRESENT entries existed before this run. DELETED entries were created by AZPR and later deleted on the PR; AZPR does not post them again. FAILED entries are safe to retry with /pr-comment ${review.id} --publish; existing comments are skipped by their markers. UNVERIFIED entries were created but not found when read back; a re-run checks them again and never posts them twice. UNCERTAIN entries may still appear from an earlier attempt and are retried only after their marker check settles.`;
|
|
260
274
|
}
|
|
261
275
|
|
|
262
276
|
function renderStageReceipt(stage) {
|
|
@@ -313,7 +327,7 @@ export function renderReceipt(run, report, status, error, settings) {
|
|
|
313
327
|
if (last?.reportQueued) body += `\nReport delivery: report queued to session=${last.sessionID}.\n`;
|
|
314
328
|
else if (run.stages.length) body += '\nReport delivery: the report could not be queued to a review session; it is enclosed below.\n';
|
|
315
329
|
if (settings.returnReport === 'full' || run.draft || ['PARTIAL', 'INCOMPLETE', 'STALE'].includes(status) || !last?.reportQueued) {
|
|
316
|
-
body += `\nReport data:\n<azpr_report_data>\n${
|
|
330
|
+
body += `\nReport data:\n<azpr_report_data>\n${enclose('report', report)}\n</azpr_report_data>\n`;
|
|
317
331
|
}
|
|
318
332
|
}
|
|
319
333
|
if (['review', 'deep', 'quick'].includes(run.mode) && status === 'COMPLETE' && settings.returnReport !== 'full') body += '\n' + renderCommentActions(run.id, settings.outputLanguage, run.afterReview) + '\n';
|
package/src/comment-work.mjs
CHANGED
|
@@ -303,7 +303,9 @@ export const UNCERTAIN_SETTLE_MS = 15 * 60 * 1000;
|
|
|
303
303
|
|
|
304
304
|
/**
|
|
305
305
|
* Publish a saved plan with deterministic Azure DevOps calls.
|
|
306
|
-
* - Refuses if the PR
|
|
306
|
+
* - Refuses if the PR's source commit changed. The PR's status stops nothing: a
|
|
307
|
+
* completed or abandoned PR takes comments like an active one, and the
|
|
308
|
+
* result names such a status (`prStatus`) for the receipt.
|
|
307
309
|
* - Skips items whose marker already exists on the PR (idempotent re-runs).
|
|
308
310
|
* - Coordinates through `attempts` (per PR, shared by every review; not a
|
|
309
311
|
* lock between processes): an attempt is saved before its request and
|
|
@@ -323,7 +325,6 @@ export async function publishPlan({ run, review, azure, attempts, progress, pers
|
|
|
323
325
|
const items = publicationItems(review.plan).filter(item => !only || only.has(item.marker));
|
|
324
326
|
const ledger = review.publication ??= new Map();
|
|
325
327
|
const current = await azure.versions(run, review.snapshot);
|
|
326
|
-
if (current.status !== 'active') return { status: 'INCOMPLETE', reason: `The PR is ${current.status}; nothing was posted.` };
|
|
327
328
|
if (current.head !== review.snapshot.head) {
|
|
328
329
|
return { status: 'STALE', reason: `The PR source commit changed after the review (reviewed ${review.snapshot.head.slice(0, 12)}, current ${current.head.slice(0, 12)}). Run a new review before commenting.` };
|
|
329
330
|
}
|
|
@@ -413,6 +414,7 @@ export async function publishPlan({ run, review, azure, attempts, progress, pers
|
|
|
413
414
|
const uncertain = states.filter(state => state === 'UNCERTAIN').length;
|
|
414
415
|
const reason = halted || (uncertain ? `${uncertain} item(s) may still be created by an earlier attempt whose outcome is unknown; they are not posted again until their marker appears or ${Math.round(settleMs / 60000)} minutes have passed since that attempt. Run the same command again later.` : undefined);
|
|
415
416
|
const planned = new Set(items.map(item => item.marker));
|
|
416
|
-
return { status, readBack, ...(reason ? { reason } : {}),
|
|
417
|
+
return { status, readBack, ...(reason ? { reason } : {}), ...(current.status !== 'active' ? { prStatus: current.status } : {}),
|
|
418
|
+
counts: Object.fromEntries([...new Set(states)].map(state => [state, states.filter(s => s === state).length])),
|
|
417
419
|
...(compare ? { otherComments: [...present.keys()].filter(marker => !planned.has(marker)).length } : {}) };
|
|
418
420
|
}
|
package/src/config.mjs
CHANGED
|
@@ -110,13 +110,60 @@ export const AFTER_REVIEW = Object.freeze(['none', 'preview', 'publish']);
|
|
|
110
110
|
// The largest azure.archiveMegabytes: the repository zip for content search is held in memory.
|
|
111
111
|
export const MAX_ARCHIVE_MEGABYTES = 1024;
|
|
112
112
|
|
|
113
|
+
// Whether the panel in OpenCode's terminal UI opens by itself (a run starts, a report or preview arrives) or only with /pr-panel.
|
|
114
|
+
export const TERMINAL_PANEL = Object.freeze(['auto', 'manual']);
|
|
115
|
+
|
|
116
|
+
const deepFreeze = value => { for (const item of Object.values(value)) if (item !== null && typeof item === 'object') deepFreeze(item); return Object.freeze(value); };
|
|
117
|
+
/**
|
|
118
|
+
* Every setting that has a default, with it, in the order of config/settings.example.json. The review
|
|
119
|
+
* models and azure.organization have none: a person chooses them. Validation applies these values to
|
|
120
|
+
* what a settings file leaves out, and withMissingSettings writes them into the file.
|
|
121
|
+
*/
|
|
122
|
+
export const SETTING_DEFAULTS = deepFreeze({
|
|
123
|
+
models: { review: { rater: '' }, deep: { functional: '', risk: '', verifier: '', rater: '' }, quick: { reviewer: '' } },
|
|
124
|
+
enabled: true,
|
|
125
|
+
returnReport: 'receipt',
|
|
126
|
+
debug: { enabled: false, directory: '', keepRuns: 20 },
|
|
127
|
+
outputLanguage: 'en',
|
|
128
|
+
runTimeoutSeconds: null,
|
|
129
|
+
shell: 'deny',
|
|
130
|
+
progressNotices: true,
|
|
131
|
+
deletePrivateSessions: true,
|
|
132
|
+
terminalPanel: 'auto',
|
|
133
|
+
afterReview: { quick: 'preview', review: 'preview', deep: 'preview' },
|
|
134
|
+
azure: { pat: '', patFile: '', concurrency: 6, callTimeoutSeconds: 120, archiveMegabytes: 100, proxy: '', caFile: '', verifyTls: true },
|
|
135
|
+
workflow: { shardFiles: 25, shardFindings: 15, parallelSessions: 8, repairAttempts: 2, stageRetries: 1, stageIdleSeconds: 600 },
|
|
136
|
+
});
|
|
113
137
|
const DEFAULTS = Object.freeze({
|
|
114
|
-
afterReview:
|
|
115
|
-
azure: Object.freeze({ organization: '',
|
|
116
|
-
workflow:
|
|
138
|
+
afterReview: SETTING_DEFAULTS.afterReview,
|
|
139
|
+
azure: Object.freeze({ organization: '', ...SETTING_DEFAULTS.azure }),
|
|
140
|
+
workflow: SETTING_DEFAULTS.workflow,
|
|
117
141
|
});
|
|
118
142
|
const withDefault = (value, fallback) => value === undefined ? fallback : value;
|
|
119
143
|
const isObject = value => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* `raw` with every setting it leaves out, at its default: what validation assumes for them anyway, so
|
|
147
|
+
* the result behaves as `raw` does. Values that are there stay as they are, also where they are not
|
|
148
|
+
* what a default expects; new names follow the existing ones. Returns the settings and the names added.
|
|
149
|
+
*/
|
|
150
|
+
export function withMissingSettings(raw) {
|
|
151
|
+
const added = [];
|
|
152
|
+
const copy = value => isObject(value) ? Object.fromEntries(Object.entries(value).map(([key, item]) => [key, copy(item)])) : value;
|
|
153
|
+
const fill = (existing, defaults, prefix) => {
|
|
154
|
+
const result = { ...existing };
|
|
155
|
+
for (const [key, value] of Object.entries(defaults)) {
|
|
156
|
+
// A group added as a whole is named once, not once per value in it.
|
|
157
|
+
if (!Object.hasOwn(result, key)) { result[key] = copy(value); added.push(prefix + key); }
|
|
158
|
+
else if (isObject(value) && isObject(result[key])) result[key] = fill(result[key], value, `${prefix}${key}.`);
|
|
159
|
+
}
|
|
160
|
+
return result;
|
|
161
|
+
};
|
|
162
|
+
return { settings: fill(raw, SETTING_DEFAULTS, ''), added };
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** A settings file as AZPR writes it: the text setup saves and the one a completed file has. */
|
|
166
|
+
export const settingsText = settings => JSON.stringify(settings, null, 2) + '\n';
|
|
120
167
|
function keys(value, allowed, at) {
|
|
121
168
|
if (!isObject(value)) throw new Error(`${at} must be a JSON object.`);
|
|
122
169
|
// Name an unknown key only when it looks like a setting name: a long one may be a pasted secret.
|
|
@@ -160,7 +207,7 @@ export function validateSettings(raw) {
|
|
|
160
207
|
throw new Error('settings.mcp is no longer used: AZPR calls the Azure DevOps REST API itself. Move concurrency and callTimeoutSeconds to azure, set azure.organization and azure.patFile (or azure.pat), and remove mcp.');
|
|
161
208
|
}
|
|
162
209
|
keys(raw, ['$schema', 'version', 'enabled', 'models', 'debug', 'outputLanguage', 'returnReport', 'runTimeoutSeconds',
|
|
163
|
-
'shell', 'progressNotices', 'deletePrivateSessions', 'afterReview', 'azure', 'workflow'], 'settings');
|
|
210
|
+
'shell', 'progressNotices', 'deletePrivateSessions', 'terminalPanel', 'afterReview', 'azure', 'workflow'], 'settings');
|
|
164
211
|
if (raw.version !== 2) throw new Error('settings.version must be 2. Use the V2 settings example; older host layouts are not supported.');
|
|
165
212
|
if (raw.enabled !== undefined && typeof raw.enabled !== 'boolean') throw new Error('enabled must be boolean.');
|
|
166
213
|
if (raw.$schema !== undefined && typeof raw.$schema !== 'string') throw new Error('$schema must be a string.');
|
|
@@ -183,24 +230,26 @@ export function validateSettings(raw) {
|
|
|
183
230
|
}
|
|
184
231
|
// The optional rater does not count: deep mode is on when its three review roles are set.
|
|
185
232
|
const deepConfigured = MODEL_SLOTS.deep.filter(slot => models.deep[slot]).length;
|
|
186
|
-
const returnReport = withDefault(raw.returnReport,
|
|
233
|
+
const returnReport = withDefault(raw.returnReport, SETTING_DEFAULTS.returnReport);
|
|
187
234
|
if (!['receipt', 'full'].includes(returnReport)) throw new Error('returnReport must be receipt or full.');
|
|
188
|
-
const outputLanguage = languageTag(raw.outputLanguage
|
|
189
|
-
const debug = raw.debug === undefined ? { enabled:
|
|
235
|
+
const outputLanguage = languageTag(withDefault(raw.outputLanguage, SETTING_DEFAULTS.outputLanguage));
|
|
236
|
+
const debug = raw.debug === undefined ? { enabled: SETTING_DEFAULTS.debug.enabled, directory: SETTING_DEFAULTS.debug.directory } : raw.debug;
|
|
190
237
|
keys(debug, ['enabled', 'directory', 'keepRuns'], 'debug');
|
|
191
238
|
if (typeof debug.enabled !== 'boolean' || (debug.directory !== undefined &&
|
|
192
239
|
(typeof debug.directory !== 'string' || /[\0\r\n]/.test(debug.directory) || debug.directory.startsWith('~')))) throw new Error('debug requires enabled (boolean) and an optional directory path; use an absolute path or a project-relative path, not ~.');
|
|
193
|
-
const keepRuns = withDefault(debug.keepRuns,
|
|
240
|
+
const keepRuns = withDefault(debug.keepRuns, SETTING_DEFAULTS.debug.keepRuns);
|
|
194
241
|
integer(keepRuns, 'debug.keepRuns', 0, 1000);
|
|
195
|
-
const runTimeoutSeconds = withDefault(raw.runTimeoutSeconds,
|
|
242
|
+
const runTimeoutSeconds = withDefault(raw.runTimeoutSeconds, SETTING_DEFAULTS.runTimeoutSeconds);
|
|
196
243
|
if (runTimeoutSeconds !== null) integer(runTimeoutSeconds, 'runTimeoutSeconds', 10, 7200);
|
|
197
|
-
const shell = withDefault(raw.shell,
|
|
244
|
+
const shell = withDefault(raw.shell, SETTING_DEFAULTS.shell);
|
|
198
245
|
if (!SHELL_MODES.includes(shell)) throw new Error('shell must be deny, ask or inherit.');
|
|
199
|
-
const progressNotices = withDefault(raw.progressNotices,
|
|
246
|
+
const progressNotices = withDefault(raw.progressNotices, SETTING_DEFAULTS.progressNotices);
|
|
200
247
|
if (typeof progressNotices !== 'boolean') throw new Error('progressNotices must be boolean.');
|
|
201
|
-
const deletePrivateSessions = withDefault(raw.deletePrivateSessions,
|
|
248
|
+
const deletePrivateSessions = withDefault(raw.deletePrivateSessions, SETTING_DEFAULTS.deletePrivateSessions);
|
|
202
249
|
if (typeof deletePrivateSessions !== 'boolean') throw new Error('deletePrivateSessions must be boolean.');
|
|
203
|
-
|
|
250
|
+
const terminalPanel = withDefault(raw.terminalPanel, SETTING_DEFAULTS.terminalPanel);
|
|
251
|
+
if (!TERMINAL_PANEL.includes(terminalPanel)) throw new Error('terminalPanel must be auto or manual.');
|
|
252
|
+
// A mode left out has the default.
|
|
204
253
|
const afterReview = { ...DEFAULTS.afterReview, ...(raw.afterReview === undefined ? {} : (keys(raw.afterReview, MODES, 'afterReview'), raw.afterReview)) };
|
|
205
254
|
for (const mode of MODES) if (!AFTER_REVIEW.includes(afterReview[mode])) throw new Error(`afterReview.${mode} must be none, preview or publish.`);
|
|
206
255
|
const azure = { ...DEFAULTS.azure, ...(raw.azure === undefined ? {} : (keys(raw.azure, Object.keys(DEFAULTS.azure), 'azure'), raw.azure)) };
|
|
@@ -233,7 +282,7 @@ export function validateSettings(raw) {
|
|
|
233
282
|
const idle = workflow.stageIdleSeconds;
|
|
234
283
|
if (idle !== 0 && (!Number.isInteger(idle) || idle < 60 || idle > 7200)) throw new Error('workflow.stageIdleSeconds must be 0 (off) or an integer from 60 to 7200.');
|
|
235
284
|
return { models, debug: { enabled: debug.enabled, directory: debug.directory ?? '', keepRuns },
|
|
236
|
-
enabled: raw.enabled !== false, outputLanguage, returnReport, runTimeoutSeconds, shell, progressNotices, deletePrivateSessions, afterReview, azure, workflow,
|
|
285
|
+
enabled: raw.enabled !== false, outputLanguage, returnReport, runTimeoutSeconds, shell, progressNotices, deletePrivateSessions, terminalPanel, afterReview, azure, workflow,
|
|
237
286
|
deepReady: deepConfigured === MODEL_SLOTS.deep.length,
|
|
238
287
|
deepPartial: deepConfigured > 0 && deepConfigured < MODEL_SLOTS.deep.length,
|
|
239
288
|
quickReady: models.quick.reviewer !== '' };
|