firecrown.fctools.docs_helpers
Helper functions shared by documentation validation tools.
Provides common functionality for file/directory validation, JSON loading, and rich console output for code_block_checker, symbol_reference_checker, and generate_symbol_map tools.
Functions
|
Load and parse a JSON file with error handling. |
|
Validate that a directory exists. |
|
Validate that a file exists. |
|
Print a success message with green checkmark. |
|
Print an error message in red. |
Module Contents
- firecrown.fctools.docs_helpers.load_json_file(file_path, error_prefix='JSON file')[source]
Load and parse a JSON file with error handling.
- Parameters:
file_path (pathlib.Path) – Path to the JSON file
error_prefix (str) – Prefix for error messages
- Returns:
Parsed JSON as dictionary
- Raises:
typer.Exit – If file cannot be loaded or parsed
- Return type:
dict
- firecrown.fctools.docs_helpers.validate_directory_exists(directory, error_prefix='Directory')[source]
Validate that a directory exists.
- Parameters:
directory (pathlib.Path) – Path to validate
error_prefix (str) – Prefix for error message
- Raises:
typer.Exit – If directory doesn’t exist
- Return type:
None
- firecrown.fctools.docs_helpers.validate_file_exists(file_path, error_prefix='File')[source]
Validate that a file exists.
- Parameters:
file_path (pathlib.Path) – Path to validate
error_prefix (str) – Prefix for error message
- Raises:
typer.Exit – If file doesn’t exist
- Return type:
None