Files
Orchestrator/shared/OrgMyLife/app/services/backlog_sync.py
T
ankn a5f8fb49ab Migrate all repos into monorepo context folders
Bahn: aisupport, Analyse-O2C-C2S, awesome-bahn-mcp-servers, beam-mcp,
      Confluence_Bot, db-planet-mcp-server, O2C-Harness, project-audit,
      Projekt-KIQ-HP, teamlandkarte-mcp
Dhive: Jury-Voting
Privat: CV, NoteGraph (NOTE: NoteGraph needs complete redo after consolidation)
Shared: AI-Orchestrator, OrgMyLife, power_skills_and_more
Shared/references: symphony (read-only)

Bahn repos remain available as independent remotes - this monorepo
pulls them in via subtree, the originals are untouched.
2026-06-30 20:39:52 +02:00

80 lines
2.8 KiB
Python

import os
from app.db.session import SessionLocal
from app.models import Task
def sync_backlog():
filepath = "BACKLOG.md"
if not os.path.exists(filepath):
return False
db = SessionLocal()
try:
with open(filepath, "r", encoding="utf-8") as f:
lines = f.readlines()
table_lines = [l.strip() for l in lines if l.strip().startswith("|")]
if len(table_lines) > 2:
data_lines = table_lines[2:] # Skip header and separator
for line in data_lines:
cols = [c.strip() for c in line.split("|")]
if len(cols) >= 8:
todo = cols[1]
details = cols[2]
ansprechpartner = cols[3]
quelle = cols[4]
deadline = cols[5]
prioritaet = cols[6].lower()
umfang = cols[7]
if not todo:
continue
priority_val = 4
if "sehr hoch" in prioritaet:
priority_val = 1
elif "hoch" in prioritaet:
priority_val = 2
elif "mittel" in prioritaet:
priority_val = 3
# Build a structured description
description_parts = []
if details: description_parts.append(f"Details: {details}")
if ansprechpartner: description_parts.append(f"Ansprechpartner: {ansprechpartner}")
if deadline: description_parts.append(f"Deadline: {deadline}")
if umfang: description_parts.append(f"Umfang: {umfang}")
full_desc = "\n".join(description_parts)
existing_task = db.query(Task).filter(Task.title == todo).first()
if existing_task:
existing_task.description = full_desc
existing_task.origin = quelle
existing_task.priority = priority_val
else:
new_task = Task(
title=todo,
description=full_desc,
origin=quelle,
priority=priority_val,
status="open"
)
db.add(new_task)
db.commit()
return True
except Exception as e:
print(f"Error syncing backlog: {e}")
db.rollback()
return False
finally:
db.close()
return False
if __name__ == "__main__":
success = sync_backlog()
print(f"Sync successful: {success}")