Select the types of activity you want to include in your feed.
Guard service start and add service CLI
Skip starting a service when the sandbox status is not RUNNING; log an info message and return. Add CLI command stubs for services (create/list/start/stop/restart/delete) and register them in the CLI.
···7575 return service;
7676 });
77777878+ if (record.status !== "RUNNING") {
7979+ consola.info("Sandbox is not running, skipping service start", {
8080+ sandboxId: record.id,
8181+ serviceId: service.id,
8282+ status: record.status,
8383+ });
8484+ return;
8585+ }
8686+7887 // start service
7988 const sandbox =
8089 record.provider === Providers.CLOUDFLARE
+11
apps/cli/src/cmd/service.ts
···11+export async function createService() {}
22+33+export async function listServices() {}
44+55+export async function restartService() {}
66+77+export async function startService() {}
88+99+export async function stopService() {}
1010+1111+export async function deleteService() {}
+50
apps/cli/src/index.ts
···2323import { c } from "./theme";
2424import { exposeVscode } from "./cmd/vscode";
2525import { exec } from "./cmd/exec";
2626+import {
2727+ createService,
2828+ deleteService,
2929+ listServices,
3030+ restartService,
3131+ startService,
3232+ stopService,
3333+} from "./cmd/service";
26342735const program = new Command();
2836···299307 .argument("<sandbox>", "the sandbox to get the Tailscale Auth Key from")
300308 .description("get a Tailscale Auth Key (redacted) from the given sandbox")
301309 .action(getTailscaleAuthKey);
310310+311311+const service = program.command("service").description("manage services");
312312+313313+service
314314+ .command("create")
315315+ .argument("<sandbox>", "the sandbox to create the service in")
316316+ .argument("<name>", "the name of the service")
317317+ .argument("<command...>", "the command to run for the service")
318318+ .description("create a new service in the given sandbox")
319319+ .action(createService);
320320+321321+service
322322+ .command("list")
323323+ .aliases(["ls"])
324324+ .argument("<sandbox>", "the sandbox to list services for")
325325+ .description("list services in the given sandbox")
326326+ .action(listServices);
327327+328328+service
329329+ .command("delete")
330330+ .aliases(["rm", "remove"])
331331+ .argument("<service_id>", "the ID of the service to delete")
332332+ .description("delete a service")
333333+ .action(deleteService);
334334+335335+service
336336+ .command("start")
337337+ .argument("<service_id>", "the ID of the service to start")
338338+ .description("start a service")
339339+ .action(startService);
340340+341341+service
342342+ .command("stop")
343343+ .argument("<service_id>", "the ID of the service to stop")
344344+ .description("stop a service")
345345+ .action(stopService);
346346+347347+service
348348+ .command("restart")
349349+ .argument("<service_id>", "the ID of the service to restart")
350350+ .description("restart a service")
351351+ .action(restartService);
302352303353if (process.argv.length <= 2) {
304354 program.help();