Skip to main content

resolve_effective_project

Function resolve_effective_project 

Source
pub async fn resolve_effective_project(
    inputs: &ProjectResolveInputs<'_>,
    user_default: Option<ProjectBinding>,
    git_url: Option<&str>,
    client: &ApiClient,
) -> Result<Option<(ProjectBinding, ProjectSource)>, Box<dyn Error>>
Expand description

Full project-attribution precedence chain: --project flag → subagent override → session active → config default (all pure, via effective_project; no network call) → server-side deduction from the repo’s git remote → user-level default. Deduction outranks the user-level default — this falls out of the ordering below: the user default is only consulted once deduction has returned None.

An Ambiguous deduction result is an error (the caller can’t safely guess among several candidate projects); a Resolved deduction emits a warning so the user knows attribution wasn’t explicit. Returns Ok(None) only when every tier in the chain is empty — the caller turns that into a “project required” error where appropriate.