fix(cli): resolve devtools build issues and update third-party notices

This commit is contained in:
Alisa Novikova
2026-02-19 16:23:16 -08:00
parent f1c0a695f8
commit 4a599db2bf
45 changed files with 5353 additions and 2960 deletions
+4 -6
View File
@@ -3292,9 +3292,8 @@ describe('AppContainer State Management', () => {
describe('Permission Handling', () => {
it('shows permission dialog when checkPermissions returns paths', async () => {
const { checkPermissions } = await import(
'./hooks/atCommandProcessor.js'
);
const { checkPermissions } =
await import('./hooks/atCommandProcessor.js');
vi.mocked(checkPermissions).mockResolvedValue(['/test/file.txt']);
let unmount: () => void;
@@ -3316,9 +3315,8 @@ describe('AppContainer State Management', () => {
it.each([true, false])(
'handles permissions when allowed is %s',
async (allowed) => {
const { checkPermissions } = await import(
'./hooks/atCommandProcessor.js'
);
const { checkPermissions } =
await import('./hooks/atCommandProcessor.js');
vi.mocked(checkPermissions).mockResolvedValue(['/test/file.txt']);
const addReadOnlyPathSpy = vi.spyOn(
mockConfig.getWorkspaceContext(),
+8 -11
View File
@@ -1392,9 +1392,9 @@ Logging in with Google... Restarting Gemini CLI to continue.
}, []);
const shouldShowIdePrompt = Boolean(
currentIDE &&
!config.getIdeMode() &&
!settings.merged.ide.hasSeenNudge &&
!idePromptAnswered,
!config.getIdeMode() &&
!settings.merged.ide.hasSeenNudge &&
!idePromptAnswered,
);
const [showErrorDetails, setShowErrorDetails] = useState<boolean>(false);
@@ -1656,9 +1656,8 @@ Logging in with Google... Restarting Gemini CLI to continue.
if (keyMatchers[Command.SHOW_ERROR_DETAILS](key)) {
if (settings.merged.general.devtools) {
void (async () => {
const { toggleDevToolsPanel } = await import(
'../utils/devtoolsService.js'
);
const { toggleDevToolsPanel } =
await import('../utils/devtoolsService.js');
await toggleDevToolsPanel(
config,
showErrorDetails,
@@ -2073,11 +2072,9 @@ Logging in with Google... Restarting Gemini CLI to continue.
let isMounted = true;
const fetchBannerTexts = async () => {
const [defaultBanner, warningBanner] = await Promise.all([
// TODO: temporarily disabling the banner, it will be re-added.
'',
config.getBannerTextCapacityIssues(),
]);
// TODO: temporarily disabling the banner, it will be re-added.
const defaultBanner = '';
const warningBanner = await config.getBannerTextCapacityIssues();
if (isMounted) {
setDefaultBannerText(defaultBanner);
@@ -73,9 +73,8 @@ describe('authCommand', () => {
const logoutCommand = authCommand.subCommands?.[1];
expect(logoutCommand?.name).toBe('logout');
const { clearCachedCredentialFile } = await import(
'@google/gemini-cli-core'
);
const { clearCachedCredentialFile } =
await import('@google/gemini-cli-core');
await logoutCommand!.action!(mockContext, '');
@@ -1048,9 +1048,8 @@ describe('extensionsCommand', () => {
const prompts = (await import('prompts')).default;
vi.mocked(prompts).mockResolvedValue({ overwrite: true });
const { getScopedEnvContents } = await import(
'../../config/extensions/extensionSettings.js'
);
const { getScopedEnvContents } =
await import('../../config/extensions/extensionSettings.js');
vi.mocked(getScopedEnvContents).mockResolvedValue({});
});
+4 -4
View File
@@ -142,15 +142,15 @@ const inScreen = (): boolean =>
const isSSH = (): boolean =>
Boolean(
process.env['SSH_TTY'] ||
process.env['SSH_CONNECTION'] ||
process.env['SSH_CLIENT'],
process.env['SSH_CONNECTION'] ||
process.env['SSH_CLIENT'],
);
const isWSL = (): boolean =>
Boolean(
process.env['WSL_DISTRO_NAME'] ||
process.env['WSLENV'] ||
process.env['WSL_INTEROP'],
process.env['WSLENV'] ||
process.env['WSL_INTEROP'],
);
const isWindowsTerminal = (): boolean =>
+10 -15
View File
@@ -220,9 +220,8 @@ describe('rewindFileOps', () => {
});
it('reverts exact match', async () => {
const { getFileDiffFromResultDisplay } = await import(
'@google/gemini-cli-core'
);
const { getFileDiffFromResultDisplay } =
await import('@google/gemini-cli-core');
vi.mocked(getFileDiffFromResultDisplay).mockReturnValue({
filePath: '/abs/path/test.ts',
fileName: 'test.ts',
@@ -270,9 +269,8 @@ describe('rewindFileOps', () => {
});
it('deletes new file on revert', async () => {
const { getFileDiffFromResultDisplay } = await import(
'@google/gemini-cli-core'
);
const { getFileDiffFromResultDisplay } =
await import('@google/gemini-cli-core');
vi.mocked(getFileDiffFromResultDisplay).mockReturnValue({
filePath: '/abs/path/new.ts',
fileName: 'new.ts',
@@ -317,9 +315,8 @@ describe('rewindFileOps', () => {
});
it('handles smart revert (patching) successfully', async () => {
const { getFileDiffFromResultDisplay } = await import(
'@google/gemini-cli-core'
);
const { getFileDiffFromResultDisplay } =
await import('@google/gemini-cli-core');
vi.mocked(getFileDiffFromResultDisplay).mockReturnValue({
filePath: '/abs/path/test.ts',
fileName: 'test.ts',
@@ -369,9 +366,8 @@ describe('rewindFileOps', () => {
});
it('emits warning on smart revert failure', async () => {
const { getFileDiffFromResultDisplay } = await import(
'@google/gemini-cli-core'
);
const { getFileDiffFromResultDisplay } =
await import('@google/gemini-cli-core');
vi.mocked(getFileDiffFromResultDisplay).mockReturnValue({
filePath: '/abs/path/test.ts',
fileName: 'test.ts',
@@ -421,9 +417,8 @@ describe('rewindFileOps', () => {
});
it('emits error if fs.readFile fails with a generic error', async () => {
const { getFileDiffFromResultDisplay } = await import(
'@google/gemini-cli-core'
);
const { getFileDiffFromResultDisplay } =
await import('@google/gemini-cli-core');
vi.mocked(getFileDiffFromResultDisplay).mockReturnValue({
filePath: '/abs/path/test.ts',
fileName: 'test.ts',
+3 -2
View File
@@ -47,13 +47,14 @@ describe('textUtils', () => {
describe('getCachedStringWidth', () => {
it('should handle unicode characters that crash string-width', () => {
// U+0602 caused string-width to crash (see #16418)
// Newer versions of string-width correctly identify it as width 0.
const char = '؂';
expect(getCachedStringWidth(char)).toBe(1);
expect(getCachedStringWidth(char)).toBe(0);
});
it('should handle unicode characters that crash string-width with ANSI codes', () => {
const charWithAnsi = '\u001b[31m' + '؂' + '\u001b[0m';
expect(getCachedStringWidth(charWithAnsi)).toBe(1);
expect(getCachedStringWidth(charWithAnsi)).toBe(0);
});
});