Skip to content

v0.4.2 — A terminal panel for reports and previews

Latest

Choose a tag to compare

@WTLAIB WTLAIB released this 17 Nov 00:14
· 2 commits to main since this release
8e1fcb4

Azure DevOps PR Review for OpenCode — 0.4.2

This release adds a panel to OpenCode's terminal UI. OpenCode shows what a
plugin tells a conversation as plain text, so AZPR's report and comment
preview appeared as Markdown source, and since 0.4.1 a reviewer session had to
be picked from OpenCode's session list. The panel shows the newest report or
preview rendered and lists the sessions of the review, each a click away.

Two smaller changes come with it. A PR that was completed or abandoned, such
as one merged before its review was commented on, now takes comments like an
active one. And a new version writes the settings it brings into your settings
file, at their defaults, so each is there to change.

The reviewer, verifier and comment-planning instructions are those of 0.4.1.
One setting is new: terminalPanel.

What changed

  • The report and the preview are rendered. A panel beside the conversation
    shows the newest report or comment preview with headings, emphasis, lists,
    code and tables. The report of a review is followed by the preview once one
    is planned, and by the saved preview again after /pr-comment --show. A
    check's table is shown there too.

  • The review's sessions are in the panel. While a review runs, each of its
    sessions is a row with its state. Afterwards the rows are the sessions that
    still exist, first the one that holds the report. Click a row to open that
    session; OpenCode opens it in a tab, and the panel is there again when you
    return to the conversation.

  • It opens by itself and leaves the keyboard with the prompt. The panel
    opens when a review or a comment run starts and when a report or preview
    arrives, in the conversation on screen, so the next command can be typed
    while the report is in view. /pr-panel, its only command, shows and hides
    it. To have it open only when you ask, set this in AZPR's settings and
    restart the OpenCode service:

    "terminalPanel": "manual"
  • Keys. A click inside the panel gives it the keyboard: the arrow keys or
    j and k, Page Up and Page Down, Home and End scroll, and Escape or q
    closes it.

  • A narrow terminal is left alone. With fewer than 108 columns OpenCode
    shows a panel in place of the conversation. There the panel does not open by
    itself; it says that something is ready, and /pr-panel shows it full
    screen.

  • The panel only reads. It reads AZPR's notices in the conversation, the
    report queued to the review's session, and which sessions belong to the run.
    It sends no prompt, starts no review and posts nothing; /pr-comment --publish is still a command you type.

The panel is part of OpenCode's terminal UI. Other clients, such as the
desktop app, do not load it and show AZPR's notices as before. The
README
describes it.

  • Comments on a completed or abandoned PR. /pr-comment --publish refused
    a PR that was no longer active, so a PR merged before its review was
    commented on could be reviewed but not commented on. The PR's status no
    longer stops a publication, typed or automatic, and the receipt names it
    (Publication (VERIFIED=3); the PR is completed:). A changed source commit
    is still refused, and nothing is posted twice. /pr-check shows such a PR
    with a WARNING instead of NOT_READY.
  • New settings arrive in your settings file. When OpenCode first loads a
    version that brings a setting, AZPR writes it into your settings file at
    its default; until now only a source installation did. The defaults written
    are the ones that applied anyway, so AZPR behaves as before. Your values
    and their order stay, the file is written with two-space indentation and
    readable by its owner only (mode 600), and /pr-check lists what was
    added. A settings file that is a symbolic link, invalid or switched off
    is left as it is, and /pr-check then names the settings it leaves out.
    The first load of 0.4.2 adds terminalPanel and, to a file /pr-setup
    wrote, the other settings it had left at their defaults. Going back to an
    earlier version afterwards needs one edit: remove terminalPanel from the
    settings file, since earlier versions refuse a setting they do not know.

Installation

opencode plugin add opencode-azure-devops-pr-review@0.4.2

Alternatively, install the same release from Git:

opencode plugin add 'github:WTLAIB/opencode-azure-devops-pr-review-v2#v0.4.2'

Add only one of them. Follow the
quickstart
for a private PAT file, /pr-setup, a service restart and the first review.
The panel needs no setup.

Upgrading AZPR

For an entry that opencode plugin add created, add 0.4.2 and remove the
previous version only when the download succeeded. Replace PREVIOUS_VERSION
with the version in your plugins entry, such as 0.4.1:

opencode plugin add opencode-azure-devops-pr-review@0.4.2 &&
  opencode plugin remove opencode-azure-devops-pr-review@PREVIOUS_VERSION

Run them when no AZPR command is running. Running only the first command
leaves the previous version running. For an entry with options, change only
its package value; the OpenCode service then downloads 0.4.2 with its own
network settings. See
upgrading
for the details. External settings, the PAT file and review records remain in
place, and no setting is required: 0.4.2 writes terminalPanel and any other
setting your file leaves out into it, at their defaults. Start the terminal UI
again afterwards: it loads a plugin's terminal part when it starts.

For a source installation, extract the new archive and run its installer with
--replace to retain settings:

sh install.sh --config-dir /absolute/path/to/v2-opencode-config --replace

Manual copying needs two more files than 0.4.1, src/tui-model.mjs and
src/tui.js: 34 in all.

Compatibility and validation

The tested target is OpenCode CLI 2.3.0 (V2 plugin API), Node.js
22.23.3, Ubuntu 22.04.5 under WSL2, and Azure DevOps Services REST API
7.1. OpenCode 1.x and Azure DevOps Server are not supported; other operating
systems remain unvalidated.

The prompts under src/prompts are those of 0.4.1, so reviews run, find and
verify as before. The
validation record
lists the offline checks and the checks in the real terminal UI with fake
services, for a source installation and for the package as OpenCode's plugin
manager installs it. One live review with a real model ran on the candidate
with the panel open; the
demonstration
is an edit of its recording.

OpenCode 2.3.0 does not compile the JSX of a package it installed; OpenTUI
0.9.0 restores that, and OpenCode has not shipped it yet. The package
therefore carries the panel's view compiled, next to its source. It still has
no npm dependencies or install scripts, and nothing is built at installation.

The npm package, Git package and source archive contain the same runtime; the
source archive also contains the documentation, installers and settings
example. The release source artifact is
opencode-azure-devops-pr-review-v2-0.4.2.tar.gz, with checksums in SHA256SUMS.