class Workspace extends AbstractObject implements IdAble, Node

A Dagger workspace detected from the current working directory or constructed from a Directory.

Properties

$lastQuery from  AbstractObject

Methods

__construct(AbstractClient $client, QueryBuilderChain $queryBuilderChain)

No description

null|array|string|int|float|bool
queryLeaf(QueryBuilder $leafQueryBuilder, string $leafKey)

No description

string
address()

Canonical Dagger address of the workspace location, or an opaque identity for synthetic workspaces.

changes(Workspace $other)

Return the changes from another workspace to this workspace.

checks(array|null $include = null, array|null $skip = null, bool|null $noGenerate = null, bool|null $onlyGenerate = null)

Return all checks from modules loaded in the workspace.

clientGenerate()

Regenerate all generated API clients registered in workspace config and return the resulting Changeset.

clientInit(string $path, string $sdk, string $module, bool|null $here = false, Json|null $args = null)

Plan the workspace changes for initializing a generated API client: generated client files at path plus a [[modules..as-sdk.clients]] entry in dagger.toml. Returns the resulting Changeset for the caller to preview and apply.

string
configFile()

Selected native workspace config file relative to the workspace root, if any.

string
configRead(string|null $key = '')

Read a configuration value from dagger.toml.

string
configWrite(string $key, string $value, bool|null $here = false)

Write a configuration value to dagger.toml.

string
cwd()

Current location within the workspace root.

directory(string $path, array|null $exclude = [], array|null $include = [], bool|null $gitignore = false)

Returns a Directory from the workspace.

string
envCreate(string $name, bool|null $here = false)

Create a named workspace environment if it does not already exist.

array
envList()

List named environments defined in the workspace configuration.

string
envRemove(string $name, bool|null $here = false)

Remove a named workspace environment.

file(string $path)

Returns a File from the workspace.

string
findUp(string $name, string|null $from = '.')

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

generators(array|null $include = null)

Return all generators from modules loaded in the workspace.

git()

Git state for this workspace. Errors if the workspace is not in a git repository.

Id
id()

A unique identifier for this Workspace.

string
init(bool|null $here = false)

Initialize workspace config, creating dagger.toml.

string
install(string $ref, string|null $name = '', bool|null $here = false, bool|null $asSdk = false, string|null $asSdkName = '')

Install a module into the workspace, writing dagger.toml to the host.

migrate()

Plan the explicit migration needed for the current workspace.

moduleInit(string $name, string|null $sdk = '', string|null $path = '', string|null $source = '', array|null $include = [], bool|null $here = false, Json|null $args = null)

Plan the workspace changes for initializing a new module: dagger-module.toml + SDK codegen output at path, the authoring entry under [[modules..as-sdk.modules]], and (when path defaults) [modules.]. The SDK must already be installed as an SDK. Returns the resulting Changeset for the caller to preview and apply.

array
moduleList(string|null $module = '')

List modules defined in the workspace configuration.

services(array|null $include = null)

Return all services from modules loaded in the workspace.

string
uninstall(string $name, bool|null $here = false)

Uninstall a module from the workspace, writing dagger.toml to the host.

update()

Refresh workspace-managed state and return the resulting changeset.

withChanges(Changeset $changes)

Return this workspace with a changeset applied, without mutating the source.

withNewDirectory(string $path, Directory $source)

Return this workspace with a directory added, without mutating the source.

withNewFile(string $path, string $contents, int|null $permissions = 420)

Return this workspace with a new or replaced file, without mutating the source.

Details

in AbstractObject at line 13
__construct(AbstractClient $client, QueryBuilderChain $queryBuilderChain)

No description

Parameters

AbstractClient $client
QueryBuilderChain $queryBuilderChain

in AbstractObject at line 19
protected null|array|string|int|float|bool queryLeaf(QueryBuilder $leafQueryBuilder, string $leafKey)

No description

Parameters

QueryBuilder $leafQueryBuilder
string $leafKey

Return Value

null|array|string|int|float|bool

at line 19
string address()

Canonical Dagger address of the workspace location, or an opaque identity for synthetic workspaces.

Return Value

string

at line 28
Changeset changes(Workspace $other)

Return the changes from another workspace to this workspace.

Parameters

Workspace $other

Return Value

Changeset

at line 38
CheckGroup checks(array|null $include = null, array|null $skip = null, bool|null $noGenerate = null, bool|null $onlyGenerate = null)

Return all checks from modules loaded in the workspace.

Parameters

array|null $include
array|null $skip
bool|null $noGenerate
bool|null $onlyGenerate

Return Value

CheckGroup

at line 63
Changeset clientGenerate()

Regenerate all generated API clients registered in workspace config and return the resulting Changeset.

Return Value

Changeset

at line 72
Changeset clientInit(string $path, string $sdk, string $module, bool|null $here = false, Json|null $args = null)

Plan the workspace changes for initializing a generated API client: generated client files at path plus a [[modules..as-sdk.clients]] entry in dagger.toml. Returns the resulting Changeset for the caller to preview and apply.

Parameters

string $path
string $sdk
string $module
bool|null $here
Json|null $args

Return Value

Changeset

at line 95
string configFile()

Selected native workspace config file relative to the workspace root, if any.

Return Value

string

at line 110
string configRead(string|null $key = '')

Read a configuration value from dagger.toml.

If key is empty, returns the full config.

If key points to a scalar, returns the value.

If key points to a table, returns flattened dotted-key output.

Parameters

string|null $key

Return Value

string

at line 122
string configWrite(string $key, string $value, bool|null $here = false)

Write a configuration value to dagger.toml.

Parameters

string $key
string $value
bool|null $here

Return Value

string

at line 140
string cwd()

Current location within the workspace root.

The workspace root is returned as "/".

Relative paths in workspace APIs resolve from here.

Return Value

string

at line 151
Directory directory(string $path, array|null $exclude = [], array|null $include = [], bool|null $gitignore = false)

Returns a Directory from the workspace.

Relative paths resolve from the workspace cwd. Absolute paths resolve from the workspace root.

Parameters

string $path
array|null $exclude
array|null $include
bool|null $gitignore

Return Value

Directory

at line 174
string envCreate(string $name, bool|null $here = false)

Create a named workspace environment if it does not already exist.

Parameters

string $name
bool|null $here

Return Value

string

at line 187
array envList()

List named environments defined in the workspace configuration.

Return Value

array

at line 196
string envRemove(string $name, bool|null $here = false)

Remove a named workspace environment.

Parameters

string $name
bool|null $here

Return Value

string

at line 211
File file(string $path)

Returns a File from the workspace.

Relative paths resolve from the workspace cwd. Absolute paths resolve from the workspace root.

Parameters

string $path

Return Value

File

at line 227
string findUp(string $name, string|null $from = '.')

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 cwd.

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

Parameters

string $name
string|null $from

Return Value

string

at line 240
GeneratorGroup generators(array|null $include = null)

Return all generators from modules loaded in the workspace.

Parameters

array|null $include

Return Value

GeneratorGroup

at line 252
WorkspaceGit git()

Git state for this workspace. Errors if the workspace is not in a git repository.

Return Value

WorkspaceGit

at line 261
Id id()

A unique identifier for this Workspace.

Return Value

Id

at line 270
string init(bool|null $here = false)

Initialize workspace config, creating dagger.toml.

Parameters

bool|null $here

Return Value

string

at line 282
string install(string $ref, string|null $name = '', bool|null $here = false, bool|null $asSdk = false, string|null $asSdkName = '')

Install a module into the workspace, writing dagger.toml to the host.

Parameters

string $ref
string|null $name
bool|null $here
bool|null $asSdk
string|null $asSdkName

Return Value

string

at line 311
WorkspaceMigration migrate()

Plan the explicit migration needed for the current workspace.

The returned plan has an empty changeset and no steps when no migration is needed.

Return Value

WorkspaceMigration

at line 320
Changeset moduleInit(string $name, string|null $sdk = '', string|null $path = '', string|null $source = '', array|null $include = [], bool|null $here = false, Json|null $args = null)

Plan the workspace changes for initializing a new module: dagger-module.toml + SDK codegen output at path, the authoring entry under [[modules..as-sdk.modules]], and (when path defaults) [modules.]. The SDK must already be installed as an SDK. Returns the resulting Changeset for the caller to preview and apply.

Parameters

string $name
string|null $sdk
string|null $path
string|null $source
array|null $include
bool|null $here
Json|null $args

Return Value

Changeset

at line 355
array moduleList(string|null $module = '')

List modules defined in the workspace configuration.

Parameters

string|null $module

Return Value

array

at line 367
UpGroup services(array|null $include = null)

Return all services from modules loaded in the workspace.

Parameters

array|null $include

Return Value

UpGroup

at line 379
string uninstall(string $name, bool|null $here = false)

Uninstall a module from the workspace, writing dagger.toml to the host.

Parameters

string $name
bool|null $here

Return Value

string

at line 394
Changeset update()

Refresh workspace-managed state and return the resulting changeset.

Currently this refreshes existing lockfile entries only.

Return Value

Changeset

at line 403
Workspace withChanges(Changeset $changes)

Return this workspace with a changeset applied, without mutating the source.

Parameters

Changeset $changes

Return Value

Workspace

at line 413
Workspace withNewDirectory(string $path, Directory $source)

Return this workspace with a directory added, without mutating the source.

Parameters

string $path
Directory $source

Return Value

Workspace

at line 424
Workspace withNewFile(string $path, string $contents, int|null $permissions = 420)

Return this workspace with a new or replaced file, without mutating the source.

Parameters

string $path
string $contents
int|null $permissions

Return Value

Workspace