Skip to main content

Class: Workspace

A Dagger workspace detected from the current working directory.

Extends

  • BaseClient

Constructors

Constructor

new Workspace(ctx?, _id?, _address?, _clientId?, _configPath?, _findUp?, _hasConfig?, _initialized?, _path?): Workspace

Constructor is used for internal usage only, do not create object from it.

Parameters

ctx?

Context

_id?

ID

_address?

string

_clientId?

string

_configPath?

string

_findUp?

string

_hasConfig?

boolean

_initialized?

boolean

_path?

string

Returns

Workspace

Overrides

BaseClient.constructor

Methods

address()

address(): Promise<string>

Canonical Dagger address of the workspace directory.

Returns

Promise<string>


checks()

checks(opts?): CheckGroup

Return all checks from modules loaded in the workspace.

Parameters

opts?

WorkspaceChecksOpts

Returns

CheckGroup


clientId()

clientId(): Promise<string>

The client ID that owns this workspace's host filesystem.

Returns

Promise<string>


configPath()

configPath(): Promise<string>

Path to config.toml relative to the workspace boundary (empty if not initialized).

Returns

Promise<string>


directory()

directory(path, opts?): Directory

Returns a Directory from the workspace.

Relative paths resolve from the workspace directory. Absolute paths resolve from the workspace boundary.

Parameters

path

string

Location of the directory to retrieve. Relative paths (e.g., "src") resolve from the workspace directory; absolute paths (e.g., "/src") resolve from the workspace boundary.

opts?

WorkspaceDirectoryOpts

Returns

Directory


file()

file(path): File

Returns a File from the workspace.

Relative paths resolve from the workspace directory. Absolute paths resolve from the workspace boundary.

Parameters

path

string

Location of the file to retrieve. Relative paths (e.g., "go.mod") resolve from the workspace directory; absolute paths (e.g., "/go.mod") resolve from the workspace boundary.

Returns

File


findUp()

findUp(name, opts?): Promise<string>

Search for a file or directory by walking up from the start path within the workspace.

Returns the absolute workspace path if found, or null if not found.

Relative start paths resolve from the workspace directory.

The search stops at the workspace boundary and will not traverse above it.

Parameters

name

string

The name of the file or directory to search for.

opts?

WorkspaceFindUpOpts

Returns

Promise<string>


generators()

generators(opts?): GeneratorGroup

Return all generators from modules loaded in the workspace.

Parameters

opts?

WorkspaceGeneratorsOpts

Returns

GeneratorGroup


hasConfig()

hasConfig(): Promise<boolean>

Whether a config.toml file exists in the workspace.

Returns

Promise<boolean>


id()

id(): Promise<ID>

A unique identifier for this Workspace.

Returns

Promise<ID>


initialized()

initialized(): Promise<boolean>

Whether .dagger/config.toml exists.

Returns

Promise<boolean>


path()

path(): Promise<string>

Workspace directory path relative to the workspace boundary.

Returns

Promise<string>


services()

services(opts?): UpGroup

Return all services from modules loaded in the workspace.

Parameters

opts?

WorkspaceServicesOpts

Returns

UpGroup


update()

update(): Changeset

Experimental

Refresh workspace-managed state and return the resulting changeset.

Currently this refreshes existing lockfile entries only.

Returns

Changeset