generated from coulomb/repo-seed
first steps to better scanning of repos
This commit is contained in:
@@ -42,6 +42,22 @@ def test_deterministic_scanner_extracts_structural_facts(tmp_path):
|
||||
assert languages == {"Python": 2}
|
||||
|
||||
|
||||
def test_scanner_records_scope_with_source_role(tmp_path):
|
||||
repo = tmp_path / "sample"
|
||||
repo.mkdir()
|
||||
(repo / "SCOPE.md").write_text(
|
||||
"# SCOPE\n\n## One-liner\n\nProvides OIDC profile enforcement.\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
result = DeterministicScanner().scan(repo)
|
||||
|
||||
scope_fact = next(fact for fact in result.facts if fact.kind == "scope")
|
||||
assert scope_fact.name == "SCOPE"
|
||||
assert scope_fact.path == "SCOPE.md"
|
||||
assert scope_fact.metadata["source_role"] == "scope_summary"
|
||||
|
||||
|
||||
def test_scanner_readme_only_fixture_records_docs_without_interfaces(tmp_path):
|
||||
repo = write_readme_only_repo(tmp_path)
|
||||
|
||||
@@ -116,3 +132,28 @@ def test_scanner_records_llm_provider_and_fallback_facts(tmp_path):
|
||||
assert ("credential_config", "Anthropic API key", ".env.example") in facts
|
||||
assert ("provider_registry", "LLM provider registry", "providers.py") in facts
|
||||
assert ("fallback_policy", "LLM provider fallback policy", "README.md") in facts
|
||||
|
||||
|
||||
def test_scanner_does_not_treat_agent_guidance_as_llm_provider(tmp_path):
|
||||
repo = tmp_path / "key-cape-like"
|
||||
repo.mkdir()
|
||||
(repo / "README.md").write_text(
|
||||
"# KeyCape\n\n"
|
||||
"Backend adapters live in src/internal/adapters.\n\n"
|
||||
"See `CLAUDE.md` for agent session protocol.\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
(repo / "CLAUDE.md").write_text(
|
||||
"# CLAUDE.md\n\n"
|
||||
"This file provides guidance to Claude Code when working in this repo.\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
(repo / "src").mkdir()
|
||||
(repo / "src" / "go.mod").write_text("module keycape\n", encoding="utf-8")
|
||||
|
||||
result = DeterministicScanner().scan(repo)
|
||||
|
||||
facts = {(fact.kind, fact.name, fact.path) for fact in result.facts}
|
||||
assert ("llm_provider", "Claude", "CLAUDE.md") not in facts
|
||||
assert ("llm_provider", "Claude", "README.md") not in facts
|
||||
assert ("provider_registry", "LLM provider registry", "README.md") not in facts
|
||||
|
||||
Reference in New Issue
Block a user