@lenne.tech/cli 1.0.0 → 1.0.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 (25) hide show
  1. package/build/commands/claude/install-commands.js +332 -0
  2. package/build/commands/claude/install-skills.js +5 -1
  3. package/build/commands/server/add-property.js +22 -41
  4. package/build/extensions/server.js +142 -46
  5. package/build/templates/claude-commands/code-cleanup.md +82 -0
  6. package/build/templates/claude-commands/mr-description-clipboard.md +48 -0
  7. package/build/templates/claude-commands/mr-description.md +33 -0
  8. package/build/templates/claude-commands/sec-review.md +62 -0
  9. package/build/templates/claude-commands/skill-optimize.md +140 -0
  10. package/build/templates/claude-commands/test-generate.md +45 -0
  11. package/build/templates/claude-skills/nest-server-generator/SKILL.md +372 -1314
  12. package/build/templates/claude-skills/nest-server-generator/configuration.md +279 -0
  13. package/build/templates/claude-skills/nest-server-generator/declare-keyword-warning.md +124 -0
  14. package/build/templates/claude-skills/nest-server-generator/description-management.md +217 -0
  15. package/build/templates/claude-skills/nest-server-generator/examples.md +131 -5
  16. package/build/templates/claude-skills/nest-server-generator/quality-review.md +855 -0
  17. package/build/templates/claude-skills/nest-server-generator/reference.md +67 -13
  18. package/build/templates/claude-skills/nest-server-generator/security-rules.md +358 -0
  19. package/build/templates/claude-skills/story-tdd/SKILL.md +1173 -0
  20. package/build/templates/claude-skills/story-tdd/code-quality.md +266 -0
  21. package/build/templates/claude-skills/story-tdd/database-indexes.md +173 -0
  22. package/build/templates/claude-skills/story-tdd/examples.md +1332 -0
  23. package/build/templates/claude-skills/story-tdd/reference.md +1180 -0
  24. package/build/templates/claude-skills/story-tdd/security-review.md +299 -0
  25. package/package.json +1 -1
@@ -0,0 +1,279 @@
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 File (lt.config.json)
8
+
9
+ 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.
10
+
11
+ ### File Location and Hierarchy
12
+
13
+ - **Location**: Place `lt.config.json` in your project root or any parent directory
14
+ - **Hierarchy**: The CLI searches from the current directory up to the root, merging configurations
15
+ - **Priority** (lowest to highest):
16
+ 1. Default values (hardcoded in CLI)
17
+ 2. Config from parent directories (higher up = lower priority)
18
+ 3. Config from current directory
19
+ 4. CLI parameters (`--flag value`)
20
+ 5. Interactive user input
21
+
22
+ ### Configuration Structure
23
+
24
+ ```json
25
+ {
26
+ "meta": {
27
+ "version": "1.0.0",
28
+ "name": "My Project",
29
+ "description": "Optional project description"
30
+ },
31
+ "commands": {
32
+ "server": {
33
+ "module": {
34
+ "controller": "Both",
35
+ "skipLint": false
36
+ },
37
+ "object": {
38
+ "skipLint": false
39
+ },
40
+ "addProp": {
41
+ "skipLint": false
42
+ }
43
+ }
44
+ }
45
+ }
46
+ ```
47
+
48
+ ### Available Configuration Options
49
+
50
+ **Server Module Configuration (`commands.server.module`)**:
51
+ - `controller`: Default controller type (`"Rest"` | `"GraphQL"` | `"Both"` | `"auto"`)
52
+ - `skipLint`: Skip lint prompt after module creation (boolean)
53
+
54
+ **Server Object Configuration (`commands.server.object`)**:
55
+ - `skipLint`: Skip lint prompt after object creation (boolean)
56
+
57
+ **Server AddProp Configuration (`commands.server.addProp`)**:
58
+ - `skipLint`: Skip lint prompt after adding property (boolean)
59
+
60
+ ### Using Configuration in Commands
61
+
62
+ **Example 1: Configure controller type globally**
63
+ ```json
64
+ {
65
+ "commands": {
66
+ "server": {
67
+ "module": {
68
+ "controller": "Rest"
69
+ }
70
+ }
71
+ }
72
+ }
73
+ ```
74
+
75
+ Now all `lt server module` commands will default to REST controllers:
76
+ ```bash
77
+ # Uses "Rest" from config (no prompt)
78
+ lt server module --name Product --prop-name-0 name --prop-type-0 string
79
+ ```
80
+
81
+ **Example 2: Override config with CLI parameter**
82
+ ```bash
83
+ # Ignores config, uses GraphQL
84
+ lt server module --name Product --controller GraphQL
85
+ ```
86
+
87
+ **Example 3: Auto-detect from config**
88
+ ```json
89
+ {
90
+ "commands": {
91
+ "server": {
92
+ "module": {
93
+ "controller": "auto"
94
+ }
95
+ }
96
+ }
97
+ }
98
+ ```
99
+
100
+ Now the CLI will auto-detect controller type from existing modules without prompting.
101
+
102
+ ### Managing Configuration
103
+
104
+ **Initialize configuration**:
105
+ ```bash
106
+ lt config init
107
+ ```
108
+
109
+ **Show current configuration** (merged from all hierarchy levels):
110
+ ```bash
111
+ lt config show
112
+ ```
113
+
114
+ **Get help**:
115
+ ```bash
116
+ lt config help
117
+ ```
118
+
119
+ ### When to Use Configuration
120
+
121
+ **✅ Use configuration when:**
122
+ - Creating multiple modules with the same controller type
123
+ - Working in a team with agreed-upon conventions
124
+ - Automating module generation in CI/CD
125
+ - You want to skip repetitive prompts
126
+
127
+ **❌ Don't use configuration when:**
128
+ - Creating a single module with specific requirements
129
+ - Each module needs a different controller type
130
+ - You're just testing or experimenting
131
+
132
+ ### Best Practices
133
+
134
+ 1. **Project Root**: Place `lt.config.json` in your project root
135
+ 2. **Version Control**: Commit the config file to share with your team
136
+ 3. **Documentation**: Add a README note explaining the config choices
137
+ 4. **Override When Needed**: Use CLI parameters to override for special cases
138
+
139
+ ### 🎯 IMPORTANT: Configuration After Server Creation
140
+
141
+ **CRITICAL WORKFLOW**: After creating a new server with `lt server create`, you **MUST** initialize the configuration file to set project conventions.
142
+
143
+ #### Automatic Post-Creation Setup
144
+
145
+ When you create a new NestJS server, immediately follow these steps:
146
+
147
+ 1. **Navigate to the API directory**:
148
+ ```bash
149
+ cd projects/api
150
+ ```
151
+
152
+ 2. **Create the configuration file manually**:
153
+ ```bash
154
+ # Create lt.config.json with controller preference
155
+ ```
156
+
157
+ 3. **Ask the developer for their preference** (if not already specified):
158
+ ```
159
+ What controller type do you prefer for new modules in this project?
160
+ 1. Rest - REST controllers only
161
+ 2. GraphQL - GraphQL resolvers only
162
+ 3. Both - Both REST and GraphQL
163
+ 4. auto - Auto-detect from existing modules
164
+ ```
165
+
166
+ 4. **Write the configuration** based on the answer:
167
+ ```json
168
+ {
169
+ "meta": {
170
+ "version": "1.0.0"
171
+ },
172
+ "commands": {
173
+ "server": {
174
+ "module": {
175
+ "controller": "Rest"
176
+ }
177
+ }
178
+ }
179
+ }
180
+ ```
181
+
182
+ #### Why This Is Important
183
+
184
+ - ✅ **Consistency**: All modules will follow the same pattern
185
+ - ✅ **No Prompts**: Developers won't be asked for controller type repeatedly
186
+ - ✅ **Team Alignment**: Everyone uses the same conventions
187
+ - ✅ **Automation**: Scripts and CI/CD can create modules without interaction
188
+
189
+ #### Example Workflow
190
+
191
+ ```bash
192
+ # User creates new server
193
+ lt server create --name MyAPI
194
+
195
+ # You (Claude) navigate to API directory
196
+ cd projects/api
197
+
198
+ # You ask the user
199
+ "I've created the server. What controller type would you like to use for modules?"
200
+ "1. Rest (REST only)"
201
+ "2. GraphQL (GraphQL only)"
202
+ "3. Both (REST + GraphQL)"
203
+ "4. auto (Auto-detect)"
204
+
205
+ # User answers: "Rest"
206
+
207
+ # You create lt.config.json
208
+ {
209
+ "meta": {
210
+ "version": "1.0.0"
211
+ },
212
+ "commands": {
213
+ "server": {
214
+ "module": {
215
+ "controller": "Rest"
216
+ }
217
+ }
218
+ }
219
+ }
220
+
221
+ # Confirm to user
222
+ "✅ Configuration saved! All new modules will default to REST controllers."
223
+ "You can change this anytime by editing lt.config.json or running 'lt config init'."
224
+ ```
225
+
226
+ #### Configuration Options Explained
227
+
228
+ **"Rest"**:
229
+ - ✅ Creates REST controllers (`@Controller()`)
230
+ - ❌ No GraphQL resolvers
231
+ - ❌ No PubSub integration
232
+ - **Best for**: Traditional REST APIs, microservices
233
+
234
+ **"GraphQL"**:
235
+ - ❌ No REST controllers
236
+ - ✅ Creates GraphQL resolvers (`@Resolver()`)
237
+ - ✅ Includes PubSub for subscriptions
238
+ - **Best for**: GraphQL-first APIs, real-time apps
239
+
240
+ **"Both"**:
241
+ - ✅ Creates REST controllers
242
+ - ✅ Creates GraphQL resolvers
243
+ - ✅ Includes PubSub
244
+ - **Best for**: Hybrid APIs, gradual migration
245
+
246
+ **"auto"**:
247
+ - 🤖 Analyzes existing modules
248
+ - 🤖 Detects pattern automatically
249
+ - 🤖 No user prompt
250
+ - **Best for**: Following existing conventions
251
+
252
+ #### When NOT to Create Config
253
+
254
+ Skip config creation if:
255
+ - ❌ User is just testing/experimenting
256
+ - ❌ User explicitly says "no configuration"
257
+ - ❌ Project already has lt.config.json
258
+
259
+ ### Integration with Commands
260
+
261
+ When generating code, **ALWAYS check for configuration**:
262
+ 1. Load config via `lt config show` or check for `lt.config.json`
263
+ 2. Use configured values in command construction
264
+ 3. Only pass CLI parameters when overriding config
265
+
266
+ **Example: Generating module with config**
267
+ ```bash
268
+ # Check if config exists and what controller type is configured
269
+ # If config has "controller": "Rest", use it
270
+ lt server module --name Product --prop-name-0 name --prop-type-0 string
271
+
272
+ # If config has "controller": "auto", let CLI detect
273
+ lt server module --name Order --prop-name-0 total --prop-type-0 number
274
+
275
+ # Override config when needed
276
+ lt server module --name User --controller Both
277
+ ```
278
+
279
+ ## Command Syntax Reference
@@ -0,0 +1,124 @@
1
+ ---
2
+ name: nest-server-generator-declare-keyword
3
+ version: 1.0.0
4
+ description: Critical warning about using the declare keyword in TypeScript classes
5
+ ---
6
+
7
+ # 🚨 CRITICAL: NEVER USE `declare` KEYWORD FOR PROPERTIES
8
+
9
+ **⚠️ IMPORTANT RULE: DO NOT use the `declare` keyword when defining properties in classes!**
10
+
11
+ The `declare` keyword in TypeScript signals that a property is only a type declaration without a runtime value. This prevents decorators from being properly applied and overridden.
12
+
13
+ ---
14
+
15
+ ## ❌ WRONG - Using `declare`
16
+
17
+ ```typescript
18
+ export class ProductCreateInput extends ProductInput {
19
+ declare name: string; // ❌ WRONG - Decorator won't be applied!
20
+ declare price: number; // ❌ WRONG - Decorator won't be applied!
21
+ }
22
+ ```
23
+
24
+ ---
25
+
26
+ ## ✅ CORRECT - Without `declare`
27
+
28
+ ```typescript
29
+ export class ProductCreateInput extends ProductInput {
30
+ @UnifiedField({ description: 'Product name' })
31
+ name: string; // ✅ CORRECT - Decorator works properly
32
+
33
+ @UnifiedField({ description: 'Product price' })
34
+ price: number; // ✅ CORRECT - Decorator works properly
35
+ }
36
+ ```
37
+
38
+ ---
39
+
40
+ ## Why This Matters
41
+
42
+ 1. **Decorators require actual properties**: `@UnifiedField()`, `@Restricted()`, and other decorators need actual property declarations to attach metadata
43
+ 2. **Override behavior**: When extending classes, using `declare` prevents decorators from being properly overridden
44
+ 3. **Runtime behavior**: `declare` properties don't exist at runtime, breaking the decorator system
45
+
46
+ ---
47
+
48
+ ## When You Might Be Tempted to Use `declare`
49
+
50
+ - ❌ When extending a class and wanting to change a decorator
51
+ - ❌ When TypeScript shows "property is declared but never used"
52
+ - ❌ When dealing with inheritance and property redefinition
53
+
54
+ ---
55
+
56
+ ## Correct Approach Instead
57
+
58
+ Use the `override` keyword (when appropriate) but NEVER `declare`:
59
+
60
+ ```typescript
61
+ export class ProductCreateInput extends ProductInput {
62
+ // ✅ Use override when useDefineForClassFields is enabled
63
+ override name: string;
64
+
65
+ // ✅ Apply decorators directly - they will override parent decorators
66
+ @UnifiedField({ description: 'Product name', isOptional: false })
67
+ override price: number;
68
+ }
69
+ ```
70
+
71
+ ---
72
+
73
+ ## Examples
74
+
75
+ ### ❌ WRONG - Using declare
76
+
77
+ ```typescript
78
+ // This will BREAK decorator functionality
79
+ export class AddressInput extends Address {
80
+ declare street: string;
81
+ declare city: string;
82
+ declare zipCode: string;
83
+ }
84
+ ```
85
+
86
+ ### ✅ CORRECT - Without declare
87
+
88
+ ```typescript
89
+ // This works properly
90
+ export class AddressInput extends Address {
91
+ @UnifiedField({ description: 'Street' })
92
+ street: string;
93
+
94
+ @UnifiedField({ description: 'City' })
95
+ city: string;
96
+
97
+ @UnifiedField({ description: 'Zip code' })
98
+ zipCode: string;
99
+ }
100
+ ```
101
+
102
+ ### ✅ CORRECT - With override
103
+
104
+ ```typescript
105
+ // This also works when extending decorated properties
106
+ export class AddressInput extends Address {
107
+ @UnifiedField({ description: 'Street', isOptional: false })
108
+ override street: string;
109
+
110
+ @UnifiedField({ description: 'City', isOptional: false })
111
+ override city: string;
112
+
113
+ @UnifiedField({ description: 'Zip code', isOptional: true })
114
+ override zipCode?: string;
115
+ }
116
+ ```
117
+
118
+ ---
119
+
120
+ ## Remember
121
+
122
+ **`declare` = no decorators = broken functionality!**
123
+
124
+ Always use actual property declarations with decorators, optionally with the `override` keyword when extending classes.
@@ -0,0 +1,217 @@
1
+ ---
2
+ name: nest-server-generator-description-management
3
+ version: 1.0.0
4
+ description: Guidelines for consistent description management across all generated components
5
+ ---
6
+
7
+ # 🚨 CRITICAL: Description Management
8
+
9
+ **⚠️ COMMON MISTAKE:** Descriptions are often applied inconsistently or only partially. You MUST follow this process for EVERY component.
10
+
11
+ ---
12
+
13
+ ## 🔍 Step 1: ALWAYS Extract Descriptions from User Input
14
+
15
+ **BEFORE generating ANY code, scan the user's specification for description hints:**
16
+
17
+ 1. **Look for comments after `//`**:
18
+ ```
19
+ Module: Product
20
+ - name: string // Product name
21
+ - price: number // Produktpreis
22
+ - stock?: number // Current stock level
23
+ ```
24
+
25
+ 2. **Extract ALL comments** and store them for each property
26
+ 3. **Identify language** (English or German)
27
+
28
+ ---
29
+
30
+ ## 📝 Step 2: Format Descriptions Correctly
31
+
32
+ **Rule**: `"ENGLISH_DESCRIPTION (DEUTSCHE_BESCHREIBUNG)"`
33
+
34
+ ### Processing Logic
35
+
36
+ | User Input | Language | Formatted Description |
37
+ |------------|----------|----------------------|
38
+ | `// Product name` | English | `'Product name'` |
39
+ | `// Produktname` | German | `'Product name (Produktname)'` |
40
+ | `// Straße` | German | `'Street (Straße)'` |
41
+ | `// Postleizahl` (typo) | German | `'Postal code (Postleitzahl)'` |
42
+ | (no comment) | - | Create meaningful English description |
43
+
44
+ ### ⚠️ CRITICAL - Preserving Original Text
45
+
46
+ **1. Fix spelling errors ONLY:**
47
+ - ✅ Correct typos: `Postleizahl` → `Postleitzahl` (missing 't')
48
+ - ✅ Fix character errors: `Starße` → `Straße` (wrong character)
49
+ - ✅ Correct English typos: `Prodcut name` → `Product name`
50
+
51
+ **2. DO NOT change the wording:**
52
+ - ❌ NEVER rephrase: `Straße` → `Straßenname` (NO!)
53
+ - ❌ NEVER expand: `Produkt` → `Produktbezeichnung` (NO!)
54
+ - ❌ NEVER improve: `Name` → `Full name` (NO!)
55
+ - ❌ NEVER translate differently: `Name` → `Title` (NO!)
56
+
57
+ **3. Why this is critical:**
58
+ - User comments may be **predefined terms** from requirements
59
+ - External systems may **reference these exact terms**
60
+ - Changing wording breaks **external integrations**
61
+
62
+ ### Examples
63
+
64
+ ```
65
+ ✅ CORRECT:
66
+ // Straße → 'Street (Straße)' (only translated)
67
+ // Starße → 'Street (Straße)' (typo fixed, then translated)
68
+ // Produkt → 'Product (Produkt)' (keep original word)
69
+ // Strasse → 'Street (Straße)' (ss→ß corrected, then translated)
70
+
71
+ ❌ WRONG:
72
+ // Straße → 'Street name (Straßenname)' (changed wording!)
73
+ // Produkt → 'Product name (Produktname)' (added word!)
74
+ // Name → 'Full name (Vollständiger Name)' (rephrased!)
75
+ ```
76
+
77
+ **Rule Summary**: Fix typos, preserve wording, translate accurately.
78
+
79
+ ---
80
+
81
+ ## ✅ Step 3: Apply Descriptions EVERYWHERE (Most Critical!)
82
+
83
+ **🚨 YOU MUST apply the SAME description to ALL of these locations:**
84
+
85
+ ### For Module Properties
86
+
87
+ **1. Model file** (`<module>.model.ts`):
88
+ ```typescript
89
+ @UnifiedField({ description: 'Product name (Produktname)' })
90
+ name: string;
91
+ ```
92
+
93
+ **2. Create Input** (`<module>-create.input.ts`):
94
+ ```typescript
95
+ @UnifiedField({ description: 'Product name (Produktname)' })
96
+ name: string;
97
+ ```
98
+
99
+ **3. Update Input** (`<module>.input.ts`):
100
+ ```typescript
101
+ @UnifiedField({ description: 'Product name (Produktname)' })
102
+ name?: string;
103
+ ```
104
+
105
+ ### For SubObject Properties
106
+
107
+ **1. Object file** (`<object>.object.ts`):
108
+ ```typescript
109
+ @UnifiedField({ description: 'Street (Straße)' })
110
+ street: string;
111
+ ```
112
+
113
+ **2. Object Create Input** (`<object>-create.input.ts`):
114
+ ```typescript
115
+ @UnifiedField({ description: 'Street (Straße)' })
116
+ street: string;
117
+ ```
118
+
119
+ **3. Object Update Input** (`<object>.input.ts`):
120
+ ```typescript
121
+ @UnifiedField({ description: 'Street (Straße)' })
122
+ street?: string;
123
+ ```
124
+
125
+ ### For Object/Module Type Decorators
126
+
127
+ Apply descriptions to the class decorators as well:
128
+
129
+ ```typescript
130
+ @ObjectType({ description: 'Address information (Adressinformationen)' })
131
+ export class Address { ... }
132
+
133
+ @InputType({ description: 'Address information (Adressinformationen)' })
134
+ export class AddressInput { ... }
135
+
136
+ @ObjectType({ description: 'Product entity (Produkt-Entität)' })
137
+ export class Product extends CoreModel { ... }
138
+ ```
139
+
140
+ ---
141
+
142
+ ## ⛔ Common Mistakes to AVOID
143
+
144
+ 1. ❌ **Partial application**: Descriptions only in Models, not in Inputs
145
+ 2. ❌ **Inconsistent format**: German-only in some places, English-only in others
146
+ 3. ❌ **Missing descriptions**: No descriptions when user provided comments
147
+ 4. ❌ **Ignoring Object inputs**: Forgetting to add descriptions to SubObject Input files
148
+ 5. ❌ **Wrong format**: Using `(ENGLISH)` instead of `ENGLISH (DEUTSCH)`
149
+ 6. ❌ **Changing wording**: Rephrasing user's original terms
150
+ 7. ❌ **Adding words**: Expanding user's terminology
151
+
152
+ ---
153
+
154
+ ## ✅ Verification Checklist
155
+
156
+ After generating code, ALWAYS verify:
157
+
158
+ - [ ] All user comments/descriptions extracted from specification
159
+ - [ ] All descriptions follow format: `"ENGLISH (DEUTSCH)"` or `"ENGLISH"`
160
+ - [ ] Model properties have descriptions
161
+ - [ ] Create Input properties have SAME descriptions
162
+ - [ ] Update Input properties have SAME descriptions
163
+ - [ ] Object properties have descriptions
164
+ - [ ] Object Input properties have SAME descriptions
165
+ - [ ] Class-level `@ObjectType()` and `@InputType()` have descriptions
166
+ - [ ] NO German-only descriptions (must be translated)
167
+ - [ ] NO inconsistencies between files
168
+ - [ ] Original wording preserved (only typos fixed)
169
+
170
+ ---
171
+
172
+ ## 🔄 If You Forget
173
+
174
+ **If you generate code and realize descriptions are missing or inconsistent:**
175
+
176
+ 1. **STOP** - Don't continue with other phases
177
+ 2. **Go back** and add/fix ALL descriptions
178
+ 3. **Verify** using the checklist above
179
+ 4. **Then continue** with remaining phases
180
+
181
+ **Remember**: Descriptions are NOT optional "nice-to-have" - they are MANDATORY for:
182
+ - API documentation (Swagger/GraphQL)
183
+ - Code maintainability
184
+ - Developer experience
185
+ - Bilingual projects (German/English teams)
186
+
187
+ ---
188
+
189
+ ## Quick Reference
190
+
191
+ ### Format Rules
192
+
193
+ ```
194
+ English input → 'Product name'
195
+ German input → 'Product name (Produktname)'
196
+ No input → Create meaningful description
197
+ Typo input → Fix typo, then translate
198
+ Mixed input → Standardize to 'ENGLISH (DEUTSCH)'
199
+ ```
200
+
201
+ ### Application Checklist
202
+
203
+ For **each property**:
204
+ - [ ] Model file
205
+ - [ ] Create Input file
206
+ - [ ] Update Input file
207
+
208
+ For **each class**:
209
+ - [ ] @ObjectType() decorator
210
+ - [ ] @InputType() decorator (if applicable)
211
+
212
+ ### Remember
213
+
214
+ - **Consistency is critical** - Same description everywhere
215
+ - **Preserve wording** - Only fix typos, never rephrase
216
+ - **Bilingual format** - Always use "ENGLISH (DEUTSCH)" for German terms
217
+ - **Verification** - Check all files before proceeding