diff options
Diffstat (limited to 'packages/cli/src/config')
| -rw-r--r-- | packages/cli/src/config/config.test.ts | 5 | ||||
| -rw-r--r-- | packages/cli/src/config/extension.test.ts | 25 | ||||
| -rw-r--r-- | packages/cli/src/config/extension.ts | 5 |
3 files changed, 35 insertions, 0 deletions
diff --git a/packages/cli/src/config/config.test.ts b/packages/cli/src/config/config.test.ts index 55780320..7f47660d 100644 --- a/packages/cli/src/config/config.test.ts +++ b/packages/cli/src/config/config.test.ts @@ -35,6 +35,11 @@ vi.mock('@google/gemini-cli-core', async () => { ); return { ...actualServer, + IdeClient: vi.fn().mockImplementation(() => ({ + getConnectionStatus: vi.fn(), + initialize: vi.fn(), + shutdown: vi.fn(), + })), loadEnvironment: vi.fn(), loadServerHierarchicalMemory: vi.fn( (cwd, debug, fileService, extensionPaths, _maxDirs) => diff --git a/packages/cli/src/config/extension.test.ts b/packages/cli/src/config/extension.test.ts index 6b2a3f83..85852bd7 100644 --- a/packages/cli/src/config/extension.test.ts +++ b/packages/cli/src/config/extension.test.ts @@ -42,6 +42,31 @@ describe('loadExtensions', () => { fs.rmSync(tempHomeDir, { recursive: true, force: true }); }); + it('should include extension path in loaded extension', () => { + const workspaceExtensionsDir = path.join( + tempWorkspaceDir, + EXTENSIONS_DIRECTORY_NAME, + ); + fs.mkdirSync(workspaceExtensionsDir, { recursive: true }); + + const extensionDir = path.join(workspaceExtensionsDir, 'test-extension'); + fs.mkdirSync(extensionDir, { recursive: true }); + + const config = { + name: 'test-extension', + version: '1.0.0', + }; + fs.writeFileSync( + path.join(extensionDir, EXTENSIONS_CONFIG_FILENAME), + JSON.stringify(config), + ); + + const extensions = loadExtensions(tempWorkspaceDir); + expect(extensions).toHaveLength(1); + expect(extensions[0].path).toBe(extensionDir); + expect(extensions[0].config.name).toBe('test-extension'); + }); + it('should load context file path when GEMINI.md is present', () => { const workspaceExtensionsDir = path.join( tempWorkspaceDir, diff --git a/packages/cli/src/config/extension.ts b/packages/cli/src/config/extension.ts index adefec29..1922f55a 100644 --- a/packages/cli/src/config/extension.ts +++ b/packages/cli/src/config/extension.ts @@ -13,6 +13,7 @@ export const EXTENSIONS_DIRECTORY_NAME = path.join('.gemini', 'extensions'); export const EXTENSIONS_CONFIG_FILENAME = 'gemini-extension.json'; export interface Extension { + path: string; config: ExtensionConfig; contextFiles: string[]; } @@ -90,6 +91,7 @@ function loadExtension(extensionDir: string): Extension | null { .filter((contextFilePath) => fs.existsSync(contextFilePath)); return { + path: extensionDir, config, contextFiles, }; @@ -121,6 +123,7 @@ export function annotateActiveExtensions( name: extension.config.name, version: extension.config.version, isActive: true, + path: extension.path, })); } @@ -136,6 +139,7 @@ export function annotateActiveExtensions( name: extension.config.name, version: extension.config.version, isActive: false, + path: extension.path, })); } @@ -153,6 +157,7 @@ export function annotateActiveExtensions( name: extension.config.name, version: extension.config.version, isActive, + path: extension.path, }); } |
