Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.
Python aicode-complexitycode-healthcode-intelligencecode-qualitydead-codedeveloper-toolsdocumentationgit-analyticsmcpopen-sourcepythonrefactoringstatic-analysistechnical-debt
fix(decisions): discover changelogs under docs/, doc/, .github/ (#243)
Raghav Chamadiyab1895cbcbfca
diff --git a/packages/core/src/repowise/core/analysis/decision_extractor.py b/packages/core/src/repowise/core/analysis/decision_extractor.pyindex 0b376c361..4e0326a91 100644--- a/packages/core/src/repowise/core/analysis/decision_extractor.py+++ b/packages/core/src/repowise/core/analysis/decision_extractor.py@@ -1001,13 +1001,28 @@ class DecisionExtractor:return decisionsdef _find_changelog(self) -> Path | None:- """Locate a top-level CHANGELOG/HISTORY/NEWS file (any extension)."""- for p in sorted(self._repo_path.glob("*")):- if not p.is_file():+ """Locate a CHANGELOG/HISTORY/NEWS file (any extension).++ Checks the repo root first, then the conventional documentation+ subdirectories (``docs/``, ``doc/``, ``.github/``). Many projects keep+ their changelog under ``docs/`` rather than at the root, so a root-only+ scan silently skips this source.+ """+ search_dirs = [+ self._repo_path,+ self._repo_path / "docs",+ self._repo_path / "doc",+ self._repo_path / ".github",+ ]+ for directory in search_dirs:+ if not directory.is_dir():continue- stem = re.sub(r"[^a-z]", "", p.stem.lower())- if stem in _CHANGELOG_NAMES:- return p+ for p in sorted(directory.glob("*")):+ if not p.is_file():+ continue+ stem = re.sub(r"[^a-z]", "", p.stem.lower())+ if stem in _CHANGELOG_NAMES:+ return preturn Nonedef _parse_changelog(self, content: str) -> list[tuple[str, str]]:diff --git a/tests/unit/analysis/test_decision_sources.py b/tests/unit/analysis/test_decision_sources.pyindex f5f5db5ca..9c8299ac3 100644--- a/tests/unit/analysis/test_decision_sources.py+++ b/tests/unit/analysis/test_decision_sources.py@@ -106,6 +106,20 @@ async def test_mine_changelog_extracts_decision_sections(tmp_path):assert all(d.source == "changelog" for d in decisions)+async def test_mine_changelog_finds_changelog_under_docs(tmp_path):+ # Many projects keep the changelog under docs/ rather than at the root.+ docs = tmp_path / "docs"+ docs.mkdir()+ (docs / "CHANGELOG.md").write_text(_CHANGELOG, encoding="utf-8")++ ex = DecisionExtractor(repo_path=tmp_path) # no provider → raw bullets+ decisions = await ex.mine_changelog()++ texts = [d.decision for d in decisions]+ assert any("Migrate the auth layer" in t for t in texts)+ assert all(d.source == "changelog" for d in decisions)++async def test_extract_all_runs_deterministic_sources_and_gates(tmp_path):adr_dir = tmp_path / "docs" / "adr"adr_dir.mkdir(parents=True)