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,345 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# ///////////////////////////////////////////////////////////////
|
|
3
|
+
# CONTEXT RESULTS - Context Result Classes
|
|
4
|
+
# Project: works-on-my-machine
|
|
5
|
+
# ///////////////////////////////////////////////////////////////
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
Context result classes for Works On My Machine.
|
|
9
|
+
|
|
10
|
+
This module contains result classes for context menu operations:
|
|
11
|
+
- Context registry operations
|
|
12
|
+
- Context validation operations
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
# ///////////////////////////////////////////////////////////////
|
|
18
|
+
# IMPORTS
|
|
19
|
+
# ///////////////////////////////////////////////////////////////
|
|
20
|
+
# Standard library imports
|
|
21
|
+
from dataclasses import dataclass
|
|
22
|
+
from datetime import datetime
|
|
23
|
+
from typing import Any
|
|
24
|
+
|
|
25
|
+
# Local imports
|
|
26
|
+
from .base import BaseResult
|
|
27
|
+
from .security_results import ValidationResult
|
|
28
|
+
|
|
29
|
+
# ///////////////////////////////////////////////////////////////
|
|
30
|
+
# CONTEXT REGISTRY RESULT
|
|
31
|
+
# ///////////////////////////////////////////////////////////////
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@dataclass
|
|
35
|
+
class ContextRegistryResult(BaseResult):
|
|
36
|
+
"""Result for context menu registry operations."""
|
|
37
|
+
|
|
38
|
+
registry_path: str = ""
|
|
39
|
+
command: str = ""
|
|
40
|
+
display_name: str = ""
|
|
41
|
+
icon_path: str | None = None
|
|
42
|
+
entries: list[dict[str, str | None]] | None = None
|
|
43
|
+
backup_data: dict[str, Any] | None = None
|
|
44
|
+
|
|
45
|
+
def __post_init__(self) -> None:
|
|
46
|
+
"""Initialize derived fields."""
|
|
47
|
+
if self.entries is None:
|
|
48
|
+
self.entries = []
|
|
49
|
+
if self.backup_data is None:
|
|
50
|
+
self.backup_data = {}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
# ///////////////////////////////////////////////////////////////
|
|
54
|
+
# CONTEXT VALIDATION RESULT
|
|
55
|
+
# ///////////////////////////////////////////////////////////////
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@dataclass
|
|
59
|
+
class ContextValidationResult(ValidationResult):
|
|
60
|
+
"""Result for context menu validation operations."""
|
|
61
|
+
|
|
62
|
+
script_path: str = ""
|
|
63
|
+
extension: str = ""
|
|
64
|
+
file_size: int = 0
|
|
65
|
+
label: str = ""
|
|
66
|
+
registry_key: str = ""
|
|
67
|
+
icon_path: str = ""
|
|
68
|
+
icon_type: str = "" # file, special, etc.
|
|
69
|
+
has_permissions: bool = False
|
|
70
|
+
compatible: bool = False
|
|
71
|
+
windows_version: str = ""
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
# ///////////////////////////////////////////////////////////////
|
|
75
|
+
# SCRIPT REGISTRATION RESULTS
|
|
76
|
+
# ///////////////////////////////////////////////////////////////
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
@dataclass
|
|
80
|
+
class ScriptRegistrationResult(BaseResult):
|
|
81
|
+
"""Result for script registration in context menu."""
|
|
82
|
+
|
|
83
|
+
script_path: str = ""
|
|
84
|
+
script_type: str = ""
|
|
85
|
+
label: str = ""
|
|
86
|
+
icon_path: str | None = None
|
|
87
|
+
registry_key: str = ""
|
|
88
|
+
command: str = ""
|
|
89
|
+
context_info: str = ""
|
|
90
|
+
dry_run: bool = False
|
|
91
|
+
success_count: int = 0
|
|
92
|
+
total_paths: int = 0
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
@dataclass
|
|
96
|
+
class ScriptUnregistrationResult(BaseResult):
|
|
97
|
+
"""Result for script unregistration from context menu."""
|
|
98
|
+
|
|
99
|
+
key_name: str = ""
|
|
100
|
+
dry_run: bool = False
|
|
101
|
+
success_count: int = 0
|
|
102
|
+
total_types: int = 0
|
|
103
|
+
permission_errors: list[str] | None = None
|
|
104
|
+
not_found_count: int = 0
|
|
105
|
+
|
|
106
|
+
def __post_init__(self) -> None:
|
|
107
|
+
"""Initialize derived fields."""
|
|
108
|
+
if self.permission_errors is None:
|
|
109
|
+
self.permission_errors = []
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
# ///////////////////////////////////////////////////////////////
|
|
113
|
+
# BACKUP/RESTORE RESULTS
|
|
114
|
+
# ///////////////////////////////////////////////////////////////
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
@dataclass
|
|
118
|
+
class ContextBackupResult(BaseResult):
|
|
119
|
+
"""Result for context menu backup operation."""
|
|
120
|
+
|
|
121
|
+
backup_file: str = ""
|
|
122
|
+
entry_count: int = 0
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
@dataclass
|
|
126
|
+
class ContextRestoreResult(BaseResult):
|
|
127
|
+
"""Result for context menu restore operation."""
|
|
128
|
+
|
|
129
|
+
backup_file: str = ""
|
|
130
|
+
entry_count: int = 0
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
# ///////////////////////////////////////////////////////////////
|
|
134
|
+
# ENTRIES RESULTS
|
|
135
|
+
# ///////////////////////////////////////////////////////////////
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
@dataclass
|
|
139
|
+
class ContextEntriesResult(BaseResult):
|
|
140
|
+
"""Result for listing context menu entries."""
|
|
141
|
+
|
|
142
|
+
entries: dict[str, list[dict[str, str | None]]] | None = None
|
|
143
|
+
|
|
144
|
+
def __post_init__(self) -> None:
|
|
145
|
+
"""Initialize derived fields."""
|
|
146
|
+
if self.entries is None:
|
|
147
|
+
self.entries = {}
|
|
148
|
+
|
|
149
|
+
@property
|
|
150
|
+
def entries_by_type(self) -> dict[str, int]:
|
|
151
|
+
"""Entry count per context type, for the types actually present."""
|
|
152
|
+
return {
|
|
153
|
+
context_type: len(context_entries)
|
|
154
|
+
for context_type, context_entries in (self.entries or {}).items()
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
@property
|
|
158
|
+
def total_entries(self) -> int:
|
|
159
|
+
"""Total number of registered entries, across all context types."""
|
|
160
|
+
return sum(
|
|
161
|
+
len(context_entries) for context_entries in (self.entries or {}).values()
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
# ///////////////////////////////////////////////////////////////
|
|
166
|
+
# SETUP RESULTS
|
|
167
|
+
# ///////////////////////////////////////////////////////////////
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
@dataclass
|
|
171
|
+
class ContextSetupResult(BaseResult):
|
|
172
|
+
"""Result for quick setup of context menu tools."""
|
|
173
|
+
|
|
174
|
+
success_count: int = 0
|
|
175
|
+
total_tools: int = 0
|
|
176
|
+
tools_registered: list[str] | None = None
|
|
177
|
+
|
|
178
|
+
def __post_init__(self) -> None:
|
|
179
|
+
"""Initialize derived fields."""
|
|
180
|
+
if self.tools_registered is None:
|
|
181
|
+
self.tools_registered = []
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
@dataclass
|
|
185
|
+
class ScriptInfoResult(BaseResult):
|
|
186
|
+
"""Result for script type detection and command building."""
|
|
187
|
+
|
|
188
|
+
script_path: str = ""
|
|
189
|
+
script_type: str = ""
|
|
190
|
+
extension: str = ""
|
|
191
|
+
default_icon: str | None = None
|
|
192
|
+
context_params: str = ""
|
|
193
|
+
command: str = ""
|
|
194
|
+
# Enriched by ContextMenuInterface.get_script_info(); left unset by the
|
|
195
|
+
# detector itself, which knows nothing about icons or the registry.
|
|
196
|
+
resolved_icon: str | None = None
|
|
197
|
+
registry_key: str | None = None
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
@dataclass
|
|
201
|
+
class ScriptValidationResult(BaseResult):
|
|
202
|
+
"""Result for validating that a script can be registered."""
|
|
203
|
+
|
|
204
|
+
script_path: str = ""
|
|
205
|
+
script_type: str = ""
|
|
206
|
+
command: str = ""
|
|
207
|
+
permissions_ok: bool = False
|
|
208
|
+
permissions_error: str = ""
|
|
209
|
+
compatibility_ok: bool = False
|
|
210
|
+
compatibility_error: str = ""
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
@dataclass
|
|
214
|
+
class BackupFileInfo:
|
|
215
|
+
"""A single registry backup file's metadata (plain record, not a Result)."""
|
|
216
|
+
|
|
217
|
+
filename: str
|
|
218
|
+
filepath: str
|
|
219
|
+
size_bytes: int = 0
|
|
220
|
+
modified_time: datetime | None = None
|
|
221
|
+
entry_count: int = 0
|
|
222
|
+
backup_version: str = "unknown"
|
|
223
|
+
backup_timestamp: str = "unknown"
|
|
224
|
+
context_types: list[str] | None = None
|
|
225
|
+
|
|
226
|
+
def __post_init__(self) -> None:
|
|
227
|
+
"""Initialize derived fields."""
|
|
228
|
+
if self.context_types is None:
|
|
229
|
+
self.context_types = []
|
|
230
|
+
|
|
231
|
+
@property
|
|
232
|
+
def size_kb(self) -> float:
|
|
233
|
+
"""File size in kilobytes."""
|
|
234
|
+
return self.size_bytes / 1024
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
@dataclass
|
|
238
|
+
class BackupFileResult(BaseResult):
|
|
239
|
+
"""Result for creating, copying, or merging a registry backup file."""
|
|
240
|
+
|
|
241
|
+
filepath: str = ""
|
|
242
|
+
metadata: dict | None = None
|
|
243
|
+
data: dict | None = None
|
|
244
|
+
|
|
245
|
+
def __post_init__(self) -> None:
|
|
246
|
+
"""Initialize derived fields."""
|
|
247
|
+
if self.metadata is None:
|
|
248
|
+
self.metadata = {}
|
|
249
|
+
if self.data is None:
|
|
250
|
+
self.data = {}
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
@dataclass
|
|
254
|
+
class BackupFileListResult(BaseResult):
|
|
255
|
+
"""Result for listing registry backup files."""
|
|
256
|
+
|
|
257
|
+
backup_directory: str = ""
|
|
258
|
+
backups: list[BackupFileInfo] | None = None
|
|
259
|
+
|
|
260
|
+
def __post_init__(self) -> None:
|
|
261
|
+
"""Initialize derived fields."""
|
|
262
|
+
if self.backups is None:
|
|
263
|
+
self.backups = []
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
@dataclass
|
|
267
|
+
class BackupDataResult(BaseResult):
|
|
268
|
+
"""Result for loading or inspecting a registry backup file."""
|
|
269
|
+
|
|
270
|
+
filepath: str = ""
|
|
271
|
+
data: dict | None = None
|
|
272
|
+
metadata: dict | None = None
|
|
273
|
+
entry_stats: dict | None = None
|
|
274
|
+
|
|
275
|
+
def __post_init__(self) -> None:
|
|
276
|
+
"""Initialize derived fields."""
|
|
277
|
+
if self.data is None:
|
|
278
|
+
self.data = {}
|
|
279
|
+
if self.metadata is None:
|
|
280
|
+
self.metadata = {}
|
|
281
|
+
if self.entry_stats is None:
|
|
282
|
+
self.entry_stats = {}
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
@dataclass
|
|
286
|
+
class BackupCleanupResult(BaseResult):
|
|
287
|
+
"""Result for pruning old registry backup files."""
|
|
288
|
+
|
|
289
|
+
deleted_files: list[str] | None = None
|
|
290
|
+
kept_files: list[str] | None = None
|
|
291
|
+
|
|
292
|
+
def __post_init__(self) -> None:
|
|
293
|
+
"""Initialize derived fields."""
|
|
294
|
+
if self.deleted_files is None:
|
|
295
|
+
self.deleted_files = []
|
|
296
|
+
if self.kept_files is None:
|
|
297
|
+
self.kept_files = []
|
|
298
|
+
|
|
299
|
+
@property
|
|
300
|
+
def deleted_count(self) -> int:
|
|
301
|
+
"""Number of backup files removed."""
|
|
302
|
+
return len(self.deleted_files or [])
|
|
303
|
+
|
|
304
|
+
@property
|
|
305
|
+
def kept_count(self) -> int:
|
|
306
|
+
"""Number of backup files retained."""
|
|
307
|
+
return len(self.kept_files or [])
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
@dataclass
|
|
311
|
+
class ContextCherryPickResult(BaseResult):
|
|
312
|
+
"""Result for cherry-picking context menu entries from backups."""
|
|
313
|
+
|
|
314
|
+
success_count: int = 0
|
|
315
|
+
total_selected: int = 0
|
|
316
|
+
selected_entries: list[str] | None = None
|
|
317
|
+
|
|
318
|
+
def __post_init__(self) -> None:
|
|
319
|
+
"""Initialize derived fields."""
|
|
320
|
+
if self.selected_entries is None:
|
|
321
|
+
self.selected_entries = []
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
# ///////////////////////////////////////////////////////////////
|
|
325
|
+
# PUBLIC API
|
|
326
|
+
# ///////////////////////////////////////////////////////////////
|
|
327
|
+
|
|
328
|
+
__all__ = [
|
|
329
|
+
"BackupCleanupResult",
|
|
330
|
+
"BackupDataResult",
|
|
331
|
+
"BackupFileInfo",
|
|
332
|
+
"BackupFileListResult",
|
|
333
|
+
"BackupFileResult",
|
|
334
|
+
"ContextBackupResult",
|
|
335
|
+
"ContextCherryPickResult",
|
|
336
|
+
"ContextEntriesResult",
|
|
337
|
+
"ContextRegistryResult",
|
|
338
|
+
"ContextRestoreResult",
|
|
339
|
+
"ContextSetupResult",
|
|
340
|
+
"ContextValidationResult",
|
|
341
|
+
"ScriptInfoResult",
|
|
342
|
+
"ScriptRegistrationResult",
|
|
343
|
+
"ScriptUnregistrationResult",
|
|
344
|
+
"ScriptValidationResult",
|
|
345
|
+
]
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# ///////////////////////////////////////////////////////////////
|
|
3
|
+
# DEPENDENCY RESULTS - Dependency Diagnostic Result Classes
|
|
4
|
+
# Project: works-on-my-machine
|
|
5
|
+
# ///////////////////////////////////////////////////////////////
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
Dependency result classes for Works On My Machine.
|
|
9
|
+
|
|
10
|
+
This module contains result classes for the read-only dependency diagnostic
|
|
11
|
+
across the two strata WOMM depends on (runtimes, runtime package managers):
|
|
12
|
+
- Availability check
|
|
13
|
+
- Status report
|
|
14
|
+
- Static inventory
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
# ///////////////////////////////////////////////////////////////
|
|
20
|
+
# IMPORTS
|
|
21
|
+
# ///////////////////////////////////////////////////////////////
|
|
22
|
+
# Standard library imports
|
|
23
|
+
from dataclasses import dataclass, field
|
|
24
|
+
|
|
25
|
+
# Local imports
|
|
26
|
+
from .base import BaseResult
|
|
27
|
+
|
|
28
|
+
# ///////////////////////////////////////////////////////////////
|
|
29
|
+
# PLAIN RECORDS
|
|
30
|
+
# ///////////////////////////////////////////////////////////////
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@dataclass
|
|
34
|
+
class DependencyProbe:
|
|
35
|
+
"""A single probed dependency (plain record, not a Result)."""
|
|
36
|
+
|
|
37
|
+
name: str
|
|
38
|
+
available: bool
|
|
39
|
+
path: str | None = None
|
|
40
|
+
version: str | None = None
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
@dataclass
|
|
44
|
+
class DependencyInventoryEntry:
|
|
45
|
+
"""A statically configured dependency (no probing involved)."""
|
|
46
|
+
|
|
47
|
+
name: str
|
|
48
|
+
detail: str = ""
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
# ///////////////////////////////////////////////////////////////
|
|
52
|
+
# DEPENDENCY CHECK RESULT
|
|
53
|
+
# ///////////////////////////////////////////////////////////////
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
@dataclass
|
|
57
|
+
class DependencyCheckResult(BaseResult):
|
|
58
|
+
"""Result for probing every dependency across both strata."""
|
|
59
|
+
|
|
60
|
+
runtime: list[DependencyProbe] = field(default_factory=list)
|
|
61
|
+
package_managers: list[DependencyProbe] = field(default_factory=list)
|
|
62
|
+
|
|
63
|
+
@property
|
|
64
|
+
def runtime_ok(self) -> bool:
|
|
65
|
+
"""Every configured runtime is available."""
|
|
66
|
+
return all(entry.available for entry in self.runtime)
|
|
67
|
+
|
|
68
|
+
@property
|
|
69
|
+
def package_managers_ok(self) -> bool:
|
|
70
|
+
"""At least one runtime package manager is available."""
|
|
71
|
+
return any(entry.available for entry in self.package_managers)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
# ///////////////////////////////////////////////////////////////
|
|
75
|
+
# DEPENDENCY STATUS RESULT
|
|
76
|
+
# ///////////////////////////////////////////////////////////////
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
@dataclass
|
|
80
|
+
class DependencyStatusResult(BaseResult):
|
|
81
|
+
"""Result for the comprehensive dependency status report."""
|
|
82
|
+
|
|
83
|
+
runtime: list[DependencyProbe] = field(default_factory=list)
|
|
84
|
+
package_managers: list[DependencyProbe] = field(default_factory=list)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
# ///////////////////////////////////////////////////////////////
|
|
88
|
+
# DEPENDENCY INVENTORY RESULT
|
|
89
|
+
# ///////////////////////////////////////////////////////////////
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
@dataclass
|
|
93
|
+
class DependencyInventoryResult(BaseResult):
|
|
94
|
+
"""Result for the static dependency inventory (no probing)."""
|
|
95
|
+
|
|
96
|
+
runtime: list[DependencyInventoryEntry] = field(default_factory=list)
|
|
97
|
+
package_managers: list[DependencyInventoryEntry] = field(default_factory=list)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
# ///////////////////////////////////////////////////////////////
|
|
101
|
+
# PUBLIC API
|
|
102
|
+
# ///////////////////////////////////////////////////////////////
|
|
103
|
+
|
|
104
|
+
__all__ = [
|
|
105
|
+
"DependencyCheckResult",
|
|
106
|
+
"DependencyInventoryEntry",
|
|
107
|
+
"DependencyInventoryResult",
|
|
108
|
+
"DependencyProbe",
|
|
109
|
+
"DependencyStatusResult",
|
|
110
|
+
]
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# ///////////////////////////////////////////////////////////////
|
|
3
|
+
# DOCTOR RESULTS - Runtime Diagnostic Result Classes
|
|
4
|
+
# Project: works-on-my-machine
|
|
5
|
+
# ///////////////////////////////////////////////////////////////
|
|
6
|
+
|
|
7
|
+
"""Result class for the read-only runtime diagnostic (``womm doctor``)."""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
# ///////////////////////////////////////////////////////////////
|
|
12
|
+
# IMPORTS
|
|
13
|
+
# ///////////////////////////////////////////////////////////////
|
|
14
|
+
# Standard library imports
|
|
15
|
+
from dataclasses import dataclass
|
|
16
|
+
|
|
17
|
+
# Local imports
|
|
18
|
+
from .base import BaseResult
|
|
19
|
+
|
|
20
|
+
# ///////////////////////////////////////////////////////////////
|
|
21
|
+
# DOCTOR RESULT
|
|
22
|
+
# ///////////////////////////////////////////////////////////////
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@dataclass
|
|
26
|
+
class DoctorResult(BaseResult):
|
|
27
|
+
"""Result for the runtime diagnostic report."""
|
|
28
|
+
|
|
29
|
+
version: str = ""
|
|
30
|
+
executable: str = ""
|
|
31
|
+
data_dir: str = ""
|
|
32
|
+
data_dir_writable: bool = False
|
|
33
|
+
path_command: str | None = None
|
|
34
|
+
context_menu_status: str = ""
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
# ///////////////////////////////////////////////////////////////
|
|
38
|
+
# PUBLIC API
|
|
39
|
+
# ///////////////////////////////////////////////////////////////
|
|
40
|
+
|
|
41
|
+
__all__ = ["DoctorResult"]
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# ///////////////////////////////////////////////////////////////
|
|
3
|
+
# FILE RESULTS - File Result Classes
|
|
4
|
+
# Project: works-on-my-machine
|
|
5
|
+
# ///////////////////////////////////////////////////////////////
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
File result classes for Works On My Machine.
|
|
9
|
+
|
|
10
|
+
This module contains result classes for file operations:
|
|
11
|
+
- File operations (copy, create, delete, etc.)
|
|
12
|
+
- File scanning operations
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
# ///////////////////////////////////////////////////////////////
|
|
18
|
+
# IMPORTS
|
|
19
|
+
# ///////////////////////////////////////////////////////////////
|
|
20
|
+
# Standard library imports
|
|
21
|
+
from dataclasses import dataclass
|
|
22
|
+
from pathlib import Path
|
|
23
|
+
|
|
24
|
+
# Local imports
|
|
25
|
+
from .base import BaseResult
|
|
26
|
+
|
|
27
|
+
# ///////////////////////////////////////////////////////////////
|
|
28
|
+
# FILE OPERATION RESULT
|
|
29
|
+
# ///////////////////////////////////////////////////////////////
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@dataclass
|
|
33
|
+
class FileOperationResult(BaseResult):
|
|
34
|
+
"""Result for file operations."""
|
|
35
|
+
|
|
36
|
+
operation: str = "" # copy, create, delete, etc.
|
|
37
|
+
source_path: Path | None = None
|
|
38
|
+
destination_path: Path | None = None
|
|
39
|
+
file_size: int = 0
|
|
40
|
+
operation_time: float = 0.0
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
# ///////////////////////////////////////////////////////////////
|
|
44
|
+
# FILE SCAN RESULT
|
|
45
|
+
# ///////////////////////////////////////////////////////////////
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@dataclass
|
|
49
|
+
class FileScanResult(BaseResult):
|
|
50
|
+
"""Result for file scanning operations."""
|
|
51
|
+
|
|
52
|
+
target_path: Path | None = None
|
|
53
|
+
total_files: int = 0
|
|
54
|
+
files_found: list[Path] | None = None
|
|
55
|
+
excluded_dirs: list[str] | None = None
|
|
56
|
+
file_extensions: list[str] | None = None
|
|
57
|
+
scan_time: float = 0.0
|
|
58
|
+
|
|
59
|
+
def __post_init__(self) -> None:
|
|
60
|
+
"""Initialize derived fields."""
|
|
61
|
+
if self.files_found is None:
|
|
62
|
+
self.files_found = []
|
|
63
|
+
if self.excluded_dirs is None:
|
|
64
|
+
self.excluded_dirs = []
|
|
65
|
+
if self.file_extensions is None:
|
|
66
|
+
self.file_extensions = []
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
# ///////////////////////////////////////////////////////////////
|
|
70
|
+
# FILE SEARCH RESULT
|
|
71
|
+
# ///////////////////////////////////////////////////////////////
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
@dataclass
|
|
75
|
+
class FileSearchResult(BaseResult):
|
|
76
|
+
"""Result for finding Python files."""
|
|
77
|
+
|
|
78
|
+
target_path: Path | None = None
|
|
79
|
+
files_found: list[Path] | None = None
|
|
80
|
+
recursive: bool = False
|
|
81
|
+
search_time: float = 0.0
|
|
82
|
+
|
|
83
|
+
def __post_init__(self) -> None:
|
|
84
|
+
"""Initialize derived fields."""
|
|
85
|
+
if self.files_found is None:
|
|
86
|
+
self.files_found = []
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
# ///////////////////////////////////////////////////////////////
|
|
90
|
+
# PUBLIC API
|
|
91
|
+
# ///////////////////////////////////////////////////////////////
|
|
92
|
+
|
|
93
|
+
__all__ = [
|
|
94
|
+
"FileOperationResult",
|
|
95
|
+
"FileScanResult",
|
|
96
|
+
"FileSearchResult",
|
|
97
|
+
]
|