Convert CLI Configuration to Backend Config. This method bridges the gap between persistent user settings (CLI Configuration) and runtime job configuration (Backend Config). Args: repo_path: Path to the repository to document
(self, repo_path: str, output_dir: str, api_key: str, runtime_instructions: AgentInstructions = None)
| 228 | self.base_url and |
| 229 | self.main_model and |
| 230 | self.cluster_model and |
| 231 | self.fallback_model |
| 232 | ) |
| 233 | |
| 234 | def to_backend_config(self, repo_path: str, output_dir: str, api_key: str, runtime_instructions: AgentInstructions = None): |
| 235 | """ |
| 236 | Convert CLI Configuration to Backend Config. |
| 237 | |
| 238 | This method bridges the gap between persistent user settings (CLI Configuration) |
| 239 | and runtime job configuration (Backend Config). |
| 240 | |
| 241 | Args: |
| 242 | repo_path: Path to the repository to document |
| 243 | output_dir: Output directory for generated documentation |
| 244 | api_key: LLM API key (from keyring) |
| 245 | runtime_instructions: Runtime agent instructions (override persistent settings) |
| 246 | |
| 247 | Returns: |
| 248 | Backend Config instance ready for documentation generation |
| 249 | """ |
| 250 | from codewiki.src.config import Config |
| 251 | |
| 252 | # Merge runtime instructions with persistent settings |
| 253 | # Runtime instructions take precedence |
| 254 | final_instructions = self.agent_instructions |
| 255 | if runtime_instructions and not runtime_instructions.is_empty(): |
| 256 | final_instructions = AgentInstructions( |
| 257 | include_patterns=runtime_instructions.include_patterns or self.agent_instructions.include_patterns, |
| 258 | exclude_patterns=runtime_instructions.exclude_patterns or self.agent_instructions.exclude_patterns, |
| 259 | focus_modules=runtime_instructions.focus_modules or self.agent_instructions.focus_modules, |
| 260 | doc_type=runtime_instructions.doc_type or self.agent_instructions.doc_type, |
| 261 | custom_instructions=runtime_instructions.custom_instructions or self.agent_instructions.custom_instructions, |
| 262 | ) |
| 263 | |
| 264 | return Config.from_cli( |
| 265 | repo_path=repo_path, |
| 266 | output_dir=output_dir, |
| 267 | llm_base_url=self.base_url, |
| 268 | llm_api_key=api_key, |
| 269 | main_model=self.main_model, |
| 270 | cluster_model=self.cluster_model, |
| 271 | fallback_model=self.fallback_model, |
| 272 | provider=self.provider, |
| 273 | aws_region=self.aws_region, |
| 274 | api_version=self.api_version, |
| 275 | azure_deployment=self.azure_deployment, |
| 276 | max_tokens=self.max_tokens, |
| 277 | max_token_per_module=self.max_token_per_module, |
| 278 | max_token_per_leaf_module=self.max_token_per_leaf_module, |
| 279 | max_depth=self.max_depth, |
| 280 | agent_instructions=final_instructions.to_dict() if final_instructions else None, |
nothing calls this directly
no test coverage detected