tlc-claude-code 1.1.1 → 1.2.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/bin/install.js CHANGED
@@ -30,6 +30,7 @@ const VERSION = require('../package.json').version;
30
30
  const COMMANDS = [
31
31
  // Core workflow
32
32
  'tlc.md',
33
+ 'sync.md',
33
34
  'new-project.md',
34
35
  'init.md',
35
36
  'import-project.md',
package/claim.md CHANGED
@@ -24,15 +24,37 @@ else
24
24
  fi
25
25
  ```
26
26
 
27
- ### Step 2: Sync Latest State
27
+ ### Step 2: Sync with Main Branch
28
28
 
29
- Pull latest changes to get current task claims:
29
+ Get the configured trunk branch from `.tlc.json`:
30
30
 
31
31
  ```bash
32
- git pull --rebase
32
+ mainBranch=$(jq -r '.git.mainBranch // "main"' .tlc.json 2>/dev/null || echo "main")
33
33
  ```
34
34
 
35
- If pull fails due to conflicts, abort and notify user to resolve manually.
35
+ Rebase from trunk to minimize conflicts:
36
+
37
+ ```bash
38
+ git fetch origin
39
+ git rebase origin/$mainBranch
40
+ ```
41
+
42
+ Output:
43
+ ```
44
+ Syncing with main...
45
+ ↳ Rebased 2 commits from origin/main
46
+ ```
47
+
48
+ If rebase fails due to conflicts:
49
+ ```
50
+ ⚠️ Rebase conflict detected.
51
+
52
+ Your branch has diverged from main. Resolve conflicts first:
53
+ git rebase --continue (after fixing conflicts)
54
+ git rebase --abort (to cancel)
55
+
56
+ Then run /tlc:claim again.
57
+ ```
36
58
 
37
59
  ### Step 3: Find Current Phase Plan
38
60
 
package/help.md CHANGED
@@ -18,10 +18,11 @@ Launches the visual dashboard. Detects where you are, shows what's next.
18
18
  |---------|--------------|
19
19
  | `/tlc` | **Visual dashboard. Context-aware. Knows what to do next.** |
20
20
 
21
- ### Setup
21
+ ### Setup & Sync
22
22
 
23
23
  | Command | What It Does |
24
24
  |---------|--------------|
25
+ | `/tlc:sync` | **One command to rule them all.** First-time setup or post-rebase reconciliation |
25
26
  | `/tlc:new-project` | Start new project (discusses stack, creates roadmap) |
26
27
  | `/tlc:init` | Add TLC to existing code |
27
28
  | `/tlc:import-project` | Import multi-repo microservices architecture |
@@ -99,12 +100,15 @@ Launches the visual dashboard. Detects where you are, shows what's next.
99
100
 
100
101
  **Simple version:**
101
102
  ```
102
- /tlc <- just keep running this
103
+ /tlc:sync <- First time or after rebase
104
+ /tlc <- Then just keep running this
103
105
  ```
104
106
 
105
107
  **Detailed version:**
106
108
  ```
107
- /tlc:new-project New project
109
+ /tlc:sync First-time setup (all config in one go)
110
+ ↓ Or: post-rebase reconciliation
111
+ /tlc:new-project New project (or /tlc:init for existing)
108
112
 
109
113
  /tlc Guides you through each phase:
110
114
  → discuss → plan → build → verify
@@ -112,6 +116,15 @@ Launches the visual dashboard. Detects where you are, shows what's next.
112
116
  /tlc:complete Tag release
113
117
  ```
114
118
 
119
+ **After rebasing:**
120
+ ```
121
+ git rebase origin/main TLC detects changes
122
+
123
+ /tlc:sync Reconcile incoming code
124
+
125
+ /tlc Continue working
126
+ ```
127
+
115
128
  ---
116
129
 
117
130
  ## What `/tlc` Does
package/init.md CHANGED
@@ -242,7 +242,48 @@ Tests are written BEFORE implementation, not after.
242
242
 
243
243
  If PROJECT.md exists, append the TLC section only.
244
244
 
245
- ### 10. Report Summary
245
+ ### 10. Detect Main Branch
246
+
247
+ Identify the trunk branch for rebasing and merges:
248
+
249
+ ```bash
250
+ # Try to detect from git
251
+ if git rev-parse --verify main >/dev/null 2>&1; then
252
+ detected="main"
253
+ elif git rev-parse --verify master >/dev/null 2>&1; then
254
+ detected="master"
255
+ elif git rev-parse --verify develop >/dev/null 2>&1; then
256
+ detected="develop"
257
+ else
258
+ detected=$(git rev-parse --abbrev-ref HEAD)
259
+ fi
260
+ ```
261
+
262
+ Confirm with user:
263
+ ```
264
+ Detected main branch: main
265
+
266
+ Is this your trunk branch for merges? (Y/n/other):
267
+ >
268
+
269
+ If "other", prompt for branch name.
270
+ ```
271
+
272
+ Add to `.tlc.json`:
273
+ ```json
274
+ {
275
+ "git": {
276
+ "mainBranch": "main"
277
+ }
278
+ }
279
+ ```
280
+
281
+ This branch is used by:
282
+ - `/tlc:claim` - rebases from this branch before claiming
283
+ - `/tlc:build` - suggests merging back to this branch
284
+ - PR reviews - compares against this branch
285
+
286
+ ### 11. Report Summary
246
287
 
247
288
  ```
248
289
  TLC initialized for [project name]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tlc-claude-code",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "description": "TLC - Test Led Coding for Claude Code",
5
5
  "bin": {
6
6
  "tlc": "./bin/tlc.js",
package/plan.md CHANGED
@@ -124,7 +124,55 @@ Create `.planning/phases/{N}-PLAN.md`:
124
124
  - Tests: ~{N} (estimated)
125
125
  ```
126
126
 
127
- ### Step 5: Review Plan
127
+ ### Step 5: Detect File Overlaps (Parallel Safety)
128
+
129
+ Analyze tasks for file conflicts to prevent merge issues:
130
+
131
+ ```
132
+ Analyzing task dependencies...
133
+
134
+ Files by task:
135
+ Task 1: src/db/schema.ts, src/db/migrations/001.sql
136
+ Task 2: src/api/users.ts, src/db/schema.ts ← overlap!
137
+ Task 3: src/api/auth.ts
138
+ Task 4: src/api/users.ts ← overlap with Task 2!
139
+ ```
140
+
141
+ When overlaps detected, auto-sequence:
142
+
143
+ ```
144
+ ⚠️ File overlaps detected:
145
+
146
+ src/db/schema.ts → Task 1, Task 2
147
+ src/api/users.ts → Task 2, Task 4
148
+
149
+ Restructuring for parallel safety:
150
+ Task 1: Create schema [independent]
151
+ Task 2: Add user endpoints [after: 1] ← must wait for schema
152
+ Task 3: Add auth middleware [independent]
153
+ Task 4: Add user validation [after: 2] ← must wait for endpoints
154
+
155
+ Tasks 1 and 3 can be worked in parallel.
156
+ Tasks 2 and 4 are sequential.
157
+ ```
158
+
159
+ Add dependencies to PLAN.md:
160
+
161
+ ```markdown
162
+ ## Dependencies
163
+
164
+ | Task | Depends On | Reason |
165
+ |------|------------|--------|
166
+ | 2 | 1 | Both modify src/db/schema.ts |
167
+ | 4 | 2 | Both modify src/api/users.ts |
168
+
169
+ **Parallel groups:**
170
+ - Group A: Tasks 1, 3 (can work simultaneously)
171
+ - Group B: Task 2 (after Group A)
172
+ - Group C: Task 4 (after Task 2)
173
+ ```
174
+
175
+ ### Step 6: Review Plan
128
176
 
129
177
  Present plan summary:
130
178
 
@@ -144,7 +192,7 @@ Proceed with this plan? (Y/n)
144
192
 
145
193
  Allow refinement if needed.
146
194
 
147
- ### Step 6: Save and Continue
195
+ ### Step 7: Save and Continue
148
196
 
149
197
  ```
150
198
  Plan saved to .planning/phases/{N}-PLAN.md
package/sync.md ADDED
@@ -0,0 +1,680 @@
1
+ # /tlc:sync - One Command to Rule Them All
2
+
3
+ The unified entry point for TLC adoption and codebase synchronization.
4
+
5
+ ## What This Does
6
+
7
+ **First-time adoption:** Complete onboarding with all configuration in one flow.
8
+
9
+ **Post-rebase:** Detect changes and reconcile incoming code with TLC standards.
10
+
11
+ ## Usage
12
+
13
+ ```
14
+ /tlc:sync
15
+ ```
16
+
17
+ No arguments. TLC auto-detects the scenario.
18
+
19
+ ## Scenario Detection
20
+
21
+ ```
22
+ Check for .tlc.json:
23
+ ├── Not found → First-time adoption
24
+ └── Found → Check for changes
25
+ ├── HEAD matches lastSync → Already synced
26
+ └── HEAD differs → Post-rebase reconciliation
27
+ ```
28
+
29
+ ---
30
+
31
+ ## Scenario 1: First-Time Adoption
32
+
33
+ Complete onboarding questionnaire. All settings in one flow so nothing gets forgotten.
34
+
35
+ ### Step 1.1: Welcome
36
+
37
+ ```
38
+ ████████╗██╗ ██████╗
39
+ ╚══██╔══╝██║ ██╔════╝
40
+ ██║ ██║ ██║
41
+ ██║ ██║ ██║
42
+ ██║ ███████╗╚██████╗
43
+ ╚═╝ ╚══════╝ ╚═════╝
44
+
45
+ Welcome to TLC - Test Led Coding
46
+
47
+ Let's configure your project. This takes about 2 minutes.
48
+ All settings can be changed later in .tlc.json
49
+ ```
50
+
51
+ ### Step 1.2: Detect Existing Setup
52
+
53
+ Scan the codebase:
54
+
55
+ ```bash
56
+ # Detect language/framework
57
+ if [ -f "package.json" ]; then
58
+ stack="node"
59
+ if grep -q "react\|next" package.json; then
60
+ stack="react"
61
+ fi
62
+ elif [ -f "pyproject.toml" ] || [ -f "requirements.txt" ]; then
63
+ stack="python"
64
+ elif [ -f "go.mod" ]; then
65
+ stack="go"
66
+ elif [ -f "Cargo.toml" ]; then
67
+ stack="rust"
68
+ fi
69
+
70
+ # Detect existing tests
71
+ tests_exist=$(find . -name "*.test.*" -o -name "test_*.py" -o -name "*_test.go" | head -1)
72
+
73
+ # Detect git branch
74
+ main_branch=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@')
75
+ ```
76
+
77
+ ### Step 1.3: Configuration Questionnaire
78
+
79
+ Present all options with smart defaults based on detection:
80
+
81
+ ```
82
+ ─────────────────────────────────────────────────────
83
+ 1. TEST FRAMEWORK
84
+ ─────────────────────────────────────────────────────
85
+
86
+ Detected: Node.js project
87
+
88
+ Choose test framework:
89
+ [1] Mocha + Chai + Sinon (TLC default, recommended)
90
+ [2] Vitest
91
+ [3] Jest
92
+ [4] Keep existing: jest (47 test files found)
93
+
94
+ Choice [1/2/3/4]: _
95
+
96
+ ─────────────────────────────────────────────────────
97
+ 2. GIT CONFIGURATION
98
+ ─────────────────────────────────────────────────────
99
+
100
+ Detected main branch: main
101
+
102
+ Is this your trunk branch? (Y/n): _
103
+
104
+ ─────────────────────────────────────────────────────
105
+ 3. TEAM MODE
106
+ ─────────────────────────────────────────────────────
107
+
108
+ How many people work on this codebase?
109
+ [1] Solo - just me
110
+ [2] Team - multiple developers
111
+
112
+ Choice [1/2]: _
113
+
114
+ (If team selected)
115
+ Require task claiming before work? (Y/n): _
116
+ Slack webhook for notifications (optional): _
117
+
118
+ ─────────────────────────────────────────────────────
119
+ 4. QUALITY STANDARDS
120
+ ─────────────────────────────────────────────────────
121
+
122
+ Set your quality gates:
123
+
124
+ Minimum test coverage [80]: ___%
125
+ Minimum quality score [75]: ___/100
126
+ Require tests before code (TDD) [Y/n]: _
127
+
128
+ ─────────────────────────────────────────────────────
129
+ 5. CI/CD INTEGRATION
130
+ ─────────────────────────────────────────────────────
131
+
132
+ Set up continuous integration?
133
+ [1] GitHub Actions (recommended)
134
+ [2] GitLab CI
135
+ [3] Azure Pipelines
136
+ [4] Skip for now
137
+
138
+ Choice [1/2/3/4]: _
139
+
140
+ (If CI selected)
141
+ Block PRs on test failure? (Y/n): _
142
+ Block PRs on coverage drop? (Y/n): _
143
+
144
+ ─────────────────────────────────────────────────────
145
+ 6. EXISTING CODE
146
+ ─────────────────────────────────────────────────────
147
+
148
+ Found 34 source files without tests.
149
+
150
+ How should TLC handle existing code?
151
+ [1] Create test backlog - I'll add tests gradually
152
+ [2] Generate tests now - for critical paths first
153
+ [3] Ignore existing - only enforce TLC on new code
154
+
155
+ Choice [1/2/3]: _
156
+
157
+ ─────────────────────────────────────────────────────
158
+ 7. ADVANCED OPTIONS
159
+ ─────────────────────────────────────────────────────
160
+
161
+ Configure advanced settings? (y/N): _
162
+
163
+ (If yes)
164
+ Auto-fix failing tests [Y/n]: _
165
+ Edge case generation [Y/n]: _
166
+ PR auto-review [Y/n]: _
167
+ Max parallel agents [10]: _
168
+ ```
169
+
170
+ ### Step 1.4: Generate Configuration
171
+
172
+ Create `.tlc.json` with all settings:
173
+
174
+ ```json
175
+ {
176
+ "version": "1.0",
177
+ "lastSync": "abc123def456",
178
+ "git": {
179
+ "mainBranch": "main"
180
+ },
181
+ "testFrameworks": {
182
+ "primary": "mocha",
183
+ "installed": ["mocha", "chai", "sinon", "proxyquire"],
184
+ "run": ["mocha"]
185
+ },
186
+ "team": {
187
+ "mode": "team",
188
+ "requireClaim": true,
189
+ "slackWebhook": null
190
+ },
191
+ "quality": {
192
+ "coverageThreshold": 80,
193
+ "qualityScoreThreshold": 75,
194
+ "enforceTDD": true
195
+ },
196
+ "ci": {
197
+ "provider": "github",
198
+ "blockOnTestFailure": true,
199
+ "blockOnCoverageDrop": true
200
+ },
201
+ "existingCode": {
202
+ "strategy": "backlog"
203
+ },
204
+ "advanced": {
205
+ "autofix": true,
206
+ "edgeCases": true,
207
+ "prAutoReview": true,
208
+ "maxAgents": 10
209
+ }
210
+ }
211
+ ```
212
+
213
+ ### Step 1.5: Apply Configuration
214
+
215
+ Based on choices, set up the project:
216
+
217
+ ```
218
+ Applying configuration...
219
+
220
+ ✓ Test framework: mocha
221
+ → Installed: mocha, chai, sinon, proxyquire
222
+ → Created: .mocharc.json
223
+ → Added test scripts to package.json
224
+
225
+ ✓ Git: main branch set to "main"
226
+ → Installed: post-rebase hook
227
+
228
+ ✓ Team mode: enabled
229
+ → Task claiming required
230
+
231
+ ✓ Quality gates: 80% coverage, 75 quality score
232
+
233
+ ✓ CI: GitHub Actions
234
+ → Created: .github/workflows/tlc.yml
235
+
236
+ ✓ Existing code: backlog created
237
+ → Created: .planning/BACKLOG.md (34 files to test)
238
+
239
+ ✓ Planning structure
240
+ → Created: PROJECT.md
241
+ → Created: .planning/ROADMAP.md
242
+ → Created: .planning/STATE.md
243
+ ```
244
+
245
+ ### Step 1.6: Install Git Hook
246
+
247
+ Create `.git/hooks/post-rebase`:
248
+
249
+ ```bash
250
+ #!/bin/bash
251
+ # TLC post-rebase hook
252
+
253
+ echo ""
254
+ echo "⚠️ Rebase detected. Run /tlc:sync to reconcile changes."
255
+ echo ""
256
+
257
+ # Update marker file so TLC knows rebase happened
258
+ touch .tlc-rebase-marker
259
+ ```
260
+
261
+ Make executable:
262
+ ```bash
263
+ chmod +x .git/hooks/post-rebase
264
+ ```
265
+
266
+ ### Step 1.7: Summary
267
+
268
+ ```
269
+ ─────────────────────────────────────────────────────
270
+ TLC SETUP COMPLETE
271
+ ─────────────────────────────────────────────────────
272
+
273
+ Configuration saved to .tlc.json
274
+
275
+ Your setup:
276
+ • Test framework: Mocha + Chai + Sinon
277
+ • Main branch: main
278
+ • Team mode: Enabled (claiming required)
279
+ • Coverage target: 80%
280
+ • CI: GitHub Actions
281
+
282
+ Next steps:
283
+ /tlc → See what to do next
284
+ /tlc:plan → Plan your first phase
285
+ /tlc:build → Start building (test-first)
286
+
287
+ Run /tlc:sync anytime after rebasing to reconcile changes.
288
+
289
+ Happy testing! 🧪
290
+ ```
291
+
292
+ ---
293
+
294
+ ## Scenario 2: Post-Rebase Reconciliation
295
+
296
+ Detect and handle code changes from rebase.
297
+
298
+ ### Step 2.1: Detect Changes
299
+
300
+ ```bash
301
+ # Get stored commit
302
+ lastSync=$(jq -r '.lastSync // ""' .tlc.json)
303
+
304
+ # Get current HEAD
305
+ currentHead=$(git rev-parse HEAD)
306
+
307
+ # Check for rebase marker
308
+ rebaseMarker=".tlc-rebase-marker"
309
+ ```
310
+
311
+ If `lastSync` equals `currentHead` and no rebase marker:
312
+ ```
313
+ ✓ Already synced. Nothing to do.
314
+ ```
315
+
316
+ Otherwise, continue to analysis.
317
+
318
+ ### Step 2.2: Analyze Incoming Changes
319
+
320
+ ```bash
321
+ # Get changed files since last sync
322
+ changedFiles=$(git diff --name-only $lastSync $currentHead 2>/dev/null)
323
+
324
+ # Categorize changes
325
+ newFiles=$(git diff --name-only --diff-filter=A $lastSync $currentHead)
326
+ modifiedFiles=$(git diff --name-only --diff-filter=M $lastSync $currentHead)
327
+ deletedFiles=$(git diff --name-only --diff-filter=D $lastSync $currentHead)
328
+ ```
329
+
330
+ Present analysis:
331
+
332
+ ```
333
+ ─────────────────────────────────────────────────────
334
+ REBASE DETECTED
335
+ ─────────────────────────────────────────────────────
336
+
337
+ Last sync: abc123 (2 hours ago)
338
+ Current: def456 (just now)
339
+
340
+ Changes detected:
341
+
342
+ New files (4):
343
+ + src/api/payments.ts
344
+ + src/api/webhooks.ts
345
+ + src/services/stripe.ts
346
+ + src/utils/currency.ts
347
+
348
+ Modified files (7):
349
+ ~ src/api/users.ts
350
+ ~ src/db/schema.ts
351
+ ~ src/middleware/auth.ts
352
+ ~ tests/api/users.test.ts
353
+ ~ ...
354
+
355
+ Deleted files (1):
356
+ - src/old-payment.ts
357
+
358
+ Tests for new code: 0 found ⚠️
359
+ ```
360
+
361
+ ### Step 2.3: Choose Reconciliation Strategy
362
+
363
+ ```
364
+ ─────────────────────────────────────────────────────
365
+ RECONCILIATION STRATEGY
366
+ ─────────────────────────────────────────────────────
367
+
368
+ How should TLC handle the incoming code?
369
+
370
+ [1] CONFORM TO TLC (Recommended)
371
+ → Analyze incoming code
372
+ → Generate tests for new files
373
+ → Apply TLC patterns (if needed)
374
+ → May modify incoming files
375
+
376
+ Best when: You want all code to follow TLC standards
377
+
378
+ [2] PRESERVE INCOMING
379
+ → Keep incoming code exactly as-is
380
+ → Update YOUR existing code to work with it
381
+ → Incoming files are untouched
382
+
383
+ Best when: Incoming code is reviewed/approved,
384
+ you just need to integrate
385
+
386
+ [3] MANUAL REVIEW
387
+ → Show detailed diff
388
+ → Let me decide file-by-file
389
+
390
+ Best when: Mixed situation, some files need
391
+ conforming, others should be preserved
392
+
393
+ Choice [1/2/3]: _
394
+ ```
395
+
396
+ ### Step 2.4a: Strategy - Conform to TLC
397
+
398
+ ```
399
+ ─────────────────────────────────────────────────────
400
+ CONFORMING INCOMING CODE TO TLC
401
+ ─────────────────────────────────────────────────────
402
+
403
+ Analyzing 4 new files...
404
+
405
+ src/api/payments.ts
406
+ → No tests found
407
+ → Generating: tests/api/payments.test.ts
408
+ → 6 test cases identified
409
+
410
+ src/api/webhooks.ts
411
+ → No tests found
412
+ → Generating: tests/api/webhooks.test.ts
413
+ → 4 test cases identified
414
+
415
+ src/services/stripe.ts
416
+ → No tests found
417
+ → Generating: tests/services/stripe.test.ts
418
+ → 8 test cases identified (mocking Stripe API)
419
+
420
+ src/utils/currency.ts
421
+ → No tests found
422
+ → Generating: tests/utils/currency.test.ts
423
+ → 5 test cases identified
424
+
425
+ Analyzing 7 modified files...
426
+
427
+ src/api/users.ts
428
+ → Existing tests: tests/api/users.test.ts
429
+ → 2 new functions added, need 3 new test cases
430
+ → Updating test file
431
+
432
+ src/db/schema.ts
433
+ → Existing tests cover changes ✓
434
+
435
+ ...
436
+
437
+ ─────────────────────────────────────────────────────
438
+ PROPOSED CHANGES
439
+ ─────────────────────────────────────────────────────
440
+
441
+ Will create:
442
+ + tests/api/payments.test.ts (6 tests)
443
+ + tests/api/webhooks.test.ts (4 tests)
444
+ + tests/services/stripe.test.ts (8 tests)
445
+ + tests/utils/currency.test.ts (5 tests)
446
+
447
+ Will update:
448
+ ~ tests/api/users.test.ts (+3 tests)
449
+
450
+ Total: 26 new tests
451
+
452
+ Apply changes? (Y/n): _
453
+ ```
454
+
455
+ If confirmed, write tests and run them:
456
+
457
+ ```
458
+ Creating tests...
459
+
460
+ ✓ tests/api/payments.test.ts
461
+ Running... 6 passing
462
+
463
+ ✓ tests/api/webhooks.test.ts
464
+ Running... 4 passing
465
+
466
+ ✓ tests/services/stripe.test.ts
467
+ Running... 7 passing, 1 failing
468
+
469
+ ⚠️ stripe.test.ts:45 - handleRefund expects different response
470
+
471
+ Options:
472
+ [1] Fix the test (incoming code is correct)
473
+ [2] Fix the code (test expectation is correct)
474
+ [3] Skip for now (add to backlog)
475
+
476
+ Choice: _
477
+
478
+ ✓ tests/utils/currency.test.ts
479
+ Running... 5 passing
480
+
481
+ ✓ tests/api/users.test.ts (updated)
482
+ Running... 12 passing
483
+
484
+ ─────────────────────────────────────────────────────
485
+
486
+ Sync complete!
487
+ → 25 tests passing
488
+ → 1 issue added to backlog
489
+ → Committed: "sync: add tests for rebased code"
490
+
491
+ Updated .tlc.json lastSync to def456
492
+ ```
493
+
494
+ ### Step 2.4b: Strategy - Preserve Incoming
495
+
496
+ ```
497
+ ─────────────────────────────────────────────────────
498
+ PRESERVING INCOMING CODE
499
+ ─────────────────────────────────────────────────────
500
+
501
+ Incoming files will NOT be modified.
502
+ Checking integration points...
503
+
504
+ Analyzing impact on existing TLC code...
505
+
506
+ src/api/users.ts (incoming) affects:
507
+ → tests/api/users.test.ts (yours)
508
+ 3 tests now failing due to API changes
509
+
510
+ src/db/schema.ts (incoming) affects:
511
+ → tests/db/schema.test.ts (yours)
512
+ 1 test failing - new required field
513
+ → src/api/auth.ts (yours)
514
+ Type error - User type changed
515
+
516
+ ─────────────────────────────────────────────────────
517
+ REQUIRED UPDATES TO YOUR CODE
518
+ ─────────────────────────────────────────────────────
519
+
520
+ To integrate incoming changes, TLC needs to update:
521
+
522
+ tests/api/users.test.ts
523
+ → Update 3 test expectations to match new API
524
+
525
+ tests/db/schema.test.ts
526
+ → Add required field to test fixtures
527
+
528
+ src/api/auth.ts
529
+ → Update User type usage (line 45, 67)
530
+
531
+ Apply updates? (Y/n): _
532
+ ```
533
+
534
+ If confirmed:
535
+
536
+ ```
537
+ Updating your code to integrate...
538
+
539
+ ✓ tests/api/users.test.ts - 3 expectations updated
540
+ ✓ tests/db/schema.test.ts - fixture updated
541
+ ✓ src/api/auth.ts - type usage fixed
542
+
543
+ Running all tests...
544
+ ✓ 47 passing
545
+
546
+ Sync complete!
547
+ → Incoming code preserved
548
+ → Your code updated to integrate
549
+ → Committed: "sync: integrate rebased changes"
550
+
551
+ Updated .tlc.json lastSync to def456
552
+ ```
553
+
554
+ ### Step 2.4c: Strategy - Manual Review
555
+
556
+ ```
557
+ ─────────────────────────────────────────────────────
558
+ MANUAL FILE-BY-FILE REVIEW
559
+ ─────────────────────────────────────────────────────
560
+
561
+ Review each changed file:
562
+
563
+ [1/4] src/api/payments.ts (NEW)
564
+
565
+ No tests. 142 lines. Payment processing logic.
566
+
567
+ Action:
568
+ [C] Conform - generate tests
569
+ [P] Preserve - add to backlog for later
570
+ [S] Skip - ignore this file
571
+
572
+ Choice: _
573
+
574
+ [2/4] src/api/webhooks.ts (NEW)
575
+ ...
576
+
577
+ [3/4] src/api/users.ts (MODIFIED)
578
+
579
+ Changes: +45 lines, -12 lines
580
+ 2 new functions: updateProfile, deleteAccount
581
+
582
+ Existing tests: tests/api/users.test.ts
583
+ Tests affected: 3 failing
584
+
585
+ Action:
586
+ [C] Conform - update tests for new behavior
587
+ [P] Preserve - update your code to match
588
+ [V] View diff
589
+
590
+ Choice: _
591
+ ```
592
+
593
+ ### Step 2.5: Update Sync State
594
+
595
+ After any strategy completes:
596
+
597
+ ```bash
598
+ # Update lastSync in .tlc.json
599
+ currentHead=$(git rev-parse HEAD)
600
+ jq ".lastSync = \"$currentHead\"" .tlc.json > .tlc.json.tmp
601
+ mv .tlc.json.tmp .tlc.json
602
+
603
+ # Remove rebase marker if exists
604
+ rm -f .tlc-rebase-marker
605
+
606
+ # Commit the sync
607
+ git add .
608
+ git commit -m "sync: reconcile changes from rebase"
609
+ ```
610
+
611
+ ---
612
+
613
+ ## Auto-Detection in /tlc
614
+
615
+ The main `/tlc` command should check sync status first:
616
+
617
+ ```
618
+ /tlc
619
+
620
+ Checking sync status...
621
+ ⚠️ Rebase detected since last sync.
622
+
623
+ Run /tlc:sync to reconcile changes before continuing.
624
+ ```
625
+
626
+ This ensures users don't accidentally work on out-of-sync code.
627
+
628
+ ---
629
+
630
+ ## Configuration Reference
631
+
632
+ Settings managed by `/tlc:sync`:
633
+
634
+ | Setting | First-Time | Post-Rebase |
635
+ |---------|------------|-------------|
636
+ | `lastSync` | Set to current HEAD | Updated after reconciliation |
637
+ | `git.mainBranch` | Asked | Unchanged |
638
+ | `testFrameworks` | Asked | Unchanged |
639
+ | `team` | Asked | Unchanged |
640
+ | `quality` | Asked | Unchanged |
641
+ | `ci` | Asked | Unchanged |
642
+ | `advanced` | Asked | Unchanged |
643
+
644
+ ---
645
+
646
+ ## Error Handling
647
+
648
+ **No git repository:**
649
+ ```
650
+ Error: Not a git repository.
651
+ TLC requires git for sync tracking.
652
+ Run: git init
653
+ ```
654
+
655
+ **Uncommitted changes:**
656
+ ```
657
+ ⚠️ You have uncommitted changes.
658
+
659
+ TLC sync works best with a clean working tree.
660
+ Options:
661
+ [1] Stash changes, sync, then restore
662
+ [2] Commit changes first
663
+ [3] Continue anyway (not recommended)
664
+
665
+ Choice: _
666
+ ```
667
+
668
+ **Merge conflicts during reconciliation:**
669
+ ```
670
+ ⚠️ Conflict in tests/api/users.test.ts
671
+
672
+ The incoming code and your tests have conflicting changes.
673
+
674
+ Options:
675
+ [1] Keep yours (incoming tests discarded)
676
+ [2] Keep theirs (your tests replaced)
677
+ [3] Open in editor to resolve manually
678
+
679
+ Choice: _
680
+ ```
package/tlc.md CHANGED
@@ -8,6 +8,42 @@ Launches the TLC dashboard - a visual interface showing project state, phases, t
8
8
 
9
9
  ## Process
10
10
 
11
+ ### Step 0: Check Sync Status (ALWAYS FIRST)
12
+
13
+ Before anything else, check if codebase is synced:
14
+
15
+ ```bash
16
+ # Check if .tlc.json exists
17
+ if [ ! -f ".tlc.json" ]; then
18
+ # No TLC config - need first-time setup
19
+ echo "No TLC configuration found."
20
+ echo "→ Run /tlc:sync to set up TLC"
21
+ exit
22
+ fi
23
+
24
+ # Check for rebase marker
25
+ if [ -f ".tlc-rebase-marker" ]; then
26
+ echo "⚠️ Rebase detected since last sync."
27
+ echo "→ Run /tlc:sync to reconcile changes"
28
+ exit
29
+ fi
30
+
31
+ # Check if HEAD matches lastSync
32
+ lastSync=$(jq -r '.lastSync // ""' .tlc.json)
33
+ currentHead=$(git rev-parse HEAD 2>/dev/null)
34
+
35
+ if [ -n "$lastSync" ] && [ "$lastSync" != "$currentHead" ]; then
36
+ echo "⚠️ Codebase changed since last sync."
37
+ echo " Last sync: ${lastSync:0:7}"
38
+ echo " Current: ${currentHead:0:7}"
39
+ echo ""
40
+ echo "→ Run /tlc:sync to reconcile changes"
41
+ exit
42
+ fi
43
+ ```
44
+
45
+ Only proceed if synced. This prevents working on out-of-sync code.
46
+
11
47
  ### Step 1: Launch Dashboard
12
48
 
13
49
  Run the TLC dashboard: