@trawlme/cli 1.9.1 → 1.11.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.
@@ -122,7 +122,9 @@ scraps
122
122
  .option('--no-cron', 'Disable cron (set to null)')
123
123
  .option('--alert <email>', 'Failure alert email (empty string to clear)')
124
124
  .option('--no-alert', 'Disable failure alert email (set to null)')
125
- .option('-p, --params <json>', 'Runtime params as JSON array of objects (e.g. \'[{"@slug":"..."}]\')')
125
+ .option('--autofix', 'Enable AI Fix (auto-recovery on selector breakage)')
126
+ .option('--no-autofix', 'Disable AI Fix')
127
+ .option('-p, --params <json>', 'Runtime params as JSON array of objects (e.g. \'[{"TRAWL.paramName":"value"}]\')')
126
128
  .option('--params-file <path>', 'Runtime params from a JSON file')
127
129
  .action(async (id, opts) => {
128
130
  validateObjectId(id);
@@ -143,6 +145,10 @@ scraps
143
145
  body.alert = null;
144
146
  else if (typeof opts.alert === 'string')
145
147
  body.alert = opts.alert === '' ? null : opts.alert;
148
+ if (opts.autofix === true)
149
+ body.autoFix = true;
150
+ else if (opts.autofix === false)
151
+ body.autoFix = false;
146
152
  if (opts.params !== undefined || opts.paramsFile !== undefined) {
147
153
  let raw;
148
154
  if (opts.paramsFile) {
@@ -196,21 +202,26 @@ scraps
196
202
  // data
197
203
  scraps
198
204
  .command('data <id>')
199
- .description('Get scrap data (latest history)')
205
+ .description('Get scrap data (latest run payload)')
200
206
  .option('--json', 'Output as JSON')
201
207
  .action(async (id, opts) => {
202
208
  validateObjectId(id);
203
- const scrap = await api.get(`/api/scraps/${id}`);
204
- const lastHistory = scrap.history?.[0];
205
- if (!lastHistory) {
209
+ const loaded = await api.get(`/api/scraps/load/${id}`);
210
+ const items = loaded?.result?.data;
211
+ if (!Array.isArray(items)) {
206
212
  console.log(chalk.dim('No data yet. Run the scrap first.'));
207
213
  return;
208
214
  }
209
215
  if (opts.json)
210
- return json(lastHistory);
211
- const items = lastHistory.items;
216
+ return json(items);
212
217
  console.log(chalk.bold('Last run data:'));
213
- console.log(chalk.dim(` Items: ${Array.isArray(items) ? items.length : '—'}`));
218
+ console.log(chalk.dim(` Items: ${items.length}`));
219
+ if (loaded?.result?._proxyTier) {
220
+ console.log(chalk.dim(` Proxy tier: ${loaded.result._proxyTier}`));
221
+ }
222
+ if (items.length > 0 && typeof items[0] === 'object' && items[0] !== null) {
223
+ console.log(chalk.dim(` First item keys: ${Object.keys(items[0]).join(', ')}`));
224
+ }
214
225
  console.log(chalk.dim(' Use --json for full output.'));
215
226
  });
216
227
  // delete
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trawlme/cli",
3
- "version": "1.9.1",
3
+ "version": "1.11.0",
4
4
  "description": "Trawl CLI — manage scraps from the terminal",
5
5
  "type": "module",
6
6
  "bin": {