import sys
from pathlib import Path

# Add the parent directory to the Python path to find utils
utils_path = Path(__file__).parent.parent / 'utils'
sys.path.append(str(utils_path))

from config_utils import load_config, get_config_path

def main():
    """
    Ensures the configuration file exists by calling the load_config utility.
    """
    print("Checking for configuration file...")
    # load_config() will automatically create the file if it doesn't exist.
    config = load_config()
    config_path = get_config_path()
    
    if config:
        print(f"Successfully created or updated config file at: {config_path}")
    else:
        print(f"Error: Could not create or load the configuration file.", file=sys.stderr)
        sys.exit(1)

if __name__ == "__main__":
    main()
