@raytrace-cli/cli 0.8.0 → 0.9.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
@@ -86,9 +86,10 @@ Cloud sandboxes are a preview and may change; please
86
86
  ## Use from your editor (MCP)
87
87
 
88
88
  `raytrace mcp` is an [MCP](https://modelcontextprotocol.io) server, so the agent
89
- in VS Code, Cursor, Claude Code or any MCP client can create and manage cloud
90
- sandboxes for you: "put this project in a sandbox", "stop my sandbox",
91
- "destroy rtp-…". Nothing to install first; `npx` fetches the CLI.
89
+ in VS Code, Cursor, Claude Code or any MCP client can create and manage
90
+ sandboxes for you, in the cloud or on your machine: "put this project in a
91
+ sandbox", "connect this repo to a local sandbox", "stop my sandbox". Nothing to
92
+ install first; `npx` fetches the CLI.
92
93
 
93
94
  - **Claude Code:** `claude mcp add raytrace -- npx -y @raytrace-cli/cli mcp`
94
95
  - **VS Code** (`.vscode/mcp.json`):
@@ -101,14 +102,54 @@ sandboxes for you: "put this project in a sandbox", "stop my sandbox",
101
102
  ```
102
103
 
103
104
  Tools: `login`, `create_sandbox`, `list_sandboxes`, `sandbox_status`,
104
- `start_sandbox`, `stop_sandbox`, `destroy_sandbox`. The first time, the agent
105
+ `start_sandbox`, `stop_sandbox`, `destroy_sandbox`, `run_command`,
106
+ `get_command_result`, `cancel_command`. The first time, the agent
105
107
  calls `login` and shows you a code to approve in the browser; it is the same
106
108
  sign-in as `raytrace auth login`. `create_sandbox` uploads the Git project open
107
109
  in your editor, with the same rules and limits as `raytrace sandbox create`.
108
110
  `destroy_sandbox` deletes the sandbox's traces too unless the agent passes
109
- `keep_traces` (paid plans), as `raytrace sandbox destroy --yes` does. To work
110
- inside a sandbox, run `raytrace connect <id>` in a terminal. Local sandboxes
111
- stay terminal-only for now.
111
+ `keep_traces` (paid plans), as `raytrace sandbox destroy --yes` does.
112
+
113
+ **Working in the sandbox with Claude Code.** After `create_sandbox`, a new
114
+ terminal opens connected to the sandbox with Claude Code starting in it, and the
115
+ session you have there is recorded (`connect: false` skips this).
116
+ `connect_sandbox` does the same for a sandbox you already have: "open my sandbox
117
+ with Claude". The terminal opens where your agent runs when it can: a new tmux
118
+ window inside tmux, a new iTerm window or WezTerm tab; otherwise a new Terminal
119
+ window on macOS (also from VS Code, whose built-in terminal cannot be opened from
120
+ outside), the desktop's terminal on Linux, or Windows Terminal. macOS asks once
121
+ whether your terminal may be controlled. If no terminal can be opened, the agent
122
+ gives you the command: `raytrace connect <id or name> --claude`. Claude Code runs
123
+ there with `--dangerously-skip-permissions`: it does not stop to ask before each
124
+ command, because the sandbox is what contains it, and everything it does is
125
+ recorded. Files the project's owner restricted stay locked. The first time in
126
+ each sandbox, Claude Code asks you to sign in and to accept that mode.
127
+
128
+ **Running commands from the chat.** `run_command` starts a shell command in the
129
+ sandbox's `/workspace` (up to 4 at a time, 120 s by default, at most 1,800 s) and
130
+ returns at once with a command id. `get_command_result` gives its state, the real
131
+ exit code (*unknown* is never reported as success) and the last 20,000 characters
132
+ of stdout and stderr; `wait_seconds` (up to 30) waits for a running command, so
133
+ the agent does not have to poll. `cancel_command` stops it and everything it
134
+ started. What a command prints comes from your project, so the agent is told to
135
+ treat it as data, not as instructions. This needs a RayTrace server with the
136
+ command API; on one without it the tools say so, and you can still run
137
+ `raytrace connect <id>` yourself in a terminal (it needs a real terminal, which
138
+ an agent's own shell does not have). Running commands works on cloud sandboxes
139
+ only.
140
+
141
+ **Local sandboxes from the chat.** Ask for a local sandbox and the agent calls
142
+ `create_sandbox` with `local: true`: the same as `raytrace sandbox create --local`
143
+ in the project, so nothing is uploaded and no RayTrace sign-in is needed. If Lima
144
+ is not installed, the agent asks you before downloading it (`install_lima`). The
145
+ first local sandbox sets up the Linux VM, which takes several minutes: the agent
146
+ gets an answer after about a minute and follows the rest with `sandbox_status`,
147
+ and the setup carries on even if the chat ends. `list_sandboxes` shows local and
148
+ cloud sandboxes together; `start_sandbox`, `stop_sandbox`, `sandbox_status` and
149
+ `destroy_sandbox` and `connect_sandbox` take a local sandbox's name. Destroying one archives its
150
+ captured logs to `~/.raytrace/archive` unless the agent passes `delete_logs`
151
+ (`upload_first` uploads its evidences to the cloud before). To work in it, run
152
+ `raytrace connect <name> --claude` in a terminal, or ask for `connect_sandbox`.
112
153
 
113
154
  ## Local sandboxes
114
155
 
@@ -208,7 +249,7 @@ raytrace key # which keys are set
208
249
  | Command | What it does |
209
250
  |---|---|
210
251
  | `raytrace sandbox create` | upload this Git repository to a new cloud sandbox; `--name <name>` |
211
- | `raytrace connect [id]` | open a terminal in a sandbox, signing in first if needed (also `raytrace sandbox shell [id]`) |
252
+ | `raytrace connect [id] [--claude]` | open a terminal in a sandbox, signing in first if needed (also `raytrace sandbox shell [id]`); `--claude` starts Claude Code in it |
212
253
  | `raytrace sandbox list` | your cloud sandboxes |
213
254
  | `raytrace sandbox start\|stop [id]` | start or stop a sandbox; stopping keeps its files |
214
255
  | `raytrace sandbox destroy [id]` | delete a sandbox; its recorded sessions are kept |
package/bin/raytrace.mjs CHANGED
@@ -16,8 +16,9 @@ Cloud sandboxes:
16
16
  raytrace auth login|status|logout your RayTrace sign-in
17
17
  raytrace sandbox create [--name <name>] upload this Git repository to a new sandbox
18
18
  (up to 200 MiB, 25 MiB a file, 20,000 files)
19
- raytrace connect [id] a terminal in it; with one sandbox the id is
20
- optional (same as: raytrace sandbox shell [id])
19
+ raytrace connect [id] [--claude] a terminal in it; with one sandbox the id is
20
+ optional (same as: raytrace sandbox shell [id]);
21
+ --claude starts Claude Code in it at once
21
22
  raytrace --code <code> beta invite: redeem a code RayTrace gave you for one
22
23
  $10-credit sandbox (signed in first; also: raytrace code <code>)
23
24
  raytrace sandbox list
@@ -56,6 +57,11 @@ Export recorded traces:
56
57
  raytrace export <trace-id> --output <file>
57
58
  save export to file with owner-only permissions
58
59
 
60
+ Share recorded traces (time-limited cloud link):
61
+ raytrace share <trace-id> [--fork] create a share link for peers
62
+ raytrace share --list list your active share links
63
+ raytrace share --revoke <share-id> revoke an active share link
64
+
59
65
  AI features in the dashboard (summaries, recaps, Chain of thought), on your own key:
60
66
  raytrace key which keys are set
61
67
  raytrace key openrouter add your OpenRouter key (asked for, not echoed)
@@ -120,9 +126,9 @@ if (command === 'auth') {
120
126
 
121
127
  // `raytrace connect <id>`: the sandbox's terminal, by the id the dashboard shows.
122
128
  if (command === 'connect') {
123
- const flags = { local: rest.includes('--local') };
124
- const args = rest.filter((arg) => arg !== '--local');
125
- if (args.length > 1 || args[0]?.startsWith('-')) { console.error('Usage: raytrace connect [sandbox-id or local name] [--local]'); process.exit(2); }
129
+ const flags = { local: rest.includes('--local'), claude: rest.includes('--claude') };
130
+ const args = rest.filter((arg) => arg !== '--local' && arg !== '--claude');
131
+ if (args.length > 1 || args[0]?.startsWith('-')) { console.error('Usage: raytrace connect [sandbox-id or local name] [--local] [--claude]'); process.exit(2); }
126
132
  const sandbox = await import('../src/sandbox.mjs');
127
133
  try { await sandbox.shell(args[0], flags); process.exit(0); }
128
134
  catch (error) { console.error(`raytrace connect: ${error.message}`); process.exit(1); }
@@ -217,6 +223,47 @@ if (command === 'export') {
217
223
  }
218
224
  }
219
225
 
226
+ if (command === 'share') {
227
+ let parsed;
228
+ try {
229
+ parsed = parseArgs({ args: rest, strict: true, allowPositionals: true, options: {
230
+ list: { type: 'boolean', short: 'l' },
231
+ revoke: { type: 'string' },
232
+ sandbox: { type: 'string' },
233
+ fork: { type: 'boolean' },
234
+ } });
235
+ } catch (error) {
236
+ console.error(`${error.message}\n\nUsage: raytrace share <trace-id> [--sandbox <id>] [--fork] | raytrace share --list | raytrace share --revoke <id>`);
237
+ process.exit(2);
238
+ }
239
+ const [sub, ...extra] = parsed.positionals;
240
+ const share = await import('../src/share.mjs');
241
+ try {
242
+ if (parsed.values.list || sub === 'list') {
243
+ await share.listShares();
244
+ process.exit(0);
245
+ }
246
+ if (parsed.values.revoke || sub === 'revoke') {
247
+ const shareId = parsed.values.revoke || extra[0];
248
+ if (!shareId) {
249
+ console.error('Usage: raytrace share --revoke <id> (or raytrace share revoke <id>)');
250
+ process.exit(2);
251
+ }
252
+ await share.revokeShare(shareId);
253
+ process.exit(0);
254
+ }
255
+ if (!sub || extra.length > 0) {
256
+ console.error('Usage: raytrace share <trace-id> [--sandbox <id>] [--fork] | raytrace share --list | raytrace share --revoke <id>');
257
+ process.exit(2);
258
+ }
259
+ await share.sharePrompt(sub, { sandboxId: parsed.values.sandbox, allowFork: parsed.values.fork });
260
+ process.exit(0);
261
+ } catch (error) {
262
+ console.error(`raytrace share: ${error.message}`);
263
+ process.exit(1);
264
+ }
265
+ }
266
+
220
267
  let flags;
221
268
  try {
222
269
  ({ values: flags } = parseArgs({ args: rest, strict: true, options: {