djinitx 0.1.0__tar.gz

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.
Files changed (50) hide show
  1. djinitx-0.1.0/LICENSE +21 -0
  2. djinitx-0.1.0/MANIFEST.in +3 -0
  3. djinitx-0.1.0/PKG-INFO +182 -0
  4. djinitx-0.1.0/README.md +142 -0
  5. djinitx-0.1.0/djinit/__init__.py +0 -0
  6. djinitx-0.1.0/djinit/cli.py +109 -0
  7. djinitx-0.1.0/djinit/generator.py +74 -0
  8. djinitx-0.1.0/djinit/scripts/__init__.py +0 -0
  9. djinitx-0.1.0/djinit/scripts/app_generator.py +254 -0
  10. djinitx-0.1.0/djinit/scripts/cicd_config_generator.py +41 -0
  11. djinitx-0.1.0/djinit/scripts/command_handler.py +140 -0
  12. djinitx-0.1.0/djinit/scripts/console_ui.py +381 -0
  13. djinitx-0.1.0/djinit/scripts/deployment_files_generator.py +118 -0
  14. djinitx-0.1.0/djinit/scripts/files.py +163 -0
  15. djinitx-0.1.0/djinit/scripts/input_handler.py +406 -0
  16. djinitx-0.1.0/djinit/scripts/name_validator.py +52 -0
  17. djinitx-0.1.0/djinit/scripts/project.py +111 -0
  18. djinitx-0.1.0/djinit/scripts/secretkey_generator.py +59 -0
  19. djinitx-0.1.0/djinit/scripts/settings.py +86 -0
  20. djinitx-0.1.0/djinit/scripts/template_engine.py +80 -0
  21. djinitx-0.1.0/djinit/templates/app_urls.j2 +9 -0
  22. djinitx-0.1.0/djinit/templates/asgi.j2 +9 -0
  23. djinitx-0.1.0/djinit/templates/env_sample.j2 +23 -0
  24. djinitx-0.1.0/djinit/templates/github_actions_ci.j2 +109 -0
  25. djinitx-0.1.0/djinit/templates/gitignore.j2 +89 -0
  26. djinitx-0.1.0/djinit/templates/gitlab_ci.j2 +133 -0
  27. djinitx-0.1.0/djinit/templates/justfile.j2 +154 -0
  28. djinitx-0.1.0/djinit/templates/manage_py.j2 +25 -0
  29. djinitx-0.1.0/djinit/templates/procfile.j2 +20 -0
  30. djinitx-0.1.0/djinit/templates/project_urls.j2 +29 -0
  31. djinitx-0.1.0/djinit/templates/pyproject_toml.j2 +41 -0
  32. djinitx-0.1.0/djinit/templates/readme.j2 +60 -0
  33. djinitx-0.1.0/djinit/templates/requirements.j2 +11 -0
  34. djinitx-0.1.0/djinit/templates/routes.j2 +16 -0
  35. djinitx-0.1.0/djinit/templates/runtime_txt.j2 +1 -0
  36. djinitx-0.1.0/djinit/templates/serializers.j2 +13 -0
  37. djinitx-0.1.0/djinit/templates/settings_base.j2 +161 -0
  38. djinitx-0.1.0/djinit/templates/settings_development.j2 +27 -0
  39. djinitx-0.1.0/djinit/templates/settings_production.j2 +51 -0
  40. djinitx-0.1.0/djinit/templates/wsgi.j2 +9 -0
  41. djinitx-0.1.0/djinit/utils.py +52 -0
  42. djinitx-0.1.0/djinitx.egg-info/PKG-INFO +182 -0
  43. djinitx-0.1.0/djinitx.egg-info/SOURCES.txt +48 -0
  44. djinitx-0.1.0/djinitx.egg-info/dependency_links.txt +1 -0
  45. djinitx-0.1.0/djinitx.egg-info/entry_points.txt +3 -0
  46. djinitx-0.1.0/djinitx.egg-info/requires.txt +4 -0
  47. djinitx-0.1.0/djinitx.egg-info/top_level.txt +1 -0
  48. djinitx-0.1.0/pyproject.toml +54 -0
  49. djinitx-0.1.0/setup.cfg +4 -0
  50. djinitx-0.1.0/setup.py +64 -0
djinitx-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Sankalp Tharu
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,3 @@
1
+ recursive-include djinit/templates *.j2
2
+ include README.md
3
+ include LICENSE
djinitx-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,182 @@
1
+ Metadata-Version: 2.4
2
+ Name: djinitx
3
+ Version: 0.1.0
4
+ Summary: A CLI tool to setup Django project
5
+ Home-page: https://github.com/S4NKALP/djinit
6
+ Author: Sankalp Tharu
7
+ Author-email: Sankalp Tharu <sankalptharu50028@gmail.com>
8
+ License: MIT
9
+ Project-URL: Homepage, https://github.com/S4NKALP/djinit
10
+ Keywords: django,cli,project,djinit,djinitx,dj,django-init,django project,django starter
11
+ Classifier: Programming Language :: Python
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Environment :: Web Environment
18
+ Classifier: Framework :: Django
19
+ Classifier: Framework :: Django :: 4.2
20
+ Classifier: Framework :: Django :: 5.1
21
+ Classifier: Framework :: Django :: 5.2
22
+ Classifier: Intended Audience :: Developers
23
+ Classifier: License :: OSI Approved :: MIT License
24
+ Classifier: Operating System :: OS Independent
25
+ Classifier: Topic :: Internet :: WWW/HTTP
26
+ Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
27
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
28
+ Classifier: Topic :: Software Development :: Code Generators
29
+ Requires-Python: >=3.13
30
+ Description-Content-Type: text/markdown
31
+ License-File: LICENSE
32
+ Requires-Dist: click>=8.3.0
33
+ Requires-Dist: rich>=14.2.0
34
+ Requires-Dist: ruff>=0.14.2
35
+ Requires-Dist: jinja2>=3.1.0
36
+ Dynamic: author
37
+ Dynamic: home-page
38
+ Dynamic: license-file
39
+ Dynamic: requires-python
40
+
41
+ # djinit
42
+
43
+ <p align="center">
44
+ <img src="https://img.shields.io/badge/Django-4.2%20%7C%205.1%20%7C%205.2-0C4B33?logo=django&logoColor=white" alt="Django">
45
+ <img src="https://img.shields.io/badge/Python-3.13%2B-3776AB?logo=python&logoColor=white" alt="Python">
46
+ <a href="https://github.com/S4NKALP/djinit/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License"></a>
47
+ </p>
48
+
49
+ A fast, interactive CLI to bootstrap a modern, production‑ready Django project in minutes — featuring split settings, DRF and JWT integration, OpenAPI docs, CORS, static file handling via WhiteNoise, Postgres‑friendly configuration, CI/CD templates, deployment helpers, and battle‑tested defaults that deliver a polished developer experience out of the box.
50
+
51
+ - ✨ Split settings: `settings/base.py`, `settings/development.py`, `settings/production.py`
52
+ - 🧱 Optional nested apps layout (e.g., `apps/`)
53
+ - 🧩 App scaffolding: URLs, serializers, routes
54
+ - 🔗 Project URLs wired automatically
55
+ - 🧰 Utility files: `.gitignore`, `README.md`, `.env.sample`, `requirements.txt`, `pyproject.toml`
56
+ - 🚀 Deploy helpers: `Justfile`, `Procfile`, `runtime.txt`
57
+ - 🛠️ CI/CD: GitHub Actions and/or GitLab CI
58
+ - 🎨 Polished UX with `rich`
59
+
60
+ ---
61
+
62
+ ## Demo
63
+
64
+ ![djinit demo](docs/demo.gif)
65
+
66
+ Tip: If the GIF doesn't load, open `docs/demo.gif` or view it on the repository page.
67
+
68
+ ## Installation
69
+
70
+ Using pipx (recommended):
71
+
72
+ ```bash
73
+ pipx install git+https://github.com/S4NKALP/djinit
74
+ ```
75
+
76
+ Using pip (user space):
77
+
78
+ ```bash
79
+ pip install --user git+https://github.com/S4NKALP/djinit
80
+ ```
81
+
82
+ From source:
83
+
84
+ ```bash
85
+ git clone https://github.com/S4NKALP/djinit
86
+ cd djinit
87
+ pip install -e .
88
+ ```
89
+
90
+ Requirements: Python 3.13+
91
+
92
+ ## Quick start
93
+
94
+ Run the interactive setup:
95
+
96
+ ```bash
97
+ djinit setup
98
+ # or
99
+ dj setup
100
+ ```
101
+
102
+ Prompts include:
103
+
104
+ - Project directory
105
+ - Django project name (used by `django-admin startproject`)
106
+ - Apps layout (flat vs nested package like `apps/`)
107
+ - App names (comma‑separated)
108
+ - CI/CD choice (GitHub, GitLab, both, none)
109
+ - Database config preference (`DATABASE_URL` vs individual params)
110
+
111
+ ## Commands
112
+
113
+ - `djinit setup` or `dj setup` — Launch the interactive project generator
114
+ - `djinit app <names>` or `dj app <names>` — Create one or more Django apps in an existing project
115
+ - Examples:
116
+ - `djinit app users` or `dj app users`
117
+ - `djinit app users,products,orders` or `dj app users,products,orders`
118
+ - `djinit app users products orders` or `dj app users products orders`
119
+ - `djinit secret [--count N] [--length L]` or `dj secret [--count N] [--length L]` — Print random Django `SECRET_KEY` values
120
+ - Example: `djinit secret --count 5 --length 50`
121
+
122
+ ## What gets generated
123
+
124
+ - Django project and apps, then structure validation
125
+ - Settings package and split settings
126
+ - Base/development/production settings
127
+ - Utility files
128
+ - App files: `urls.py`, `serializers.py`, `routes.py`
129
+ - Project `urls.py` (auto‑includes your apps)
130
+ - Updated `wsgi.py`, `asgi.py`, `manage.py`
131
+ - `Justfile`, `Procfile`, `runtime.txt`
132
+ - CI/CD workflows (per your selection)
133
+
134
+ ### Output highlights
135
+
136
+ - `config/settings/` → `__init__.py`, `base.py`, `development.py`, `production.py`
137
+ - `apps/<app>/` → `urls.py`, `serializers.py`, `routes.py`
138
+ - Project root → `.gitignore`, `README.md`, `.env.sample`, `requirements.txt`, `pyproject.toml`, `Justfile`, `Procfile`, `runtime.txt`
139
+ - CI/CD → `.github/workflows/` and/or `.gitlab-ci.yml`
140
+
141
+ Note: If you choose a nested apps package (e.g., `apps`), imports and `INSTALLED_APPS` entries are configured accordingly.
142
+
143
+ ## Included packages (by default)
144
+
145
+ Generated `requirements.txt` includes:
146
+
147
+ - Django
148
+ - python-dotenv
149
+ - django-jazzmin
150
+ - djangorestframework
151
+ - djangorestframework-simplejwt
152
+ - drf-spectacular
153
+ - django-cors-headers
154
+ - whitenoise
155
+ - psycopg2-binary
156
+ - gunicorn
157
+ - dj-database-url (when you opt into `DATABASE_URL`)
158
+
159
+ These give you a ready‑to‑use stack with DRF, JWT auth, OpenAPI schema generation, CORS, static files in production, and Postgres support.
160
+
161
+ ## Environment and database
162
+
163
+ - A `.env.sample` is generated to get you started.
164
+ - If you opt into `DATABASE_URL`, `production.py` expects an environment variable like:
165
+ `postgres://user:password@host:port/database`
166
+
167
+ ## Contributing
168
+
169
+ Contributions are welcome!
170
+ Please open an issue for bugs/ideas. PRs with clear descriptions are appreciated.
171
+
172
+ ## Acknowledgments
173
+
174
+ - Django and the Django community
175
+ - Jinja2
176
+ - rich
177
+ - click
178
+ - ruff
179
+
180
+ ## License
181
+
182
+ MIT © Sankalp Tharu
@@ -0,0 +1,142 @@
1
+ # djinit
2
+
3
+ <p align="center">
4
+ <img src="https://img.shields.io/badge/Django-4.2%20%7C%205.1%20%7C%205.2-0C4B33?logo=django&logoColor=white" alt="Django">
5
+ <img src="https://img.shields.io/badge/Python-3.13%2B-3776AB?logo=python&logoColor=white" alt="Python">
6
+ <a href="https://github.com/S4NKALP/djinit/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License"></a>
7
+ </p>
8
+
9
+ A fast, interactive CLI to bootstrap a modern, production‑ready Django project in minutes — featuring split settings, DRF and JWT integration, OpenAPI docs, CORS, static file handling via WhiteNoise, Postgres‑friendly configuration, CI/CD templates, deployment helpers, and battle‑tested defaults that deliver a polished developer experience out of the box.
10
+
11
+ - ✨ Split settings: `settings/base.py`, `settings/development.py`, `settings/production.py`
12
+ - 🧱 Optional nested apps layout (e.g., `apps/`)
13
+ - 🧩 App scaffolding: URLs, serializers, routes
14
+ - 🔗 Project URLs wired automatically
15
+ - 🧰 Utility files: `.gitignore`, `README.md`, `.env.sample`, `requirements.txt`, `pyproject.toml`
16
+ - 🚀 Deploy helpers: `Justfile`, `Procfile`, `runtime.txt`
17
+ - 🛠️ CI/CD: GitHub Actions and/or GitLab CI
18
+ - 🎨 Polished UX with `rich`
19
+
20
+ ---
21
+
22
+ ## Demo
23
+
24
+ ![djinit demo](docs/demo.gif)
25
+
26
+ Tip: If the GIF doesn't load, open `docs/demo.gif` or view it on the repository page.
27
+
28
+ ## Installation
29
+
30
+ Using pipx (recommended):
31
+
32
+ ```bash
33
+ pipx install git+https://github.com/S4NKALP/djinit
34
+ ```
35
+
36
+ Using pip (user space):
37
+
38
+ ```bash
39
+ pip install --user git+https://github.com/S4NKALP/djinit
40
+ ```
41
+
42
+ From source:
43
+
44
+ ```bash
45
+ git clone https://github.com/S4NKALP/djinit
46
+ cd djinit
47
+ pip install -e .
48
+ ```
49
+
50
+ Requirements: Python 3.13+
51
+
52
+ ## Quick start
53
+
54
+ Run the interactive setup:
55
+
56
+ ```bash
57
+ djinit setup
58
+ # or
59
+ dj setup
60
+ ```
61
+
62
+ Prompts include:
63
+
64
+ - Project directory
65
+ - Django project name (used by `django-admin startproject`)
66
+ - Apps layout (flat vs nested package like `apps/`)
67
+ - App names (comma‑separated)
68
+ - CI/CD choice (GitHub, GitLab, both, none)
69
+ - Database config preference (`DATABASE_URL` vs individual params)
70
+
71
+ ## Commands
72
+
73
+ - `djinit setup` or `dj setup` — Launch the interactive project generator
74
+ - `djinit app <names>` or `dj app <names>` — Create one or more Django apps in an existing project
75
+ - Examples:
76
+ - `djinit app users` or `dj app users`
77
+ - `djinit app users,products,orders` or `dj app users,products,orders`
78
+ - `djinit app users products orders` or `dj app users products orders`
79
+ - `djinit secret [--count N] [--length L]` or `dj secret [--count N] [--length L]` — Print random Django `SECRET_KEY` values
80
+ - Example: `djinit secret --count 5 --length 50`
81
+
82
+ ## What gets generated
83
+
84
+ - Django project and apps, then structure validation
85
+ - Settings package and split settings
86
+ - Base/development/production settings
87
+ - Utility files
88
+ - App files: `urls.py`, `serializers.py`, `routes.py`
89
+ - Project `urls.py` (auto‑includes your apps)
90
+ - Updated `wsgi.py`, `asgi.py`, `manage.py`
91
+ - `Justfile`, `Procfile`, `runtime.txt`
92
+ - CI/CD workflows (per your selection)
93
+
94
+ ### Output highlights
95
+
96
+ - `config/settings/` → `__init__.py`, `base.py`, `development.py`, `production.py`
97
+ - `apps/<app>/` → `urls.py`, `serializers.py`, `routes.py`
98
+ - Project root → `.gitignore`, `README.md`, `.env.sample`, `requirements.txt`, `pyproject.toml`, `Justfile`, `Procfile`, `runtime.txt`
99
+ - CI/CD → `.github/workflows/` and/or `.gitlab-ci.yml`
100
+
101
+ Note: If you choose a nested apps package (e.g., `apps`), imports and `INSTALLED_APPS` entries are configured accordingly.
102
+
103
+ ## Included packages (by default)
104
+
105
+ Generated `requirements.txt` includes:
106
+
107
+ - Django
108
+ - python-dotenv
109
+ - django-jazzmin
110
+ - djangorestframework
111
+ - djangorestframework-simplejwt
112
+ - drf-spectacular
113
+ - django-cors-headers
114
+ - whitenoise
115
+ - psycopg2-binary
116
+ - gunicorn
117
+ - dj-database-url (when you opt into `DATABASE_URL`)
118
+
119
+ These give you a ready‑to‑use stack with DRF, JWT auth, OpenAPI schema generation, CORS, static files in production, and Postgres support.
120
+
121
+ ## Environment and database
122
+
123
+ - A `.env.sample` is generated to get you started.
124
+ - If you opt into `DATABASE_URL`, `production.py` expects an environment variable like:
125
+ `postgres://user:password@host:port/database`
126
+
127
+ ## Contributing
128
+
129
+ Contributions are welcome!
130
+ Please open an issue for bugs/ideas. PRs with clear descriptions are appreciated.
131
+
132
+ ## Acknowledgments
133
+
134
+ - Django and the Django community
135
+ - Jinja2
136
+ - rich
137
+ - click
138
+ - ruff
139
+
140
+ ## License
141
+
142
+ MIT © Sankalp Tharu
File without changes
@@ -0,0 +1,109 @@
1
+ """
2
+ Main CLI orchestrator for djinit.
3
+ Coordinates between different managers to create a complete Django project.
4
+ """
5
+
6
+ import os
7
+ from typing import Callable, List, Tuple
8
+
9
+ from djinit.scripts.cicd_config_generator import CICDConfigGenerator
10
+ from djinit.scripts.console_ui import UIFormatter
11
+ from djinit.scripts.deployment_files_generator import DeploymentConfigGenerator
12
+ from djinit.scripts.files import FileManager
13
+ from djinit.scripts.project import ProjectManager
14
+ from djinit.scripts.secretkey_generator import generate_secret_command
15
+ from djinit.scripts.settings import SettingsManager
16
+
17
+
18
+ class Cli:
19
+ def __init__(self, project_dir: str, project_name: str, primary_app: str, app_names: list, metadata: dict):
20
+ self.project_dir = project_dir
21
+ self.project_name = project_name
22
+ self.primary_app = primary_app
23
+ self.app_names = app_names
24
+ self.metadata = metadata
25
+ self.project_root = os.path.join(os.getcwd(), project_dir)
26
+
27
+ # Initialize managers
28
+ self.project_manager = ProjectManager(project_dir, project_name, app_names, metadata)
29
+ self.settings_manager = SettingsManager(self.project_root, project_name, app_names, metadata)
30
+ self.file_manager = FileManager(self.project_root, project_name, app_names, metadata)
31
+ self.deployment_manager = DeploymentConfigGenerator(self.project_root, project_name)
32
+ self.cicd_manager = CICDConfigGenerator(self.project_root, project_name)
33
+
34
+ def run_setup(self) -> bool:
35
+ steps: List[Tuple[str, Callable[[], bool]]] = [
36
+ ("Creating Django project", self.project_manager.create_project),
37
+ ("Creating Django apps", self.project_manager.create_apps),
38
+ ("Validating project structure", self.project_manager.validate_project_structure),
39
+ ("Setting up project structure", self.settings_manager.create_settings_structure),
40
+ ("Configuring base settings", self.settings_manager.update_base_settings),
41
+ ("Configuring development settings", self.settings_manager.update_development_settings),
42
+ ("Configuring production settings", self.settings_manager.update_production_settings),
43
+ ("Creating utility files", self._create_utility_files),
44
+ ("Setting up app URLs", self.file_manager.create_app_urls),
45
+ ("Creating app serializers", self.file_manager.create_app_serializers),
46
+ ("Creating app routes", self.file_manager.create_app_routes),
47
+ ("Configuring comprehensive URLs", self.file_manager.update_project_urls),
48
+ ("Updating WSGI configuration", self.file_manager.update_wsgi_file),
49
+ ("Updating ASGI configuration", self.file_manager.update_asgi_file),
50
+ ("Updating manage.py", self.file_manager.update_manage_py),
51
+ ("Creating Justfile", self.deployment_manager.create_justfile),
52
+ ("Creating Procfile", self.deployment_manager.create_procfile),
53
+ ("Creating runtime.txt", lambda: self.deployment_manager.create_runtime_txt("3.13")),
54
+ ("Creating CI/CD pipelines", self._create_cicd_pipelines),
55
+ ]
56
+
57
+ total_steps = len(steps)
58
+ success = True
59
+
60
+ # Create live progress display
61
+ progress, task = UIFormatter.create_live_progress(description="Setup Progress", total_steps=total_steps)
62
+
63
+ with progress:
64
+ # Execute each step with progress tracking
65
+ for step_number, (description, step_func) in enumerate(steps, 1):
66
+ result = step_func()
67
+ if not result:
68
+ success = False
69
+ UIFormatter.print_error(f"Step {step_number} failed: {description}")
70
+ break
71
+
72
+ # Update the same progress bar
73
+ progress.update(task, advance=1, description=f"Step {step_number}/{total_steps}")
74
+
75
+ return success
76
+
77
+ def _create_utility_files(self) -> bool:
78
+ utility_steps = [
79
+ self.file_manager.create_gitignore,
80
+ self.file_manager.create_requirements,
81
+ self.file_manager.create_readme,
82
+ self.file_manager.create_env_file,
83
+ lambda: self.file_manager.create_pyproject_toml(self.metadata),
84
+ ]
85
+
86
+ for step_func in utility_steps:
87
+ result = step_func()
88
+ if not result:
89
+ return False
90
+
91
+ UIFormatter.print_success("Created all utility files successfully!")
92
+ return True
93
+
94
+ def _create_cicd_pipelines(self) -> bool:
95
+ if self.metadata.get("use_github_actions", True):
96
+ result = self.cicd_manager.create_github_actions()
97
+ if not result:
98
+ return False
99
+
100
+ if self.metadata.get("use_gitlab_ci", True):
101
+ result = self.cicd_manager.create_gitlab_ci()
102
+ if not result:
103
+ return False
104
+
105
+ return True
106
+
107
+ def generate_secret_keys(self) -> bool:
108
+ generate_secret_command()
109
+ return True
@@ -0,0 +1,74 @@
1
+ """
2
+ Main script entry point for djinit.
3
+ Handles user input validation and orchestrates the setup process.
4
+ """
5
+
6
+ import os
7
+ import subprocess
8
+ import sys
9
+
10
+ from djinit.cli import Cli
11
+ from djinit.scripts.command_handler import handle_app_command, handle_secret_command, parse_arguments
12
+ from djinit.scripts.console_ui import UIFormatter, console
13
+ from djinit.scripts.input_handler import confirm_setup, get_user_input
14
+
15
+
16
+ def clear_screen() -> None:
17
+ try:
18
+ if os.name == "nt":
19
+ subprocess.run("cls", shell=True, check=True) # Windows
20
+ else:
21
+ subprocess.run("clear", shell=True, check=True) # Linux/MacOS
22
+ except subprocess.CalledProcessError:
23
+ # If clearing fails, just print some newlines
24
+ console.print("\n" * 50)
25
+
26
+
27
+ def main() -> None:
28
+ # Parse command line arguments
29
+ args = parse_arguments()
30
+
31
+ # Handle secret command
32
+ if args.command == "secret":
33
+ handle_secret_command(args)
34
+ return
35
+
36
+ # Handle app command
37
+ if args.command == "app":
38
+ handle_app_command(args)
39
+ return
40
+
41
+ # Default to setup command
42
+ # Clear screen
43
+ clear_screen()
44
+
45
+ # Display welcome screen
46
+ console.print()
47
+ console.print(UIFormatter.create_welcome_panel())
48
+ console.print()
49
+
50
+ # Get user input
51
+ project_dir, project_name, primary_app, app_names, metadata = get_user_input()
52
+
53
+ # Confirm setup
54
+ if not confirm_setup(project_dir, project_name, app_names, metadata):
55
+ UIFormatter.print_info("Setup cancelled by user.")
56
+ return
57
+
58
+ # Run setup
59
+ console.print()
60
+ UIFormatter.print_info("Starting Django project setup...")
61
+ console.print()
62
+
63
+ django_cli = Cli(project_dir, project_name, primary_app, app_names, metadata)
64
+ success = django_cli.run_setup()
65
+
66
+ # Display completion summary
67
+ UIFormatter.create_summary_panel(project_dir, project_name, app_names, True)
68
+
69
+ # Exit with appropriate code
70
+ sys.exit(0 if success else 1)
71
+
72
+
73
+ if __name__ == "__main__":
74
+ main()
File without changes