@trawlme/skills 1.3.1 → 1.3.2

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 CHANGED
@@ -15,6 +15,7 @@ Follows the [Anthropic Agent Skills](https://github.com/anthropics/skills) layou
15
15
  | `trawl-scrap-design` | Best practices for writing the Puppeteer script body — selectors, returnData shape, params, validation, anti-patterns. |
16
16
  | `trawl-scrap-account` | Authentication — Trawl-managed credentials, BYO-cookies (embedded and persisted flavours), session reuse. |
17
17
  | `trawl-scrap-local-test` | Run a scrap locally with headed Chrome before publishing, mirroring the worker entry contract. |
18
+ | `trawl-scrap-banner` | Generate + upload a brand-aware 1200x630 banner image for a scrap. |
18
19
 
19
20
  ## Install
20
21
 
@@ -51,7 +52,7 @@ The CLI bundles the skills and keeps them in sync with the CLI version.
51
52
 
52
53
  ## Migrating from v0.1.x
53
54
 
54
- In v0.1.x there was a single skill named `trawl`. v0.2.0 splits it into four focused skills (see the bundled skills table above). When you run `npx @trawlme/skills install` (or `update`), the installer detects the legacy `~/.claude/skills/trawl/` directory and removes it before installing the new four. No manual cleanup needed.
55
+ In v0.1.x there was a single skill named `trawl`. v0.2.0 split it into four focused skills; `trawl-scrap-banner` was added later, bringing the total to the five listed in the bundled skills table above. When you run `npx @trawlme/skills install` (or `update`), the installer detects the legacy `~/.claude/skills/trawl/` directory and removes it before installing the current set. No manual cleanup needed.
55
56
 
56
57
  Restart Claude Code after the install for the new skills to be picked up.
57
58
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trawlme/skills",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "Claude Code skills for the Trawl CLI — teaches Claude how to manage scraps via @trawlme/cli",
5
5
  "type": "module",
6
6
  "bin": {
@@ -25,11 +25,12 @@ The user must have `@trawlme/cli` installed:
25
25
  npm install -g @trawlme/cli
26
26
  ```
27
27
 
28
- And be authenticated. Three auth paths:
28
+ And be authenticated. Auth paths:
29
29
 
30
- 1. **Interactive** — `trawl login` (prompts email/password, stores JWT in `~/.config/trawl-cli/`)
31
- 2. **Env var** — `export TRAWL_TOKEN=<jwt>` (overrides stored token, ideal for CI)
30
+ 1. **Interactive** — `trawl login` (prompts email/password, stores JWT via `conf`; on macOS that's `~/Library/Preferences/trawl-cli-nodejs/`, **not** `~/.config/trawl-cli/` — Conf's `env-paths` dependency hardcodes `Library/Preferences` and ignores XDG. Override the location with `TRAWL_CONFIG_DIR`.)
31
+ 2. **Env var** — `export TRAWL_TOKEN=<jwt>` (overrides stored token, ideal for CI; `trawl token` also resolves it — see MCP bridge below)
32
32
  3. **Token flag** — `trawl login --token <jwt>`
33
+ 4. **Email/password flags** — `trawl login -e <email> -p <password>` (non-interactive; `-p` on the command line is visible in process list/shell history — CI only, prefer the interactive password prompt otherwise)
33
34
 
34
35
  Custom API base: `trawl login --url https://self-hosted.example.com`. Default is `https://api.trawl.me`.
35
36
 
@@ -39,6 +40,7 @@ CI-relevant env vars. The first three are per-invocation session overrides — t
39
40
  - `TRAWL_TOKEN` — session JWT, takes precedence over `trawl login`'s stored token
40
41
  - `TRAWL_API_URL` — API base URL, takes precedence over `trawl login --url`
41
42
  - `TRAWL_TIMEOUT` — per-request fetch timeout in ms (default 30000)
43
+ - `DEBUG` — any truthy value prints the full error stack trace to stderr, same effect as the global `--debug` flag
42
44
 
43
45
  `TRAWL_CONFIG_DIR` is different — it **redirects where the CLI reads and writes** its config file (so `trawl login` persists there). Point it at an ephemeral dir for hermetic runs, e.g. `TRAWL_CONFIG_DIR=$(mktemp -d)`.
44
46
 
@@ -73,6 +75,17 @@ trawl scraps data <id> --json # last run output (the scraped data)
73
75
  - `--errors` — show failure diagnostics inline when the last run failed.
74
76
  - `--json` — machine-readable output.
75
77
 
78
+ **Honest data states (since CLI 1.18.2):** `[]` is reserved for a genuine zero-item run. Every other outcome is a distinct error envelope instead of a silent empty array:
79
+
80
+ | State | Result |
81
+ |---|---|
82
+ | Genuine zero-item run (incl. a run with `statusDetail: 'empty'`) | `[]`, exit `0` |
83
+ | Scrap has never run | error, exit `4`, kind `not_found` — "Run it first... or pass --fresh" |
84
+ | Last run failed (`status: false` and not `empty`) | error, exit `1`, kind `run_failed` — points to `--errors` |
85
+ | Payload aged out of retention (server keeps only the newest row per scrap+status bucket) | error, exit `4`, kind `not_found` |
86
+
87
+ Before 1.18.2 all four states collapsed into the same `[]` / "No data yet." — never assume "no data" from an empty result without checking the exit code.
88
+
76
89
  ### Create a scrap
77
90
 
78
91
  ```bash
@@ -87,6 +100,7 @@ Flags:
87
100
  - `-d, --description` — what the scrap does (used by wizard few-shot examples + future marketplace listing)
88
101
  - `-r, --request` — the Puppeteer script body (must call `returnData(arr)`)
89
102
  - `--tier tier0..tier4` — request a starting proxy tier (see Proxy tiers below)
103
+ - `--json` — output the full scrap object as JSON; a refused tier returns the standard error envelope + exit `1` instead (see Proxy tiers below)
90
104
 
91
105
  For the script body, see the `trawl-scrap-design` skill.
92
106
 
@@ -104,15 +118,19 @@ trawl scraps update <id> -p '[{"TRAWL.page":"2"}]' # runtime params: JS
104
118
  trawl scraps update <id> --params-file ./params.json # bulk params from file (same array shape)
105
119
  trawl scraps update <id> --tier tier2 # request a proxy tier
106
120
  trawl scraps update <id> --force-tier tier4 # raise the tier CEILING past the auto-cap
121
+ trawl scraps update <id> --tier tier2 --json # full scrap JSON, or error envelope + exit 1 on refusal
107
122
  ```
108
123
 
109
124
  > **GTM seed scraps:** always run `trawl scraps update <id> --autofix --cron '0 0 * * 0'` post-create (weekly schedule + AI Fix enabled).
110
125
 
111
126
  ### Proxy tiers
112
127
 
113
- - `--tier tier0..tier4` (create + update) — requests a starting proxy tier. It's **clamped to tier3** if the target domain isn't allow-listed for tier4, even though the flag accepts `tier4` without error. On `update`, the CLI **echoes** the clamp (`⚠ proxyTier requested tier4 → applied tier3`); on `create` (and older servers) the clamp is silent — so don't rely on seeing a warning.
114
- - `--force-tier tier0..tier4` (update only) — raises the tier **ceiling** past that auto-cap. History-gated: the server may refuse it (the CLI prints `✗ tier ceiling override refused` and exits `1`) or it may cost more, depending on the scrap's run history.
115
- - Either way, verify what tier a run actually used with `trawl scraps history <id>` / `trawl scraps run-info <hid>` (the `history` list may show these columns blank — drill into `run-info` for the confirmed value) — don't assume the requested tier was honored.
128
+ - `--tier tier0..tier4` (create + update) — requests a starting proxy tier. It's **clamped to tier3** if the target domain isn't allow-listed for tier4, even though the flag accepts `tier4` without error.
129
+ - Since CLI 1.18.2, **both `create` and `update`** read `_tierOverride` back from the server and render the same honest truth (previously only `update` echoed the clamp; `create` was silent): a clamp (`⚠ proxyTier requested tier4 → applied tier3`), an allowed ceiling raise (+ spend warning if any), or a refusal.
130
+ - **Old-server fallback (since CLI 1.18.2):** if a tier was requested but the response carries no `_tierOverride` at all, the CLI no longer echoes the requested value as if it were applied — it prints `⚠ Server did not confirm the tier change (older server) — verify with: trawl scraps get <id>` instead. Never assume the requested tier was honored on an unconfirmed response.
131
+ - `--force-tier tier0..tier4` (update only) — raises the tier **ceiling** past that auto-cap. History-gated: the server may refuse it (the CLI prints `✗ tier ceiling override refused: <reason>` and exits `1`) or it may cost more, depending on the scrap's run history.
132
+ - `--json` (create + update, since CLI 1.18.2): success returns the full scrap object including `_tierOverride`; a refused tier returns the standard error envelope on stdout and exits `1` — same outcome as human mode, just machine-readable.
133
+ - Either way, verify what tier a run actually used with `trawl scraps history <id>` / `trawl scraps run-info <hid>` (on servers released before mid-July 2026 the `history` list shows these columns blank — `run-info` always has them) — don't assume the requested tier was honored.
116
134
 
117
135
  ### Run / trigger / watch
118
136
 
@@ -133,23 +151,23 @@ trawl scraps run-info <hid> # one run's detail by its history id
133
151
  trawl scraps run-info <hid> --json
134
152
  ```
135
153
 
136
- `doctor`/`autofix` (below) inspect the **last** run; `history` + `run-info` reach **any** run: list with `history`, then pass a run's `hid` to `run-info` for the full diagnosis. `run-info` hits `/api/historys/:hid`, which returns the proxy tier + `failureKind` to the scrap owner. (In `history`'s embedded list those columns may be blank — drill into `run-info <hid>` for them.)
154
+ `doctor`/`autofix` (below) inspect the **last** run; `history` + `run-info` reach **any** run: list with `history`, then pass a run's `hid` to `run-info` for the full diagnosis. `run-info` hits `/api/historys/:hid`, which returns the proxy tier + `failureKind` to the scrap owner, plus the error snapshot (`errorMessage`/selector context) that `history`'s embedded list never carries. (On servers released before mid-July 2026, `history` also shows the tier/failureKind columns blank — `run-info` always has them.)
137
155
 
138
156
  ### Delete
139
157
 
140
158
  ```bash
141
- trawl scraps rm <id> # prompts for confirmation
142
- trawl scraps rm <id> --force # no prompt, useful in scripts
143
- trawl scraps delete <id> # `delete` is an alias for `rm`, same flags
159
+ trawl scraps delete <id> # prompts for confirmation
160
+ trawl scraps delete <id> --force # no prompt, useful in scripts
161
+ trawl scraps rm <id> # `rm` is an alias for `delete`, same flags
144
162
  ```
145
163
 
146
164
  ## Scrap accounts
147
165
 
148
- For per-scrap authentication, see the `trawl-scrap-account` skill. CLI commands: `trawl scraps account set/status/clear-session/delete`.
166
+ For per-scrap authentication, see the `trawl-scrap-account` skill. CLI commands: `trawl scraps account set/status/clear-session/delete`, plus `trawl scraps account session set <id>` (upload BYO-cookies).
149
167
 
150
168
  ## MCP bridge
151
169
 
152
- `trawl token` prints the stored session JWT to **stdout** (any advisory text, e.g. expiry, goes to stderr — safe to capture stdout alone).
170
+ `trawl token` prints the stored session JWT to **stdout** (any advisory text, e.g. expiry, goes to stderr — safe to capture stdout alone). Since CLI 1.18.2 it resolves `TRAWL_TOKEN` before the stored config token (same precedence every other token consumer uses), so it works headless in CI/agents without a prior `trawl login`: `TRAWL_TOKEN=<jwt> trawl token` prints straight through. A missing or expired token now exits `3` with kind `auth` (previously exit `1`, kind `unknown` — indistinguishable from an arbitrary bug).
153
171
 
154
172
  The session JWT authenticates two different ways depending on the endpoint:
155
173
 
@@ -199,6 +217,7 @@ trawl scraps run <id> --watch
199
217
 
200
218
  ## Other commands
201
219
 
220
+ - `trawl scraps banner <id> -f <path>` — upload a banner image (jpg/png/webp) for a scrap; see the `trawl-scrap-banner` skill for the full generate + upload pipeline
202
221
  - `trawl logout` — clear stored credentials
203
222
  - `trawl skills list/install/uninstall/update` — manage the bundled Claude Code skills (this package)
204
223
  - `trawl telemetry` — inspect/toggle usage telemetry (`TRAWL_TELEMETRY=0` / `DO_NOT_TRACK=1` env overrides also work)
@@ -215,15 +234,38 @@ Scrap object shape:
215
234
  "url": "https://...",
216
235
  "request": "var page = ...",
217
236
  "scrapper": "puppeteer",
218
- "cron": "0 9 * * *" ,
237
+ "cron": "0 9 * * *",
238
+ "autoFix": false,
219
239
  "params": [{"TRAWL.paramName": "value"}],
220
- "lastRun": { "status": "success" | "failure", "duration": 1234, "error": "..." },
240
+ "history": [
241
+ {
242
+ "_id": "...",
243
+ "status": true,
244
+ "statusDetail": "success",
245
+ "time": 4200,
246
+ "proxyTier": "tier1",
247
+ "failureKind": null,
248
+ "blockType": null,
249
+ "createdAt": "..."
250
+ }
251
+ ],
221
252
  "createdAt": "...",
222
- "updatedAt": "..."
253
+ "updatedAt": "...",
254
+ "_tierOverride": { "requestedMaxTier": "tier4", "effectiveMaxTier": "tier3", "refused": false, "reason": "...", "provider": "...", "warning": null }
223
255
  }
224
256
  ```
225
257
 
226
- `trawl scraps data <id> --json` returns the array passed to `returnData(...)`.
258
+ There is **no `lastRun` field** — that never existed. Last-run status/timing/error all derive from `history[0]` (newest first). The embedded row shape differs by command:
259
+ - `trawl scraps get <id>` — up to 100 rows, each with `status`, `statusDetail`, `time`, `proxyTier`, `failureKind`, `blockType`, `createdAt`
260
+ - `trawl scraps list` — only the single newest row per scrap, with just `status` / `statusDetail` / `createdAt` (no `time`/`proxyTier`/`failureKind`/`blockType` — those come back `undefined`, not `null`); fetch `get <id>` if you need the triage fields
261
+ - `status` — tri-state: `true` (success) / `false` (failure) / `null` (in-flight, no result yet)
262
+ - `statusDetail` — `'success' | 'error' | 'empty' | 'regression' | null` — the fine-grained outcome (`empty` = ran clean but returned 0 items; `regression` = item count dropped sharply vs. history)
263
+ - `proxyTier` / `failureKind` / `blockType` — owner-safe triage fields (not stripped like the admin-only proxy vendor/cost internals), present on `get`'s rows (and therefore on `history`, which reads the same endpoint); never on `list`'s rows. Servers released before mid-July 2026 leave them blank — `run-info <hid>` is always authoritative
264
+ - Full error detail (`errorSnapshot`: `errorMessage`, `selector`, `emptyContext`) is **not** embedded on either — fetch it via `trawl scraps run-info <hid>` or `trawl scraps doctor <id>`
265
+
266
+ `_tierOverride` is present only on `create`/`update` responses when a tier was requested (see Proxy tiers above) — absent otherwise.
267
+
268
+ `trawl scraps data <id> --json` returns the array passed to `returnData(...)` — see the honest data states above for what a non-array outcome means.
227
269
 
228
270
  ## Errors to recognize
229
271
 
@@ -232,6 +274,8 @@ Scrap object shape:
232
274
  - HTTP 403 → user doesn't own the scrap
233
275
  - HTTP 404 → wrong scrap ID
234
276
  - HTTP 422 on create/update → missing required field or invalid cron expression
277
+ - HTTP 402 → quota/billing limit hit; message may carry `— upgrade: <url>` when the server provides one (since CLI 1.18.0)
278
+ - HTTP 429 → rate-limited; message may carry `(retry after <N>s)` when the server sends a `Retry-After` header (since CLI 1.18.0)
235
279
 
236
280
  ### Exit codes
237
281
 
@@ -240,15 +284,15 @@ Every command uses these exit codes — check `$?` instead of parsing stderr tex
240
284
  | Code | Meaning |
241
285
  |---|---|
242
286
  | `0` | success |
243
- | `1` | API error (non-401/404) / unknown error — also **"Not logged in"** (no stored token at all) and commander parse errors (see below) |
244
- | `2` | usage error — invalid flag **value** / malformed input (bad ObjectId, invalid `--tier` value, malformed `-p` JSON, missing file, `--limit`+`--page` conflict) |
245
- | `3` | auth error (server **401** — token present but expired/invalid) |
246
- | `4` | not found (404 — wrong ID) |
287
+ | `1` | unmapped API error (HTTP status other than 401/404) or an unhandled bug — also `scraps data`'s "last run failed" state (kind `run_failed`) and a refused tier override (kind `unknown`) |
288
+ | `2` | usage error — invalid flag/value or malformed input (bad ObjectId, invalid `--tier` value, malformed `-p` JSON, missing file, `--limit`+`--page` conflict) **and, since CLI 1.18.2, commander parse errors** (unknown option/command, missing required arg — previously exit `1`) |
289
+ | `3` | auth error — server **401** (token expired/invalid) **or no stored token at all** (since CLI 1.18.2 — previously exit `1`, kind `unknown`) |
290
+ | `4` | not found — 404, or (for `scraps data`) never-ran / retention-aged-out |
247
291
  | `5` | network error (unreachable API, timeout) |
248
292
 
249
293
  Two edges to know:
250
- - **No stored token at all** exits `1` with "Not logged in. Run: trawl login" (not `3`). Exit `3` is specifically a server 401 for a token that *was* sent. `trawl token` with no/expired token also exits `1`.
251
- - **Unknown flags / missing required args** are caught by commander *before* the command runs, so they exit `1` (not `2`) — only bad flag *values* reach the usage-error path (`2`).
294
+ - **No stored token at all** now exits `3` with kind `auth` (`Not logged in. Run: trawl login`) — the same path a real 401 takes. Before CLI 1.18.2 this was a generic exit `1`, kind `unknown`, indistinguishable from an arbitrary bug. `trawl token` follows the same rule.
295
+ - **Unknown flags / missing required args** now exit `2` (usage), same bucket as bad flag *values* — before CLI 1.18.2 commander caught these before the command ran and they fell through to exit `1`.
252
296
 
253
297
  ### `--json` failure envelope
254
298
 
@@ -258,12 +302,13 @@ When a command fails **after argument parsing** with `--json` set, the error goe
258
302
  {"error":{"message":"Session expired or invalid. Run: trawl login","kind":"auth","status":401}}
259
303
  ```
260
304
 
261
- `kind` is one of `auth` / `not_found` / `api` / `network` / `usage` / `unknown`. `status` is only present for HTTP-backed errors.
305
+ `kind` is one of `auth` / `not_found` / `api` / `network` / `usage` / `unknown`, plus `run_failed` (`scraps data`-specific, not part of the shared classifier). `status` is only present for HTTP-backed errors.
262
306
 
263
- > Caveat: commander-level parse errors (unknown flag, missing required arg) bypass this envelope entirely — even with `--json` you get empty stdout, a plain-text error on stderr, and exit `1`.
307
+ Since CLI 1.18.2, commander-level parse errors (unknown flag, missing required arg) **also** emit the envelope — `{"error":{"message":"...","kind":"usage"}}` (no `status` field) — whenever `--json` appears anywhere on the command line (scanned from raw argv, since parsing fails before any command's own `--json` flag can be read). Exit code `2`. Before 1.18.2 these always bypassed the envelope: empty stdout, a plain-text error on stderr, exit `1`.
264
308
 
265
309
  ## What this skill does NOT do
266
310
 
267
311
  - Script body → `trawl-scrap-design`
268
312
  - Authentication / session injection → `trawl-scrap-account`
269
313
  - Local debugging runs → `trawl-scrap-local-test`
314
+ - Banner image generation + composition pipeline → `trawl-scrap-banner` (this skill only lists the raw `trawl scraps banner` upload command)
@@ -95,7 +95,7 @@ Linux / CI: replace with `google-chrome` or `chromium-browser` (same flags). On
95
95
 
96
96
  ### 5. Upload
97
97
 
98
- Requires an authenticated CLI session first — `trawl login` (or `TRAWL_TOKEN` env / `trawl login --token <jwt>`). Not logged in at all → exit `1` ("Not logged in"); an expired/invalid token → exit `3` (server 401).
98
+ Requires an authenticated CLI session first — `trawl login` (or `TRAWL_TOKEN` env / `trawl login --token <jwt>`). Not logged in at all → exit `3` (kind `auth`, since CLI 1.18.2 — was exit `1`); an expired/invalid token → also exit `3` (server 401).
99
99
 
100
100
  ```bash
101
101
  trawl scraps banner ${scrapId} -f /tmp/${siteName}-banner.png
@@ -105,7 +105,7 @@ trawl scraps banner ${scrapId} -f /tmp/${siteName}-banner.png
105
105
 
106
106
  CLI confirms upload. Banner is immediately visible on trawl.me.
107
107
 
108
- **Failure detection:** `banner` has **no `--json` mode** — the exit code is the only machine-readable signal. `0` = uploaded; non-zero = failed: `1` not logged in (no token) / other error, `3` expired-or-invalid token (401), `4` wrong `scrapId` (404), `5` network. Check `$?`, don't parse stdout for success/failure.
108
+ **Failure detection:** `banner` has **no `--json` mode** — the exit code is the only machine-readable signal. `0` = uploaded; non-zero = failed: `1` other/unmapped error, `2` malformed `scrapId` (not a 24-char hex ObjectId — usage error), `3` not logged in / expired-or-invalid token (401), `4` wrong `scrapId` (404), `5` network. Check `$?`, don't parse stdout for success/failure.
109
109
 
110
110
  ## Conventions
111
111
 
@@ -9,7 +9,7 @@ Use when writing the Puppeteer script body that runs on a Trawl worker.
9
9
 
10
10
  ## The worker boundary
11
11
 
12
- The worker handles fingerprinting, proxy escalation, AI Fix, and schema validation. Your script handles selectors, returnData shape, params, and graceful failure. See `references/anti-patterns.md`.
12
+ The worker handles fingerprinting, proxy escalation, AI Fix, and run-outcome classification (`statusDetail`: success/error/empty/regression). Your script handles selectors, returnData shape, params, and graceful failure. See `references/anti-patterns.md`.
13
13
 
14
14
  > **Don't add stealth in your script.** Trawl's worker handles fingerprinting, proxy rotation, and bot-detection countermeasures centrally. Adding stealth plugins, UA spoofing, viewport randomisation, or aggressive jitter in your script duplicates worker policy and causes drift. The worker's policy evolves; your script's hardcoded tricks won't.
15
15
 
@@ -122,7 +122,7 @@ try {
122
122
 
123
123
  The platform auto-escalates proxy tiers when a run comes back empty — you usually don't manage tiers at all. For a site you *know* is heavily protected, there are two CLI knobs (see the `trawl-cli` skill for full flag docs):
124
124
 
125
- - `trawl scraps update <id> --tier tier0..tier4` — requests a starting tier so the first run doesn't waste a cycle. **It's clamped to tier3 for domains that aren't allow-listed for tier4** — requesting `tier4` does not error, it just gets capped. On `update` the CLI echoes the clamp (`⚠ proxyTier requested tier4 → applied tier3`); on `create`/older servers it's silent.
125
+ - `trawl scraps update <id> --tier tier0..tier4` — requests a starting tier so the first run doesn't waste a cycle. **It's clamped to tier3 for domains that aren't allow-listed for tier4** — requesting `tier4` does not error, it just gets capped. Since CLI 1.18.2, both `create` and `update` echo the clamp (`⚠ proxyTier requested tier4 → applied tier3`); on an older server that doesn't confirm the change, the CLI warns instead of pretending the request was applied.
126
126
  - `trawl scraps update <id> --force-tier tier0..tier4` — raises the tier **ceiling** past that auto-cap. History-gated: the server may refuse it (CLI exits `1`) or it may cost more, depending on the scrap's run history.
127
127
 
128
128
  Don't assume the requested tier was honored — verify with `trawl scraps history <id>` / `trawl scraps run-info <hid>` after a run. Don't try to outsmart protection in your script — return what you can and let the platform escalate.
@@ -147,7 +147,7 @@ Some pages hide data behind real UI interactions — scroll, hover, click, form
147
147
 
148
148
  - *Trawl Scraping docs (in-app help center)* — selector basics, `returnData`, scrap lifecycle.
149
149
  - *Trawl Scraping Advanced docs* — proxy tiers, escalation triggers, rate-limit guidance.
150
- - *Trawl Data Quality docs* — `checkSchema` usage; note that `validation_failed` is a distinct history status from `error` and `0 items`.
150
+ - *Trawl Data Quality docs* — reading run outcomes: `history[].status` is tri-state (`true`/`false`/`null`); `history[].statusDetail` is the fine-grained enum `success` / `error` / `empty` / `regression` (`empty` = ran clean but `returnData([])`; `regression` = item count dropped sharply vs. prior runs). There is no `validation_failed` status — schema validation (`checkSchema`) was decommissioned.
151
151
  - *Trawl AI Features docs* — AI Fix quotas, how selector comments improve AI Fix accuracy.
152
152
  - *Trawl Schedule + Parameters docs* — `TRAWL.<custom>` params, `RANDOM(...)` and `DATE(...)` helpers.
153
153
 
@@ -28,13 +28,13 @@ Return a flat object per item. Nest only when source data is genuinely nested
28
28
 
29
29
  ## null vs omission
30
30
 
31
- Return `null` for absent optional fields. Never omit the key — schema validation distinguishes "null" from "key never sent", and omission breaks it silently.
31
+ Return `null` for absent optional fields. Never omit the key — downstream consumers (the frontend table, exports, any consumer script) expect every item to carry the same key set; omitting a key produces ragged objects that silently break column-based rendering.
32
32
 
33
33
  ```js
34
34
  // Good
35
35
  { title: 'Widget Pro', discount_pct: null, badge: null }
36
36
 
37
- // Bad — key omitted, breaks checkSchema expectations
37
+ // Bad — key omitted, produces a ragged object across the returned array
38
38
  { title: 'Widget Pro' }
39
39
  ```
40
40
 
@@ -84,8 +84,13 @@ returnData(allItems); // single call with all pages merged
84
84
 
85
85
  ---
86
86
 
87
- ## Compatibility with checkSchema
87
+ ## How returnData shape affects the run outcome
88
88
 
89
- - `validation_failed` is distinct from `error` (script threw) and `0 items` (empty array). Check all three when debugging data gaps.
90
- - Missing required keys → `validation_failed`, not `error` — no retry triggered.
91
- - See *Trawl Data Quality docs* for schema syntax and enforcement.
89
+ Each run gets one `history` row with `status` (tri-state `true`/`false`/`null`) and a finer `statusDetail` enum: `success` / `error` / `empty` / `regression`. There is no schema-validation status — the platform does not enforce a JSON Schema against your items, so a "wrong shape" (missing key, wrong type) never fails the run on its own. What actually flips `statusDetail`:
90
+
91
+ - **`success`** — `returnData(arr)` called with at least one item.
92
+ - **`empty`** — an explicit `returnData([])` — ran clean but returned zero items. Usually means a selector broke; see `references/anti-patterns.md`. Never calling `returnData` at all is NOT `empty`: the run persists as `success` with a `null` payload, which `trawl scraps data` later reports as a `not_found` error (it looks like the payload aged out of retention). Always call `returnData`, even with `[]`.
93
+ - **`error`** — the script threw. Throw only for structural failures (see the Resilience section in `SKILL.md`) — a per-field `try/catch` that degrades a field to `null` does NOT produce `error`, it stays `success` with that field `null`.
94
+ - **`regression`** — item count dropped sharply vs. recent history, computed server-side after a successful run.
95
+
96
+ Ragged objects (an omitted key on some items) don't get their own status — they just make the returned array inconsistent for whatever consumes it downstream. Keep every item's key set identical (`null` for absent values) so `success` runs are actually usable.
@@ -33,7 +33,7 @@ Log in manually in that Chrome window (complete MFA, solve CAPTCHA, etc.). Then
33
33
  node run-local.mjs scrap.js --remote
34
34
  ```
35
35
 
36
- The harness calls `puppeteer.connect({ browserURL: 'http://127.0.0.1:9222' })` and opens a new page. It does not close the browser when done.
36
+ The harness only calls `puppeteer.connect({ browserURL: 'http://127.0.0.1:9222' })` when `--remote` is passed (otherwise it launches a fresh browser). Only `browser` is injected as a global — not `page` — so the script body itself is responsible for calling `browser.newPage()`. Under `--remote` the harness calls `browser.disconnect()` when done instead of `browser.close()`, so the manually-launched Chrome instance stays open.
37
37
 
38
38
  ## Intermediate snapshots
39
39