spritecook-mcp 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/package.json +1 -1
- package/src/editors.mjs +67 -0
- package/src/setup.mjs +2 -1
package/package.json
CHANGED
package/src/editors.mjs
CHANGED
|
@@ -62,6 +62,18 @@ export function readExistingKey() {
|
|
|
62
62
|
}
|
|
63
63
|
} catch { /* ignore */ }
|
|
64
64
|
|
|
65
|
+
// Check Antigravity
|
|
66
|
+
try {
|
|
67
|
+
const antigravityPath = getAntigravityConfigPath();
|
|
68
|
+
if (antigravityPath && existsSync(antigravityPath)) {
|
|
69
|
+
const config = JSON.parse(readFileSync(antigravityPath, 'utf-8'));
|
|
70
|
+
const auth = config?.mcpServers?.spritecook?.headers?.Authorization;
|
|
71
|
+
if (auth && auth.startsWith('Bearer sc_live_')) {
|
|
72
|
+
return auth.replace('Bearer ', '');
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
} catch { /* ignore */ }
|
|
76
|
+
|
|
65
77
|
return null;
|
|
66
78
|
}
|
|
67
79
|
|
|
@@ -79,6 +91,17 @@ function isRunningInCursor() {
|
|
|
79
91
|
return false;
|
|
80
92
|
}
|
|
81
93
|
|
|
94
|
+
function isRunningInAntigravity() {
|
|
95
|
+
const env = process.env;
|
|
96
|
+
// Antigravity may set its own env vars or identify via TERM_PROGRAM
|
|
97
|
+
if (env.ANTIGRAVITY_CHANNEL) return true;
|
|
98
|
+
if (env.TERM_PROGRAM === 'antigravity') return true;
|
|
99
|
+
// Antigravity is a VS Code fork - check for antigravity-specific paths
|
|
100
|
+
const ipcHandle = env.VSCODE_GIT_IPC_HANDLE || env.VSCODE_IPC_HOOK_CLI || '';
|
|
101
|
+
if (ipcHandle.toLowerCase().includes('antigravity')) return true;
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
|
|
82
105
|
function isRunningInVSCode() {
|
|
83
106
|
const env = process.env;
|
|
84
107
|
if (env.TERM_PROGRAM === 'vscode') return true;
|
|
@@ -142,6 +165,16 @@ export function detectEditors() {
|
|
|
142
165
|
write: (apiKey) => writeClaudeCodeConfig(claudeCodeConfigPath, apiKey),
|
|
143
166
|
});
|
|
144
167
|
|
|
168
|
+
// Antigravity (Google) - user-level mcp_config.json
|
|
169
|
+
const antigravityPath = getAntigravityConfigPath();
|
|
170
|
+
const antigravityDetected = isRunningInAntigravity() || (antigravityPath ? existsSync(join(antigravityPath, '..')) : false);
|
|
171
|
+
editors.push({
|
|
172
|
+
name: 'Antigravity',
|
|
173
|
+
detected: antigravityDetected,
|
|
174
|
+
configPath: antigravityPath,
|
|
175
|
+
write: (apiKey) => writeAntigravityConfig(antigravityPath, apiKey),
|
|
176
|
+
});
|
|
177
|
+
|
|
145
178
|
return editors;
|
|
146
179
|
}
|
|
147
180
|
|
|
@@ -252,6 +285,34 @@ function writeClaudeDesktopConfig(configPath, apiKey) {
|
|
|
252
285
|
writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n', 'utf-8');
|
|
253
286
|
}
|
|
254
287
|
|
|
288
|
+
function writeAntigravityConfig(configPath, apiKey) {
|
|
289
|
+
if (!configPath) {
|
|
290
|
+
warn('Antigravity config path not found for this platform.');
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
const mcpUrl = getMcpUrl();
|
|
294
|
+
|
|
295
|
+
let config = {};
|
|
296
|
+
if (existsSync(configPath)) {
|
|
297
|
+
try {
|
|
298
|
+
config = JSON.parse(readFileSync(configPath, 'utf-8'));
|
|
299
|
+
} catch {
|
|
300
|
+
// Start fresh
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
if (!config.mcpServers) config.mcpServers = {};
|
|
305
|
+
config.mcpServers.spritecook = {
|
|
306
|
+
url: mcpUrl,
|
|
307
|
+
headers: {
|
|
308
|
+
Authorization: `Bearer ${apiKey}`,
|
|
309
|
+
},
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
ensureDir(join(configPath, '..'));
|
|
313
|
+
writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n', 'utf-8');
|
|
314
|
+
}
|
|
315
|
+
|
|
255
316
|
function writeClaudeCodeConfig(configPath, apiKey) {
|
|
256
317
|
const mcpUrl = getMcpUrl();
|
|
257
318
|
|
|
@@ -278,6 +339,12 @@ function writeClaudeCodeConfig(configPath, apiKey) {
|
|
|
278
339
|
|
|
279
340
|
// ── Helpers ─────────────────────────────────────────────────────────────
|
|
280
341
|
|
|
342
|
+
function getAntigravityConfigPath() {
|
|
343
|
+
const home = homedir();
|
|
344
|
+
// Antigravity stores MCP config at ~/.gemini/antigravity/mcp_config.json on all platforms
|
|
345
|
+
return join(home, '.gemini', 'antigravity', 'mcp_config.json');
|
|
346
|
+
}
|
|
347
|
+
|
|
281
348
|
function getClaudeDesktopConfigPath() {
|
|
282
349
|
const platform = process.platform;
|
|
283
350
|
const home = homedir();
|
package/src/setup.mjs
CHANGED
|
@@ -78,6 +78,7 @@ export async function run() {
|
|
|
78
78
|
selected: e.detected,
|
|
79
79
|
})),
|
|
80
80
|
hint: 'Space to toggle, Enter to confirm',
|
|
81
|
+
instructions: false,
|
|
81
82
|
});
|
|
82
83
|
|
|
83
84
|
const selected = editors.filter((e) => response.editors?.includes(e.name));
|
|
@@ -130,6 +131,6 @@ export async function run() {
|
|
|
130
131
|
|
|
131
132
|
console.log();
|
|
132
133
|
console.log(chalk.dim(' Then try asking your AI agent:'));
|
|
133
|
-
console.log(chalk.white(' "Generate a
|
|
134
|
+
console.log(chalk.white(' "Generate a chicken sprite"'));
|
|
134
135
|
console.log();
|
|
135
136
|
}
|