@lizard-build/cli 4.0.122 → 4.0.124
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/commands/sandbox.js +1 -1
- package/dist/commands/sandbox.js.map +1 -1
- package/dist/commands/up.d.ts +15 -0
- package/dist/commands/up.js +7 -5
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/volume.js +3 -2
- package/dist/commands/volume.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/updater.d.ts +1 -1
- package/dist/lib/updater.js +1 -1
- package/package.json +1 -1
- package/skill-data/core/SKILL.md +1 -1
- package/skill-data/core/references/deploys.md +2 -1
- package/skill-data/core/references/sandboxes.md +3 -3
- package/src/commands/sandbox.ts +1 -1
- package/src/commands/up.ts +6 -3
- package/src/commands/volume.ts +3 -2
- package/src/lib/updater.ts +1 -1
- package/test/unit/up-region.test.ts +58 -0
- package/test/unit/volume-size.test.ts +1 -1
|
@@ -77,7 +77,7 @@ lizard sandbox files rm <id> <path>
|
|
|
77
77
|
| Size | vCPU | RAM | Disk | Price |
|
|
78
78
|
|---|---|---|---|---|
|
|
79
79
|
| `nano` | 0.5 | 1 GiB | 5 GB | $0.00405/h |
|
|
80
|
-
| `mini` | 1 | 2 GiB |
|
|
80
|
+
| `mini` | 1 | 2 GiB | 10 GB | $0.0081/h |
|
|
81
81
|
| `small` | 2 | 4 GiB | 20 GB | $0.0162/h |
|
|
82
82
|
| `medium` (default) | 4 | 8 GiB | 40 GB | $0.0324/h |
|
|
83
83
|
| `large` | 8 | 16 GiB | 80 GB | $0.0648/h |
|
|
@@ -86,7 +86,7 @@ Mini has no warm pool, so it starts only from templates with a disk-only build:
|
|
|
86
86
|
|
|
87
87
|
Nano is half a vCPU: the sandbox sees 1 CPU (`nproc` says 1) but gets at most half a core of time, so CPU-bound work takes about twice as long as on Mini (the rest shows as steal time). It suits an idle shell or a coding agent waiting on a model. Nano starts only from `base`, `claude` and `codex`; any other template answers 400 `SANDBOX_SIZE_NOT_ALLOWED` with `templates`.
|
|
88
88
|
|
|
89
|
-
Disk is the sandbox's root file system (`/`): its home directory, `/workspace` and everything it installs share it (a volume, if attached, mounts over `/workspace`). `df -h` prints GiB, so it shows about 4.7G /
|
|
89
|
+
Disk is the sandbox's root file system (`/`): its home directory, `/workspace` and everything it installs share it (a volume, if attached, mounts over `/workspace`). `df -h` prints GiB, so it shows about 4.7G / 9.4G / 18.8G / 37.6G / 75.2G for `nano` / `mini` / `small` / `medium` / `large`. A sandbox restored from a snapshot keeps at least its snapshot's disk.
|
|
90
90
|
|
|
91
91
|
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)).
|
|
92
92
|
|
|
@@ -190,7 +190,7 @@ Use `lizard volume create <name> --size <gb> --project <project>` for persistent
|
|
|
190
190
|
Persistent volumes for sandboxes. A volume's name is its key within the project; every command takes a name or ID.
|
|
191
191
|
|
|
192
192
|
```
|
|
193
|
-
lizard volume create <name> [--size <gb>] [--region <code>] # default 5 GB; a sandbox with --volume starts in its region
|
|
193
|
+
lizard volume create <name> [--size <gb>] [--region <code>] # default 5 GB in us-east-1; a sandbox with --volume starts in its region
|
|
194
194
|
lizard volume list --json # name, sizeGb, status, attachedTo
|
|
195
195
|
lizard volume resize <name> --size <gb> # grow in place
|
|
196
196
|
lizard volume rm <name> [-y] # refused while attached; delete the sandbox first
|
package/src/commands/sandbox.ts
CHANGED
|
@@ -30,7 +30,7 @@ const TEMPLATE_HINT = "base, interpreter, codex, claude, opencode, pi, prime, de
|
|
|
30
30
|
// held to 50% of a core) only from NANO_TEMPLATES. The server answers SANDBOX_SIZE_NOT_ALLOWED
|
|
31
31
|
// for any other template.
|
|
32
32
|
const SANDBOX_SIZES = ["nano", "mini", "small", "medium", "large"] as const;
|
|
33
|
-
const SIZE_HINT = "nano 0.5 vCPU/1 GB RAM/5 GB disk, mini 1/2/
|
|
33
|
+
const SIZE_HINT = "nano 0.5 vCPU/1 GB RAM/5 GB disk, mini 1/2/10, small 2/4/20, medium 4/8/40, large 8/16/80";
|
|
34
34
|
const MINI_TEMPLATES = "base, claude, codex and interpreter";
|
|
35
35
|
const NANO_TEMPLATES = "base, claude and codex";
|
|
36
36
|
|
package/src/commands/up.ts
CHANGED
|
@@ -48,7 +48,7 @@ export function registerUp(program: Command) {
|
|
|
48
48
|
.option("-s, --service <name>", "Service to deploy to (defaults to linked)")
|
|
49
49
|
.option("-p, --project <id>", "Project name, slug, or ID")
|
|
50
50
|
.option("--no-gitignore", "Don't ignore paths from .gitignore")
|
|
51
|
-
.option("--region <code>",
|
|
51
|
+
.option("--region <code>", `Region to create the service in (default ${DEFAULT_REGION}; new services only)`)
|
|
52
52
|
.option("--build-command <cmd>", "Build command to run (e.g. 'npm run build')")
|
|
53
53
|
.option("--start-command <cmd>", "Start command to run (e.g. 'node dist/index.js')")
|
|
54
54
|
.option("--pre-deploy-command <cmd>", "Pre-deploy command (e.g. 'node dist/migrate.js')")
|
|
@@ -125,7 +125,7 @@ export function registerUp(program: Command) {
|
|
|
125
125
|
|
|
126
126
|
// ── deploy strategies ────────────────────────────────────────────────────────
|
|
127
127
|
|
|
128
|
-
async function deployFromLocal(args: {
|
|
128
|
+
export async function deployFromLocal(args: {
|
|
129
129
|
projectId: string;
|
|
130
130
|
scope: ResourceScope;
|
|
131
131
|
targetPath: string;
|
|
@@ -174,7 +174,10 @@ async function deployFromLocal(args: {
|
|
|
174
174
|
if (resolvedPort !== undefined) qs.set("port", String(resolvedPort));
|
|
175
175
|
if (!args.existingServiceId) {
|
|
176
176
|
qs.set("name", appName);
|
|
177
|
-
|
|
177
|
+
// No --region: us-east-1, like sandbox create and add. Leaving it out let the
|
|
178
|
+
// platform pick the region of whichever server answered, and DNS sends
|
|
179
|
+
// European users to the EU one.
|
|
180
|
+
qs.set("region", args.region || DEFAULT_REGION);
|
|
178
181
|
// New services with no detected port default to 3000
|
|
179
182
|
if (resolvedPort === undefined) qs.set("port", "3000");
|
|
180
183
|
}
|
package/src/commands/volume.ts
CHANGED
|
@@ -3,6 +3,7 @@ import * as p from "@clack/prompts";
|
|
|
3
3
|
import { Command } from "commander";
|
|
4
4
|
import { api, withScope, type ResourceScope } from "../lib/api.js";
|
|
5
5
|
import { assertValidVolumeName, resolveVolume, type VolumeRecord } from "../lib/volume.js";
|
|
6
|
+
import { DEFAULT_REGION } from "../lib/config.js";
|
|
6
7
|
import { resolveProjectScope, resolveService } from "../lib/resolve.js";
|
|
7
8
|
import { success, info, warn, isJSONMode, printJSON, table, isTTY } from "../lib/format.js";
|
|
8
9
|
|
|
@@ -82,7 +83,7 @@ export function registerVolume(program: Command) {
|
|
|
82
83
|
.argument("<name>", "Volume name")
|
|
83
84
|
.description("Create a persistent volume for sandboxes, or create one and attach it to a service with --service")
|
|
84
85
|
.option("--size <gb>", "Size in GB (server limits apply; default 5)", parseIntOption)
|
|
85
|
-
.option("--region <code>",
|
|
86
|
+
.option("--region <code>", `Region to place the volume in (default ${DEFAULT_REGION}; must match the sandbox that will attach it)`)
|
|
86
87
|
.option("-s, --service <name>", "Attach it to this service instead (one volume per service; files there survive restarts and redeploys)")
|
|
87
88
|
.option("--mount-path <path>", "With --service: where the service sees it (default /data)")
|
|
88
89
|
.option("-p, --project <id>", "Project name, slug, or ID")
|
|
@@ -111,7 +112,7 @@ export function registerVolume(program: Command) {
|
|
|
111
112
|
if (!isJSONMode()) info(`Creating volume ${chalk.cyan(name)}...`);
|
|
112
113
|
const created = await api.post<VolumeRecord>(
|
|
113
114
|
withScope(`/api/projects/${projectId}/volumes`, scope),
|
|
114
|
-
{ name, sizeGb, region: opts.region },
|
|
115
|
+
{ name, sizeGb, region: opts.region || DEFAULT_REGION },
|
|
115
116
|
);
|
|
116
117
|
|
|
117
118
|
if (isJSONMode()) {
|
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.124";
|
|
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
|
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
5
|
+
|
|
6
|
+
vi.mock("../../src/lib/auth.js", async (importOriginal) => {
|
|
7
|
+
const actual = await importOriginal<typeof import("../../src/lib/auth.js")>();
|
|
8
|
+
return { ...actual, getToken: () => "token" };
|
|
9
|
+
});
|
|
10
|
+
import { deployFromLocal } from "../../src/commands/up.js";
|
|
11
|
+
import { setJSONMode } from "../../src/lib/format.js";
|
|
12
|
+
|
|
13
|
+
describe("up region", () => {
|
|
14
|
+
let dir: string;
|
|
15
|
+
let urls: URL[];
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
dir = fs.mkdtempSync(path.join(os.tmpdir(), "lz-up-"));
|
|
18
|
+
fs.writeFileSync(path.join(dir, "index.js"), "console.log(1)\n");
|
|
19
|
+
process.env.LIZARD_HOME = dir;
|
|
20
|
+
urls = [];
|
|
21
|
+
vi.stubGlobal("fetch", vi.fn(async (url: string) => {
|
|
22
|
+
urls.push(new URL(url));
|
|
23
|
+
return new Response(JSON.stringify({ id: "a1", name: "svc" }), { status: 201 });
|
|
24
|
+
}));
|
|
25
|
+
setJSONMode(true);
|
|
26
|
+
vi.spyOn(process.stdout, "write").mockImplementation(() => true);
|
|
27
|
+
});
|
|
28
|
+
afterEach(() => {
|
|
29
|
+
vi.unstubAllGlobals();
|
|
30
|
+
vi.restoreAllMocks();
|
|
31
|
+
setJSONMode(false);
|
|
32
|
+
delete process.env.LIZARD_HOME;
|
|
33
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const deploy = (extra: { region?: string; existingServiceId?: string }) =>
|
|
37
|
+
deployFromLocal({
|
|
38
|
+
projectId: "p1", scope: {}, targetPath: dir, useGitignore: false, serviceFlag: "svc",
|
|
39
|
+
existingServiceId: undefined, region: undefined, opts: { detach: true }, ...extra,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it("creates a new service in us-east-1 when no --region is given", async () => {
|
|
43
|
+
await deploy({});
|
|
44
|
+
expect(urls[0].pathname).toBe("/api/projects/p1/apps/upload");
|
|
45
|
+
expect(urls[0].searchParams.get("region")).toBe("us-east-1");
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it("keeps an explicit --region", async () => {
|
|
49
|
+
await deploy({ region: "eu-west-lim-a" });
|
|
50
|
+
expect(urls[0].searchParams.get("region")).toBe("eu-west-lim-a");
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it("sends no region when uploading to an existing service", async () => {
|
|
54
|
+
await deploy({ existingServiceId: "a1" });
|
|
55
|
+
expect(urls[0].searchParams.get("appId")).toBe("a1");
|
|
56
|
+
expect(urls[0].searchParams.has("region")).toBe(false);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
@@ -35,7 +35,7 @@ describe('volume create size', () => {
|
|
|
35
35
|
it('uses server defaults and workspace scope', async () => {
|
|
36
36
|
await create();
|
|
37
37
|
expect(api.get).toHaveBeenCalledWith('/api/projects/p1/volume-limits?workspaceId=w1');
|
|
38
|
-
expect(api.post).toHaveBeenCalledWith('/api/projects/p1/volumes?workspaceId=w1', { name: 'cache', sizeGb: 5, region:
|
|
38
|
+
expect(api.post).toHaveBeenCalledWith('/api/projects/p1/volumes?workspaceId=w1', { name: 'cache', sizeGb: 5, region: 'us-east-1' });
|
|
39
39
|
});
|
|
40
40
|
it('accepts the boundary and follows a changed limit', async () => {
|
|
41
41
|
await create('50');
|