@codebakers/cli 3.8.5 → 3.8.6
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/dist/commands/init.js +56 -2
- package/package.json +1 -1
- package/src/commands/init.ts +58 -2
package/dist/commands/init.js
CHANGED
|
@@ -684,6 +684,58 @@ function setupCursorIDE(cwd) {
|
|
|
684
684
|
spinner.warn('Could not configure Cursor IDE (continuing anyway)');
|
|
685
685
|
}
|
|
686
686
|
}
|
|
687
|
+
function setupClaudeCode() {
|
|
688
|
+
const spinner = (0, ora_1.default)(' Setting up Claude Code MCP...').start();
|
|
689
|
+
try {
|
|
690
|
+
const homeDir = process.env.USERPROFILE || process.env.HOME || '';
|
|
691
|
+
let configPath;
|
|
692
|
+
const isWindows = process.platform === 'win32';
|
|
693
|
+
// Determine config path based on platform
|
|
694
|
+
if (isWindows) {
|
|
695
|
+
configPath = (0, path_1.join)(homeDir, 'AppData', 'Roaming', 'Claude', 'claude_desktop_config.json');
|
|
696
|
+
}
|
|
697
|
+
else if (process.platform === 'darwin') {
|
|
698
|
+
configPath = (0, path_1.join)(homeDir, 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json');
|
|
699
|
+
}
|
|
700
|
+
else {
|
|
701
|
+
configPath = (0, path_1.join)(homeDir, '.config', 'claude', 'claude_desktop_config.json');
|
|
702
|
+
}
|
|
703
|
+
// Ensure directory exists
|
|
704
|
+
const configDir = (0, path_1.join)(configPath, '..');
|
|
705
|
+
if (!(0, fs_1.existsSync)(configDir)) {
|
|
706
|
+
(0, fs_1.mkdirSync)(configDir, { recursive: true });
|
|
707
|
+
}
|
|
708
|
+
// MCP config for Claude Code
|
|
709
|
+
const mcpConfig = {
|
|
710
|
+
mcpServers: {
|
|
711
|
+
codebakers: isWindows
|
|
712
|
+
? { command: 'cmd', args: ['/c', 'npx', '-y', '@codebakers/cli', 'serve'] }
|
|
713
|
+
: { command: 'npx', args: ['-y', '@codebakers/cli', 'serve'] }
|
|
714
|
+
}
|
|
715
|
+
};
|
|
716
|
+
// Read existing or create new
|
|
717
|
+
if ((0, fs_1.existsSync)(configPath)) {
|
|
718
|
+
try {
|
|
719
|
+
const existing = JSON.parse((0, fs_1.readFileSync)(configPath, 'utf-8'));
|
|
720
|
+
if (!existing.mcpServers) {
|
|
721
|
+
existing.mcpServers = {};
|
|
722
|
+
}
|
|
723
|
+
existing.mcpServers.codebakers = mcpConfig.mcpServers.codebakers;
|
|
724
|
+
(0, fs_1.writeFileSync)(configPath, JSON.stringify(existing, null, 2));
|
|
725
|
+
}
|
|
726
|
+
catch {
|
|
727
|
+
(0, fs_1.writeFileSync)(configPath, JSON.stringify(mcpConfig, null, 2));
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
else {
|
|
731
|
+
(0, fs_1.writeFileSync)(configPath, JSON.stringify(mcpConfig, null, 2));
|
|
732
|
+
}
|
|
733
|
+
spinner.succeed('Claude Code MCP configured!');
|
|
734
|
+
}
|
|
735
|
+
catch {
|
|
736
|
+
spinner.warn('Could not configure Claude Code MCP (continuing anyway)');
|
|
737
|
+
}
|
|
738
|
+
}
|
|
687
739
|
function updateGitignore(cwd) {
|
|
688
740
|
const gitignorePath = (0, path_1.join)(cwd, '.gitignore');
|
|
689
741
|
if ((0, fs_1.existsSync)(gitignorePath)) {
|
|
@@ -754,9 +806,10 @@ async function initNewProject(cwd) {
|
|
|
754
806
|
// Create tracking files
|
|
755
807
|
const structure = buildStructureString(cwd);
|
|
756
808
|
createTrackingFiles(cwd, projectName, {}, structure, false);
|
|
757
|
-
// Setup
|
|
809
|
+
// Setup IDEs and MCP
|
|
758
810
|
console.log('');
|
|
759
811
|
setupCursorIDE(cwd);
|
|
812
|
+
setupClaudeCode();
|
|
760
813
|
// Update .gitignore
|
|
761
814
|
updateGitignore(cwd);
|
|
762
815
|
// How to describe project
|
|
@@ -902,9 +955,10 @@ async function initExistingProject(cwd, projectInfo) {
|
|
|
902
955
|
// Create tracking files with detected stack
|
|
903
956
|
const structure = buildStructureString(cwd);
|
|
904
957
|
createTrackingFiles(cwd, projectName, projectInfo.stack, structure, true, auditScore);
|
|
905
|
-
// Setup
|
|
958
|
+
// Setup IDEs and MCP
|
|
906
959
|
console.log('');
|
|
907
960
|
setupCursorIDE(cwd);
|
|
961
|
+
setupClaudeCode();
|
|
908
962
|
// Update .gitignore
|
|
909
963
|
updateGitignore(cwd);
|
|
910
964
|
// Success
|
package/package.json
CHANGED
package/src/commands/init.ts
CHANGED
|
@@ -739,6 +739,60 @@ function setupCursorIDE(cwd: string): void {
|
|
|
739
739
|
}
|
|
740
740
|
}
|
|
741
741
|
|
|
742
|
+
function setupClaudeCode(): void {
|
|
743
|
+
const spinner = ora(' Setting up Claude Code MCP...').start();
|
|
744
|
+
|
|
745
|
+
try {
|
|
746
|
+
const homeDir = process.env.USERPROFILE || process.env.HOME || '';
|
|
747
|
+
let configPath: string;
|
|
748
|
+
const isWindows = process.platform === 'win32';
|
|
749
|
+
|
|
750
|
+
// Determine config path based on platform
|
|
751
|
+
if (isWindows) {
|
|
752
|
+
configPath = join(homeDir, 'AppData', 'Roaming', 'Claude', 'claude_desktop_config.json');
|
|
753
|
+
} else if (process.platform === 'darwin') {
|
|
754
|
+
configPath = join(homeDir, 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json');
|
|
755
|
+
} else {
|
|
756
|
+
configPath = join(homeDir, '.config', 'claude', 'claude_desktop_config.json');
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
// Ensure directory exists
|
|
760
|
+
const configDir = join(configPath, '..');
|
|
761
|
+
if (!existsSync(configDir)) {
|
|
762
|
+
mkdirSync(configDir, { recursive: true });
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
// MCP config for Claude Code
|
|
766
|
+
const mcpConfig = {
|
|
767
|
+
mcpServers: {
|
|
768
|
+
codebakers: isWindows
|
|
769
|
+
? { command: 'cmd', args: ['/c', 'npx', '-y', '@codebakers/cli', 'serve'] }
|
|
770
|
+
: { command: 'npx', args: ['-y', '@codebakers/cli', 'serve'] }
|
|
771
|
+
}
|
|
772
|
+
};
|
|
773
|
+
|
|
774
|
+
// Read existing or create new
|
|
775
|
+
if (existsSync(configPath)) {
|
|
776
|
+
try {
|
|
777
|
+
const existing = JSON.parse(readFileSync(configPath, 'utf-8'));
|
|
778
|
+
if (!existing.mcpServers) {
|
|
779
|
+
existing.mcpServers = {};
|
|
780
|
+
}
|
|
781
|
+
existing.mcpServers.codebakers = mcpConfig.mcpServers.codebakers;
|
|
782
|
+
writeFileSync(configPath, JSON.stringify(existing, null, 2));
|
|
783
|
+
} catch {
|
|
784
|
+
writeFileSync(configPath, JSON.stringify(mcpConfig, null, 2));
|
|
785
|
+
}
|
|
786
|
+
} else {
|
|
787
|
+
writeFileSync(configPath, JSON.stringify(mcpConfig, null, 2));
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
spinner.succeed('Claude Code MCP configured!');
|
|
791
|
+
} catch {
|
|
792
|
+
spinner.warn('Could not configure Claude Code MCP (continuing anyway)');
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
|
|
742
796
|
function updateGitignore(cwd: string): void {
|
|
743
797
|
const gitignorePath = join(cwd, '.gitignore');
|
|
744
798
|
if (existsSync(gitignorePath)) {
|
|
@@ -827,9 +881,10 @@ async function initNewProject(cwd: string): Promise<void> {
|
|
|
827
881
|
const structure = buildStructureString(cwd);
|
|
828
882
|
createTrackingFiles(cwd, projectName, {}, structure, false);
|
|
829
883
|
|
|
830
|
-
// Setup
|
|
884
|
+
// Setup IDEs and MCP
|
|
831
885
|
console.log('');
|
|
832
886
|
setupCursorIDE(cwd);
|
|
887
|
+
setupClaudeCode();
|
|
833
888
|
|
|
834
889
|
// Update .gitignore
|
|
835
890
|
updateGitignore(cwd);
|
|
@@ -990,9 +1045,10 @@ async function initExistingProject(cwd: string, projectInfo: ReturnType<typeof d
|
|
|
990
1045
|
const structure = buildStructureString(cwd);
|
|
991
1046
|
createTrackingFiles(cwd, projectName, projectInfo.stack, structure, true, auditScore);
|
|
992
1047
|
|
|
993
|
-
// Setup
|
|
1048
|
+
// Setup IDEs and MCP
|
|
994
1049
|
console.log('');
|
|
995
1050
|
setupCursorIDE(cwd);
|
|
1051
|
+
setupClaudeCode();
|
|
996
1052
|
|
|
997
1053
|
// Update .gitignore
|
|
998
1054
|
updateGitignore(cwd);
|