tlc-claude-code 1.2.4 → 1.2.6

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.
Files changed (3) hide show
  1. package/package.json +1 -1
  2. package/sync.md +48 -246
  3. package/tlc.md +19 -25
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tlc-claude-code",
3
- "version": "1.2.4",
3
+ "version": "1.2.6",
4
4
  "description": "TLC - Test Led Coding for Claude Code",
5
5
  "bin": {
6
6
  "tlc": "./bin/tlc.js",
package/sync.md CHANGED
@@ -16,20 +16,32 @@ The unified entry point for TLC adoption and codebase synchronization.
16
16
 
17
17
  No arguments. TLC auto-detects the scenario.
18
18
 
19
- ## Scenario Detection
19
+ ## CRITICAL: Execution Flow
20
+
21
+ **You MUST detect the scenario FIRST, then execute ONLY that scenario.**
20
22
 
21
23
  ```
22
- Check for .tlc.json:
23
- ├── Not found → First-time adoption
24
- └── FoundCheck for changes
25
- ├── HEAD matches lastSync → Already synced
26
- └── HEAD differs → Post-rebase reconciliation
24
+ Step 1: Check for .tlc.json
25
+
26
+ ├── NOT FOUND Execute "Scenario 1: First-Time Adoption" ONLY
27
+ │ (Skip Scenario 2 entirely)
28
+
29
+ └── FOUND → Step 2: Compare HEAD with lastSync
30
+
31
+ ├── HEAD == lastSync → Print "✓ Already synced" and STOP
32
+
33
+ └── HEAD != lastSync → Execute "Scenario 2: Post-Rebase" ONLY
34
+ (Skip Scenario 1 entirely)
27
35
  ```
28
36
 
37
+ **DO NOT run both scenarios. Pick ONE based on detection.**
38
+
29
39
  ---
30
40
 
31
41
  ## Scenario 1: First-Time Adoption
32
42
 
43
+ **ONLY run this if .tlc.json does NOT exist.**
44
+
33
45
  Complete onboarding questionnaire. All settings in one flow so nothing gets forgotten.
34
46
 
35
47
  ### Step 1.1: Welcome
@@ -293,6 +305,8 @@ Happy testing! 🧪
293
305
 
294
306
  ## Scenario 2: Post-Rebase Reconciliation
295
307
 
308
+ **ONLY run this if .tlc.json EXISTS and HEAD differs from lastSync.**
309
+
296
310
  Detect and handle code changes from rebase.
297
311
 
298
312
  ### Step 2.1: Detect Changes
@@ -358,241 +372,48 @@ Changes detected:
358
372
  Tests for new code: 0 found ⚠️
359
373
  ```
360
374
 
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...
375
+ ### Step 2.3: Auto-Sync (Default Behavior)
404
376
 
405
- src/api/payments.ts
406
- → No tests found
407
- → Generating: tests/api/payments.test.ts
408
- → 6 test cases identified
377
+ **DO NOT ask about individual files. Just sync automatically.**
409
378
 
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
379
  ```
380
+ Syncing...
454
381
 
455
- If confirmed, write tests and run them:
382
+ Updated lastSync to ${currentHead:0:7}
383
+ ✓ Removed rebase marker (if present)
456
384
 
385
+ Sync complete.
457
386
  ```
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
387
 
476
- Choice: _
388
+ That's it. The sync just updates the tracking. Tests are written when you run `/tlc:build`.
477
389
 
478
- tests/utils/currency.test.ts
479
- Running... 5 passing
390
+ **Why no file-by-file questions?**
391
+ - Incoming code was already reviewed in the PR
392
+ - Tests will be written during the build phase
393
+ - Asking about every file is annoying and slow
480
394
 
481
- tests/api/users.test.ts (updated)
482
- Running... 12 passing
395
+ ### Step 2.4: Optional - Add Tests for Untested Code
483
396
 
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
397
+ If `.tlc.json` has `existingCode.strategy: "backlog"`, silently note any new untested files:
495
398
 
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
399
+ ```bash
400
+ # Find new source files without tests
401
+ newUntested=$(for f in $newFiles; do
402
+ if [[ $f == src/* ]] && ! [ -f "tests/${f#src/}" ]; then
403
+ echo "$f"
404
+ fi
405
+ done)
555
406
 
407
+ if [ -n "$newUntested" ]; then
408
+ echo "Note: $(echo "$newUntested" | wc -l) new files added to test backlog"
409
+ fi
556
410
  ```
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
411
 
579
- Changes: +45 lines, -12 lines
580
- 2 new functions: updateProfile, deleteAccount
412
+ DO NOT ask about them. Just note and continue.
581
413
 
582
- Existing tests: tests/api/users.test.ts
583
- Tests affected: 3 failing
414
+ ### Step 2.6: Update Sync State
584
415
 
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:
416
+ After sync completes:
596
417
 
597
418
  ```bash
598
419
  # Update lastSync in .tlc.json
@@ -655,26 +476,7 @@ Run: git init
655
476
  **Uncommitted changes:**
656
477
  ```
657
478
  ⚠️ 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: _
479
+ Commit or stash them before syncing.
666
480
  ```
667
481
 
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
- ```
482
+ Then stop. Don't offer choices.
package/tlc.md CHANGED
@@ -34,45 +34,35 @@ if [ ! -f ".tlc.json" ]; then
34
34
  echo "This configures test framework, team settings, quality gates, and more."
35
35
  echo ""
36
36
  echo "Run setup now? (Y/n)"
37
- # If yes → Run /tlc:sync inline (first-time flow)
37
+ # If yes → Run sync.md "Scenario 1: First-Time Adoption" ONLY
38
+ # DO NOT run Scenario 2
38
39
  # Then continue to Step 1
40
+ exit # Don't fall through to other checks
39
41
  fi
40
42
 
41
- # Check for rebase marker
42
- if [ -f ".tlc-rebase-marker" ]; then
43
- echo "⚠️ Rebase detected since last sync."
44
- echo ""
45
- echo "TLC needs to reconcile incoming changes."
46
- echo "This ensures new code meets TLC standards."
47
- echo ""
48
- echo "Run sync now? (Y/n)"
49
- # If yes → Run /tlc:sync inline (post-rebase flow)
50
- # Then continue to Step 1
51
- fi
52
-
53
- # Check if HEAD matches lastSync
43
+ # .tlc.json exists - check sync state
54
44
  lastSync=$(jq -r '.lastSync // ""' .tlc.json)
55
45
  currentHead=$(git rev-parse HEAD 2>/dev/null)
56
46
 
57
- # If lastSync missing, initialize it (existing config, first sync tracking)
47
+ # If lastSync missing, initialize it
58
48
  if [ -z "$lastSync" ]; then
59
49
  echo "Initializing sync tracking..."
60
- # Update .tlc.json with current HEAD as lastSync
61
50
  jq ".lastSync = \"$currentHead\"" .tlc.json > .tlc.json.tmp && mv .tlc.json.tmp .tlc.json
62
51
  echo "✓ Synced (initialized to ${currentHead:0:7})"
63
- # Continue to Step 1
52
+ # Continue to Step 1 - NO sync needed
64
53
  fi
65
54
 
66
- if [ -n "$lastSync" ] && [ "$lastSync" != "$currentHead" ]; then
55
+ # Check for rebase marker OR HEAD mismatch
56
+ if [ -f ".tlc-rebase-marker" ] || [ "$lastSync" != "$currentHead" ]; then
67
57
  echo "⚠️ Codebase changed since last sync."
68
58
  echo " Last sync: ${lastSync:0:7}"
69
59
  echo " Current: ${currentHead:0:7}"
70
- echo ""
71
60
  changedCount=$(git diff --name-only $lastSync $currentHead 2>/dev/null | wc -l)
72
61
  echo " $changedCount files changed"
73
62
  echo ""
74
63
  echo "Run sync now? (Y/n)"
75
- # If yes → Run /tlc:sync inline (post-rebase flow)
64
+ # If yes → Run sync.md "Scenario 2: Post-Rebase Reconciliation" ONLY
65
+ # DO NOT run Scenario 1 (no questionnaire!)
76
66
  # Then continue to Step 1
77
67
  fi
78
68
 
@@ -80,11 +70,15 @@ fi
80
70
  echo "✓ Synced"
81
71
  ```
82
72
 
83
- **Key behavior:**
84
- - Detects if sync needed
85
- - Asks for confirmation
86
- - Runs sync flow inline (not separate command)
87
- - Then continues to dashboard/status
73
+ **CRITICAL - Which sync scenario to run:**
74
+
75
+ | Condition | Action |
76
+ |-----------|--------|
77
+ | No `.tlc.json` | Run sync.md **Scenario 1** (questionnaire) |
78
+ | `.tlc.json` exists, HEAD changed | Run sync.md **Scenario 2** (reconciliation only, NO questionnaire) |
79
+ | `.tlc.json` exists, HEAD matches | Already synced, skip to dashboard |
80
+
81
+ **The questionnaire ONLY runs on first-time setup, NEVER after rebase.**
88
82
 
89
83
  User never needs to know about `/tlc:sync` as a separate command - `/tlc` handles everything.
90
84