fabro/apps/fabro-web/app/lib/environment-providers.ts
Scott Werner 7c261f2ae6 Move environment provider helpers into a lib module
Importing them from the environment form component pulled headlessui
Disclosure into the automation form, which the automations-new test mocks
without it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-30 12:30:58 -04:00

19 lines
856 B
TypeScript

import { EnvironmentProvider, type Environment } from "@qltysh/fabro-api-client";
// Providers a managed environment can be created with. `local` is a reserved,
// in-memory environment, never a managed-environment provider, so it is never
// offered. The provider is fixed at creation time and cannot be changed.
export const CREATABLE_PROVIDERS = [
EnvironmentProvider.DOCKER,
EnvironmentProvider.DAYTONA,
] as const;
// Whether a server-managed environment can back Git-targeted work such as
// automations: only the clone-based (creatable) providers qualify.
export function isCloneBasedEnvironment(environment: Environment): boolean {
return (CREATABLE_PROVIDERS as readonly string[]).includes(environment.provider);
}
export function providerLabel(provider: string): string {
return provider.charAt(0).toUpperCase() + provider.slice(1);
}