mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-10 22:21:22 -07:00
Fix(cli): Use the correct extensionPath (#11896)
This commit is contained in:
@@ -474,11 +474,10 @@ export class ExtensionManager {
|
||||
`Invalid configuration in ${configFilePath}: missing ${!rawConfig.name ? '"name"' : '"version"'}`,
|
||||
);
|
||||
}
|
||||
const installDir = new ExtensionStorage(rawConfig.name).getExtensionDir();
|
||||
const config = recursivelyHydrateStrings(
|
||||
rawConfig as unknown as JsonObject,
|
||||
{
|
||||
extensionPath: installDir,
|
||||
extensionPath: extensionDir,
|
||||
workspacePath: this.workspaceDir,
|
||||
'/': path.sep,
|
||||
pathSeparator: path.sep,
|
||||
|
||||
@@ -285,6 +285,32 @@ describe('extension tests', () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it('should hydrate ${extensionPath} correctly for linked extensions', async () => {
|
||||
const sourceExtDir = createExtension({
|
||||
extensionsDir: tempWorkspaceDir,
|
||||
name: 'my-linked-extension-with-path',
|
||||
version: '1.0.0',
|
||||
mcpServers: {
|
||||
'test-server': {
|
||||
command: 'node',
|
||||
args: ['${extensionPath}/server/index.js'],
|
||||
cwd: '${extensionPath}/server',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
await extensionManager.installOrUpdateExtension({
|
||||
source: sourceExtDir,
|
||||
type: 'link',
|
||||
});
|
||||
|
||||
const extensions = extensionManager.loadExtensions();
|
||||
expect(extensions).toHaveLength(1);
|
||||
expect(extensions[0].mcpServers?.['test-server'].cwd).toBe(
|
||||
path.join(sourceExtDir, 'server'),
|
||||
);
|
||||
});
|
||||
|
||||
it('should resolve environment variables in extension configuration', () => {
|
||||
process.env['TEST_API_KEY'] = 'test-api-key-123';
|
||||
process.env['TEST_DB_URL'] = 'postgresql://localhost:5432/testdb';
|
||||
|
||||
Reference in New Issue
Block a user