@trawlme/cli 1.18.1 → 1.18.3
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 +42 -18
- package/dist/commands/doctor.js +8 -4
- package/dist/commands/scraps.js +271 -75
- package/dist/commands/skills.js +16 -4
- package/dist/commands/token.js +15 -6
- package/dist/index.d.ts +65 -4
- package/dist/index.js +177 -33
- package/dist/lib/api.d.ts +26 -0
- package/dist/lib/api.js +35 -4
- package/dist/lib/errors.js +9 -1
- package/dist/lib/skills.d.ts +34 -4
- package/dist/lib/skills.js +80 -5
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -10,6 +10,8 @@ Command-line client for [Trawl](https://trawl.me) — manage your scraps from th
|
|
|
10
10
|
|
|
11
11
|
## Install
|
|
12
12
|
|
|
13
|
+
Requires Node.js >= 20.
|
|
14
|
+
|
|
13
15
|
```bash
|
|
14
16
|
npm install -g @trawlme/cli
|
|
15
17
|
```
|
|
@@ -41,8 +43,8 @@ trawl token Print the stored session JWT (for M
|
|
|
41
43
|
```
|
|
42
44
|
trawl scraps list [--json] [--status <success|failure|never>] [--limit <n>] [--page <n>]
|
|
43
45
|
trawl scraps get <id> [--json]
|
|
44
|
-
trawl scraps create -t <title> [-u <url>] [-r <request>] [-d <description>] [--tier <tier0|tier1|tier2|tier3|tier4>]
|
|
45
|
-
trawl scraps update <id> [-t <title>] [-u <url>] [-r <request>] [-d <description>] [--cron <expr>|--no-cron] [--alert <email>|--no-alert] [--autofix|--no-autofix] [-p <json>|--params-file <path>] [--tier <tier0|tier1|tier2|tier3|tier4>] [--force-tier <tier0|tier1|tier2|tier3|tier4>]
|
|
46
|
+
trawl scraps create -t <title> [-u <url>] [-r <request>] [-d <description>] [--tier <tier0|tier1|tier2|tier3|tier4>] [--json]
|
|
47
|
+
trawl scraps update <id> [-t <title>] [-u <url>] [-r <request>] [-d <description>] [--cron <expr>|--no-cron] [--alert <email>|--no-alert] [--autofix|--no-autofix] [-p <json>|--params-file <path>] [--tier <tier0|tier1|tier2|tier3|tier4>] [--force-tier <tier0|tier1|tier2|tier3|tier4>] [--json]
|
|
46
48
|
trawl scraps run <id> [--watch]
|
|
47
49
|
trawl scraps trigger <id> [--watch] [--wait]
|
|
48
50
|
trawl scraps watch <id>
|
|
@@ -53,15 +55,16 @@ trawl scraps doctor <id> [--json] [--autofix]
|
|
|
53
55
|
trawl scraps autofix <id> [--json]
|
|
54
56
|
trawl scraps snapshot <id> [--error] [-o <file>]
|
|
55
57
|
trawl scraps banner <id> -f <file>
|
|
56
|
-
trawl scraps
|
|
58
|
+
trawl scraps delete <id> [--force] Alias: rm
|
|
57
59
|
```
|
|
58
60
|
|
|
59
|
-
- `--tier` forces a proxy tier; `--force-tier` raises the proxy-tier ceiling past the auto-cap (history-gated: may be refused or cost more).
|
|
60
|
-
- `scraps doctor` diagnoses the last run (error, failed selector, block status, page state, autofix outcome); `--autofix` includes the full autofix diff/dry-run/knowledge.
|
|
61
|
-
- `scraps autofix` shows the last auto-fix attempt on its own (decision, diff, dry-run, knowledge).
|
|
61
|
+
- `--tier` forces a proxy tier; `--force-tier` raises the proxy-tier ceiling past the auto-cap (history-gated: may be refused or cost more). `create --json`/`update --json` print the full scrap object (including the `_tierOverride` outcome) on stdout; a refused tier override exits 1 with a standard `--json` error envelope. When a tier was requested but the server's response carries no `_tierOverride` at all (an older server that can't confirm what actually got applied), a stderr warning is printed either way, and under `--json` the emitted object also carries `"_tierUnconfirmed": true` — the machine-readable counterpart to that warning, since a `--json` caller has no reliable reason to read stderr.
|
|
62
|
+
- `scraps doctor` diagnoses the last run (error, failed selector, block status, page state, autofix outcome); `--autofix` includes the full autofix diff/dry-run/knowledge. A run that is still in flight (`status: null`, server-side) shows a `running` badge, never `failed`.
|
|
63
|
+
- `scraps autofix` shows the last auto-fix attempt on its own (decision, diff, dry-run, knowledge). `--json` on a scrap that has **never run** returns `{"status":"no_runs"}` (exit 0) — distinct from `null`, which means a run exists but had no auto-fix attempt.
|
|
62
64
|
- `scraps snapshot --error` fetches the error-path snapshot instead of the normal one; `-o <file>` writes to a file instead of stdout.
|
|
63
65
|
- `scraps history` lists past runs (newest first); `scraps run-info <hid>` shows details of a single run from that history.
|
|
64
|
-
- `scraps data` returns the last persisted run payload (no execute quota); `--fresh` runs the scrap live instead (consumes execute quota); `--errors` shows the last run's error detail.
|
|
66
|
+
- `scraps data` returns the last persisted run payload (no execute quota); `--fresh` runs the scrap live instead (consumes execute quota); `--errors` shows the last run's error detail (`--json` on a never-run scrap returns `{"status":"no_runs"}`, exit 0, matching `doctor --json`). `[]` on stdout means a genuine zero-item successful run — a scrap that has never run, whose last run failed, or whose payload aged out of retention returns a `--json` error envelope (exit 4/1/4 respectively) instead. Two more honest states: a run still **in flight** (`status: null` server-side) returns a `kind:"in_progress"` error envelope (exit 1, "retry shortly" — never suggests `--fresh`, which would just 429 against the run already holding the lock); a run whose item count **regressed** vs baseline (`statusDetail: "regression"`) still returns the real, non-empty items on stdout (exit 0) plus a stderr warning pointing at `scraps doctor <id>` — the data itself is genuine even though the run is flagged.
|
|
67
|
+
- `scraps get` (and anything reading through it, like `scraps data`'s default path) embeds only the newest 100 history rows on the returned scrap object — `scraps run-info` and `scraps doctor` fetch a single run directly and are unaffected by that cap.
|
|
65
68
|
|
|
66
69
|
### Scrap accounts
|
|
67
70
|
|
|
@@ -80,13 +83,15 @@ trawl scraps account session set <id> -c <file>
|
|
|
80
83
|
The CLI bundles a Claude Code skill that teaches Claude how to use `trawl`. Once installed, Claude can manage scraps for you via prompts.
|
|
81
84
|
|
|
82
85
|
```
|
|
83
|
-
trawl skills list
|
|
84
|
-
trawl skills install [<skill>] [--local]
|
|
85
|
-
trawl skills uninstall [<skill>] [--local]
|
|
86
|
-
trawl skills update [<skill>] [--local]
|
|
86
|
+
trawl skills list List bundled skills and install status
|
|
87
|
+
trawl skills install [<skill>] [--local] [--force] Install all (or one). Default: ~/.claude/skills/
|
|
88
|
+
trawl skills uninstall [<skill>] [--local] Remove
|
|
89
|
+
trawl skills update [<skill>] [--local] [--force] Reinstall (force sync with CLI version)
|
|
87
90
|
```
|
|
88
91
|
|
|
89
|
-
Skills auto-update
|
|
92
|
+
Skills auto-update when you upgrade the CLI — no need to re-install manually — but it is not silent: it prints an honest `trawl: re-synced skill "<name>" (<scope>) <old> → <new>` line to stderr whenever it rewrites a skill dir, so a rewrite is never invisible. If a bundled skill is renamed or dropped between CLI versions, the old install is swept too — a `trawl: removed orphaned skill "<name>" (<scope>) — no longer bundled with this CLI version` line to stderr, so a stale skill teaching outdated CLI usage never lingers silently. Only marker-owned dirs (installed by trawl itself) are ever touched by either line. Opt out with `TRAWL_SKILLS_SYNC=0`.
|
|
93
|
+
|
|
94
|
+
A pre-existing skill directory that trawl did not install itself (no `.version` marker) is never touched — `install`/`update` refuse to overwrite it and require `--force` to proceed. This applies to the CLI-upgrade auto-sync too (it silently skips marker-less dirs rather than refusing, since there is no interactive user to show a refusal to).
|
|
90
95
|
|
|
91
96
|
You can also install skills standalone (without the CLI): `npx @trawlme/skills install`.
|
|
92
97
|
|
|
@@ -108,7 +113,7 @@ trawl telemetry status Show current state, telemetry ID, and opt-out instructi
|
|
|
108
113
|
- Node.js version
|
|
109
114
|
- Platform (e.g. `darwin`, `linux`, `win32`)
|
|
110
115
|
- Command duration (`duration_ms`)
|
|
111
|
-
- Exit code
|
|
116
|
+
- Exit code — the full 0–5 range below, not just success/failure (see [Exit codes](#exit-codes))
|
|
112
117
|
- Error name if the command failed (e.g. `ApiError`) — never the error message or stack
|
|
113
118
|
- An opaque, randomly-generated telemetry ID (`cli_<uuid>`) stored locally in your config file
|
|
114
119
|
|
|
@@ -131,13 +136,32 @@ TRAWL_TELEMETRY=0 trawl scraps list
|
|
|
131
136
|
|
|
132
137
|
**Why:** usage data helps us prioritise CLI features and catch silent errors before users report them.
|
|
133
138
|
|
|
139
|
+
## Exit codes
|
|
140
|
+
|
|
141
|
+
Every command exits with one of these codes — scripts and agents driving the CLI unattended can branch on the exact failure kind instead of a uniform pass/fail:
|
|
142
|
+
|
|
143
|
+
| Code | Meaning |
|
|
144
|
+
|------|--------------------------------------------------------------------------|
|
|
145
|
+
| `0` | Success |
|
|
146
|
+
| `1` | Unknown/generic error (an unmapped failure — API errors other than 401/404, an unhandled bug — or a business-logic refusal like `scraps data`'s `run_failed`/`in_progress` states) |
|
|
147
|
+
| `2` | Usage error (bad flag/value, invalid ID, missing required argument, unknown option/command) |
|
|
148
|
+
| `3` | Auth error (not logged in, or the session token is expired/invalid — run `trawl login`) |
|
|
149
|
+
| `4` | Not found (no such resource, or — for `scraps data` — no persisted payload to read) |
|
|
150
|
+
| `5` | Network error (the API host is unreachable, DNS/connection/TLS failure, or the request timed out) |
|
|
151
|
+
|
|
152
|
+
Under `--json`, a failing command emits a single error envelope on stdout — `{"error":{"message","status?","kind"}}` — instead of prose; the human-readable line always goes to stderr, never stdout.
|
|
153
|
+
|
|
134
154
|
## Environment variables
|
|
135
155
|
|
|
136
|
-
| Variable
|
|
137
|
-
|
|
138
|
-
| `TRAWL_TOKEN`
|
|
139
|
-
| `TRAWL_API_URL`
|
|
140
|
-
| `TRAWL_TELEMETRY`
|
|
156
|
+
| Variable | Description |
|
|
157
|
+
|-----------------------|--------------------------------------------------------------------|
|
|
158
|
+
| `TRAWL_TOKEN` | JWT token — bypasses login prompt, useful for CI/CD |
|
|
159
|
+
| `TRAWL_API_URL` | Override the API base URL for the session (takes precedence over `trawl login --url`) |
|
|
160
|
+
| `TRAWL_TELEMETRY` | Set to `0` to disable telemetry for the current session |
|
|
161
|
+
| `DO_NOT_TRACK` | Set to `1` to disable telemetry (cross-vendor convention, https://consoledonottrack.com) — same effect as `TRAWL_TELEMETRY=0` |
|
|
162
|
+
| `TRAWL_CONFIG_DIR` | Override where the config file (token, API URL, telemetry state) is stored — useful for hermetic CI runs or concurrent `trawl login`s that must not share one on-disk file |
|
|
163
|
+
| `TRAWL_TIMEOUT` | Override the per-request fetch timeout in milliseconds (default `30000`) |
|
|
164
|
+
| `TRAWL_SKILLS_SYNC` | Set to `0` to disable the startup skills auto-sync entirely |
|
|
141
165
|
|
|
142
166
|
Session override (no `trawl login` mutation, ideal for CI/QA against another env):
|
|
143
167
|
|
package/dist/commands/doctor.js
CHANGED
|
@@ -83,13 +83,17 @@ export function pickFix(fix) {
|
|
|
83
83
|
*/
|
|
84
84
|
export function formatDoctor(scrapTitle, run, fix = null, scrapId) {
|
|
85
85
|
const lines = [];
|
|
86
|
-
// Header + status badge
|
|
86
|
+
// Header + status badge. status:null means a run is IN FLIGHT (node
|
|
87
|
+
// persists {status:null, statusDetail:null, inFlight:true} the moment a
|
|
88
|
+
// run starts) — that must never render as "failed". (#88 item 1)
|
|
87
89
|
const ok = run.status === true;
|
|
88
90
|
const badge = ok
|
|
89
91
|
? chalk.green('● success')
|
|
90
|
-
: run.
|
|
91
|
-
? chalk.
|
|
92
|
-
:
|
|
92
|
+
: run.status === null
|
|
93
|
+
? chalk.cyan('● running')
|
|
94
|
+
: run.statusDetail === 'empty'
|
|
95
|
+
? chalk.yellow('● empty')
|
|
96
|
+
: chalk.red('● failed');
|
|
93
97
|
lines.push(`${chalk.bold(scrapTitle)} ${badge}${run.statusDetail ? ` (${run.statusDetail})` : ''}`);
|
|
94
98
|
lines.push(chalk.dim(` Run ID: ${run._id}`));
|
|
95
99
|
// Error message — an honest accept-wall string for known-walled scraps
|