instavm 0.13.0 → 0.16.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
@@ -1,8 +1,8 @@
1
- # InstaVM JavaScript SDK
1
+ # InstaVM JavaScript SDK + CLI
2
2
 
3
3
  ![Build Status](https://github.com/instavm/js/actions/workflows/ci.yml/badge.svg)
4
4
 
5
- Official JavaScript/TypeScript client for [InstaVM](https://instavm.io) secure code execution in ephemeral microVMs with browser automation, networking controls, and platform APIs.
5
+ Official JavaScript/TypeScript SDK and installed CLI for [InstaVM](https://instavm.io). Use it to manage VMs, snapshots, shares, volumes, desktops, account settings, and code execution from Node.js or your shell.
6
6
 
7
7
  ## Installation
8
8
 
@@ -12,24 +12,126 @@ npm install instavm
12
12
 
13
13
  **Requirements:** Node.js 18+, TypeScript 4.7+ (optional)
14
14
 
15
- ## Quick Start
15
+ ## CLI
16
+
17
+ The published package includes an `instavm` binary.
18
+
19
+ ```bash
20
+ npx instavm --help
21
+ pnpm exec instavm --help
22
+ yarn exec instavm --help
23
+ bunx instavm --help
24
+ ```
25
+
26
+ If you want `instavm` directly on your PATH, install it globally:
27
+
28
+ ```bash
29
+ npm install -g instavm
30
+ instavm --help
31
+ ```
32
+
33
+ The CLI stores defaults in `~/.instavm/config.json`, checks `INSTAVM_API_KEY` when no key is stored, and also respects `INSTAVM_BASE_URL` and `INSTAVM_SSH_HOST`.
34
+
35
+ ### Auth & Config
36
+
37
+ ```bash
38
+ instavm auth set-key
39
+ instavm auth status
40
+ printf '%s' "$INSTAVM_API_KEY" | instavm auth set-key
41
+ ```
42
+
43
+ ### Common Commands
44
+
45
+ ```bash
46
+ instavm whoami
47
+ instavm ls
48
+ instavm ls -a
49
+ instavm create --type computer-use --memory 4096
50
+ instavm connect vm_123
51
+ instavm deploy
52
+ instavm deploy --plan
53
+ instavm snapshot ls
54
+ instavm volume ls
55
+ instavm volume files upload <volume_id> ./README.md --path docs/README.md
56
+ instavm share create vm_123 3000 --public
57
+ instavm share set-private <share_id>
58
+ instavm ssh-key list
59
+ instavm desktop viewer <session_id>
60
+ instavm doc
61
+ instavm billing
62
+ ```
63
+
64
+ `instavm ls` shows active VMs only. Use `-a` or `--all` to include terminated VM records.
65
+
66
+ ### Cookbooks
67
+
68
+ `instavm cookbook` pulls curated starter apps from the public [`instavm/cookbooks`](https://github.com/instavm/cookbooks) catalog, creates a VM, starts the service, creates the share, and returns the public URL.
69
+
70
+ ```bash
71
+ instavm cookbook list
72
+ instavm cookbook info neon-city-webgl
73
+ instavm cookbook deploy neon-city-webgl
74
+ instavm cookbook deploy hello-fastapi
75
+ ```
76
+
77
+ The CLI syncs the cookbook repo into `~/.instavm/cookbooks/`, checks for `git`, `ssh`, `scp`, and `tar`, prompts for any required secrets, and auto-registers a local public SSH key if your account does not already have one.
78
+
79
+ ### Deploy
80
+
81
+ `instavm deploy` tries to deploy the app in the current directory without asking you to create an `instavm.yaml` first. It detects a simple Node.js or Python web app, creates a VM, uploads the project, starts the service, and gives you a share URL.
82
+
83
+ ```bash
84
+ instavm deploy
85
+ instavm deploy --plan
86
+ instavm deploy ./path/to/app
87
+ ```
88
+
89
+ `--plan` shows the detected runtime, install command, start command, port, and secrets without creating a VM.
90
+
91
+ `instavm deploy` is experimental right now. The zero-config path is working best for straightforward Node.js and Python apps. Some runtimes and projects still need follow-up fixes or backend support.
92
+
93
+ ### Command Reference
94
+
95
+ - `auth`: `set-key`, `status`, `logout`
96
+ - `whoami`: show account details and SSH keys
97
+ - `ls`/`list`: show active VMs by default; use `-a` or `--all` for all VM records
98
+ - `cookbook`: `list`, `info`, `deploy` for curated starter apps from `instavm/cookbooks`
99
+ - `deploy`: experimental zero-config deploy for the current app directory
100
+ - `create`/`new`, `rm`/`delete`, `clone`, `connect`: core VM workflows
101
+ - `snapshot`: `ls`, `create`, `build`, `get`, `rm`
102
+ - `desktop`: `status`, `start`, `stop`, `viewer`
103
+ - `volume`: `ls`, `get`, `create`, `update`, `rm`, `checkpoint`, `files`
104
+ - `share`: `create`, `set-public`, `set-private`, `revoke`
105
+ - `ssh-key`: `list`, `add`, `remove`
106
+ - `doc`/`docs`, `billing`: docs and billing links
107
+
108
+ All leaf commands support `--json`. Share visibility updates use `share_id`, which matches the public API.
109
+
110
+ ## Library Quick Start
16
111
 
17
112
  ```typescript
18
113
  import { InstaVM } from 'instavm';
19
114
 
20
115
  const client = new InstaVM(process.env.INSTAVM_API_KEY || 'your_api_key');
21
116
 
22
- try {
23
- const result = await client.execute("print('hello from instavm')");
24
- console.log(result.stdout);
25
- } finally {
26
- await client.dispose();
27
- }
117
+ const [me, vms] = await Promise.all([
118
+ client.getCurrentUser(),
119
+ client.vms.list(),
120
+ ]);
121
+
122
+ console.log(me.email);
123
+ console.log(vms.length);
28
124
  ```
29
125
 
30
126
  ## Table of Contents
31
127
 
32
- - [Quick Start](#quick-start)
128
+ - [CLI](#cli)
129
+ - [Auth & Config](#auth--config)
130
+ - [Common Commands](#common-commands)
131
+ - [Cookbooks](#cookbooks)
132
+ - [Deploy](#deploy)
133
+ - [Command Reference](#command-reference)
134
+ - [Library Quick Start](#library-quick-start)
33
135
  - [Code Execution](#code-execution)
34
136
  - [Cloud Mode](#cloud-mode)
35
137
  - [Local Mode](#local-mode)
@@ -424,7 +526,23 @@ npm run build # Build package
424
526
 
425
527
  ## Changelog
426
528
 
427
- Current package version: **0.13.0**
529
+ Current package version: **0.16.0**
530
+
531
+ ### 0.16.0
532
+
533
+ - Expanded CLI docs for `instavm cookbook`
534
+ - Added experimental `instavm deploy` for zero-config app deploys from the current directory
535
+
536
+ ### 0.15.1
537
+
538
+ - `ls` now matches the SSH gateway: active VMs by default, `-a` or `--all` for all VM records
539
+ - `whoami` now uses the live `/v1/users/me` endpoint
540
+
541
+ ### 0.15.0
542
+
543
+ - Installed `instavm` CLI for `npm`, `pnpm`, `yarn`, `bun`, and global package installs
544
+ - Stored CLI auth/config in `~/.instavm/config.json` with `INSTAVM_API_KEY` fallback
545
+ - Added [`getCurrentUser()`](#library-quick-start) and `getSessionStatus(sessionId?)` helpers for identity and desktop workflows
428
546
 
429
547
  ### 0.13.0
430
548