File-existence check fails to expand ~ in script paths, causing false-positive ask on python3 path/to/script.py
Summary
When Dippy validates a python3 path/to/script.py invocation (or any command form where the script path is checked for existence), ~-prefixed paths are not expanded before the existence check. The check fails because Dippy is looking at <CWD>/~/... (literal tilde concatenated with the working directory) instead of $HOME/.... The command falls back to ask with a "file not found" reason, even though the script exists at the expanded path and the operator clearly intends to run it.
This works against your own design intent: python3 path/to/script.py is the safer form than python3 -c "<inline body>" (the body is statically inspectable in a file), and operators who follow that guidance get prompted anyway whenever the script path uses ~.
Reproduction
$ touch ~/deep-roots/scripts/probe.py
$ cd ~/deep-roots/public_html/hq/vault/systems/fleet-harness
$ python3 ~/deep-roots/scripts/probe.py
Dippy returns ask with reason:
🐤 python3 probe.py: file not found:
/Users/philipstancil/deep-roots/public_html/hq/vault/systems/fleet-harness/~/deep-roots/scripts/probe.py
The "file not found" path is <CWD>/~/<rest> — the ~ is literal, not expanded.
The same shape reproduces with absolute-path invocation if any argument carries a ~, with bash ~/path/to/script.sh, and with any future check that walks script-file existence.
Expected behavior
Expand ~ to $HOME (and ~user to that user's home directory, per OS conventions) before the existence check. In Python: os.path.expanduser(path) is the one-line fix; in Rust: shellexpand::tilde() or dirs::home_dir() + manual prefix substitution.
Why this matters
~-prefixed paths are the canonical form for any command that references home-directory artifacts in shell. Every Claude Code hook script lives at ~/.claude/hooks/...; every Deep Roots vault path is ~/deep-roots/...; most operators have similar conventions. If Dippy can't see those files, it falls back to ask on a meaningful fraction of routine commands.
There's an additional reason this stings: Dippy's design (correctly) prefers python3 path/to/file.py over python3 -c "..." because the script body in a file is statically inspectable while the inline body is not. When the file form gets prompted on a tilde path while the inline form gets prompted unconditionally, the operator has no Dippy-friendly path forward — both forms ask. Fixing tilde expansion restores the file form's intended fast-path.
Related
This is the same class of bug as a recently-filed agnix issue (agent-sh/agnix#894) — file-existence validators that don't expand ~. Different codebase, same pattern.
Environment
- Dippy 0.2.7 (Homebrew tap, macOS arm64)
- macOS 25.3.0 (Darwin)
- Claude Code, PreToolUse:Bash hook integration
- Reproduces with bare
python3 ~/path/script.pyfrom any working directory whose path doesn't start with~
Happy to send a PR if you'd accept it. Thanks again for building this — the AST gating story is solid; this is a small expansion-step gap that erodes value disproportionately.