tlc-claude-code 0.6.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.
package/complete.md ADDED
@@ -0,0 +1,160 @@
1
+ # /tlc:complete - Complete Milestone
2
+
3
+ Archive current milestone and tag the release.
4
+
5
+ ## What This Does
6
+
7
+ 1. Verifies all phases complete
8
+ 2. Runs full test suite
9
+ 3. Creates git tag
10
+ 4. Archives milestone files
11
+ 5. Prepares for next version
12
+
13
+ ## Usage
14
+
15
+ ```
16
+ /tlc:complete
17
+ ```
18
+
19
+ ## Process
20
+
21
+ ### Step 1: Check All Phases Complete
22
+
23
+ Read `.planning/ROADMAP.md` and verify:
24
+ - All phases marked `[x]` or `[completed]`
25
+ - All phases have `{N}-VERIFIED.md`
26
+
27
+ If incomplete:
28
+ ```
29
+ Cannot complete milestone.
30
+
31
+ Incomplete phases:
32
+ - Phase 4: Reports (not verified)
33
+ - Phase 5: Settings (not built)
34
+
35
+ Run /tlc to continue building.
36
+ ```
37
+
38
+ ### Step 2: Run Full Test Suite
39
+
40
+ ```bash
41
+ npm test
42
+ ```
43
+
44
+ - ✅ All pass → Continue
45
+ - ❌ Any fail → Block completion
46
+
47
+ ```
48
+ Cannot complete milestone.
49
+
50
+ 3 tests failing:
51
+ - user.test.ts: login timeout
52
+ - api.test.ts: invalid response
53
+
54
+ Fix tests before completing.
55
+ ```
56
+
57
+ ### Step 3: Confirm Completion
58
+
59
+ ```
60
+ Milestone: v1.0
61
+
62
+ Summary:
63
+ - 5 phases completed
64
+ - 47 tests passing
65
+ - All phases verified
66
+
67
+ Ready to tag release? (Y/n)
68
+ ```
69
+
70
+ ### Step 4: Create Git Tag
71
+
72
+ ```bash
73
+ git tag -a v1.0 -m "Release v1.0
74
+
75
+ Phases:
76
+ - Phase 1: Authentication
77
+ - Phase 2: User Dashboard
78
+ - Phase 3: Reports
79
+ - Phase 4: Settings
80
+ - Phase 5: Admin Panel
81
+
82
+ Tests: 47 passing"
83
+ ```
84
+
85
+ ### Step 5: Archive Milestone
86
+
87
+ Move planning files:
88
+ ```
89
+ .planning/
90
+ ├── archive/
91
+ │ └── v1.0/
92
+ │ ├── ROADMAP.md
93
+ │ ├── phases/
94
+ │ │ ├── 1-PLAN.md
95
+ │ │ ├── 1-VERIFIED.md
96
+ │ │ └── ...
97
+ │ └── SUMMARY.md
98
+ └── (clean for next milestone)
99
+ ```
100
+
101
+ Create `.planning/archive/v1.0/SUMMARY.md`:
102
+ ```markdown
103
+ # v1.0 Release Summary
104
+
105
+ Released: {date}
106
+ Tag: v1.0
107
+
108
+ ## Phases
109
+
110
+ 1. Authentication - User login, registration, sessions
111
+ 2. User Dashboard - Main interface, data display
112
+ 3. Reports - Export, PDF generation
113
+ 4. Settings - User preferences
114
+ 5. Admin Panel - User management
115
+
116
+ ## Stats
117
+
118
+ - Total tests: 47
119
+ - Duration: {X days/weeks}
120
+ - Commits: {N}
121
+
122
+ ## Notes
123
+
124
+ {Any release notes}
125
+ ```
126
+
127
+ ### Step 6: Complete
128
+
129
+ ```
130
+ ✅ Milestone v1.0 complete!
131
+
132
+ Tag created: v1.0
133
+ Files archived to .planning/archive/v1.0/
134
+
135
+ Next steps:
136
+ 1) Push tag: git push origin v1.0
137
+ 2) Start next version: /tlc:new-milestone v2.0
138
+ ```
139
+
140
+ ## Example
141
+
142
+ ```
143
+ > /tlc:complete
144
+
145
+ Checking milestone status...
146
+
147
+ ✅ All 5 phases verified
148
+ ✅ 47 tests passing
149
+
150
+ Ready to complete v1.0? (Y/n) > y
151
+
152
+ Creating tag v1.0...
153
+ Archiving planning files...
154
+
155
+ ✅ Milestone v1.0 complete!
156
+
157
+ Push to remote? (Y/n) > y
158
+
159
+ Done! Start v2.0 with /tlc:new-milestone
160
+ ```
package/coverage.md ADDED
@@ -0,0 +1,222 @@
1
+ # /tlc:coverage - Analyze Test Coverage Gaps
2
+
3
+ Scan existing code, identify what's untested, and offer to write retrospective tests.
4
+
5
+ ## When to Use
6
+
7
+ - After `/tlc:init` to add tests to existing code
8
+ - Anytime you want to improve test coverage
9
+ - When joining a project to understand test gaps
10
+ - After "vibe coding" a feature without tests
11
+
12
+ ## Process
13
+
14
+ ### 1. Detect Test Framework
15
+
16
+ Identify the test setup:
17
+ - Framework: vitest, jest, pytest, go test, rspec, cargo test
18
+ - Test directory: `tests/`, `__tests__/`, `spec/`, etc.
19
+ - Test patterns: `*.test.ts`, `*_test.py`, etc.
20
+
21
+ If no test framework found, suggest running `/tlc:init` first.
22
+
23
+ ### 2. Scan Source Files
24
+
25
+ Identify all source files:
26
+ - `src/**/*`, `lib/**/*`, `app/**/*`, `pkg/**/*`
27
+ - Exclude: node_modules, vendor, dist, build, .git
28
+
29
+ Categorize by type:
30
+ - **API/Routes**: files handling HTTP endpoints
31
+ - **Services**: business logic modules
32
+ - **Components**: UI components (React, Vue, etc.)
33
+ - **Utils**: helper functions
34
+ - **Models**: data structures, schemas
35
+ - **Config**: configuration files (skip testing)
36
+
37
+ ### 3. Match Tests to Source
38
+
39
+ For each source file, look for corresponding test:
40
+ - `src/auth/login.ts` → `tests/auth/login.test.ts` or `src/auth/login.test.ts`
41
+ - `lib/utils.py` → `tests/test_utils.py` or `tests/utils_test.py`
42
+ - `pkg/api/handler.go` → `pkg/api/handler_test.go`
43
+
44
+ ### 4. Identify Critical Paths
45
+
46
+ Flag high-priority untested code:
47
+ - **Auth**: login, logout, session, token, password, oauth
48
+ - **Payments**: payment, billing, charge, subscription, stripe, checkout
49
+ - **Data mutations**: create, update, delete, save, remove
50
+ - **Security**: validate, sanitize, permission, role, access
51
+
52
+ ### 5. Present Coverage Analysis
53
+
54
+ ```
55
+ Test Coverage Analysis
56
+
57
+ Source files: 24
58
+ Test files: 8
59
+ Coverage: 33% (8/24 files have tests)
60
+
61
+ Tested:
62
+ ✓ src/utils/format.ts (src/utils/format.test.ts)
63
+ ✓ src/api/health.ts (tests/api/health.test.ts)
64
+ ... [list all]
65
+
66
+ Untested - Critical:
67
+ ✗ src/services/payment.ts - Stripe integration, checkout flow
68
+ ✗ src/api/auth.ts - login, session management
69
+ ✗ src/middleware/auth.ts - JWT validation
70
+
71
+ Untested - High Priority:
72
+ ✗ src/api/users.ts - user CRUD operations
73
+ ✗ src/services/email.ts - transactional emails
74
+
75
+ Untested - Standard:
76
+ ✗ src/utils/helpers.ts - utility functions
77
+ ✗ src/components/Header.tsx - navigation component
78
+ ... [list all]
79
+ ```
80
+
81
+ ### 6. Offer Retrospective Test Writing
82
+
83
+ Ask the user:
84
+
85
+ ```
86
+ Would you like to write tests for existing code?
87
+
88
+ 1) Yes - critical paths only (fastest)
89
+ 2) Yes - critical + high priority
90
+ 3) Yes - everything untested
91
+ 4) No - just wanted the report
92
+ ```
93
+
94
+ **If tests requested:**
95
+
96
+ Create `.planning/TEST-BACKLOG.md`:
97
+
98
+ ```markdown
99
+ # Test Backlog
100
+
101
+ Generated: [date]
102
+ Coverage before: 33% (8/24)
103
+
104
+ ## Critical (auth, payments, security)
105
+ - [ ] src/services/payment.ts - Stripe integration
106
+ - [ ] src/api/auth.ts - login/logout flows
107
+ - [ ] src/middleware/auth.ts - JWT validation
108
+
109
+ ## High Priority (data mutations, core logic)
110
+ - [ ] src/api/users.ts - CRUD operations
111
+ - [ ] src/services/email.ts - email sending
112
+
113
+ ## Standard (utils, components, helpers)
114
+ - [ ] src/utils/helpers.ts
115
+ - [ ] src/components/Header.tsx
116
+ ```
117
+
118
+ Then ask:
119
+ ```
120
+ Start writing tests now?
121
+
122
+ 1) Yes - begin with first critical item
123
+ 2) No - I'll run /tlc:build backlog later
124
+ ```
125
+
126
+ **If "Yes":**
127
+
128
+ Write tests one file at a time with verification and commits.
129
+
130
+ #### For each file in the backlog (sequentially):
131
+
132
+ **a) Plan tests for this file**
133
+
134
+ Read the source file and create test plan:
135
+ ```markdown
136
+ ## File: src/services/payment.ts
137
+
138
+ ### Exports:
139
+ - createCharge(amount, customerId)
140
+ - refundCharge(chargeId)
141
+ - getPaymentHistory(customerId)
142
+
143
+ ### Test cases:
144
+ | Function | Test | Type |
145
+ |----------|------|------|
146
+ | createCharge | creates charge for valid customer | happy path |
147
+ | createCharge | rejects negative amount | edge case |
148
+ | createCharge | handles Stripe API error | error |
149
+ | refundCharge | refunds existing charge | happy path |
150
+ | refundCharge | fails for invalid chargeId | error |
151
+ ```
152
+
153
+ **b) Write test file**
154
+
155
+ Create tests that capture current behavior:
156
+ ```typescript
157
+ import { describe, it, expect } from 'vitest'
158
+ import { createCharge, refundCharge } from '../src/services/payment'
159
+
160
+ describe('createCharge', () => {
161
+ it('creates charge for valid customer', async () => {
162
+ const result = await createCharge(1000, 'cust_123')
163
+ expect(result.id).toBeDefined()
164
+ expect(result.amount).toBe(1000)
165
+ })
166
+
167
+ it('rejects negative amount', async () => {
168
+ await expect(createCharge(-100, 'cust_123'))
169
+ .rejects.toThrow()
170
+ })
171
+ })
172
+ ```
173
+
174
+ **c) Run tests for this file**
175
+
176
+ ```bash
177
+ npm test -- tests/services/payment.test.ts
178
+ ```
179
+
180
+ Verify:
181
+ - ✅ Tests PASS (code already exists)
182
+ - ❌ If tests fail, investigate — either test is wrong or found a bug
183
+
184
+ **d) Commit this test file**
185
+
186
+ ```bash
187
+ git add tests/services/payment.test.ts
188
+ git commit -m "test: add payment service tests"
189
+ ```
190
+
191
+ **e) Update backlog**
192
+
193
+ Mark item complete in `.planning/TEST-BACKLOG.md`:
194
+ ```markdown
195
+ - [x] src/services/payment.ts - payment processing logic ✅
196
+ ```
197
+
198
+ **f) Move to next file**
199
+
200
+ Repeat a-e for each file in the backlog.
201
+
202
+ ### 7. Report Summary
203
+
204
+ ```
205
+ Coverage analysis complete.
206
+
207
+ Before: 33% (8/24 files)
208
+ Backlog created: .planning/TEST-BACKLOG.md
209
+ - Critical: 3 files
210
+ - High priority: 2 files
211
+ - Standard: 11 files
212
+
213
+ Run /tlc:build backlog to start writing tests.
214
+ ```
215
+
216
+ ## Usage
217
+
218
+ ```
219
+ /tlc:coverage
220
+ ```
221
+
222
+ No arguments needed. Scans entire codebase.
package/discuss.md ADDED
@@ -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
+ ```
package/help.md ADDED
@@ -0,0 +1,115 @@
1
+ # /tlc:help - Test-Led Development Commands
2
+
3
+ ## Quick Start
4
+
5
+ ```
6
+ /tlc
7
+ ```
8
+
9
+ That's it. Detects where you are, tells you what's next.
10
+
11
+ ---
12
+
13
+ ## All Commands
14
+
15
+ ### The Smart One
16
+
17
+ | Command | What It Does |
18
+ |---------|--------------|
19
+ | `/tlc` | **Context-aware entry point. Knows what to do next.** |
20
+
21
+ ### Setup
22
+
23
+ | Command | What It Does |
24
+ |---------|--------------|
25
+ | `/tlc:new-project` | Start new project (discusses stack, creates roadmap) |
26
+ | `/tlc:init` | Add TLC to existing code |
27
+ | `/tlc:coverage` | Find untested code, write tests |
28
+
29
+ ### Build (rarely needed directly)
30
+
31
+ | Command | What It Does |
32
+ |---------|--------------|
33
+ | `/tlc:discuss` | Shape implementation approach |
34
+ | `/tlc:plan` | Create task plan |
35
+ | `/tlc:build` | Write tests → implement → verify |
36
+ | `/tlc:verify` | Human acceptance testing |
37
+
38
+ ### Utility
39
+
40
+ | Command | What It Does |
41
+ |---------|--------------|
42
+ | `/tlc:status` | Test pass/fail counts |
43
+ | `/tlc:quick` | One-off task with tests |
44
+ | `/tlc:complete` | Tag release |
45
+ | `/tlc:new-milestone` | Start next version |
46
+
47
+ ---
48
+
49
+ ## Workflow
50
+
51
+ **Simple version:**
52
+ ```
53
+ /tlc <- just keep running this
54
+ ```
55
+
56
+ **Detailed version:**
57
+ ```
58
+ /tlc:new-project New project
59
+
60
+ /tlc Guides you through each phase:
61
+ → discuss → plan → build → verify
62
+
63
+ /tlc:complete Tag release
64
+ ```
65
+
66
+ ---
67
+
68
+ ## What `/tlc` Does
69
+
70
+ Checks project state and presents ONE action:
71
+
72
+ ```
73
+ > /tlc
74
+
75
+ Phase 2: User Dashboard
76
+ Status: Planned, not built
77
+
78
+ 4 tasks ready. Tests will be written first.
79
+
80
+ → Build phase 2? (Y/n)
81
+ ```
82
+
83
+ Or if you have untested code:
84
+
85
+ ```
86
+ > /tlc
87
+
88
+ Found 3 files without tests:
89
+ - src/utils/format.ts
90
+ - src/api/health.ts
91
+ - src/middleware/auth.ts
92
+
93
+ Add tests? (Y/n)
94
+ ```
95
+
96
+ ---
97
+
98
+ ## Philosophy
99
+
100
+ **Tests define behavior. Code makes tests pass.**
101
+
102
+ - Tests written BEFORE code
103
+ - Tests are the spec, not afterthought
104
+ - Human verification still happens
105
+ - No phase numbers to remember
106
+
107
+ ---
108
+
109
+ ## Installation
110
+
111
+ ```bash
112
+ npx tlc-claude-code
113
+ ```
114
+
115
+ Lives in `.claude/commands/tlc/`