@lenne.tech/cli 1.2.0 β 1.3.0
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.
- package/build/commands/claude/install-plugin.js +339 -0
- package/package.json +1 -1
- package/build/commands/claude/install-commands.js +0 -337
- package/build/commands/claude/install-mcps.js +0 -258
- package/build/commands/claude/install-skills.js +0 -693
- package/build/lib/mcp-registry.js +0 -80
- package/build/templates/claude-commands/code-cleanup.md +0 -82
- package/build/templates/claude-commands/commit-message.md +0 -21
- package/build/templates/claude-commands/create-story.md +0 -435
- package/build/templates/claude-commands/mr-description-clipboard.md +0 -48
- package/build/templates/claude-commands/mr-description.md +0 -33
- package/build/templates/claude-commands/sec-review.md +0 -62
- package/build/templates/claude-commands/skill-optimize.md +0 -481
- package/build/templates/claude-commands/test-generate.md +0 -45
- package/build/templates/claude-skills/building-stories-with-tdd/SKILL.md +0 -265
- package/build/templates/claude-skills/building-stories-with-tdd/code-quality.md +0 -276
- package/build/templates/claude-skills/building-stories-with-tdd/database-indexes.md +0 -182
- package/build/templates/claude-skills/building-stories-with-tdd/examples.md +0 -1383
- package/build/templates/claude-skills/building-stories-with-tdd/handling-existing-tests.md +0 -197
- package/build/templates/claude-skills/building-stories-with-tdd/reference.md +0 -1427
- package/build/templates/claude-skills/building-stories-with-tdd/security-review.md +0 -307
- package/build/templates/claude-skills/building-stories-with-tdd/workflow.md +0 -1004
- package/build/templates/claude-skills/generating-nest-servers/SKILL.md +0 -303
- package/build/templates/claude-skills/generating-nest-servers/configuration.md +0 -285
- package/build/templates/claude-skills/generating-nest-servers/declare-keyword-warning.md +0 -133
- package/build/templates/claude-skills/generating-nest-servers/description-management.md +0 -226
- package/build/templates/claude-skills/generating-nest-servers/examples.md +0 -893
- package/build/templates/claude-skills/generating-nest-servers/framework-guide.md +0 -259
- package/build/templates/claude-skills/generating-nest-servers/quality-review.md +0 -864
- package/build/templates/claude-skills/generating-nest-servers/reference.md +0 -487
- package/build/templates/claude-skills/generating-nest-servers/security-rules.md +0 -371
- package/build/templates/claude-skills/generating-nest-servers/verification-checklist.md +0 -262
- package/build/templates/claude-skills/generating-nest-servers/workflow-process.md +0 -1061
- package/build/templates/claude-skills/using-lt-cli/SKILL.md +0 -284
- package/build/templates/claude-skills/using-lt-cli/examples.md +0 -546
- package/build/templates/claude-skills/using-lt-cli/reference.md +0 -513
|
@@ -1,303 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: generating-nest-servers
|
|
3
|
-
version: 1.1.0
|
|
4
|
-
description: PRIMARY expert for ALL NestJS and @lenne.tech/nest-server tasks. ALWAYS use this skill when working in projects with @lenne.tech/nest-server in package.json dependencies (supports monorepos with projects/*, packages/*, apps/* structure), or when asked about NestJS modules, services, controllers, resolvers, models, objects, tests, server creation, debugging, or any NestJS/nest-server development task. Handles lt server commands, security analysis, test creation, and all backend development. ALWAYS reads CrudService base class before working with Services.
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# NestJS Server Development Expert
|
|
8
|
-
|
|
9
|
-
You are the **PRIMARY expert** for NestJS backend development and the @lenne.tech/nest-server framework. This skill handles **ALL NestJS-related tasks**, from analysis to creation to debugging:
|
|
10
|
-
|
|
11
|
-
## When to Use This Skill
|
|
12
|
-
|
|
13
|
-
**β
ALWAYS use this skill for:**
|
|
14
|
-
|
|
15
|
-
### Analysis & Understanding
|
|
16
|
-
- π Analyzing existing NestJS code structure
|
|
17
|
-
- π Understanding how modules, services, controllers work
|
|
18
|
-
- π Reviewing project architecture
|
|
19
|
-
- πΊοΈ Mapping relationships between modules
|
|
20
|
-
- π Reading and explaining NestJS code
|
|
21
|
-
- π Finding specific implementations (controllers, services, etc.)
|
|
22
|
-
|
|
23
|
-
### Running & Debugging
|
|
24
|
-
- π Starting the NestJS server (`npm start`, `npm run dev`)
|
|
25
|
-
- π Debugging server issues and errors
|
|
26
|
-
- π§ͺ Running tests (`npm test`)
|
|
27
|
-
- π Checking server logs and output
|
|
28
|
-
- βοΈ Configuring environment variables
|
|
29
|
-
- π§ Troubleshooting build/compile errors
|
|
30
|
-
|
|
31
|
-
### Creation & Modification
|
|
32
|
-
- β¨ Creating new modules with `lt server module`
|
|
33
|
-
- π¨ Creating new objects with `lt server object`
|
|
34
|
-
- β Adding properties with `lt server addProp`
|
|
35
|
-
- ποΈ Creating a new server with `lt server create`
|
|
36
|
-
- β»οΈ Modifying existing code (services, controllers, resolvers)
|
|
37
|
-
- π Adding relationships between modules
|
|
38
|
-
- π¦ Managing dependencies and imports
|
|
39
|
-
|
|
40
|
-
### Testing & Validation
|
|
41
|
-
- β
Creating API tests for controllers/resolvers
|
|
42
|
-
- π§ͺ Running and fixing failing tests
|
|
43
|
-
- π― Testing endpoints manually
|
|
44
|
-
- π Validating data models and schemas
|
|
45
|
-
- π Testing authentication and permissions
|
|
46
|
-
|
|
47
|
-
### General NestJS Tasks
|
|
48
|
-
- π¬ Answering NestJS/nest-server questions
|
|
49
|
-
- π Explaining framework concepts
|
|
50
|
-
- ποΈ Discussing architecture decisions
|
|
51
|
-
- π οΈ Recommending best practices
|
|
52
|
-
- π Refactoring existing code
|
|
53
|
-
|
|
54
|
-
**π― Rule: If it involves NestJS or @lenne.tech/nest-server in ANY way, use this skill!**
|
|
55
|
-
|
|
56
|
-
## Related Skills
|
|
57
|
-
|
|
58
|
-
**π Works closely with:**
|
|
59
|
-
- `building-stories-with-tdd` skill - For building user stories with Test-Driven Development
|
|
60
|
-
- `using-lt-cli` skill - For Git operations and Fullstack initialization
|
|
61
|
-
|
|
62
|
-
**When to use which:**
|
|
63
|
-
- Building features with TDD workflow? β Use `building-stories-with-tdd` skill (it will use this skill for implementation)
|
|
64
|
-
- Need Git operations? β Use `using-lt-cli` skill
|
|
65
|
-
- Direct NestJS work? β Use this skill
|
|
66
|
-
|
|
67
|
-
---
|
|
68
|
-
|
|
69
|
-
## π¨ CRITICAL SECURITY RULES - READ FIRST
|
|
70
|
-
|
|
71
|
-
**Before you start ANY work, understand these NON-NEGOTIABLE rules:**
|
|
72
|
-
|
|
73
|
-
### β NEVER Do This:
|
|
74
|
-
1. **NEVER remove or weaken `@Restricted()` decorators**
|
|
75
|
-
2. **NEVER change `@Roles()` decorators** to more permissive roles
|
|
76
|
-
3. **NEVER modify `securityCheck()` logic** to bypass security
|
|
77
|
-
4. **NEVER remove class-level `@Restricted(RoleEnum.ADMIN)`**
|
|
78
|
-
|
|
79
|
-
### β
ALWAYS Do This:
|
|
80
|
-
1. **ALWAYS analyze permissions BEFORE writing tests**
|
|
81
|
-
2. **ALWAYS test with the LEAST privileged user** who is authorized
|
|
82
|
-
3. **ALWAYS adapt tests to security requirements**, never vice versa
|
|
83
|
-
4. **ALWAYS ask developer for approval** before changing ANY security decorator
|
|
84
|
-
|
|
85
|
-
**π Complete security rules with all details, examples, and testing strategies: `security-rules.md`**
|
|
86
|
-
|
|
87
|
-
## π¨ CRITICAL: NEVER USE `declare` KEYWORD FOR PROPERTIES
|
|
88
|
-
|
|
89
|
-
**β οΈ DO NOT use the `declare` keyword when defining properties in classes!**
|
|
90
|
-
|
|
91
|
-
```typescript
|
|
92
|
-
// β WRONG
|
|
93
|
-
declare name: string; // Decorator won't work!
|
|
94
|
-
|
|
95
|
-
// β
CORRECT
|
|
96
|
-
@UnifiedField({ description: 'Product name' })
|
|
97
|
-
name: string; // Decorator works properly
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
**Why**: `declare` prevents decorators from being applied, breaking the decorator system.
|
|
101
|
-
|
|
102
|
-
**π Complete explanation and correct patterns: `declare-keyword-warning.md`**
|
|
103
|
-
|
|
104
|
-
## π¨ CRITICAL: DESCRIPTION MANAGEMENT
|
|
105
|
-
|
|
106
|
-
**β οΈ Descriptions must be applied consistently to EVERY component.**
|
|
107
|
-
|
|
108
|
-
**Quick 3-Step Process:**
|
|
109
|
-
1. Extract descriptions from user's `// comments`
|
|
110
|
-
2. Format: `'English text'` or `'English (Deutsch)'` for German input
|
|
111
|
-
3. Apply EVERYWHERE: Model, CreateInput, UpdateInput, Objects, Class-level decorators
|
|
112
|
-
|
|
113
|
-
**π Complete formatting rules, examples, and verification checklist: `description-management.md`**
|
|
114
|
-
|
|
115
|
-
---
|
|
116
|
-
|
|
117
|
-
## Core Responsibilities
|
|
118
|
-
|
|
119
|
-
This skill handles **ALL** NestJS server development tasks, including:
|
|
120
|
-
|
|
121
|
-
### Simple Tasks (Single Commands)
|
|
122
|
-
- Creating a single module with `lt server module`
|
|
123
|
-
- Creating a single object with `lt server object`
|
|
124
|
-
- Adding properties with `lt server addProp`
|
|
125
|
-
- Creating a new server with `lt server create`
|
|
126
|
-
- Starting the server with `npm start` or `npm run dev`
|
|
127
|
-
- Running tests with `npm test`
|
|
128
|
-
|
|
129
|
-
### Complex Tasks (Multiple Components)
|
|
130
|
-
When you receive a complete structure specification, you will:
|
|
131
|
-
|
|
132
|
-
1. **Parse and analyze** the complete structure (modules, models, objects, properties, relationships)
|
|
133
|
-
2. **Create a comprehensive todo list** breaking down all tasks
|
|
134
|
-
3. **Generate all components** in the correct order (objects first, then modules)
|
|
135
|
-
4. **Handle inheritance** properly (Core and custom parent classes)
|
|
136
|
-
5. **Manage descriptions** (translate German to English, add originals in parentheses)
|
|
137
|
-
6. **Create API tests** for all controllers and resolvers
|
|
138
|
-
7. **Verify functionality** and provide a summary with observations
|
|
139
|
-
|
|
140
|
-
### Analysis Tasks
|
|
141
|
-
When analyzing existing code:
|
|
142
|
-
|
|
143
|
-
1. **Explore the project structure** to understand the architecture
|
|
144
|
-
2. **Read relevant files** (modules, services, controllers, models)
|
|
145
|
-
3. **Identify patterns** and conventions used in the project
|
|
146
|
-
4. **Explain findings** clearly and concisely
|
|
147
|
-
5. **Suggest improvements** when appropriate
|
|
148
|
-
|
|
149
|
-
### Debugging Tasks
|
|
150
|
-
When debugging issues:
|
|
151
|
-
|
|
152
|
-
1. **Read error messages and logs** carefully
|
|
153
|
-
2. **Identify the root cause** by analyzing relevant code
|
|
154
|
-
3. **Check configuration** (environment variables, config files)
|
|
155
|
-
4. **Test hypotheses** by examining related files
|
|
156
|
-
5. **Provide solutions** with code examples
|
|
157
|
-
|
|
158
|
-
**Remember:** For ANY task involving NestJS or @lenne.tech/nest-server, use this skill!
|
|
159
|
-
|
|
160
|
-
## π Understanding the Framework
|
|
161
|
-
|
|
162
|
-
**π Complete framework guide: `framework-guide.md`**
|
|
163
|
-
|
|
164
|
-
**Critical Rules:**
|
|
165
|
-
- [ ] Read CrudService before modifying any Service (`node_modules/@lenne.tech/nest-server/src/core/common/services/crud.service.ts`)
|
|
166
|
-
- [ ] NEVER blindly pass all serviceOptions to other Services (only pass `currentUser`)
|
|
167
|
-
- [ ] Check if CrudService already provides needed functionality (create, find, findOne, update, delete, pagination)
|
|
168
|
-
|
|
169
|
-
## Configuration File & Commands
|
|
170
|
-
|
|
171
|
-
**π Complete guide: `configuration.md`**
|
|
172
|
-
|
|
173
|
-
**Quick Command Reference:**
|
|
174
|
-
```bash
|
|
175
|
-
# Create complete module
|
|
176
|
-
lt server module --name Product --controller Rest|GraphQL|Both|auto
|
|
177
|
-
|
|
178
|
-
# Create SubObject
|
|
179
|
-
lt server object --name Address
|
|
180
|
-
|
|
181
|
-
# Add properties
|
|
182
|
-
lt server addProp --type Module --element User
|
|
183
|
-
|
|
184
|
-
# New project
|
|
185
|
-
lt server create <server-name>
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
**Essential Property Flags:**
|
|
189
|
-
- `--prop-name-X / --prop-type-X` - Name and type (string|number|boolean|ObjectId|Json|Date|bigint)
|
|
190
|
-
- `--prop-nullable-X` / `--prop-array-X` - Modifiers
|
|
191
|
-
- `--prop-enum-X / --prop-schema-X / --prop-reference-X` - Complex types
|
|
192
|
-
|
|
193
|
-
## Prerequisites Check
|
|
194
|
-
|
|
195
|
-
**Setup:**
|
|
196
|
-
```bash
|
|
197
|
-
lt --version # Check CLI installation
|
|
198
|
-
npm install -g @lenne.tech/cli # If needed
|
|
199
|
-
ls src/server/modules # Verify project structure
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
**Creating New Server:**
|
|
203
|
-
```bash
|
|
204
|
-
lt server create <server-name>
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
**Post-creation verification:** Check `src/config.env.ts` for replaced secrets and correct database URIs.
|
|
208
|
-
|
|
209
|
-
## Understanding the Specification Format
|
|
210
|
-
|
|
211
|
-
**π Complete reference and examples: `reference.md` and `examples.md`**
|
|
212
|
-
|
|
213
|
-
**Quick Type Reference:**
|
|
214
|
-
- Basic: `string`, `number`, `boolean`, `Date`, `bigint`, `Json`
|
|
215
|
-
- Arrays: `type[]` β add `--prop-array-X true`
|
|
216
|
-
- Optional: `property?: type` β add `--prop-nullable-X true`
|
|
217
|
-
- References: `User` β use `--prop-type-X ObjectId --prop-reference-X User`
|
|
218
|
-
- Embedded: `Address` β use `--prop-schema-X Address`
|
|
219
|
-
- Enums: `ENUM (VAL1, VAL2)` β use `--prop-enum-X PropertyNameEnum`
|
|
220
|
-
|
|
221
|
-
## Workflow Process
|
|
222
|
-
|
|
223
|
-
**π Complete details: `workflow-process.md`**
|
|
224
|
-
|
|
225
|
-
**7-Phase Workflow:**
|
|
226
|
-
1. Analysis & Planning β Parse spec, create todo list
|
|
227
|
-
2. SubObject Creation β Create in dependency order
|
|
228
|
-
3. Module Creation β Create with all properties
|
|
229
|
-
4. Inheritance Handling β Update extends, CreateInput must include parent fields
|
|
230
|
-
5. **Description Management** β οΈ **CRITICAL** β Extract from comments, format as "ENGLISH (DEUTSCH)", apply everywhere
|
|
231
|
-
6. Enum File Creation β Manual creation in `src/server/common/enums/`
|
|
232
|
-
7. API Test Creation β **MANDATORY:** Analyze permissions first, use least privileged user, test failures
|
|
233
|
-
|
|
234
|
-
**Critical Testing Rules:**
|
|
235
|
-
- β
Test via REST/GraphQL using TestHelper (NEVER direct Service tests)
|
|
236
|
-
- β
Analyze @Roles decorators BEFORE writing tests
|
|
237
|
-
- β
Use appropriate user role (not admin when S_USER works)
|
|
238
|
-
- β
Test unauthorized access failures (401/403)
|
|
239
|
-
|
|
240
|
-
## Property Ordering
|
|
241
|
-
|
|
242
|
-
**ALL properties must be in alphabetical order** in Model, Input, and Output files. Verify and reorder after generating.
|
|
243
|
-
|
|
244
|
-
## Verification Checklist
|
|
245
|
-
|
|
246
|
-
**π Complete checklist: `verification-checklist.md`**
|
|
247
|
-
|
|
248
|
-
**Essential Checks:**
|
|
249
|
-
- [ ] All components created with descriptions (Model + CreateInput + UpdateInput)
|
|
250
|
-
- [ ] Properties in alphabetical order
|
|
251
|
-
- [ ] Permission analysis BEFORE writing tests
|
|
252
|
-
- [ ] Least privileged user used in tests
|
|
253
|
-
- [ ] Security validation tests (401/403 failures)
|
|
254
|
-
- [ ] All tests pass
|
|
255
|
-
|
|
256
|
-
## Error Handling
|
|
257
|
-
|
|
258
|
-
**Common Issues:**
|
|
259
|
-
- **TypeScript errors** β Add missing imports manually
|
|
260
|
-
- **CreateInput validation fails** β Check parent's CreateInput for required fields
|
|
261
|
-
- **Tests fail with 403** β Check @Roles decorator, use appropriate user role (not admin when S_USER works)
|
|
262
|
-
- **Security tests not failing** β Verify @Roles and securityCheck() logic, fix model/controller if needed
|
|
263
|
-
|
|
264
|
-
## Phase 8: Pre-Report Quality Review
|
|
265
|
-
|
|
266
|
-
**π Complete process: `quality-review.md`**
|
|
267
|
-
|
|
268
|
-
**7 Steps:**
|
|
269
|
-
1. Identify all changes (git)
|
|
270
|
-
2. Test management (analyze existing tests, create new, follow patterns)
|
|
271
|
-
3. Compare with existing code (consistency)
|
|
272
|
-
4. Critical analysis (style, structure, quality)
|
|
273
|
-
5. Automated optimizations (imports, properties, formatting)
|
|
274
|
-
6. Pre-report testing (build, lint, all tests must pass)
|
|
275
|
-
7. Final verification (complete checklist)
|
|
276
|
-
|
|
277
|
-
**Critical:** Understand TestHelper, analyze existing tests first, use appropriate user roles, all tests must pass.
|
|
278
|
-
|
|
279
|
-
## Final Report
|
|
280
|
-
|
|
281
|
-
After completing all tasks, provide:
|
|
282
|
-
1. Summary of created components (SubObjects, Objects, Modules, enums, tests)
|
|
283
|
-
2. Observations about data structure
|
|
284
|
-
3. Test results (all passing)
|
|
285
|
-
4. Next steps
|
|
286
|
-
|
|
287
|
-
## Best Practices
|
|
288
|
-
|
|
289
|
-
1. Create dependencies first (SubObjects before Modules)
|
|
290
|
-
2. Check for circular dependencies
|
|
291
|
-
3. Test incrementally, commit after major components
|
|
292
|
-
4. Use appropriate controller types (Rest/GraphQL/Both)
|
|
293
|
-
5. Validate required fields in tests
|
|
294
|
-
6. Document complex relationships
|
|
295
|
-
|
|
296
|
-
## Working with This Skill
|
|
297
|
-
|
|
298
|
-
When receiving a specification:
|
|
299
|
-
1. Parse completely, ask clarifying questions
|
|
300
|
-
2. Create detailed todo list
|
|
301
|
-
3. Execute systematically following workflow
|
|
302
|
-
4. Verify each step, report progress
|
|
303
|
-
5. Provide comprehensive summary
|
|
@@ -1,285 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: nest-server-generator-configuration
|
|
3
|
-
version: 1.0.0
|
|
4
|
-
description: Complete guide to lt.config.json configuration file
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Configuration Guide
|
|
8
|
-
|
|
9
|
-
## Table of Contents
|
|
10
|
-
- [Configuration File (lt.config.json)](#configuration-file-ltconfigjson)
|
|
11
|
-
- [Command Syntax Reference](#command-syntax-reference)
|
|
12
|
-
|
|
13
|
-
## Configuration File (lt.config.json)
|
|
14
|
-
|
|
15
|
-
The lenne.tech CLI supports project-level configuration via `lt.config.json` files. This allows you to set default values for commands, eliminating the need for repeated CLI parameters or interactive prompts.
|
|
16
|
-
|
|
17
|
-
### File Location and Hierarchy
|
|
18
|
-
|
|
19
|
-
- **Location**: Place `lt.config.json` in your project root or any parent directory
|
|
20
|
-
- **Hierarchy**: The CLI searches from the current directory up to the root, merging configurations
|
|
21
|
-
- **Priority** (lowest to highest):
|
|
22
|
-
1. Default values (hardcoded in CLI)
|
|
23
|
-
2. Config from parent directories (higher up = lower priority)
|
|
24
|
-
3. Config from current directory
|
|
25
|
-
4. CLI parameters (`--flag value`)
|
|
26
|
-
5. Interactive user input
|
|
27
|
-
|
|
28
|
-
### Configuration Structure
|
|
29
|
-
|
|
30
|
-
```json
|
|
31
|
-
{
|
|
32
|
-
"meta": {
|
|
33
|
-
"version": "1.0.0",
|
|
34
|
-
"name": "My Project",
|
|
35
|
-
"description": "Optional project description"
|
|
36
|
-
},
|
|
37
|
-
"commands": {
|
|
38
|
-
"server": {
|
|
39
|
-
"module": {
|
|
40
|
-
"controller": "Both",
|
|
41
|
-
"skipLint": false
|
|
42
|
-
},
|
|
43
|
-
"object": {
|
|
44
|
-
"skipLint": false
|
|
45
|
-
},
|
|
46
|
-
"addProp": {
|
|
47
|
-
"skipLint": false
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
### Available Configuration Options
|
|
55
|
-
|
|
56
|
-
**Server Module Configuration (`commands.server.module`)**:
|
|
57
|
-
- `controller`: Default controller type (`"Rest"` | `"GraphQL"` | `"Both"` | `"auto"`)
|
|
58
|
-
- `skipLint`: Skip lint prompt after module creation (boolean)
|
|
59
|
-
|
|
60
|
-
**Server Object Configuration (`commands.server.object`)**:
|
|
61
|
-
- `skipLint`: Skip lint prompt after object creation (boolean)
|
|
62
|
-
|
|
63
|
-
**Server AddProp Configuration (`commands.server.addProp`)**:
|
|
64
|
-
- `skipLint`: Skip lint prompt after adding property (boolean)
|
|
65
|
-
|
|
66
|
-
### Using Configuration in Commands
|
|
67
|
-
|
|
68
|
-
**Example 1: Configure controller type globally**
|
|
69
|
-
```json
|
|
70
|
-
{
|
|
71
|
-
"commands": {
|
|
72
|
-
"server": {
|
|
73
|
-
"module": {
|
|
74
|
-
"controller": "Rest"
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
Now all `lt server module` commands will default to REST controllers:
|
|
82
|
-
```bash
|
|
83
|
-
# Uses "Rest" from config (no prompt)
|
|
84
|
-
lt server module --name Product --prop-name-0 name --prop-type-0 string
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
**Example 2: Override config with CLI parameter**
|
|
88
|
-
```bash
|
|
89
|
-
# Ignores config, uses GraphQL
|
|
90
|
-
lt server module --name Product --controller GraphQL
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
**Example 3: Auto-detect from config**
|
|
94
|
-
```json
|
|
95
|
-
{
|
|
96
|
-
"commands": {
|
|
97
|
-
"server": {
|
|
98
|
-
"module": {
|
|
99
|
-
"controller": "auto"
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
Now the CLI will auto-detect controller type from existing modules without prompting.
|
|
107
|
-
|
|
108
|
-
### Managing Configuration
|
|
109
|
-
|
|
110
|
-
**Initialize configuration**:
|
|
111
|
-
```bash
|
|
112
|
-
lt config init
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
**Show current configuration** (merged from all hierarchy levels):
|
|
116
|
-
```bash
|
|
117
|
-
lt config show
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
**Get help**:
|
|
121
|
-
```bash
|
|
122
|
-
lt config help
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
### When to Use Configuration
|
|
126
|
-
|
|
127
|
-
**β
Use configuration when:**
|
|
128
|
-
- Creating multiple modules with the same controller type
|
|
129
|
-
- Working in a team with agreed-upon conventions
|
|
130
|
-
- Automating module generation in CI/CD
|
|
131
|
-
- You want to skip repetitive prompts
|
|
132
|
-
|
|
133
|
-
**β Don't use configuration when:**
|
|
134
|
-
- Creating a single module with specific requirements
|
|
135
|
-
- Each module needs a different controller type
|
|
136
|
-
- You're just testing or experimenting
|
|
137
|
-
|
|
138
|
-
### Best Practices
|
|
139
|
-
|
|
140
|
-
1. **Project Root**: Place `lt.config.json` in your project root
|
|
141
|
-
2. **Version Control**: Commit the config file to share with your team
|
|
142
|
-
3. **Documentation**: Add a README note explaining the config choices
|
|
143
|
-
4. **Override When Needed**: Use CLI parameters to override for special cases
|
|
144
|
-
|
|
145
|
-
### π― IMPORTANT: Configuration After Server Creation
|
|
146
|
-
|
|
147
|
-
**CRITICAL WORKFLOW**: After creating a new server with `lt server create`, you **MUST** initialize the configuration file to set project conventions.
|
|
148
|
-
|
|
149
|
-
#### Automatic Post-Creation Setup
|
|
150
|
-
|
|
151
|
-
When you create a new NestJS server, immediately follow these steps:
|
|
152
|
-
|
|
153
|
-
1. **Navigate to the API directory**:
|
|
154
|
-
```bash
|
|
155
|
-
cd projects/api
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
2. **Create the configuration file manually**:
|
|
159
|
-
```bash
|
|
160
|
-
# Create lt.config.json with controller preference
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
3. **Ask the developer for their preference** (if not already specified):
|
|
164
|
-
```
|
|
165
|
-
What controller type do you prefer for new modules in this project?
|
|
166
|
-
1. Rest - REST controllers only
|
|
167
|
-
2. GraphQL - GraphQL resolvers only
|
|
168
|
-
3. Both - Both REST and GraphQL
|
|
169
|
-
4. auto - Auto-detect from existing modules
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
4. **Write the configuration** based on the answer:
|
|
173
|
-
```json
|
|
174
|
-
{
|
|
175
|
-
"meta": {
|
|
176
|
-
"version": "1.0.0"
|
|
177
|
-
},
|
|
178
|
-
"commands": {
|
|
179
|
-
"server": {
|
|
180
|
-
"module": {
|
|
181
|
-
"controller": "Rest"
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
#### Why This Is Important
|
|
189
|
-
|
|
190
|
-
- β
**Consistency**: All modules will follow the same pattern
|
|
191
|
-
- β
**No Prompts**: Developers won't be asked for controller type repeatedly
|
|
192
|
-
- β
**Team Alignment**: Everyone uses the same conventions
|
|
193
|
-
- β
**Automation**: Scripts and CI/CD can create modules without interaction
|
|
194
|
-
|
|
195
|
-
#### Example Workflow
|
|
196
|
-
|
|
197
|
-
```bash
|
|
198
|
-
# User creates new server
|
|
199
|
-
lt server create --name MyAPI
|
|
200
|
-
|
|
201
|
-
# You (Claude) navigate to API directory
|
|
202
|
-
cd projects/api
|
|
203
|
-
|
|
204
|
-
# You ask the user
|
|
205
|
-
"I've created the server. What controller type would you like to use for modules?"
|
|
206
|
-
"1. Rest (REST only)"
|
|
207
|
-
"2. GraphQL (GraphQL only)"
|
|
208
|
-
"3. Both (REST + GraphQL)"
|
|
209
|
-
"4. auto (Auto-detect)"
|
|
210
|
-
|
|
211
|
-
# User answers: "Rest"
|
|
212
|
-
|
|
213
|
-
# You create lt.config.json
|
|
214
|
-
{
|
|
215
|
-
"meta": {
|
|
216
|
-
"version": "1.0.0"
|
|
217
|
-
},
|
|
218
|
-
"commands": {
|
|
219
|
-
"server": {
|
|
220
|
-
"module": {
|
|
221
|
-
"controller": "Rest"
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
# Confirm to user
|
|
228
|
-
"β
Configuration saved! All new modules will default to REST controllers."
|
|
229
|
-
"You can change this anytime by editing lt.config.json or running 'lt config init'."
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
#### Configuration Options Explained
|
|
233
|
-
|
|
234
|
-
**"Rest"**:
|
|
235
|
-
- β
Creates REST controllers (`@Controller()`)
|
|
236
|
-
- β No GraphQL resolvers
|
|
237
|
-
- β No PubSub integration
|
|
238
|
-
- **Best for**: Traditional REST APIs, microservices
|
|
239
|
-
|
|
240
|
-
**"GraphQL"**:
|
|
241
|
-
- β No REST controllers
|
|
242
|
-
- β
Creates GraphQL resolvers (`@Resolver()`)
|
|
243
|
-
- β
Includes PubSub for subscriptions
|
|
244
|
-
- **Best for**: GraphQL-first APIs, real-time apps
|
|
245
|
-
|
|
246
|
-
**"Both"**:
|
|
247
|
-
- β
Creates REST controllers
|
|
248
|
-
- β
Creates GraphQL resolvers
|
|
249
|
-
- β
Includes PubSub
|
|
250
|
-
- **Best for**: Hybrid APIs, gradual migration
|
|
251
|
-
|
|
252
|
-
**"auto"**:
|
|
253
|
-
- π€ Analyzes existing modules
|
|
254
|
-
- π€ Detects pattern automatically
|
|
255
|
-
- π€ No user prompt
|
|
256
|
-
- **Best for**: Following existing conventions
|
|
257
|
-
|
|
258
|
-
#### When NOT to Create Config
|
|
259
|
-
|
|
260
|
-
Skip config creation if:
|
|
261
|
-
- β User is just testing/experimenting
|
|
262
|
-
- β User explicitly says "no configuration"
|
|
263
|
-
- β Project already has lt.config.json
|
|
264
|
-
|
|
265
|
-
### Integration with Commands
|
|
266
|
-
|
|
267
|
-
When generating code, **ALWAYS check for configuration**:
|
|
268
|
-
1. Load config via `lt config show` or check for `lt.config.json`
|
|
269
|
-
2. Use configured values in command construction
|
|
270
|
-
3. Only pass CLI parameters when overriding config
|
|
271
|
-
|
|
272
|
-
**Example: Generating module with config**
|
|
273
|
-
```bash
|
|
274
|
-
# Check if config exists and what controller type is configured
|
|
275
|
-
# If config has "controller": "Rest", use it
|
|
276
|
-
lt server module --name Product --prop-name-0 name --prop-type-0 string
|
|
277
|
-
|
|
278
|
-
# If config has "controller": "auto", let CLI detect
|
|
279
|
-
lt server module --name Order --prop-name-0 total --prop-type-0 number
|
|
280
|
-
|
|
281
|
-
# Override config when needed
|
|
282
|
-
lt server module --name User --controller Both
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
## Command Syntax Reference
|