Add a command line option to enable and list extensions (#3191)

This commit is contained in:
Billy Biggs
2025-07-08 12:57:34 -04:00
committed by GitHub
parent f1647d9e19
commit c0940a194e
8 changed files with 220 additions and 10 deletions

View File

@@ -555,3 +555,41 @@ describe('loadCliConfig with allowed-mcp-server-names', () => {
expect(config.getMcpServers()).toEqual(baseSettings.mcpServers);
});
});
describe('loadCliConfig extensions', () => {
const mockExtensions: Extension[] = [
{
config: { name: 'ext1', version: '1.0.0' },
contextFiles: ['/path/to/ext1.md'],
},
{
config: { name: 'ext2', version: '1.0.0' },
contextFiles: ['/path/to/ext2.md'],
},
];
it('should not filter extensions if --extensions flag is not used', async () => {
process.argv = ['node', 'script.js'];
const settings: Settings = {};
const config = await loadCliConfig(
settings,
mockExtensions,
'test-session',
);
expect(config.getExtensionContextFilePaths()).toEqual([
'/path/to/ext1.md',
'/path/to/ext2.md',
]);
});
it('should filter extensions if --extensions flag is used', async () => {
process.argv = ['node', 'script.js', '--extensions', 'ext1'];
const settings: Settings = {};
const config = await loadCliConfig(
settings,
mockExtensions,
'test-session',
);
expect(config.getExtensionContextFilePaths()).toEqual(['/path/to/ext1.md']);
});
});