"""Keep the design skill's editor-readiness and recovery guidance aligned.""" import unittest from pathlib import Path ROOT = Path(__file__).resolve().parents[1] / "skills/bortstack-design" SKILL = (ROOT / "SKILL.md").read_text(encoding="utf-8") OPERATIONS = (ROOT / "references/penpot-operations.md").read_text(encoding="utf-8") class PenpotConnectionContractTests(unittest.TestCase): def test_skill_requires_verified_inspection_before_modification(self): self.assertIn("non-destructive inspection", SKILL) self.assertIn("only a successful inspection", SKILL) self.assertIn("Stop mutations", SKILL) def test_reference_distinguishes_service_editor_and_verified_design(self): for state in ("A — MCP service available", "B — Editor connected", "C — Design operations verified"): with self.subTest(state=state): self.assertIn(state, OPERATIONS) self.assertIn("Only C permits modification", OPERATIONS) self.assertIn("intended file and page", OPERATIONS) self.assertIn("read-only operation", OPERATIONS) def test_recovery_verifies_target_and_uncertain_writes(self): self.assertIn("Stop further design modifications", OPERATIONS) self.assertIn("Do not assume a failed write either applied or rolled back", OPERATIONS) self.assertIn("Repeat the non-destructive inspection", OPERATIONS) self.assertIn("Reconcile any uncertain prior write", OPERATIONS) self.assertIn("Firefox and other compatible browsers", OPERATIONS) if __name__ == "__main__": unittest.main()