Download app.py from AZILS/AGSB: direct link, hf CLI and curl.
- Browser
- Download file 18.1 kB
-
https://huggingface.co/spaces/AZILS/AGSB/resolve/main/app.py
- Command line
-
hf download hf://spaces/AZILS/AGSB/app.py
-
curl -L -o app.py https://huggingface.co/spaces/AZILS/AGSB/resolve/main/app.py
18.1 kB
| #!/usr/bin/env python3 | |
| """ | |
| Antigravity VS Code IDE Launcher - Dark Theme | |
| Launches the actual Antigravity VS Code IDE with agents support | |
| """ | |
| from http.server import HTTPServer, BaseHTTPRequestHandler | |
| import subprocess | |
| import sys | |
| import os | |
| import json | |
| from urllib.parse import parse_qs | |
| import threading | |
| import time | |
| vscode_process = None | |
| class AntigravityHandler(BaseHTTPRequestHandler): | |
| def do_GET(self): | |
| if self.path == '/': | |
| self.send_response(200) | |
| self.send_header('Content-type', 'text/html') | |
| self.end_headers() | |
| # Check Antigravity installation | |
| try: | |
| result = subprocess.run(['antigravity', '--version'], | |
| capture_output=True, text=True, timeout=5) | |
| antigravity_status = "β Installed" if result.returncode == 0 else "β Not Available" | |
| antigravity_version = result.stdout.strip() if result.returncode == 0 else "Error" | |
| except Exception as e: | |
| antigravity_status = "β Error" | |
| antigravity_version = str(e) | |
| # System info | |
| try: | |
| system_info = subprocess.run(['uname', '-a'], capture_output=True, text=True) | |
| system_details = system_info.stdout | |
| except: | |
| system_details = "System info unavailable" | |
| html = f""" | |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Antigravity VS Code IDE</title> | |
| <style> | |
| body {{ | |
| font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; | |
| margin: 0; | |
| padding: 20px; | |
| background: linear-gradient(135deg, #0d1117 0%, #161b22 100%); | |
| color: #e6edf3; | |
| min-height: 100vh; | |
| }} | |
| .container {{ | |
| background: #0d1117; | |
| color: #e6edf3; | |
| padding: 30px; | |
| border-radius: 15px; | |
| box-shadow: 0 10px 30px rgba(0,0,0,0.5); | |
| max-width: 1200px; | |
| margin: 0 auto; | |
| border: 1px solid #30363d; | |
| }} | |
| .header {{ | |
| text-align: center; | |
| margin-bottom: 30px; | |
| padding-bottom: 20px; | |
| border-bottom: 2px solid #1f6feb; | |
| }} | |
| .header h1 {{ | |
| color: #1f6feb; | |
| margin: 0; | |
| font-size: 2.5em; | |
| text-shadow: 0 0 10px rgba(31, 111, 235, 0.3); | |
| }} | |
| .vscode-badge {{ | |
| background: #1f6feb; | |
| color: #0d1117; | |
| padding: 8px 20px; | |
| border-radius: 25px; | |
| font-size: 0.9em; | |
| display: inline-block; | |
| margin: 10px 0; | |
| font-weight: bold; | |
| }} | |
| .grid {{ | |
| display: grid; | |
| grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); | |
| gap: 20px; | |
| margin: 30px 0; | |
| }} | |
| .card {{ | |
| background: #161b22; | |
| padding: 25px; | |
| border-radius: 12px; | |
| border-left: 5px solid #1f6feb; | |
| box-shadow: 0 4px 8px rgba(0,0,0,0.3); | |
| border: 1px solid #30363d; | |
| }} | |
| .card h3 {{ | |
| color: #58a6ff; | |
| margin-top: 0; | |
| font-size: 1.3em; | |
| }} | |
| .button {{ | |
| background: #1f6feb; | |
| color: #0d1117; | |
| padding: 12px 24px; | |
| border: none; | |
| border-radius: 8px; | |
| font-size: 1em; | |
| cursor: pointer; | |
| text-decoration: none; | |
| display: inline-block; | |
| margin: 8px 8px 8px 0; | |
| transition: all 0.3s; | |
| font-weight: bold; | |
| }} | |
| .button:hover {{ | |
| background: #388bfd; | |
| transform: translateY(-2px); | |
| }} | |
| .button.green {{ | |
| background: #3fb950; | |
| }} | |
| .button.green:hover {{ | |
| background: #56d364; | |
| transform: translateY(-2px); | |
| }} | |
| .button.orange {{ | |
| background: #fb8500; | |
| }} | |
| .button.orange:hover {{ | |
| background: #ffa947; | |
| transform: translateY(-2px); | |
| }} | |
| .button.red {{ | |
| background: #f85149; | |
| }} | |
| .button.red:hover {{ | |
| background: #ff7b72; | |
| transform: translateY(-2px); | |
| }} | |
| .button:disabled {{ | |
| opacity: 0.5; | |
| cursor: not-allowed; | |
| }} | |
| .status {{ | |
| padding: 15px; | |
| border-radius: 8px; | |
| margin: 15px 0; | |
| font-weight: bold; | |
| }} | |
| .success {{ | |
| background: rgba(63, 185, 80, 0.15); | |
| color: #3fb950; | |
| border: 1px solid #3fb950; | |
| }} | |
| .warning {{ | |
| background: rgba(251, 133, 0, 0.15); | |
| color: #fb8500; | |
| border: 1px solid #fb8500; | |
| }} | |
| .error {{ | |
| background: rgba(248, 81, 73, 0.15); | |
| color: #f85149; | |
| border: 1px solid #f85149; | |
| }} | |
| .pre {{ | |
| background: #0d1117; | |
| color: #79c0ff; | |
| padding: 15px; | |
| border-radius: 8px; | |
| overflow-x: auto; | |
| font-family: 'Courier New', monospace; | |
| margin: 10px 0; | |
| border: 1px solid #30363d; | |
| }} | |
| .terminal {{ | |
| background: #0d1117; | |
| color: #39ff14; | |
| padding: 15px; | |
| border-radius: 8px; | |
| font-family: 'Courier New', monospace; | |
| margin: 10px 0; | |
| border: 2px solid #1f6feb; | |
| }} | |
| .command-box {{ | |
| background: #0d1117; | |
| color: #79c0ff; | |
| border: 1px solid #30363d; | |
| padding: 12px; | |
| border-radius: 8px; | |
| margin: 10px 0; | |
| font-family: 'Courier New', monospace; | |
| }} | |
| </style> | |
| </head> | |
| <body> | |
| <div class="container"> | |
| <div class="header"> | |
| <h1>β‘ Antigravity VS Code IDE</h1> | |
| <div class="vscode-badge">Agents + Code Editor</div> | |
| <p>Professional development environment with Antigravity agents</p> | |
| </div> | |
| <div class="grid"> | |
| <div class="card"> | |
| <h3>π System Status</h3> | |
| <div class="status {'success' if antigravity_status == 'β Installed' else 'warning'}"> | |
| Antigravity: {antigravity_status} | |
| </div> | |
| <div><strong>Version:</strong> {antigravity_version}</div> | |
| <div><strong>Python:</strong> {sys.version.split()[0]}</div> | |
| <div><strong>Platform:</strong> {sys.platform}</div> | |
| <div><strong>Working Dir:</strong> {os.getcwd()}</div> | |
| </div> | |
| <div class="card"> | |
| <h3>π Launch IDE</h3> | |
| <p>Start Antigravity VS Code:</p> | |
| <button onclick="launchIDE()" class="button green" style="width: 100%; margin-top: 10px;"> | |
| βΆοΈ Launch Antigravity IDE | |
| </button> | |
| <button onclick="launchAgents()" class="button orange" style="width: 100%; margin-top: 10px;"> | |
| π€ Launch Agents | |
| </button> | |
| <button onclick="launchChat()" class="button" style="width: 100%; margin-top: 10px;"> | |
| π¬ AI Chat | |
| </button> | |
| </div> | |
| <div class="card"> | |
| <h3>π Available Commands</h3> | |
| <div class="pre" style="font-size: 12px;">antigravity --serve-web | |
| antigravity chat | |
| antigravity agents | |
| antigravity --list-extensions | |
| antigravity --help</div> | |
| </div> | |
| <div class="card"> | |
| <h3>π₯οΈ System Details</h3> | |
| <div class="terminal" style="font-size: 12px;">{system_details}</div> | |
| </div> | |
| </div> | |
| <div class="card" style="margin-top: 20px;"> | |
| <h3>β‘ Antigravity Agents</h3> | |
| <p>Use AI-powered agents to code, debug, and create:</p> | |
| <div class="command-box">$ antigravity agents</div> | |
| <p style="color: #8b949e; font-size: 14px;">Agents enable autonomous code generation, testing, and debugging with natural language commands.</p> | |
| </div> | |
| <div class="card" style="margin-top: 20px;"> | |
| <h3>π Quick Start</h3> | |
| <ol style="color: #e6edf3;"> | |
| <li>Click <strong>"Launch Antigravity IDE"</strong> to open VS Code</li> | |
| <li>Use <strong>"Launch Agents"</strong> to enable AI-powered coding</li> | |
| <li>Type your requirements in natural language</li> | |
| <li>Agents will generate and execute code automatically</li> | |
| <li>Use AI Chat for questions and assistance</li> | |
| </ol> | |
| </div> | |
| </div> | |
| <script> | |
| function launchIDE() {{ | |
| fetch('/launch-ide', {{ method: 'POST' }}) | |
| .then(r => r.json()) | |
| .then(d => {{ | |
| if (d.success) {{ | |
| alert('β Antigravity VS Code IDE launched!\\n\\nCheck the terminal or open http://localhost:8000'); | |
| }} else {{ | |
| alert('β Error: ' + d.error); | |
| }} | |
| }}) | |
| .catch(e => alert('Error: ' + e)); | |
| }} | |
| function launchAgents() {{ | |
| fetch('/launch-agents', {{ method: 'POST' }}) | |
| .then(r => r.json()) | |
| .then(d => {{ | |
| if (d.success) {{ | |
| alert('β Antigravity Agents launched!\\n\\n' + d.message); | |
| }} else {{ | |
| alert('β Error: ' + d.error); | |
| }} | |
| }}) | |
| .catch(e => alert('Error: ' + e)); | |
| }} | |
| function launchChat() {{ | |
| fetch('/launch-chat', {{ method: 'POST' }}) | |
| .then(r => r.json()) | |
| .then(d => {{ | |
| if (d.success) {{ | |
| alert('β AI Chat launched!\\n\\n' + d.message); | |
| }} else {{ | |
| alert('β Error: ' + d.error); | |
| }} | |
| }}) | |
| .catch(e => alert('Error: ' + e)); | |
| }} | |
| </script> | |
| </body> | |
| </html> | |
| """ | |
| self.wfile.write(html.encode()) | |
| elif self.path == '/api/status': | |
| self.send_response(200) | |
| self.send_header('Content-type', 'application/json') | |
| self.end_headers() | |
| status_data = { | |
| 'service': 'Antigravity VS Code Sandbox', | |
| 'status': 'running', | |
| 'antigravity_available': antigravity_status == 'Available', | |
| 'features': [ | |
| 'VS Code CLI', | |
| 'File Management', | |
| 'Extensions', | |
| 'Web Interface', | |
| 'AI Assistant', | |
| 'Development Tools' | |
| ], | |
| 'quick_commands': [ | |
| 'antigravity --serve-web', | |
| 'antigravity chat', | |
| 'antigravity --version', | |
| 'antigravity --diff', | |
| 'antigravity --list-extensions' | |
| ] | |
| } | |
| self.wfile.write(json.dumps(status_data).encode()) | |
| else: | |
| self.send_response(404) | |
| self.end_headers() | |
| def log_message(self, format, *args): | |
| print(f"[Antigravity VS Code] {format % args}") | |
| def do_POST(self): | |
| global vscode_process | |
| if self.path == '/launch-ide': | |
| self.send_response(200) | |
| self.send_header('Content-type', 'application/json') | |
| self.end_headers() | |
| try: | |
| # Launch Antigravity VS Code web interface | |
| if vscode_process is None or vscode_process.poll() is not None: | |
| vscode_process = subprocess.Popen( | |
| ['antigravity', '--serve-web'], | |
| stdout=subprocess.PIPE, | |
| stderr=subprocess.PIPE | |
| ) | |
| time.sleep(2) | |
| response = { | |
| 'success': True, | |
| 'message': 'Antigravity VS Code IDE launched on http://localhost:8000' | |
| } | |
| except Exception as e: | |
| response = { | |
| 'success': False, | |
| 'error': str(e) | |
| } | |
| self.wfile.write(json.dumps(response).encode()) | |
| elif self.path == '/launch-agents': | |
| self.send_response(200) | |
| self.send_header('Content-type', 'application/json') | |
| self.end_headers() | |
| try: | |
| result = subprocess.run(['antigravity', 'agents'], | |
| capture_output=True, text=True, timeout=3) | |
| response = { | |
| 'success': True, | |
| 'message': 'Antigravity Agents activated!\n' + result.stdout | |
| } | |
| except Exception as e: | |
| response = { | |
| 'success': False, | |
| 'error': str(e) | |
| } | |
| self.wfile.write(json.dumps(response).encode()) | |
| elif self.path == '/launch-chat': | |
| self.send_response(200) | |
| self.send_header('Content-type', 'application/json') | |
| self.end_headers() | |
| try: | |
| result = subprocess.run(['antigravity', 'chat'], | |
| capture_output=True, text=True, timeout=3) | |
| response = { | |
| 'success': True, | |
| 'message': 'AI Chat opened!\n' + result.stdout | |
| } | |
| except Exception as e: | |
| response = { | |
| 'success': False, | |
| 'error': str(e) | |
| } | |
| self.wfile.write(json.dumps(response).encode()) | |
| else: | |
| self.send_response(404) | |
| self.end_headers() | |
| def main(): | |
| port = int(os.environ.get('PORT', 7860)) | |
| server = HTTPServer(('0.0.0.0', port), AntigravityHandler) | |
| print(f"π Antigravity VS Code Sandbox running on port {port}") | |
| print(f"π Access at: http://localhost:{port}") | |
| print(f"π VS Code features available via antigravity commands") | |
| try: | |
| server.serve_forever() | |
| except KeyboardInterrupt: | |
| print("\nShutting down Antigravity VS Code Sandbox...") | |
| server.shutdown() | |
| if __name__ == '__main__': | |
| main() | |