claude-ws 0.1.19 → 0.1.20
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/claudekanban.js +53 -3
- package/package.json +1 -1
package/bin/claudekanban.js
CHANGED
|
@@ -53,6 +53,52 @@ if (!fs.existsSync(DB_DIR)) {
|
|
|
53
53
|
fs.mkdirSync(DB_DIR, { recursive: true });
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
async function runMigrations() {
|
|
57
|
+
console.log('[Claude Workspace] Initializing database...');
|
|
58
|
+
|
|
59
|
+
// Simple approach: just require the db module which auto-runs initDb()
|
|
60
|
+
const dbPath = path.join(packageRoot, 'src', 'lib', 'db', 'index.ts');
|
|
61
|
+
|
|
62
|
+
try {
|
|
63
|
+
// Find tsx binary (should already be installed by this point)
|
|
64
|
+
let tsxCmd;
|
|
65
|
+
const possiblePaths = [
|
|
66
|
+
path.join(packageRoot, 'node_modules', '.bin', 'tsx'),
|
|
67
|
+
path.join(packageRoot, '..', '.bin', 'tsx'),
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
for (const tsxPath of possiblePaths) {
|
|
71
|
+
if (fs.existsSync(tsxPath)) {
|
|
72
|
+
tsxCmd = tsxPath;
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (!tsxCmd) {
|
|
78
|
+
// Try global tsx
|
|
79
|
+
try {
|
|
80
|
+
const { execSync } = require('child_process');
|
|
81
|
+
execSync('which tsx', { stdio: 'ignore' });
|
|
82
|
+
tsxCmd = 'tsx';
|
|
83
|
+
} catch {
|
|
84
|
+
throw new Error('tsx not found - this should not happen after dependency installation');
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const { execSync } = require('child_process');
|
|
89
|
+
execSync(`"${tsxCmd}" -e "require('${dbPath}'); console.log('[Claude Workspace] ✓ Database ready');"`, {
|
|
90
|
+
cwd: packageRoot,
|
|
91
|
+
stdio: 'inherit',
|
|
92
|
+
env: { ...process.env }
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
console.log('');
|
|
96
|
+
} catch (error) {
|
|
97
|
+
console.error('[Claude Workspace] Database initialization failed:', error.message);
|
|
98
|
+
throw error;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
56
102
|
async function startServer() {
|
|
57
103
|
console.log('[Claude Workspace] Starting server...');
|
|
58
104
|
console.log('[Claude Workspace] Database location:', DB_PATH);
|
|
@@ -86,6 +132,12 @@ async function startServer() {
|
|
|
86
132
|
console.error('[Claude Workspace] Failed to install dependencies:', error.message);
|
|
87
133
|
process.exit(1);
|
|
88
134
|
}
|
|
135
|
+
|
|
136
|
+
// Run migrations after dependencies are installed
|
|
137
|
+
await runMigrations();
|
|
138
|
+
} else {
|
|
139
|
+
// Dependencies already installed, run migrations
|
|
140
|
+
await runMigrations();
|
|
89
141
|
}
|
|
90
142
|
|
|
91
143
|
// Check if .next directory has valid build (check BUILD_ID file)
|
|
@@ -221,9 +273,7 @@ async function main() {
|
|
|
221
273
|
console.log('='.repeat(60));
|
|
222
274
|
console.log('');
|
|
223
275
|
|
|
224
|
-
//
|
|
225
|
-
// No need to run separate migration - initDb() handles it all
|
|
226
|
-
|
|
276
|
+
// Migrations will be run inside startServer() after dependencies are installed
|
|
227
277
|
await startServer();
|
|
228
278
|
|
|
229
279
|
} catch (error) {
|