Workspace
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
No description
Canonical Dagger address of the workspace location, or an opaque identity for synthetic workspaces.
Return all agent middlewares from modules loaded in the workspace.
Return all checks from modules loaded in the workspace.
Selected native workspace config file relative to the workspace cwd, if any.
Read a configuration value from dagger.toml.
Current location within the workspace root.
Returns a Directory from the workspace.
List named environments defined in the workspace configuration.
Write this workspace's pending changes to its local Git workspace.
Search for a file or directory by walking up from the start path within the workspace.
Return all generators from modules loaded in the workspace.
Git state for this workspace. Errors if the workspace is not in a git repository.
Returns a list of files and directories that match the given pattern.
Plan the explicit migration needed for the current workspace.
Return a module defined in the workspace configuration.
Load a module source from a path within the workspace.
List modules defined in the workspace configuration.
Return this workspace with its cached host reads invalidated, so subsequent file and directory reads re-read the live host instead of a snapshot cached earlier in the session.
An installed SDK, by name.
Installed SDKs.
Searches for content matching the given regular expression or literal string.
Return all services from modules loaded in the workspace.
Return this workspace with a changeset applied, without mutating the source.
Return this workspace with a named config environment created.
Return this workspace with a configuration value written.
Return this workspace with a generated API client initialized.
Return this workspace with a new module initialized.
Return this workspace with a module installed in its config.
Return this workspace with a directory mounted read-only at the given path, without mutating the source.
Return this workspace with a file mounted read-only at the given path, without mutating the source.
Return this workspace with a directory added, without mutating the source.
Return this workspace with a new or replaced file, without mutating the source.
Return this workspace with an SDK installed in its config.
Return this workspace with refreshed lockfile state.
Return this workspace with its working directory pointed at the given workspace-relative path.
Return this workspace with a named config environment removed.
Return this workspace with a configuration value removed.
Return this workspace with a directory removed, without mutating the source.
Return this workspace with a file removed, without mutating the source.
Return this workspace with a module removed from its config.
Return this workspace with an SDK removed from its config.
Details
in
AbstractObject at line 13
__construct(AbstractClient $client, QueryBuilderChain $queryBuilderChain)
No description
in
AbstractObject at line 19
protected null|array|string|int|float|bool
queryLeaf(QueryBuilder $leafQueryBuilder, string $leafKey)
No description
at line 19
string
address()
Canonical Dagger address of the workspace location, or an opaque identity for synthetic workspaces.
at line 28
AgentGroup
agents(array|null $include = null)
Return all agent middlewares from modules loaded in the workspace.
at line 40
Changeset
changes()
Return this workspace's pending overlay changes.
at line 49
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.
at line 74
string
configFile()
Selected native workspace config file relative to the workspace cwd, if any.
at line 89
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.
at line 105
string
cwd()
Current location within the workspace root.
The workspace root is returned as "/".
Relative paths in workspace APIs resolve from here.
at line 116
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.
at line 139
array
envList()
List named environments defined in the workspace configuration.
at line 148
void
export()
Write this workspace's pending changes to its local Git workspace.
at line 159
File
file(string $path)
Returns a File from the workspace.
Relative paths resolve from the workspace cwd. Absolute paths resolve from the workspace root.
at line 175
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.
at line 188
GeneratorGroup
generators(array|null $include = null)
Return all generators from modules loaded in the workspace.
at line 200
WorkspaceGit
git()
Git state for this workspace. Errors if the workspace is not in a git repository.
at line 211
array
glob(string $pattern)
Returns a list of files and directories that match the given pattern.
Patterns match paths relative to the workspace root.
at line 221
Id
id()
A unique identifier for this Workspace.
at line 232
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.
at line 241
WorkspaceModule
module(string $name)
Return a module defined in the workspace configuration.
at line 255
ModuleSource
moduleSource(string $path)
Load a module source from a path within the workspace.
Relative paths (e.g., "foo") resolve from the workspace cwd; absolute paths (e.g., "/foo") resolve from the workspace root.
Fails if the path does not point to an initialized module.
at line 265
array
modules()
List modules defined in the workspace configuration.
at line 274
Workspace
reloaded()
Return this workspace with its cached host reads invalidated, so subsequent file and directory reads re-read the live host instead of a snapshot cached earlier in the session.
at line 283
WorkspaceSDK
sdk(string $name)
An installed SDK, by name.
at line 293
array
sdks()
Installed SDKs.
at line 306
array
search(string $pattern, array|null $paths = [], array|null $globs = [], bool|null $literal = false, bool|null $multiline = false, bool|null $dotall = false, bool|null $insensitive = false, bool|null $skipIgnored = false, bool|null $skipHidden = false, bool|null $filesOnly = false, int|null $limit = null)
Searches for content matching the given regular expression or literal string.
Uses Rust regex syntax; escape literal ., [, ], {, }, | with backslashes.
Runs ripgrep on the client host, falling back to grep if unavailable.
at line 357
UpGroup
services(array|null $include = null)
Return all services from modules loaded in the workspace.
at line 369
Workspace
withChanges(Changeset $changes)
Return this workspace with a changeset applied, without mutating the source.
at line 379
Workspace
withConfigEnv(string $name, bool|null $here = false)
Return this workspace with a named config environment created.
at line 392
Workspace
withConfigValue(string $key, string $value, array|null $values = null, bool|null $here = false)
Return this workspace with a configuration value written.
at line 411
Workspace
withInitClient(string $path, string $sdk, string $module, Json|null $args = null, bool|null $here = false, bool|null $noGenerate = false)
Return this workspace with a generated API client initialized.
The SDK's generators run for the new client, so the returned workspace carries its generated bindings.
at line 440
Workspace
withInitModule(string $name, string $sdk, string|null $path = '', string|null $source = '', array|null $include = [], Json|null $args = null, bool|null $here = false, bool|null $noGenerate = false)
Return this workspace with a new module initialized.
The SDK's generators run for the new module, so the returned workspace carries the generated code it needs to be loadable.
at line 477
Workspace
withModule(string $ref, string|null $name = '', bool|null $here = false)
Return this workspace with a module installed in its config.
at line 495
Workspace
withMountedDirectory(string $path, Directory $source)
Return this workspace with a directory mounted read-only at the given path, without mutating the source.
Mounted content is readable through the normal workspace file tools but shadows the source at the mount path and stays out of the pending changeset: it never appears in changes, is never exported, and cannot be modified.
at line 508
Workspace
withMountedFile(string $path, File $source)
Return this workspace with a file mounted read-only at the given path, without mutating the source.
Mounted content is readable through the normal workspace file tools but shadows the source at the mount path and stays out of the pending changeset: it never appears in changes, is never exported, and cannot be modified.
at line 519
Workspace
withNewDirectory(string $path, Directory $source)
Return this workspace with a directory added, without mutating the source.
at line 530
Workspace
withNewFile(string $path, string $contents, int|null $permissions = 420)
Return this workspace with a new or replaced file, without mutating the source.
at line 544
Workspace
withSDK(string $ref, string|null $name = '', bool|null $here = false, string|null $asSdkName = '')
Return this workspace with an SDK installed in its config.
at line 563
Workspace
withUpdatedLock()
Return this workspace with refreshed lockfile state.
at line 572
Workspace
withWorkdir(string $path)
Return this workspace with its working directory pointed at the given workspace-relative path.
at line 582
Workspace
withoutConfigEnv(string $name, bool|null $here = false)
Return this workspace with a named config environment removed.
at line 597
Workspace
withoutConfigValue(string $key, bool|null $here = false)
Return this workspace with a configuration value removed.
Errors when the key is not currently set.
at line 610
Workspace
withoutDirectory(string $path)
Return this workspace with a directory removed, without mutating the source.
at line 620
Workspace
withoutFile(string $path)
Return this workspace with a file removed, without mutating the source.
at line 630
Workspace
withoutModule(string $name, bool|null $here = false)
Return this workspace with a module removed from its config.
at line 643
Workspace
withoutSDK(string $name, bool|null $here = false)
Return this workspace with an SDK removed from its config.