List all installed presets with metadata. Returns: List of preset metadata dictionaries
(self)
| 1752 | return True |
| 1753 | |
| 1754 | def list_installed(self) -> List[Dict[str, Any]]: |
| 1755 | """List all installed presets with metadata. |
| 1756 | |
| 1757 | Returns: |
| 1758 | List of preset metadata dictionaries |
| 1759 | """ |
| 1760 | result = [] |
| 1761 | |
| 1762 | for pack_id, metadata in self.registry.list().items(): |
| 1763 | # Ensure metadata is a dictionary to avoid AttributeError when using .get() |
| 1764 | if not isinstance(metadata, dict): |
| 1765 | metadata = {} |
| 1766 | pack_dir = self.presets_dir / pack_id |
| 1767 | manifest_path = pack_dir / "preset.yml" |
| 1768 | |
| 1769 | try: |
| 1770 | manifest = PresetManifest(manifest_path) |
| 1771 | result.append({ |
| 1772 | "id": pack_id, |
| 1773 | "name": manifest.name, |
| 1774 | "version": metadata.get("version", manifest.version), |
| 1775 | "description": manifest.description, |
| 1776 | "enabled": metadata.get("enabled", True), |
| 1777 | "installed_at": metadata.get("installed_at"), |
| 1778 | "template_count": len(manifest.templates), |
| 1779 | "tags": manifest.tags, |
| 1780 | "priority": normalize_priority(metadata.get("priority")), |
| 1781 | }) |
| 1782 | except PresetValidationError: |
| 1783 | result.append({ |
| 1784 | "id": pack_id, |
| 1785 | "name": pack_id, |
| 1786 | "version": metadata.get("version", "unknown"), |
| 1787 | "description": "⚠️ Corrupted preset", |
| 1788 | "enabled": False, |
| 1789 | "installed_at": metadata.get("installed_at"), |
| 1790 | "template_count": 0, |
| 1791 | "tags": [], |
| 1792 | "priority": normalize_priority(metadata.get("priority")), |
| 1793 | }) |
| 1794 | |
| 1795 | return result |
| 1796 | |
| 1797 | def get_pack(self, pack_id: str) -> Optional[PresetManifest]: |
| 1798 | """Get manifest for an installed preset. |