Get the full project configuration including detection results. This provides all relevant configuration information in a single call, useful for displaying in a UI or debugging. Args: project_dir: Path to the project directory. Returns: ProjectConfig dict wit
(project_dir: Path)
| 431 | |
| 432 | |
| 433 | def get_project_config(project_dir: Path) -> ProjectConfig: |
| 434 | """ |
| 435 | Get the full project configuration including detection results. |
| 436 | |
| 437 | This provides all relevant configuration information in a single call, |
| 438 | useful for displaying in a UI or debugging. |
| 439 | |
| 440 | Args: |
| 441 | project_dir: Path to the project directory. |
| 442 | |
| 443 | Returns: |
| 444 | ProjectConfig dict with: |
| 445 | - detected_type: The auto-detected project type (or None) |
| 446 | - detected_command: The default command for detected type (or None) |
| 447 | - custom_command: The user-configured custom command (or None) |
| 448 | - effective_command: The command that would actually be used (or None) |
| 449 | |
| 450 | Raises: |
| 451 | ValueError: If project_dir is not a valid directory. |
| 452 | """ |
| 453 | project_dir = _validate_project_dir(project_dir) |
| 454 | |
| 455 | # Detect project type and get default command |
| 456 | detected_type = detect_project_type(project_dir) |
| 457 | detected_command = PROJECT_TYPE_COMMANDS.get(detected_type) if detected_type else None |
| 458 | |
| 459 | # Load custom command from config |
| 460 | config = _load_config(project_dir) |
| 461 | custom_command = config.get("dev_command") |
| 462 | |
| 463 | # Validate custom_command is a string |
| 464 | if not isinstance(custom_command, str): |
| 465 | custom_command = None |
| 466 | |
| 467 | # Determine effective command |
| 468 | effective_command = custom_command if custom_command else detected_command |
| 469 | |
| 470 | return ProjectConfig( |
| 471 | detected_type=detected_type, |
| 472 | detected_command=detected_command, |
| 473 | custom_command=custom_command, |
| 474 | effective_command=effective_command, |
| 475 | ) |
no test coverage detected