@shaykec/claude-teach 0.6.7 → 0.6.9
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.e2e.test.js +3 -3
- package/src/cli.js +42 -28
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shaykec/claude-teach",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.9",
|
|
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.4.
|
|
18
|
+
"@shaykec/bridge": "0.4.10",
|
|
19
19
|
"@shaykec/shared": "0.1.3",
|
|
20
20
|
"@shaykec/plugin": "0.2.12",
|
|
21
21
|
"@shaykec/extension": "0.1.0"
|
package/src/cli.e2e.test.js
CHANGED
|
@@ -674,7 +674,7 @@ describe('CLI E2E: Setup command', () => {
|
|
|
674
674
|
const { stdout, exitCode } = runCli(['start', '--help']);
|
|
675
675
|
expect(exitCode).toBe(0);
|
|
676
676
|
const clean = stripAnsi(stdout);
|
|
677
|
-
expect(clean).toContain('Launch
|
|
677
|
+
expect(clean).toContain('Launch ClaudeTeach');
|
|
678
678
|
expect(clean).toContain('--no-server');
|
|
679
679
|
expect(clean).toContain('--port');
|
|
680
680
|
});
|
|
@@ -881,7 +881,7 @@ describe('CLI E2E: Subcommand help texts', () => {
|
|
|
881
881
|
{ args: ['level-up', '--help'], contains: 'belt roadmap' },
|
|
882
882
|
{ args: ['serve', '--help'], contains: 'bridge server' },
|
|
883
883
|
{ args: ['inbox', '--help'], contains: 'captured from the browser' },
|
|
884
|
-
{ args: ['start', '--help'], contains: 'Launch
|
|
884
|
+
{ args: ['start', '--help'], contains: 'Launch ClaudeTeach' },
|
|
885
885
|
{ args: ['setup', '--help'], contains: 'Check environment' },
|
|
886
886
|
{ args: ['registry:build', '--help'], contains: 'Rebuild the module registry' },
|
|
887
887
|
{ args: ['install', '--help'], contains: 'Install a module pack' },
|
|
@@ -916,7 +916,7 @@ describe('CLI E2E: npx comprehensive', () => {
|
|
|
916
916
|
it('npx start --help shows launch description', () => {
|
|
917
917
|
const { stdout, exitCode } = runNpx(['start', '--help'], { timeout: 60000 });
|
|
918
918
|
expect(exitCode).toBe(0);
|
|
919
|
-
expect(stripAnsi(stdout)).toContain('Launch
|
|
919
|
+
expect(stripAnsi(stdout)).toContain('Launch ClaudeTeach');
|
|
920
920
|
});
|
|
921
921
|
|
|
922
922
|
it('npx setup --help shows setup options', () => {
|
package/src/cli.js
CHANGED
|
@@ -435,7 +435,8 @@ program
|
|
|
435
435
|
// --- start ---
|
|
436
436
|
program
|
|
437
437
|
.command('start')
|
|
438
|
-
.description('Launch
|
|
438
|
+
.description('Launch ClaudeTeach — browser chat by default, or --terminal for CLI mode')
|
|
439
|
+
.option('--terminal', 'Use terminal CLI mode instead of browser chat')
|
|
439
440
|
.option('--no-server', 'Skip starting the bridge server')
|
|
440
441
|
.option('--no-browser', 'Skip opening the canvas in the browser')
|
|
441
442
|
.option('--port <port>', 'Bridge server port', '3456')
|
|
@@ -470,10 +471,10 @@ program
|
|
|
470
471
|
server = await new Promise((resolve, reject) => {
|
|
471
472
|
const srv = startServer({
|
|
472
473
|
port,
|
|
474
|
+
pluginDir,
|
|
473
475
|
progressProvider: { getProgress: () => loadProgress(ROOT) },
|
|
474
476
|
onReady: () => resolve(srv),
|
|
475
477
|
});
|
|
476
|
-
// Handle port-in-use and other startup errors
|
|
477
478
|
srv.server.on('error', (err) => {
|
|
478
479
|
if (err.code === 'EADDRINUSE') {
|
|
479
480
|
reject(new Error(`Port ${port} is already in use. Kill the old process or use --port <other>`));
|
|
@@ -492,38 +493,51 @@ program
|
|
|
492
493
|
// 4. Open canvas in browser (unless --no-browser or --no-server)
|
|
493
494
|
if (server && opts.browser !== false) {
|
|
494
495
|
const canvasUrl = `http://localhost:${opts.port}`;
|
|
495
|
-
|
|
496
|
-
if (platform === 'darwin') {
|
|
497
|
-
exec(`open "${canvasUrl}"`);
|
|
498
|
-
} else if (platform === 'linux') {
|
|
499
|
-
exec(`xdg-open "${canvasUrl}"`);
|
|
500
|
-
} else if (platform === 'win32') {
|
|
501
|
-
exec(`start "" "${canvasUrl}"`);
|
|
502
|
-
}
|
|
496
|
+
openUrl(canvasUrl);
|
|
503
497
|
console.log(chalk.dim(` Canvas: ${canvasUrl}`));
|
|
504
498
|
}
|
|
505
499
|
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
500
|
+
if (opts.terminal) {
|
|
501
|
+
// --- Terminal mode: spawn Claude Code with stdio: 'inherit' (legacy) ---
|
|
502
|
+
console.log(chalk.green('Launching Claude Code in terminal mode...'));
|
|
503
|
+
console.log(chalk.dim(` Plugin: ${pluginDir}`));
|
|
509
504
|
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
505
|
+
const claudeArgs = [
|
|
506
|
+
'--plugin-dir', pluginDir,
|
|
507
|
+
'--allowedTools', 'Bash(*),Read,Write,Edit,Glob,Grep',
|
|
508
|
+
...cmd.args,
|
|
509
|
+
];
|
|
510
|
+
const child = spawn('claude', claudeArgs, { stdio: 'inherit' });
|
|
516
511
|
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
512
|
+
child.on('error', (err) => {
|
|
513
|
+
console.error(chalk.red(`Failed to start Claude Code: ${err.message}`));
|
|
514
|
+
if (server) server.close();
|
|
515
|
+
process.exit(1);
|
|
516
|
+
});
|
|
522
517
|
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
518
|
+
child.on('close', (code) => {
|
|
519
|
+
if (server) server.close();
|
|
520
|
+
process.exit(code ?? 0);
|
|
521
|
+
});
|
|
522
|
+
} else {
|
|
523
|
+
// --- Browser chat mode (default): Claude runs via SDK in the bridge ---
|
|
524
|
+
console.log(chalk.green('ClaudeTeach is ready — chat in your browser!'));
|
|
525
|
+
console.log(chalk.dim(` Plugin: ${pluginDir}`));
|
|
526
|
+
console.log(chalk.dim(` Claude Code runs via the Agent SDK (no terminal TTY)`));
|
|
527
|
+
console.log(chalk.dim(` Use --terminal flag for classic CLI mode`));
|
|
528
|
+
|
|
529
|
+
// Keep the process alive — the bridge server handles everything.
|
|
530
|
+
// On SIGINT, clean up and exit.
|
|
531
|
+
process.on('SIGINT', () => {
|
|
532
|
+
console.log(chalk.dim('\nShutting down...'));
|
|
533
|
+
if (server) server.close();
|
|
534
|
+
process.exit(0);
|
|
535
|
+
});
|
|
536
|
+
process.on('SIGTERM', () => {
|
|
537
|
+
if (server) server.close();
|
|
538
|
+
process.exit(0);
|
|
539
|
+
});
|
|
540
|
+
}
|
|
527
541
|
});
|
|
528
542
|
|
|
529
543
|
// --- setup ---
|