Update ashboard, dashboard (~3)
This commit is contained in:
@@ -28,9 +28,43 @@ class TaskBoardHandler(SimpleHTTPRequestHandler):
|
||||
self.handle_files_post()
|
||||
elif self.path == '/api/refresh-index':
|
||||
self.handle_refresh_index()
|
||||
elif self.path == '/api/git-commit':
|
||||
self.handle_git_commit()
|
||||
else:
|
||||
self.send_error(404)
|
||||
|
||||
def handle_git_commit(self):
|
||||
"""Run git commit and push."""
|
||||
try:
|
||||
script = TOOLS_DIR / 'git_commit.py'
|
||||
result = subprocess.run(
|
||||
[sys.executable, str(script), '--push'],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=60,
|
||||
cwd=str(BASE_DIR)
|
||||
)
|
||||
|
||||
output = result.stdout + result.stderr
|
||||
|
||||
# Parse files count
|
||||
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)
|
||||
|
||||
def handle_refresh_index(self):
|
||||
"""Regenerate memory/kb/index.json"""
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user