@hcrosse/opencode-pr-tracker 0.3.0 → 0.4.1
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 +67 -62
- package/dist/server.js +1215 -2838
- package/dist/server.js.map +30 -21
- package/dist/tui.js +1112 -4393
- package/dist/tui.js.map +20 -28
- package/package.json +34 -26
- package/server.js +1 -0
- package/tui.js +1 -0
package/README.md
CHANGED
|
@@ -1,88 +1,93 @@
|
|
|
1
1
|
# OpenCode PR Tracker
|
|
2
2
|
|
|
3
|
-
Track GitHub pull requests
|
|
4
|
-
slash commands for attaching pull requests, then shows their lifecycle,
|
|
5
|
-
mergeability, and CI status in the TUI sidebar.
|
|
3
|
+
Track GitHub pull requests in an OpenCode session. Attach pull requests with a slash command or let the agent attach them, and the session's sidebar shows each one's state, checks, and mergeability.
|
|
6
4
|
|
|
7
5
|
## Requirements
|
|
8
6
|
|
|
9
|
-
- OpenCode
|
|
10
|
-
- [GitHub CLI](https://cli.github.com/)
|
|
11
|
-
-
|
|
7
|
+
- [OpenCode](https://opencode.ai/) 2.0.15 or later, from plugin version 0.4.0. For OpenCode 1, use version 0.3.
|
|
8
|
+
- A GitHub token: set `GH_TOKEN` or `GITHUB_TOKEN`, or sign in with the [GitHub CLI](https://cli.github.com/) (`gh auth login`).
|
|
9
|
+
- The GitHub CLI, to attach a pull request by number.
|
|
10
|
+
- macOS or Linux, to open pull requests in the browser.
|
|
12
11
|
|
|
13
12
|
## Install
|
|
14
13
|
|
|
15
|
-
Install the server and TUI plugins:
|
|
16
|
-
|
|
17
14
|
```sh
|
|
18
|
-
opencode plugin @hcrosse/opencode-pr-tracker
|
|
15
|
+
opencode plugin add @hcrosse/opencode-pr-tracker
|
|
19
16
|
```
|
|
20
17
|
|
|
21
|
-
|
|
22
|
-
specific release, include its exact version:
|
|
18
|
+
This adds the plugin to your global OpenCode configuration. To use it in one project instead, add it to that project's `opencode.json`:
|
|
23
19
|
|
|
24
|
-
```
|
|
25
|
-
|
|
20
|
+
```jsonc
|
|
21
|
+
{
|
|
22
|
+
"$schema": "https://opencode.ai/config.json",
|
|
23
|
+
"plugins": ["@hcrosse/opencode-pr-tracker"],
|
|
24
|
+
}
|
|
26
25
|
```
|
|
27
26
|
|
|
28
|
-
|
|
27
|
+
Update it with `opencode plugin update`.
|
|
29
28
|
|
|
30
|
-
##
|
|
29
|
+
## Attach pull requests
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
Install each new release by its exact version with `--force`:
|
|
31
|
+
In a session, run `/pr-attach` followed by a pull request URL, with or without `https://`, or a number in the session's GitHub repository:
|
|
34
32
|
|
|
35
|
-
```
|
|
36
|
-
|
|
33
|
+
```text
|
|
34
|
+
/pr-attach github.com/owner/repository/pull/123
|
|
35
|
+
/pr-attach 123
|
|
37
36
|
```
|
|
38
37
|
|
|
39
|
-
|
|
40
|
-
in the current project.
|
|
38
|
+
Without an argument, `/pr-attach` asks for one. Attaching any member of a GitHub Stack attaches the whole Stack, bottom first. If GitHub returns only part of the Stack, nothing is attached. A session can track up to 20 pull requests.
|
|
41
39
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
`/pr-
|
|
45
|
-
|
|
40
|
+
| Command | What it does |
|
|
41
|
+
| ------------ | --------------------------------------------------------------- |
|
|
42
|
+
| `/pr-attach` | Attaches a pull request and the rest of its Stack. |
|
|
43
|
+
| `/pr-detach` | Detaches the pull request you choose. Other Stack members stay. |
|
|
44
|
+
| `/pr-sync` | Refreshes every attached pull request now. |
|
|
45
|
+
| `/pr-open` | Opens the pull request you choose in the browser. |
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
The same commands appear in the command palette (ctrl+p) under **Pull requests**. Deleting a session removes its attachments.
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
- `/pr-open` lets you select and open an attached pull request on macOS or Linux.
|
|
51
|
-
- `/pr-detach` lets you select and remove an attached pull request.
|
|
52
|
-
- `/pr-sync` immediately refreshes attached pull request status.
|
|
53
|
-
- `/pr-tracker-feedback` collects bug reports, feature requests, or other feedback and previews optional diagnostics. It opens a prefilled browser issue by default, with confirmed `gh` submission as an alternative. Diagnostics never automatically include session content, local paths, repository names, or pull request URLs.
|
|
54
|
-
- `/pr-tracker-plugin-update` checks for a compatible plugin release and shows the update command.
|
|
55
|
-
- Agents can use the `pr_list`, `pr_attach`, and `pr_detach` tools when the server plugin is enabled.
|
|
49
|
+
Agents get three tools in the `pr` namespace: `pr.list`, `pr.attach` and `pr.detach`. They act on the agent's session and accept the same URLs and numbers. When several attached pull requests share a number, detach by URL.
|
|
56
50
|
|
|
57
|
-
|
|
58
|
-
one session attachment has that number. Use a pull request URL when repositories
|
|
59
|
-
have attached pull requests with the same number.
|
|
51
|
+
## Sidebar
|
|
60
52
|
|
|
61
|
-
|
|
62
|
-
`https://github.com/<owner>/<repository>/pull/<number>` and
|
|
63
|
-
`github.com/<owner>/<repository>/pull/<number>`.
|
|
53
|
+
Each attached pull request shows its repository, number, status, and title. Open the sidebar with ctrl+x b if your terminal is narrow enough to hide it. Click a row to open its pull request. With more than two pull requests attached, click the **Pull requests** heading to collapse or expand the list.
|
|
64
54
|
|
|
65
|
-
|
|
55
|
+
Stack members appear together in Stack order, joined by `┌─`, `├─` and `└─`. `├┄ 2 PRs not attached` marks Stack members between attached ones. Other pull requests use `•`.
|
|
56
|
+
|
|
57
|
+
| Status | Appearance |
|
|
58
|
+
| --------------- | ---------------------- |
|
|
59
|
+
| Merged | Purple, struck through |
|
|
60
|
+
| Closed | Red, struck through |
|
|
61
|
+
| Merge conflict | Red |
|
|
62
|
+
| Checks failed | Red |
|
|
63
|
+
| Draft | Gray |
|
|
64
|
+
| Checks pending | Yellow |
|
|
65
|
+
| Behind its base | Yellow |
|
|
66
|
+
| Checks passed | Green |
|
|
67
|
+
| No checks | Gray |
|
|
68
|
+
|
|
69
|
+
The first matching row wins. A pull request shows as behind only when its base branch requires it to be up to date. Checks count only their most recent run.
|
|
70
|
+
|
|
71
|
+
Open and closed pull requests refresh every 15 seconds in each session you have viewed or changed since OpenCode started, until the session is deleted. Merged pull requests stop refreshing. When a refresh fails, the sidebar keeps the last status and marks it `stale`. After five minutes of failures, it shows why instead, for example `authenticate` or `GitHub unavailable`.
|
|
72
|
+
|
|
73
|
+
### Compact layout
|
|
74
|
+
|
|
75
|
+
To show one line per pull request, without titles, set the `layout` option:
|
|
76
|
+
|
|
77
|
+
```jsonc
|
|
78
|
+
{
|
|
79
|
+
"plugins": [{ "package": "@hcrosse/opencode-pr-tracker", "options": { "layout": "compact" } }],
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Any other value keeps the default layout.
|
|
84
|
+
|
|
85
|
+
## Development
|
|
86
|
+
|
|
87
|
+
```sh
|
|
88
|
+
mise install
|
|
89
|
+
bun install
|
|
90
|
+
bun run check
|
|
91
|
+
```
|
|
66
92
|
|
|
67
|
-
|
|
68
|
-
current state. Open and closed pull requests refresh at least once per minute
|
|
69
|
-
and when session activity changes. Click a row to open the pull request on
|
|
70
|
-
macOS or Linux. When more than two pull requests are attached, click the
|
|
71
|
-
**Pull requests** heading to collapse or expand its rows. Status refreshes
|
|
72
|
-
continue while the section is collapsed.
|
|
73
|
-
|
|
74
|
-
| State | Appearance |
|
|
75
|
-
| ------------------------ | --------------------- |
|
|
76
|
-
| Merged | Purple, strikethrough |
|
|
77
|
-
| Closed | Red, strikethrough |
|
|
78
|
-
| Merge conflict | Red |
|
|
79
|
-
| Checks passed | Green |
|
|
80
|
-
| Checks pending | Yellow |
|
|
81
|
-
| Checks failed | Red |
|
|
82
|
-
| No checks or unavailable | Gray |
|
|
83
|
-
|
|
84
|
-
Merged and closed states take precedence. For open pull requests, merge
|
|
85
|
-
conflicts take precedence over CI status.
|
|
86
|
-
|
|
87
|
-
If a refresh fails, the sidebar keeps the last successful status and marks it
|
|
88
|
-
as stale. Merged pull requests remain attached but stop refreshing.
|
|
93
|
+
`bun run check` runs lint, format, type checks, tests and a package dry run. `bun run smoke:opencode` installs the packed plugin into a temporary project, starts OpenCode, and exercises the RPC and events against GitHub when `GH_TOKEN` is set. Set `OPENCODE_BIN` to test with a specific OpenCode binary. To verify the terminal UI, follow the project skill in `.opencode/skills/verify-tui/`.
|