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,391 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# ///////////////////////////////////////////////////////////////
|
|
3
|
+
# PROJECT CORE UTILS - Core Project Functionality
|
|
4
|
+
# Project: works-on-my-machine
|
|
5
|
+
# ///////////////////////////////////////////////////////////////
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
Core project utilities - consolidated project detection and discovery utilities.
|
|
9
|
+
|
|
10
|
+
Merged from:
|
|
11
|
+
- project_detection_utils.py
|
|
12
|
+
- project_structure_utils.py
|
|
13
|
+
- project_config_utils.py
|
|
14
|
+
|
|
15
|
+
Provides core functionality for:
|
|
16
|
+
- Detecting project types and configurations
|
|
17
|
+
- Creating project structures
|
|
18
|
+
- Creating configuration files
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
from __future__ import annotations
|
|
22
|
+
|
|
23
|
+
# ///////////////////////////////////////////////////////////////
|
|
24
|
+
# IMPORTS
|
|
25
|
+
# ///////////////////////////////////////////////////////////////
|
|
26
|
+
# Standard library imports
|
|
27
|
+
import json
|
|
28
|
+
import logging
|
|
29
|
+
from pathlib import Path
|
|
30
|
+
|
|
31
|
+
# ///////////////////////////////////////////////////////////////
|
|
32
|
+
# LOGGER SETUP
|
|
33
|
+
# ///////////////////////////////////////////////////////////////
|
|
34
|
+
|
|
35
|
+
logger = logging.getLogger(__name__)
|
|
36
|
+
|
|
37
|
+
# ///////////////////////////////////////////////////////////////
|
|
38
|
+
# PROJECT DETECTION & ANALYSIS
|
|
39
|
+
# ///////////////////////////////////////////////////////////////
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def matches_project_type(config_files: dict[str, list[str]], project_type: str) -> bool:
|
|
43
|
+
"""
|
|
44
|
+
Check if configuration files match a project type.
|
|
45
|
+
|
|
46
|
+
Args:
|
|
47
|
+
config_files: Dict mapping project types to their marker files
|
|
48
|
+
project_type: Type to check for
|
|
49
|
+
|
|
50
|
+
Returns:
|
|
51
|
+
True if project type markers found, False otherwise
|
|
52
|
+
"""
|
|
53
|
+
return bool(config_files.get(project_type, []))
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def categorize_directory(path: Path) -> str:
|
|
57
|
+
"""
|
|
58
|
+
Categorize a directory based on its contents.
|
|
59
|
+
|
|
60
|
+
Args:
|
|
61
|
+
path: Directory path to categorize
|
|
62
|
+
|
|
63
|
+
Returns:
|
|
64
|
+
Directory category string
|
|
65
|
+
"""
|
|
66
|
+
if not path.is_dir():
|
|
67
|
+
return "unknown"
|
|
68
|
+
|
|
69
|
+
# Check for specific indicators
|
|
70
|
+
if (path / "package.json").exists():
|
|
71
|
+
return "javascript"
|
|
72
|
+
if (path / "pyproject.toml").exists() or (path / "setup.py").exists():
|
|
73
|
+
return "python"
|
|
74
|
+
if (path / "pom.xml").exists():
|
|
75
|
+
return "java"
|
|
76
|
+
if (path / ".git").exists():
|
|
77
|
+
return "git_repo"
|
|
78
|
+
|
|
79
|
+
return "generic"
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def analyze_python_config(project_path: Path) -> dict[str, dict[str, str]]:
|
|
83
|
+
"""
|
|
84
|
+
Analyze Python project configuration.
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
project_path: Path to Python project
|
|
88
|
+
|
|
89
|
+
Returns:
|
|
90
|
+
Dictionary with Python configuration details
|
|
91
|
+
"""
|
|
92
|
+
config = {"markers": {}, "details": {}}
|
|
93
|
+
|
|
94
|
+
# Check for configuration files
|
|
95
|
+
if (project_path / "pyproject.toml").exists():
|
|
96
|
+
config["markers"]["pyproject_toml"] = "found"
|
|
97
|
+
|
|
98
|
+
if (project_path / "setup.py").exists():
|
|
99
|
+
config["markers"]["setup_py"] = "found"
|
|
100
|
+
|
|
101
|
+
if (project_path / "requirements.txt").exists():
|
|
102
|
+
config["markers"]["requirements_txt"] = "found"
|
|
103
|
+
|
|
104
|
+
if (project_path / ".venv").exists():
|
|
105
|
+
config["details"]["venv"] = str(project_path / ".venv")
|
|
106
|
+
|
|
107
|
+
return config
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def analyze_javascript_config(
|
|
111
|
+
project_path: Path,
|
|
112
|
+
) -> dict[str, dict[str, str]]:
|
|
113
|
+
"""
|
|
114
|
+
Analyze JavaScript project configuration.
|
|
115
|
+
|
|
116
|
+
Args:
|
|
117
|
+
project_path: Path to JavaScript project
|
|
118
|
+
|
|
119
|
+
Returns:
|
|
120
|
+
Dictionary with JavaScript configuration details
|
|
121
|
+
"""
|
|
122
|
+
config = {"markers": {}, "details": {}}
|
|
123
|
+
|
|
124
|
+
if (project_path / "package.json").exists():
|
|
125
|
+
config["markers"]["package_json"] = "found"
|
|
126
|
+
|
|
127
|
+
if (project_path / "package-lock.json").exists():
|
|
128
|
+
config["markers"]["package_lock"] = "found"
|
|
129
|
+
|
|
130
|
+
if (project_path / "yarn.lock").exists():
|
|
131
|
+
config["markers"]["yarn_lock"] = "found"
|
|
132
|
+
|
|
133
|
+
if (project_path / "node_modules").exists():
|
|
134
|
+
config["details"]["node_modules"] = "present"
|
|
135
|
+
|
|
136
|
+
return config
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def analyze_java_config(project_path: Path) -> dict[str, dict[str, str]]:
|
|
140
|
+
"""
|
|
141
|
+
Analyze Java project configuration.
|
|
142
|
+
|
|
143
|
+
Args:
|
|
144
|
+
project_path: Path to Java project
|
|
145
|
+
|
|
146
|
+
Returns:
|
|
147
|
+
Dictionary with Java configuration details
|
|
148
|
+
"""
|
|
149
|
+
config = {"markers": {}, "details": {}}
|
|
150
|
+
|
|
151
|
+
if (project_path / "pom.xml").exists():
|
|
152
|
+
config["markers"]["pom_xml"] = "found"
|
|
153
|
+
|
|
154
|
+
if (project_path / "build.gradle").exists():
|
|
155
|
+
config["markers"]["gradle"] = "found"
|
|
156
|
+
|
|
157
|
+
if (project_path / "build.sbt").exists():
|
|
158
|
+
config["markers"]["sbt"] = "found"
|
|
159
|
+
|
|
160
|
+
return config
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
def analyze_go_config(project_path: Path) -> dict[str, dict[str, str]]:
|
|
164
|
+
"""
|
|
165
|
+
Analyze Go project configuration.
|
|
166
|
+
|
|
167
|
+
Args:
|
|
168
|
+
project_path: Path to Go project
|
|
169
|
+
|
|
170
|
+
Returns:
|
|
171
|
+
Dictionary with Go configuration details
|
|
172
|
+
"""
|
|
173
|
+
config = {"markers": {}, "details": {}}
|
|
174
|
+
|
|
175
|
+
if (project_path / "go.mod").exists():
|
|
176
|
+
config["markers"]["go_mod"] = "found"
|
|
177
|
+
|
|
178
|
+
if (project_path / "go.sum").exists():
|
|
179
|
+
config["markers"]["go_sum"] = "found"
|
|
180
|
+
|
|
181
|
+
return config
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
def analyze_rust_config(project_path: Path) -> dict[str, dict[str, str]]:
|
|
185
|
+
"""
|
|
186
|
+
Analyze Rust project configuration.
|
|
187
|
+
|
|
188
|
+
Args:
|
|
189
|
+
project_path: Path to Rust project
|
|
190
|
+
|
|
191
|
+
Returns:
|
|
192
|
+
Dictionary with Rust configuration details
|
|
193
|
+
"""
|
|
194
|
+
config = {"markers": {}, "details": {}}
|
|
195
|
+
|
|
196
|
+
if (project_path / "Cargo.toml").exists():
|
|
197
|
+
config["markers"]["cargo_toml"] = "found"
|
|
198
|
+
|
|
199
|
+
if (project_path / "Cargo.lock").exists():
|
|
200
|
+
config["markers"]["cargo_lock"] = "found"
|
|
201
|
+
|
|
202
|
+
return config
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
def analyze_csharp_config(project_path: Path) -> dict[str, dict[str, str]]:
|
|
206
|
+
"""
|
|
207
|
+
Analyze C# project configuration.
|
|
208
|
+
|
|
209
|
+
Args:
|
|
210
|
+
project_path: Path to C# project
|
|
211
|
+
|
|
212
|
+
Returns:
|
|
213
|
+
Dictionary with C# configuration details
|
|
214
|
+
"""
|
|
215
|
+
config = {"markers": {}, "details": {}}
|
|
216
|
+
|
|
217
|
+
# Check for .csproj files
|
|
218
|
+
csproj_files = list(project_path.glob("*.csproj"))
|
|
219
|
+
if csproj_files:
|
|
220
|
+
config["markers"]["csproj"] = "found"
|
|
221
|
+
|
|
222
|
+
# Check for .sln files
|
|
223
|
+
sln_files = list(project_path.glob("*.sln"))
|
|
224
|
+
if sln_files:
|
|
225
|
+
config["markers"]["sln"] = "found"
|
|
226
|
+
|
|
227
|
+
return config
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
# ///////////////////////////////////////////////////////////////
|
|
231
|
+
# PROJECT STRUCTURE CREATION
|
|
232
|
+
# ///////////////////////////////////////////////////////////////
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
def create_common_structure(project_path: Path, _project_name: str) -> list[str]:
|
|
236
|
+
"""
|
|
237
|
+
Create common project structure.
|
|
238
|
+
|
|
239
|
+
Args:
|
|
240
|
+
project_path: Path where project will be created
|
|
241
|
+
project_name: Name of the project
|
|
242
|
+
|
|
243
|
+
Returns:
|
|
244
|
+
List of created directories
|
|
245
|
+
"""
|
|
246
|
+
created = []
|
|
247
|
+
|
|
248
|
+
common_dirs = [
|
|
249
|
+
project_path / "src",
|
|
250
|
+
project_path / "tests",
|
|
251
|
+
project_path / "docs",
|
|
252
|
+
project_path / ".github",
|
|
253
|
+
]
|
|
254
|
+
|
|
255
|
+
for dir_path in common_dirs:
|
|
256
|
+
dir_path.mkdir(parents=True, exist_ok=True)
|
|
257
|
+
created.append(str(dir_path))
|
|
258
|
+
logger.debug(f"Created directory: {dir_path}")
|
|
259
|
+
|
|
260
|
+
return created
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
def create_python_structure(project_path: Path, project_name: str) -> list[str]:
|
|
264
|
+
"""
|
|
265
|
+
Create Python-specific project structure.
|
|
266
|
+
|
|
267
|
+
Args:
|
|
268
|
+
project_path: Path where project will be created
|
|
269
|
+
project_name: Name of the project
|
|
270
|
+
|
|
271
|
+
Returns:
|
|
272
|
+
List of created directories
|
|
273
|
+
"""
|
|
274
|
+
created = list(create_common_structure(project_path, project_name))
|
|
275
|
+
|
|
276
|
+
python_dirs = [
|
|
277
|
+
project_path / project_name,
|
|
278
|
+
project_path / "tests",
|
|
279
|
+
project_path / "src",
|
|
280
|
+
]
|
|
281
|
+
|
|
282
|
+
for dir_path in python_dirs:
|
|
283
|
+
dir_path.mkdir(parents=True, exist_ok=True)
|
|
284
|
+
if dir_path not in [Path(p) for p in created]:
|
|
285
|
+
created.append(str(dir_path))
|
|
286
|
+
logger.debug(f"Created Python directory: {dir_path}")
|
|
287
|
+
|
|
288
|
+
return created
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
def create_javascript_structure(project_path: Path, project_name: str) -> list[str]:
|
|
292
|
+
"""
|
|
293
|
+
Create JavaScript-specific project structure.
|
|
294
|
+
|
|
295
|
+
Args:
|
|
296
|
+
project_path: Path where project will be created
|
|
297
|
+
project_name: Name of the project
|
|
298
|
+
|
|
299
|
+
Returns:
|
|
300
|
+
List of created directories
|
|
301
|
+
"""
|
|
302
|
+
created = list(create_common_structure(project_path, project_name))
|
|
303
|
+
|
|
304
|
+
js_dirs = [
|
|
305
|
+
project_path / "src",
|
|
306
|
+
project_path / "src" / "components",
|
|
307
|
+
project_path / "src" / "utils",
|
|
308
|
+
project_path / "tests",
|
|
309
|
+
project_path / "public",
|
|
310
|
+
]
|
|
311
|
+
|
|
312
|
+
for dir_path in js_dirs:
|
|
313
|
+
dir_path.mkdir(parents=True, exist_ok=True)
|
|
314
|
+
if dir_path not in [Path(p) for p in created]:
|
|
315
|
+
created.append(str(dir_path))
|
|
316
|
+
logger.debug(f"Created JavaScript directory: {dir_path}")
|
|
317
|
+
|
|
318
|
+
return created
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
# ///////////////////////////////////////////////////////////////
|
|
322
|
+
# PROJECT CONFIGURATION FILE CREATION
|
|
323
|
+
# ///////////////////////////////////////////////////////////////
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
def create_python_requirements_files(project_path: Path) -> list[str]:
|
|
327
|
+
"""
|
|
328
|
+
Create Python requirements files.
|
|
329
|
+
|
|
330
|
+
Args:
|
|
331
|
+
project_path: Path to Python project
|
|
332
|
+
|
|
333
|
+
Returns:
|
|
334
|
+
List of created files
|
|
335
|
+
"""
|
|
336
|
+
created = []
|
|
337
|
+
|
|
338
|
+
requirements_txt = project_path / "requirements.txt"
|
|
339
|
+
requirements_txt.touch()
|
|
340
|
+
created.append(str(requirements_txt))
|
|
341
|
+
|
|
342
|
+
requirements_dev_txt = project_path / "requirements-dev.txt"
|
|
343
|
+
requirements_dev_txt.touch()
|
|
344
|
+
created.append(str(requirements_dev_txt))
|
|
345
|
+
|
|
346
|
+
return created
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
def create_python_dev_config_files(project_path: Path) -> list[str]:
|
|
350
|
+
"""
|
|
351
|
+
Create Python development configuration files.
|
|
352
|
+
|
|
353
|
+
Args:
|
|
354
|
+
project_path: Path to Python project
|
|
355
|
+
|
|
356
|
+
Returns:
|
|
357
|
+
List of created files
|
|
358
|
+
"""
|
|
359
|
+
created = []
|
|
360
|
+
|
|
361
|
+
pyproject_toml = project_path / "pyproject.toml"
|
|
362
|
+
if not pyproject_toml.exists():
|
|
363
|
+
pyproject_toml.touch()
|
|
364
|
+
created.append(str(pyproject_toml))
|
|
365
|
+
|
|
366
|
+
return created
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
def create_javascript_config_files(project_path: Path) -> list[str]:
|
|
370
|
+
"""
|
|
371
|
+
Create JavaScript configuration files.
|
|
372
|
+
|
|
373
|
+
Args:
|
|
374
|
+
project_path: Path to JavaScript project
|
|
375
|
+
|
|
376
|
+
Returns:
|
|
377
|
+
List of created files
|
|
378
|
+
"""
|
|
379
|
+
created = []
|
|
380
|
+
|
|
381
|
+
package_json = project_path / "package.json"
|
|
382
|
+
if not package_json.exists():
|
|
383
|
+
package_json.write_text(json.dumps({"name": "", "version": "1.0.0"}, indent=2))
|
|
384
|
+
created.append(str(package_json))
|
|
385
|
+
|
|
386
|
+
gitignore = project_path / ".gitignore"
|
|
387
|
+
if not gitignore.exists():
|
|
388
|
+
gitignore.write_text("node_modules/\n.env\n")
|
|
389
|
+
created.append(str(gitignore))
|
|
390
|
+
|
|
391
|
+
return created
|