smash-os-install 0.2.0 → 0.2.2
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/install.mjs +90 -0
- package/package.json +1 -1
package/install.mjs
CHANGED
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'fs';
|
|
24
24
|
import { join, dirname, basename } from 'path';
|
|
25
25
|
import { homedir } from 'os';
|
|
26
|
+
import { execSync } from 'child_process';
|
|
26
27
|
import prompts from 'prompts';
|
|
27
28
|
import chalk from 'chalk';
|
|
28
29
|
|
|
@@ -455,6 +456,95 @@ After every completed session, append decisions and lessons to the relevant memo
|
|
|
455
456
|
console.log(chalk.dim(' Fill in the ai/context/ files with your project details,'));
|
|
456
457
|
console.log(chalk.dim(' then Claude Code will load them automatically every session.'));
|
|
457
458
|
console.log('');
|
|
459
|
+
|
|
460
|
+
// ─── MCP Installation ───────────────────────────────────────────────────────
|
|
461
|
+
|
|
462
|
+
const MCP_SERVERS = [
|
|
463
|
+
{
|
|
464
|
+
name: 'jcodemunch',
|
|
465
|
+
title: 'jcodemunch — code intelligence (search, navigate, refactor)',
|
|
466
|
+
cmd: 'claude mcp add jcodemunch --transport stdio -- uvx jcodemunch-mcp',
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
name: 'jdocmunch',
|
|
470
|
+
title: 'jdocmunch — documentation intelligence (index + search docs)',
|
|
471
|
+
cmd: 'claude mcp add jdocmunch --transport stdio -- uvx jdocmunch-mcp',
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
name: 'context7',
|
|
475
|
+
title: 'context7 — live library docs for any npm/pip package',
|
|
476
|
+
cmd: null, // built dynamically — requires API key prompt
|
|
477
|
+
promptKey: true,
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
name: 'chrome-devtools',
|
|
481
|
+
title: 'chrome-devtools — browser automation and debugging',
|
|
482
|
+
cmd: 'claude mcp add chrome-devtools --transport stdio -- npx -y chrome-devtools-mcp@latest',
|
|
483
|
+
},
|
|
484
|
+
];
|
|
485
|
+
|
|
486
|
+
// Check which MCPs are already installed
|
|
487
|
+
let alreadyInstalled = new Set();
|
|
488
|
+
try {
|
|
489
|
+
const out = execSync('claude mcp list', { encoding: 'utf8', stdio: ['pipe','pipe','pipe'] });
|
|
490
|
+
for (const s of MCP_SERVERS) {
|
|
491
|
+
if (out.includes(s.name)) alreadyInstalled.add(s.name);
|
|
492
|
+
}
|
|
493
|
+
} catch { /* claude CLI not available — skip pre-check */ }
|
|
494
|
+
|
|
495
|
+
const available = MCP_SERVERS.filter(s => !alreadyInstalled.has(s.name));
|
|
496
|
+
|
|
497
|
+
if (alreadyInstalled.size > 0) {
|
|
498
|
+
console.log(chalk.dim(` Already installed: ${[...alreadyInstalled].join(', ')}`));
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
if (available.length > 0) {
|
|
502
|
+
console.log(chalk.bold(' MCP Servers'));
|
|
503
|
+
console.log(chalk.dim(' These extend Claude Code with code intelligence and browser tools.'));
|
|
504
|
+
console.log('');
|
|
505
|
+
|
|
506
|
+
const { mcpChoices } = await prompts({
|
|
507
|
+
type: 'multiselect',
|
|
508
|
+
name: 'mcpChoices',
|
|
509
|
+
message: 'Select MCP servers to install (space to toggle, enter to confirm)',
|
|
510
|
+
choices: available.map(s => ({ title: s.title, value: s.name, selected: true })),
|
|
511
|
+
hint: '- Space to select. Return to submit',
|
|
512
|
+
}, { onCancel });
|
|
513
|
+
|
|
514
|
+
if (mcpChoices && mcpChoices.length > 0) {
|
|
515
|
+
console.log('');
|
|
516
|
+
|
|
517
|
+
// Resolve context7 API key if selected
|
|
518
|
+
let context7Key = '';
|
|
519
|
+
if (mcpChoices.includes('context7')) {
|
|
520
|
+
const { key } = await prompts({
|
|
521
|
+
type: 'text',
|
|
522
|
+
name: 'key',
|
|
523
|
+
message: 'context7 API key (get one free at context7.com — leave blank to skip key)',
|
|
524
|
+
}, { onCancel });
|
|
525
|
+
context7Key = key || '';
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
for (const name of mcpChoices) {
|
|
529
|
+
const server = MCP_SERVERS.find(s => s.name === name);
|
|
530
|
+
let cmd = server.cmd;
|
|
531
|
+
if (name === 'context7') {
|
|
532
|
+
cmd = context7Key
|
|
533
|
+
? `claude mcp add context7 --transport http https://mcp.context7.com/mcp -H "CONTEXT7_API_KEY: ${context7Key}"`
|
|
534
|
+
: 'claude mcp add context7 --transport http https://mcp.context7.com/mcp';
|
|
535
|
+
}
|
|
536
|
+
try {
|
|
537
|
+
execSync(cmd, { stdio: 'pipe' });
|
|
538
|
+
console.log(' ' + chalk.green('✓') + ' ' + chalk.white(name) + chalk.dim(' installed'));
|
|
539
|
+
} catch (err) {
|
|
540
|
+
console.log(' ' + chalk.red('✗') + ' ' + chalk.white(name) + chalk.dim(` — ${err.message.split('\n')[0]}`));
|
|
541
|
+
console.log(' ' + chalk.dim(`Run manually: ${cmd}`));
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
console.log('');
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
|
|
458
548
|
process.exit(0);
|
|
459
549
|
}
|
|
460
550
|
|