rapidkit 0.14.2 → 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 +183 -53
  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,69 +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
- > ⚠️ **PREVIEW VERSION** - This package provides demo templates for testing RapidKit's workflow.
9
- > Full module ecosystem and advanced features will be available after the Python Core release.
10
-
11
- 🚀 The easiest way to create FastAPI and NestJS projects with RapidKit templates!
8
+ This is the official RapidKit CLI on npm.
12
9
 
13
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.
14
20
 
15
21
  **💡 Tip:** Use the [RapidKit VS Code Extension](https://marketplace.visualstudio.com/items?itemName=rapidkit.rapidkit-vscode) for a visual interface!
16
22
 
17
23
  ## Quick Start
18
24
 
19
- ### Create a FastAPI Project
25
+ ### Create a Project (FastAPI)
20
26
 
21
27
  ```bash
22
- npx rapidkit my-api --template fastapi
28
+ npx rapidkit create project fastapi.standard my-api --output .
23
29
  cd my-api
24
30
  npx rapidkit init # Install dependencies
25
31
  npx rapidkit dev # Start dev server at http://localhost:8000
26
32
  ```
27
33
 
28
- ### Create a NestJS Project
34
+ ### Create a Project (NestJS)
29
35
 
30
36
  ```bash
31
- npx rapidkit my-api --template nestjs
37
+ npx rapidkit create project nestjs.standard my-api --output .
32
38
  cd my-api
33
39
  npx rapidkit init # Install dependencies
34
40
  npx rapidkit dev # Start dev server at http://localhost:8000
35
41
  ```
36
42
 
37
- 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.
38
50
 
39
51
  ## Two Modes of Operation
40
52
 
41
- ### 1. Direct Project Creation (with `--template`)
53
+ ### 1. Direct Project Creation (Core-first)
42
54
 
43
- Create a standalone project directly:
55
+ Create a standalone project directly via Core:
44
56
 
45
57
  ```bash
46
- npx rapidkit my-api --template fastapi # Create FastAPI project
47
- 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 .
48
60
  ```
49
61
 
50
- ### 2. Workspace Mode (without `--template`)
62
+ ### 2. RapidKit Environment Mode (without `--template`)
51
63
 
52
64
  Create a workspace to organize multiple projects:
53
65
 
54
66
  ```bash
55
- npx rapidkit my-workspace # Create workspace
67
+ npx rapidkit my-workspace # Create a RapidKit environment (installs python core)
56
68
  cd my-workspace
57
- npx rapidkit my-api --template fastapi # Create FastAPI project
58
- 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 .
59
101
  ```
60
102
 
61
- > **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
+ ```
62
109
 
63
- ## Templates
110
+ ### Offline fallback (deprecated, last resort)
64
111
 
65
- | Template | Framework | Description |
66
- | --------- | --------- | ------------------------------------------------------ |
67
- | `fastapi` | FastAPI | Python async web framework with automatic API docs |
68
- | `nestjs` | NestJS | TypeScript Node.js framework with modular architecture |
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.
69
113
 
70
- > 📦 **Note:** These templates are designed for testing the RapidKit workflow. Full module ecosystem coming with Core release!
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
+ ```
152
+
153
+ ## Install Python Core (optional) 🐍🔧
154
+
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.
71
172
 
72
173
  ## CLI Options
73
174
 
@@ -81,7 +182,6 @@ npx rapidkit [project-name] [options]
81
182
 
82
183
  ### Options
83
184
 
84
- - `-t, --template <template>` - Template to use: `fastapi` or `nestjs` (creates direct project)
85
185
  - `--skip-git` - Skip git initialization
86
186
  - `--skip-install` - Skip installing dependencies (for NestJS)
87
187
  - `--debug` - Enable verbose debug logging
@@ -106,6 +206,43 @@ npx rapidkit format # Format code
106
206
  npx rapidkit --help # Show all commands
107
207
  ```
108
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
+
109
246
  > **Note:** `npx rapidkit` automatically detects when you're inside a RapidKit project and delegates to the local CLI. Works everywhere without any setup!
110
247
 
111
248
  > **💡 Tip:** Install globally with `npm i -g rapidkit` to use `rapidkit` directly without `npx`.
@@ -165,33 +302,36 @@ my-api/
165
302
  ## Requirements
166
303
 
167
304
  - **Node.js**: 20.19.6+ (LTS recommended)
168
- - **For FastAPI**: Python 3.10.14+ with Poetry 2.2.1+
169
- - **For NestJS**: Node.js 20+ with npm/yarn/pnpm
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)
170
308
  - **Git**: For version control
171
309
 
172
310
  > 💡 **Tip:** Use [RapidKit VS Code Extension](https://marketplace.visualstudio.com/items?itemName=rapidkit.rapidkit-vscode) - includes system checker to verify all requirements!
173
311
 
174
- ## What's Next?
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:
175
317
 
176
- This npm package is currently in **preview mode** with demo templates. Here's what's coming:
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`).
177
320
 
178
- ### 🚀 After Core Release (v1.0.0)
321
+ 2. If you're not inside a project and run a global/core command (e.g. `rapidkit list --json`):
179
322
 
180
- - **Full Module Ecosystem** - 50+ production-ready modules
181
- - **AI-Powered Recommendations** - Intelligent module suggestions
182
- - **Seamless Integration** - npm package becomes thin wrapper over Python Core
183
- - **Dynamic Modules** - Install any module from the registry
184
- - **Advanced Features** - All RapidKit power through npm
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.
185
325
 
186
- ### 📦 Current Focus (v0.15.0)
326
+ 3. If you run `npx rapidkit <name>` without `--template`:
187
327
 
188
- - Polish existing features
189
- - Improve documentation
190
- - Optimize bundle size
191
- - Prepare Core integration bridge
192
- - Enhanced error messages
328
+ - It creates a "RapidKit environment" directory (Poetry/venv/pipx) so you're ready to create and run real projects.
193
329
 
194
- **Stay tuned!** Follow our progress on [GitHub](https://github.com/getrapidkit/rapidkit-npm).
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`
195
335
 
196
336
  ## Development
197
337
 
@@ -215,7 +355,7 @@ npm run dev
215
355
 
216
356
  ## Related Projects
217
357
 
218
- - **RapidKit Python** - The core framework (coming soon to PyPI)
358
+ - **RapidKit Core (Python)** - The engine (PyPI: `rapidkit-core`)
219
359
  - **RapidKit Docs** - https://getrapidkit.com
220
360
  - **GitHub**: https://github.com/getrapidkit
221
361
 
@@ -227,13 +367,3 @@ MIT
227
367
 
228
368
  - 🐛 Report issues: [GitHub Issues](https://github.com/getrapidkit/rapidkit-npm/issues)
229
369
  - 📚 Docs: https://getrapidkit.com
230
-
231
- ---
232
-
233
- **v0.13.0** - NestJS test coverage boost (75%→90%), demo-kit improvements
234
-
235
- **v0.12.4** - Friendly shell activation UX with green headers and robust fallback logic
236
-
237
- **v0.12.2** - Simplified CLI: `rapidkit init` now handles environment activation automatically
238
-
239
- **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 };