paper-snapshot-cli 0.1.3 → 0.1.5
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/dist/bin.mjs +11 -4
- package/package.json +1 -1
- package/skills/paper-snapshot/SKILL.md +1 -1
package/dist/bin.mjs
CHANGED
|
@@ -54613,7 +54613,7 @@ const NodeInfo = fromJsonString(Struct({
|
|
|
54613
54613
|
const layer = succeed$3(Service, Service.of({ connect: fn("Paper.connect")(function* (settings) {
|
|
54614
54614
|
const client = new Client({
|
|
54615
54615
|
name: "paper-snapshot",
|
|
54616
|
-
version: "0.1.
|
|
54616
|
+
version: "0.1.5"
|
|
54617
54617
|
});
|
|
54618
54618
|
yield* acquireRelease(tryPromise({
|
|
54619
54619
|
try: () => client.connect(new StdioClientTransport({
|
|
@@ -54889,7 +54889,7 @@ const flags = {
|
|
|
54889
54889
|
json: toggle("json", false, "Print one JSON line per capture on stdout; failures print {\"index\", \"url\", \"error\"}"),
|
|
54890
54890
|
quiet: toggle("quiet", false, "Only log warnings and errors (same as --log-level warn)"),
|
|
54891
54891
|
failFast: toggle("fail-fast", false, "Stop at the first failed capture"),
|
|
54892
|
-
fileId:
|
|
54892
|
+
fileId: String$1("file-id").pipe(withDescription$1("Paper file id (default: $PAPER_SNAPSHOT_FILE_ID, else the file in front in Paper)"), withFallbackConfig(String$6("PAPER_SNAPSHOT_FILE_ID")), optional$1),
|
|
54893
54893
|
pageId: optionalString("page-id", "Paper page id (default: the active page)"),
|
|
54894
54894
|
name: optionalString("name", "Artboard name (default: page title · host)"),
|
|
54895
54895
|
x: optionalInteger("x", "Artboard x position on the canvas"),
|
|
@@ -55070,6 +55070,13 @@ const target = (job, input, name, layout) => {
|
|
|
55070
55070
|
position
|
|
55071
55071
|
});
|
|
55072
55072
|
};
|
|
55073
|
+
/** "Title · host"; a page titled only with its host is named by its URL instead. */
|
|
55074
|
+
const defaultName = (title, url) => {
|
|
55075
|
+
const parsed = URL.parse(url);
|
|
55076
|
+
if (parsed === null) return title;
|
|
55077
|
+
const path = parsed.pathname === "/" ? "" : parsed.pathname.replace(/\/$/, "");
|
|
55078
|
+
return title === "" || title === parsed.host ? `${parsed.host}${path}` : `${title} · ${parsed.host}`;
|
|
55079
|
+
};
|
|
55073
55080
|
const slug = (text) => text.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 60) || "snapshot";
|
|
55074
55081
|
const handler = fn("paper-snapshot")(function* (input) {
|
|
55075
55082
|
const fs = yield* FileSystem;
|
|
@@ -55155,7 +55162,7 @@ const handler = fn("paper-snapshot")(function* (input) {
|
|
|
55155
55162
|
captureTimeout: millis(input.captureTimeout)
|
|
55156
55163
|
});
|
|
55157
55164
|
})).pipe(flatMap$1((snapshot) => gen(function* () {
|
|
55158
|
-
const name = getOrElse(job.name, () =>
|
|
55165
|
+
const name = getOrElse(job.name, () => defaultName(snapshot.title, snapshot.url));
|
|
55159
55166
|
const warned = Object.entries(snapshot.warnings).filter(([, count]) => count > 0);
|
|
55160
55167
|
if (warned.length > 0) yield* logWarning(`${name}: ${warned.map(([kind, count]) => `${count} ${kind}`).join(", ")}`);
|
|
55161
55168
|
const out = map$9(input.out, (location) => batch ? path.join(location, `${job.index + 1}-${slug(name)}.html`) : location);
|
|
@@ -55280,7 +55287,7 @@ const LoggerLive = layer$4([make$6((options) => {
|
|
|
55280
55287
|
process.stderr.write(`${mark} ${text}\n`);
|
|
55281
55288
|
})]);
|
|
55282
55289
|
const MainLive = mergeAll(layer$2, layer$1.pipe(provide$2(layer$3)), layer).pipe(provideMerge(layer$5), provideMerge(LoggerLive));
|
|
55283
|
-
run$1(command, { version: "0.1.
|
|
55290
|
+
run$1(command, { version: "0.1.5" }).pipe(tapError((error) => isCliError(error) ? void_ : error$1(`paper-snapshot: ${error.message}`)), tapDefect((defect) => error$1(`paper-snapshot: unexpected error: ${defect instanceof Error ? defect.stack ?? defect.message : String(defect)}`)), provide(MainLive), runMain({
|
|
55284
55291
|
disableErrorReporting: true,
|
|
55285
55292
|
teardown: (exit, onExit) => defaultTeardown(exit, (code) => {
|
|
55286
55293
|
onExit(code);
|
package/package.json
CHANGED
|
@@ -31,7 +31,7 @@ description: Snapshot web UI into Paper as editable layers. Use when a URL, loca
|
|
|
31
31
|
Tell the user before running a command that waits on them, and name what they will see.
|
|
32
32
|
|
|
33
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
|
|
34
|
+
- **Paper app.** It must be running. Without `--file-id` (or `PAPER_SNAPSHOT_FILE_ID`), artboards go to the file in front in Paper, which may not be the one the user means: in scripts and batches, always pass the file id. Pushing needs no approval.
|
|
35
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
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
37
|
|