Skip to main content

find_workspace_root

Function find_workspace_root 

Source
pub fn find_workspace_root(start: &Path) -> Option<PathBuf>
Expand description

Walk upward from start looking for the first ancestor that contains .memstead/workspace.toml (the post-rebuild workspace marker). Returns the first ancestor directory carrying the marker, or None if the walk reaches filesystem root without finding one.

Both files and directories are accepted as start. A plain file’s parent is used as the first candidate; for a directory, the directory itself is the first candidate.

Deeper-marker semantics: because the walk is upward and stops at the first match, an inner workspace nested inside an outer one resolves to the inner.

Mirrors memstead-mcp/src/main.rs::find_workspace_root and the per-command walkers in memstead-cli/src/commands/link.rs / memstead-cli/src/commands/publish.rs. Keep the resolution rules in sync if any of these change.