Merge branch 'main' into acp-base-url

This commit is contained in:
Shreya Keshive
2026-03-05 13:47:17 -05:00
committed by GitHub
21 changed files with 1397 additions and 600 deletions
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect, vi } from 'vitest';
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import {
ApprovalMode,
PolicyDecision,
@@ -29,6 +29,10 @@ vi.mock('@google/gemini-cli-core', async (importOriginal) => {
});
describe('Policy Engine Integration Tests', () => {
beforeEach(() => vi.stubEnv('GEMINI_SYSTEM_MD', ''));
afterEach(() => vi.unstubAllEnvs());
describe('Policy configuration produces valid PolicyEngine config', () => {
it('should create a working PolicyEngine from basic settings', async () => {
const settings: Settings = {
@@ -37,6 +37,7 @@ import {
import type { Key } from '../hooks/useKeypress.js';
import { useKeypress } from '../hooks/useKeypress.js';
import { keyMatchers, Command } from '../keyMatchers.js';
import { formatCommand } from '../utils/keybindingUtils.js';
import type { CommandContext, SlashCommand } from '../commands/types.js';
import type { Config } from '@google/gemini-cli-core';
import { ApprovalMode, coreEvents, debugLogger } from '@google/gemini-cli-core';
@@ -494,7 +495,7 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
buffer.insert(textToInsert, { paste: true });
if (isLargePaste(textToInsert)) {
appEvents.emit(AppEvent.TransientMessage, {
message: 'Press Ctrl+O to expand pasted text',
message: `Press ${formatCommand(Command.EXPAND_PASTE)} to expand pasted text`,
type: TransientMessageType.Hint,
});
}
@@ -730,7 +731,7 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
buffer.handleInput(key);
if (key.sequence && isLargePaste(key.sequence)) {
appEvents.emit(AppEvent.TransientMessage, {
message: 'Press Ctrl+O to expand pasted text',
message: `Press ${formatCommand(Command.EXPAND_PASTE)} to expand pasted text`,
type: TransientMessageType.Hint,
});
}
@@ -137,6 +137,14 @@ describe('<ShellToolMessage />', () => {
{ status: CoreToolCallStatus.Error, resultDisplay: 'Error output' },
undefined,
],
[
'renders in Cancelled state with partial output',
{
status: CoreToolCallStatus.Cancelled,
resultDisplay: 'Partial output before cancellation',
},
undefined,
],
[
'renders in Alternate Buffer mode while focused',
{
@@ -309,6 +309,14 @@ exports[`<ShellToolMessage /> > Snapshots > renders in Alternate Buffer mode whi
"
`;
exports[`<ShellToolMessage /> > Snapshots > renders in Cancelled state with partial output 1`] = `
"╭──────────────────────────────────────────────────────────────────────────────╮
│ - Shell Command A shell command │
│ │
│ Partial output before cancellation │
"
`;
exports[`<ShellToolMessage /> > Snapshots > renders in Error state 1`] = `
"╭──────────────────────────────────────────────────────────────────────────────╮
│ x Shell Command A shell command │
@@ -25,6 +25,7 @@ import {
} from '../../utils/textUtils.js';
import { useKeypress, type Key } from '../../hooks/useKeypress.js';
import { keyMatchers, Command } from '../../keyMatchers.js';
import { formatCommand } from '../../utils/keybindingUtils.js';
/**
* Represents a single item in the settings dialog.
@@ -625,7 +626,7 @@ export function BaseSettingsDialog({
{/* Help text */}
<Box marginX={1}>
<Text color={theme.text.secondary}>
(Use Enter to select, Ctrl+L to reset
(Use Enter to select, {formatCommand(Command.CLEAR_SCREEN)} to reset
{showScopeSelector ? ', Tab to change focus' : ''}, Esc to close)
</Text>
</Box>