opencode-github-pr 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +168 -59
- package/demo/fixtures.ts +74 -8
- package/dist/pr-dashboard.tui.js +8710 -0
- package/package.json +20 -11
- package/plugins/app/DashboardView.tsx +166 -83
- package/plugins/app/PRRow.tsx +86 -54
- package/plugins/app/StatusMessage.tsx +22 -0
- package/plugins/app/config.ts +90 -10
- package/plugins/app/theme.ts +1 -10
- package/plugins/app/usePRData.ts +256 -85
- package/plugins/domain/format.ts +11 -22
- package/plugins/domain/messages.ts +34 -12
- package/plugins/domain/pr-status.ts +23 -22
- package/plugins/domain/types.ts +23 -6
- package/plugins/infra/git.ts +287 -27
- package/plugins/infra/loader.ts +274 -41
- package/plugins/infra/mappers.ts +25 -49
- package/plugins/infra/octokit.ts +33 -17
- package/plugins/infra/queries.ts +137 -51
- package/plugins/pr-dashboard.tui.tsx +124 -40
- package/demo/demo.gif +0 -0
- package/plugins/domain/login.ts +0 -33
package/README.md
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
# opencode-github-pr
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/opencode-github-pr)
|
|
4
|
+
[](https://github.com/987poiuytrewq/opencode-github-pr/actions/workflows/ci.yml)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
|
|
3
7
|
A GitHub pull request dashboard for the [OpenCode](https://opencode.ai) V2 sidebar. See your PRs for the current
|
|
4
8
|
repository, their CI, review and merge status, and jump straight to the right page on GitHub, without leaving OpenCode.
|
|
5
9
|
|
|
6
|
-
|
|
10
|
+
<img src="https://raw.githubusercontent.com/987poiuytrewq/opencode-github-pr/main/demo/demo.gif" alt="The PR dashboard in the OpenCode sidebar, paging through PRs and changing filters" width="552" />
|
|
7
11
|
|
|
8
12
|
## Features
|
|
9
13
|
|
|
@@ -14,16 +18,16 @@ repository, their CI, review and merge status, and jump straight to the right pa
|
|
|
14
18
|
- **Filters:** show PRs for the current branch, authored by you, assigned to you, or all of them, and choose open,
|
|
15
19
|
closed or all states.
|
|
16
20
|
- **Follows your theme:** colours come from your active OpenCode theme, and every colour and icon can be overridden.
|
|
21
|
+
- **Nerd Font or plain Unicode icons**, so it looks right whether or not your terminal font has Nerd Font glyphs.
|
|
17
22
|
- **Works with GitHub.com and GitHub Enterprise Server**, over HTTPS or SSH remotes, including linked Git worktrees.
|
|
18
23
|
|
|
19
24
|
## Requirements
|
|
20
25
|
|
|
21
26
|
- OpenCode **2.0.20 or later** (V2 plugin API).
|
|
22
|
-
- [Bun](https://bun.sh),
|
|
27
|
+
- [Bun](https://bun.sh), if installing from source.
|
|
23
28
|
- A GitHub token, or the [GitHub CLI](https://cli.github.com) signed in with `gh auth login`. See
|
|
24
29
|
[Authentication](#authentication).
|
|
25
|
-
- A terminal font
|
|
26
|
-
[plain icons](#plain-text-icons).
|
|
30
|
+
- A terminal font that supports Nerd Font glyphs, or set `iconStyle` to `"unicode"` to use standard Unicode symbols.
|
|
27
31
|
|
|
28
32
|
## Install from npm
|
|
29
33
|
|
|
@@ -37,9 +41,25 @@ Add the package name to the `plugins` array in your OpenCode config, either glob
|
|
|
37
41
|
}
|
|
38
42
|
```
|
|
39
43
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
Run `/reload` in the TUI. OpenCode installs the package from npm and the **Pull Requests** panel appears in the session
|
|
45
|
+
sidebar.
|
|
46
|
+
|
|
47
|
+
To pass [options](#configuration), keep the plugin registered in `opencode.json` and add a matching entry to the
|
|
48
|
+
global CLI config at `~/.config/opencode/cli.json` (or `$XDG_CONFIG_HOME/opencode/cli.json`):
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"$schema": "https://opencode.ai/v2/cli.json",
|
|
53
|
+
"plugins": [
|
|
54
|
+
{
|
|
55
|
+
"package": "opencode-github-pr",
|
|
56
|
+
"options": {
|
|
57
|
+
"iconStyle": "unicode"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
```
|
|
43
63
|
|
|
44
64
|
## Install from source
|
|
45
65
|
|
|
@@ -51,10 +71,29 @@ when it is connected to a remote server.
|
|
|
51
71
|
bun install
|
|
52
72
|
```
|
|
53
73
|
|
|
54
|
-
|
|
55
|
-
|
|
74
|
+
The install also builds the package's TUI entrypoint. The npm artifact ships this precompiled JavaScript so
|
|
75
|
+
OpenCode's isolated plugin cache can resolve the OpenTUI JSX runtime through the host's shared runtime modules.
|
|
76
|
+
|
|
77
|
+
2. Add the clone's absolute path to the `plugins` array in your OpenCode config. Use the global config at
|
|
78
|
+
`~/.config/opencode/opencode.json` to get the dashboard in every project, or a project's `opencode.json` for just
|
|
79
|
+
that project:
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"$schema": "https://opencode.ai/config.json",
|
|
84
|
+
"plugins": [
|
|
85
|
+
{
|
|
86
|
+
"package": "/absolute/path/to/opencode-github-pr"
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
3. Run `/reload` in the TUI. The **Pull Requests** panel appears in the session sidebar.
|
|
56
93
|
|
|
57
|
-
|
|
94
|
+
However you install it, register the package in `opencode.json` so its server part is available. Put TUI
|
|
95
|
+
[options](#configuration) in the global `cli.json` entry for the same package. The CLI loads the TUI part from the
|
|
96
|
+
server's plugin list, including when it is connected to a remote server.
|
|
58
97
|
|
|
59
98
|
## Authentication
|
|
60
99
|
|
|
@@ -88,7 +127,7 @@ and removed, and on the right, the unresolved comment count, review status and c
|
|
|
88
127
|
|
|
89
128
|
| Element | Meaning | Click opens |
|
|
90
129
|
| --- | --- | --- |
|
|
91
|
-
| PR icon | Green: ready to merge. Red: merge conflict. Grey: draft, closed or unknown.
|
|
130
|
+
| PR icon | Green: ready to merge (including `HAS_HOOKS` when reviews are approved or not required). Red: merge conflict or changes requested. Yellow: blocked, behind, unstable or review required. Grey: draft, closed or unknown. Your theme's info colour: merged ([use GitHub's purple](#colours) instead). | Merge status panel |
|
|
92
131
|
| Title | The PR title, shortened to fit the sidebar. | PR overview |
|
|
93
132
|
| `#128` | PR number. | PR overview |
|
|
94
133
|
| `+42 -7` | Lines added and removed. | Files changed |
|
|
@@ -99,6 +138,10 @@ and removed, and on the right, the unresolved comment count, review status and c
|
|
|
99
138
|
When reviews or checks are in more than one state, each state gets its own icon with a count, for example three green
|
|
100
139
|
dots and one red dot for three passing checks and one failing.
|
|
101
140
|
|
|
141
|
+
On older GitHub Enterprise Server versions that report `mergeStateStatus` or `reviewDecision` as unknown GraphQL fields,
|
|
142
|
+
the dashboard retries once without those fields and continues with the remaining PR data. It does not retry unrelated
|
|
143
|
+
GraphQL errors, including other `422` responses.
|
|
144
|
+
|
|
102
145
|
### Filters
|
|
103
146
|
|
|
104
147
|
The two labels at the top right of the panel are filters. Click one to cycle through its values.
|
|
@@ -112,7 +155,9 @@ You can change the defaults with [`defaultScope` and `defaultStatusFilter`](#con
|
|
|
112
155
|
|
|
113
156
|
### Pages
|
|
114
157
|
|
|
115
|
-
The panel shows five PRs at a time. When there are more, use the arrows at the bottom
|
|
158
|
+
The panel shows five PRs at a time, most recently updated first. When there are more, use the arrows at the bottom
|
|
159
|
+
of the panel to page through them. The counter between the arrows shows the current page and the total, for example
|
|
160
|
+
`2 of 7`. Change the number per page with [`pageSize`](#configuration).
|
|
116
161
|
|
|
117
162
|
### Commands
|
|
118
163
|
|
|
@@ -126,29 +171,49 @@ These commands are available as slash commands and in the command palette, under
|
|
|
126
171
|
### Refreshing
|
|
127
172
|
|
|
128
173
|
The list refreshes when OpenCode starts, each time a session goes idle (for example after the agent finishes a task),
|
|
129
|
-
and every 60 seconds while a session is open. Use `/pr-refresh` to reload it on demand.
|
|
174
|
+
and every 60 seconds while a session is open. Use `/pr-refresh` to reload it on demand. Change the interval with
|
|
175
|
+
[`refreshIntervalMs`](#configuration).
|
|
176
|
+
|
|
177
|
+
### How PRs are loaded
|
|
178
|
+
|
|
179
|
+
The filters are applied by GitHub, so the dashboard only downloads PRs that match them:
|
|
130
180
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
181
|
+
- `all` and `branch` use the repository's PR list, so new PRs appear on the next refresh.
|
|
182
|
+
- `author` and `assignee` use GitHub search. Search can take a short while to index a new PR, so a PR you've just
|
|
183
|
+
opened may appear a refresh or two later. To bridge that delay, the dashboard also checks a small number of the
|
|
184
|
+
repository's newest PRs and adds matching ones that search hasn't returned yet. Set `recentPRsLimit` to `0` to disable
|
|
185
|
+
this supplement. GitHub search also returns at most 1,000 PRs; when you reach that limit, the panel says so.
|
|
134
186
|
|
|
135
|
-
|
|
187
|
+
PRs load in batches. The first batch holds four pages' worth (20 PRs with the default page size). Moving to another
|
|
188
|
+
page starts loading the next batch in the background, so paging stays quick. If you reach the last loaded page
|
|
189
|
+
before the next batch arrives, the panel moves on as soon as it does. Changing a filter loads that filter's first
|
|
190
|
+
batch. Use [`pageSize` and `pagesPerBatch`](#configuration) to change how much is loaded at a time.
|
|
136
191
|
|
|
137
192
|
## Configuration
|
|
138
193
|
|
|
139
|
-
Pass options in the plugin entry's `options` object
|
|
194
|
+
Pass options in the matching plugin entry's `options` object in the global
|
|
195
|
+
`~/.config/opencode/cli.json` (or `$XDG_CONFIG_HOME/opencode/cli.json`). CLI config is global, so these options apply
|
|
196
|
+
to all projects. Every option is optional. For a source installation, use the clone's absolute path as the `package`
|
|
197
|
+
value:
|
|
140
198
|
|
|
141
199
|
```json
|
|
142
200
|
{
|
|
143
|
-
"$schema": "https://opencode.ai/
|
|
201
|
+
"$schema": "https://opencode.ai/v2/cli.json",
|
|
144
202
|
"plugins": [
|
|
145
203
|
{
|
|
146
|
-
"package": "
|
|
204
|
+
"package": "opencode-github-pr",
|
|
147
205
|
"options": {
|
|
148
206
|
"pageSize": 8,
|
|
149
207
|
"refreshIntervalMs": 30000,
|
|
208
|
+
"recentPRsLimit": 5,
|
|
150
209
|
"defaultScope": "all",
|
|
151
|
-
"defaultStatusFilter": "open"
|
|
210
|
+
"defaultStatusFilter": "open",
|
|
211
|
+
"spacing": {
|
|
212
|
+
"iconToCount": 0,
|
|
213
|
+
"sameTypeGroups": 0,
|
|
214
|
+
"differentTypeGroups": 1
|
|
215
|
+
},
|
|
216
|
+
"showSingleStatusCount": false
|
|
152
217
|
}
|
|
153
218
|
}
|
|
154
219
|
]
|
|
@@ -159,15 +224,23 @@ Pass options in the plugin entry's `options` object. Every option is optional:
|
|
|
159
224
|
| --- | --- | --- |
|
|
160
225
|
| `enabled` | `true` | Set to `false` to turn the dashboard off without uninstalling it. |
|
|
161
226
|
| `pageSize` | `5` | PRs shown per page. |
|
|
162
|
-
| `
|
|
227
|
+
| `pagesPerBatch` | `4` | Pages of PRs to load from GitHub at a time, so each batch is `pageSize × pagesPerBatch` PRs. The minimum is `4`; lower values are raised to it. See [How PRs are loaded](#how-prs-are-loaded). |
|
|
163
228
|
| `refreshIntervalMs` | `60000` | How often the list refreshes while a session is open, in milliseconds. |
|
|
164
229
|
| `requestTimeoutMs` | `15000` | How long to wait for a GitHub request before giving up, in milliseconds. |
|
|
230
|
+
| `recentPRsLimit` | `5` | For `author` and `assignee` scopes, check up to this many newest repository PRs to fill search-index gaps. Set to `0` to disable; values above `100` are capped. |
|
|
165
231
|
| `defaultScope` | `"author"` | Scope filter at startup: `branch`, `author`, `assignee` or `all`. |
|
|
166
232
|
| `defaultStatusFilter` | `"open"` | Status filter at startup: `open`, `closed` or `all`. |
|
|
233
|
+
| `iconStyle` | `"nerd"` | Icon set: `"nerd"` for Nerd Font glyphs, or `"unicode"` for standard Unicode symbols that work in any font. See [Icons](#icons). |
|
|
167
234
|
| `colors` | Theme | Colour overrides. See [Colours](#colours). |
|
|
168
|
-
| `icons` |
|
|
235
|
+
| `icons` | From `iconStyle` | Overrides for individual icons. See [Icons](#icons). |
|
|
236
|
+
| `spacing` | See below | Gaps, in terminal cells, between an indicator's icon and count, between same-type groups, and between comment/review/check types. Each gap is clamped to `0`–`4`. |
|
|
237
|
+
| `showSingleStatusCount` | `false` | Show counts for review and check badges even when there is only one status group. |
|
|
238
|
+
|
|
239
|
+
`spacing` accepts `iconToCount`, `sameTypeGroups` and `differentTypeGroups`. Its defaults are `0`, `0` and `1`,
|
|
240
|
+
respectively. For example, set `iconToCount` to `1` to put one cell between each status icon and its count.
|
|
169
241
|
|
|
170
|
-
|
|
242
|
+
Most numeric options must be positive numbers. `recentPRsLimit` accepts `0` through `100`, and spacing gaps accept
|
|
243
|
+
`0` through `4`; invalid values fall back to their defaults.
|
|
171
244
|
|
|
172
245
|
### Colours
|
|
173
246
|
|
|
@@ -176,10 +249,7 @@ By default, colours come from your active OpenCode theme. Override any of them w
|
|
|
176
249
|
|
|
177
250
|
| Key | Used for | Default theme token |
|
|
178
251
|
| --- | --- | --- |
|
|
179
|
-
| `panel` | Panel background | Background |
|
|
180
252
|
| `panelAlt` | Background of each row's second line | Raised background |
|
|
181
|
-
| `border` | Divider above the page controls | Border |
|
|
182
|
-
| `borderActive` | Divider while a page arrow is hovered | Primary action text |
|
|
183
253
|
| `text` | PR titles and the panel heading | Text |
|
|
184
254
|
| `muted` | Secondary text, neutral states | Muted text |
|
|
185
255
|
| `accent` | Hovered filters and page arrows | Primary action text |
|
|
@@ -187,56 +257,76 @@ By default, colours come from your active OpenCode theme. Override any of them w
|
|
|
187
257
|
| `warning` | Pending checks, requested reviews, warnings | Warning text |
|
|
188
258
|
| `error` | Failing checks, requested changes, conflicts, deletions, errors | Error text |
|
|
189
259
|
| `draft` | Draft PR icon | Muted text |
|
|
190
|
-
| `merged` | Merged PR icon |
|
|
260
|
+
| `merged` | Merged PR icon | Info text |
|
|
191
261
|
|
|
192
|
-
|
|
262
|
+
To show merged PRs in GitHub's purple instead of your theme's info colour, set `merged` to `"#a371f7"` (GitHub's dark
|
|
263
|
+
theme) or `"#8250df"` (GitHub's light theme). Colour and icon overrides go inside the plugin entry's `options` in
|
|
264
|
+
`cli.json`, next to the other options:
|
|
193
265
|
|
|
194
266
|
```json
|
|
195
267
|
{
|
|
196
|
-
"
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
"
|
|
268
|
+
"$schema": "https://opencode.ai/v2/cli.json",
|
|
269
|
+
"plugins": [
|
|
270
|
+
{
|
|
271
|
+
"package": "opencode-github-pr",
|
|
272
|
+
"options": {
|
|
273
|
+
"colors": {
|
|
274
|
+
"merged": "#a371f7"
|
|
275
|
+
}
|
|
276
|
+
}
|
|
200
277
|
}
|
|
201
|
-
|
|
278
|
+
]
|
|
202
279
|
}
|
|
203
280
|
```
|
|
204
281
|
|
|
205
282
|
### Icons
|
|
206
283
|
|
|
207
|
-
|
|
284
|
+
`iconStyle` picks the icon set. Nerd Font glyphs are the default; set `"unicode"` if your terminal font doesn't have
|
|
285
|
+
them. Set it in the matching plugin entry's `options` in `cli.json`:
|
|
208
286
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
|
218
|
-
|
|
|
219
|
-
| `
|
|
220
|
-
| `
|
|
221
|
-
| `
|
|
222
|
-
| `
|
|
287
|
+
```json
|
|
288
|
+
{
|
|
289
|
+
"options": {
|
|
290
|
+
"iconStyle": "unicode"
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
| Key | Nerd Font (default) | Unicode | Used for |
|
|
296
|
+
| --- | --- | --- | --- |
|
|
297
|
+
| `openPR` | `U+E726` | `•` | Open PRs |
|
|
298
|
+
| `closedPR` | `U+E726` | `•` | Closed PRs |
|
|
299
|
+
| `draftPR` | `U+E726` | `•` | Draft PRs |
|
|
300
|
+
| `mergedPR` | `U+E727` | `•` | Merged PRs |
|
|
301
|
+
| `review` | `U+F4FF` | `✓` | Review status |
|
|
302
|
+
| `openComment` | `U+F017A` | `■` | Unresolved review threads |
|
|
303
|
+
| `check` | `●` | `●` | CI check status |
|
|
304
|
+
| `scope` | `U+F4D7` | *(none)* | Icon before the filter labels |
|
|
305
|
+
| `loading` | `U+F051F` | `…` | Loading messages |
|
|
306
|
+
| `info` | `U+F129` | `ℹ` | Informational messages |
|
|
307
|
+
| `error` | `U+E654` | `⚠` | Error messages |
|
|
308
|
+
| `previousPage` | `U+EB6F` | `◀` | Previous page arrow |
|
|
309
|
+
| `nextPage` | `U+EB70` | `▶` | Next page arrow |
|
|
310
|
+
|
|
311
|
+
To change individual icons, set them in `icons`. These override the chosen style. An empty string hides an icon;
|
|
312
|
+
whitespace-only values are ignored.
|
|
223
313
|
|
|
224
314
|
#### Plain-text icons
|
|
225
315
|
|
|
226
|
-
If
|
|
227
|
-
characters:
|
|
316
|
+
If neither set suits your font, replace every icon with ASCII characters:
|
|
228
317
|
|
|
229
318
|
```json
|
|
230
319
|
{
|
|
231
320
|
"options": {
|
|
232
321
|
"icons": {
|
|
233
322
|
"openPR": "o",
|
|
323
|
+
"closedPR": "c",
|
|
324
|
+
"draftPR": "d",
|
|
234
325
|
"mergedPR": "m",
|
|
235
326
|
"review": "R",
|
|
236
327
|
"openComment": "C",
|
|
237
328
|
"check": "*",
|
|
238
329
|
"scope": "@",
|
|
239
|
-
"status": "~",
|
|
240
330
|
"loading": "...",
|
|
241
331
|
"info": "i",
|
|
242
332
|
"error": "!",
|
|
@@ -263,16 +353,33 @@ unset for GitHub.com.
|
|
|
263
353
|
|
|
264
354
|
| You see | What to do |
|
|
265
355
|
| --- | --- |
|
|
266
|
-
| No **Pull Requests** panel | Check that the
|
|
267
|
-
|
|
|
356
|
+
| No **Pull Requests** panel | Check that the package is registered in `opencode.json` and that `enabled` isn't `false`, then reload OpenCode. If you installed from source, check that `bun install` has run in the clone. Plugin load errors are written to `~/.local/share/opencode/log/opencode.log`. |
|
|
357
|
+
| Plugin options or colour overrides have no effect | Put the options in the matching plugin entry in the global `~/.config/opencode/cli.json` (or `$XDG_CONFIG_HOME/opencode/cli.json`), not in `opencode.json`, then run `/reload` in the TUI. For a source install, the `package` path in `cli.json` must point to the same clone registered in `opencode.json`. |
|
|
358
|
+
| Icons show as boxes or question marks | Your terminal font doesn't have Nerd Font glyphs. Set `iconStyle` to `"unicode"`, install a Nerd Font, or use [plain-text icons](#plain-text-icons). |
|
|
268
359
|
| **No GitHub repo** | The session's directory isn't a Git repository with a GitHub remote. Add a remote, or open a session in the right project. For Enterprise, check `GITHUB_ENTERPRISE_URL`. |
|
|
269
360
|
| **GitHub sign-in failed** | No valid token was found. Run `gh auth login`, or set `GITHUB_TOKEN` where the OpenCode server starts. |
|
|
270
361
|
| **Permission denied** or **Repo not found** | Your token can't read this repository. Check its scopes or fine-grained permissions, and SSO authorisation for organisation repositories. |
|
|
271
|
-
| **Rate limit exceeded** | GitHub's API limit has been reached. The panel shows when you can try again.
|
|
362
|
+
| **Rate limit exceeded** | GitHub's API limit has been reached. The panel shows when you can try again. Raise `refreshIntervalMs` and avoid paging forward unnecessarily to use less quota. |
|
|
272
363
|
| **Request timed out** or **Cannot reach GitHub** | Check your connection or proxy. On slow networks, raise `requestTimeoutMs`. |
|
|
273
|
-
| **No matching PRs** | No PRs match the current filters. Click the scope or status label to widen them. |
|
|
364
|
+
| **No matching PRs** | No PRs match the current filters. Click the scope or status label to widen them. Under `author` or `assignee`, a PR opened moments ago may not be in GitHub's search index yet; it appears on a later refresh. |
|
|
365
|
+
| **GitHub search is limited to 1,000 matching PRs** | The `author` and `assignee` filters use GitHub search, which returns at most 1,000 PRs. Switch the status filter to `open` or the scope to `all` to see older PRs. |
|
|
274
366
|
| `branch` scope is empty | The current branch has no PR, or the session is in detached HEAD. |
|
|
275
367
|
|
|
368
|
+
## Releasing
|
|
369
|
+
|
|
370
|
+
Releases are published to npm by GitHub Actions after a GitHub Release is published. To make a release:
|
|
371
|
+
|
|
372
|
+
1. Set the `version` in `package.json` to the release version and merge that change to `main`.
|
|
373
|
+
2. Create and publish a GitHub Release with the matching `v`-prefixed tag (for example, package version `0.2.0` uses
|
|
374
|
+
tag `v0.2.0`).
|
|
375
|
+
3. The release workflow verifies the tag and package version, runs the full CI suite, then publishes to npm with
|
|
376
|
+
provenance. Prereleases are not published. The archival `v0.1.0` release is tested but not republished because that
|
|
377
|
+
version already exists on npm.
|
|
378
|
+
|
|
379
|
+
The repository's npm package must be configured for **trusted publishing** on npmjs.com to use GitHub Actions as the
|
|
380
|
+
publisher, with repository `987poiuytrewq/opencode-github-pr`, workflow `release.yml`, and environment `npm`. The
|
|
381
|
+
workflow's `npm` environment can also be configured with required reviewers to gate publication.
|
|
382
|
+
|
|
276
383
|
## Development
|
|
277
384
|
|
|
278
385
|
```bash
|
|
@@ -307,14 +414,16 @@ OpenCode config isn't changed. It uses `GH_TOKEN`, `GITHUB_TOKEN` or `GITHUB_PER
|
|
|
307
414
|
| `make test-integration` | Integration tests. |
|
|
308
415
|
| `make test-e2e` | End-to-end tests against a real OpenCode TUI in tmux. |
|
|
309
416
|
|
|
310
|
-
The end-to-end tests need `tmux` and the OpenCode CLI
|
|
311
|
-
with:
|
|
417
|
+
The end-to-end tests need `tmux` and the OpenCode CLI. `make ci-tools` installs version `2.0.20` by default; override it
|
|
418
|
+
with `OPENCODE_VERSION` to install another version. To run against an already installed binary, use:
|
|
312
419
|
|
|
313
420
|
```bash
|
|
314
421
|
make test-e2e OPENCODE_BIN=/path/to/opencode
|
|
315
422
|
```
|
|
316
423
|
|
|
317
|
-
CI
|
|
424
|
+
CI runs the full test suite against the latest stable patch from each current OpenCode V2 minor line: `2.0.32`,
|
|
425
|
+
`2.1.4`, `2.2.7` and `2.3.2`. OpenCode V1 and older patch releases are not covered by this matrix. Update the matrix
|
|
426
|
+
in `.github/workflows/ci.yml` as new V2 minor lines are released.
|
|
318
427
|
|
|
319
428
|
### Recording the demo
|
|
320
429
|
|
package/demo/fixtures.ts
CHANGED
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
type DashboardState,
|
|
4
4
|
type PR,
|
|
5
5
|
} from "../plugins/domain/types";
|
|
6
|
+
import { filterPRs } from "../plugins/domain/pr-filters";
|
|
6
7
|
|
|
7
8
|
function demoPR(overrides: Partial<PR> & Pick<PR, "number" | "title">): PR {
|
|
8
9
|
const { number, title, ...values } = overrides;
|
|
@@ -20,6 +21,8 @@ function demoPR(overrides: Partial<PR> & Pick<PR, "number" | "title">): PR {
|
|
|
20
21
|
deletions: 18,
|
|
21
22
|
baseRefName: "main",
|
|
22
23
|
mergeable: "MERGEABLE",
|
|
24
|
+
mergeStateStatus: "CLEAN",
|
|
25
|
+
reviewDecision: null,
|
|
23
26
|
statusCheckRollup: { state: "SUCCESS" },
|
|
24
27
|
checkStatuses: ["SUCCESS"],
|
|
25
28
|
reviewThreads: [],
|
|
@@ -36,49 +39,87 @@ const demoPRs: PR[] = [
|
|
|
36
39
|
headRefName: "feature/passkeys",
|
|
37
40
|
additions: 128,
|
|
38
41
|
deletions: 36,
|
|
42
|
+
mergeStateStatus: "HAS_HOOKS",
|
|
43
|
+
reviewDecision: "APPROVED",
|
|
44
|
+
reviewRequests: [
|
|
45
|
+
{ type: "user", login: "alex" },
|
|
46
|
+
{ type: "team", slug: "platform" },
|
|
47
|
+
],
|
|
39
48
|
reviewThreads: [{ isResolved: true }],
|
|
40
49
|
latestReviews: [{ author: { login: "samantha" }, state: "APPROVED" }],
|
|
41
50
|
}),
|
|
42
51
|
demoPR({
|
|
43
52
|
number: 247,
|
|
44
53
|
title: "Retry expired sessions",
|
|
54
|
+
additions: 86,
|
|
55
|
+
deletions: 14,
|
|
45
56
|
assigneeLogins: ["mia"],
|
|
57
|
+
mergeStateStatus: "BLOCKED",
|
|
58
|
+
reviewDecision: "REVIEW_REQUIRED",
|
|
46
59
|
statusCheckRollup: { state: "FAILURE" },
|
|
47
60
|
checkStatuses: ["SUCCESS", "FAILURE"],
|
|
48
|
-
reviewRequests: [
|
|
61
|
+
reviewRequests: [
|
|
62
|
+
{ type: "user", login: "alex" },
|
|
63
|
+
{ type: "user", login: "mia" },
|
|
64
|
+
{ type: "team", slug: "release-engineering" },
|
|
65
|
+
],
|
|
49
66
|
reviewThreads: [{ isResolved: false }, { isResolved: true }],
|
|
67
|
+
latestReviews: [{ author: { login: "jules" }, state: "COMMENTED" }],
|
|
50
68
|
}),
|
|
51
69
|
demoPR({
|
|
52
70
|
number: 246,
|
|
53
71
|
title: "Add audit log filters",
|
|
72
|
+
additions: 52,
|
|
73
|
+
deletions: 21,
|
|
54
74
|
headRefName: "feature/audit-filters",
|
|
75
|
+
mergeStateStatus: "BEHIND",
|
|
55
76
|
statusCheckRollup: { state: "PENDING" },
|
|
56
77
|
checkStatuses: ["SUCCESS", "IN_PROGRESS"],
|
|
78
|
+
reviewRequests: [{ type: "team", slug: "design-systems" }],
|
|
57
79
|
latestReviews: [{ author: { login: "jules" }, state: "COMMENTED" }],
|
|
58
80
|
}),
|
|
59
81
|
demoPR({
|
|
60
82
|
number: 245,
|
|
61
83
|
title: "Improve keyboard navigation",
|
|
84
|
+
additions: 41,
|
|
85
|
+
deletions: 11,
|
|
62
86
|
assigneeLogins: ["mia"],
|
|
63
|
-
|
|
87
|
+
mergeStateStatus: "UNSTABLE",
|
|
88
|
+
reviewDecision: "CHANGES_REQUESTED",
|
|
89
|
+
reviewRequests: [{ type: "user", login: "alex" }],
|
|
90
|
+
latestReviews: [
|
|
91
|
+
{ author: { login: "samantha" }, state: "CHANGES_REQUESTED" },
|
|
92
|
+
],
|
|
64
93
|
}),
|
|
65
94
|
demoPR({
|
|
66
95
|
number: 244,
|
|
67
96
|
title: "Cache organization membership",
|
|
97
|
+
additions: 23,
|
|
98
|
+
deletions: 6,
|
|
68
99
|
statusCheckRollup: { state: "PENDING" },
|
|
69
100
|
checkStatuses: ["QUEUED"],
|
|
70
|
-
reviewRequests: [
|
|
101
|
+
reviewRequests: [
|
|
102
|
+
{ type: "user", login: "mia" },
|
|
103
|
+
{ type: "user", login: "jules" },
|
|
104
|
+
{ type: "team", slug: "docs" },
|
|
105
|
+
],
|
|
106
|
+
latestReviews: [
|
|
107
|
+
{ author: { login: "samantha" }, state: "APPROVED" },
|
|
108
|
+
{ author: { login: "jules" }, state: "APPROVED" },
|
|
109
|
+
],
|
|
71
110
|
}),
|
|
72
111
|
demoPR({
|
|
73
112
|
number: 243,
|
|
74
113
|
title: "Add CLI configuration hints",
|
|
75
|
-
assigneeLogins: ["mia"],
|
|
76
114
|
additions: 31,
|
|
77
115
|
deletions: 9,
|
|
116
|
+
assigneeLogins: ["mia"],
|
|
78
117
|
}),
|
|
79
118
|
demoPR({
|
|
80
119
|
number: 242,
|
|
81
120
|
title: "Simplify session settings",
|
|
121
|
+
additions: 17,
|
|
122
|
+
deletions: 22,
|
|
82
123
|
isDraft: true,
|
|
83
124
|
mergeable: "CONFLICTING",
|
|
84
125
|
statusCheckRollup: { state: "FAILURE" },
|
|
@@ -88,6 +129,8 @@ const demoPRs: PR[] = [
|
|
|
88
129
|
demoPR({
|
|
89
130
|
number: 241,
|
|
90
131
|
title: "Add workspace export",
|
|
132
|
+
additions: 74,
|
|
133
|
+
deletions: 13,
|
|
91
134
|
headRefName: "feature/workspace-export",
|
|
92
135
|
authorLogin: "octocat",
|
|
93
136
|
assigneeLogins: ["samantha"],
|
|
@@ -97,14 +140,16 @@ const demoPRs: PR[] = [
|
|
|
97
140
|
demoPR({
|
|
98
141
|
number: 240,
|
|
99
142
|
title: "Fix landing page contrast",
|
|
100
|
-
authorLogin: "mia",
|
|
101
|
-
assigneeLogins: ["octocat"],
|
|
102
143
|
additions: 12,
|
|
103
144
|
deletions: 7,
|
|
145
|
+
authorLogin: "mia",
|
|
146
|
+
assigneeLogins: ["octocat"],
|
|
104
147
|
}),
|
|
105
148
|
demoPR({
|
|
106
149
|
number: 239,
|
|
107
150
|
title: "Prepare the v2.4 release",
|
|
151
|
+
additions: 104,
|
|
152
|
+
deletions: 28,
|
|
108
153
|
isMerged: true,
|
|
109
154
|
isClosed: true,
|
|
110
155
|
latestReviews: [{ author: { login: "samantha" }, state: "APPROVED" }],
|
|
@@ -112,6 +157,8 @@ const demoPRs: PR[] = [
|
|
|
112
157
|
demoPR({
|
|
113
158
|
number: 238,
|
|
114
159
|
title: "Remove legacy auth fallback",
|
|
160
|
+
additions: 9,
|
|
161
|
+
deletions: 33,
|
|
115
162
|
authorLogin: "jules",
|
|
116
163
|
assigneeLogins: ["octocat"],
|
|
117
164
|
isClosed: true,
|
|
@@ -122,6 +169,8 @@ const demoPRs: PR[] = [
|
|
|
122
169
|
demoPR({
|
|
123
170
|
number: 237,
|
|
124
171
|
title: "Streamline onboarding",
|
|
172
|
+
additions: 65,
|
|
173
|
+
deletions: 4,
|
|
125
174
|
isMerged: true,
|
|
126
175
|
isClosed: true,
|
|
127
176
|
latestReviews: [{ author: { login: "mia" }, state: "APPROVED" }],
|
|
@@ -152,7 +201,24 @@ export function demoDashboardState(): DashboardState {
|
|
|
152
201
|
currentBranch: "feature/passkeys",
|
|
153
202
|
viewerLogin: "octocat",
|
|
154
203
|
fetchedAt: 0,
|
|
155
|
-
|
|
156
|
-
|
|
204
|
+
pagination: {
|
|
205
|
+
listing: "open",
|
|
206
|
+
scope: "author",
|
|
207
|
+
scopeValue: null,
|
|
208
|
+
cursor: null,
|
|
209
|
+
hasMore: false,
|
|
210
|
+
totalCount: filterPRs(
|
|
211
|
+
demoPRs,
|
|
212
|
+
"author",
|
|
213
|
+
"open",
|
|
214
|
+
"feature/passkeys",
|
|
215
|
+
"octocat",
|
|
216
|
+
).length,
|
|
217
|
+
pagesLoaded: 1,
|
|
218
|
+
searchResultsFetched: 0,
|
|
219
|
+
supplementalPRCount: 0,
|
|
220
|
+
loading: false,
|
|
221
|
+
limitReached: false,
|
|
222
|
+
},
|
|
157
223
|
};
|
|
158
224
|
}
|