Skip to main content

Environments API

Environments API

import { CodeBoltClient } from '@codebolt/clientsdk';

const client = new CodeBoltClient();

Quick Reference​

MethodDescription
createEnvironmentCreates a new development environment.
createInstalledProviderRegisters a new installed environment provider.
deleteEnvironmentDeletes an environment.
deleteInstalledProviderDeletes an installed environment provider.
getDiffFilesRetrieves diff files for an environment.
getEnvironmentRetrieves a specific environment by its ID.
getFullProjectRetrieves the complete project file structure from an environment.
getInstalledProviderRetrieves a specific installed provider by its ID.
getLocalProvidersRetrieves the list of available local environment providers.
getProviderStatusRetrieves the current provider status for an environment.
getRunningProvidersRetrieves all currently running environment providers.
installProviderInstalls a new environment provider from a remote source.
listEnvironmentsLists all environments.
listInstalledProvidersLists all installed environment providers.
mergePatchMerges a patch into the environment's project files.
readFileReads a file from within an environment.
restartEnvironmentRestarts an environment.
sendPullRequestSends a pull request from the environment's current state.
setDefaultProviderSets an installed provider as the system default.
startEnvironmentStarts an environment.
startProviderStarts the underlying provider for an environment.
stopEnvironmentStops a running environment.
stopProviderStops the underlying provider for an environment.
updateEnvironmentUpdates an existing environment's configuration.
updateInstalledProviderUpdates the configuration of an installed provider.
writeFileWrites a file to an environment's filesystem.

Methods​


createEnvironment​

client.environments.createEnvironment(data: CreateEnvironmentRequest): Promise<Environment>

Creates a new development environment.

Provisions a new environment using the specified provider and configuration. The environment can then be started, stopped, and managed through other methods.

ParameterTypeRequiredDescription
dataCreateEnvironmentRequestYesEnvironment creation parameters including name, provider, and settings

Returns: Promise<Environment> — A promise that resolves to the newly created

Full reference →


createInstalledProvider​

client.environments.createInstalledProvider(data: CreateInstalledProviderRequest): Promise<InstalledProvider>

Registers a new installed environment provider.

Creates a provider record from an already-installed provider on the system. This makes the provider available for environment creation.

ParameterTypeRequiredDescription
dataCreateInstalledProviderRequestYesThe provider registration details

Returns: Promise<InstalledProvider> — A promise that resolves to the newly created

Full reference →


deleteEnvironment​

client.environments.deleteEnvironment(id: string): Promise<unknown>

Deletes an environment.

Permanently removes the environment and releases its resources. The environment should be stopped before deletion.

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the environment to delete

Returns: Promise<unknown> — A promise that resolves when deletion is complete

Full reference →


deleteInstalledProvider​

client.environments.deleteInstalledProvider(id: string): Promise<unknown>

Deletes an installed environment provider.

Removes the provider registration. Environments already created by this provider are not automatically deleted.

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the installed provider to delete

Returns: Promise<unknown> — A promise that resolves when deletion is complete

Full reference →


getDiffFiles​

client.environments.getDiffFiles(id: string, data: GetDiffFilesRequest): Promise<unknown>

Retrieves diff files for an environment.

Compares the environment's current file state against a baseline to identify modified, added, or deleted files.

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the environment
dataGetDiffFilesRequestYesParameters specifying the diff comparison (e.g., base commit or branch)

Returns: Promise<unknown> — A promise that resolves to the diff file information

Full reference →


getEnvironment​

client.environments.getEnvironment(id: string): Promise<Environment>

Retrieves a specific environment by its ID.

Returns the full details of a single environment including its current state, provider, and configuration.

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the environment

Returns: Promise<Environment> — A promise that resolves to the

Full reference →


getFullProject​

client.environments.getFullProject(id: string): Promise<unknown>

Retrieves the complete project file structure from an environment.

Returns the full directory tree and file listing for the project contained within the environment.

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the environment

Returns: Promise<unknown> — A promise that resolves to the project structure data

Full reference →


getInstalledProvider​

client.environments.getInstalledProvider(id: string): Promise<InstalledProvider>

Retrieves a specific installed provider by its ID.

Returns the full details of a single provider including its configuration and current state.

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the installed provider

Returns: Promise<InstalledProvider> — A promise that resolves to the

Full reference →


getLocalProviders​

client.environments.getLocalProviders(): Promise<ProviderData[]>

Retrieves the list of available local environment providers.

Discovers providers installed on the local machine that can be used to create new environments. Useful for populating provider selection UIs.

No parameters.

Returns: Promise<ProviderData[]> — A promise that resolves to an array of descriptors

Full reference →


getProviderStatus​

client.environments.getProviderStatus(id: string): Promise<EnvironmentProviderStatus>

Retrieves the current provider status for an environment.

Returns whether the backing provider is running, stopped, or in an error state. Useful for health checks and monitoring.

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the environment

Returns: Promise<EnvironmentProviderStatus> — A promise that resolves to the

Full reference →


getRunningProviders​

client.environments.getRunningProviders(): Promise<InstalledProvider[]>

Retrieves all currently running environment providers.

Returns only providers that are actively running and available to serve environment requests.

No parameters.

Returns: Promise<InstalledProvider[]> — A promise that resolves to an array of running objects

Full reference →


installProvider​

client.environments.installProvider(data: InstallProviderRequest): Promise<InstalledProvider>

Installs a new environment provider from a remote source.

Downloads and registers a provider, making it available for creating environments. Use this when the provider is not yet present locally.

ParameterTypeRequiredDescription
dataInstallProviderRequestYesInstallation parameters including provider source and configuration

Returns: Promise<InstalledProvider> — A promise that resolves to the newly installed

Full reference →


listEnvironments​

client.environments.listEnvironments(params?: Record<string, unknown>): Promise<Environment[]>

Lists all environments.

Returns every environment regardless of state. Use optional parameters to filter or paginate the results.

ParameterTypeRequiredDescription
paramsRecord<string, unknown>NoOptional query parameters for filtering or pagination

Returns: Promise<Environment[]> — A promise that resolves to an array of objects

Full reference →


listInstalledProviders​

client.environments.listInstalledProviders(params?: Record<string, unknown>): Promise<InstalledProvider[]>

Lists all installed environment providers.

Returns every provider that has been registered or installed in the system.

ParameterTypeRequiredDescription
paramsRecord<string, unknown>NoOptional query parameters for filtering or pagination

Returns: Promise<InstalledProvider[]> — A promise that resolves to an array of objects

Full reference →


mergePatch​

client.environments.mergePatch(id: string, data: MergePatchRequest): Promise<unknown>

Merges a patch into the environment's project files.

Applies a set of file changes (additions, modifications, deletions) to the environment in a single atomic operation.

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the environment
dataMergePatchRequestYesThe patch payload describing file changes to apply

Returns: Promise<unknown> — A promise that resolves when the patch has been applied

Full reference →


readFile​

client.environments.readFile(id: string, data: ReadEnvironmentFileRequest): Promise<unknown>

Reads a file from within an environment.

Retrieves the contents of a specific file from the environment's filesystem. Useful for inspecting files without SSH access.

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the environment
dataReadEnvironmentFileRequestYesThe file read request specifying the file path

Returns: Promise<unknown> — A promise that resolves to the file contents

Full reference →


restartEnvironment​

client.environments.restartEnvironment(id: string, data?: Record<string, unknown>): Promise<unknown>

Restarts an environment.

Performs a stop followed by a start on the environment. Useful for applying configuration changes that require a fresh boot.

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the environment to restart
dataRecord<string, unknown>NoOptional restart configuration

Returns: Promise<unknown> — A promise that resolves when the environment has restarted

Full reference →


sendPullRequest​

client.environments.sendPullRequest(id: string, data: SendPullRequestRequest): Promise<unknown>

Sends a pull request from the environment's current state.

Creates a pull request on the remote repository using the changes present in the environment. The PR details are specified in the request.

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the environment
dataSendPullRequestRequestYesPull request details including title, description, and target branch

Returns: Promise<unknown> — A promise that resolves when the pull request has been created

Full reference →


setDefaultProvider​

client.environments.setDefaultProvider(id: string, data?: Record<string, unknown>): Promise<unknown>

Sets an installed provider as the system default.

New environments will use this provider unless another is explicitly specified during creation.

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the provider to set as default
dataRecord<string, unknown>NoOptional additional configuration for the default setting

Returns: Promise<unknown> — A promise that resolves when the default is updated

Full reference →


startEnvironment​

client.environments.startEnvironment(id: string, data?: Record<string, unknown>): Promise<unknown>

Starts an environment.

Boots up the environment so it becomes active and ready for use. The environment's provider must be running first.

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the environment to start
dataRecord<string, unknown>NoOptional start configuration

Returns: Promise<unknown> — A promise that resolves when the environment has started

Full reference →


startProvider​

client.environments.startProvider(id: string, data?: Record<string, unknown>): Promise<unknown>

Starts the underlying provider for an environment.

Boots up the provider process that backs the environment, making it ready to accept operations. This is distinct from starting the environment itself.

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the environment
dataRecord<string, unknown>NoOptional start configuration

Returns: Promise<unknown> — A promise that resolves when the provider has started

Full reference →


stopEnvironment​

client.environments.stopEnvironment(id: string, data?: Record<string, unknown>): Promise<unknown>

Stops a running environment.

Gracefully shuts down the environment, preserving its state for later restart. Resources may be released depending on the provider.

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the environment to stop
dataRecord<string, unknown>NoOptional stop configuration

Returns: Promise<unknown> — A promise that resolves when the environment has stopped

Full reference →


stopProvider​

client.environments.stopProvider(id: string, data?: Record<string, unknown>): Promise<unknown>

Stops the underlying provider for an environment.

Shuts down the provider process without destroying the environment. The provider can be restarted later.

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the environment
dataRecord<string, unknown>NoOptional stop configuration

Returns: Promise<unknown> — A promise that resolves when the provider has stopped

Full reference →


updateEnvironment​

client.environments.updateEnvironment(id: string, data: UpdateEnvironmentRequest): Promise<Environment>

Updates an existing environment's configuration.

Modifies environment settings such as name, resource allocations, or other configurable properties.

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the environment to update
dataUpdateEnvironmentRequestYesThe fields to update on the environment

Returns: Promise<Environment> — A promise that resolves to the updated

Full reference →


updateInstalledProvider​

client.environments.updateInstalledProvider(id: string, data: UpdateInstalledProviderRequest): Promise<InstalledProvider>

Updates the configuration of an installed provider.

Modifies provider settings such as name, credentials, or resource limits.

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the installed provider to update
dataUpdateInstalledProviderRequestYesThe fields to update on the provider

Returns: Promise<InstalledProvider> — A promise that resolves to the updated

Full reference →


writeFile​

client.environments.writeFile(id: string, data: WriteEnvironmentFileRequest): Promise<unknown>

Writes a file to an environment's filesystem.

Creates or overwrites a file at the specified path within the environment. Useful for deploying configuration or code changes.

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the environment
dataWriteEnvironmentFileRequestYesThe file write request specifying path and content

Returns: Promise<unknown> — A promise that resolves when the file has been written

Full reference →