tlc-claude-code 0.9.5 → 0.9.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.
package/bin/init.js CHANGED
@@ -70,46 +70,53 @@ const shContent = `#!/bin/bash
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
package/bin/install.js CHANGED
@@ -54,6 +54,7 @@ const COMMANDS = [
54
54
  'who.md',
55
55
  'bug.md',
56
56
  'server.md',
57
+ 'start.md',
57
58
  // CI/CD & Integration
58
59
  'ci.md',
59
60
  'issues.md',
@@ -40,7 +40,7 @@ services:
40
40
  ports:
41
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:
@@ -74,7 +74,7 @@ services:
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
@@ -91,7 +91,7 @@ services:
91
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.5",
3
+ "version": "0.9.7",
4
4
  "description": "TLC - Test Led Coding for Claude Code",
5
5
  "bin": {
6
6
  "tlc": "./bin/tlc.js",
package/start.md ADDED
@@ -0,0 +1,24 @@
1
+ # /tlc:start - Start TLC Dev Server
2
+
3
+ Start the Docker development environment.
4
+
5
+ ## Instructions for Claude
6
+
7
+ Check which launcher exists and run the appropriate one:
8
+
9
+ **On Mac/Linux (or WSL):**
10
+ ```bash
11
+ ./tlc-start.sh
12
+ ```
13
+
14
+ **On Windows (CMD/PowerShell):**
15
+ ```cmd
16
+ tlc-start.bat
17
+ ```
18
+
19
+ If neither file exists, tell the user:
20
+ ```
21
+ No launcher found. Run 'tlc init' first.
22
+ ```
23
+
24
+ **Don't analyze the codebase. Just run the launcher.**