tlc-claude-code 1.2.6 → 1.2.7

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 (4) hide show
  1. package/help.md +9 -0
  2. package/package.json +1 -1
  3. package/sync.md +176 -6
  4. package/tlc.md +20 -2
package/help.md CHANGED
@@ -115,6 +115,8 @@ That's it. `/tlc` handles everything:
115
115
 
116
116
  Rebase detected? → "Run sync? (Y/n)" → Reconcile
117
117
 
118
+ Main ahead? → "Integrate? [1/2]" → Read & rebuild (no rebase)
119
+
118
120
  Already synced? → Dashboard + next actions
119
121
  ```
120
122
 
@@ -125,6 +127,13 @@ git rebase origin/main
125
127
  /tlc ← Detects changes, asks, syncs, continues
126
128
  ```
127
129
 
130
+ **When main is ahead (no rebase):**
131
+ ```
132
+ /tlc ← Detects main ahead, offers to integrate
133
+
134
+ [1] Integrate ← Claude reads changes, rebuilds locally
135
+ ```
136
+
128
137
  ---
129
138
 
130
139
  ## What `/tlc` Does
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tlc-claude-code",
3
- "version": "1.2.6",
3
+ "version": "1.2.7",
4
4
  "description": "TLC - Test Led Coding for Claude Code",
5
5
  "bin": {
6
6
  "tlc": "./bin/tlc.js",
package/sync.md CHANGED
@@ -8,6 +8,8 @@ The unified entry point for TLC adoption and codebase synchronization.
8
8
 
9
9
  **Post-rebase:** Detect changes and reconcile incoming code with TLC standards.
10
10
 
11
+ **Main ahead:** Read changes from main, understand context, rebuild locally without rebasing.
12
+
11
13
  ## Usage
12
14
 
13
15
  ```
@@ -24,17 +26,27 @@ No arguments. TLC auto-detects the scenario.
24
26
  Step 1: Check for .tlc.json
25
27
 
26
28
  ├── NOT FOUND → Execute "Scenario 1: First-Time Adoption" ONLY
27
- │ (Skip Scenario 2 entirely)
28
29
 
29
- └── FOUND → Step 2: Compare HEAD with lastSync
30
+ └── FOUND → Step 2: Check branch status
31
+
32
+ ├── HEAD == lastSync AND main not ahead → "✓ Already synced" STOP
30
33
 
31
- ├── HEAD == lastSync → Print " Already synced" and STOP
34
+ ├── HEAD != lastSync → Execute "Scenario 2: Post-Rebase" ONLY
32
35
 
33
- └── HEAD != lastSync → Execute "Scenario 2: Post-Rebase" ONLY
34
- (Skip Scenario 1 entirely)
36
+ └── Main is ahead of current branch → Execute "Scenario 3: Integrate Main" ONLY
35
37
  ```
36
38
 
37
- **DO NOT run both scenarios. Pick ONE based on detection.**
39
+ **Detection for "main ahead":**
40
+ ```bash
41
+ mainBranch=$(jq -r '.git.mainBranch // "main"' .tlc.json)
42
+ git fetch origin $mainBranch
43
+ behindCount=$(git rev-list HEAD..origin/$mainBranch --count)
44
+ if [ "$behindCount" -gt 0 ]; then
45
+ # Main is ahead - offer Scenario 3
46
+ fi
47
+ ```
48
+
49
+ **DO NOT run multiple scenarios. Pick ONE based on detection.**
38
50
 
39
51
  ---
40
52
 
@@ -431,6 +443,164 @@ git commit -m "sync: reconcile changes from rebase"
431
443
 
432
444
  ---
433
445
 
446
+ ## Scenario 3: Integrate Main (No Rebase)
447
+
448
+ **ONLY run this if main branch is ahead of current branch.**
449
+
450
+ This is for when you want to incorporate changes from main WITHOUT rebasing. Claude reads and understands the changes, then rebuilds them in your branch's context.
451
+
452
+ ### When to Use This
453
+
454
+ - Rebase would cause too many conflicts
455
+ - You want to cherry-pick specific improvements
456
+ - You need to understand what changed before integrating
457
+ - Your branch has diverged significantly from main
458
+
459
+ ### Step 3.1: Detect Main Ahead
460
+
461
+ ```bash
462
+ mainBranch=$(jq -r '.git.mainBranch // "main"' .tlc.json)
463
+ git fetch origin $mainBranch
464
+
465
+ behindCount=$(git rev-list HEAD..origin/$mainBranch --count)
466
+ aheadCount=$(git rev-list origin/$mainBranch..HEAD --count)
467
+
468
+ if [ "$behindCount" -gt 0 ]; then
469
+ echo "─────────────────────────────────────────────────────"
470
+ echo " MAIN IS AHEAD"
471
+ echo "─────────────────────────────────────────────────────"
472
+ echo ""
473
+ echo "Your branch: $(git branch --show-current)"
474
+ echo "Main branch: $mainBranch"
475
+ echo ""
476
+ echo " $behindCount commits behind main"
477
+ echo " $aheadCount commits ahead of main"
478
+ echo ""
479
+ echo "Options:"
480
+ echo " [1] Integrate changes (read & rebuild without rebase)"
481
+ echo " [2] Skip for now"
482
+ echo ""
483
+ echo "Choice [1/2]: _"
484
+ fi
485
+ ```
486
+
487
+ ### Step 3.2: Analyze Main's Changes
488
+
489
+ If user chooses to integrate:
490
+
491
+ ```bash
492
+ # Get the changes from main that we don't have
493
+ git log --oneline HEAD..origin/$mainBranch
494
+ git diff HEAD...origin/$mainBranch --stat
495
+ ```
496
+
497
+ Present summary:
498
+
499
+ ```
500
+ ─────────────────────────────────────────────────────
501
+ CHANGES IN MAIN
502
+ ─────────────────────────────────────────────────────
503
+
504
+ 12 commits to integrate:
505
+
506
+ abc1234 feat: add payment processing
507
+ def5678 fix: user validation bug
508
+ ghi9012 refactor: cleanup auth module
509
+ ...
510
+
511
+ Files changed: 23
512
+ + 8 new files
513
+ ~ 12 modified files
514
+ - 3 deleted files
515
+
516
+ Key changes:
517
+ • New payment system (src/payments/*)
518
+ • Auth module refactored
519
+ • Bug fixes in user validation
520
+ ```
521
+
522
+ ### Step 3.3: Read and Understand
523
+
524
+ **Claude reads the actual changes (not just filenames):**
525
+
526
+ ```bash
527
+ # Read new files entirely
528
+ for f in $(git diff --name-only --diff-filter=A HEAD...origin/$mainBranch); do
529
+ git show origin/$mainBranch:$f
530
+ done
531
+
532
+ # Read diffs for modified files
533
+ git diff HEAD...origin/$mainBranch
534
+ ```
535
+
536
+ **Build context:**
537
+ - What new features were added?
538
+ - What bugs were fixed?
539
+ - What was refactored and why?
540
+ - What was deleted and why?
541
+
542
+ ### Step 3.4: Rebuild Locally
543
+
544
+ Instead of rebasing, Claude:
545
+
546
+ 1. **Creates new files** based on understanding (not copy-paste)
547
+ 2. **Applies fixes** to your branch's version of files
548
+ 3. **Incorporates refactors** that make sense in your context
549
+ 4. **Skips changes** that conflict with your work (notes them)
550
+
551
+ ```
552
+ ─────────────────────────────────────────────────────
553
+ INTEGRATING CHANGES
554
+ ─────────────────────────────────────────────────────
555
+
556
+ Reading main's changes...
557
+
558
+ ✓ New: src/payments/processor.ts
559
+ → Created in your branch (adapted to your patterns)
560
+
561
+ ✓ Fix: src/api/users.ts - validation bug
562
+ → Applied fix to your version
563
+
564
+ ✓ Refactor: src/auth/login.ts
565
+ → Incorporated improvements
566
+
567
+ ⚠ Skipped: src/api/orders.ts
568
+ → Conflicts with your changes (noted for manual review)
569
+
570
+ ─────────────────────────────────────────────────────
571
+
572
+ Integrated 11 of 12 changes.
573
+ 1 change skipped (see .planning/INTEGRATION-NOTES.md)
574
+
575
+ Commit these changes? (Y/n): _
576
+ ```
577
+
578
+ ### Step 3.5: Commit Integration
579
+
580
+ ```bash
581
+ git add -A
582
+ git commit -m "integrate: incorporate changes from main (no rebase)
583
+
584
+ Changes integrated:
585
+ - Payment processing system
586
+ - User validation fix
587
+ - Auth module improvements
588
+
589
+ Skipped (manual review needed):
590
+ - src/api/orders.ts (conflicts with current work)"
591
+ ```
592
+
593
+ ### Step 3.6: Update Sync State
594
+
595
+ ```bash
596
+ # Note that we've seen main's changes (even if not fully merged)
597
+ mainHead=$(git rev-parse origin/$mainBranch)
598
+ jq ".lastMainCheck = \"$mainHead\"" .tlc.json > .tlc.json.tmp
599
+ mv .tlc.json.tmp .tlc.json
600
+ ```
601
+
602
+ ---
603
+
434
604
  ## Auto-Detection in /tlc
435
605
 
436
606
  The main `/tlc` command should check sync status first:
package/tlc.md CHANGED
@@ -64,6 +64,23 @@ if [ -f ".tlc-rebase-marker" ] || [ "$lastSync" != "$currentHead" ]; then
64
64
  # If yes → Run sync.md "Scenario 2: Post-Rebase Reconciliation" ONLY
65
65
  # DO NOT run Scenario 1 (no questionnaire!)
66
66
  # Then continue to Step 1
67
+ exit # Don't fall through to main-ahead check
68
+ fi
69
+
70
+ # Check if main is ahead of current branch
71
+ mainBranch=$(jq -r '.git.mainBranch // "main"' .tlc.json)
72
+ git fetch origin $mainBranch 2>/dev/null
73
+ behindCount=$(git rev-list HEAD..origin/$mainBranch --count 2>/dev/null)
74
+
75
+ if [ "$behindCount" -gt 0 ]; then
76
+ echo "⚠️ Main branch is $behindCount commits ahead."
77
+ echo ""
78
+ echo "Options:"
79
+ echo " [1] Integrate changes (read & rebuild without rebase)"
80
+ echo " [2] Skip for now"
81
+ echo ""
82
+ # If 1 → Run sync.md "Scenario 3: Integrate Main" ONLY
83
+ # If 2 → Continue to dashboard
67
84
  fi
68
85
 
69
86
  # If we get here, sync is current
@@ -76,9 +93,10 @@ echo "✓ Synced"
76
93
  |-----------|--------|
77
94
  | No `.tlc.json` | Run sync.md **Scenario 1** (questionnaire) |
78
95
  | `.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 |
96
+ | Main is ahead of current branch | Run sync.md **Scenario 3** (integrate without rebase) |
97
+ | `.tlc.json` exists, all synced | Already synced, skip to dashboard |
80
98
 
81
- **The questionnaire ONLY runs on first-time setup, NEVER after rebase.**
99
+ **The questionnaire ONLY runs on first-time setup, NEVER after rebase or integrate.**
82
100
 
83
101
  User never needs to know about `/tlc:sync` as a separate command - `/tlc` handles everything.
84
102