UNPKG

sesterce-cli

Version:

A powerful command-line interface tool for managing Sesterce Cloud services. Sesterce CLI provides easy access to GPU cloud instances, AI inference services, container registries, and SSH key management directly from your terminal.

63 lines 2.99 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createAIInferenceInstanceStartCommand = createAIInferenceInstanceStartCommand; const list_instances_1 = require("@/modules/ai-inference/use-cases/list-instances"); const start_instance_1 = require("@/modules/ai-inference/use-cases/start-instance"); const prompts_1 = require("@inquirer/prompts"); const printInstance = (instance) => { return `${instance.name} (${instance.features.join(", ")}) | ${instance.address} | ${instance.status} | ${instance.hourlyPrice.toFixed(2)}`; }; function createAIInferenceInstanceStartCommand(aiInferenceInstanceCommand) { aiInferenceInstanceCommand .command("start") .description("Start a launched instance in Sesterce AI Inference") .option("-i, --instance-id <instanceId>", "The ID of the instance to start") .action(async (args) => { let instanceId = args.instanceId; if (!instanceId) { console.log("Loading inference instances..."); const result = await list_instances_1.listInferenceInstances.execute(); if (result.isLeft()) { console.error(result.value.message); return; } const instances = result.value; if (instances.length === 0) { console.log("No instances found"); return; } const instance = await (0, prompts_1.search)({ message: "Select an instance to start", source: async (input, { signal }) => { if (!input) { return instances.map((instance) => ({ name: printInstance(instance), value: instance, })); } return instances .filter((instance) => instance.name.toLowerCase().includes(input.toLowerCase()) || instance.address .toLowerCase() .includes(input.toLowerCase()) || instance.features.includes(input.toLowerCase()) || instance.status.toLowerCase().includes(input.toLowerCase()) || instance.name.toLowerCase().includes(input.toLowerCase()) || instance.hourlyPrice.toFixed(2).includes(input)) .map((instance) => ({ name: printInstance(instance), value: instance, })); }, }); instanceId = instance._id; } const result = await start_instance_1.startInferenceInstance.execute(instanceId); if (result.isLeft()) { console.error(result.value.message); return; } console.log("Instance started successfully"); }); } //# sourceMappingURL=start.js.map