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.
- womm/__init__.py +53 -0
- womm/__main__.py +48 -0
- womm/_version.py +10 -0
- womm/assets/copier/meta/copier.yml +15 -0
- womm/assets/copier/meta/template/README.md.jinja +32 -0
- womm/assets/copier/meta/template/copier.yml.jinja +13 -0
- womm/assets/copier/meta/template/template/.gitkeep +0 -0
- womm/assets/copier/official/javascript/copier.yml +104 -0
- womm/assets/copier/official/javascript/template/.gitignore.jinja +35 -0
- womm/assets/copier/official/javascript/template/.nvmrc.jinja +1 -0
- womm/assets/copier/official/javascript/template/.prettierignore.jinja +10 -0
- womm/assets/copier/official/javascript/template/README.md.jinja +81 -0
- womm/assets/copier/official/javascript/template/biome.json.jinja +54 -0
- womm/assets/copier/official/javascript/template/eslint.config.mjs.jinja +51 -0
- womm/assets/copier/official/javascript/template/index.html.jinja +12 -0
- womm/assets/copier/official/javascript/template/package.json.jinja +88 -0
- womm/assets/copier/official/javascript/template/prettier.config.mjs.jinja +8 -0
- womm/assets/copier/official/javascript/template/src/App.jsx.jinja +10 -0
- womm/assets/copier/official/javascript/template/src/App.tsx.jinja +10 -0
- womm/assets/copier/official/javascript/template/src/App.vue.jinja +18 -0
- womm/assets/copier/official/javascript/template/src/index.jsx.jinja +10 -0
- womm/assets/copier/official/javascript/template/src/index.tsx.jinja +11 -0
- womm/assets/copier/official/javascript/template/src/main.js.jinja +21 -0
- womm/assets/copier/official/javascript/template/src/main.ts.jinja +21 -0
- womm/assets/copier/official/javascript/template/tsconfig.json.jinja +35 -0
- womm/assets/copier/official/javascript/template/vite.config.mjs.jinja +10 -0
- womm/assets/copier/official/javascript/template/{% if with_ci %}.github{% endif %}/workflows/ci.yml.jinja +63 -0
- womm/assets/copier/official/javascript/template/{% if with_tests %}tests{% endif %}/smoke.test.js.jinja +12 -0
- womm/assets/copier/official/javascript/template/{% if with_tests %}tests{% endif %}/smoke.test.ts.jinja +12 -0
- womm/assets/copier/official/javascript/template/{% if with_vscode %}.vscode{% endif %}/extensions.json.jinja +4 -0
- womm/assets/copier/official/javascript/template/{% if with_vscode %}.vscode{% endif %}/settings.json.jinja +27 -0
- womm/assets/copier/official/python/copier.yml +107 -0
- womm/assets/copier/official/python/template/.gitignore.jinja +40 -0
- womm/assets/copier/official/python/template/.pre-commit-config.yaml.jinja +19 -0
- womm/assets/copier/official/python/template/.python-version.jinja +1 -0
- womm/assets/copier/official/python/template/README.md.jinja +83 -0
- womm/assets/copier/official/python/template/pyproject.toml.jinja +114 -0
- womm/assets/copier/official/python/template/{% if framework == 'django' %}manage.py{% endif %}.jinja +23 -0
- womm/assets/copier/official/python/template/{% if not use_src_layout %}{{ package_name }}{% endif %}/__init__.py.jinja +3 -0
- womm/assets/copier/official/python/template/{% if not use_src_layout %}{{ package_name }}{% endif %}/asgi.py.jinja +9 -0
- womm/assets/copier/official/python/template/{% if not use_src_layout %}{{ package_name }}{% endif %}/core/__init__.py.jinja +0 -0
- womm/assets/copier/official/python/template/{% if not use_src_layout %}{{ package_name }}{% endif %}/core/apps.py.jinja +10 -0
- womm/assets/copier/official/python/template/{% if not use_src_layout %}{{ package_name }}{% endif %}/core/models.py.jinja +1 -0
- womm/assets/copier/official/python/template/{% if not use_src_layout %}{{ package_name }}{% endif %}/core/views.py.jinja +8 -0
- womm/assets/copier/official/python/template/{% if not use_src_layout %}{{ package_name }}{% endif %}/py.typed +0 -0
- womm/assets/copier/official/python/template/{% if not use_src_layout %}{{ package_name }}{% endif %}/settings.py.jinja +81 -0
- womm/assets/copier/official/python/template/{% if not use_src_layout %}{{ package_name }}{% endif %}/urls.py.jinja +11 -0
- womm/assets/copier/official/python/template/{% if not use_src_layout %}{{ package_name }}{% endif %}/wsgi.py.jinja +9 -0
- womm/assets/copier/official/python/template/{% if use_src_layout %}src{% endif %}/{{ package_name }}/__init__.py.jinja +3 -0
- womm/assets/copier/official/python/template/{% if use_src_layout %}src{% endif %}/{{ package_name }}/asgi.py.jinja +9 -0
- womm/assets/copier/official/python/template/{% if use_src_layout %}src{% endif %}/{{ package_name }}/core/__init__.py.jinja +0 -0
- womm/assets/copier/official/python/template/{% if use_src_layout %}src{% endif %}/{{ package_name }}/core/apps.py.jinja +10 -0
- womm/assets/copier/official/python/template/{% if use_src_layout %}src{% endif %}/{{ package_name }}/core/models.py.jinja +1 -0
- womm/assets/copier/official/python/template/{% if use_src_layout %}src{% endif %}/{{ package_name }}/core/views.py.jinja +8 -0
- womm/assets/copier/official/python/template/{% if use_src_layout %}src{% endif %}/{{ package_name }}/py.typed +0 -0
- womm/assets/copier/official/python/template/{% if use_src_layout %}src{% endif %}/{{ package_name }}/settings.py.jinja +81 -0
- womm/assets/copier/official/python/template/{% if use_src_layout %}src{% endif %}/{{ package_name }}/urls.py.jinja +11 -0
- womm/assets/copier/official/python/template/{% if use_src_layout %}src{% endif %}/{{ package_name }}/wsgi.py.jinja +9 -0
- womm/assets/copier/official/python/template/{% if with_ci %}.github{% endif %}/workflows/ci.yml.jinja +78 -0
- womm/assets/copier/official/python/template/{% if with_tests %}tests{% endif %}/test_smoke.py.jinja +16 -0
- womm/assets/copier/official/python/template/{% if with_vscode %}.vscode{% endif %}/extensions.json.jinja +8 -0
- womm/assets/copier/official/python/template/{% if with_vscode %}.vscode{% endif %}/settings.json.jinja +28 -0
- womm/bin/refresh_env.cmd +130 -0
- womm/cli.py +111 -0
- womm/commands/__init__.py +30 -0
- womm/commands/core/__init__.py +29 -0
- womm/commands/core/doctor.py +52 -0
- womm/commands/core/path.py +337 -0
- womm/commands/project/__init__.py +31 -0
- womm/commands/project/create.py +128 -0
- womm/commands/project/setup.py +438 -0
- womm/commands/project/template.py +160 -0
- womm/commands/system/__init__.py +31 -0
- womm/commands/system/context/__init__.py +82 -0
- womm/commands/system/context/backup.py +344 -0
- womm/commands/system/context/inventory.py +111 -0
- womm/commands/system/context/registration.py +290 -0
- womm/commands/system/deps.py +165 -0
- womm/commands/system/system.py +130 -0
- womm/exceptions/__init__.py +69 -0
- womm/exceptions/common/__init__.py +55 -0
- womm/exceptions/common/command_service.py +91 -0
- womm/exceptions/common/file_service.py +60 -0
- womm/exceptions/common/security_service.py +44 -0
- womm/exceptions/common/validation_service.py +70 -0
- womm/exceptions/context/__init__.py +27 -0
- womm/exceptions/context/context_service.py +55 -0
- womm/exceptions/project/__init__.py +29 -0
- womm/exceptions/project/project_service.py +59 -0
- womm/exceptions/system/__init__.py +25 -0
- womm/exceptions/system/system_service.py +53 -0
- womm/interfaces/__init__.py +71 -0
- womm/interfaces/context/__init__.py +34 -0
- womm/interfaces/context/menu_interface.py +686 -0
- womm/interfaces/context/registry_interface.py +562 -0
- womm/interfaces/context/script_detector_interface.py +208 -0
- womm/interfaces/context/script_registrar.py +264 -0
- womm/interfaces/core/__init__.py +26 -0
- womm/interfaces/core/doctor_interface.py +102 -0
- womm/interfaces/dependencies/__init__.py +28 -0
- womm/interfaces/dependencies/deps_interface.py +160 -0
- womm/interfaces/project/__init__.py +36 -0
- womm/interfaces/project/create_interface.py +162 -0
- womm/interfaces/project/detection_interface.py +181 -0
- womm/interfaces/project/manager_interface.py +99 -0
- womm/interfaces/project/setup_interface.py +477 -0
- womm/interfaces/project/template_store_interface.py +196 -0
- womm/interfaces/system/__init__.py +32 -0
- womm/interfaces/system/detector_interface.py +84 -0
- womm/interfaces/system/environment_interface.py +110 -0
- womm/interfaces/system/path_interface.py +570 -0
- womm/services/__init__.py +70 -0
- womm/services/common/__init__.py +33 -0
- womm/services/common/base_validation_service.py +450 -0
- womm/services/common/command_runner_service.py +647 -0
- womm/services/common/file_scanner_service.py +483 -0
- womm/services/common/security_validator_service.py +348 -0
- womm/services/context/__init__.py +37 -0
- womm/services/context/backup_entries.py +148 -0
- womm/services/context/parameters.py +515 -0
- womm/services/context/registry_paths.py +56 -0
- womm/services/context/registry_service.py +573 -0
- womm/services/context/validation_service.py +691 -0
- womm/services/dependencies/__init__.py +29 -0
- womm/services/dependencies/probe.py +102 -0
- womm/services/project/__init__.py +48 -0
- womm/services/project/copier_project_creation_service.py +111 -0
- womm/services/project/destination_guard.py +96 -0
- womm/services/project/detection_service.py +354 -0
- womm/services/project/env_utils.py +333 -0
- womm/services/project/javascript_environment_service.py +348 -0
- womm/services/project/python_environment_service.py +245 -0
- womm/services/project/setup_profile_resolver.py +146 -0
- womm/services/project/template_store_service.py +344 -0
- womm/services/project/validation_service.py +418 -0
- womm/services/system/__init__.py +32 -0
- womm/services/system/detector_service.py +704 -0
- womm/services/system/environment_service.py +494 -0
- womm/services/system/path_service.py +642 -0
- womm/shared/__init__.py +30 -0
- womm/shared/configs/__init__.py +51 -0
- womm/shared/configs/context/__init__.py +43 -0
- womm/shared/configs/context/context_config.py +125 -0
- womm/shared/configs/context/context_file_types_config.py +159 -0
- womm/shared/configs/context/context_limits_config.py +187 -0
- womm/shared/configs/context/context_paths_config.py +115 -0
- womm/shared/configs/context/context_types_config.py +65 -0
- womm/shared/configs/context/script_config.py +219 -0
- womm/shared/configs/dependencies/__init__.py +32 -0
- womm/shared/configs/dependencies/runtime_config.py +46 -0
- womm/shared/configs/dependencies/runtime_package_manager_config.py +48 -0
- womm/shared/configs/logging_config.py +89 -0
- womm/shared/configs/project/__init__.py +33 -0
- womm/shared/configs/project/project_config.py +109 -0
- womm/shared/configs/project/project_structure_config.py +88 -0
- womm/shared/configs/project/python_project_config.py +165 -0
- womm/shared/configs/security/__init__.py +26 -0
- womm/shared/configs/security/security_patterns_config.py +242 -0
- womm/shared/configs/system/__init__.py +28 -0
- womm/shared/configs/system/system_detector_config.py +210 -0
- womm/shared/configs/system/system_environment_config.py +101 -0
- womm/shared/models/__init__.py +13 -0
- womm/shared/models/template_source.py +65 -0
- womm/shared/paths.py +192 -0
- womm/shared/results/__init__.py +138 -0
- womm/shared/results/base.py +85 -0
- womm/shared/results/command_results.py +61 -0
- womm/shared/results/context_results.py +345 -0
- womm/shared/results/dependency_results.py +110 -0
- womm/shared/results/doctor_results.py +41 -0
- womm/shared/results/file_results.py +97 -0
- womm/shared/results/project_results.py +163 -0
- womm/shared/results/security_results.py +128 -0
- womm/shared/results/system_results.py +268 -0
- womm/shared/results/template_results.py +43 -0
- womm/shared/runtime.py +36 -0
- womm/ui/__init__.py +31 -0
- womm/ui/common/__init__.py +39 -0
- womm/ui/common/interactive_menu.py +246 -0
- womm/ui/common/logging.py +184 -0
- womm/ui/common/prompts.py +93 -0
- womm/ui/context/__init__.py +31 -0
- womm/ui/context/display.py +485 -0
- womm/ui/context/menu_display.py +189 -0
- womm/ui/context/wizard.py +557 -0
- womm/ui/project/__init__.py +42 -0
- womm/ui/project/create/create_completion_summaries.py +55 -0
- womm/ui/project/project_wizard.py +174 -0
- womm/ui/project/setup/setup_completion_summaries.py +111 -0
- womm/ui/project/templates/template_store_display.py +128 -0
- womm/ui/system/__init__.py +60 -0
- womm/ui/system/display.py +531 -0
- womm/ui/system/path_display.py +387 -0
- womm/utils/__init__.py +23 -0
- womm/utils/common/__init__.py +49 -0
- womm/utils/common/file_scanner_utils.py +110 -0
- womm/utils/common/path_resolver_utils.py +127 -0
- womm/utils/common/safe_fs_utils.py +135 -0
- womm/utils/context/__init__.py +54 -0
- womm/utils/context/core_utils.py +345 -0
- womm/utils/context/icon_utils.py +259 -0
- womm/utils/project/__init__.py +106 -0
- womm/utils/project/asset_utils.py +154 -0
- womm/utils/project/core_utils.py +391 -0
- womm/utils/project/file_utils.py +494 -0
- womm/utils/project/platform_utils.py +170 -0
- womm/utils/project/validation_utils.py +273 -0
- womm/utils/security/__init__.py +46 -0
- womm/utils/security/security_validation_utils.py +258 -0
- womm/utils/system/__init__.py +69 -0
- womm/utils/system/detector_utils.py +299 -0
- womm/utils/system/environment_utils.py +172 -0
- womm/utils/system/path_utils.py +101 -0
- womm_cli-4.0.0.dist-info/METADATA +203 -0
- womm_cli-4.0.0.dist-info/RECORD +218 -0
- womm_cli-4.0.0.dist-info/WHEEL +4 -0
- womm_cli-4.0.0.dist-info/entry_points.txt +2 -0
- 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
|
+
]
|