diff --git a/packages/core/src/utils/compatibility.test.ts b/packages/core/src/utils/compatibility.test.ts index dfa9ffb14f..45c81bc9a1 100644 --- a/packages/core/src/utils/compatibility.test.ts +++ b/packages/core/src/utils/compatibility.test.ts @@ -94,6 +94,8 @@ describe('compatibility', () => { }, { env: {}, expected: false, desc: 'no env vars set' }, ])('should return $expected when $desc', ({ env, expected }) => { + vi.stubEnv('TERMINAL_EMULATOR', ''); + vi.stubEnv('JETBRAINS_IDE', ''); for (const [key, value] of Object.entries(env)) { vi.stubEnv(key, value); } @@ -140,6 +142,7 @@ describe('compatibility', () => { it('should return false when TERM=xterm-256color', () => { vi.stubEnv('TERM', 'xterm-256color'); + vi.stubEnv('COLORTERM', ''); expect(isLowColorTmux()).toBe(false); }); }); @@ -230,6 +233,8 @@ describe('compatibility', () => { process.stdout.getColorDepth = vi.fn().mockReturnValue(depth); if (term !== undefined) { vi.stubEnv('TERM', term); + } else { + vi.stubEnv('TERM', ''); } expect(supports256Colors()).toBe(expected); }); @@ -278,6 +283,14 @@ describe('compatibility', () => { describe('getCompatibilityWarnings', () => { beforeEach(() => { + // Clear out potential local environment variables that might trigger warnings + vi.stubEnv('TERMINAL_EMULATOR', ''); + vi.stubEnv('JETBRAINS_IDE', ''); + vi.stubEnv('TMUX', ''); + vi.stubEnv('STY', ''); + vi.stubEnv('TERM', 'xterm-256color'); // Prevent dumb terminal warning + vi.stubEnv('TERM_PROGRAM', ''); + // Default to supporting true color to keep existing tests simple vi.stubEnv('COLORTERM', 'truecolor'); process.stdout.getColorDepth = vi.fn().mockReturnValue(24); diff --git a/packages/core/src/utils/compatibility.ts b/packages/core/src/utils/compatibility.ts index 0b902c064d..d19b07dc75 100644 --- a/packages/core/src/utils/compatibility.ts +++ b/packages/core/src/utils/compatibility.ts @@ -160,7 +160,7 @@ export function getCompatibilityWarnings(options?: { warnings.push({ id: 'jetbrains-terminal', message: - '⚠️ JetBrains terminal detected — alternate buffer mode may cause scroll wheel issues and rendering artifacts. If you experience problems, disable it in /settings → "Use Alternate Screen Buffer".', + 'Warning: JetBrains terminal detected — alternate buffer mode may cause scroll wheel issues and rendering artifacts. If you experience problems, disable it in /settings → "Use Alternate Screen Buffer".', priority: WarningPriority.High, }); } @@ -169,7 +169,7 @@ export function getCompatibilityWarnings(options?: { warnings.push({ id: 'tmux-alternate-buffer', message: - '⚠️ tmux detected — alternate buffer mode may cause unexpected scrollback loss and flickering. If you experience issues, disable it in /settings → "Use Alternate Screen Buffer".\n Tip: Use Ctrl-b [ to access tmux copy mode for scrolling history.', + 'Warning: tmux detected — alternate buffer mode may cause unexpected scrollback loss and flickering. If you experience issues, disable it in /settings → "Use Alternate Screen Buffer".\n Tip: Use Ctrl-b [ to access tmux copy mode for scrolling history.', priority: WarningPriority.High, }); } @@ -178,7 +178,7 @@ export function getCompatibilityWarnings(options?: { warnings.push({ id: 'low-color-tmux', message: - '⚠️ Limited color support detected (TERM=screen). Some visual elements may not render correctly. For better color support in tmux, add to ~/.tmux.conf:\n set -g default-terminal "tmux-256color"\n set -ga terminal-overrides ",*256col*:Tc"', + 'Warning: Limited color support detected (TERM=screen). Some visual elements may not render correctly. For better color support in tmux, add to ~/.tmux.conf:\n set -g default-terminal "tmux-256color"\n set -ga terminal-overrides ",*256col*:Tc"', priority: WarningPriority.High, }); } @@ -187,7 +187,7 @@ export function getCompatibilityWarnings(options?: { warnings.push({ id: 'gnu-screen', message: - '⚠️ GNU screen detected. Some keyboard shortcuts and visual features may behave unexpectedly. For the best experience, consider using tmux or running Gemini CLI directly in your terminal.', + 'Warning: GNU screen detected. Some keyboard shortcuts and visual features may behave unexpectedly. For the best experience, consider using tmux or running Gemini CLI directly in your terminal.', priority: WarningPriority.Low, }); } @@ -196,7 +196,7 @@ export function getCompatibilityWarnings(options?: { warnings.push({ id: 'dumb-terminal', message: - '⚠️ Basic terminal detected (TERM=dumb). Visual rendering will be limited. For the best experience, use a terminal emulator with truecolor support.', + 'Warning: Basic terminal detected (TERM=dumb). Visual rendering will be limited. For the best experience, use a terminal emulator with truecolor support.', priority: WarningPriority.High, }); }