opencode-azure-devops-pr-review 0.3.1 → 0.3.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.
Files changed (48) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +122 -80
  3. package/package.json +2 -11
  4. package/src/attribution.mjs +2 -2
  5. package/AGENTS.md +0 -164
  6. package/CODE_OF_CONDUCT.md +0 -83
  7. package/CONTRIBUTING.md +0 -84
  8. package/SECURITY.md +0 -38
  9. package/config/settings.example.json +0 -55
  10. package/config/settings.schema.json +0 -316
  11. package/docs/ARCHITECTURE.md +0 -414
  12. package/docs/AZURE_DEVOPS.md +0 -217
  13. package/docs/COMMENTING.md +0 -399
  14. package/docs/DEBUGGING.md +0 -146
  15. package/docs/DEMO.md +0 -195
  16. package/docs/ENTERPRISE.md +0 -236
  17. package/docs/QUICKSTART.md +0 -238
  18. package/docs/RELEASING.md +0 -95
  19. package/docs/ROADMAP.md +0 -241
  20. package/docs/VALIDATION.md +0 -2127
  21. package/docs/VALIDATION_HISTORY.md +0 -1845
  22. package/docs/VERIFICATION.md +0 -42
  23. package/docs/assets/RECORDING.md +0 -131
  24. package/docs/assets/adjust-findings-teaser.gif +0 -0
  25. package/docs/assets/adjust-preview.png +0 -0
  26. package/docs/assets/adjust-publication.png +0 -0
  27. package/docs/assets/example-comments.md +0 -38
  28. package/docs/assets/generate-demo-gif.py +0 -25
  29. package/docs/assets/generate-demo.mjs +0 -141
  30. package/docs/assets/live-azure-readback.png +0 -0
  31. package/docs/assets/live-preview.png +0 -0
  32. package/docs/assets/live-review-teaser.gif +0 -0
  33. package/docs/assets/live-review.png +0 -0
  34. package/docs/assets/quick-review-demo.gif +0 -0
  35. package/docs/assets/record-terminal.py +0 -124
  36. package/docs/assets/render-terminal-demo.py +0 -168
  37. package/docs/assets/review-example.svg +0 -1
  38. package/docs/assets/walkthrough.svg +0 -1
  39. package/docs/releases/v0.1.0.md +0 -74
  40. package/docs/releases/v0.2.0.md +0 -107
  41. package/docs/releases/v0.2.1.md +0 -65
  42. package/docs/releases/v0.2.2.md +0 -76
  43. package/docs/releases/v0.2.3.md +0 -93
  44. package/docs/releases/v0.3.0.md +0 -125
  45. package/docs/releases/v0.3.1.md +0 -87
  46. package/install.sh +0 -171
  47. package/scripts/merge-settings.py +0 -120
  48. package/uninstall.sh +0 -50
package/docs/DEMO.md DELETED
@@ -1,195 +0,0 @@
1
- # See a review before installing
2
-
3
- ## Adjust findings before publishing
4
-
5
- ![Real OpenCode terminal recording: a preview with three verified findings, the command that excludes F-3 and lowers F-2 to low, the new preview, and publication read back from Azure DevOps.](assets/adjust-findings-teaser.gif)
6
-
7
- The 15-second teaser uses a **real OpenCode 2.1.4 session, real configured
8
- model calls and real Azure DevOps publication** on the same dedicated test PR
9
- as the earlier recording below: one `fulfillment.py` file with three
10
- deliberately seeded regressions. It demonstrates the workflow; it is not a
11
- benchmark of review accuracy or a promise about the time or cost of another PR.
12
-
13
- Recorded on **2026-10-26**, on Ubuntu 22.04 under WSL2, using
14
- `openai/gpt-6-luna` for the functional reviewer, risk reviewer, verifier and
15
- comment planner. The installed plugin matched all 27 runtime and prompt files
16
- in public Git commit [`dfba561`](https://github.com/WTLAIB/opencode-azure-devops-pr-review-v2/commit/dfba561840c0d61be6f8fc2e921507da8bbcbb11)
17
- of the 0.3.0 release candidate. Model IDs identify the configured selection,
18
- not an independently attested provider backend.
19
-
20
- The recording follows one conversation:
21
-
22
- 1. `/pr-review <test-pr-url> --preview` completes the review in 66 seconds. The
23
- verifier confirms three medium findings and merges two duplicate candidates.
24
- The automatic preview, 14 seconds later, prepares a summary and three inline
25
- comments; nothing is posted.
26
- 2. `/pr-comment 63f7d3d6 --exclude F-3 --severity F-2=low` plans a new preview
27
- in 8 seconds. F-3 is left out, F-2 is listed as low in the summary with no
28
- inline comment, and the preview names both adjustments.
29
- 3. `/pr-comment 63f7d3d6 --publish` posts the summary and the F-1 comment; both
30
- are read back from Azure DevOps as `VERIFIED`.
31
- 4. Repeating the command reports `ALREADY_PRESENT=2`; nothing is posted twice.
32
- The two demonstration comments are retained on the test PR.
33
-
34
- ![Actual new preview after excluding F-3 and lowering F-2 to low: the adjustments, the summary counts and the index with F-1 as medium and F-2 as low.](assets/adjust-preview.png)
35
-
36
- ![Actual publication receipt: F-2 is skipped as a low finding, and the summary and the F-1 comment are read back as VERIFIED.](assets/adjust-publication.png)
37
-
38
- These are faithful rendered frames from one terminal capture, **not Azure
39
- DevOps browser screenshots**. Commands were submitted through OpenCode's native
40
- command API to the session shown in the attached TUI, so they appear as AZPR
41
- notices and segment captions rather than as typed input. The TUI sidebar was
42
- hidden before the segments shown, and the bottom seven rows (the empty input
43
- box with the conversation's chat model, and the status/path bar) are cropped.
44
- Segments that showed the local debug directory were left out. The original
45
- private cast is unchanged.
46
-
47
- ## Earlier recording: review, preview and publication
48
-
49
- [Watch the 73-second walkthrough (MP4)](https://github.com/WTLAIB/opencode-azure-devops-pr-review-v2/releases/download/v0.2.0/azpr-live-demo.mp4)
50
-
51
- ![Real OpenCode terminal recording: inspect an independently verified finding, preview its comment, and repeat publication without duplicate comments.](assets/live-review-teaser.gif)
52
-
53
- The 12-second teaser and full walkthrough use a **real OpenCode 2.1.2 session,
54
- real configured model calls, and real Azure DevOps publication**. The dedicated
55
- test PR changes one `fulfillment.py` file with three deliberately seeded
56
- regressions. It is a reproducible workflow demonstration, not a benchmark of
57
- review accuracy or a promise about the time or cost of another PR.
58
-
59
- Recorded on **2026-10-22**, on Ubuntu 22.04 under WSL2, using
60
- `openai/gpt-6-luna` for the functional reviewer, risk reviewer, verifier, and
61
- comment planner. The installed plugin matched all 27 runtime and prompt files
62
- in commit [`f323aaa`](https://github.com/WTLAIB/opencode-azure-devops-pr-review-v2/commit/f323aaab31e98da0ffed08a8f54fca94c7caf651),
63
- the v0.1.0 release candidate. Model IDs identify the configured selection, not
64
- an independently attested provider backend. The v0.2.0 release reuses this
65
- recording unchanged; it demonstrates the manual workflow, not the new automatic
66
- comment step.
67
-
68
- The recording follows one conversation:
69
-
70
- 1. `/pr-check <test-pr-url>` confirms access and model readiness.
71
- 2. `/pr-review <test-pr-url>` runs two reviewers and an independent verifier.
72
- The verifier confirms three findings and merges the three duplicate
73
- candidates from the other reviewer.
74
- 3. `/pr-comment 268cc3f3` prepares a summary and three inline comments. The
75
- receipt explicitly says that nothing was posted.
76
- 4. `/pr-comment 268cc3f3 --publish` creates four comments. Each is read back
77
- from Azure DevOps and reported as `VERIFIED`.
78
- 5. Repeating the publication command reports `ALREADY_PRESENT=4`. A separate
79
- Azure REST read confirms the same four active threads, with no extra
80
- comments. The successful demonstration comments are retained.
81
-
82
- Measured command durations were 64.95 seconds for review, 15.63 seconds for
83
- preview, 1.52 seconds for publication, and 0.51 seconds for repeated publication.
84
- The video includes reading pauses and cuts waiting and navigation time; its
85
- length is **not** a latency measurement.
86
-
87
- ### Inspect the actual output
88
-
89
- ![Actual OpenCode review: the verifier confirms that a shallow snapshot shares nested state, with source location, evidence, counterevidence and a correction.](assets/live-review.png)
90
-
91
- ![Actual comment preview: the shallow-copy finding includes a summary, evidence, suggested fix and AI disclosure before publication.](assets/live-preview.png)
92
-
93
- ![Actual Azure DevOps REST read-back: four active threads and the unchanged published shallow-copy comment.](assets/live-azure-readback.png)
94
-
95
- These are faithful rendered frames from terminal captures, **not Azure DevOps
96
- browser screenshots**. Commands were submitted through OpenCode's native
97
- command API to the same session shown in the attached TUI. The separate
98
- read-back clip executes an actual Azure DevOps GET and displays the returned
99
- comment; author details, deleted history and hidden publication markers are
100
- omitted, while the comment wording stays unchanged. The TUI frames preserve
101
- the displayed review text; only the bottom status/path row and its blank margin
102
- are cropped to avoid exposing the local workspace path. The original private
103
- cast is unchanged. Captions and the editing disclosure are outside the terminal
104
- content.
105
-
106
- No credential, provider configuration, or private reasoning is included in the
107
- published media. Raw recordings and connection files remain private. See the
108
- [capture and editing guide](assets/RECORDING.md) to reproduce this process, and
109
- [validation](VALIDATION.md) for the broader test evidence and limitations.
110
-
111
- ## Illustrative quick-review example
112
-
113
- The example below is an **illustrative example / synthetic PR**, not an Azure
114
- DevOps screenshot or an OpenCode session recording. A hand-written pagination
115
- defect shows the quick-review comment format. No live model was called and no
116
- Azure comment was published to make these illustrations; they are separate
117
- from the real verified review above.
118
-
119
- ### A short walkthrough
120
-
121
- The animation shows four steps, takes 21 seconds and plays twice. Its pacing is
122
- for reading; it does not measure review latency. Prefer no animation? Use the
123
- [static walkthrough](assets/walkthrough.svg) or the text below.
124
-
125
- ![Illustrative example / synthetic PR: check setup, run a quick review, preview comments, and optionally publish.](assets/quick-review-demo.gif)
126
-
127
- 1. **Check setup and PR access:** run `/pr-check <azure-pr-url>`, replacing the
128
- placeholder with a real PR you are authorized to review. The command checks
129
- PR, source and discussion access, plus plugin configuration and model
130
- readiness. Resolve errors and inspect warnings. This deterministic check
131
- does not call a review model.
132
- 2. **Review:** run `/pr-quick <azure-pr-url>` for the same PR in your OpenCode
133
- conversation.
134
- Wait for completion, then inspect findings and coverage gaps. Quick review
135
- uses one reviewer per shard, without an independent verifier. Findings are
136
- `REPORTED`, and verification is `none`; a session can make multiple model
137
- requests.
138
- 3. **Preview:** run `/pr-comment` in the same conversation. A model plans the
139
- inline comments and summary; the preview does not write to Azure. Read the
140
- proposed text and skips before deciding whether to publish.
141
- 4. **Publish only when ready:** `/pr-comment --publish` uses the saved preview.
142
- The runtime rechecks the PR, skips existing markers and writes the comments.
143
- Inspect the publication receipt for results. This optional step writes to
144
- Azure; it was not executed for this demo.
145
-
146
- The example is one small PR and one finding, not a promise about the number of
147
- sessions, requests, findings or cost for your PR. See [Commenting](COMMENTING.md)
148
- for publication details, retries, markers and their limits.
149
-
150
- ### What the comments look like
151
-
152
- ![Illustrative Azure DevOps-style layout: a medium pagination finding with Summary, Evidence and Suggested fix, followed by a PR summary index. Both show that quick review was not independently verified.](assets/review-example.svg)
153
-
154
- The layout, colors and spacing are illustrative. The comment text and summary
155
- index come from the project's comment-plan validator and renderer, supplied
156
- with a hand-written fixture. `example/model`, the repository, PR, code and
157
- finding are synthetic. The illustration simplifies formatting; read the
158
- [exact generated comment bodies](assets/example-comments.md) for accessible
159
- Markdown, including the disclosure and headings. Hidden publication markers
160
- are omitted from that document.
161
-
162
- The example code passes the page size as `Array.slice`'s end index. For page
163
- size 2 and offset 1, both the start and end are 2, yielding an empty array.
164
- The suggested change is `items.slice(start, start + size)`. This is a teaching
165
- example, not evidence of review accuracy. [Validation](VALIDATION.md) records
166
- actual tests and distinguishes simulated services from live runs.
167
-
168
- ### Reproduce these illustrations
169
-
170
- From the repository root, with Node.js 22.12 or later:
171
-
172
- ```sh
173
- node docs/assets/generate-demo.mjs
174
- ```
175
-
176
- This uses only Node.js and the existing source modules. It validates the
177
- synthetic plan, assembles the real comment text and regenerates
178
- `review-example.svg`, `walkthrough.svg` and `example-comments.md`. It makes no
179
- network requests, starts no model session and needs no credentials.
180
-
181
- Regenerating the optional GIF also needs existing installations of
182
- [Sharp](https://sharp.pixelplumbing.com/) for SVG rendering and
183
- [Pillow](https://pillow.readthedocs.io/) for GIF encoding. These are documentation
184
- tools, not plugin dependencies. With Sharp resolvable by Node and Pillow
185
- available in Python:
186
-
187
- ```sh
188
- node docs/assets/generate-demo.mjs --frames
189
- python3 docs/assets/generate-demo-gif.py
190
- ```
191
-
192
- For a separately installed Sharp package, set `AZPR_DEMO_SHARP` to its absolute
193
- package directory when running the first command. Intermediate PNGs go only to
194
- `.local/project-launch-demo-assets/`; they must not be committed. The checked-in
195
- SVG, GIF and Markdown files can be viewed without these optional tools.
@@ -1,236 +0,0 @@
1
- # Using AZPR with your team
2
-
3
- AZPR runs inside your OpenCode process and reads Azure DevOps Services directly.
4
- You choose the models in OpenCode; AZPR has no separate hosted review service or
5
- MCP dependency. Start with the [quickstart](QUICKSTART.md), then use
6
- this page to understand access, data flow and local retention before reviewing
7
- your team's repositories.
8
-
9
- The tested environment is **OpenCode V2 `@opencode/cli` 2.1.4 on Ubuntu
10
- 22.04**. Azure DevOps Server URLs are not supported. See
11
- [current validation](VALIDATION.md) for the distinction between isolated tests
12
- with fake services and runs against real Azure DevOps and model providers.
13
-
14
- ## Azure access and credentials
15
-
16
- Configure an organization-scoped PAT, preferably alone in a file that only its
17
- owner can read, named by `azure.patFile` in AZPR's settings (otherwise in
18
- `azure.pat`), alongside `azure.organization`. `/pr-setup` shows the active
19
- settings path: native packages use an external configuration file, while
20
- source installations keep `plugins/azpr-v2/settings.json`. Neither a package
21
- update nor removal deletes the native installation's external configuration.
22
- The recommended scopes are:
23
-
24
- | Scope | Used for |
25
- | --- | --- |
26
- | Code: Read (`vso.code`) | PR metadata, changes, commits, source files and repository archives. |
27
- | Pull Request Threads: Read & write (`vso.threads_full`) | Reading discussions and creating review comments. |
28
-
29
- These correspond to Microsoft's documented [source read](https://learn.microsoft.com/en-us/rest/api/azure/devops/git/items/get?view=azure-devops-rest-7.1#security)
30
- and [thread creation](https://learn.microsoft.com/en-us/rest/api/azure/devops/git/pull-request-threads/create?view=azure-devops-rest-7.1#security)
31
- scopes. A live check on 2026-10-21 confirmed that this combination covers
32
- every read AZPR makes, including repository archives, and thread creation (see
33
- [validation](VALIDATION.md#pat-scopes-and-azurepatfile-2026-10-21)).
34
- The PAT owner also needs access to the project and repository. AZPR does not
35
- need permission to push code or merge PRs.
36
-
37
- `/pr-check <PR URL>` makes read requests and checks configured models without
38
- calling a model. A successful check confirms read access, not permission to
39
- publish. Test publication separately on a suitable PR when you intend to post.
40
-
41
- AZPR's REST client uses the PAT only for the configured organization's
42
- `https://dev.azure.com/<organization>` endpoint, and refuses PR URLs for another
43
- organization. Credentials are not included in AZPR's model payloads or
44
- diagnostic settings. With `azure.patFile`, `settings.json` holds no secret:
45
- AZPR opens the PAT file without following symbolic links and refuses it unless
46
- it is a regular file owned by the OpenCode user with no group or other access,
47
- and it reads the file at start and before each command, so a replaced PAT
48
- needs a restart of the OpenCode service. The installer and `/pr-setup` create
49
- `settings.json` with mode `600`; source replacement preserves it, and native
50
- package updates do not write to it. Keep it outside shared profiles and Git,
51
- and restart the OpenCode service (`opencode service restart`) after changing
52
- it. A file only its owner can read protects the
53
- PAT from other accounts, not from programs that run as the same user (an
54
- agent's shell commands, for example), so keep the PAT's scopes minimal and its
55
- lifetime short, and keep it out of environment variables that child processes
56
- inherit. Only a PAT is supported (in `azure.pat` or `azure.patFile`); there is
57
- no Azure CLI, Entra token or environment-variable credential setting. See
58
- [Azure DevOps access](AZURE_DEVOPS.md).
59
-
60
- ## What the selected model receives
61
-
62
- The model connections use your existing OpenCode providers and authentication.
63
- Use providers whose data handling fits the repositories you review; AZPR does
64
- not control their retention or training policies.
65
-
66
- | Route | Data involved |
67
- | --- | --- |
68
- | Azure DevOps → AZPR runtime | PR identity and description, changed-file inventory, commit messages, discussions, source files at exact commits, and a repository archive when content search needs one. |
69
- | AZPR → selected models through OpenCode | PR context, assigned paths, commit messages for reviewers, supplementary text after the PR URL, tool results, findings and verification reports. Planning also receives source excerpts and existing-discussion digests, including author names and comment excerpts. |
70
- | AZPR runtime → Azure DevOps | Saved summary and inline comment text, including AI/model disclosure and anchors, only during publication you asked for: `/pr-comment --publish`, or automatic publication after a COMPLETE review when `afterReview` or the review command's `--publish` flag says so. |
71
-
72
- Reviewers can follow definitions, callers and tests outside the changed files.
73
- Content search downloads a repository archive into runtime memory, searches it
74
- locally, and returns bounded matches to the model; it does not upload the zip as
75
- a model attachment. Later tool reads can expose additional source. Source and
76
- discussion text are not automatically scrubbed for secrets before being used
77
- as model context.
78
-
79
- AZPR's six repository tools are read-only and bound to the review's repository.
80
- Private sessions also have native `read`, `glob` and `grep` for local files and
81
- AZPR's private data. Keep sensitive unrelated files out of the active project.
82
- With `permission.hook`, AZPR refuses native access outside that project except
83
- to its own state directory. Without the hook, `/pr-check` shows **Project
84
- boundary WARNING** while keeping reviews available; the host's permission
85
- rules then decide which paths native tools can reach. A READY result does not
86
- remove that warning.
87
-
88
- Keep `shell: "deny"` (the default) unless reviewers need commands.
89
- `shell: "ask"` requests approval; `"inherit"` follows host permissions. Allowed
90
- shell has real host authority and is not a sandbox. Native edit/write tools,
91
- web access, delegation and other MCP tools are excluded from private sessions.
92
- See [authorization and isolation](ARCHITECTURE.md#authorization-and-isolation).
93
-
94
- ## Preview, cost and publication
95
-
96
- Start in one OpenCode conversation with a small PR:
97
-
98
- ```text
99
- /pr-check <PR URL>
100
- /pr-quick <PR URL>
101
- /pr-comment
102
- ```
103
-
104
- `/pr-quick` runs one reviewer per shard and no independent verifier. Its
105
- findings are **reported, not verified**; inspect the coverage and limitations
106
- as well as the findings. Use `/pr-review` or `/pr-deep` when you want separate
107
- functional and risk reviewers followed by verification; `/pr-deep` runs the
108
- same review with the stronger models you set in `models.deep`, so its cost
109
- depends on those models. None of these commands
110
- posts to Azure DevOps by default. `afterReview` (per mode) or a flag after the
111
- PR URL can follow a COMPLETE review with a preview (`preview`, `--preview`) or
112
- with publication (`publish`, `--publish`); see
113
- [automatic comments](COMMENTING.md#automatic-comments-after-a-review).
114
-
115
- **Preview uses a model.** `/pr-comment` reads live discussions and plans the
116
- comments; each new preview replans and can incur provider charges. One session
117
- can contain several requests, and larger PRs, repairs, retries and overflow
118
- splits add work. `workflow.parallelSessions` controls concurrency, not a token
119
- or spending limit. There is no built-in monetary cap; `runTimeoutSeconds` is
120
- `null` by default, and `/pr-stop <run-id>` cancels a run. See
121
- [debugging](DEBUGGING.md#diagnosis-order) for provider-reported token usage.
122
-
123
- After inspecting a preview, explicitly publish the named review:
124
-
125
- ```text
126
- /pr-comment <review-id> --publish
127
- ```
128
-
129
- Teams that want comments without that step can set `afterReview` to `publish`
130
- for a mode, or add `--publish` after the PR URL for one review. Automatic
131
- publication posts under the PAT owner's identity without anyone reading the
132
- text first. It holds back, item by item, a comment whose text would notify
133
- people, load or run something when viewed, or hide text from readers: an
134
- `@<…>` mention, an image, HTML that embeds content, runs a script or hides
135
- text, or a `javascript:`, `vbscript:`, `data:` or `file://` link (script links
136
- and mentions also when encoded with escapes or character references, and
137
- script links also with a tab or line break inside, which a browser drops from
138
- a URL). Literal code is skipped where its reading is certain,
139
- except for mentions. Held items wait in the saved preview for a person; the
140
- others, ordinary web links included, are posted. A quick review's comments
141
- carry the disclosure that they were not independently verified; teams that
142
- want a person to read them first set `afterReview.quick` to `preview`.
143
- Automatic publication posts nothing for a review without findings to comment
144
- on, or when every finding is already discussed on the PR. `/pr-check` lists
145
- the `afterReview` setting of each mode and who posts. An automatic preview
146
- still uses a model.
147
-
148
- The runtime posts the saved preview, rechecks that the PR is active and its
149
- source commit is unchanged, and skips existing comment markers. If no preview
150
- is saved, `--publish` plans and publishes in the same command; run the preview
151
- first when you want to inspect the text. Publication uses the PAT owner's Azure
152
- identity. Models themselves have no Azure write tool. Repeating publication
153
- recovers partial results; avoid publishing the same PR concurrently from
154
- different OpenCode processes. See [commenting](COMMENTING.md).
155
-
156
- ## Local records and cleanup
157
-
158
- AZPR stores reviews, previews, publication ledgers and observed source under
159
- `${XDG_STATE_HOME:-~/.local/state}/opencode/azpr-v2/`, with owner-only permissions
160
- on the files and directories it creates. A relative `XDG_STATE_HOME` is ignored
161
- in favor of `~/.local/state`. If the normal state directory cannot be created,
162
- AZPR falls back to `azpr-v2-state-<uid>` in the system temporary directory;
163
- include that location when locating or removing records.
164
- The newest **20 completed reviews** are retained across restarts. This is a
165
- count limit, not an expiry period; a quiet installation can retain them
166
- indefinitely. Unreferenced scratch data becomes eligible for cleanup after
167
- 24 hours. Fallback receipts have a separate limit of 50. Publication recovery
168
- records under `attempts/` are separate; entries older than 90 days are ignored
169
- when accessed and removed when that PR's record is next rewritten.
170
-
171
- With `deletePrivateSessions: true` (default), AZPR requests deletion of its
172
- private review sessions when their completed review is evicted. An unfinished
173
- review normally keeps only its report/draft session, within a separate limit
174
- of 20 runs; diagnostics or an unconfirmed cancellation can retain all of that
175
- run's sessions. Deletion depends on host support and is best effort. Setting
176
- this option to `false` keeps the sessions. Your own conversations are never
177
- deleted by AZPR, and deleting local records does not delete provider records
178
- or published Azure comments.
179
-
180
- Diagnostics are off by default (`debug.enabled: false`). When enabled, they
181
- can include source, PR details, prompts, answers and secrets echoed in them.
182
- The default location is `…/opencode/azpr-v2-debug/`, separate from review state;
183
- `debug.directory` changes it and `debug.keepRuns` defaults to 20 (`0` keeps all).
184
- Inspect and redact records before sharing them. See [debugging](DEBUGGING.md).
185
- Uninstall archives the installed package, including its private settings, and
186
- leaves review state in place. To remove local copies, stop OpenCode and handle
187
- the installed settings/backups, state, diagnostics and OpenCode conversations
188
- according to your team's retention needs.
189
-
190
- ## Company networks
191
-
192
- Three kinds of connection leave your machine, and each is configured where it
193
- is made. Set up the first before `opencode plugin add`:
194
-
195
- | Connection | Made by | Configure |
196
- | --- | --- | --- |
197
- | Package download for `opencode plugin add` | The `opencode` command in your terminal | `HTTPS_PROXY` (and `HTTP_PROXY`, `NO_PROXY`) in that terminal, or `https-proxy` in your user `~/.npmrc`. OpenCode does not read a project's `.npmrc` or, by default, npm's global configuration. |
198
- | Package download when a changed `plugins` entry or a start finds a version that is not installed yet | The OpenCode background service | The service's environment, set with `opencode service set env` |
199
- | Model providers | The OpenCode background service | The service's environment, as in OpenCode's [network guide](https://opencode.ai/v2/docs/network) |
200
- | Azure DevOps | AZPR, inside the OpenCode service | `azure.proxy` and `azure.caFile` below; with an empty `azure.proxy`, the service environment's proxy variables apply |
201
-
202
- - When a terminal sets a proxy, keep `localhost,127.0.0.1,::1` in its
203
- `NO_PROXY`: the `opencode` command reaches the background service over the
204
- loopback interface. Keep your organization's existing exceptions too.
205
- - A variable set with `opencode service set env` applies when the service
206
- starts; setting one stops the running service, so start it again with
207
- `opencode service start`. Exports in a terminal do not change a service that
208
- is already running. Do not share the output of `opencode service get env`:
209
- it shows the values, including proxy credentials.
210
- - For a company CA, OpenCode reads a PEM file named by `NODE_EXTRA_CA_CERTS`
211
- (in the terminal, and in the service environment); see OpenCode's
212
- [network guide](https://opencode.ai/v2/docs/network). `azure.caFile` applies
213
- only to AZPR's Azure DevOps requests and cannot fix a package-download
214
- certificate error.
215
- - Keep TLS verification on. A failed package download leaves nothing changed
216
- when `opencode plugin add` makes it; when the service makes it, AZPR's
217
- commands disappear until the package is available and the service restarts
218
- (see [upgrading](../README.md#upgrading)).
219
-
220
- ### Azure DevOps requests
221
-
222
- The following settings affect **AZPR's Azure DevOps requests only**. Configure
223
- model-provider connectivity separately in the OpenCode environment.
224
-
225
- | Setting | Behavior |
226
- | --- | --- |
227
- | `azure.proxy` | Forward proxy URL; Basic proxy credentials may be percent-encoded in the URL. NTLM/Kerberos requires a separate local forwarder. |
228
- | `azure.caFile` | Absolute path to PEM CA certificates, added to the built-in trusted roots. Use this for your organization's TLS inspection CA. |
229
- | `azure.verifyTls` | Defaults to `true`. Disabling certificate verification exposes the PAT to intercepted connections and produces a `/pr-check` warning. |
230
-
231
- Restart the OpenCode service after changing transport settings or the CA file. These
232
- options depend on Bun's per-request transport support; an unsupported runtime
233
- refuses to load them. If `azure.proxy` is empty, process-wide proxy environment
234
- settings can still apply. A TLS-inspecting proxy can see the PAT and source
235
- traffic. See [proxies and TLS inspection](AZURE_DEVOPS.md#proxies-and-tls-inspection)
236
- for setup and connection troubleshooting.
@@ -1,238 +0,0 @@
1
- # Your first review
2
-
3
- This guide gets you from a clean installation to a private comment preview.
4
- Use a small, active Azure DevOps Services PR for the first run. Steps 1–3 and
5
- 5 run in a terminal; steps 4, 6 and 7 run in OpenCode.
6
-
7
- Already using an earlier version? Follow [upgrading](../README.md#upgrading)
8
- instead, to keep your configuration and one AZPR installation.
9
-
10
- ## 1. Check the prerequisites (terminal)
11
-
12
- - **OpenCode CLI 2.1.4** (`@opencode/cli`, V2 plugin API), tested on **Ubuntu
13
- 22.04.5 LTS (WSL2)**. Other host versions and operating systems are not
14
- validated; see [validation](VALIDATION.md). OpenCode 1.x is not supported.
15
- - An authenticated OpenCode model with tool support, and its exact
16
- `provider/model` ID from `opencode models` or your host's model selection.
17
- AZPR uses your existing provider account.
18
- - Your Azure DevOps organization (the `<org>` in `https://dev.azure.com/<org>`)
19
- and an organization-scoped PAT. The recommended scopes are **Code: Read** and
20
- **Pull Request Threads: Read & write**; see
21
- [access and validation limits](ENTERPRISE.md).
22
- - Access to the npm registry for the npm package, or Git for the Git package.
23
- AZPR has no build step or npm dependencies. Behind a company proxy, set up
24
- the terminal first: see [company networks](ENTERPRISE.md#company-networks).
25
-
26
- ```sh
27
- opencode --version
28
- opencode models
29
- ```
30
-
31
- ## 2. Save the PAT in a private file (terminal)
32
-
33
- Put the PAT alone in a file only you can read. The following **Bash** example
34
- creates a new file and refuses to overwrite an existing one. Input is hidden
35
- and is not added to shell history:
36
-
37
- ```sh
38
- AZPR_USER_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/azpr"
39
- mkdir -p "$AZPR_USER_DIR"
40
- (
41
- umask 077
42
- set -o noclobber
43
- read -rs -p 'Azure DevOps PAT: ' AZPR_PAT
44
- printf '\n'
45
- test -n "$AZPR_PAT" && printf '%s' "$AZPR_PAT" > "$AZPR_USER_DIR/pat"
46
- )
47
- printf 'PAT file: %s\n' "$AZPR_USER_DIR/pat"
48
- ```
49
-
50
- This is the default PAT file that `/pr-setup` uses. If the file already
51
- exists, reuse your existing owner-only PAT file, or choose another unused path
52
- and name it with `--pat-file` in step 4. Do not paste a PAT into a
53
- conversation or command argument.
54
-
55
- ## 3. Install the package (terminal)
56
-
57
- ```sh
58
- opencode plugin add opencode-azure-devops-pr-review@0.3.1
59
- ```
60
-
61
- This is the host's native package installation; no npm account or separate
62
- build is needed. OpenCode 2.1.4 loads the plugin into a running OpenCode
63
- service within a few seconds, and otherwise when OpenCode next starts. The
64
- plugin exposes `/pr-setup` even before its review configuration exists.
65
-
66
- To install the same release from Git instead of the npm registry, use
67
- `opencode plugin add 'github:WTLAIB/opencode-azure-devops-pr-review-v2#v0.3.1'`.
68
- Add only one of the two. For a source archive or an existing source
69
- installation, see [other installation methods](#other-installation-methods).
70
-
71
- ## 4. Configure one model and your Azure organization (OpenCode)
72
-
73
- Open OpenCode and start an ordinary conversation. If `/pr-setup` is not
74
- listed, run `opencode service restart` in your terminal and reopen OpenCode.
75
-
76
- Run `/pr-setup` alone to see the settings path, the default PAT file and the
77
- available model IDs. Then replace both placeholders in this command:
78
-
79
- ```text
80
- /pr-setup --organization YOUR_ORGANIZATION --model YOUR_PROVIDER/YOUR_MODEL
81
- ```
82
-
83
- Use the organization name from `https://dev.azure.com/<organization>`;
84
- `--organization` also accepts your PR's URL. Add
85
- `--pat-file "/absolute/path/to/pat"` when your PAT file is not the default one
86
- from step 2. The command checks the model catalog and the PAT file, then saves
87
- configuration with owner-only permissions. It makes no model request and does
88
- not contact Azure.
89
-
90
- One model selection configures the quick reviewer and all three review roles.
91
- `/pr-quick` still runs only its own reviewer; `/pr-review` uses separate reviewer
92
- and verifier sessions. Deep models remain unset until you choose stronger
93
- models for that mode. Setup preserves other settings when explicitly replacing
94
- an existing file with `--replace`, and then keeps the PAT file already set
95
- unless you name another one.
96
-
97
- Native installations save settings outside the package cache at
98
- `${XDG_CONFIG_HOME:-~/.config}/azpr/settings.json`. Source installations keep
99
- `plugins/azpr-v2/settings.json`; `/pr-setup` shows the exact path. An explicit
100
- `options.settingsFile` can select a different absolute path; see
101
- [configuration](../README.md#configuration).
102
-
103
- Make any other changes to that settings file now, before the restart in step 5:
104
- behind a company proxy, AZPR's Azure DevOps requests need `azure.proxy` (and
105
- `azure.caFile` for a company CA) as described in
106
- [company networks](ENTERPRISE.md#company-networks); leave `shell: "deny"` and TLS
107
- verification enabled. See [all settings](../README.md#all-settings-and-defaults)
108
- for output language and other options, and
109
- [model configuration](../README.md#configuration) for model variants and
110
- separate models for each role.
111
-
112
- ## 5. Restart the OpenCode service (terminal)
113
-
114
- Settings are read when OpenCode loads AZPR, so restart the service once after
115
- saving them:
116
-
117
- ```sh
118
- opencode service restart
119
- ```
120
-
121
- If you run `opencode serve` yourself, restart that process instead. Closing a
122
- conversation or reopening the terminal UI alone does not reload a running
123
- background service.
124
-
125
- ## 6. Check access without a model request (OpenCode)
126
-
127
- In OpenCode, replace this sample with your PR's URL:
128
-
129
- ```text
130
- /pr-check https://dev.azure.com/YOUR_ORGANIZATION/YOUR_PROJECT/_git/YOUR_REPO/pullrequest/123
131
- ```
132
-
133
- Wait for the final `READY` receipt after `STARTED`. This reads PR metadata,
134
- changed files, sample source and discussions, and checks the model catalog;
135
- it neither runs a review nor tests model-provider authentication or Azure write
136
- permissions. Fix any `NOT_READY` result before continuing. A **Quick model
137
- WARNING** also needs fixing before `/pr-quick`, even if the overall result is
138
- `READY`; a **Deep model** WARNING likewise before `/pr-deep`. The **Deep models**
139
- row says whether `/pr-deep` is set up (see below), and the **AZPR** row names
140
- the installation that answered.
141
-
142
- On a host without `permission.hook`, **Project boundary WARNING** means the
143
- host's own permission rules control where native read tools can read; reviews
144
- remain available. The tested OpenCode 2.1.4 host has that hook. `READY` is an
145
- access check, not a security audit or an approval of the PR.
146
-
147
- ## 7. Run a review and preview its comments (OpenCode)
148
-
149
- ```text
150
- /pr-review https://dev.azure.com/YOUR_ORGANIZATION/YOUR_PROJECT/_git/YOUR_REPO/pullrequest/123 --preview
151
- ```
152
-
153
- This starts functional and risk reviewers, followed by separate verification.
154
- The starter setup uses the same model in separate sessions; you can assign
155
- models per role later. For a lighter pass, use `/pr-quick <PR URL> --preview`
156
- instead: it runs one reviewer per shard without independent verification.
157
-
158
- Follow the progress notices and wait for the review receipt. If the COMPLETE
159
- review has findings to comment on, `--preview` starts a separate comment run
160
- that saves a preview; wait for its receipt too. **Neither command posts to
161
- Azure**, even if your settings normally enable automatic publication. A review
162
- with no findings to comment on produces a notice without running a planner.
163
- A review that is `PARTIAL` or `STALE` cannot be commented on; resolve the cause
164
- and run a new review.
165
-
166
- Inspect the report, proposed summary, inline comments and skipped findings.
167
- Check coverage and limitations: COMPLETE does not mean every file was reviewed
168
- or every finding confirmed. Quick findings are `REPORTED`, with `verification
169
- none`. Keep the review's eight-character ID for publication in the **same
170
- conversation** (`1a2b3c4d` below is an example).
171
-
172
- For a small PR, `/pr-review` commonly uses two reviewer sessions, a verifier
173
- session and a comment-planning session; `/pr-quick` commonly uses one review
174
- session plus comment planning. **A session is not a single model request**:
175
- tool reads, corrections, retries, more shards or planning pages add requests
176
- and cost. Refreshing a preview with `/pr-comment <review-id>` runs planning
177
- again. Use the displayed `/pr-stop <run-id>` to cancel an active command; no
178
- cost cap is configured by default.
179
-
180
- ## Optional: adjust findings before publishing
181
-
182
- Use finding IDs from your report to leave findings out or change their severity:
183
-
184
- ```text
185
- /pr-comment 1a2b3c4d --exclude F-1 --severity F-2=low
186
- ```
187
-
188
- In this example, F-1 is excluded from the new preview; F-2 appears as low in the
189
- summary, with no new inline comment. The original review is preserved. A changed
190
- severity does not verify the finding again; exclude a finding when it is wrong.
191
-
192
- AZPR uses a model to plan the comments again without rerunning the review, so
193
- read the whole new preview. Each option replaces its own saved list:
194
- `--exclude F-1` followed by `--exclude F-2` excludes only F-2; use
195
- `--exclude F-1,F-2` to keep both out. `--reset` clears both adjustment lists
196
- and plans again; `--show` displays the saved preview without a model or Azure
197
- request. See [adjusting findings](COMMENTING.md#adjusting-findings-after-a-preview)
198
- for the full rules.
199
-
200
- ## Optional: publish after inspecting the preview
201
-
202
- ```text
203
- /pr-comment 1a2b3c4d --publish
204
- ```
205
-
206
- This explicit command posts the saved preview through your PAT after checking
207
- the PR is active and its source commit is unchanged. Existing markers are
208
- skipped. Check the publication receipt for failures or incomplete read-back.
209
- An adjusted review needs a saved preview planned after its latest adjustment,
210
- also after `--reset`; `--publish` refuses if that preview is missing. Once
211
- publication starts, its adjustments and preview are fixed, and `--publish`
212
- retries the saved content. Earlier comments on the PR are never edited; the
213
- receipt names those whose text differs from an adjusted preview.
214
-
215
- For a review that has never been adjusted, `--publish` plans first if no preview
216
- exists; use `/pr-comment <review-id>` to prepare and inspect a preview first. See
217
- [automatic comments](COMMENTING.md#automatic-comments-after-a-review) for
218
- `afterReview` and the flags that override it for one review.
219
-
220
- For important changes, `/pr-deep` runs the same review as `/pr-review` with
221
- the models of `models.deep`. Put stronger (usually slower and costlier) models
222
- in all three deep slots and keep it for changes that justify the cost; with
223
- the review's models it would only repeat `/pr-review`, and `/pr-check` warns
224
- about that. All modes produce AI findings that require human judgment; see
225
- [commands](../README.md#commands).
226
-
227
- ## Other installation methods
228
-
229
- For an existing source installation, keep using `install.sh --replace`, or
230
- follow the migration notes in [installation](../README.md#native-package-npm-or-git).
231
- Do not load both copies in the same OpenCode profile.
232
-
233
- Prefer a source archive? Download and extract the
234
- [v0.3.1 archive](https://github.com/WTLAIB/opencode-azure-devops-pr-review-v2/archive/refs/tags/v0.3.1.tar.gz),
235
- then run `sh install.sh --config-dir /absolute/path/to/your/opencode-config`
236
- inside it. That directory must be the one your OpenCode actually loads. The
237
- source installer creates starter settings, so add `--replace` to the setup
238
- command in step 4, then restart the OpenCode service as in step 5.