Skip to content

Commit cec5b95

Browse files
JonZeollaclaude
andcommitted
fix(platform): replace Unix-only precondition checks with cross-platform alternatives
Replaces `which`, `test -d`, `command -v`, and `[[ ]]` with portable equivalents so Taskfile preconditions work on Windows (PowerShell). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 4b3aaff commit cec5b95

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

Taskfile.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ tasks:
3636
status:
3737
# Don't do any of this if you aren't in a git repository; quote to avoid yaml intrepretering the ! as a node tag
3838
# https://yaml.org/spec/1.2.2/#691-node-tags
39-
- '! test -d .git'
39+
- '! git rev-parse --git-dir'
4040
cmds:
4141
- uv tool install pre-commit
4242
# Don't run this in pipelines
@@ -128,9 +128,9 @@ tasks:
128128
env:
129129
GH_TOKEN:
130130
sh: |
131-
if [[ -n "${GH_TOKEN:-}" ]]; then
131+
if [ -n "${GH_TOKEN:-}" ]; then
132132
echo "${GH_TOKEN}"
133-
elif command -v gh &> /dev/null && gh auth token &> /dev/null; then
133+
elif gh auth token > /dev/null 2>&1; then
134134
gh auth token
135135
fi
136136
cmds:

{{cookiecutter.project_name}}/Taskfile.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ tasks:
3434
- pyproject.toml
3535
- uv.lock
3636
preconditions:
37-
- which uv
37+
- uv --version
3838
cmds:
3939
# Sync dependencies with uv
4040
- uv sync --frozen --all-extras
@@ -47,7 +47,7 @@ tasks:
4747
status:
4848
# Don't do any of this if you aren't in a git repository; quote to avoid yaml intrepretering the ! as a node tag
4949
# https://yaml.org/spec/1.2.2/#691-node-tags
50-
- '! test -d .git'
50+
- '! git rev-parse --git-dir'
5151
cmds:
5252
- uv tool install pre-commit
5353
# Don't run this in pipelines
@@ -205,9 +205,9 @@ tasks:
205205
env:
206206
GH_TOKEN:
207207
sh: |
208-
if [[ -n "${GH_TOKEN:-}" ]]; then
208+
if [ -n "${GH_TOKEN:-}" ]; then
209209
echo "${GH_TOKEN}"
210-
elif command -v gh &> /dev/null && gh auth token &> /dev/null; then
210+
elif gh auth token > /dev/null 2>&1; then
211211
gh auth token
212212
fi
213213
cmds:

0 commit comments

Comments
 (0)