pub fn resolve_root(
cli: Option<&Path>,
env: Option<&str>,
fallback_cwd: &Path,
) -> Result<ResolvedRoot, RootError>Expand description
Pure resolution function so unit tests can drive every case without touching the process environment.
cli is the value of --root; env is the value of SHELL_MCP_ROOT
(an empty string is treated as unset to match shell ergonomics);
fallback_cwd is what the process believes its cwd to be.
The launch-cwd fallback is intentionally permissive — it accepts
whatever the OS reports — because direct shell invocations
(cd ~/proj && shell-mcp) should still work without ceremony. The
strict absolute-path requirement only applies when the user explicitly
supplied a flag or env value.