tlc-claude-code 1.2.6 → 1.2.8

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 (5) hide show
  1. package/build.md +185 -0
  2. package/help.md +11 -2
  3. package/package.json +1 -1
  4. package/sync.md +176 -6
  5. package/tlc.md +20 -2
package/build.md CHANGED
@@ -354,6 +354,138 @@ Status: ✅ All tests passing (Green)
354
354
  {test runner output showing all pass}
355
355
  ```
356
356
 
357
+ ### Step 10: E2E Testing (Optional)
358
+
359
+ After unit tests pass, offer E2E testing:
360
+
361
+ ```
362
+ ✅ Unit tests passing (11/11)
363
+
364
+ Run E2E tests?
365
+ [1] Yes - run full E2E suite
366
+ [2] Skip - proceed to verify
367
+
368
+ Choice [1/2]: _
369
+ ```
370
+
371
+ **If user chooses E2E:**
372
+
373
+ #### 10a. Detect E2E Framework
374
+
375
+ Check `.tlc.json` or detect from project:
376
+
377
+ ```bash
378
+ # Check config
379
+ e2eFramework=$(jq -r '.e2e.framework // ""' .tlc.json)
380
+
381
+ # Or detect
382
+ if [ -f "playwright.config.ts" ]; then
383
+ e2eFramework="playwright"
384
+ elif [ -f "cypress.config.ts" ]; then
385
+ e2eFramework="cypress"
386
+ fi
387
+ ```
388
+
389
+ If no E2E framework:
390
+ ```
391
+ No E2E framework detected.
392
+
393
+ Set up E2E testing?
394
+ [1] Playwright (recommended)
395
+ [2] Cypress
396
+ [3] Skip for now
397
+
398
+ Choice [1/2/3]: _
399
+ ```
400
+
401
+ #### 10b. Generate E2E Tests from Acceptance Criteria
402
+
403
+ Read acceptance criteria from PLAN.md and generate E2E scenarios:
404
+
405
+ ```
406
+ Analyzing phase acceptance criteria...
407
+
408
+ E2E scenarios for Phase 1:
409
+ 1. User can log in with valid credentials
410
+ 2. User sees error for invalid password
411
+ 3. User session persists after refresh
412
+ 4. User can log out
413
+
414
+ Generate E2E tests? (Y/n)
415
+ ```
416
+
417
+ Create `tests/e2e/phase-{N}.spec.ts`:
418
+
419
+ ```typescript
420
+ import { test, expect } from '@playwright/test';
421
+
422
+ test.describe('Phase 1: Authentication', () => {
423
+ test('user can log in with valid credentials', async ({ page }) => {
424
+ await page.goto('/login');
425
+ await page.fill('[name="email"]', 'user@test.com');
426
+ await page.fill('[name="password"]', 'password123');
427
+ await page.click('button[type="submit"]');
428
+
429
+ await expect(page).toHaveURL('/dashboard');
430
+ });
431
+
432
+ test('user sees error for invalid password', async ({ page }) => {
433
+ await page.goto('/login');
434
+ await page.fill('[name="email"]', 'user@test.com');
435
+ await page.fill('[name="password"]', 'wrong');
436
+ await page.click('button[type="submit"]');
437
+
438
+ await expect(page.locator('.error')).toContainText('Invalid credentials');
439
+ });
440
+
441
+ // ... more tests from acceptance criteria
442
+ });
443
+ ```
444
+
445
+ #### 10c. Run E2E Tests
446
+
447
+ ```bash
448
+ # Playwright
449
+ npx playwright test
450
+
451
+ # Cypress
452
+ npx cypress run
453
+
454
+ # Docker (if configured)
455
+ docker-compose --profile test up playwright
456
+ ```
457
+
458
+ Output:
459
+ ```
460
+ Running E2E tests...
461
+
462
+ ✓ user can log in with valid credentials (1.2s)
463
+ ✓ user sees error for invalid password (0.8s)
464
+ ✓ user session persists after refresh (1.5s)
465
+ ✓ user can log out (0.6s)
466
+
467
+ ✅ 4 E2E tests passing
468
+
469
+ Phase 1 complete. Ready for /tlc:verify 1
470
+ ```
471
+
472
+ #### 10d. E2E Failures
473
+
474
+ If E2E tests fail:
475
+ ```
476
+ E2E test failed: user can log in with valid credentials
477
+
478
+ Error: Expected URL '/dashboard', got '/login'
479
+ Screenshot: tests/e2e/screenshots/login-failure.png
480
+
481
+ Options:
482
+ [1] Fix and retry
483
+ [2] Skip E2E (proceed to verify)
484
+ [3] Debug (open headed browser)
485
+
486
+ Choice [1/2/3]: _
487
+ ```
488
+
357
489
  ## Framework Defaults
358
490
 
359
491
  ### TLC Default: Mocha Stack
@@ -425,6 +557,51 @@ Projects can have multiple test frameworks. Configure in `.tlc.json`:
425
557
 
426
558
  When running tests, TLC will execute all frameworks in the `run` array.
427
559
 
560
+ ### E2E Framework Configuration
561
+
562
+ Configure E2E testing in `.tlc.json`:
563
+
564
+ ```json
565
+ {
566
+ "e2e": {
567
+ "framework": "playwright",
568
+ "baseUrl": "http://localhost:5001",
569
+ "command": "npx playwright test",
570
+ "docker": true
571
+ }
572
+ }
573
+ ```
574
+
575
+ **Playwright setup** (recommended):
576
+ ```bash
577
+ npm init playwright@latest
578
+ ```
579
+
580
+ Creates `playwright.config.ts`:
581
+ ```typescript
582
+ import { defineConfig } from '@playwright/test';
583
+
584
+ export default defineConfig({
585
+ testDir: './tests/e2e',
586
+ baseURL: process.env.BASE_URL || 'http://localhost:5001',
587
+ use: {
588
+ screenshot: 'only-on-failure',
589
+ video: 'retain-on-failure',
590
+ },
591
+ });
592
+ ```
593
+
594
+ **Cypress setup**:
595
+ ```bash
596
+ npm install -D cypress
597
+ npx cypress open
598
+ ```
599
+
600
+ **Docker E2E** (already in docker-compose.dev.yml):
601
+ ```bash
602
+ docker-compose --profile test up playwright
603
+ ```
604
+
428
605
  Default pytest.ini (Python):
429
606
  ```ini
430
607
  [pytest]
@@ -472,6 +649,14 @@ Committed: feat: session management - phase 1
472
649
  Running tests again...
473
650
  ✅ 11 tests passing
474
651
 
652
+ Run E2E tests? [1] Yes [2] Skip: 1
653
+
654
+ Running E2E tests...
655
+ ✓ user can log in with valid credentials
656
+ ✓ user sees error for invalid password
657
+ ✓ session persists after refresh
658
+ ✅ 3 E2E tests passing
659
+
475
660
  Phase 1 complete. Ready for /tlc:verify 1
476
661
  ```
477
662
 
package/help.md CHANGED
@@ -37,7 +37,7 @@ Launches the visual dashboard. Detects where you are, shows what's next.
37
37
  |---------|--------------|
38
38
  | `/tlc:discuss` | Shape implementation approach |
39
39
  | `/tlc:plan` | Create task plan |
40
- | `/tlc:build` | Write tests → implement → verify |
40
+ | `/tlc:build` | Write tests → implement → E2E (optional) → verify |
41
41
  | `/tlc:verify` | Human acceptance testing |
42
42
 
43
43
  ### Quality & Testing
@@ -49,7 +49,7 @@ Launches the visual dashboard. Detects where you are, shows what's next.
49
49
  | `/tlc:quality` | Test quality scoring and analysis |
50
50
  | `/tlc:edge-cases` | Generate edge case tests |
51
51
  | `/tlc:autofix` | Auto-fix failing tests |
52
- | `/tlc:config` | Configure test frameworks |
52
+ | `/tlc:config` | Configure test frameworks (unit + E2E) |
53
53
 
54
54
  ### Utility
55
55
 
@@ -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.8",
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