app-generator-cli 1.0.1__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 (73) hide show
  1. app_generator_cli-1.0.1/LICENSE +21 -0
  2. app_generator_cli-1.0.1/PKG-INFO +219 -0
  3. app_generator_cli-1.0.1/README.md +193 -0
  4. app_generator_cli-1.0.1/app_generator/__init__.py +10 -0
  5. app_generator_cli-1.0.1/app_generator/commands/__init__.py +1 -0
  6. app_generator_cli-1.0.1/app_generator/commands/create.py +74 -0
  7. app_generator_cli-1.0.1/app_generator/generator.py +265 -0
  8. app_generator_cli-1.0.1/app_generator/main.py +32 -0
  9. app_generator_cli-1.0.1/app_generator/templates/ai/.env.example +29 -0
  10. app_generator_cli-1.0.1/app_generator/templates/ai/.gitignore +47 -0
  11. app_generator_cli-1.0.1/app_generator/templates/ai/Dockerfile +22 -0
  12. app_generator_cli-1.0.1/app_generator/templates/ai/README.md +97 -0
  13. app_generator_cli-1.0.1/app_generator/templates/ai/app/__init__.py +1 -0
  14. app_generator_cli-1.0.1/app_generator/templates/ai/app/agents/__init__.py +1 -0
  15. app_generator_cli-1.0.1/app_generator/templates/ai/app/agents/assistant.py +100 -0
  16. app_generator_cli-1.0.1/app_generator/templates/ai/app/chains/__init__.py +1 -0
  17. app_generator_cli-1.0.1/app_generator/templates/ai/app/chains/rag.py +50 -0
  18. app_generator_cli-1.0.1/app_generator/templates/ai/app/config.py +47 -0
  19. app_generator_cli-1.0.1/app_generator/templates/ai/app/tools/__init__.py +1 -0
  20. app_generator_cli-1.0.1/app_generator/templates/ai/app/tools/registry.py +19 -0
  21. app_generator_cli-1.0.1/app_generator/templates/ai/app/tools/search.py +34 -0
  22. app_generator_cli-1.0.1/app_generator/templates/ai/docker-compose.yml +39 -0
  23. app_generator_cli-1.0.1/app_generator/templates/ai/main.py +40 -0
  24. app_generator_cli-1.0.1/app_generator/templates/ai/pyproject.toml +28 -0
  25. app_generator_cli-1.0.1/app_generator/templates/ai/tests/__init__.py +1 -0
  26. app_generator_cli-1.0.1/app_generator/templates/ai/tests/conftest.py +21 -0
  27. app_generator_cli-1.0.1/app_generator/templates/ai/tests/test_agent.py +53 -0
  28. app_generator_cli-1.0.1/app_generator/templates/fastapi/.env.example +17 -0
  29. app_generator_cli-1.0.1/app_generator/templates/fastapi/.gitignore +42 -0
  30. app_generator_cli-1.0.1/app_generator/templates/fastapi/Dockerfile +27 -0
  31. app_generator_cli-1.0.1/app_generator/templates/fastapi/README.md +68 -0
  32. app_generator_cli-1.0.1/app_generator/templates/fastapi/app/__init__.py +1 -0
  33. app_generator_cli-1.0.1/app_generator/templates/fastapi/app/api/__init__.py +1 -0
  34. app_generator_cli-1.0.1/app_generator/templates/fastapi/app/api/v1/__init__.py +1 -0
  35. app_generator_cli-1.0.1/app_generator/templates/fastapi/app/api/v1/health.py +25 -0
  36. app_generator_cli-1.0.1/app_generator/templates/fastapi/app/config.py +45 -0
  37. app_generator_cli-1.0.1/app_generator/templates/fastapi/app/db/__init__.py +1 -0
  38. app_generator_cli-1.0.1/app_generator/templates/fastapi/app/db/session.py +35 -0
  39. app_generator_cli-1.0.1/app_generator/templates/fastapi/app/dependencies.py +12 -0
  40. app_generator_cli-1.0.1/app_generator/templates/fastapi/app/main.py +58 -0
  41. app_generator_cli-1.0.1/app_generator/templates/fastapi/app/models/__init__.py +4 -0
  42. app_generator_cli-1.0.1/app_generator/templates/fastapi/app/models/base.py +23 -0
  43. app_generator_cli-1.0.1/app_generator/templates/fastapi/docker-compose.yml +39 -0
  44. app_generator_cli-1.0.1/app_generator/templates/fastapi/pyproject.toml +29 -0
  45. app_generator_cli-1.0.1/app_generator/templates/fastapi/tests/__init__.py +1 -0
  46. app_generator_cli-1.0.1/app_generator/templates/fastapi/tests/conftest.py +46 -0
  47. app_generator_cli-1.0.1/app_generator/templates/fastapi/tests/test_health.py +13 -0
  48. app_generator_cli-1.0.1/app_generator/templates/fastapi-with-frontend/.env.example +17 -0
  49. app_generator_cli-1.0.1/app_generator/templates/fastapi-with-frontend/.gitignore +42 -0
  50. app_generator_cli-1.0.1/app_generator/templates/fastapi-with-frontend/Dockerfile +27 -0
  51. app_generator_cli-1.0.1/app_generator/templates/fastapi-with-frontend/README.md +77 -0
  52. app_generator_cli-1.0.1/app_generator/templates/fastapi-with-frontend/app/__init__.py +1 -0
  53. app_generator_cli-1.0.1/app_generator/templates/fastapi-with-frontend/app/api/__init__.py +1 -0
  54. app_generator_cli-1.0.1/app_generator/templates/fastapi-with-frontend/app/api/v1/__init__.py +1 -0
  55. app_generator_cli-1.0.1/app_generator/templates/fastapi-with-frontend/app/api/v1/health.py +25 -0
  56. app_generator_cli-1.0.1/app_generator/templates/fastapi-with-frontend/app/config.py +45 -0
  57. app_generator_cli-1.0.1/app_generator/templates/fastapi-with-frontend/app/db/__init__.py +1 -0
  58. app_generator_cli-1.0.1/app_generator/templates/fastapi-with-frontend/app/db/session.py +35 -0
  59. app_generator_cli-1.0.1/app_generator/templates/fastapi-with-frontend/app/dependencies.py +12 -0
  60. app_generator_cli-1.0.1/app_generator/templates/fastapi-with-frontend/app/main.py +70 -0
  61. app_generator_cli-1.0.1/app_generator/templates/fastapi-with-frontend/app/models/__init__.py +4 -0
  62. app_generator_cli-1.0.1/app_generator/templates/fastapi-with-frontend/app/models/base.py +23 -0
  63. app_generator_cli-1.0.1/app_generator/templates/fastapi-with-frontend/app/templates/base.html +116 -0
  64. app_generator_cli-1.0.1/app_generator/templates/fastapi-with-frontend/app/templates/index.html +15 -0
  65. app_generator_cli-1.0.1/app_generator/templates/fastapi-with-frontend/app/templates/partials/footer.html +7 -0
  66. app_generator_cli-1.0.1/app_generator/templates/fastapi-with-frontend/app/templates/partials/header.html +7 -0
  67. app_generator_cli-1.0.1/app_generator/templates/fastapi-with-frontend/docker-compose.yml +39 -0
  68. app_generator_cli-1.0.1/app_generator/templates/fastapi-with-frontend/pyproject.toml +28 -0
  69. app_generator_cli-1.0.1/app_generator/templates/fastapi-with-frontend/tests/__init__.py +1 -0
  70. app_generator_cli-1.0.1/app_generator/templates/fastapi-with-frontend/tests/conftest.py +46 -0
  71. app_generator_cli-1.0.1/app_generator/templates/fastapi-with-frontend/tests/test_frontend.py +12 -0
  72. app_generator_cli-1.0.1/app_generator/templates/fastapi-with-frontend/tests/test_health.py +13 -0
  73. app_generator_cli-1.0.1/pyproject.toml +61 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Your Name
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,219 @@
1
+ Metadata-Version: 2.3
2
+ Name: app-generator-cli
3
+ Version: 1.0.1
4
+ Summary: A developer-friendly scaffolding CLI for FastAPI and LangChain/LangGraph projects
5
+ Keywords: cli,scaffolding,fastapi,langchain,langgraph,uv
6
+ Author: Rajendra Kumar Yadav
7
+ Author-email: Rajendra Kumar Yadav <yadavrajendrakumar@outlook.com>
8
+ License: MIT
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Environment :: Console
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Software Development :: Code Generators
18
+ Requires-Dist: typer>=0.12.0
19
+ Requires-Dist: rich>=13.0.0
20
+ Requires-Dist: jinja2>=3.1.0
21
+ Requires-Python: >=3.10
22
+ Project-URL: Homepage, https://github.com/rajendrakumaryadav/app-generator-cli
23
+ Project-URL: Repository, https://github.com/rajendrakumaryadav/app-generator-cli
24
+ Project-URL: Issues, https://github.com/rajendrakumaryadav/app-generator-cli/issues
25
+ Description-Content-Type: text/markdown
26
+
27
+ # ⚒ AppGenerator CLI
28
+
29
+ [![CI](https://github.com/rajendrakumaryadav/pyforge/actions/workflows/ci.yml/badge.svg)](https://github.com/rajendrakumaryadav/app-generator-cli/actions/workflows/ci.yml)
30
+ [![PyPI version](https://img.shields.io/pypi/v/appgenerator-cli)](https://pypi.org/project/app-generator-cli/)
31
+ [![pytest](https://img.shields.io/badge/pytest-3.10%20%7C%203.11%20%7C%203.12-0A9EDC?logo=pytest)](https://github.com/rajendrakumaryadav/app-generator-cli/actions/workflows/ci.yml)
32
+
33
+ > Scaffold production-ready Python projects in seconds — powered by `uv`.
34
+
35
+ CI runs `uv run pytest tests/ -v --tb=short` on Python `3.10`, `3.11`, and `3.12`.
36
+
37
+ ```
38
+ $ app-generator-cli create fastapi my_api
39
+ $ app-generator-cli create ai my_ai_app --docker --postgres
40
+ ```
41
+
42
+ ---
43
+
44
+ ## Installation
45
+
46
+ ```bash
47
+ pip install app-generator-cli
48
+ # or, with uv (recommended):
49
+ uv tool install app-generator-cli
50
+ ```
51
+
52
+ Verify:
53
+ ```bash
54
+ app-generator-cli --version
55
+ ```
56
+
57
+ ---
58
+
59
+ ## Commands
60
+
61
+ ### `app-generator-cli create fastapi <name>`
62
+
63
+ Scaffold a **FastAPI** backend.
64
+
65
+ | Flag | Description |
66
+ |------|-------------|
67
+ | `--docker` | Add `Dockerfile` + `docker-compose.yml` |
68
+ | `--postgres` | Use PostgreSQL (`asyncpg`) instead of SQLite |
69
+ | `--redis` | Add Redis client (`redis`) |
70
+ | `--output PATH` | Create the project in a custom directory |
71
+
72
+ **Example:**
73
+ ```bash
74
+ app-generator-cli create fastapi my_api --docker --postgres --redis
75
+ cd my_api
76
+ cp .env.example .env
77
+ uv run uvicorn app.main:app --reload
78
+ ```
79
+
80
+ ### `app-generator-cli create ai <name>`
81
+
82
+ Scaffold a **LangChain / LangGraph** AI application.
83
+
84
+ | Flag | Description |
85
+ |------|-------------|
86
+ | `--docker` | Add `Dockerfile` + `docker-compose.yml` |
87
+ | `--postgres` | Add pgvector PostgreSQL support |
88
+ | `--redis` | Add Redis semantic cache |
89
+ | `--output PATH` | Create the project in a custom directory |
90
+
91
+ **Example:**
92
+ ```bash
93
+ app-generator-cli create ai my_assistant --docker
94
+ cd my_assistant
95
+ cp .env.example .env # add your OPENAI_API_KEY
96
+ uv run python main.py
97
+ ```
98
+
99
+ ---
100
+
101
+ ## Generated Project Structure
102
+
103
+ ### FastAPI
104
+
105
+ ```
106
+ my_api/
107
+ ├── app/
108
+ │ ├── main.py # Application factory
109
+ │ ├── config.py # Pydantic Settings
110
+ │ ├── dependencies.py # FastAPI deps (DB session, etc.)
111
+ │ ├── api/v1/
112
+ │ │ └── health.py # Health-check endpoint
113
+ │ ├── models/
114
+ │ │ └── base.py # SQLModel base with timestamps
115
+ │ └── db/
116
+ │ └── session.py # Async session factory
117
+ ├── tests/
118
+ │ ├── conftest.py # Async test client + DB fixtures
119
+ │ └── test_health.py
120
+ ├── .env.example
121
+ ├── .gitignore
122
+ ├── pyproject.toml
123
+ ├── Dockerfile # (--docker)
124
+ └── docker-compose.yml # (--docker)
125
+ ```
126
+
127
+ ### AI (LangChain / LangGraph)
128
+
129
+ ```
130
+ my_assistant/
131
+ ├── main.py # Interactive REPL
132
+ ├── app/
133
+ │ ├── config.py # Pydantic Settings
134
+ │ ├── agents/
135
+ │ │ └── assistant.py # LangGraph ReAct agent
136
+ │ ├── chains/
137
+ │ │ └── rag.py # RAG chain example
138
+ │ └── tools/
139
+ │ ├── registry.py # Tool registry
140
+ │ └── search.py # Web search tool stub
141
+ ├── tests/
142
+ │ └── test_agent.py
143
+ ├── .env.example
144
+ ├── .gitignore
145
+ ├── pyproject.toml
146
+ ├── Dockerfile # (--docker)
147
+ └── docker-compose.yml # (--docker)
148
+ ```
149
+
150
+ ---
151
+
152
+ ## Packaging & Publishing to PyPI
153
+
154
+ ### 1. Build
155
+
156
+ ```bash
157
+ # Install build tools
158
+ pip install build twine
159
+
160
+ # Build wheel + sdist
161
+ python -m build
162
+ # Outputs: dist/app-generator-cli-0.1.0-py3-none-any.whl
163
+ # dist/app-generator-cli-0.1.0.tar.gz
164
+ ```
165
+
166
+ ### 2. Test on TestPyPI
167
+
168
+ ```bash
169
+ twine upload --repository testpypi dist/*
170
+ pip install --index-url https://test.pypi.org/simple/ app-generator-cli
171
+ ```
172
+
173
+ ### 3. Publish to PyPI
174
+
175
+ ```bash
176
+ twine upload dist/*
177
+ ```
178
+
179
+ Or with uv:
180
+
181
+ ```bash
182
+ uv build
183
+ uv publish
184
+ ```
185
+
186
+ ---
187
+
188
+ ## Development Setup
189
+
190
+ ```bash
191
+ git clone https://github.com/yourname/app-generator-cli
192
+ cd app-generator-cli
193
+
194
+ uv venv
195
+ uv sync --dev
196
+
197
+ # Run locally
198
+ uv run app-generator-cli --help
199
+
200
+ # Tests
201
+ uv run pytest
202
+
203
+ # Lint
204
+ uv run ruff check .
205
+ uv run ruff format .
206
+ ```
207
+
208
+ ---
209
+
210
+ ## Requirements
211
+
212
+ - Python ≥ 3.10
213
+ - [`uv`](https://docs.astral.sh/uv/) installed on the system (for generated project env management)
214
+
215
+ ---
216
+
217
+ ## License
218
+
219
+ MIT
@@ -0,0 +1,193 @@
1
+ # ⚒ AppGenerator CLI
2
+
3
+ [![CI](https://github.com/rajendrakumaryadav/pyforge/actions/workflows/ci.yml/badge.svg)](https://github.com/rajendrakumaryadav/app-generator-cli/actions/workflows/ci.yml)
4
+ [![PyPI version](https://img.shields.io/pypi/v/appgenerator-cli)](https://pypi.org/project/app-generator-cli/)
5
+ [![pytest](https://img.shields.io/badge/pytest-3.10%20%7C%203.11%20%7C%203.12-0A9EDC?logo=pytest)](https://github.com/rajendrakumaryadav/app-generator-cli/actions/workflows/ci.yml)
6
+
7
+ > Scaffold production-ready Python projects in seconds — powered by `uv`.
8
+
9
+ CI runs `uv run pytest tests/ -v --tb=short` on Python `3.10`, `3.11`, and `3.12`.
10
+
11
+ ```
12
+ $ app-generator-cli create fastapi my_api
13
+ $ app-generator-cli create ai my_ai_app --docker --postgres
14
+ ```
15
+
16
+ ---
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ pip install app-generator-cli
22
+ # or, with uv (recommended):
23
+ uv tool install app-generator-cli
24
+ ```
25
+
26
+ Verify:
27
+ ```bash
28
+ app-generator-cli --version
29
+ ```
30
+
31
+ ---
32
+
33
+ ## Commands
34
+
35
+ ### `app-generator-cli create fastapi <name>`
36
+
37
+ Scaffold a **FastAPI** backend.
38
+
39
+ | Flag | Description |
40
+ |------|-------------|
41
+ | `--docker` | Add `Dockerfile` + `docker-compose.yml` |
42
+ | `--postgres` | Use PostgreSQL (`asyncpg`) instead of SQLite |
43
+ | `--redis` | Add Redis client (`redis`) |
44
+ | `--output PATH` | Create the project in a custom directory |
45
+
46
+ **Example:**
47
+ ```bash
48
+ app-generator-cli create fastapi my_api --docker --postgres --redis
49
+ cd my_api
50
+ cp .env.example .env
51
+ uv run uvicorn app.main:app --reload
52
+ ```
53
+
54
+ ### `app-generator-cli create ai <name>`
55
+
56
+ Scaffold a **LangChain / LangGraph** AI application.
57
+
58
+ | Flag | Description |
59
+ |------|-------------|
60
+ | `--docker` | Add `Dockerfile` + `docker-compose.yml` |
61
+ | `--postgres` | Add pgvector PostgreSQL support |
62
+ | `--redis` | Add Redis semantic cache |
63
+ | `--output PATH` | Create the project in a custom directory |
64
+
65
+ **Example:**
66
+ ```bash
67
+ app-generator-cli create ai my_assistant --docker
68
+ cd my_assistant
69
+ cp .env.example .env # add your OPENAI_API_KEY
70
+ uv run python main.py
71
+ ```
72
+
73
+ ---
74
+
75
+ ## Generated Project Structure
76
+
77
+ ### FastAPI
78
+
79
+ ```
80
+ my_api/
81
+ ├── app/
82
+ │ ├── main.py # Application factory
83
+ │ ├── config.py # Pydantic Settings
84
+ │ ├── dependencies.py # FastAPI deps (DB session, etc.)
85
+ │ ├── api/v1/
86
+ │ │ └── health.py # Health-check endpoint
87
+ │ ├── models/
88
+ │ │ └── base.py # SQLModel base with timestamps
89
+ │ └── db/
90
+ │ └── session.py # Async session factory
91
+ ├── tests/
92
+ │ ├── conftest.py # Async test client + DB fixtures
93
+ │ └── test_health.py
94
+ ├── .env.example
95
+ ├── .gitignore
96
+ ├── pyproject.toml
97
+ ├── Dockerfile # (--docker)
98
+ └── docker-compose.yml # (--docker)
99
+ ```
100
+
101
+ ### AI (LangChain / LangGraph)
102
+
103
+ ```
104
+ my_assistant/
105
+ ├── main.py # Interactive REPL
106
+ ├── app/
107
+ │ ├── config.py # Pydantic Settings
108
+ │ ├── agents/
109
+ │ │ └── assistant.py # LangGraph ReAct agent
110
+ │ ├── chains/
111
+ │ │ └── rag.py # RAG chain example
112
+ │ └── tools/
113
+ │ ├── registry.py # Tool registry
114
+ │ └── search.py # Web search tool stub
115
+ ├── tests/
116
+ │ └── test_agent.py
117
+ ├── .env.example
118
+ ├── .gitignore
119
+ ├── pyproject.toml
120
+ ├── Dockerfile # (--docker)
121
+ └── docker-compose.yml # (--docker)
122
+ ```
123
+
124
+ ---
125
+
126
+ ## Packaging & Publishing to PyPI
127
+
128
+ ### 1. Build
129
+
130
+ ```bash
131
+ # Install build tools
132
+ pip install build twine
133
+
134
+ # Build wheel + sdist
135
+ python -m build
136
+ # Outputs: dist/app-generator-cli-0.1.0-py3-none-any.whl
137
+ # dist/app-generator-cli-0.1.0.tar.gz
138
+ ```
139
+
140
+ ### 2. Test on TestPyPI
141
+
142
+ ```bash
143
+ twine upload --repository testpypi dist/*
144
+ pip install --index-url https://test.pypi.org/simple/ app-generator-cli
145
+ ```
146
+
147
+ ### 3. Publish to PyPI
148
+
149
+ ```bash
150
+ twine upload dist/*
151
+ ```
152
+
153
+ Or with uv:
154
+
155
+ ```bash
156
+ uv build
157
+ uv publish
158
+ ```
159
+
160
+ ---
161
+
162
+ ## Development Setup
163
+
164
+ ```bash
165
+ git clone https://github.com/yourname/app-generator-cli
166
+ cd app-generator-cli
167
+
168
+ uv venv
169
+ uv sync --dev
170
+
171
+ # Run locally
172
+ uv run app-generator-cli --help
173
+
174
+ # Tests
175
+ uv run pytest
176
+
177
+ # Lint
178
+ uv run ruff check .
179
+ uv run ruff format .
180
+ ```
181
+
182
+ ---
183
+
184
+ ## Requirements
185
+
186
+ - Python ≥ 3.10
187
+ - [`uv`](https://docs.astral.sh/uv/) installed on the system (for generated project env management)
188
+
189
+ ---
190
+
191
+ ## License
192
+
193
+ MIT
@@ -0,0 +1,10 @@
1
+ """PyForge CLI package."""
2
+
3
+ from importlib.metadata import metadata
4
+
5
+ try:
6
+ _meta = metadata("app-generator-cli")
7
+ except Exception:
8
+ _meta = metadata("pyforge-cli")
9
+ __version__ = _meta["Version"]
10
+ __author__ = _meta["Author-email"]
@@ -0,0 +1 @@
1
+ """CLI command modules."""
@@ -0,0 +1,74 @@
1
+ """
2
+ `appgenerator create` subcommand group.
3
+ Delegates to template-specific generators.
4
+ """
5
+ from __future__ import annotations
6
+
7
+ from pathlib import Path
8
+ from typing import Optional
9
+
10
+ import typer
11
+ from rich.console import Console
12
+
13
+ from app_generator.generator import ProjectGenerator
14
+
15
+ create_app = typer.Typer(no_args_is_help=True, rich_markup_mode="rich")
16
+ console = Console()
17
+
18
+
19
+ def _run_generator(
20
+ template: str,
21
+ project_name: str,
22
+ output_dir: Optional[Path],
23
+ docker: bool,
24
+ postgres: bool,
25
+ redis: bool,
26
+ ) -> None:
27
+ target = (output_dir or Path.cwd()) / project_name
28
+ if target.exists():
29
+ console.print(f"[bold red]✗[/] Directory [bold]{target}[/] already exists.")
30
+ raise typer.Exit(code=1)
31
+
32
+ generator = ProjectGenerator(
33
+ template=template,
34
+ project_name=project_name,
35
+ target_dir=target,
36
+ options={"docker": docker, "postgres": postgres, "redis": redis},
37
+ )
38
+ generator.run()
39
+
40
+
41
+ @create_app.command("fastapi", help="Scaffold a [bold]FastAPI[/] backend project.")
42
+ def create_fastapi(
43
+ project_name: str = typer.Argument(..., help="Name of the new project."),
44
+ output_dir: Optional[Path] = typer.Option(None, "--output", "-o", help="Parent directory."),
45
+ docker: bool = typer.Option(False, "--docker", help="Add Dockerfile & docker-compose.yml."),
46
+ postgres: bool = typer.Option(False, "--postgres", help="Add PostgreSQL support."),
47
+ redis: bool = typer.Option(False, "--redis", help="Add Redis support."),
48
+ ) -> None:
49
+ _run_generator("fastapi", project_name, output_dir, docker, postgres, redis)
50
+
51
+
52
+ @create_app.command(
53
+ "fastapi-with-frontend",
54
+ help="Scaffold a [bold]FastAPI + Jinja frontend[/] project.",
55
+ )
56
+ def create_fastapi_with_frontend(
57
+ project_name: str = typer.Argument(..., help="Name of the new project."),
58
+ output_dir: Optional[Path] = typer.Option(None, "--output", "-o", help="Parent directory."),
59
+ docker: bool = typer.Option(False, "--docker", help="Add Dockerfile & docker-compose.yml."),
60
+ postgres: bool = typer.Option(False, "--postgres", help="Add PostgreSQL support."),
61
+ redis: bool = typer.Option(False, "--redis", help="Add Redis support."),
62
+ ) -> None:
63
+ _run_generator("fastapi-with-frontend", project_name, output_dir, docker, postgres, redis)
64
+
65
+
66
+ @create_app.command("ai", help="Scaffold a [bold]LangChain / LangGraph[/] AI project.")
67
+ def create_ai(
68
+ project_name: str = typer.Argument(..., help="Name of the new project."),
69
+ output_dir: Optional[Path] = typer.Option(None, "--output", "-o", help="Parent directory."),
70
+ docker: bool = typer.Option(False, "--docker", help="Add Dockerfile & docker-compose.yml."),
71
+ postgres: bool = typer.Option(False, "--postgres", help="Add PostgreSQL vector DB support."),
72
+ redis: bool = typer.Option(False, "--redis", help="Add Redis cache support."),
73
+ ) -> None:
74
+ _run_generator("ai", project_name, output_dir, docker, postgres, redis)