Expand description
Workspace-root utilities. Today’s only consumer is the memstead_health
OUTER_REPO_NOT_IGNORING_MEM_REPO warning surfaced by the MCP layer:
when the workspace is embedded inside another git repository, the
mem-repo-git directory must be excluded by the outer repo’s
.gitignore to avoid the gitlink trap.
Pure path-walking — no IO beyond metadata / read_to_string for
the gitignore probe — so this module is safe to call from any
engine surface, including read-only health queries.
Functions§
- find_
enclosing_ git_ repo - Walk parent directories from
workspace_root.parent()upward looking for a.gitdirectory or file. Returns the first ancestor that carries one, orNonewhen none exist (for example, the workspace is not embedded inside another git repository). - outer_
repo_ ignores_ mem_ repo - Returns
truewhen the outer repo atouter_repo_rootcontains a.gitignoreline that ignoresmem-repo/(with or without a leading workspace-relative prefix). The match is whitespace- and trailing-slash-insensitive:mem-repo,mem-repo/,memstead/mem-repo, andmemstead/mem-repo/all count as “ignored.” A negation (!mem-repo/) cancels the match.