@profullstack/r4ck 0.1.0 → 0.2.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.
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [r4ck.dev](https://r4ck.dev) from the terminal, and for agents: search every VPS, cloud, bare metal, GPU and PaaS offer for sale, drill down by spec, price and place, and bridge the same tools into any MCP client.
4
4
 
5
5
  ```
6
- npm i -g @profullstack/r4ck
6
+ curl -fsSL https://r4ck.dev/install.sh | sh # or: npm i -g @profullstack/r4ck
7
7
  r4ck search "2 vcpu 4gb under $10 in eu"
8
8
  r4ck search --kind bare-metal --min-ram 64 --country US --sort price --json
9
9
  r4ck cheapest --min-vcpu 4 --min-ram 8 --has api,cli
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@profullstack/r4ck",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "r4ck.dev from the terminal and for agents: search every VPS, bare metal, GPU and PaaS offer for sale, drill down by spec, price and place, and bridge the same tools into any MCP client.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/index.js CHANGED
@@ -9,7 +9,7 @@ import { createInterface } from 'node:readline';
9
9
  * reply verbatim, otherwise a table a person can read. `r4ck mcp` bridges
10
10
  * stdio to the site's MCP endpoint so any client gets every tool.
11
11
  */
12
- export const VERSION = '0.1.0';
12
+ export const VERSION = '0.2.0';
13
13
  const DEFAULT_API = process.env.R4CK_API ?? 'https://r4ck.dev';
14
14
  const CONFIG_DIR = join(process.env.XDG_CONFIG_HOME ?? join(homedir(), '.config'), 'r4ck');
15
15
  const CONFIG_FILE = join(CONFIG_DIR, 'config.json');
@@ -54,6 +54,17 @@ export const COMMANDS = [
54
54
  usage: 'saved [list|add <name> [filters]|rm <id>]',
55
55
  help: 'Saved searches on the account.',
56
56
  },
57
+ {
58
+ name: 'redeem',
59
+ usage: 'redeem <CR-code>',
60
+ help: 'Redeem a credit code for days of the pass on your account.',
61
+ },
62
+ { name: 'pass', usage: 'pass', help: 'When the pass on your account runs out, and its token.' },
63
+ {
64
+ name: 'invites',
65
+ usage: 'invites [list|create [note]|revoke <id>]',
66
+ help: 'Your scarce invites (both sides get pass days) and your link.',
67
+ },
57
68
  {
58
69
  name: 'open',
59
70
  usage: 'open <id|sentence>',
@@ -441,6 +452,42 @@ export async function run(
441
452
  }
442
453
  throw new Error('usage: r4ck saved [list|add <name> [filters]|rm <id>]');
443
454
  }
455
+ case 'redeem': {
456
+ if (!rest[0]) throw new Error('usage: r4ck redeem <code>');
457
+ const r = await client.post('/api/v1/credits/redeem', { code: rest.join(' ') });
458
+ return flags.json
459
+ ? json(r)
460
+ : say(`Redeemed: ${r.days} days of pass. Unmetered until ${r.pass_until}.`);
461
+ }
462
+ case 'pass': {
463
+ const r = await client.get('/api/v1/pass');
464
+ if (flags.json) return json(r);
465
+ return say(
466
+ r.until
467
+ ? `pass until ${r.until}${r.token ? `\n${r.header}: ${r.token}` : ''}`
468
+ : `no pass on this account (buy one at ${client.base}/crawl or redeem a code)`,
469
+ );
470
+ }
471
+ case 'invites': {
472
+ const [sub = 'list', ...more] = rest;
473
+ if (sub === 'list') {
474
+ const r = await client.get('/api/v1/invites');
475
+ if (flags.json) return json(r);
476
+ say(`${r.quota.left} of ${r.quota.total} invites left; ${r.bonus_days} pass days each`);
477
+ if (!r.can_send) say(r.why_not);
478
+ for (const i of r.invites) say(`${i.id} ${i.status} ${i.note}`);
479
+ return say(`your link: ${r.affiliate.url}`);
480
+ }
481
+ if (sub === 'create') {
482
+ const r = await client.post('/api/v1/invites', { note: more.join(' ') });
483
+ return flags.json ? json(r) : say(r.invite.url);
484
+ }
485
+ if (sub === 'revoke') {
486
+ await client.post(`/api/v1/invites/${encodeURIComponent(more[0] ?? '')}/revoke`);
487
+ return say('withdrawn');
488
+ }
489
+ throw new Error('usage: r4ck invites [list|create [note]|revoke <id>]');
490
+ }
444
491
  case 'open': {
445
492
  if (/^\d+$/.test(rest[0] ?? '')) return say(`${client.base}/servers/${rest[0]}`);
446
493
  return say(`${client.base}/servers?${queryFrom(flags, rest.join(' ') || undefined)}`);