womm-cli 4.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. womm/__init__.py +53 -0
  2. womm/__main__.py +48 -0
  3. womm/_version.py +10 -0
  4. womm/assets/copier/meta/copier.yml +15 -0
  5. womm/assets/copier/meta/template/README.md.jinja +32 -0
  6. womm/assets/copier/meta/template/copier.yml.jinja +13 -0
  7. womm/assets/copier/meta/template/template/.gitkeep +0 -0
  8. womm/assets/copier/official/javascript/copier.yml +104 -0
  9. womm/assets/copier/official/javascript/template/.gitignore.jinja +35 -0
  10. womm/assets/copier/official/javascript/template/.nvmrc.jinja +1 -0
  11. womm/assets/copier/official/javascript/template/.prettierignore.jinja +10 -0
  12. womm/assets/copier/official/javascript/template/README.md.jinja +81 -0
  13. womm/assets/copier/official/javascript/template/biome.json.jinja +54 -0
  14. womm/assets/copier/official/javascript/template/eslint.config.mjs.jinja +51 -0
  15. womm/assets/copier/official/javascript/template/index.html.jinja +12 -0
  16. womm/assets/copier/official/javascript/template/package.json.jinja +88 -0
  17. womm/assets/copier/official/javascript/template/prettier.config.mjs.jinja +8 -0
  18. womm/assets/copier/official/javascript/template/src/App.jsx.jinja +10 -0
  19. womm/assets/copier/official/javascript/template/src/App.tsx.jinja +10 -0
  20. womm/assets/copier/official/javascript/template/src/App.vue.jinja +18 -0
  21. womm/assets/copier/official/javascript/template/src/index.jsx.jinja +10 -0
  22. womm/assets/copier/official/javascript/template/src/index.tsx.jinja +11 -0
  23. womm/assets/copier/official/javascript/template/src/main.js.jinja +21 -0
  24. womm/assets/copier/official/javascript/template/src/main.ts.jinja +21 -0
  25. womm/assets/copier/official/javascript/template/tsconfig.json.jinja +35 -0
  26. womm/assets/copier/official/javascript/template/vite.config.mjs.jinja +10 -0
  27. womm/assets/copier/official/javascript/template/{% if with_ci %}.github{% endif %}/workflows/ci.yml.jinja +63 -0
  28. womm/assets/copier/official/javascript/template/{% if with_tests %}tests{% endif %}/smoke.test.js.jinja +12 -0
  29. womm/assets/copier/official/javascript/template/{% if with_tests %}tests{% endif %}/smoke.test.ts.jinja +12 -0
  30. womm/assets/copier/official/javascript/template/{% if with_vscode %}.vscode{% endif %}/extensions.json.jinja +4 -0
  31. womm/assets/copier/official/javascript/template/{% if with_vscode %}.vscode{% endif %}/settings.json.jinja +27 -0
  32. womm/assets/copier/official/python/copier.yml +107 -0
  33. womm/assets/copier/official/python/template/.gitignore.jinja +40 -0
  34. womm/assets/copier/official/python/template/.pre-commit-config.yaml.jinja +19 -0
  35. womm/assets/copier/official/python/template/.python-version.jinja +1 -0
  36. womm/assets/copier/official/python/template/README.md.jinja +83 -0
  37. womm/assets/copier/official/python/template/pyproject.toml.jinja +114 -0
  38. womm/assets/copier/official/python/template/{% if framework == 'django' %}manage.py{% endif %}.jinja +23 -0
  39. womm/assets/copier/official/python/template/{% if not use_src_layout %}{{ package_name }}{% endif %}/__init__.py.jinja +3 -0
  40. womm/assets/copier/official/python/template/{% if not use_src_layout %}{{ package_name }}{% endif %}/asgi.py.jinja +9 -0
  41. womm/assets/copier/official/python/template/{% if not use_src_layout %}{{ package_name }}{% endif %}/core/__init__.py.jinja +0 -0
  42. womm/assets/copier/official/python/template/{% if not use_src_layout %}{{ package_name }}{% endif %}/core/apps.py.jinja +10 -0
  43. womm/assets/copier/official/python/template/{% if not use_src_layout %}{{ package_name }}{% endif %}/core/models.py.jinja +1 -0
  44. womm/assets/copier/official/python/template/{% if not use_src_layout %}{{ package_name }}{% endif %}/core/views.py.jinja +8 -0
  45. womm/assets/copier/official/python/template/{% if not use_src_layout %}{{ package_name }}{% endif %}/py.typed +0 -0
  46. womm/assets/copier/official/python/template/{% if not use_src_layout %}{{ package_name }}{% endif %}/settings.py.jinja +81 -0
  47. womm/assets/copier/official/python/template/{% if not use_src_layout %}{{ package_name }}{% endif %}/urls.py.jinja +11 -0
  48. womm/assets/copier/official/python/template/{% if not use_src_layout %}{{ package_name }}{% endif %}/wsgi.py.jinja +9 -0
  49. womm/assets/copier/official/python/template/{% if use_src_layout %}src{% endif %}/{{ package_name }}/__init__.py.jinja +3 -0
  50. womm/assets/copier/official/python/template/{% if use_src_layout %}src{% endif %}/{{ package_name }}/asgi.py.jinja +9 -0
  51. womm/assets/copier/official/python/template/{% if use_src_layout %}src{% endif %}/{{ package_name }}/core/__init__.py.jinja +0 -0
  52. womm/assets/copier/official/python/template/{% if use_src_layout %}src{% endif %}/{{ package_name }}/core/apps.py.jinja +10 -0
  53. womm/assets/copier/official/python/template/{% if use_src_layout %}src{% endif %}/{{ package_name }}/core/models.py.jinja +1 -0
  54. womm/assets/copier/official/python/template/{% if use_src_layout %}src{% endif %}/{{ package_name }}/core/views.py.jinja +8 -0
  55. womm/assets/copier/official/python/template/{% if use_src_layout %}src{% endif %}/{{ package_name }}/py.typed +0 -0
  56. womm/assets/copier/official/python/template/{% if use_src_layout %}src{% endif %}/{{ package_name }}/settings.py.jinja +81 -0
  57. womm/assets/copier/official/python/template/{% if use_src_layout %}src{% endif %}/{{ package_name }}/urls.py.jinja +11 -0
  58. womm/assets/copier/official/python/template/{% if use_src_layout %}src{% endif %}/{{ package_name }}/wsgi.py.jinja +9 -0
  59. womm/assets/copier/official/python/template/{% if with_ci %}.github{% endif %}/workflows/ci.yml.jinja +78 -0
  60. womm/assets/copier/official/python/template/{% if with_tests %}tests{% endif %}/test_smoke.py.jinja +16 -0
  61. womm/assets/copier/official/python/template/{% if with_vscode %}.vscode{% endif %}/extensions.json.jinja +8 -0
  62. womm/assets/copier/official/python/template/{% if with_vscode %}.vscode{% endif %}/settings.json.jinja +28 -0
  63. womm/bin/refresh_env.cmd +130 -0
  64. womm/cli.py +111 -0
  65. womm/commands/__init__.py +30 -0
  66. womm/commands/core/__init__.py +29 -0
  67. womm/commands/core/doctor.py +52 -0
  68. womm/commands/core/path.py +337 -0
  69. womm/commands/project/__init__.py +31 -0
  70. womm/commands/project/create.py +128 -0
  71. womm/commands/project/setup.py +438 -0
  72. womm/commands/project/template.py +160 -0
  73. womm/commands/system/__init__.py +31 -0
  74. womm/commands/system/context/__init__.py +82 -0
  75. womm/commands/system/context/backup.py +344 -0
  76. womm/commands/system/context/inventory.py +111 -0
  77. womm/commands/system/context/registration.py +290 -0
  78. womm/commands/system/deps.py +165 -0
  79. womm/commands/system/system.py +130 -0
  80. womm/exceptions/__init__.py +69 -0
  81. womm/exceptions/common/__init__.py +55 -0
  82. womm/exceptions/common/command_service.py +91 -0
  83. womm/exceptions/common/file_service.py +60 -0
  84. womm/exceptions/common/security_service.py +44 -0
  85. womm/exceptions/common/validation_service.py +70 -0
  86. womm/exceptions/context/__init__.py +27 -0
  87. womm/exceptions/context/context_service.py +55 -0
  88. womm/exceptions/project/__init__.py +29 -0
  89. womm/exceptions/project/project_service.py +59 -0
  90. womm/exceptions/system/__init__.py +25 -0
  91. womm/exceptions/system/system_service.py +53 -0
  92. womm/interfaces/__init__.py +71 -0
  93. womm/interfaces/context/__init__.py +34 -0
  94. womm/interfaces/context/menu_interface.py +686 -0
  95. womm/interfaces/context/registry_interface.py +562 -0
  96. womm/interfaces/context/script_detector_interface.py +208 -0
  97. womm/interfaces/context/script_registrar.py +264 -0
  98. womm/interfaces/core/__init__.py +26 -0
  99. womm/interfaces/core/doctor_interface.py +102 -0
  100. womm/interfaces/dependencies/__init__.py +28 -0
  101. womm/interfaces/dependencies/deps_interface.py +160 -0
  102. womm/interfaces/project/__init__.py +36 -0
  103. womm/interfaces/project/create_interface.py +162 -0
  104. womm/interfaces/project/detection_interface.py +181 -0
  105. womm/interfaces/project/manager_interface.py +99 -0
  106. womm/interfaces/project/setup_interface.py +477 -0
  107. womm/interfaces/project/template_store_interface.py +196 -0
  108. womm/interfaces/system/__init__.py +32 -0
  109. womm/interfaces/system/detector_interface.py +84 -0
  110. womm/interfaces/system/environment_interface.py +110 -0
  111. womm/interfaces/system/path_interface.py +570 -0
  112. womm/services/__init__.py +70 -0
  113. womm/services/common/__init__.py +33 -0
  114. womm/services/common/base_validation_service.py +450 -0
  115. womm/services/common/command_runner_service.py +647 -0
  116. womm/services/common/file_scanner_service.py +483 -0
  117. womm/services/common/security_validator_service.py +348 -0
  118. womm/services/context/__init__.py +37 -0
  119. womm/services/context/backup_entries.py +148 -0
  120. womm/services/context/parameters.py +515 -0
  121. womm/services/context/registry_paths.py +56 -0
  122. womm/services/context/registry_service.py +573 -0
  123. womm/services/context/validation_service.py +691 -0
  124. womm/services/dependencies/__init__.py +29 -0
  125. womm/services/dependencies/probe.py +102 -0
  126. womm/services/project/__init__.py +48 -0
  127. womm/services/project/copier_project_creation_service.py +111 -0
  128. womm/services/project/destination_guard.py +96 -0
  129. womm/services/project/detection_service.py +354 -0
  130. womm/services/project/env_utils.py +333 -0
  131. womm/services/project/javascript_environment_service.py +348 -0
  132. womm/services/project/python_environment_service.py +245 -0
  133. womm/services/project/setup_profile_resolver.py +146 -0
  134. womm/services/project/template_store_service.py +344 -0
  135. womm/services/project/validation_service.py +418 -0
  136. womm/services/system/__init__.py +32 -0
  137. womm/services/system/detector_service.py +704 -0
  138. womm/services/system/environment_service.py +494 -0
  139. womm/services/system/path_service.py +642 -0
  140. womm/shared/__init__.py +30 -0
  141. womm/shared/configs/__init__.py +51 -0
  142. womm/shared/configs/context/__init__.py +43 -0
  143. womm/shared/configs/context/context_config.py +125 -0
  144. womm/shared/configs/context/context_file_types_config.py +159 -0
  145. womm/shared/configs/context/context_limits_config.py +187 -0
  146. womm/shared/configs/context/context_paths_config.py +115 -0
  147. womm/shared/configs/context/context_types_config.py +65 -0
  148. womm/shared/configs/context/script_config.py +219 -0
  149. womm/shared/configs/dependencies/__init__.py +32 -0
  150. womm/shared/configs/dependencies/runtime_config.py +46 -0
  151. womm/shared/configs/dependencies/runtime_package_manager_config.py +48 -0
  152. womm/shared/configs/logging_config.py +89 -0
  153. womm/shared/configs/project/__init__.py +33 -0
  154. womm/shared/configs/project/project_config.py +109 -0
  155. womm/shared/configs/project/project_structure_config.py +88 -0
  156. womm/shared/configs/project/python_project_config.py +165 -0
  157. womm/shared/configs/security/__init__.py +26 -0
  158. womm/shared/configs/security/security_patterns_config.py +242 -0
  159. womm/shared/configs/system/__init__.py +28 -0
  160. womm/shared/configs/system/system_detector_config.py +210 -0
  161. womm/shared/configs/system/system_environment_config.py +101 -0
  162. womm/shared/models/__init__.py +13 -0
  163. womm/shared/models/template_source.py +65 -0
  164. womm/shared/paths.py +192 -0
  165. womm/shared/results/__init__.py +138 -0
  166. womm/shared/results/base.py +85 -0
  167. womm/shared/results/command_results.py +61 -0
  168. womm/shared/results/context_results.py +345 -0
  169. womm/shared/results/dependency_results.py +110 -0
  170. womm/shared/results/doctor_results.py +41 -0
  171. womm/shared/results/file_results.py +97 -0
  172. womm/shared/results/project_results.py +163 -0
  173. womm/shared/results/security_results.py +128 -0
  174. womm/shared/results/system_results.py +268 -0
  175. womm/shared/results/template_results.py +43 -0
  176. womm/shared/runtime.py +36 -0
  177. womm/ui/__init__.py +31 -0
  178. womm/ui/common/__init__.py +39 -0
  179. womm/ui/common/interactive_menu.py +246 -0
  180. womm/ui/common/logging.py +184 -0
  181. womm/ui/common/prompts.py +93 -0
  182. womm/ui/context/__init__.py +31 -0
  183. womm/ui/context/display.py +485 -0
  184. womm/ui/context/menu_display.py +189 -0
  185. womm/ui/context/wizard.py +557 -0
  186. womm/ui/project/__init__.py +42 -0
  187. womm/ui/project/create/create_completion_summaries.py +55 -0
  188. womm/ui/project/project_wizard.py +174 -0
  189. womm/ui/project/setup/setup_completion_summaries.py +111 -0
  190. womm/ui/project/templates/template_store_display.py +128 -0
  191. womm/ui/system/__init__.py +60 -0
  192. womm/ui/system/display.py +531 -0
  193. womm/ui/system/path_display.py +387 -0
  194. womm/utils/__init__.py +23 -0
  195. womm/utils/common/__init__.py +49 -0
  196. womm/utils/common/file_scanner_utils.py +110 -0
  197. womm/utils/common/path_resolver_utils.py +127 -0
  198. womm/utils/common/safe_fs_utils.py +135 -0
  199. womm/utils/context/__init__.py +54 -0
  200. womm/utils/context/core_utils.py +345 -0
  201. womm/utils/context/icon_utils.py +259 -0
  202. womm/utils/project/__init__.py +106 -0
  203. womm/utils/project/asset_utils.py +154 -0
  204. womm/utils/project/core_utils.py +391 -0
  205. womm/utils/project/file_utils.py +494 -0
  206. womm/utils/project/platform_utils.py +170 -0
  207. womm/utils/project/validation_utils.py +273 -0
  208. womm/utils/security/__init__.py +46 -0
  209. womm/utils/security/security_validation_utils.py +258 -0
  210. womm/utils/system/__init__.py +69 -0
  211. womm/utils/system/detector_utils.py +299 -0
  212. womm/utils/system/environment_utils.py +172 -0
  213. womm/utils/system/path_utils.py +101 -0
  214. womm_cli-4.0.0.dist-info/METADATA +203 -0
  215. womm_cli-4.0.0.dist-info/RECORD +218 -0
  216. womm_cli-4.0.0.dist-info/WHEEL +4 -0
  217. womm_cli-4.0.0.dist-info/entry_points.txt +2 -0
  218. womm_cli-4.0.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,174 @@
1
+ #!/usr/bin/env python3
2
+ # ///////////////////////////////////////////////////////////////
3
+ # PROJECT WIZARD - Interactive Project Setup Wizard
4
+ # Project: works-on-my-machine
5
+ # ///////////////////////////////////////////////////////////////
6
+
7
+ """
8
+ Interactive wizard for configuring existing projects.
9
+
10
+ This module provides an interactive step-by-step wizard for the ``womm
11
+ setup`` command, letting users pick which development tools to configure
12
+ in an already-existing project directory.
13
+
14
+ Project *creation* (language/variant/file-structure selection) is handled
15
+ entirely by Copier templates (see ``womm create``/``womm template``); this
16
+ wizard no longer has a scaffolding role.
17
+ """
18
+
19
+ from __future__ import annotations
20
+
21
+ # ///////////////////////////////////////////////////////////////
22
+ # IMPORTS
23
+ # ///////////////////////////////////////////////////////////////
24
+ # Standard library imports
25
+ from pathlib import Path
26
+
27
+ try:
28
+ from InquirerPy import inquirer
29
+
30
+ INQUIRERPY_AVAILABLE = True
31
+ except ImportError:
32
+ INQUIRERPY_AVAILABLE = False
33
+
34
+ # Local imports
35
+ from ..common.logging import ezprinter
36
+
37
+ # ///////////////////////////////////////////////////////////////
38
+ # CLASSES
39
+ # ///////////////////////////////////////////////////////////////
40
+
41
+
42
+ class ProjectWizard:
43
+ """Interactive wizard for configuring existing projects."""
44
+
45
+ @staticmethod
46
+ def run_interactive_setup_for_existing_project(
47
+ project_type: str, project_path: Path
48
+ ) -> dict[str, str | bool | int | dict[str, str | bool]] | None:
49
+ """
50
+ Run interactive setup wizard for an existing project.
51
+
52
+ Args:
53
+ project_type: Type of the existing project
54
+ project_path: Path to the existing project
55
+
56
+ Returns:
57
+ Setup configuration dictionary or None if cancelled
58
+ """
59
+ ezprinter.info(f"🔧 Interactive Setup for {project_type.title()} Project")
60
+ ezprinter.info("=" * 40)
61
+ ezprinter.info(f"Project path: {project_path.absolute()}")
62
+
63
+ # Configure setup options
64
+ setup_options = ProjectWizard._configure_setup_options(project_type)
65
+
66
+ # Confirm setup
67
+ if not ProjectWizard._confirm_setup(project_type, project_path, setup_options):
68
+ return None
69
+
70
+ # Return setup configuration
71
+ return {
72
+ "project_type": project_type,
73
+ "project_path": str(project_path),
74
+ "options": setup_options,
75
+ }
76
+
77
+ @staticmethod
78
+ def _configure_setup_options(
79
+ _project_type: str,
80
+ ) -> dict[str, str | bool]:
81
+ """Configure setup-specific options for an existing project."""
82
+ options = {}
83
+
84
+ if INQUIRERPY_AVAILABLE:
85
+ # Common setup options
86
+ options["virtual_env"] = inquirer.confirm(
87
+ message="Create virtual environment?",
88
+ default=False,
89
+ ).execute()
90
+
91
+ options["install_deps"] = inquirer.confirm(
92
+ message="Install dependencies?",
93
+ default=True,
94
+ ).execute()
95
+
96
+ options["setup_dev_tools"] = inquirer.confirm(
97
+ message="Setup development tools (linting, formatting, etc.)?",
98
+ default=True,
99
+ ).execute()
100
+
101
+ options["setup_git_hooks"] = inquirer.confirm(
102
+ message="Setup Git hooks?",
103
+ default=True,
104
+ ).execute()
105
+
106
+ else:
107
+ # Fallback to simple input
108
+ virtual_env = input("Create virtual environment? (y/N): ").strip().lower()
109
+ options["virtual_env"] = virtual_env in ["y", "yes"]
110
+
111
+ install_deps = input("Install dependencies? (Y/n): ").strip().lower()
112
+ options["install_deps"] = install_deps in ["", "y", "yes"]
113
+
114
+ setup_dev_tools = input("Setup development tools? (Y/n): ").strip().lower()
115
+ options["setup_dev_tools"] = setup_dev_tools in ["", "y", "yes"]
116
+
117
+ setup_git_hooks = input("Setup Git hooks? (Y/n): ").strip().lower()
118
+ options["setup_git_hooks"] = setup_git_hooks in ["", "y", "yes"]
119
+
120
+ return options
121
+
122
+ @staticmethod
123
+ def _confirm_setup(
124
+ project_type: str, project_path: Path, options: dict[str, str | bool]
125
+ ) -> bool:
126
+ """Confirm setup configuration with a Rich panel."""
127
+ from rich.console import Console
128
+ from rich.table import Table
129
+
130
+ console = Console()
131
+
132
+ # Create a table for the setup configuration summary
133
+ table = Table(
134
+ title="🔧 Setup Configuration Summary",
135
+ show_header=True,
136
+ header_style="bold blue",
137
+ )
138
+ table.add_column("Property", style="cyan", no_wrap=True)
139
+ table.add_column("Value", style="white")
140
+
141
+ table.add_row("Project type", project_type.title())
142
+ table.add_row("Project path", str(project_path.absolute()))
143
+ table.add_row(
144
+ "Virtual environment", "Yes" if options.get("virtual_env") else "No"
145
+ )
146
+ table.add_row(
147
+ "Install dependencies", "Yes" if options.get("install_deps") else "No"
148
+ )
149
+ table.add_row(
150
+ "Setup dev tools", "Yes" if options.get("setup_dev_tools") else "No"
151
+ )
152
+ table.add_row(
153
+ "Setup Git hooks", "Yes" if options.get("setup_git_hooks") else "No"
154
+ )
155
+
156
+ console.print("")
157
+ console.print(table)
158
+ console.print("")
159
+
160
+ if INQUIRERPY_AVAILABLE:
161
+ return inquirer.confirm(
162
+ message="Proceed with setup?",
163
+ default=True,
164
+ ).execute()
165
+ else:
166
+ confirm = input("Proceed with setup? (Y/n): ").strip().lower()
167
+ return confirm in ["", "y", "yes"]
168
+
169
+
170
+ # ///////////////////////////////////////////////////////////////
171
+ # PUBLIC API
172
+ # ///////////////////////////////////////////////////////////////
173
+
174
+ __all__ = ["ProjectWizard"]
@@ -0,0 +1,111 @@
1
+ #!/usr/bin/env python3
2
+ # ///////////////////////////////////////////////////////////////
3
+ # SETUP SUMMARIES - Project Setup Completion Summaries
4
+ # Project: works-on-my-machine
5
+ # ///////////////////////////////////////////////////////////////
6
+
7
+ """
8
+ Setup completion summaries for existing projects.
9
+
10
+ This module provides UI components for displaying completion summaries
11
+ after setting up existing projects, following the established patterns in the WOMM codebase.
12
+ """
13
+
14
+ from __future__ import annotations
15
+
16
+ # ///////////////////////////////////////////////////////////////
17
+ # IMPORTS
18
+ # ///////////////////////////////////////////////////////////////
19
+ # Standard library imports
20
+ from pathlib import Path
21
+
22
+ # Third-party imports
23
+ from rich.panel import Panel
24
+
25
+ # Local imports
26
+ from ....shared.results import ProjectSetupResult
27
+ from ...common.logging import ezconsole, ezprinter
28
+
29
+ # ///////////////////////////////////////////////////////////////
30
+ # FUNCTIONS
31
+ # ///////////////////////////////////////////////////////////////
32
+
33
+
34
+ def print_setup_completion_summary(
35
+ project_path: Path,
36
+ project_type: str,
37
+ virtual_env: bool = False,
38
+ install_deps: bool = False,
39
+ setup_dev_tools: bool = False,
40
+ setup_git_hooks: bool = False,
41
+ ) -> None:
42
+ """
43
+ Print a completion summary for project setup.
44
+
45
+ Args:
46
+ project_path: Path to the project
47
+ project_type: Type of project (python, javascript, react, vue)
48
+ virtual_env: Whether virtual environment was set up
49
+ install_deps: Whether dependencies were installed
50
+ setup_dev_tools: Whether development tools were configured
51
+ setup_git_hooks: Whether Git hooks were set up
52
+ """
53
+ completed = [
54
+ label
55
+ for enabled, label in (
56
+ (virtual_env, "Virtual environment setup"),
57
+ (install_deps, "Dependencies installed"),
58
+ (setup_dev_tools, "Development tools configured"),
59
+ (setup_git_hooks, "Git hooks configured"),
60
+ )
61
+ if enabled
62
+ ]
63
+ content = f"📁 Project location: {project_path}\n📋 Project type: {project_type}"
64
+ if completed:
65
+ content += "\n\n🔧 Configuration completed:\n"
66
+ content += "\n".join(f" • {label}" for label in completed)
67
+
68
+ content += "\n\n🚀 Next steps:\n"
69
+ if (project_path / "README.md").is_file():
70
+ content += "Read the project's README.md for setup and usage instructions.\n"
71
+ content += "Check the project configuration for available development commands."
72
+
73
+ title = {
74
+ "python": "🔧 Python Project Setup Completed!",
75
+ "javascript": "🔧 JavaScript Project Setup Completed!",
76
+ "node": "🔧 JavaScript Project Setup Completed!",
77
+ "react": "🔧 JavaScript Project Setup Completed!",
78
+ "vue": "🔧 JavaScript Project Setup Completed!",
79
+ }.get(project_type, "🔧 Project Setup Completed!")
80
+ ezconsole.print("")
81
+ ezconsole.print(
82
+ Panel(
83
+ content, title=title, border_style="bright_blue", width=80, padding=(1, 1)
84
+ )
85
+ )
86
+
87
+
88
+ def print_project_setup_result(result: ProjectSetupResult) -> None:
89
+ """Render a successful project-setup result for the CLI."""
90
+ project_path = result.project_path
91
+ if project_path is None:
92
+ return
93
+
94
+ configured_tools = result.tools_configured or []
95
+ print_setup_completion_summary(
96
+ project_path,
97
+ result.project_type,
98
+ virtual_env="venv" in configured_tools,
99
+ install_deps="dependencies" in configured_tools,
100
+ setup_dev_tools="dev_tools" in configured_tools,
101
+ setup_git_hooks="git_hooks" in configured_tools,
102
+ )
103
+ for warning in result.warnings or []:
104
+ ezprinter.warning(warning)
105
+
106
+
107
+ # ///////////////////////////////////////////////////////////////
108
+ # PUBLIC API
109
+ # ///////////////////////////////////////////////////////////////
110
+
111
+ __all__ = ["print_project_setup_result", "print_setup_completion_summary"]
@@ -0,0 +1,128 @@
1
+ #!/usr/bin/env python3
2
+ # ///////////////////////////////////////////////////////////////
3
+ # TEMPLATE STORE DISPLAY - Template Catalog Rendering
4
+ # Project: works-on-my-machine
5
+ # ///////////////////////////////////////////////////////////////
6
+
7
+ """
8
+ Rendering for the template catalog.
9
+
10
+ This module renders the outcome of ``TemplateStoreInterface`` operations for
11
+ the CLI, following the established rendering pattern used by ``path``,
12
+ ``context``, ``deps`` and ``doctor``: a table for a list of entries, a panel
13
+ for a single entry, and an error message on failure.
14
+ """
15
+
16
+ from __future__ import annotations
17
+
18
+ # ///////////////////////////////////////////////////////////////
19
+ # IMPORTS
20
+ # ///////////////////////////////////////////////////////////////
21
+ # Third-party imports
22
+ from rich.panel import Panel
23
+
24
+ # Local imports
25
+ from ....shared.models.template_source import TemplateEntry
26
+ from ....shared.results.template_results import TemplateListResult, TemplateStoreResult
27
+ from ...common.logging import ezconsole, ezprinter
28
+
29
+ # ///////////////////////////////////////////////////////////////
30
+ # HELPERS
31
+ # ///////////////////////////////////////////////////////////////
32
+
33
+
34
+ def _entry_panel(entry: TemplateEntry, *, verbose: bool) -> Panel:
35
+ """Build a Rich panel describing a single template entry.
36
+
37
+ Args:
38
+ entry: Template entry to describe.
39
+ verbose: Whether to also show the source path.
40
+
41
+ Returns:
42
+ Panel: A bordered panel ready to print.
43
+ """
44
+ lines = [
45
+ f"[b]Identifier:[/b] {entry.qualified_id}",
46
+ f"[b]Origin:[/b] {entry.origin.value}",
47
+ f"[b]Version:[/b] {entry.version or 'unknown'}",
48
+ f"[b]Description:[/b] {entry.description or 'No description'}",
49
+ ]
50
+ if verbose:
51
+ lines.append(f"[b]Source:[/b] {entry.source}")
52
+
53
+ return Panel(
54
+ "\n".join(lines),
55
+ title=f"Template: {entry.qualified_id}",
56
+ border_style="blue",
57
+ padding=(1, 1),
58
+ )
59
+
60
+
61
+ # ///////////////////////////////////////////////////////////////
62
+ # DISPLAY FUNCTIONS
63
+ # ///////////////////////////////////////////////////////////////
64
+
65
+
66
+ def render_template_list(result: TemplateListResult, *, verbose: bool = False) -> None:
67
+ """Render the outcome of ``TemplateStoreInterface.list_templates``.
68
+
69
+ Args:
70
+ result: Outcome returned by ``TemplateStoreInterface.list_templates``.
71
+ verbose: Whether to also show the source path of every entry.
72
+ """
73
+ if not result.success:
74
+ ezprinter.error(result.error or "Failed to list templates")
75
+ return
76
+
77
+ entries = result.entries or []
78
+ ezprinter.success(result.message or f"{len(entries)} template(s) available")
79
+
80
+ if not entries:
81
+ ezprinter.console.print("")
82
+ ezprinter.system("No template registered")
83
+ return
84
+
85
+ columns: list[str] | list[tuple[str, str | None, bool]] = [
86
+ ("Identifier", "cyan", False),
87
+ ("Version", "yellow", True),
88
+ ("Description", "white", False),
89
+ ]
90
+ if verbose:
91
+ columns.append(("Source", "green", False))
92
+
93
+ table = ezprinter.create_table(title="Template Catalog", columns=columns)
94
+ for entry in entries:
95
+ row = [entry.qualified_id, entry.version or "-", entry.description or "-"]
96
+ if verbose:
97
+ row.append(str(entry.source))
98
+ table.add_row(*row)
99
+
100
+ ezprinter.console.print("")
101
+ ezprinter.console.print(table)
102
+
103
+
104
+ def render_template_result(
105
+ result: TemplateStoreResult, *, verbose: bool = False
106
+ ) -> None:
107
+ """Render the outcome of a single-template operation.
108
+
109
+ Args:
110
+ result: Outcome returned by ``show_template``, ``add_template``,
111
+ ``remove_template`` or ``update_template``.
112
+ verbose: Whether to also show the source path in the panel.
113
+ """
114
+ if not result.success:
115
+ ezprinter.error(result.error or "Template operation failed")
116
+ return
117
+
118
+ ezprinter.success(result.message or "Template operation succeeded")
119
+ if result.entry is not None:
120
+ ezconsole.print("")
121
+ ezconsole.print(_entry_panel(result.entry, verbose=verbose))
122
+
123
+
124
+ # ///////////////////////////////////////////////////////////////
125
+ # PUBLIC API
126
+ # ///////////////////////////////////////////////////////////////
127
+
128
+ __all__ = ["render_template_list", "render_template_result"]
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env python3
2
+ # ///////////////////////////////////////////////////////////////
3
+ # UI SYSTEM - System UI Components
4
+ # Project: works-on-my-machine
5
+ # ///////////////////////////////////////////////////////////////
6
+
7
+ """
8
+ System UI components for Works On My Machine.
9
+
10
+ This module provides UI components for system operations,
11
+ including system detection displays.
12
+ """
13
+
14
+ from __future__ import annotations
15
+
16
+ # ///////////////////////////////////////////////////////////////
17
+ # IMPORTS
18
+ # ///////////////////////////////////////////////////////////////
19
+ # Local imports
20
+ from .display import (
21
+ display_available_managers,
22
+ display_best_manager,
23
+ display_system_detection_results,
24
+ display_system_managers_list,
25
+ render_deps_check_result,
26
+ render_deps_inventory_result,
27
+ render_deps_status_result,
28
+ render_doctor_result,
29
+ render_environment_refresh_result,
30
+ render_system_detection_result,
31
+ )
32
+ from .path_display import (
33
+ render_path_backup_content_result,
34
+ render_path_backup_list_result,
35
+ render_path_backup_result,
36
+ render_path_entries_result,
37
+ render_path_operation_result,
38
+ )
39
+
40
+ # ///////////////////////////////////////////////////////////////
41
+ # PUBLIC API
42
+ # ///////////////////////////////////////////////////////////////
43
+
44
+ __all__ = [
45
+ "display_available_managers",
46
+ "display_best_manager",
47
+ "display_system_detection_results",
48
+ "display_system_managers_list",
49
+ "render_deps_check_result",
50
+ "render_deps_inventory_result",
51
+ "render_deps_status_result",
52
+ "render_doctor_result",
53
+ "render_environment_refresh_result",
54
+ "render_path_backup_content_result",
55
+ "render_path_backup_list_result",
56
+ "render_path_backup_result",
57
+ "render_path_entries_result",
58
+ "render_path_operation_result",
59
+ "render_system_detection_result",
60
+ ]