diff --git a/src/lib/nodes/create.ts b/src/lib/nodes/create.ts index 7294dcd..51f35e1 100644 --- a/src/lib/nodes/create.ts +++ b/src/lib/nodes/create.ts @@ -21,7 +21,6 @@ import { import { handleNodesError, nodesClient } from "../../nodesClient.ts"; import { getPricePerGpuHourFromQuote, getQuote } from "../buy/index.tsx"; import { GPUS_PER_NODE } from "../constants.ts"; -import { isFeatureEnabled } from "../posthog.ts"; import { createNodesTable, durationOption, @@ -130,6 +129,12 @@ const create = new Command("create") } }), ) + .addOption( + new Option( + "-i, --image ", + "ID of the VM image to boot on the nodes. View available images with `sf node images list`.", + ), + ) .addOption(yesOption) .addOption(jsonOption) .hook("preAction", (command) => { @@ -492,18 +497,4 @@ async function createNodesAction( } } -// Remove this once the feature flag is enabled by default -export async function addCreate(program: Command) { - const imagesEnabled = await isFeatureEnabled("custom-vm-images"); - if (imagesEnabled) { - create.addOption( - new Option( - "-i, --image ", - "ID of the VM image to boot on the nodes. View available images with `sf node images list`.", - ), - ); - } - program.addCommand(create); -} - export default create; diff --git a/src/lib/nodes/image/index.ts b/src/lib/nodes/image/index.ts index 92fc06f..6f79ab2 100644 --- a/src/lib/nodes/image/index.ts +++ b/src/lib/nodes/image/index.ts @@ -1,5 +1,4 @@ import { Command } from "@commander-js/extra-typings"; -import { isFeatureEnabled } from "../../posthog.ts"; import list from "./list.tsx"; import show from "./show.tsx"; import upload from "./upload.ts"; @@ -30,11 +29,4 @@ Examples:\n image.help(); }); -export async function addImage(program: Command) { - const imagesEnabled = await isFeatureEnabled("custom-vm-images"); - if (imagesEnabled) { - program.addCommand(image); - } -} - export default image; diff --git a/src/lib/nodes/index.ts b/src/lib/nodes/index.ts index 29c3e18..3644696 100644 --- a/src/lib/nodes/index.ts +++ b/src/lib/nodes/index.ts @@ -1,19 +1,19 @@ import console from "node:console"; import type { Command } from "@commander-js/extra-typings"; -import { addCreate } from "./create.ts"; +import create from "./create.ts"; import deleteCommand from "./delete.ts"; import extend from "./extend.ts"; import get from "./get.tsx"; -import { addImage } from "./image/index.ts"; +import image from "./image/index.ts"; import list from "./list.tsx"; import logs from "./logs.ts"; -import { addRedeploy } from "./redeploy.ts"; +import redeploy from "./redeploy.ts"; import release from "./release.ts"; import set from "./set.ts"; import ssh from "./ssh.ts"; -export async function registerNodes(program: Command) { +export function registerNodes(program: Command) { const nodes = program .command("nodes") .alias("node") @@ -21,16 +21,15 @@ export async function registerNodes(program: Command) { .description("Manage compute nodes") .addCommand(list) .addCommand(get) + .addCommand(create) .addCommand(extend) .addCommand(release) .addCommand(deleteCommand) + .addCommand(redeploy) .addCommand(set) .addCommand(ssh) - .addCommand(logs); - - await addImage(nodes); - await addCreate(nodes); - await addRedeploy(nodes); + .addCommand(logs) + .addCommand(image); const baseHelpText = nodes.helpInformation(); diff --git a/src/lib/nodes/redeploy.ts b/src/lib/nodes/redeploy.ts index bff3ddb..1212a75 100644 --- a/src/lib/nodes/redeploy.ts +++ b/src/lib/nodes/redeploy.ts @@ -8,7 +8,6 @@ import chalk from "chalk"; import ora from "ora"; import { handleNodesError, nodesClient } from "../../nodesClient.ts"; -import { isFeatureEnabled } from "../posthog.ts"; import { createNodesTable, jsonOption, @@ -50,6 +49,12 @@ const redeploy = new Command("redeploy") "If set, any configuration left empty will be cleared in the new VM (default: inherits from current VM)", ), ) + .addOption( + new Option( + "-i, --image ", + "ID of the VM image to use for the new VM (inherits from current VM if not specified)", + ), + ) .addOption(yesOption) .addOption(jsonOption) .addHelpText( @@ -288,18 +293,4 @@ async function redeployNodeAction( } } -// Remove this once the feature flag is enabled by default -export async function addRedeploy(program: Command) { - const imagesEnabled = await isFeatureEnabled("custom-vm-images"); - if (imagesEnabled) { - redeploy.addOption( - new Option( - "-i, --image ", - "ID of the VM image to use for the new VM (inherits from current VM if not specified)", - ), - ); - } - program.addCommand(redeploy); -} - export default redeploy; diff --git a/src/lib/posthog.ts b/src/lib/posthog.ts index addd8d4..d4a88e2 100644 --- a/src/lib/posthog.ts +++ b/src/lib/posthog.ts @@ -62,7 +62,7 @@ const trackEvent = ({ } }; -type FeatureFlags = "procurements" | "zones" | "custom-vm-images"; +type FeatureFlags = "procurements" | "zones"; /** * Checks if a feature is enabled for the current user. diff --git a/src/lib/vm/index.ts b/src/lib/vm/index.ts index 60b69e6..43cbf86 100644 --- a/src/lib/vm/index.ts +++ b/src/lib/vm/index.ts @@ -3,7 +3,7 @@ import type { Command } from "@commander-js/extra-typings"; import boxen from "boxen"; import chalk from "chalk"; import { nodesClient } from "../../nodesClient.ts"; -import { addImage } from "../nodes/image/index.ts"; +import image from "../nodes/image/index.ts"; import { pluralizeNodes } from "../nodes/utils.ts"; import list from "./list.ts"; import logs from "./logs.ts"; @@ -62,8 +62,9 @@ export async function registerVM(program: Command) { registerSsh(vm); - vm.addCommand(list).addCommand(logs).addCommand(replace).addCommand(script); - - // Add images command if feature flag is enabled - await addImage(vm); + vm.addCommand(list) + .addCommand(logs) + .addCommand(replace) + .addCommand(script) + .addCommand(image); }