请严格按下面清单使用 Bash tool 发起 tool call。这个脚本只用于制造 Bash shell-provider 轨迹。
Bash tool call,不要合并多个 case。command 和 description。Read / Grep / Glob / Edit / Write / Agent / WebSearch 等其他工具。/tmp/zcode-bash-shell-profile-* 和 /tmp/zcode-bash-shell-profile-last-*,不要创建或修改其他测试文件。DONE。{
"description": "Print shell identity and process substitution output",
"command": "printf 'CASE01 shell0=%s\\n' \"$0\"\nprintf 'CASE01 versions bash=%s zsh=%s\\n' \"${BASH_VERSION:-}\" \"${ZSH_VERSION:-}\"\ncat <(printf 'CASE01 process-substitution-ok\\n')"
}
{
"description": "Check login shell mode",
"command": "if [ -n \"${BASH_VERSION:-}\" ]; then\n shopt -q login_shell\nelif [ -n \"${ZSH_VERSION:-}\" ]; then\n [[ -o login ]]\nelse\n false\nfi\nrc=$?\nprintf 'CASE02 login_rc=%s\\n' \"$rc\"\nprintf 'CASE02 shell_versions bash=%s zsh=%s\\n' \"${BASH_VERSION:-}\" \"${ZSH_VERSION:-}\""
}
{
"description": "Run bash or zsh array and pipeline status syntax",
"command": "if [ -n \"${BASH_VERSION:-}\" ]; then\n arr=(a b)\n printf 'CASE03 array=%s\\n' \"${arr[1]}\"\n false | true\n printf 'CASE03 pipe=%s %s\\n' \"${PIPESTATUS[0]}\" \"${PIPESTATUS[1]}\"\nelif [ -n \"${ZSH_VERSION:-}\" ]; then\n arr=(a b)\n printf 'CASE03 array=%s\\n' \"${arr[2]}\"\n false | true\n printf 'CASE03 pipe=%s %s\\n' \"${pipestatus[1]}\" \"${pipestatus[2]}\"\nelse\n printf 'CASE03 unsupported-shell\\n'\nfi"
}
{
"description": "Run double bracket regex syntax",
"command": "if [[ \"alpha-123\" =~ ^alpha-[0-9]+$ ]]; then\n printf 'CASE04 regex-match\\n'\nelse\n printf 'CASE04 regex-no-match\\n'\nfi"
}
Tool 参数:timeout: 3000
{
"description": "Confirm stdin closes without blocking",
"timeout": 3000,
"command": "cat >/tmp/zcode-bash-shell-profile-stdin.txt\nprintf 'CASE05 after-cat\\n'"
}
{
"description": "Set persisted working directory inside workspace",
"command": "START=\"$(pwd -P)\"\nif [ -d \"$START/apps/zcode-cli\" ]; then\n NEXT=\"$START/apps/zcode-cli\"\nelif [ -d \"$START/packages/core\" ]; then\n NEXT=\"$START/packages/core\"\nelif [ -d \"$START/src\" ]; then\n NEXT=\"$START/src\"\nelse\n NEXT=\"$START\"\nfi\nprintf '%s\\n' \"$START\" > /tmp/zcode-bash-shell-profile-last-start-cwd\nprintf '%s\\n' \"$NEXT\" > /tmp/zcode-bash-shell-profile-last-inside-cwd\ncd \"$NEXT\"\nprintf 'CASE06 start=%s\\n' \"$START\"\nprintf 'CASE06 pwd=%s\\n' \"$(pwd -P)\"\nprintf 'CASE06 cwd-set-inside\\n'"
}
{
"description": "Use persisted working directory",
"command": "printf 'CASE07 pwd=%s\\n' \"$(pwd -P)\"\nprintf 'CASE07 saved=%s\\n' \"$(cat /tmp/zcode-bash-shell-profile-last-inside-cwd)\"\nprintf 'CASE07 cwd-persisted-inside\\n'"
}
{
"description": "Fail after changing directory",
"command": "FAILED_OUT=\"/tmp/zcode-bash-shell-profile-failed-cwd-${USER:-user}-$(date +%s)-$$\"\nmkdir -p \"$FAILED_OUT\"\ncd \"$FAILED_OUT\"\nprintf 'CASE08 before-fail-pwd=%s\\n' \"$(pwd -P)\"\nexit 3"
}
{
"description": "Print working directory after failed command",
"command": "printf 'CASE09 after-failed-cd-pwd=%s\\n' \"$(pwd -P)\""
}
{
"description": "Change to outside temp directory successfully",
"command": "OUTSIDE=\"/tmp/zcode-bash-shell-profile-reset-cwd-${USER:-user}-$(date +%s)-$$\"\nmkdir -p \"$OUTSIDE\"\nprintf '%s\\n' \"$OUTSIDE\" > /tmp/zcode-bash-shell-profile-last-outside-cwd\ncd \"$OUTSIDE\"\nprintf 'CASE10 outside-success-pwd=%s\\n' \"$(pwd -P)\"\nprintf 'CASE10 outside-success\\n'"
}
{
"description": "Print working directory after outside reset",
"command": "printf 'CASE11 after-reset-pwd=%s\\n' \"$(pwd -P)\"\nprintf 'CASE11 start=%s\\n' \"$(cat /tmp/zcode-bash-shell-profile-last-start-cwd)\"\nprintf 'CASE11 outside=%s\\n' \"$(cat /tmp/zcode-bash-shell-profile-last-outside-cwd)\""
}
{
"description": "Return stdout stderr and nonzero exit",
"command": "printf 'CASE12 stdout-before-fail\\n'\nprintf 'CASE12 stderr-before-fail\\n' >&2\nexit 7"
}
{
"description": "Run empty successful command",
"command": "true"
}
{
"description": "Emit large stdout for persisted output",
"command": "i=0\nwhile [ \"$i\" -lt 2200 ]; do\n printf 'CASE14-%04d abcdefghijklmnopqrstuvwxyz\\n' \"$i\"\n i=$((i + 1))\ndone"
}
{
"description": "Emit png data URI stdout",
"command": "printf '%s' 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+/p9sAAAAASUVORK5CYII='"
}
{
"description": "Emit png data URI then fail",
"command": "printf '%s\\n' 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+/p9sAAAAASUVORK5CYII='\nprintf 'CASE16 stderr-before-fail\\n' >&2\nexit 5"
}
{
"description": "Run shell time keyword",
"command": "{ time printf 'CASE17 time-body\\n'; } 2>&1"
}
{
"description": "Run ripgrep no match command",
"command": "TMP=\"$(mktemp -d /tmp/zcode-bash-shell-profile-rg.XXXXXX)\"\nprintf 'abc\\n' > \"$TMP/file.txt\"\nrg 'definitely-no-match-zcode-shell-profile' \"$TMP\""
}
Tool 参数:run_in_background: true
{
"description": "Run background shell command",
"run_in_background": true,
"command": "sleep 1\nprintf 'CASE19 background stdout\\n'\nprintf 'CASE19 background stderr\\n' >&2"
}
{
"description": "Print final shell state",
"command": "printf 'CASE20 pwd=%s\\n' \"$(pwd -P)\"\nprintf 'CASE20 versions bash=%s zsh=%s\\n' \"${BASH_VERSION:-}\" \"${ZSH_VERSION:-}\""
}
如果当前 session 运行在 Windows,再执行这个 case;否则跳过。
{
"description": "Print Windows Git Bash shell details",
"command": "printf 'CASE21 shell0=%s\\n' \"$0\"\nprintf 'CASE21 bash=%s\\n' \"${BASH_VERSION:-}\"\nprintf 'CASE21 pwd=%s\\n' \"$(pwd -P)\"\narr=(win bash)\nprintf 'CASE21 array=%s\\n' \"${arr[1]}\"\ncat <(printf 'CASE21 process-substitution\\n')"
}