import sys import subprocess def fix_html(): with open('dashboard.html', 'r', encoding='utf-8') as f: content = f.read() parts = content.split('') if len(parts) < 2: print("Could not find in dashboard.html") return False top_part = parts[0] + '\n' new_script = """ """ with open('dashboard.html', 'w', encoding='utf-8') as f: f.write(top_part + new_script) print("Replaced script successfully.") # Run git commands subprocess.run(['git', 'add', 'dashboard.html'], check=True) try: subprocess.run(['git', 'commit', '-m', 'Critical Bugfix: Resolve corrupted JS syntax and restore core agent loop'], check=True) except subprocess.CalledProcessError: print("Nothing to commit") subprocess.run(['git', 'push', '--force', 'space', 'HEAD:main'], check=True) # Push to origin main as well try: subprocess.run(['git', 'push', 'origin', 'HEAD:main'], check=True) except subprocess.CalledProcessError: print("Push to origin failed or not needed") print("Deployment triggered successfully.") if __name__ == '__main__': fix_html()