Skip to main content

join_cwd

Function join_cwd 

Source
pub fn join_cwd(cur: Option<&str>, target: &str) -> Option<String>
Expand description

Resolve a cd target to a new working directory. cur is the current cwd, needed for a relative target. Used by intra-line cd tracking (HP-19 #2).

A target that cannot be pinned yields [UNRESOLVED_CWD], NOT None. This used to return None for ~… and $VAR, and the caller reads None as “no cd happened” and keeps the previous cwd — so the cd was silently ignored and every later relative path was judged against a workspace the shell had already left. cd ~/.aws && cat credentials and cd ~/.claude && echo … > settings.json both auto-approved that way, the second writing the very file the allowlist bridge trusts. None now means only what the caller can act on: cd_target already returned None for “not a cd” (bare cd, cd -), so reaching here means the shell definitely moved.

~/~/… are EXPANDED rather than blanket-refused, because they are pinnable — that keeps cd ~/.aws && cat credentials gated as the credential read it is instead of coarsely denying everything downstream.