You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(workflows): expose workflow source directory to steps (#3469)
* feat(workflows): expose workflow source directory to steps (#3467)
Propagate WorkflowDefinition.source_path to steps via
{{ context.workflow_dir }} in template expressions and
SPECKIT_WORKFLOW_DIR env var for shell steps. The original
source directory is persisted in state.json so resume
restores the correct value instead of the run-directory copy path.
Closes#3467
Assisted-By: 🤖 Claude Code
* fix: apply bot review suggestions (#2)
Applied fixes from bot review comments:
- Comment #3563319058: prevent stale SPECKIT_WORKFLOW_DIR leak from parent env
- Comment #3563319094: use cross-platform Python one-liner instead of printenv
- Comment #3563319103: add monkeypatch.delenv for deterministic env var test
- Comment #3563319116: same env leak fix as #3563319058
Assisted-By: 🤖 Claude Code
* fix: use YAML single-quotes and forward-slash paths for Windows CI (#2)
sys.executable on Windows returns backslash paths (D:\a\...) which YAML
double-quoted strings interpret as escape sequences. Switch to
single-quoted YAML strings and normalize paths with replace("\\", "/").
Assisted-By: 🤖 Claude Code
* fix: resolve workflow_dir to absolute path and add installed-by-ID test (#3469)
Applied fixes from bot review comments:
- Comment #3563382853: resolve source_path before taking parent to ensure absolute paths
- Comment #3563382864: add test for installed-by-ID workflow_dir semantics
Assisted-By: 🤖 Claude Code
* docs: document context.workflow_dir and SPECKIT_WORKFLOW_DIR
Add reference documentation for the new workflow_dir runtime value in
both workflows/README.md and docs/reference/workflows.md so workflow
authors can discover the feature and its semantics.
Assisted-By: 🤖 Claude Code
* fix: clarify installed workflow_dir is an absolute path (#3469)
The documentation for context.workflow_dir described the installed-by-ID
case as ".specify/workflows/<id>/" which appears relative, contradicting
the "resolved absolute path" semantics. Clarified that it is the absolute
path to the installation directory.
Assisted-By: 🤖 Claude Code
* fix: apply bot review suggestions (#3469)
Applied fixes from bot review comments:
- Comment #3580005128: Quote sys.executable in shell step env var test
- Comment #3580005174: Quote sys.executable in no-env-var test
Assisted-By: 🤖 Claude Code
* fix: apply bot review suggestions (#3469)
Applied fixes from bot review comments:
- Comment #3587146944: Quote interpolated workflow_dir path in example
Assisted-By: 🤖 Claude Code
Copy file name to clipboardExpand all lines: docs/reference/workflows.md
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -305,6 +305,8 @@ Steps can reference inputs and previous step outputs using `{{ expression }}` sy
305
305
|`inputs.spec`| Workflow input values |
306
306
|`steps.specify.output.file`| Output from a previous step |
307
307
|`item`| Current item in a fan-out iteration |
308
+
|`context.run_id`| Current workflow run ID |
309
+
|`context.workflow_dir`| Resolved absolute path to the workflow source directory. Empty string for string-loaded workflows. |
308
310
309
311
Available filters: `default`, `join`, `contains`, `map`, `from_json`.
310
312
@@ -316,6 +318,14 @@ args: "{{ inputs.spec }}"
316
318
message: "{{ status | default('pending') }}"
317
319
```
318
320
321
+
## Shell Step Environment Variables
322
+
323
+
Shell steps automatically receive the following environment variables:
324
+
325
+
| Variable | Description |
326
+
| -------- | ----------- |
327
+
| `SPECKIT_WORKFLOW_DIR` | Resolved absolute path to the workflow source directory (same value as `{{ context.workflow_dir }}`). Not set when the workflow has no source path. |
0 commit comments