Skip to content

Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.

fix(workspace): detect src-layout packages as service boundaries (#3897)

Raghav Chamadiyafba5806250c1
diff --git a/packages/core/src/repowise/core/workspace/extractors/service_boundary.py b/packages/core/src/repowise/core/workspace/extractors/service_boundary.py
index ba0f60cc9..89b8dbb52 100644
--- a/packages/core/src/repowise/core/workspace/extractors/service_boundary.py
+++ b/packages/core/src/repowise/core/workspace/extractors/service_boundary.py
@@ -143,6 +143,14 @@ def detect_service_boundaries(repo_path: Path) -> list[ServiceBoundary]:
except (PermissionError, OSError):
has_source = False
+ if not has_source and "src" in dirnames:
+ # src-layout packages (src/<pkg>/...) keep sources below the first level
+ has_source = any(
+ Path(f).suffix.lower() in _SOURCE_EXTENSIONS
+ for _, _, fs in walk_repo(Path(dirpath, "src"))
+ for f in fs
+ )
+
if not has_source:
continue
diff --git a/tests/unit/workspace/test_extractor_traversal.py b/tests/unit/workspace/test_extractor_traversal.py
index e99828444..b1157851a 100644
--- a/tests/unit/workspace/test_extractor_traversal.py
+++ b/tests/unit/workspace/test_extractor_traversal.py
@@ -112,3 +112,14 @@ def test_service_boundary_under_a_source_package_named_build(tmp_path: Path) ->
assert "services/build" in paths
assert "services/dist" not in paths
+
+
+def test_src_layout_package_is_a_service_boundary(tmp_path):
+ from repowise.core.workspace.extractors.service_boundary import detect_service_boundaries
+
+ pkg = tmp_path / "packages" / "cli"
+ (pkg / "src" / "tool" / "cmds").mkdir(parents=True)
+ (pkg / "pyproject.toml").write_text("[project]\nname='cli'\n")
+ (pkg / "src" / "tool" / "cmds" / "run.py").write_text("x = 1\n")
+
+ assert [b.service_path for b in detect_service_boundaries(tmp_path)] == ["packages/cli"]