fix(hilfe): vollständigen Hilfetext über zwei Teile ausgeben statt kürzen

Andreas' Entscheidung: lieber den vollständigen Hilfetext über zwei
Textblöcke ausgeben, als eine unvollständige Seite. Der progressive
Kürzungs-Fix (f74d206) schnitt Subcommand-Details weg (::keywords
review/status, ::butler mode-Optionen) — nicht akzeptabel.

- build_help_text() gibt wieder den vollständigen, ungekürzten Text zurück
- progressiven Kürzungs-Fix (Stufe 1-3) entfernt
- room_map_summary-Kürzungs-Fix (P1) beibehalten (optionale Sektion)
- NEU: build_help_text_parts() teilt bei > 4500 Zeichen in zwei Teile:
  Teil 1 = Core + Standard + RC-Befehle, Teil 2 = Natürliche Sprache +
  Status + Tipp
- adapter.py: _post_help_text() postet beide Teile nacheinander; alle
  Aufrufer (::hilfe, ::commands, natürliche Hilfe, unbekannter Befehl,
  Command-Question, Onboarding-Review) umgestellt
- Tests: test_build_help_text_full (alle Subcommands), test_build_help_text_split
  (zwei Teile < 4500), test_build_help_text_split_single_part_when_short
This commit is contained in:
Bernd (Hermes)
2026-08-26 20:22:35 +02:00
parent f74d206657
commit 89ca4d5e8c
3 changed files with 223 additions and 153 deletions
+29 -41
View File
@@ -2955,13 +2955,9 @@ class RocketChatAdapter(BasePlatformAdapter):
# Prüft VOR dem ::-Parsing und VOR dem Archivar-Routing, ob der # Prüft VOR dem ::-Parsing und VOR dem Archivar-Routing, ob der
# Nutzer in natürlicher Sprache die Hilfeseite anfordert. # Nutzer in natürlicher Sprache die Hilfeseite anfordert.
# "Ich brauche Hilfe", "Hilf mir", "help" etc. zeigen die ::hilfe-Seite. # "Ich brauche Hilfe", "Hilf mir", "help" etc. zeigen die ::hilfe-Seite.
from archivar.inline_commands import is_natural_help_request, build_help_text from archivar.inline_commands import is_natural_help_request
if is_natural_help_request(routing_text): if is_natural_help_request(routing_text):
help_text = build_help_text( await self._post_help_text(room_id)
self._inline_commands,
room_map_summary=self._room_map_summary,
)
await self._post_message_with_retry(room_id, help_text)
routing_counter.increment('natural_help_triggered') routing_counter.increment('natural_help_triggered')
logger.info( logger.info(
"ROUTING BYPASS: reason=natural_help_triggered, origin_room=%s, text=%s", "ROUTING BYPASS: reason=natural_help_triggered, origin_room=%s, text=%s",
@@ -4971,7 +4967,6 @@ class RocketChatAdapter(BasePlatformAdapter):
from archivar.inline_commands import ( from archivar.inline_commands import (
parse_inline_command, parse_inline_command,
is_natural_help_request, is_natural_help_request,
build_help_text,
) )
stripped = text.strip() stripped = text.strip()
@@ -4990,15 +4985,12 @@ class RocketChatAdapter(BasePlatformAdapter):
return True return True
else: else:
# Unbekannter ::-Befehl → Hilfeseite zeigen # Unbekannter ::-Befehl → Hilfeseite zeigen
help_text = build_help_text(
self._inline_commands,
room_map_summary=self._room_map_summary,
)
unknown_msg = ( unknown_msg = (
f"Unbekannter Befehl `::{command}`. " f"Unbekannter Befehl `::{command}`. "
f"Hier sind alle verfügbaren Befehle:\n\n{help_text}" f"Hier sind alle verfügbaren Befehle:"
) )
await self._post_message_with_retry(room_id, unknown_msg) await self._post_message_with_retry(room_id, unknown_msg)
await self._post_help_text(room_id)
return True return True
# 2. UX-8: Command-Question? "Was macht ::curate?" etc. # 2. UX-8: Command-Question? "Was macht ::curate?" etc.
@@ -5011,24 +5003,17 @@ class RocketChatAdapter(BasePlatformAdapter):
await self._post_message_with_retry(room_id, cmd_help) await self._post_message_with_retry(room_id, cmd_help)
else: else:
# Unbekannter Befehl → Liste aller verfügbaren # Unbekannter Befehl → Liste aller verfügbaren
help_text = build_help_text(
self._inline_commands,
room_map_summary=self._room_map_summary,
)
unknown_msg = ( unknown_msg = (
f"Unbekannter Befehl `::{cmd_question}`. " f"Unbekannter Befehl `::{cmd_question}`. "
f"Hier sind alle verfügbaren Befehle:\n\n{help_text}" f"Hier sind alle verfügbaren Befehle:"
) )
await self._post_message_with_retry(room_id, unknown_msg) await self._post_message_with_retry(room_id, unknown_msg)
await self._post_help_text(room_id)
return True return True
# 3. Natürliche Hilfeseiten-Anfrage? # 3. Natürliche Hilfeseiten-Anfrage?
if is_natural_help_request(stripped): if is_natural_help_request(stripped):
help_text = build_help_text( await self._post_help_text(room_id)
self._inline_commands,
room_map_summary=self._room_map_summary,
)
await self._post_message_with_retry(room_id, help_text)
return True return True
return False return False
@@ -5103,9 +5088,15 @@ class RocketChatAdapter(BasePlatformAdapter):
# (die Nachricht wurde schon gesendet) # (die Nachricht wurde schon gesendet)
return "" # Wird nicht gepostet, da _handle_inline_command den Return-Wert sendet return "" # Wird nicht gepostet, da _handle_inline_command den Return-Wert sendet
async def _cmd_hilfe(self, room_id: str, args: str) -> str: async def _post_help_text(self, room_id: str) -> None:
"""::hilfe — Zeigt die Hilfeseite mit allen Befehlen.""" """Postet die vollständige Hilfeseite (ggf. in zwei Teilen).
from archivar.inline_commands import build_help_text
Andreas' Entscheidung: lieber den vollständigen Hilfetext über zwei
Textblöcke ausgeben, als eine unvollständige Seite. Wenn der Text
> 4500 Zeichen ist, wird er in zwei Teile aufgeteilt und beide
nacheinander gepostet.
"""
from archivar.inline_commands import build_help_text_parts
# P1-4: PresenceEngine-Werte lesen (mit _has_presence-Guard) # P1-4: PresenceEngine-Werte lesen (mit _has_presence-Guard)
presence_enabled = None presence_enabled = None
@@ -5115,12 +5106,21 @@ class RocketChatAdapter(BasePlatformAdapter):
presence_enabled = self._presence_engine.is_enabled() presence_enabled = self._presence_engine.is_enabled()
current_status = getattr(self._presence_engine, '_last_sent_status', 'online') or 'online' current_status = getattr(self._presence_engine, '_last_sent_status', 'online') or 'online'
return build_help_text( parts = build_help_text_parts(
self._inline_commands, self._inline_commands,
room_map_summary=self._room_map_summary, room_map_summary=self._room_map_summary,
presence_enabled=presence_enabled, presence_enabled=presence_enabled,
current_status=current_status, current_status=current_status,
) )
for part in parts:
await self._post_message_with_retry(room_id, part)
async def _cmd_hilfe(self, room_id: str, args: str) -> str:
"""::hilfe — Zeigt die Hilfeseite mit allen Befehlen."""
await self._post_help_text(room_id)
# Wir haben bereits gepostet, also leeren String zurückgeben
# (die Nachricht wurde schon gesendet).
return ""
async def _cmd_status(self, room_id: str, args: str) -> str: async def _cmd_status(self, room_id: str, args: str) -> str:
"""::status — Zeigt den aktuellen Plugin-Status.""" """::status — Zeigt den aktuellen Plugin-Status."""
@@ -5252,11 +5252,8 @@ class RocketChatAdapter(BasePlatformAdapter):
async def _cmd_commands(self, room_id: str, args: str) -> str: async def _cmd_commands(self, room_id: str, args: str) -> str:
"""::commands — Listet alle verfügbaren ::-Befehle (::Variante von /commands).""" """::commands — Listet alle verfügbaren ::-Befehle (::Variante von /commands)."""
from archivar.inline_commands import build_help_text await self._post_help_text(room_id)
return build_help_text( return ""
self._inline_commands,
room_map_summary=self._room_map_summary,
)
async def _cmd_restart(self, room_id: str, args: str) -> str: async def _cmd_restart(self, room_id: str, args: str) -> str:
"""::restart — Löst einen Gateway-Neustart aus (::Variante von /restart). """::restart — Löst einen Gateway-Neustart aus (::Variante von /restart).
@@ -7480,16 +7477,7 @@ class RocketChatAdapter(BasePlatformAdapter):
if "Beibehalten" in choice or "⏭️" in choice or choice.lower() in ("beibehalten", "skip", "überspringen"): if "Beibehalten" in choice or "⏭️" in choice or choice.lower() in ("beibehalten", "skip", "überspringen"):
await self._complete_onboarding(operator_room_id) await self._complete_onboarding(operator_room_id)
from archivar.inline_commands import build_help_text await self._post_help_text(operator_room_id)
presence_enabled = None
current_status = "online"
_has_presence = hasattr(self, '_presence_engine') and self._presence_engine is not None
if _has_presence:
presence_enabled = self._presence_engine.is_enabled()
current_status = getattr(self._presence_engine, '_last_sent_status', 'online') or 'online'
help_text = build_help_text(self._inline_commands, room_map_summary=self._room_map_summary,
presence_enabled=presence_enabled, current_status=current_status)
await self._post_message_with_retry(operator_room_id, help_text)
logger.info("[rocketchat] F8 UX: Review-Flow abgeschlossen — ACTIVE") logger.info("[rocketchat] F8 UX: Review-Flow abgeschlossen — ACTIVE")
return return
+104 -82
View File
@@ -236,24 +236,17 @@ class InlineCommandRegistry:
# ── Help-Text-Generator ───────────────────────────────────────────────── # ── Help-Text-Generator ─────────────────────────────────────────────────
def build_help_text( def _build_help_sections(
registry: InlineCommandRegistry, registry: InlineCommandRegistry,
room_map_summary: str = "", room_map_summary: str = "",
presence_enabled: Optional[bool] = None, presence_enabled: Optional[bool] = None,
current_status: str = "online", current_status: str = "online",
plugin_version: str = "", plugin_version: str = "",
) -> str: ) -> Dict[str, List[str]]:
"""Baut die Hilfeseite mit ::-Befehlen und natürlichen Sprach-Befehlen. """Baut die Hilfeseiten-Sektionen als Dict von Zeilen-Listen.
Args:
registry: Die InlineCommandRegistry mit allen registrierten Befehlen.
room_map_summary: Optionale Raum-Map-Übersicht für den Status-Teil.
presence_enabled: Ob die PresenceEngine aktiv ist (None = nicht verfügbar).
current_status: Aktueller Presence-Status ('online', 'away', 'busy').
plugin_version: Plugin-Version (z.B. "9.2 (1d31d2c)").
Returns: Returns:
Formatierte Hilfeseite als Markdown-String. Dict mit den Keys: header, core, standard, rc, natural, status, footer.
""" """
header = [ header = [
"## 🤖 Rocket.Chat Plugin — Hilfe", "## 🤖 Rocket.Chat Plugin — Hilfe",
@@ -398,16 +391,18 @@ def build_help_text(
"Moderatorenrechte in den Themenräumen haben.", "Moderatorenrechte in den Themenräumen haben.",
] ]
lines = header + core_lines + standard_lines + rc_lines + natural_lines + status_lines + footer
result = "\n".join(lines)
# P1-Fix: Rocket.Chat hat ein Payload-Limit von ~5000 Zeichen. # P1-Fix: Rocket.Chat hat ein Payload-Limit von ~5000 Zeichen.
# Wenn der Hilfe-Text > 4000 Zeichen ist, lasse die room_map_summary # Wenn der Hilfe-Text > 4000 Zeichen ist, lasse die room_map_summary
# weg und ersetze sie durch einen kurzen Hinweis. Die Ersetzung erfolgt # weg und ersetze sie durch einen kurzen Hinweis. Die Ersetzung erfolgt
# direkt in status_lines, damit sie auch bei den P1b-Kürzungen # direkt in status_lines, damit sie auch bei der Zwei-Teil-Aufteilung
# (Stufe 1/2) erhalten bleibt. # erhalten bleibt. (Die room_map_summary ist eine optionale Sektion,
# keine Befehlsliste — das Kürzen ist hier akzeptabel.)
MAX_HELP_LENGTH = 4000 MAX_HELP_LENGTH = 4000
if len(result) > MAX_HELP_LENGTH and room_map_summary: full_lines = (
header + core_lines + standard_lines + rc_lines
+ natural_lines + status_lines + footer
)
if len("\n".join(full_lines)) > MAX_HELP_LENGTH and room_map_summary:
for i, line in enumerate(status_lines): for i, line in enumerate(status_lines):
if line == room_map_summary: if line == room_map_summary:
status_lines[i] = ( status_lines[i] = (
@@ -415,73 +410,100 @@ def build_help_text(
"(> 4000 Zeichen). `::status` für Details." "(> 4000 Zeichen). `::status` für Details."
) )
break break
lines = header + core_lines + standard_lines + rc_lines + natural_lines + status_lines + footer
result = "\n".join(lines)
# P1b-Fix: Die Hilfe-Seite ist durch Subcommand-Ergänzungen auch OHNE return {
# room_map_summary über das Payload-Limit gewachsen. Der P1-Fix greift "header": header,
# nur, wenn room_map_summary gesetzt ist. Zweiter Check: wenn der Text "core": core_lines,
# IMMER NOCH > 4500 Zeichen ist (nah am ~5000-Limit), kürze die "standard": standard_lines,
# entbehrlichsten Sektionen progressiv — zuerst die natürlichen "rc": rc_lines,
# Sprach-Befehle (Sektion 3), dann die Standard-Hermes-Befehle "natural": natural_lines,
# (Sektion 1) auf eine kompakte Liste. Core-Befehle, RC-Plugin-Befehle, "status": status_lines,
# Status-Farben und Plugin-Status bleiben erhalten. "footer": footer,
}
def build_help_text(
registry: InlineCommandRegistry,
room_map_summary: str = "",
presence_enabled: Optional[bool] = None,
current_status: str = "online",
plugin_version: str = "",
) -> str:
"""Baut die vollständige Hilfeseite mit ::-Befehlen und natürlichen Sprach-Befehlen.
Der Text wird NICHT gekürzt — alle Subcommands bleiben erhalten.
Nur die optionale room_map_summary wird bei Überschreitung des
Payload-Limits weggelassen (P1-Fix).
Args:
registry: Die InlineCommandRegistry mit allen registrierten Befehlen.
room_map_summary: Optionale Raum-Map-Übersicht für den Status-Teil.
presence_enabled: Ob die PresenceEngine aktiv ist (None = nicht verfügbar).
current_status: Aktueller Presence-Status ('online', 'away', 'busy').
plugin_version: Plugin-Version (z.B. "9.2 (1d31d2c)").
Returns:
Formatierte Hilfeseite als Markdown-String (vollständig, ungekürzt).
"""
s = _build_help_sections(
registry,
room_map_summary=room_map_summary,
presence_enabled=presence_enabled,
current_status=current_status,
plugin_version=plugin_version,
)
lines = (
s["header"] + s["core"] + s["standard"] + s["rc"]
+ s["natural"] + s["status"] + s["footer"]
)
return "\n".join(lines)
def build_help_text_parts(
registry: InlineCommandRegistry,
room_map_summary: str = "",
presence_enabled: Optional[bool] = None,
current_status: str = "online",
plugin_version: str = "",
) -> List[str]:
"""Baut die Hilfeseite als Liste von 1-2 Teilen, jeder < 4500 Zeichen.
Andreas' Entscheidung: lieber den vollständigen Hilfetext über zwei
Textblöcke ausgeben, als eine unvollständige Seite. Wenn der vollständige
Text > 4500 Zeichen ist, wird er in zwei Teile aufgeteilt:
- Teil 1: Core-Befehle + Standard-Hermes-Befehle + RC-Plugin-Befehle
- Teil 2: Natürliche Sprach-Befehle + Status-Farben + Plugin-Status + Tipp
Args:
registry: Die InlineCommandRegistry mit allen registrierten Befehlen.
room_map_summary: Optionale Raum-Map-Übersicht für den Status-Teil.
presence_enabled: Ob die PresenceEngine aktiv ist (None = nicht verfügbar).
current_status: Aktueller Presence-Status ('online', 'away', 'busy').
plugin_version: Plugin-Version (z.B. "9.2 (1d31d2c)").
Returns:
Liste mit 1 Element (vollständiger Text, wenn <= 4500 Zeichen)
oder 2 Elementen (Teil 1 und Teil 2, wenn > 4500 Zeichen).
"""
s = _build_help_sections(
registry,
room_map_summary=room_map_summary,
presence_enabled=presence_enabled,
current_status=current_status,
plugin_version=plugin_version,
)
part1 = "\n".join(s["header"] + s["core"] + s["standard"] + s["rc"])
part2 = "\n".join(s["natural"] + s["status"] + s["footer"])
full = "\n".join(
s["header"] + s["core"] + s["standard"] + s["rc"]
+ s["natural"] + s["status"] + s["footer"]
)
MAX_SAFE_LENGTH = 4500 MAX_SAFE_LENGTH = 4500
# Kompakte Varianten der entbehrlichsten Sektionen — werden nur bei if len(full) <= MAX_SAFE_LENGTH:
# Überschreitung des Limits verwendet. return [full]
compact_natural = [ return [part1, part2]
"### 🗣️ Natürliche Sprach-Befehle",
"",
"Du kannst auch natürlich sprechen: 'Lass uns in #Raum wechseln', "
"'Das gehört in den Plugin-Raum', 'Ich brauche Hilfe', '::status'.",
"",
]
compact_standard = ["### 🔷 Standard-Hermes-Befehle (:: als Variante)", ""]
for cmd in standard_cmds:
compact_standard.append(f"- `::{cmd['name']}` — {cmd['help_text']}")
compact_standard.append("")
compact_rc = ["### 🔶 RC-Plugin-spezifische Befehle", ""]
compact_rc.append("Diese Befehle steuern das Rocket.Chat-Plugin direkt:")
compact_rc.append("")
for cmd in rc_cmds:
compact_rc.append(f"- `::{cmd['name']}` — {cmd['help_text']}")
compact_rc.append("")
compact_rc.append(
"**Butler-Routing-Modus:** cognitive (Vorschlag+Bestätigung), "
"strict (automatisch), off (deaktiviert) — einstellbar über `::onboarding`"
)
compact_rc.append("")
if len(result) > MAX_SAFE_LENGTH:
# Stufe 1: Natürliche Sprach-Befehle auf eine Zeile kürzen
lines = (
header + core_lines + standard_lines + rc_lines
+ compact_natural + status_lines + footer
)
result = "\n".join(lines)
if len(result) > MAX_SAFE_LENGTH:
# Stufe 2: Standard-Hermes-Befehle auf kompakte Liste kürzen
# (nur Befehlsnamen, keine Subcommands, keine Einleitung)
lines = (
header + core_lines + compact_standard + rc_lines
+ compact_natural + status_lines + footer
)
result = "\n".join(lines)
if len(result) > MAX_SAFE_LENGTH:
# Stufe 3: RC-Plugin-Befehle behalten, aber Subcommand-Details
# weglassen (nur Befehlsname + help_text). Die Befehle selbst
# bleiben vollständig erhalten — nur die ausführlichen
# Subcommand-Aufzählungen (z.B. ::reasoning mit 9 Einträgen,
# ::onboarding mit 6) werden entfernt.
lines = (
header + core_lines + compact_standard + compact_rc
+ compact_natural + status_lines + footer
)
result = "\n".join(lines)
return result
def build_status_text( def build_status_text(
@@ -318,19 +318,9 @@ class TestBuildHelpText:
assert "Raum-Map: 1 Raum" in text assert "Raum-Map: 1 Raum" in text
assert len(text) <= 4000 assert len(text) <= 4000
def test_build_help_text_length_with_all_commands(self): def _build_full_registry(self):
"""P1b-Fix: Hilfe-Text bleibt auch OHNE room_map_summary unter 4500 Zeichen. """Baut eine Registry mit ALLEN realen Befehlen (inkl. Subcommands)."""
from archivar.inline_commands import InlineCommandRegistry
Die Hilfe-Seite ist durch Subcommand-Ergänzungen (mode proactive,
mode silent_collector, Routing-Modi-Hinweis) über das Payload-Limit
gewachsen. Der P1-Fix griff nur bei gesetzter room_map_summary.
Dieser Test registriert ALLE realen Befehle (inkl. Subcommands) und
prüft, dass der Text auch ohne room_map_summary < 4500 Zeichen bleibt.
"""
from archivar.inline_commands import (
InlineCommandRegistry,
build_help_text,
)
registry = InlineCommandRegistry() registry = InlineCommandRegistry()
async def dummy(room_id, args): async def dummy(room_id, args):
@@ -475,33 +465,103 @@ class TestBuildHelpText:
"Kontext manuell komprimieren (::Variante von /compress)", "Kontext manuell komprimieren (::Variante von /compress)",
category="Standard", category="Standard",
) )
return registry
# OHNE room_map_summary — der P1-Fix greift hier NICHT. def test_build_help_text_full(self):
"""Vollständiger Text: ALLE Subcommands müssen vorhanden sein.
Andreas' Entscheidung: lieber den vollständigen Hilfetext über zwei
Textblöcke ausgeben, als eine unvollständige Seite. Der progressive
Kürzungs-Fix (f74d206) schnitt Subcommand-Details weg — das ist
nicht akzeptabel. Dieser Test prüft, dass KEIN Subcommand fehlt.
"""
from archivar.inline_commands import build_help_text
registry = self._build_full_registry()
text = build_help_text(registry, room_map_summary="") text = build_help_text(registry, room_map_summary="")
assert len(text) < 4500, (
f"Hilfe-Text ist {len(text)} Zeichen lang, "
f"maximal erlaubt sind < 4500 (Payload-Limit ~5000)"
)
# MIT room_map_summary — beide Fixes müssen greifen. # keywords Subcommands
big_summary = "Rocket.Chat Raum-Map:\n" assert "::keywords review" in text
for i in range(5): assert "::keywords status" in text
big_summary += ( # butler Subcommands
f" {i+1}. #Raum{i+1} (room_id_{i+1}...) — " assert "::butler mode" in text
f"Thema: Dies ist ein sehr langer Beschreibungstext für Raum {i+1} " assert "::butler mode proactive" in text
f"um die Länge der Hilfeseite künstlich zu erhöhen\n" assert "::butler mode silent_collector" in text
) # onboarding Subcommands
text_with_map = build_help_text(registry, room_map_summary=big_summary) assert "::onboarding start" in text
assert len(text_with_map) < 4500, ( assert "::onboarding status" in text
f"Hilfe-Text mit room_map_summary ist {len(text_with_map)} Zeichen lang, " assert "::onboarding resume" in text
assert "::onboarding pause" in text
assert "::onboarding abort" in text
assert "::onboarding reset" in text
# approve Subcommands
assert "::approve session" in text
assert "::approve always" in text
# setstatus Subcommands
assert "::setstatus on" in text
assert "::setstatus off" in text
assert "::setstatus status" in text
# reasoning Subcommands
assert "::reasoning none" in text
assert "::reasoning low" in text
assert "::reasoning medium" in text
assert "::reasoning high" in text
assert "::reasoning xhigh" in text
assert "::reasoning show" in text
assert "::reasoning hide" in text
assert "::reasoning reset" in text
assert "::reasoning --global" in text
def test_build_help_text_split(self):
"""Bei > 4500 Zeichen werden zwei Teile geliefert, beide < 4500."""
from archivar.inline_commands import build_help_text_parts
registry = self._build_full_registry()
parts = build_help_text_parts(registry, room_map_summary="")
# Der vollständige Text ist > 4500 Zeichen → zwei Teile
assert len(parts) == 2, f"Erwartet 2 Teile, bekam {len(parts)}"
for i, part in enumerate(parts, start=1):
assert len(part) < 4500, (
f"Teil {i} ist {len(part)} Zeichen lang, "
f"maximal erlaubt sind < 4500" f"maximal erlaubt sind < 4500"
) )
# Core-Befehle, RC-Plugin-Befehle und Plugin-Status müssen erhalten bleiben. # Teil 1 enthält die Befehlslisten (Core + Standard + RC)
assert "Core-Befehle" in text assert "Core-Befehle" in parts[0]
assert "RC-Plugin-spezifische Befehle" in text assert "Standard-Hermes-Befehle" in parts[0]
assert "Plugin-Status" in text assert "RC-Plugin-spezifische Befehle" in parts[0]
assert "::butler" in text # Teil 2 enthält natürliche Sprache + Status + Tipp
assert "Natürliche Sprach-Befehle" in parts[1]
assert "Plugin-Status" in parts[1]
assert "Tipp" in parts[1]
# KEIN Subcommand darf fehlen — über beide Teile hinweg
combined = "\n".join(parts)
for sub in (
"::keywords review", "::keywords status",
"::butler mode", "::butler mode proactive",
"::butler mode silent_collector",
):
assert sub in combined, f"Subcommand {sub} fehlt in beiden Teilen"
def test_build_help_text_split_single_part_when_short(self):
"""Kurzer Text (wenige Befehle) → nur EIN Teil."""
from archivar.inline_commands import (
InlineCommandRegistry,
build_help_text_parts,
)
registry = InlineCommandRegistry()
async def dummy(room_id, args):
return "ok"
registry.register("hilfe", dummy, "Zeigt diese Hilfeseite", category="Hilfe")
registry.register("status", dummy, "Zeigt Plugin-Status", category="Hilfe")
parts = build_help_text_parts(registry, room_map_summary="")
assert len(parts) == 1
assert len(parts[0]) < 4500
class TestBuildStatusText: class TestBuildStatusText: