Skip to main content

Module resolver

Module resolver 

Source
Expand description

Root resolution logic for determining Project boundaries

Implements the root resolution algorithms from PROJECT_ROOT_SPEC.md and 02_DESIGN.md [H2]:

  • GitRoot mode: Each git repository gets its own Project
  • WorkspaceFolder mode: Each workspace folder is a Project
  • WorkspaceRoot mode: Single Project covering all folders

§Fallback Chain (gitRoot mode, per C1)

1. Walk ancestors of file looking for .git
2. IF .git found → use git root
3. ELSE IF workspace folders exist → use containing folder or first folder
4. ELSE (single-file mode) → use parent directory

Functions§

canonicalize_and_resolve
Canonicalize a path and resolve its index root.
find_git_root
Find the git root for a file path by walking ancestors.
resolve_index_root
Resolve the index root for a file path based on mode and workspace context.