Get or create a Project for the given root. Lazy initialization.
(self, project_root: str)
| 144 | self.query_params = dict(query_params) if query_params else {} |
| 145 | |
| 146 | async def get_project(self, project_root: str) -> Project: |
| 147 | """Get or create a Project for the given root. Lazy initialization.""" |
| 148 | if self._embedder is None: |
| 149 | raise RuntimeError( |
| 150 | "Daemon has no global settings loaded. Run `ccc init` to set up cocoindex-code." |
| 151 | ) |
| 152 | if project_root not in self._projects: |
| 153 | root = Path(project_root) |
| 154 | project_settings = load_project_settings(root) |
| 155 | chunker_registry = _resolve_chunker_registry(project_settings.chunkers) |
| 156 | project = await Project.create( |
| 157 | root, |
| 158 | self._embedder, |
| 159 | indexing_params=self.indexing_params, |
| 160 | query_params=self.query_params, |
| 161 | chunker_registry=chunker_registry, |
| 162 | ) |
| 163 | self._projects[project_root] = project |
| 164 | return self._projects[project_root] |
| 165 | |
| 166 | def remove_project(self, project_root: str) -> bool: |
| 167 | """Remove a project from the registry. Returns True if it was loaded.""" |
no test coverage detected