@juangadm/pre-post 1.2.0 → 1.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.
Files changed (83) hide show
  1. package/README.md +52 -182
  2. package/dist/baseline.d.ts +122 -3
  3. package/dist/baseline.d.ts.map +1 -1
  4. package/dist/baseline.js +491 -46
  5. package/dist/baseline.js.map +1 -1
  6. package/dist/bin/cli.js +41 -17
  7. package/dist/bin/cli.js.map +1 -1
  8. package/dist/browser.d.ts +38 -3
  9. package/dist/browser.d.ts.map +1 -1
  10. package/dist/browser.js +132 -11
  11. package/dist/browser.js.map +1 -1
  12. package/dist/commands/compare.d.ts.map +1 -1
  13. package/dist/commands/compare.js +5 -5
  14. package/dist/commands/compare.js.map +1 -1
  15. package/dist/commands/detect.d.ts +5 -0
  16. package/dist/commands/detect.d.ts.map +1 -1
  17. package/dist/commands/detect.js +3 -0
  18. package/dist/commands/detect.js.map +1 -1
  19. package/dist/commands/doctor.d.ts.map +1 -1
  20. package/dist/commands/doctor.js +9 -3
  21. package/dist/commands/doctor.js.map +1 -1
  22. package/dist/commands/pr.d.ts +13 -1
  23. package/dist/commands/pr.d.ts.map +1 -1
  24. package/dist/commands/pr.js +222 -107
  25. package/dist/commands/pr.js.map +1 -1
  26. package/dist/comparison.d.ts +14 -0
  27. package/dist/comparison.d.ts.map +1 -1
  28. package/dist/comparison.js +48 -25
  29. package/dist/comparison.js.map +1 -1
  30. package/dist/diff-worker.d.ts +1 -0
  31. package/dist/diff-worker.d.ts.map +1 -1
  32. package/dist/diff-worker.js +1 -0
  33. package/dist/diff-worker.js.map +1 -1
  34. package/dist/diff.d.ts +42 -0
  35. package/dist/diff.d.ts.map +1 -1
  36. package/dist/diff.js +142 -24
  37. package/dist/diff.js.map +1 -1
  38. package/dist/doctor.d.ts +4 -1
  39. package/dist/doctor.d.ts.map +1 -1
  40. package/dist/doctor.js +5 -1
  41. package/dist/doctor.js.map +1 -1
  42. package/dist/drift.d.ts +29 -0
  43. package/dist/drift.d.ts.map +1 -0
  44. package/dist/drift.js +106 -0
  45. package/dist/drift.js.map +1 -0
  46. package/dist/errors.d.ts +13 -0
  47. package/dist/errors.d.ts.map +1 -1
  48. package/dist/errors.js +13 -0
  49. package/dist/errors.js.map +1 -1
  50. package/dist/github.d.ts +34 -3
  51. package/dist/github.d.ts.map +1 -1
  52. package/dist/github.js +102 -11
  53. package/dist/github.js.map +1 -1
  54. package/dist/report.d.ts +27 -1
  55. package/dist/report.d.ts.map +1 -1
  56. package/dist/report.js +144 -38
  57. package/dist/report.js.map +1 -1
  58. package/dist/routes/imports.d.ts +21 -1
  59. package/dist/routes/imports.d.ts.map +1 -1
  60. package/dist/routes/imports.js +32 -2
  61. package/dist/routes/imports.js.map +1 -1
  62. package/dist/routes.d.ts +18 -0
  63. package/dist/routes.d.ts.map +1 -1
  64. package/dist/routes.js +110 -29
  65. package/dist/routes.js.map +1 -1
  66. package/dist/run.d.ts +46 -12
  67. package/dist/run.d.ts.map +1 -1
  68. package/dist/run.js +138 -17
  69. package/dist/run.js.map +1 -1
  70. package/dist/sheet.d.ts +24 -0
  71. package/dist/sheet.d.ts.map +1 -0
  72. package/dist/sheet.js +94 -0
  73. package/dist/sheet.js.map +1 -0
  74. package/dist/timings.d.ts +46 -0
  75. package/dist/timings.d.ts.map +1 -0
  76. package/dist/timings.js +108 -0
  77. package/dist/timings.js.map +1 -0
  78. package/dist/types.d.ts +86 -1
  79. package/dist/types.d.ts.map +1 -1
  80. package/dist/types.js +8 -0
  81. package/dist/types.js.map +1 -1
  82. package/package.json +2 -2
  83. package/skill/SKILL.md +34 -10
package/skill/SKILL.md CHANGED
@@ -1,8 +1,9 @@
1
1
  ---
2
2
  name: pre-post
3
3
  description: Before/after screenshots for the current PR. Use when the user says "take before and after", "pre-post", "screenshot comparison", "visual diff", "PR screenshots", or after making visual UI changes.
4
+ version: 1.4.0
4
5
  allowed-tools:
5
- - Bash(npx -y @juangadm/pre-post@latest *)
6
+ - Bash(npx -y @juangadm/pre-post@1.4.0 *)
6
7
  - Bash(npx pre-post *)
7
8
  - Bash(pre-post *)
8
9
  ---
@@ -11,7 +12,7 @@ allowed-tools:
11
12
 
12
13
  One command does everything: detects the routes this branch changed, screenshots them on
13
14
  desktop, pixel-diffs them, uploads the images to a `pre-post-assets` branch, and
14
- posts or updates a single comment on the open PR. The human reviews on GitHub.
15
+ puts them at the top of the open PR description. The human reviews on GitHub.
15
16
 
16
17
  It picks both sides itself:
17
18
 
@@ -39,10 +40,16 @@ the Post side. Pass `--no-local-baseline` to turn it off.
39
40
  ## Run
40
41
 
41
42
  ```bash
42
- npx -y @juangadm/pre-post@latest pr
43
+ npx -y @juangadm/pre-post@1.4.0 pr
43
44
  ```
44
45
 
45
- Add `--routes /a,/b` when the user names pages explicitly. Add
46
+ The version is pinned on purpose: this file describes that release. If the run starts with
47
+ `Note:` lines about another version, relay them; they mean a copy of these instructions is
48
+ out of date.
49
+
50
+ If you have a folder the user can open from wherever they are following you (a scratchpad
51
+ or workspace directory in a hosted session), add `-o <that folder>/pre-post` so the images
52
+ land somewhere they can see. Add `--routes /a,/b` when the user names pages explicitly. Add
46
53
  `--before https://production-url` only if the run reports it cannot work out the baseline
47
54
  (it is then saved to `.pre-post.json` for next time).
48
55
 
@@ -53,16 +60,30 @@ re-runs replace in place — the author's own text is never touched. If the PR c
53
60
  edited (a fork, a read-only token) it falls back to a single sticky comment.
54
61
 
55
62
  Each changed route shows **Pre beside Post**, per viewport, full pages in a `<details>`. No
56
- overlay, no percentage. A page that moved says `Content shifted down 48px`; relay as written.
63
+ overlay, no percentage. A page that moved says `Content shifted down 48px`; relay as written. A pure move
64
+ ("Nothing else changed.") shows the full pages with no crop and no `<details>`, by design.
65
+
66
+ ## Show the user
67
+
68
+ When anything changed, the command prints `Sheet: <path>`: one image with Pre beside Post for
69
+ every change. If you can send files to the user, send that one file, even when the PR was
70
+ updated. Someone following you from a phone sees it there before they open GitHub.
57
71
 
58
72
  ## Rules
59
73
 
60
- - Run the command once. Do not open, read, or describe the screenshot files; the PR
61
- comment is the deliverable. Report the summary the command prints, plus the comment link.
74
+ - Run the command once. Do not open, read, or describe the screenshot files. The block in
75
+ the PR description is the deliverable, and the sheet is the one image you pass along. Tell
76
+ the user what the summary says, plus the PR link. Never paste the terminal output into the
77
+ PR: ports, timings and percentages there are for you, not for a reviewer.
62
78
  - Do not switch branches, start dev servers, or use a browser tool yourself. The command
63
79
  handles all three.
64
- - Exit code 3 means a human must do one thing (log in, start the dev server, pass
65
- `--before`). Relay that one sentence verbatim and stop.
80
+ - Exit code 4 means a page rendered an error (a build error, a 500) instead of itself. No
81
+ screenshots were published and the PR says so in one sentence. Relay that sentence; the
82
+ branch needs fixing before a visual comparison means anything.
83
+ - Exit code 3 means a human must do one thing (set a token, start the dev server, pass
84
+ `--before`). Relay that one sentence verbatim and stop. If GitHub refused the token, the
85
+ screenshots were still taken: send the sheet first, then relay the sentence. Never ask the
86
+ user to paste a token into the chat; the sentence names where it goes.
66
87
  - Do not use `--dry-run` unless the user asks to preview without posting.
67
88
  - If the summary lists routes that "need a sample URL", ask the user for one example URL per
68
89
  dynamic route and add it under `"samples"` in `.pre-post.json`, then re-run.
@@ -78,5 +99,8 @@ overlay, no percentage. A page that moved says `Content shifted down 48px`; rela
78
99
  | `--dry-run` | Preview locally, post nothing |
79
100
  | `--header k=v` / `--cookie k=v` | The site needs auth headers or cookies |
80
101
 
81
- Login-protected sites: `npx -y @juangadm/pre-post@latest login https://site` opens a browser
102
+ To run on every PR without anyone invoking it, point the user to the GitHub Action guide
103
+ (https://github.com/juangadm/pre-post/blob/main/docs/github-action.md). It posts with GitHub's own token, which also covers work done in cloud sessions.
104
+
105
+ Login-protected sites: `npx -y @juangadm/pre-post@1.4.0 login https://site` opens a browser
82
106
  once; the saved session is reused automatically.