Working directory
The working directory (cwd) controls where exec participants run their shell commands. Duckflux resolves it through three levels, each overriding the previous.
Precedence levels
Section titled “Precedence levels”The runtime evaluates working directory from lowest to highest priority:
-
Process working directory — the directory from which you invoke
quack run. This is the implicit default when nothing else is configured. -
CLI
--cwdflag — sets a base directory for the entire execution, overriding the process directory. Useful when the workflow file lives in a different location from the project it operates on.Terminal window quack run workflow.yaml --cwd /workspace/my-project -
defaults.cwd— declared in the workflow file itself. Applies to allexecparticipants that don’t define their owncwd.defaults:cwd: ./repo -
participant.cwd— set on an individual participant. Has the highest priority, overriding all other levels.participants:build:type: execrun: npm run buildcwd: ./packages/frontend
How they combine
Section titled “How they combine”| Level | Set by | Scope |
|---|---|---|
| Process cwd | OS / shell | All participants (implicit) |
--cwd | CLI flag | All participants |
defaults.cwd | Workflow file | All exec participants |
participant.cwd | Participant definition | Single participant |
A higher-priority level completely replaces lower ones. They do not merge or concatenate.
Common patterns
Section titled “Common patterns”Workflow that operates on a repository clone
Section titled “Workflow that operates on a repository clone”defaults: cwd: ./repo
flow: - type: exec run: git clone $REPO_URL .
- type: exec run: npm install
- type: exec run: npm testAll three steps execute inside ./repo.
Per-participant overrides in a monorepo
Section titled “Per-participant overrides in a monorepo”defaults: cwd: ./repo
participants: buildFrontend: type: exec run: npm run build cwd: ./repo/packages/frontend
buildBackend: type: exec run: npm run build cwd: ./repo/packages/backend
flow: - type: exec run: npm install - parallel: - buildFrontend - buildBackendThe npm install runs in ./repo (from defaults.cwd), while each build step overrides with its own path.
Dynamic cwd from inputs
Section titled “Dynamic cwd from inputs”inputs: packagePath: type: string
flow: - type: exec run: npm run build cwd: workflow.inputs.packagePathThe caller decides which directory to use at runtime.
Sub-workflows
Section titled “Sub-workflows”When using type: workflow, paths in the sub-workflow’s defaults.cwd and participant.cwd are resolved relative to the sub-workflow file’s directory, not the parent’s working directory. See Nested workflows for details.