/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */
import * as fs from 'node:fs';
import * as path from 'node:path';
import { EXTENSIONS_CONFIG_FILENAME, INSTALL_METADATA_FILENAME, } from '../config/extension.js';
import {} from '@google/gemini-cli-core';
export function createExtension({ extensionsDir = 'extensions-dir', name = 'my-extension', version = '1.0.0', addContextFile = false, contextFileName = undefined, mcpServers = {}, installMetadata = undefined, } = {}) {
    const extDir = path.join(extensionsDir, name);
    fs.mkdirSync(extDir, { recursive: true });
    fs.writeFileSync(path.join(extDir, EXTENSIONS_CONFIG_FILENAME), JSON.stringify({ name, version, contextFileName, mcpServers }));
    if (addContextFile) {
        fs.writeFileSync(path.join(extDir, 'GEMINI.md'), 'context');
    }
    if (contextFileName) {
        fs.writeFileSync(path.join(extDir, contextFileName), 'context');
    }
    if (installMetadata) {
        fs.writeFileSync(path.join(extDir, INSTALL_METADATA_FILENAME), JSON.stringify(installMetadata));
    }
    return extDir;
}
//# sourceMappingURL=createExtension.js.map