paper-snapshot-cli 0.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/LICENSE +21 -0
- package/README.md +187 -0
- package/dist/bin.mjs +55374 -0
- package/package.json +72 -0
- package/skills/paper-snapshot/SKILL.md +47 -0
package/package.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "paper-snapshot-cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Paper Snapshot as a CLI. Copy and paste your real site directly into Paper as editable layers. No more screenshots.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ai-agents",
|
|
7
|
+
"claude-code",
|
|
8
|
+
"cli",
|
|
9
|
+
"coding-agents",
|
|
10
|
+
"design-tools",
|
|
11
|
+
"effect",
|
|
12
|
+
"paper",
|
|
13
|
+
"paper-design",
|
|
14
|
+
"paper-snapshot",
|
|
15
|
+
"snapshot"
|
|
16
|
+
],
|
|
17
|
+
"homepage": "https://github.com/jeremyosih/paper-snapshot#readme",
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/jeremyosih/paper-snapshot.git"
|
|
22
|
+
},
|
|
23
|
+
"bin": {
|
|
24
|
+
"paper-snapshot": "dist/bin.mjs"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist",
|
|
28
|
+
"skills"
|
|
29
|
+
],
|
|
30
|
+
"type": "module",
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public",
|
|
33
|
+
"provenance": true
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "vp pack",
|
|
37
|
+
"dev": "bun src/bin.ts",
|
|
38
|
+
"check": "vp check && bun run typecheck && bun run knip",
|
|
39
|
+
"lint": "vp lint --report-unused-disable-directives",
|
|
40
|
+
"format": "vp fmt",
|
|
41
|
+
"fmt:check": "vp fmt --check",
|
|
42
|
+
"typecheck": "tsc --noEmit",
|
|
43
|
+
"knip": "knip",
|
|
44
|
+
"staged": "vp staged",
|
|
45
|
+
"hooks:setup": "vp config",
|
|
46
|
+
"setup": "effect-tsgo patch"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"playwright-core": "1.64.1"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@effect/platform-node": "4.0.6",
|
|
53
|
+
"@effect/tsgo": "0.57.0",
|
|
54
|
+
"@modelcontextprotocol/sdk": "1.32.2",
|
|
55
|
+
"@oxlint/plugins": "1.82.0",
|
|
56
|
+
"@types/node": "^26.2.0",
|
|
57
|
+
"effect": "4.0.6",
|
|
58
|
+
"fflate": "0.8.2",
|
|
59
|
+
"knip": "6.34.0",
|
|
60
|
+
"oxlint": "1.82.0",
|
|
61
|
+
"typescript": "7.0.2",
|
|
62
|
+
"vite-plus": "0.3.1"
|
|
63
|
+
},
|
|
64
|
+
"overrides": {
|
|
65
|
+
"@effect/platform-node-shared": "4.0.6",
|
|
66
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@0.3.1"
|
|
67
|
+
},
|
|
68
|
+
"engines": {
|
|
69
|
+
"node": ">=22"
|
|
70
|
+
},
|
|
71
|
+
"packageManager": "bun@1.4.2"
|
|
72
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: paper-snapshot
|
|
3
|
+
description: Snapshot web UI into Paper as editable layers. Use when a URL, local dev server, set of app screens, or live browser state should land in a Paper file, or when Paper artboards need refreshing from the app.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# paper-snapshot
|
|
7
|
+
|
|
8
|
+
`paper-snapshot` serializes pages with Paper Snapshot's own serializer and writes each as an artboard into the file open in the Paper app. Every behaviour is a flag; `paper-snapshot --help` is the reference.
|
|
9
|
+
|
|
10
|
+
## Steps
|
|
11
|
+
|
|
12
|
+
1. **Pick the source.**
|
|
13
|
+
- URLs, public or localhost: `paper-snapshot <url> [<url or /path>…]`. It launches the installed Chrome headlessly.
|
|
14
|
+
- A state that takes interaction to reach and that page-state flags (step 2) cannot set up: get a browser there, then capture its tab without a URL.
|
|
15
|
+
- agent-browser: `paper-snapshot` (captures the tab agent-browser is on).
|
|
16
|
+
- The user's everyday Chrome, also what Chrome DevTools MCP drives with `--autoConnect`: `paper-snapshot --source chrome --tab <text in the tab's URL or title>`. The user must approve it in Chrome; see **Human checkpoints**.
|
|
17
|
+
- Playwriter: `--source playwriter --tab <text>`. Any other CDP browser: `--cdp <endpoint>`.
|
|
18
|
+
|
|
19
|
+
2. **Set up the state.** Sign-in: `--storage-state auth.json`, or `--cookie "name=value"`. Theme and flags that apps keep in storage: `--local-storage key=value` (`--color-scheme dark` alone only flips the media query). Menus and dialogs: `--click <selector>`, repeatable, in order. `--eval` covers anything else.
|
|
20
|
+
|
|
21
|
+
3. **Scope it.** `-s <css>` captures one element; the default is the whole page. Internal scroll containers (`h-screen` shells) are unclipped automatically. Match the device with `--width`/`--height`.
|
|
22
|
+
|
|
23
|
+
4. **Place it.** One screen: optional `--name`, `--page-id`, `--x/--y`, `--below <artboardId>` or `--right-of <artboardId>`. Several screens: pass several URLs, or a `--manifest` JSON file whose items set per-screen fields (`name`, `colorScheme`, `localStorage`, `x`, `below`, `replace`, …). They share one browser and one Paper connection and are arranged by `--layout row|column|grid`. Refreshing a screen after the app changed: `--replace <artboardId>`, which keeps the artboard's id, position and name.
|
|
24
|
+
|
|
25
|
+
5. **Run with `--json`.** Stdout carries one JSON line per artboard: `artboardId`, `fileId`, `x`, `y`, `width`, `height`, and `warnings`. A failed capture prints `{"index", "url", "error"}`, the batch continues, and the exit code is 1.
|
|
26
|
+
|
|
27
|
+
6. **Verify.** Read each line's `warnings`; any non-zero count names what imported badly (`emptySvgs`, `unresolvedSprites`, `clippedScrollContainers`, `unresolvedImages`, `lostColspans`). Screenshot flagged artboards with the Paper MCP `get_screenshot`. Done when every artboard shows the intended state with zero warnings, or the remaining ones are explained.
|
|
28
|
+
|
|
29
|
+
## Human checkpoints
|
|
30
|
+
|
|
31
|
+
Tell the user before running a command that waits on them, and name what they will see.
|
|
32
|
+
|
|
33
|
+
- **Chrome "Allow remote debugging?" dialog** (`--source chrome`, and auto without a URL when agent-browser is absent). One-time setup: the user turns on remote debugging at `chrome://inspect/#remote-debugging`; Chrome then shows "Server running at 127.0.0.1:9222". Every run opens a fresh connection, so Chrome shows "Allow remote debugging?" each time, on the machine where Chrome runs. The command blocks until the user clicks **Allow**, for up to `--chrome-approval-timeout` (2 min). **Cancel** fails the run. While attached, Chrome shows a "controlled by automated test software" banner. A batch asks once. On a remote machine, the person at that screen has to click.
|
|
34
|
+
- **Paper app.** It must be running with a file open, or pass `--file-id`. Pushing needs no approval.
|
|
35
|
+
- **agent-browser / Playwriter.** No prompt, but an agent-browser session must be open (`agent-browser open <url>`), or Playwriter's extension must be connected to its relay.
|
|
36
|
+
- **First run.** paper-snapshot downloads the Paper Snapshot extension once (network required). Without an installed Chrome, Edge, Brave or Chromium it also downloads headless Chromium once.
|
|
37
|
+
|
|
38
|
+
## Gotchas
|
|
39
|
+
|
|
40
|
+
- When `paper-snapshot` isn't on PATH, run it as `npx -y paper-snapshot-cli …` with the same arguments.
|
|
41
|
+
|
|
42
|
+
- The Paper app must be running: the push goes through its MCP relay at `~/.paper/bin/paper`. `--file-id` and `--page-id` target a specific file and page.
|
|
43
|
+
- Snapshots run to several MB. Let paper-snapshot carry the HTML; `--out` writes it to disk (a directory for several captures).
|
|
44
|
+
- Images on localhost and private hosts are inlined automatically because Paper cannot reach them. Use `--inline-images always` for assets behind auth.
|
|
45
|
+
- Sections that animate in on scroll can come out blank: give them time with `--settle 2000`, or force the final state with `--eval`.
|
|
46
|
+
- Attached browsers stay open. Passing a URL while attached opens a temporary tab and closes it afterwards.
|
|
47
|
+
- `--quiet` keeps stderr to warnings and errors across long batches.
|