tlc-claude-code 0.8.3 → 0.8.4
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/rebuild.js +109 -0
- package/bin/tlc.js +4 -0
- package/package.json +3 -2
package/bin/rebuild.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* TLC Rebuild - Trigger full Docker rebuild
|
|
5
|
+
* Usage: tlc rebuild
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const { spawn } = require('child_process');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
const fs = require('fs');
|
|
11
|
+
|
|
12
|
+
// Find TLC installation directory
|
|
13
|
+
function findTlcDir() {
|
|
14
|
+
const isWSL = process.platform === 'linux' && fs.existsSync('/mnt/c');
|
|
15
|
+
|
|
16
|
+
// Check common locations (adjust for WSL)
|
|
17
|
+
const locations = [
|
|
18
|
+
path.join(__dirname, '..'), // Where this script lives (most reliable)
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
if (isWSL) {
|
|
22
|
+
locations.push('/mnt/c/Code/TLC');
|
|
23
|
+
locations.push(path.join(require('os').homedir(), 'Code', 'TLC'));
|
|
24
|
+
} else {
|
|
25
|
+
locations.push('C:\\Code\\TLC');
|
|
26
|
+
locations.push(path.join(require('os').homedir(), 'Code', 'TLC'));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Check npm global
|
|
30
|
+
try {
|
|
31
|
+
const { execSync } = require('child_process');
|
|
32
|
+
const globalRoot = execSync('npm root -g', { encoding: 'utf-8' }).trim();
|
|
33
|
+
locations.push(path.join(globalRoot, 'tlc-claude-code'));
|
|
34
|
+
} catch (e) {
|
|
35
|
+
// Ignore
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
for (const loc of locations) {
|
|
39
|
+
if (fs.existsSync(path.join(loc, 'docker-compose.dev.yml'))) {
|
|
40
|
+
return loc;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Get project name from current directory
|
|
48
|
+
function getProjectName() {
|
|
49
|
+
const projectDir = process.cwd();
|
|
50
|
+
return path.basename(projectDir).toLowerCase().replace(/[^a-z0-9]/g, '');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async function main() {
|
|
54
|
+
console.log('');
|
|
55
|
+
console.log(' TLC Rebuild');
|
|
56
|
+
console.log(' ===========');
|
|
57
|
+
console.log('');
|
|
58
|
+
|
|
59
|
+
const tlcDir = findTlcDir();
|
|
60
|
+
if (!tlcDir) {
|
|
61
|
+
console.error(' [ERROR] Could not find TLC installation');
|
|
62
|
+
console.error(' Make sure docker-compose.dev.yml exists');
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const projectName = getProjectName();
|
|
67
|
+
const composePath = path.join(tlcDir, 'docker-compose.dev.yml');
|
|
68
|
+
|
|
69
|
+
console.log(` TLC Dir: ${tlcDir}`);
|
|
70
|
+
console.log(` Project: ${projectName}`);
|
|
71
|
+
console.log('');
|
|
72
|
+
|
|
73
|
+
// Set environment variables
|
|
74
|
+
process.env.PROJECT_DIR = process.cwd();
|
|
75
|
+
process.env.COMPOSE_PROJECT_NAME = projectName;
|
|
76
|
+
|
|
77
|
+
console.log(' [1/2] Stopping containers...');
|
|
78
|
+
|
|
79
|
+
// Run docker-compose down
|
|
80
|
+
const down = spawn('docker-compose', ['-f', composePath, 'down'], {
|
|
81
|
+
stdio: 'inherit',
|
|
82
|
+
shell: true,
|
|
83
|
+
env: process.env
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
down.on('close', (code) => {
|
|
87
|
+
if (code !== 0) {
|
|
88
|
+
console.error(' [ERROR] Failed to stop containers');
|
|
89
|
+
process.exit(1);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
console.log('');
|
|
93
|
+
console.log(' [2/2] Rebuilding and starting...');
|
|
94
|
+
console.log('');
|
|
95
|
+
|
|
96
|
+
// Run docker-compose up --build
|
|
97
|
+
const up = spawn('docker-compose', ['-f', composePath, 'up', '--build'], {
|
|
98
|
+
stdio: 'inherit',
|
|
99
|
+
shell: true,
|
|
100
|
+
env: process.env
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
up.on('close', (upCode) => {
|
|
104
|
+
process.exit(upCode || 0);
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
main();
|
package/bin/tlc.js
CHANGED
|
@@ -15,6 +15,9 @@ switch (command) {
|
|
|
15
15
|
case 'init':
|
|
16
16
|
require('./init.js');
|
|
17
17
|
break;
|
|
18
|
+
case 'rebuild':
|
|
19
|
+
require('./rebuild.js');
|
|
20
|
+
break;
|
|
18
21
|
case 'help':
|
|
19
22
|
case '--help':
|
|
20
23
|
case '-h':
|
|
@@ -24,6 +27,7 @@ switch (command) {
|
|
|
24
27
|
Usage:
|
|
25
28
|
tlc Install TLC slash commands to Claude Code
|
|
26
29
|
tlc init Add Docker launcher to your project
|
|
30
|
+
tlc rebuild Stop, rebuild, and restart Docker containers
|
|
27
31
|
|
|
28
32
|
Options:
|
|
29
33
|
--global, -g Install commands globally (~/.claude/commands)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tlc-claude-code",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"description": "TLC - Test Led Coding for Claude Code",
|
|
5
5
|
"bin": {
|
|
6
6
|
"tlc": "./bin/tlc.js",
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"tlc-dashboard": "./dashboard/dist/index.js",
|
|
9
9
|
"tlc-server": "./bin/server.js",
|
|
10
10
|
"tlc-setup": "./bin/setup.js",
|
|
11
|
-
"tlc-init": "./bin/init.js"
|
|
11
|
+
"tlc-init": "./bin/init.js",
|
|
12
|
+
"tlc-rebuild": "./bin/rebuild.js"
|
|
12
13
|
},
|
|
13
14
|
"files": [
|
|
14
15
|
"bin/",
|