Files
Trung Nguyen dca687987e hooks/builtins: name the resolved shell in the env block
The session_start env block previously named the OS but not the shell.
When the model reads 'Operating System: Windows' it defaults to POSIX
syntax by habit and emits '&&', 'grep', 'head', '2>/dev/null', 'ls -la',
'$(pwd)' — none of which work under Windows PowerShell 5.1 or cmd.exe.
The shell tool description already carries a shell-specific hint
(shellSyntaxHint), but it sits far from the user turn and is drowned
out by the agent's own system prompt; the env block sits at the top
of every turn and is cached, so that is where the disambiguation
belongs.

Resolve the shell via the shared shellpath.DetectShell helper and print
its base name plus the resolved path. Long-form dialect rules stay in
the shell tool description (shellSyntaxHint) so this block stays terse
and doesn't diverge from them.

The base-name derivation lives in a new shellpath.ShellBaseName helper
so the same logic isn't copied into hooks/builtins.

No behaviour change on darwin/linux where the shell defaults to $SHELL
or /bin/sh; the extra 'Shell:' line lands cleanly in the existing
tab-indented env block.
2026-08-31 09:00:17 +02:00
..