#!/usr/bin/env bash

# `mise tasks ls --json` and `mise tasks info --json` should surface the
# resolved `dir` (including any inherited task_config.dir) so consumers see
# where the task will actually run. Previously the raw `self.dir` (often
# null) was reported even when runtime honored the inherited dir.
# See jdx/mise#8673.

mkdir -p mywork

cat <<EOF >mise.toml
[task_config]
dir = "{{config_root}}/mywork"

[tasks.inline]
run = "pwd"
EOF

# Inherited dir should appear in the JSON output rather than null.
assert_contains "mise tasks ls --json" "$(pwd)/mywork"
assert_not_contains "mise tasks ls --json" '"dir": null'
assert_contains "mise tasks info inline --json" "$(pwd)/mywork"
