plexus.cli.shared.score_config_fetching module

Shared utility functions for fetching and caching score configurations.

This module provides a unified approach to fetch score configurations from the API and cache them locally, with consistent formatting and error handling.

plexus.cli.shared.score_config_fetching.fetch_and_cache_single_score(client: PlexusDashboardClient, scorecard_identifier: str, score_identifier: str, use_cache: bool = False, verbose: bool = False) Tuple[Dict[str, Any], Path, Path, bool]

Fetch a single score configuration and guidelines from the API and cache them locally.

This function is a unified implementation that combines the best aspects of both the score pull command and the evaluation command approach.

Args:

client: The GraphQL API client scorecard_identifier: Identifier for the scorecard (ID, key, name, external ID) score_identifier: Identifier for the score (ID, key, name, external ID) use_cache: Whether to check and use locally cached files first

When False (default), always fetch from API but still update cache When True, check local cache first and only fetch if not found

verbose: Whether to enable verbose logging

Returns:

Tuple of (score_configuration, yaml_path, guidelines_path, from_cache) - score_configuration: The parsed score configuration as a dictionary - yaml_path: The path to the cached YAML file - guidelines_path: The path to the cached guidelines markdown file - from_cache: Whether the configuration was loaded from cache

Raises:

ValueError: If scorecard or score cannot be found