mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-15 14:23:02 -07:00
refactor(cli): further trim open-plugin schema and core extension interface
This commit is contained in:
@@ -37,10 +37,6 @@ export interface ExtensionConfig {
|
||||
description?: string;
|
||||
author?: string | { name: string; email?: string; url?: string };
|
||||
license?: string;
|
||||
repository?: string | { type: string; url: string; directory?: string };
|
||||
homepage?: string;
|
||||
logo?: string;
|
||||
keywords?: string[];
|
||||
mcpServers?: Record<string, MCPServerConfig>;
|
||||
contextFileName?: string | string[];
|
||||
excludeTools?: string[];
|
||||
@@ -80,19 +76,6 @@ export const geminiExtensionSchema = z.object({
|
||||
])
|
||||
.optional(),
|
||||
license: z.string().optional(),
|
||||
repository: z
|
||||
.union([
|
||||
z.string(),
|
||||
z.object({
|
||||
type: z.string(),
|
||||
url: z.string(),
|
||||
directory: z.string().optional(),
|
||||
}),
|
||||
])
|
||||
.optional(),
|
||||
homepage: z.string().url().optional(),
|
||||
logo: z.string().optional(),
|
||||
keywords: z.array(z.string()).optional(),
|
||||
mcpServers: z.record(z.any()).optional(),
|
||||
contextFileName: z.union([z.string(), z.array(z.string())]).optional(),
|
||||
excludeTools: z.array(z.string()).optional(),
|
||||
@@ -190,10 +173,6 @@ export function createGeminiExtension(
|
||||
description: config.description,
|
||||
author: config.author,
|
||||
license: config.license,
|
||||
repository: config.repository ?? config.migratedTo,
|
||||
homepage: config.homepage,
|
||||
logo: config.logo,
|
||||
keywords: config.keywords,
|
||||
contextFiles,
|
||||
mcpServers: config.mcpServers,
|
||||
excludeTools: config.excludeTools,
|
||||
|
||||
@@ -92,8 +92,6 @@ describe('ExtensionManager - Open Plugin Support', () => {
|
||||
expect(plugin?.version).toBe('1.0.0');
|
||||
expect(plugin?.description).toBe('An Open Plugin test');
|
||||
expect(plugin?.manifestType).toBe('open-plugin');
|
||||
expect(plugin?.author).toEqual({ name: 'Taylor' });
|
||||
expect(plugin?.license).toBe('Apache-2.0');
|
||||
});
|
||||
|
||||
it('should discover a plugin with .plugin/plugin.json', async () => {
|
||||
|
||||
@@ -10,7 +10,6 @@ import { z } from 'zod';
|
||||
import type {
|
||||
ExtensionInstallMetadata,
|
||||
GeminiCLIExtension,
|
||||
CustomTheme,
|
||||
} from '@google/gemini-cli-core';
|
||||
import {
|
||||
EXTENSIONS_CONFIG_FILENAME,
|
||||
@@ -20,7 +19,6 @@ import {
|
||||
type JsonObject,
|
||||
} from './extensions/variables.js';
|
||||
import type { ExtensionConfig } from './extension.js';
|
||||
import type { ExtensionSetting } from './extensions/extensionSettings.js';
|
||||
|
||||
/**
|
||||
* Open Plugin manifest (plugin.json) v1.0.0
|
||||
@@ -32,20 +30,11 @@ export interface OpenPluginConfig {
|
||||
description?: string;
|
||||
author?: string | { name: string; email?: string; url?: string };
|
||||
license?: string;
|
||||
repository?: string | { type: string; url: string; directory?: string };
|
||||
homepage?: string;
|
||||
logo?: string;
|
||||
keywords?: string[];
|
||||
// Component fields (parsed but currently ignored during execution per v1 plan)
|
||||
skills?: string[] | Record<string, unknown>;
|
||||
agents?: string[] | Record<string, unknown>;
|
||||
hooks?: string[] | Record<string, unknown>;
|
||||
mcpServers?: string[] | Record<string, unknown>;
|
||||
lspServers?: string[] | Record<string, unknown>;
|
||||
rules?: string[] | Record<string, unknown>;
|
||||
// For Gemini CLI compatibility
|
||||
settings?: ExtensionSetting[];
|
||||
themes?: CustomTheme[];
|
||||
}
|
||||
|
||||
export const OPEN_PLUGIN_NAME_REGEX = /^[a-z0-9]([a-z0-9.-]*[a-z0-9])?$/;
|
||||
@@ -65,27 +54,10 @@ export const openPluginSchema = z.object({
|
||||
])
|
||||
.optional(),
|
||||
license: z.string().optional(),
|
||||
repository: z
|
||||
.union([
|
||||
z.string(),
|
||||
z.object({
|
||||
type: z.string(),
|
||||
url: z.string(),
|
||||
directory: z.string().optional(),
|
||||
}),
|
||||
])
|
||||
.optional(),
|
||||
homepage: z.string().url().optional(),
|
||||
logo: z.string().optional(),
|
||||
keywords: z.array(z.string()).optional(),
|
||||
skills: z.union([z.array(z.string()), z.record(z.any())]).optional(),
|
||||
agents: z.union([z.array(z.string()), z.record(z.any())]).optional(),
|
||||
hooks: z.union([z.array(z.string()), z.record(z.any())]).optional(),
|
||||
mcpServers: z.union([z.array(z.string()), z.record(z.any())]).optional(),
|
||||
lspServers: z.union([z.array(z.string()), z.record(z.any())]).optional(),
|
||||
rules: z.union([z.array(z.string()), z.record(z.any())]).optional(),
|
||||
settings: z.array(z.any()).optional(),
|
||||
themes: z.array(z.any()).optional(),
|
||||
});
|
||||
|
||||
export interface ManifestInfo {
|
||||
@@ -153,12 +125,6 @@ export async function loadOpenPluginConfig(
|
||||
description: hydratedConfig.description,
|
||||
author: hydratedConfig.author,
|
||||
license: hydratedConfig.license,
|
||||
repository: hydratedConfig.repository,
|
||||
homepage: hydratedConfig.homepage,
|
||||
logo: hydratedConfig.logo,
|
||||
keywords: hydratedConfig.keywords,
|
||||
settings: hydratedConfig.settings,
|
||||
themes: hydratedConfig.themes,
|
||||
// Features are explicitly NOT mapped here for v1 plugins
|
||||
};
|
||||
}
|
||||
@@ -193,10 +159,6 @@ export async function createOpenPlugin(
|
||||
description: config.description,
|
||||
author: config.author,
|
||||
license: config.license,
|
||||
repository: config.repository,
|
||||
homepage: config.homepage,
|
||||
logo: config.logo,
|
||||
keywords: config.keywords,
|
||||
// v1: Features disabled
|
||||
contextFiles: [],
|
||||
mcpServers: undefined,
|
||||
@@ -205,6 +167,6 @@ export async function createOpenPlugin(
|
||||
resolvedSettings: undefined,
|
||||
skills: undefined,
|
||||
agents: undefined,
|
||||
themes: config.themes,
|
||||
themes: undefined,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -386,10 +386,6 @@ export interface GeminiCLIExtension {
|
||||
description?: string;
|
||||
author?: string | { name: string; email?: string; url?: string };
|
||||
license?: string;
|
||||
repository?: string | { type: string; url: string; directory?: string };
|
||||
homepage?: string;
|
||||
logo?: string;
|
||||
keywords?: string[];
|
||||
mcpServers?: Record<string, MCPServerConfig>;
|
||||
contextFiles: string[];
|
||||
excludeTools?: string[];
|
||||
|
||||
Reference in New Issue
Block a user