Skip to content

Commit 0362aad

Browse files
committed
cp dines
1 parent 7555d3f commit 0362aad

24 files changed

Lines changed: 466 additions & 253 deletions

src/cli.ts

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ devbox
5454
.option("-n, --name <name>", "Devbox name")
5555
.option("-t, --template <template>", "Template to use")
5656
.option("--blueprint <blueprint>", "Blueprint ID to use")
57-
.option("--resources <size>", "Resource size (X_SMALL, SMALL, MEDIUM, LARGE, X_LARGE, XX_LARGE)")
57+
.option(
58+
"--resources <size>",
59+
"Resource size (X_SMALL, SMALL, MEDIUM, LARGE, X_LARGE, XX_LARGE)",
60+
)
5861
.option("--architecture <arch>", "Architecture (arm64, x86_64)")
5962
.option("--entrypoint <command>", "Entrypoint command to run")
6063
.option("--available-ports <ports...>", "Available ports")
@@ -171,8 +174,16 @@ devbox
171174
.description("SSH into a devbox")
172175
.option("--config-only", "Print SSH config only")
173176
.option("--no-wait", "Do not wait for devbox to be ready")
174-
.option("--timeout <seconds>", "Timeout in seconds to wait for readiness", "180")
175-
.option("--poll-interval <seconds>", "Polling interval in seconds while waiting", "3")
177+
.option(
178+
"--timeout <seconds>",
179+
"Timeout in seconds to wait for readiness",
180+
"180",
181+
)
182+
.option(
183+
"--poll-interval <seconds>",
184+
"Polling interval in seconds while waiting",
185+
"3",
186+
)
176187
.option(
177188
"-o, --output [format]",
178189
"Output format: text|json|yaml (default: interactive)",
@@ -252,7 +263,10 @@ devbox
252263
.command("download <id>")
253264
.description("Download a file from a devbox")
254265
.option("--file-path <path>", "Path to the file in the devbox")
255-
.option("--output-path <path>", "Local path where to save the downloaded file")
266+
.option(
267+
"--output-path <path>",
268+
"Local path where to save the downloaded file",
269+
)
256270
.option(
257271
"-o, --output-format [format]",
258272
"Output format: text|json|yaml (default: interactive)",
@@ -394,7 +408,10 @@ blueprint
394408
.option("--dockerfile <content>", "Dockerfile contents")
395409
.option("--dockerfile-path <path>", "Dockerfile path")
396410
.option("--system-setup-commands <commands...>", "System setup commands")
397-
.option("--resources <size>", "Resource size (X_SMALL, SMALL, MEDIUM, LARGE, X_LARGE, XX_LARGE)")
411+
.option(
412+
"--resources <size>",
413+
"Resource size (X_SMALL, SMALL, MEDIUM, LARGE, X_LARGE, XX_LARGE)",
414+
)
398415
.option("--architecture <arch>", "Architecture (arm64, x86_64)")
399416
.option("--available-ports <ports...>", "Available ports")
400417
.option("--root", "Run as root")
@@ -413,7 +430,10 @@ blueprint
413430
.description("Preview blueprint before creation")
414431
.option("--dockerfile <content>", "Dockerfile contents")
415432
.option("--system-setup-commands <commands...>", "System setup commands")
416-
.option("--resources <size>", "Resource size (X_SMALL, SMALL, MEDIUM, LARGE, X_LARGE, XX_LARGE)")
433+
.option(
434+
"--resources <size>",
435+
"Resource size (X_SMALL, SMALL, MEDIUM, LARGE, X_LARGE, XX_LARGE)",
436+
)
417437
.option("--architecture <arch>", "Architecture (arm64, x86_64)")
418438
.option("--available-ports <ports...>", "Available ports")
419439
.option("--root", "Run as root")
@@ -423,7 +443,9 @@ blueprint
423443
"Output format: text|json|yaml (default: interactive)",
424444
)
425445
.action(async (name, options) => {
426-
const { previewBlueprint } = await import("./commands/blueprint/preview.js");
446+
const { previewBlueprint } = await import(
447+
"./commands/blueprint/preview.js"
448+
);
427449
await previewBlueprint({ name, ...options });
428450
});
429451

@@ -499,7 +521,11 @@ object
499521
.command("download <id> <path>")
500522
.description("Download object to local file")
501523
.option("--extract", "Extract downloaded archive after download")
502-
.option("--duration-seconds <seconds>", "Duration in seconds for the presigned URL validity", "3600")
524+
.option(
525+
"--duration-seconds <seconds>",
526+
"Duration in seconds for the presigned URL validity",
527+
"3600",
528+
)
503529
.option(
504530
"-o, --output [format]",
505531
"Output format: text|json|yaml (default: interactive)",
@@ -513,7 +539,10 @@ object
513539
.command("upload <path>")
514540
.description("Upload a file as an object")
515541
.option("--name <name>", "Object name (required)")
516-
.option("--content-type <type>", "Content type: unspecified|text|binary|gzip|tar|tgz")
542+
.option(
543+
"--content-type <type>",
544+
"Content type: unspecified|text|binary|gzip|tar|tgz",
545+
)
517546
.option("--public", "Make object publicly accessible")
518547
.option(
519548
"-o, --output [format]",

src/commands/blueprint/create.tsx

Lines changed: 42 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@ const CreateBlueprintUI: React.FC<{
3333
availablePorts?: string[];
3434
root?: boolean;
3535
user?: string;
36-
}> = ({
37-
name,
38-
dockerfile,
39-
dockerfilePath,
40-
systemSetupCommands,
41-
resources,
42-
architecture,
43-
availablePorts,
44-
root,
45-
user
36+
}> = ({
37+
name,
38+
dockerfile,
39+
dockerfilePath,
40+
systemSetupCommands,
41+
resources,
42+
architecture,
43+
availablePorts,
44+
root,
45+
user,
4646
}) => {
4747
const [loading, setLoading] = React.useState(true);
4848
const [result, setResult] = React.useState<any>(null);
@@ -52,7 +52,7 @@ const CreateBlueprintUI: React.FC<{
5252
const createBlueprint = async () => {
5353
try {
5454
const client = getClient();
55-
55+
5656
// Read dockerfile from file if path is provided
5757
let dockerfileContents = dockerfile;
5858
if (dockerfilePath) {
@@ -80,7 +80,9 @@ const CreateBlueprintUI: React.FC<{
8080
launch_parameters: {
8181
resource_size_request: resources as any,
8282
architecture: architecture as any,
83-
available_ports: availablePorts?.map(port => parseInt(port, 10)) as any,
83+
available_ports: availablePorts?.map((port) =>
84+
parseInt(port, 10),
85+
) as any,
8486
user_parameters: userParameters,
8587
},
8688
});
@@ -94,7 +96,17 @@ const CreateBlueprintUI: React.FC<{
9496
};
9597

9698
createBlueprint();
97-
}, [name, dockerfile, dockerfilePath, systemSetupCommands, resources, architecture, availablePorts, root, user]);
99+
}, [
100+
name,
101+
dockerfile,
102+
dockerfilePath,
103+
systemSetupCommands,
104+
resources,
105+
architecture,
106+
availablePorts,
107+
root,
108+
user,
109+
]);
98110

99111
return (
100112
<>
@@ -119,7 +131,7 @@ export async function createBlueprint(options: CreateBlueprintOptions) {
119131
await executor.executeAction(
120132
async () => {
121133
const client = executor.getClient();
122-
134+
123135
// Read dockerfile from file if path is provided
124136
let dockerfileContents = options.dockerfile;
125137
if (options.dockerfilePath) {
@@ -147,21 +159,25 @@ export async function createBlueprint(options: CreateBlueprintOptions) {
147159
launch_parameters: {
148160
resource_size_request: options.resources as any,
149161
architecture: options.architecture as any,
150-
available_ports: options.availablePorts?.map(port => parseInt(port, 10)) as any,
162+
available_ports: options.availablePorts?.map((port) =>
163+
parseInt(port, 10),
164+
) as any,
151165
user_parameters: userParameters,
152166
},
153167
});
154168
},
155-
() => <CreateBlueprintUI
156-
name={options.name}
157-
dockerfile={options.dockerfile}
158-
dockerfilePath={options.dockerfilePath}
159-
systemSetupCommands={options.systemSetupCommands}
160-
resources={options.resources}
161-
architecture={options.architecture}
162-
availablePorts={options.availablePorts}
163-
root={options.root}
164-
user={options.user}
165-
/>,
169+
() => (
170+
<CreateBlueprintUI
171+
name={options.name}
172+
dockerfile={options.dockerfile}
173+
dockerfilePath={options.dockerfilePath}
174+
systemSetupCommands={options.systemSetupCommands}
175+
resources={options.resources}
176+
architecture={options.architecture}
177+
availablePorts={options.availablePorts}
178+
root={options.root}
179+
user={options.user}
180+
/>
181+
),
166182
);
167183
}

src/commands/blueprint/logs.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,19 @@ const BlueprintLogsUI: React.FC<{
4040
return (
4141
<>
4242
<Banner />
43-
{loading && <SpinnerComponent message="Fetching blueprint build logs..." />}
43+
{loading && (
44+
<SpinnerComponent message="Fetching blueprint build logs..." />
45+
)}
4446
{result && (
4547
<Box flexDirection="column">
4648
<Text color={colors.primary}>Blueprint Build Logs:</Text>
4749
{result.logs && result.logs.length > 0 ? (
4850
result.logs.map((log: any, index: number) => (
4951
<Box key={index} marginLeft={2}>
5052
<Text color={colors.textDim}>
51-
{log.timestampMs ? new Date(log.timestampMs).toISOString() : ""}
53+
{log.timestampMs
54+
? new Date(log.timestampMs).toISOString()
55+
: ""}
5256
</Text>
5357
<Text color={colors.textDim}> [{log.level}]</Text>
5458
<Text> {log.message}</Text>

src/commands/blueprint/preview.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,12 @@ export async function previewBlueprint(options: PreviewBlueprintOptions) {
7474
system_setup_commands: options.systemSetupCommands,
7575
});
7676
},
77-
() => <PreviewBlueprintUI
78-
name={options.name}
79-
dockerfile={options.dockerfile}
80-
systemSetupCommands={options.systemSetupCommands}
81-
/>,
77+
() => (
78+
<PreviewBlueprintUI
79+
name={options.name}
80+
dockerfile={options.dockerfile}
81+
systemSetupCommands={options.systemSetupCommands}
82+
/>
83+
),
8284
);
8385
}

src/commands/devbox/download.tsx

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ const DownloadFileUI: React.FC<{
2929
const downloadFile = async () => {
3030
try {
3131
const client = getClient();
32-
const result = await client.devboxes.downloadFile(devboxId, { path: filePath });
32+
const result = await client.devboxes.downloadFile(devboxId, {
33+
path: filePath,
34+
});
3335
// The result should contain the file contents, write them to the output path
3436
writeFileSync(outputPath, result as any);
3537
setResult({ filePath, outputPath });
@@ -46,7 +48,9 @@ const DownloadFileUI: React.FC<{
4648
return (
4749
<>
4850
<Banner />
49-
{loading && <SpinnerComponent message="Downloading file from devbox..." />}
51+
{loading && (
52+
<SpinnerComponent message="Downloading file from devbox..." />
53+
)}
5054
{result && (
5155
<SuccessMessage
5256
message="File downloaded successfully"
@@ -66,13 +70,21 @@ export async function downloadFile(devboxId: string, options: DownloadOptions) {
6670
await executor.executeAction(
6771
async () => {
6872
const client = executor.getClient();
69-
const result = await client.devboxes.downloadFile(devboxId, { path: options.filePath });
73+
const result = await client.devboxes.downloadFile(devboxId, {
74+
path: options.filePath,
75+
});
7076
writeFileSync(options.outputPath, result as any);
7177
return {
7278
filePath: options.filePath,
73-
outputPath: options.outputPath
79+
outputPath: options.outputPath,
7480
};
7581
},
76-
() => <DownloadFileUI devboxId={devboxId} filePath={options.filePath} outputPath={options.outputPath} />,
82+
() => (
83+
<DownloadFileUI
84+
devboxId={devboxId}
85+
filePath={options.filePath}
86+
outputPath={options.outputPath}
87+
/>
88+
),
7789
);
7890
}

src/commands/devbox/exec.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ interface ExecCommandOptions {
5757
output?: string;
5858
}
5959

60-
export async function execCommand(id: string, command: string[], options: ExecCommandOptions = {}) {
60+
export async function execCommand(
61+
id: string,
62+
command: string[],
63+
options: ExecCommandOptions = {},
64+
) {
6165
const executor = createExecutor({ output: options.output });
6266

6367
await executor.executeAction(
@@ -67,9 +71,10 @@ export async function execCommand(id: string, command: string[], options: ExecCo
6771
command: command.join(" "),
6872
});
6973
return {
70-
result: result.stdout || result.stderr || "Command executed successfully",
74+
result:
75+
result.stdout || result.stderr || "Command executed successfully",
7176
};
7277
},
73-
() => <ExecCommandUI id={id} command={command} />
78+
() => <ExecCommandUI id={id} command={command} />,
7479
);
7580
}

src/commands/devbox/execAsync.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ const ExecAsyncUI: React.FC<{
2828
const execAsync = async () => {
2929
try {
3030
const client = getClient();
31-
const execution = await client.devboxes.executeAsync(devboxId, {
31+
const execution = await client.devboxes.executeAsync(devboxId, {
3232
command,
33-
shell_name: shellName || undefined
33+
shell_name: shellName || undefined,
3434
});
3535
setResult(execution);
3636
} catch (err) {
@@ -66,11 +66,17 @@ export async function execAsync(devboxId: string, options: ExecAsyncOptions) {
6666
await executor.executeAction(
6767
async () => {
6868
const client = executor.getClient();
69-
return client.devboxes.executeAsync(devboxId, {
69+
return client.devboxes.executeAsync(devboxId, {
7070
command: options.command,
71-
shell_name: options.shellName || undefined
71+
shell_name: options.shellName || undefined,
7272
});
7373
},
74-
() => <ExecAsyncUI devboxId={devboxId} command={options.command} shellName={options.shellName} />,
74+
() => (
75+
<ExecAsyncUI
76+
devboxId={devboxId}
77+
command={options.command}
78+
shellName={options.shellName}
79+
/>
80+
),
7581
);
7682
}

src/commands/devbox/get.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ const GetDevboxUI: React.FC<{
4646
details={`ID: ${result.id}\nStatus: ${result.status}\nCreated: ${new Date(result.createdAt).toLocaleString()}`}
4747
/>
4848
)}
49-
{error && (
50-
<ErrorMessage message="Failed to get devbox" error={error} />
51-
)}
49+
{error && <ErrorMessage message="Failed to get devbox" error={error} />}
5250
</>
5351
);
5452
};

0 commit comments

Comments
 (0)