Skip to content

docs(tasks): add bash shebang to conditional-dependencies example#9747

Merged
jdx merged 1 commit into
jdx:mainfrom
JamBalaya56562:docs/tasks-architecture-windows-shebang
May 9, 2026
Merged

docs(tasks): add bash shebang to conditional-dependencies example#9747
jdx merged 1 commit into
jdx:mainfrom
JamBalaya56562:docs/tasks-architecture-windows-shebang

Conversation

@JamBalaya56562

Copy link
Copy Markdown
Contributor

Summary

The "Conditional Dependencies" example in docs/tasks/architecture.md
uses bash test syntax inside an inline run block:

[tasks.test]
depends = ["build"]
run = '''
if [ "$1" = "--with-lint" ]; then
  mise run lint
fi
npm test
'''

Without a shebang, mise runs the script under the platform default
inline shell — sh -c -o errexit on Unix, cmd /c on Windows.
cmd cannot parse [ "$1" = ... ], so a Windows host running this
verbatim fails immediately:

[test] $ if [ "$1" = "--with-lint" ]; then
"$1" was unexpected at this time.
[test] ERROR task failed

That happens before the conditional is even evaluated, so the example
is essentially non-functional on Windows as written.

This patch adds #!/usr/bin/env bash to the example so it is portable
across Linux, macOS, and Windows hosts, and follows the recommendation
in docs/tasks/task-configuration.md
to "use a shebang instead" of the shell field.

It also adds a short paragraph pointing readers toward the
usage field for richer argument handling, since positional
parameters in inline run blocks have subtle cross-platform caveats
(see e.g. discussion #9355
about Windows quoting, and the comment at
e2e/tasks/test_task_raw_args:48-50
noting that real positional parameters are only guaranteed for
file-based shebang scripts, not inline TOML scripts).

Verification

Reproduced the failing case and the fix on a fresh mise.toml on
Windows 11 + mise 2026.5.2:

Before (verbatim from current docs, called from PowerShell or bash):

[test] $ if [ "$1" = "--with-lint" ]; then
"$1" was unexpected at this time.
[test] ERROR task failed

After (with the shebang added):

$ mise run test --with-lint
[build] $ echo build done
build done
[test] $ #!/usr/bin/env bash
running lint
running npm test
Finished in 137.5ms

Existing Linux/macOS behavior is unchanged: the shebang takes
precedence over the platform default inline shell, and bash
behaves the same way the previous example assumed.

Scope

Documentation only. No code or test changes.

…mple

The example for 'Conditional Dependencies' uses bash test syntax
(`if [ "$1" = ... ]`). Without an explicit shebang, mise runs inline
`run` scripts under the platform default inline shell, which is
`cmd /c` on Windows. cmd cannot parse bash test syntax, so a
verbatim copy of the example fails on Windows with a confusing
`'"$1"' was unexpected at this time` error before any argument is
even read.

Add `#!/usr/bin/env bash` to the example so it is portable across
Linux, macOS, and Windows hosts, and add a short note pointing
readers toward the `usage` field for richer argument handling.
@greptile-apps

greptile-apps Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This documentation-only PR fixes the "Conditional Dependencies" example in docs/tasks/architecture.md by adding a #!/usr/bin/env bash shebang to the inline TOML script so it works on Windows (where the default cmd /c shell cannot parse [ ... ] test syntax).

  • Adds #!/usr/bin/env bash as the first line of the multi-line run block so mise selects bash over the platform default shell.
  • Adds a follow-up paragraph explaining the platform-default-shell behaviour and pointing readers to the usage field for more robust argument handling.

Confidence Score: 5/5

Safe to merge — single doc file change with no code or test impact.

The change is confined to one documentation file and corrects a real cross-platform failure in the example. The shebang placement inside the TOML triple-quoted string is the established pattern used by the very next example in the same file, confirming it is handled correctly by mise.

No files require special attention.

Important Files Changed

Filename Overview
docs/tasks/architecture.md Adds #!/usr/bin/env bash shebang to the conditional-dependencies TOML example and adds a short explanatory paragraph about platform behavior and the usage field.

Reviews (1): Last reviewed commit: "docs(tasks): add bash shebang to archite..." | Re-trigger Greptile

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the architecture documentation to include a shebang in task examples, ensuring cross-platform compatibility. It also adds guidance on using the usage field for argument handling. A review comment suggests using relative links instead of site-absolute paths to ensure documentation links function correctly when viewed on GitHub.

it, mise uses the platform default inline shell (`sh -c` on Unix,
`cmd /c` on Windows), so the bash `[ ... ]` test would fail to parse on a
Windows host. For richer argument handling, prefer the
[`usage` field](/tasks/task-arguments#usage-field) instead of positional

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The link uses a site-absolute path (/tasks/task-arguments) which will not resolve correctly when viewing the documentation on GitHub. Using a relative link to the markdown file ensures that the link works both on the documentation website and when browsing the repository directly.

Suggested change
[`usage` field](/tasks/task-arguments#usage-field) instead of positional
[usage field](./task-arguments.md#usage-field) instead of positional

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review! I'd like to push back on this one — I believe the site-absolute path is actually the established convention in this repo and the suggested change would be inconsistent with the surrounding docs.

A few data points from docs/tasks/:

  • docs/tasks/toml-tasks.md already links to the same target with the same anchor in exactly the form this PR uses:

    See the Task Arguments page for complete documentation.

  • docs/tasks/file-tasks.md, docs/tasks/task-configuration.md, and docs/tasks/toml-tasks.md all use [Task Arguments](/tasks/task-arguments).
  • A quick count under docs/tasks/: 27 site-absolute (/tasks/...) links vs. 0 (./xxx.md) links and 1 (./xxx#anchor) link.

The docs are published via VitePress to mise.jdx.dev, where site-absolute paths resolve correctly without the .md extension; the live site appears to be the canonical browsing target rather than GitHub's markdown viewer.

Given that, I'd prefer to keep the link in the form used elsewhere in this directory so it stays consistent. Happy to change it if a maintainer prefers the relative-path style — in that case it might be worth converting the other 27 occurrences in the same pass for consistency.

@jdx jdx enabled auto-merge (squash) May 9, 2026 13:12
@jdx jdx merged commit f4cad13 into jdx:main May 9, 2026
35 checks passed
@JamBalaya56562 JamBalaya56562 deleted the docs/tasks-architecture-windows-shebang branch May 9, 2026 13:22
mise-en-dev added a commit that referenced this pull request May 10, 2026
### 🚀 Features

- add --inactive option to outdated and upgrade commands for inactive
tools by @roele in [#9640](#9640)

### 🐛 Bug Fixes

- **(aqua)** resolve bin paths for prefixed v tags by @risu729 in
[#9759](#9759)
- **(bun)** create bunx alongside bun.exe on Windows install by
@JamBalaya56562 in [#9732](#9732)
- **(dotnet)** use shared prerelease tool option by @risu729 in
[#9720](#9720)
- **(node)** use matching node in npm shim by @jdx in
[#9749](#9749)
- **(task)** resolve bash deterministically on Windows to avoid WSL
launcher by @JamBalaya56562 in
[#9750](#9750)

### 📚 Documentation

- **(secrets)** clarify age strict mode default by @risu729 in
[#9737](#9737)
- **(tasks)** add bash shebang to conditional-dependencies example by
@JamBalaya56562 in [#9747](#9747)
- update backend tool option docs by @risu729 in
[#9738](#9738)

### 📦 Registry

- remove tools with zero users by @jdx in
[#9725](#9725)
- add scalafmt
([github:scalameta/scalafmt](https://github.com/scalameta/scalafmt)) by
@pokir in [#9757](#9757)
- remove flarectl by @risu729 in
[#9756](#9756)

### Chore

- **(release)** strip pre-existing sponsor block before appending
canonical one by @jdx in [#9745](#9745)

### New Contributors

- @pokir made their first contribution in
[#9757](#9757)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants