2026-05-09 16:36:18 +02:00
|
|
|
"""Worklog router — proxies worklog/standup calls to DevOpsMCP."""
|
|
|
|
|
|
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
from typing import Optional
|
|
|
|
|
|
feat: Taskz project-first redesign, worklog sync, FA6 icons, indigo theme
- Replace 4-column Kanban with project-grouped sidebar + flat task list
- Status badges (colored pills) with click-to-cycle
- Full task edit modal: title, description, status, priority, tags, findings
- Worklog sync endpoints POST /api/v1/worklog/sync + sync-activity
- Worklog empty state with curl command + paste-to-upload modal
- Font Awesome 6 throughout, no emojis
- Indigo topbar (bg-indigo-950)
- Fix Knowledge rendering: r.documents, r.files, r.available_agents/skills
- HOWTOs filename fallback, agent/skill detail extraction
2026-05-09 19:09:51 +02:00
|
|
|
from fastapi import APIRouter, HTTPException, Request
|
2026-05-09 16:36:18 +02:00
|
|
|
|
|
|
|
|
from app import mcp_client
|
|
|
|
|
|
|
|
|
|
router = APIRouter(prefix="/api/v1", tags=["worklog"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@router.get("/worklog")
|
|
|
|
|
async def api_worklog(
|
|
|
|
|
context: str = "egmont",
|
|
|
|
|
days: int = 7,
|
|
|
|
|
group_by: str = "repo",
|
|
|
|
|
since_date: Optional[str] = None,
|
|
|
|
|
until_date: Optional[str] = None,
|
|
|
|
|
):
|
|
|
|
|
try:
|
|
|
|
|
return await mcp_client.get_worklog(
|
|
|
|
|
context=context,
|
|
|
|
|
days=days,
|
|
|
|
|
group_by=group_by,
|
|
|
|
|
since_date=since_date,
|
|
|
|
|
until_date=until_date,
|
|
|
|
|
)
|
|
|
|
|
except Exception as exc:
|
|
|
|
|
raise HTTPException(status_code=502, detail=f"DevOpsMCP error: {exc}") from exc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@router.get("/standup")
|
|
|
|
|
async def api_standup(days: int = 2, context: str = "egmont"):
|
|
|
|
|
try:
|
|
|
|
|
return await mcp_client.get_standup(days=days, context=context)
|
|
|
|
|
except Exception as exc:
|
|
|
|
|
raise HTTPException(status_code=502, detail=f"DevOpsMCP error: {exc}") from exc
|
feat: Taskz project-first redesign, worklog sync, FA6 icons, indigo theme
- Replace 4-column Kanban with project-grouped sidebar + flat task list
- Status badges (colored pills) with click-to-cycle
- Full task edit modal: title, description, status, priority, tags, findings
- Worklog sync endpoints POST /api/v1/worklog/sync + sync-activity
- Worklog empty state with curl command + paste-to-upload modal
- Font Awesome 6 throughout, no emojis
- Indigo topbar (bg-indigo-950)
- Fix Knowledge rendering: r.documents, r.files, r.available_agents/skills
- HOWTOs filename fallback, agent/skill detail extraction
2026-05-09 19:09:51 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
@router.post("/worklog/sync")
|
|
|
|
|
async def api_worklog_sync(request: Request):
|
|
|
|
|
"""Accept raw ~/.githistory content and ingest into DevOpsMCP Redis."""
|
|
|
|
|
body = await request.body()
|
|
|
|
|
content = body.decode("utf-8", errors="replace")
|
|
|
|
|
if not content.strip():
|
|
|
|
|
raise HTTPException(status_code=400, detail="Empty body — send content of ~/.githistory")
|
|
|
|
|
try:
|
|
|
|
|
result = await mcp_client.ingest_git_history(content)
|
|
|
|
|
return {"message": "Git history synced", "result": result}
|
|
|
|
|
except Exception as exc:
|
|
|
|
|
raise HTTPException(status_code=502, detail=f"DevOpsMCP error: {exc}") from exc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@router.post("/worklog/sync-activity")
|
|
|
|
|
async def api_worklog_sync_activity(request: Request):
|
|
|
|
|
"""Accept raw ~/.activitylog content and ingest into DevOpsMCP Redis."""
|
|
|
|
|
body = await request.body()
|
|
|
|
|
content = body.decode("utf-8", errors="replace")
|
|
|
|
|
if not content.strip():
|
|
|
|
|
raise HTTPException(status_code=400, detail="Empty body — send content of ~/.activitylog")
|
|
|
|
|
try:
|
|
|
|
|
result = await mcp_client.ingest_activity_log(content)
|
|
|
|
|
return {"message": "Activity log synced", "result": result}
|
|
|
|
|
except Exception as exc:
|
|
|
|
|
raise HTTPException(status_code=502, detail=f"DevOpsMCP error: {exc}") from exc
|