fix: install native Cursor hook and MCP config (#1543)

* fix: install native cursor hook and MCP config

* fix: avoid false healthy stdio mcp probes
This commit is contained in:
Affaan Mustafa
2026-04-21 18:35:21 -04:00
committed by GitHub
parent 8c422a76f4
commit 92e0c7e9ff
8 changed files with 249 additions and 52 deletions

View File

@@ -138,11 +138,19 @@ function runTests() {
assert.ok(fs.existsSync(path.join(projectDir, '.cursor', 'agents', 'architect.md')));
assert.ok(fs.existsSync(path.join(projectDir, '.cursor', 'commands', 'plan.md')));
assert.ok(fs.existsSync(path.join(projectDir, '.cursor', 'hooks.json')));
assert.ok(fs.existsSync(path.join(projectDir, '.cursor', 'mcp.json')));
assert.ok(fs.existsSync(path.join(projectDir, '.cursor', 'hooks', 'session-start.js')));
assert.ok(fs.existsSync(path.join(projectDir, '.cursor', 'scripts', 'lib', 'utils.js')));
assert.ok(fs.existsSync(path.join(projectDir, '.cursor', 'skills', 'tdd-workflow', 'SKILL.md')));
assert.ok(fs.existsSync(path.join(projectDir, '.cursor', 'skills', 'coding-standards', 'SKILL.md')));
const hooksConfig = readJson(path.join(projectDir, '.cursor', 'hooks.json'));
const mcpConfig = readJson(path.join(projectDir, '.cursor', 'mcp.json'));
assert.strictEqual(hooksConfig.version, 1);
assert.ok(hooksConfig.hooks.sessionStart, 'Should keep Cursor sessionStart hooks');
assert.ok(mcpConfig.mcpServers.github, 'Should install shared MCP servers into Cursor');
assert.ok(mcpConfig.mcpServers.context7, 'Should include bundled documentation MCPs');
const statePath = path.join(projectDir, '.cursor', 'ecc-install-state.json');
const state = readJson(statePath);
const normalizedProjectDir = fs.realpathSync(projectDir);
@@ -163,6 +171,35 @@ function runTests() {
}
})) passed++; else failed++;
if (test('installs Cursor MCP config by merging bundled servers into an existing mcp.json', () => {
const homeDir = createTempDir('install-apply-home-');
const projectDir = createTempDir('install-apply-project-');
try {
const cursorRoot = path.join(projectDir, '.cursor');
fs.mkdirSync(cursorRoot, { recursive: true });
fs.writeFileSync(path.join(cursorRoot, 'mcp.json'), JSON.stringify({
mcpServers: {
custom: {
command: 'node',
args: ['custom-mcp.js'],
},
},
}, null, 2));
const result = run(['--target', 'cursor', 'typescript'], { cwd: projectDir, homeDir });
assert.strictEqual(result.code, 0, result.stderr);
const mcpConfig = readJson(path.join(projectDir, '.cursor', 'mcp.json'));
assert.ok(mcpConfig.mcpServers.custom, 'Should preserve existing custom Cursor MCP servers');
assert.ok(mcpConfig.mcpServers.github, 'Should merge bundled GitHub MCP server');
assert.ok(mcpConfig.mcpServers.playwright, 'Should merge bundled Playwright MCP server');
} finally {
cleanup(homeDir);
cleanup(projectDir);
}
})) passed++; else failed++;
if (test('installs Antigravity configs and writes install-state', () => {
const homeDir = createTempDir('install-apply-home-');
const projectDir = createTempDir('install-apply-project-');