@reshotdev/screenshot 0.0.1-beta.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/LICENSE +190 -0
- package/README.md +388 -0
- package/package.json +64 -0
- package/src/commands/auth.js +259 -0
- package/src/commands/chrome.js +140 -0
- package/src/commands/ci-run.js +123 -0
- package/src/commands/ci-setup.js +288 -0
- package/src/commands/drifts.js +423 -0
- package/src/commands/import-tests.js +309 -0
- package/src/commands/ingest.js +458 -0
- package/src/commands/init.js +633 -0
- package/src/commands/publish.js +1721 -0
- package/src/commands/pull.js +303 -0
- package/src/commands/record.js +94 -0
- package/src/commands/run.js +476 -0
- package/src/commands/setup-wizard.js +740 -0
- package/src/commands/setup.js +137 -0
- package/src/commands/status.js +275 -0
- package/src/commands/sync.js +621 -0
- package/src/commands/ui.js +248 -0
- package/src/commands/validate-docs.js +529 -0
- package/src/index.js +462 -0
- package/src/lib/api-client.js +815 -0
- package/src/lib/capture-engine.js +1623 -0
- package/src/lib/capture-script-runner.js +3120 -0
- package/src/lib/ci-detect.js +137 -0
- package/src/lib/config.js +1240 -0
- package/src/lib/diff-engine.js +642 -0
- package/src/lib/hash.js +74 -0
- package/src/lib/image-crop.js +396 -0
- package/src/lib/matrix.js +89 -0
- package/src/lib/output-path-template.js +318 -0
- package/src/lib/playwright-runner.js +252 -0
- package/src/lib/polished-clip.js +553 -0
- package/src/lib/privacy-engine.js +408 -0
- package/src/lib/progress-tracker.js +142 -0
- package/src/lib/record-browser-injection.js +654 -0
- package/src/lib/record-cdp.js +612 -0
- package/src/lib/record-clip.js +343 -0
- package/src/lib/record-config.js +623 -0
- package/src/lib/record-screenshot.js +360 -0
- package/src/lib/record-terminal.js +123 -0
- package/src/lib/recorder-service.js +781 -0
- package/src/lib/secrets.js +51 -0
- package/src/lib/selector-strategies.js +859 -0
- package/src/lib/standalone-mode.js +400 -0
- package/src/lib/storage-providers.js +569 -0
- package/src/lib/style-engine.js +684 -0
- package/src/lib/ui-api.js +4677 -0
- package/src/lib/ui-assets.js +373 -0
- package/src/lib/ui-executor.js +587 -0
- package/src/lib/variant-injector.js +591 -0
- package/src/lib/viewport-presets.js +454 -0
- package/src/lib/worker-pool.js +118 -0
- package/web/cropper/index.html +436 -0
- package/web/manager/dist/assets/index--ZgioErz.js +507 -0
- package/web/manager/dist/assets/index-n468W0Wr.css +1 -0
- package/web/manager/dist/index.html +27 -0
- package/web/subtitle-editor/index.html +295 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2026 Mindy, Inc.
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
# @reshotdev/screenshot
|
|
2
|
+
|
|
3
|
+
Product screenshots in documentation go stale within days of a deploy. Manually recapturing them across themes, viewports, and locales is tedious and error-prone. This CLI automates screenshot and video capture in CI/CD, comparing against baselines to detect visual drift before it reaches production docs.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@reshotdev/screenshot)
|
|
6
|
+
[](https://github.com/reshotdev/screenshot/actions/workflows/ci.yml)
|
|
7
|
+
|
|
8
|
+
**Status: Beta** (0.x). The API may change between minor versions.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install -g @reshotdev/screenshot
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Requires Node.js >= 18. Playwright browsers are installed automatically on first run.
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# 1. Interactive setup wizard
|
|
22
|
+
reshot setup
|
|
23
|
+
|
|
24
|
+
# 2. Capture screenshots from your config
|
|
25
|
+
reshot run
|
|
26
|
+
|
|
27
|
+
# 3. Review captures in the web UI
|
|
28
|
+
reshot studio
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Configuration
|
|
32
|
+
|
|
33
|
+
Create `docsync.config.json` in your project root:
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"baseUrl": "http://localhost:3000",
|
|
38
|
+
"assetDir": ".reshot/output",
|
|
39
|
+
"concurrency": 2,
|
|
40
|
+
"viewport": { "width": 1280, "height": 720 },
|
|
41
|
+
"timeout": 30000,
|
|
42
|
+
"headless": true,
|
|
43
|
+
"scenarios": [
|
|
44
|
+
{
|
|
45
|
+
"key": "homepage",
|
|
46
|
+
"name": "Homepage",
|
|
47
|
+
"url": "/",
|
|
48
|
+
"steps": [
|
|
49
|
+
{ "action": "wait", "ms": 1000 },
|
|
50
|
+
{ "action": "screenshot", "key": "hero", "description": "Hero section" }
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"key": "dashboard",
|
|
55
|
+
"name": "Dashboard",
|
|
56
|
+
"url": "/dashboard",
|
|
57
|
+
"requiresAuth": true,
|
|
58
|
+
"readySelector": "[data-loaded='true']",
|
|
59
|
+
"steps": [
|
|
60
|
+
{ "action": "screenshot", "key": "overview", "description": "Dashboard overview" },
|
|
61
|
+
{ "action": "click", "selector": "button[data-tab='analytics']" },
|
|
62
|
+
{ "action": "wait", "ms": 500 },
|
|
63
|
+
{ "action": "screenshot", "key": "analytics", "description": "Analytics tab" }
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Commands
|
|
71
|
+
|
|
72
|
+
| Command | Description | Key Flags |
|
|
73
|
+
| --- | --- | --- |
|
|
74
|
+
| `reshot setup` | Interactive config wizard | `--offline`, `--force` |
|
|
75
|
+
| `reshot run` | Execute capture scenarios | `--scenarios`, `--diff`, `--all-variants`, `--concurrency`, `--no-headless` |
|
|
76
|
+
| `reshot record [title]` | Interactive recording via Chrome DevTools | `--browser`, `--url`, `--port` |
|
|
77
|
+
| `reshot sync` | Upload traces/docs to Reshot platform | `--trace-dir`, `--dry-run` |
|
|
78
|
+
| `reshot studio` | Launch web management UI | `--port`, `--no-open` |
|
|
79
|
+
| `reshot validate` | Check config and bindings | `--strict`, `--fix` |
|
|
80
|
+
| `reshot status` | View project status and sync history | `--jobs`, `--drifts`, `--json` |
|
|
81
|
+
| `reshot publish` | Upload assets with versioning | `--tag`, `--message`, `--dry-run` |
|
|
82
|
+
| `reshot pull` | Generate asset map for builds | `--format json\|ts\|csv`, `--output`, `--status` |
|
|
83
|
+
| `reshot drifts` | Manage visual drift notifications | `approve`, `reject`, `ignore`, `approve-all` |
|
|
84
|
+
| `reshot import-tests` | Import Playwright tests as scenarios | `--dry-run`, `--no-interactive` |
|
|
85
|
+
| `reshot ci setup` | Generate CI/CD workflow files | — |
|
|
86
|
+
| `reshot ci run` | Capture + publish in one step (CI) | `--tag`, `--no-publish`, `--dry-run` |
|
|
87
|
+
|
|
88
|
+
## Step Types
|
|
89
|
+
|
|
90
|
+
Steps define a sequence of browser actions within a scenario:
|
|
91
|
+
|
|
92
|
+
| Step | Description | Key Properties |
|
|
93
|
+
| --- | --- | --- |
|
|
94
|
+
| `wait` | Pause execution | `ms` |
|
|
95
|
+
| `screenshot` | Capture current viewport | `key`, `description` |
|
|
96
|
+
| `click` | Click a DOM element | `selector`, `optional` |
|
|
97
|
+
| `type` | Type text into an input | `selector`, `text` |
|
|
98
|
+
| `keyboard` | Send keyboard input | `key` (e.g., `"Meta+k"`, `"Enter"`) |
|
|
99
|
+
| `waitForSelector` | Wait for element to appear | `selector`, `timeout` |
|
|
100
|
+
| `navigate` | Go to a URL | `url` |
|
|
101
|
+
| `fillForm` | Fill multiple form fields | `fields` (selector-to-value map) |
|
|
102
|
+
|
|
103
|
+
## Variant System
|
|
104
|
+
|
|
105
|
+
Capture the same scenario across multiple dimensions (themes, locales, roles) without duplicating config:
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
{
|
|
109
|
+
"variants": {
|
|
110
|
+
"dimensions": {
|
|
111
|
+
"theme": {
|
|
112
|
+
"label": "Color Theme",
|
|
113
|
+
"options": {
|
|
114
|
+
"light": {
|
|
115
|
+
"name": "Light Mode",
|
|
116
|
+
"inject": [
|
|
117
|
+
{ "method": "localStorage", "key": "theme", "value": "light" },
|
|
118
|
+
{ "method": "browser", "colorScheme": "light" }
|
|
119
|
+
]
|
|
120
|
+
},
|
|
121
|
+
"dark": {
|
|
122
|
+
"name": "Dark Mode",
|
|
123
|
+
"inject": [
|
|
124
|
+
{ "method": "localStorage", "key": "theme", "value": "dark" },
|
|
125
|
+
{ "method": "browser", "colorScheme": "dark" }
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
"locale": {
|
|
131
|
+
"label": "Language",
|
|
132
|
+
"options": {
|
|
133
|
+
"en": {
|
|
134
|
+
"name": "English",
|
|
135
|
+
"inject": [
|
|
136
|
+
{ "method": "browser", "locale": "en-US" }
|
|
137
|
+
]
|
|
138
|
+
},
|
|
139
|
+
"de": {
|
|
140
|
+
"name": "German",
|
|
141
|
+
"inject": [
|
|
142
|
+
{ "method": "browser", "locale": "de-DE", "timezone": "Europe/Berlin" }
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
"presets": {
|
|
149
|
+
"all-themes": { "name": "All Themes", "dimensions": ["theme"] },
|
|
150
|
+
"matrix": { "name": "Full Matrix", "dimensions": ["theme", "locale"] }
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Run all variants:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
reshot run --all-variants
|
|
160
|
+
# Captures: homepage/light/en, homepage/light/de, homepage/dark/en, homepage/dark/de
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
**Injection methods:** `localStorage`, `sessionStorage`, `browser` (colorScheme, locale, timezone), `cookie`, `queryParam`.
|
|
164
|
+
|
|
165
|
+
## Viewport Presets
|
|
166
|
+
|
|
167
|
+
Use preset names in your config or with the `--viewport` flag:
|
|
168
|
+
|
|
169
|
+
| Category | Preset | Resolution | Scale |
|
|
170
|
+
| --- | --- | --- | --- |
|
|
171
|
+
| Desktop | `desktop-hd` | 1920x1080 | 1x |
|
|
172
|
+
| Desktop | `desktop` | 1280x720 | 1x |
|
|
173
|
+
| Desktop | `desktop-retina` | 1280x720 | 2x |
|
|
174
|
+
| Tablet | `tablet-landscape` | 1024x768 | 2x |
|
|
175
|
+
| Tablet | `tablet-portrait` | 768x1024 | 2x |
|
|
176
|
+
| Mobile | `mobile` | 375x667 | 2x |
|
|
177
|
+
| Mobile | `mobile-large` | 414x896 | 3x |
|
|
178
|
+
| Docs | `docs-wide` | 1200x800 | 2x |
|
|
179
|
+
| Docs | `docs-standard` | 960x640 | 2x |
|
|
180
|
+
| Social | `social-og` | 1200x630 | 2x |
|
|
181
|
+
| Social | `social-twitter` | 1200x600 | 2x |
|
|
182
|
+
|
|
183
|
+
## Visual Diffing
|
|
184
|
+
|
|
185
|
+
Compare captures against baselines to detect changes:
|
|
186
|
+
|
|
187
|
+
```json
|
|
188
|
+
{
|
|
189
|
+
"diffing": {
|
|
190
|
+
"enabled": true,
|
|
191
|
+
"threshold": 0.1,
|
|
192
|
+
"antialiasing": true,
|
|
193
|
+
"ignoreRegions": [
|
|
194
|
+
{ "x": 0, "y": 0, "width": 1280, "height": 50 }
|
|
195
|
+
]
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
# Run with diffing enabled
|
|
202
|
+
reshot run --diff
|
|
203
|
+
|
|
204
|
+
# Compare against cloud baselines
|
|
205
|
+
reshot run --diff --cloud
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Pixel-level comparison using pixelmatch. The `threshold` (0-1) controls sensitivity — 0.1 means 10% pixel difference tolerance. `antialiasing: true` compensates for font rendering differences across platforms. `ignoreRegions` excludes dynamic areas like timestamps or ads.
|
|
209
|
+
|
|
210
|
+
## Interactive Recording
|
|
211
|
+
|
|
212
|
+
Record scenarios by interacting with your app in a real browser:
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
# Launch Chrome and start recording
|
|
216
|
+
reshot record "Checkout Flow" --browser --url http://localhost:3000
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
During recording:
|
|
220
|
+
- Press **S** to capture a screenshot step
|
|
221
|
+
- Press **C** to start/stop a video clip
|
|
222
|
+
- Press **Q** to quit and save
|
|
223
|
+
|
|
224
|
+
The recorded scenario is appended to `docsync.config.json` automatically.
|
|
225
|
+
|
|
226
|
+
## Authentication
|
|
227
|
+
|
|
228
|
+
### Storage State (from Playwright)
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
npx playwright codegen http://localhost:3000 --save-storage=.reshot/auth-state.json
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
```json
|
|
235
|
+
{
|
|
236
|
+
"storageStatePath": ".reshot/auth-state.json"
|
|
237
|
+
}
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### Login Steps
|
|
241
|
+
|
|
242
|
+
```json
|
|
243
|
+
{
|
|
244
|
+
"auth": {
|
|
245
|
+
"loginUrl": "http://localhost:3000/login",
|
|
246
|
+
"loginSteps": [
|
|
247
|
+
{ "action": "type", "selector": "input[name='email']", "text": "${EMAIL}" },
|
|
248
|
+
{ "action": "type", "selector": "input[name='password']", "text": "${PASSWORD}" },
|
|
249
|
+
{ "action": "click", "selector": "button[type='submit']" },
|
|
250
|
+
{ "action": "waitForSelector", "selector": "[data-authenticated='true']" }
|
|
251
|
+
]
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
Environment variables (`${EMAIL}`, `${PASSWORD}`) are interpolated at runtime.
|
|
257
|
+
|
|
258
|
+
## Output Formats
|
|
259
|
+
|
|
260
|
+
### Step-by-Step Images (default)
|
|
261
|
+
|
|
262
|
+
```
|
|
263
|
+
.reshot/output/dashboard/20260315-120000/theme-light/
|
|
264
|
+
├── step-0-overview.png
|
|
265
|
+
└── step-1-analytics.png
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### Video Recording
|
|
269
|
+
|
|
270
|
+
Set `"format": "summary-video"` in scenario output config to record the full browser session as MP4.
|
|
271
|
+
|
|
272
|
+
### Selective Capture (Crop)
|
|
273
|
+
|
|
274
|
+
```json
|
|
275
|
+
{
|
|
276
|
+
"output": {
|
|
277
|
+
"crop": {
|
|
278
|
+
"enabled": true,
|
|
279
|
+
"selector": ".modal-dialog",
|
|
280
|
+
"padding": 16
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
Crops the screenshot to the bounding box of the selected element.
|
|
287
|
+
|
|
288
|
+
## CI/CD Integration
|
|
289
|
+
|
|
290
|
+
### GitHub Actions
|
|
291
|
+
|
|
292
|
+
```yaml
|
|
293
|
+
name: Visual Capture
|
|
294
|
+
on:
|
|
295
|
+
push:
|
|
296
|
+
branches: [main]
|
|
297
|
+
|
|
298
|
+
jobs:
|
|
299
|
+
capture:
|
|
300
|
+
runs-on: ubuntu-latest
|
|
301
|
+
steps:
|
|
302
|
+
- uses: actions/checkout@v4
|
|
303
|
+
- uses: actions/setup-node@v4
|
|
304
|
+
with: { node-version: 20 }
|
|
305
|
+
- run: npm ci
|
|
306
|
+
- run: npm start & # start your app
|
|
307
|
+
- run: npx @reshotdev/screenshot ci run --tag ${{ github.sha }} --message "Deploy ${{ github.sha }}"
|
|
308
|
+
env:
|
|
309
|
+
RESHOT_TOKEN: ${{ secrets.RESHOT_TOKEN }}
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
Or use the setup wizard:
|
|
313
|
+
|
|
314
|
+
```bash
|
|
315
|
+
reshot ci setup
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
This generates a `.github/workflows/reshot.yml` tailored to your project.
|
|
319
|
+
|
|
320
|
+
## Asset Map for Builds
|
|
321
|
+
|
|
322
|
+
Generate a manifest of captured assets for use in documentation sites or marketing pages:
|
|
323
|
+
|
|
324
|
+
```bash
|
|
325
|
+
reshot pull --format json --output assets.json --status approved
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
```json
|
|
329
|
+
{
|
|
330
|
+
"assets": [
|
|
331
|
+
{
|
|
332
|
+
"key": "dashboard-overview",
|
|
333
|
+
"variant": "theme-light",
|
|
334
|
+
"url": "https://cdn.reshot.dev/abc123/dashboard-overview.png",
|
|
335
|
+
"format": "png",
|
|
336
|
+
"width": 1280,
|
|
337
|
+
"height": 720,
|
|
338
|
+
"version": "v1.2.0"
|
|
339
|
+
}
|
|
340
|
+
]
|
|
341
|
+
}
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
Also supports `--format ts` (TypeScript with full metadata) and `--format csv`.
|
|
345
|
+
|
|
346
|
+
## Drift Management
|
|
347
|
+
|
|
348
|
+
Visual drifts are flagged when captures differ from baselines:
|
|
349
|
+
|
|
350
|
+
```bash
|
|
351
|
+
# List pending drifts
|
|
352
|
+
reshot drifts
|
|
353
|
+
|
|
354
|
+
# Approve a specific drift (updates baseline)
|
|
355
|
+
reshot drifts approve drift-abc123
|
|
356
|
+
|
|
357
|
+
# Approve all pending drifts
|
|
358
|
+
reshot drifts approve-all
|
|
359
|
+
|
|
360
|
+
# Reject a drift (keeps old baseline)
|
|
361
|
+
reshot drifts reject drift-abc123
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
## Standalone Mode
|
|
365
|
+
|
|
366
|
+
Run without any cloud connection:
|
|
367
|
+
|
|
368
|
+
```bash
|
|
369
|
+
reshot setup --offline
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
All capture, recording, diffing, and studio features work locally. Cloud features (publish, sync, drifts, pull) are disabled.
|
|
373
|
+
|
|
374
|
+
## Limitations
|
|
375
|
+
|
|
376
|
+
- Beta release. The CLI interface and config format may change between minor versions.
|
|
377
|
+
- Playwright browsers are downloaded on first run (~200MB for Chromium).
|
|
378
|
+
- Video recording requires Chromium (Firefox and WebKit support screenshots only).
|
|
379
|
+
- Cloud features (publish, sync, drifts) require a Reshot account at [reshot.dev](https://reshot.dev).
|
|
380
|
+
- Privacy masking (automatic PII redaction) is best-effort and should not be relied on for compliance.
|
|
381
|
+
|
|
382
|
+
## Documentation
|
|
383
|
+
|
|
384
|
+
[reshot.dev/docs](https://reshot.dev/docs)
|
|
385
|
+
|
|
386
|
+
## License
|
|
387
|
+
|
|
388
|
+
MIT
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@reshotdev/screenshot",
|
|
3
|
+
"version": "0.0.1-beta.0",
|
|
4
|
+
"description": "CI/CD screenshot and video capture CLI",
|
|
5
|
+
"author": "Reshot <hello@reshot.dev>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://reshot.dev",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/reshotdev/screenshot"
|
|
11
|
+
},
|
|
12
|
+
"bugs": "https://github.com/reshotdev/screenshot/issues",
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"keywords": ["screenshots", "ci-cd", "documentation", "visual-testing", "automation", "playwright"],
|
|
17
|
+
"bin": {
|
|
18
|
+
"reshot": "./src/index.js"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"src/",
|
|
22
|
+
"web/manager/dist/",
|
|
23
|
+
"web/cropper/",
|
|
24
|
+
"web/subtitle-editor/",
|
|
25
|
+
"LICENSE",
|
|
26
|
+
"README.md"
|
|
27
|
+
],
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=18.0.0"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"test": "node scripts/test.js",
|
|
33
|
+
"test:unit": "node --test tests/unit/*.test.js",
|
|
34
|
+
"test:integration": "node --test tests/integration/*.test.js",
|
|
35
|
+
"test:all": "node --test tests/unit/*.test.js tests/integration/*.test.js",
|
|
36
|
+
"test:dry-run": "node src/index.js --help && node src/index.js --version",
|
|
37
|
+
"prepublishOnly": "cd web/manager && npm install && npm run build",
|
|
38
|
+
"ui:build": "cd web/manager && npm install && npm run build",
|
|
39
|
+
"ui:dev": "cd web/manager && npm install && npm run dev",
|
|
40
|
+
"lint": "echo 'No linting configured yet'",
|
|
41
|
+
"pack:check": "npm pack --dry-run"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"axios": "^1.6.2",
|
|
45
|
+
"chalk": "^4.1.2",
|
|
46
|
+
"commander": "^11.1.0",
|
|
47
|
+
"cors": "^2.8.5",
|
|
48
|
+
"dotenv": "^16.3.1",
|
|
49
|
+
"express": "^4.18.2",
|
|
50
|
+
"form-data": "^4.0.0",
|
|
51
|
+
"fs-extra": "^11.2.0",
|
|
52
|
+
"get-port": "^7.0.0",
|
|
53
|
+
"inquirer": "^8.2.5",
|
|
54
|
+
"open": "^9.1.0",
|
|
55
|
+
"ora": "^7.0.1",
|
|
56
|
+
"pixelmatch": "^5.3.0",
|
|
57
|
+
"playwright": "^1.40.0",
|
|
58
|
+
"pngjs": "^7.0.0",
|
|
59
|
+
"sharp": "^0.33.2",
|
|
60
|
+
"socket.io": "^4.7.2",
|
|
61
|
+
"uuid": "^9.0.1",
|
|
62
|
+
"@aws-sdk/client-s3": "^3.650.0"
|
|
63
|
+
}
|
|
64
|
+
}
|