Add or update an installed workflow entry.
(self, workflow_id: str, metadata: dict[str, Any])
| 89 | json.dump(self.data, f, indent=2) |
| 90 | |
| 91 | def add(self, workflow_id: str, metadata: dict[str, Any]) -> None: |
| 92 | """Add or update an installed workflow entry.""" |
| 93 | from datetime import datetime, timezone |
| 94 | |
| 95 | existing = self.data["workflows"].get(workflow_id, {}) |
| 96 | metadata["installed_at"] = existing.get( |
| 97 | "installed_at", datetime.now(timezone.utc).isoformat() |
| 98 | ) |
| 99 | metadata["updated_at"] = datetime.now(timezone.utc).isoformat() |
| 100 | self.data["workflows"][workflow_id] = metadata |
| 101 | self.save() |
| 102 | |
| 103 | def remove(self, workflow_id: str) -> bool: |
| 104 | """Remove an installed workflow entry. Returns True if found.""" |