tlc-claude-code 1.5.3 → 1.5.4
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/.claude/commands/tlc/audit.md +129 -0
- package/.claude/commands/tlc/autofix.md +217 -0
- package/.claude/commands/tlc/bug.md +255 -0
- package/.claude/commands/tlc/build.md +731 -0
- package/.claude/commands/tlc/checklist.md +212 -0
- package/.claude/commands/tlc/ci.md +414 -0
- package/.claude/commands/tlc/claim.md +189 -0
- package/.claude/commands/tlc/cleanup.md +187 -0
- package/.claude/commands/tlc/complete.md +160 -0
- package/.claude/commands/tlc/config.md +395 -0
- package/.claude/commands/tlc/coverage.md +222 -0
- package/.claude/commands/tlc/deploy.md +723 -0
- package/.claude/commands/tlc/discuss.md +185 -0
- package/.claude/commands/tlc/docs.md +194 -0
- package/.claude/commands/tlc/edge-cases.md +241 -0
- package/.claude/commands/tlc/export.md +456 -0
- package/.claude/commands/tlc/help.md +169 -0
- package/.claude/commands/tlc/import-project.md +246 -0
- package/.claude/commands/tlc/init.md +443 -0
- package/.claude/commands/tlc/issues.md +376 -0
- package/.claude/commands/tlc/llm.md +111 -0
- package/.claude/commands/tlc/new-milestone.md +172 -0
- package/.claude/commands/tlc/new-project.md +399 -0
- package/.claude/commands/tlc/next.md +129 -0
- package/.claude/commands/tlc/outdated.md +200 -0
- package/.claude/commands/tlc/plan.md +224 -0
- package/.claude/commands/tlc/progress.md +153 -0
- package/.claude/commands/tlc/quality.md +185 -0
- package/.claude/commands/tlc/quick.md +52 -0
- package/.claude/commands/tlc/refactor.md +190 -0
- package/.claude/commands/tlc/release.md +135 -0
- package/.claude/commands/tlc/review-pr.md +184 -0
- package/.claude/commands/tlc/review.md +200 -0
- package/.claude/commands/tlc/security.md +195 -0
- package/.claude/commands/tlc/server.md +19 -0
- package/.claude/commands/tlc/start.md +137 -0
- package/.claude/commands/tlc/status.md +65 -0
- package/.claude/commands/tlc/sync.md +652 -0
- package/.claude/commands/tlc/tlc.md +279 -0
- package/.claude/commands/tlc/verify.md +159 -0
- package/.claude/commands/tlc/who.md +151 -0
- package/bin/postinstall.js +54 -0
- package/package.json +3 -1
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# /tlc:discuss - Discuss Phase Implementation
|
|
2
|
+
|
|
3
|
+
Capture implementation preferences before planning.
|
|
4
|
+
|
|
5
|
+
## What This Does
|
|
6
|
+
|
|
7
|
+
Gathers your preferences for HOW a phase should be built through adaptive questioning. Saves decisions to guide planning and test writing.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
/tlc:discuss [phase_number]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
If no phase number, auto-detect current phase from ROADMAP.md.
|
|
16
|
+
|
|
17
|
+
## Process
|
|
18
|
+
|
|
19
|
+
### Step 1: Load Phase Context
|
|
20
|
+
|
|
21
|
+
Read from `.planning/ROADMAP.md` to get:
|
|
22
|
+
- Phase name and goal
|
|
23
|
+
- What comes before (context)
|
|
24
|
+
- What comes after (constraints)
|
|
25
|
+
|
|
26
|
+
### Step 2: Adaptive Questioning
|
|
27
|
+
|
|
28
|
+
Ask about implementation preferences. Adapt questions based on phase type.
|
|
29
|
+
|
|
30
|
+
**For UI/Frontend phases:**
|
|
31
|
+
```
|
|
32
|
+
Layout approach?
|
|
33
|
+
1) Component library (shadcn, MUI, etc.)
|
|
34
|
+
2) Custom components
|
|
35
|
+
3) Minimal styling (Tailwind only)
|
|
36
|
+
|
|
37
|
+
State management?
|
|
38
|
+
1) React state + context
|
|
39
|
+
2) Zustand / Jotai
|
|
40
|
+
3) Redux
|
|
41
|
+
4) Server state only (React Query)
|
|
42
|
+
|
|
43
|
+
Form handling?
|
|
44
|
+
1) React Hook Form
|
|
45
|
+
2) Formik
|
|
46
|
+
3) Native forms
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**For API/Backend phases:**
|
|
50
|
+
```
|
|
51
|
+
API style?
|
|
52
|
+
1) REST
|
|
53
|
+
2) tRPC
|
|
54
|
+
3) GraphQL
|
|
55
|
+
|
|
56
|
+
Validation approach?
|
|
57
|
+
1) Zod schemas
|
|
58
|
+
2) Yup
|
|
59
|
+
3) Manual validation
|
|
60
|
+
|
|
61
|
+
Error handling?
|
|
62
|
+
1) Return error objects
|
|
63
|
+
2) Throw exceptions
|
|
64
|
+
3) Result types (Ok/Err)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**For Data/Database phases:**
|
|
68
|
+
```
|
|
69
|
+
Query approach?
|
|
70
|
+
1) Raw SQL
|
|
71
|
+
2) Query builder (Kysely, Knex)
|
|
72
|
+
3) ORM (Prisma, Drizzle)
|
|
73
|
+
|
|
74
|
+
Migration strategy?
|
|
75
|
+
1) Schema-first (Prisma migrate)
|
|
76
|
+
2) Code-first
|
|
77
|
+
3) Manual SQL migrations
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**For Auth phases:**
|
|
81
|
+
```
|
|
82
|
+
Auth provider?
|
|
83
|
+
1) Custom (JWT + bcrypt)
|
|
84
|
+
2) NextAuth / Auth.js
|
|
85
|
+
3) Clerk / Auth0 / Supabase Auth
|
|
86
|
+
|
|
87
|
+
Session storage?
|
|
88
|
+
1) JWT in httpOnly cookie
|
|
89
|
+
2) Database sessions
|
|
90
|
+
3) Redis sessions
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Step 3: Capture Edge Cases
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
What edge cases should we handle?
|
|
97
|
+
|
|
98
|
+
- Empty states?
|
|
99
|
+
- Error states?
|
|
100
|
+
- Loading states?
|
|
101
|
+
- Offline behavior?
|
|
102
|
+
- Rate limiting?
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Step 4: Capture Constraints
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
Any constraints or requirements?
|
|
109
|
+
|
|
110
|
+
- Performance targets?
|
|
111
|
+
- Accessibility requirements?
|
|
112
|
+
- Browser support?
|
|
113
|
+
- Mobile considerations?
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Step 5: Save Discussion
|
|
117
|
+
|
|
118
|
+
Create `.planning/phases/{N}-DISCUSSION.md`:
|
|
119
|
+
|
|
120
|
+
```markdown
|
|
121
|
+
# Phase {N}: {Name} - Discussion
|
|
122
|
+
|
|
123
|
+
## Implementation Preferences
|
|
124
|
+
|
|
125
|
+
| Decision | Choice | Notes |
|
|
126
|
+
|----------|--------|-------|
|
|
127
|
+
| State management | Zustand | Simple, minimal boilerplate |
|
|
128
|
+
| Form handling | React Hook Form | Good validation support |
|
|
129
|
+
| API style | tRPC | Type-safe, good DX |
|
|
130
|
+
|
|
131
|
+
## Edge Cases to Handle
|
|
132
|
+
|
|
133
|
+
- [ ] Empty state when no data
|
|
134
|
+
- [ ] Error toast on API failure
|
|
135
|
+
- [ ] Optimistic updates for better UX
|
|
136
|
+
|
|
137
|
+
## Constraints
|
|
138
|
+
|
|
139
|
+
- Must work on mobile
|
|
140
|
+
- Target 100ms API response time
|
|
141
|
+
|
|
142
|
+
## Notes
|
|
143
|
+
|
|
144
|
+
[Any additional context from discussion]
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Step 6: Confirm and Continue
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
Discussion saved to .planning/phases/{N}-DISCUSSION.md
|
|
151
|
+
|
|
152
|
+
Ready to plan this phase?
|
|
153
|
+
1) Yes, continue to /tlc:plan
|
|
154
|
+
2) No, I'll plan later
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Example
|
|
158
|
+
|
|
159
|
+
```
|
|
160
|
+
> /tlc:discuss 2
|
|
161
|
+
|
|
162
|
+
Phase 2: User Dashboard
|
|
163
|
+
|
|
164
|
+
Let's discuss how to build this.
|
|
165
|
+
|
|
166
|
+
State management approach?
|
|
167
|
+
1) React state + context
|
|
168
|
+
2) Zustand
|
|
169
|
+
3) Server state only (React Query)
|
|
170
|
+
|
|
171
|
+
> 3
|
|
172
|
+
|
|
173
|
+
Data fetching?
|
|
174
|
+
1) REST + fetch
|
|
175
|
+
2) tRPC
|
|
176
|
+
3) React Query + REST
|
|
177
|
+
|
|
178
|
+
> 2
|
|
179
|
+
|
|
180
|
+
[...continues until preferences captured...]
|
|
181
|
+
|
|
182
|
+
Discussion saved.
|
|
183
|
+
|
|
184
|
+
Ready to plan? (Y/n)
|
|
185
|
+
```
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# /tlc:docs - Documentation Maintenance
|
|
2
|
+
|
|
3
|
+
Automatically maintain your project's documentation, screenshots, and wiki.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
/tlc:docs # Full docs update
|
|
9
|
+
/tlc:docs setup # Set up automation (first time)
|
|
10
|
+
/tlc:docs screenshots # Capture app screenshots
|
|
11
|
+
/tlc:docs readme # Update README
|
|
12
|
+
/tlc:docs api # Generate API docs
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## What This Does
|
|
16
|
+
|
|
17
|
+
### Setup (`/tlc:docs setup`)
|
|
18
|
+
|
|
19
|
+
First-time setup for your project:
|
|
20
|
+
|
|
21
|
+
1. Creates `docs/` directory structure
|
|
22
|
+
2. Adds `.github/workflows/docs-sync.yml` for auto-sync on push
|
|
23
|
+
3. Adds npm scripts (`npm run docs`, `npm run docs:screenshots`)
|
|
24
|
+
4. Creates initial `docs/getting-started.md`
|
|
25
|
+
|
|
26
|
+
After setup, docs update automatically on every push.
|
|
27
|
+
|
|
28
|
+
### Full Update (`/tlc:docs`)
|
|
29
|
+
|
|
30
|
+
1. **Updates version references** in all docs
|
|
31
|
+
2. **Generates API docs** (TypeDoc for TypeScript)
|
|
32
|
+
3. **Captures screenshots** of running app (via Playwright)
|
|
33
|
+
4. **Validates links** in documentation
|
|
34
|
+
|
|
35
|
+
### Screenshots (`/tlc:docs screenshots`)
|
|
36
|
+
|
|
37
|
+
Uses Playwright to capture real screenshots:
|
|
38
|
+
|
|
39
|
+
1. Installs Playwright if not present
|
|
40
|
+
2. Launches headless browser
|
|
41
|
+
3. Captures pages at common URLs:
|
|
42
|
+
- `localhost:3000` (homepage)
|
|
43
|
+
- `localhost:3000/dashboard`
|
|
44
|
+
- `localhost:5001` (TLC app proxy)
|
|
45
|
+
- `localhost:3147` (TLC dashboard)
|
|
46
|
+
4. Saves to `docs/images/`
|
|
47
|
+
|
|
48
|
+
**Note:** Your app should be running for screenshots to work.
|
|
49
|
+
|
|
50
|
+
## Automation
|
|
51
|
+
|
|
52
|
+
Once set up, GitHub Actions automatically:
|
|
53
|
+
|
|
54
|
+
1. **On every push to main:**
|
|
55
|
+
- Updates version references
|
|
56
|
+
- Syncs to GitHub Wiki
|
|
57
|
+
- Commits any doc changes
|
|
58
|
+
|
|
59
|
+
2. **You don't need to manually maintain docs.** Just push code.
|
|
60
|
+
|
|
61
|
+
## Process
|
|
62
|
+
|
|
63
|
+
### Step 1: Run Setup (Once)
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
/tlc:docs setup
|
|
67
|
+
|
|
68
|
+
Setting up documentation automation...
|
|
69
|
+
|
|
70
|
+
✓ Created docs/ directory
|
|
71
|
+
✓ Created docs/images/ directory
|
|
72
|
+
✓ Created .github/workflows/docs-sync.yml
|
|
73
|
+
✓ Added docs scripts to package.json
|
|
74
|
+
✓ Created docs/getting-started.md
|
|
75
|
+
|
|
76
|
+
✓ Documentation setup complete!
|
|
77
|
+
|
|
78
|
+
Next steps:
|
|
79
|
+
1. Push to GitHub to enable wiki sync
|
|
80
|
+
2. Run /tlc:docs to update documentation
|
|
81
|
+
3. Run /tlc:docs screenshots to capture app screenshots
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Step 2: Update Docs (Anytime)
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
/tlc:docs
|
|
88
|
+
|
|
89
|
+
TLC Documentation Update
|
|
90
|
+
══════════════════════════════════════════════════
|
|
91
|
+
|
|
92
|
+
Project: my-app v1.2.0
|
|
93
|
+
|
|
94
|
+
📄 README
|
|
95
|
+
✓ Updated version references
|
|
96
|
+
|
|
97
|
+
📚 API Documentation
|
|
98
|
+
Detecting TypeScript, using TypeDoc...
|
|
99
|
+
✓ Generated API docs in docs/api/
|
|
100
|
+
|
|
101
|
+
📸 Screenshots
|
|
102
|
+
✓ homepage.png
|
|
103
|
+
✓ dashboard.png
|
|
104
|
+
⚠ app.png (app not running)
|
|
105
|
+
|
|
106
|
+
══════════════════════════════════════════════════
|
|
107
|
+
|
|
108
|
+
✓ Documentation updated!
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Step 3: Push (Auto-Sync)
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
git push
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
GitHub Actions will:
|
|
118
|
+
- Sync docs to GitHub Wiki
|
|
119
|
+
- Update any version references
|
|
120
|
+
- Commit changes back
|
|
121
|
+
|
|
122
|
+
## Configuration
|
|
123
|
+
|
|
124
|
+
In `.tlc.json` (optional):
|
|
125
|
+
|
|
126
|
+
```json
|
|
127
|
+
{
|
|
128
|
+
"docs": {
|
|
129
|
+
"dir": "docs",
|
|
130
|
+
"screenshots": {
|
|
131
|
+
"urls": [
|
|
132
|
+
{ "url": "http://localhost:3000", "name": "home" },
|
|
133
|
+
{ "url": "http://localhost:3000/login", "name": "login" }
|
|
134
|
+
]
|
|
135
|
+
},
|
|
136
|
+
"api": {
|
|
137
|
+
"enabled": true,
|
|
138
|
+
"output": "docs/api"
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## CLI Usage
|
|
145
|
+
|
|
146
|
+
Also available as standalone command:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
npx tlc-docs # Full update
|
|
150
|
+
npx tlc-docs setup # First-time setup
|
|
151
|
+
npx tlc-docs screenshots # Capture screenshots
|
|
152
|
+
npx tlc-docs api # Generate API docs
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Or add to package.json scripts:
|
|
156
|
+
|
|
157
|
+
```json
|
|
158
|
+
{
|
|
159
|
+
"scripts": {
|
|
160
|
+
"docs": "tlc-docs",
|
|
161
|
+
"docs:screenshots": "tlc-docs screenshots"
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Requirements
|
|
167
|
+
|
|
168
|
+
- **Playwright** (auto-installed for screenshots)
|
|
169
|
+
- **TypeDoc** (auto-used if TypeScript detected)
|
|
170
|
+
- **GitHub repo** (for wiki sync)
|
|
171
|
+
|
|
172
|
+
## Troubleshooting
|
|
173
|
+
|
|
174
|
+
### Screenshots not capturing
|
|
175
|
+
|
|
176
|
+
Make sure your app is running:
|
|
177
|
+
```bash
|
|
178
|
+
npm start
|
|
179
|
+
# In another terminal:
|
|
180
|
+
/tlc:docs screenshots
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Wiki not syncing
|
|
184
|
+
|
|
185
|
+
1. Enable GitHub Wiki in repo settings
|
|
186
|
+
2. Push to main branch
|
|
187
|
+
3. Check Actions tab for workflow status
|
|
188
|
+
|
|
189
|
+
### API docs not generating
|
|
190
|
+
|
|
191
|
+
TypeDoc requires TypeScript. Check:
|
|
192
|
+
```bash
|
|
193
|
+
npm install -D typescript typedoc
|
|
194
|
+
```
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
# /tlc:edge-cases - Generate Edge Case Tests
|
|
2
|
+
|
|
3
|
+
Analyze code and generate comprehensive edge case tests to improve test coverage.
|
|
4
|
+
|
|
5
|
+
## What This Does
|
|
6
|
+
|
|
7
|
+
1. Analyzes target file/function
|
|
8
|
+
2. Identifies parameter types
|
|
9
|
+
3. Generates edge cases by category
|
|
10
|
+
4. Presents selection interface
|
|
11
|
+
5. Writes tests to appropriate file
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
/tlc:edge-cases [file_path] [function_name]
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
If no arguments, prompts for target.
|
|
20
|
+
|
|
21
|
+
## Process
|
|
22
|
+
|
|
23
|
+
### Step 1: Identify Target
|
|
24
|
+
|
|
25
|
+
If no path provided, ask:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
Generate edge cases for:
|
|
29
|
+
|
|
30
|
+
1) A specific file - enter path
|
|
31
|
+
2) A specific function - enter file:function
|
|
32
|
+
3) Current phase tests - analyze phase plan
|
|
33
|
+
|
|
34
|
+
Choice:
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Step 2: Parse Target Code
|
|
38
|
+
|
|
39
|
+
Read and parse the target to extract:
|
|
40
|
+
- Function names
|
|
41
|
+
- Parameter names
|
|
42
|
+
- Parameter types (from TypeScript or inference)
|
|
43
|
+
- Async status
|
|
44
|
+
|
|
45
|
+
### Step 3: Generate Edge Cases
|
|
46
|
+
|
|
47
|
+
For each parameter type, generate appropriate edge cases:
|
|
48
|
+
|
|
49
|
+
**String Parameters:**
|
|
50
|
+
- `null` - null check
|
|
51
|
+
- `undefined` - undefined check
|
|
52
|
+
- `''` - empty string
|
|
53
|
+
- `' '` - whitespace only
|
|
54
|
+
- Very long string (10,000 chars)
|
|
55
|
+
|
|
56
|
+
**Number Parameters:**
|
|
57
|
+
- `null` / `undefined`
|
|
58
|
+
- `0` - zero
|
|
59
|
+
- `-1` - negative
|
|
60
|
+
- `Number.MAX_SAFE_INTEGER`
|
|
61
|
+
- `NaN`
|
|
62
|
+
- `Infinity`
|
|
63
|
+
|
|
64
|
+
**Array Parameters:**
|
|
65
|
+
- `null` / `undefined`
|
|
66
|
+
- `[]` - empty array
|
|
67
|
+
- Single element
|
|
68
|
+
- 1000+ elements
|
|
69
|
+
|
|
70
|
+
**Security (String Inputs):**
|
|
71
|
+
- SQL injection: `'; DROP TABLE users; --`
|
|
72
|
+
- XSS: `<script>alert('xss')</script>`
|
|
73
|
+
- Path traversal: `../../../etc/passwd`
|
|
74
|
+
- Template injection: `{{7*7}}`
|
|
75
|
+
|
|
76
|
+
### Step 4: Display Summary
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
Edge Case Analysis
|
|
80
|
+
══════════════════
|
|
81
|
+
|
|
82
|
+
Functions: 2
|
|
83
|
+
Edge Cases: 24
|
|
84
|
+
|
|
85
|
+
By Category:
|
|
86
|
+
null-check: 4
|
|
87
|
+
undefined-check: 4
|
|
88
|
+
empty-string: 2
|
|
89
|
+
boundary: 8
|
|
90
|
+
security: 6
|
|
91
|
+
|
|
92
|
+
Functions:
|
|
93
|
+
validateEmail(email) - 12 edge cases
|
|
94
|
+
formatName(first, last) - 12 edge cases
|
|
95
|
+
|
|
96
|
+
Generate tests? (Y/n)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Step 5: Selection Interface
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
Select edge cases to generate:
|
|
103
|
+
|
|
104
|
+
null-check:
|
|
105
|
+
[1] handles null email
|
|
106
|
+
[2] handles null first name
|
|
107
|
+
|
|
108
|
+
boundary:
|
|
109
|
+
[3] handles zero-length input
|
|
110
|
+
[4] handles very long input
|
|
111
|
+
|
|
112
|
+
security:
|
|
113
|
+
[5] rejects SQL injection
|
|
114
|
+
[6] rejects XSS payload
|
|
115
|
+
|
|
116
|
+
[A] All - Generate all edge cases
|
|
117
|
+
[N] None - Cancel
|
|
118
|
+
|
|
119
|
+
Selection (comma-separated, e.g., 1,3,5):
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Step 6: Generate Test Code
|
|
123
|
+
|
|
124
|
+
For each selected edge case, generate test:
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
it('handles null email', () => {
|
|
128
|
+
expect(() => validateEmail(null)).toThrow();
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it('rejects SQL injection', () => {
|
|
132
|
+
expect(() => validateEmail("'; DROP TABLE users; --")).toThrow();
|
|
133
|
+
});
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Step 7: Write to Test File
|
|
137
|
+
|
|
138
|
+
Append to existing test file or create new one:
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
Generated tests written to:
|
|
142
|
+
tests/validate.test.ts (8 new tests)
|
|
143
|
+
|
|
144
|
+
Run tests? (Y/n)
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Step 8: Run Tests (Optional)
|
|
148
|
+
|
|
149
|
+
If user chooses to run:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
npm test -- tests/validate.test.ts
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Expected: Most edge case tests will FAIL initially (Red phase).
|
|
156
|
+
This is correct - you now write code to make them pass.
|
|
157
|
+
|
|
158
|
+
## Edge Case Categories
|
|
159
|
+
|
|
160
|
+
| Category | Description | Example Input |
|
|
161
|
+
|----------|-------------|---------------|
|
|
162
|
+
| null-check | Null value handling | `null` |
|
|
163
|
+
| undefined-check | Undefined handling | `undefined` |
|
|
164
|
+
| empty-string | Empty string handling | `''` |
|
|
165
|
+
| whitespace | Whitespace-only | `' '` |
|
|
166
|
+
| boundary | Edge values | `0`, `-1`, `MAX_INT` |
|
|
167
|
+
| large-input | Very large values | 10KB string, 1000 items |
|
|
168
|
+
| security | Malicious input | SQL injection, XSS |
|
|
169
|
+
|
|
170
|
+
## Configuration
|
|
171
|
+
|
|
172
|
+
In `.tlc.json`:
|
|
173
|
+
|
|
174
|
+
```json
|
|
175
|
+
{
|
|
176
|
+
"edgeCases": {
|
|
177
|
+
"patterns": ["null-check", "boundary", "security"],
|
|
178
|
+
"maxPerFunction": 20,
|
|
179
|
+
"includeSecurity": true
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Example Session
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
User: /tlc:edge-cases src/auth/validate.ts
|
|
188
|
+
|
|
189
|
+
Claude: Analyzing src/auth/validate.ts...
|
|
190
|
+
|
|
191
|
+
Edge Case Analysis
|
|
192
|
+
══════════════════
|
|
193
|
+
|
|
194
|
+
Functions: 1
|
|
195
|
+
Edge Cases: 14
|
|
196
|
+
|
|
197
|
+
Function: validateLogin(email: string, password: string)
|
|
198
|
+
|
|
199
|
+
By Category:
|
|
200
|
+
null-check: 2
|
|
201
|
+
undefined-check: 2
|
|
202
|
+
empty-string: 2
|
|
203
|
+
whitespace: 2
|
|
204
|
+
security: 6
|
|
205
|
+
|
|
206
|
+
Generate all 14 tests? (Y/n)
|
|
207
|
+
|
|
208
|
+
User: y
|
|
209
|
+
|
|
210
|
+
Claude: Generating tests...
|
|
211
|
+
|
|
212
|
+
Created: tests/auth/validate.edge-cases.test.ts
|
|
213
|
+
|
|
214
|
+
✓ handles null email
|
|
215
|
+
✓ handles null password
|
|
216
|
+
✓ handles undefined email
|
|
217
|
+
✓ handles undefined password
|
|
218
|
+
✓ handles empty email
|
|
219
|
+
✓ handles empty password
|
|
220
|
+
✓ handles whitespace email
|
|
221
|
+
✓ handles whitespace password
|
|
222
|
+
✓ rejects SQL injection in email
|
|
223
|
+
✓ rejects SQL injection in password
|
|
224
|
+
✓ rejects XSS in email
|
|
225
|
+
✓ rejects XSS in password
|
|
226
|
+
✓ rejects path traversal
|
|
227
|
+
✓ rejects template injection
|
|
228
|
+
|
|
229
|
+
Run tests now?
|
|
230
|
+
1) Yes - expect failures (Red phase)
|
|
231
|
+
2) No - I'll run later
|
|
232
|
+
|
|
233
|
+
User: 1
|
|
234
|
+
|
|
235
|
+
Claude: Running tests...
|
|
236
|
+
|
|
237
|
+
14 tests, 12 failing, 2 passing
|
|
238
|
+
|
|
239
|
+
This is expected! The failing tests show gaps in your error handling.
|
|
240
|
+
Fix them using /tlc:build or implement manually.
|
|
241
|
+
```
|