feat(dashboard): consolidate /api/git-commit into /api/eco/git-commit

This commit is contained in:
2026-04-21 07:17:11 +00:00
parent e0abe5cdfc
commit 0ac0f3b907
3 changed files with 1 additions and 29 deletions

View File

@@ -1,8 +1,6 @@
"""Git status / diff / commit handlers for dashboard + workspace projects."""
import json
import re
import subprocess
import sys
import urllib.error
import urllib.request
from datetime import datetime
@@ -25,30 +23,6 @@ class GitHandlers:
timeout=timeout,
)
# ── /api/git-commit (legacy — delegates to tools/git_commit.py) ──
def handle_git_commit(self):
"""Run tools/git_commit.py --push against the echo-core repo."""
try:
script = constants.TOOLS_DIR / 'git_commit.py'
result = subprocess.run(
[sys.executable, str(script), '--push'],
capture_output=True,
text=True,
timeout=60,
cwd=str(constants.BASE_DIR),
)
output = result.stdout + result.stderr
files_match = re.search(r'Files changed: (\d+)', output)
files = int(files_match.group(1)) if files_match else 0
if result.returncode == 0 or 'Pushing...' in output:
self.send_json({'success': True, 'files': files, 'output': output})
else:
self.send_json({'success': False, 'error': output or 'Unknown error'})
except Exception as e:
self.send_json({'success': False, 'error': str(e)}, 500)
# ── /api/git (dashboard repo) ───────────────────────────────
def handle_git_status(self):
"""Get git status for the echo-core repo."""