@lizard-build/cli 4.0.108 → 4.0.110
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 +1 -1
- package/dist/commands/fn.js +5 -0
- package/dist/commands/fn.js.map +1 -1
- package/dist/commands/sandbox.js +9 -14
- package/dist/commands/sandbox.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/lib/format.d.ts +2 -0
- package/dist/lib/format.js +9 -1
- package/dist/lib/format.js.map +1 -1
- package/dist/lib/skills-data.generated.js +3 -3
- package/dist/lib/skills-data.generated.js.map +1 -1
- package/dist/lib/support.d.ts +12 -3
- package/dist/lib/support.js +15 -6
- package/dist/lib/support.js.map +1 -1
- package/dist/lib/updater.d.ts +1 -1
- package/dist/lib/updater.js +1 -1
- package/package.json +1 -1
- package/skill-data/core/SKILL.md +4 -4
- package/skill-data/core/references/sandboxes.md +5 -2
- package/skill-data/core/references/sdk.md +2 -2
- package/src/commands/fn.ts +3 -0
- package/src/commands/sandbox.ts +9 -14
- package/src/index.ts +3 -3
- package/src/lib/format.ts +9 -1
- package/src/lib/support.ts +12 -6
- package/src/lib/updater.ts +1 -1
- package/test/unit/sandbox.test.ts +27 -0
- package/test/unit/support.test.ts +19 -7
package/dist/lib/support.js
CHANGED
|
@@ -58,15 +58,24 @@ export function ticketContext() {
|
|
|
58
58
|
export function agentName() {
|
|
59
59
|
return detectAgent() ?? undefined;
|
|
60
60
|
}
|
|
61
|
-
/**
|
|
62
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Whether a failed command ends with the one-line support hint. Almost every error does: the hint
|
|
63
|
+
* is optional and one line, and an agent can't always tell a Lizard bug from its own mistake.
|
|
64
|
+
* Not shown for: sign-in problems (`lizard login` is the fix), cancelled prompts, `lizard support`
|
|
65
|
+
* itself, and AGENT_SUPPORT=0 (the user turned agent tickets off).
|
|
66
|
+
*/
|
|
67
|
+
export function wantsSupportHint(opts = {}) {
|
|
63
68
|
if (process.env.AGENT_SUPPORT === "0")
|
|
64
69
|
return false;
|
|
65
|
-
if (
|
|
66
|
-
return
|
|
67
|
-
|
|
70
|
+
if (process.argv.slice(2).includes("support"))
|
|
71
|
+
return false;
|
|
72
|
+
if (opts.status === 401 || opts.code === "NOT_AUTHENTICATED" || opts.exitCode === 2)
|
|
73
|
+
return false;
|
|
74
|
+
if (opts.exitCode === 5 || opts.exitCode === 130)
|
|
75
|
+
return false;
|
|
76
|
+
return true;
|
|
68
77
|
}
|
|
69
|
-
export const SUPPORT_HINT = '
|
|
78
|
+
export const SUPPORT_HINT = 'Lizard bug? Optional: lizard support open "<what happened>"';
|
|
70
79
|
/**
|
|
71
80
|
* Prints support replies the user has not seen yet, after a command. Throttled to one request
|
|
72
81
|
* a minute; each reply is printed at most twice. Never throws and never waits more than 2 s.
|
package/dist/lib/support.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"support.js","sourceRoot":"","sources":["../../src/lib/support.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,EAAE;AACF,6DAA6D;AAC7D,gGAAgG;AAChG,oDAAoD;AACpD,iGAAiG;AACjG,uDAAuD;AACvD,2FAA2F;AAC3F,+DAA+D;AAC/D,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAKzC,MAAM,cAAc,GAAG,MAAM,CAAC;AAC9B,MAAM,UAAU,GAAG,CAAC,CAAC;AAErB,SAAS,SAAS,KAAa,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,cAAc,CAAC,CAAC,CAAC,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,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;QAC/F,MAAM,IAAI,GAAG,IAAI,EAAE,CAAC;QACpB,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACpF,IAAI,CAAC,IAAI,CAAC,CAAC;QACX,IAAI,GAAG,CAAC,MAAM;YAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IACrE,CAAC;IAAC,MAAM,CAAC,CAAC,0CAA0C,CAAC,CAAC;AACxD,CAAC"}
|
package/dist/lib/updater.d.ts
CHANGED
package/dist/lib/updater.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Readable } from "node:stream";
|
|
|
4
4
|
import { join, dirname } from "node:path";
|
|
5
5
|
import os from "node:os";
|
|
6
6
|
import { spawn } from "node:child_process";
|
|
7
|
-
export const CURRENT_VERSION = "4.0.
|
|
7
|
+
export const CURRENT_VERSION = "4.0.110";
|
|
8
8
|
const RELEASES_API = "https://api.github.com/repos/lizard-build/lizard-cli/releases/latest";
|
|
9
9
|
const RELEASE_BASE = "https://github.com/lizard-build/lizard-cli/releases/latest/download";
|
|
10
10
|
/** Minimum gap between background update checks. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lizard-build/cli",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.110",
|
|
4
4
|
"description": "Lizard CLI — deploy apps, databases and sandboxes to Lizard (lizard.build) from your terminal or your coding agent. Detects Go, Node, Python, Rust, Ruby, PHP, Java and static sites; adds Managed Postgres, Managed Redis and Managed Object Storage in one command.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/skill-data/core/SKILL.md
CHANGED
|
@@ -112,7 +112,7 @@ lizard sandbox rm <id> # delete it now (alias
|
|
|
112
112
|
`lizard sandbox list --json` shows the project's sandboxes; `--all` shows every one you have.
|
|
113
113
|
|
|
114
114
|
- **Templates:** `base` (default, Python 3.11 on Alpine Linux), `interpreter` (Python with numpy, pandas, matplotlib and scipy, plus Node 22), `codex`, `claude`, `opencode`, `pi`, `prime` (one coding agent each), `desktop` (graphical desktop with Chromium).
|
|
115
|
-
- **Sizes:** `-s small|medium|large`, $0.0162 / $0.0324 (default) / $0.0648 per hour, billed per second while it runs. A paused sandbox costs nothing. On the Pro trial
|
|
115
|
+
- **Sizes:** `-s mini|small|medium|large`, $0.0081 / $0.0162 / $0.0324 (default) / $0.0648 per hour, billed per second while it runs. A paused sandbox costs nothing. Mini (1 vCPU / 2 GB) works only with the `base`, `claude`, `codex` and `interpreter` templates; another template answers 400 `SANDBOX_SIZE_NOT_ALLOWED`. On the Pro trial, Small and one Medium at a time work, in US regions only (no size = small). Until the first Pro payment, another size or region answers 403 `TRIAL_SANDBOX_SIZE` / `TRIAL_SANDBOX_REGION`, and a second Medium answers 403 `TRIAL_MEDIUM_RUNNING`.
|
|
116
116
|
- **Region:** `us-east-1` unless `--region` names another (`lizard regions`). With `--volume` or `--snapshot` the sandbox starts in their region.
|
|
117
117
|
- **Lifetime:** 5 minutes by default, then the sandbox is deleted with its files. `--timeout 0` at create means no limit; `lizard sandbox timeout <id> <ms>` sets a new lifetime from now. Commands do not reset it.
|
|
118
118
|
- **Commands:** `exec <id> -- <cmd> [args…]` passes each argument as one word, so a whole shell line in one quoted string fails with `not found`: wrap it, `-- sh -c 'cd /workspace && npm test'`. Each call is a new process that starts in `/root`, gives up after 150 seconds (exit `4`, `EXEC_TIMEOUT`; the command may still be running) and keeps at most 512 KB of output. Run longer jobs in the background and poll a log: `-- sh -c 'cd /workspace && nohup npm run build > build.log 2>&1 &'`, then `-- tail -n 50 /workspace/build.log`. `ssh` needs a real terminal: from an agent, use `exec`.
|
|
@@ -314,7 +314,7 @@ lizard support reply T-1043 "request id r_8f2…, still failing at 18:05" --json
|
|
|
314
314
|
|
|
315
315
|
Write the ticket like a bug report: what you ran, what happened (the exact error), what you expected, since when. Your last failed Lizard calls, CLI version and OS are attached automatically; `--sandbox` / `--app` attach that resource's state. Never put secrets, keys or customer data in a ticket. Types: `bug` (default), `limits`, `billing`, `question`. Filing the same problem again does not open a new ticket: the answer has `similarId` (the open ticket) and `similarCount`; add details there with `lizard support reply`. At most 5 new tickets an hour. `AGENT_SUPPORT=0` in the environment means the user turned agent tickets off: don't open any.
|
|
316
316
|
|
|
317
|
-
After opening one, tell the user the ticket id and continue with whatever does not depend on the fix. Replies from the team are printed on stderr after your next `lizard` command (`📬 Lizard support replied on T-1043`) and emailed to the account owner. When support asks a question, answer with `lizard support reply` and tell the user what was asked. Don't open tickets for the user's own build errors, app bugs or wrong commands.
|
|
317
|
+
After opening one, tell the user the ticket id and continue with whatever does not depend on the fix. Replies from the team are printed on stderr after your next `lizard` command (`📬 Lizard support replied on T-1043`) and emailed to the account owner. When support asks a question, answer with `lizard support reply` and tell the user what was asked. Don't open tickets for the user's own build errors, app bugs or wrong commands. Most errors end with a dim `Lizard bug? Optional: lizard support open …` line (`support` in `--json` errors): it is a pointer, not an instruction — open one only when the failure looks like Lizard's.
|
|
318
318
|
|
|
319
319
|
## Billing
|
|
320
320
|
|
|
@@ -343,8 +343,8 @@ way and run more Sandboxes at once. They have no trial: `lizard billing start
|
|
|
343
343
|
--tier 5x` charges today. A paid subscription changes tier with `lizard billing
|
|
344
344
|
tier <pro|5x|20x>`: up is charged now, prorated, and the new limits apply at once;
|
|
345
345
|
down starts with the next period. `lizard billing --json` shows `tier` and
|
|
346
|
-
`pendingTier`. Sandbox limits count vCPU of running sandboxes (
|
|
347
|
-
Large 8; paused ones don't count), across all of the owner's workspaces: the trial
|
|
346
|
+
`pendingTier`. Sandbox limits count vCPU of running sandboxes (Mini 1, Small 2,
|
|
347
|
+
Medium 4, Large 8; paused ones don't count), across all of the owner's workspaces: the trial
|
|
348
348
|
runs up to 4 Small (8 vCPU), Pro 40 vCPU, Pro 5x 220, Pro 20x 1,200. Sandbox
|
|
349
349
|
starts are limited only on the trial (6 a minute, 30 an hour, 100 a day); Pro,
|
|
350
350
|
Pro 5x and Pro 20x have unlimited starts. Trial
|
|
@@ -71,19 +71,22 @@ lizard sandbox files rm <id> <path>
|
|
|
71
71
|
|
|
72
72
|
## Size and pricing
|
|
73
73
|
|
|
74
|
-
`lizard sandbox create -s/--size small|medium|large` picks the machine; the default is `medium`. On the Pro trial
|
|
74
|
+
`lizard sandbox create -s/--size mini|small|medium|large` picks the machine; the default is `medium`. On the Pro trial, Small (also the default) and one Medium at a time work, in US regions only: another size or region answers 403 `TRIAL_SANDBOX_SIZE` / `TRIAL_SANDBOX_REGION`, a second Medium answers 403 `TRIAL_MEDIUM_RUNNING`, and `lizard billing start-now` lifts both limits. There are exactly four sizes:
|
|
75
75
|
|
|
76
76
|
| Size | vCPU | RAM | Disk | Price |
|
|
77
77
|
|---|---|---|---|---|
|
|
78
|
+
| `mini` | 1 | 2 GiB | 5 GB | $0.0081/h |
|
|
78
79
|
| `small` | 2 | 4 GiB | 5 GB | $0.0162/h |
|
|
79
80
|
| `medium` (default) | 4 | 8 GiB | 20 GB | $0.0324/h |
|
|
80
81
|
| `large` | 8 | 16 GiB | 50 GB | $0.0648/h |
|
|
81
82
|
|
|
83
|
+
Mini has no warm pool, so it starts only from templates with a disk-only build: `base`, `claude`, `codex` and `interpreter`. Any other template answers 400 `SANDBOX_SIZE_NOT_ALLOWED`; use `small` or larger for it.
|
|
84
|
+
|
|
82
85
|
Prices are per hour, billed per second while the sandbox runs, flat by size: measured CPU/RAM is not charged, and disk and egress are included. A paused sandbox costs nothing. Attached volumes bill separately. `--size` cannot be combined with `--snapshot`: a snapshot restores at the size it was captured at (see [private snapshots](#snapshots-and-pauseresume)).
|
|
83
86
|
|
|
84
87
|
Lizard Sandboxes run as Firecracker microVMs, each with its own kernel. If a sandbox cannot start, creation fails with an error.
|
|
85
88
|
|
|
86
|
-
An account's limit counts vCPU of running sandboxes (Small 2, Medium 4, Large 8; paused ones don't count), across all of the owner's workspaces: up to 4 Small (8 vCPU) on the trial, 40 vCPU on Pro, 220 on Pro 5x and 1,200 on Pro 20x. Starts are limited only on the trial (6 a minute, 30 an hour, 100 a day); Pro, Pro 5x and Pro 20x have unlimited starts. Enterprise has no fixed limit on sandboxes running at once: each customer's agreement sets the limit per workspace, and running, paused and crashed sandboxes all count toward it. Over a limit the API answers 429 `SANDBOX_LIMIT_REACHED` (with `unit: "vcpu"`, `limit`, `running` and `needed`, all in vCPU) or `SANDBOX_RATE_LIMITED` (with `retryAfterS`).
|
|
89
|
+
An account's limit counts vCPU of running sandboxes (Mini 1, Small 2, Medium 4, Large 8; paused ones don't count), across all of the owner's workspaces: up to 4 Small (8 vCPU) on the trial, 40 vCPU on Pro, 220 on Pro 5x and 1,200 on Pro 20x. Starts are limited only on the trial (6 a minute, 30 an hour, 100 a day); Pro, Pro 5x and Pro 20x have unlimited starts. Enterprise has no fixed limit on sandboxes running at once: each customer's agreement sets the limit per workspace, and running, paused and crashed sandboxes all count toward it. Over a limit the API answers 429 `SANDBOX_LIMIT_REACHED` (with `unit: "vcpu"`, `limit`, `running` and `needed`, all in vCPU) or `SANDBOX_RATE_LIMITED` (with `retryAfterS`).
|
|
87
90
|
|
|
88
91
|
## Interactive shell
|
|
89
92
|
|
|
@@ -36,7 +36,7 @@ Options for `create()` (TypeScript / Python):
|
|
|
36
36
|
|
|
37
37
|
| Option | Purpose |
|
|
38
38
|
|---|---|
|
|
39
|
-
| `size` | `small` (2 vCPU / 4 GB, $0.0162/h), `medium` (4 vCPU / 8 GB, $0.0324/h, default), `large` (8 vCPU / 16 GB, $0.0648/h) |
|
|
39
|
+
| `size` | `mini` (1 vCPU / 2 GB, $0.0081/h; `base`, `claude`, `codex` and `interpreter` templates only; SDK 1.0.12 or later), `small` (2 vCPU / 4 GB, $0.0162/h), `medium` (4 vCPU / 8 GB, $0.0324/h, default), `large` (8 vCPU / 16 GB, $0.0648/h) |
|
|
40
40
|
| `timeoutMs` / `timeout_ms` | Lifetime; default 300,000 ms (5 minutes); `0` means no deadline (the VM still stops after 596 hours) |
|
|
41
41
|
| `envs` | Environment variables for every command in the sandbox (up to 256) |
|
|
42
42
|
| `metadata` | Your own string labels, returned by `getInfo()` / `get_info()` (up to 64) |
|
|
@@ -47,7 +47,7 @@ Options for `create()` (TypeScript / Python):
|
|
|
47
47
|
|
|
48
48
|
Templates: `base` (default), `interpreter` (Python with data libraries, plus Node 22), `codex`, `claude`, `opencode`, `pi`, `prime` (one coding agent each), `desktop`. The SDK and CLI give a sandbox 5 minutes by default; the raw API and the dashboard give none. Commands do not reset the deadline. Pricing is flat by size, billed per second while the sandbox runs; a sandbox restored from a snapshot runs at the source's size and is billed at that size; volumes bill separately.
|
|
49
49
|
|
|
50
|
-
An account's limit counts vCPU of running sandboxes (Small 2, Medium 4, Large 8): up to 4 Small on the trial, 40 vCPU on Pro, 220 on Pro 5x and 1,200 on Pro 20x. Starts are limited only on the trial (6 a minute, 30 an hour, 100 a day); Pro, Pro 5x and Pro 20x have unlimited starts. Over a limit, a `LimitExceededError` (status 429) with `code` `SANDBOX_LIMIT_REACHED` (`unit` `vcpu`, `limit`, `running`, `needed`) or `SANDBOX_RATE_LIMITED` (`retryAfterS`). More than 32 commands at once in one sandbox gives `EXEC_LIMIT_REACHED`.
|
|
50
|
+
An account's limit counts vCPU of running sandboxes (Mini 1, Small 2, Medium 4, Large 8): up to 4 Small on the trial, 40 vCPU on Pro, 220 on Pro 5x and 1,200 on Pro 20x. Starts are limited only on the trial (6 a minute, 30 an hour, 100 a day); Pro, Pro 5x and Pro 20x have unlimited starts. Over a limit, a `LimitExceededError` (status 429) with `code` `SANDBOX_LIMIT_REACHED` (`unit` `vcpu`, `limit`, `running`, `needed`) or `SANDBOX_RATE_LIMITED` (`retryAfterS`). More than 32 commands at once in one sandbox gives `EXEC_LIMIT_REACHED`.
|
|
51
51
|
|
|
52
52
|
## Quickstart
|
|
53
53
|
|
package/src/commands/fn.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { Command } from "commander";
|
|
|
9
9
|
import { api, getBaseURL, getRequestToken, clientHeaders, APIError } from "../lib/api.js";
|
|
10
10
|
import { resolveProjectScope } from "../lib/resolve.js";
|
|
11
11
|
import { success, info, warn, fail, isJSONMode, printJSON, table } from "../lib/format.js";
|
|
12
|
+
import { SUPPORT_HINT, wantsSupportHint } from "../lib/support.js";
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* `lizard fn`: Lizard Functions (AWS Lambda-compatible) from the CLI, made for one-command
|
|
@@ -496,6 +497,7 @@ export const EXIT = { OK: 0, FAILED: 1, AUTH: 2, INVALID: 3, TIMEOUT: 4 } as con
|
|
|
496
497
|
function failEnv(e: Record<string, any>, exit: number): never {
|
|
497
498
|
statusDone();
|
|
498
499
|
const env: Record<string, any> = { schemaVersion: 1, status: "failed", ...e };
|
|
500
|
+
if (wantsSupportHint({ code: env.code, exitCode: exit })) env.support = SUPPORT_HINT;
|
|
499
501
|
for (const k of Object.keys(env)) if (env[k] === undefined || k === "deployId" || k === "log" || k === "startedAt" || k === "endedAt") delete (env as any)[k];
|
|
500
502
|
if (isJSONMode()) process.stderr.write(JSON.stringify(env, null, 2) + "\n");
|
|
501
503
|
else {
|
|
@@ -503,6 +505,7 @@ function failEnv(e: Record<string, any>, exit: number): never {
|
|
|
503
505
|
if (env.serving?.unchanged) process.stderr.write(chalk.dim(`Version ${env.serving.version} is still serving: nothing changed.\n`));
|
|
504
506
|
if (env.logTail) process.stderr.write(chalk.dim(String(env.logTail).trim().split("\n").slice(-12).join("\n") + "\n"));
|
|
505
507
|
if (env.remediation) process.stderr.write(`Fix: ${chalk.cyan(env.remediation)}\n`);
|
|
508
|
+
if (env.support) process.stderr.write(chalk.dim(env.support) + "\n");
|
|
506
509
|
}
|
|
507
510
|
process.exit(exit);
|
|
508
511
|
}
|
package/src/commands/sandbox.ts
CHANGED
|
@@ -4,7 +4,7 @@ import fs from "node:fs";
|
|
|
4
4
|
import * as https from "node:https";
|
|
5
5
|
import * as http from "node:http";
|
|
6
6
|
import * as p from "@clack/prompts";
|
|
7
|
-
import { Command,
|
|
7
|
+
import { Command, Option } from "commander";
|
|
8
8
|
import open from "open";
|
|
9
9
|
import { api, APIError, getBaseURL, getRawBytes, apiErrorFrom, clientHeaders, getRequestToken, withQuery, withScope, type ResourceScope } from "../lib/api.js";
|
|
10
10
|
import { getToken } from "../lib/auth.js";
|
|
@@ -23,18 +23,13 @@ import { success, info, error, isJSONMode, printJSON, table, statusColor, timeAg
|
|
|
23
23
|
// so let it.
|
|
24
24
|
const TEMPLATE_HINT = "base, interpreter, codex, claude, opencode, pi, prime, desktop";
|
|
25
25
|
|
|
26
|
-
// The
|
|
27
|
-
// platform rejects anything else, so the CLI offers exactly these.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
function parseSandboxSize(v: string): string {
|
|
35
|
-
if ((SANDBOX_SIZES as readonly string[]).includes(v) || (GATED_SANDBOX_SIZES as readonly string[]).includes(v)) return v;
|
|
36
|
-
throw new InvalidArgumentError(`Allowed choices are ${SANDBOX_SIZES.join(", ")}.`);
|
|
37
|
-
}
|
|
26
|
+
// The four machines a sandbox can be, each priced per hour, billed per second by the server. The
|
|
27
|
+
// platform rejects anything else, so the CLI offers exactly these. Mini has no warm pool, so it
|
|
28
|
+
// starts only from templates with a disk-only build (MINI_TEMPLATES); the server answers
|
|
29
|
+
// SANDBOX_SIZE_NOT_ALLOWED for any other template.
|
|
30
|
+
const SANDBOX_SIZES = ["mini", "small", "medium", "large"] as const;
|
|
31
|
+
const SIZE_HINT = "mini 1 vCPU/2 GB, small 2/4, medium 4/8, large 8/16";
|
|
32
|
+
const MINI_TEMPLATES = "base, claude, codex and interpreter";
|
|
38
33
|
|
|
39
34
|
interface SandboxRecord {
|
|
40
35
|
sandboxId: string;
|
|
@@ -178,7 +173,7 @@ export function registerSandbox(program: Command) {
|
|
|
178
173
|
sb.command("create")
|
|
179
174
|
.description("Create a sandbox")
|
|
180
175
|
.option("-t, --template <name>", `Template (${TEMPLATE_HINT}; server validates)`, "base")
|
|
181
|
-
.addOption(new Option("-s, --size <size>", `Machine size (${SIZE_HINT}); default medium, small
|
|
176
|
+
.addOption(new Option("-s, --size <size>", `Machine size (${SIZE_HINT}); default medium, small on the Pro trial (US regions only). Mini works only with the ${MINI_TEMPLATES} templates`).choices(SANDBOX_SIZES))
|
|
182
177
|
.option("--timeout <ms>", "Lifetime in milliseconds; 0 disables expiration", parseTimeoutOption, 300_000)
|
|
183
178
|
.option("--region <code>", `Region to create the sandbox in (default ${DEFAULT_REGION}; with --volume or --snapshot, theirs)`)
|
|
184
179
|
.option("--snapshot <id>", "Create from a private saved snapshot, at the size it was taken at")
|
package/src/index.ts
CHANGED
|
@@ -103,7 +103,7 @@ import { registerUpgrade } from "./commands/upgrade.js";
|
|
|
103
103
|
import { registerVolume } from "./commands/volume.js";
|
|
104
104
|
import { registerWhoami } from "./commands/whoami.js";
|
|
105
105
|
import { registerSupport } from "./commands/support.js";
|
|
106
|
-
import { printSupportInbox,
|
|
106
|
+
import { printSupportInbox, wantsSupportHint, SUPPORT_HINT } from "./lib/support.js";
|
|
107
107
|
import { registerWorkspace } from "./commands/workspace.js";
|
|
108
108
|
|
|
109
109
|
const program = new Command();
|
|
@@ -508,8 +508,8 @@ async function main() {
|
|
|
508
508
|
netCode === "UND_ERR_CONNECT_TIMEOUT";
|
|
509
509
|
|
|
510
510
|
const exitCode = isAuth ? 2 : isNotFound ? 3 : isTimeout ? 4 : 1;
|
|
511
|
-
//
|
|
512
|
-
const showSupportHint =
|
|
511
|
+
// One optional line pointing at `lizard support open` (lib/support.ts says when not).
|
|
512
|
+
const showSupportHint = wantsSupportHint({ status, code, exitCode });
|
|
513
513
|
|
|
514
514
|
if (isJSONMode()) {
|
|
515
515
|
// Through writeAndExit, not console.log + exit: `body` carries the raw
|
package/src/lib/format.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
|
+
import { SUPPORT_HINT, wantsSupportHint } from "./support.js";
|
|
2
3
|
|
|
3
4
|
export function isTTY(): boolean {
|
|
4
5
|
return Boolean(process.stdout.isTTY);
|
|
@@ -26,10 +27,12 @@ export function printJSON(data: unknown) {
|
|
|
26
27
|
* semantics (2 = auth, 3 = not found, 127 = command not found, …).
|
|
27
28
|
*/
|
|
28
29
|
export function fail(msg: string, exitCode = 1, code = "ERROR"): never {
|
|
30
|
+
const hint = wantsSupportHint({ code, exitCode });
|
|
29
31
|
if (jsonMode) {
|
|
30
|
-
printJSON({ error: { code, status: null, message: msg, body: null } });
|
|
32
|
+
printJSON({ error: { code, status: null, message: msg, body: null, ...(hint ? { support: SUPPORT_HINT } : {}) } });
|
|
31
33
|
} else {
|
|
32
34
|
error(msg);
|
|
35
|
+
if (hint) supportHint();
|
|
33
36
|
}
|
|
34
37
|
process.exit(exitCode);
|
|
35
38
|
}
|
|
@@ -43,6 +46,11 @@ export function error(msg: string) {
|
|
|
43
46
|
process.stderr.write(chalk.red("Error:") + " " + msg + "\n");
|
|
44
47
|
}
|
|
45
48
|
|
|
49
|
+
/** The optional one-line pointer to `lizard support open`, dim, on stderr. */
|
|
50
|
+
export function supportHint() {
|
|
51
|
+
process.stderr.write(chalk.dim(SUPPORT_HINT) + "\n");
|
|
52
|
+
}
|
|
53
|
+
|
|
46
54
|
export function warn(msg: string) {
|
|
47
55
|
process.stderr.write(chalk.yellow("Warning:") + " " + msg + "\n");
|
|
48
56
|
}
|
package/src/lib/support.ts
CHANGED
|
@@ -62,15 +62,21 @@ export function agentName(): string | undefined {
|
|
|
62
62
|
return detectAgent() ?? undefined;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
/**
|
|
66
|
-
|
|
65
|
+
/**
|
|
66
|
+
* Whether a failed command ends with the one-line support hint. Almost every error does: the hint
|
|
67
|
+
* is optional and one line, and an agent can't always tell a Lizard bug from its own mistake.
|
|
68
|
+
* Not shown for: sign-in problems (`lizard login` is the fix), cancelled prompts, `lizard support`
|
|
69
|
+
* itself, and AGENT_SUPPORT=0 (the user turned agent tickets off).
|
|
70
|
+
*/
|
|
71
|
+
export function wantsSupportHint(opts: { status?: number; code?: string; exitCode?: number } = {}): boolean {
|
|
67
72
|
if (process.env.AGENT_SUPPORT === "0") return false;
|
|
68
|
-
if (
|
|
69
|
-
|
|
73
|
+
if (process.argv.slice(2).includes("support")) return false;
|
|
74
|
+
if (opts.status === 401 || opts.code === "NOT_AUTHENTICATED" || opts.exitCode === 2) return false;
|
|
75
|
+
if (opts.exitCode === 5 || opts.exitCode === 130) return false;
|
|
76
|
+
return true;
|
|
70
77
|
}
|
|
71
78
|
|
|
72
|
-
export const SUPPORT_HINT =
|
|
73
|
-
'If this keeps failing, tell the Lizard team: lizard support open "<what you ran and what happened>" (the error above is attached automatically)';
|
|
79
|
+
export const SUPPORT_HINT = 'Lizard bug? Optional: lizard support open "<what happened>"';
|
|
74
80
|
|
|
75
81
|
interface UnreadTicket { ticket: string; subject: string; status: string; messages: Array<{ from: string; body: string; at: string }> }
|
|
76
82
|
|
package/src/lib/updater.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { join, dirname } from "node:path";
|
|
|
5
5
|
import os from "node:os";
|
|
6
6
|
import { spawn } from "node:child_process";
|
|
7
7
|
|
|
8
|
-
export const CURRENT_VERSION = "4.0.
|
|
8
|
+
export const CURRENT_VERSION = "4.0.110";
|
|
9
9
|
const RELEASES_API = "https://api.github.com/repos/lizard-build/lizard-cli/releases/latest";
|
|
10
10
|
const RELEASE_BASE = "https://github.com/lizard-build/lizard-cli/releases/latest/download";
|
|
11
11
|
|
|
@@ -49,6 +49,33 @@ describe("sandbox create timeout", () => {
|
|
|
49
49
|
});
|
|
50
50
|
|
|
51
51
|
|
|
52
|
+
describe("sandbox create size", () => {
|
|
53
|
+
beforeEach(() => {
|
|
54
|
+
vi.clearAllMocks();
|
|
55
|
+
vi.mocked(api.post).mockResolvedValue({ id: "sandbox-test" });
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it.each(["mini", "small", "medium", "large"])("sends --size %s to the API", async (size) => {
|
|
59
|
+
await create(["--size", size]);
|
|
60
|
+
expect(api.post).toHaveBeenCalledWith("/api/sandboxes", expect.objectContaining({ size }));
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("rejects an unknown size before making a request", async () => {
|
|
64
|
+
await expect(create(["--size", "tiny"])).rejects.toThrow(/mini, small, medium, large|"mini", "small", "medium", "large"/);
|
|
65
|
+
expect(api.post).not.toHaveBeenCalled();
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it("lists every size, Mini included, in the help", () => {
|
|
69
|
+
const program = new Command();
|
|
70
|
+
registerSandbox(program);
|
|
71
|
+
const createCmd = program.commands.find((c) => c.name() === "sandbox")!.commands.find((c) => c.name() === "create")!;
|
|
72
|
+
const help = createCmd.helpInformation().replace(/\s+/g, " ");
|
|
73
|
+
expect(help).toContain("mini 1 vCPU/2 GB, small 2/4, medium 4/8, large 8/16");
|
|
74
|
+
expect(help).toContain("Mini works only with the base, claude, codex and interpreter templates");
|
|
75
|
+
expect(help).toContain('(choices: "mini", "small", "medium", "large")');
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
|
|
52
79
|
describe("sandbox create without a project", () => {
|
|
53
80
|
beforeEach(() => {
|
|
54
81
|
vi.clearAllMocks();
|
|
@@ -2,7 +2,7 @@ import fs from "node:fs";
|
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
5
|
-
import {
|
|
5
|
+
import { wantsSupportHint, printSupportInbox, recordFailedCall, ticketContext } from "../../src/lib/support.js";
|
|
6
6
|
|
|
7
7
|
let home: string;
|
|
8
8
|
beforeEach(() => { home = fs.mkdtempSync(path.join(os.tmpdir(), "lz-support-")); process.env.LIZARD_HOME = home; });
|
|
@@ -42,11 +42,23 @@ describe("ticket context", () => {
|
|
|
42
42
|
expect(ctx.lastErrors[0].error).not.toContain("abcdefghijkl");
|
|
43
43
|
expect(ctx.cliVersion).toBeTruthy();
|
|
44
44
|
});
|
|
45
|
-
it("
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
it("hints on almost every error, never on sign-in, cancels, support itself or AGENT_SUPPORT=0", () => {
|
|
46
|
+
const argv = process.argv;
|
|
47
|
+
try {
|
|
48
|
+
process.argv = ["node", "lizard", "sandbox", "create"];
|
|
49
|
+
expect(wantsSupportHint({ status: 500 })).toBe(true);
|
|
50
|
+
expect(wantsSupportHint({ status: 404, exitCode: 3 })).toBe(true);
|
|
51
|
+
expect(wantsSupportHint({ status: 402 })).toBe(true);
|
|
52
|
+
expect(wantsSupportHint({ code: "ERROR", exitCode: 1 })).toBe(true);
|
|
53
|
+
expect(wantsSupportHint({ status: 401 })).toBe(false);
|
|
54
|
+
expect(wantsSupportHint({ code: "NOT_AUTHENTICATED" })).toBe(false);
|
|
55
|
+
expect(wantsSupportHint({ exitCode: 2 })).toBe(false);
|
|
56
|
+
expect(wantsSupportHint({ exitCode: 5 })).toBe(false);
|
|
57
|
+
process.env.AGENT_SUPPORT = "0";
|
|
58
|
+
expect(wantsSupportHint({ status: 500 })).toBe(false);
|
|
59
|
+
delete process.env.AGENT_SUPPORT;
|
|
60
|
+
process.argv = ["node", "lizard", "support", "open", "x"];
|
|
61
|
+
expect(wantsSupportHint({ status: 500 })).toBe(false);
|
|
62
|
+
} finally { process.argv = argv; delete process.env.AGENT_SUPPORT; }
|
|
51
63
|
});
|
|
52
64
|
});
|