#!/usr/bin/env python3
import os
import subprocess
from dotenv import load_dotenv

load_dotenv()

def test_git_config():
    print("=== Git Configuration Test ===")
    print(f"Working directory: {os.getcwd()}")
    print(f"Git repo exists: {os.path.exists('.git')}")
    
    if os.path.exists('.git'):
        print("\n=== Git Remote Configuration ===")
        result = subprocess.run("git remote -v", shell=True, capture_output=True, text=True)
        if result.returncode == 0:
            print(result.stdout)
        else:
            print(f"Error: {result.stderr}")
        
        print("\n=== Git Config ===")
        subprocess.run("git config --list", shell=True)
        
        print("\n=== Environment Variables ===")
        git_vars = ['GIT_REPO_URL', 'GIT_USERNAME', 'GIT_EMAIL', 'GITHUB_TOKEN']
        for var in git_vars:
            value = os.environ.get(var)
            if value:
                if 'TOKEN' in var:
                    print(f"{var}: {value[:10]}...")
                else:
                    print(f"{var}: {value}")
            else:
                print(f"{var}: Not set")

if __name__ == "__main__":
    test_git_config()
