@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.
Files changed (36) hide show
  1. package/build/commands/claude/install-plugin.js +339 -0
  2. package/package.json +1 -1
  3. package/build/commands/claude/install-commands.js +0 -337
  4. package/build/commands/claude/install-mcps.js +0 -258
  5. package/build/commands/claude/install-skills.js +0 -693
  6. package/build/lib/mcp-registry.js +0 -80
  7. package/build/templates/claude-commands/code-cleanup.md +0 -82
  8. package/build/templates/claude-commands/commit-message.md +0 -21
  9. package/build/templates/claude-commands/create-story.md +0 -435
  10. package/build/templates/claude-commands/mr-description-clipboard.md +0 -48
  11. package/build/templates/claude-commands/mr-description.md +0 -33
  12. package/build/templates/claude-commands/sec-review.md +0 -62
  13. package/build/templates/claude-commands/skill-optimize.md +0 -481
  14. package/build/templates/claude-commands/test-generate.md +0 -45
  15. package/build/templates/claude-skills/building-stories-with-tdd/SKILL.md +0 -265
  16. package/build/templates/claude-skills/building-stories-with-tdd/code-quality.md +0 -276
  17. package/build/templates/claude-skills/building-stories-with-tdd/database-indexes.md +0 -182
  18. package/build/templates/claude-skills/building-stories-with-tdd/examples.md +0 -1383
  19. package/build/templates/claude-skills/building-stories-with-tdd/handling-existing-tests.md +0 -197
  20. package/build/templates/claude-skills/building-stories-with-tdd/reference.md +0 -1427
  21. package/build/templates/claude-skills/building-stories-with-tdd/security-review.md +0 -307
  22. package/build/templates/claude-skills/building-stories-with-tdd/workflow.md +0 -1004
  23. package/build/templates/claude-skills/generating-nest-servers/SKILL.md +0 -303
  24. package/build/templates/claude-skills/generating-nest-servers/configuration.md +0 -285
  25. package/build/templates/claude-skills/generating-nest-servers/declare-keyword-warning.md +0 -133
  26. package/build/templates/claude-skills/generating-nest-servers/description-management.md +0 -226
  27. package/build/templates/claude-skills/generating-nest-servers/examples.md +0 -893
  28. package/build/templates/claude-skills/generating-nest-servers/framework-guide.md +0 -259
  29. package/build/templates/claude-skills/generating-nest-servers/quality-review.md +0 -864
  30. package/build/templates/claude-skills/generating-nest-servers/reference.md +0 -487
  31. package/build/templates/claude-skills/generating-nest-servers/security-rules.md +0 -371
  32. package/build/templates/claude-skills/generating-nest-servers/verification-checklist.md +0 -262
  33. package/build/templates/claude-skills/generating-nest-servers/workflow-process.md +0 -1061
  34. package/build/templates/claude-skills/using-lt-cli/SKILL.md +0 -284
  35. package/build/templates/claude-skills/using-lt-cli/examples.md +0 -546
  36. package/build/templates/claude-skills/using-lt-cli/reference.md +0 -513
@@ -1,487 +0,0 @@
1
- ---
2
- name: nest-server-generator-reference
3
- version: 1.0.1
4
- description: Quick reference for ALL NestJS server development - from simple single commands to complex structure generation
5
- ---
6
-
7
- # NestJS Server Development Quick Reference
8
-
9
- ## Table of Contents
10
- - [Scope](#scope)
11
- - [Specification Syntax](#specification-syntax)
12
- - [Execution Workflow](#execution-workflow)
13
- - [Command Quick Reference](#command-quick-reference)
14
- - [Description Format](#description-format)
15
- - [Inheritance Handling](#inheritance-handling)
16
- - [Enum File Template](#enum-file-template)
17
- - [API Test Template](#api-test-template)
18
- - [Common Patterns](#common-patterns)
19
- - [Troubleshooting](#troubleshooting)
20
- - [Verification Checklist](#verification-checklist)
21
- - [File Structure](#file-structure)
22
- - [Best Practices Summary](#best-practices-summary)
23
- - [Quick Start](#quick-start)
24
-
25
- ## Scope
26
-
27
- **This skill handles ALL NestJS server development tasks:**
28
- - ✅ Simple: Create single module, object, or add property
29
- - ✅ Complex: Generate complete server structures from specifications
30
- - ✅ Any `lt server` command
31
-
32
- Use this skill for **ANY** NestJS/nest-server work, no matter how simple or complex.
33
-
34
- ## Specification Syntax
35
-
36
- ### Component Types
37
-
38
- | Type | Syntax | Purpose |
39
- |------|--------|---------|
40
- | **SubObject** | `SubObject: Name // Desc` | Embedded data structure (no _id, no timestamps) |
41
- | **Object** | `Object: Name\nProperties:\n- prop: type` | Base model for inheritance |
42
- | **Module** | `Module: Name\nModel: Name\n- prop: type` | Full CRUD module with API |
43
-
44
- ### Property Syntax
45
-
46
- | Pattern | Meaning | LT CLI Flag |
47
- |---------|---------|-------------|
48
- | `name: string` | Required string | `--prop-name-X name --prop-type-X string` |
49
- | `age?: number` | Optional number | `--prop-name-X age --prop-type-X number --prop-nullable-X true` |
50
- | `tags: string[]` | Array of strings | `--prop-name-X tags --prop-type-X string --prop-array-X true` |
51
- | `status: ENUM (A, B)` | Enum property | `--prop-name-X status --prop-enum-X StatusEnum` |
52
- | `owner: User` | Reference to module | `--prop-name-X owner --prop-type-X ObjectId --prop-reference-X User` |
53
- | `address: Address` | Embedded object | `--prop-name-X address --prop-schema-X Address` |
54
- | `items: Item[]` | Array of objects | `--prop-name-X items --prop-schema-X Item --prop-array-X true` |
55
- | `doc: File` | File reference | `--prop-name-X doc --prop-type-X string` |
56
-
57
- ### Type Mapping
58
-
59
- | Spec Type | TypeScript | MongoDB | CLI Type |
60
- |-----------|-----------|---------|----------|
61
- | `string` | string | String | string |
62
- | `number` | number | Number | number |
63
- | `boolean` | boolean | Boolean | boolean |
64
- | `Date` | Date | Date | Date |
65
- | `bigint` | bigint | Long | bigint |
66
- | `File` | string | String | string |
67
- | `ENUM(...)` | XxxEnum | String/Number | (use --prop-enum-X) |
68
- | `OtherModule` | ObjectId ref | ObjectId | ObjectId + reference |
69
- | `SubObject` | Embedded | Object | (use --prop-schema-X) |
70
-
71
- ## Execution Workflow
72
-
73
- ### Phase Checklist
74
-
75
- ```
76
- ☐ 1. Parse specification completely
77
- ☐ 2. Create comprehensive todo list
78
- ☐ 3. Create all SubObjects (dependency order)
79
- ☐ 4. Create all Objects
80
- ☐ 5. Create all Modules (dependency order)
81
- ☐ 6. Handle inheritance (manual edits)
82
- ☐ 7. Update ALL descriptions EVERYWHERE (CRITICAL!)
83
- ☐ 7.1. Extract ALL user comments (after //) from specification
84
- ☐ 7.2. Format descriptions: ENGLISH (DEUTSCH)
85
- ☐ 7.3. Apply to ALL Module files (Model, CreateInput, UpdateInput)
86
- ☐ 7.4. Apply to ALL SubObject files (Object, CreateInput, UpdateInput)
87
- ☐ 7.5. Add to ALL class decorators (@ObjectType, @InputType)
88
- ☐ 7.6. Verify consistency (same property = same description)
89
- ☐ 8. Alphabetize all properties
90
- ☐ 9. Create enum files
91
- ☐ 10. Create API tests
92
- ☐ 11. Run tests
93
- ☐ 12. Verify & provide summary
94
- ```
95
-
96
- ### Dependency Order
97
-
98
- ```
99
- 1. SubObjects (if A uses B, create B first)
100
- 2. Objects (base models)
101
- 3. Modules (if A references B, create B first)
102
- 4. Circular refs (use addProp for second reference)
103
- 5. Inheritance updates
104
- 6. Enums
105
- 7. Tests
106
- ```
107
-
108
- ## Command Quick Reference
109
-
110
- ### Create New Server
111
- ```bash
112
- lt server create <server-name>
113
- # Alias: lt server c <server-name>
114
-
115
- # Example
116
- lt server create my-api
117
- ```
118
-
119
- **What it does**:
120
- - Clones nest-server-starter template
121
- - Configures package.json
122
- - Sets up Swagger docs
123
- - **Replaces ALL secrets** (`'SECRET_OR_PRIVATE_KEY...'` → unique random values)
124
- - **Updates database names** (`nest-server-*` → `<project-name>-*`)
125
- - Installs dependencies
126
- - Optionally initializes git
127
-
128
- **Post-creation verification**:
129
- - Verify `src/config.env.ts` has no `SECRET_OR_PRIVATE_KEY` placeholders
130
- - Verify mongoose.uri uses project name (e.g., `my-api-local` not `nest-server-local`)
131
- - If using older CLI (<v0.0.126), run `lt server setConfigSecrets` manually
132
-
133
- ### Create SubObject
134
- ```bash
135
- lt server object --name <Name> \
136
- --prop-name-0 <name> --prop-type-0 <type> [modifiers] \
137
- --prop-name-1 <name> --prop-type-1 <type> [modifiers]
138
- ```
139
-
140
- ### Create Module
141
- ```bash
142
- lt server module --name <Name> --controller <Rest|GraphQL|Both> \
143
- --prop-name-0 <name> --prop-type-0 <type> [modifiers] \
144
- --prop-name-1 <name> --prop-type-1 <type> [modifiers]
145
- ```
146
-
147
- ### Add Properties
148
- ```bash
149
- lt server addProp --type Module --element <Name> \
150
- --prop-name-0 <name> --prop-type-0 <type> [modifiers]
151
- ```
152
-
153
- ### Modifiers
154
-
155
- | Modifier | Flag | Example |
156
- |----------|------|---------|
157
- | Optional | `--prop-nullable-X true` | `--prop-nullable-2 true` |
158
- | Array | `--prop-array-X true` | `--prop-array-1 true` |
159
- | Enum | `--prop-enum-X <EnumName>` | `--prop-enum-3 StatusEnum` |
160
- | Schema | `--prop-schema-X <SchemaName>` | `--prop-schema-0 Address` |
161
- | Reference | `--prop-reference-X <ModelName>` | `--prop-reference-1 User` |
162
-
163
- ## Description Format
164
-
165
- **⚠️ CRITICAL:** Always extract descriptions from user comments (after `//`) and apply EVERYWHERE!
166
-
167
- **Rule**: `"ENGLISH_DESCRIPTION (DEUTSCHE_BESCHREIBUNG)"`
168
-
169
- ### Processing
170
-
171
- | Input Comment | Language | Output Description |
172
- |---------------|----------|-------------------|
173
- | `// Product name` | English | `'Product name'` |
174
- | `// Produktname` | German | `'Product name (Produktname)'` |
175
- | `// Street name` | English | `'Street name'` |
176
- | `// Straße` | German | `'Street (Straße)'` |
177
- | `// Postleizahl` (typo) | German | `'Postal code (Postleitzahl)'` (corrected) |
178
- | (no comment) | - | Create meaningful English description |
179
-
180
- **⚠️ Preserve Original Wording:**
181
- - ✅ Fix typos: `Postleizahl` → `Postleitzahl`, `Starße` → `Straße`
182
- - ❌ DON'T rephrase: `Straße` → `Straßenname` (NO!)
183
- - ❌ DON'T expand: `Produkt` → `Produktbezeichnung` (NO!)
184
- - **Reason:** User comments may be predefined terms referenced by external systems
185
-
186
- ### Apply To ALL Files
187
-
188
- **For EVERY Module property** (3 files):
189
- 1. `<module>.model.ts` → Property `@UnifiedField({ description: '...' })`
190
- 2. `inputs/<module>-create.input.ts` → Property `@UnifiedField({ description: '...' })`
191
- 3. `inputs/<module>.input.ts` → Property `@UnifiedField({ description: '...' })`
192
-
193
- **For EVERY SubObject property** (3 files):
194
- 1. `objects/<object>/<object>.object.ts` → Property `@UnifiedField({ description: '...' })`
195
- 2. `objects/<object>/<object>-create.input.ts` → Property `@UnifiedField({ description: '...' })`
196
- 3. `objects/<object>/<object>.input.ts` → Property `@UnifiedField({ description: '...' })`
197
-
198
- **For class decorators**:
199
- - `@ObjectType({ description: '...' })` on Models and Objects
200
- - `@InputType({ description: '...' })` on all Input classes
201
-
202
- ### Common Mistakes
203
-
204
- ❌ **WRONG:** Descriptions only in Model, missing in Inputs
205
- ❌ **WRONG:** German-only descriptions without English translation
206
- ❌ **WRONG:** Inconsistent descriptions (different in Model vs Input)
207
- ❌ **WRONG:** Ignoring user-provided comments from specification
208
- ❌ **WRONG:** Changing wording: `Straße` → `Straßenname` (rephrased!)
209
- ❌ **WRONG:** Expanding terms: `Produkt` → `Produktbezeichnung` (added word!)
210
-
211
- ✅ **CORRECT:** Same description in ALL 3 files (Model, CreateInput, UpdateInput)
212
- ✅ **CORRECT:** Format `ENGLISH (DEUTSCH)` for German comments
213
- ✅ **CORRECT:** All user comments extracted and applied
214
- ✅ **CORRECT:** Fix typos only, preserve original wording: `Postleizahl` → `Postleitzahl`
215
- ✅ **CORRECT:** Keep exact terms: `Straße` → `Street (Straße)` (not "Street name"!)
216
-
217
- ## Inheritance Handling
218
-
219
- ### Model Extension
220
-
221
- ```typescript
222
- // FROM (generated):
223
- import { CoreModel } from '@lenne.tech/nest-server';
224
- export class ChildModel extends CoreModel { ... }
225
-
226
- // TO (manual edit):
227
- import { ParentModel } from '../../common/objects/parent/parent.model';
228
- export class ChildModel extends ParentModel { ... }
229
- ```
230
-
231
- ### Input Extension
232
-
233
- ```typescript
234
- // child-create.input.ts
235
- // MUST include:
236
- // 1. ALL required fields from parent's CreateInput
237
- // 2. ALL required fields from child model
238
- // 3. Optional fields from both (optional in UpdateInput)
239
- ```
240
-
241
- ### Core Models (no changes needed)
242
- - `CoreModel`
243
- - `CorePersisted`
244
- - Any @lenne.tech/nest-server base class
245
-
246
- ## Enum File Template
247
-
248
- ```typescript
249
- // src/server/common/enums/<name>.enum.ts
250
- export enum <Name>Enum {
251
- VALUE_ONE = 'VALUE_ONE',
252
- VALUE_TWO = 'VALUE_TWO',
253
- VALUE_THREE = 'VALUE_THREE',
254
- }
255
- ```
256
-
257
- ### Naming
258
- - **File**: `kebab-case.enum.ts` → `user-status.enum.ts`
259
- - **Enum**: `PascalCaseEnum` → `UserStatusEnum`
260
- - **Values**: `UPPER_SNAKE_CASE` → `ACTIVE`, `PENDING`
261
-
262
- ## API Test Template
263
-
264
- ```typescript
265
- // test/<module>/<module>.controller.test.ts
266
- import { testHelper } from '@lenne.tech/nest-server';
267
-
268
- describe('<Module> Controller', () => {
269
- let testUser;
270
- let created<Model>;
271
-
272
- beforeAll(async () => {
273
- testUser = await testHelper.createTestUser({ roles: ['admin'] });
274
- });
275
-
276
- afterAll(async () => {
277
- if (created<Model>) await testHelper.delete('<modules>', created<Model>.id);
278
- await testHelper.deleteTestUser(testUser.id);
279
- });
280
-
281
- it('should create with required fields', async () => { /* ... */ });
282
- it('should fail without required fields', async () => { /* ... */ });
283
- it('should get all', async () => { /* ... */ });
284
- it('should get by id', async () => { /* ... */ });
285
- it('should update', async () => { /* ... */ });
286
- it('should delete', async () => { /* ... */ });
287
- it('should fail without auth', async () => { /* ... */ });
288
- });
289
- ```
290
-
291
- ### Test Coverage
292
- - ✅ Create (valid data)
293
- - ✅ Create (missing required - fail)
294
- - ✅ Find all
295
- - ✅ Find by ID
296
- - ✅ Update
297
- - ✅ Delete
298
- - ✅ Authorization (fail without auth)
299
- - ✅ Required fields validation
300
-
301
- ## Common Patterns
302
-
303
- ### Pattern 1: Simple Module
304
- ```
305
- Module: Product
306
- Model: Product
307
- - name: string
308
- - price: number
309
- ```
310
- → `lt server module --name Product --controller Both --prop-name-0 name --prop-type-0 string --prop-name-1 price --prop-type-1 number`
311
-
312
- ### Pattern 2: Module with Reference
313
- ```
314
- Module: Order
315
- Model: Order
316
- - customer: User
317
- - total: number
318
- ```
319
- → `lt server module --name Order --controller Both --prop-name-0 customer --prop-type-0 ObjectId --prop-reference-0 User --prop-name-1 total --prop-type-1 number`
320
-
321
- ### Pattern 3: Module with Embedded Object
322
- ```
323
- SubObject: Address
324
- - street: string
325
- - city: string
326
-
327
- Module: Company
328
- Model: Company
329
- - name: string
330
- - address: Address
331
- ```
332
- → Create Address first, then Company with `--prop-schema-X Address`
333
-
334
- ### Pattern 4: Module with Enum Array
335
- ```
336
- Module: User
337
- Model: User
338
- - name: string
339
- - roles: ENUM (ADMIN, USER, GUEST)[]
340
- ```
341
- → `--prop-name-1 roles --prop-enum-1 RoleEnum --prop-array-1 true`
342
-
343
- ### Pattern 5: Inheritance
344
- ```
345
- Object: BaseProfile
346
- Properties:
347
- - name: string
348
- - email: string
349
-
350
- Module: UserProfile
351
- Model: UserProfile
352
- Extends: BaseProfile
353
- - username: string
354
- ```
355
- → Create BaseProfile object, create UserProfile module, manually update to extend BaseProfile
356
-
357
- ### Pattern 6: Circular References
358
- ```
359
- Module: Author
360
- - books: Book[]
361
-
362
- Module: Book
363
- - author: Author
364
- ```
365
- → Create Author, create Book with author ref, use addProp to add books to Author
366
-
367
- ## Troubleshooting
368
-
369
- | Issue | Solution |
370
- |-------|----------|
371
- | Missing imports | Add manually: `import { Ref } from '@lenne.tech/nest-server'` |
372
- | CreateInput validation fails | Add parent's required fields to child's CreateInput |
373
- | Enum errors | Create enum file in `src/server/common/enums/` |
374
- | Test fails (required fields) | Check CreateInput for all required fields |
375
- | Circular dependency | Use `addProp` for second reference |
376
- | Properties not alphabetical | Reorder manually in all files |
377
- | TypeScript errors after inheritance | Check imports and extend statement |
378
-
379
- ## Verification Checklist
380
-
381
- Final checks before completing:
382
-
383
- ```
384
- ☐ All SubObjects created
385
- ☐ All Objects created
386
- ☐ All Modules created
387
- ☐ Properties in alphabetical order
388
- ☐ DESCRIPTIONS - CRITICAL (check ALL):
389
- ☐ User comments extracted from specification
390
- ☐ German descriptions → ENGLISH (DEUTSCH) format
391
- ☐ English descriptions → kept as-is
392
- ☐ Module Models have descriptions
393
- ☐ Module CreateInputs have SAME descriptions
394
- ☐ Module UpdateInputs have SAME descriptions
395
- ☐ SubObjects have descriptions
396
- ☐ SubObject CreateInputs have SAME descriptions
397
- ☐ SubObject UpdateInputs have SAME descriptions
398
- ☐ @ObjectType/@InputType decorators have descriptions
399
- ☐ NO inconsistencies between files
400
- ☐ Inheritance correctly implemented
401
- ☐ CreateInputs have all required fields (parent + model)
402
- ☐ Enum files created in src/server/common/enums/
403
- ☐ API tests created for all modules
404
- ☐ Tests cover CRUD operations
405
- ☐ Tests verify authorization
406
- ☐ Tests verify required fields
407
- ☐ All tests pass
408
- ☐ No TypeScript errors
409
- ☐ Lint passes
410
- ```
411
-
412
- ## File Structure
413
-
414
- ```
415
- src/server/
416
- ├── modules/
417
- │ ├── <module-name>/
418
- │ │ ├── <module-name>.model.ts
419
- │ │ ├── <module-name>.service.ts
420
- │ │ ├── <module-name>.controller.ts (if Rest/Both)
421
- │ │ ├── <module-name>.resolver.ts (if GraphQL/Both)
422
- │ │ ├── <module-name>.module.ts
423
- │ │ ├── inputs/
424
- │ │ │ ├── <module-name>.input.ts
425
- │ │ │ └── <module-name>-create.input.ts
426
- │ │ └── outputs/
427
- │ │ └── find-and-count-<module-name>s-result.output.ts
428
- │ └── ...
429
- └── common/
430
- ├── objects/
431
- │ ├── <object-name>/
432
- │ │ ├── <object-name>.object.ts
433
- │ │ ├── <object-name>.input.ts
434
- │ │ └── <object-name>-create.input.ts
435
- │ └── ...
436
- └── enums/
437
- ├── <enum-name>.enum.ts
438
- └── ...
439
-
440
- test/
441
- ├── <module-name>/
442
- │ ├── <module-name>.controller.test.ts
443
- │ └── <module-name>.resolver.test.ts
444
- └── ...
445
- ```
446
-
447
- ## Best Practices Summary
448
-
449
- 1. ✅ **Plan before executing** - Analyze full specification first
450
- 2. ✅ **Create dependencies first** - SubObjects → Objects → Modules
451
- 3. ✅ **Follow naming conventions** - PascalCase for types, camelCase for properties
452
- 4. ✅ **Order matters** - Alphabetical properties, dependency-ordered creation
453
- 5. ✅ **Describe thoroughly** - "ENGLISH (DEUTSCH)" everywhere
454
- 6. ✅ **Test comprehensively** - All CRUD + auth + validation
455
- 7. ✅ **Clean up tests** - Delete test data in afterAll
456
- 8. ✅ **Commit incrementally** - After SubObjects, Modules, Tests
457
- 9. ✅ **Verify before finishing** - Run checklist, ensure tests pass
458
- 10. ✅ **Report observations** - Note data structure issues/improvements
459
-
460
- ## Quick Start
461
-
462
- ```bash
463
- # 1. Receive specification
464
- # 2. Parse and create todo list
465
- # 3. Execute commands in order:
466
-
467
- # SubObjects
468
- lt server object --name Address --prop-name-0 street --prop-type-0 string ...
469
-
470
- # Modules
471
- lt server module --name User --controller Both --prop-name-0 email --prop-type-0 string ...
472
-
473
- # Enums
474
- # Create files in src/server/common/enums/
475
-
476
- # Tests
477
- # Create test files for each module
478
-
479
- # 4. Verify and report
480
- npm test
481
- npm run lint
482
- # Provide summary
483
- ```
484
-
485
- ---
486
-
487
- **Remember**: This skill handles COMPLETE structure generation, not individual commands. Always process the full specification systematically and provide comprehensive summaries.