feat: Enhance dashboard widget configuration and introduce new widgets
- Updated the dashboard layout schema to include new widgets: DashboardGreeting, QuickWeightToday, BodyStatStrip, StatusPills, ProfileGoalsProgress, TrendKcalWeight, NutritionActivitySummary, RecoverySleepRest, and TrainingTypeDistribution. - Improved widget configuration validation to support new features, including chart days for trend and distribution widgets. - Refactored the default lab layout to align with the updated widget catalog and ensure proper default activation. - Bumped app_dashboard version to 1.6.0 to reflect the addition of new widgets and configuration enhancements.
This commit is contained in:
1 parent
c0c512e942
commit
3d498d03c1
28 files changed
+1487
-243
No files matched your search
@@ -53,10 +53,13 @@ Die Gitea-URL muss von deinem Rechner erreichbar sein (z. B. `192.168.2.144:3000
|
||||
| `gitea_list_issues` | Issues listen, optional alle Seiten |
|
||||
| `gitea_get_issue` | Ein Issue mit Body |
|
||||
| `gitea_comment_issue` | Kommentar |
|
||||
| `gitea_patch_issue` | Titel und/oder **Beschreibung** des Issues ändern (PATCH) |
|
||||
| `gitea_create_issue` | Neu anlegen |
|
||||
| `gitea_close_issue` / `gitea_reopen_issue` | Status |
|
||||
| `gitea_get_repo_file` | Datei remote via API |
|
||||
|
||||
**MCP vs. CLI:** Sehr lange Issue-Bodies oder Vorlagen aus Datei → `python scripts/gitea/gitea_api.py issues edit … --body-file` (siehe README). Kurze Updates direkt im Agent → `gitea_patch_issue`.
|
||||
|
||||
## Issue-Triage durch den Agent
|
||||
|
||||
Sinnvoller Ablauf: Issues listen → je Issue **Code/Commits prüfen** → bei eindeutig erledigt: kurzer Kommentar + **close**; bei teilweise: Kommentar mit Checkboxen; bei unklar: nur Kommentar, **nicht** schließen.
|
||||
|
||||
+18
-1
@@ -15,6 +15,17 @@ Dient dazu, **Issues** auf deiner Gitea-Instanz zu lesen und anzulegen – mit d
|
||||
|
||||
Python 3.10+ (nur Standardbibliothek).
|
||||
|
||||
## MCP vs. CLI (wann was)
|
||||
|
||||
| Aufgabe | Empfehlung |
|
||||
|--------|------------|
|
||||
| Issues listen, ein Issue lesen, kurzer Kommentar, schließen/öffnen | **MCP** (`gitea_*` in Cursor), weniger Kontext im Chat |
|
||||
| **Issue-Beschreibung oder Titel ändern** (PATCH) | Kurz im Chat: **MCP** `gitea_patch_issue`. Groß / aus Datei / Automation: **CLI** `issues edit --body-file` |
|
||||
| Neues Issue mit langem Markdown aus Vorlage | **CLI** `issues create --body-file` |
|
||||
| Remote-Datei aus Gitea lesen (nicht im Workspace) | **MCP** `gitea_get_repo_file` oder CLI `repo file` |
|
||||
|
||||
Beides spricht dieselbe REST-API (`gitea_lib`); Token und `GITEA_*` wie oben.
|
||||
|
||||
## Aufruf (im Repo-Root)
|
||||
|
||||
```powershell
|
||||
@@ -36,6 +47,11 @@ python scripts/gitea/gitea_api.py issues create --title "Fix: …" --body-file p
|
||||
python scripts/gitea/gitea_api.py issues comment 42 --body "…"
|
||||
python scripts/gitea/gitea_api.py issues comment 42 --body-file path/to/comment.md
|
||||
|
||||
# Beschreibung und/oder Titel ändern (PATCH)
|
||||
python scripts/gitea/gitea_api.py issues edit 42 --title "Neuer Titel"
|
||||
python scripts/gitea/gitea_api.py issues edit 42 --body "Neuer **Markdown**-Body"
|
||||
python scripts/gitea/gitea_api.py issues edit 42 --body-file path/to/body.md
|
||||
|
||||
# Schließen / wieder öffnen
|
||||
python scripts/gitea/gitea_api.py issues close 42
|
||||
python scripts/gitea/gitea_api.py issues reopen 42
|
||||
@@ -66,4 +82,5 @@ python scripts/gitea/gitea_api.py repo file backend/main.py --ref develop
|
||||
|
||||
## MCP (Tools direkt im Agent)
|
||||
|
||||
Siehe [`MCP_SETUP.md`](./MCP_SETUP.md) und [`../.cursor/mcp.json.example`](../../.cursor/mcp.json.example).
|
||||
Siehe [`MCP_SETUP.md`](./MCP_SETUP.md) und [`../.cursor/mcp.json.example`](../../.cursor/mcp.json.example).
|
||||
Nach dem Hinzufügen neuer MCP-Tools Cursor einmal **neu starten**, damit die Tool-Liste aktualisiert wird.
|
||||
@@ -103,6 +103,31 @@ def cmd_issues_reopen(args: argparse.Namespace, base: str, token: str, owner: st
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def cmd_issues_edit(args: argparse.Namespace, base: str, token: str, owner: str, repo: str) -> None:
|
||||
fields: dict = {}
|
||||
if args.title is not None:
|
||||
fields["title"] = args.title.strip()
|
||||
if not fields["title"]:
|
||||
sys.stderr.write("issues edit: --title darf nicht leer sein\n")
|
||||
sys.exit(2)
|
||||
body: str | None = None
|
||||
if args.body_file:
|
||||
body = Path(args.body_file).read_text(encoding="utf-8")
|
||||
elif args.body is not None:
|
||||
body = args.body
|
||||
if body is not None:
|
||||
fields["body"] = body
|
||||
if not fields:
|
||||
sys.stderr.write(
|
||||
"issues edit: mindestens eines von --title, --body oder --body-file setzen\n"
|
||||
)
|
||||
sys.exit(2)
|
||||
status, payload = issues_patch(base, token, owner, repo, args.number, fields)
|
||||
print(json.dumps(payload, indent=2, ensure_ascii=False))
|
||||
if status >= 400:
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def cmd_repo_contents(args: argparse.Namespace, base: str, token: str, owner: str, repo: str) -> None:
|
||||
status, payload = repo_file_content(
|
||||
base, token, owner, repo, args.path, ref=args.ref or ""
|
||||
@@ -167,6 +192,20 @@ def main() -> None:
|
||||
p_ro.add_argument("number", type=int)
|
||||
p_ro.set_defaults(_handler=cmd_issues_reopen)
|
||||
|
||||
p_ed = i_sub.add_parser(
|
||||
"edit",
|
||||
help="Issue per PATCH ändern (Titel und/oder Beschreibung; für große Texte --body-file)",
|
||||
)
|
||||
p_ed.add_argument("number", type=int)
|
||||
p_ed.add_argument("--title", default=None, help="Neuer Titel")
|
||||
p_ed.add_argument("--body", default=None, help="Neue Beschreibung (Markdown)")
|
||||
p_ed.add_argument(
|
||||
"--body-file",
|
||||
default=None,
|
||||
help="Beschreibung aus Datei (UTF-8); überschreibt --body wenn beides gesetzt",
|
||||
)
|
||||
p_ed.set_defaults(_handler=cmd_issues_edit)
|
||||
|
||||
p_repo = sub.add_parser("repo", help="Repository (API)")
|
||||
r_sub = p_repo.add_subparsers(dest="repo_cmd", required=True)
|
||||
|
||||
|
||||
@@ -31,7 +31,9 @@ mcp = FastMCP(
|
||||
"mitai-gitea",
|
||||
instructions=(
|
||||
"Gitea-Tools für das Repo aus GITEA_OWNER/GITEA_REPO. "
|
||||
"Schließe Issues nur nach klarer Code-Verifikation; sonst Kommentar mit offenen Punkten."
|
||||
"Schließe Issues nur nach klarer Code-Verifikation; sonst Kommentar mit offenen Punkten. "
|
||||
"Kurze Titel-/Body-Änderungen: gitea_patch_issue. "
|
||||
"Sehr lange Bodies oder Skripte: Terminal scripts/gitea/gitea_api.py issues edit … --body-file."
|
||||
),
|
||||
)
|
||||
|
||||
@@ -95,6 +97,28 @@ def gitea_comment_issue(issue_number: int, body: str) -> str:
|
||||
return _json({"http_status": st, "result": payload})
|
||||
|
||||
|
||||
@mcp.tool()
|
||||
def gitea_patch_issue(
|
||||
issue_number: int,
|
||||
title: str | None = None,
|
||||
body: str | None = None,
|
||||
) -> str:
|
||||
"""Issue-Titel und/oder Beschreibung (PATCH). Mindestens eines von title/body setzen. Für sehr lange Markdown-Texte besser: CLI issues edit --body-file."""
|
||||
fields: dict[str, str] = {}
|
||||
if title is not None:
|
||||
t = title.strip()
|
||||
if not t:
|
||||
return _json({"error": "title darf nicht leer sein"})
|
||||
fields["title"] = t
|
||||
if body is not None:
|
||||
fields["body"] = body
|
||||
if not fields:
|
||||
return _json({"error": "Mindestens title oder body angeben"})
|
||||
base, token, owner, repo = _cfg()
|
||||
st, payload = issues_patch(base, token, owner, repo, issue_number, fields)
|
||||
return _json({"http_status": st, "result": payload})
|
||||
|
||||
|
||||
@mcp.tool()
|
||||
def gitea_close_issue(issue_number: int) -> str:
|
||||
"""Issue schließen (state=closed)."""
|
||||
|
||||
Reference in new issue
Block a user