diff --git a/src/contextseek/scope.py b/src/contextseek/scope.py index c3f9343..f8b16ba 100644 --- a/src/contextseek/scope.py +++ b/src/contextseek/scope.py @@ -29,6 +29,10 @@ def _lint_scope(scope: str) -> list[str]: issues.append( f"scope '{scope}' has no '/' separator; at least two levels recommended for isolation" ) + if any(part == "" for part in scope.split("/")): + issues.append( + f"scope '{scope}' contains empty path segments; avoid repeated, leading, or trailing slashes" + ) depth = len(scope.strip("/").split("/")) if depth > 6: issues.append( diff --git a/tests/unit_tests/test_scope.py b/tests/unit_tests/test_scope.py index 37a3c8a..984fb2b 100644 --- a/tests/unit_tests/test_scope.py +++ b/tests/unit_tests/test_scope.py @@ -128,6 +128,10 @@ def test_space_flagged(self): issues = _lint_scope("acme/my project") assert issues + def test_empty_segment_flagged(self): + issues = _lint_scope("acme//pay") + assert any("empty" in m or "repeated" in m for m in issues) + def test_clean_scope_has_no_issues(self): assert _lint_scope("acme/payment-service/agent") == []