@lenne.tech/cli 1.0.0 → 1.0.2

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 (37) hide show
  1. package/build/commands/claude/install-commands.js +337 -0
  2. package/build/commands/claude/install-mcps.js +256 -0
  3. package/build/commands/claude/install-skills.js +91 -20
  4. package/build/commands/server/add-property.js +22 -41
  5. package/build/extensions/server.js +142 -46
  6. package/build/lib/mcp-registry.js +71 -0
  7. package/build/templates/claude-commands/code-cleanup.md +82 -0
  8. package/build/templates/claude-commands/commit-message.md +21 -0
  9. package/build/templates/claude-commands/mr-description-clipboard.md +48 -0
  10. package/build/templates/claude-commands/mr-description.md +33 -0
  11. package/build/templates/claude-commands/sec-review.md +62 -0
  12. package/build/templates/claude-commands/skill-optimize.md +481 -0
  13. package/build/templates/claude-commands/test-generate.md +45 -0
  14. package/build/templates/claude-skills/building-stories-with-tdd/SKILL.md +265 -0
  15. package/build/templates/claude-skills/building-stories-with-tdd/code-quality.md +276 -0
  16. package/build/templates/claude-skills/building-stories-with-tdd/database-indexes.md +182 -0
  17. package/build/templates/claude-skills/building-stories-with-tdd/examples.md +1383 -0
  18. package/build/templates/claude-skills/building-stories-with-tdd/handling-existing-tests.md +197 -0
  19. package/build/templates/claude-skills/building-stories-with-tdd/reference.md +1427 -0
  20. package/build/templates/claude-skills/building-stories-with-tdd/security-review.md +307 -0
  21. package/build/templates/claude-skills/building-stories-with-tdd/workflow.md +1004 -0
  22. package/build/templates/claude-skills/generating-nest-servers/SKILL.md +303 -0
  23. package/build/templates/claude-skills/generating-nest-servers/configuration.md +285 -0
  24. package/build/templates/claude-skills/generating-nest-servers/declare-keyword-warning.md +133 -0
  25. package/build/templates/claude-skills/generating-nest-servers/description-management.md +226 -0
  26. package/build/templates/claude-skills/{nest-server-generator → generating-nest-servers}/examples.md +138 -5
  27. package/build/templates/claude-skills/generating-nest-servers/framework-guide.md +259 -0
  28. package/build/templates/claude-skills/generating-nest-servers/quality-review.md +864 -0
  29. package/build/templates/claude-skills/{nest-server-generator → generating-nest-servers}/reference.md +83 -13
  30. package/build/templates/claude-skills/generating-nest-servers/security-rules.md +371 -0
  31. package/build/templates/claude-skills/generating-nest-servers/verification-checklist.md +262 -0
  32. package/build/templates/claude-skills/generating-nest-servers/workflow-process.md +1061 -0
  33. package/build/templates/claude-skills/{lt-cli → using-lt-cli}/SKILL.md +22 -10
  34. package/build/templates/claude-skills/{lt-cli → using-lt-cli}/examples.md +7 -3
  35. package/build/templates/claude-skills/{lt-cli → using-lt-cli}/reference.md +10 -3
  36. package/package.json +2 -2
  37. package/build/templates/claude-skills/nest-server-generator/SKILL.md +0 -2833
@@ -0,0 +1,182 @@
1
+ ---
2
+ name: story-tdd-database-indexes
3
+ version: 1.0.0
4
+ description: Database index guidelines for @UnifiedField decorator - keep indexes visible with properties
5
+ ---
6
+
7
+ # 🔍 Database Indexes with @UnifiedField
8
+
9
+ ## Table of Contents
10
+ - [When to Add Indexes](#when-to-add-indexes)
11
+ - [Example Patterns](#example-patterns)
12
+ - [DON'T Create Indexes Separately!](#-dont-create-indexes-separately)
13
+ - [Benefits of Decorator-Based Indexes](#benefits-of-decorator-based-indexes)
14
+ - [Index Verification Checklist](#index-verification-checklist)
15
+ - [Red Flags - Missing Indexes](#red-flags---missing-indexes)
16
+ - [Quick Index Checklist](#quick-index-checklist)
17
+
18
+ **IMPORTANT: Always define indexes directly in the @UnifiedField decorator!**
19
+
20
+ This keeps indexes visible right where properties are defined, making them easy to spot during code reviews.
21
+
22
+ ---
23
+
24
+ ## When to Add Indexes
25
+
26
+ - ✅ Fields used in queries (find, filter, search)
27
+ - ✅ Foreign keys (references to other collections)
28
+ - ✅ Fields used in sorting operations
29
+ - ✅ Unique constraints (email, username, etc.)
30
+ - ✅ Fields frequently accessed together (compound indexes)
31
+
32
+ ---
33
+
34
+ ## Example Patterns
35
+
36
+ ### Single Field Index
37
+
38
+ ```typescript
39
+ @UnifiedField({
40
+ description: 'User email address',
41
+ mongoose: { index: true, unique: true, type: String } // ✅ Simple index + unique constraint
42
+ })
43
+ email: string;
44
+ ```
45
+
46
+ ### Compound Index
47
+
48
+ ```typescript
49
+ @UnifiedField({
50
+ description: 'Product category',
51
+ mongoose: { index: true, type: String } // ✅ Part of compound index
52
+ })
53
+ category: string;
54
+
55
+ @UnifiedField({
56
+ description: 'Product status',
57
+ mongoose: { index: true, type: String } // ✅ Part of compound index
58
+ })
59
+ status: string;
60
+
61
+ // Both fields indexed individually for flexible querying
62
+ ```
63
+
64
+ ### Text Index for Search
65
+
66
+ ```typescript
67
+ @UnifiedField({
68
+ description: 'Product name',
69
+ mongoose: { type: String, text: true } // ✅ Full-text search index
70
+ })
71
+ name: string;
72
+ ```
73
+
74
+ ### Foreign Key Index
75
+
76
+ ```typescript
77
+ @UnifiedField({
78
+ description: 'Reference to user who created this',
79
+ mongoose: { index: true, type: String } // ✅ Index for JOIN operations
80
+ })
81
+ createdBy: string;
82
+ ```
83
+
84
+ ---
85
+
86
+ ## ⚠️ DON'T Create Indexes Separately!
87
+
88
+ ```typescript
89
+ // ❌ WRONG: Separate schema index definition
90
+ @Schema()
91
+ export class Product {
92
+ @UnifiedField({
93
+ description: 'Category',
94
+ mongoose: { type: String }
95
+ })
96
+ category: string;
97
+ }
98
+
99
+ ProductSchema.index({ category: 1 }); // ❌ Index hidden away from property
100
+
101
+ // ✅ CORRECT: Index in decorator mongoose option
102
+ @Schema()
103
+ export class Product {
104
+ @UnifiedField({
105
+ description: 'Category',
106
+ mongoose: { index: true, type: String } // ✅ Immediately visible
107
+ })
108
+ category: string;
109
+ }
110
+ ```
111
+
112
+ ---
113
+
114
+ ## Benefits of Decorator-Based Indexes
115
+
116
+ - ✅ Indexes visible when reviewing properties
117
+ - ✅ No need to search schema files
118
+ - ✅ Clear documentation of query patterns
119
+ - ✅ Easier to maintain and update
120
+ - ✅ Self-documenting code
121
+
122
+ ---
123
+
124
+ ## Index Verification Checklist
125
+
126
+ **Look for fields that should have indexes:**
127
+ - Fields used in find/filter operations
128
+ - Foreign keys (userId, productId, etc.)
129
+ - Fields used in sorting (createdAt, updatedAt, name)
130
+ - Unique fields (email, username, slug)
131
+
132
+ **Example check:**
133
+
134
+ ```typescript
135
+ // Service has this query:
136
+ const orders = await this.orderService.find({
137
+ where: { customerId: userId, status: 'pending' }
138
+ });
139
+
140
+ // ✅ Model should have indexes:
141
+ export class Order {
142
+ @UnifiedField({
143
+ description: 'Customer reference',
144
+ mongoose: { index: true, type: String } // ✅ Used in queries
145
+ })
146
+ customerId: string;
147
+
148
+ @UnifiedField({
149
+ description: 'Order status',
150
+ mongoose: { index: true, type: String } // ✅ Used in filtering
151
+ })
152
+ status: string;
153
+ }
154
+ ```
155
+
156
+ ---
157
+
158
+ ## Red Flags - Missing Indexes
159
+
160
+ 🚩 **Check for these issues:**
161
+ - Service queries a field but model has no index
162
+ - Foreign key fields without index
163
+ - Unique constraints not marked in decorator
164
+ - Fields used in sorting without index
165
+
166
+ **If indexes are missing:**
167
+ 1. Add them to the @UnifiedField decorator immediately
168
+ 2. Re-run tests to ensure everything still works
169
+ 3. Document why the index is needed (query pattern)
170
+
171
+ ---
172
+
173
+ ## Quick Index Checklist
174
+
175
+ Before marking complete:
176
+
177
+ - [ ] **Fields used in find() queries have indexes**
178
+ - [ ] **Foreign keys (userId, productId, etc.) have indexes**
179
+ - [ ] **Unique fields (email, username) marked with unique: true**
180
+ - [ ] **Fields used in sorting have indexes**
181
+ - [ ] **All indexes in @UnifiedField decorator (NOT separate schema)**
182
+ - [ ] **Indexes match query patterns in services**