Documentation, terminology repo cleanup.

This commit is contained in:
2026-05-01 15:00:39 +02:00
parent c9ba7095a7
commit 8889fc3430
22 changed files with 274 additions and 45 deletions

View File

@@ -2,6 +2,7 @@ from __future__ import annotations
from dataclasses import asdict
from html import escape
from pathlib import Path
from urllib.parse import quote_plus
from fastapi import APIRouter, Depends, Form, HTTPException, Query
@@ -13,6 +14,7 @@ from repo_registry.web_api.app import get_service
router = APIRouter(include_in_schema=False)
APP_NAME = "Repository Scoping"
def page(title: str, body: str) -> HTMLResponse:
@@ -23,7 +25,7 @@ def page(title: str, body: str) -> HTMLResponse:
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{escape(title)} · Repository Ability Registry</title>
<title>{escape(title)} · {APP_NAME}</title>
<style>
:root {{
color-scheme: light;
@@ -151,6 +153,18 @@ def page(title: str, body: str) -> HTMLResponse:
.tree ul {{ margin: 8px 0 0 20px; padding: 0; }}
.tree li {{ margin: 6px 0; }}
.source {{ color: var(--muted); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }}
.scope-document {{
margin: 0;
padding: 16px;
overflow-x: auto;
white-space: pre-wrap;
overflow-wrap: anywhere;
border: 1px solid var(--line);
border-radius: 8px;
background: #fbfcfd;
color: #1f2933;
font: 13px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace;
}}
.actions {{ display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }}
[data-pending] {{ display: none; color: var(--muted); }}
form.is-submitting [data-pending] {{ display: inline; }}
@@ -168,10 +182,11 @@ def page(title: str, body: str) -> HTMLResponse:
</head>
<body>
<header>
<a href="/ui"><strong>Repository Ability Registry</strong></a>
<a href="/ui"><strong>{APP_NAME}</strong></a>
<nav class="actions">
<a href="/ui/search">Search</a>
<a href="/ui/discovery">Discovery</a>
<a href="/ui/scope">SCOPE</a>
<a href="/docs">API Docs</a>
</nav>
</header>
@@ -262,6 +277,24 @@ def repository_index(service: RegistryService = Depends(get_service)) -> HTMLRes
return render_repository_index(service)
@router.get("/ui/scope")
def scope_document() -> HTMLResponse:
scope_path = Path("SCOPE.md")
if scope_path.exists():
content = scope_path.read_text(encoding="utf-8")
rendered = f'<pre class="scope-document">{escape(content)}</pre>'
else:
rendered = '<p class="muted">No SCOPE.md file was found in this checkout.</p>'
body = f"""
<h1>SCOPE.md</h1>
<section class="panel stack">
<p class="muted">Canonical scope summary for this repository.</p>
{rendered}
</section>
"""
return page("SCOPE.md", body)
@router.get("/ui/discovery")
def discovery_page(service: RegistryService = Depends(get_service)) -> HTMLResponse:
repositories = service.list_repositories()