Coverage for src/lexigram/notification/cli/contributor.py: 0%
24 statements
« prev ^ index » next coverage.py v7.15.4, created at 2026-08-26 02:26 +0800
« prev ^ index » next coverage.py v7.15.4, created at 2026-08-26 02:26 +0800
1"""Notification CLI contributor definitions."""
3from __future__ import annotations
5from typing import Any
7from lexigram.contracts.cli.contributions import (
8 CommandContribution,
9 DoctorCheckContribution,
10 HealthCheckContribution,
11 SchemaSetupContribution,
12)
13from lexigram.contracts.cli.types import GeneratorDefinition
15_GENERATOR_DEFINITIONS: tuple[GeneratorDefinition, ...] = (
16 GeneratorDefinition(
17 name="notification_template",
18 title="Generate Notification Template",
19 description="Generate a notification template",
20 contributor="notification",
21 generator_path="lexigram.notification.cli.generators.template:NotificationTemplateGenerator",
22 default_output_dir="src/notifications",
23 category="notification",
24 ),
25)
28class NotificationCliContributor:
29 """CLI contributor for the lexigram-notification package."""
31 @property
32 def contributor_id(self) -> str:
33 """Return the contributor identifier."""
34 return "notification"
36 def get_generators(self) -> list[GeneratorDefinition]:
37 """Return generator definitions for notification."""
38 return list(_GENERATOR_DEFINITIONS)
40 def get_commands(self) -> list[CommandContribution]:
41 """Return the contributed `notify` command group."""
42 return [
43 CommandContribution(
44 name="notify",
45 help="Notification channel management commands",
46 app_factory_path="lexigram.notification.cli.commands:create_notify_app",
47 contributor="notification",
48 category="notification",
49 requires_app_context=True,
50 ),
51 ]
53 def get_health_checks(self) -> list[HealthCheckContribution]:
54 """Return notification channel health checks."""
55 return [
56 HealthCheckContribution(
57 name="notification_channels",
58 description="Check notification channels are reachable",
59 check_path="lexigram.notification.cli.checks:check_notification_channels",
60 contributor="notification",
61 category="notification",
62 timeout=15.0,
63 ),
64 ]
66 def get_doctor_checks(self) -> list[DoctorCheckContribution]:
67 """Return notification configuration doctor checks."""
68 return [
69 DoctorCheckContribution(
70 name="smtp_configured",
71 description="Check SMTP configuration is present",
72 check_path="lexigram.notification.cli.doctor:check_smtp_config",
73 contributor="notification",
74 category="notification",
75 ),
76 DoctorCheckContribution(
77 name="push_credentials_configured",
78 description="Check push notification credentials are configured",
79 check_path="lexigram.notification.cli.doctor:check_push_credentials",
80 contributor="notification",
81 category="notification",
82 ),
83 ]
85 def get_shell_context(self) -> list[Any]:
86 """Return no shell context contributions."""
87 return []
89 def get_hooks(self) -> list[Any]:
90 """Return no hook contributions."""
91 return []
93 def get_schema_setup(self) -> list[SchemaSetupContribution]:
94 """Return schema setup contributions for notification."""
95 return [
96 SchemaSetupContribution(
97 name="notification.inbox_messages",
98 description="In-app notification inbox storage",
99 setup_fn_path="lexigram.notification.cli.schema_setup:ensure_inbox_messages",
100 contributor=self.contributor_id,
101 ),
102 ]
105__all__ = ["NotificationCliContributor"]