@hybridlabor-api/bdb-antigravity-skills 1.1.3 → 1.1.4
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/installer.js +73 -36
- package/package.json +1 -1
package/installer.js
CHANGED
|
@@ -46,17 +46,23 @@ const isAutoYes = process.argv.includes('-y') || process.argv.includes('--yes');
|
|
|
46
46
|
|
|
47
47
|
function promptMode(callback) {
|
|
48
48
|
if (isAutoYes) {
|
|
49
|
-
return callback('1'
|
|
49
|
+
return callback({ mode: '1', platform: '1' });
|
|
50
50
|
}
|
|
51
|
-
console.log("\
|
|
52
|
-
console.log(" (1)
|
|
53
|
-
console.log(" (2)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
51
|
+
console.log("\nTarget AI Platform:");
|
|
52
|
+
console.log(" (1) Google Antigravity (Default)");
|
|
53
|
+
console.log(" (2) Claude Desktop / Claude Code");
|
|
54
|
+
console.log(" (3) Cursor / Generic IDE");
|
|
55
|
+
|
|
56
|
+
rl.question("\nSelect platform [1/2/3]: ", (platformAns) => {
|
|
57
|
+
const platform = platformAns.trim() || '1';
|
|
58
|
+
|
|
59
|
+
console.log("\nInstallation Mode:");
|
|
60
|
+
console.log(" (1) Merge: Keep your existing skills/MCPs and add/update BDB tools.");
|
|
61
|
+
console.log(" (2) Replace: Backup and wipe your existing skills/MCPs, installing ONLY BDB tools.");
|
|
62
|
+
rl.question("\nSelect mode [1/2]: ", (modeAns) => {
|
|
63
|
+
const mode = modeAns.trim() === '2' ? '2' : '1';
|
|
64
|
+
callback({ mode, platform });
|
|
65
|
+
});
|
|
60
66
|
});
|
|
61
67
|
}
|
|
62
68
|
|
|
@@ -93,71 +99,102 @@ function copyDirRecursiveSync(source, target) {
|
|
|
93
99
|
});
|
|
94
100
|
}
|
|
95
101
|
|
|
96
|
-
promptMode((mode) => {
|
|
102
|
+
promptMode(({ mode, platform }) => {
|
|
97
103
|
fs.mkdirSync(backupDir, { recursive: true });
|
|
104
|
+
|
|
105
|
+
let targetSkillDir = globalConfigDir;
|
|
106
|
+
let targetLegacyDir = globalLegacyDir;
|
|
107
|
+
let targetWorkspaceDir = workspaceDir;
|
|
108
|
+
let targetMcpDir = path.join(geminiDir, 'config');
|
|
109
|
+
let mcpConfigPath = path.join(targetMcpDir, 'mcp_config.json');
|
|
110
|
+
|
|
111
|
+
if (platform === '2') {
|
|
112
|
+
// Claude Desktop
|
|
113
|
+
console.log("\n[Platform: Claude Desktop] Adapting installation paths...");
|
|
114
|
+
targetSkillDir = path.join(homeDir, '.bdb-skills');
|
|
115
|
+
targetLegacyDir = path.join(homeDir, '.bdb-skills', 'legacy');
|
|
116
|
+
|
|
117
|
+
let claudeAppSupport = process.platform === 'win32'
|
|
118
|
+
? path.join(process.env.APPDATA || homeDir, 'Claude')
|
|
119
|
+
: path.join(homeDir, 'Library', 'Application Support', 'Claude');
|
|
120
|
+
|
|
121
|
+
targetMcpDir = claudeAppSupport;
|
|
122
|
+
mcpConfigPath = path.join(claudeAppSupport, 'claude_desktop_config.json');
|
|
123
|
+
} else if (platform === '3') {
|
|
124
|
+
// Cursor / Generic
|
|
125
|
+
console.log("\n[Platform: Cursor / Generic IDE] Adapting installation paths...");
|
|
126
|
+
targetSkillDir = path.join(currentDir, '.cursor', 'bdb-skills');
|
|
127
|
+
targetLegacyDir = path.join(currentDir, '.cursor', 'bdb-skills', 'legacy');
|
|
128
|
+
targetWorkspaceDir = path.join(currentDir, '.cursor', 'workspace_skills');
|
|
129
|
+
targetMcpDir = path.join(currentDir, '.cursor');
|
|
130
|
+
mcpConfigPath = path.join(targetMcpDir, 'mcp.json');
|
|
131
|
+
}
|
|
98
132
|
|
|
99
133
|
if (mode === '2') {
|
|
100
134
|
console.log(`\n[Replace Mode] Creating backup of current skills in ${backupDir}...`);
|
|
101
|
-
moveIfExists(
|
|
102
|
-
moveIfExists(
|
|
103
|
-
moveIfExists(
|
|
135
|
+
moveIfExists(targetSkillDir, path.join(backupDir, 'config_skills_backup'), 'global config skills');
|
|
136
|
+
moveIfExists(targetLegacyDir, path.join(backupDir, 'legacy_skills_backup'), 'global legacy skills');
|
|
137
|
+
moveIfExists(targetWorkspaceDir, path.join(backupDir, 'workspace_skills_backup'), 'workspace skills');
|
|
104
138
|
} else {
|
|
105
139
|
console.log(`\n[Merge Mode] Installing over existing directories. Existing skills will not be deleted.`);
|
|
106
140
|
}
|
|
107
141
|
|
|
108
142
|
console.log("\nInstalling optimized skills (140 curated skills)...");
|
|
109
|
-
fs.mkdirSync(
|
|
110
|
-
fs.mkdirSync(
|
|
111
|
-
fs.mkdirSync(
|
|
143
|
+
fs.mkdirSync(targetSkillDir, { recursive: true });
|
|
144
|
+
fs.mkdirSync(targetLegacyDir, { recursive: true });
|
|
145
|
+
fs.mkdirSync(targetWorkspaceDir, { recursive: true });
|
|
112
146
|
|
|
113
|
-
copyDirRecursiveSync(path.join(srcDir, 'skills', 'global_config'),
|
|
147
|
+
copyDirRecursiveSync(path.join(srcDir, 'skills', 'global_config'), targetSkillDir);
|
|
114
148
|
console.log(" -> Installed global config skills.");
|
|
115
149
|
|
|
116
|
-
copyDirRecursiveSync(path.join(srcDir, 'skills', 'global_legacy'),
|
|
150
|
+
copyDirRecursiveSync(path.join(srcDir, 'skills', 'global_legacy'), targetLegacyDir);
|
|
117
151
|
console.log(" -> Installed global legacy skills.");
|
|
118
152
|
|
|
119
|
-
copyDirRecursiveSync(path.join(srcDir, 'skills', 'workspace_agents'),
|
|
153
|
+
copyDirRecursiveSync(path.join(srcDir, 'skills', 'workspace_agents'), targetWorkspaceDir);
|
|
120
154
|
console.log(" -> Installed workspace skills.");
|
|
121
155
|
|
|
122
156
|
const geminiMdSrc = path.join(srcDir, 'GEMINI.md');
|
|
123
|
-
if (fs.existsSync(geminiMdSrc)) {
|
|
157
|
+
if (platform === '1' && fs.existsSync(geminiMdSrc)) {
|
|
124
158
|
fs.copyFileSync(geminiMdSrc, path.join(geminiDir, 'GEMINI.md'));
|
|
125
159
|
console.log(` -> Installed GEMINI.md to ${path.join(geminiDir, 'GEMINI.md')}`);
|
|
126
160
|
}
|
|
127
161
|
|
|
128
162
|
promptMCP((answer) => {
|
|
129
163
|
if (answer.toLowerCase().startsWith('y')) {
|
|
130
|
-
|
|
131
|
-
fs.mkdirSync(configDir, { recursive: true });
|
|
164
|
+
fs.mkdirSync(targetMcpDir, { recursive: true });
|
|
132
165
|
|
|
133
|
-
const mcpCodeTarget = path.join(
|
|
166
|
+
const mcpCodeTarget = path.join(targetMcpDir, 'mcps');
|
|
134
167
|
copyDirRecursiveSync(path.join(srcDir, 'mcps'), mcpCodeTarget);
|
|
135
168
|
console.log(` -> Installed local MCP servers to ${mcpCodeTarget}`);
|
|
136
169
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
console.log(" -> Backed up existing mcp_config.json");
|
|
170
|
+
if (fs.existsSync(mcpConfigPath)) {
|
|
171
|
+
fs.copyFileSync(mcpConfigPath, path.join(backupDir, 'mcp_config_backup.json'));
|
|
172
|
+
console.log(` -> Backed up existing ${path.basename(mcpConfigPath)}`);
|
|
141
173
|
}
|
|
142
174
|
|
|
143
175
|
let mcpConfigStr = fs.readFileSync(path.join(srcDir, 'mcp_config.json'), 'utf8');
|
|
144
176
|
mcpConfigStr = mcpConfigStr.replace(/__MCPS_DIR__/g, mcpCodeTarget);
|
|
145
177
|
mcpConfigStr = mcpConfigStr.replace(/\{\{HOME\}\}/g, homeDir);
|
|
146
178
|
|
|
147
|
-
if (mode === '1' && fs.existsSync(
|
|
179
|
+
if (mode === '1' && fs.existsSync(mcpConfigPath)) {
|
|
148
180
|
try {
|
|
149
|
-
const oldConfig = JSON.parse(fs.readFileSync(
|
|
181
|
+
const oldConfig = JSON.parse(fs.readFileSync(mcpConfigPath, 'utf8'));
|
|
150
182
|
const newConfig = JSON.parse(mcpConfigStr);
|
|
151
183
|
oldConfig.mcpServers = Object.assign({}, oldConfig.mcpServers || {}, newConfig.mcpServers || {});
|
|
152
|
-
fs.writeFileSync(
|
|
153
|
-
console.log(` -> Merged BDB MCPs into existing
|
|
184
|
+
fs.writeFileSync(mcpConfigPath, JSON.stringify(oldConfig, null, 2));
|
|
185
|
+
console.log(` -> Merged BDB MCPs into existing ${path.basename(mcpConfigPath)}`);
|
|
154
186
|
} catch (e) {
|
|
155
|
-
console.log(` -> Failed to parse existing JSON, overwriting
|
|
156
|
-
fs.writeFileSync(
|
|
187
|
+
console.log(` -> Failed to parse existing JSON, overwriting ${path.basename(mcpConfigPath)}`);
|
|
188
|
+
fs.writeFileSync(mcpConfigPath, mcpConfigStr);
|
|
157
189
|
}
|
|
158
190
|
} else {
|
|
159
|
-
fs.
|
|
160
|
-
|
|
191
|
+
if (platform === '2' && !fs.existsSync(mcpConfigPath)) {
|
|
192
|
+
const wrapper = { mcpServers: JSON.parse(mcpConfigStr).mcpServers };
|
|
193
|
+
fs.writeFileSync(mcpConfigPath, JSON.stringify(wrapper, null, 2));
|
|
194
|
+
} else {
|
|
195
|
+
fs.writeFileSync(mcpConfigPath, mcpConfigStr);
|
|
196
|
+
}
|
|
197
|
+
console.log(` -> Installed optimized MCP config to ${targetMcpDir}`);
|
|
161
198
|
}
|
|
162
199
|
} else {
|
|
163
200
|
console.log(" -> Skipping MCP installation.");
|