Skip to content

Working directory

The working directory (cwd) controls where exec participants run their shell commands. Duckflux resolves it through three levels, each overriding the previous.


The runtime evaluates working directory from lowest to highest priority:

  1. Process working directory — the directory from which you invoke quack run. This is the implicit default when nothing else is configured.

  2. CLI --cwd flag — 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
  3. defaults.cwd — declared in the workflow file itself. Applies to all exec participants that don’t define their own cwd.

    defaults:
    cwd: ./repo
  4. participant.cwd — set on an individual participant. Has the highest priority, overriding all other levels.

    participants:
    build:
    type: exec
    run: npm run build
    cwd: ./packages/frontend

LevelSet byScope
Process cwdOS / shellAll participants (implicit)
--cwdCLI flagAll participants
defaults.cwdWorkflow fileAll exec participants
participant.cwdParticipant definitionSingle participant

A higher-priority level completely replaces lower ones. They do not merge or concatenate.


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 test

All three steps execute inside ./repo.

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
- buildBackend

The npm install runs in ./repo (from defaults.cwd), while each build step overrides with its own path.

inputs:
packagePath:
type: string
flow:
- type: exec
run: npm run build
cwd: workflow.inputs.packagePath

The caller decides which directory to use at runtime.


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.