@phantomcodes/cli 1.3.3 → 1.4.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.
@@ -45,12 +45,13 @@ export const COMMANDS = [
45
45
  workspace payment --id <payment-id> check verified funding status
46
46
  workspace export --file <path> export private guest recovery; refuses overwrites
47
47
  workspace import --file <path> restore a guest, then issue replacement keys
48
- workspace revoke-access --id <id> revoke a browser, device or recovery credential`,
48
+ workspace revoke-access --id <id> revoke a browser, device or recovery credential
49
+ workspace delete [--yes] delete an empty workspace and forget it here (--yes: don't ask)`,
49
50
  },
50
51
  {
51
52
  name: 'fund', handler: fundDispatch, keyless: true,
52
53
  group: 'Money', summary: 'add credit by card or crypto',
53
- help: ` fund --amount <USD> [--card | --coin usdc|usdt|sol|usdc-base] [--no-browser]
54
+ help: ` fund --amount <USD> [--card | --coin usdc|usdc-base] [--no-browser]
54
55
  fund your workspace balance with card (plus Stripe's fee) or crypto`,
55
56
  },
56
57
  {
@@ -1,2 +1,2 @@
1
1
  /** This release of phantom. `npm version` keeps it equal to the version in package.json. */
2
- export const VERSION = '1.3.3';
2
+ export const VERSION = '1.4.0';
@@ -399,6 +399,31 @@ export async function workspaceCommand(input) {
399
399
  : JSON.stringify(result) + '\n');
400
400
  return 0;
401
401
  }
402
+ if (command === 'delete') {
403
+ // Deleting takes the keys and saved sign-ins with it, so at a terminal it asks first and says what goes.
404
+ const pick = flags['yes'] ? null : pickIo(input);
405
+ if (pick) {
406
+ const go = await choose({ ...pick, esc: 'back' }, 'Delete this workspace?', [
407
+ {
408
+ label: 'Delete workspace',
409
+ hint: 'takes its keys and saved sign-ins with it; credit must be spent first and it cannot be undone',
410
+ value: true,
411
+ },
412
+ { label: 'Cancel', hint: 'keep it', value: false },
413
+ ], 1);
414
+ if (!go) {
415
+ io.stderr(' Nothing was changed.\n');
416
+ return 0;
417
+ }
418
+ }
419
+ const result = await wire(saved.base_url, 'DELETE', endpoint, undefined, saved.management_credential);
420
+ // The workspace is gone, so the credential saved here points at nothing.
421
+ removeSecret(credentialPath(env));
422
+ io.stdout(showsScreen(input)
423
+ ? `\n ${paint(env, colorOn(env, io.stdoutIsTTY)).lime('✓')} Workspace deleted. Its keys and saved sign-ins are gone.\n`
424
+ : JSON.stringify(result) + '\n');
425
+ return 0;
426
+ }
402
427
  if (command === 'revoke-access') {
403
428
  if (typeof flags.id !== 'string')
404
429
  die('Use --id <management-id> from phantom workspace status.');
@@ -417,7 +442,7 @@ export async function workspaceCommand(input) {
417
442
  if (flags.pay)
418
443
  die('--pay has been removed. Use --card or --coin.');
419
444
  if (flags.coin === true)
420
- die(`--coin needs usdc, usdt, sol or usdc-base. ${FUND_EXAMPLE}`);
445
+ die(`--coin needs usdc or usdc-base. ${FUND_EXAMPLE}`);
421
446
  let amount = dollarsFlag(flags);
422
447
  let method = flags.card ? 'card' : flags.coin;
423
448
  // At a terminal, whatever is missing is asked for: first how much, then how to pay.
@@ -436,9 +461,7 @@ export async function workspaceCommand(input) {
436
461
  hint: "on Stripe's page, plus Stripe's card fee",
437
462
  value: 'card',
438
463
  },
439
- { label: 'USDC', hint: 'from a Solana wallet', value: 'usdc' },
440
- { label: 'USDT', hint: 'from a Solana wallet', value: 'usdt' },
441
- { label: 'SOL', hint: 'from a Solana wallet', value: 'sol' },
464
+ { label: 'USDC', hint: 'from a Solana wallet, to Stripe', value: 'usdc' },
442
465
  ])) ?? undefined;
443
466
  if (!method)
444
467
  return leaveFund(input);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phantomcodes/cli",
3
- "version": "1.3.3",
3
+ "version": "1.4.0",
4
4
  "description": "AI inference for your coding agents. Route models, control spending, and fund your workspace.",
5
5
  "keywords": [
6
6
  "phantom",
@@ -70,7 +70,7 @@ phantom fund --amount 10 --coin usdc
70
70
  phantom workspace payment --id <payment-id>
71
71
  ```
72
72
 
73
- Card checkout opens the payment URL in your browser. Crypto funding (`--coin usdc|usdt|sol`)
73
+ Card checkout opens the payment URL in your browser. Crypto funding (`--coin usdc` on Solana, `--coin usdc-base` on Base)
74
74
  provides a Solana pay URL. Credit is available once confirmed. Check pending payments with
75
75
  `phantom workspace payment --id <id>`. Check balance anytime with `phantom balance`.
76
76
 
@@ -157,6 +157,9 @@ still spends credit.
157
157
  Use `phantom --help --all` for receipts, MCP and direct-key purchases.
158
158
  Export guest recovery with `phantom workspace export --file
159
159
  <path>` only to a private destination. Recovery grants workspace management access.
160
+ Delete an empty workspace with `phantom workspace delete`: it takes the workspace's keys
161
+ and saved sign-ins with it, asks first (`--yes` skips the question), and refuses while the
162
+ workspace holds credit, a running request, a live plan or a payment in progress.
160
163
 
161
164
  ## Rules
162
165