claudmax 1.0.3 → 1.0.5
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/index.js +48 -73
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -398,7 +398,8 @@ function installMCPServer() {
|
|
|
398
398
|
console.log(` ${CHECK} ${C.green(MCP_PKG + ' installed successfully.')}`);
|
|
399
399
|
return true;
|
|
400
400
|
} catch (err) {
|
|
401
|
-
|
|
401
|
+
const errMsg = String(err.stderr || err.message || '');
|
|
402
|
+
console.log(` ${WARN} Could not install ${MCP_PKG}: ${C.dim(errMsg.trim())}`);
|
|
402
403
|
console.log(` ${INFO} Install manually later: ${C.bold('npm install -g ' + MCP_PKG)}`);
|
|
403
404
|
return false;
|
|
404
405
|
}
|
|
@@ -407,9 +408,9 @@ function installMCPServer() {
|
|
|
407
408
|
// ── Banner ────────────────────────────────────────────────────────────────────
|
|
408
409
|
function printBanner() {
|
|
409
410
|
console.log('');
|
|
410
|
-
console.log(C.magenta('\u2554' + '\u2550'.repeat(
|
|
411
|
-
console.log(C.magenta('\u2551') + C.bold('
|
|
412
|
-
console.log(C.magenta('\u255A' + '\u2550'.repeat(
|
|
411
|
+
console.log(C.magenta('\u2554' + '\u2550'.repeat(44) + '\u2557'));
|
|
412
|
+
console.log(C.magenta('\u2551') + C.bold(' \u26A1 ClaudMax Setup ') + C.magenta('\u2551'));
|
|
413
|
+
console.log(C.magenta('\u255A' + '\u2550'.repeat(44) + '\u255D'));
|
|
413
414
|
console.log('');
|
|
414
415
|
}
|
|
415
416
|
|
|
@@ -552,30 +553,8 @@ async function main() {
|
|
|
552
553
|
}
|
|
553
554
|
}
|
|
554
555
|
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
console.log(`\n${C.yellow('Git installation failed. You can install it manually.')}`);
|
|
558
|
-
} else {
|
|
559
|
-
gitOk = isCommandAvailable('git');
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
if (nodeOk && !claudeOk) {
|
|
564
|
-
const installClaude = await ask(rl, `\n${WARN} Claude CLI not found. Install it? ${C.bold('[Y/n]: ')}`);
|
|
565
|
-
if (!installClaude || installClaude.toLowerCase() === 'y' || installClaude.toLowerCase() === 'yes') {
|
|
566
|
-
if (!installDep('Claude CLI', installClaudeCLI)) {
|
|
567
|
-
console.log(`\n${C.yellow('Claude CLI installation failed. You can install it with: npm i -g @anthropic-ai/claude-code')}`);
|
|
568
|
-
} else {
|
|
569
|
-
claudeOk = isCommandAvailable('claude');
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
console.log('');
|
|
575
|
-
|
|
576
|
-
// ── Step 2: API key prompt ───────────────────────────────────────────────
|
|
577
|
-
console.log(C.bold('Step 2: Enter your ClaudMax API key\n'));
|
|
578
|
-
console.log('');
|
|
556
|
+
// ── Step 1: API key prompt ───────────────────────────────────────────────
|
|
557
|
+
console.log(C.bold('\nStep 1: Enter your ClaudMax API key\n'));
|
|
579
558
|
|
|
580
559
|
let apiKey = '';
|
|
581
560
|
while (!apiKey.trim()) {
|
|
@@ -587,42 +566,14 @@ async function main() {
|
|
|
587
566
|
apiKey = apiKey.trim();
|
|
588
567
|
console.log('');
|
|
589
568
|
|
|
590
|
-
// ── Step
|
|
591
|
-
console.log(C.bold('Step
|
|
592
|
-
const result = await verifyConnection(apiKey);
|
|
593
|
-
|
|
594
|
-
if (result.ok) {
|
|
595
|
-
const data = result.data;
|
|
596
|
-
if (result.status === 401) {
|
|
597
|
-
console.log(` ${CROSS} ${C.red('Invalid API key. Please check and try again.')}`);
|
|
598
|
-
console.log(` ${INFO} ${C.dim(data.error || 'Authentication failed')}`);
|
|
599
|
-
rl.close();
|
|
600
|
-
process.exit(1);
|
|
601
|
-
} else {
|
|
602
|
-
console.log(` ${CHECK} ${C.green('API key is valid!')}`);
|
|
603
|
-
const tier = (data.tier || 'free').toUpperCase();
|
|
604
|
-
const limit = data.requestsLimit?.toLocaleString() || 'N/A';
|
|
605
|
-
const tokenLimit = data.tokensLimit ? (data.tokensLimit >= 1e9 ? 'Unlimited' : (data.tokensLimit / 1e6).toFixed(0) + 'M tokens/5h') : 'N/A';
|
|
606
|
-
console.log(` ${INFO} Plan: ${C.magenta(tier)} | Requests: ${C.cyan(limit)} | Tokens: ${C.cyan(tokenLimit)}`);
|
|
607
|
-
}
|
|
608
|
-
} else {
|
|
609
|
-
console.log(` ${WARN} ${C.yellow('Could not verify API key (network error). Continuing with setup anyway...')}`);
|
|
610
|
-
console.log(` ${INFO} ${C.dim(result.error || 'Connection failed')}`);
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
// ── Step 4: Configure system ──────────────────────────────────────────────
|
|
614
|
-
console.log('');
|
|
615
|
-
const profile = configureSystem(apiKey);
|
|
616
|
-
|
|
617
|
-
// ── Step 5: IDE selection ─────────────────────────────────────────────────
|
|
618
|
-
console.log('');
|
|
619
|
-
console.log(C.bold('Step 5: Select IDEs to configure\n'));
|
|
569
|
+
// ── Step 2: IDE selection ─────────────────────────────────────────────────
|
|
570
|
+
console.log(C.bold('Step 2: Select IDEs to configure\n'));
|
|
620
571
|
|
|
621
572
|
const IDES = [
|
|
622
|
-
{ id: 1, name: 'Claude Code CLI',
|
|
573
|
+
{ id: 1, name: 'Claude Code (CLI)', shortName: 'Claude Code', configure: configureClaudeCLI },
|
|
623
574
|
{ id: 2, name: 'VS Code (Claude Extension)', shortName: 'VS Code', configure: configureVSCodeClaude },
|
|
624
|
-
{ id: 3, name: 'Cursor',
|
|
625
|
-
{ id: 4, name: 'Windsurf',
|
|
575
|
+
{ id: 3, name: 'Cursor', shortName: 'Cursor', configure: configureCursor },
|
|
576
|
+
{ id: 4, name: 'Windsurf', shortName: 'Windsurf', configure: configureWindsurf },
|
|
626
577
|
{ id: 5, name: 'Cline (VS Code Extension)', shortName: 'Cline', configure: configureCline },
|
|
627
578
|
{ id: 6, name: 'Roo Code (VS Code Extension)', shortName: 'Roo Code', configure: configureRooCode },
|
|
628
579
|
];
|
|
@@ -631,7 +582,7 @@ async function main() {
|
|
|
631
582
|
console.log(` ${C.purple('[' + ide.id + ']')} ${ide.name}`);
|
|
632
583
|
}
|
|
633
584
|
console.log('');
|
|
634
|
-
console.log(` ${C.dim("Enter numbers separated by spaces (e.g. 1 3 4), " + C.bold("'a'") + " for all
|
|
585
|
+
console.log(` ${C.dim("Enter numbers separated by spaces (e.g. 1 3 4), or " + C.bold("'a'") + " for all")}`);
|
|
635
586
|
|
|
636
587
|
const choice = await ask(rl, ` ${C.bold('Your choice')}: `);
|
|
637
588
|
let selectedIds = [];
|
|
@@ -642,42 +593,66 @@ async function main() {
|
|
|
642
593
|
selectedIds = choice.trim().split(/[\s,]+/).map(Number).filter((n) => n >= 1 && n <= IDES.length);
|
|
643
594
|
}
|
|
644
595
|
|
|
596
|
+
console.log('');
|
|
597
|
+
|
|
598
|
+
// ── Configure selected IDEs ──────────────────────────────────────────────
|
|
645
599
|
if (selectedIds.length > 0) {
|
|
646
600
|
const selectedIDEs = IDES.filter((ide) => selectedIds.includes(ide.id));
|
|
647
601
|
for (const ide of selectedIDEs) {
|
|
648
602
|
try {
|
|
649
603
|
ide.configure(apiKey);
|
|
650
604
|
} catch (err) {
|
|
651
|
-
console.log(` ${CROSS} Failed to configure ${ide.name}: ${err.message}`);
|
|
605
|
+
console.log(` ${CROSS} Failed to configure ${ide.name}: ${String(err.message || err)}`);
|
|
652
606
|
}
|
|
653
607
|
}
|
|
654
608
|
} else {
|
|
655
|
-
console.log(
|
|
609
|
+
console.log(` ${WARN} ${C.yellow('No IDEs selected. Skipping IDE configuration.')}`);
|
|
656
610
|
}
|
|
657
611
|
|
|
658
|
-
// ──
|
|
612
|
+
// ── Install MCP server ───────────────────────────────────────────────────
|
|
659
613
|
installMCPServer();
|
|
660
614
|
|
|
615
|
+
// ── Verify connection ─────────────────────────────────────────────────────
|
|
616
|
+
console.log(`\n${ARROW} ${C.bold('Verifying connection to ClaudMax API...')}`);
|
|
617
|
+
const result = await verifyConnection(apiKey);
|
|
618
|
+
|
|
619
|
+
if (result.ok) {
|
|
620
|
+
const data = result.data;
|
|
621
|
+
if (result.status === 401) {
|
|
622
|
+
console.log(` ${CROSS} ${C.red('Invalid API key. Please check and try again.')}`);
|
|
623
|
+
console.log(` ${INFO} ${C.dim(data.error || 'Authentication failed')}`);
|
|
624
|
+
rl.close();
|
|
625
|
+
process.exit(1);
|
|
626
|
+
} else {
|
|
627
|
+
console.log(` ${CHECK} ${C.green('Connected — API key is valid.')}`);
|
|
628
|
+
const tier = (data.tier || 'free').toUpperCase();
|
|
629
|
+
const limit = data.requestsLimit?.toLocaleString() || 'N/A';
|
|
630
|
+
const tokenLimit = data.tokensLimit ? (data.tokensLimit >= 1e9 ? 'Unlimited' : (data.tokensLimit / 1e6).toFixed(0) + 'M tokens/5h') : 'N/A';
|
|
631
|
+
console.log(` ${INFO} Plan: ${C.magenta(tier)} | Requests: ${C.cyan(limit)} | Tokens: ${C.cyan(tokenLimit)}`);
|
|
632
|
+
}
|
|
633
|
+
} else {
|
|
634
|
+
console.log(` ${WARN} ${C.yellow('Could not verify API key (network error).')}`);
|
|
635
|
+
console.log(` ${INFO} ${C.dim(result.error || 'Connection failed')}`);
|
|
636
|
+
}
|
|
637
|
+
|
|
661
638
|
// ── Summary ───────────────────────────────────────────────────────────────
|
|
662
639
|
console.log('');
|
|
663
|
-
console.log(C.magenta('\u2554' + '\u2550'.repeat(
|
|
664
|
-
console.log(C.magenta('\u2551') + C.bold(' \u2713 Setup complete!
|
|
665
|
-
console.log(C.magenta('\u2551') + C.green('
|
|
666
|
-
console.log(C.magenta('\u255A' + '\u2550'.repeat(
|
|
640
|
+
console.log(C.magenta('\u2554' + '\u2550'.repeat(44) + '\u2557'));
|
|
641
|
+
console.log(C.magenta('\u2551') + C.bold(' \u2713 Setup complete! ') + C.magenta('\u2551'));
|
|
642
|
+
console.log(C.magenta('\u2551') + C.green(' Restart your IDE(s) to apply. ') + C.magenta('\u2551'));
|
|
643
|
+
console.log(C.magenta('\u255A' + '\u2550'.repeat(44) + '\u255D'));
|
|
667
644
|
console.log('');
|
|
668
645
|
console.log(` ${INFO} ${C.bold('Next steps:')}`);
|
|
669
|
-
console.log(` 1. ${C.dim('
|
|
646
|
+
console.log(` 1. ${C.dim('Restart your IDE(s) to apply.')}`);
|
|
670
647
|
console.log(` 2. ${C.dim('Verify with:')} ${C.bold('claude --version')}`);
|
|
671
648
|
console.log(` 3. ${C.dim('Start chatting:')} ${C.bold('claude')}`);
|
|
672
649
|
console.log(` 4. ${C.dim('Check usage:')} ${C.bold('npx claudmax status')}`);
|
|
673
650
|
console.log('');
|
|
674
|
-
console.log(` ${INFO} Config saved at: ${C.magenta(CONFIG_FILE)}`);
|
|
675
|
-
console.log('');
|
|
676
651
|
|
|
677
652
|
rl.close();
|
|
678
653
|
}
|
|
679
654
|
|
|
680
655
|
main().catch((err) => {
|
|
681
|
-
console.error('\n' + C.red('\u2717 Fatal error: ' + err.message));
|
|
656
|
+
console.error('\n' + C.red('\u2717 Fatal error: ' + String(err.message || err)));
|
|
682
657
|
process.exit(1);
|
|
683
658
|
});
|
package/package.json
CHANGED