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,531 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# ///////////////////////////////////////////////////////////////
|
|
3
|
+
# SYSTEM DISPLAY - System UI Display Functions
|
|
4
|
+
# Project: works-on-my-machine
|
|
5
|
+
# ///////////////////////////////////////////////////////////////
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
System display functions for Works On My Machine.
|
|
9
|
+
|
|
10
|
+
Provides display functions for system detection results and information.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
# ///////////////////////////////////////////////////////////////
|
|
16
|
+
# IMPORTS
|
|
17
|
+
# ///////////////////////////////////////////////////////////////
|
|
18
|
+
# Third-party imports
|
|
19
|
+
from rich.panel import Panel
|
|
20
|
+
from rich.table import Table
|
|
21
|
+
|
|
22
|
+
# Local imports
|
|
23
|
+
from ...shared.configs.dependencies import (
|
|
24
|
+
RuntimeConfig,
|
|
25
|
+
RuntimePackageManagerConfig,
|
|
26
|
+
)
|
|
27
|
+
from ...shared.results import (
|
|
28
|
+
DependencyCheckResult,
|
|
29
|
+
DependencyInventoryResult,
|
|
30
|
+
DependencyProbe,
|
|
31
|
+
DependencyStatusResult,
|
|
32
|
+
DoctorResult,
|
|
33
|
+
EnvironmentRefreshResult,
|
|
34
|
+
SystemDetectionResult,
|
|
35
|
+
)
|
|
36
|
+
from ..common import ezconsole, ezprinter
|
|
37
|
+
|
|
38
|
+
# ///////////////////////////////////////////////////////////////
|
|
39
|
+
# PANEL HELPERS
|
|
40
|
+
# ///////////////////////////////////////////////////////////////
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _show_panel(content: str, title: str, border_style: str) -> None:
|
|
44
|
+
"""Print a bordered panel using the shared WOMM panel styling.
|
|
45
|
+
|
|
46
|
+
Args:
|
|
47
|
+
content: Body text of the panel.
|
|
48
|
+
title: Panel title.
|
|
49
|
+
border_style: Rich colour name; also drives the ``bright_`` body style.
|
|
50
|
+
"""
|
|
51
|
+
panel = Panel(
|
|
52
|
+
content,
|
|
53
|
+
title=title,
|
|
54
|
+
border_style=border_style,
|
|
55
|
+
style=f"bright_{border_style}",
|
|
56
|
+
padding=(1, 1),
|
|
57
|
+
width=80,
|
|
58
|
+
)
|
|
59
|
+
ezconsole.print("")
|
|
60
|
+
ezconsole.print(panel)
|
|
61
|
+
ezconsole.print("")
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
# ///////////////////////////////////////////////////////////////
|
|
65
|
+
# DISPLAY FUNCTIONS
|
|
66
|
+
# ///////////////////////////////////////////////////////////////
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def display_system_managers_list(status: dict, verbose: bool = False) -> None:
|
|
70
|
+
"""
|
|
71
|
+
Display all system package managers and their status in a table.
|
|
72
|
+
|
|
73
|
+
Args:
|
|
74
|
+
status: Dictionary of manager status information from get_installation_status()
|
|
75
|
+
verbose: Whether to show additional details (priority column)
|
|
76
|
+
"""
|
|
77
|
+
table = Table(title="System Package Managers", show_header=True)
|
|
78
|
+
table.add_column("Manager", style="cyan", no_wrap=True)
|
|
79
|
+
table.add_column("Available", style="green", justify="center")
|
|
80
|
+
table.add_column("Version", style="yellow")
|
|
81
|
+
table.add_column("Platform", style="blue")
|
|
82
|
+
|
|
83
|
+
if verbose:
|
|
84
|
+
table.add_column("Priority", style="magenta", justify="center")
|
|
85
|
+
|
|
86
|
+
for name, info in status.items():
|
|
87
|
+
if info["supported_on_current_platform"]:
|
|
88
|
+
row = [
|
|
89
|
+
name,
|
|
90
|
+
"✓" if info["available"] else "✗",
|
|
91
|
+
info["version"] or "N/A",
|
|
92
|
+
info["platform"],
|
|
93
|
+
]
|
|
94
|
+
|
|
95
|
+
if verbose:
|
|
96
|
+
row.append(str(info.get("priority", "N/A")))
|
|
97
|
+
|
|
98
|
+
table.add_row(*row)
|
|
99
|
+
|
|
100
|
+
ezconsole.print(table)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def display_available_managers(results: dict, verbose: bool = False) -> None:
|
|
104
|
+
"""
|
|
105
|
+
Display available package managers from detection results.
|
|
106
|
+
|
|
107
|
+
Args:
|
|
108
|
+
results: Dictionary of package manager results from detect_available_managers()
|
|
109
|
+
verbose: Whether to show detailed information about each manager
|
|
110
|
+
"""
|
|
111
|
+
available = [name for name, res in results.items() if res.success]
|
|
112
|
+
|
|
113
|
+
if available:
|
|
114
|
+
ezprinter.tip(f"Available managers: {', '.join(available)}")
|
|
115
|
+
|
|
116
|
+
if verbose:
|
|
117
|
+
ezprinter.info("\nDetails:")
|
|
118
|
+
for name in available:
|
|
119
|
+
res = results[name]
|
|
120
|
+
ezprinter.info(f" • {name}: v{res.version} (priority: {res.priority})")
|
|
121
|
+
else:
|
|
122
|
+
ezprinter.warning("No system package managers detected")
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def display_best_manager(
|
|
126
|
+
manager_name: str | None,
|
|
127
|
+
version: str | None = None,
|
|
128
|
+
platform: str | None = None,
|
|
129
|
+
priority: int | None = None,
|
|
130
|
+
verbose: bool = False,
|
|
131
|
+
) -> None:
|
|
132
|
+
"""
|
|
133
|
+
Display the best available package manager.
|
|
134
|
+
|
|
135
|
+
Args:
|
|
136
|
+
manager_name: Name of the best manager or None if not available
|
|
137
|
+
version: Manager version if available
|
|
138
|
+
platform: Platform the manager runs on
|
|
139
|
+
priority: Priority ranking of the manager
|
|
140
|
+
verbose: Whether to show additional information about selection criteria
|
|
141
|
+
"""
|
|
142
|
+
if manager_name:
|
|
143
|
+
msg = f"✨ Best manager: {manager_name}"
|
|
144
|
+
if version:
|
|
145
|
+
msg += f" (version {version})"
|
|
146
|
+
ezprinter.tip(msg)
|
|
147
|
+
|
|
148
|
+
if verbose:
|
|
149
|
+
if platform:
|
|
150
|
+
ezprinter.info(f"Platform: {platform}")
|
|
151
|
+
if priority is not None:
|
|
152
|
+
ezprinter.info(f"Priority: {priority}")
|
|
153
|
+
ezprinter.info(
|
|
154
|
+
"\nThis manager was selected based on:"
|
|
155
|
+
"\n • Platform compatibility"
|
|
156
|
+
"\n • Availability on system"
|
|
157
|
+
"\n • Priority ranking"
|
|
158
|
+
)
|
|
159
|
+
else:
|
|
160
|
+
ezprinter.error("No system package manager available")
|
|
161
|
+
|
|
162
|
+
if verbose:
|
|
163
|
+
ezprinter.info(
|
|
164
|
+
"\nTip: Install a package manager for your platform:"
|
|
165
|
+
"\n • Windows: winget, chocolatey, scoop"
|
|
166
|
+
"\n • macOS: homebrew"
|
|
167
|
+
"\n • Linux: apt, dnf, pacman (usually pre-installed)"
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
def display_system_detection_results(data: dict) -> None:
|
|
172
|
+
"""
|
|
173
|
+
Display system detection results in a Rich panel.
|
|
174
|
+
|
|
175
|
+
Args:
|
|
176
|
+
data: System data to display with the following structure:
|
|
177
|
+
- system_info: Dict with platform, architecture, python_version, shell
|
|
178
|
+
- package_managers: Dict of available package managers
|
|
179
|
+
- dev_environments: Dict of detected development environments
|
|
180
|
+
- recommendations: Dict of recommendations by category
|
|
181
|
+
|
|
182
|
+
Raises:
|
|
183
|
+
ValueError: If data format is invalid
|
|
184
|
+
"""
|
|
185
|
+
# Validate data structure
|
|
186
|
+
if not isinstance(data, dict):
|
|
187
|
+
raise TypeError(
|
|
188
|
+
f"Invalid data format: expected dictionary, got {type(data).__name__}"
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
system_info = data.get("system_info", {})
|
|
192
|
+
package_managers = data.get("package_managers", {})
|
|
193
|
+
dev_environments = data.get("dev_environments", {})
|
|
194
|
+
recommendations = data.get("recommendations", {})
|
|
195
|
+
|
|
196
|
+
# Format the data nicely
|
|
197
|
+
content = []
|
|
198
|
+
content.append("[bold blue]System Information[/bold blue]")
|
|
199
|
+
content.append(
|
|
200
|
+
f"OS: {system_info.get('platform', 'unknown')} {system_info.get('platform_release', '')}"
|
|
201
|
+
)
|
|
202
|
+
content.append(f"Architecture: {system_info.get('architecture', 'unknown')}")
|
|
203
|
+
content.append(f"Python: {system_info.get('python_version', 'unknown')}")
|
|
204
|
+
content.append(f"Shell: {system_info.get('shell', 'unknown')}")
|
|
205
|
+
|
|
206
|
+
content.append(
|
|
207
|
+
f"\n[bold green]Package Managers[/bold green] ({len(package_managers)} available)"
|
|
208
|
+
)
|
|
209
|
+
for name, info in package_managers.items():
|
|
210
|
+
if info.get("available"):
|
|
211
|
+
content.append(
|
|
212
|
+
f"✓ {name}: {info.get('version', 'unknown')} - {info.get('description', '')}"
|
|
213
|
+
)
|
|
214
|
+
|
|
215
|
+
content.append(
|
|
216
|
+
f"\n[bold yellow]Development Environments[/bold yellow] ({len(dev_environments)} detected)"
|
|
217
|
+
)
|
|
218
|
+
for _, info in dev_environments.items():
|
|
219
|
+
if info.get("available"):
|
|
220
|
+
content.append(
|
|
221
|
+
f"✓ {info.get('name', 'unknown')}: {info.get('version', 'unknown')}"
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
content.append("\n[bold magenta]Recommendations[/bold magenta]")
|
|
225
|
+
for category, recommendation in recommendations.items():
|
|
226
|
+
content.append(f"- {category}: {recommendation}")
|
|
227
|
+
|
|
228
|
+
# Add a blank line before the panel for better spacing
|
|
229
|
+
panel = ezprinter.create_panel(
|
|
230
|
+
"\n".join(content),
|
|
231
|
+
title="System Detection Results",
|
|
232
|
+
border_style="dim white",
|
|
233
|
+
)
|
|
234
|
+
ezprinter.console.print(panel)
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
def render_system_detection_result(result: SystemDetectionResult) -> None:
|
|
238
|
+
"""
|
|
239
|
+
Render a system detection Result: the detail panel on success, an error
|
|
240
|
+
message on failure.
|
|
241
|
+
|
|
242
|
+
Args:
|
|
243
|
+
result: Outcome returned by ``SystemDetectorInterface.detect_system()``.
|
|
244
|
+
"""
|
|
245
|
+
if result.success:
|
|
246
|
+
print()
|
|
247
|
+
display_system_detection_results(result.system_data or {})
|
|
248
|
+
return
|
|
249
|
+
|
|
250
|
+
ezprinter.error(result.message or "System detection failed")
|
|
251
|
+
if result.error:
|
|
252
|
+
ezprinter.info(result.error)
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
def render_environment_refresh_result(
|
|
256
|
+
result: EnvironmentRefreshResult, accessible: bool
|
|
257
|
+
) -> None:
|
|
258
|
+
"""
|
|
259
|
+
Render an environment refresh Result together with the accessibility check.
|
|
260
|
+
|
|
261
|
+
Args:
|
|
262
|
+
result: Outcome returned by ``SystemEnvironmentInterface.refresh_environment()``.
|
|
263
|
+
accessible: Whether the target command is reachable after the refresh
|
|
264
|
+
(from ``verify_environment_refresh()``).
|
|
265
|
+
"""
|
|
266
|
+
if result.success:
|
|
267
|
+
if accessible:
|
|
268
|
+
print()
|
|
269
|
+
ezprinter.tip(
|
|
270
|
+
"Recent PATH additions should now be accessible in this terminal session"
|
|
271
|
+
)
|
|
272
|
+
else:
|
|
273
|
+
ezprinter.warning(
|
|
274
|
+
"Environment refreshed but changes may not be accessible in current session"
|
|
275
|
+
)
|
|
276
|
+
ezprinter.tip(
|
|
277
|
+
"Solution: Restart your terminal or open a new command prompt"
|
|
278
|
+
)
|
|
279
|
+
return
|
|
280
|
+
|
|
281
|
+
ezprinter.error(result.message or "Environment refresh failed")
|
|
282
|
+
if result.error:
|
|
283
|
+
ezprinter.info(result.error)
|
|
284
|
+
ezprinter.info("This means WOMM may not be accessible in the current session")
|
|
285
|
+
ezprinter.info("Solution: Restart your terminal or run 'refreshenv' manually")
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
def render_doctor_result(result: DoctorResult, verbose: bool = False) -> None:
|
|
289
|
+
"""
|
|
290
|
+
Render the runtime diagnostic Result.
|
|
291
|
+
|
|
292
|
+
Args:
|
|
293
|
+
result: Outcome returned by ``DoctorInterface.diagnose()``.
|
|
294
|
+
verbose: Whether to show the raw executable and data directory paths.
|
|
295
|
+
"""
|
|
296
|
+
if not result.success:
|
|
297
|
+
ezprinter.error(result.message or "Runtime diagnostic failed")
|
|
298
|
+
if result.error:
|
|
299
|
+
ezprinter.info(result.error)
|
|
300
|
+
return
|
|
301
|
+
|
|
302
|
+
ezprinter.system(f"Version: {result.version}")
|
|
303
|
+
ezprinter.system(f"PATH command: {result.path_command or 'not found'}")
|
|
304
|
+
ezprinter.system(f"Context menu: {result.context_menu_status}")
|
|
305
|
+
|
|
306
|
+
writable_label = "writable" if result.data_dir_writable else "not writable"
|
|
307
|
+
if result.data_dir_writable:
|
|
308
|
+
ezprinter.success(f"Data directory: {result.data_dir} ({writable_label})")
|
|
309
|
+
else:
|
|
310
|
+
ezprinter.warning(f"Data directory: {result.data_dir} ({writable_label})")
|
|
311
|
+
|
|
312
|
+
if verbose:
|
|
313
|
+
ezprinter.info(f"Executable: {result.executable}")
|
|
314
|
+
|
|
315
|
+
_show_panel(
|
|
316
|
+
"""Runtime diagnostic commands:
|
|
317
|
+
|
|
318
|
+
- womm doctor -v - Show the resolved executable path
|
|
319
|
+
- womm path list - Inspect the current PATH
|
|
320
|
+
- womm context list - Inspect registered context menu entries""",
|
|
321
|
+
"Doctor Commands",
|
|
322
|
+
"blue",
|
|
323
|
+
)
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
def render_deps_check_result(
|
|
327
|
+
result: DependencyCheckResult,
|
|
328
|
+
verbose: bool = False,
|
|
329
|
+
) -> None:
|
|
330
|
+
"""
|
|
331
|
+
Render a dependency check Result (both strata).
|
|
332
|
+
|
|
333
|
+
Args:
|
|
334
|
+
result: Probe results collected by ``DepsInterface.check_all()``
|
|
335
|
+
verbose: Whether to also show the resolved path of each component
|
|
336
|
+
"""
|
|
337
|
+
|
|
338
|
+
def _render(entries: list[DependencyProbe]) -> None:
|
|
339
|
+
for entry in entries:
|
|
340
|
+
status = "✓" if entry.available else "✗"
|
|
341
|
+
version = f"v{entry.version}" if entry.version else "N/A"
|
|
342
|
+
msg = f"{status} {entry.name}: {version}"
|
|
343
|
+
if entry.available:
|
|
344
|
+
ezprinter.success(msg)
|
|
345
|
+
if verbose and entry.path:
|
|
346
|
+
ezprinter.info(f" {entry.path}")
|
|
347
|
+
else:
|
|
348
|
+
ezprinter.warning(msg)
|
|
349
|
+
|
|
350
|
+
if not result.success:
|
|
351
|
+
ezprinter.error(result.message or "Dependency check failed")
|
|
352
|
+
if result.error:
|
|
353
|
+
ezprinter.info(result.error)
|
|
354
|
+
|
|
355
|
+
_show_panel(
|
|
356
|
+
"""The dependency check could not complete.
|
|
357
|
+
|
|
358
|
+
- Re-run with -v/--verbose for more detail
|
|
359
|
+
- Use womm deps list to see the static inventory instead""",
|
|
360
|
+
"Troubleshooting",
|
|
361
|
+
"yellow",
|
|
362
|
+
)
|
|
363
|
+
return
|
|
364
|
+
|
|
365
|
+
ezprinter.info("Checking all dependencies...\n")
|
|
366
|
+
|
|
367
|
+
# Strata 1
|
|
368
|
+
ezprinter.info("\n=== Runtimes (Strata 1) ===")
|
|
369
|
+
_render(result.runtime)
|
|
370
|
+
ezconsole.print("")
|
|
371
|
+
|
|
372
|
+
# Strata 2
|
|
373
|
+
ezprinter.info("\n=== Runtime Package Managers (Strata 2) ===")
|
|
374
|
+
_render(result.package_managers)
|
|
375
|
+
|
|
376
|
+
missing = [entry.name for entry in result.runtime if not entry.available]
|
|
377
|
+
if missing:
|
|
378
|
+
_show_panel(
|
|
379
|
+
f"""Missing runtimes: {", ".join(missing)}
|
|
380
|
+
|
|
381
|
+
WOMM does not install runtimes for you. Install the missing ones with your
|
|
382
|
+
usual tooling, then re-run womm deps check.
|
|
383
|
+
|
|
384
|
+
If a runtime is already installed but not detected, it is probably absent from
|
|
385
|
+
your PATH — womm path list shows the current entries.""",
|
|
386
|
+
"Missing Runtimes",
|
|
387
|
+
"yellow",
|
|
388
|
+
)
|
|
389
|
+
|
|
390
|
+
_show_panel(
|
|
391
|
+
"""Dependency commands:
|
|
392
|
+
|
|
393
|
+
- womm deps status - Full status table with versions
|
|
394
|
+
- womm deps list - Static inventory, no probing
|
|
395
|
+
- womm deps check -v - Show version details for each component""",
|
|
396
|
+
"Deps Commands",
|
|
397
|
+
"blue",
|
|
398
|
+
)
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
def render_deps_status_result(
|
|
402
|
+
result: DependencyStatusResult,
|
|
403
|
+
verbose: bool = False,
|
|
404
|
+
) -> None:
|
|
405
|
+
"""
|
|
406
|
+
Render a comprehensive dependency status table.
|
|
407
|
+
|
|
408
|
+
Args:
|
|
409
|
+
result: Status data collected by ``DepsInterface.show_status()``
|
|
410
|
+
verbose: Whether to show additional details column
|
|
411
|
+
"""
|
|
412
|
+
if not result.success:
|
|
413
|
+
ezprinter.error(result.message or "Failed to generate dependency status")
|
|
414
|
+
if result.error:
|
|
415
|
+
ezprinter.info(result.error)
|
|
416
|
+
|
|
417
|
+
_show_panel(
|
|
418
|
+
"""The dependency status report could not be generated.
|
|
419
|
+
|
|
420
|
+
- Re-run with -v/--verbose for more detail
|
|
421
|
+
- Use womm deps list to see the static inventory instead""",
|
|
422
|
+
"Troubleshooting",
|
|
423
|
+
"yellow",
|
|
424
|
+
)
|
|
425
|
+
return
|
|
426
|
+
|
|
427
|
+
table = Table(title="WOMM Dependency Status", show_header=True)
|
|
428
|
+
table.add_column("Strata", style="cyan", width=20)
|
|
429
|
+
table.add_column("Component", style="yellow", width=30)
|
|
430
|
+
table.add_column("Status", style="green", width=10, justify="center")
|
|
431
|
+
table.add_column("Version", style="white", width=15)
|
|
432
|
+
|
|
433
|
+
if verbose:
|
|
434
|
+
table.add_column("Details", style="blue", width=30)
|
|
435
|
+
|
|
436
|
+
# Strata 1
|
|
437
|
+
for entry in result.runtime:
|
|
438
|
+
row = [
|
|
439
|
+
"Runtime",
|
|
440
|
+
entry.name,
|
|
441
|
+
"✓" if entry.available else "✗",
|
|
442
|
+
entry.version or "N/A",
|
|
443
|
+
]
|
|
444
|
+
if verbose:
|
|
445
|
+
row.append(f"Min: {RuntimeConfig.RUNTIMES.get(entry.name, 'Any')}")
|
|
446
|
+
table.add_row(*row)
|
|
447
|
+
|
|
448
|
+
# Strata 2
|
|
449
|
+
for entry in result.package_managers:
|
|
450
|
+
row = [
|
|
451
|
+
"Runtime PKG MGR",
|
|
452
|
+
entry.name,
|
|
453
|
+
"✓" if entry.available else "✗",
|
|
454
|
+
entry.version or "N/A",
|
|
455
|
+
]
|
|
456
|
+
if verbose:
|
|
457
|
+
requires = RuntimePackageManagerConfig.RUNTIME_PACKAGE_MANAGERS.get(
|
|
458
|
+
entry.name, "N/A"
|
|
459
|
+
)
|
|
460
|
+
row.append(f"Requires: {requires}")
|
|
461
|
+
table.add_row(*row)
|
|
462
|
+
|
|
463
|
+
ezconsole.print(table)
|
|
464
|
+
|
|
465
|
+
_show_panel(
|
|
466
|
+
"""Dependency commands:
|
|
467
|
+
|
|
468
|
+
- womm deps check - Probe and report availability
|
|
469
|
+
- womm deps list - Static inventory, no probing
|
|
470
|
+
- womm deps status -v - Show details column""",
|
|
471
|
+
"Deps Commands",
|
|
472
|
+
"blue",
|
|
473
|
+
)
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
def render_deps_inventory_result(result: DependencyInventoryResult) -> None:
|
|
477
|
+
"""
|
|
478
|
+
Render the static dependency inventory (no probing).
|
|
479
|
+
|
|
480
|
+
Args:
|
|
481
|
+
result: Inventory collected by ``DepsInterface.list_all()``
|
|
482
|
+
"""
|
|
483
|
+
if not result.success:
|
|
484
|
+
ezprinter.error(result.message or "Failed to list dependencies")
|
|
485
|
+
if result.error:
|
|
486
|
+
ezprinter.info(result.error)
|
|
487
|
+
|
|
488
|
+
_show_panel(
|
|
489
|
+
"""The dependency inventory could not be listed.
|
|
490
|
+
|
|
491
|
+
- This is a static listing; it should not depend on system state
|
|
492
|
+
- Re-run with -v/--verbose for more detail""",
|
|
493
|
+
"Troubleshooting",
|
|
494
|
+
"yellow",
|
|
495
|
+
)
|
|
496
|
+
return
|
|
497
|
+
|
|
498
|
+
ezprinter.info("=== Runtimes (Strata 1) ===")
|
|
499
|
+
for entry in result.runtime:
|
|
500
|
+
ezprinter.info(f" • {entry.name} ({entry.detail})")
|
|
501
|
+
|
|
502
|
+
ezprinter.info("\n=== Runtime Package Managers (Strata 2) ===")
|
|
503
|
+
for entry in result.package_managers:
|
|
504
|
+
ezprinter.info(f" • {entry.name} ({entry.detail})")
|
|
505
|
+
|
|
506
|
+
_show_panel(
|
|
507
|
+
"""Dependency commands:
|
|
508
|
+
|
|
509
|
+
- womm deps check - Probe and report availability
|
|
510
|
+
- womm deps status - Full status table with versions""",
|
|
511
|
+
"Deps Commands",
|
|
512
|
+
"blue",
|
|
513
|
+
)
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
# ///////////////////////////////////////////////////////////////
|
|
517
|
+
# PUBLIC API
|
|
518
|
+
# ///////////////////////////////////////////////////////////////
|
|
519
|
+
|
|
520
|
+
__all__ = [
|
|
521
|
+
"display_available_managers",
|
|
522
|
+
"display_best_manager",
|
|
523
|
+
"display_system_detection_results",
|
|
524
|
+
"display_system_managers_list",
|
|
525
|
+
"render_deps_check_result",
|
|
526
|
+
"render_deps_inventory_result",
|
|
527
|
+
"render_deps_status_result",
|
|
528
|
+
"render_doctor_result",
|
|
529
|
+
"render_environment_refresh_result",
|
|
530
|
+
"render_system_detection_result",
|
|
531
|
+
]
|