pub fn discover(
repo: &Repository,
sources: &Sources,
source: &dyn DiscoverySource,
) -> Result<(Vec<DiscoveredFile>, Vec<Diagnostic>), Error>Expand description
Run every class of sources through source, in declared class order, each class’s
files sorted by path. A file two classes both match is kept under the first and reported.
One precedence rule stands above class order, and the manifest states it rather than
this function: a file name listed under context.documents carries the context
contract wherever it appears under the layer, so it belongs to the class that
produces context documents and to no other. Without it a directory’s contract would be
discovered only where some unrelated class’s pathspec happened to reach — .ai/repo/rules/README.md
through the rule class, .ai/repo/ci/README.md through nothing at all — which is
discovery by accident, and it left the root of the hierarchy invisible to every
projection. The rule applies only when a class declares the kind, so a layer that
declares no context class is read exactly as before.