Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1743c8c101 | ||
|
|
411c0d2934 | ||
|
|
6e71b87d09 | ||
|
|
0417d0593f | ||
|
|
39b751df56 | ||
|
|
1cc27bd4fb | ||
|
|
0c280b3c7e | ||
|
|
395ab6e14c | ||
|
|
05b8c506e0 | ||
|
|
943ecd6a6b | ||
|
|
af59417d07 | ||
|
|
a358c45d73 |
@@ -1,5 +1,78 @@
|
||||
# Changelog
|
||||
|
||||
## 0.8.0 — 2026-10-11
|
||||
|
||||
### Nouveautés
|
||||
- **Palette de commandes** (issue #10) : `Ctrl+K` / `Cmd+K` (ou le
|
||||
bouton ⌨️ dans la navigation) ouvre sur toutes les pages une
|
||||
palette façon Linear/Raycast — actions de navigation, tous les
|
||||
projets (filtrage local instantané) et recherche globale d'issues
|
||||
annotées de leur colonne (nouvel endpoint `GET /api/palette?q=`).
|
||||
Navigation entièrement au clavier (↑↓, Entrée, Échap).
|
||||
- **Digest hebdo vers ObsiGate** (issue #13) : le résumé markdown
|
||||
de la semaine (issues fermées enrichies de leurs titres, cartes en
|
||||
cours/QA/révision, compteurs du journal) est composé
|
||||
automatiquement le jour et l'heure choisis
|
||||
(`KANBANTE_DIGEST_WEEKDAY` / `KANBANTE_DIGEST_TIME`) avec
|
||||
notification ntfy — mais **jamais livré sans approbation** :
|
||||
l'envoi se fait d'un clic sur `/digest`, vers le serveur MCP
|
||||
d'ObsiGate (client MCP intégré : initialize + tools/call ; URL,
|
||||
jeton, nom d'outil et gabarit JSON d'arguments configurables ;
|
||||
bouton « Tester la connexion » qui liste les outils du serveur)
|
||||
ou vers un webhook générique (`KANBANTE_DIGEST_WEBHOOK_URL`,
|
||||
JSON `{title, markdown, week}`).
|
||||
|
||||
11 tests ajoutés (121 au total).
|
||||
|
||||
## 0.7.0 — 2026-10-11
|
||||
|
||||
### Nouveauté
|
||||
- **Capture éclair** (issue #12 de la feuille de route) : trois
|
||||
entrées, un seul geste — transformer un message en issue placée
|
||||
sur le board (événement `created`, source `capture`) :
|
||||
- `POST /api/capture` : endpoint machine-à-machine protégé par un
|
||||
**jeton de capture dédié** (`KANBANTE_CAPTURE_TOKEN`, en-tête
|
||||
`X-Capture-Token` ou Bearer ; distinct du jeton Gitea, révocable
|
||||
seul ; désactivé en 503 tant qu'il n'est pas défini ; exempté
|
||||
d'auth Basic et de CSRF). JSON `{title, body, repo, column}` ou
|
||||
texte libre (première ligne = titre). Dépôt par défaut :
|
||||
`KANBANTE_CAPTURE_REPO`.
|
||||
- **Écoute ntfy** : si `KANBANTE_CAPTURE_NTFY_TOPIC` est défini,
|
||||
un abonné en tâche de fond (flux JSON du topic, reconnexion avec
|
||||
recul, curseur persisté dans `kv_store` — aucun rejeu au
|
||||
redémarrage) transforme chaque message en issue. Les messages
|
||||
tagués `kanbante` sont ignorés (pas d'auto-ingestion).
|
||||
- Page **`/capture`** : formulaire de saisie rapide, statut de
|
||||
configuration et exemples prêts à copier (curl, ntfy). Lien
|
||||
« ⚡ Capture » dans la navigation de toutes les pages.
|
||||
|
||||
12 tests ajoutés (110 au total).
|
||||
|
||||
## 0.6.0 — 2026-10-11
|
||||
|
||||
### Nouveautés
|
||||
- **Colonne QA** entre « En cours » et « Révision » (🧪, étiquette
|
||||
`kanban:qa`) : une étape de validation finale avant la révision.
|
||||
Le flux complet devient Backlog → À faire → En cours → QA →
|
||||
Révision → Terminé ; la vue Focus inclut les cartes en QA.
|
||||
- **Wallboard** (issue #14 de la feuille de route) : `GET /wall`,
|
||||
affichage plein écran pensé pour un écran d'atelier — rotation
|
||||
automatique (30 s) entre les projets actifs, compteurs des six
|
||||
colonnes, cartes en vol (En cours / QA / Révision / À faire) avec
|
||||
âge, fermées du jour, horloge ; rafraîchissement en direct via le
|
||||
flux SSE. `?repo=Proprietaire/depot` fige un seul projet. Lien
|
||||
« 🖥️ Wallboard » ajouté à la navigation de toutes les pages.
|
||||
- **Réconciliation par étiquettes** : si l'étiquette `kanban:*` d'une
|
||||
issue ouverte diverge de sa colonne enregistrée (modifiée dans
|
||||
Gitea ou par un autre outil), le board et la vue Focus adoptent la
|
||||
colonne de l'étiquette et journalisent le déplacement (source
|
||||
`gitea`). Règles : exactement une étiquette `kanban:*` fait foi ;
|
||||
zéro ou plusieurs = l'état local gagne ; inactif si
|
||||
`KANBANTE_SYNC_LABELS=0`. Déplacer une carte depuis Gitea devient
|
||||
donc possible.
|
||||
|
||||
10 tests ajoutés (98 au total).
|
||||
|
||||
## 0.5.2 — 2026-10-11
|
||||
|
||||
### Correctif
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
## Features
|
||||
|
||||
- 📋 **Dashboard** — tous tes projets Gitea en un coup d'œil (actifs / inactifs / archivés — le vrai drapeau Gitea)
|
||||
- 🗂️ **Kanban Board** — colonnes Backlog → À faire → En cours → Révision → Terminé, ordre des cartes persisté
|
||||
- 🗂️ **Kanban Board** — colonnes Backlog → À faire → En cours → **QA** → Révision → Terminé, ordre des cartes persisté
|
||||
- 🎯 **Drag & Drop** — glisse les issues entre colonnes ; en cas d'échec, la carte est replacée
|
||||
- 🔗 **Gitea Sync bidirectionnelle** — « Terminé » ferme l'issue dans Gitea, la ressortir la rouvre ; l'état local est réconcilié à chaque chargement
|
||||
- ➕ **Création d'issues** depuis le board, filtres texte + étiquettes, cartes liées à Gitea
|
||||
@@ -14,7 +14,12 @@
|
||||
- 🗂️ **Panneau détail** — clic sur une carte : corps markdown, commentaires, et réponse postée dans Gitea sans quitter le board
|
||||
- 📰 **Journal d'événements** — chaque mouvement est horodaté : fil d'activité (`/activity`), métriques de débit et de temps de cycle (`/api/metrics`)
|
||||
- ⏳ **Vieillissement + limites WIP** — badge d'ancienneté par colonne et limites souples configurables
|
||||
- 🎯 **Vue Focus** — tout ce qui est En cours / En révision, tous projets confondus (`/focus`)
|
||||
- 🎯 **Vue Focus** — tout ce qui est En cours / en QA / En révision, tous projets confondus (`/focus`)
|
||||
- 🖥️ **Wallboard** — mode TV plein écran (`/wall`) : rotation automatique entre les projets actifs, cartes en vol et compteurs en très grands caractères, rafraîchi en direct ; `?repo=Proprietaire/depot` fige un seul projet
|
||||
- ⌨️ **Palette de commandes** — `Ctrl+K` (ou le bouton ⌨️) sur toutes les pages : actions, projets et recherche d'issues globale, 100 % clavier
|
||||
- 🧠 **Digest hebdo → ObsiGate** — résumé markdown de la semaine (journal + focus) composé automatiquement, **livré seulement sur approbation** (page `/digest`) vers le serveur MCP d'ObsiGate (client MCP intégré, outil et gabarit d'arguments configurables) ou un webhook générique
|
||||
- ⚡ **Capture éclair** — page `/capture` (formulaire), endpoint `POST /api/capture` protégé par un jeton dédié, et écoute ntfy : un message publié sur le topic de capture devient une issue dans le dépôt par défaut
|
||||
- 🔀 **Réconciliation par étiquettes** — si l'étiquette `kanban:*` d'une issue change hors de Kanbante (dans Gitea, par un autre outil), le board adopte la colonne de l'étiquette au chargement et le journalise (source `gitea`). Une seule étiquette `kanban:*` fait foi ; aucune ou plusieurs = l'état local gagne
|
||||
- 🔍 **Recherche globale + Mes issues** — chercher dans toutes les issues de tous les projets (`/search`), et voir ce qui vous est assigné (`/my`)
|
||||
- 📊 **Briefing quotidien** — encours, vieillissement, milestones proches : page `/briefing` et envoi **ntfy** planifié
|
||||
- 🤖 **Serveur MCP** — 7 outils en lecture seule (boards, focus, recherche, métriques) exposés en JSON-RPC sur `/mcp` pour vos agents
|
||||
@@ -110,6 +115,12 @@ sudo systemctl enable --now docker
|
||||
| `KANBANTE_NTFY_TOPIC` | *(vide)* | Topic ntfy du briefing (URL + topic requis pour activer l'envoi) |
|
||||
| `KANBANTE_NTFY_TOKEN` | *(vide)* | Jeton Bearer optionnel pour un topic protégé |
|
||||
| `KANBANTE_BRIEFING_TIME` | *(vide)* | Heure d'envoi quotidien du briefing, `HH:MM` heure du serveur ; vide = pas d'envoi automatique |
|
||||
| `KANBANTE_CAPTURE_REPO` | *(vide)* | Dépôt par défaut de la capture éclair (`Proprietaire/depot`) |
|
||||
| `KANBANTE_CAPTURE_TOKEN` | *(vide)* | Jeton dédié de `POST /api/capture` ; vide = endpoint désactivé (503) |
|
||||
| `KANBANTE_CAPTURE_NTFY_TOPIC` | *(vide)* | Topic ntfy écouté : chaque message devient une issue dans `KANBANTE_CAPTURE_REPO` |
|
||||
| `KANBANTE_DIGEST_TIME` / `KANBANTE_DIGEST_WEEKDAY` | *(vide)* / `0` | Composition hebdo du digest (`HH:MM`, 0 = lundi) ; notification ntfy, jamais d'envoi automatique |
|
||||
| `KANBANTE_OBSIGATE_MCP_URL` / `_TOKEN` / `_TOOL` / `_ARGS` | *(vide)* | Serveur MCP d'ObsiGate : URL, jeton optionnel, outil de création de note, gabarit JSON d'arguments (`{title}`, `{content}`) |
|
||||
| `KANBANTE_DIGEST_WEBHOOK_URL` | *(vide)* | Webhook générique recevant le digest en JSON `{title, markdown, week}` |
|
||||
|
||||
## Sécurité
|
||||
|
||||
@@ -151,7 +162,13 @@ kanbante/
|
||||
|---------|-------|-------------|
|
||||
| GET | `/` | Dashboard tous les projets |
|
||||
| GET | `/board/{owner}/{repo}` | Kanban board |
|
||||
| GET | `/focus` | En cours + En révision, tous projets actifs |
|
||||
| GET | `/focus` | En cours + QA + En révision, tous projets actifs |
|
||||
| GET | `/wall` | Wallboard plein écran (rotation des projets actifs ; `?repo=` pour un seul projet) |
|
||||
| GET | `/capture` | Page de capture éclair (formulaire + statut + instructions) |
|
||||
| GET | `/api/palette` | Données de la palette Ctrl+K (projets + recherche d'issues `?q=`) |
|
||||
| GET | `/digest` | Digest hebdo : aperçu, statut des cibles, approbation d'envoi |
|
||||
| POST | `/digest/send` | Livrer le digest (cible `obsigate` ou `webhook`) — approbation explicite |
|
||||
| POST | `/api/capture` | Capture machine-à-machine (jeton `X-Capture-Token`, JSON ou texte : 1re ligne = titre) |
|
||||
| GET | `/activity` | Fil d'activité (journal d'événements, tous projets) |
|
||||
| POST | `/api/move` | Déplacer une issue (ordre persisté, synchro Gitea) |
|
||||
| POST | `/api/issues` | Créer une issue Gitea depuis le board |
|
||||
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
"""Quick capture (roadmap #12): turn an external message into an issue.
|
||||
|
||||
Two entry points share the same parsing:
|
||||
- POST /api/capture (token-authenticated, in app.main) — curl, a
|
||||
shortcut, any automation;
|
||||
- an ntfy *listener*: messages published to a dedicated topic become
|
||||
issues in the default capture repo. Capture from a phone is then
|
||||
just "share to the ntfy app".
|
||||
|
||||
The listener is a background task with reconnect + dedupe: the last
|
||||
processed ntfy message id is kept (by the caller, in kv_store) and
|
||||
passed back as `since`, so a restart never re-ingests old messages.
|
||||
Messages tagged "kanbante" are skipped — Kanbante never ingests its
|
||||
own posts.
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import json
|
||||
import logging
|
||||
|
||||
import httpx
|
||||
|
||||
from .config import get_settings
|
||||
|
||||
logger = logging.getLogger("kanbante.capture")
|
||||
|
||||
MAX_TITLE_CHARS = 255
|
||||
|
||||
|
||||
def parse_capture_text(text: str) -> tuple[str, str]:
|
||||
"""First non-empty line = title, the rest = body."""
|
||||
lines = (text or "").strip().splitlines()
|
||||
lines = [line.rstrip() for line in lines]
|
||||
while lines and not lines[0].strip():
|
||||
lines.pop(0)
|
||||
if not lines:
|
||||
return "", ""
|
||||
title = lines[0].strip()[:MAX_TITLE_CHARS]
|
||||
body = "\n".join(lines[1:]).strip()
|
||||
return title, body
|
||||
|
||||
|
||||
def parse_ntfy_message(msg: dict) -> tuple[str, str] | None:
|
||||
"""Extract (title, body) from an ntfy message, or None to skip it."""
|
||||
if msg.get("event") not in (None, "message"):
|
||||
return None
|
||||
if "kanbante" in (msg.get("tags") or []):
|
||||
return None
|
||||
title = str(msg.get("title") or "").strip()
|
||||
message = str(msg.get("message") or "").strip()
|
||||
if title and message:
|
||||
return title[:MAX_TITLE_CHARS], message
|
||||
if message:
|
||||
return parse_capture_text(message)
|
||||
if title:
|
||||
return title[:MAX_TITLE_CHARS], ""
|
||||
return None
|
||||
|
||||
|
||||
async def ntfy_capture_loop(create_issue, get_last_id, set_last_id) -> None:
|
||||
"""Subscribe to the capture topic forever (reconnect with backoff).
|
||||
|
||||
create_issue(title, body) is an async callback; get_last_id /
|
||||
set_last_id persist the ntfy cursor. Returns quietly when the
|
||||
listener is no longer configured.
|
||||
"""
|
||||
seen: set[str] = set()
|
||||
while True:
|
||||
settings = get_settings()
|
||||
base = settings.ntfy_url.rstrip("/")
|
||||
topic = settings.capture_ntfy_topic
|
||||
if not base or not topic:
|
||||
return
|
||||
since = get_last_id() or "latest"
|
||||
headers = {}
|
||||
if settings.ntfy_token:
|
||||
headers["Authorization"] = f"Bearer {settings.ntfy_token}"
|
||||
try:
|
||||
async with httpx.AsyncClient(timeout=None) as client:
|
||||
async with client.stream(
|
||||
"GET", f"{base}/{topic}/json?since={since}", headers=headers
|
||||
) as response:
|
||||
response.raise_for_status()
|
||||
logger.info(
|
||||
"ntfy capture listening on %s/%s (since=%s)",
|
||||
base, topic, since,
|
||||
)
|
||||
async for line in response.aiter_lines():
|
||||
if not line.strip():
|
||||
continue
|
||||
try:
|
||||
msg = json.loads(line)
|
||||
except ValueError:
|
||||
continue
|
||||
msg_id = str(msg.get("id") or "")
|
||||
if msg_id:
|
||||
if msg_id in seen:
|
||||
continue
|
||||
seen.add(msg_id)
|
||||
if len(seen) > 500:
|
||||
seen = set(list(seen)[-250:])
|
||||
set_last_id(msg_id)
|
||||
parsed = parse_ntfy_message(msg)
|
||||
if parsed is None:
|
||||
continue
|
||||
title, body = parsed
|
||||
try:
|
||||
await create_issue(title, body)
|
||||
except Exception:
|
||||
logger.exception("capture failed for %r", title)
|
||||
except asyncio.CancelledError:
|
||||
raise
|
||||
except Exception as exc:
|
||||
logger.warning(
|
||||
"ntfy capture stream interrupted (%s); retrying in 10s", exc
|
||||
)
|
||||
await asyncio.sleep(10)
|
||||
+56
-1
@@ -36,6 +36,38 @@ Environment variables:
|
||||
the daily briefing is sent to ntfy.
|
||||
Empty (default) = no automatic send,
|
||||
the /briefing page stays available.
|
||||
KANBANTE_CAPTURE_REPO Default repo for quick capture
|
||||
(POST /api/capture, the /capture page
|
||||
and the ntfy capture listener), e.g.
|
||||
"Projets/kanbante". Empty = captures
|
||||
must name their repo explicitly.
|
||||
KANBANTE_CAPTURE_TOKEN Dedicated token for POST /api/capture
|
||||
(header X-Capture-Token or Bearer).
|
||||
Empty (default) = the endpoint is
|
||||
disabled (503). Distinct from the
|
||||
Gitea token; revocable on its own.
|
||||
KANBANTE_CAPTURE_NTFY_TOPIC ntfy topic listened to for captures:
|
||||
each message published there becomes
|
||||
an issue in KANBANTE_CAPTURE_REPO.
|
||||
Uses KANBANTE_NTFY_URL/_TOKEN as the
|
||||
server. Empty (default) = no listener.
|
||||
KANBANTE_DIGEST_TIME "HH:MM" at which the weekly digest is
|
||||
composed (and ntfy-notified) on
|
||||
KANBANTE_DIGEST_WEEKDAY. The digest is
|
||||
NEVER auto-delivered: it waits for a
|
||||
one-click approval on /digest.
|
||||
KANBANTE_DIGEST_WEEKDAY 0 = Monday … 6 = Sunday (default 0).
|
||||
KANBANTE_DIGEST_WEBHOOK_URL Generic webhook receiving the digest
|
||||
as JSON {title, markdown, week}.
|
||||
KANBANTE_OBSIGATE_MCP_URL URL of ObsiGate's MCP endpoint; the
|
||||
digest is delivered by calling a
|
||||
note-creation tool on it (client MCP).
|
||||
KANBANTE_OBSIGATE_MCP_TOKEN Optional Bearer token for that MCP.
|
||||
KANBANTE_OBSIGATE_MCP_TOOL Name of the ObsiGate tool to call
|
||||
(see /digest for the live tool list).
|
||||
KANBANTE_OBSIGATE_MCP_ARGS JSON argument template for the tool;
|
||||
"{title}" and "{content}" placeholders
|
||||
are substituted (JSON-escaped).
|
||||
"""
|
||||
|
||||
import os
|
||||
@@ -44,7 +76,7 @@ from pathlib import Path
|
||||
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
|
||||
APP_VERSION = "0.5.2"
|
||||
APP_VERSION = "0.8.0"
|
||||
|
||||
|
||||
def _env_bool(name: str, default: bool) -> bool:
|
||||
@@ -100,6 +132,16 @@ class Settings:
|
||||
ntfy_topic: str = ""
|
||||
ntfy_token: str = ""
|
||||
briefing_time: str = ""
|
||||
capture_repo: str = ""
|
||||
capture_token: str = ""
|
||||
capture_ntfy_topic: str = ""
|
||||
digest_time: str = ""
|
||||
digest_weekday: int = 0
|
||||
digest_webhook_url: str = ""
|
||||
obsigate_mcp_url: str = ""
|
||||
obsigate_mcp_token: str = ""
|
||||
obsigate_mcp_tool: str = ""
|
||||
obsigate_mcp_args: str = '{"title": "{title}", "content": "{content}"}'
|
||||
|
||||
@property
|
||||
def auth_enabled(self) -> bool:
|
||||
@@ -129,4 +171,17 @@ def get_settings() -> Settings:
|
||||
ntfy_topic=os.getenv("KANBANTE_NTFY_TOPIC", ""),
|
||||
ntfy_token=os.getenv("KANBANTE_NTFY_TOKEN", ""),
|
||||
briefing_time=os.getenv("KANBANTE_BRIEFING_TIME", ""),
|
||||
capture_repo=os.getenv("KANBANTE_CAPTURE_REPO", ""),
|
||||
capture_token=os.getenv("KANBANTE_CAPTURE_TOKEN", ""),
|
||||
capture_ntfy_topic=os.getenv("KANBANTE_CAPTURE_NTFY_TOPIC", ""),
|
||||
digest_time=os.getenv("KANBANTE_DIGEST_TIME", ""),
|
||||
digest_weekday=_env_int("KANBANTE_DIGEST_WEEKDAY", 0),
|
||||
digest_webhook_url=os.getenv("KANBANTE_DIGEST_WEBHOOK_URL", ""),
|
||||
obsigate_mcp_url=os.getenv("KANBANTE_OBSIGATE_MCP_URL", ""),
|
||||
obsigate_mcp_token=os.getenv("KANBANTE_OBSIGATE_MCP_TOKEN", ""),
|
||||
obsigate_mcp_tool=os.getenv("KANBANTE_OBSIGATE_MCP_TOOL", ""),
|
||||
obsigate_mcp_args=os.getenv(
|
||||
"KANBANTE_OBSIGATE_MCP_ARGS",
|
||||
'{"title": "{title}", "content": "{content}"}',
|
||||
),
|
||||
)
|
||||
|
||||
+188
@@ -0,0 +1,188 @@
|
||||
"""Weekly digest (roadmap #13): the week in Kanbante, as a note.
|
||||
|
||||
Composes a markdown digest from the event journal (last 7 days) and
|
||||
the current focus snapshot, then — ONLY after a human approves on
|
||||
/digest (standing rule: cross-app writes need approval) — delivers
|
||||
it to ObsiGate through its MCP server (Kanbante as MCP *client*:
|
||||
initialize → tools/call) or to a generic JSON webhook.
|
||||
|
||||
The ObsiGate tool contract is configurable (URL, tool name, JSON
|
||||
argument template with {title}/{content} placeholders) because the
|
||||
exact tool names of the target server are an operator decision, not
|
||||
something to hardcode blindly.
|
||||
"""
|
||||
|
||||
import json
|
||||
import logging
|
||||
|
||||
import httpx
|
||||
|
||||
logger = logging.getLogger("kanbante.digest")
|
||||
|
||||
MCP_PROTOCOL_VERSION = "2024-11-05"
|
||||
|
||||
|
||||
def format_digest_markdown(
|
||||
week_label: str,
|
||||
closed_items: list[dict],
|
||||
created_count: int,
|
||||
moved_count: int,
|
||||
focus_groups: list[dict],
|
||||
) -> str:
|
||||
"""Render the weekly digest as markdown (Obsidian-friendly)."""
|
||||
lines = [f"# 🧠 Kanbante — semaine du {week_label}", ""]
|
||||
lines.append(f"## ✅ Livré ({len(closed_items)})")
|
||||
if closed_items:
|
||||
for item in closed_items:
|
||||
title = item.get("title") or ""
|
||||
lines.append(
|
||||
f"- [{item['repo']}#{item['number']}]({item.get('html_url', '')})"
|
||||
f" {title}".rstrip()
|
||||
)
|
||||
else:
|
||||
lines.append("- Rien n'a été fermé cette semaine.")
|
||||
lines.append("")
|
||||
lines.append("## 🚧 En cours")
|
||||
total_focus = sum(len(g["cards"]) for g in focus_groups)
|
||||
if total_focus:
|
||||
for group in focus_groups:
|
||||
lines.append(f"### {group['full_name']}")
|
||||
for card in group["cards"]:
|
||||
issue = card["issue"]
|
||||
lines.append(
|
||||
f"- #{issue['number']} {issue.get('title', '')}"
|
||||
f" — *{card['column']}*"
|
||||
)
|
||||
else:
|
||||
lines.append("- Aucune carte en cours, en QA ou en révision.")
|
||||
lines.append("")
|
||||
lines.append("## 📈 Activité de la semaine")
|
||||
lines.append(f"- Issues créées : {created_count}")
|
||||
lines.append(f"- Déplacements de cartes : {moved_count}")
|
||||
lines.append(f"- Issues fermées : {len(closed_items)}")
|
||||
lines.append("")
|
||||
lines.append("*Digest composé par Kanbante à partir de son journal d'événements.*")
|
||||
return "\n".join(lines)
|
||||
|
||||
|
||||
def render_mcp_args(template: str, title: str, content: str) -> dict:
|
||||
"""Substitute {title}/{content} in a JSON template, safely."""
|
||||
def esc(value: str) -> str:
|
||||
return json.dumps(value, ensure_ascii=False)[1:-1]
|
||||
|
||||
rendered = template.replace("{title}", esc(title)).replace(
|
||||
"{content}", esc(content)
|
||||
)
|
||||
try:
|
||||
args = json.loads(rendered)
|
||||
except ValueError as exc:
|
||||
raise ValueError(f"KANBANTE_OBSIGATE_MCP_ARGS is not valid JSON: {exc}")
|
||||
if not isinstance(args, dict):
|
||||
raise ValueError("KANBANTE_OBSIGATE_MCP_ARGS must be a JSON object")
|
||||
return args
|
||||
|
||||
|
||||
async def send_webhook(url: str, title: str, markdown: str, week: str) -> tuple[bool, str]:
|
||||
"""POST the digest as JSON to a generic webhook."""
|
||||
try:
|
||||
async with httpx.AsyncClient(timeout=20) as client:
|
||||
response = await client.post(
|
||||
url, json={"title": title, "markdown": markdown, "week": week}
|
||||
)
|
||||
if response.status_code < 300:
|
||||
return True, f"webhook HTTP {response.status_code}"
|
||||
return False, f"webhook HTTP {response.status_code}: {response.text[:200]}"
|
||||
except Exception as exc:
|
||||
return False, f"webhook error: {exc}"
|
||||
|
||||
|
||||
def _mcp_headers(token: str) -> dict:
|
||||
headers = {
|
||||
"Accept": "application/json, text/event-stream",
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
if token:
|
||||
headers["Authorization"] = f"Bearer {token}"
|
||||
return headers
|
||||
|
||||
|
||||
def _parse_mcp_body(response: httpx.Response) -> dict:
|
||||
"""MCP streamable HTTP answers JSON or an SSE frame — accept both."""
|
||||
text = response.text.strip()
|
||||
if not text:
|
||||
return {}
|
||||
if text.startswith("{"):
|
||||
return json.loads(text)
|
||||
payload: dict = {}
|
||||
for line in text.splitlines():
|
||||
if line.startswith("data:"):
|
||||
chunk = line[5:].strip()
|
||||
if chunk.startswith("{"):
|
||||
payload = json.loads(chunk)
|
||||
return payload
|
||||
|
||||
|
||||
async def _mcp_rpc(client: httpx.AsyncClient, url: str, token: str,
|
||||
method: str, params: dict, req_id: int) -> dict:
|
||||
response = await client.post(
|
||||
url,
|
||||
json={"jsonrpc": "2.0", "id": req_id, "method": method, "params": params},
|
||||
headers=_mcp_headers(token),
|
||||
)
|
||||
response.raise_for_status()
|
||||
payload = _parse_mcp_body(response)
|
||||
if "error" in payload:
|
||||
err = payload["error"] or {}
|
||||
raise RuntimeError(f"MCP error {err.get('code')}: {err.get('message')}")
|
||||
return payload.get("result") or {}
|
||||
|
||||
|
||||
async def _mcp_session(client: httpx.AsyncClient, url: str, token: str) -> None:
|
||||
await _mcp_rpc(
|
||||
client, url, token, "initialize",
|
||||
{
|
||||
"protocolVersion": MCP_PROTOCOL_VERSION,
|
||||
"capabilities": {},
|
||||
"clientInfo": {"name": "kanbante", "version": "0.8.0"},
|
||||
},
|
||||
req_id=1,
|
||||
)
|
||||
await client.post(
|
||||
url,
|
||||
json={"jsonrpc": "2.0", "method": "notifications/initialized"},
|
||||
headers=_mcp_headers(token),
|
||||
)
|
||||
|
||||
|
||||
async def mcp_list_tools(url: str, token: str) -> tuple[bool, list[str] | str]:
|
||||
"""(True, [tool names]) or (False, error message)."""
|
||||
try:
|
||||
async with httpx.AsyncClient(timeout=20) as client:
|
||||
await _mcp_session(client, url, token)
|
||||
result = await _mcp_rpc(client, url, token, "tools/list", {}, req_id=2)
|
||||
return True, [t.get("name", "?") for t in result.get("tools", [])]
|
||||
except Exception as exc:
|
||||
return False, f"MCP tools/list failed: {exc}"
|
||||
|
||||
|
||||
async def mcp_call_tool(
|
||||
url: str, token: str, tool: str, arguments: dict
|
||||
) -> tuple[bool, str]:
|
||||
"""Call one tool; (True, short result) or (False, error message)."""
|
||||
try:
|
||||
async with httpx.AsyncClient(timeout=30) as client:
|
||||
await _mcp_session(client, url, token)
|
||||
result = await _mcp_rpc(
|
||||
client, url, token, "tools/call",
|
||||
{"name": tool, "arguments": arguments}, req_id=3,
|
||||
)
|
||||
if result.get("isError"):
|
||||
return False, f"tool {tool} reported an error: {str(result)[:300]}"
|
||||
texts = [
|
||||
block.get("text", "")
|
||||
for block in result.get("content", [])
|
||||
if isinstance(block, dict) and block.get("type") == "text"
|
||||
]
|
||||
return True, (" ".join(texts)[:300] or f"tool {tool} OK")
|
||||
except Exception as exc:
|
||||
return False, f"MCP tools/call failed: {exc}"
|
||||
+563
-5
@@ -34,7 +34,9 @@ from starlette.middleware.base import BaseHTTPMiddleware
|
||||
|
||||
from app.config import APP_VERSION, get_settings
|
||||
from app.gitea_client import GiteaClient
|
||||
from app import digest as digest_service
|
||||
from app.briefing import format_briefing_text, ntfy_configured, send_ntfy
|
||||
from app.capture import ntfy_capture_loop, parse_capture_text
|
||||
from app.models import (
|
||||
KANBAN_COLUMNS,
|
||||
column_entry_times,
|
||||
@@ -64,6 +66,7 @@ COLUMN_LABELS = {
|
||||
"backlog": "📥 Backlog",
|
||||
"todo": "📋 À faire",
|
||||
"in_progress": "🚧 En cours",
|
||||
"qa": "🧪 QA",
|
||||
"review": "🔍 Révision",
|
||||
"done": "✅ Terminé",
|
||||
}
|
||||
@@ -72,11 +75,16 @@ COLUMN_COLORS = {
|
||||
"backlog": "#6b7280",
|
||||
"todo": "#3b82f6",
|
||||
"in_progress": "#f59e0b",
|
||||
"qa": "#06b6d4",
|
||||
"review": "#8b5cf6",
|
||||
"done": "#10b981",
|
||||
}
|
||||
|
||||
FOCUS_COLUMNS = ["in_progress", "review"]
|
||||
FOCUS_COLUMNS = ["in_progress", "qa", "review"]
|
||||
|
||||
# Columns mirrored to Gitea as kanban:<column> labels (backlog and
|
||||
# done carry none: done is the closed state itself).
|
||||
LABELLED_COLUMNS = ("todo", "in_progress", "qa", "review")
|
||||
|
||||
EVENT_ICONS = {
|
||||
"created": "➕",
|
||||
@@ -133,8 +141,32 @@ async def lifespan(app: FastAPI):
|
||||
"GITEA_TOKEN is not set: only public Gitea content will be visible."
|
||||
)
|
||||
scheduler = asyncio.create_task(_briefing_scheduler())
|
||||
digest_task = asyncio.create_task(_digest_scheduler())
|
||||
capture_task = None
|
||||
if settings.capture_ntfy_topic and settings.ntfy_url:
|
||||
async def _capture_create(title: str, body: str) -> None:
|
||||
repo = get_settings().capture_repo
|
||||
if not repo:
|
||||
logger.warning("ntfy capture: no KANBANTE_CAPTURE_REPO, skipped")
|
||||
return
|
||||
await _do_capture(title, body, repo, "backlog")
|
||||
|
||||
capture_task = asyncio.create_task(
|
||||
ntfy_capture_loop(
|
||||
_capture_create,
|
||||
lambda: get_kv("capture_ntfy_last_id"),
|
||||
lambda value: set_kv("capture_ntfy_last_id", value),
|
||||
)
|
||||
)
|
||||
logger.info(
|
||||
"ntfy capture listener started (topic %s)",
|
||||
settings.capture_ntfy_topic,
|
||||
)
|
||||
yield
|
||||
scheduler.cancel()
|
||||
digest_task.cancel()
|
||||
if capture_task is not None:
|
||||
capture_task.cancel()
|
||||
await gitea.aclose()
|
||||
|
||||
|
||||
@@ -156,7 +188,7 @@ class AuthMiddleware(BaseHTTPMiddleware):
|
||||
async def dispatch(self, request: Request, call_next):
|
||||
# /api/health: liveness for Docker. /webhooks/gitea: authenticated
|
||||
# by its HMAC signature, not by Basic auth (Gitea cannot log in).
|
||||
if request.url.path in ("/api/health", "/webhooks/gitea"):
|
||||
if request.url.path in ("/api/health", "/webhooks/gitea", "/api/capture"):
|
||||
return await call_next(request)
|
||||
settings = get_settings()
|
||||
if not settings.auth_enabled:
|
||||
@@ -353,6 +385,44 @@ def _merge_issues_with_board(
|
||||
return columns
|
||||
|
||||
|
||||
def _adopt_label_columns(
|
||||
full_name: str, open_issues: list[dict], board_state: dict
|
||||
) -> None:
|
||||
"""Adopt the column named by an issue's kanban:* label, if any.
|
||||
|
||||
Labels are the Gitea-visible mirror of columns (written on every
|
||||
drag). If the label changed outside Kanbante — edited in Gitea,
|
||||
or set by another tool — the board follows it and the move is
|
||||
journaled (source "gitea"). Rules: exactly one kanban:* label
|
||||
(zero or several = no opinion), target must be a labelled column,
|
||||
and label synchronisation must be enabled.
|
||||
"""
|
||||
if not get_settings().sync_labels:
|
||||
return
|
||||
placement: dict[int, str] = {}
|
||||
for col_name, cards in board_state.items():
|
||||
for card in cards:
|
||||
placement[card["issue_number"]] = col_name
|
||||
for issue in open_issues:
|
||||
names = [
|
||||
str(label.get("name", "")) for label in issue.get("labels") or []
|
||||
]
|
||||
kanban = [n for n in names if n.startswith("kanban:")]
|
||||
if len(kanban) != 1:
|
||||
continue
|
||||
target = kanban[0].split(":", 1)[1]
|
||||
if target not in LABELLED_COLUMNS:
|
||||
continue
|
||||
current = placement.get(issue["number"], "backlog")
|
||||
if current != target:
|
||||
move_issue(full_name, issue["number"], target)
|
||||
log_event(
|
||||
full_name, issue["number"], "moved",
|
||||
from_column=current, to_column=target, source="gitea",
|
||||
)
|
||||
placement[issue["number"]] = target
|
||||
|
||||
|
||||
def _split_full_name(repo_full_name: str) -> tuple[str, str] | None:
|
||||
owner, sep, repo = repo_full_name.partition("/")
|
||||
if not sep or not owner or not repo or "/" in repo:
|
||||
@@ -405,6 +475,9 @@ async def board(request: Request, owner: str, repo: str, milestone: str = ""):
|
||||
for number in changes["closed_numbers"]:
|
||||
log_event(full_name, number, "closed", to_column="done", source="gitea")
|
||||
|
||||
# A kanban:* label changed outside Kanbante wins over local state.
|
||||
_adopt_label_columns(full_name, open_issues, get_board_state(full_name))
|
||||
|
||||
# Milestone view: filter the board to one milestone (sprint-style),
|
||||
# with its deadline and completion progress.
|
||||
milestones: list[dict] = []
|
||||
@@ -530,6 +603,7 @@ async def _collect_focus_groups() -> list[dict]:
|
||||
logger.warning("focus: repo fetch failed: %s", result)
|
||||
continue
|
||||
full_name, open_issues = result
|
||||
_adopt_label_columns(full_name, open_issues, get_board_state(full_name))
|
||||
columns = _merge_issues_with_board(open_issues, get_board_state(full_name))
|
||||
cards = [
|
||||
{"issue": issue, "column": col}
|
||||
@@ -578,6 +652,96 @@ def _group_issue_results(issues: list[dict]) -> list[dict]:
|
||||
return groups
|
||||
|
||||
|
||||
WALL_COLUMNS = ["in_progress", "qa", "review", "todo"]
|
||||
|
||||
|
||||
async def _collect_wall_data(only_repo: str | None) -> list[dict]:
|
||||
"""Slides for the wallboard: one per active project.
|
||||
|
||||
Each slide carries the column counts, the cards in flight
|
||||
(in progress / QA / review / todo, in flow order) with their age
|
||||
in column, and how many cards were closed today (journal).
|
||||
"""
|
||||
if only_repo:
|
||||
if _split_full_name(only_repo) is None:
|
||||
return []
|
||||
known = await gitea.search_repos()
|
||||
match = [r for r in known if r.get("full_name") == only_repo]
|
||||
if not match:
|
||||
return []
|
||||
repos = match
|
||||
else:
|
||||
all_repos = await gitea.search_repos()
|
||||
active, _inactive, _archived = classify_repos(all_repos)
|
||||
repos = active[:12]
|
||||
|
||||
today = datetime.now(timezone.utc).strftime("%Y-%m-%d")
|
||||
closed_today: dict[str, int] = {}
|
||||
for event in get_events(limit=500):
|
||||
if event["event_type"] == "closed" and str(
|
||||
event["created_at"]
|
||||
).startswith(today):
|
||||
closed_today[event["repo_full_name"]] = (
|
||||
closed_today.get(event["repo_full_name"], 0) + 1
|
||||
)
|
||||
|
||||
slides = []
|
||||
for repo in repos:
|
||||
full_name = repo["full_name"]
|
||||
owner, _, name = full_name.partition("/")
|
||||
try:
|
||||
items = await gitea.get_repo_issues(owner, name, state="open")
|
||||
except Exception as exc:
|
||||
logger.debug("wall: issues failed for %s: %s", full_name, exc)
|
||||
continue
|
||||
open_issues = [i for i in items if _is_issue(i)]
|
||||
_adopt_label_columns(full_name, open_issues, get_board_state(full_name))
|
||||
board_state = get_board_state(full_name)
|
||||
columns = _merge_issues_with_board(open_issues, board_state)
|
||||
ages = _card_ages(full_name, open_issues, board_state)
|
||||
aging_days = get_settings().aging_days
|
||||
cards = []
|
||||
for col in WALL_COLUMNS:
|
||||
for issue in columns[col]:
|
||||
age = ages.get(issue["number"]) or {}
|
||||
days = age.get("days")
|
||||
cards.append(
|
||||
{
|
||||
"number": issue["number"],
|
||||
"title": issue.get("title", ""),
|
||||
"column": col,
|
||||
"column_label": COLUMN_LABELS[col],
|
||||
"age_days": days,
|
||||
"aging": days is not None and days >= aging_days,
|
||||
}
|
||||
)
|
||||
slides.append(
|
||||
{
|
||||
"full_name": full_name,
|
||||
"counts": {col: len(columns[col]) for col in KANBAN_COLUMNS},
|
||||
"open_total": len(open_issues),
|
||||
"cards": cards[:9],
|
||||
"closed_today": closed_today.get(full_name, 0),
|
||||
}
|
||||
)
|
||||
return slides
|
||||
|
||||
|
||||
@app.get("/wall", response_class=HTMLResponse)
|
||||
async def wall(request: Request, repo: str = ""):
|
||||
"""Wallboard: full-screen, auto-rotating, live project display."""
|
||||
slides = await _collect_wall_data(repo or None)
|
||||
return render(
|
||||
request,
|
||||
"wall.html",
|
||||
slides=slides,
|
||||
single=bool(repo),
|
||||
column_labels=COLUMN_LABELS,
|
||||
column_colors=COLUMN_COLORS,
|
||||
columns=KANBAN_COLUMNS,
|
||||
)
|
||||
|
||||
|
||||
@app.get("/search", response_class=HTMLResponse)
|
||||
async def search_page(request: Request, q: str = ""):
|
||||
"""Global issue search across every repo (Gitea search API)."""
|
||||
@@ -865,6 +1029,349 @@ async def sse_event_stream(request: Request):
|
||||
hub.unsubscribe(queue)
|
||||
|
||||
|
||||
async def _do_capture(
|
||||
title: str, body: str, repo_full_name: str, column: str = "backlog"
|
||||
) -> dict:
|
||||
"""Create a Gitea issue from a capture and place its card.
|
||||
|
||||
Shared by POST /api/capture, the /capture page and the ntfy
|
||||
listener. Raises ValueError for bad input (callers map to 400).
|
||||
"""
|
||||
title = (title or "").strip()
|
||||
if not title or len(title) > 255:
|
||||
raise ValueError("Title required (max 255 chars)")
|
||||
if column not in KANBAN_COLUMNS:
|
||||
raise ValueError("Invalid column")
|
||||
parts = _split_full_name(repo_full_name)
|
||||
if parts is None:
|
||||
raise ValueError("Invalid repo (expected owner/name)")
|
||||
owner, repo = parts
|
||||
issue = await gitea.create_issue(owner, repo, title, body or "")
|
||||
move_issue(repo_full_name, issue["number"], column)
|
||||
log_event(
|
||||
repo_full_name, issue["number"], "created",
|
||||
to_column=column, source="capture",
|
||||
)
|
||||
return {
|
||||
"number": issue["number"],
|
||||
"title": issue.get("title", title),
|
||||
"html_url": issue.get("html_url", ""),
|
||||
"repo_full_name": repo_full_name,
|
||||
"column": column,
|
||||
}
|
||||
|
||||
|
||||
@app.post("/api/capture")
|
||||
async def api_capture(request: Request):
|
||||
"""Quick capture endpoint (roadmap #12).
|
||||
|
||||
Auth: dedicated capture token (X-Capture-Token header or
|
||||
Authorization: Bearer), distinct from the Gitea token. Exempt
|
||||
from Basic Auth and CSRF — it is a machine-to-machine endpoint.
|
||||
Disabled (503) until KANBANTE_CAPTURE_TOKEN is set.
|
||||
"""
|
||||
settings = get_settings()
|
||||
if not settings.capture_token:
|
||||
return JSONResponse(
|
||||
{"ok": False, "error": "Capture is not configured "
|
||||
"(set KANBANTE_CAPTURE_TOKEN)"},
|
||||
status_code=503,
|
||||
)
|
||||
provided = request.headers.get("x-capture-token", "")
|
||||
auth = request.headers.get("authorization", "")
|
||||
if not provided and auth.lower().startswith("bearer "):
|
||||
provided = auth[7:].strip()
|
||||
if not provided or not secrets.compare_digest(provided, settings.capture_token):
|
||||
return JSONResponse(
|
||||
{"ok": False, "error": "Invalid capture token"}, status_code=401
|
||||
)
|
||||
|
||||
content_type = request.headers.get("content-type", "")
|
||||
title = body = text = repo = ""
|
||||
column = "backlog"
|
||||
if "application/json" in content_type:
|
||||
try:
|
||||
payload = await request.json()
|
||||
except Exception:
|
||||
payload = {}
|
||||
if isinstance(payload, dict):
|
||||
title = str(payload.get("title") or "")
|
||||
body = str(payload.get("body") or "")
|
||||
text = str(payload.get("text") or "")
|
||||
repo = str(payload.get("repo") or "")
|
||||
column = str(payload.get("column") or "backlog")
|
||||
elif "application/x-www-form-urlencoded" in content_type or (
|
||||
"multipart/form-data" in content_type
|
||||
):
|
||||
form = await request.form()
|
||||
title = str(form.get("title") or "")
|
||||
body = str(form.get("body") or "")
|
||||
text = str(form.get("text") or "")
|
||||
repo = str(form.get("repo") or "")
|
||||
column = str(form.get("column") or "backlog")
|
||||
else: # text/plain and friends: the whole body is the capture
|
||||
text = (await request.body()).decode("utf-8", errors="replace")
|
||||
|
||||
if not title and text:
|
||||
title, rest = parse_capture_text(text)
|
||||
body = body or rest
|
||||
repo = repo or settings.capture_repo
|
||||
if not repo:
|
||||
return JSONResponse(
|
||||
{"ok": False, "error": "No repo given and KANBANTE_CAPTURE_REPO "
|
||||
"is not set"},
|
||||
status_code=400,
|
||||
)
|
||||
try:
|
||||
created = await _do_capture(title, body, repo, column)
|
||||
except ValueError as exc:
|
||||
return JSONResponse({"ok": False, "error": str(exc)}, status_code=400)
|
||||
return JSONResponse({"ok": True, "issue": created}, status_code=201)
|
||||
|
||||
|
||||
@app.get("/capture", response_class=HTMLResponse)
|
||||
async def capture_page(request: Request):
|
||||
"""Quick-capture page: form, status and usage instructions."""
|
||||
settings = get_settings()
|
||||
return render(
|
||||
request,
|
||||
"capture.html",
|
||||
capture_repo=settings.capture_repo,
|
||||
api_enabled=bool(settings.capture_token),
|
||||
ntfy_topic=settings.capture_ntfy_topic,
|
||||
ntfy_url=settings.ntfy_url,
|
||||
created=None,
|
||||
error=None,
|
||||
)
|
||||
|
||||
|
||||
@app.post("/capture", response_class=HTMLResponse)
|
||||
async def capture_submit(
|
||||
request: Request,
|
||||
repo_full_name: str = Form(""),
|
||||
title: str = Form(""),
|
||||
body: str = Form(""),
|
||||
column: str = Form("backlog"),
|
||||
csrf_token: str = Form(""),
|
||||
):
|
||||
"""Web form capture (session + CSRF, like every other form)."""
|
||||
if not _csrf_valid(request, csrf_token):
|
||||
return _csrf_error()
|
||||
settings = get_settings()
|
||||
repo_full_name = repo_full_name.strip() or settings.capture_repo
|
||||
created, error = None, None
|
||||
if not repo_full_name:
|
||||
error = "Aucun dépôt : renseigne le dépôt ou définis KANBANTE_CAPTURE_REPO."
|
||||
else:
|
||||
try:
|
||||
created = await _do_capture(title, body, repo_full_name, column)
|
||||
except ValueError as exc:
|
||||
error = str(exc)
|
||||
return render(
|
||||
request,
|
||||
"capture.html",
|
||||
capture_repo=settings.capture_repo,
|
||||
api_enabled=bool(settings.capture_token),
|
||||
ntfy_topic=settings.capture_ntfy_topic,
|
||||
ntfy_url=settings.ntfy_url,
|
||||
created=created,
|
||||
error=error,
|
||||
)
|
||||
|
||||
|
||||
async def _weekly_digest() -> dict:
|
||||
"""Compose the weekly digest (journal of the last 7 days + focus)."""
|
||||
now = datetime.now(timezone.utc)
|
||||
since = (now - timedelta(days=7)).replace(tzinfo=None)
|
||||
events = []
|
||||
for event in get_events(limit=1000):
|
||||
at = _parse_datetime(str(event.get("created_at") or ""))
|
||||
if at is not None and at.replace(tzinfo=None) >= since:
|
||||
events.append(event)
|
||||
|
||||
closed_keys: list[tuple[str, int]] = []
|
||||
seen: set[tuple[str, int]] = set()
|
||||
for event in events:
|
||||
if event["event_type"] == "closed":
|
||||
key = (event["repo_full_name"], event["issue_number"])
|
||||
if key not in seen:
|
||||
seen.add(key)
|
||||
closed_keys.append(key)
|
||||
|
||||
titles: dict[tuple[str, int], dict] = {}
|
||||
for repo_name in {repo for repo, _ in closed_keys}:
|
||||
owner, _, name = repo_name.partition("/")
|
||||
try:
|
||||
items = await gitea.get_repo_issues(owner, name, state="all")
|
||||
except Exception:
|
||||
continue
|
||||
for item in items:
|
||||
if _is_issue(item):
|
||||
titles[(repo_name, item["number"])] = item
|
||||
closed_items = [
|
||||
{
|
||||
"repo": repo,
|
||||
"number": number,
|
||||
"title": (titles.get((repo, number)) or {}).get("title", ""),
|
||||
"html_url": (titles.get((repo, number)) or {}).get("html_url", ""),
|
||||
}
|
||||
for repo, number in closed_keys
|
||||
]
|
||||
|
||||
focus_groups = []
|
||||
for group in await _collect_focus_groups():
|
||||
focus_groups.append(
|
||||
{
|
||||
"full_name": group["full_name"],
|
||||
"cards": [
|
||||
{
|
||||
"issue": card["issue"],
|
||||
"column": COLUMN_LABELS[card["column"]],
|
||||
}
|
||||
for card in group["cards"]
|
||||
],
|
||||
}
|
||||
)
|
||||
|
||||
week_label = (
|
||||
f"{(now - timedelta(days=6)).strftime('%Y-%m-%d')}"
|
||||
f" au {now.strftime('%Y-%m-%d')}"
|
||||
)
|
||||
markdown = digest_service.format_digest_markdown(
|
||||
week_label,
|
||||
closed_items,
|
||||
created_count=sum(1 for e in events if e["event_type"] == "created"),
|
||||
moved_count=sum(1 for e in events if e["event_type"] == "moved"),
|
||||
focus_groups=focus_groups,
|
||||
)
|
||||
return {
|
||||
"title": f"Kanbante — semaine du {week_label}",
|
||||
"week": now.strftime("%G-W%V"),
|
||||
"markdown": markdown,
|
||||
"closed_count": len(closed_items),
|
||||
}
|
||||
|
||||
|
||||
def _render_digest(request: Request, banner: str | None = None,
|
||||
tools: list[str] | None = None):
|
||||
settings = get_settings()
|
||||
return render(
|
||||
request,
|
||||
"digest.html",
|
||||
pending=get_kv("digest_pending"),
|
||||
last_result=get_kv("digest_last_result"),
|
||||
obsigate_configured=bool(settings.obsigate_mcp_url),
|
||||
obsigate_url=settings.obsigate_mcp_url,
|
||||
obsigate_tool=settings.obsigate_mcp_tool,
|
||||
webhook_configured=bool(settings.digest_webhook_url),
|
||||
digest_time=settings.digest_time,
|
||||
digest_weekday=settings.digest_weekday,
|
||||
banner=banner,
|
||||
tools=tools,
|
||||
)
|
||||
|
||||
|
||||
@app.get("/digest", response_class=HTMLResponse)
|
||||
async def digest_page(request: Request):
|
||||
"""Weekly digest: preview, approval and delivery status."""
|
||||
return _render_digest(request)
|
||||
|
||||
|
||||
@app.post("/digest/probe", response_class=HTMLResponse)
|
||||
async def digest_probe(request: Request, csrf_token: str = Form("")):
|
||||
"""List the tools of the configured ObsiGate MCP server."""
|
||||
if not _csrf_valid(request, csrf_token):
|
||||
return _csrf_error()
|
||||
settings = get_settings()
|
||||
if not settings.obsigate_mcp_url:
|
||||
return _render_digest(request, banner="❌ Aucun serveur MCP ObsiGate configuré (KANBANTE_OBSIGATE_MCP_URL).")
|
||||
ok, result = await digest_service.mcp_list_tools(
|
||||
settings.obsigate_mcp_url, settings.obsigate_mcp_token
|
||||
)
|
||||
if ok:
|
||||
return _render_digest(
|
||||
request,
|
||||
banner=f"✅ Connexion MCP réussie — {len(result)} outil(s) disponible(s).",
|
||||
tools=result,
|
||||
)
|
||||
return _render_digest(request, banner=f"❌ {result}")
|
||||
|
||||
|
||||
@app.post("/digest/send", response_class=HTMLResponse)
|
||||
async def digest_send(
|
||||
request: Request,
|
||||
target: str = Form(...),
|
||||
csrf_token: str = Form(""),
|
||||
):
|
||||
"""Deliver the digest — only ever from this explicit approval."""
|
||||
if not _csrf_valid(request, csrf_token):
|
||||
return _csrf_error()
|
||||
settings = get_settings()
|
||||
digest = await _weekly_digest()
|
||||
if target == "webhook":
|
||||
if not settings.digest_webhook_url:
|
||||
return _render_digest(request, banner="❌ Webhook non configuré (KANBANTE_DIGEST_WEBHOOK_URL).")
|
||||
ok, message = await digest_service.send_webhook(
|
||||
settings.digest_webhook_url,
|
||||
digest["title"], digest["markdown"], digest["week"],
|
||||
)
|
||||
elif target == "obsigate":
|
||||
if not settings.obsigate_mcp_url or not settings.obsigate_mcp_tool:
|
||||
return _render_digest(request, banner="❌ ObsiGate incomplet : KANBANTE_OBSIGATE_MCP_URL et KANBANTE_OBSIGATE_MCP_TOOL sont requis (utilise « Tester la connexion » pour voir les outils).")
|
||||
try:
|
||||
arguments = digest_service.render_mcp_args(
|
||||
settings.obsigate_mcp_args, digest["title"], digest["markdown"]
|
||||
)
|
||||
except ValueError as exc:
|
||||
return _render_digest(request, banner=f"❌ {exc}")
|
||||
ok, message = await digest_service.mcp_call_tool(
|
||||
settings.obsigate_mcp_url, settings.obsigate_mcp_token,
|
||||
settings.obsigate_mcp_tool, arguments,
|
||||
)
|
||||
else:
|
||||
return _render_digest(request, banner="❌ Cible inconnue.")
|
||||
stamp = datetime.now().strftime("%Y-%m-%d %H:%M")
|
||||
set_kv("digest_last_result", f"{stamp} · {target} · {message}")
|
||||
if ok:
|
||||
set_kv("digest_pending", "")
|
||||
return _render_digest(request, banner=f"✅ Digest envoyé ({target}) : {message}")
|
||||
return _render_digest(request, banner=f"❌ Échec de l'envoi ({target}) : {message}")
|
||||
|
||||
|
||||
async def _digest_scheduler() -> None:
|
||||
"""Compose the weekly digest and notify — never deliver it.
|
||||
|
||||
Delivery to ObsiGate is a cross-app write: it waits for the
|
||||
one-click approval on /digest (standing rule).
|
||||
"""
|
||||
while True:
|
||||
try:
|
||||
settings = get_settings()
|
||||
if settings.digest_time:
|
||||
now = datetime.now()
|
||||
week = now.strftime("%G-W%V")
|
||||
if (
|
||||
now.weekday() == settings.digest_weekday
|
||||
and now.strftime("%H:%M") >= settings.digest_time
|
||||
and get_kv("digest_pending_week") != week
|
||||
):
|
||||
digest = await _weekly_digest()
|
||||
set_kv("digest_pending", digest["markdown"])
|
||||
set_kv("digest_pending_week", week)
|
||||
logger.info("Weekly digest composed for %s", week)
|
||||
if ntfy_configured(settings):
|
||||
await send_ntfy(
|
||||
settings,
|
||||
"🧠 Digest hebdo Kanbante prêt — "
|
||||
"en attente d'approbation sur la page /digest.",
|
||||
)
|
||||
except asyncio.CancelledError:
|
||||
raise
|
||||
except Exception as exc:
|
||||
logger.warning("Digest scheduler error: %s", exc)
|
||||
await asyncio.sleep(60)
|
||||
|
||||
|
||||
@app.get("/api/stream")
|
||||
async def live_stream(request: Request):
|
||||
"""Server-Sent Events: browsers reload softly on Gitea activity."""
|
||||
@@ -970,9 +1477,7 @@ async def api_move(
|
||||
if settings.sync_labels and from_column != to_column:
|
||||
try:
|
||||
desired = (
|
||||
f"kanban:{to_column}"
|
||||
if to_column in ("todo", "in_progress", "review")
|
||||
else None
|
||||
f"kanban:{to_column}" if to_column in LABELLED_COLUMNS else None
|
||||
)
|
||||
issue = await gitea.get_issue(owner, repo, issue_number)
|
||||
current = [
|
||||
@@ -1497,6 +2002,59 @@ async def api_stats():
|
||||
return get_stats()
|
||||
|
||||
|
||||
@app.get("/api/palette")
|
||||
async def api_palette(q: str = ""):
|
||||
"""Data for the Ctrl+K command palette (roadmap #10).
|
||||
|
||||
Projects are always returned (the palette filters them locally);
|
||||
issues are searched globally once the query has 2+ characters,
|
||||
annotated with their current board column.
|
||||
"""
|
||||
repos = await gitea.search_repos()
|
||||
active, inactive, _archived = classify_repos(repos)
|
||||
projects = [
|
||||
{"full_name": r["full_name"]} for r in (active + inactive)[:60]
|
||||
]
|
||||
issues: list[dict] = []
|
||||
query = q.strip()
|
||||
if len(query) >= 2:
|
||||
try:
|
||||
found = await gitea.search_issues(query, state="all")
|
||||
except Exception as exc:
|
||||
logger.debug("palette search failed: %s", exc)
|
||||
found = []
|
||||
placements: dict[str, dict[int, str]] = {}
|
||||
for item in found[:40]:
|
||||
if not _is_issue(item):
|
||||
continue
|
||||
full = (item.get("repository") or {}).get("full_name", "")
|
||||
if not full:
|
||||
continue
|
||||
if full not in placements:
|
||||
placements[full] = {
|
||||
card["issue_number"]: col
|
||||
for col, cards in get_board_state(full).items()
|
||||
for card in cards
|
||||
}
|
||||
if item.get("state") == "closed":
|
||||
column = "done"
|
||||
else:
|
||||
column = placements[full].get(item["number"], "backlog")
|
||||
issues.append(
|
||||
{
|
||||
"repo": full,
|
||||
"number": item["number"],
|
||||
"title": item.get("title", ""),
|
||||
"state": item.get("state", "open"),
|
||||
"column": column,
|
||||
"column_label": COLUMN_LABELS[column],
|
||||
}
|
||||
)
|
||||
if len(issues) >= 8:
|
||||
break
|
||||
return {"projects": projects, "issues": issues}
|
||||
|
||||
|
||||
@app.get("/api/projects")
|
||||
async def api_projects():
|
||||
"""Get all projects (JSON), classified like the dashboard."""
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ import sqlite3
|
||||
from contextlib import contextmanager
|
||||
from typing import Iterator
|
||||
|
||||
KANBAN_COLUMNS = ["backlog", "todo", "in_progress", "review", "done"]
|
||||
KANBAN_COLUMNS = ["backlog", "todo", "in_progress", "qa", "review", "done"]
|
||||
|
||||
|
||||
def db_path() -> str:
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<div class="palette-overlay" id="palette-overlay" hidden>
|
||||
<div class="palette" role="dialog" aria-modal="true" aria-label="Palette de commandes">
|
||||
<div class="palette-input-row">
|
||||
<span class="palette-icon">⌨️</span>
|
||||
<input id="palette-input" type="text" autocomplete="off" spellcheck="false"
|
||||
placeholder="Chercher un projet, une issue, une action…">
|
||||
<kbd>Échap</kbd>
|
||||
</div>
|
||||
<ul class="palette-results" id="palette-results"></ul>
|
||||
<div class="palette-hint">↑↓ naviguer · ↵ ouvrir · Échap fermer · Ctrl+K pour rouvrir</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -20,6 +20,10 @@
|
||||
<a href="/activity" class="nav-pill active">📰 Activité</a>
|
||||
<a href="/briefing" class="nav-pill">📊 Briefing</a>
|
||||
<a href="/search" class="nav-pill">🔍 Recherche</a>
|
||||
<a href="/capture" class="nav-pill">⚡ Capture</a>
|
||||
<a href="/digest" class="nav-pill">🧠 Digest</a>
|
||||
<a href="/wall" class="nav-pill">🖥️ Wallboard</a>
|
||||
<button type="button" class="nav-pill palette-trigger" title="Palette de commandes (Ctrl+K)">⌨️ Ctrl K</button>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
@@ -57,5 +61,7 @@
|
||||
Kanbante v{{ version }} · journal d'événements
|
||||
</footer>
|
||||
<script src="/static/js/live.js" defer></script>
|
||||
{% include "_palette.html" %}
|
||||
<script src="/static/js/palette.js" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -23,6 +23,10 @@
|
||||
<a href="/my" class="nav-pill">👤 Mes issues</a>
|
||||
<a href="/activity" class="nav-pill">📰 Activité</a>
|
||||
<a href="/search" class="nav-pill">🔍 Recherche</a>
|
||||
<a href="/capture" class="nav-pill">⚡ Capture</a>
|
||||
<a href="/digest" class="nav-pill">🧠 Digest</a>
|
||||
<a href="/wall" class="nav-pill">🖥️ Wallboard</a>
|
||||
<button type="button" class="nav-pill palette-trigger" title="Palette de commandes (Ctrl+K)">⌨️ Ctrl K</button>
|
||||
{% if repo_info.html_url %}
|
||||
<a href="{{ repo_info.html_url }}" target="_blank" class="nav-pill">🔗 Gitea ↗</a>
|
||||
{% endif %}
|
||||
@@ -72,7 +76,7 @@
|
||||
|
||||
<main class="board-container">
|
||||
<div class="kanban-board">
|
||||
{% for col in ['backlog','todo','in_progress','review','done'] %}
|
||||
{% for col in ['backlog','todo','in_progress','qa','review','done'] %}
|
||||
<div class="kanban-column"
|
||||
data-column="{{ col }}">
|
||||
<div class="column-header" style="border-top: 3px solid {{ column_colors[col] }}">
|
||||
@@ -203,5 +207,7 @@
|
||||
{% endif %}
|
||||
</footer>
|
||||
<script src="/static/js/live.js" defer></script>
|
||||
{% include "_palette.html" %}
|
||||
<script src="/static/js/palette.js" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -20,6 +20,10 @@
|
||||
<a href="/my" class="nav-pill">👤 Mes issues</a>
|
||||
<a href="/activity" class="nav-pill">📰 Activité</a>
|
||||
<a href="/search" class="nav-pill">🔍 Recherche</a>
|
||||
<a href="/capture" class="nav-pill">⚡ Capture</a>
|
||||
<a href="/digest" class="nav-pill">🧠 Digest</a>
|
||||
<a href="/wall" class="nav-pill">🖥️ Wallboard</a>
|
||||
<button type="button" class="nav-pill palette-trigger" title="Palette de commandes (Ctrl+K)">⌨️ Ctrl K</button>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
@@ -67,5 +71,7 @@
|
||||
status.textContent = data.ok ? '✅ Briefing envoyé sur ntfy.' : '❌ ' + (data.error || ('HTTP ' + r.status));
|
||||
});
|
||||
</script>
|
||||
{% include "_palette.html" %}
|
||||
<script src="/static/js/palette.js" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr" data-theme="dark">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="csrf-token" content="{{ csrf_token }}">
|
||||
<title>Capture éclair — Kanbante</title>
|
||||
<link rel="stylesheet" href="/static/css/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<header class="app-header">
|
||||
<a href="/" class="logo">📋 Kanbante</a>
|
||||
<nav class="nav-pills">
|
||||
<a href="/" class="nav-pill">🏠 Projets</a>
|
||||
<a href="/focus" class="nav-pill">🎯 Focus</a>
|
||||
<a href="/my" class="nav-pill">👤 Mes issues</a>
|
||||
<a href="/activity" class="nav-pill">📰 Activité</a>
|
||||
<a href="/briefing" class="nav-pill">📊 Briefing</a>
|
||||
<a href="/search" class="nav-pill">🔍 Recherche</a>
|
||||
<a href="/capture" class="nav-pill active">⚡ Capture</a>
|
||||
<a href="/digest" class="nav-pill">🧠 Digest</a>
|
||||
<a href="/wall" class="nav-pill">🖥️ Wallboard</a>
|
||||
<button type="button" class="nav-pill palette-trigger" title="Palette de commandes (Ctrl+K)">⌨️ Ctrl K</button>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<main class="focus-main">
|
||||
<section class="briefing-card">
|
||||
<h1>⚡ Capture éclair</h1>
|
||||
<p>Une idée, un bogue, une pensée — capturés en deux secondes, ils deviennent une issue dans le bon backlog.</p>
|
||||
</section>
|
||||
|
||||
{% if created %}
|
||||
<div class="briefing-card">
|
||||
<h2>✅ Capturé !</h2>
|
||||
<p>Issue <strong>#{{ created.number }}</strong> créée dans
|
||||
<strong>{{ created.repo_full_name }}</strong> (colonne {{ created.column }}) :
|
||||
{% if created.html_url %}<a href="{{ created.html_url }}" target="_blank">{{ created.title }}</a>{% else %}{{ created.title }}{% endif %}
|
||||
· <a href="/board/{{ created.repo_full_name }}">ouvrir le board</a></p>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if error %}
|
||||
<div class="briefing-card">
|
||||
<h2>❌ Capture impossible</h2>
|
||||
<p>{{ error }}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="briefing-card">
|
||||
<h2>✍️ Saisie rapide</h2>
|
||||
<form method="post" action="/capture" class="capture-form">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
||||
<label>Dépôt
|
||||
<input type="text" name="repo_full_name" value="{{ capture_repo }}" placeholder="Projets/kanbante" required>
|
||||
</label>
|
||||
<label>Titre de l'issue
|
||||
<input type="text" name="title" maxlength="255" placeholder="Ce qu'il faut retenir…" required autofocus>
|
||||
</label>
|
||||
<label>Détails (optionnel)
|
||||
<textarea name="body" rows="4" placeholder="Contexte, lien, capture d'écran à coller dans Gitea ensuite…"></textarea>
|
||||
</label>
|
||||
<label>Colonne
|
||||
<select name="column">
|
||||
<option value="backlog" selected>📥 Backlog</option>
|
||||
<option value="todo">📋 À faire</option>
|
||||
</select>
|
||||
</label>
|
||||
<button type="submit" class="btn-save">⚡ Capturer</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="briefing-card">
|
||||
<h2>🔌 Depuis un script ou un raccourci</h2>
|
||||
{% if api_enabled %}
|
||||
<p>L'endpoint <code>POST /api/capture</code> est <strong>actif</strong> (jeton de capture configuré). Exemples :</p>
|
||||
<pre class="capture-pre">curl -X POST https://votre-kanbante/api/capture \
|
||||
-H "X-Capture-Token: VOTRE_JETON" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"text": "Idée : trier les cartes par échéance\n\nDétails ici…"}'</pre>
|
||||
<p>Texte libre accepté aussi (<code>Content-Type: text/plain</code>) : la première ligne devient le titre. Le dépôt vient de <code>KANBANTE_CAPTURE_REPO</code> ou du champ <code>repo</code>.</p>
|
||||
{% else %}
|
||||
<p>L'endpoint <code>POST /api/capture</code> est <strong>inactif</strong> : définis <code>KANBANTE_CAPTURE_TOKEN</code> (un jeton dédié, distinct de celui de Gitea) puis redémarre Kanbante.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="briefing-card">
|
||||
<h2>📱 Depuis le téléphone (ntfy)</h2>
|
||||
{% if ntfy_topic %}
|
||||
<p>Écoute active sur le topic <code>{{ ntfy_topic }}</code> : chaque message publié devient une issue dans <code>{{ capture_repo or "— (KANBANTE_CAPTURE_REPO manquant)" }}</code>. La première ligne fait le titre. Publie depuis l'application ntfy ou :</p>
|
||||
<pre class="capture-pre">curl -d "Idée : relire le rapport\n\nDétails…" {{ ntfy_url }}/{{ ntfy_topic }}</pre>
|
||||
<p>Les messages portant le tag <code>kanbante</code> sont ignorés (jamais d'auto-ingestion).</p>
|
||||
{% else %}
|
||||
<p>Inactif : définis <code>KANBANTE_CAPTURE_NTFY_TOPIC</code> (et <code>KANBANTE_CAPTURE_REPO</code>) puis redémarre Kanbante. Chaque message publié sur ce topic deviendra une issue — capture depuis l'application ntfy en deux touchers.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</main>
|
||||
<footer>
|
||||
<span>Kanbante v{{ version }} · capture éclair : formulaire web, API à jeton dédié, écoute ntfy</span>
|
||||
</footer>
|
||||
<script src="/static/js/live.js" defer></script>
|
||||
{% include "_palette.html" %}
|
||||
<script src="/static/js/palette.js" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -20,6 +20,10 @@
|
||||
<a href="/activity" class="nav-pill">📰 Activité</a>
|
||||
<a href="/briefing" class="nav-pill">📊 Briefing</a>
|
||||
<a href="/search" class="nav-pill">🔍 Recherche</a>
|
||||
<a href="/capture" class="nav-pill">⚡ Capture</a>
|
||||
<a href="/digest" class="nav-pill">🧠 Digest</a>
|
||||
<a href="/wall" class="nav-pill">🖥️ Wallboard</a>
|
||||
<button type="button" class="nav-pill palette-trigger" title="Palette de commandes (Ctrl+K)">⌨️ Ctrl K</button>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
@@ -84,7 +88,7 @@
|
||||
<span>{{ repo.open_issues_count or 0 }} issues ouvertes</span>
|
||||
{% if full in stats %}
|
||||
<div class="mini-progress">
|
||||
{% for col in ['backlog','todo','in_progress','review','done'] %}
|
||||
{% for col in ['backlog','todo','in_progress','qa','review','done'] %}
|
||||
{% set n = stats[full].get(col, 0) %}
|
||||
{% if n > 0 %}
|
||||
<span class="chip" style="background: {{ COLUMN_COLORS[col] }}20; color: {{ COLUMN_COLORS[col] }}">
|
||||
@@ -132,5 +136,7 @@
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% include "_palette.html" %}
|
||||
<script src="/static/js/palette.js" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr" data-theme="dark">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="csrf-token" content="{{ csrf_token }}">
|
||||
<title>Digest hebdo — Kanbante</title>
|
||||
<link rel="stylesheet" href="/static/css/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<header class="app-header">
|
||||
<a href="/" class="logo">📋 Kanbante</a>
|
||||
<nav class="nav-pills">
|
||||
<a href="/" class="nav-pill">🏠 Projets</a>
|
||||
<a href="/focus" class="nav-pill">🎯 Focus</a>
|
||||
<a href="/my" class="nav-pill">👤 Mes issues</a>
|
||||
<a href="/activity" class="nav-pill">📰 Activité</a>
|
||||
<a href="/briefing" class="nav-pill">📊 Briefing</a>
|
||||
<a href="/search" class="nav-pill">🔍 Recherche</a>
|
||||
<a href="/capture" class="nav-pill">⚡ Capture</a>
|
||||
<a href="/digest" class="nav-pill active">🧠 Digest</a>
|
||||
<a href="/wall" class="nav-pill">🖥️ Wallboard</a>
|
||||
<button type="button" class="nav-pill palette-trigger" title="Palette de commandes (Ctrl+K)">⌨️ Ctrl K</button>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<main class="focus-main">
|
||||
<section class="briefing-card">
|
||||
<h1>🧠 Digest hebdo → ObsiGate</h1>
|
||||
<p>Chaque semaine, Kanbante compose le résumé de l'activité (livré, en cours, chiffres du journal) en une note markdown.
|
||||
L'envoi vers ObsiGate est une écriture dans un autre système : <strong>il n'a jamais lieu sans ton approbation ici</strong>.</p>
|
||||
{% if last_result %}<p>🧾 Dernier envoi : <code>{{ last_result }}</code></p>{% endif %}
|
||||
{% if digest_time %}<p>🕐 Composition automatique : jour {{ digest_weekday }} à {{ digest_time }} (notification ntfy, envoi manuel ensuite).</p>{% endif %}
|
||||
</section>
|
||||
|
||||
{% if banner %}
|
||||
<div class="briefing-card"><p>{{ banner }}</p></div>
|
||||
{% endif %}
|
||||
|
||||
{% if tools is not none %}
|
||||
<div class="briefing-card">
|
||||
<h2>🛠️ Outils du serveur MCP ObsiGate</h2>
|
||||
{% if tools %}
|
||||
<ul>
|
||||
{% for tool in tools %}<li><code>{{ tool }}</code></li>{% endfor %}
|
||||
</ul>
|
||||
<p>Choisis l'outil de création de note, puis définis <code>KANBANTE_OBSIGATE_MCP_TOOL</code> (et au besoin <code>KANBANTE_OBSIGATE_MCP_ARGS</code>, gabarit JSON avec <code>{title}</code> et <code>{content}</code>).</p>
|
||||
{% else %}
|
||||
<p>Le serveur répond, mais n'expose aucun outil.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="briefing-card">
|
||||
<h2>📤 Livraison</h2>
|
||||
<p>
|
||||
ObsiGate (MCP) : {% if obsigate_configured %}<strong>configuré</strong> — <code>{{ obsigate_url }}</code>, outil <code>{{ obsigate_tool or "(à définir)" }}</code>{% else %}non configuré (<code>KANBANTE_OBSIGATE_MCP_URL</code>){% endif %}<br>
|
||||
Webhook générique : {% if webhook_configured %}<strong>configuré</strong>{% else %}non configuré (<code>KANBANTE_DIGEST_WEBHOOK_URL</code>){% endif %}
|
||||
</p>
|
||||
<form method="post" action="/digest/probe" style="display:inline">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
||||
<button type="submit" class="btn-save">🔌 Tester la connexion MCP</button>
|
||||
</form>
|
||||
<form method="post" action="/digest/send" style="display:inline">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
||||
<input type="hidden" name="target" value="obsigate">
|
||||
<button type="submit" class="btn-save">🧠 Envoyer vers ObsiGate</button>
|
||||
</form>
|
||||
<form method="post" action="/digest/send" style="display:inline">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
||||
<input type="hidden" name="target" value="webhook">
|
||||
<button type="submit" class="btn-save">🔗 Envoyer au webhook</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="briefing-card">
|
||||
<h2>👀 Aperçu du digest de la semaine</h2>
|
||||
{% if pending %}
|
||||
<pre class="capture-pre">{{ pending }}</pre>
|
||||
{% else %}
|
||||
<p>Aucun digest en attente. L'aperçu exact est composé au moment de l'envoi (boutons ci-dessus) à partir du journal des 7 derniers jours et de la vue Focus.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</main>
|
||||
<footer>
|
||||
<span>Kanbante v{{ version }} · digest hebdo : composé automatiquement, livré seulement sur approbation</span>
|
||||
</footer>
|
||||
{% include "_palette.html" %}
|
||||
<script src="/static/js/palette.js" defer></script>
|
||||
<script src="/static/js/live.js" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -20,6 +20,10 @@
|
||||
<a href="/activity" class="nav-pill">📰 Activité</a>
|
||||
<a href="/briefing" class="nav-pill">📊 Briefing</a>
|
||||
<a href="/search" class="nav-pill">🔍 Recherche</a>
|
||||
<a href="/capture" class="nav-pill">⚡ Capture</a>
|
||||
<a href="/digest" class="nav-pill">🧠 Digest</a>
|
||||
<a href="/wall" class="nav-pill">🖥️ Wallboard</a>
|
||||
<button type="button" class="nav-pill palette-trigger" title="Palette de commandes (Ctrl+K)">⌨️ Ctrl K</button>
|
||||
<span class="badge">{{ groups|map(attribute='cards')|map('length')|sum }} cartes en cours</span>
|
||||
</nav>
|
||||
</header>
|
||||
@@ -68,5 +72,7 @@
|
||||
Kanbante v{{ version }} · vue Focus
|
||||
</footer>
|
||||
<script src="/static/js/live.js" defer></script>
|
||||
{% include "_palette.html" %}
|
||||
<script src="/static/js/palette.js" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -19,6 +19,10 @@
|
||||
<a href="/my" class="nav-pill active">👤 Mes issues</a>
|
||||
<a href="/activity" class="nav-pill">📰 Activité</a>
|
||||
<a href="/search" class="nav-pill">🔍 Recherche</a>
|
||||
<a href="/capture" class="nav-pill">⚡ Capture</a>
|
||||
<a href="/digest" class="nav-pill">🧠 Digest</a>
|
||||
<a href="/wall" class="nav-pill">🖥️ Wallboard</a>
|
||||
<button type="button" class="nav-pill palette-trigger" title="Palette de commandes (Ctrl+K)">⌨️ Ctrl K</button>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
@@ -59,5 +63,7 @@
|
||||
Kanbante v{{ version }} · mes issues
|
||||
</footer>
|
||||
<script src="/static/js/live.js" defer></script>
|
||||
{% include "_palette.html" %}
|
||||
<script src="/static/js/palette.js" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -19,6 +19,10 @@
|
||||
<a href="/my" class="nav-pill">👤 Mes issues</a>
|
||||
<a href="/activity" class="nav-pill">📰 Activité</a>
|
||||
<a href="/search" class="nav-pill active">🔍 Recherche</a>
|
||||
<a href="/capture" class="nav-pill">⚡ Capture</a>
|
||||
<a href="/digest" class="nav-pill">🧠 Digest</a>
|
||||
<a href="/wall" class="nav-pill">🖥️ Wallboard</a>
|
||||
<button type="button" class="nav-pill palette-trigger" title="Palette de commandes (Ctrl+K)">⌨️ Ctrl K</button>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
@@ -65,5 +69,7 @@
|
||||
Kanbante v{{ version }} · recherche globale
|
||||
</footer>
|
||||
<script src="/static/js/live.js" defer></script>
|
||||
{% include "_palette.html" %}
|
||||
<script src="/static/js/palette.js" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Kanbante — Wallboard</title>
|
||||
<link rel="stylesheet" href="/static/css/style.css">
|
||||
</head>
|
||||
<body class="wall-body">
|
||||
{% if slides %}
|
||||
<div class="wall-stage" id="wall-stage">
|
||||
{% for slide in slides %}
|
||||
<section class="wall-slide{% if loop.first %} active{% endif %}">
|
||||
<header class="wall-head">
|
||||
<div>
|
||||
<div class="wall-kicker">📂 Projet</div>
|
||||
<h1 class="wall-project">{{ slide.full_name }}</h1>
|
||||
</div>
|
||||
<div class="wall-clock">
|
||||
<div class="wall-time" data-clock>--:--</div>
|
||||
<div class="wall-date" data-date></div>
|
||||
{% if not single and slides|length > 1 %}
|
||||
<div class="wall-rotation">{{ loop.index }} / {{ slides|length }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="wall-counts">
|
||||
{% for col in columns %}
|
||||
<div class="wall-count" style="--col: {{ column_colors[col] }}">
|
||||
<span class="wall-count-n">{{ slide.counts[col] }}</span>
|
||||
<span class="wall-count-l">{{ column_labels[col] }}</span>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{% if slide.cards %}
|
||||
<ul class="wall-cards">
|
||||
{% for card in slide.cards %}
|
||||
<li class="wall-card">
|
||||
<span class="wall-card-col" style="--col: {{ column_colors[card.column] }}">{{ card.column_label }}</span>
|
||||
<span class="wall-card-title">#{{ card.number }} · {{ card.title }}</span>
|
||||
{% if card.age_days is not none and card.age_days >= 1 %}
|
||||
<span class="wall-card-age{% if card.aging %} hot{% endif %}">⏳ {{ card.age_days }} j</span>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<p class="wall-idle">🌿 Rien en vol pour le moment — tout est au Backlog ou terminé.</p>
|
||||
{% endif %}
|
||||
|
||||
<footer class="wall-foot">
|
||||
<span>✅ Fermées aujourd'hui : <strong>{{ slide.closed_today }}</strong></span>
|
||||
<span>📋 Ouvertes : <strong>{{ slide.open_total }}</strong></span>
|
||||
<span class="wall-live">● EN DIRECT</span>
|
||||
</footer>
|
||||
</section>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="wall-empty">
|
||||
<h1>🖥️ Wallboard</h1>
|
||||
<p>Aucun projet actif à afficher{% if single %} pour ce dépôt{% endif %}.</p>
|
||||
<p class="wall-empty-hint">Astuce : <code>/wall?repo=Proprietaire/depot</code> fige un seul projet.</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
<script src="/static/js/wall.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "kanbante"
|
||||
version = "0.5.2"
|
||||
version = "0.8.0"
|
||||
description = "Kanban project manager integrated with Gitea"
|
||||
requires-python = ">=3.11"
|
||||
dependencies = [
|
||||
|
||||
@@ -893,3 +893,136 @@ footer {
|
||||
scroll-behavior: auto !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* ── Wallboard (0.6.0) : affichage plein écran, lisible à 3 mètres ── */
|
||||
.wall-body {
|
||||
background: #0b1220;
|
||||
color: #e5ecf5;
|
||||
margin: 0;
|
||||
font-family: inherit;
|
||||
}
|
||||
.wall-stage { position: relative; min-height: 100vh; }
|
||||
.wall-slide {
|
||||
display: none;
|
||||
min-height: 100vh;
|
||||
box-sizing: border-box;
|
||||
padding: 4vh 4vw;
|
||||
flex-direction: column;
|
||||
gap: 3vh;
|
||||
}
|
||||
.wall-slide.active { display: flex; animation: wall-in 0.45s ease; }
|
||||
@keyframes wall-in { from { opacity: 0; } to { opacity: 1; } }
|
||||
.wall-head {
|
||||
display: flex; justify-content: space-between; align-items: flex-start; gap: 24px;
|
||||
}
|
||||
.wall-kicker { font-size: 1rem; letter-spacing: 0.22em; text-transform: uppercase; color: #8fa3bf; }
|
||||
.wall-project { font-size: clamp(2.2rem, 5.2vw, 4.2rem); margin: 0.4rem 0 0; line-height: 1.05; }
|
||||
.wall-clock { text-align: right; }
|
||||
.wall-time { font-size: clamp(2rem, 4.5vw, 3.6rem); font-weight: 800; line-height: 1; }
|
||||
.wall-date { color: #8fa3bf; font-size: 1.15rem; margin-top: 0.35rem; text-transform: capitalize; }
|
||||
.wall-rotation { color: #5b6b84; margin-top: 0.4rem; font-size: 1rem; }
|
||||
.wall-counts {
|
||||
display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px;
|
||||
}
|
||||
.wall-count {
|
||||
border: 1.5px solid var(--col);
|
||||
border-top: 6px solid var(--col);
|
||||
border-radius: 14px;
|
||||
padding: 14px 10px 12px;
|
||||
text-align: center;
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
}
|
||||
.wall-count-n { display: block; font-size: clamp(1.9rem, 3.6vw, 3rem); font-weight: 800; }
|
||||
.wall-count-l { display: block; color: #aebdd2; font-size: clamp(0.78rem, 1.25vw, 1.02rem); margin-top: 2px; }
|
||||
.wall-cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
|
||||
.wall-card {
|
||||
display: flex; align-items: center; gap: 18px;
|
||||
background: rgba(255, 255, 255, 0.045);
|
||||
border-radius: 14px;
|
||||
padding: 16px 20px;
|
||||
font-size: clamp(1.15rem, 2.1vw, 1.7rem);
|
||||
}
|
||||
.wall-card-col {
|
||||
border: 1.5px solid var(--col); color: var(--col);
|
||||
border-radius: 999px; padding: 4px 14px;
|
||||
font-size: 0.62em; font-weight: 700; white-space: nowrap;
|
||||
}
|
||||
.wall-card-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.wall-card-age { color: #fbbf24; font-weight: 700; white-space: nowrap; }
|
||||
.wall-card-age.hot { color: #f87171; }
|
||||
.wall-idle { font-size: 1.5rem; color: #8fa3bf; }
|
||||
.wall-foot {
|
||||
margin-top: auto;
|
||||
display: flex; gap: 36px; flex-wrap: wrap;
|
||||
font-size: clamp(1rem, 1.7vw, 1.35rem); color: #aebdd2;
|
||||
}
|
||||
.wall-live { color: #34d399; font-weight: 700; letter-spacing: 0.08em; }
|
||||
.wall-empty {
|
||||
min-height: 100vh; display: flex; flex-direction: column;
|
||||
align-items: center; justify-content: center; gap: 10px; text-align: center;
|
||||
color: #aebdd2; padding: 24px;
|
||||
}
|
||||
.wall-empty h1 { color: #e5ecf5; font-size: 2.6rem; margin: 0; }
|
||||
.wall-empty code { background: rgba(255,255,255,0.08); padding: 2px 8px; border-radius: 6px; }
|
||||
@media (max-width: 900px) {
|
||||
.wall-counts { grid-template-columns: repeat(3, 1fr); }
|
||||
}
|
||||
|
||||
/* ── Capture éclair (0.7.0) ── */
|
||||
.capture-form { display: flex; flex-direction: column; gap: 12px; }
|
||||
.capture-form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
|
||||
.capture-form input, .capture-form textarea, .capture-form select {
|
||||
padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
|
||||
background: var(--bg-2); color: var(--text-1); font: inherit; font-weight: 400;
|
||||
}
|
||||
.capture-form .btn { align-self: flex-start; }
|
||||
.capture-pre {
|
||||
background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
|
||||
padding: 12px 14px; overflow-x: auto; font-size: 0.82rem; line-height: 1.5;
|
||||
}
|
||||
|
||||
/* ── Palette de commandes (0.8.0, #10) ── */
|
||||
.palette-overlay {
|
||||
position: fixed; inset: 0; z-index: 200;
|
||||
background: rgba(5, 10, 20, 0.62);
|
||||
backdrop-filter: blur(3px);
|
||||
display: flex; justify-content: center; align-items: flex-start;
|
||||
padding: 10vh 16px 16px;
|
||||
}
|
||||
.palette-overlay[hidden] { display: none; }
|
||||
.palette {
|
||||
width: min(640px, 100%);
|
||||
background: var(--surface-1, #131a29);
|
||||
border: 1px solid var(--border-strong, #2c3a52);
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
|
||||
overflow: hidden;
|
||||
animation: wall-in 0.15s ease;
|
||||
}
|
||||
.palette-input-row {
|
||||
display: flex; align-items: center; gap: 12px;
|
||||
padding: 14px 16px; border-bottom: 1px solid var(--border, #22304a);
|
||||
}
|
||||
.palette-input-row input {
|
||||
flex: 1; background: transparent; border: none; outline: none;
|
||||
color: var(--text-1); font: inherit; font-size: 1.05rem;
|
||||
}
|
||||
.palette-input-row kbd {
|
||||
background: var(--surface-3, #1d2942); border: 1px solid var(--border, #22304a);
|
||||
border-radius: 6px; padding: 2px 8px; font-size: 0.75rem; color: var(--text-3);
|
||||
}
|
||||
.palette-results { list-style: none; margin: 0; padding: 8px; max-height: 46vh; overflow-y: auto; }
|
||||
.palette-item {
|
||||
display: flex; align-items: center; gap: 12px;
|
||||
padding: 10px 12px; border-radius: 10px; cursor: pointer;
|
||||
}
|
||||
.palette-item.active { background: var(--surface-3, #1d2942); }
|
||||
.palette-item-icon { font-size: 1.05rem; width: 24px; text-align: center; }
|
||||
.palette-item-main { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.palette-item-sub { color: var(--text-3); font-size: 0.8rem; white-space: nowrap; }
|
||||
.palette-empty { padding: 18px 14px; color: var(--text-3); text-align: center; }
|
||||
.palette-hint {
|
||||
padding: 9px 16px; border-top: 1px solid var(--border, #22304a);
|
||||
color: var(--text-3); font-size: 0.78rem; text-align: right;
|
||||
}
|
||||
.palette-trigger { cursor: pointer; font: inherit; }
|
||||
|
||||
@@ -0,0 +1,178 @@
|
||||
/**
|
||||
* Kanbante — Command palette (Ctrl+K), roadmap #10.
|
||||
*
|
||||
* One overlay for the whole app: static actions, every project, and
|
||||
* global issue search (via /api/palette). Fully keyboard driven.
|
||||
*/
|
||||
(function () {
|
||||
var overlay = document.getElementById('palette-overlay');
|
||||
if (!overlay) return;
|
||||
var input = document.getElementById('palette-input');
|
||||
var list = document.getElementById('palette-results');
|
||||
|
||||
var ACTIONS = [
|
||||
{ icon: '🏠', label: 'Projets — dashboard', href: '/' },
|
||||
{ icon: '🎯', label: 'Focus — en cours, QA, révision', href: '/focus' },
|
||||
{ icon: '👤', label: 'Mes issues', href: '/my' },
|
||||
{ icon: '📰', label: 'Activité — journal des événements', href: '/activity' },
|
||||
{ icon: '📊', label: 'Briefing quotidien', href: '/briefing' },
|
||||
{ icon: '⚡', label: 'Capture éclair — nouvelle idée', href: '/capture' },
|
||||
{ icon: '🧠', label: 'Digest hebdo — vers ObsiGate', href: '/digest' },
|
||||
{ icon: '🖥️', label: 'Wallboard — mode TV', href: '/wall' },
|
||||
{ icon: '🔍', label: 'Recherche avancée', href: '/search' },
|
||||
];
|
||||
|
||||
var projects = null; // cached after first fetch
|
||||
var issues = []; // latest search results for the query
|
||||
var items = []; // rendered items
|
||||
var activeIndex = 0;
|
||||
var debounce = null;
|
||||
var lastQuery = '';
|
||||
|
||||
function open() {
|
||||
overlay.hidden = false;
|
||||
document.body.style.overflow = 'hidden';
|
||||
input.value = '';
|
||||
issues = [];
|
||||
lastQuery = '';
|
||||
render('');
|
||||
input.focus();
|
||||
if (projects === null) {
|
||||
fetch('/api/palette')
|
||||
.then(function (r) { return r.json(); })
|
||||
.then(function (data) {
|
||||
projects = data.projects || [];
|
||||
render(input.value.trim());
|
||||
})
|
||||
.catch(function () { projects = []; });
|
||||
}
|
||||
}
|
||||
|
||||
function close() {
|
||||
overlay.hidden = true;
|
||||
document.body.style.overflow = '';
|
||||
}
|
||||
|
||||
function buildItems(query) {
|
||||
var q = query.toLowerCase();
|
||||
var out = [];
|
||||
ACTIONS.forEach(function (a) {
|
||||
if (!q || a.label.toLowerCase().includes(q)) {
|
||||
out.push({ icon: a.icon, label: a.label, sub: 'Action', href: a.href });
|
||||
}
|
||||
});
|
||||
(projects || []).forEach(function (p) {
|
||||
if (out.length >= 14) return;
|
||||
if (!q || p.full_name.toLowerCase().includes(q)) {
|
||||
out.push({
|
||||
icon: '📂', label: p.full_name, sub: 'Projet · ouvrir le board',
|
||||
href: '/board/' + p.full_name,
|
||||
});
|
||||
}
|
||||
});
|
||||
issues.forEach(function (i) {
|
||||
out.push({
|
||||
icon: '🐛',
|
||||
label: '#' + i.number + ' · ' + i.title,
|
||||
sub: i.repo + ' · ' + i.column_label + (i.state === 'closed' ? ' · fermée' : ''),
|
||||
href: '/board/' + i.repo,
|
||||
});
|
||||
});
|
||||
return out.slice(0, 14);
|
||||
}
|
||||
|
||||
function render(query) {
|
||||
items = buildItems(query);
|
||||
activeIndex = Math.min(activeIndex, Math.max(0, items.length - 1));
|
||||
list.innerHTML = '';
|
||||
if (!items.length) {
|
||||
var empty = document.createElement('li');
|
||||
empty.className = 'palette-empty';
|
||||
empty.textContent = 'Aucun résultat — essaie un nom de projet ou un mot du titre d\'une issue.';
|
||||
list.appendChild(empty);
|
||||
return;
|
||||
}
|
||||
items.forEach(function (item, idx) {
|
||||
var li = document.createElement('li');
|
||||
li.className = 'palette-item' + (idx === activeIndex ? ' active' : '');
|
||||
var icon = document.createElement('span');
|
||||
icon.className = 'palette-item-icon';
|
||||
icon.textContent = item.icon;
|
||||
var main = document.createElement('span');
|
||||
main.className = 'palette-item-main';
|
||||
main.textContent = item.label;
|
||||
var sub = document.createElement('span');
|
||||
sub.className = 'palette-item-sub';
|
||||
sub.textContent = item.sub;
|
||||
li.appendChild(icon);
|
||||
li.appendChild(main);
|
||||
li.appendChild(sub);
|
||||
li.addEventListener('click', function () { go(item); });
|
||||
li.addEventListener('mousemove', function () {
|
||||
if (activeIndex !== idx) { activeIndex = idx; render(input.value.trim()); }
|
||||
});
|
||||
list.appendChild(li);
|
||||
});
|
||||
}
|
||||
|
||||
function go(item) {
|
||||
if (item) window.location.href = item.href;
|
||||
}
|
||||
|
||||
function searchIssues(query) {
|
||||
if (query.length < 2) { issues = []; render(query); return; }
|
||||
fetch('/api/palette?q=' + encodeURIComponent(query))
|
||||
.then(function (r) { return r.json(); })
|
||||
.then(function (data) {
|
||||
if (input.value.trim() !== query) return; // stale response
|
||||
issues = data.issues || [];
|
||||
if (projects === null) projects = data.projects || [];
|
||||
render(query);
|
||||
})
|
||||
.catch(function () { /* keep previous results */ });
|
||||
}
|
||||
|
||||
input.addEventListener('input', function () {
|
||||
var query = input.value.trim();
|
||||
activeIndex = 0;
|
||||
render(query);
|
||||
if (query !== lastQuery) {
|
||||
lastQuery = query;
|
||||
clearTimeout(debounce);
|
||||
debounce = setTimeout(function () { searchIssues(query); }, 180);
|
||||
}
|
||||
});
|
||||
|
||||
input.addEventListener('keydown', function (e) {
|
||||
if (e.key === 'ArrowDown') {
|
||||
e.preventDefault();
|
||||
activeIndex = Math.min(activeIndex + 1, items.length - 1);
|
||||
render(input.value.trim());
|
||||
} else if (e.key === 'ArrowUp') {
|
||||
e.preventDefault();
|
||||
activeIndex = Math.max(activeIndex - 1, 0);
|
||||
render(input.value.trim());
|
||||
} else if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
go(items[activeIndex]);
|
||||
}
|
||||
});
|
||||
|
||||
overlay.addEventListener('click', function (e) {
|
||||
if (e.target === overlay) close();
|
||||
});
|
||||
|
||||
document.addEventListener('keydown', function (e) {
|
||||
var combo = (e.ctrlKey || e.metaKey) && e.key.toLowerCase() === 'k';
|
||||
if (combo) {
|
||||
e.preventDefault();
|
||||
if (overlay.hidden) open(); else close();
|
||||
} else if (e.key === 'Escape' && !overlay.hidden) {
|
||||
close();
|
||||
}
|
||||
});
|
||||
|
||||
document.querySelectorAll('.palette-trigger').forEach(function (btn) {
|
||||
btn.addEventListener('click', function () { open(); });
|
||||
});
|
||||
})();
|
||||
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* Kanbante — Wallboard: slide rotation, clock, live refresh.
|
||||
*
|
||||
* The wall is a display, not a workspace: no interaction to protect,
|
||||
* so a realtime event simply reloads the page (plus a slow safety
|
||||
* reload in case the stream drops silently).
|
||||
*/
|
||||
(function () {
|
||||
var slides = Array.from(document.querySelectorAll('.wall-slide'));
|
||||
var ROTATE_MS = 30000;
|
||||
var current = 0;
|
||||
|
||||
if (slides.length > 1) {
|
||||
setInterval(function () {
|
||||
slides[current].classList.remove('active');
|
||||
current = (current + 1) % slides.length;
|
||||
slides[current].classList.add('active');
|
||||
}, ROTATE_MS);
|
||||
}
|
||||
|
||||
function tickClock() {
|
||||
var now = new Date();
|
||||
var time = now.toLocaleTimeString('fr-CA', { hour: '2-digit', minute: '2-digit' });
|
||||
var date = now.toLocaleDateString('fr-CA', {
|
||||
weekday: 'long', day: 'numeric', month: 'long',
|
||||
});
|
||||
document.querySelectorAll('[data-clock]').forEach(function (el) { el.textContent = time; });
|
||||
document.querySelectorAll('[data-date]').forEach(function (el) { el.textContent = date; });
|
||||
}
|
||||
tickClock();
|
||||
setInterval(tickClock, 15000);
|
||||
|
||||
// Live: any board activity refreshes the wall.
|
||||
try {
|
||||
var source = new EventSource('/api/stream');
|
||||
source.onmessage = function () { location.reload(); };
|
||||
} catch (err) {
|
||||
console.warn('Wallboard live stream unavailable:', err);
|
||||
}
|
||||
// Safety net.
|
||||
setTimeout(function () { location.reload(); }, 5 * 60 * 1000);
|
||||
})();
|
||||
@@ -0,0 +1,154 @@
|
||||
"""Capture éclair (feuille de route #12) : API à jeton, page web, ntfy."""
|
||||
|
||||
import pytest
|
||||
|
||||
from app import models
|
||||
from app.capture import parse_capture_text, parse_ntfy_message
|
||||
from tests.conftest import csrf_from
|
||||
|
||||
TOKEN = "jeton-de-capture-test"
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def capture_env(monkeypatch):
|
||||
monkeypatch.setenv("KANBANTE_CAPTURE_TOKEN", TOKEN)
|
||||
monkeypatch.setenv("KANBANTE_CAPTURE_REPO", "Projets/demo")
|
||||
|
||||
|
||||
# ── Parsing ───────────────────────────────────────────────────────
|
||||
|
||||
|
||||
def test_parse_capture_text_first_line_is_title():
|
||||
title, body = parse_capture_text("Idée géniale\n\nDétails\nsur deux lignes")
|
||||
assert title == "Idée géniale"
|
||||
assert body == "Détails\nsur deux lignes"
|
||||
|
||||
|
||||
def test_parse_capture_text_empty():
|
||||
assert parse_capture_text(" \n ") == ("", "")
|
||||
|
||||
|
||||
def test_parse_ntfy_message_variants():
|
||||
assert parse_ntfy_message(
|
||||
{"event": "message", "title": "Titre", "message": "Corps"}
|
||||
) == ("Titre", "Corps")
|
||||
assert parse_ntfy_message(
|
||||
{"event": "message", "message": "Ligne un\n\nLigne deux"}
|
||||
) == ("Ligne un", "Ligne deux")
|
||||
assert parse_ntfy_message({"event": "open"}) is None
|
||||
assert parse_ntfy_message(
|
||||
{"event": "message", "message": "auto", "tags": ["kanbante"]}
|
||||
) is None # never ingest our own posts
|
||||
|
||||
|
||||
# ── API ───────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
def test_capture_api_disabled_without_token(client, fake_gitea):
|
||||
r = client.post("/api/capture", json={"text": "Idée"})
|
||||
assert r.status_code == 503
|
||||
|
||||
|
||||
def test_capture_api_rejects_wrong_token(client, fake_gitea, capture_env):
|
||||
r = client.post(
|
||||
"/api/capture",
|
||||
json={"text": "Idée"},
|
||||
headers={"X-Capture-Token": "mauvais"},
|
||||
)
|
||||
assert r.status_code == 401
|
||||
assert fake_gitea.created == []
|
||||
|
||||
|
||||
def test_capture_api_creates_issue_in_default_repo(client, fake_gitea, capture_env):
|
||||
r = client.post(
|
||||
"/api/capture",
|
||||
json={"text": "Idée éclair\n\nLe détail qui compte"},
|
||||
headers={"X-Capture-Token": TOKEN},
|
||||
)
|
||||
assert r.status_code == 201
|
||||
data = r.json()
|
||||
assert data["ok"] is True
|
||||
number = data["issue"]["number"]
|
||||
assert fake_gitea.created == [("Projets", "demo", "Idée éclair")]
|
||||
state = models.get_board_state("Projets/demo")
|
||||
assert number in [c["issue_number"] for c in state["backlog"]]
|
||||
events = [
|
||||
e for e in models.get_events("Projets/demo")
|
||||
if e["issue_number"] == number
|
||||
]
|
||||
assert any(
|
||||
e["event_type"] == "created" and e["source"] == "capture" for e in events
|
||||
)
|
||||
|
||||
|
||||
def test_capture_api_text_plain_and_bearer(client, fake_gitea, capture_env):
|
||||
r = client.post(
|
||||
"/api/capture",
|
||||
content="Titre en texte brut\nCorps",
|
||||
headers={
|
||||
"Authorization": f"Bearer {TOKEN}",
|
||||
"Content-Type": "text/plain",
|
||||
},
|
||||
)
|
||||
assert r.status_code == 201
|
||||
assert fake_gitea.created == [("Projets", "demo", "Titre en texte brut")]
|
||||
|
||||
|
||||
def test_capture_api_explicit_repo_and_column(client, fake_gitea, capture_env):
|
||||
r = client.post(
|
||||
"/api/capture",
|
||||
json={"title": "Direct en todo", "repo": "Projets/demo", "column": "todo"},
|
||||
headers={"X-Capture-Token": TOKEN},
|
||||
)
|
||||
assert r.status_code == 201
|
||||
number = r.json()["issue"]["number"]
|
||||
state = models.get_board_state("Projets/demo")
|
||||
assert number in [c["issue_number"] for c in state["todo"]]
|
||||
|
||||
|
||||
def test_capture_api_validates_input(client, fake_gitea, capture_env):
|
||||
r = client.post(
|
||||
"/api/capture", json={"text": " "},
|
||||
headers={"X-Capture-Token": TOKEN},
|
||||
)
|
||||
assert r.status_code == 400
|
||||
r = client.post(
|
||||
"/api/capture",
|
||||
json={"title": "X", "repo": "pas-de-slash"},
|
||||
headers={"X-Capture-Token": TOKEN},
|
||||
)
|
||||
assert r.status_code == 400
|
||||
|
||||
|
||||
def test_capture_api_no_repo_anywhere(client, fake_gitea, monkeypatch):
|
||||
monkeypatch.setenv("KANBANTE_CAPTURE_TOKEN", TOKEN)
|
||||
monkeypatch.delenv("KANBANTE_CAPTURE_REPO", raising=False)
|
||||
r = client.post(
|
||||
"/api/capture", json={"title": "Orpheline"},
|
||||
headers={"X-Capture-Token": TOKEN},
|
||||
)
|
||||
assert r.status_code == 400
|
||||
|
||||
|
||||
# ── Page web ──────────────────────────────────────────────────────
|
||||
|
||||
|
||||
def test_capture_page_renders(client, capture_env):
|
||||
r = client.get("/capture")
|
||||
assert r.status_code == 200
|
||||
assert "Capture éclair" in r.text
|
||||
assert "Projets/demo" in r.text
|
||||
|
||||
|
||||
def test_capture_web_form_creates_issue(client, fake_gitea, capture_env):
|
||||
token = csrf_from(client)
|
||||
r = client.post(
|
||||
"/capture",
|
||||
data={
|
||||
"repo_full_name": "Projets/demo", "title": "Via le formulaire",
|
||||
"body": "Détails", "column": "backlog", "csrf_token": token,
|
||||
},
|
||||
)
|
||||
assert r.status_code == 200
|
||||
assert "Capturé" in r.text
|
||||
assert fake_gitea.created == [("Projets", "demo", "Via le formulaire")]
|
||||
@@ -0,0 +1,146 @@
|
||||
"""Palier 4 (0.6.0): QA column, label reconciliation, wallboard."""
|
||||
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
import app.main as main
|
||||
from app import models
|
||||
from tests.conftest import _issue, csrf_from
|
||||
|
||||
|
||||
def _column_block(html: str, column: str) -> str:
|
||||
blocks = html.split('<div class="kanban-column"')
|
||||
for block in blocks[1:]:
|
||||
if f'data-column="{column}"' in block.split(">", 1)[0]:
|
||||
return block
|
||||
raise AssertionError(f"column {column} not found")
|
||||
|
||||
|
||||
def _labelled(number: int, title: str, label_names: list[str]) -> dict:
|
||||
issue = _issue(number, title)
|
||||
issue["labels"] = [
|
||||
{"id": 900 + i, "name": name, "color": "8b5cf6"}
|
||||
for i, name in enumerate(label_names)
|
||||
]
|
||||
return issue
|
||||
|
||||
|
||||
# ── QA column ─────────────────────────────────────────────────────
|
||||
|
||||
|
||||
def test_board_has_six_columns_including_qa(client):
|
||||
r = client.get("/board/Projets/demo")
|
||||
assert r.status_code == 200
|
||||
assert "🧪 QA" in r.text
|
||||
positions = [
|
||||
r.text.index(f'data-column="{col}"')
|
||||
for col in ("backlog", "todo", "in_progress", "qa", "review", "done")
|
||||
]
|
||||
assert positions == sorted(positions) # QA between in_progress and review
|
||||
|
||||
|
||||
def test_move_to_qa_syncs_kanban_qa_label(client, fake_gitea):
|
||||
token = csrf_from(client)
|
||||
r = client.post(
|
||||
"/api/move",
|
||||
data={
|
||||
"repo_full_name": "Projets/demo", "issue_number": 1,
|
||||
"to_column": "qa", "from_column": "backlog",
|
||||
"to_order": "1", "from_order": "5", "csrf_token": token,
|
||||
},
|
||||
)
|
||||
assert r.status_code == 200
|
||||
assert r.json()["label_sync"] == "ok"
|
||||
assert ("add", 1, "kanban:qa") in fake_gitea.label_ops
|
||||
state = models.get_board_state("Projets/demo")
|
||||
assert 1 in [c["issue_number"] for c in state["qa"]]
|
||||
|
||||
|
||||
def test_qa_cards_appear_in_focus(client, fake_gitea):
|
||||
models.move_issue("Projets/demo", 5, "qa")
|
||||
r = client.get("/focus")
|
||||
assert r.status_code == 200
|
||||
assert "Tâche focus" in r.text
|
||||
assert "🧪 QA" in r.text
|
||||
|
||||
|
||||
# ── Label reconciliation (adoption) ───────────────────────────────
|
||||
|
||||
|
||||
def test_board_adopts_diverging_kanban_label(client, fake_gitea):
|
||||
fake_gitea.issues["Projets/demo"].append(
|
||||
_labelled(9, "Déplacée via Gitea", ["kanban:review"])
|
||||
)
|
||||
r = client.get("/board/Projets/demo")
|
||||
assert r.status_code == 200
|
||||
assert "Déplacée via Gitea" in _column_block(r.text, "review")
|
||||
state = models.get_board_state("Projets/demo")
|
||||
assert 9 in [c["issue_number"] for c in state["review"]]
|
||||
events = [
|
||||
e for e in models.get_events("Projets/demo") if e["issue_number"] == 9
|
||||
]
|
||||
assert any(
|
||||
e["event_type"] == "moved" and e["to_column"] == "review"
|
||||
and e["source"] == "gitea"
|
||||
for e in events
|
||||
)
|
||||
|
||||
|
||||
def test_board_ignores_conflicting_kanban_labels(client, fake_gitea):
|
||||
fake_gitea.issues["Projets/demo"].append(
|
||||
_labelled(9, "Étiquettes en conflit", ["kanban:todo", "kanban:review"])
|
||||
)
|
||||
r = client.get("/board/Projets/demo")
|
||||
assert r.status_code == 200
|
||||
assert "Étiquettes en conflit" in _column_block(r.text, "backlog")
|
||||
state = models.get_board_state("Projets/demo")
|
||||
elsewhere = [
|
||||
c["issue_number"]
|
||||
for col, cards in state.items() if col != "backlog"
|
||||
for c in cards
|
||||
]
|
||||
assert 9 not in elsewhere
|
||||
|
||||
|
||||
def test_adoption_is_idempotent(client, fake_gitea):
|
||||
fake_gitea.issues["Projets/demo"].append(
|
||||
_labelled(9, "Stable", ["kanban:qa"])
|
||||
)
|
||||
client.get("/board/Projets/demo")
|
||||
client.get("/board/Projets/demo")
|
||||
events = [
|
||||
e for e in models.get_events("Projets/demo")
|
||||
if e["issue_number"] == 9 and e["event_type"] == "moved"
|
||||
]
|
||||
assert len(events) == 1 # adopted once, then label and state agree
|
||||
|
||||
|
||||
# ── Wallboard ─────────────────────────────────────────────────────
|
||||
|
||||
|
||||
def test_wall_renders_active_projects(client):
|
||||
models.move_issue("Projets/demo", 5, "in_progress")
|
||||
r = client.get("/wall")
|
||||
assert r.status_code == 200
|
||||
assert "Projets/demo" in r.text
|
||||
assert "Tâche focus" in r.text # the in-progress card is on the wall
|
||||
assert 'class="wall-slide active"' in r.text
|
||||
assert "🧪 QA" in r.text # the six column counters include QA
|
||||
|
||||
|
||||
def test_wall_single_repo_mode(client):
|
||||
r = client.get("/wall", params={"repo": "Projets/demo"})
|
||||
assert r.status_code == 200
|
||||
assert "Projets/demo" in r.text
|
||||
|
||||
|
||||
def test_wall_unknown_repo_shows_empty_state(client):
|
||||
r = client.get("/wall", params={"repo": "Inconnu/xyz"})
|
||||
assert r.status_code == 200
|
||||
assert "Aucun projet actif" in r.text
|
||||
|
||||
|
||||
def test_wall_is_behind_auth(monkeypatch, fake_gitea):
|
||||
monkeypatch.setenv("KANBANTE_AUTH_USER", "bruno")
|
||||
monkeypatch.setenv("KANBANTE_AUTH_PASSWORD", "motdepasse")
|
||||
with TestClient(main.app) as secured:
|
||||
assert secured.get("/wall").status_code == 401
|
||||
@@ -0,0 +1,164 @@
|
||||
"""Palier 5 (0.8.0): palette de commandes (#10) + digest hebdo (#13)."""
|
||||
|
||||
import httpx
|
||||
import pytest
|
||||
|
||||
from app import digest as digest_service
|
||||
from app import models
|
||||
from tests.conftest import csrf_from
|
||||
|
||||
|
||||
# ── Palette (#10) ─────────────────────────────────────────────────
|
||||
|
||||
|
||||
def test_palette_endpoint_projects_and_issues(client, fake_gitea):
|
||||
r = client.get("/api/palette", params={"q": "tâche"})
|
||||
assert r.status_code == 200
|
||||
data = r.json()
|
||||
assert any(p["full_name"] == "Projets/demo" for p in data["projects"])
|
||||
titles = [i["title"] for i in data["issues"]]
|
||||
assert "Tâche un" in titles
|
||||
found = next(i for i in data["issues"] if i["title"] == "Tâche un")
|
||||
assert found["repo"] == "Projets/demo"
|
||||
assert found["column"] == "backlog"
|
||||
|
||||
|
||||
def test_palette_short_query_skips_issue_search(client):
|
||||
r = client.get("/api/palette", params={"q": "x"})
|
||||
assert r.status_code == 200
|
||||
assert r.json()["issues"] == []
|
||||
assert r.json()["projects"] # projects are always there
|
||||
|
||||
|
||||
def test_palette_markup_on_pages(client):
|
||||
for path in ("/", "/focus", "/capture"):
|
||||
r = client.get(path)
|
||||
assert r.status_code == 200
|
||||
assert 'id="palette-overlay"' in r.text, path
|
||||
assert "/static/js/palette.js" in r.text, path
|
||||
assert "palette-trigger" in r.text, path
|
||||
|
||||
|
||||
# ── Digest : composition (#13) ────────────────────────────────────
|
||||
|
||||
|
||||
def test_digest_markdown_format():
|
||||
md = digest_service.format_digest_markdown(
|
||||
"2026-10-05 au 2026-10-11",
|
||||
[{"repo": "Projets/demo", "number": 3, "title": "Ancienne tâche",
|
||||
"html_url": "http://gitea.test/x"}],
|
||||
created_count=2,
|
||||
moved_count=5,
|
||||
focus_groups=[{
|
||||
"full_name": "Projets/demo",
|
||||
"cards": [{"issue": {"number": 5, "title": "Tâche focus"},
|
||||
"column": "🚧 En cours"}],
|
||||
}],
|
||||
)
|
||||
assert "# 🧠 Kanbante — semaine du 2026-10-05" in md
|
||||
assert "## ✅ Livré (1)" in md
|
||||
assert "Projets/demo#3" in md
|
||||
assert "Tâche focus" in md
|
||||
assert "Déplacements de cartes : 5" in md
|
||||
|
||||
|
||||
def test_render_mcp_args_escapes_content():
|
||||
args = digest_service.render_mcp_args(
|
||||
'{"title": "{title}", "content": "{content}", "folder": "Kanbante"}',
|
||||
'Titre "cité"',
|
||||
"Ligne 1\nLigne 2 avec \\ barre",
|
||||
)
|
||||
assert args["title"] == 'Titre "cité"'
|
||||
assert args["content"] == "Ligne 1\nLigne 2 avec \\ barre"
|
||||
assert args["folder"] == "Kanbante"
|
||||
with pytest.raises(ValueError):
|
||||
digest_service.render_mcp_args("{pas json", "t", "c")
|
||||
|
||||
|
||||
def test_digest_page_renders(client):
|
||||
r = client.get("/digest")
|
||||
assert r.status_code == 200
|
||||
assert "Digest hebdo" in r.text
|
||||
assert "approbation" in r.text
|
||||
|
||||
|
||||
# ── Digest : livraison ────────────────────────────────────────────
|
||||
|
||||
|
||||
def _mcp_handler_factory(calls: list):
|
||||
def handler(request: httpx.Request) -> httpx.Response:
|
||||
import json as _json
|
||||
payload = _json.loads(request.content.decode() or "{}")
|
||||
calls.append(payload.get("method"))
|
||||
method = payload.get("method")
|
||||
if method == "initialize":
|
||||
return httpx.Response(200, json={"jsonrpc": "2.0", "id": 1,
|
||||
"result": {"protocolVersion": "2024-11-05", "capabilities": {}}})
|
||||
if method == "notifications/initialized":
|
||||
return httpx.Response(202, json={})
|
||||
if method == "tools/list":
|
||||
return httpx.Response(200, json={"jsonrpc": "2.0", "id": 2,
|
||||
"result": {"tools": [{"name": "create_note"}, {"name": "search"}]}})
|
||||
if method == "tools/call":
|
||||
calls.append(payload["params"])
|
||||
return httpx.Response(200, json={"jsonrpc": "2.0", "id": 3,
|
||||
"result": {"content": [{"type": "text", "text": "note créée"}]}})
|
||||
return httpx.Response(200, json={})
|
||||
return handler
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mcp_transport(monkeypatch):
|
||||
calls: list = []
|
||||
transport = httpx.MockTransport(_mcp_handler_factory(calls))
|
||||
real_async_client = httpx.AsyncClient
|
||||
|
||||
def factory(*args, **kwargs):
|
||||
kwargs["transport"] = transport
|
||||
return real_async_client(*args, **kwargs)
|
||||
|
||||
monkeypatch.setattr(httpx, "AsyncClient", factory)
|
||||
return calls
|
||||
|
||||
|
||||
async def test_mcp_list_tools(mcp_transport):
|
||||
ok, tools = await digest_service.mcp_list_tools("http://obsigate.test/mcp", "")
|
||||
assert ok is True
|
||||
assert tools == ["create_note", "search"]
|
||||
|
||||
|
||||
async def test_mcp_call_tool(mcp_transport):
|
||||
ok, message = await digest_service.mcp_call_tool(
|
||||
"http://obsigate.test/mcp", "", "create_note",
|
||||
{"title": "T", "content": "C"},
|
||||
)
|
||||
assert ok is True
|
||||
assert "note créée" in message
|
||||
call = next(c for c in mcp_transport if isinstance(c, dict))
|
||||
assert call["name"] == "create_note"
|
||||
assert call["arguments"] == {"title": "T", "content": "C"}
|
||||
|
||||
|
||||
def test_digest_send_to_obsigate(client, fake_gitea, monkeypatch, mcp_transport):
|
||||
monkeypatch.setenv("KANBANTE_OBSIGATE_MCP_URL", "http://obsigate.test/mcp")
|
||||
monkeypatch.setenv("KANBANTE_OBSIGATE_MCP_TOOL", "create_note")
|
||||
token = csrf_from(client)
|
||||
r = client.post("/digest/send", data={"target": "obsigate", "csrf_token": token})
|
||||
assert r.status_code == 200
|
||||
assert "✅ Digest envoyé (obsigate)" in r.text
|
||||
assert models.get_kv("digest_last_result")
|
||||
|
||||
|
||||
def test_digest_send_requires_configuration(client, fake_gitea):
|
||||
token = csrf_from(client)
|
||||
r = client.post("/digest/send", data={"target": "obsigate", "csrf_token": token})
|
||||
assert r.status_code == 200
|
||||
assert "❌ ObsiGate incomplet" in r.text
|
||||
|
||||
|
||||
def test_digest_probe_lists_tools(client, fake_gitea, monkeypatch, mcp_transport):
|
||||
monkeypatch.setenv("KANBANTE_OBSIGATE_MCP_URL", "http://obsigate.test/mcp")
|
||||
token = csrf_from(client)
|
||||
r = client.post("/digest/probe", data={"csrf_token": token})
|
||||
assert r.status_code == 200
|
||||
assert "create_note" in r.text
|
||||
Reference in New Issue
Block a user