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.

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.
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
The key of a repository, 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.
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 "".
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).