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,163 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# ///////////////////////////////////////////////////////////////
|
|
3
|
+
# PROJECT RESULTS - Project Result Classes
|
|
4
|
+
# Project: works-on-my-machine
|
|
5
|
+
# ///////////////////////////////////////////////////////////////
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
Project result classes for Works On My Machine.
|
|
9
|
+
|
|
10
|
+
This module contains result classes for project operations:
|
|
11
|
+
- Project detection
|
|
12
|
+
- Project creation
|
|
13
|
+
- Project setup
|
|
14
|
+
- Template operations
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
# ///////////////////////////////////////////////////////////////
|
|
20
|
+
# IMPORTS
|
|
21
|
+
# ///////////////////////////////////////////////////////////////
|
|
22
|
+
# Standard library imports
|
|
23
|
+
from dataclasses import dataclass
|
|
24
|
+
from pathlib import Path
|
|
25
|
+
from typing import Any
|
|
26
|
+
|
|
27
|
+
# Local imports
|
|
28
|
+
from .base import BaseResult
|
|
29
|
+
|
|
30
|
+
# ///////////////////////////////////////////////////////////////
|
|
31
|
+
# SETUP RESULT
|
|
32
|
+
# ///////////////////////////////////////////////////////////////
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@dataclass
|
|
36
|
+
class SetupResult(BaseResult):
|
|
37
|
+
"""Result for project setup operations."""
|
|
38
|
+
|
|
39
|
+
project_path: Path | None = None
|
|
40
|
+
project_name: str = ""
|
|
41
|
+
files_created: list[str] | None = None
|
|
42
|
+
tools_configured: list[str] | None = None
|
|
43
|
+
warnings: list[str] | None = None
|
|
44
|
+
|
|
45
|
+
def __post_init__(self) -> None:
|
|
46
|
+
"""Initialize derived fields."""
|
|
47
|
+
if self.files_created is None:
|
|
48
|
+
self.files_created = []
|
|
49
|
+
if self.tools_configured is None:
|
|
50
|
+
self.tools_configured = []
|
|
51
|
+
if self.warnings is None:
|
|
52
|
+
self.warnings = []
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
# ///////////////////////////////////////////////////////////////
|
|
56
|
+
# PROJECT DETECTION RESULT
|
|
57
|
+
# ///////////////////////////////////////////////////////////////
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
@dataclass
|
|
61
|
+
class ProjectDetectionResult(BaseResult):
|
|
62
|
+
"""Result for project type detection."""
|
|
63
|
+
|
|
64
|
+
project_type: str = ""
|
|
65
|
+
confidence: float = 0.0
|
|
66
|
+
detected_files: list[str] | None = None
|
|
67
|
+
configuration_files: dict[str, str] | None = None
|
|
68
|
+
|
|
69
|
+
def __post_init__(self) -> None:
|
|
70
|
+
"""Initialize derived fields."""
|
|
71
|
+
if self.detected_files is None:
|
|
72
|
+
self.detected_files = []
|
|
73
|
+
if self.configuration_files is None:
|
|
74
|
+
self.configuration_files = {}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
# ///////////////////////////////////////////////////////////////
|
|
78
|
+
# PROJECT CREATION RESULT
|
|
79
|
+
# ///////////////////////////////////////////////////////////////
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
@dataclass
|
|
83
|
+
class ProjectCreationResult(BaseResult):
|
|
84
|
+
"""Result for project creation operations."""
|
|
85
|
+
|
|
86
|
+
project_path: Path | None = None
|
|
87
|
+
project_name: str = ""
|
|
88
|
+
project_type: str = ""
|
|
89
|
+
files_created: list[str] | None = None
|
|
90
|
+
directories_created: list[str] | None = None
|
|
91
|
+
tools_configured: list[str] | None = None
|
|
92
|
+
warnings: list[str] | None = None
|
|
93
|
+
|
|
94
|
+
def __post_init__(self) -> None:
|
|
95
|
+
"""Initialize derived fields."""
|
|
96
|
+
if self.files_created is None:
|
|
97
|
+
self.files_created = []
|
|
98
|
+
if self.directories_created is None:
|
|
99
|
+
self.directories_created = []
|
|
100
|
+
if self.tools_configured is None:
|
|
101
|
+
self.tools_configured = []
|
|
102
|
+
if self.warnings is None:
|
|
103
|
+
self.warnings = []
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
# ///////////////////////////////////////////////////////////////
|
|
107
|
+
# PROJECT SETUP RESULT
|
|
108
|
+
# ///////////////////////////////////////////////////////////////
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
@dataclass
|
|
112
|
+
class ProjectSetupResult(BaseResult):
|
|
113
|
+
"""Result for project setup operations."""
|
|
114
|
+
|
|
115
|
+
project_path: Path | None = None
|
|
116
|
+
project_name: str = ""
|
|
117
|
+
project_type: str = ""
|
|
118
|
+
files_modified: list[str] | None = None
|
|
119
|
+
tools_configured: list[str] | None = None
|
|
120
|
+
warnings: list[str] | None = None
|
|
121
|
+
|
|
122
|
+
def __post_init__(self) -> None:
|
|
123
|
+
"""Initialize derived fields."""
|
|
124
|
+
if self.files_modified is None:
|
|
125
|
+
self.files_modified = []
|
|
126
|
+
if self.tools_configured is None:
|
|
127
|
+
self.tools_configured = []
|
|
128
|
+
if self.warnings is None:
|
|
129
|
+
self.warnings = []
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
# ///////////////////////////////////////////////////////////////
|
|
133
|
+
# CONFIGURATION RESULT
|
|
134
|
+
# ///////////////////////////////////////////////////////////////
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
@dataclass
|
|
138
|
+
class ConfigurationResult(BaseResult):
|
|
139
|
+
"""Result for configuration operations."""
|
|
140
|
+
|
|
141
|
+
config_type: str = "" # vscode, git, etc.
|
|
142
|
+
config_files: list[str] | None = None
|
|
143
|
+
settings_applied: dict[str, Any] | None = None
|
|
144
|
+
|
|
145
|
+
def __post_init__(self) -> None:
|
|
146
|
+
"""Initialize derived fields."""
|
|
147
|
+
if self.config_files is None:
|
|
148
|
+
self.config_files = []
|
|
149
|
+
if self.settings_applied is None:
|
|
150
|
+
self.settings_applied = {}
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
# ///////////////////////////////////////////////////////////////
|
|
154
|
+
# PUBLIC API
|
|
155
|
+
# ///////////////////////////////////////////////////////////////
|
|
156
|
+
|
|
157
|
+
__all__ = [
|
|
158
|
+
"ConfigurationResult",
|
|
159
|
+
"ProjectCreationResult",
|
|
160
|
+
"ProjectDetectionResult",
|
|
161
|
+
"ProjectSetupResult",
|
|
162
|
+
"SetupResult",
|
|
163
|
+
]
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# ///////////////////////////////////////////////////////////////
|
|
3
|
+
# SECURITY RESULTS - Security Result Classes
|
|
4
|
+
# Project: works-on-my-machine
|
|
5
|
+
# ///////////////////////////////////////////////////////////////
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
Security result classes for Works On My Machine.
|
|
9
|
+
|
|
10
|
+
This module contains result classes for security operations:
|
|
11
|
+
- Security validation
|
|
12
|
+
- Input validation
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
# ///////////////////////////////////////////////////////////////
|
|
18
|
+
# IMPORTS
|
|
19
|
+
# ///////////////////////////////////////////////////////////////
|
|
20
|
+
# Standard library imports
|
|
21
|
+
from dataclasses import dataclass
|
|
22
|
+
|
|
23
|
+
# Local imports
|
|
24
|
+
from .base import BaseResult
|
|
25
|
+
|
|
26
|
+
# ///////////////////////////////////////////////////////////////
|
|
27
|
+
# VALIDATION RESULT
|
|
28
|
+
# ///////////////////////////////////////////////////////////////
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@dataclass
|
|
32
|
+
class ValidationResult(BaseResult):
|
|
33
|
+
"""Result for input validation operations."""
|
|
34
|
+
|
|
35
|
+
input_type: str = ""
|
|
36
|
+
input_value: str = ""
|
|
37
|
+
validation_rules: list[str] | None = None
|
|
38
|
+
|
|
39
|
+
def __post_init__(self) -> None:
|
|
40
|
+
"""Initialize derived fields."""
|
|
41
|
+
if self.validation_rules is None:
|
|
42
|
+
self.validation_rules = []
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
# ///////////////////////////////////////////////////////////////
|
|
46
|
+
# SECURITY RESULT
|
|
47
|
+
# ///////////////////////////////////////////////////////////////
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@dataclass
|
|
51
|
+
class SecurityResult(BaseResult):
|
|
52
|
+
"""Result for security validation operations."""
|
|
53
|
+
|
|
54
|
+
security_level: str = "low" # low, medium, high
|
|
55
|
+
threats_detected: list[str] | None = None
|
|
56
|
+
recommendations: list[str] | None = None
|
|
57
|
+
|
|
58
|
+
def __post_init__(self) -> None:
|
|
59
|
+
"""Initialize derived fields."""
|
|
60
|
+
if self.threats_detected is None:
|
|
61
|
+
self.threats_detected = []
|
|
62
|
+
if self.recommendations is None:
|
|
63
|
+
self.recommendations = []
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
# ///////////////////////////////////////////////////////////////
|
|
67
|
+
# COMMAND VALIDATION RESULT
|
|
68
|
+
# ///////////////////////////////////////////////////////////////
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
@dataclass
|
|
72
|
+
class CommandValidationResult(BaseResult):
|
|
73
|
+
"""Result for command security validation."""
|
|
74
|
+
|
|
75
|
+
command: str = ""
|
|
76
|
+
is_valid: bool = False
|
|
77
|
+
validation_reason: str = ""
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
# ///////////////////////////////////////////////////////////////
|
|
81
|
+
# PATH VALIDATION RESULT
|
|
82
|
+
# ///////////////////////////////////////////////////////////////
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
@dataclass
|
|
86
|
+
class PathValidationResult(BaseResult):
|
|
87
|
+
"""Result for file/directory path security validation."""
|
|
88
|
+
|
|
89
|
+
path: str = ""
|
|
90
|
+
is_valid: bool = False
|
|
91
|
+
validation_reason: str = ""
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
# ///////////////////////////////////////////////////////////////
|
|
95
|
+
# SECURITY REPORT RESULT
|
|
96
|
+
# ///////////////////////////////////////////////////////////////
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
@dataclass
|
|
100
|
+
class SecurityReportResult(BaseResult):
|
|
101
|
+
"""Result for security report generation."""
|
|
102
|
+
|
|
103
|
+
command: str = ""
|
|
104
|
+
is_safe: bool = False
|
|
105
|
+
reason: str = ""
|
|
106
|
+
base_command: str = ""
|
|
107
|
+
arguments: list[str] | None = None
|
|
108
|
+
checks_performed: list[str] | None = None
|
|
109
|
+
|
|
110
|
+
def __post_init__(self) -> None:
|
|
111
|
+
"""Initialize derived fields."""
|
|
112
|
+
if self.arguments is None:
|
|
113
|
+
self.arguments = []
|
|
114
|
+
if self.checks_performed is None:
|
|
115
|
+
self.checks_performed = []
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
# ///////////////////////////////////////////////////////////////
|
|
119
|
+
# PUBLIC API
|
|
120
|
+
# ///////////////////////////////////////////////////////////////
|
|
121
|
+
|
|
122
|
+
__all__ = [
|
|
123
|
+
"CommandValidationResult",
|
|
124
|
+
"PathValidationResult",
|
|
125
|
+
"SecurityReportResult",
|
|
126
|
+
"SecurityResult",
|
|
127
|
+
"ValidationResult",
|
|
128
|
+
]
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# ///////////////////////////////////////////////////////////////
|
|
3
|
+
# SYSTEM RESULTS - System Result Classes
|
|
4
|
+
# Project: works-on-my-machine
|
|
5
|
+
# ///////////////////////////////////////////////////////////////
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
System result classes for Works On My Machine.
|
|
9
|
+
|
|
10
|
+
This module contains result classes for system operations:
|
|
11
|
+
- System information
|
|
12
|
+
- PATH operations
|
|
13
|
+
- Environment refresh
|
|
14
|
+
- Environment verification
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
# ///////////////////////////////////////////////////////////////
|
|
20
|
+
# IMPORTS
|
|
21
|
+
# ///////////////////////////////////////////////////////////////
|
|
22
|
+
# Standard library imports
|
|
23
|
+
from dataclasses import dataclass
|
|
24
|
+
|
|
25
|
+
# Local imports
|
|
26
|
+
from .base import BaseResult
|
|
27
|
+
|
|
28
|
+
# ///////////////////////////////////////////////////////////////
|
|
29
|
+
# SYSTEM INFO RESULT
|
|
30
|
+
# ///////////////////////////////////////////////////////////////
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@dataclass
|
|
34
|
+
class SystemInfoResult(BaseResult):
|
|
35
|
+
"""Result for system information operations."""
|
|
36
|
+
|
|
37
|
+
platform: str = ""
|
|
38
|
+
platform_release: str = ""
|
|
39
|
+
platform_version: str = ""
|
|
40
|
+
architecture: str = ""
|
|
41
|
+
processor: str = ""
|
|
42
|
+
python_version: str = ""
|
|
43
|
+
python_implementation: str = ""
|
|
44
|
+
node: str = ""
|
|
45
|
+
user: str = ""
|
|
46
|
+
home: str = ""
|
|
47
|
+
shell: str = ""
|
|
48
|
+
terminal: str = ""
|
|
49
|
+
path_separator: str = ""
|
|
50
|
+
line_separator: str = ""
|
|
51
|
+
package_managers: dict[str, dict[str, str | bool]] | None = None
|
|
52
|
+
dev_environments: dict[str, dict[str, str | bool]] | None = None
|
|
53
|
+
recommendations: dict[str, str] | None = None
|
|
54
|
+
|
|
55
|
+
def __post_init__(self) -> None:
|
|
56
|
+
"""Initialize derived fields."""
|
|
57
|
+
if self.package_managers is None:
|
|
58
|
+
self.package_managers = {}
|
|
59
|
+
if self.dev_environments is None:
|
|
60
|
+
self.dev_environments = {}
|
|
61
|
+
if self.recommendations is None:
|
|
62
|
+
self.recommendations = {}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
# ///////////////////////////////////////////////////////////////
|
|
66
|
+
# PATH OPERATION RESULT
|
|
67
|
+
# ///////////////////////////////////////////////////////////////
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
@dataclass
|
|
71
|
+
class PathOperationResult(BaseResult):
|
|
72
|
+
"""Result for PATH operation results."""
|
|
73
|
+
|
|
74
|
+
entry_path: str = ""
|
|
75
|
+
operation: str = "" # add, remove, verify
|
|
76
|
+
path_modified: bool = False
|
|
77
|
+
path_entries: list[str] | None = None
|
|
78
|
+
modification_time: float = 0.0
|
|
79
|
+
|
|
80
|
+
def __post_init__(self) -> None:
|
|
81
|
+
"""Initialize derived fields."""
|
|
82
|
+
if self.path_entries is None:
|
|
83
|
+
self.path_entries = []
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
# ///////////////////////////////////////////////////////////////
|
|
87
|
+
# PATH BACKUP RESULTS
|
|
88
|
+
# ///////////////////////////////////////////////////////////////
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
@dataclass
|
|
92
|
+
class PathBackupInfo:
|
|
93
|
+
"""A single PATH backup file's metadata (plain record, not a Result)."""
|
|
94
|
+
|
|
95
|
+
name: str
|
|
96
|
+
path: str
|
|
97
|
+
size: int
|
|
98
|
+
modified: str
|
|
99
|
+
path_entries: int
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
@dataclass
|
|
103
|
+
class PathBackupListResult(BaseResult):
|
|
104
|
+
"""Result for listing PATH backup files."""
|
|
105
|
+
|
|
106
|
+
backup_location: str = ""
|
|
107
|
+
backups: list[PathBackupInfo] | None = None
|
|
108
|
+
|
|
109
|
+
def __post_init__(self) -> None:
|
|
110
|
+
"""Initialize derived fields."""
|
|
111
|
+
if self.backups is None:
|
|
112
|
+
self.backups = []
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
@dataclass
|
|
116
|
+
class PathBackupContentResult(BaseResult):
|
|
117
|
+
"""Content of a single PATH backup file."""
|
|
118
|
+
|
|
119
|
+
name: str = ""
|
|
120
|
+
# Fully resolved filesystem path; intentionally never rendered to the
|
|
121
|
+
# user, and should not be printed by future renderers.
|
|
122
|
+
backup_file: str = ""
|
|
123
|
+
timestamp: str = ""
|
|
124
|
+
platform: str = ""
|
|
125
|
+
separator: str = ""
|
|
126
|
+
length: int = 0
|
|
127
|
+
entries: list[str] | None = None
|
|
128
|
+
|
|
129
|
+
def __post_init__(self) -> None:
|
|
130
|
+
"""Initialize derived fields."""
|
|
131
|
+
if self.entries is None:
|
|
132
|
+
self.entries = []
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
@dataclass
|
|
136
|
+
class PathBackupResult(BaseResult):
|
|
137
|
+
"""Result for creating a PATH backup."""
|
|
138
|
+
|
|
139
|
+
backup_location: str = ""
|
|
140
|
+
backup_file: str = ""
|
|
141
|
+
entries_count: int = 0
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
# ///////////////////////////////////////////////////////////////
|
|
145
|
+
# ENVIRONMENT REFRESH RESULT
|
|
146
|
+
# ///////////////////////////////////////////////////////////////
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
@dataclass
|
|
150
|
+
class EnvironmentRefreshResult(BaseResult):
|
|
151
|
+
"""Result for environment refresh operations."""
|
|
152
|
+
|
|
153
|
+
platform: str = ""
|
|
154
|
+
refresh_method: str = "" # registry, shell_config, etc.
|
|
155
|
+
path_refreshed: bool = False
|
|
156
|
+
environment_info: dict[str, str] | None = None
|
|
157
|
+
refresh_time: float = 0.0
|
|
158
|
+
|
|
159
|
+
def __post_init__(self) -> None:
|
|
160
|
+
"""Initialize derived fields."""
|
|
161
|
+
if self.environment_info is None:
|
|
162
|
+
self.environment_info = {}
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
# ///////////////////////////////////////////////////////////////
|
|
166
|
+
# ENVIRONMENT VERIFICATION RESULT
|
|
167
|
+
# ///////////////////////////////////////////////////////////////
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
@dataclass
|
|
171
|
+
class EnvironmentVerificationResult(BaseResult):
|
|
172
|
+
"""Result for environment verification operations."""
|
|
173
|
+
|
|
174
|
+
command: str = ""
|
|
175
|
+
command_accessible: bool = False
|
|
176
|
+
verification_method: str = "" # refresh_env_cmd, direct_test, etc.
|
|
177
|
+
verification_time: float = 0.0
|
|
178
|
+
temp_script_path: str | None = None
|
|
179
|
+
|
|
180
|
+
def __post_init__(self) -> None:
|
|
181
|
+
"""Initialize derived fields."""
|
|
182
|
+
if self.temp_script_path is None:
|
|
183
|
+
self.temp_script_path = ""
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
# ///////////////////////////////////////////////////////////////
|
|
187
|
+
# SYSTEM DETECTION RESULT
|
|
188
|
+
# ///////////////////////////////////////////////////////////////
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
@dataclass
|
|
192
|
+
class SystemDetectionResult(BaseResult):
|
|
193
|
+
"""Result for system detection operations."""
|
|
194
|
+
|
|
195
|
+
system_data: dict | None = None
|
|
196
|
+
detection_time: float = 0.0
|
|
197
|
+
|
|
198
|
+
def __post_init__(self) -> None:
|
|
199
|
+
"""Initialize derived fields."""
|
|
200
|
+
if self.system_data is None:
|
|
201
|
+
self.system_data = {}
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
# ///////////////////////////////////////////////////////////////
|
|
205
|
+
# PREREQUISITES CHECK RESULT
|
|
206
|
+
# ///////////////////////////////////////////////////////////////
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
@dataclass
|
|
210
|
+
class PrerequisitesCheckResult(BaseResult):
|
|
211
|
+
"""Result for prerequisites checking operations."""
|
|
212
|
+
|
|
213
|
+
checked_tools: list[str] | None = None
|
|
214
|
+
results: dict | None = None
|
|
215
|
+
missing_tools: list[str] | None = None
|
|
216
|
+
check_time: float = 0.0
|
|
217
|
+
|
|
218
|
+
def __post_init__(self) -> None:
|
|
219
|
+
"""Initialize derived fields."""
|
|
220
|
+
if self.checked_tools is None:
|
|
221
|
+
self.checked_tools = []
|
|
222
|
+
if self.results is None:
|
|
223
|
+
self.results = {}
|
|
224
|
+
if self.missing_tools is None:
|
|
225
|
+
self.missing_tools = []
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
# ///////////////////////////////////////////////////////////////
|
|
229
|
+
# PREREQUISITES INSTALL RESULT
|
|
230
|
+
# ///////////////////////////////////////////////////////////////
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
@dataclass
|
|
234
|
+
class PrerequisitesInstallResult(BaseResult):
|
|
235
|
+
"""Result for prerequisites installation operations."""
|
|
236
|
+
|
|
237
|
+
selected_tools: list[str] | None = None
|
|
238
|
+
installation_results: dict | None = None
|
|
239
|
+
failed_installations: list[str] | None = None
|
|
240
|
+
install_time: float = 0.0
|
|
241
|
+
|
|
242
|
+
def __post_init__(self) -> None:
|
|
243
|
+
"""Initialize derived fields."""
|
|
244
|
+
if self.selected_tools is None:
|
|
245
|
+
self.selected_tools = []
|
|
246
|
+
if self.installation_results is None:
|
|
247
|
+
self.installation_results = {}
|
|
248
|
+
if self.failed_installations is None:
|
|
249
|
+
self.failed_installations = []
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
# ///////////////////////////////////////////////////////////////
|
|
253
|
+
# PUBLIC API
|
|
254
|
+
# ///////////////////////////////////////////////////////////////
|
|
255
|
+
|
|
256
|
+
__all__ = [
|
|
257
|
+
"EnvironmentRefreshResult",
|
|
258
|
+
"EnvironmentVerificationResult",
|
|
259
|
+
"PathBackupContentResult",
|
|
260
|
+
"PathBackupInfo",
|
|
261
|
+
"PathBackupListResult",
|
|
262
|
+
"PathBackupResult",
|
|
263
|
+
"PathOperationResult",
|
|
264
|
+
"PrerequisitesCheckResult",
|
|
265
|
+
"PrerequisitesInstallResult",
|
|
266
|
+
"SystemDetectionResult",
|
|
267
|
+
"SystemInfoResult",
|
|
268
|
+
]
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# ///////////////////////////////////////////////////////////////
|
|
3
|
+
# TEMPLATE RESULTS - Template catalog result types
|
|
4
|
+
# Project: works-on-my-machine
|
|
5
|
+
# ///////////////////////////////////////////////////////////////
|
|
6
|
+
|
|
7
|
+
"""Typed results returned by the template store."""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
# ///////////////////////////////////////////////////////////////
|
|
12
|
+
# IMPORTS
|
|
13
|
+
# ///////////////////////////////////////////////////////////////
|
|
14
|
+
from dataclasses import dataclass
|
|
15
|
+
|
|
16
|
+
from womm.shared.models.template_source import TemplateEntry
|
|
17
|
+
|
|
18
|
+
from .base import BaseResult
|
|
19
|
+
|
|
20
|
+
# ///////////////////////////////////////////////////////////////
|
|
21
|
+
# RESULTS
|
|
22
|
+
# ///////////////////////////////////////////////////////////////
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@dataclass
|
|
26
|
+
class TemplateStoreResult(BaseResult):
|
|
27
|
+
"""Result of an operation targeting a single template."""
|
|
28
|
+
|
|
29
|
+
entry: TemplateEntry | None = None
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@dataclass
|
|
33
|
+
class TemplateListResult(BaseResult):
|
|
34
|
+
"""Result of listing the template catalog."""
|
|
35
|
+
|
|
36
|
+
entries: list[TemplateEntry] | None = None
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
# ///////////////////////////////////////////////////////////////
|
|
40
|
+
# PUBLIC API
|
|
41
|
+
# ///////////////////////////////////////////////////////////////
|
|
42
|
+
|
|
43
|
+
__all__ = ["TemplateListResult", "TemplateStoreResult"]
|
womm/shared/runtime.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# ///////////////////////////////////////////////////////////////
|
|
3
|
+
# SHARED RUNTIME - Executable Resolution
|
|
4
|
+
# Project: works-on-my-machine
|
|
5
|
+
# ///////////////////////////////////////////////////////////////
|
|
6
|
+
|
|
7
|
+
"""Resolve the stable command entry point used by integrations."""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
# ///////////////////////////////////////////////////////////////
|
|
12
|
+
# IMPORTS
|
|
13
|
+
# ///////////////////////////////////////////////////////////////
|
|
14
|
+
# Standard library imports
|
|
15
|
+
import shutil
|
|
16
|
+
import sys
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def get_womm_executable() -> Path:
|
|
21
|
+
"""Return the executable integrations should invoke.
|
|
22
|
+
|
|
23
|
+
Prefer uv's stable user shim and fall back to the command currently
|
|
24
|
+
resolvable on PATH. The returned path may not exist in a source checkout;
|
|
25
|
+
callers that need an executable must validate it.
|
|
26
|
+
"""
|
|
27
|
+
executable_name = "womm.exe" if sys.platform == "win32" else "womm"
|
|
28
|
+
uv_shim = Path.home() / ".local" / "bin" / executable_name
|
|
29
|
+
if uv_shim.is_file():
|
|
30
|
+
return uv_shim
|
|
31
|
+
|
|
32
|
+
resolved = shutil.which("womm")
|
|
33
|
+
return Path(resolved) if resolved else uv_shim
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
__all__ = ["get_womm_executable"]
|