| Server IP : 85.155.190.233 / Your IP : 216.73.216.103 Web Server : nginx/1.24.0 System : Linux antigravity-cli 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64 User : wp-moonbloom ( 1001) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /opt/Gemini_Swarm_Core/scripts/ |
Upload File : |
const fs = require('fs');
const path = require('path');
const { exec } = require('child_process');
console.log('=== STITCH MCP SMOKE TEST ===');
const workspaceRoot = path.resolve(__dirname, '../..');
const mcpConfigPath = path.resolve(process.env.USERPROFILE || process.env.HOME, '.gemini/antigravity-cli/mcp_config.json');
const agentsMcpPath = path.join(workspaceRoot, '.agents/mcp_config.json');
let exitCode = 0;
// 1. Check MCP config (agy uses .agents/mcp_config.json or ~/.gemini/antigravity-cli/mcp_config.json)
console.log('\n[1/4] Checking MCP Config...');
if (fs.existsSync(agentsMcpPath)) {
console.log(`✔ Workspace MCP config found at: .agents/mcp_config.json`);
} else if (fs.existsSync(mcpConfigPath)) {
console.log(`✔ Global MCP config found at: ~/.gemini/antigravity-cli/mcp_config.json`);
} else {
console.log(`❌ No MCP config found (checked .agents/mcp_config.json and global)`);
exitCode = 1;
}
// 2. Check Stitch Skills
console.log('\n[2/4] Checking Stitch Skills Installation...');
const expectedSkills = [
'stitch-generate-design',
'stitch-extract-static-html',
'stitch-manage-design-system',
'stitch-upload-to-stitch'
];
expectedSkills.forEach(skill => {
const skillPath = path.join(workspaceRoot, `.agents/skills/${skill}/SKILL.md`);
if (fs.existsSync(skillPath)) {
console.log(`✔ Skill "${skill}" found.`);
} else {
console.log(`❌ Skill "${skill}" is missing!`);
exitCode = 1;
}
});
// 3. Parse .mcp.json & Extract API Key
console.log('\n[3/4] Reading MCP Config File...');
let stitchApiKey = '';
if (fs.existsSync(mcpConfigPath)) {
try {
const mcpConfig = JSON.parse(fs.readFileSync(mcpConfigPath, 'utf8'));
if (mcpConfig.mcpServers && mcpConfig.mcpServers.stitch) {
const stitchConf = mcpConfig.mcpServers.stitch;
console.log(`✔ Stitch server configuration found in .mcp.json`);
if (stitchConf.env && stitchConf.env.STITCH_API_KEY) {
stitchApiKey = stitchConf.env.STITCH_API_KEY;
if (stitchApiKey === 'YOUR_STITCH_API_KEY_HERE') {
console.log(`❌ STITCH_API_KEY is still the placeholder! Please replace it in: ${mcpConfigPath}`);
exitCode = 1;
} else {
const maskedKey = stitchApiKey.substring(0, 7) + '...' + stitchApiKey.substring(stitchApiKey.length - 4);
console.log(`✔ STITCH_API_KEY detected in .mcp.json: ${maskedKey}`);
}
} else {
console.log(`❌ STITCH_API_KEY is missing from stitch env in .mcp.json!`);
exitCode = 1;
}
} else {
console.log(`❌ Stitch config is missing from .mcp.json!`);
exitCode = 1;
}
} catch (err) {
console.log(`❌ Failed to parse .mcp.json: ${err.message}`);
exitCode = 1;
}
} else {
console.log(`❌ MCP configuration file not found at: ${mcpConfigPath}`);
exitCode = 1;
}
// 4. Run Stitch Doctor Check
if (stitchApiKey && stitchApiKey !== 'YOUR_STITCH_API_KEY_HERE') {
console.log('\n[4/4] Running Stitch Doctor Live Diagnostics...');
// Set up child process with the API Key
const options = {
env: { ...process.env, STITCH_API_KEY: stitchApiKey }
};
exec('npx @_davideast/stitch-mcp doctor', options, (error, stdout, stderr) => {
console.log('----------------------------------------');
console.log(stdout.trim());
if (stderr.trim()) {
console.error('Errors/Warnings:');
console.error(stderr.trim());
}
console.log('----------------------------------------');
const isHealthy = stdout.includes('Stitch API: Healthy') || stdout.includes('All checks passed!');
if (isHealthy) {
console.log('✔ Stitch Doctor confirmed connection is HEALTHY and ACTIVE.');
} else {
console.log('❌ Stitch Doctor diagnostics FAILED.');
exitCode = 1;
}
process.exit(exitCode);
});
} else {
console.log('\n[4/4] Skipping Stitch Doctor check due to missing or invalid API Key.');
process.exit(exitCode);
}