Validate a list of command entries from a YAML config. Each entry must be a dict with a non-empty string 'name' field. Used by both load_org_config() and load_project_commands() to avoid duplicating the same validation logic. Args: commands: List of command entries to
(commands: list, config_path: Path, field_name: str)
| 480 | |
| 481 | |
| 482 | def _validate_command_list(commands: list, config_path: Path, field_name: str) -> bool: |
| 483 | """ |
| 484 | Validate a list of command entries from a YAML config. |
| 485 | |
| 486 | Each entry must be a dict with a non-empty string 'name' field. |
| 487 | Used by both load_org_config() and load_project_commands() to avoid |
| 488 | duplicating the same validation logic. |
| 489 | |
| 490 | Args: |
| 491 | commands: List of command entries to validate |
| 492 | config_path: Path to the config file (for log messages) |
| 493 | field_name: Name of the YAML field being validated (e.g., 'allowed_commands', 'commands') |
| 494 | |
| 495 | Returns: |
| 496 | True if all entries are valid, False otherwise |
| 497 | """ |
| 498 | if not isinstance(commands, list): |
| 499 | logger.warning(f"Config at {config_path}: '{field_name}' must be a list") |
| 500 | return False |
| 501 | for i, cmd in enumerate(commands): |
| 502 | if not isinstance(cmd, dict): |
| 503 | logger.warning(f"Config at {config_path}: {field_name}[{i}] must be a dict") |
| 504 | return False |
| 505 | if "name" not in cmd: |
| 506 | logger.warning(f"Config at {config_path}: {field_name}[{i}] missing 'name'") |
| 507 | return False |
| 508 | if not isinstance(cmd["name"], str) or cmd["name"].strip() == "": |
| 509 | logger.warning(f"Config at {config_path}: {field_name}[{i}] has invalid 'name'") |
| 510 | return False |
| 511 | return True |
| 512 | |
| 513 | |
| 514 | def _validate_pkill_processes(config: dict, config_path: Path) -> Optional[list[str]]: |
no outgoing calls
no test coverage detected