pub fn resolve_project(
storage: &SqliteStorage,
explicit: Option<&str>,
) -> Result<Project>Expand description
Resolve a project from explicit input or CWD.
Accepts a project ID, a filesystem path, or None for CWD auto-detection.
Always validates against the database — sessions can only be created for
registered projects.
§Resolution
Explicit value (Some):
- Try as project ID (
storage.get_project) - Try as filesystem path, canonicalized (
storage.get_project_by_path) - Error with
ProjectNotFound
Auto-detect (None):
- Canonicalize CWD
- Check CWD and parent directories against known project paths (longest match)
- Fall back to
.savecontext/directory discovery (legacy) - Error with
NoProjectForDirectorylisting available projects
§Errors
Returns ProjectNotFound or NoProjectForDirectory if no match is found.