Open-source skills for designing and reviewing software with AI agents
Python agent-skillsai-agentsantigravityclaude-codeclaude-code-pluginclaude-skillscodexcodex-plugincoding-agentscontext-engineeringdeveloper-toolsgeminillmmulti-agentprompt-engineeringspec-driven-development
fix(tests): make offline checks portable to Windows
Nagi-Inabadd7dc59226af
diff --git a/.gitattributes b/.gitattributesnew file mode 100644index 0000000..dfdb8b7--- /dev/null+++ b/.gitattributes@@ -0,0 +1 @@+*.sh text eol=lfdiff --git a/.github/workflows/tests.yml b/.github/workflows/tests.ymlindex a67c5f4..eb73f33 100644--- a/.github/workflows/tests.yml+++ b/.github/workflows/tests.yml@@ -27,7 +27,10 @@ permissions:jobs:unit:- runs-on: ubuntu-24.04+ strategy:+ matrix:+ os: [ubuntu-24.04, windows-2025]+ runs-on: ${{ matrix.os }}steps:- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1with:@@ -36,4 +39,5 @@ jobs:with:python-version: '3.12'- run: pip install pytest==8.3.5 pyyaml==6.0.2- - run: pytest tests/unit+ - run: python -m pytest tests/unit+ shell: bashdiff --git a/TESTING.md b/TESTING.mdindex e784e0b..6354dec 100644--- a/TESTING.md+++ b/TESTING.md@@ -32,6 +32,16 @@ dependencies. They validate YAML frontmatter schemas and relative linkintegrity, the portable plugin manifest, shared metadata consistency, andmarketplace/component paths.+The read-hook tests also require a POSIX `sh` on `PATH`. On Windows, use+Git for Windows and run the tests from Git Bash, or add its `bin` directory+(containing `sh.exe`) to `PATH` in the current PowerShell session. Create+the environment with `python -m venv .venv`, then activate it with+`.venv\Scripts\Activate.ps1` in PowerShell or `source .venv/Scripts/activate`+in Git Bash. Install the test dependencies as described above.+Shell scripts use LF line endings through `.gitattributes`, including when+Git's `core.autocrlf` is enabled. CI runs this offline suite on Ubuntu and+Windows; this does not establish native host workflow support.+```bash# Run all unit testspytest tests/unitdiff --git a/tests/unit/test_claude_traces.py b/tests/unit/test_claude_traces.pyindex 364cbee..5177eec 100644--- a/tests/unit/test_claude_traces.py+++ b/tests/unit/test_claude_traces.py@@ -3,8 +3,9 @@"""Offline regression coverage for Claude's native transcript directory."""-from pathlib import Path+from pathlib import Path, PurePosixPath, PureWindowsPathimport runpy+from unittest.mock import Mockimport pytest@@ -12,8 +13,16 @@ ROOT = Path(__file__).resolve().parents[2]@pytest.mark.parametrize("config_mode", ["unset", "default", "custom"])+ ("workspace_path", "project_name"),+ [+ (PurePosixPath("/work/egm probe.v1"), "-work-egm-probe-v1"),+ (PureWindowsPath(r"C:\work\egm probe.v1"), "C--work-egm-probe-v1"),+ ],+)def test_trace_directory(- tmp_path: Path, monkeypatch: pytest.MonkeyPatch, config_mode: str+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch, config_mode: str,+ workspace_path: PurePosixPath | PureWindowsPath, project_name: str,) -> None:trace_directory = runpy.run_path(str(ROOT / "tests/integration/test_claude.py"))["trace_directory"@@ -27,6 +36,8 @@ def test_trace_directory(config = tmp_path / "custom config"monkeypatch.setenv("CLAUDE_CONFIG_DIR", str(config))- assert trace_directory(Path("/work/egm probe.v1")) == (- config / "projects" / "-work-egm-probe-v1"+ workspace = Mock(spec=Path)+ workspace.resolve.return_value = workspace_path+ assert trace_directory(workspace) == (+ config / "projects" / project_name)diff --git a/tests/unit/test_harnesses.py b/tests/unit/test_harnesses.pyindex 1be5264..bb99eb0 100644--- a/tests/unit/test_harnesses.py+++ b/tests/unit/test_harnesses.py@@ -156,12 +156,12 @@ READ_HOOK = ".claude-plugin/hooks/allow_plugin_reads.sh"def run_read_hook(tool_name: str, tool_input: dict) -> str:result = subprocess.run(- [str(ROOT / READ_HOOK)],+ ["sh", (ROOT / READ_HOOK).as_posix()],input=json.dumps({"tool_name": tool_name, "tool_input": tool_input}),capture_output=True,text=True,check=True,- env={**os.environ, "CLAUDE_PLUGIN_ROOT": str(ROOT)},+ env={**os.environ, "CLAUDE_PLUGIN_ROOT": ROOT.as_posix()},)return result.stdout@@ -198,7 +198,7 @@ def test_claude_read_hook_approves_plugin_folders_only(tool_name: str, tool_input: dict, allowed: bool) -> None:"""Only clean paths in the folders EGM reads skip the permission prompt."""- tool_input = {k: v.replace("{root}", str(ROOT)) for k, v in tool_input.items()}+ tool_input = {k: v.replace("{root}", ROOT.as_posix()) for k, v in tool_input.items()}output = run_read_hook(tool_name, tool_input)assert ('"permissionDecision":"allow"' in output) is allowed