Coverage for src/prosemark/templates/ports/user_prompter_port.py: 100%
15 statements
« prev ^ index » next coverage.py v7.8.0, created at 2025-09-30 23:09 +0000
« prev ^ index » next coverage.py v7.8.0, created at 2025-09-30 23:09 +0000
1"""User Prompter Port Contract.
3Defines the interface for user interaction during template instantiation.
4"""
6from abc import ABC, abstractmethod
8from prosemark.templates.domain.entities.placeholder import Placeholder, PlaceholderValue
11class UserPrompterPort(ABC):
12 """Port for user interaction during template instantiation."""
14 @abstractmethod
15 def prompt_for_placeholder_values(self, placeholders: list[Placeholder]) -> dict[str, PlaceholderValue]:
16 """Prompt user for values for all placeholders.
18 Args:
19 placeholders: List of placeholders requiring values
21 Returns:
22 Dictionary mapping placeholder names to their values
24 Raises:
25 UserCancelledError: If user cancels the operation
26 InvalidPlaceholderValueError: If user provides invalid value
28 """
30 @abstractmethod
31 def prompt_for_single_value(self, placeholder: Placeholder) -> PlaceholderValue:
32 """Prompt user for a single placeholder value.
34 Args:
35 placeholder: Placeholder requiring a value
37 Returns:
38 PlaceholderValue with user input
40 Raises:
41 UserCancelledError: If user cancels the operation
42 InvalidPlaceholderValueError: If user provides invalid value
44 """
46 @abstractmethod
47 def confirm_template_selection(self, template_name: str) -> bool:
48 """Confirm with user that they want to use the selected template.
50 Args:
51 template_name: Name of template to confirm
53 Returns:
54 True if user confirms, False otherwise
56 """
58 @abstractmethod
59 def display_template_list(self, templates: list[str]) -> None:
60 """Display list of available templates to user.
62 Args:
63 templates: List of template names to display
65 """
67 @abstractmethod
68 def show_error_message(self, message: str) -> None:
69 """Display error message to user.
71 Args:
72 message: Error message to display
74 """
76 @abstractmethod
77 def show_success_message(self, message: str) -> None:
78 """Display success message to user.
80 Args:
81 message: Success message to display
83 """