Summary
Add support for a dir: option in command definitions to allow individual commands to run from a specific working directory, rather than always running from the directory containing the .ahoy.yml file.
This would of course be a backwards compatibility breaking feature, so would have to be part of the schema updates for Ahoy v3.
Current Behavior
Currently, all Ahoy commands execute from the directory containing the .ahoy.yml file (AhoyConf.srcDir). This is hardcoded in the command execution logic:
command := exec.Command(cmdItems[0], cmdItems[1:]...)
command.Dir = AhoyConf.srcDir // Always uses .ahoy.yml directory
To change directories, users must handle it within the command script:
commands:
example:
cmd: |
cd /some/other/directory
echo "Now in $(pwd)"
Proposed Feature
Add an optional dir: field to command definitions that specifies the working directory for that command:
ahoyapi: v2
commands:
frontend-build:
usage: Build frontend assets
dir: ./frontend
cmd: npm run build
backend-test:
usage: Run backend tests
dir: ./api
cmd: composer test
root-command:
usage: Command that runs from project root
# No dir specified - uses default (.ahoy.yml directory)
cmd: echo "Running from $(pwd)"
Summary
Add support for a
dir:option in command definitions to allow individual commands to run from a specific working directory, rather than always running from the directory containing the.ahoy.ymlfile.This would of course be a backwards compatibility breaking feature, so would have to be part of the schema updates for Ahoy v3.
Current Behavior
Currently, all Ahoy commands execute from the directory containing the
.ahoy.ymlfile (AhoyConf.srcDir). This is hardcoded in the command execution logic:To change directories, users must handle it within the command script:
Proposed Feature
Add an optional
dir:field to command definitions that specifies the working directory for that command: