@shaykec/claude-teach 0.5.0 → 0.6.0
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/package.json +2 -2
- package/src/cli.js +38 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shaykec/claude-teach",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Socratic AI teaching platform — learn anything through guided dialogue, visual canvas, and gamification",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/cli.js",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"commander": "^12.0.0",
|
|
16
16
|
"js-yaml": "^4.1.0",
|
|
17
17
|
"chalk": "^5.3.0",
|
|
18
|
-
"@shaykec/bridge": "0.
|
|
18
|
+
"@shaykec/bridge": "0.4.0",
|
|
19
19
|
"@shaykec/shared": "0.1.0",
|
|
20
20
|
"@shaykec/plugin": "0.2.0",
|
|
21
21
|
"@shaykec/extension": "0.1.0"
|
package/src/cli.js
CHANGED
|
@@ -299,6 +299,7 @@ program
|
|
|
299
299
|
.command('start')
|
|
300
300
|
.description('Launch Claude Code with ClaudeTeach — starts bridge server + loads teaching skills')
|
|
301
301
|
.option('--no-server', 'Skip starting the bridge server')
|
|
302
|
+
.option('--no-browser', 'Skip opening the canvas in the browser')
|
|
302
303
|
.option('--port <port>', 'Bridge server port', '3456')
|
|
303
304
|
.allowUnknownOption(true)
|
|
304
305
|
.action(async (opts, cmd) => {
|
|
@@ -323,21 +324,52 @@ program
|
|
|
323
324
|
if (opts.server !== false) {
|
|
324
325
|
try {
|
|
325
326
|
const { startServer } = await import('@shaykec/bridge');
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
327
|
+
const port = parseInt(opts.port, 10);
|
|
328
|
+
server = await new Promise((resolve, reject) => {
|
|
329
|
+
const srv = startServer({
|
|
330
|
+
port,
|
|
331
|
+
progressProvider: { getProgress: () => loadProgress(ROOT) },
|
|
332
|
+
onReady: () => resolve(srv),
|
|
333
|
+
});
|
|
334
|
+
// Handle port-in-use and other startup errors
|
|
335
|
+
srv.server.on('error', (err) => {
|
|
336
|
+
if (err.code === 'EADDRINUSE') {
|
|
337
|
+
reject(new Error(`Port ${port} is already in use. Kill the old process or use --port <other>`));
|
|
338
|
+
} else {
|
|
339
|
+
reject(err);
|
|
340
|
+
}
|
|
341
|
+
});
|
|
329
342
|
});
|
|
330
343
|
console.log(chalk.dim(` Bridge server on port ${opts.port}`));
|
|
331
344
|
} catch (err) {
|
|
332
|
-
console.warn(chalk.yellow(` Bridge server failed
|
|
345
|
+
console.warn(chalk.yellow(` Bridge server failed: ${err.message}`));
|
|
346
|
+
console.warn(chalk.dim(' Continuing without bridge server (visuals unavailable)'));
|
|
333
347
|
}
|
|
334
348
|
}
|
|
335
349
|
|
|
336
|
-
// 4.
|
|
350
|
+
// 4. Open canvas in browser (unless --no-browser or --no-server)
|
|
351
|
+
if (server && opts.browser !== false) {
|
|
352
|
+
const canvasUrl = `http://localhost:${opts.port}`;
|
|
353
|
+
const platform = process.platform;
|
|
354
|
+
if (platform === 'darwin') {
|
|
355
|
+
exec(`open "${canvasUrl}"`);
|
|
356
|
+
} else if (platform === 'linux') {
|
|
357
|
+
exec(`xdg-open "${canvasUrl}"`);
|
|
358
|
+
} else if (platform === 'win32') {
|
|
359
|
+
exec(`start "" "${canvasUrl}"`);
|
|
360
|
+
}
|
|
361
|
+
console.log(chalk.dim(` Canvas: ${canvasUrl}`));
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
// 5. Launch
|
|
337
365
|
console.log(chalk.green('Launching Claude Code with ClaudeTeach...'));
|
|
338
366
|
console.log(chalk.dim(` Plugin: ${pluginDir}`));
|
|
339
367
|
|
|
340
|
-
const claudeArgs = [
|
|
368
|
+
const claudeArgs = [
|
|
369
|
+
'--plugin-dir', pluginDir,
|
|
370
|
+
'--allowedTools', 'Bash(*),Read,Write,Edit,Glob,Grep',
|
|
371
|
+
...cmd.args,
|
|
372
|
+
];
|
|
341
373
|
const child = spawn('claude', claudeArgs, { stdio: 'inherit' });
|
|
342
374
|
|
|
343
375
|
child.on('error', (err) => {
|