shell: expand tildes in backtick commands with REPL completion support
Implement `~` and `~username` expansion in backtick command literals,
matching the behavior of POSIX shells. Tilde at the start of a word is
expanded via `expanduser` at parse time; mid-word or quoted tildes are
left as-is.
Add REPL tab-completion for tilde paths in backtick and shell mode
contexts: bare `~` completes to `~/` plus `~name/` for real local
users, while `~/prefix` completes paths in the home directory keeping
the contracted tilde form.
Refactor `parse_dollar_interp` as a local function taking `st` as an
explicit argument to avoid closure boxing of outer variables.
Remove the now-redundant `expanduser` call in `repl_cmd`, since
`shell_parse` handles tilde expansion at parse time.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>