@juangadm/pre-post 0.3.0 → 1.1.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 +174 -233
- package/dist/baseline.d.ts +119 -0
- package/dist/baseline.d.ts.map +1 -0
- package/dist/baseline.js +316 -0
- package/dist/baseline.js.map +1 -0
- package/dist/bin/cli.js +243 -458
- package/dist/bin/cli.js.map +1 -1
- package/dist/browser.d.ts +68 -25
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +500 -105
- package/dist/browser.js.map +1 -1
- package/dist/capture.d.ts +1 -6
- package/dist/capture.d.ts.map +1 -1
- package/dist/capture.js +12 -36
- package/dist/capture.js.map +1 -1
- package/dist/commands/compare.d.ts +18 -0
- package/dist/commands/compare.d.ts.map +1 -0
- package/dist/commands/compare.js +82 -0
- package/dist/commands/compare.js.map +1 -0
- package/dist/commands/detect.d.ts +25 -0
- package/dist/commands/detect.d.ts.map +1 -0
- package/dist/commands/detect.js +22 -0
- package/dist/commands/detect.js.map +1 -0
- package/dist/commands/doctor.d.ts +42 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +119 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/login.d.ts +6 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +34 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/pr.d.ts +32 -0
- package/dist/commands/pr.d.ts.map +1 -0
- package/dist/commands/pr.js +259 -0
- package/dist/commands/pr.js.map +1 -0
- package/dist/commands/prune.d.ts +10 -0
- package/dist/commands/prune.d.ts.map +1 -0
- package/dist/commands/prune.js +13 -0
- package/dist/commands/prune.js.map +1 -0
- package/dist/comparison.d.ts +104 -0
- package/dist/comparison.d.ts.map +1 -0
- package/dist/comparison.js +236 -0
- package/dist/comparison.js.map +1 -0
- package/dist/config.d.ts +46 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +82 -0
- package/dist/config.js.map +1 -0
- package/dist/deployments.d.ts +71 -0
- package/dist/deployments.d.ts.map +1 -0
- package/dist/deployments.js +204 -0
- package/dist/deployments.js.map +1 -0
- package/dist/diff-pool.d.ts +17 -0
- package/dist/diff-pool.d.ts.map +1 -0
- package/dist/diff-pool.js +92 -0
- package/dist/diff-pool.js.map +1 -0
- package/dist/diff-worker.d.ts +32 -0
- package/dist/diff-worker.d.ts.map +1 -0
- package/dist/diff-worker.js +39 -0
- package/dist/diff-worker.js.map +1 -0
- package/dist/diff.d.ts +47 -0
- package/dist/diff.d.ts.map +1 -0
- package/dist/diff.js +281 -0
- package/dist/diff.js.map +1 -0
- package/dist/doctor.d.ts +79 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +138 -0
- package/dist/doctor.js.map +1 -0
- package/dist/errors.d.ts +38 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +59 -0
- package/dist/errors.js.map +1 -0
- package/dist/git.d.ts +61 -0
- package/dist/git.d.ts.map +1 -0
- package/dist/git.js +182 -0
- package/dist/git.js.map +1 -0
- package/dist/github.d.ts +163 -0
- package/dist/github.d.ts.map +1 -0
- package/dist/github.js +411 -0
- package/dist/github.js.map +1 -0
- package/dist/index.d.ts +22 -23
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -67
- package/dist/index.js.map +1 -1
- package/dist/landing.d.ts +48 -0
- package/dist/landing.d.ts.map +1 -0
- package/dist/landing.js +93 -0
- package/dist/landing.js.map +1 -0
- package/dist/pkg.d.ts +17 -0
- package/dist/pkg.d.ts.map +1 -0
- package/dist/pkg.js +49 -0
- package/dist/pkg.js.map +1 -0
- package/dist/report.d.ts +20 -0
- package/dist/report.d.ts.map +1 -0
- package/dist/report.js +130 -0
- package/dist/report.js.map +1 -0
- package/dist/routes/imports.d.ts +46 -0
- package/dist/routes/imports.d.ts.map +1 -0
- package/dist/routes/imports.js +208 -0
- package/dist/routes/imports.js.map +1 -0
- package/dist/routes/vite.d.ts +15 -0
- package/dist/routes/vite.d.ts.map +1 -0
- package/dist/routes/vite.js +130 -0
- package/dist/routes/vite.js.map +1 -0
- package/dist/routes.d.ts +65 -11
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +346 -141
- package/dist/routes.js.map +1 -1
- package/dist/run.d.ts +116 -0
- package/dist/run.d.ts.map +1 -0
- package/dist/run.js +316 -0
- package/dist/run.js.map +1 -0
- package/dist/sameness.d.ts +91 -0
- package/dist/sameness.d.ts.map +1 -0
- package/dist/sameness.js +157 -0
- package/dist/sameness.js.map +1 -0
- package/dist/sessions.d.ts +50 -0
- package/dist/sessions.d.ts.map +1 -0
- package/dist/sessions.js +80 -0
- package/dist/sessions.js.map +1 -0
- package/dist/shift.d.ts +67 -0
- package/dist/shift.d.ts.map +1 -0
- package/dist/shift.js +184 -0
- package/dist/shift.js.map +1 -0
- package/dist/types.d.ts +179 -68
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -1
- package/dist/url.d.ts +12 -0
- package/dist/url.d.ts.map +1 -0
- package/dist/url.js +30 -0
- package/dist/url.js.map +1 -0
- package/dist/viewport.d.ts +6 -1
- package/dist/viewport.d.ts.map +1 -1
- package/dist/viewport.js +13 -7
- package/dist/viewport.js.map +1 -1
- package/package.json +21 -14
- package/skill/SKILL.md +56 -221
- package/dist/clipboard.d.ts +0 -9
- package/dist/clipboard.d.ts.map +0 -1
- package/dist/clipboard.js +0 -26
- package/dist/clipboard.js.map +0 -1
- package/dist/upload.d.ts +0 -39
- package/dist/upload.d.ts.map +0 -1
- package/dist/upload.js +0 -159
- package/dist/upload.js.map +0 -1
- package/dist/video.d.ts +0 -19
- package/dist/video.d.ts.map +0 -1
- package/dist/video.js +0 -263
- package/dist/video.js.map +0 -1
- package/skill/scripts/adapters/0x0st.sh +0 -36
- package/skill/scripts/adapters/blob.sh +0 -55
- package/skill/scripts/adapters/git-native.sh +0 -51
- package/skill/scripts/upload-and-copy.sh +0 -230
package/skill/SKILL.md
CHANGED
|
@@ -1,247 +1,82 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: pre-post
|
|
3
|
-
description:
|
|
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
4
|
allowed-tools:
|
|
5
|
+
- Bash(npx -y @juangadm/pre-post@latest *)
|
|
5
6
|
- Bash(npx pre-post *)
|
|
6
7
|
- Bash(pre-post *)
|
|
7
|
-
- Bash(*/upload-and-copy.sh *)
|
|
8
|
-
- Bash(git add *)
|
|
9
|
-
- Bash(git commit -m *)
|
|
10
|
-
- Bash(git push origin *)
|
|
11
|
-
- Bash(curl -s -o /dev/null -w *)
|
|
12
|
-
- Bash(gh pr view *)
|
|
13
|
-
- Bash(gh pr edit *)
|
|
14
|
-
- Bash(lsof -i *)
|
|
15
|
-
- Bash(mkdir -p /tmp/pre-post)
|
|
16
|
-
- Bash(git diff *)
|
|
17
8
|
---
|
|
18
9
|
|
|
19
|
-
#
|
|
10
|
+
# pre-post
|
|
20
11
|
|
|
21
|
-
|
|
22
|
-
|
|
12
|
+
One command does everything: detects the routes this branch changed, screenshots them on
|
|
13
|
+
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.
|
|
23
15
|
|
|
24
|
-
|
|
16
|
+
It picks both sides itself:
|
|
25
17
|
|
|
26
|
-
**
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
18
|
+
- **Post** (this branch) — the PR's preview deployment when one exists, read from the GitHub
|
|
19
|
+
Deployments API or, for providers that only comment (Vercel's GitHub app does), from the
|
|
20
|
+
deployment bot's PR comment. Otherwise a dev server: one already running, or one it starts
|
|
21
|
+
and stops itself.
|
|
22
|
+
- **Pre** (the baseline) — `before` from `.pre-post.json`, otherwise the production
|
|
23
|
+
deployment for the commit this branch forked from, otherwise that base commit itself,
|
|
24
|
+
checked out into a throwaway worktree and served locally.
|
|
30
25
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
- Use `--mobile` / `--tablet` if user mentions phone, mobile, tablet, responsive
|
|
35
|
-
- Assume current state is **After** (localhost = after, production = before)
|
|
36
|
-
- Show screenshots to user before posting to PR
|
|
37
|
-
- If user provides only one URL, **ASK**: "What URL should I use for the 'before' state? (production URL, preview deployment, or another local port)"
|
|
26
|
+
Both sides always come from the same kind of environment. Pairing a deployment against a
|
|
27
|
+
dev server would compare different builds — a dev server renders Next.js's dev badge that
|
|
28
|
+
production never shows — so a diff would carry changes the branch never made.
|
|
38
29
|
|
|
39
|
-
|
|
30
|
+
So on a PR with a preview deployment, no dev server and no checkout are needed — anyone on
|
|
31
|
+
the team can run it against anyone's PR. With nothing deployed and nothing running, it
|
|
32
|
+
serves both sides itself.
|
|
40
33
|
|
|
41
|
-
|
|
34
|
+
The last baseline needs no network at all, so the tool still works inside a sandbox, a CI
|
|
35
|
+
container, or behind an egress allowlist where no deployment URL is reachable. It also
|
|
36
|
+
compares against exactly what the branch forked from, rendered in the same environment as
|
|
37
|
+
the Post side. Pass `--no-local-baseline` to turn it off.
|
|
42
38
|
|
|
43
|
-
|
|
44
|
-
# Detect running dev server
|
|
45
|
-
lsof -i :3000 2>/dev/null || lsof -i :3001 2>/dev/null || lsof -i :5173 2>/dev/null || lsof -i :8080 2>/dev/null
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
If no dev server is running, tell the user to start one.
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
# Check production URL is accessible
|
|
52
|
-
curl -s -o /dev/null -w "%{http_code}" "<production-url>"
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
- **200** → proceed
|
|
56
|
-
- **401/403** → warn user: "Production URL requires authentication. Options: (1) provide a public URL, (2) skip 'before' and capture after-only, (3) provide auth cookies"
|
|
57
|
-
- **No production URL** → "after-only" mode: screenshot localhost only, label as current state
|
|
58
|
-
|
|
59
|
-
### 2. Route Detection + Refinement
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
# Detect affected routes from git diff
|
|
63
|
-
npx pre-post detect
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
This outputs JSON with detected routes, confidence levels, and source files.
|
|
67
|
-
|
|
68
|
-
**Claude's role:** Review the JSON output using conversation context:
|
|
69
|
-
- Add routes you know are affected from the work done in this session
|
|
70
|
-
- Remove false positives (e.g., API-only changes)
|
|
71
|
-
- For dynamic routes (e.g., `/blog/[slug]`), ask user for a sample value
|
|
72
|
-
- Present to user: "I'll screenshot these routes: `/dashboard`, `/settings`. Want to add or change any?"
|
|
73
|
-
|
|
74
|
-
### 3. Screenshot Capture
|
|
75
|
-
|
|
76
|
-
**Option A: CLI (preferred — deterministic)**
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
|
-
# Single route, desktop only
|
|
80
|
-
npx pre-post compare \
|
|
81
|
-
--before-base https://prod.com \
|
|
82
|
-
--after-base http://localhost:3000 \
|
|
83
|
-
--routes /dashboard \
|
|
84
|
-
--output /tmp/pre-post
|
|
85
|
-
|
|
86
|
-
# Multiple routes, responsive (desktop + mobile)
|
|
87
|
-
npx pre-post compare \
|
|
88
|
-
--before-base https://prod.com \
|
|
89
|
-
--after-base http://localhost:3000 \
|
|
90
|
-
--routes /dashboard,/settings,/ \
|
|
91
|
-
--responsive \
|
|
92
|
-
--output /tmp/pre-post
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
**Option B: Playwright MCP (for more control)**
|
|
96
|
-
|
|
97
|
-
Use when you need custom waits, interactions, or complex page states:
|
|
98
|
-
|
|
99
|
-
```
|
|
100
|
-
browser_resize(1280, 800)
|
|
101
|
-
browser_navigate("https://prod.com/dashboard")
|
|
102
|
-
browser_wait_for(time: 3)
|
|
103
|
-
browser_take_screenshot(filename: "/tmp/pre-post/dashboard-desktop-before.png")
|
|
104
|
-
|
|
105
|
-
browser_navigate("http://localhost:3000/dashboard")
|
|
106
|
-
browser_wait_for(time: 3)
|
|
107
|
-
browser_take_screenshot(filename: "/tmp/pre-post/dashboard-desktop-after.png")
|
|
108
|
-
|
|
109
|
-
# Mobile
|
|
110
|
-
browser_resize(375, 812)
|
|
111
|
-
browser_navigate("https://prod.com/dashboard")
|
|
112
|
-
browser_wait_for(time: 3)
|
|
113
|
-
browser_take_screenshot(filename: "/tmp/pre-post/dashboard-mobile-before.png")
|
|
114
|
-
|
|
115
|
-
browser_navigate("http://localhost:3000/dashboard")
|
|
116
|
-
browser_wait_for(time: 3)
|
|
117
|
-
browser_take_screenshot(filename: "/tmp/pre-post/dashboard-mobile-after.png")
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
### 4. User Approval
|
|
121
|
-
|
|
122
|
-
Show screenshots in conversation. Ask: "Here are the before/after screenshots. Should I post to PR, retake any, or add more pages?"
|
|
123
|
-
|
|
124
|
-
### 5. Upload + PR Markdown
|
|
39
|
+
## Run
|
|
125
40
|
|
|
126
41
|
```bash
|
|
127
|
-
|
|
128
|
-
mkdir -p /tmp/pre-post
|
|
129
|
-
./scripts/upload-and-copy.sh /tmp/pre-post/before.png /tmp/pre-post/after.png --markdown
|
|
42
|
+
npx -y @juangadm/pre-post@latest pr
|
|
130
43
|
```
|
|
131
44
|
|
|
132
|
-
|
|
45
|
+
Add `--routes /a,/b` when the user names pages explicitly. Add
|
|
46
|
+
`--before https://production-url` only if the run reports it cannot work out the baseline
|
|
47
|
+
(it is then saved to `.pre-post.json` for next time).
|
|
133
48
|
|
|
134
|
-
|
|
135
|
-
npx pre-post <before.png> <after.png> --markdown
|
|
136
|
-
```
|
|
49
|
+
## What it posts
|
|
137
50
|
|
|
138
|
-
|
|
51
|
+
The visual changes go at the **top of the PR description**, in a delimited block that
|
|
52
|
+
re-runs replace in place — the author's own text is never touched. If the PR cannot be
|
|
53
|
+
edited (a fork, a read-only token) it falls back to a single sticky comment.
|
|
139
54
|
|
|
140
|
-
|
|
141
|
-
|
|
55
|
+
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.
|
|
142
57
|
|
|
143
|
-
|
|
58
|
+
## Rules
|
|
144
59
|
|
|
145
|
-
|
|
146
|
-
|
|
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.
|
|
62
|
+
- Do not switch branches, start dev servers, or use a browser tool yourself. The command
|
|
63
|
+
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.
|
|
66
|
+
- Do not use `--dry-run` unless the user asks to preview without posting.
|
|
67
|
+
- If the summary lists routes that "need a sample URL", ask the user for one example URL per
|
|
68
|
+
dynamic route and add it under `"samples"` in `.pre-post.json`, then re-run.
|
|
147
69
|
|
|
148
|
-
|
|
149
|
-
|:---:|:----:|
|
|
150
|
-
|  |  |
|
|
151
|
-
</details>
|
|
152
|
-
|
|
153
|
-
<details>
|
|
154
|
-
<summary>Mobile (375x812)</summary>
|
|
155
|
-
|
|
156
|
-
| Pre | Post |
|
|
157
|
-
|:---:|:----:|
|
|
158
|
-
|  |  |
|
|
159
|
-
</details>
|
|
160
|
-
|
|
161
|
-
---
|
|
162
|
-
*Captured by [pre-post](https://github.com/juangadm/pre-post)*
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
### 6. PR Integration
|
|
166
|
-
|
|
167
|
-
```bash
|
|
168
|
-
# Get current PR
|
|
169
|
-
gh pr view --json number,body
|
|
170
|
-
|
|
171
|
-
# Append screenshots to PR body
|
|
172
|
-
gh pr edit <number> --body "<existing-body>
|
|
173
|
-
|
|
174
|
-
<generated-markdown>"
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
If no `gh` CLI: output markdown and tell user to paste manually.
|
|
178
|
-
|
|
179
|
-
## Quick Reference
|
|
180
|
-
|
|
181
|
-
```bash
|
|
182
|
-
# Basic usage (two URLs)
|
|
183
|
-
pre-post site.com localhost:3000
|
|
184
|
-
|
|
185
|
-
# Detect routes from git diff
|
|
186
|
-
pre-post detect
|
|
187
|
-
pre-post detect --framework nextjs-app
|
|
188
|
-
|
|
189
|
-
# Compare with auto-detected routes
|
|
190
|
-
pre-post run --before-base https://prod.com --after-base http://localhost:3000
|
|
191
|
-
|
|
192
|
-
# Compare specific routes
|
|
193
|
-
pre-post compare --before-base URL --after-base URL --routes /dashboard,/settings
|
|
194
|
-
|
|
195
|
-
# Responsive (desktop + mobile)
|
|
196
|
-
pre-post compare --before-base URL --after-base URL --responsive
|
|
197
|
-
|
|
198
|
-
# From existing images
|
|
199
|
-
pre-post before.png after.png --markdown
|
|
200
|
-
|
|
201
|
-
# Via npx
|
|
202
|
-
npx pre-post detect
|
|
203
|
-
npx pre-post compare --before-base URL --after-base URL
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
| Flag | Description |
|
|
207
|
-
|------|-------------|
|
|
208
|
-
| `-m, --mobile` | Mobile viewport (375x812) |
|
|
209
|
-
| `-t, --tablet` | Tablet viewport (768x1024) |
|
|
210
|
-
| `--size <WxH>` | Custom viewport |
|
|
211
|
-
| `-f, --full` | Full scrollable page |
|
|
212
|
-
| `-s, --selector` | CSS selector to capture |
|
|
213
|
-
| `-r, --responsive` | Desktop + mobile capture |
|
|
214
|
-
| `--routes <paths>` | Explicit route list (comma-separated) |
|
|
215
|
-
| `--max-routes <n>` | Max detected routes (default: 5) |
|
|
216
|
-
| `--framework <name>` | Force framework detection |
|
|
217
|
-
| `--before-base <url>` | Production URL |
|
|
218
|
-
| `--after-base <url>` | Localhost URL |
|
|
219
|
-
| `-o, --output` | Output directory (default: ~/Downloads) |
|
|
220
|
-
| `--markdown` | Upload images & output markdown |
|
|
221
|
-
| `--upload-url <url>` | Upload endpoint (overrides git-native default) |
|
|
222
|
-
|
|
223
|
-
## Image Upload
|
|
224
|
-
|
|
225
|
-
Screenshots are committed to `.pre-post/` on the current PR branch and served via
|
|
226
|
-
GitHub blob URLs pinned to the commit SHA. This works for **both public and private
|
|
227
|
-
repos** — blob URLs are same-origin on GitHub, so the markdown renderer resolves them
|
|
228
|
-
with the viewer's authentication.
|
|
229
|
-
|
|
230
|
-
```bash
|
|
231
|
-
# Default (git-native — commits to PR branch, works on any repo)
|
|
232
|
-
./scripts/upload-and-copy.sh before.png after.png --markdown
|
|
233
|
-
|
|
234
|
-
# Explicit override for external storage:
|
|
235
|
-
IMAGE_ADAPTER=0x0st ./scripts/upload-and-copy.sh before.png after.png --markdown
|
|
236
|
-
```
|
|
70
|
+
## Options worth knowing
|
|
237
71
|
|
|
238
|
-
|
|
72
|
+
| Flag | Use when |
|
|
73
|
+
|------|----------|
|
|
74
|
+
| `--routes /a,/b` | The user names the pages |
|
|
75
|
+
| `-r`, `--responsive` | Desktop and mobile (default is desktop only) |
|
|
76
|
+
| `--viewport-only` | First screen only instead of full page |
|
|
77
|
+
| `--pr <n>` | The branch has several PRs or the lookup fails |
|
|
78
|
+
| `--dry-run` | Preview locally, post nothing |
|
|
79
|
+
| `--header k=v` / `--cookie k=v` | The site needs auth headers or cookies |
|
|
239
80
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
| `command not found` | `npm install -g @juangadm/pre-post` |
|
|
243
|
-
| `browserType.launch: Executable doesn't exist` | `npx playwright install chromium` |
|
|
244
|
-
| 401/403 on production URL | See pre-flight section above |
|
|
245
|
-
| Element not found | Verify selector exists on page |
|
|
246
|
-
| No changed files detected | Specify routes manually with `--routes` |
|
|
247
|
-
| Could not determine commit SHA | Ensure `git push` succeeded and HEAD is valid |
|
|
81
|
+
Login-protected sites: `npx -y @juangadm/pre-post@latest login https://site` opens a browser
|
|
82
|
+
once; the saved session is reused automatically.
|
package/dist/clipboard.d.ts
DELETED
package/dist/clipboard.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../src/clipboard.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAcrD"}
|
package/dist/clipboard.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cross-platform clipboard utilities
|
|
3
|
-
*/
|
|
4
|
-
import { execSync } from 'child_process';
|
|
5
|
-
/**
|
|
6
|
-
* Copy text to system clipboard
|
|
7
|
-
* Supports macOS (pbcopy) and Linux (xclip)
|
|
8
|
-
*/
|
|
9
|
-
export function copyToClipboard(text) {
|
|
10
|
-
try {
|
|
11
|
-
if (process.platform === 'darwin') {
|
|
12
|
-
execSync('pbcopy', { input: text });
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
else if (process.platform === 'linux') {
|
|
16
|
-
execSync('xclip -selection clipboard', { input: text });
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
19
|
-
// Windows or unsupported platform
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
catch {
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=clipboard.js.map
|
package/dist/clipboard.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clipboard.js","sourceRoot":"","sources":["../src/clipboard.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,IAAI,CAAC;QACH,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;YAClC,QAAQ,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YACpC,OAAO,IAAI,CAAC;QACd,CAAC;aAAM,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;YACxC,QAAQ,CAAC,4BAA4B,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YACxD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,kCAAkC;QAClC,OAAO,KAAK,CAAC;IACf,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
package/dist/upload.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Image upload for generating shareable URLs.
|
|
3
|
-
* Default: git-native (commits to .pre-post/, serves via blob+SHA URLs).
|
|
4
|
-
* Opt-in: 0x0.st, Vercel Blob, generic PUT via --upload-url.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Upload an image and return a public URL.
|
|
8
|
-
* Auto-detects upload method from URL pattern.
|
|
9
|
-
*/
|
|
10
|
-
export declare function uploadImage(image: Buffer, filename: string, uploadUrl?: string): Promise<string>;
|
|
11
|
-
/**
|
|
12
|
-
* Write an image to .pre-post/ in the repo root and stage it.
|
|
13
|
-
* Returns filename + ownerRepo — caller constructs blob+SHA URL after commit.
|
|
14
|
-
*/
|
|
15
|
-
export declare function uploadGitNative(image: Buffer, filename: string): {
|
|
16
|
-
filename: string;
|
|
17
|
-
ownerRepo: string;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Commit and push all staged .pre-post/ screenshots in one batch.
|
|
21
|
-
* Returns the full 40-char commit SHA.
|
|
22
|
-
*/
|
|
23
|
-
export declare function commitAndPushScreenshots(): string;
|
|
24
|
-
/**
|
|
25
|
-
* Upload before/after images and return URLs.
|
|
26
|
-
* When uploadUrl is provided, uses the HTTP-based upload path.
|
|
27
|
-
* Otherwise, uses git-native (commit to .pre-post/) with blob+SHA URLs.
|
|
28
|
-
*/
|
|
29
|
-
export declare function uploadBeforeAfter(before: {
|
|
30
|
-
image: Buffer;
|
|
31
|
-
filename: string;
|
|
32
|
-
}, after: {
|
|
33
|
-
image: Buffer;
|
|
34
|
-
filename: string;
|
|
35
|
-
}, uploadUrl?: string): Promise<{
|
|
36
|
-
beforeUrl: string;
|
|
37
|
-
afterUrl: string;
|
|
38
|
-
}>;
|
|
39
|
-
//# sourceMappingURL=upload.d.ts.map
|
package/dist/upload.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../src/upload.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,SAAS,GAAE,MAA2B,GACrC,OAAO,CAAC,MAAM,CAAC,CAajB;AAiFD;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,GACf;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAoBzC;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,CASjD;AAWD;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,EAC3C,KAAK,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,EAC1C,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAqBlD"}
|
package/dist/upload.js
DELETED
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Image upload for generating shareable URLs.
|
|
3
|
-
* Default: git-native (commits to .pre-post/, serves via blob+SHA URLs).
|
|
4
|
-
* Opt-in: 0x0.st, Vercel Blob, generic PUT via --upload-url.
|
|
5
|
-
*/
|
|
6
|
-
import { execSync } from 'child_process';
|
|
7
|
-
import fs from 'fs';
|
|
8
|
-
import path from 'path';
|
|
9
|
-
const DEFAULT_UPLOAD_URL = 'https://0x0.st';
|
|
10
|
-
function mimeForFilename(filename) {
|
|
11
|
-
return filename.endsWith('.gif') ? 'image/gif' : 'image/png';
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Upload an image and return a public URL.
|
|
15
|
-
* Auto-detects upload method from URL pattern.
|
|
16
|
-
*/
|
|
17
|
-
export async function uploadImage(image, filename, uploadUrl = DEFAULT_UPLOAD_URL) {
|
|
18
|
-
// 0x0.st uses multipart form upload
|
|
19
|
-
if (uploadUrl.includes('0x0.st')) {
|
|
20
|
-
return upload0x0st(image, filename, uploadUrl);
|
|
21
|
-
}
|
|
22
|
-
// Vercel Blob uses PUT with specific headers
|
|
23
|
-
if (uploadUrl.includes('blob.vercel')) {
|
|
24
|
-
return uploadVercelBlob(image, filename, uploadUrl);
|
|
25
|
-
}
|
|
26
|
-
// Generic PUT upload (common for S3-compatible services)
|
|
27
|
-
return uploadGenericPut(image, filename, uploadUrl);
|
|
28
|
-
}
|
|
29
|
-
async function upload0x0st(image, filename, url) {
|
|
30
|
-
const formData = new FormData();
|
|
31
|
-
formData.append('file', new Blob([image]), filename);
|
|
32
|
-
const response = await fetch(url, {
|
|
33
|
-
method: 'POST',
|
|
34
|
-
headers: { 'User-Agent': 'before-after-cli/1.0' },
|
|
35
|
-
body: formData,
|
|
36
|
-
});
|
|
37
|
-
const result = (await response.text()).trim();
|
|
38
|
-
if (!result.startsWith('http')) {
|
|
39
|
-
throw new Error(`Upload failed: ${result}`);
|
|
40
|
-
}
|
|
41
|
-
return result;
|
|
42
|
-
}
|
|
43
|
-
async function uploadVercelBlob(image, filename, url) {
|
|
44
|
-
const contentType = mimeForFilename(filename);
|
|
45
|
-
const response = await fetch(`${url}/${filename}`, {
|
|
46
|
-
method: 'PUT',
|
|
47
|
-
headers: { 'Content-Type': contentType },
|
|
48
|
-
body: image,
|
|
49
|
-
});
|
|
50
|
-
if (!response.ok) {
|
|
51
|
-
throw new Error(`Upload failed: ${response.statusText}`);
|
|
52
|
-
}
|
|
53
|
-
const result = await response.json();
|
|
54
|
-
return result.url;
|
|
55
|
-
}
|
|
56
|
-
async function uploadGenericPut(image, filename, url) {
|
|
57
|
-
const mimeType = mimeForFilename(filename);
|
|
58
|
-
const response = await fetch(`${url}/${filename}`, {
|
|
59
|
-
method: 'PUT',
|
|
60
|
-
headers: { 'Content-Type': mimeType },
|
|
61
|
-
body: image,
|
|
62
|
-
});
|
|
63
|
-
if (!response.ok) {
|
|
64
|
-
throw new Error(`Upload failed: ${response.statusText}`);
|
|
65
|
-
}
|
|
66
|
-
// Try to parse JSON response, fall back to URL from location header or constructed URL
|
|
67
|
-
const contentType = response.headers.get('content-type') || '';
|
|
68
|
-
if (contentType.includes('application/json')) {
|
|
69
|
-
const result = await response.json();
|
|
70
|
-
if (result.url)
|
|
71
|
-
return result.url;
|
|
72
|
-
}
|
|
73
|
-
return response.headers.get('location') || `${url}/${filename}`;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Resolve owner/repo from environment variables or git remote URL.
|
|
77
|
-
* Supports standard GitHub URLs, SSH URLs, and proxy/non-standard URLs.
|
|
78
|
-
*/
|
|
79
|
-
function resolveOwnerRepo() {
|
|
80
|
-
const envOwnerRepo = process.env.GH_REPO || process.env.GITHUB_REPOSITORY;
|
|
81
|
-
if (envOwnerRepo)
|
|
82
|
-
return envOwnerRepo;
|
|
83
|
-
const remoteUrl = execSync('git remote get-url origin', { encoding: 'utf-8' }).trim();
|
|
84
|
-
// Standard GitHub: https://github.com/owner/repo.git or git@github.com:owner/repo.git
|
|
85
|
-
const githubMatch = remoteUrl.match(/github\.com[/:]([^/]+\/[^/]+?)(?:\.git)?$/);
|
|
86
|
-
if (githubMatch)
|
|
87
|
-
return githubMatch[1];
|
|
88
|
-
// Fallback: extract last two path segments from any URL (covers proxies, mirrors, etc.)
|
|
89
|
-
const fallbackMatch = remoteUrl.match(/\/([^/]+\/[^/]+?)(?:\.git)?$/);
|
|
90
|
-
if (fallbackMatch)
|
|
91
|
-
return fallbackMatch[1];
|
|
92
|
-
throw new Error(`Cannot parse owner/repo from: ${remoteUrl}\n` +
|
|
93
|
-
'Fix: set GH_REPO=owner/repo');
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Write an image to .pre-post/ in the repo root and stage it.
|
|
97
|
-
* Returns filename + ownerRepo — caller constructs blob+SHA URL after commit.
|
|
98
|
-
*/
|
|
99
|
-
export function uploadGitNative(image, filename) {
|
|
100
|
-
const MAX_FILE_SIZE = 10 * 1024 * 1024; // 10 MB
|
|
101
|
-
if (image.length > MAX_FILE_SIZE) {
|
|
102
|
-
const sizeMB = (image.length / 1024 / 1024).toFixed(1);
|
|
103
|
-
throw new Error(`File is ${sizeMB} MB (limit: 10 MB). Reduce --duration or --fps.`);
|
|
104
|
-
}
|
|
105
|
-
const repoRoot = execSync('git rev-parse --show-toplevel', { encoding: 'utf-8' }).trim();
|
|
106
|
-
const ownerRepo = resolveOwnerRepo();
|
|
107
|
-
const destDir = path.join(repoRoot, '.pre-post');
|
|
108
|
-
fs.mkdirSync(destDir, { recursive: true });
|
|
109
|
-
const dest = path.join(destDir, filename);
|
|
110
|
-
fs.writeFileSync(dest, image);
|
|
111
|
-
execSync(`git add -f "${dest}"`);
|
|
112
|
-
return { filename, ownerRepo };
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Commit and push all staged .pre-post/ screenshots in one batch.
|
|
116
|
-
* Returns the full 40-char commit SHA.
|
|
117
|
-
*/
|
|
118
|
-
export function commitAndPushScreenshots() {
|
|
119
|
-
execSync('git commit -m "chore: add pre/post screenshots"');
|
|
120
|
-
execSync('git push origin HEAD');
|
|
121
|
-
const sha = execSync('git rev-parse HEAD', { encoding: 'utf-8' }).trim();
|
|
122
|
-
if (!/^[0-9a-f]{40}$/.test(sha)) {
|
|
123
|
-
throw new Error(`Failed to get commit SHA after push (got: "${sha}")`);
|
|
124
|
-
}
|
|
125
|
-
return sha;
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Construct a GitHub blob URL with full SHA for an image in .pre-post/.
|
|
129
|
-
* Blob URLs are same-origin on GitHub — the markdown renderer resolves them
|
|
130
|
-
* with the viewer's auth, so they work for both public and private repos.
|
|
131
|
-
*/
|
|
132
|
-
function buildBlobUrl(ownerRepo, sha, filename) {
|
|
133
|
-
return `https://github.com/${ownerRepo}/blob/${sha}/.pre-post/${filename}?raw=true`;
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Upload before/after images and return URLs.
|
|
137
|
-
* When uploadUrl is provided, uses the HTTP-based upload path.
|
|
138
|
-
* Otherwise, uses git-native (commit to .pre-post/) with blob+SHA URLs.
|
|
139
|
-
*/
|
|
140
|
-
export async function uploadBeforeAfter(before, after, uploadUrl) {
|
|
141
|
-
// If an explicit upload URL is provided, use HTTP upload
|
|
142
|
-
if (uploadUrl) {
|
|
143
|
-
const [beforeUrl, afterUrl] = await Promise.all([
|
|
144
|
-
uploadImage(before.image, before.filename, uploadUrl),
|
|
145
|
-
uploadImage(after.image, after.filename, uploadUrl),
|
|
146
|
-
]);
|
|
147
|
-
return { beforeUrl, afterUrl };
|
|
148
|
-
}
|
|
149
|
-
// Default: git-native with blob+SHA URLs.
|
|
150
|
-
// Works for both public and private repos — blob URLs are same-origin on GitHub,
|
|
151
|
-
// so the markdown renderer resolves them with the viewer's authentication context.
|
|
152
|
-
const beforeResult = uploadGitNative(before.image, before.filename);
|
|
153
|
-
const afterResult = uploadGitNative(after.image, after.filename);
|
|
154
|
-
const sha = commitAndPushScreenshots();
|
|
155
|
-
const beforeUrl = buildBlobUrl(beforeResult.ownerRepo, sha, beforeResult.filename);
|
|
156
|
-
const afterUrl = buildBlobUrl(afterResult.ownerRepo, sha, afterResult.filename);
|
|
157
|
-
return { beforeUrl, afterUrl };
|
|
158
|
-
}
|
|
159
|
-
//# sourceMappingURL=upload.js.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CAAC,CAAC;IAEhF,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;AACjC,CAAC"}
|
package/dist/video.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Animated GIF capture via sequential Playwright screenshots + gifenc encoding.
|
|
3
|
-
*
|
|
4
|
-
* Pipeline: PNG screenshots → canvas decode → gifenc quantize → animated GIF.
|
|
5
|
-
* Single codepath. No FFmpeg. No external dependencies beyond Playwright + gifenc.
|
|
6
|
-
*/
|
|
7
|
-
import { Page } from 'playwright';
|
|
8
|
-
import { VideoOptions, VideoResult } from './types.js';
|
|
9
|
-
/**
|
|
10
|
-
* Capture animated GIF frames from an existing Playwright Page.
|
|
11
|
-
* Caller manages page lifecycle.
|
|
12
|
-
*/
|
|
13
|
-
export declare function captureGif(page: Page, url: string, options: VideoOptions): Promise<VideoResult>;
|
|
14
|
-
/**
|
|
15
|
-
* Capture an animated GIF of a URL.
|
|
16
|
-
* Creates its own page at DPR 1 (no retina), captures, cleans up.
|
|
17
|
-
*/
|
|
18
|
-
export declare function captureVideo(url: string, options: VideoOptions): Promise<VideoResult>;
|
|
19
|
-
//# sourceMappingURL=video.d.ts.map
|
package/dist/video.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../src/video.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAW,IAAI,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAgB,MAAM,YAAY,CAAC;AA+FrE;;;GAGG;AACH,wBAAsB,UAAU,CAC9B,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,WAAW,CAAC,CAkFtB;AAsBD;;;GAGG;AACH,wBAAsB,YAAY,CAChC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,WAAW,CAAC,CAmBtB"}
|