tlc-claude-code 0.9.4 → 0.9.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.
package/README.md CHANGED
@@ -154,7 +154,7 @@ tlc init
154
154
  | URL | Service |
155
155
  |-----|---------|
156
156
  | http://localhost:3147 | Dashboard — Live preview, logs, tasks |
157
- | http://localhost:5000 | App — Your running application |
157
+ | http://localhost:5001 | App — Your running application |
158
158
  | http://localhost:8080 | DB Admin — Database GUI (Adminer) |
159
159
  | localhost:5433 | Database — PostgreSQL |
160
160
 
package/bin/init.js CHANGED
@@ -18,7 +18,7 @@ const batContent = `@echo off
18
18
  :: Double-click to start your dev environment
19
19
  ::
20
20
  :: Dashboard: http://localhost:3147
21
- :: App: http://localhost:5000
21
+ :: App: http://localhost:5001
22
22
  :: DB Admin: http://localhost:8080
23
23
  :: Database: localhost:5433
24
24
  :: ========================================
@@ -63,53 +63,60 @@ const shContent = `#!/bin/bash
63
63
  # TLC Dev Server Launcher
64
64
  # ========================================
65
65
  # Dashboard: http://localhost:3147
66
- # App: http://localhost:5000
66
+ # App: http://localhost:5001
67
67
  # DB Admin: http://localhost:8080
68
68
  # Database: localhost:5433
69
69
  # ========================================
70
70
 
71
71
  set -e
72
72
 
73
- # Find TLC installation
74
- TLC_DIR=""
75
- LOCATIONS=(
76
- "$HOME/.nvm/versions/node/*/lib/node_modules/tlc-claude-code"
77
- "/usr/local/lib/node_modules/tlc-claude-code"
78
- "/usr/lib/node_modules/tlc-claude-code"
79
- "$HOME/.npm-global/lib/node_modules/tlc-claude-code"
80
- )
73
+ PROJECT_PATH="$(cd "$(dirname "\${BASH_SOURCE[0]}")" && pwd)"
74
+ TLC_DIR="$PROJECT_PATH/.tlc"
81
75
 
82
- # Check npm global
83
- NPM_ROOT=$(npm root -g 2>/dev/null || echo "")
84
- if [ -n "$NPM_ROOT" ] && [ -f "$NPM_ROOT/tlc-claude-code/start-dev.sh" ]; then
85
- TLC_DIR="$NPM_ROOT/tlc-claude-code"
76
+ if [ ! -f "$TLC_DIR/docker-compose.dev.yml" ]; then
77
+ echo "[TLC] ERROR: .tlc folder not found. Run: tlc init"
78
+ exit 1
86
79
  fi
87
80
 
88
- # Check common locations
89
- if [ -z "$TLC_DIR" ]; then
90
- for pattern in "\${LOCATIONS[@]}"; do
91
- for dir in $pattern; do
92
- if [ -f "$dir/start-dev.sh" ]; then
93
- TLC_DIR="$dir"
94
- break 2
95
- fi
96
- done
81
+ # Check Docker
82
+ echo "[TLC] Checking Docker..."
83
+ if ! docker info >/dev/null 2>&1; then
84
+ echo "[TLC] Starting Docker..."
85
+ if [[ "$OSTYPE" == "darwin"* ]]; then
86
+ open -a Docker
87
+ fi
88
+ echo "[TLC] Waiting for Docker..."
89
+ for i in {1..30}; do
90
+ sleep 2
91
+ docker info >/dev/null 2>&1 && break
92
+ printf "."
97
93
  done
94
+ echo ""
98
95
  fi
99
96
 
100
- if [ -z "$TLC_DIR" ]; then
101
- echo "[TLC] ERROR: Could not find TLC installation"
102
- echo "[TLC] Install with: npm install -g tlc-claude-code"
97
+ if ! docker info >/dev/null 2>&1; then
98
+ echo "[TLC] ERROR: Docker not running"
103
99
  exit 1
104
100
  fi
105
101
 
106
- PROJECT_PATH="$(cd "$(dirname "\${BASH_SOURCE[0]}")" && pwd)"
102
+ echo "[TLC] Docker ready!"
103
+
104
+ PROJECT_NAME=$(basename "$PROJECT_PATH" | tr '[:upper:]' '[:lower:]' | tr -cd 'a-z0-9')
105
+ export PROJECT_DIR="$PROJECT_PATH"
106
+ export COMPOSE_PROJECT_NAME="\${PROJECT_NAME:-dev}"
107
107
 
108
- echo "[TLC] Found TLC at: $TLC_DIR"
109
- echo "[TLC] Starting dev server for: $PROJECT_PATH"
108
+ echo "[TLC] Project: $PROJECT_PATH"
109
+ echo ""
110
+ echo "[TLC] Starting services..."
111
+ echo " Dashboard: http://localhost:3147"
112
+ echo " App: http://localhost:5001"
113
+ echo " DB Admin: http://localhost:8080"
114
+ echo ""
115
+ echo "[TLC] Press Ctrl+C to stop"
110
116
  echo ""
111
117
 
112
- exec "$TLC_DIR/start-dev.sh" "$PROJECT_PATH"
118
+ cd "$TLC_DIR"
119
+ docker-compose -f docker-compose.dev.yml up --build
113
120
  `;
114
121
 
115
122
  // Detect OS - WSL counts as Windows since user will double-click .bat from Explorer
@@ -118,10 +125,11 @@ const isWindows = process.platform === 'win32' || isWSL;
118
125
  const launcherFile = isWindows ? 'tlc-start.bat' : 'tlc-start.sh';
119
126
  const launcherPath = path.join(projectDir, launcherFile);
120
127
 
121
- // FAST PATH: If launcher exists for this OS, just confirm and exit
122
- if (fs.existsSync(launcherPath)) {
128
+ // FAST PATH: If launcher and .tlc folder exist, just confirm and exit
129
+ const tlcFolderExists = fs.existsSync(path.join(projectDir, '.tlc', 'docker-compose.dev.yml'));
130
+ if (fs.existsSync(launcherPath) && tlcFolderExists) {
123
131
  console.log('');
124
- console.log(`[TLC] Already initialized. ${launcherFile} exists.`);
132
+ console.log(`[TLC] Already initialized.`);
125
133
  console.log('');
126
134
  if (isWindows) {
127
135
  console.log('[TLC] To start: Double-click ' + launcherFile);
@@ -160,19 +168,66 @@ if (isWindows) {
160
168
  console.log('[TLC] Note: Full macOS/Linux support coming soon!');
161
169
  }
162
170
 
171
+ // Copy TLC files to project's .tlc/ directory for Docker access
172
+ const tlcLocalDir = path.join(projectDir, '.tlc');
173
+ const tlcInstallDir = path.join(__dirname, '..');
174
+
175
+ if (!fs.existsSync(tlcLocalDir)) {
176
+ fs.mkdirSync(tlcLocalDir, { recursive: true });
177
+ }
178
+
179
+ // Copy server folder
180
+ const serverSrc = path.join(tlcInstallDir, 'server');
181
+ const serverDest = path.join(tlcLocalDir, 'server');
182
+ if (fs.existsSync(serverSrc)) {
183
+ copyDirSync(serverSrc, serverDest);
184
+ console.log('[TLC] Copied server to .tlc/server');
185
+ }
186
+
187
+ // Copy docker-compose.dev.yml
188
+ const composeSrc = path.join(tlcInstallDir, 'docker-compose.dev.yml');
189
+ const composeDest = path.join(tlcLocalDir, 'docker-compose.dev.yml');
190
+ if (fs.existsSync(composeSrc)) {
191
+ fs.copyFileSync(composeSrc, composeDest);
192
+ console.log('[TLC] Copied docker-compose.dev.yml to .tlc/');
193
+ }
194
+
195
+ // Helper to copy directory recursively
196
+ function copyDirSync(src, dest) {
197
+ if (!fs.existsSync(dest)) fs.mkdirSync(dest, { recursive: true });
198
+ for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
199
+ const srcPath = path.join(src, entry.name);
200
+ const destPath = path.join(dest, entry.name);
201
+ if (entry.name === 'node_modules') continue; // Skip node_modules
202
+ if (entry.isDirectory()) {
203
+ copyDirSync(srcPath, destPath);
204
+ } else {
205
+ fs.copyFileSync(srcPath, destPath);
206
+ }
207
+ }
208
+ }
209
+
163
210
  // Add to .gitignore if not already there
164
211
  const gitignorePath = path.join(projectDir, '.gitignore');
165
212
 
166
213
  if (fs.existsSync(gitignorePath)) {
167
214
  let gitignore = fs.readFileSync(gitignorePath, 'utf-8');
215
+ let updated = false;
168
216
  if (!gitignore.includes('tlc-start')) {
169
- gitignore += '\\n# TLC dev server launcher (local only)\\ntlc-start.*\\n';
217
+ gitignore += '\n# TLC dev server (local only)\ntlc-start.*\n';
218
+ updated = true;
219
+ }
220
+ if (!gitignore.includes('.tlc/')) {
221
+ gitignore += '.tlc/\n';
222
+ updated = true;
223
+ }
224
+ if (updated) {
170
225
  fs.writeFileSync(gitignorePath, gitignore);
171
- console.log('[TLC] Added tlc-start.* to .gitignore');
226
+ console.log('[TLC] Updated .gitignore');
172
227
  }
173
228
  } else {
174
- fs.writeFileSync(gitignorePath, '# TLC dev server launcher (local only)\\ntlc-start.*\\n');
175
- console.log('[TLC] Created .gitignore with tlc-start.*');
229
+ fs.writeFileSync(gitignorePath, '# TLC dev server (local only)\ntlc-start.*\n.tlc/\n');
230
+ console.log('[TLC] Created .gitignore');
176
231
  }
177
232
 
178
233
  // Create/update .tlc.json if it doesn't exist
@@ -191,7 +246,7 @@ if (!fs.existsSync(tlcConfigPath)) {
191
246
  const match = pkg.scripts.dev.match(/--port[=\\s]+(\\d+)/);
192
247
  if (match) appPort = parseInt(match[1]);
193
248
  }
194
- if (pkg.scripts?.dev?.includes('5000')) appPort = 5000;
249
+ if (pkg.scripts?.dev?.includes('5001')) appPort = 5001;
195
250
  if (pkg.scripts?.dev?.includes('3000')) appPort = 3000;
196
251
  if (pkg.scripts?.dev?.includes('5173')) appPort = 5173;
197
252
  } catch (e) {
@@ -228,7 +283,7 @@ if (isWindows) {
228
283
  console.log('');
229
284
  console.log('[TLC] Services when running:');
230
285
  console.log(' Dashboard: http://localhost:3147');
231
- console.log(' App: http://localhost:5000');
286
+ console.log(' App: http://localhost:5001');
232
287
  console.log(' DB Admin: http://localhost:8080');
233
288
  console.log(' Database: localhost:5433');
234
289
  console.log('');
@@ -36,11 +36,11 @@ services:
36
36
  environment:
37
37
  - NODE_ENV=development
38
38
  - DATABASE_URL=postgres://postgres:postgres@db:5432/app
39
- - PORT=5000
39
+ - PORT=5001
40
40
  ports:
41
- - "${APP_PORT:-5000}:5000"
41
+ - "${APP_PORT:-5001}:5001"
42
42
  volumes:
43
- - ${PROJECT_DIR:-.}:/app
43
+ - ..:/app
44
44
  - /app/node_modules
45
45
  depends_on:
46
46
  db:
@@ -69,12 +69,12 @@ services:
69
69
  environment:
70
70
  - TLC_PORT=3147
71
71
  - TLC_PROXY_ONLY=true
72
- - TLC_APP_PORT=5000
72
+ - TLC_APP_PORT=5001
73
73
  ports:
74
74
  - "${DASHBOARD_PORT:-3147}:3147"
75
75
  volumes:
76
76
  - ./server:/tlc/server
77
- - ${PROJECT_DIR:-.}:/project
77
+ - ..:/project
78
78
  depends_on:
79
79
  - app
80
80
  restart: on-failure
@@ -88,10 +88,10 @@ services:
88
88
  - test
89
89
  command: npx playwright test
90
90
  environment:
91
- - BASE_URL=http://app:5000
91
+ - BASE_URL=http://app:5001
92
92
  - CI=true
93
93
  volumes:
94
- - ${PROJECT_DIR:-.}:/app
94
+ - ..:/app
95
95
  depends_on:
96
96
  - app
97
97
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tlc-claude-code",
3
- "version": "0.9.4",
3
+ "version": "0.9.6",
4
4
  "description": "TLC - Test Led Coding for Claude Code",
5
5
  "bin": {
6
6
  "tlc": "./bin/tlc.js",
@@ -589,9 +589,9 @@
589
589
  <div class="sidebar-section">
590
590
  <h3>Links</h3>
591
591
  <div class="links">
592
- <a class="link" href="http://localhost:5000" target="_blank">
592
+ <a class="link" href="http://localhost:5001" target="_blank">
593
593
  <span>App</span>
594
- <span class="url">:5000</span>
594
+ <span class="url">:5001</span>
595
595
  </a>
596
596
  <a class="link" href="http://localhost:8080" target="_blank">
597
597
  <span>Database Admin</span>
package/server.md CHANGED
@@ -26,7 +26,7 @@ To start your dev environment:
26
26
 
27
27
  Services when running:
28
28
  Dashboard: http://localhost:3147
29
- App: http://localhost:5000
29
+ App: http://localhost:5001
30
30
  DB Admin: http://localhost:8080
31
31
  Database: localhost:5433
32
32
 
package/start-dev.ps1 CHANGED
@@ -81,7 +81,7 @@ Set-Location $scriptDir
81
81
  Write-Host ""
82
82
  Write-Host "[TLC] Starting services..." -ForegroundColor Yellow
83
83
  Write-Host " Dashboard: http://localhost:3147" -ForegroundColor White
84
- Write-Host " App: http://localhost:5000" -ForegroundColor White
84
+ Write-Host " App: http://localhost:5001" -ForegroundColor White
85
85
  Write-Host " DB Admin: http://localhost:8080" -ForegroundColor White
86
86
  Write-Host " Database: localhost:5433 (postgres/postgres)" -ForegroundColor Gray
87
87
  Write-Host ""
package/start-dev.sh CHANGED
@@ -76,7 +76,7 @@ cd "$SCRIPT_DIR"
76
76
  echo ""
77
77
  echo "[TLC] Starting services..."
78
78
  echo " Dashboard: http://localhost:3147"
79
- echo " App: http://localhost:5000"
79
+ echo " App: http://localhost:5001"
80
80
  echo " DB Admin: http://localhost:8080"
81
81
  echo " Database: localhost:5433 (postgres/postgres)"
82
82
  echo ""