mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-21 02:24:09 -07:00
4a92f938e1
Co-authored-by: hritan <48129645+hritan@users.noreply.github.com> Co-authored-by: Taneja Hriday <hridayt@google.com> Co-authored-by: shishu314 <shishu_1998@yahoo.com> Co-authored-by: Shi Shu <shii@google.com> Co-authored-by: Jacob MacDonald <jakemac@google.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
50 lines
1.2 KiB
TypeScript
50 lines
1.2 KiB
TypeScript
/**
|
|
* @license
|
|
* Copyright 2025 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import type { CommandModule } from 'yargs';
|
|
import { installExtension } from '../../config/extension.js';
|
|
import type { ExtensionInstallMetadata } from '@google/gemini-cli-core';
|
|
|
|
import { getErrorMessage } from '../../utils/errors.js';
|
|
|
|
interface InstallArgs {
|
|
path: string;
|
|
}
|
|
|
|
export async function handleLink(args: InstallArgs) {
|
|
try {
|
|
const installMetadata: ExtensionInstallMetadata = {
|
|
source: args.path,
|
|
type: 'link',
|
|
};
|
|
const extensionName = await installExtension(installMetadata);
|
|
console.log(
|
|
`Extension "${extensionName}" linked successfully and enabled.`,
|
|
);
|
|
} catch (error) {
|
|
console.error(getErrorMessage(error));
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
export const linkCommand: CommandModule = {
|
|
command: 'link <path>',
|
|
describe:
|
|
'Links an extension from a local path. Updates made to the local path will always be reflected.',
|
|
builder: (yargs) =>
|
|
yargs
|
|
.positional('path', {
|
|
describe: 'The name of the extension to link.',
|
|
type: 'string',
|
|
})
|
|
.check((_) => true),
|
|
handler: async (argv) => {
|
|
await handleLink({
|
|
path: argv['path'] as string,
|
|
});
|
|
},
|
|
};
|