Context
Following the discussion in #3308, I moved away from the __PROJECT_ROOT__ approach and switched to a workflow-based setup, which @mnriem pointed me toward. That was good advice, thanks. The workflow approach fits my use case much better.
I did run into a limitation while developing the workflow itself that I wanted to ask about.
Use case
I'm building a setup workflow for cc-spex that handles extension installation and command adaptation in one specify workflow run call. The workflow needs to reference files that live alongside it in the same repository (extension manifests, adapter scripts, etc.).
During development, I want to test it against other repos:
cd ~/some-other-repo
specify workflow run ~/dev/cc-spex/spex/setup.yml -i "integration=claude"
The workflow file is at ~/dev/cc-spex/spex/setup.yml, and the files it needs are in ~/dev/cc-spex/spex/extensions/, ~/dev/cc-spex/spex/scripts/, etc. But inside the workflow's shell steps, there's no way to discover that path.
What I've tried
I built a locate-source step with fallbacks (env var, cwd detection, git clone), but the simplest case doesn't work: the workflow can't find its own directory. I noticed WorkflowDefinition.source_path is stored in engine.py but not exposed to steps.
The workaround is passing the path twice:
SPEX_SOURCE=~/dev/cc-spex/spex specify workflow run ~/dev/cc-spex/spex/setup.yml -i "integration=claude"
This works but feels redundant since the path is already in the command.
Question
Is there an existing way for a workflow to discover where its own YAML file lives? If not, is there a recommended pattern for workflows that need to reference sibling files?
Context
Following the discussion in #3308, I moved away from the
__PROJECT_ROOT__approach and switched to a workflow-based setup, which @mnriem pointed me toward. That was good advice, thanks. The workflow approach fits my use case much better.I did run into a limitation while developing the workflow itself that I wanted to ask about.
Use case
I'm building a setup workflow for cc-spex that handles extension installation and command adaptation in one
specify workflow runcall. The workflow needs to reference files that live alongside it in the same repository (extension manifests, adapter scripts, etc.).During development, I want to test it against other repos:
The workflow file is at
~/dev/cc-spex/spex/setup.yml, and the files it needs are in~/dev/cc-spex/spex/extensions/,~/dev/cc-spex/spex/scripts/, etc. But inside the workflow's shell steps, there's no way to discover that path.What I've tried
I built a
locate-sourcestep with fallbacks (env var, cwd detection, git clone), but the simplest case doesn't work: the workflow can't find its own directory. I noticedWorkflowDefinition.source_pathis stored inengine.pybut not exposed to steps.The workaround is passing the path twice:
This works but feels redundant since the path is already in the command.
Question
Is there an existing way for a workflow to discover where its own YAML file lives? If not, is there a recommended pattern for workflows that need to reference sibling files?