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_json_file(file_path[, error_prefix])

Load and parse a JSON file with error handling.

validate_directory_exists(directory[, error_prefix])

Validate that a directory exists.

validate_file_exists(file_path[, error_prefix])

Validate that a file exists.

print_success(message)

Print a success message with green checkmark.

print_error(message)

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

firecrown.fctools.docs_helpers.print_success(message)[source]

Print a success message with green checkmark.

Parameters:

message (str) – Message to print

Return type:

None

firecrown.fctools.docs_helpers.print_error(message)[source]

Print an error message in red.

Parameters:

message (str) – Error message to print

Return type:

None