@codebakers/cli 3.8.5 → 3.8.7
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/go.js +917 -89
- package/dist/commands/init.js +56 -2
- package/package.json +1 -1
- package/src/commands/go.ts +995 -98
- 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
|