@vintasoftware/pr-review-canvas 0.3.0 → 0.5.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 +79 -31
- package/docs/reference.md +396 -101
- package/package.json +9 -4
- package/pr-review.config.example.yml +44 -4
- package/prompts/chat-seed.md +3 -0
- package/prompts/generation-format.md +123 -26
- package/prompts/generation-strict-incremental.md +53 -0
- package/prompts/generation-strict.md +1 -27
- package/prompts/generation-surfacing-incremental.md +56 -0
- package/prompts/generation-surfacing.md +1 -58
- package/prompts/judging-strict.md +27 -0
- package/prompts/judging-surfacing.md +58 -0
- package/skills/pr-review-canvas/SKILL.md +81 -42
- package/src/acpx/acpx.ts +98 -5
- package/src/acpx/models.ts +43 -0
- package/src/canvas/comment.ts +24 -0
- package/src/canvas/import.ts +30 -9
- package/src/canvas/name.ts +1 -0
- package/src/canvas/zip.ts +21 -1
- package/src/chat/chat-manager.ts +67 -40
- package/src/chat/threads.ts +27 -26
- package/src/cli.ts +70 -8
- package/src/commands.ts +50 -17
- package/src/config.ts +14 -26
- package/src/contract/api.ts +58 -2
- package/src/contract/canvas-manifest.ts +7 -0
- package/src/contract/comments.ts +5 -0
- package/src/contract/discovery.ts +5 -2
- package/src/contract/generation-context.ts +76 -2
- package/src/contract/keys.ts +1 -0
- package/src/contract/pending.ts +49 -0
- package/src/contract/review-artifact.ts +50 -7
- package/src/contract/review-key.ts +51 -0
- package/src/contract/reviews.ts +26 -0
- package/src/contract/settings.ts +7 -0
- package/src/contract/state.ts +53 -22
- package/src/contract/validation.ts +1 -0
- package/src/git/environment.mjs +27 -0
- package/src/git/git.ts +109 -9
- package/src/git/local-target.ts +138 -0
- package/src/git/patch-lines.ts +34 -2
- package/src/git/pr-refs.ts +36 -0
- package/src/github/attachments.ts +9 -257
- package/src/github/canvas-comment.ts +22 -0
- package/src/github/capabilities.ts +3 -41
- package/src/github/comments.ts +3 -24
- package/src/github/post-comment.ts +3 -36
- package/src/github/post-review.ts +64 -23
- package/src/github/pr.ts +6 -87
- package/src/github/threads.ts +2 -2
- package/src/gitlab/attachments.ts +40 -0
- package/src/gitlab/canvas-comment.ts +26 -0
- package/src/gitlab/capabilities.ts +64 -0
- package/src/gitlab/comments.ts +164 -0
- package/src/gitlab/mr.ts +115 -0
- package/src/gitlab/post-comment.ts +111 -0
- package/src/gitlab/post-review.ts +93 -0
- package/src/gitlab/project.ts +13 -0
- package/src/gitlab/publish-drafts.ts +69 -0
- package/src/host/attachments.ts +293 -0
- package/src/host/capabilities.ts +38 -0
- package/src/host/client.ts +246 -0
- package/src/host/host.ts +154 -0
- package/src/host/pr.ts +51 -0
- package/src/host/remote.ts +42 -0
- package/src/project-config.ts +26 -0
- package/src/review/carry-marks.ts +131 -0
- package/src/review/carry-over.ts +79 -0
- package/src/review/doctor.ts +82 -38
- package/src/review/incremental.ts +107 -0
- package/src/review/normalize.ts +14 -4
- package/src/review/prepare.ts +111 -10
- package/src/review/prompt.ts +112 -5
- package/src/review/publish.ts +62 -10
- package/src/{github → review}/review-body.ts +17 -5
- package/src/review/skill-command.ts +5 -3
- package/src/review/test-paths.ts +44 -4
- package/src/review/validate-folds.ts +349 -24
- package/src/review/validate.ts +14 -5
- package/src/server/bundle.ts +324 -111
- package/src/server/context.ts +10 -8
- package/src/server/errors.ts +30 -8
- package/src/server/html.ts +35 -11
- package/src/server/routes/api.ts +63 -26
- package/src/server/routes/chat-routes.ts +91 -44
- package/src/server/routes/pages.ts +26 -9
- package/src/server/routes/review-routes.ts +278 -67
- package/src/store/canvas-store.ts +93 -55
- package/src/store/data-dir.ts +2 -1
- package/src/store/derived-store.ts +41 -27
- package/src/store/pr-store.ts +23 -14
- package/src/store/settings-store.ts +9 -1
- package/src/store/state-store.ts +105 -36
- package/src/upgrade.ts +338 -0
- package/static/js/api.js +87 -25
- package/static/js/app.js +50 -15
- package/static/js/chat-panel.js +32 -9
- package/static/js/chat.js +30 -6
- package/static/js/code-folds.js +171 -44
- package/static/js/composer.js +132 -17
- package/static/js/contract-types.d.ts +7 -0
- package/static/js/diff-decorations.js +67 -1
- package/static/js/diff-renderer.js +1 -1
- package/static/js/download.js +1 -1
- package/static/js/empty-state.js +102 -18
- package/static/js/errors.js +22 -6
- package/static/js/fold-levels.js +176 -0
- package/static/js/header.js +65 -15
- package/static/js/host.js +40 -0
- package/static/js/import-zone.js +1 -1
- package/static/js/interactions.js +274 -46
- package/static/js/keyboard.js +4 -1
- package/static/js/keys.js +12 -0
- package/static/js/layers.js +295 -32
- package/static/js/links.js +3 -3
- package/static/js/markdown.js +28 -1
- package/static/js/nav.js +22 -4
- package/static/js/pending.js +161 -0
- package/static/js/points.js +70 -9
- package/static/js/progress.js +4 -5
- package/static/js/quick-questions.js +15 -2
- package/static/js/reading-level.js +97 -0
- package/static/js/review-session.js +113 -29
- package/static/js/settings.js +55 -24
- package/static/js/signoff.js +79 -10
- package/static/js/skin.js +2 -2
- package/static/styles/chat-panel.css +22 -24
- package/static/styles/chat.css +4 -0
- package/static/styles/commands.css +6 -0
- package/static/styles/header.css +21 -0
- package/static/styles/panels.css +4 -0
- package/static/styles/pending.css +102 -0
- package/static/styles/review-actions.css +1 -0
- package/static/styles/review.css +4 -0
- package/static/styles/skin-github.css +7 -1
- package/static/styles.css +1 -0
- package/src/github/gh.ts +0 -211
package/README.md
CHANGED
|
@@ -1,25 +1,42 @@
|
|
|
1
1
|
# PR Review Canvas
|
|
2
2
|
|
|
3
|
-
Review a GitHub pull request canvas: layers by topic, with grouped diffs,
|
|
4
|
-
and an optional AI chat. Everything runs locally at **http://localhost:3010**.
|
|
3
|
+
Review a GitHub pull request or GitLab merge request canvas: layers by topic, with grouped diffs,
|
|
4
|
+
attention points, comments, and an optional AI chat. Everything runs locally at **http://localhost:3010**.
|
|
5
5
|
|
|
6
6
|
## Quick start: author generates, reviewers review
|
|
7
7
|
|
|
8
8
|
### Author side
|
|
9
9
|
|
|
10
|
-
Each PR author
|
|
11
|
-
|
|
10
|
+
Each PR author generates a canvas before requesting review. The skill shares it automatically
|
|
11
|
+
in a comment on the GitHub PR or GitLab MR. After the project setup below, run the installed skill in Claude Code or Codex:
|
|
12
12
|
|
|
13
13
|
```text
|
|
14
14
|
/pr-review-canvas 123
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
Replace **123** with your PR number. The skill reads the PR, generates and validates the canvas,
|
|
18
|
-
|
|
17
|
+
Replace **123** with your PR number. The skill reads the PR, generates and validates the canvas, then publishes a compressed canvas
|
|
18
|
+
comment using your `gh` or `glab` login. It returns a local review URL and the comment link.
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
If automatic sharing fails (including a canvas too large for one comment), the skill warns you
|
|
21
|
+
and gives you a ZIP path. Drag that ZIP into the PR or MR description, wait for the upload, and
|
|
22
|
+
save. This manual upload is only a fallback.
|
|
23
|
+
|
|
24
|
+
### Before you open the pull request
|
|
25
|
+
|
|
26
|
+
To read your own change the way a reviewer will, generate a canvas for the work in your clone:
|
|
27
|
+
|
|
28
|
+
```text
|
|
29
|
+
/pr-review-canvas branch # the current branch against the default branch
|
|
30
|
+
/pr-review-canvas uncommitted # the same, with your working-tree edits and new files on top
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Start `pr-review serve` and open **http://localhost:3010/review/branch** or
|
|
34
|
+
**/review/uncommitted**. The two are separate reviews, so generating one leaves the other alone.
|
|
35
|
+
|
|
36
|
+
Nothing is posted anywhere: local work has no pull request, so the comment and sign-off commands
|
|
37
|
+
stay off. Add `--base <ref>` to compare against another branch. Committing after `branch`, or
|
|
38
|
+
editing a file after `uncommitted`, moves the head: the next time you open the page or press
|
|
39
|
+
refresh, the canvas is marked outdated and the page offers to generate it again.
|
|
23
40
|
|
|
24
41
|
### Review side
|
|
25
42
|
|
|
@@ -29,13 +46,16 @@ Start the canvas server from the project you want to review:
|
|
|
29
46
|
pr-review serve
|
|
30
47
|
```
|
|
31
48
|
|
|
32
|
-
Open **http://localhost:3010**, enter a PR number
|
|
33
|
-
review. Stop the server with **Ctrl+C**. To use another port, run `pr-review serve --port 3011`.
|
|
49
|
+
Open **http://localhost:3010**, enter a PR number (or follow a link to a local review), and
|
|
50
|
+
leave the terminal running while you review. Stop the server with **Ctrl+C**. To use another port, run `pr-review serve --port 3011`.
|
|
34
51
|
|
|
35
52
|
## Install
|
|
36
53
|
|
|
37
|
-
You need Node.js 22+, npm, Git, and
|
|
38
|
-
|
|
54
|
+
You need Node.js 22+, npm, Git, and the CLI for your host:
|
|
55
|
+
|
|
56
|
+
- GitHub: [GitHub CLI](https://cli.github.com). Sign in with `gh auth login`.
|
|
57
|
+
- GitLab: [GitLab CLI (glab)](https://gitlab.com/gitlab-org/cli). Sign in with `glab auth login`.
|
|
58
|
+
Self-hosted GitLab whose hostname does not contain `gitlab` needs `PR_REVIEW_HOST=gitlab`.
|
|
39
59
|
|
|
40
60
|
Install the command globally once, for use in any project:
|
|
41
61
|
|
|
@@ -43,6 +63,18 @@ Install the command globally once, for use in any project:
|
|
|
43
63
|
npm install -g @vintasoftware/pr-review-canvas
|
|
44
64
|
```
|
|
45
65
|
|
|
66
|
+
### Upgrade
|
|
67
|
+
|
|
68
|
+
Run this from a project that has the skill installed:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
pr-review upgrade
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
It updates pr-review, acpx, and the project's skill copies, after showing the plan and asking.
|
|
75
|
+
Commit and push any refreshed skill copies so your team uses the same skill. `--yes` skips the
|
|
76
|
+
question.
|
|
77
|
+
|
|
46
78
|
## Set up a project
|
|
47
79
|
|
|
48
80
|
```bash
|
|
@@ -53,14 +85,14 @@ pr-review doctor --all-checks
|
|
|
53
85
|
|
|
54
86
|
`install-skill` sets up **both Claude Code and Codex** in one command: `.claude/skills/pr-review-canvas`
|
|
55
87
|
and `.agents/skills/pr-review-canvas`, respectively. These are portable copies you can commit to Git.
|
|
56
|
-
|
|
57
|
-
project's `.gitignore`. Restart your coding agent if the skill
|
|
58
|
-
does not appear. Repeat this setup for each project you want to review.
|
|
88
|
+
`pr-review upgrade` refreshes them after the CLI changes. It also adds `.pr-review/settings.yml` to the
|
|
89
|
+
project's `.gitignore`. Restart your coding agent if the skill does not appear. Repeat this setup for each project you want to review.
|
|
59
90
|
|
|
60
|
-
`doctor` checks Git, your GitHub remote, the
|
|
61
|
-
canvas directory, and whether installed skills match the current package.
|
|
62
|
-
each check and suggested fixes for failures.
|
|
63
|
-
reports its version. Exit code `0` means all
|
|
91
|
+
`doctor` checks Git, your GitHub or GitLab remote, the matching CLI (`gh` or `glab`) and its login,
|
|
92
|
+
write access to the local canvas directory, and whether installed skills match the current package.
|
|
93
|
+
It prints a JSON report with a result for each check and suggested fixes for failures.
|
|
94
|
+
`doctor --all-checks` also checks that `acpx` runs and reports its version. Exit code `0` means all
|
|
95
|
+
checks passed.
|
|
64
96
|
|
|
65
97
|
`serve` automatically runs the skill check and warns on stderr if a skill is missing, outdated,
|
|
66
98
|
or modified. The warning includes the reinstall command and does not block startup.
|
|
@@ -70,7 +102,7 @@ or modified. The warning includes the reinstall command and does not block start
|
|
|
70
102
|
To ask questions about a PR inside the canvas, install `acpx` globally:
|
|
71
103
|
|
|
72
104
|
```bash
|
|
73
|
-
npm install -g acpx
|
|
105
|
+
npm install -g acpx@latest
|
|
74
106
|
acpx --version
|
|
75
107
|
pr-review doctor --all-checks
|
|
76
108
|
```
|
|
@@ -89,34 +121,46 @@ See the [CLI and configuration reference](docs/reference.md) for detailed option
|
|
|
89
121
|
pr-review export --pr 123
|
|
90
122
|
```
|
|
91
123
|
|
|
92
|
-
The command prints the zip's absolute path.
|
|
93
|
-
|
|
124
|
+
The command prints the zip's absolute path. `export` saves locally; `publish` also shares PR/MR
|
|
125
|
+
canvases automatically as compressed comments.
|
|
94
126
|
|
|
95
127
|
The zip contains `manifest.json` and `review.json`: the PR description, file/hunk metadata,
|
|
96
|
-
and generated review notes.
|
|
97
|
-
information. Each reviewer gets source diffs from their own clone; chat history stays local.
|
|
128
|
+
and generated review notes. Publishing shares this information with everyone who can read the PR/MR. Each reviewer gets source diffs from their own clone; chat history stays local.
|
|
98
129
|
|
|
99
130
|
### Update an outdated canvas
|
|
100
131
|
|
|
101
132
|
After pushing new commits, run `/pr-review-canvas 123` again. To rewrite a canvas for the
|
|
102
|
-
same commit, run `/pr-review-canvas 123 --force`.
|
|
133
|
+
same commit, run `/pr-review-canvas 123 --force`. Publishing updates your canvas comment automatically.
|
|
103
134
|
Reviewers click **refresh**.
|
|
104
135
|
|
|
105
136
|
When the saved canvas describes a different PR head, **Canvas is outdated** appears at
|
|
106
137
|
the top. You can still read the older canvas, with its commit and distance shown; posting
|
|
107
|
-
from that view is disabled. Click **refresh** to check GitHub for changes and a newer
|
|
138
|
+
from that view is disabled. Click **refresh** to check GitHub or GitLab for changes and a newer canvas.
|
|
139
|
+
|
|
140
|
+
A head whose diff is identical to the canvas's does not outdate it: after **Update branch**
|
|
141
|
+
merged `main` in without touching the changed files, for example, the canvas still applies
|
|
142
|
+
and the page says so. Set `canvas.keepForIdenticalDiff: false` in the project config to treat
|
|
143
|
+
every commit as a new head.
|
|
144
|
+
|
|
145
|
+
Regenerating for a new head updates the previous canvas. Content for untouched files is kept,
|
|
146
|
+
and your review progress on them follows. `--force` starts from a blank page, and
|
|
147
|
+
`canvas.incremental: false` turns this off. See [Incremental canvases](docs/reference.md#incremental-canvases).
|
|
108
148
|
|
|
109
149
|
## Configuration
|
|
110
150
|
|
|
111
151
|
### User-local preferences
|
|
112
152
|
|
|
113
|
-
Your appearance and AI Chat preferences are saved in `.pr-review/settings.yml`
|
|
114
|
-
project directory. This file is ignored by Git, so each teammate can use their own
|
|
153
|
+
Your appearance, reading level, and AI Chat preferences are saved in `.pr-review/settings.yml`
|
|
154
|
+
in your local project directory. This file is ignored by Git, so each teammate can use their own
|
|
155
|
+
settings.
|
|
115
156
|
|
|
116
|
-
Use **skin** and **theme** in the header to change the appearance
|
|
157
|
+
Use **skin** and **theme** in the header to change the appearance, and **Hide code by default**
|
|
158
|
+
in the settings dialog to choose how much code a review hides when it opens.
|
|
117
159
|
|
|
118
160
|
For AI Chat, open **settings**, choose Claude Code or Codex, and optionally enter a model ID.
|
|
119
|
-
Leave the model blank to use the agent's default.
|
|
161
|
+
Leave the model blank to use the agent's default. A model ID runs as the newest model of its family
|
|
162
|
+
(`claude-opus-4-8` runs as `opus`); write `pin:claude-opus-4-8` to use that exact model. See
|
|
163
|
+
[Model families](docs/reference.md#model-families). You can also adjust the reply timeout and
|
|
120
164
|
maximum turns. Click **Test agent** to check the connection, then **save**.
|
|
121
165
|
|
|
122
166
|
Switching agents starts a new thread and keeps earlier threads. Server flags `--agent` and
|
|
@@ -161,6 +205,10 @@ Restart the server after changing the config; chat template edits apply to new t
|
|
|
161
205
|
See the [prompt template reference](docs/reference.md#prompt-templates) for supported keys,
|
|
162
206
|
path rules, validation, and upgrades.
|
|
163
207
|
|
|
208
|
+
## Website
|
|
209
|
+
|
|
210
|
+
The [project website](https://vintasoftware.github.io/pr-review-canvas/) introduces the review workflow with a real PR walkthrough. See [website development and publishing](docs/website.md) for local preview commands and the GitHub Pages deployment workflow.
|
|
211
|
+
|
|
164
212
|
## Contributing
|
|
165
213
|
|
|
166
214
|
In a clone of this tool, use pnpm for the shared lockfile and development checks:
|