@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,371 +0,0 @@
1
- ---
2
- name: nest-server-generator-security-rules
3
- version: 1.0.0
4
- description: Critical security and test coverage rules for NestJS development
5
- ---
6
-
7
- # 🚨 CRITICAL SECURITY RULES
8
-
9
- ## Table of Contents
10
- - [NEVER Do This](#-never-do-this)
11
- - [ALWAYS Do This](#-always-do-this)
12
- - [Permission Hierarchy (Specific Overrides General)](#-permission-hierarchy-specific-overrides-general)
13
- - [Rule 1: NEVER Weaken Security for Test Convenience](#rule-1-never-weaken-security-for-test-convenience)
14
- - [Rule 2: Understanding Permission Hierarchy](#rule-2-understanding-permission-hierarchy)
15
- - [Rule 3: Adapt Tests to Security, Not Vice Versa](#rule-3-adapt-tests-to-security-not-vice-versa)
16
- - [Rule 4: Test with Least Privileged User](#rule-4-test-with-least-privileged-user)
17
- - [Rule 5: Create Appropriate Test Users](#rule-5-create-appropriate-test-users)
18
- - [Rule 6: Comprehensive Test Coverage](#rule-6-comprehensive-test-coverage)
19
- - [Quick Security Checklist](#quick-security-checklist)
20
- - [Security Decision Protocol](#security-decision-protocol)
21
-
22
- **Before you start ANY work, understand these NON-NEGOTIABLE rules.**
23
-
24
- ---
25
-
26
- ## ⛔ NEVER Do This
27
-
28
- 1. **NEVER remove or weaken `@Restricted()` decorators** to make tests pass
29
- 2. **NEVER change `@Roles()` decorators** to more permissive roles for test convenience
30
- 3. **NEVER modify `securityCheck()` logic** to bypass security in tests
31
- 4. **NEVER remove class-level `@Restricted(RoleEnum.ADMIN)`** - it's a security fallback
32
-
33
- ---
34
-
35
- ## ✅ ALWAYS Do This
36
-
37
- 1. **ALWAYS analyze permissions BEFORE writing tests** (Controller, Model, Service layers)
38
- 2. **ALWAYS test with the LEAST privileged user** who is authorized
39
- 3. **ALWAYS create appropriate test users** for each permission level
40
- 4. **ALWAYS adapt tests to security requirements**, never the other way around
41
- 5. **ALWAYS ask developer for approval** before changing ANY security decorator
42
- 6. **ALWAYS aim for maximum test coverage** (80-100% depending on criticality)
43
-
44
- ---
45
-
46
- ## 🔑 Permission Hierarchy (Specific Overrides General)
47
-
48
- ```typescript
49
- @Restricted(RoleEnum.ADMIN) // ← FALLBACK: DO NOT REMOVE
50
- export class ProductController {
51
- @Roles(RoleEnum.S_USER) // ← SPECIFIC: This method is more open
52
- async createProduct() { } // ← S_USER can access (specific wins)
53
-
54
- async secretMethod() { } // ← ADMIN only (fallback applies)
55
- }
56
- ```
57
-
58
- **Why class-level `@Restricted(ADMIN)` MUST stay:**
59
- - If someone forgets `@Roles()` on a new method → it's secure by default
60
- - Shows the class is security-sensitive
61
- - Fail-safe protection
62
-
63
- ---
64
-
65
- ## Rule 1: NEVER Weaken Security for Test Convenience
66
-
67
- ### ❌ ABSOLUTELY FORBIDDEN
68
-
69
- ```typescript
70
- // BEFORE (secure):
71
- @Restricted(RoleEnum.ADMIN)
72
- export class ProductController {
73
- @Roles(RoleEnum.S_USER)
74
- async createProduct() { ... }
75
- }
76
-
77
- // AFTER (FORBIDDEN - security weakened!):
78
- // @Restricted(RoleEnum.ADMIN) ← NEVER remove this!
79
- export class ProductController {
80
- @Roles(RoleEnum.S_USER)
81
- async createProduct() { ... }
82
- }
83
- ```
84
-
85
- ### 🚨 CRITICAL RULE
86
-
87
- - **NEVER remove or weaken `@Restricted()` decorators** on Controllers, Resolvers, Models, or Objects
88
- - **NEVER change `@Roles()` decorators** to more permissive roles just to make tests pass
89
- - **NEVER modify `securityCheck()` logic** to bypass security for testing
90
-
91
- ### If tests fail due to permissions
92
-
93
- 1. ✅ **CORRECT**: Adjust the test to use the appropriate user/token
94
- 2. ✅ **CORRECT**: Create test users with the required roles
95
- 3. ❌ **WRONG**: Weaken security to make tests pass
96
-
97
- ### Any security changes MUST
98
-
99
- - Be discussed with the developer FIRST
100
- - Have a solid business justification
101
- - Be explicitly approved by the developer
102
- - Be documented with the reason
103
-
104
- ---
105
-
106
- ## Rule 2: Understanding Permission Hierarchy
107
-
108
- ### ⭐ Key Concept: Specific Overrides General
109
-
110
- The `@Restricted()` decorator on a class acts as a **security fallback** - if a method/property doesn't specify permissions, it inherits the class-level restriction. This is a **security-by-default** pattern.
111
-
112
- ### Example - Controller/Resolver
113
-
114
- ```typescript
115
- @Restricted(RoleEnum.ADMIN) // ← FALLBACK: Protects everything by default
116
- export class ProductController {
117
-
118
- @Roles(RoleEnum.S_EVERYONE) // ← SPECIFIC: This method is MORE open
119
- async getPublicProducts() {
120
- // Anyone can access this (specific @Roles wins)
121
- }
122
-
123
- @Roles(RoleEnum.S_USER) // ← SPECIFIC: Logged-in users
124
- async createProduct() {
125
- // S_USER can access (specific wins over fallback)
126
- }
127
-
128
- async deleteProduct() {
129
- // ADMIN ONLY (no specific decorator, fallback applies)
130
- }
131
- }
132
- ```
133
-
134
- ### Example - Model
135
-
136
- ```typescript
137
- @Restricted(RoleEnum.ADMIN) // ← FALLBACK
138
- export class Product {
139
-
140
- @Roles(RoleEnum.S_EVERYONE) // ← SPECIFIC
141
- @UnifiedField({ description: 'Product name' })
142
- name: string; // Everyone can read this
143
-
144
- @UnifiedField({ description: 'Internal cost' })
145
- cost: number; // ADMIN ONLY (fallback applies)
146
- }
147
- ```
148
-
149
- ---
150
-
151
- ## Rule 3: Adapt Tests to Security, Not Vice Versa
152
-
153
- ### ❌ WRONG Approach
154
-
155
- ```typescript
156
- // Test fails because user isn't admin
157
- it('should create product', async () => {
158
- const result = await request(app)
159
- .post('/products')
160
- .set('Authorization', regularUserToken) // Not an admin!
161
- .send(productData);
162
-
163
- expect(result.status).toBe(201); // Fails with 403
164
- });
165
-
166
- // ❌ WRONG FIX: Removing @Restricted from controller
167
- // @Restricted(RoleEnum.ADMIN) ← NEVER DO THIS!
168
- ```
169
-
170
- ### ✅ CORRECT Approach
171
-
172
- ```typescript
173
- // Analyze first: Who is allowed to create products?
174
- // Answer: ADMIN only (based on @Restricted on controller)
175
-
176
- // Create admin test user
177
- let adminToken: string;
178
-
179
- beforeAll(async () => {
180
- const admin = await createTestUser({ roles: [RoleEnum.ADMIN] });
181
- adminToken = admin.token;
182
- });
183
-
184
- it('should create product as admin', async () => {
185
- const result = await request(app)
186
- .post('/products')
187
- .set('Authorization', adminToken) // ✅ Use admin token
188
- .send(productData);
189
-
190
- expect(result.status).toBe(201); // ✅ Passes
191
- });
192
-
193
- it('should reject product creation for regular user', async () => {
194
- const result = await request(app)
195
- .post('/products')
196
- .set('Authorization', regularUserToken)
197
- .send(productData);
198
-
199
- expect(result.status).toBe(403); // ✅ Test security works!
200
- });
201
- ```
202
-
203
- ---
204
-
205
- ## Rule 4: Test with Least Privileged User
206
-
207
- **Always test with the LEAST privileged user who is authorized to perform the action.**
208
-
209
- ### ❌ WRONG
210
-
211
- ```typescript
212
- // Method allows S_USER, but testing with ADMIN
213
- @Roles(RoleEnum.S_USER)
214
- async getProducts() { }
215
-
216
- it('should get products', async () => {
217
- const result = await request(app)
218
- .get('/products')
219
- .set('Authorization', adminToken); // ❌ Over-privileged!
220
- });
221
- ```
222
-
223
- ### ✅ CORRECT
224
-
225
- ```typescript
226
- @Roles(RoleEnum.S_USER)
227
- async getProducts() { }
228
-
229
- it('should get products as regular user', async () => {
230
- const result = await request(app)
231
- .get('/products')
232
- .set('Authorization', regularUserToken); // ✅ Least privilege
233
- });
234
- ```
235
-
236
- **Why this matters:**
237
- - Tests might pass with ADMIN but fail with S_USER
238
- - You won't catch permission bugs
239
- - False confidence in security
240
-
241
- ---
242
-
243
- ## Rule 5: Create Appropriate Test Users
244
-
245
- **Create test users for EACH permission level you need to test.**
246
-
247
- ### Example Test Setup
248
-
249
- ```typescript
250
- describe('ProductController', () => {
251
- let adminToken: string;
252
- let userToken: string;
253
- let everyoneToken: string;
254
-
255
- beforeAll(async () => {
256
- // Create admin user
257
- const admin = await createTestUser({
258
- roles: [RoleEnum.ADMIN]
259
- });
260
- adminToken = admin.token;
261
-
262
- // Create regular user
263
- const user = await createTestUser({
264
- roles: [RoleEnum.S_USER]
265
- });
266
- userToken = user.token;
267
-
268
- // Create unauthenticated scenario
269
- const guest = await createTestUser({
270
- roles: [RoleEnum.S_EVERYONE]
271
- });
272
- everyoneToken = guest.token;
273
- });
274
-
275
- it('admin can delete products', async () => {
276
- // Use adminToken
277
- });
278
-
279
- it('regular user can create products', async () => {
280
- // Use userToken
281
- });
282
-
283
- it('everyone can view products', async () => {
284
- // Use everyoneToken or no token
285
- });
286
-
287
- it('regular user cannot delete products', async () => {
288
- // Use userToken, expect 403
289
- });
290
- });
291
- ```
292
-
293
- ---
294
-
295
- ## Rule 6: Comprehensive Test Coverage
296
-
297
- **Aim for 80-100% test coverage depending on criticality:**
298
-
299
- - **High criticality** (payments, user data, admin functions): 95-100%
300
- - **Medium criticality** (business logic, CRUD): 80-90%
301
- - **Low criticality** (utilities, formatters): 70-80%
302
-
303
- ### What to Test
304
-
305
- **For each endpoint/method:**
306
-
307
- 1. ✅ Happy path (authorized user, valid data)
308
- 2. ✅ Permission denied (unauthorized user)
309
- 3. ✅ Validation errors (invalid input)
310
- 4. ✅ Edge cases (empty data, boundaries)
311
- 5. ✅ Error handling (server errors, missing resources)
312
-
313
- ### Example Comprehensive Tests
314
-
315
- ```typescript
316
- describe('createProduct', () => {
317
- it('should create product with admin user', async () => {
318
- // Happy path
319
- });
320
-
321
- it('should reject creation by regular user', async () => {
322
- // Permission test
323
- });
324
-
325
- it('should reject invalid product data', async () => {
326
- // Validation test
327
- });
328
-
329
- it('should reject duplicate product name', async () => {
330
- // Business rule test
331
- });
332
-
333
- it('should handle missing required fields', async () => {
334
- // Edge case
335
- });
336
- });
337
- ```
338
-
339
- ---
340
-
341
- ## Quick Security Checklist
342
-
343
- Before completing ANY task:
344
-
345
- - [ ] **All @Restricted decorators preserved**
346
- - [ ] **@Roles decorators NOT made more permissive**
347
- - [ ] **Tests use appropriate user roles**
348
- - [ ] **Test users created for each permission level**
349
- - [ ] **Least privileged user tested**
350
- - [ ] **Permission denial tested (403 responses)**
351
- - [ ] **No securityCheck() logic bypassed**
352
- - [ ] **Test coverage ≥ 80%**
353
- - [ ] **All edge cases covered**
354
-
355
- ---
356
-
357
- ## Security Decision Protocol
358
-
359
- **When you encounter a security-related decision:**
360
-
361
- 1. **STOP** - Don't make the change immediately
362
- 2. **ANALYZE** - Why does the current security exist?
363
- 3. **ASK** - Consult the developer before changing
364
- 4. **DOCUMENT** - If approved, document the reason
365
- 5. **TEST** - Ensure security still works after change
366
-
367
- **Remember:**
368
- - **Security > Convenience**
369
- - **Better to over-restrict than under-restrict**
370
- - **Always preserve existing security mechanisms**
371
- - **When in doubt, ask the developer**
@@ -1,262 +0,0 @@
1
- ---
2
- name: nest-server-generator-verification
3
- version: 1.0.0
4
- description: Comprehensive verification checklist for generated NestJS modules and objects - covers code generation, descriptions, API tests with security-first approach, test coverage requirements, and security rules compliance
5
- ---
6
-
7
- # Verification Checklist
8
-
9
- ## Table of Contents
10
- - [Code Generation](#code-generation)
11
- - [API Tests - Security First](#api-tests---security-first)
12
- - [Test Coverage - Comprehensive Testing](#test-coverage---comprehensive-testing)
13
- - [Security Rules Compliance](#security-rules-compliance)
14
- - [Test Organization Structure](#test-organization-structure)
15
- - [Quick Verification Workflow](#quick-verification-workflow)
16
- - [Common Verification Failures](#common-verification-failures)
17
- - [Success Criteria](#success-criteria)
18
-
19
- After generation, verify all items in this comprehensive checklist:
20
-
21
- ## Code Generation
22
-
23
- - [ ] All SubObjects created
24
- - [ ] All Objects created
25
- - [ ] All Modules created
26
- - [ ] All properties in alphabetical order
27
- - [ ] **DESCRIPTIONS (Critical - check thoroughly):**
28
- - [ ] All user-provided comments (after `//`) extracted from specification
29
- - [ ] All German descriptions translated to format: `ENGLISH (DEUTSCH)`
30
- - [ ] All English descriptions kept as-is (spelling corrected)
31
- - [ ] ALL Module Models have descriptions on all properties
32
- - [ ] ALL Module CreateInputs have SAME descriptions
33
- - [ ] ALL Module UpdateInputs have SAME descriptions
34
- - [ ] ALL SubObjects have descriptions on all properties
35
- - [ ] ALL SubObject CreateInputs have SAME descriptions
36
- - [ ] ALL SubObject UpdateInputs have SAME descriptions
37
- - [ ] ALL `@ObjectType()` decorators have descriptions
38
- - [ ] ALL `@InputType()` decorators have descriptions
39
- - [ ] NO inconsistencies (same property, different descriptions in different files)
40
- - [ ] NO German-only descriptions (must be translated)
41
- - [ ] Inheritance properly implemented
42
- - [ ] Required fields correctly set in CreateInputs
43
- - [ ] Enum files created in `src/server/common/enums/`
44
-
45
- ---
46
-
47
- ## API Tests - Security First
48
-
49
- **🚨 CRITICAL: Security analysis MUST be completed BEFORE writing ANY test!**
50
-
51
- ### Permission Analysis (BEFORE Writing Tests)
52
- - [ ] **Permission analysis completed BEFORE writing tests**
53
- - [ ] **Analyzed ALL `@Roles()` decorators in controllers/resolvers**
54
- - [ ] **Read complete `securityCheck()` method in models**
55
- - [ ] **Understood permission hierarchy (specific overrides general)**
56
-
57
- ### Test User Matrix (Principle of Least Privilege)
58
- - [ ] **Tests use LEAST privileged user (never admin when less works)**
59
- - [ ] **S_EVERYONE endpoints tested WITHOUT token**
60
- - [ ] **S_USER endpoints tested with REGULAR user (not admin)**
61
- - [ ] **UPDATE/DELETE tested with CREATOR token (not admin)**
62
-
63
- ### Security Validation Tests (MANDATORY)
64
- - [ ] **Tests verify unauthorized access FAILS (401/403)**
65
- - [ ] **Tests verify non-creators CANNOT update/delete**
66
- - [ ] **Tests verify required fields**
67
- - [ ] **Security validation tests exist (permission failures)**
68
-
69
- ### General Test Requirements
70
- - [ ] API tests created for all modules
71
- - [ ] Tests cover all CRUD operations
72
- - [ ] All tests pass
73
- - [ ] No TypeScript errors
74
- - [ ] Lint passes
75
-
76
- ---
77
-
78
- ## Test Coverage - Comprehensive Testing
79
-
80
- **🎯 GOAL: Achieve the HIGHEST possible test coverage**
81
-
82
- ### Functional Coverage
83
- - [ ] **Every endpoint has at least one successful test**
84
- - [ ] **Every endpoint has at least one failure test (unauthorized/validation)**
85
- - [ ] **All query parameters tested (filters, sorting, pagination)**
86
- - [ ] **All validation rules tested (required fields, min/max, patterns)**
87
- - [ ] **All relationships tested (creating/updating/deleting with references)**
88
- - [ ] **Edge cases tested (empty results, non-existent IDs, duplicate values)**
89
- - [ ] **Error handling tested (400, 401, 403, 404, 409 status codes)**
90
- - [ ] **Data integrity tested (cascading deletes, orphan prevention)**
91
- - [ ] **Business logic tested (custom methods, computed properties)**
92
- - [ ] **Performance tested (large datasets, pagination limits)**
93
-
94
- ### Coverage Requirements
95
- - Minimum 80% line coverage for services
96
- - Minimum 90% line coverage for resolvers/controllers
97
- - 100% coverage for critical security logic (securityCheck, permission guards)
98
- - 100% coverage for all endpoints (success AND failure cases)
99
- - 100% coverage for all permission combinations
100
- - All public methods tested
101
- - All error paths tested
102
-
103
- ---
104
-
105
- ## Security Rules Compliance
106
-
107
- **🚨 CRITICAL: These MUST be checked before completing**
108
-
109
- ### Security Decorator Rules
110
- - [ ] **NO `@Restricted()` decorators removed from Controllers/Resolvers/Models/Objects**
111
- - [ ] **NO `@Roles()` decorators weakened to make tests pass**
112
- - [ ] **NO `securityCheck()` logic modified to bypass security**
113
- - [ ] **Class-level `@Restricted(ADMIN)` kept as security fallback**
114
-
115
- ### Security Change Management
116
- - [ ] **All security changes discussed and approved by developer**
117
- - [ ] **All security changes documented with approval and reason**
118
- - [ ] **Tests adapted to security requirements (not vice versa)**
119
-
120
- ### Test User Management
121
- - [ ] **Appropriate test users created for each permission level**
122
- - [ ] **Permission hierarchy understood and respected (specific overrides general)**
123
-
124
- ---
125
-
126
- ## Test Organization Structure
127
-
128
- Use this structure for comprehensive, organized tests:
129
-
130
- ```typescript
131
- describe('ProductResolver', () => {
132
- // Setup
133
- describe('Setup', () => {
134
- beforeAll(async () => {
135
- // Initialize test environment
136
- // Create test users with different roles
137
- });
138
-
139
- afterAll(async () => {
140
- // Cleanup all test data
141
- });
142
- });
143
-
144
- // Happy path tests
145
- describe('CREATE operations', () => {
146
- it('should create product as regular user', ...);
147
- it('should create product with all optional fields', ...);
148
- it('should create product with relationships', ...);
149
- });
150
-
151
- describe('READ operations', () => {
152
- it('should get product by ID', ...);
153
- it('should list all products with pagination', ...);
154
- it('should filter products by criteria', ...);
155
- it('should sort products by field', ...);
156
- });
157
-
158
- describe('UPDATE operations', () => {
159
- it('should update product as creator', ...);
160
- it('should update product as admin', ...);
161
- it('should update with partial data', ...);
162
- });
163
-
164
- describe('DELETE operations', () => {
165
- it('should delete product as creator', ...);
166
- it('should delete product as admin', ...);
167
- it('should handle cascading deletes', ...);
168
- });
169
-
170
- // Security tests (MANDATORY)
171
- describe('Security Validation', () => {
172
- it('should FAIL to create without auth', ...);
173
- it('should FAIL to update as non-creator', ...);
174
- it('should FAIL to delete as non-creator', ...);
175
- it('should FAIL to access with invalid token', ...);
176
- it('should FAIL to read private data as different user', ...);
177
- });
178
-
179
- // Validation tests
180
- describe('Input Validation', () => {
181
- it('should FAIL with missing required fields', ...);
182
- it('should FAIL with invalid field values', ...);
183
- it('should FAIL with duplicate values', ...);
184
- it('should FAIL with invalid references', ...);
185
- });
186
-
187
- // Edge cases
188
- describe('Edge Cases', () => {
189
- it('should handle non-existent ID (404)', ...);
190
- it('should handle empty list results', ...);
191
- it('should handle concurrent updates', ...);
192
- it('should handle circular references', ...);
193
- });
194
- });
195
- ```
196
-
197
- ---
198
-
199
- ## Quick Verification Workflow
200
-
201
- 1. **Code Generation:**
202
- - Run through all Code Generation checkboxes
203
- - Pay special attention to DESCRIPTIONS - most common error!
204
-
205
- 2. **API Tests - Security First:**
206
- - Complete Permission Analysis BEFORE writing tests
207
- - Create appropriate test users
208
- - Write security validation tests FIRST
209
- - Then write functional tests
210
-
211
- 3. **Test Coverage:**
212
- - Review coverage report
213
- - Add tests for any uncovered code
214
- - Aim for 90%+ overall coverage
215
-
216
- 4. **Security Rules:**
217
- - Double-check no decorators were removed
218
- - Verify all security changes documented
219
- - Confirm tests adapted to security (not vice versa)
220
-
221
- 5. **Final Validation:**
222
- - Run all tests: `npm test`
223
- - Check TypeScript: `npm run build`
224
- - Run linter: `npm run lint`
225
-
226
- ---
227
-
228
- ## Common Verification Failures
229
-
230
- ### ❌ Missing Descriptions
231
- **Problem:** Forgot to add descriptions to CreateInput or UpdateInput
232
- **Fix:** Add SAME description from Model to ALL Input files
233
-
234
- ### ❌ Wrong Test Privileges
235
- **Problem:** Using admin token when S_USER would work
236
- **Fix:** Review @Roles decorator, use least privileged user
237
-
238
- ### ❌ Missing Security Tests
239
- **Problem:** No tests for unauthorized access
240
- **Fix:** Add describe('Security Validation') block with 401/403 tests
241
-
242
- ### ❌ Inconsistent Descriptions
243
- **Problem:** Different descriptions for same property in different files
244
- **Fix:** Standardize to one description across Model + CreateInput + UpdateInput
245
-
246
- ### ❌ Security Decorator Removed
247
- **Problem:** Removed @Restricted to make test pass
248
- **Fix:** Keep decorator, fix test to use proper authentication
249
-
250
- ---
251
-
252
- ## Success Criteria
253
-
254
- ✅ **All checkboxes checked**
255
- ✅ **All tests pass**
256
- ✅ **No TypeScript errors**
257
- ✅ **Lint passes**
258
- ✅ **Coverage > 90%**
259
- ✅ **Security rules maintained**
260
- ✅ **Descriptions consistent**
261
-
262
- **When all criteria met → Generation complete! 🎉**