@vintasoftware/pr-review-canvas 0.2.0 → 0.4.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 +61 -26
- package/docs/reference.md +231 -121
- package/package.json +18 -4
- package/pr-review.config.example.yml +10 -4
- package/prompts/chat-seed.md +3 -0
- package/prompts/generation-format.md +3 -0
- package/skills/pr-review-canvas/SKILL.md +77 -40
- package/src/acpx/acpx.ts +21 -4
- package/src/acpx/events.ts +5 -1
- package/src/acpx/ndjson.ts +3 -1
- package/src/acpx/preflight.ts +5 -1
- package/src/canvas/comment.ts +24 -0
- package/src/canvas/export.ts +11 -2
- package/src/canvas/import.ts +30 -9
- package/src/canvas/name.ts +1 -0
- package/src/canvas/zip.ts +25 -2
- package/src/chat/chat-manager.ts +55 -41
- package/src/chat/context.ts +10 -3
- package/src/chat/seed.ts +3 -1
- package/src/chat/threads.ts +27 -26
- package/src/cli.ts +24 -9
- package/src/commands.ts +86 -25
- package/src/config.ts +24 -24
- package/src/contract/api.ts +32 -1
- package/src/contract/canvas-manifest.ts +2 -0
- package/src/contract/comments.ts +8 -1
- package/src/contract/discovery.ts +5 -2
- package/src/contract/generation-context.ts +27 -2
- package/src/contract/review-artifact.ts +14 -8
- package/src/contract/review-key.ts +51 -0
- package/src/contract/reviews.ts +17 -0
- package/src/contract/settings.ts +2 -0
- package/src/contract/state.ts +41 -19
- package/src/git/diff-collector.ts +2 -1
- package/src/git/environment.mjs +27 -0
- package/src/git/git.ts +117 -12
- 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 -37
- package/src/github/comments.ts +9 -27
- package/src/github/post-comment.ts +7 -37
- package/src/github/post-review.ts +4 -19
- package/src/github/pr.ts +6 -84
- package/src/github/threads.ts +6 -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 +54 -0
- package/src/gitlab/project.ts +13 -0
- package/src/host/attachments.ts +293 -0
- package/src/host/capabilities.ts +38 -0
- package/src/host/client.ts +245 -0
- package/src/host/host.ts +136 -0
- package/src/host/pr.ts +51 -0
- package/src/host/remote.ts +42 -0
- package/src/project-config.ts +25 -9
- package/src/prompt-files.ts +4 -3
- package/src/review/carry-over.ts +79 -0
- package/src/review/doctor.ts +31 -14
- package/src/review/normalize.ts +3 -1
- package/src/review/prepare.ts +87 -17
- package/src/review/prompt.ts +8 -2
- package/src/review/publish.ts +76 -13
- package/src/{github → review}/review-body.ts +17 -5
- package/src/review/skill-command.ts +5 -3
- package/src/review/trim-caps.ts +10 -6
- package/src/review/validate-folds.ts +2 -2
- package/src/review/validate.ts +67 -15
- package/src/server/app.ts +12 -4
- package/src/server/bundle.ts +320 -106
- package/src/server/context.ts +24 -10
- package/src/server/errors.ts +56 -10
- package/src/server/html.ts +36 -12
- package/src/server/node-server.ts +4 -2
- package/src/server/routes/api.ts +92 -31
- package/src/server/routes/chat-routes.ts +105 -46
- package/src/server/routes/pages.ts +25 -9
- package/src/server/routes/review-routes.ts +101 -35
- package/src/server/sse.ts +3 -1
- package/src/store/atomic-json.ts +5 -1
- package/src/store/canvas-store.ts +95 -46
- package/src/store/data-dir.ts +2 -1
- package/src/store/derived-store.ts +41 -23
- package/src/store/pr-store.ts +25 -15
- package/src/store/state-store.ts +42 -37
- package/static/brand.svg +19 -0
- package/static/js/api.js +47 -27
- package/static/js/app.js +27 -7
- package/static/js/chat-panel.js +93 -0
- package/static/js/chat.js +41 -17
- package/static/js/composer.js +30 -17
- package/static/js/contract-types.d.ts +3 -0
- package/static/js/diagram.js +2 -1
- package/static/js/diff-decorations.js +5 -3
- package/static/js/diff-renderer.js +7 -2
- package/static/js/dom.js +5 -7
- package/static/js/download.js +1 -1
- package/static/js/empty-state.js +85 -16
- package/static/js/errors.js +22 -6
- package/static/js/header.js +32 -9
- package/static/js/host.js +40 -0
- package/static/js/import-zone.js +1 -1
- package/static/js/interactions.js +56 -17
- package/static/js/keyboard.js +7 -2
- package/static/js/layers.js +26 -14
- package/static/js/links.js +9 -3
- package/static/js/markdown.js +28 -1
- package/static/js/nav.js +5 -2
- package/static/js/overview.js +32 -4
- package/static/js/points.js +5 -3
- package/static/js/progress.js +2 -1
- package/static/js/proposed-comment.js +4 -1
- package/static/js/quick-questions.js +2 -1
- package/static/js/regenerate.js +4 -1
- package/static/js/review-session.js +7 -2
- package/static/js/settings.js +2 -1
- package/static/js/signoff.js +9 -6
- package/static/styles/base.css +16 -6
- package/static/styles/chat-panel.css +81 -0
- package/static/styles/chat-tools.css +28 -0
- package/static/styles/chat.css +1 -1
- package/static/styles/commands.css +10 -4
- package/static/styles/diff.css +1 -1
- package/static/styles/header.css +18 -4
- package/static/styles/layout.css +4 -4
- package/static/styles/panels.css +4 -0
- package/static/styles/responsive.css +1 -15
- package/static/styles/review-actions.css +1 -0
- package/static/styles/review.css +24 -3
- package/static/styles/skin-github.css +99 -100
- package/static/styles.css +13 -12
- package/src/github/gh.ts +0 -196
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
|
|
|
@@ -57,10 +77,11 @@ Re-run `pr-review install-skill` after upgrading the CLI to refresh them. It als
|
|
|
57
77
|
project's `.gitignore`. Restart your coding agent if the skill
|
|
58
78
|
does not appear. Repeat this setup for each project you want to review.
|
|
59
79
|
|
|
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
|
|
80
|
+
`doctor` checks Git, your GitHub or GitLab remote, the matching CLI (`gh` or `glab`) and its login,
|
|
81
|
+
write access to the local canvas directory, and whether installed skills match the current package.
|
|
82
|
+
It prints a JSON report with a result for each check and suggested fixes for failures.
|
|
83
|
+
`doctor --all-checks` also checks that `acpx` runs and reports its version. Exit code `0` means all
|
|
84
|
+
checks passed.
|
|
64
85
|
|
|
65
86
|
`serve` automatically runs the skill check and warns on stderr if a skill is missing, outdated,
|
|
66
87
|
or modified. The warning includes the reinstall command and does not block startup.
|
|
@@ -89,22 +110,26 @@ See the [CLI and configuration reference](docs/reference.md) for detailed option
|
|
|
89
110
|
pr-review export --pr 123
|
|
90
111
|
```
|
|
91
112
|
|
|
92
|
-
The command prints the zip's absolute path.
|
|
93
|
-
|
|
113
|
+
The command prints the zip's absolute path. `export` saves locally; `publish` also shares PR/MR
|
|
114
|
+
canvases automatically as compressed comments.
|
|
94
115
|
|
|
95
116
|
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.
|
|
117
|
+
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
118
|
|
|
99
119
|
### Update an outdated canvas
|
|
100
120
|
|
|
101
121
|
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`.
|
|
122
|
+
same commit, run `/pr-review-canvas 123 --force`. Publishing updates your canvas comment automatically.
|
|
103
123
|
Reviewers click **refresh**.
|
|
104
124
|
|
|
105
125
|
When the saved canvas describes a different PR head, **Canvas is outdated** appears at
|
|
106
126
|
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
|
|
127
|
+
from that view is disabled. Click **refresh** to check GitHub or GitLab for changes and a newer canvas.
|
|
128
|
+
|
|
129
|
+
A head whose diff is identical to the canvas's does not outdate it: after **Update branch**
|
|
130
|
+
merged `main` in without touching the changed files, for example, the canvas still applies
|
|
131
|
+
and the page says so. Set `canvas.keepForIdenticalDiff: false` in the project config to treat
|
|
132
|
+
every commit as a new head.
|
|
108
133
|
|
|
109
134
|
## Configuration
|
|
110
135
|
|
|
@@ -138,9 +163,9 @@ Customize generation and AI Chat prompts with the `prompts` map in your project'
|
|
|
138
163
|
|
|
139
164
|
```yaml
|
|
140
165
|
prompts:
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
166
|
+
generation-format.md: review-prompts/generation-format.md
|
|
167
|
+
generation-surfacing.md: review-prompts/generation-surfacing.md
|
|
168
|
+
chat-seed.md: review-prompts/chat-seed.md
|
|
144
169
|
```
|
|
145
170
|
|
|
146
171
|
Copy the installed templates to start editing (for an npm global install):
|
|
@@ -161,6 +186,10 @@ Restart the server after changing the config; chat template edits apply to new t
|
|
|
161
186
|
See the [prompt template reference](docs/reference.md#prompt-templates) for supported keys,
|
|
162
187
|
path rules, validation, and upgrades.
|
|
163
188
|
|
|
189
|
+
## Website
|
|
190
|
+
|
|
191
|
+
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.
|
|
192
|
+
|
|
164
193
|
## Contributing
|
|
165
194
|
|
|
166
195
|
In a clone of this tool, use pnpm for the shared lockfile and development checks:
|
|
@@ -168,11 +197,17 @@ In a clone of this tool, use pnpm for the shared lockfile and development checks
|
|
|
168
197
|
```bash
|
|
169
198
|
corepack pnpm --version
|
|
170
199
|
corepack pnpm install --frozen-lockfile
|
|
200
|
+
corepack pnpm hooks:install
|
|
171
201
|
corepack pnpm exec playwright install --with-deps chromium
|
|
172
202
|
corepack pnpm verify
|
|
173
203
|
corepack pnpm start --repo /path/to/your-project
|
|
174
204
|
```
|
|
175
205
|
|
|
206
|
+
The pre-commit hook runs `pnpm precommit`: lint, formatting, strict type checks, and tests.
|
|
207
|
+
Any failure blocks the commit. Run `pnpm hooks:install`
|
|
208
|
+
once per clone to enable it. Use `pnpm lint:fix` and `pnpm format` to apply automatic fixes.
|
|
209
|
+
CI runs the same checks through `pnpm verify`, with coverage executing the unit tests once.
|
|
210
|
+
|
|
176
211
|
Run the full `pnpm verify` before pushing. Keep branch coverage at least 96% when adding or
|
|
177
212
|
changing behavior, leaving a margin above CI's 95% minimum. Cover meaningful failure and boundary
|
|
178
213
|
cases rather than lowering thresholds. Each CI job uploads `coverage-node-<version>` with branch
|