Skip to main content

Module paths

Module paths 

Source
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 its AGENTMUX_AGENT_ID, else the registered agent id; sanitized the way bashwrap does.
is_absolute
Whether raw names an absolute path in any of the spellings agents use.
normalize_path
One spelling for a path: \ becomes /, an MSYS /c/... becomes C:/..., 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 an owner/repo a caller typed. Credentials in a URL never survive: only the last two path segments are kept.
path_matches
Whether the repository-relative file is target or 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
path relative to root (both normalized), or None when 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).