Load persisted init options, returning an empty dict when unavailable.
(project_path: Path)
| 20 | |
| 21 | |
| 22 | def load_init_options(project_path: Path) -> dict[str, Any]: |
| 23 | """Load persisted init options, returning an empty dict when unavailable.""" |
| 24 | path = project_path / INIT_OPTIONS_FILE |
| 25 | if not path.exists(): |
| 26 | return {} |
| 27 | try: |
| 28 | payload = json.loads(path.read_text(encoding="utf-8")) |
| 29 | except (json.JSONDecodeError, OSError, UnicodeError): |
| 30 | return {} |
| 31 | return payload if isinstance(payload, dict) else {} |
| 32 | |
| 33 | |
| 34 | def is_ai_skills_enabled(opts: Mapping[str, Any] | None) -> bool: |