@trawlme/cli 1.9.0 → 1.10.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,7 @@ 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('-p, --params <json>', 'Runtime params as JSON array of objects (e.g. \'[{"TRAWL.paramName":"value"}]\')')
126
126
  .option('--params-file <path>', 'Runtime params from a JSON file')
127
127
  .action(async (id, opts) => {
128
128
  validateObjectId(id);
@@ -196,21 +196,26 @@ scraps
196
196
  // data
197
197
  scraps
198
198
  .command('data <id>')
199
- .description('Get scrap data (latest history)')
199
+ .description('Get scrap data (latest run payload)')
200
200
  .option('--json', 'Output as JSON')
201
201
  .action(async (id, opts) => {
202
202
  validateObjectId(id);
203
- const scrap = await api.get(`/api/scraps/${id}`);
204
- const lastHistory = scrap.history?.[0];
205
- if (!lastHistory) {
203
+ const loaded = await api.get(`/api/scraps/load/${id}`);
204
+ const items = loaded?.result?.data;
205
+ if (!Array.isArray(items)) {
206
206
  console.log(chalk.dim('No data yet. Run the scrap first.'));
207
207
  return;
208
208
  }
209
209
  if (opts.json)
210
- return json(lastHistory);
211
- const items = lastHistory.items;
210
+ return json(items);
212
211
  console.log(chalk.bold('Last run data:'));
213
- console.log(chalk.dim(` Items: ${Array.isArray(items) ? items.length : '—'}`));
212
+ console.log(chalk.dim(` Items: ${items.length}`));
213
+ if (loaded?.result?._proxyTier) {
214
+ console.log(chalk.dim(` Proxy tier: ${loaded.result._proxyTier}`));
215
+ }
216
+ if (items.length > 0 && typeof items[0] === 'object' && items[0] !== null) {
217
+ console.log(chalk.dim(` First item keys: ${Object.keys(items[0]).join(', ')}`));
218
+ }
214
219
  console.log(chalk.dim(' Use --json for full output.'));
215
220
  });
216
221
  // delete
package/dist/index.js CHANGED
@@ -1,15 +1,20 @@
1
1
  #!/usr/bin/env node
2
2
  import { Command } from 'commander';
3
3
  import chalk from 'chalk';
4
+ import { readFileSync } from 'node:fs';
5
+ import { fileURLToPath } from 'node:url';
6
+ import { dirname, join } from 'node:path';
4
7
  import { login, logout } from './commands/login.js';
5
8
  import { scraps } from './commands/scraps.js';
6
9
  import { skills } from './commands/skills.js';
7
10
  import { autoUpdateInstalledSkills } from './lib/skills.js';
8
11
  autoUpdateInstalledSkills();
12
+ const __dirname = dirname(fileURLToPath(import.meta.url));
13
+ const pkg = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf8'));
9
14
  const program = new Command()
10
15
  .name('trawl')
11
16
  .description('Trawl CLI — manage scraps from the terminal')
12
- .version('0.1.0')
17
+ .version(pkg.version)
13
18
  .option('--debug', 'Show full error stack traces');
14
19
  program.addCommand(login);
15
20
  program.addCommand(logout);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trawlme/cli",
3
- "version": "1.9.0",
3
+ "version": "1.10.0",
4
4
  "description": "Trawl CLI — manage scraps from the terminal",
5
5
  "type": "module",
6
6
  "bin": {