A tiny, local-first CLI that finds the files your AI coding agent actually needs — and packs them into a focused context.
| 1 | """Tests for explain / repository map.""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | from pathlib import Path |
| 6 | |
| 7 | from agent_context.explain import explain_repository, format_repo_map |
| 8 | |
| 9 | |
| 10 | def test_explain_sample(sample_repo: Path): |
| 11 | repo_map = explain_repository(sample_repo) |
| 12 | text = format_repo_map(repo_map) |
| 13 | assert "Repository Map" in text |
| 14 | assert "Detected technology" in text |
| 15 | # Should pick up Next/TS/Mongo from package.json heuristics |
| 16 | joined = " ".join(repo_map.stack).lower() |
| 17 | assert "next" in joined or "node" in joined or "typescript" in joined |
| 18 | data = repo_map.to_dict() |
| 19 | assert "likely_architecture" in data |
| 20 | assert any("heuristic" in n.lower() for n in repo_map.notes) |