"""Native taxonomy JSON and local DeepSeek skills live under periscope/src.""" from __future__ import annotations from pathlib import Path from backend.repo_paths import skills_dir, taxonomy_dir from backend.services.llm.local_skill import load_skill_markdown, load_skill_validator ROOT = Path(__file__).resolve().parents[1] def test_taxonomy_json_is_src(): d = taxonomy_dir() assert d.parts[-2:] == ("src", "taxonomy") for name in ( "ic.json", "passive.json", "discrete.json", "connector.json", "crystal.json", "fuse.json", "switch.json", "test_point.json", "transformer.json", ): assert (d / name).is_file(), name def test_skills_dir_is_src_and_local(): d = skills_dir() assert d.parts[-2:] == ("src", "skills") for name in ("extract-pintable", "extract-pattern", "extract-specs"): assert (d / name / "SKILL.md").is_file() assert (d / name / "validate.py").is_file() assert (d / name / "schema.json").is_file() text = (d / name / "SKILL.md").read_text(encoding="utf-8") assert "Native Periscope overlay" not in text[:400] assert "upload_skills" not in text def test_pintable_skill_mentions_save_tool_and_wroom(): md = load_skill_markdown("extract-pintable") assert "save_pintable" in md assert "layout_rules" in md assert "WROOM" in md assert "net_class" in md def test_docker_copies_src_taxonomy_and_skills(): docker = (ROOT / "periscope" / "src" / "backend" / "Dockerfile").read_text(encoding="utf-8") assert "COPY periscope/src/taxonomy/ /app/taxonomy/" in docker assert "COPY periscope/src/skills/ /app/skills/" in docker compose = (ROOT / "docker-compose.yml").read_text(encoding="utf-8") assert "./periscope/src/taxonomy:/app/taxonomy" in compose assert "dependency/taxonomy:/app/taxonomy" not in compose def test_skills_manifest_bumped_for_prompt_change(): text = (ROOT / "periscope" / "src" / "backend" / "skills_manifest.json").read_text( encoding="utf-8" ) assert '"default_model_version": "1.15.0"' in text validate = load_skill_validator("extract-pintable") assert validate is not None