rapidkit 0.14.1 → 0.15.1

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 (61) hide show
  1. package/README.md +199 -38
  2. package/dist/index.d.ts +3 -0
  3. package/dist/index.js +746 -494
  4. package/dist/package.json +14 -6
  5. package/package.json +14 -6
  6. package/templates/generator.js +0 -175
  7. package/templates/kits/fastapi-standard/.rapidkit/__init__.py.j2 +0 -1
  8. package/templates/kits/fastapi-standard/.rapidkit/activate.j2 +0 -24
  9. package/templates/kits/fastapi-standard/.rapidkit/cli.py.j2 +0 -289
  10. package/templates/kits/fastapi-standard/.rapidkit/context.json +0 -3
  11. package/templates/kits/fastapi-standard/.rapidkit/project.json.j2 +0 -7
  12. package/templates/kits/fastapi-standard/.rapidkit/rapidkit.j2 +0 -107
  13. package/templates/kits/fastapi-standard/Makefile.j2 +0 -41
  14. package/templates/kits/fastapi-standard/README.md.j2 +0 -38
  15. package/templates/kits/fastapi-standard/kit.json +0 -70
  16. package/templates/kits/fastapi-standard/kit.yaml +0 -120
  17. package/templates/kits/fastapi-standard/pyproject.toml.j2 +0 -42
  18. package/templates/kits/fastapi-standard/rapidkit.cmd.j2 +0 -72
  19. package/templates/kits/fastapi-standard/rapidkit.j2 +0 -50
  20. package/templates/kits/fastapi-standard/src/__init__.py.j2 +0 -3
  21. package/templates/kits/fastapi-standard/src/cli.py.j2 +0 -335
  22. package/templates/kits/fastapi-standard/src/main.py.j2 +0 -44
  23. package/templates/kits/fastapi-standard/src/modules/__init__.py.j2 +0 -3
  24. package/templates/kits/fastapi-standard/src/routing/__init__.py.j2 +0 -13
  25. package/templates/kits/fastapi-standard/src/routing/health.py.j2 +0 -32
  26. package/templates/kits/fastapi-standard/tests/__init__.py.j2 +0 -1
  27. package/templates/kits/nestjs-standard/.env.example.j2 +0 -16
  28. package/templates/kits/nestjs-standard/.eslintrc.js.j2 +0 -25
  29. package/templates/kits/nestjs-standard/.gitignore.j2 +0 -26
  30. package/templates/kits/nestjs-standard/.node-version.j2 +0 -1
  31. package/templates/kits/nestjs-standard/.nvmrc.j2 +0 -1
  32. package/templates/kits/nestjs-standard/.prettierrc.j2 +0 -7
  33. package/templates/kits/nestjs-standard/.rapidkit/activate.j2 +0 -25
  34. package/templates/kits/nestjs-standard/.rapidkit/context.json +0 -3
  35. package/templates/kits/nestjs-standard/.rapidkit/project.json.j2 +0 -7
  36. package/templates/kits/nestjs-standard/.rapidkit/rapidkit.cmd.j2 +0 -166
  37. package/templates/kits/nestjs-standard/.rapidkit/rapidkit.j2 +0 -227
  38. package/templates/kits/nestjs-standard/README.md.j2 +0 -110
  39. package/templates/kits/nestjs-standard/jest.config.ts.j2 +0 -21
  40. package/templates/kits/nestjs-standard/nest-cli.json.j2 +0 -10
  41. package/templates/kits/nestjs-standard/package.json.j2 +0 -75
  42. package/templates/kits/nestjs-standard/rapidkit.cmd.j2 +0 -5
  43. package/templates/kits/nestjs-standard/rapidkit.j2 +0 -5
  44. package/templates/kits/nestjs-standard/src/app.controller.ts.j2 +0 -12
  45. package/templates/kits/nestjs-standard/src/app.module.ts.j2 +0 -23
  46. package/templates/kits/nestjs-standard/src/app.service.ts.j2 +0 -11
  47. package/templates/kits/nestjs-standard/src/config/configuration.ts.j2 +0 -9
  48. package/templates/kits/nestjs-standard/src/config/index.ts.j2 +0 -2
  49. package/templates/kits/nestjs-standard/src/config/validation.ts.j2 +0 -11
  50. package/templates/kits/nestjs-standard/src/examples/dto/create-note.dto.ts.j2 +0 -11
  51. package/templates/kits/nestjs-standard/src/examples/examples.controller.ts.j2 +0 -24
  52. package/templates/kits/nestjs-standard/src/examples/examples.module.ts.j2 +0 -10
  53. package/templates/kits/nestjs-standard/src/examples/examples.service.ts.j2 +0 -33
  54. package/templates/kits/nestjs-standard/src/main.ts.j2 +0 -51
  55. package/templates/kits/nestjs-standard/src/modules/index.ts.j2 +0 -3
  56. package/templates/kits/nestjs-standard/test/app.controller.spec.ts.j2 +0 -22
  57. package/templates/kits/nestjs-standard/test/app.e2e-spec.ts.j2 +0 -48
  58. package/templates/kits/nestjs-standard/test/examples.controller.spec.ts.j2 +0 -28
  59. package/templates/kits/nestjs-standard/test/jest-e2e.json.j2 +0 -15
  60. package/templates/kits/nestjs-standard/tsconfig.build.json.j2 +0 -12
  61. package/templates/kits/nestjs-standard/tsconfig.json.j2 +0 -26
package/README.md CHANGED
@@ -5,65 +5,170 @@
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](https://opensource.org/licenses/MIT)
6
6
  [![GitHub Stars](https://img.shields.io/github/stars/getrapidkit/rapidkit-npm.svg?style=flat-square)](https://github.com/getrapidkit/rapidkit-npm/stargazers)
7
7
 
8
- > ⚠️ **PRE-RELEASE VERSION** - This is a companion tool for RapidKit framework.
9
- > The stable production version of RapidKit Python will be released soon on PyPI.
8
+ This is the official RapidKit CLI on npm.
10
9
 
11
- 🚀 The easiest way to create FastAPI and NestJS projects with RapidKit templates!
10
+ > 🔮 **Coming Soon:** AI-powered module recommendations when Core modules are released!
11
+ >
12
+ > _Note: The AI recommender feature is complete in the `feature/ai-recommender` branch but not yet released. We will announce it when Core module support is available._
13
+
14
+ RapidKit's single source of truth for kits and global commands is **RapidKit Core (Python)**.
15
+ This npm package is a **bridge/wrapper** that:
16
+
17
+ - Delegates project commands (e.g. `init`, `dev`, `test`) to the project-local launcher when you are inside a RapidKit project.
18
+ - Forwards global/core commands (e.g. `list`, `info`, `create`, `add`, `doctor`, `--tui`, `--json`) to `python -m rapidkit ...`.
19
+ - If `rapidkit-core` is not available in your system Python, it can bootstrap a cached virtualenv and install Core there.
12
20
 
13
21
  **💡 Tip:** Use the [RapidKit VS Code Extension](https://marketplace.visualstudio.com/items?itemName=rapidkit.rapidkit-vscode) for a visual interface!
14
22
 
15
23
  ## Quick Start
16
24
 
17
- ### Create a FastAPI Project
25
+ ### Create a Project (FastAPI)
18
26
 
19
27
  ```bash
20
- npx rapidkit my-api --template fastapi
28
+ npx rapidkit create project fastapi.standard my-api --output .
21
29
  cd my-api
22
30
  npx rapidkit init # Install dependencies
23
31
  npx rapidkit dev # Start dev server at http://localhost:8000
24
32
  ```
25
33
 
26
- ### Create a NestJS Project
34
+ ### Create a Project (NestJS)
27
35
 
28
36
  ```bash
29
- npx rapidkit my-api --template nestjs
37
+ npx rapidkit create project nestjs.standard my-api --output .
30
38
  cd my-api
31
39
  npx rapidkit init # Install dependencies
32
40
  npx rapidkit dev # Start dev server at http://localhost:8000
33
41
  ```
34
42
 
35
- Your API will be available at `http://localhost:8000` with Swagger docs at `/docs`
43
+ ### Interactive mode (recommended)
44
+
45
+ ```bash
46
+ npx rapidkit create
47
+ ```
48
+
49
+ This runs the RapidKit Core wizard (`python -m rapidkit create`) and guides you through kit selection and project creation.
36
50
 
37
51
  ## Two Modes of Operation
38
52
 
39
- ### 1. Direct Project Creation (with `--template`)
53
+ ### 1. Direct Project Creation (Core-first)
40
54
 
41
- Create a standalone project directly:
55
+ Create a standalone project directly via Core:
42
56
 
43
57
  ```bash
44
- npx rapidkit my-api --template fastapi # Create FastAPI project
45
- npx rapidkit my-api --template nestjs # Create NestJS project
58
+ npx rapidkit create project fastapi.standard my-api --output .
59
+ npx rapidkit create project nestjs.standard my-api --output .
46
60
  ```
47
61
 
48
- ### 2. Workspace Mode (without `--template`)
62
+ ### 2. RapidKit Environment Mode (without `--template`)
49
63
 
50
64
  Create a workspace to organize multiple projects:
51
65
 
52
66
  ```bash
53
- npx rapidkit my-workspace # Create workspace
67
+ npx rapidkit my-workspace # Create a RapidKit environment (installs python core)
54
68
  cd my-workspace
55
- npx rapidkit my-api --template fastapi # Create FastAPI project
56
- npx rapidkit admin-api --template nestjs # Create NestJS project
69
+
70
+ # Interactive project creation (recommended)
71
+ rapidkit create
72
+
73
+ # Or non-interactive via kit slug
74
+ rapidkit create project fastapi.standard my-api --output .
75
+ rapidkit create project nestjs.standard admin-api --output .
76
+ ```
77
+
78
+ This mode creates a "RapidKit environment" directory (Poetry/venv/pipx) and installs the Python Core there, so you can create/manage projects from the same CLI.
79
+
80
+ Note: when you choose Poetry, the virtualenv is typically created in Poetry's cache (not as a local `.venv` folder). Activate it via:
81
+
82
+ ```bash
83
+ source "$(poetry env info --path)/bin/activate"
84
+ ```
85
+
86
+ ## Kits / Templates
87
+
88
+ Kits/templates are provided by the Python Core. This npm package is not limited to two templates.
89
+
90
+ List kits:
91
+
92
+ ```bash
93
+ rapidkit list
94
+ rapidkit list --json
95
+ ```
96
+
97
+ Create a project with any kit slug:
98
+
99
+ ```bash
100
+ npx rapidkit create project <kit-slug> my-service --output .
57
101
  ```
58
102
 
59
- > **Note:** The same `npx rapidkit <name> --template <type>` command works everywhere - in any directory or inside a workspace!
103
+ Examples:
104
+
105
+ ```bash
106
+ npx rapidkit create project fastapi.standard my-service --output .
107
+ npx rapidkit create project nestjs.standard my-service --output .
108
+ ```
109
+
110
+ ### Offline fallback (deprecated, last resort)
111
+
112
+ **Deprecated:** With the Python Core (PyPI `rapidkit-core`) now providing dynamic kits and the interactive wizard, the npm package no longer relies on static embedded templates. The offline fallback remains available only as an absolute last-resort for environments where Python/Core cannot be used, but it is not recommended for normal usage.
113
+
114
+ If you still need the fallback it supports:
115
+
116
+ - `fastapi.standard` (and `fastapi` shorthand)
117
+ - `nestjs.standard` (and `nestjs` shorthand)
118
+
119
+ Example (deprecated fallback):
120
+
121
+ ```bash
122
+ npx rapidkit create project fastapi.standard my-api --output .
123
+ ```
124
+
125
+ Limitations of the offline fallback (deprecated):
126
+
127
+ - Only FastAPI/NestJS embedded templates are supported.
128
+ - The full kit catalog (`rapidkit list`) and the interactive wizard (`rapidkit create`) require Python Core.
129
+ - `--json` output is not supported for fallback `create`.
130
+
131
+ ---
132
+
133
+ ### Bootstrapping Python Core into a workspace
134
+
135
+ The recommended flow is to use the Python Core (`rapidkit-core` on PyPI) as the single source of truth for kits and modules. The npm CLI will bootstrap the Python Core into a workspace virtual environment so you can create and manage projects even on a fresh machine.
136
+
137
+ Example: create a workspace and verify Core is bootstrapped
138
+
139
+ ```bash
140
+ # Create a RapidKit workspace non-interactively (workspace .venv will be created)
141
+ npx rapidkit my-workspace --yes --skip-git
142
+
143
+ # Activate the workspace environment
144
+ cd my-workspace
145
+ source .venv/bin/activate
146
+
147
+ # Confirm rapidkit-core is installed inside the workspace venv
148
+ python -m pip show rapidkit-core
149
+ # -> Name: rapidkit-core
150
+ # -> Version: 0.2.1rc1 (or newer)
151
+ ```
60
152
 
61
- ## Templates
153
+ ## Install Python Core (optional) 🐍🔧
62
154
 
63
- | Template | Framework | Description |
64
- |----------|-----------|-------------|
65
- | `fastapi` | FastAPI | Python async web framework with automatic API docs |
66
- | `nestjs` | NestJS | TypeScript Node.js framework with modular architecture |
155
+ RapidKit's engine is provided by the Python package `rapidkit-core` on PyPI. If you prefer to install the engine manually (for development or testing), you can do so:
156
+
157
+ ```bash
158
+ # Install for current user
159
+ pip install --user rapidkit-core
160
+
161
+ # Or install into an active virtual environment / system
162
+ pip install rapidkit-core
163
+ ```
164
+
165
+ Project page: https://pypi.org/project/rapidkit-core/
166
+
167
+ Notes:
168
+
169
+ - The CLI will prefer system Python with `rapidkit-core` if available. If not present it bootstraps `rapidkit-core` into the workspace `.venv` (or a cached bridge venv as a fallback for some global flows).
170
+ - To emulate a clean system in CI/QA, ensure `rapidkit-core` is not installed in the global/system Python before running the workspace creation script.
171
+ - If you prefer Poetry to create in-project virtualenvs (`.venv`), enable it via `poetry config virtualenvs.in-project true` or let the workspace installer configure Poetry for you.
67
172
 
68
173
  ## CLI Options
69
174
 
@@ -72,11 +177,12 @@ npx rapidkit [project-name] [options]
72
177
  ```
73
178
 
74
179
  ### Arguments
180
+
75
181
  - `project-name` - Name of project/workspace directory to create
76
182
 
77
183
  ### Options
78
- - `-t, --template <template>` - Template to use: `fastapi` or `nestjs` (creates direct project)
79
- - `--skip-git` - Skip git initialization
184
+
185
+ - `--skip-git` - Skip git initialization
80
186
  - `--skip-install` - Skip installing dependencies (for NestJS)
81
187
  - `--debug` - Enable verbose debug logging
82
188
  - `--dry-run` - Preview what would be created without creating it
@@ -100,6 +206,43 @@ npx rapidkit format # Format code
100
206
  npx rapidkit --help # Show all commands
101
207
  ```
102
208
 
209
+ ### Adding Modules to Your Project
210
+
211
+ RapidKit's modular architecture lets you extend your project with pre-built modules. Install modules using:
212
+
213
+ ```bash
214
+ npx rapidkit add module <module-slug>
215
+ ```
216
+
217
+ **Examples:**
218
+
219
+ ```bash
220
+ # Add authentication module
221
+ npx rapidkit add module auth
222
+
223
+ # Add caching module (Redis)
224
+ npx rapidkit add module redis
225
+
226
+ # Add database module (PostgreSQL)
227
+ npx rapidkit add module db_postgres
228
+ ```
229
+
230
+ **List available modules:**
231
+
232
+ ```bash
233
+ npx rapidkit list modules
234
+ npx rapidkit list modules --json
235
+ ```
236
+
237
+ **View module details:**
238
+
239
+ ```bash
240
+ npx rapidkit info module auth
241
+ npx rapidkit info module db_postgres
242
+ ```
243
+
244
+ > **💡 Tip:** Use the [RapidKit VS Code Extension](https://marketplace.visualstudio.com/items?itemName=rapidkit.rapidkit-vscode) for a visual interface to browse and install modules!
245
+
103
246
  > **Note:** `npx rapidkit` automatically detects when you're inside a RapidKit project and delegates to the local CLI. Works everywhere without any setup!
104
247
 
105
248
  > **💡 Tip:** Install globally with `npm i -g rapidkit` to use `rapidkit` directly without `npx`.
@@ -158,9 +301,37 @@ my-api/
158
301
 
159
302
  ## Requirements
160
303
 
161
- - **Node.js**: 18+ (for running npx)
162
- - **For FastAPI**: Python 3.11+ with Poetry
163
- - **For NestJS**: Node.js 20+ with npm/yarn/pnpm
304
+ - **Node.js**: 20.19.6+ (LTS recommended)
305
+ - **Python**: Required for RapidKit Core commands (e.g. `list/info/create/add/...`). If Python is missing, the bridge fails with a clear error message.
306
+ - For FastAPI projects: Python + Poetry (as required by the generated project)
307
+ - For NestJS projects: Node + a package manager (npm/yarn/pnpm)
308
+ - **Git**: For version control
309
+
310
+ > 💡 **Tip:** Use [RapidKit VS Code Extension](https://marketplace.visualstudio.com/items?itemName=rapidkit.rapidkit-vscode) - includes system checker to verify all requirements!
311
+
312
+ ## How It Works (Under the Hood)
313
+
314
+ This CLI runs a Node entrypoint (`dist/index.js`) that makes these decisions:
315
+
316
+ 1. If you're inside a RapidKit project:
317
+
318
+ - It detects the project (via `.rapidkit/project.json` or other signals).
319
+ - It delegates `rapidkit init/dev/test/...` to the project-local launcher (`./rapidkit` or `.rapidkit/rapidkit`).
320
+
321
+ 2. If you're not inside a project and run a global/core command (e.g. `rapidkit list --json`):
322
+
323
+ - It forwards the request to the Python Core via `python -m rapidkit ...`.
324
+ - If Core is not installed in system Python, it bootstraps a cached venv and installs `rapidkit-core` there.
325
+
326
+ 3. If you run `npx rapidkit <name>` without `--template`:
327
+
328
+ - It creates a "RapidKit environment" directory (Poetry/venv/pipx) so you're ready to create and run real projects.
329
+
330
+ ### Bridge controls
331
+
332
+ - Override Core install target (dev/test): `RAPIDKIT_CORE_PYTHON_PACKAGE=/path/to/core`
333
+ - Cache location: `XDG_CACHE_HOME=...`
334
+ - Upgrade pip during bootstrap (optional): `RAPIDKIT_BRIDGE_UPGRADE_PIP=1`
164
335
 
165
336
  ## Development
166
337
 
@@ -184,7 +355,7 @@ npm run dev
184
355
 
185
356
  ## Related Projects
186
357
 
187
- - **RapidKit Python** - The core framework (coming soon to PyPI)
358
+ - **RapidKit Core (Python)** - The engine (PyPI: `rapidkit-core`)
188
359
  - **RapidKit Docs** - https://getrapidkit.com
189
360
  - **GitHub**: https://github.com/getrapidkit
190
361
 
@@ -196,13 +367,3 @@ MIT
196
367
 
197
368
  - 🐛 Report issues: [GitHub Issues](https://github.com/getrapidkit/rapidkit-npm/issues)
198
369
  - 📚 Docs: https://getrapidkit.com
199
-
200
- ---
201
-
202
- **v0.13.0** - NestJS test coverage boost (75%→90%), demo-kit improvements
203
-
204
- **v0.12.4** - Friendly shell activation UX with green headers and robust fallback logic
205
-
206
- **v0.12.2** - Simplified CLI: `rapidkit init` now handles environment activation automatically
207
-
208
- **v0.12.0** - Added NestJS template, workspace mode, and unified CLI
package/dist/index.d.ts CHANGED
@@ -1 +1,4 @@
1
1
  #!/usr/bin/env node
2
+ declare function handleCreateOrFallback(args: string[]): Promise<number>;
3
+
4
+ export { handleCreateOrFallback };