vibe.infrastructure.data_directory

Data Directory Management for VIBE.

Provides centralized management of data directories with configurable priority resolution: 1. Environment variable VIBE_DATA_DIR 2. Config file data_dir setting
3. Default to current working directory

DataDirectoryManager

Manages VIBE's data directory structure with priority-based resolution.

Provides typed path getters for different data types (sessions, drafts, logs, cache) while maintaining a single configurable root directory.

__init__

__init__(config_data_dir: str | None = None, model_cache_dir: Path | None = None) -> None

Initialize data directory manager.

Parameters:
  • config_data_dir (str | None, default: None ) –

    Optional data_dir setting from config file

  • model_cache_dir (Path | None, default: None ) –

    Optional override for model cache directory

get_data_root

get_data_root() -> Path

Get the root data directory using priority resolution.

Priority: 1. VIBE_DATA_DIR environment variable 2. data_dir from config file 3. Default: .vibe_data in current working directory

Returns:
  • Path( Path ) –

    Resolved data root directory

get_sessions_dir

get_sessions_dir() -> Path

Get the directory for Flask session storage.

get_drafts_dir

get_drafts_dir(extension: str | None = None) -> Path

Get the directory for workbench template drafts.

Parameters:
  • extension (str | None, default: None ) –

    Optional subdirectory name (e.g., "workbench")

Returns:
  • Path

    Path to drafts directory, optionally with extension subdirectory

get_logs_dir

get_logs_dir(extension: str | None = None) -> Path

Get the directory for application logs.

Parameters:
  • extension (str | None, default: None ) –

    Optional subdirectory name (e.g., "assistant" for assistant logs)

Returns:
  • Path

    Path to logs directory, optionally with extension subdirectory

get_cache_dir

get_cache_dir(extension: str | None = None) -> Path

Get the directory for cache data.

Parameters:
  • extension (str | None, default: None ) –

    Optional subdirectory name (e.g., "review" for review-specific caches)

Returns:
  • Path

    Path to cache directory, optionally with extension subdirectory

get_work_dir

get_work_dir(extension: str | None = None) -> Path

Get the directory for temporary work files.

Used for intermediate files during processing (e.g., OCR image files passed between host and Docker container).

Parameters:
  • extension (str | None, default: None ) –

    Optional subdirectory name (e.g., "ocr" for OCR work files)

Returns:
  • Path

    Path to work directory, optionally with extension subdirectory

get_vector_store_cache_dir

get_vector_store_cache_dir() -> Path

Get the directory for OpenAI vector store ID cache.

get_filestore_dir

get_filestore_dir(extension: str | None = None) -> Path

Get the directory for file storage (e.g., uploaded documents).

Parameters:
  • extension (str | None, default: None ) –

    Optional subdirectory name (e.g., "review" for review file storage)

Returns:
  • Path

    Path to filestore directory, optionally with extension subdirectory

get_app_log_file

get_app_log_file() -> Path

Get the path for the main application log file.

get_model_cache_dir

get_model_cache_dir(extension: str | None = None) -> Path

Get the directory for downloaded ML models.

This directory is separate from the regular cache to ensure models persist across test sessions and aren't re-downloaded unnecessarily.

Priority: 1. Explicit model_cache_dir from config 2. .model_cache in the project root (detected via pyproject.toml) 3. Fallback to regular cache_dir/models

Parameters:
  • extension (str | None, default: None ) –

    Optional subdirectory name (e.g., "yolo_layout", "fastembed")

Returns:
  • Path

    Path to model cache directory, optionally with extension subdirectory

get_data_directory_manager

get_data_directory_manager() -> DataDirectoryManager

Get the global DataDirectoryManager instance.

Returns:
Raises:
  • RuntimeError

    If not initialized (should be called during app setup)

initialize_data_directory_manager

initialize_data_directory_manager(config_data_dir: str | None = None, model_cache_dir: Path | None = None) -> DataDirectoryManager

Initialize the global DataDirectoryManager instance.

Parameters:
  • config_data_dir (str | None, default: None ) –

    Optional data_dir setting from config file

  • model_cache_dir (Path | None, default: None ) –

    Optional override for model cache directory

Returns: