diff --git a/src/skillspector/nodes/build_context.py b/src/skillspector/nodes/build_context.py index 694a048..225c26d 100644 --- a/src/skillspector/nodes/build_context.py +++ b/src/skillspector/nodes/build_context.py @@ -87,7 +87,10 @@ def _walk_skill_files(skill_dir: Path) -> list[str]: continue try: rel = item.relative_to(skill_dir) - paths.append(str(rel)) + # Use forward slashes on every OS: these relative paths are dict keys + # and SARIF/URI locations, so they must be portable (not OS-specific + # backslashes on Windows). + paths.append(rel.as_posix()) except ValueError: logger.debug("Skipping path (not under skill_dir): %s", item) continue diff --git a/tests/nodes/analyzers/test_semantic_developer_intent.py b/tests/nodes/analyzers/test_semantic_developer_intent.py index 0ddc704..408daa9 100644 --- a/tests/nodes/analyzers/test_semantic_developer_intent.py +++ b/tests/nodes/analyzers/test_semantic_developer_intent.py @@ -342,7 +342,7 @@ def _build_file_cache(skill_dir: Path) -> dict[str, str]: for item in sorted(skill_dir.rglob("*")): if not item.is_file(): continue - rel = str(item.relative_to(skill_dir)) + rel = item.relative_to(skill_dir).as_posix() # forward slashes on every OS try: cache[rel] = item.read_text(encoding="utf-8", errors="replace") except OSError: diff --git a/tests/nodes/analyzers/test_semantic_security_discovery.py b/tests/nodes/analyzers/test_semantic_security_discovery.py index 85209f6..5b0c53b 100644 --- a/tests/nodes/analyzers/test_semantic_security_discovery.py +++ b/tests/nodes/analyzers/test_semantic_security_discovery.py @@ -317,7 +317,7 @@ def _build_file_cache(skill_dir: Path) -> dict[str, str]: for item in sorted(skill_dir.rglob("*")): if not item.is_file(): continue - rel = str(item.relative_to(skill_dir)) + rel = item.relative_to(skill_dir).as_posix() # forward slashes on every OS try: cache[rel] = item.read_text(encoding="utf-8", errors="replace") except OSError: diff --git a/tests/nodes/test_semantic_quality_policy.py b/tests/nodes/test_semantic_quality_policy.py index f80960b..9d52d33 100644 --- a/tests/nodes/test_semantic_quality_policy.py +++ b/tests/nodes/test_semantic_quality_policy.py @@ -289,7 +289,7 @@ def _build_file_cache(skill_dir: Path) -> dict[str, str]: for item in sorted(skill_dir.rglob("*")): if not item.is_file(): continue - rel = str(item.relative_to(skill_dir)) + rel = item.relative_to(skill_dir).as_posix() # forward slashes on every OS try: cache[rel] = item.read_text(encoding="utf-8", errors="replace") except OSError: diff --git a/tests/test_mcp_least_privilege.py b/tests/test_mcp_least_privilege.py index 9e7852e..8195986 100644 --- a/tests/test_mcp_least_privilege.py +++ b/tests/test_mcp_least_privilege.py @@ -98,7 +98,7 @@ def _make_state(fixture_name: str) -> dict: continue if item.name.startswith(".") and not item.name.startswith(".claude"): continue - rel = str(item.relative_to(fixture_dir)) + rel = item.relative_to(fixture_dir).as_posix() # forward slashes on every OS components.append(rel) components.sort() diff --git a/tests/test_mcp_tool_poisoning.py b/tests/test_mcp_tool_poisoning.py index 7d5b524..428897c 100644 --- a/tests/test_mcp_tool_poisoning.py +++ b/tests/test_mcp_tool_poisoning.py @@ -121,7 +121,7 @@ def _make_state( continue if item.name.startswith(".") and not item.name.startswith(".claude"): continue - rel = str(item.relative_to(fixture_dir)) + rel = item.relative_to(fixture_dir).as_posix() # forward slashes on every OS components.append(rel) components.sort()