| 1 | # projects.py DOX |
| 2 | |
| 3 | ## Purpose |
| 4 | |
| 5 | - Own the `projects.py` API endpoint. |
| 6 | - This module manages project create, update, delete, clone, and metadata flows. |
| 7 | - Keep this file-level DOX profile synchronized with `projects.py` because this directory is intentionally flat. |
| 8 | |
| 9 | ## Ownership |
| 10 | |
| 11 | - `projects.py` owns the runtime implementation. |
| 12 | - `projects.py.dox.md` owns durable notes about responsibilities, contracts, side effects, and verification for that implementation. |
| 13 | - Classes: |
| 14 | - `Projects` (`ApiHandler`) |
| 15 | - `async process(self, input: Input, request: Request) -> Output` |
| 16 | - `get_active_projects_list(self)` |
| 17 | - `get_active_projects_options(self)` |
| 18 | - `create_project(self, project: dict | None)` |
| 19 | - `clone_project(self, project: dict | None)` |
| 20 | - `load_project(self, name: str | None)` |
| 21 | - `update_project(self, project: dict | None)` |
| 22 | - `delete_project(self, name: str | None)` |
| 23 | |
| 24 | ## Runtime Contracts |
| 25 | |
| 26 | - HTTP handlers must derive from `helpers.api.ApiHandler`; WebSocket handlers must derive from `helpers.ws.WsHandler`. |
| 27 | - Update this file whenever request payloads, authentication or CSRF requirements, response shapes, route side effects, or WebSocket event contracts change. |
| 28 | - `Projects` is an `ApiHandler`. |
| 29 | - `Projects` defines `process(...)`. |
| 30 | - Observed side-effect areas: filesystem deletion, settings/state persistence. |
| 31 | - Imported dependency areas include: `helpers`, `helpers.api`, `helpers.notification`. |
| 32 | |
| 33 | ## Key Concepts |
| 34 | |
| 35 | - Important called helpers/classes observed in the source: `projects.get_active_projects_list`, `projects.BasicProjectData`, `projects.create_project`, `projects.load_edit_project_data`, `NotificationManager.send_notification`, `projects.EditProjectData`, `projects.update_project`, `projects.delete_project`, `projects.activate_project`, `projects.deactivate_project`, `projects.load_basic_project_data`, `projects.get_file_structure`, `self.use_context`, `Exception`, `projects.clone_git_project`, `self.get_active_projects_list`, `self.get_active_projects_options`, `self.load_project`, `self.create_project`, `self.clone_project`. |
| 36 | - Keep request/response, tool, or helper semantics documented here at the same time as source changes. |
| 37 | |
| 38 | ## Work Guidance |
| 39 | |
| 40 | - Preserve authentication, CSRF, loopback, and API-key checks unless the endpoint contract explicitly changes. |
| 41 | - Update frontend callers, plugin callers, and tests together when payload shape changes. |
| 42 | - Use `helpers.api.Response` for non-JSON responses, files, redirects, or status-specific replies. |
| 43 | |
| 44 | ## Verification |
| 45 | |
| 46 | - Run endpoint-specific or API/WebSocket tests for changed behavior; smoke-test browser callers when no focused test exists. |
| 47 | - Related tests observed by source search: |
| 48 | - `tests/test_model_config_project_presets.py` |
| 49 | - `tests/test_office_document_store.py` |
| 50 | - `tests/test_plugin_activation_ui.py` |
| 51 | - `tests/test_projects.py` |
| 52 | - `tests/test_skills_runtime.py` |
| 53 | - `tests/test_task_scheduler_timezone.py` |
| 54 | - `tests/test_time_travel.py` |
| 55 | - `tests/test_tool_action_contracts.py` |
| 56 | |
| 57 | ## Child DOX Index |
| 58 | |
| 59 | No child DOX files. |