@paperpod/cli 0.1.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 ADDED
@@ -0,0 +1,245 @@
1
+ # @paperpod/cli
2
+
3
+ PaperPod CLI - Agent-native sandbox execution from your terminal.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install -g @paperpod/cli
9
+ ```
10
+
11
+ ## Updating
12
+
13
+ ```bash
14
+ npm update -g @paperpod/cli
15
+ ```
16
+
17
+ ## Quick Start
18
+
19
+ ```bash
20
+ # Get a token (one-time)
21
+ curl -X POST https://paperpod.dev/login -d '{"email":"you@email.com"}'
22
+ # Click link in email → copy token
23
+
24
+ # Login (saves token)
25
+ ppod login pp_sess_...
26
+
27
+ # Discover all commands
28
+ ppod help
29
+
30
+ # Get help for specific command
31
+ ppod exec --help
32
+ ppod browser:screenshot --help
33
+
34
+ # Execute commands
35
+ ppod exec "ls -la"
36
+ ppod exec "python -c 'print(2+2)'"
37
+ ```
38
+
39
+ ## Authentication
40
+
41
+ | Method | How | Best for |
42
+ |--------|-----|----------|
43
+ | **CLI login** | `ppod login pp_sess_...` | Interactive use |
44
+ | **Env var** | `export PAPERPOD_TOKEN=pp_sess_...` | Scripts, CI/CD |
45
+
46
+ Tokens are stored in `~/.paperpod/config.json` (mode 0600). Tokens valid for 15 days.
47
+
48
+ ## Commands
49
+
50
+ ### Sandbox
51
+
52
+ | Command | Description |
53
+ |---------|-------------|
54
+ | `ppod exec <cmd>` | Run shell command |
55
+ | `ppod exec <cmd> --no-stream` | Run without streaming output |
56
+ | `ppod write <path> [file]` | Write file (stdin if no file) |
57
+ | `ppod read <path>` | Read file |
58
+ | `ppod read <path> -o <file>` | Save to local file |
59
+ | `ppod ls <path>` | List directory |
60
+
61
+ ### Processes
62
+
63
+ | Command | Description |
64
+ |---------|-------------|
65
+ | `ppod start <cmd>` | Start background process |
66
+ | `ppod ps` | List running processes |
67
+ | `ppod kill <id>` | Stop a process |
68
+
69
+ ### Ports
70
+
71
+ | Command | Description |
72
+ |---------|-------------|
73
+ | `ppod expose <port>` | Get public URL for port |
74
+
75
+ ### Browser
76
+
77
+ All browser commands support both `browser:` prefix and short form.
78
+
79
+ | Command | Description |
80
+ |---------|-------------|
81
+ | `ppod browser:screenshot <url>` | Capture webpage |
82
+ | `ppod browser:screenshot <url> -o <file>` | Save screenshot to file |
83
+ | `ppod browser:pdf <url>` | Generate PDF |
84
+ | `ppod browser:pdf <url> -o <file>` | Save PDF to file |
85
+ | `ppod browser:scrape <url> [selector]` | Scrape elements (default: body) |
86
+ | `ppod browser:markdown <url>` | Extract markdown from page |
87
+ | `ppod browser:content <url>` | Get rendered HTML |
88
+ | `ppod browser:trace start` | Start browser tracing |
89
+ | `ppod browser:trace stop -o trace.zip` | Stop tracing, save file |
90
+ | `ppod browser:test <url> '<assertions>'` | Run Playwright assertions |
91
+ | `ppod browser:sessions` | List active browser sessions |
92
+ | `ppod browser:limits` | Check browser limits |
93
+
94
+ **Tip:** Use `ppod browser:screenshot --help` to see all options for any command.
95
+
96
+ ### AI
97
+
98
+ | Command | Description |
99
+ |---------|-------------|
100
+ | `ppod ai <prompt>` | Text generation (LLM) |
101
+ | `ppod ai <prompt> --model <model>` | Use specific model |
102
+ | `ppod ai:embed <text>` | Generate embeddings |
103
+ | `ppod ai:image <prompt>` | Generate image |
104
+ | `ppod ai:image <prompt> -o <file>` | Save image to file |
105
+ | `ppod ai:transcribe <audio>` | Transcribe audio to text |
106
+
107
+ ### Code
108
+
109
+ | Command | Description |
110
+ |---------|-------------|
111
+ | `ppod interpret <code>` | Rich output (charts, images) |
112
+ | `ppod interpret <code> --language python` | Specify language |
113
+
114
+ ### Memory (Persistent Storage)
115
+
116
+ | Command | Description |
117
+ |---------|-------------|
118
+ | `ppod mem:write <path> [file]` | Write to persistent storage |
119
+ | `ppod mem:read <path>` | Read from persistent storage |
120
+ | `ppod mem:ls [prefix]` | List memory files |
121
+ | `ppod mem:rm <path>` | Delete from memory |
122
+ | `ppod mem:usage` | Check quota (10MB) |
123
+
124
+ ### Account
125
+
126
+ | Command | Description |
127
+ |---------|-------------|
128
+ | `ppod login [token]` | Save token |
129
+ | `ppod logout` | Clear token |
130
+ | `ppod status` | Connection info |
131
+ | `ppod balance` | Check credits |
132
+ | `ppod help` | Show all commands |
133
+ | `ppod version` | Show version |
134
+
135
+ ## Options
136
+
137
+ | Option | Description |
138
+ |--------|-------------|
139
+ | `-h, --help` | Show help for specific command |
140
+ | `--timeout <ms>` | Command timeout (default: 60000) |
141
+ | `--json` | Output as JSON |
142
+ | `-o, --output <file>` | Write output to file |
143
+ | `--trace <file>` | Capture browser trace (browser:* commands) |
144
+ | `--model <model>` | AI model to use |
145
+ | `--language <lang>` | Language for interpret (python/javascript) |
146
+ | `--width <px>` | Screenshot/image width |
147
+ | `--height <px>` | Screenshot/image height |
148
+ | `--full-page` | Full page screenshot |
149
+
150
+ ## Examples
151
+
152
+ ```bash
153
+ # Multi-step workflow
154
+ ppod exec "npm init -y"
155
+ ppod exec "npm install express"
156
+ ppod write /app/server.js ./server.js
157
+ ppod start "node /app/server.js"
158
+ ppod expose 3000
159
+
160
+ # File operations
161
+ echo "print('hello')" | ppod write /app/script.py
162
+ ppod exec "python /app/script.py"
163
+ ppod read /app/output.txt -o ./local.txt
164
+
165
+ # Browser automation
166
+ ppod browser:screenshot https://example.com -o page.png
167
+ ppod browser:pdf https://example.com -o page.pdf
168
+ ppod browser:markdown https://example.com -o page.md
169
+ ppod browser:scrape https://news.ycombinator.com "a.titlelink"
170
+
171
+ # Browser tracing (debug)
172
+ ppod browser:screenshot https://example.com --trace debug.zip
173
+
174
+ # AI generation
175
+ ppod ai "Write a haiku about coding"
176
+ ppod ai:image "A sunset over mountains" -o sunset.png
177
+ ppod ai:embed "This is a test sentence"
178
+ ppod ai:transcribe audio.mp3
179
+
180
+ # Code interpreter (rich output)
181
+ ppod interpret "import matplotlib.pyplot as plt; plt.plot([1,2,3]); plt.savefig('plot.png')"
182
+
183
+ # Browser testing
184
+ ppod test https://example.com '[{"type":"visible","selector":"h1"}]'
185
+
186
+ # Persistent storage
187
+ echo '{"step": 3}' | ppod mem:write state.json
188
+ ppod mem:read state.json
189
+ ppod mem:ls
190
+ ```
191
+
192
+ ## Exit Codes
193
+
194
+ The CLI returns the exit code of the executed command:
195
+
196
+ ```bash
197
+ ppod exec "npm test" && ppod exec "npm run build"
198
+
199
+ if ppod exec "test -f /app/config.json"; then
200
+ echo "Config exists"
201
+ fi
202
+ ```
203
+
204
+ ## Programmatic Usage
205
+
206
+ ```typescript
207
+ import { PaperpodTransport } from "@paperpod/cli";
208
+
209
+ const transport = new PaperpodTransport();
210
+ await transport.connect();
211
+
212
+ // Execute commands
213
+ const result = await transport.exec("ls -la");
214
+ console.log(result.stdout);
215
+
216
+ // File operations
217
+ await transport.writeFile("/app/script.py", "print('hello')");
218
+ const content = await transport.readFile("/app/script.py");
219
+
220
+ // AI
221
+ const text = await transport.aiGenerate("Write a poem");
222
+ const embeddings = await transport.aiEmbed("Hello world");
223
+ const image = await transport.aiImage("A cat");
224
+
225
+ // Browser
226
+ const screenshot = await transport.browserScreenshot("https://example.com");
227
+ const markdown = await transport.browserMarkdown("https://example.com");
228
+
229
+ // Memory
230
+ await transport.memoryWrite("state.json", '{"step": 1}');
231
+ const state = await transport.memoryRead("state.json");
232
+
233
+ transport.disconnect();
234
+ ```
235
+
236
+ ## Environment Variables
237
+
238
+ | Variable | Description |
239
+ |----------|-------------|
240
+ | `PAPERPOD_TOKEN` | Auth token (overrides config file) |
241
+ | `PAPERPOD_API_URL` | WebSocket URL (default: wss://paperpod.dev/ws) |
242
+
243
+ ## License
244
+
245
+ MIT
package/dist/cli.d.ts ADDED
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * PaperPod CLI
4
+ *
5
+ * Agent-native sandbox execution from your terminal.
6
+ *
7
+ * Usage:
8
+ * ppod exec "ls -la" # Execute a command
9
+ * ppod exec "npm test" --timeout 120000
10
+ * ppod write /app/script.py ./local.py
11
+ * cat file.txt | ppod write /app/file.txt
12
+ * ppod read /app/output.txt
13
+ * ppod ls /app
14
+ * ppod login # Save token
15
+ * ppod status # Check connection
16
+ *
17
+ * Environment:
18
+ * PAPERPOD_TOKEN - Authentication token (overrides config file)
19
+ * PAPERPOD_API_URL - API URL (default: wss://paperpod.dev/ws)
20
+ */
21
+ export {};
22
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;GAkBG"}