feat(dashboard): consolidate /api/git-commit into /api/eco/git-commit
This commit is contained in:
@@ -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."""
|
||||
|
||||
Reference in New Issue
Block a user