generated from coulomb/repo-seed
improved scanner
This commit is contained in:
@@ -103,7 +103,10 @@ class CandidateGraphGenerator:
|
||||
capabilities.append(
|
||||
self._interface_capability(interfaces, tests, examples, docs, chunks)
|
||||
)
|
||||
if llm_providers or provider_registries or fallback_policies:
|
||||
promotable_llm_facts = self._promotable_llm_facts(
|
||||
llm_providers + provider_registries + fallback_policies
|
||||
)
|
||||
if promotable_llm_facts:
|
||||
capabilities.append(
|
||||
self._llm_provider_capability(
|
||||
llm_providers,
|
||||
@@ -269,6 +272,8 @@ class CandidateGraphGenerator:
|
||||
credentials,
|
||||
registries,
|
||||
fallback_policies,
|
||||
) + self._utility_relationship_attributes(
|
||||
providers + credentials + registries + fallback_policies
|
||||
),
|
||||
features=features,
|
||||
evidence=self._evidence(tests, examples, docs),
|
||||
@@ -761,6 +766,37 @@ class CandidateGraphGenerator:
|
||||
def _facts(self, facts: list[ObservedFact], kind: str) -> list[ObservedFact]:
|
||||
return [fact for fact in facts if fact.kind == kind]
|
||||
|
||||
def _promotable_llm_facts(self, facts: list[ObservedFact]) -> list[ObservedFact]:
|
||||
return [
|
||||
fact
|
||||
for fact in facts
|
||||
if self._utility_relationship(fact) in {"owned", "facade", "adapter"}
|
||||
]
|
||||
|
||||
def _utility_relationship(self, fact: ObservedFact) -> str:
|
||||
relationship = fact.metadata.get("utility_relationship")
|
||||
if isinstance(relationship, str) and relationship:
|
||||
return relationship
|
||||
source_role = fact.metadata.get("source_role")
|
||||
if source_role == "implementation_source":
|
||||
lower_path = fact.path.lower()
|
||||
if "adapter" in lower_path or "provider" in lower_path:
|
||||
return "adapter"
|
||||
return "owned"
|
||||
if source_role == "configuration":
|
||||
return "configure"
|
||||
if source_role == "dependency_declaration":
|
||||
return "dependency"
|
||||
if source_role in {"agent_guidance", "ci_tooling"}:
|
||||
return "tooling"
|
||||
if not source_role and fact.path.lower().endswith((".py", ".ts", ".js")):
|
||||
return "owned"
|
||||
return "mention"
|
||||
|
||||
def _utility_relationship_attributes(self, facts: list[ObservedFact]) -> list[str]:
|
||||
relationships = sorted({self._utility_relationship(fact) for fact in facts})
|
||||
return [f"utility-{relationship}" for relationship in relationships]
|
||||
|
||||
def _source_refs(self, facts: list[ObservedFact]) -> list[SourceReference]:
|
||||
return [
|
||||
SourceReference(
|
||||
|
||||
@@ -358,6 +358,10 @@ class DeterministicScanner:
|
||||
source_role = self._source_role(relative)
|
||||
if source_role == "agent_guidance":
|
||||
continue
|
||||
utility_relationship = self._provider_utility_relationship(
|
||||
source_role,
|
||||
relative,
|
||||
)
|
||||
for needle, provider in LLM_PROVIDER_HINTS.items():
|
||||
if not self._has_provider_signal(lower_text, needle):
|
||||
continue
|
||||
@@ -372,6 +376,7 @@ class DeterministicScanner:
|
||||
metadata={
|
||||
"source": "provider_hint",
|
||||
"source_role": source_role,
|
||||
"utility_relationship": utility_relationship,
|
||||
},
|
||||
),
|
||||
)
|
||||
@@ -389,6 +394,7 @@ class DeterministicScanner:
|
||||
metadata={
|
||||
"source": "environment_variable",
|
||||
"source_role": source_role,
|
||||
"utility_relationship": "configure",
|
||||
},
|
||||
),
|
||||
)
|
||||
@@ -412,6 +418,7 @@ class DeterministicScanner:
|
||||
metadata={
|
||||
"source": "provider_registry_hint",
|
||||
"source_role": source_role,
|
||||
"utility_relationship": utility_relationship,
|
||||
},
|
||||
),
|
||||
)
|
||||
@@ -429,11 +436,30 @@ class DeterministicScanner:
|
||||
metadata={
|
||||
"source": "fallback_hint",
|
||||
"source_role": source_role,
|
||||
"utility_relationship": utility_relationship,
|
||||
},
|
||||
),
|
||||
)
|
||||
return facts
|
||||
|
||||
def _provider_utility_relationship(
|
||||
self,
|
||||
source_role: str,
|
||||
relative_path: str,
|
||||
) -> str:
|
||||
if source_role == "implementation_source":
|
||||
lower = relative_path.lower()
|
||||
if "adapter" in lower or "provider" in lower:
|
||||
return "adapter"
|
||||
return "owned"
|
||||
if source_role == "configuration":
|
||||
return "configure"
|
||||
if source_role == "dependency_declaration":
|
||||
return "dependency"
|
||||
if source_role in {"ci_tooling", "agent_guidance"}:
|
||||
return "tooling"
|
||||
return "mention"
|
||||
|
||||
def _source_role(self, relative_path: str) -> str:
|
||||
lower = relative_path.lower()
|
||||
parts = lower.split("/")
|
||||
|
||||
Reference in New Issue
Block a user