diff --git a/app/main.py b/app/main.py index 0aa9d21..9b2c799 100644 --- a/app/main.py +++ b/app/main.py @@ -3513,6 +3513,35 @@ async def api_stats(): return get_stats() +@app.get("/api/repos") +async def api_repos(): + """Every repo, for pickers (capture page repo selector, 0.21.0). + + Unlike /api/palette (capped at 60 for a launcher), a picker + must be exhaustive — Bruno has 130+ repos. Ranked for the + empty-query case: starred first, archived last, most + recently updated first in between. + """ + repos = await gitea.search_repos() + active, inactive, archived = classify_repos(repos) + try: + starred = {r["full_name"] for r in await gitea.list_starred()} + except Exception: + starred = set() + out = [ + { + "full_name": r["full_name"], + "starred": r["full_name"] in starred, + "updated_at": r.get("updated_at") or "", + "archived": bool(r.get("archived")), + } + for r in active + inactive + archived + ] + out.sort(key=lambda x: x["updated_at"], reverse=True) + out.sort(key=lambda x: (not x["starred"], x["archived"])) + return {"repos": out} + + @app.get("/api/palette") async def api_palette(q: str = ""): """Data for the Ctrl+K command palette (roadmap #10). diff --git a/app/templates/capture.html b/app/templates/capture.html index 684fd57..6a4b9fe 100644 --- a/app/templates/capture.html +++ b/app/templates/capture.html @@ -37,7 +37,12 @@