@lenne.tech/cli 0.0.125 → 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.
- package/bin/lt +145 -14
- package/build/commands/claude/install-commands.js +332 -0
- package/build/commands/claude/install-skills.js +626 -0
- package/build/commands/config/config.js +25 -0
- package/build/commands/config/help.js +167 -0
- package/build/commands/config/init.js +143 -0
- package/build/commands/config/show.js +68 -0
- package/build/commands/server/add-property.js +163 -46
- package/build/commands/server/create.js +66 -4
- package/build/commands/server/module.js +133 -20
- package/build/commands/server/object.js +23 -15
- package/build/extensions/config.js +157 -0
- package/build/extensions/server.js +194 -63
- package/build/interfaces/lt-config.interface.js +3 -0
- package/build/templates/claude-commands/code-cleanup.md +82 -0
- package/build/templates/claude-commands/mr-description-clipboard.md +48 -0
- package/build/templates/claude-commands/mr-description.md +33 -0
- package/build/templates/claude-commands/sec-review.md +62 -0
- package/build/templates/claude-commands/skill-optimize.md +140 -0
- package/build/templates/claude-commands/test-generate.md +45 -0
- package/build/templates/claude-skills/lt-cli/SKILL.md +190 -259
- package/build/templates/claude-skills/lt-cli/examples.md +433 -203
- package/build/templates/claude-skills/lt-cli/reference.md +400 -226
- package/build/templates/claude-skills/nest-server-generator/SKILL.md +1891 -0
- package/build/templates/claude-skills/nest-server-generator/configuration.md +279 -0
- package/build/templates/claude-skills/nest-server-generator/declare-keyword-warning.md +124 -0
- package/build/templates/claude-skills/nest-server-generator/description-management.md +217 -0
- package/build/templates/claude-skills/nest-server-generator/examples.md +886 -0
- package/build/templates/claude-skills/nest-server-generator/quality-review.md +855 -0
- package/build/templates/claude-skills/nest-server-generator/reference.md +471 -0
- package/build/templates/claude-skills/nest-server-generator/security-rules.md +358 -0
- package/build/templates/claude-skills/story-tdd/SKILL.md +1173 -0
- package/build/templates/claude-skills/story-tdd/code-quality.md +266 -0
- package/build/templates/claude-skills/story-tdd/database-indexes.md +173 -0
- package/build/templates/claude-skills/story-tdd/examples.md +1332 -0
- package/build/templates/claude-skills/story-tdd/reference.md +1180 -0
- package/build/templates/claude-skills/story-tdd/security-review.md +299 -0
- package/build/templates/nest-server-module/inputs/template-create.input.ts.ejs +1 -3
- package/build/templates/nest-server-module/inputs/template.input.ts.ejs +1 -1
- package/build/templates/nest-server-module/template.controller.ts.ejs +24 -13
- package/build/templates/nest-server-module/template.model.ts.ejs +2 -2
- package/build/templates/nest-server-module/template.module.ts.ejs +4 -0
- package/build/templates/nest-server-module/template.service.ts.ejs +6 -6
- package/build/templates/nest-server-object/template.object.ts.ejs +2 -2
- package/package.json +13 -11
- package/build/commands/claude/install-skill.js +0 -93
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Perform security review of code changes
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Perform a complete security review:
|
|
6
|
+
|
|
7
|
+
## 🔐 1. Controller/Resolver Security
|
|
8
|
+
|
|
9
|
+
Check all modified Controller/Resolver files:
|
|
10
|
+
- [ ] Were @Restricted decorators removed or weakened?
|
|
11
|
+
- [ ] Were @Roles decorators made more permissive?
|
|
12
|
+
- [ ] Are there new endpoints without security decorators?
|
|
13
|
+
- [ ] Are the roles appropriate (not too open)?
|
|
14
|
+
|
|
15
|
+
## 🔐 2. Model Security
|
|
16
|
+
|
|
17
|
+
Check all modified Model files:
|
|
18
|
+
- [ ] Is securityCheck() method correctly implemented?
|
|
19
|
+
- [ ] Admin check: `user?.hasRole(RoleEnum.ADMIN)`
|
|
20
|
+
- [ ] Creator check: `equalIds(user, this.createdBy)`
|
|
21
|
+
- [ ] Were security checks weakened?
|
|
22
|
+
- [ ] Are sensitive properties protected with @Restricted?
|
|
23
|
+
|
|
24
|
+
## 🔐 3. Input Validation
|
|
25
|
+
|
|
26
|
+
Check all Input/DTO files:
|
|
27
|
+
- [ ] Are all inputs validated?
|
|
28
|
+
- [ ] Required fields correctly marked?
|
|
29
|
+
- [ ] Type safety ensured?
|
|
30
|
+
- [ ] No unsafe data types (e.g., any)?
|
|
31
|
+
|
|
32
|
+
## 🔐 4. Ownership & Authorization
|
|
33
|
+
|
|
34
|
+
Check service methods:
|
|
35
|
+
- [ ] Update/Delete: Ownership checks present?
|
|
36
|
+
- [ ] Check: `userId === object.createdBy` OR `user.isAdmin`
|
|
37
|
+
- [ ] serviceOptions.roles correctly set?
|
|
38
|
+
- [ ] No authorization bypasses?
|
|
39
|
+
|
|
40
|
+
## 🔐 5. Data Exposure
|
|
41
|
+
|
|
42
|
+
Check GraphQL/REST responses:
|
|
43
|
+
- [ ] Sensitive fields marked with `hideField: true`?
|
|
44
|
+
- [ ] Passwords/Tokens not in responses?
|
|
45
|
+
- [ ] securityCheck() filters correctly?
|
|
46
|
+
|
|
47
|
+
## 🔐 6. Test Coverage
|
|
48
|
+
|
|
49
|
+
Check tests:
|
|
50
|
+
- [ ] Security failure tests present (403 responses)?
|
|
51
|
+
- [ ] Tests with different roles (Admin, User, Other)?
|
|
52
|
+
- [ ] Ownership tests present?
|
|
53
|
+
|
|
54
|
+
## 📋 Report
|
|
55
|
+
|
|
56
|
+
Create a list of all findings:
|
|
57
|
+
- **Critical**: Severe security issues
|
|
58
|
+
- **Warning**: Potential problems
|
|
59
|
+
- **Info**: Improvement suggestions
|
|
60
|
+
- **OK**: Everything secure
|
|
61
|
+
|
|
62
|
+
**On Critical/Warning findings: STOP and inform the developer!**
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Optimize Claude skill files if too large
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Analyze and optimize large skill files for better Claude Code performance:
|
|
6
|
+
|
|
7
|
+
## 📊 1. Skill File Analysis
|
|
8
|
+
|
|
9
|
+
Analyze all skill files:
|
|
10
|
+
```bash
|
|
11
|
+
# Count lines of all SKILL.md files
|
|
12
|
+
find src/templates/claude-skills -name "SKILL.md" -exec wc -l {} \;
|
|
13
|
+
|
|
14
|
+
# Or more detailed
|
|
15
|
+
for skill in src/templates/claude-skills/*/SKILL.md; do
|
|
16
|
+
lines=$(wc -l < "$skill")
|
|
17
|
+
name=$(basename $(dirname "$skill"))
|
|
18
|
+
echo "$name: $lines lines"
|
|
19
|
+
done
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## 🎯 2. Determine Optimization Needs
|
|
23
|
+
|
|
24
|
+
**Target Sizes:**
|
|
25
|
+
- ✅ **Optimal:** 500-800 lines (fastest loading)
|
|
26
|
+
- ⚠️ **Acceptable:** 800-1,800 lines (borderline)
|
|
27
|
+
- ❌ **Too Large:** > 1,800 lines (MUST be optimized)
|
|
28
|
+
|
|
29
|
+
Identify files over 1,800 lines for optimization.
|
|
30
|
+
|
|
31
|
+
## 📑 3. Identify Large Sections
|
|
32
|
+
|
|
33
|
+
For each oversized SKILL.md:
|
|
34
|
+
```bash
|
|
35
|
+
# Show sections with line numbers
|
|
36
|
+
grep -n "^## " SKILL.md
|
|
37
|
+
|
|
38
|
+
# Calculate section sizes
|
|
39
|
+
# Sections > 200 lines are candidates for extraction
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**Typical large sections:**
|
|
43
|
+
- Quality Review processes (often 500-1000 lines)
|
|
44
|
+
- Security Rules (often 300-500 lines)
|
|
45
|
+
- Configuration Guides (often 200-300 lines)
|
|
46
|
+
- Test Guidelines (often 400-600 lines)
|
|
47
|
+
- Example Collections (often 300-500 lines)
|
|
48
|
+
|
|
49
|
+
## 🔧 4. Perform Modularization
|
|
50
|
+
|
|
51
|
+
For each large section (> 200 lines):
|
|
52
|
+
|
|
53
|
+
**A. Extract section:**
|
|
54
|
+
```bash
|
|
55
|
+
# Create separate .md file
|
|
56
|
+
# e.g., security-rules.md, quality-review.md, configuration.md
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**B. Add frontmatter:**
|
|
60
|
+
```markdown
|
|
61
|
+
---
|
|
62
|
+
name: skill-name-section-name
|
|
63
|
+
version: 1.0.0
|
|
64
|
+
description: What this file contains
|
|
65
|
+
---
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**C. Replace in SKILL.md:**
|
|
69
|
+
```markdown
|
|
70
|
+
## Section Name
|
|
71
|
+
|
|
72
|
+
**📖 For complete [section topic] with all details, see: `section-file.md`**
|
|
73
|
+
|
|
74
|
+
**Quick overview:**
|
|
75
|
+
- Key point 1
|
|
76
|
+
- Key point 2
|
|
77
|
+
- Key point 3
|
|
78
|
+
|
|
79
|
+
**Critical reminders:**
|
|
80
|
+
- [ ] Important checkpoint 1
|
|
81
|
+
- [ ] Important checkpoint 2
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## 📏 5. Extraction Strategy
|
|
85
|
+
|
|
86
|
+
**What to extract:**
|
|
87
|
+
- ✅ Detailed process descriptions
|
|
88
|
+
- ✅ Extensive examples
|
|
89
|
+
- ✅ Long checklists
|
|
90
|
+
- ✅ Reference documentation
|
|
91
|
+
- ✅ Troubleshooting guides
|
|
92
|
+
|
|
93
|
+
**What NOT to extract:**
|
|
94
|
+
- ❌ Core workflow (Phases 1-7)
|
|
95
|
+
- ❌ Critical warnings (Security, declare keyword)
|
|
96
|
+
- ❌ Command syntax (brief reference)
|
|
97
|
+
- ❌ Skill description and "When to Use"
|
|
98
|
+
|
|
99
|
+
## ✅ 6. Quality Assurance
|
|
100
|
+
|
|
101
|
+
After each extraction:
|
|
102
|
+
- [ ] SKILL.md has clear reference (📖) to detail file
|
|
103
|
+
- [ ] Detail file has frontmatter
|
|
104
|
+
- [ ] Compact summary remains in SKILL.md
|
|
105
|
+
- [ ] No information is lost
|
|
106
|
+
- [ ] Line count significantly reduced
|
|
107
|
+
|
|
108
|
+
## 📊 7. Measure Success
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# Before/After comparison
|
|
112
|
+
echo "Original: 3,309 lines"
|
|
113
|
+
echo "After optimization: $(wc -l < SKILL.md) lines"
|
|
114
|
+
echo "Reduction: $((3309 - $(wc -l < SKILL.md))) lines"
|
|
115
|
+
echo "Percentage: $(echo "scale=1; (3309 - $(wc -l < SKILL.md)) * 100 / 3309" | bc)%"
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**Success if:**
|
|
119
|
+
- ✅ SKILL.md under 1,800 lines (ideal: under 1,500)
|
|
120
|
+
- ✅ 5-8 modular detail files created
|
|
121
|
+
- ✅ 30-50% reduction achieved
|
|
122
|
+
- ✅ All information still available
|
|
123
|
+
|
|
124
|
+
## 🎯 8. Create Report
|
|
125
|
+
|
|
126
|
+
Create summary:
|
|
127
|
+
```
|
|
128
|
+
=== Skill Optimization Report ===
|
|
129
|
+
|
|
130
|
+
📁 Optimized Skills:
|
|
131
|
+
- skill-name: 3,309 → 1,890 lines (-43%)
|
|
132
|
+
|
|
133
|
+
📄 Created Detail Files:
|
|
134
|
+
- security-rules.md (9.2K)
|
|
135
|
+
- quality-review.md (29K)
|
|
136
|
+
- configuration.md (7.0K)
|
|
137
|
+
...
|
|
138
|
+
|
|
139
|
+
✅ All skills now within optimal range!
|
|
140
|
+
```
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Generate comprehensive tests for changes
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Analyze recent changes and create appropriate tests:
|
|
6
|
+
|
|
7
|
+
1. **Identify all changed/new modules**:
|
|
8
|
+
```bash
|
|
9
|
+
git status --short
|
|
10
|
+
git diff --name-only
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
2. **For each new module** in `src/server/modules/`:
|
|
14
|
+
- Create E2E test in `tests/modules/<module-name>.e2e-spec.ts`
|
|
15
|
+
- Analyze existing tests as templates
|
|
16
|
+
- Fully understand TestHelper (read source code)
|
|
17
|
+
|
|
18
|
+
3. **For each modified module**:
|
|
19
|
+
- Update existing test in `tests/modules/`
|
|
20
|
+
- Test new/changed properties
|
|
21
|
+
- Test changed validations
|
|
22
|
+
|
|
23
|
+
4. **Security Testing**:
|
|
24
|
+
- Check @Restricted/@Roles decorators
|
|
25
|
+
- Test with Admin User (user.roles contains 'admin')
|
|
26
|
+
- Test with Creator (user.id === object.createdBy)
|
|
27
|
+
- Test with Other User (should fail with 403)
|
|
28
|
+
- Test permission failures
|
|
29
|
+
|
|
30
|
+
5. **Test Execution**:
|
|
31
|
+
```bash
|
|
32
|
+
npm run test:e2e
|
|
33
|
+
```
|
|
34
|
+
- On errors: Debug with console.log
|
|
35
|
+
- Fix errors
|
|
36
|
+
- Re-run tests
|
|
37
|
+
|
|
38
|
+
6. **Cleanup**:
|
|
39
|
+
- Remove all console.log statements
|
|
40
|
+
- Verify tests still pass
|
|
41
|
+
|
|
42
|
+
**Important:**
|
|
43
|
+
- NEVER weaken @Restricted/@Roles to fix tests
|
|
44
|
+
- ALWAYS test with least privileged user
|
|
45
|
+
- ALWAYS follow existing test patterns
|