From 471cbcd4501c652c7fc4bdc85eff29ccb6badc1f Mon Sep 17 00:00:00 2001 From: christine betts Date: Mon, 8 Sep 2025 21:59:45 -0700 Subject: [PATCH] Remove org/repo install support (#7815) --- .../src/commands/extensions/install.test.ts | 22 +------------------ .../cli/src/commands/extensions/install.ts | 16 +++----------- 2 files changed, 4 insertions(+), 34 deletions(-) diff --git a/packages/cli/src/commands/extensions/install.test.ts b/packages/cli/src/commands/extensions/install.test.ts index 2f66e432a1..441855da2c 100644 --- a/packages/cli/src/commands/extensions/install.test.ts +++ b/packages/cli/src/commands/extensions/install.test.ts @@ -5,9 +5,8 @@ */ import { describe, it, expect } from 'vitest'; -import { installCommand, handleInstall } from './install.js'; +import { installCommand } from './install.js'; import yargs from 'yargs'; -import * as extension from '../../config/extension.js'; vi.mock('../../config/extension.js', () => ({ installExtension: vi.fn(), @@ -28,22 +27,3 @@ describe('extensions install command', () => { ).toThrow('Arguments source and path are mutually exclusive'); }); }); - -describe('extensions install with org/repo', () => { - it('should call installExtension with the correct git URL', async () => { - const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => {}); - const installExtensionSpy = vi - .spyOn(extension, 'installExtension') - .mockResolvedValue('test-extension'); - - await handleInstall({ source: 'test-org/test-repo' }); - - expect(installExtensionSpy).toHaveBeenCalledWith({ - source: 'https://github.com/test-org/test-repo.git', - type: 'git', - }); - expect(consoleLogSpy).toHaveBeenCalledWith( - 'Extension "test-extension" installed successfully and enabled.', - ); - }); -}); diff --git a/packages/cli/src/commands/extensions/install.ts b/packages/cli/src/commands/extensions/install.ts index 56eb2a1867..9beeda870b 100644 --- a/packages/cli/src/commands/extensions/install.ts +++ b/packages/cli/src/commands/extensions/install.ts @@ -17,8 +17,6 @@ interface InstallArgs { path?: string; } -const ORG_REPO_REGEX = /^[a-zA-Z0-9-]+\/[\w.-]+$/; - export async function handleInstall(args: InstallArgs) { try { let installMetadata: ExtensionInstallMetadata; @@ -34,15 +32,8 @@ export async function handleInstall(args: InstallArgs) { source, type: 'git', }; - } else if (ORG_REPO_REGEX.test(source)) { - installMetadata = { - source: `https://github.com/${source}.git`, - type: 'git', - }; } else { - throw new Error( - `The source "${source}" is not a valid URL or "org/repo" format.`, - ); + throw new Error(`The source "${source}" is not a valid URL format.`); } } else if (args.path) { installMetadata = { @@ -66,12 +57,11 @@ export async function handleInstall(args: InstallArgs) { export const installCommand: CommandModule = { command: 'install [source]', - describe: - 'Installs an extension from a git repository (URL or "org/repo") or a local path.', + describe: 'Installs an extension from a git repository URL or a local path.', builder: (yargs) => yargs .positional('source', { - describe: 'The git URL or "org/repo" of the extension to install.', + describe: 'The github URL of the extension to install.', type: 'string', }) .option('path', {