diff --git a/pyproject.toml b/pyproject.toml index e5ac5d1..de74849 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "vibeshed" -version = "0.2.0" +version = "0.2.1" description = "Vibe Coding Framework for Personal Automations — agent-agnostic CLI for vibe-coded jobs with passthrough params, exit-code results, and enforced timeouts." readme = "README.md" license = { file = "LICENSE" } diff --git a/src/vibeshed/__init__.py b/src/vibeshed/__init__.py index d3ec452..3ced358 100644 --- a/src/vibeshed/__init__.py +++ b/src/vibeshed/__init__.py @@ -1 +1 @@ -__version__ = "0.2.0" +__version__ = "0.2.1" diff --git a/src/vibeshed/templates_loader.py b/src/vibeshed/templates_loader.py index f710851..9c4f3a1 100644 --- a/src/vibeshed/templates_loader.py +++ b/src/vibeshed/templates_loader.py @@ -66,8 +66,14 @@ def _resolve(rel_path: str) -> Any: return node +_IGNORED_DIRS = frozenset({"__pycache__"}) +_IGNORED_SUFFIXES = (".pyc", ".pyo") + + def _walk_files(node: Any, prefix: str) -> Iterator[Tuple[str, str]]: for child in sorted(node.iterdir(), key=lambda c: c.name): + if child.name in _IGNORED_DIRS or child.name.endswith(_IGNORED_SUFFIXES): + continue rel = f"{prefix}{child.name}" if child.is_file(): yield rel, child.read_text(encoding="utf-8") diff --git a/tests/test_new_and_run.py b/tests/test_new_and_run.py index d19a1a7..6d0ec0e 100644 --- a/tests/test_new_and_run.py +++ b/tests/test_new_and_run.py @@ -74,6 +74,21 @@ def test_run_unknown_slug(initialized_project: Path, runner: CliRunner) -> None: assert "not registered" in result.output.lower() +def test_template_walker_skips_pycache(tmp_path: Path) -> None: + from vibeshed.templates_loader import _walk_files + + (tmp_path / "main.py").write_text("print('hi')\n", encoding="utf-8") + pycache = tmp_path / "__pycache__" + pycache.mkdir() + # Realistic .pyc header is binary and would crash a UTF-8 read. + (pycache / "main.cpython-312.pyc").write_bytes(b"\xcb\x0d\x0d\x0a\x00\x00") + (tmp_path / "stale.pyc").write_bytes(b"\xcb\x0d\x0d\x0a") + (tmp_path / "stale.pyo").write_bytes(b"\xcb\x0d\x0d\x0a") + + rels = [rel for rel, _ in _walk_files(tmp_path, prefix="")] + assert rels == ["main.py"] + + def test_run_forwards_passthrough_args( initialized_project: Path, runner: CliRunner ) -> None: