test: guard MCP launcher fallback distribution
This commit is contained in:
@@ -389,11 +389,18 @@ async function buildHooks() {
|
|||||||
if (claudeMemMarketplaceEntry?.source?.path !== './plugin') {
|
if (claudeMemMarketplaceEntry?.source?.path !== './plugin') {
|
||||||
throw new Error('.agents/plugins/marketplace.json must point claude-mem source.path at ./plugin so Codex loads the bundled plugin root');
|
throw new Error('.agents/plugins/marketplace.json must point claude-mem source.path at ./plugin so Codex loads the bundled plugin root');
|
||||||
}
|
}
|
||||||
|
const rootMcp = JSON.parse(fs.readFileSync('.mcp.json', 'utf-8'));
|
||||||
const bundledMcp = JSON.parse(fs.readFileSync('plugin/.mcp.json', 'utf-8'));
|
const bundledMcp = JSON.parse(fs.readFileSync('plugin/.mcp.json', 'utf-8'));
|
||||||
|
if (JSON.stringify(rootMcp.mcpServers?.['mcp-search']) !== JSON.stringify(bundledMcp.mcpServers?.['mcp-search'])) {
|
||||||
|
throw new Error('.mcp.json and plugin/.mcp.json mcp-search launchers must stay in sync');
|
||||||
|
}
|
||||||
const mcpSearchCommand = bundledMcp.mcpServers?.['mcp-search']?.args?.join(' ') ?? '';
|
const mcpSearchCommand = bundledMcp.mcpServers?.['mcp-search']?.args?.join(' ') ?? '';
|
||||||
if (!mcpSearchCommand.includes('.codex/plugins/cache/claude-mem-local/claude-mem')) {
|
if (!mcpSearchCommand.includes('.codex/plugins/cache/claude-mem-local/claude-mem')) {
|
||||||
throw new Error('plugin/.mcp.json mcp-search launcher must include Codex cache fallback for hosts that do not inject PLUGIN_ROOT');
|
throw new Error('plugin/.mcp.json mcp-search launcher must include Codex cache fallback for hosts that do not inject PLUGIN_ROOT');
|
||||||
}
|
}
|
||||||
|
if (!mcpSearchCommand.includes('.claude/plugins/cache/thedotmack/claude-mem')) {
|
||||||
|
throw new Error('plugin/.mcp.json mcp-search launcher must include Claude cache fallback for hosts that do not inject PLUGIN_ROOT');
|
||||||
|
}
|
||||||
console.log('✓ All required distribution files present');
|
console.log('✓ All required distribution files present');
|
||||||
|
|
||||||
console.log('\n✅ All build targets compiled successfully!');
|
console.log('\n✅ All build targets compiled successfully!');
|
||||||
|
|||||||
@@ -70,6 +70,13 @@ describe('Plugin Distribution - Codex Marketplace', () => {
|
|||||||
expect(command).toContain('.claude/plugins/cache/thedotmack/claude-mem');
|
expect(command).toContain('.claude/plugins/cache/thedotmack/claude-mem');
|
||||||
expect(command).toContain('claude-mem MCP server not found');
|
expect(command).toContain('claude-mem MCP server not found');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('keeps root and bundled MCP launchers in sync', () => {
|
||||||
|
const rootMcp = JSON.parse(readFileSync(path.join(projectRoot, '.mcp.json'), 'utf-8'));
|
||||||
|
const bundledMcp = JSON.parse(readFileSync(path.join(projectRoot, 'plugin/.mcp.json'), 'utf-8'));
|
||||||
|
|
||||||
|
expect(rootMcp.mcpServers['mcp-search']).toEqual(bundledMcp.mcpServers['mcp-search']);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Plugin Distribution - hooks.json Integrity', () => {
|
describe('Plugin Distribution - hooks.json Integrity', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user