runcloud 0.1.19 → 0.1.20

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/dist/api.js CHANGED
@@ -52,6 +52,10 @@ export class ApiClient {
52
52
  get(path) {
53
53
  return this.request('GET', path);
54
54
  }
55
+ async getText(path) {
56
+ const response = await this.request('GET', path);
57
+ return response.text();
58
+ }
55
59
  post(path, body) {
56
60
  return this.request('POST', path, body);
57
61
  }
@@ -527,23 +527,18 @@ export function registerSandbox(program) {
527
527
  }
528
528
  withOutput(sandbox
529
529
  .command('logs')
530
- .description('Show recent sandbox logs (one-shot journalctl tail; streaming is a follow-up)')
530
+ .description('Show saved console logs (available after a sandbox is deleted)')
531
531
  .argument('<id>', 'sandbox id')
532
532
  .option('--lines <n>', 'number of lines to tail', '200')).action((id, opts) => run(async () => {
533
533
  const n = Number(opts.lines) || 200;
534
- const r = await runCloudApi().post(`/run-cloud/sandboxes/${encodeURIComponent(id)}/exec`, {
535
- cmd: [
536
- '/bin/sh',
537
- '-c',
538
- `j="$(journalctl -n ${n} --no-pager 2>/dev/null)"; if [ -n "$j" ]; then printf "%s\\n" "$j"; else tail -n ${n} /root/.natively/expo_server.log 2>&1 || echo '(no logs available)'; fi`,
539
- ],
540
- });
534
+ const saved = await runCloudApi().getText(`/run-cloud/sandboxes/${encodeURIComponent(id)}/logs`);
535
+ const lines = saved.split('\n');
536
+ const logs = lines.slice(Math.max(0, lines.length - n - (saved.endsWith('\n') ? 1 : 0))).join('\n');
541
537
  if (opts.json) {
542
- console.log(JSON.stringify(r, null, 2));
538
+ printJson({ sandboxId: id, logs });
543
539
  return;
544
540
  }
545
- process.stdout.write(r.stdout ?? '');
546
- process.stderr.write(r.stderr ?? '');
541
+ process.stdout.write(logs);
547
542
  }));
548
543
  withOutput(sandbox
549
544
  .command('desktop')
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const CLI_VERSION = '0.1.19';
1
+ export const CLI_VERSION = '0.1.20';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runcloud",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
4
4
  "description": "Create and control run.cloud remote mobile simulators and cloud sandboxes",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [