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/RELEASING.md DELETED
@@ -1,95 +0,0 @@
1
- # Releasing AZPR
2
-
3
- AZPR is distributed as the npm package `opencode-azure-devops-pr-review`, a
4
- native Git package and a source archive. All three come from the same tagged
5
- source tree and contain the same runtime.
6
-
7
- ## Prepare a release
8
-
9
- 1. Set the version in `package.json`, add a dated changelog section, and write
10
- `docs/releases/vVERSION.md`. Update the quickstart, README install commands
11
- and download links to that version.
12
- 2. Run `npm run check` and `npm test`. Follow `AGENTS.md` for required host
13
- checks. Release validation includes fresh and replacement source installs,
14
- `host-v2-smoke.mjs --native`, `host-v2-comment-scale.mjs` and
15
- `host-v2-background-compaction.mjs` on the exact documented host. Keep simulated services and live model/Azure results distinct.
16
- 3. Inspect `npm pack --dry-run --json`: the entry, runtime modules, prompts,
17
- configuration example and license must be present; private settings, `.local/`,
18
- credentials, diagnostics and temporary recordings must be absent. The native
19
- fixture installs the packed files as a Git repository through the real plugin
20
- manager and tests setup plus both default and explicitly selected external
21
- settings.
22
- 4. Review the complete diff and release notes, then commit and push the release
23
- branch. Verify GitHub Actions for that exact commit. In a disposable OpenCode
24
- profile, install `github:WTLAIB/opencode-azure-devops-pr-review-v2#COMMIT` to
25
- verify public Git resolution before creating the tag.
26
- 5. Extract a Git archive of the release candidate into a clean directory. Run
27
- its source installer with disposable settings; verify the installed entry,
28
- license, prompts and settings preservation. Check documentation links and
29
- images against that archive, not a working tree with extra files.
30
-
31
- Do not upgrade the personal host, use private credentials, run paid models or
32
- publish test comments as incidental release checks. Those actions need their own
33
- authorization and a designated test environment. Never distribute `.local/`.
34
-
35
- ## Publish the tested tree
36
-
37
- Merge the reviewed release changes and verify the merged tree matches the
38
- validated candidate. Create an annotated `vVERSION` tag at that commit, push it,
39
- and create a GitHub Release using `docs/releases/vVERSION.md`.
40
-
41
- Attach the prepared demonstration video and any release artifacts with a
42
- checksum manifest. Keep raw terminal captures private: they can contain account
43
- or local path information. Public media must be inspected before uploading.
44
- GitHub also supplies source archives for the tag.
45
-
46
- Build the npm tarball from a clean export of the tag, not from a working tree,
47
- and check its file list as in step 3:
48
-
49
- ```sh
50
- mkdir /tmp/azpr-VERSION && git archive vVERSION | tar -x -C /tmp/azpr-VERSION
51
- cd /tmp/azpr-VERSION && npm pack --json
52
- ```
53
-
54
- Record the tarball's `integrity` value. A maintainer publishes that exact file
55
- from an npm account with two-factor authentication:
56
-
57
- ```sh
58
- npm publish ./opencode-azure-devops-pr-review-VERSION.tgz --access public
59
- ```
60
-
61
- A new package's first version must be published this way; later releases may
62
- use trusted publishing from GitHub Actions instead. Never commit an npm token
63
- or store one in the repository settings.
64
-
65
- Then verify the actual published installation:
66
-
67
- ```sh
68
- npm view opencode-azure-devops-pr-review@VERSION dist.integrity
69
- node tests/host-v2-smoke.mjs /absolute/path/to/opencode --native --package opencode-azure-devops-pr-review@VERSION
70
- opencode plugin add 'github:WTLAIB/opencode-azure-devops-pr-review-v2#vVERSION'
71
- ```
72
-
73
- The registry's integrity must equal the recorded value. The fixture installs
74
- the registry package into a disposable profile and runs the review workflow
75
- against fake services. Use a disposable config/data profile for the Git check
76
- too. Download the public source archive and repeat its installation check.
77
- Verify the Release, archive, npm page and media links resolve. Keep published
78
- tags and npm versions fixed; corrections belong in a new version.
79
-
80
- ## Demonstrations and evidence
81
-
82
- Record the AZPR source commit, OpenCode version, model, test fixture and observed
83
- results. A seeded test PR demonstrates the workflow, not general review accuracy.
84
- Use [the recording guide](assets/RECORDING.md) for real terminal captures, and
85
- [validation](VALIDATION.md) for the distinction between offline tests, host
86
- fixtures and live runs. A shorter edit must label accelerated or removed waits.
87
-
88
- ## Repository discoverability
89
-
90
- Keep the GitHub About description, homepage (the npm package page), topics and
91
- the `package.json` description and keywords aligned. The README should link the
92
- current release, npm package, quickstart, real demo, contribution guide, code
93
- of conduct and private vulnerability reporting. When OpenCode's ecosystem directory accepts
94
- entries, submit a focused request that follows its current rules. A directory
95
- listing is not a compatibility certification.
package/docs/ROADMAP.md DELETED
@@ -1,241 +0,0 @@
1
- # Roadmap
2
-
3
- Tested with OpenCode CLI 2.1.4, the Azure DevOps Services REST API
4
- (api-version 7.1) and Ubuntu 22.04. [Current validation](VALIDATION.md) records what this revision was tested
5
- with; [validation history](VALIDATION_HISTORY.md) keeps earlier results.
6
-
7
- ## Implemented (stability revision)
8
-
9
- - **Adjust findings before publishing.** After reading a preview, use
10
- `/pr-comment <review-id> --exclude` or `--severity` to choose which findings
11
- to publish and at what severity. The model plans a new preview while the
12
- original review stays intact. Each list replaces the saved one; `--reset`
13
- clears both, and `--show` displays the saved preview without a model or Azure
14
- request. Adjusted reviews require a saved preview and cannot be adjusted or
15
- planned again once publication starts. Earlier PR comments keep their text;
16
- the receipt reports differences. See [commenting](COMMENTING.md#adjusting-findings-after-a-preview).
17
- - **Optional automatic comments.** `afterReview` selects `none` (default),
18
- `preview` or `publish` for each mode; a flag after the PR URL overrides it
19
- for one review. A COMPLETE review hands off to a separate, cancellable
20
- comment command. Automatic publication holds individual items with mentions,
21
- images or active content for inspection, posts ordinary text and links, and
22
- skips a summary when every finding is already discussed. Quick comments
23
- retain their unverified disclosure. See [commenting](COMMENTING.md).
24
- - **Native installation and guided setup.** OpenCode's plugin manager loads
25
- the npm package or the versioned Git package through `server.js`. `/pr-setup` validates one
26
- configured model and an existing private PAT file, then writes an external,
27
- owner-only settings file. The source installer remains available; updating
28
- or removing the package does not remove external settings or review records.
29
- - **Public distribution and contribution.** An npm package, versioned release
30
- notes, a real recorded review and publication, contribution and private
31
- vulnerability reporting guides, a code of conduct, and issue and
32
- pull-request templates support adoption.
33
- - **Own Azure DevOps access.** AZPR calls the REST API (api-version 7.1, the
34
- latest released version) with the organization and PAT from its settings,
35
- or from an owner-only PAT file (`azure.patFile`) so `settings.json` holds no
36
- secret;
37
- no MCP server is needed. Reads retry transient failures, writes never retry,
38
- every call is bounded and the PAT is never logged.
39
- - **Runtime-owned facts.** PR identity, the latest iteration's head and merge
40
- base, the complete changed-file list (paged 2,000 per request) and the final
41
- version recheck come from REST calls, not model echoes. `/pr-check` is fully
42
- deterministic.
43
- - **Reviewer tools.** Models read the repository through six read-only AZPR
44
- tools bound to the run's repository: diffs with structure-aware context and
45
- folded repeats, whole files, content search over the exact commit, file
46
- search by name, folder listings and PR threads. They also see the PR's commit
47
- messages. Private sessions see only an allowlist of tools, and ordinary
48
- sessions never see AZPR's tools.
49
- - **Only source changes are stale.** A moved base is a warning; a changed head
50
- is STALE. Publication rechecks the head before writing.
51
- - **Sharded reviews.** Initial reviews run per file shard with disjoint finding-ID
52
- ranges; verification runs per finding shard; parallelism is bounded.
53
- - **Context overflow is recovered.** A compaction the host attempts in a
54
- reviewer's turn is refused, which ends the turn as overflow, and the shard is
55
- split and rerun (validated on the real host). A refused background summary
56
- (`experimental.background_compaction`) leaves the turn's own failure to decide.
57
- - **Correction turns.** Answers that break the output contract are corrected in
58
- the same session (`workflow.repairAttempts`); remaining problems degrade per
59
- item (UNREVIEWED, NEEDS_INFO, skipped comments) instead of failing the review.
60
- - **One place for duplicates.** Only verification merges duplicates: each
61
- verifier within its shard, and a duplicate check for files whose findings
62
- different verifiers confirmed (a quick review, which has no verifier, merges
63
- only records identical in every field). Verifier rows are judged by their own fields,
64
- a move to another file must be declared and the report shows the initial
65
- location, and the comment planner may not skip a finding because another
66
- finding of the review is commented.
67
- - **Stage retries.** Transient failures retry once in a new session
68
- (`workflow.stageRetries`); stream continuations work for every provider, and
69
- OpenCode's own retries of a failed provider request pass AZPR's hooks.
70
- - **Stage inactivity watchdog.** A stage that shows no activity for
71
- `workflow.stageIdleSeconds` (default 600 s) while it waits on OpenCode is
72
- stopped with `failure=idle` and an error naming its last activity, then
73
- retried in a new session; any activity, including each streamed chunk of
74
- output, restarts the window.
75
- - **Nothing to review.** A PR whose complete change list is empty stops before
76
- any session.
77
- - **Quick review.** `/pr-quick` runs one reviewer per shard for both the
78
- functional and the risk focus and no verifier, duplicate check or summary
79
- session. The runtime checks only the form and source of its findings (a
80
- required location that exists at that commit, in a file the session's own
81
- tools read): passing findings are REPORTED, the rest NEEDS_INFO. A usable
82
- PARTIAL answer that names unfinished work gets one follow-up turn in the
83
- same session; a follow-up that fails or gives no usable answer keeps the
84
- answer it followed. The review records `verification: none`, reports status, coverage and verification
85
- separately, and its comments keep the layout with a disclosure line that
86
- names the quick method. Shared prompts carry verified/quick variants; the
87
- review prompts are byte-identical to before (hash-tested), and a command
88
- checks only its own profile's agents and models.
89
- - **Deep means stronger models.** `/pr-deep` runs the same review as
90
- `/pr-review` with the models of `models.deep`. Its extra prompt text was
91
- dropped after it changed neither gpt-6-luna's nor gpt-6.1-sol's results on
92
- the test PRs, so the deep profile is where a stronger, costlier model goes.
93
- - **Bounded Azure calls.** One queue with configurable concurrency and a
94
- per-call timeout that aborts the request, for both tool and runtime calls;
95
- slots are released in `finally`.
96
- - **Corporate networks.** `azure.proxy`, `azure.caFile` and `azure.verifyTls`
97
- send AZPR's Azure DevOps calls through a proxy and trust a TLS-inspecting
98
- proxy's CA without changing OpenCode's other connections; certificate,
99
- proxy-authentication and gateway errors say which setting to change.
100
- - **Deterministic, idempotent publication.** Existing markers are skipped,
101
- writes are read back, partial results are safe to re-run, and inline markers
102
- are stable across reviews of unchanged code.
103
- - **Persistence.** Completed reviews, previews and ledgers survive restarts;
104
- stale scratch data and legacy temporary directories are cleaned up.
105
- - **Reliable notices.** PROGRESS notices during long runs; final receipts are
106
- retried and fall back to a file.
107
- - **Safer defaults.** Shell is denied for private roles by default and enforced
108
- through the permission hook, which also keeps native read tools inside the
109
- project; a host without the hook gets a `/pr-check` warning. `/pr-stop` only
110
- affects the caller's conversation.
111
- - **Maintainability.** Prompts are about a third of their former size, runtime is
112
- split into focused modules, host specifics live in `host.mjs`.
113
-
114
- ## Deferred
115
-
116
- ### Default whole-run timeout and per-stage step cap
117
-
118
- A default `runTimeoutSeconds` and a per-stage step limit that removes tools and
119
- forces the model to finish were considered and **deliberately not adopted**.
120
- Earlier versions removed the step cap after real large PRs repeatedly hit
121
- whatever limit was chosen, and no step count worked across PR sizes and models.
122
- `runTimeoutSeconds` therefore stays `null` by default and private agents carry no
123
- `steps` value.
124
-
125
- Mitigations now in place: per-call Azure DevOps timeouts, sharding that keeps each
126
- session's work bounded, overflow splitting, `/pr-stop`, PROGRESS notices that
127
- show whether a run is moving, the optional `runTimeoutSeconds`, and the stage
128
- inactivity watchdog (`workflow.stageIdleSeconds`). The watchdog limits silence,
129
- not work: it stops a stage only when nothing happened for the whole window, so
130
- it never cuts a large PR that keeps working. It was added after four stages of
131
- one run waited about 30 minutes on an approval (the cause, a native tool
132
- outside the project, is refused at once since) and because OpenCode 2.0.22
133
- waits up to 30 minutes for data on the OpenAI WebSocket transport.
134
-
135
- Revisit when there is evidence from real runs, for example:
136
-
137
- - a step budget that scales with the shard's file count or changed lines instead
138
- of a fixed number;
139
- - a soft limit that first asks the model to finish (as comment pages already do
140
- after twelve requests) before any hard stop;
141
- - per-stage wall-clock budgets derived from observed timings in `result.json`.
142
-
143
- ### Repository archives over 1 GB
144
-
145
- Content search downloads the repository zip of the exact commit, up to
146
- `azure.archiveMegabytes` (at most 1024). A repository with committed binaries
147
- can be larger; it is reviewed without content search. Raising the maximum alone
148
- is not enough (measured on 2026-10-14):
149
-
150
- - Azure DevOps sends the zip without a length, and the entries' local headers
151
- carry no sizes (data descriptors follow the data), so entries cannot be
152
- skipped while downloading; the central directory at the end is needed. The
153
- zip is held in memory and briefly doubled when the received chunks are
154
- joined, and a Bun 1.4.2 buffer holds at most 4 GiB.
155
- - The download counts against `azure.callTimeoutSeconds` as total time, and a
156
- failed download is not remembered, so each later search starts it again.
157
- - ZIP64 archives (over 4 GB or 65,535 entries) are refused.
158
-
159
- A larger maximum would need the zip written to a private temporary file with
160
- only its directory and text entries read back, ZIP64, an inactivity timeout for
161
- the download and a failed download remembered for the run. Every run would
162
- still download the whole archive. Revisit once the size of the repositories
163
- that need it is known.
164
-
165
- ### Other credential sources
166
-
167
- Only a PAT is supported, in AZPR's settings or in its own file
168
- (`azure.patFile`). Microsoft recommends short-lived
169
- Microsoft Entra tokens over PATs; an Entra or Azure CLI token source could be
170
- added if organizations restrict PAT creation.
171
-
172
- ### Azure DevOps Server
173
-
174
- The REST calls work with Azure DevOps Server 2022.1 or later (api-version 7.1),
175
- but PR URLs and the base URL are limited to Azure DevOps Services.
176
-
177
- ## Remaining validation work
178
-
179
- 1. Publication on other repositories and organizations. On the 316-file test
180
- PR this revision published 24 items, all read back, re-ran without a write
181
- and reported comments deleted by hand as `DELETED`; the planner made no skip
182
- that relied on another finding there, and the correction turn for one was
183
- seen live in a preview. Moved findings, decision rows in the wrong list and
184
- the duplicate check worked in live reviews (see [validation](VALIDATION.md)).
185
- 2. Measure how often correction turns and retries happen per model, and tune
186
- `workflow` defaults from those numbers. On the 316-file PR,
187
- `parallelSessions` 8 with `azure.concurrency` 6 cut the review from 719 s
188
- (4 / 3) to 393 s with no provider retry or throttling; 8 with a queue of 3
189
- made the REST queue the bottleneck. The defaults stay 4 / 3 until other
190
- providers and organizations have been measured; raise both together.
191
- Comment planning runs two pages at a time, which cut a nine-page plan from
192
- 140–175 s to 71–90 s; more lanes were not measured.
193
- 3. Reduce input tokens further. Reading diffs with folded repeats cut the
194
- 316-file review from 7.5–9.2 to about 5.5 million input tokens and a real
195
- 35-file code PR from 6.15 to 0.55–0.79 million; reviewers still make 4–5.5
196
- model requests per session and each re-sends what was read. They already
197
- make 9–12 tool calls per round, so batch parameters for the read tools
198
- would save little and were not added (see [validation](VALIDATION.md)).
199
- Prompt caching is the host's part: with the ChatGPT sign-in route the
200
- 1-file PR read 4–5 % of its input from the cache on OpenCode 2.0.22, which
201
- sent no session headers, and 54 % on 2.0.32. The 316-file PR read 11–21 % on
202
- 2.0.22 and 67–71 % on 2.0.32 in all three modes (see
203
- [validation](VALIDATION.md)).
204
- 4. Cross-shard evidence: a new test in one shard that contradicts unchanged
205
- code in another shard is found with content search (`azpr_search_code`, over
206
- the repository zip of the exact commit) by gpt-6.1-sol in 2 of 2 runs and
207
- missed by gpt-5.6-luna and gpt-6-luna, even with high reasoning effort and
208
- the defective line in a search result. It is a model limit, so no runtime
209
- hints were added. A stronger verifier cannot make up for it: verifiers
210
- judge the candidates and added 1 new finding in 616 decisions over 21 live
211
- runs, so the initial reviewers' model decides what is found. `/pr-deep`
212
- is for that: the review with the stronger models of `models.deep`, for
213
- selected PRs. Confirm on other real PRs. A stronger verifier does keep
214
- more of what the reviewers find: gpt-6-luna as verifier rejected 3 known
215
- defects in 62 reviews, two of them with a reason that confirms the defect,
216
- and gpt-6.1-sol none in 35; behind gpt-6-luna reviewers it cost 3–8 times
217
- the luna review.
218
- 5. Repeat host acceptance for future OpenCode versions; `host.mjs` is the place
219
- for shape changes, `azure.mjs` for REST changes.
220
- 6. Quick review: two runs per mode on the three test PRs with gpt-6-luna used
221
- 36–50 % of the review's model requests and 34–68 % of its input with the
222
- same planted-defect results except one configuration defect (see
223
- [validation](VALIDATION.md)). A quick review of the 1-file test PR was
224
- published and read back. Still open: other PRs and models, a published
225
- multi-shard quick review, and other multi-shard PRs: on the 316-file PR a
226
- shard's tests led its reviewer into another shard's changed files (8–9
227
- repeated defects in 32–35 findings), and comment planning combined 23 of 25
228
- such pairs into
229
- one comment over three runs. The quick follow-up for unfinished work has
230
- not run live yet (no PARTIAL answer in 24 runs); the larger loss is a
231
- reviewer that answers after reading only the diffs, which on PR #4 misses
232
- the regression outside the diff. A prompt sentence asking to continue
233
- unfinished checks made such answers rarer on PR #4 for 37% more input there
234
- and was not adopted (see [validation](VALIDATION.md)).
235
-
236
- ## Quality principles
237
-
238
- Keep deterministic facts in code and judgment in models. Prefer a correction
239
- turn or a per-item downgrade over discarding useful work, and keep every
240
- downgrade visible in the report. Preserve failed samples; a COMPLETE status or a
241
- successful write does not prove factual quality.