@phantomcodes/cli 1.3.4 → 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,7 +45,8 @@ 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,
@@ -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.4';
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.');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phantomcodes/cli",
3
- "version": "1.3.4",
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",
@@ -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