tlc-claude-code 1.8.1 → 1.8.3

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.
@@ -34,17 +34,24 @@ const { auditProject, generateReport } = require('./lib/standards/audit-checker'
34
34
 
35
35
  Run `auditProject(projectPath)` which executes:
36
36
 
37
- | Check | What It Finds |
38
- |-------|---------------|
39
- | Standards Files | Missing CLAUDE.md or CODING-STANDARDS.md |
40
- | Flat Folders | Files in src/services/, src/interfaces/, src/controllers/ |
41
- | Inline Interfaces | `interface X {` inside *.service.ts files |
42
- | Hardcoded URLs | http:// or https:// URLs in code |
43
- | Hardcoded Ports | `const port = 3000` patterns |
44
- | Magic Strings | `=== 'active'` comparisons without constants |
45
- | Flat Seeds | Seed files in src/seeds/ instead of src/{entity}/seeds/ |
46
- | Missing JSDoc | Exported functions without `/**` comments |
47
- | Deep Imports | `../../../` style imports (3+ levels) |
37
+ | Check | What It Finds | Severity |
38
+ |-------|---------------|----------|
39
+ | Standards Files | Missing CLAUDE.md or CODING-STANDARDS.md | error |
40
+ | Flat Folders | Files in src/services/, src/interfaces/, src/controllers/ | error |
41
+ | Inline Interfaces | `interface X {` inside *.service.ts or *.controller.ts files | error |
42
+ | Inline Constants | `const X =` hardcoded values inside service/controller files | warning |
43
+ | Hardcoded URLs | http:// or https:// URLs in code | error |
44
+ | Hardcoded Ports | `const port = 3000` patterns | error |
45
+ | Magic Strings | `=== 'active'` comparisons without constants | warning |
46
+ | Flat Seeds | Seed files in src/seeds/ instead of src/{entity}/seeds/ | warning |
47
+ | Missing JSDoc | Exported functions without `/**` comments | warning |
48
+ | Deep Imports | `../../../` style imports (3+ levels) | warning |
49
+ | **Oversized Files** | Files exceeding 1000 lines (warn at 500) | error/warning |
50
+ | **Overcrowded Folders** | Folders with >15 files directly inside (warn at 8) | error/warning |
51
+ | **`any` Type Usage** | `any` type annotations in TypeScript files | error |
52
+ | **Missing Return Types** | Exported functions without explicit return type | warning |
53
+ | **Missing Parameter Types** | Function parameters without type annotations | error |
54
+ | **Weak tsconfig** | `strict: true` not enabled in tsconfig.json | warning |
48
55
 
49
56
  ### Step 3: Generate Report
50
57
 
@@ -80,15 +87,27 @@ Status: {PASSED | FAILED}
80
87
  TLC Audit Results
81
88
  ═══════════════════════════════════════════════════════════════
82
89
 
83
- Status: FAILED (12 issues found)
84
-
85
- Standards Files: ✓ PASSED
86
- Flat Folders: ✗ 3 issues
87
- Inline Interfaces: 2 issues
88
- Hardcoded URLs: 4 issues
89
- Magic Strings: 2 issues
90
- JSDoc Coverage: ✗ 1 issue
91
- Import Style: ✓ PASSED
90
+ Status: FAILED (18 issues found)
91
+
92
+ STRUCTURE
93
+ Standards Files: PASSED
94
+ Flat Folders: 3 issues
95
+ Overcrowded Folders: 2 issues (controllers/ has 22 files)
96
+ Oversized Files: 1 issue (csp.controller.ts: 2,041 lines)
97
+
98
+ TYPES & INTERFACES
99
+ Inline Interfaces: 2 issues
100
+ Inline Constants: 3 issues
101
+ any Type Usage: 5 issues
102
+ Missing Return Types: 4 issues
103
+ Missing Param Types: 2 issues
104
+ Weak tsconfig: PASSED
105
+
106
+ CODE QUALITY
107
+ Hardcoded URLs: 4 issues
108
+ Magic Strings: 2 issues
109
+ JSDoc Coverage: 8 issues (42% of exports undocumented)
110
+ Import Style: PASSED
92
111
 
93
112
  Report saved to: .planning/AUDIT-REPORT.md
94
113
 
@@ -692,6 +692,11 @@ git diff --name-status main...HEAD
692
692
  1. **Test Coverage** - Every implementation file has a test file
693
693
  2. **TDD Compliance** - Commits show test-first pattern (score ≥ 50%)
694
694
  3. **Security Scan** - No hardcoded secrets, eval(), innerHTML, etc.
695
+ 4. **File Size** - No file exceeds 1000 lines (warning at 500+)
696
+ 5. **Folder Size** - No folder exceeds 15 files (warning at 8+)
697
+ 6. **Strict Typing** - No `any` types in new/changed files
698
+ 7. **Return Types** - All exported functions have explicit return types
699
+ 8. **Module Structure** - Files grouped by domain entity, not by type
695
700
 
696
701
  **Review output:**
697
702
 
@@ -702,6 +707,10 @@ git diff --name-status main...HEAD
702
707
  Test Coverage: ✅ 5/5 files covered
703
708
  TDD Score: 75% ✅
704
709
  Security: ✅ No issues
710
+ File Sizes: ✅ All under 1000 lines
711
+ Folder Sizes: ✅ All under 15 files
712
+ Strict Typing: ✅ No `any` found
713
+ Return Types: ✅ All exports typed
705
714
 
706
715
  Verdict: ✅ APPROVED
707
716
  ───────────────────────────────
@@ -721,6 +730,18 @@ TDD Score: 25% ❌ (target: 50%)
721
730
  Security: ❌ 1 high severity issue
722
731
  └── Hardcoded password in src/config.js
723
732
 
733
+ File Sizes: ⚠️ 1 file over limit
734
+ └── src/api/users.controller.ts (1,247 lines) → split by feature
735
+
736
+ Strict Typing: ❌ 3 `any` types found
737
+ ├── src/api/users.controller.ts:45 → define interface
738
+ ├── src/api/users.controller.ts:89 → use `unknown`
739
+ └── src/services/email.ts:12 → define `EmailOptions` interface
740
+
741
+ Return Types: ⚠️ 2 exported functions missing return types
742
+ ├── src/utils/helpers.ts:getConfig() → add `: AppConfig`
743
+ └── src/utils/helpers.ts:parseInput() → add `: ParsedInput`
744
+
724
745
  Verdict: ❌ CHANGES REQUESTED
725
746
 
726
747
  ⚠️ Phase cannot complete until issues are fixed.
@@ -730,7 +751,10 @@ Verdict: ❌ CHANGES REQUESTED
730
751
  **Actions on failure:**
731
752
  1. Add missing test files
732
753
  2. Fix security issues
733
- 3. Re-run `/tlc:build {phase}` to retry
754
+ 3. Split oversized files (>1000 lines) into focused sub-modules
755
+ 4. Replace `any` types with proper interfaces or `unknown`
756
+ 5. Add explicit return types to all exported functions
757
+ 6. Re-run `/tlc:build {phase}` to retry
734
758
 
735
759
  **CRITICAL: Phase is NOT complete until review passes.**
736
760
 
@@ -12,6 +12,10 @@ Automatically fix all coding standards violations. No prompts - just fixes every
12
12
  - Extracts inline interfaces to types/ files
13
13
  - Replaces magic strings with constants
14
14
  - Adds missing JSDoc comments
15
+ - **Splits oversized files** (>1000 lines) into focused sub-modules
16
+ - **Organizes overcrowded folders** (>15 files) into domain subfolders
17
+ - **Replaces `any` types** with proper interfaces or `unknown`
18
+ - **Adds missing return types** to exported functions
15
19
  4. Commits after each module/entity
16
20
  5. Reports results when done
17
21
 
@@ -101,6 +105,72 @@ export function getUser(id: string): User { }
101
105
  export function getUser(id: string): User { }
102
106
  ```
103
107
 
108
+ #### Oversized Files (>1000 lines)
109
+ ```
110
+ // Before: csp.controller.ts (2,041 lines)
111
+ // Analyze the file's responsibilities and split by feature:
112
+
113
+ // After:
114
+ modules/csp/
115
+ controllers/
116
+ policy.controller.ts # Policy CRUD routes
117
+ report.controller.ts # Violation report routes
118
+ directive.controller.ts # Directive management routes
119
+ csp.routes.ts # Thin route registration
120
+ csp.service.ts # Shared business logic
121
+ ```
122
+
123
+ **Split strategy:**
124
+ 1. Count exported functions/methods and group by feature
125
+ 2. Create a controller/service per feature group
126
+ 3. Keep a thin "facade" file that re-exports or registers all routes
127
+ 4. Move shared helpers to a utils file within the module
128
+
129
+ #### Overcrowded Folders (>15 files)
130
+ ```
131
+ // Before: controllers/ with 22 files
132
+ // Group by domain:
133
+
134
+ // After:
135
+ modules/
136
+ auth/ # auth.controller.ts, auth.service.ts
137
+ user/ # user.controller.ts, user.service.ts
138
+ billing/ # payment.controller.ts, invoice.controller.ts
139
+ catalog/ # product.controller.ts, category.controller.ts
140
+ ```
141
+
142
+ #### `any` Type Replacement
143
+ ```typescript
144
+ // Before
145
+ function processData(data: any): any {
146
+ return data.items;
147
+ }
148
+
149
+ // After
150
+ interface ProcessInput {
151
+ items: unknown[];
152
+ }
153
+
154
+ function processData(data: ProcessInput): unknown[] {
155
+ return data.items;
156
+ }
157
+ ```
158
+
159
+ **Strategy:** Read how the variable is used, infer the shape, create an interface.
160
+
161
+ #### Missing Return Types
162
+ ```typescript
163
+ // Before
164
+ export function calculateTotal(items: CartItem[]) {
165
+ return items.reduce((sum, item) => sum + item.price, 0);
166
+ }
167
+
168
+ // After
169
+ export function calculateTotal(items: CartItem[]): number {
170
+ return items.reduce((sum, item) => sum + item.price, 0);
171
+ }
172
+ ```
173
+
104
174
  ### Step 4: Commit After Each Module
105
175
 
106
176
  After fixing all issues in an entity/module:
@@ -0,0 +1,138 @@
1
+ # /tlc:dashboard - TLC Dashboard Container
2
+
3
+ Manage the TLC dashboard as a standalone Docker container in any project.
4
+
5
+ ## Instructions for Claude
6
+
7
+ ### Step 1: Parse Arguments
8
+
9
+ The user may pass a subcommand:
10
+
11
+ ```
12
+ /tlc:dashboard → start (default)
13
+ /tlc:dashboard stop → stop
14
+ /tlc:dashboard rebuild → rebuild with latest TLC
15
+ /tlc:dashboard logs → tail logs
16
+ /tlc:dashboard status → show container status
17
+ ```
18
+
19
+ ### Step 2: Ensure docker-compose.tlc.yml Exists
20
+
21
+ Check if `docker-compose.tlc.yml` exists in the project root.
22
+
23
+ **If it does NOT exist:**
24
+
25
+ 1. Find the TLC package directory:
26
+ ```bash
27
+ TLC_DIR=$(node -e "try { console.log(require.resolve('tlc-claude-code/package.json').replace('/package.json','')) } catch(e) { console.log('') }")
28
+ ```
29
+ If empty, try global:
30
+ ```bash
31
+ TLC_DIR=$(npm root -g)/tlc-claude-code
32
+ ```
33
+
34
+ 2. Copy the template:
35
+ ```bash
36
+ cp "$TLC_DIR/templates/docker-compose.tlc.yml" ./docker-compose.tlc.yml
37
+ ```
38
+
39
+ 3. If template not found, generate it inline (see Template section below).
40
+
41
+ 4. Tell the user:
42
+ ```
43
+ Created docker-compose.tlc.yml in your project root.
44
+ This file is YOURS — customize it freely. TLC will never overwrite it.
45
+ ```
46
+
47
+ **If it already exists:** Use it as-is. Never modify the user's file.
48
+
49
+ ### Step 3: Execute Subcommand
50
+
51
+ **start (default):**
52
+ ```bash
53
+ docker compose -f docker-compose.tlc.yml up -d
54
+ ```
55
+
56
+ Then show:
57
+ ```
58
+ TLC Dashboard running at http://localhost:3147
59
+
60
+ Stop: /tlc:dashboard stop
61
+ Logs: /tlc:dashboard logs
62
+ Rebuild: /tlc:dashboard rebuild
63
+ ```
64
+
65
+ **stop:**
66
+ ```bash
67
+ docker compose -f docker-compose.tlc.yml down
68
+ ```
69
+
70
+ **rebuild:**
71
+ ```bash
72
+ docker compose -f docker-compose.tlc.yml build --no-cache
73
+ docker compose -f docker-compose.tlc.yml up -d
74
+ ```
75
+
76
+ **logs:**
77
+ ```bash
78
+ docker compose -f docker-compose.tlc.yml logs -f --tail 50 dashboard
79
+ ```
80
+
81
+ **status:**
82
+ ```bash
83
+ docker compose -f docker-compose.tlc.yml ps
84
+ ```
85
+
86
+ ### Step 4: Verify
87
+
88
+ After `start` or `rebuild`, check the dashboard is serving the React SPA:
89
+
90
+ ```bash
91
+ # Wait a few seconds for startup
92
+ sleep 5
93
+ curl -s http://localhost:3147 | head -5
94
+ ```
95
+
96
+ If it contains `<div id="root">` → React SPA is running.
97
+ If it contains the old static HTML → warn the user that TLC needs updating.
98
+
99
+ ---
100
+
101
+ ## Template
102
+
103
+ The `docker-compose.tlc.yml` template contains only the dashboard service:
104
+
105
+ ```yaml
106
+ # TLC Dashboard
107
+ # This file is yours — customize freely. TLC will never overwrite it.
108
+ # Docs: https://github.com/jurgencalleja/TLC/wiki/devserver
109
+
110
+ services:
111
+ dashboard:
112
+ image: node:20-alpine
113
+ container_name: tlc-dashboard
114
+ working_dir: /project
115
+ command: >
116
+ sh -c "
117
+ npm install -g tlc-claude-code@latest &&
118
+ TLC_DIR=$$(npm root -g)/tlc-claude-code &&
119
+ cd /project && node $$TLC_DIR/server/index.js
120
+ "
121
+ environment:
122
+ - TLC_PORT=3147
123
+ - TLC_AUTH=false
124
+ ports:
125
+ - "${DASHBOARD_PORT:-3147}:3147"
126
+ volumes:
127
+ - .:/project
128
+ restart: on-failure
129
+ ```
130
+
131
+ ---
132
+
133
+ ## Important Notes
134
+
135
+ - The compose file belongs to the USER. Never overwrite or modify it.
136
+ - If the user has customized ports, environment, or volumes — respect that.
137
+ - The dashboard serves the React SPA from `dashboard-web/dist/` (included in npm package since v1.8.1).
138
+ - This is independent from `/tlc:start` which manages the full dev environment (app, db, storage).
@@ -17,6 +17,12 @@ Research and create implementation plans with clear tasks.
17
17
  - **Error boundaries**: Where can failures occur? How are they handled?
18
18
  - **Data flow**: How does data enter, transform, and exit the system?
19
19
 
20
+ ### Code Quality Gates
21
+ - **File size limit**: No file should exceed 1000 lines. Plan splits for large modules.
22
+ - **Folder limit**: No folder should exceed 15 files. Plan domain subfolders.
23
+ - **Strict typing**: Plan interfaces upfront — no `any` types, explicit return types.
24
+ - **Module structure**: Group by domain entity (NestJS-style), not by file type.
25
+
20
26
  ### Task Breakdown
21
27
  - **Vertical slices**: Each task delivers testable, visible progress
22
28
  - **Risk-first**: Tackle unknowns and integrations early
@@ -61,6 +67,13 @@ Each task should be:
61
67
  - **Small** - completable in one focused session
62
68
  - **Testable** - has clear pass/fail criteria
63
69
  - **Independent** - minimal dependencies on other tasks
70
+ - **Standards-compliant** - won't produce files >1000 lines or folders >15 files
71
+
72
+ **Before finalizing tasks, check:**
73
+ 1. Will any planned file exceed 1000 lines? → Split into sub-modules
74
+ 2. Will any folder exceed 15 files? → Plan domain subfolders
75
+ 3. Are all interfaces defined? → Add `interfaces/` directory per module
76
+ 4. Are types explicit? → Plan typed interfaces, not `any`
64
77
 
65
78
  #### Task Status Markers (Multi-User)
66
79
 
@@ -82,12 +95,15 @@ Use `/tlc:claim` to claim a task, `/tlc:release` to release one.
82
95
  **Goal:** Define database schema for users table
83
96
 
84
97
  **Files:**
85
- - src/db/schema/users.ts
98
+ - src/modules/user/interfaces/user.interface.ts
99
+ - src/modules/user/user.repository.ts
86
100
 
87
101
  **Acceptance Criteria:**
88
102
  - [ ] Schema has id, email, passwordHash, createdAt
89
103
  - [ ] Email is unique
90
104
  - [ ] Timestamps auto-populate
105
+ - [ ] All types explicit (no `any`)
106
+ - [ ] Exported functions have return types
91
107
 
92
108
  **Test Cases:**
93
109
  - Schema validates correct user data
@@ -42,6 +42,7 @@ Same checks as `/tlc:review`:
42
42
  - Test coverage for changed files
43
43
  - TDD compliance (commit order)
44
44
  - Security scan
45
+ - **Coding standards** (file size, folder size, strict typing, return types, module structure)
45
46
 
46
47
  ### Step 4: Generate PR Comment
47
48
 
@@ -53,12 +54,17 @@ Same checks as `/tlc:review`:
53
54
  | Test Coverage | ✅ All files covered |
54
55
  | TDD Score | ✅ 75% |
55
56
  | Security | ✅ No issues |
57
+ | File Sizes | ✅ All under 1000 lines |
58
+ | Folder Sizes | ✅ All under 15 files |
59
+ | Strict Typing | ✅ No `any` types |
60
+ | Return Types | ✅ All exports typed |
56
61
 
57
62
  ### Summary
58
63
 
59
64
  - 8 files changed (5 impl, 3 tests)
60
65
  - 4 commits analyzed
61
66
  - No security vulnerabilities detected
67
+ - All coding standards met
62
68
 
63
69
  ### Verdict: ✅ APPROVED
64
70
 
@@ -134,6 +140,12 @@ TDD Score: 0% ❌
134
140
  Security: ⚠️ 1 medium severity issue
135
141
  └── console.log with sensitive data
136
142
 
143
+ Coding Standards: ❌ 4 issues
144
+ ├── src/auth/login.js (1,247 lines) → split by feature
145
+ ├── src/auth/login.js:45 → `any` type found
146
+ ├── src/auth/login.js:89 → `any` type found
147
+ └── src/config.js:getConfig() → missing return type
148
+
137
149
  Posting review...
138
150
 
139
151
  ─────────────────────────────────
@@ -145,6 +157,9 @@ See: https://github.com/org/repo/pull/43#review-123457
145
157
  Required actions:
146
158
  1. Add/update tests for modified files
147
159
  2. Remove console.log with sensitive data
160
+ 3. Split oversized file (>1000 lines)
161
+ 4. Replace `any` types with proper interfaces
162
+ 5. Add return types to exported functions
148
163
  ─────────────────────────────────
149
164
  ```
150
165
 
@@ -112,6 +112,65 @@ Scan diff for common security issues:
112
112
 
113
113
  **Fail if:** Any HIGH severity issues found.
114
114
 
115
+ ### Step 5b: Coding Standards Check
116
+
117
+ Scan all changed/added files for coding standards violations:
118
+
119
+ #### File Size Check
120
+ ```bash
121
+ # For each changed implementation file
122
+ wc -l <file>
123
+ # >1000 lines = ERROR, 500-1000 = WARNING
124
+ ```
125
+
126
+ #### Folder Size Check
127
+ ```bash
128
+ # For each folder containing changed files
129
+ ls <folder> | wc -l
130
+ # >15 files = ERROR, 8-15 = WARNING
131
+ ```
132
+
133
+ #### Strict Typing Check
134
+ ```bash
135
+ # Scan changed .ts/.tsx files for `any` type
136
+ grep -n ': any' <file>
137
+ grep -n 'as any' <file>
138
+ grep -n '<any>' <file>
139
+ # Any match = ERROR
140
+ ```
141
+
142
+ #### Return Type Check
143
+ ```bash
144
+ # Scan changed .ts/.tsx files for exported functions missing return types
145
+ # Pattern: export function name(params) { (no : ReturnType before {)
146
+ grep -n 'export function.*)[[:space:]]*{' <file>
147
+ grep -n 'export const.*=.*=>.*{' <file>
148
+ # Missing return type on exported function = WARNING
149
+ ```
150
+
151
+ #### Module Structure Check
152
+ ```
153
+ # Flag flat folder anti-patterns in changed files:
154
+ # - src/services/ with >5 unrelated services → should be modules/{entity}/
155
+ # - src/controllers/ with >5 controllers → should be modules/{entity}/
156
+ # - src/interfaces/ at project root → should be per-module interfaces/
157
+ ```
158
+
159
+ **Standards results in report:**
160
+ ```
161
+ Coding Standards:
162
+ File Sizes: ✅ All under 1000 lines
163
+ Folder Sizes: ✅ All under 15 files
164
+ Strict Typing: ❌ 3 `any` types found
165
+ ├── src/api/users.controller.ts:45
166
+ ├── src/api/users.controller.ts:89
167
+ └── src/services/email.ts:12
168
+ Return Types: ⚠️ 2 missing on exports
169
+ Module Structure: ✅ Domain-grouped
170
+ ```
171
+
172
+ **Fail if:** Any `any` types in new code, or files >1000 lines.
173
+
115
174
  ### Step 6: Invoke External Providers (Codex, Gemini)
116
175
 
117
176
  **CRITICAL: This step runs automatically when providers are configured.**
@@ -220,6 +279,9 @@ Invoking Codex (GPT-5.2) for review...
220
279
  - ✅ All changed files have tests
221
280
  - ✅ TDD score: 75%
222
281
  - ✅ No security issues detected
282
+ - ✅ All files under 1000 lines
283
+ - ✅ No `any` types
284
+ - ✅ All exports have return types
223
285
 
224
286
  ## Statistics
225
287