@raytrace-cli/cli 0.19.5 → 0.19.6

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.
Files changed (2) hide show
  1. package/bin/raytrace.mjs +29 -19
  2. package/package.json +1 -1
package/bin/raytrace.mjs CHANGED
@@ -178,7 +178,7 @@ if (command === 'auth') {
178
178
  const auth = await import('../src/auth.mjs');
179
179
  const sub = rest[0];
180
180
  const action = { login: auth.loginCommand, status: auth.status, logout: auth.logout }[sub];
181
- if (!action) { console.error(`Usage: raytrace auth login | status | logout`); process.exit(2); }
181
+ if (!action || rest.length !== 1) { console.error(`Usage: raytrace auth login | status | logout`); process.exit(2); }
182
182
  try { await action(); process.exit(0); }
183
183
  catch (error) { console.error(`raytrace auth ${sub}: ${error.message}`); process.exit(1); }
184
184
  }
@@ -197,6 +197,7 @@ if (command === 'connect') {
197
197
  // `raytrace key [openrouter|typesafe] [--remove]`: the keys the dashboard's AI features use.
198
198
  if (command === 'key') {
199
199
  const args = rest.filter((arg) => arg !== '--remove');
200
+ if (rest.includes('--remove') && !args.length) { console.error('Usage: raytrace key <openrouter|typesafe> --remove'); process.exit(2); }
200
201
  if (args.length > 1 || args[0]?.startsWith('-')) { console.error('Usage: raytrace key [openrouter|typesafe] [--remove]'); process.exit(2); }
201
202
  const { keyCommand } = await import('../src/commands.mjs');
202
203
  try { await keyCommand(args[0], { remove: rest.includes('--remove') }); process.exit(0); }
@@ -295,6 +296,7 @@ if (command === 'export') {
295
296
  }
296
297
 
297
298
  if (command === 'share') {
299
+ const usage = 'Usage: raytrace share <trace-id> [--sandbox <id>] [--fork] | raytrace share --list | raytrace share --revoke <id>';
298
300
  let parsed;
299
301
  try {
300
302
  parsed = parseArgs({ args: rest, strict: true, allowPositionals: true, options: {
@@ -304,29 +306,30 @@ if (command === 'share') {
304
306
  fork: { type: 'boolean' },
305
307
  } });
306
308
  } catch (error) {
307
- console.error(`${error.message}\n\nUsage: raytrace share <trace-id> [--sandbox <id>] [--fork] | raytrace share --list | raytrace share --revoke <id>`);
309
+ console.error(`${error.message}\n\n${usage}`);
308
310
  process.exit(2);
309
311
  }
310
312
  const [sub, ...extra] = parsed.positionals;
313
+ const listing = parsed.values.list || sub === 'list';
314
+ const revoking = parsed.values.revoke !== undefined || sub === 'revoke';
315
+ const shareId = parsed.values.revoke ?? extra[0];
316
+ const creationFlags = parsed.values.sandbox !== undefined || parsed.values.fork !== undefined;
317
+ if ((listing && (revoking || creationFlags || parsed.positionals.length !== (sub === 'list' ? 1 : 0)))
318
+ || (revoking && (creationFlags || !shareId || (parsed.values.revoke !== undefined
319
+ ? parsed.positionals.length !== 0 : extra.length !== 1)))
320
+ || (!listing && !revoking && (!sub || extra.length))) {
321
+ console.error(usage); process.exit(2);
322
+ }
311
323
  const share = await import('../src/share.mjs');
312
324
  try {
313
- if (parsed.values.list || sub === 'list') {
325
+ if (listing) {
314
326
  await share.listShares();
315
327
  process.exit(0);
316
328
  }
317
- if (parsed.values.revoke || sub === 'revoke') {
318
- const shareId = parsed.values.revoke || extra[0];
319
- if (!shareId) {
320
- console.error('Usage: raytrace share --revoke <id> (or raytrace share revoke <id>)');
321
- process.exit(2);
322
- }
329
+ if (revoking) {
323
330
  await share.revokeShare(shareId);
324
331
  process.exit(0);
325
332
  }
326
- if (!sub || extra.length > 0) {
327
- console.error('Usage: raytrace share <trace-id> [--sandbox <id>] [--fork] | raytrace share --list | raytrace share --revoke <id>');
328
- process.exit(2);
329
- }
330
333
  await share.sharePrompt(sub, { sandboxId: parsed.values.sandbox, allowFork: parsed.values.fork });
331
334
  process.exit(0);
332
335
  } catch (error) {
@@ -356,16 +359,23 @@ if (command === 'report') {
356
359
  } catch (error) { console.error(`raytrace report: ${error.message}`); process.exit(1); }
357
360
  }
358
361
 
359
- let flags;
360
- try {
361
- ({ values: flags } = parseArgs({ args: rest, strict: true, options: {
362
+ const commandOptions = {
363
+ setup: {
362
364
  yes: { type: 'boolean', short: 'y' },
363
365
  'no-claude-code': { type: 'boolean' },
364
366
  'no-start': { type: 'boolean' },
365
367
  'openrouter-key': { type: 'string' },
366
- purge: { type: 'boolean' },
367
- } }));
368
- } catch (error) { console.error(`${error.message}\n\nRun \`raytrace help\` for usage.`); process.exit(2); }
368
+ },
369
+ uninstall: { purge: { type: 'boolean' }, yes: { type: 'boolean', short: 'y' } },
370
+ };
371
+ const commandUsage = {
372
+ setup: 'Usage: raytrace setup [--yes] [--no-claude-code] [--no-start] [--openrouter-key <key>]',
373
+ uninstall: 'Usage: raytrace uninstall [--purge] [--yes]',
374
+ };
375
+ let flags;
376
+ try {
377
+ ({ values: flags } = parseArgs({ args: rest, strict: true, options: commandOptions[command] ?? {} }));
378
+ } catch (error) { console.error(`${error.message}\n\n${commandUsage[command] ?? `Usage: raytrace ${command}`}`); process.exit(2); }
369
379
 
370
380
  const actions = {
371
381
  setup: () => commands.setup(flags),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raytrace-cli/cli",
3
- "version": "0.19.5",
3
+ "version": "0.19.6",
4
4
  "mcpName": "io.github.Godcreatebugs/raytrace",
5
5
  "description": "See what your coding agent did: traces, tool calls, cost and step-by-step evidence for Claude Code and Codex.",
6
6
  "license": "MIT",