mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-16 06:43:07 -07:00
fix(cli): remove /plan extension context hacks and fix dropped queue messages
This commit is contained in:
@@ -1366,7 +1366,7 @@ Logging in with Google... Restarting Gemini CLI to continue.
|
||||
}
|
||||
|
||||
const isMcpOrConfigReady = isConfigInitialized && isMcpReady;
|
||||
if ((isSlash && isConfigInitialized) || (isIdle && isMcpOrConfigReady)) {
|
||||
if (isIdle && ((isSlash && isConfigInitialized) || isMcpOrConfigReady)) {
|
||||
if (!isSlash) {
|
||||
const permissions = await checkPermissions(submittedValue, config);
|
||||
if (permissions.length > 0) {
|
||||
|
||||
@@ -56,8 +56,9 @@ describe('planCommand', () => {
|
||||
config: {
|
||||
isPlanEnabled: vi.fn(),
|
||||
setApprovalMode: vi.fn(),
|
||||
getApprovedPlanPath: vi.fn(),
|
||||
getApprovalMode: vi.fn(),
|
||||
getApprovedPlanPath: vi.fn(),
|
||||
getPlansDir: vi.fn(),
|
||||
getFileSystemService: vi.fn(),
|
||||
storage: {
|
||||
getPlansDir: vi.fn().mockReturnValue('/mock/plans/dir'),
|
||||
|
||||
@@ -82,7 +82,7 @@ export const planCommand: SlashCommand = {
|
||||
try {
|
||||
const content = await processSingleFileContent(
|
||||
approvedPlanPath,
|
||||
config.storage.getPlansDir(),
|
||||
config.getPlansDir(),
|
||||
config.getFileSystemService(),
|
||||
);
|
||||
const fileName = path.basename(approvedPlanPath);
|
||||
|
||||
@@ -1046,53 +1046,6 @@ describe('useSlashCommandProcessor', () => {
|
||||
expect(spySetContext).toHaveBeenCalledWith(undefined);
|
||||
});
|
||||
|
||||
it('clears active extension context when the canonical /plan command is executed', async () => {
|
||||
const planCommand = createTestCommand({
|
||||
name: 'plan',
|
||||
action: vi.fn(),
|
||||
});
|
||||
|
||||
const spySetContext = vi.spyOn(mockConfig, 'setActiveExtensionContext');
|
||||
|
||||
const hook = await setupProcessorHook({
|
||||
builtinCommands: [planCommand],
|
||||
});
|
||||
|
||||
await waitFor(() => expect(hook.current.slashCommands!.length).toBe(1));
|
||||
|
||||
await act(async () => {
|
||||
await hook.current.handleSlashCommand('/plan my task');
|
||||
});
|
||||
|
||||
expect(spySetContext).toHaveBeenCalledWith(undefined);
|
||||
});
|
||||
|
||||
it('clears active extension context when a /plan alias or subcommand is executed', async () => {
|
||||
const planCommand = createTestCommand({
|
||||
name: 'plan',
|
||||
subCommands: [
|
||||
createTestCommand({
|
||||
name: 'create',
|
||||
}),
|
||||
],
|
||||
action: vi.fn(),
|
||||
});
|
||||
|
||||
const spySetContext = vi.spyOn(mockConfig, 'setActiveExtensionContext');
|
||||
|
||||
const hook = await setupProcessorHook({
|
||||
builtinCommands: [planCommand],
|
||||
});
|
||||
|
||||
await waitFor(() => expect(hook.current.slashCommands!.length).toBe(1));
|
||||
|
||||
await act(async () => {
|
||||
await hook.current.handleSlashCommand('/plan create');
|
||||
});
|
||||
|
||||
expect(spySetContext).toHaveBeenCalledWith(undefined);
|
||||
});
|
||||
|
||||
it('handles a sequence of context switches between extensions and default plan mode', async () => {
|
||||
const extA = createTestCommand({
|
||||
name: 'extA',
|
||||
@@ -1137,12 +1090,6 @@ describe('useSlashCommandProcessor', () => {
|
||||
});
|
||||
// A concurrent command should NOT modify the active extension context
|
||||
expect(spySetContext).not.toHaveBeenCalled();
|
||||
|
||||
// 4. Run /plan (Default)
|
||||
await act(async () => {
|
||||
await hook.current.handleSlashCommand('/plan my task');
|
||||
});
|
||||
expect(spySetContext).toHaveBeenLastCalledWith(undefined);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -378,8 +378,6 @@ export const useSlashCommandProcessor = (
|
||||
} else {
|
||||
config.setActiveExtensionContext(undefined);
|
||||
}
|
||||
} else if (resolvedCommandPath?.[0] === 'plan') {
|
||||
config.setActiveExtensionContext(undefined);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user