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(serve): check skip_dirs relative to source roots in _local_build_is_stale (#4085)

Abdullah Azmib3ca7c4612a9
diff --git a/packages/cli/src/repowise/cli/commands/serve_cmd/_web_assets.py b/packages/cli/src/repowise/cli/commands/serve_cmd/_web_assets.py
index cbf20d76e..e0021f1ee 100644
--- a/packages/cli/src/repowise/cli/commands/serve_cmd/_web_assets.py
+++ b/packages/cli/src/repowise/cli/commands/serve_cmd/_web_assets.py
@@ -73,11 +73,7 @@ def _find_local_web() -> Path | None:
candidate = candidate.parent
pkg_web = candidate / "packages" / "web"
if (pkg_web / "package.json").exists():
- # Next.js standalone in monorepos nests server under package path
- standalone = pkg_web / ".next" / "standalone" / "packages" / "web" / "server.js"
- if standalone.exists():
- return pkg_web
- return pkg_web # exists but may need build
+ return pkg_web
return None
@@ -122,7 +118,7 @@ def _local_build_is_stale(web_dir: Path) -> bool:
if not root.exists():
continue
for path in root.rglob("*"):
- if any(part in skip_dirs for part in path.parts):
+ if any(part in skip_dirs for part in path.relative_to(root).parts):
continue
try:
if path.is_file() and path.stat().st_mtime > build_mtime:
diff --git a/tests/unit/cli/test_serve_paths.py b/tests/unit/cli/test_serve_paths.py
index 80f311773..fe9e35884 100644
--- a/tests/unit/cli/test_serve_paths.py
+++ b/tests/unit/cli/test_serve_paths.py
@@ -361,6 +361,15 @@ def test_local_build_ignores_skipped_dirs(tmp_path) -> None:
assert serve_cmd._local_build_is_stale(web) is False
[email protected]("parent", ["dist", ".git"])
+def test_local_build_stale_inside_skipped_parent_dir(tmp_path, parent) -> None:
+ repo = tmp_path / parent / "repo"
+ web, _ = _make_web_tree(repo)
+ assert serve_cmd._local_build_is_stale(web) is False
+ os.utime(repo / "packages" / "web" / "src" / "page.tsx", (3_000_000, 3_000_000))
+ assert serve_cmd._local_build_is_stale(web) is True
+
+
def _tarball(files: dict[str, bytes]) -> bytes:
buf = io.BytesIO()
with tarfile.open(fileobj=buf, mode="w:gz") as tar: