feat(cli): release enhance command behind an experimental flag and address review comments

This commit is contained in:
Akhilesh Kumar
2026-04-28 21:22:02 +00:00
parent b6f9f07289
commit 652c1e2f5e
6 changed files with 37 additions and 2 deletions
+1
View File
@@ -1035,6 +1035,7 @@ export async function loadCliConfig(
extensionRegistryURI,
enableExtensionReloading: settings.experimental?.extensionReloading,
enableAgents: settings.experimental?.enableAgents,
enableEnhanceCommand: settings.experimental?.enhanceCommand ?? false,
plan: settings.general?.plan?.enabled ?? true,
voiceMode: settings.experimental?.voiceMode,
tracker: settings.experimental?.taskTracker,
@@ -2437,6 +2437,15 @@ const SETTINGS_SCHEMA = {
description: 'Deprecated: Use general.topicUpdateNarration instead.',
showInDialog: false,
},
enhanceCommand: {
type: 'boolean',
label: 'Enhance Command',
category: 'Experimental',
requiresRestart: true,
default: false,
description: 'Enable the experimental /enhance slash command.',
showInDialog: true,
},
},
},
extensions: {
@@ -171,6 +171,7 @@ describe('BuiltinCommandLoader', () => {
isAdminEnabled: vi.fn().mockReturnValue(true),
}),
isVoiceModeEnabled: vi.fn().mockReturnValue(true),
isEnhanceCommandEnabled: vi.fn().mockReturnValue(true),
getContentGeneratorConfig: vi.fn().mockReturnValue({
authType: 'other',
}),
@@ -310,6 +311,22 @@ describe('BuiltinCommandLoader', () => {
expect(agentsCmd).toBeUndefined();
});
it('should include enhance command when experimental enhance command is enabled', async () => {
(mockConfig.isEnhanceCommandEnabled as Mock).mockReturnValue(true);
const loader = new BuiltinCommandLoader(mockConfig);
const commands = await loader.loadCommands(new AbortController().signal);
const enhanceCmd = commands.find((c) => c.name === 'enhance');
expect(enhanceCmd).toBeDefined();
});
it('should exclude enhance command when experimental enhance command is disabled', async () => {
(mockConfig.isEnhanceCommandEnabled as Mock).mockReturnValue(false);
const loader = new BuiltinCommandLoader(mockConfig);
const commands = await loader.loadCommands(new AbortController().signal);
const enhanceCmd = commands.find((c) => c.name === 'enhance');
expect(enhanceCmd).toBeUndefined();
});
describe('chat debug command', () => {
it('should NOT add debug subcommand to chat/resume commands if not a nightly build', async () => {
vi.mocked(isNightly).mockResolvedValue(false);
@@ -398,6 +415,7 @@ describe('BuiltinCommandLoader profile', () => {
isAdminEnabled: vi.fn().mockReturnValue(true),
}),
isVoiceModeEnabled: vi.fn().mockReturnValue(true),
isEnhanceCommandEnabled: vi.fn().mockReturnValue(true),
getContentGeneratorConfig: vi.fn().mockReturnValue({
authType: 'other',
}),
@@ -136,7 +136,7 @@ export class BuiltinCommandLoader implements ICommandLoader {
docsCommand,
directoryCommand,
editorCommand,
enhanceCommand,
...(this.config?.isEnhanceCommandEnabled() ? [enhanceCommand] : []),
...(this.config?.getExtensionsEnabled() === false
? [
{
@@ -21,7 +21,7 @@ export const enhanceCommand: SlashCommand = {
name: 'enhance',
description: 'Enhance a prompt with additional context and rephrasing',
kind: CommandKind.BUILT_IN,
autoExecute: true,
autoExecute: false,
action: async (context, args) => {
const draft = args.trim();
if (!draft) {
+7
View File
@@ -709,6 +709,7 @@ export interface ConfigParameters {
disabledSkills?: string[];
adminSkillsEnabled?: boolean;
experimentalJitContext?: boolean;
enableEnhanceCommand?: boolean;
autoDistillation?: boolean;
experimentalMemoryV2?: boolean;
experimentalAutoMemory?: boolean;
@@ -950,6 +951,7 @@ export class Config implements McpContext, AgentLoopContext {
private readonly vertexAiRouting: VertexAiRoutingConfig | undefined;
private readonly enableAgents: boolean;
private readonly enableEnhanceCommand: boolean;
private agents: AgentSettings;
private readonly enableEventDrivenScheduler: boolean;
private readonly skillsSupport: boolean;
@@ -1116,6 +1118,7 @@ export class Config implements McpContext, AgentLoopContext {
this.disableLoopDetection = params.disableLoopDetection ?? false;
this._activeModel = params.model;
this.enableAgents = params.enableAgents ?? true;
this.enableEnhanceCommand = params.enableEnhanceCommand ?? false;
this.agents = params.agents ?? {};
this.disableLLMCorrection = params.disableLLMCorrection ?? true;
this.planEnabled = params.plan ?? true;
@@ -2972,6 +2975,10 @@ export class Config implements McpContext, AgentLoopContext {
return this.planEnabled;
}
isEnhanceCommandEnabled(): boolean {
return this.enableEnhanceCommand;
}
isVoiceModeEnabled(): boolean {
return this.voiceMode;
}