@trawlme/skills 1.4.3 → 1.4.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/README.md
CHANGED
|
@@ -48,7 +48,9 @@ npm install -g @trawlme/cli
|
|
|
48
48
|
trawl skills install
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
The CLI bundles the skills and keeps them in sync with the CLI version.
|
|
51
|
+
The CLI bundles the skills and keeps them in sync with the CLI version — every `trawl` command re-syncs a skill whose installed version drifts from the CLI's.
|
|
52
|
+
|
|
53
|
+
Since `@trawlme/cli` 3.10, `trawl login` also installs any bundled skill you don't already have when run interactively — no separate `trawl skills install` needed. It prints exactly what it installed, plus the one thing you have to do yourself: **restart Claude Code**, since skills are only picked up at session start.
|
|
52
54
|
|
|
53
55
|
## Migrating from v0.1.x
|
|
54
56
|
|
|
@@ -66,6 +68,14 @@ Example prompts:
|
|
|
66
68
|
- "scrape a site behind login without giving Trawl my credentials" (`trawl-scrap-account`)
|
|
67
69
|
- "test my scrap locally before pushing" (`trawl-scrap-local-test`)
|
|
68
70
|
|
|
71
|
+
### Authenticated scraps: session capture
|
|
72
|
+
|
|
73
|
+
With `@trawlme/cli` 3.12 or later, `trawl-scrap-account` walks Claude through `trawl scraps account session capture <id>` for a site that needs a login — it opens a real, visible Chrome window at the scrap's target URL, you log in there exactly as you normally would (2FA included), and the CLI reads the resulting session over the Chrome DevTools Protocol (cookies and per-origin localStorage) and uploads it. No manual cookie export.
|
|
74
|
+
|
|
75
|
+
> You stay authenticated as yourself throughout — Trawl never sees your credentials, only the resulting session. Responsibility for lawful use of that session stays with you; this isn't legal advice.
|
|
76
|
+
|
|
77
|
+
This needs a local interactive terminal with a real display — it doesn't work headless, in CI, or over a plain SSH session. `session set -c <file>` (manual cookie upload) remains the fallback when capture can't run.
|
|
78
|
+
|
|
69
79
|
## Commands
|
|
70
80
|
|
|
71
81
|
```
|
package/package.json
CHANGED
|
@@ -48,7 +48,7 @@ CI-relevant env vars. The first three are per-invocation session overrides — t
|
|
|
48
48
|
|
|
49
49
|
All commands accept `--json` (where listed) for machine-readable or pipeable output.
|
|
50
50
|
|
|
51
|
-
Since CLI **v2.0.0** the agent-facing verbs are also top-level: `trawl list / get / run / data /
|
|
51
|
+
Since CLI **v2.0.0** the agent-facing verbs are also top-level: `trawl list / get / run / data / runs / run-info / trigger / whoami / ping / create` (`runs` is named `history` before CLI 3.14.0; `history` still works as an alias) (the `trawl scraps <verb>` paths below still work as aliases — zero breaking change, except `trawl fetch`, removed in 2.0.0, see the AI-wizard `create` below which replaced it).
|
|
52
52
|
|
|
53
53
|
### Create a scrap from a URL + a prompt (AI wizard — the flagship)
|
|
54
54
|
|
|
@@ -59,14 +59,14 @@ trawl create --url https://example.com/products --prompt "track product prices"
|
|
|
59
59
|
|
|
60
60
|
Optional flags: `--no-autofix` (skip the auto-fix retry on a failed first run), `--json` (raw API payload on stdout), `--url <url>` (**since 2.1.0**) — an alias of the positional `url` argument, for callers that prefer a named flag. Exactly one URL is required: pass the positional OR `--url`, never neither. Passing both is fine only when they're identical; two *different* URLs is a usage error (exit 2) rather than the CLI silently picking one.
|
|
61
61
|
|
|
62
|
-
One call: the server generates the extraction code (AI), creates a **persistent, self-healing scrap**, and triggers its first run (auto-fix on failure by default). Requires an api-key scoped `trawl:scraps:create` (or a session JWT). Response: `{ success, scrap, historyId }
|
|
62
|
+
One call: the server generates the extraction code (AI), creates a **persistent, self-healing scrap**, and triggers its first run (auto-fix on failure by default). Requires an api-key scoped `trawl:scraps:create` (or a session JWT). Response: `{ success, scrap, historyId }` — newer servers also send `runId`, the same value (prefer `runId`, fall back to `historyId`).
|
|
63
63
|
|
|
64
64
|
Critical semantics for agents:
|
|
65
65
|
- **Ask the user before running it** — `trawl create` sends the URL + prompt to Trawl, creates a persistent scrap, enables a DAILY schedule, and consumes quota (LLM generation + a real run). Obtain explicit user confirmation immediately before executing; never fire it speculatively.
|
|
66
66
|
- **NOT idempotent + not instant** — generation + first run legitimately takes 30-250s (the CLI already uses the 300s long-run timeout; a global `TRAWL_TIMEOUT` override clamps it). On a client-side timeout the scrap **may still have been created server-side**: run `trawl list` before retrying — a retry creates a DUPLICATE scrap and burns quota.
|
|
67
67
|
- **Daily schedule by default** — a wizard scrap is created with a daily cron (07:00 UTC); it re-runs and meters every day until you change it (`trawl scraps update <id> --cron <expr>` or `--no-cron`).
|
|
68
|
-
- **`success:false` (exit 1) ≠ retry** — the scrap EXISTS and auto-fix is retrying in the background: poll `trawl data <id>` / `trawl run-info <
|
|
69
|
-
- **On success, human mode proves the value (since 2.3.0)** — after a successful first run, `create` prints a small best-effort data sample (item count, field names, one truncated value) below the scrap summary, then `Next step: trawl data <id>` (with `trawl get <id>` noted as the secondary, metadata-only view). The sample is bonus output only: any fetch/parse failure is swallowed silently and never turns a successful create into an error. `--json` is unaffected — it always returns the raw `{ success, scrap, historyId }` payload with no sample appended.
|
|
68
|
+
- **`success:false` (exit 1) ≠ retry** — the scrap EXISTS and auto-fix is retrying in the background: poll `trawl data <id>` / `trawl run-info <runId>`, never re-run `create`.
|
|
69
|
+
- **On success, human mode proves the value (since 2.3.0)** — after a successful first run, `create` prints a small best-effort data sample (item count, field names, one truncated value) below the scrap summary, then `Next step: trawl data <id>` (with `trawl get <id>` noted as the secondary, metadata-only view). The sample is bonus output only: any fetch/parse failure is swallowed silently and never turns a successful create into an error. `--json` is unaffected — it always returns the raw `{ success, scrap, historyId }` payload (plus `runId` on newer servers) with no sample appended.
|
|
70
70
|
- Distinct from `trawl scraps create` below (raw Puppeteer script, no AI).
|
|
71
71
|
|
|
72
72
|
### List scraps
|
|
@@ -180,14 +180,14 @@ Control flow depends on the path: for a **synchronous** run (`run`, or `trigger
|
|
|
180
180
|
### Inspect past runs
|
|
181
181
|
|
|
182
182
|
```bash
|
|
183
|
-
trawl scraps
|
|
184
|
-
trawl scraps
|
|
185
|
-
trawl scraps
|
|
186
|
-
trawl scraps run-info <
|
|
187
|
-
trawl scraps run-info <
|
|
183
|
+
trawl scraps runs <id> # table of recent runs (status, time, tier, failureKind)
|
|
184
|
+
trawl scraps runs <id> --json # JSON array, newest first
|
|
185
|
+
trawl scraps runs <id> --limit 50 # cap rows (default 20)
|
|
186
|
+
trawl scraps run-info <runId> # one run's detail by its run id (status, tier, failureKind, error + selector)
|
|
187
|
+
trawl scraps run-info <runId> --json
|
|
188
188
|
```
|
|
189
189
|
|
|
190
|
-
`doctor`/`autofix` (below) inspect the **last** run; `
|
|
190
|
+
`runs` needs CLI ≥ 3.14.0 (on older installs, use `history`); `history` still works as an alias on every version. A run id and a history id are the same value — in the table and in `--json` rows the field is still named `hid`. `doctor`/`autofix` (below) inspect the **last** run; `runs` + `run-info` reach **any** run: list with `runs`, then pass a row'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 `runs`' embedded list never carries. (On servers released before mid-July 2026, `runs` also shows the tier/failureKind columns blank — `run-info` always has them.)
|
|
191
191
|
|
|
192
192
|
### Delete
|
|
193
193
|
|
|
@@ -212,7 +212,7 @@ TOKEN=$(trawl token)
|
|
|
212
212
|
|
|
213
213
|
# MCP endpoint — accepts the session JWT as a Bearer token. This is a real,
|
|
214
214
|
# runnable JSON-RPC 2.0 call (tools/list) against the Streamable HTTP
|
|
215
|
-
# transport — verified against
|
|
215
|
+
# transport — verified end-to-end against a live server:
|
|
216
216
|
curl --fail-with-body -X POST https://api.trawl.me/api/mcp \
|
|
217
217
|
-H "Authorization: Bearer $TOKEN" \
|
|
218
218
|
-H "Content-Type: application/json" \
|
|
@@ -258,7 +258,7 @@ Note: the CLI surfaces the abstract proxy Tier (0–4) + diagnostics + autofix,
|
|
|
258
258
|
|
|
259
259
|
**`failureKind: 'auth'` — the target site wants a login, not you.** `doctor`/`run-info`/`history` can show this on a run: the worker landed on a known login route and the run came back empty — the SITE is asking for a session, not blocking the request outright. Node ranks a worker-flagged block ABOVE this (precedence is block > auth > selector > nav > empty): `auth` only fires on an empty run that is NOT also block-flagged. Once it does fire, it skips auto-fix (a selector rewrite can never clear a login wall). Treat it as a distinct case from a blocked/wall run, not a subtype of one:
|
|
260
260
|
- **Send the user to the `trawl-scrap-account` skill**, not to a "no reliable bypass" explanation. The fix is that skill's `session capture` command, not a selector rewrite or a proxy-tier bump.
|
|
261
|
-
- A run can carry BOTH `failureKind: 'auth'` and a matched vendor wall
|
|
261
|
+
- A run can carry BOTH `failureKind: 'auth'` and a matched vendor wall when the vendor is one the server's block classifier doesn't yet recognize by name — e.g. `block.kind` naming Kasada. The server's block classifier and the CLI's own vendor list (`WALL_VENDOR_PATTERNS` in `doctor.ts`) are maintained separately: the CLI's list matches Kasada and reports a wall, but the server's classifier doesn't recognize it, so the block flag never gets set and `auth` still fires on the same run instead of `block` pre-empting it. For every vendor the server's classifier DOES match (Akamai, Cloudflare, DataDome, PerimeterX), `block` always wins first and the two never coexist. Don't collapse the Kasada case into one story — state both readings rather than choosing, the same way `doctor` hedges instead of asserting one.
|
|
262
262
|
|
|
263
263
|
**Don't confuse this with the CLI's own `kind: 'auth'`** (Errors to recognize / Exit codes below). The `--json` error envelope's `kind` field means **your Trawl session** is the problem — an expired or missing JWT, exit `3` — and the fix is `trawl login`. `failureKind: 'auth'` on a *run* means the **scraped site** wants credentials — the fix is `trawl scraps account session capture <id>` (see `trawl-scrap-account`). Same string, two unrelated axes (this CLI's own auth vs. the target site's auth) on two different objects (a thrown CLI error vs. a persisted run) — sending someone to `trawl login` for a `failureKind:'auth'` run fixes nothing.
|
|
264
264
|
|
|
@@ -315,7 +315,7 @@ Scrap object shape:
|
|
|
315
315
|
}
|
|
316
316
|
```
|
|
317
317
|
|
|
318
|
-
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:
|
|
318
|
+
There is **no `lastRun` field** — that never existed. Last-run status/timing/error all derive from `history[0]` (newest first). Newer servers also send the same array as `runs` — read `runs ?? history`. The embedded row shape differs by command:
|
|
319
319
|
- `trawl scraps get <id>` — up to 100 rows, each with `status`, `statusDetail`, `time`, `proxyTier`, `failureKind`, `blockType`, `createdAt`
|
|
320
320
|
- `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
|
|
321
321
|
- `status` — tri-state: `true` (success) / `false` (failure) / `null` (in-flight, no result yet)
|
|
@@ -35,7 +35,7 @@ export function buildContext(flags, readFile = (p) => readFileSync(resolve(p), '
|
|
|
35
35
|
account.session = { cookies: JSON.parse(readFile(cookiesPath)) };
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
// Parity with the worker
|
|
38
|
+
// Parity with the production worker: also expose creds under TRAWL.account.*.
|
|
39
39
|
// null when nothing was provided, mirroring buildTrawlAccount's null-when-empty contract.
|
|
40
40
|
const hasAccount = !!(account.username || account.password || account.session);
|
|
41
41
|
TRAWL.account = hasAccount ? account : null;
|