Expand description
Path and repository-name handling for work facts: one spelling for every
path (forward slashes, no trailing slash), repository-relative paths so
two clones of the same repository compare equal, owner/repo from a
remote URL, and where bashwrap keeps an agent’s live working folder.
Constants§
- CWD_
STATE_ 🔒FILE_ OVERRIDE_ ENV - bashwrap’s override for its cwd state file (
crates/bashwrap/src/bash_wrap.rs,CWD_STATE_FILE_OVERRIDE_ENV). When a block’s env sets it, that is the file.
Functions§
- clean_
relative - A repository-relative path as a caller typed it: forward slashes, no
leading
./or/, no trailing slash..is the whole repository (""). - cwd_
state_ file - Where bashwrap keeps this agent’s live working folder:
~/.agentmux/state/bashwrap-cwd/<key>.cwd, unless the env overrides it. - cwd_
state_ 🔒key - The key bashwrap names an agent’s cwd state file by: the block’s
AGENTMUX_INSTANCE_SLUG, else itsAGENTMUX_AGENT_ID, else the registered agent id; sanitized the way bashwrap does. - is_
absolute - Whether
rawnames an absolute path in any of the spellings agents use. - normalize_
path - One spelling for a path:
\becomes/, an MSYS/c/...becomesC:/..., repeated slashes collapse and a trailing slash goes. - normalize_
repo owner/repo, lowercase, from a remote URL in any of git’s spellings (https://host/owner/repo.git,git@host:owner/repo,ssh://...), or from anowner/repoa caller typed. Credentials in a URL never survive: only the last two path segments are kept.- path_
matches - Whether the repository-relative
fileistargetor inside it. An empty target is the whole repository. A file ending in/is an untracked folder git reported whole, which matches anything inside it too. - relative_
to pathrelative toroot(both normalized), orNonewhen it isn’t inside it. The root itself is"".- same_
text 🔒 - Paths compare without case on Windows, where the file system does.
- working_
folder - The agent’s working folder: the live one bashwrap recorded when it names
a folder that still exists, else the folder it started in (
cmd:cwd).