@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.
- package/build/commands/claude/install-commands.js +337 -0
- package/build/commands/claude/install-mcps.js +256 -0
- package/build/commands/claude/install-skills.js +91 -20
- package/build/commands/server/add-property.js +22 -41
- package/build/extensions/server.js +142 -46
- package/build/lib/mcp-registry.js +71 -0
- package/build/templates/claude-commands/code-cleanup.md +82 -0
- package/build/templates/claude-commands/commit-message.md +21 -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 +481 -0
- package/build/templates/claude-commands/test-generate.md +45 -0
- package/build/templates/claude-skills/building-stories-with-tdd/SKILL.md +265 -0
- package/build/templates/claude-skills/building-stories-with-tdd/code-quality.md +276 -0
- package/build/templates/claude-skills/building-stories-with-tdd/database-indexes.md +182 -0
- package/build/templates/claude-skills/building-stories-with-tdd/examples.md +1383 -0
- package/build/templates/claude-skills/building-stories-with-tdd/handling-existing-tests.md +197 -0
- package/build/templates/claude-skills/building-stories-with-tdd/reference.md +1427 -0
- package/build/templates/claude-skills/building-stories-with-tdd/security-review.md +307 -0
- package/build/templates/claude-skills/building-stories-with-tdd/workflow.md +1004 -0
- package/build/templates/claude-skills/generating-nest-servers/SKILL.md +303 -0
- package/build/templates/claude-skills/generating-nest-servers/configuration.md +285 -0
- package/build/templates/claude-skills/generating-nest-servers/declare-keyword-warning.md +133 -0
- package/build/templates/claude-skills/generating-nest-servers/description-management.md +226 -0
- package/build/templates/claude-skills/{nest-server-generator → generating-nest-servers}/examples.md +138 -5
- package/build/templates/claude-skills/generating-nest-servers/framework-guide.md +259 -0
- package/build/templates/claude-skills/generating-nest-servers/quality-review.md +864 -0
- package/build/templates/claude-skills/{nest-server-generator → generating-nest-servers}/reference.md +83 -13
- package/build/templates/claude-skills/generating-nest-servers/security-rules.md +371 -0
- package/build/templates/claude-skills/generating-nest-servers/verification-checklist.md +262 -0
- package/build/templates/claude-skills/generating-nest-servers/workflow-process.md +1061 -0
- package/build/templates/claude-skills/{lt-cli → using-lt-cli}/SKILL.md +22 -10
- package/build/templates/claude-skills/{lt-cli → using-lt-cli}/examples.md +7 -3
- package/build/templates/claude-skills/{lt-cli → using-lt-cli}/reference.md +10 -3
- package/package.json +2 -2
- package/build/templates/claude-skills/nest-server-generator/SKILL.md +0 -2833
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: story-tdd-handling-existing-tests
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
description: Complete guide for handling existing tests when modifying code in TDD workflow - decision trees, git analysis, examples, and guidelines for determining when to update tests vs fix code
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# 🔄 Handling Existing Tests When Modifying Code
|
|
8
|
+
|
|
9
|
+
## Table of Contents
|
|
10
|
+
- [Analysis Decision Tree](#analysis-decision-tree)
|
|
11
|
+
- [Using Git for Analysis (ALLOWED)](#using-git-for-analysis-allowed)
|
|
12
|
+
- [Examples](#examples)
|
|
13
|
+
- [Guidelines](#guidelines)
|
|
14
|
+
- [Process](#process)
|
|
15
|
+
- [Red Flags](#red-flags)
|
|
16
|
+
- [Remember](#remember)
|
|
17
|
+
|
|
18
|
+
**CRITICAL RULE:** When your code changes cause existing (non-story) tests to fail, you MUST analyze and handle this properly.
|
|
19
|
+
|
|
20
|
+
## Analysis Decision Tree
|
|
21
|
+
|
|
22
|
+
When existing tests fail after your changes:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
Existing test fails
|
|
26
|
+
│
|
|
27
|
+
├─► Was this change intentional and breaking?
|
|
28
|
+
│ │
|
|
29
|
+
│ ├─► YES: Change was deliberate and it's clear why tests break
|
|
30
|
+
│ │ └─► ✅ Update the existing tests to reflect new behavior
|
|
31
|
+
│ │ - Modify test expectations
|
|
32
|
+
│ │ - Update test data/setup if needed
|
|
33
|
+
│ │ - Document why test was changed
|
|
34
|
+
│ │
|
|
35
|
+
│ └─► NO/UNCLEAR: Not sure why tests are breaking
|
|
36
|
+
│ └─► 🔍 Investigate potential side effect
|
|
37
|
+
│ │
|
|
38
|
+
│ ├─► Use git to review previous state:
|
|
39
|
+
│ │ - git show HEAD:path/to/file.ts
|
|
40
|
+
│ │ - git diff HEAD path/to/test.ts
|
|
41
|
+
│ │ - git log -p path/to/file.ts
|
|
42
|
+
│ │
|
|
43
|
+
│ ├─► Compare old vs new behavior
|
|
44
|
+
│ │
|
|
45
|
+
│ └─► ⚠️ Likely unintended side effect!
|
|
46
|
+
│ └─► Fix code to satisfy BOTH old AND new tests
|
|
47
|
+
│ - Refine implementation
|
|
48
|
+
│ - Add conditional logic if needed
|
|
49
|
+
│ - Ensure backward compatibility
|
|
50
|
+
│ - Keep existing functionality intact
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Using Git for Analysis (ALLOWED)
|
|
54
|
+
|
|
55
|
+
**✅ Git commands are EXPLICITLY ALLOWED for analysis:**
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# View old version of a file
|
|
59
|
+
git show HEAD:src/server/modules/user/user.service.ts
|
|
60
|
+
|
|
61
|
+
# See what changed in a file
|
|
62
|
+
git diff HEAD src/server/modules/user/user.service.ts
|
|
63
|
+
|
|
64
|
+
# View file from specific commit
|
|
65
|
+
git show abc123:path/to/file.ts
|
|
66
|
+
|
|
67
|
+
# See commit history for a file
|
|
68
|
+
git log -p --follow path/to/file.ts
|
|
69
|
+
|
|
70
|
+
# Compare branches
|
|
71
|
+
git diff main..HEAD path/to/file.ts
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**These commands help you understand:**
|
|
75
|
+
- What the code looked like before your changes
|
|
76
|
+
- What the previous test expectations were
|
|
77
|
+
- Why existing tests were written a certain way
|
|
78
|
+
- Whether your change introduces regression
|
|
79
|
+
|
|
80
|
+
## Examples
|
|
81
|
+
|
|
82
|
+
### Example 1: Intentional Breaking Change
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
// Scenario: You added a required field to User model
|
|
86
|
+
// Old test expects: { email, firstName }
|
|
87
|
+
// New behavior requires: { email, firstName, lastName }
|
|
88
|
+
|
|
89
|
+
// ✅ CORRECT: Update the test
|
|
90
|
+
it('should create user', async () => {
|
|
91
|
+
const user = await userService.create({
|
|
92
|
+
email: 'test@example.com',
|
|
93
|
+
firstName: 'John',
|
|
94
|
+
lastName: 'Doe', // ✅ Added required field
|
|
95
|
+
});
|
|
96
|
+
// ...
|
|
97
|
+
});
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Example 2: Unintended Side Effect
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
// Scenario: You changed authentication logic for new feature
|
|
104
|
+
// Old tests for different feature now fail unexpectedly
|
|
105
|
+
|
|
106
|
+
// ❌ WRONG: Just update the failing tests
|
|
107
|
+
// ✅ CORRECT: Investigate and fix the code
|
|
108
|
+
|
|
109
|
+
// 1. Use git to see old implementation
|
|
110
|
+
// git show HEAD:src/server/modules/auth/auth.service.ts
|
|
111
|
+
|
|
112
|
+
// 2. Identify the unintended side effect
|
|
113
|
+
// 3. Refine your code to avoid breaking existing functionality
|
|
114
|
+
|
|
115
|
+
// Example fix: Add conditional logic
|
|
116
|
+
async authenticate(user: User, options?: AuthOptions) {
|
|
117
|
+
// Your new feature logic
|
|
118
|
+
if (options?.useNewBehavior) {
|
|
119
|
+
return this.newAuthMethod(user);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Preserve existing behavior for backward compatibility
|
|
123
|
+
return this.existingAuthMethod(user);
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Guidelines
|
|
128
|
+
|
|
129
|
+
**✅ DO update existing tests when:**
|
|
130
|
+
- You intentionally changed an API contract
|
|
131
|
+
- You removed deprecated functionality
|
|
132
|
+
- You renamed fields/methods
|
|
133
|
+
- The old behavior is being replaced (not extended)
|
|
134
|
+
- It's documented in your story requirements
|
|
135
|
+
|
|
136
|
+
**❌ DON'T update existing tests when:**
|
|
137
|
+
- You're not sure why they're failing
|
|
138
|
+
- The failure seems unrelated to your story
|
|
139
|
+
- Multiple unrelated tests are breaking
|
|
140
|
+
- The test was testing important existing functionality
|
|
141
|
+
|
|
142
|
+
**🔍 INVESTIGATE when:**
|
|
143
|
+
- More than 2-3 existing tests fail
|
|
144
|
+
- Tests in unrelated modules fail
|
|
145
|
+
- Test failure messages are unclear
|
|
146
|
+
- You suspect a side effect
|
|
147
|
+
|
|
148
|
+
## Process
|
|
149
|
+
|
|
150
|
+
1. **Run ALL tests** (not just story tests)
|
|
151
|
+
```bash
|
|
152
|
+
npm test
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
2. **If existing tests fail:**
|
|
156
|
+
```bash
|
|
157
|
+
# Identify which tests failed
|
|
158
|
+
# For each failing test, decide:
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
3. **For intentional changes:**
|
|
162
|
+
- Update test expectations
|
|
163
|
+
- Document change in commit message (when developer commits)
|
|
164
|
+
- Verify all tests pass
|
|
165
|
+
|
|
166
|
+
4. **For unclear failures:**
|
|
167
|
+
- Use `git show` to see old code
|
|
168
|
+
- Use `git diff` to see your changes
|
|
169
|
+
- Compare old vs new behavior
|
|
170
|
+
- Refine code to fix both old AND new tests
|
|
171
|
+
|
|
172
|
+
5. **Validate:**
|
|
173
|
+
```bash
|
|
174
|
+
# All tests (old + new) should pass
|
|
175
|
+
npm test
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Red Flags
|
|
179
|
+
|
|
180
|
+
🚩 **Warning signs of unintended side effects:**
|
|
181
|
+
- Tests in different modules failing
|
|
182
|
+
- Security/auth tests failing
|
|
183
|
+
- Tests that worked in `main` branch now fail
|
|
184
|
+
- Tests with names unrelated to your story failing
|
|
185
|
+
|
|
186
|
+
**When you see red flags:**
|
|
187
|
+
1. STOP updating tests
|
|
188
|
+
2. Use git to investigate
|
|
189
|
+
3. Fix the code, not the tests
|
|
190
|
+
4. Ask developer if uncertain
|
|
191
|
+
|
|
192
|
+
## Remember
|
|
193
|
+
|
|
194
|
+
- **Existing tests are documentation** of expected behavior
|
|
195
|
+
- **Don't break working functionality** to make new tests pass
|
|
196
|
+
- **Use git freely** for investigation (NOT for commits)
|
|
197
|
+
- **When in doubt, preserve backward compatibility**
|