geometor.seer.rebuild_indexes

Script to rebuild summary index.json files for sessions, tasks, and steps.

Attributes

SIZE_CORRECT_KEY

PALETTE_CORRECT_KEY

COLOR_COUNT_CORRECT_KEY

PIXELS_OFF_KEY

PERCENT_CORRECT_KEY

MATCH_KEY

Functions

safe_load_json(file_path) → Optional[Dict[str, Any]]

Safely loads a JSON file, returning None on error.

count_errors(level_dir) → int

Counts error files (error_*.json) in a directory.

get_level_description(level_dir) → Optional[str]

Attempts to read description from existing index.json.

get_step_title_index(step_dir) → Tuple[str, str]

Attempts to read title and index from existing index.json or derive index.

rebuild_step_summary(step_dir[, dry_run]) → Optional[Dict[str, Any]]

Rebuilds the index.json for a single TaskStep directory.

rebuild_task_summary(task_dir[, dry_run]) → Optional[Dict[str, Any]]

Rebuilds the index.json for a SessionTask directory.

rebuild_session_summary(session_dir[, dry_run]) → Optional[Dict[str, Any]]

Rebuilds the index.json for a Session directory.

main()

Module Contents

geometor.seer.rebuild_indexes.SIZE_CORRECT_KEY = 'size_correct'
geometor.seer.rebuild_indexes.PALETTE_CORRECT_KEY = 'color_palette_correct'
geometor.seer.rebuild_indexes.COLOR_COUNT_CORRECT_KEY = 'color_count_correct'
geometor.seer.rebuild_indexes.PIXELS_OFF_KEY = 'pixels_off'
geometor.seer.rebuild_indexes.PERCENT_CORRECT_KEY = 'percent_correct'
geometor.seer.rebuild_indexes.MATCH_KEY = 'match'
geometor.seer.rebuild_indexes.safe_load_json(file_path: pathlib.Path) → Dict[str, Any] | None

Safely loads a JSON file, returning None on error.

geometor.seer.rebuild_indexes.count_errors(level_dir: pathlib.Path) → int

Counts error files (error_*.json) in a directory.

geometor.seer.rebuild_indexes.get_level_description(level_dir: pathlib.Path) → str | None

Attempts to read description from existing index.json.

geometor.seer.rebuild_indexes.get_step_title_index(step_dir: pathlib.Path) → Tuple[str, str]

Attempts to read title and index from existing index.json or derive index.

geometor.seer.rebuild_indexes.rebuild_step_summary(step_dir: pathlib.Path, dry_run: bool = False) → Dict[str, Any] | None

Rebuilds the index.json for a single TaskStep directory. If dry_run is True, logs the intended action instead of writing the file.

Returns:

The summary dictionary, or None if rebuilding failed.

geometor.seer.rebuild_indexes.rebuild_task_summary(task_dir: pathlib.Path, dry_run: bool = False) → Dict[str, Any] | None

Rebuilds the index.json for a SessionTask directory. If dry_run is True, logs the intended action instead of writing the file.

Returns:

The summary dictionary, or None if rebuilding failed.

geometor.seer.rebuild_indexes.rebuild_session_summary(session_dir: pathlib.Path, dry_run: bool = False) → Dict[str, Any] | None

Rebuilds the index.json for a Session directory. If dry_run is True, logs the intended action instead of writing the file.

Returns:

The summary dictionary, or None if rebuilding failed.

geometor.seer.rebuild_indexes.main()