opencode-azure-devops-pr-review 0.3.0 → 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 (53) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +189 -109
  3. package/package.json +2 -11
  4. package/src/attribution.mjs +2 -2
  5. package/src/azure.mjs +18 -3
  6. package/src/config.mjs +5 -0
  7. package/src/host.mjs +44 -0
  8. package/src/plugin.js +2 -1
  9. package/src/runtime.mjs +27 -5
  10. package/src/setup.mjs +49 -21
  11. package/AGENTS.md +0 -164
  12. package/CODE_OF_CONDUCT.md +0 -83
  13. package/CONTRIBUTING.md +0 -84
  14. package/SECURITY.md +0 -38
  15. package/config/settings.example.json +0 -55
  16. package/config/settings.schema.json +0 -316
  17. package/docs/ARCHITECTURE.md +0 -408
  18. package/docs/AZURE_DEVOPS.md +0 -214
  19. package/docs/COMMENTING.md +0 -399
  20. package/docs/DEBUGGING.md +0 -144
  21. package/docs/DEMO.md +0 -195
  22. package/docs/ENTERPRISE.md +0 -205
  23. package/docs/QUICKSTART.md +0 -219
  24. package/docs/RELEASING.md +0 -95
  25. package/docs/ROADMAP.md +0 -241
  26. package/docs/VALIDATION.md +0 -2066
  27. package/docs/VALIDATION_HISTORY.md +0 -1845
  28. package/docs/VERIFICATION.md +0 -42
  29. package/docs/assets/RECORDING.md +0 -131
  30. package/docs/assets/adjust-findings-teaser.gif +0 -0
  31. package/docs/assets/adjust-preview.png +0 -0
  32. package/docs/assets/adjust-publication.png +0 -0
  33. package/docs/assets/example-comments.md +0 -38
  34. package/docs/assets/generate-demo-gif.py +0 -25
  35. package/docs/assets/generate-demo.mjs +0 -141
  36. package/docs/assets/live-azure-readback.png +0 -0
  37. package/docs/assets/live-preview.png +0 -0
  38. package/docs/assets/live-review-teaser.gif +0 -0
  39. package/docs/assets/live-review.png +0 -0
  40. package/docs/assets/quick-review-demo.gif +0 -0
  41. package/docs/assets/record-terminal.py +0 -124
  42. package/docs/assets/render-terminal-demo.py +0 -168
  43. package/docs/assets/review-example.svg +0 -1
  44. package/docs/assets/walkthrough.svg +0 -1
  45. package/docs/releases/v0.1.0.md +0 -74
  46. package/docs/releases/v0.2.0.md +0 -107
  47. package/docs/releases/v0.2.1.md +0 -65
  48. package/docs/releases/v0.2.2.md +0 -76
  49. package/docs/releases/v0.2.3.md +0 -93
  50. package/docs/releases/v0.3.0.md +0 -125
  51. package/install.sh +0 -171
  52. package/scripts/merge-settings.py +0 -120
  53. 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,205 +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. The installer and `/pr-setup` create `settings.json` with mode
49
- `600`; source replacement preserves it, and native package updates do not
50
- write to it. Keep it outside shared profiles and Git, and
51
- restart OpenCode after changing it. A file only its owner can read protects the
52
- PAT from other accounts, not from programs that run as the same user (an
53
- agent's shell commands, for example), so keep the PAT's scopes minimal and its
54
- lifetime short, and keep it out of environment variables that child processes
55
- inherit. Only a PAT is supported (in `azure.pat` or `azure.patFile`); there is
56
- no Azure CLI, Entra token or environment-variable credential setting. See
57
- [Azure DevOps access](AZURE_DEVOPS.md).
58
-
59
- ## What the selected model receives
60
-
61
- The model connections use your existing OpenCode providers and authentication.
62
- Use providers whose data handling fits the repositories you review; AZPR does
63
- not control their retention or training policies.
64
-
65
- | Route | Data involved |
66
- | --- | --- |
67
- | 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. |
68
- | 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. |
69
- | 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. |
70
-
71
- Reviewers can follow definitions, callers and tests outside the changed files.
72
- Content search downloads a repository archive into runtime memory, searches it
73
- locally, and returns bounded matches to the model; it does not upload the zip as
74
- a model attachment. Later tool reads can expose additional source. Source and
75
- discussion text are not automatically scrubbed for secrets before being used
76
- as model context.
77
-
78
- AZPR's six repository tools are read-only and bound to the review's repository.
79
- Private sessions also have native `read`, `glob` and `grep` for local files and
80
- AZPR's private data. Keep sensitive unrelated files out of the active project.
81
- With `permission.hook`, AZPR refuses native access outside that project except
82
- to its own state directory. Without the hook, `/pr-check` shows **Project
83
- boundary WARNING** while keeping reviews available; the host's permission
84
- rules then decide which paths native tools can reach. A READY result does not
85
- remove that warning.
86
-
87
- Keep `shell: "deny"` (the default) unless reviewers need commands.
88
- `shell: "ask"` requests approval; `"inherit"` follows host permissions. Allowed
89
- shell has real host authority and is not a sandbox. Native edit/write tools,
90
- web access, delegation and other MCP tools are excluded from private sessions.
91
- See [authorization and isolation](ARCHITECTURE.md#authorization-and-isolation).
92
-
93
- ## Preview, cost and publication
94
-
95
- Start in one OpenCode conversation with a small PR:
96
-
97
- ```text
98
- /pr-check <PR URL>
99
- /pr-quick <PR URL>
100
- /pr-comment
101
- ```
102
-
103
- `/pr-quick` runs one reviewer per shard and no independent verifier. Its
104
- findings are **reported, not verified**; inspect the coverage and limitations
105
- as well as the findings. Use `/pr-review` or `/pr-deep` when you want separate
106
- functional and risk reviewers followed by verification; `/pr-deep` runs the
107
- same review with the stronger models you set in `models.deep`, so its cost
108
- depends on those models. None of these commands
109
- posts to Azure DevOps by default. `afterReview` (per mode) or a flag after the
110
- PR URL can follow a COMPLETE review with a preview (`preview`, `--preview`) or
111
- with publication (`publish`, `--publish`); see
112
- [automatic comments](COMMENTING.md#automatic-comments-after-a-review).
113
-
114
- **Preview uses a model.** `/pr-comment` reads live discussions and plans the
115
- comments; each new preview replans and can incur provider charges. One session
116
- can contain several requests, and larger PRs, repairs, retries and overflow
117
- splits add work. `workflow.parallelSessions` controls concurrency, not a token
118
- or spending limit. There is no built-in monetary cap; `runTimeoutSeconds` is
119
- `null` by default, and `/pr-stop <run-id>` cancels a run. See
120
- [debugging](DEBUGGING.md#diagnosis-order) for provider-reported token usage.
121
-
122
- After inspecting a preview, explicitly publish the named review:
123
-
124
- ```text
125
- /pr-comment <review-id> --publish
126
- ```
127
-
128
- Teams that want comments without that step can set `afterReview` to `publish`
129
- for a mode, or add `--publish` after the PR URL for one review. Automatic
130
- publication posts under the PAT owner's identity without anyone reading the
131
- text first. It holds back, item by item, a comment whose text would notify
132
- people, load or run something when viewed, or hide text from readers: an
133
- `@<…>` mention, an image, HTML that embeds content, runs a script or hides
134
- text, or a `javascript:`, `vbscript:`, `data:` or `file://` link (script links
135
- and mentions also when encoded with escapes or character references, and
136
- script links also with a tab or line break inside, which a browser drops from
137
- a URL). Literal code is skipped where its reading is certain,
138
- except for mentions. Held items wait in the saved preview for a person; the
139
- others, ordinary web links included, are posted. A quick review's comments
140
- carry the disclosure that they were not independently verified; teams that
141
- want a person to read them first set `afterReview.quick` to `preview`.
142
- Automatic publication posts nothing for a review without findings to comment
143
- on, or when every finding is already discussed on the PR. `/pr-check` lists
144
- the `afterReview` setting of each mode and who posts. An automatic preview
145
- still uses a model.
146
-
147
- The runtime posts the saved preview, rechecks that the PR is active and its
148
- source commit is unchanged, and skips existing comment markers. If no preview
149
- is saved, `--publish` plans and publishes in the same command; run the preview
150
- first when you want to inspect the text. Publication uses the PAT owner's Azure
151
- identity. Models themselves have no Azure write tool. Repeating publication
152
- recovers partial results; avoid publishing the same PR concurrently from
153
- different OpenCode processes. See [commenting](COMMENTING.md).
154
-
155
- ## Local records and cleanup
156
-
157
- AZPR stores reviews, previews, publication ledgers and observed source under
158
- `${XDG_STATE_HOME:-~/.local/state}/opencode/azpr-v2/`, with owner-only permissions
159
- on the files and directories it creates. A relative `XDG_STATE_HOME` is ignored
160
- in favor of `~/.local/state`. If the normal state directory cannot be created,
161
- AZPR falls back to `azpr-v2-state-<uid>` in the system temporary directory;
162
- include that location when locating or removing records.
163
- The newest **20 completed reviews** are retained across restarts. This is a
164
- count limit, not an expiry period; a quiet installation can retain them
165
- indefinitely. Unreferenced scratch data becomes eligible for cleanup after
166
- 24 hours. Fallback receipts have a separate limit of 50. Publication recovery
167
- records under `attempts/` are separate; entries older than 90 days are ignored
168
- when accessed and removed when that PR's record is next rewritten.
169
-
170
- With `deletePrivateSessions: true` (default), AZPR requests deletion of its
171
- private review sessions when their completed review is evicted. An unfinished
172
- review normally keeps only its report/draft session, within a separate limit
173
- of 20 runs; diagnostics or an unconfirmed cancellation can retain all of that
174
- run's sessions. Deletion depends on host support and is best effort. Setting
175
- this option to `false` keeps the sessions. Your own conversations are never
176
- deleted by AZPR, and deleting local records does not delete provider records
177
- or published Azure comments.
178
-
179
- Diagnostics are off by default (`debug.enabled: false`). When enabled, they
180
- can include source, PR details, prompts, answers and secrets echoed in them.
181
- The default location is `…/opencode/azpr-v2-debug/`, separate from review state;
182
- `debug.directory` changes it and `debug.keepRuns` defaults to 20 (`0` keeps all).
183
- Inspect and redact records before sharing them. See [debugging](DEBUGGING.md).
184
- Uninstall archives the installed package, including its private settings, and
185
- leaves review state in place. To remove local copies, stop OpenCode and handle
186
- the installed settings/backups, state, diagnostics and OpenCode conversations
187
- according to your team's retention needs.
188
-
189
- ## Corporate proxies and certificates
190
-
191
- The following settings affect **AZPR's Azure DevOps requests only**. Configure
192
- model-provider connectivity separately in the OpenCode environment.
193
-
194
- | Setting | Behavior |
195
- | --- | --- |
196
- | `azure.proxy` | Forward proxy URL; Basic proxy credentials may be percent-encoded in the URL. NTLM/Kerberos requires a separate local forwarder. |
197
- | `azure.caFile` | Absolute path to PEM CA certificates, added to the built-in trusted roots. Use this for your organization's TLS inspection CA. |
198
- | `azure.verifyTls` | Defaults to `true`. Disabling certificate verification exposes the PAT to intercepted connections and produces a `/pr-check` warning. |
199
-
200
- Restart OpenCode after changing transport settings or the CA file. These
201
- options depend on Bun's per-request transport support; an unsupported runtime
202
- refuses to load them. If `azure.proxy` is empty, process-wide proxy environment
203
- settings can still apply. A TLS-inspecting proxy can see the PAT and source
204
- traffic. See [proxies and TLS inspection](AZURE_DEVOPS.md#proxies-and-tls-inspection)
205
- for setup and connection troubleshooting.
@@ -1,219 +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.
5
-
6
- ## 1. Check the prerequisites
7
-
8
- - **OpenCode CLI 2.1.4** (`@opencode/cli`, V2 plugin API), tested on **Ubuntu
9
- 22.04.5 LTS (WSL2)**. Other host versions and operating systems are not
10
- validated; see [validation](VALIDATION.md). OpenCode 1.x is not supported.
11
- - An authenticated OpenCode model with tool support. Copy its exact
12
- `provider/model` ID from your host's model selection or `opencode models`.
13
- AZPR uses your existing provider account.
14
- - Access to the npm registry for the npm package, or Git for the Git package.
15
- The alternative source installer needs POSIX `sh` and Python 3. AZPR has no
16
- build step or npm dependencies.
17
- - An organization-scoped Azure DevOps PAT. The recommended scopes are **Code:
18
- Read** and **Pull Request Threads: Read & write**; see
19
- [access and validation limits](ENTERPRISE.md).
20
-
21
- Check the host version:
22
-
23
- ```sh
24
- opencode --version
25
- ```
26
-
27
- ## 2. Install v0.3.0
28
-
29
- Already using an earlier version? Follow the [upgrade instructions](releases/v0.3.0.md#upgrading)
30
- to preserve your current configuration and use one AZPR installation.
31
-
32
- In your terminal:
33
-
34
- ```sh
35
- opencode plugin add opencode-azure-devops-pr-review@0.3.0
36
- ```
37
-
38
- Restart OpenCode and open an ordinary conversation. This is the host's native
39
- package installation; no npm account or separate build is needed. The
40
- plugin exposes `/pr-setup` even before its review configuration exists.
41
-
42
- To install the same release from Git instead of the npm registry, use
43
- `opencode plugin add 'github:WTLAIB/opencode-azure-devops-pr-review-v2#v0.3.0'`.
44
- Add only one of the two.
45
-
46
- For an existing source installation, keep using `install.sh --replace`, or
47
- follow the migration notes in [installation](../README.md#native-package-npm-or-git).
48
- Do not load both copies in the same OpenCode profile.
49
-
50
- Prefer a source archive? Download and extract the
51
- [v0.3.0 archive](https://github.com/WTLAIB/opencode-azure-devops-pr-review-v2/archive/refs/tags/v0.3.0.tar.gz),
52
- then run `sh install.sh --config-dir /absolute/path/to/your/opencode-config`
53
- inside it. That directory must be the one your OpenCode actually loads. The
54
- source installer creates starter settings; add `--replace` to the setup
55
- command below to configure that existing file.
56
-
57
- ## 3. Configure one model and your Azure organization
58
-
59
- Put the PAT alone in a file only you can read. The following **Bash** example
60
- creates a new file and refuses to overwrite an existing one. Input is hidden
61
- and is not added to shell history:
62
-
63
- ```sh
64
- AZPR_USER_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/azpr"
65
- mkdir -p "$AZPR_USER_DIR"
66
- (
67
- umask 077
68
- set -o noclobber
69
- read -rs -p 'Azure DevOps PAT: ' AZPR_PAT
70
- printf '\n'
71
- test -n "$AZPR_PAT" && printf '%s' "$AZPR_PAT" > "$AZPR_USER_DIR/pat"
72
- )
73
- printf 'PAT file: %s\n' "$AZPR_USER_DIR/pat"
74
- ```
75
-
76
- If the file already exists, reuse your existing owner-only PAT file, or choose
77
- another unused path. Do not paste a PAT into a conversation or command argument.
78
-
79
- In OpenCode, run `/pr-setup` to see the settings path and available model IDs.
80
- Then replace all three placeholders in this command:
81
-
82
- ```text
83
- /pr-setup --organization YOUR_ORGANIZATION --model YOUR_PROVIDER/YOUR_MODEL --pat-file "/absolute/path/to/azpr/pat"
84
- ```
85
-
86
- Use the organization name from `https://dev.azure.com/<organization>`, not the
87
- full URL. Use the absolute PAT file path printed above. The command checks the
88
- model catalog and the PAT file, then saves configuration with owner-only
89
- permissions. It makes no model request and does not contact Azure.
90
-
91
- One model selection configures the quick reviewer and all three review roles.
92
- `/pr-quick` still runs only its own reviewer; `/pr-review` uses separate reviewer
93
- and verifier sessions. Deep models remain unset until you choose stronger
94
- models for that mode. Setup preserves other settings when explicitly replacing
95
- an existing file with `--replace`.
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
- **Restart the OpenCode service after saving.** Settings are read once at plugin
104
- startup; closing a conversation or reopening the terminal UI alone does not
105
- reload a running background service. For the usual managed service, run this
106
- in your terminal, then reopen OpenCode:
107
-
108
- ```sh
109
- opencode service restart
110
- ```
111
-
112
- If you run `opencode serve` yourself, restart that process instead.
113
- If your network needs a proxy or company CA, configure it in that settings file
114
- as described in [enterprise setup](ENTERPRISE.md), then restart. Leave
115
- `shell: "deny"` and TLS verification enabled. See
116
- [all settings](../README.md#all-settings-and-defaults) for output language and
117
- other options, and [model configuration](../README.md#configuration) for model
118
- variants and separate models for each role.
119
-
120
- ## 4. Check access without a model request
121
-
122
- In OpenCode, replace this sample with your PR's URL:
123
-
124
- ```text
125
- /pr-check https://dev.azure.com/YOUR_ORGANIZATION/YOUR_PROJECT/_git/YOUR_REPO/pullrequest/123
126
- ```
127
-
128
- Wait for the final `READY` receipt after `STARTED`. This reads PR metadata,
129
- changed files, sample source and discussions, and checks the model catalog;
130
- it neither runs a review nor tests model-provider authentication or Azure write
131
- permissions. Fix any `NOT_READY` result before continuing. A **Quick model
132
- WARNING** also needs fixing before `/pr-quick`, even if the overall result is
133
- `READY`; a **Deep model** WARNING likewise before `/pr-deep`. The **Deep models**
134
- row says whether `/pr-deep` is set up (see below).
135
-
136
- On a host without `permission.hook`, **Project boundary WARNING** means the
137
- host's own permission rules control where native read tools can read; reviews
138
- remain available. The tested OpenCode 2.1.4 host has that hook. `READY` is an
139
- access check, not a security audit or an approval of the PR.
140
-
141
- ## 5. Run a review and preview its comments
142
-
143
- ```text
144
- /pr-review https://dev.azure.com/YOUR_ORGANIZATION/YOUR_PROJECT/_git/YOUR_REPO/pullrequest/123 --preview
145
- ```
146
-
147
- This starts functional and risk reviewers, followed by separate verification.
148
- The starter setup uses the same model in separate sessions; you can assign
149
- models per role later. For a lighter pass, use `/pr-quick <PR URL> --preview`
150
- instead: it runs one reviewer per shard without independent verification.
151
-
152
- Follow the progress notices and wait for the review receipt. If the COMPLETE
153
- review has findings to comment on, `--preview` starts a separate comment run
154
- that saves a preview; wait for its receipt too. **Neither command posts to
155
- Azure**, even if your settings normally enable automatic publication. A review
156
- with no findings to comment on produces a notice without running a planner.
157
- A review that is `PARTIAL` or `STALE` cannot be commented on; resolve the cause
158
- and run a new review.
159
-
160
- Inspect the report, proposed summary, inline comments and skipped findings.
161
- Check coverage and limitations: COMPLETE does not mean every file was reviewed
162
- or every finding confirmed. Quick findings are `REPORTED`, with `verification
163
- none`. Keep the review's eight-character ID for publication in the **same
164
- conversation** (`1a2b3c4d` below is an example).
165
-
166
- For a small PR, `/pr-review` commonly uses two reviewer sessions, a verifier
167
- session and a comment-planning session; `/pr-quick` commonly uses one review
168
- session plus comment planning. **A session is not a single model request**:
169
- tool reads, corrections, retries, more shards or planning pages add requests
170
- and cost. Refreshing a preview with `/pr-comment <review-id>` runs planning
171
- again. Use the displayed `/pr-stop <run-id>` to cancel an active command; no
172
- cost cap is configured by default.
173
-
174
- ## Optional: adjust findings before publishing
175
-
176
- Use finding IDs from your report to leave findings out or change their severity:
177
-
178
- ```text
179
- /pr-comment 1a2b3c4d --exclude F-1 --severity F-2=low
180
- ```
181
-
182
- In this example, F-1 is excluded from the new preview; F-2 appears as low in the
183
- summary, with no new inline comment. The original review is preserved. A changed
184
- severity does not verify the finding again; exclude a finding when it is wrong.
185
-
186
- AZPR uses a model to plan the comments again without rerunning the review, so
187
- read the whole new preview. Each option replaces its own saved list:
188
- `--exclude F-1` followed by `--exclude F-2` excludes only F-2; use
189
- `--exclude F-1,F-2` to keep both out. `--reset` clears both adjustment lists
190
- and plans again; `--show` displays the saved preview without a model or Azure
191
- request. See [adjusting findings](COMMENTING.md#adjusting-findings-after-a-preview)
192
- for the full rules.
193
-
194
- ## Optional: publish after inspecting the preview
195
-
196
- ```text
197
- /pr-comment 1a2b3c4d --publish
198
- ```
199
-
200
- This explicit command posts the saved preview through your PAT after checking
201
- the PR is active and its source commit is unchanged. Existing markers are
202
- skipped. Check the publication receipt for failures or incomplete read-back.
203
- An adjusted review needs a saved preview planned after its latest adjustment,
204
- also after `--reset`; `--publish` refuses if that preview is missing. Once
205
- publication starts, its adjustments and preview are fixed, and `--publish`
206
- retries the saved content. Earlier comments on the PR are never edited; the
207
- receipt names those whose text differs from an adjusted preview.
208
-
209
- For a review that has never been adjusted, `--publish` plans first if no preview
210
- exists; use `/pr-comment <review-id>` to prepare and inspect a preview first. See
211
- [automatic comments](COMMENTING.md#automatic-comments-after-a-review) for
212
- `afterReview` and the flags that override it for one review.
213
-
214
- For important changes, `/pr-deep` runs the same review as `/pr-review` with
215
- the models of `models.deep`. Put stronger (usually slower and costlier) models
216
- in all three deep slots and keep it for changes that justify the cost; with
217
- the review's models it would only repeat `/pr-review`, and `/pr-check` warns
218
- about that. All modes produce AI findings that require human judgment; see
219
- [commands](../README.md#commands).