@google/gemini-cli 0.12.0-preview.9 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,27 +5,60 @@ import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-run
5
5
  * SPDX-License-Identifier: Apache-2.0
6
6
  */
7
7
  import { Box, Text, useIsScreenReaderEnabled } from 'ink';
8
+ import { useEffect, useState } from 'react';
8
9
  import { useAppContext } from '../contexts/AppContext.js';
9
10
  import { useUIState } from '../contexts/UIStateContext.js';
10
11
  import { theme } from '../semantic-colors.js';
11
12
  import { StreamingState } from '../types.js';
12
13
  import { UpdateNotification } from './UpdateNotification.js';
13
- import { GEMINI_DIR } from '@google/gemini-cli-core';
14
- import { homedir } from 'node:os';
14
+ import { GEMINI_DIR, Storage } from '@google/gemini-cli-core';
15
+ import * as fs from 'node:fs/promises';
16
+ import os from 'node:os';
15
17
  import path from 'node:path';
16
- const settingsPath = path.join(homedir(), GEMINI_DIR, 'settings.json');
18
+ const settingsPath = path.join(os.homedir(), GEMINI_DIR, 'settings.json');
19
+ const screenReaderNudgeFilePath = path.join(Storage.getGlobalTempDir(), 'seen_screen_reader_nudge.json');
17
20
  export const Notifications = () => {
18
21
  const { startupWarnings } = useAppContext();
19
22
  const { initError, streamingState, updateInfo } = useUIState();
20
23
  const isScreenReaderEnabled = useIsScreenReaderEnabled();
21
24
  const showStartupWarnings = startupWarnings.length > 0;
22
25
  const showInitError = initError && streamingState !== StreamingState.Responding;
26
+ const [hasSeenScreenReaderNudge, setHasSeenScreenReaderNudge] = useState(undefined);
27
+ useEffect(() => {
28
+ const checkScreenReaderNudge = async () => {
29
+ try {
30
+ await fs.access(screenReaderNudgeFilePath);
31
+ setHasSeenScreenReaderNudge(true);
32
+ }
33
+ catch {
34
+ setHasSeenScreenReaderNudge(false);
35
+ }
36
+ };
37
+ checkScreenReaderNudge();
38
+ }, []);
39
+ const showScreenReaderNudge = isScreenReaderEnabled && hasSeenScreenReaderNudge === false;
40
+ useEffect(() => {
41
+ const writeScreenReaderNudgeFile = async () => {
42
+ if (showScreenReaderNudge) {
43
+ try {
44
+ await fs.mkdir(path.dirname(screenReaderNudgeFilePath), {
45
+ recursive: true,
46
+ });
47
+ await fs.writeFile(screenReaderNudgeFilePath, 'true');
48
+ }
49
+ catch (error) {
50
+ console.error('Error storing screen reader nudge', error);
51
+ }
52
+ }
53
+ };
54
+ writeScreenReaderNudgeFile();
55
+ }, [showScreenReaderNudge]);
23
56
  if (!showStartupWarnings &&
24
57
  !showInitError &&
25
58
  !updateInfo &&
26
- !isScreenReaderEnabled) {
59
+ !showScreenReaderNudge) {
27
60
  return null;
28
61
  }
29
- return (_jsxs(_Fragment, { children: [isScreenReaderEnabled && (_jsxs(Text, { children: ["You are currently in screen reader-friendly view. To switch out, open", ' ', settingsPath, " and remove the entry for ", '"screenReader"', "."] })), updateInfo && _jsx(UpdateNotification, { message: updateInfo.message }), showStartupWarnings && (_jsx(Box, { borderStyle: "round", borderColor: theme.status.warning, paddingX: 1, marginY: 1, flexDirection: "column", children: startupWarnings.map((warning, index) => (_jsx(Text, { color: theme.status.warning, children: warning }, index))) })), showInitError && (_jsxs(Box, { borderStyle: "round", borderColor: theme.status.error, paddingX: 1, marginBottom: 1, children: [_jsxs(Text, { color: theme.status.error, children: ["Initialization Error: ", initError] }), _jsxs(Text, { color: theme.status.error, children: [' ', "Please check API key and configuration."] })] }))] }));
62
+ return (_jsxs(_Fragment, { children: [showScreenReaderNudge && (_jsxs(Text, { children: ["You are currently in screen reader-friendly view. To switch out, open", ' ', settingsPath, " and remove the entry for ", '"screenReader"', ". This will disappear on next run."] })), updateInfo && _jsx(UpdateNotification, { message: updateInfo.message }), showStartupWarnings && (_jsx(Box, { borderStyle: "round", borderColor: theme.status.warning, paddingX: 1, marginY: 1, flexDirection: "column", children: startupWarnings.map((warning, index) => (_jsx(Text, { color: theme.status.warning, children: warning }, index))) })), showInitError && (_jsxs(Box, { borderStyle: "round", borderColor: theme.status.error, paddingX: 1, marginBottom: 1, children: [_jsxs(Text, { color: theme.status.error, children: ["Initialization Error: ", initError] }), _jsxs(Text, { color: theme.status.error, children: [' ', "Please check API key and configuration."] })] }))] }));
30
63
  };
31
64
  //# sourceMappingURL=Notifications.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Notifications.js","sourceRoot":"","sources":["../../../../src/ui/components/Notifications.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,wBAAwB,EAAE,MAAM,KAAK,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,UAAU,EAAE,eAAe,CAAC,CAAC;AAEvE,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,EAAE;IAChC,MAAM,EAAE,eAAe,EAAE,GAAG,aAAa,EAAE,CAAC;IAC5C,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU,EAAE,GAAG,UAAU,EAAE,CAAC;IAC/D,MAAM,qBAAqB,GAAG,wBAAwB,EAAE,CAAC;IACzD,MAAM,mBAAmB,GAAG,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC;IACvD,MAAM,aAAa,GACjB,SAAS,IAAI,cAAc,KAAK,cAAc,CAAC,UAAU,CAAC;IAE5D,IACE,CAAC,mBAAmB;QACpB,CAAC,aAAa;QACd,CAAC,UAAU;QACX,CAAC,qBAAqB,EACtB,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CACL,8BACG,qBAAqB,IAAI,CACxB,MAAC,IAAI,wFACmE,GAAG,EACxE,YAAY,gCAA4B,gBAAgB,SACpD,CACR,EACA,UAAU,IAAI,KAAC,kBAAkB,IAAC,OAAO,EAAE,UAAU,CAAC,OAAO,GAAI,EACjE,mBAAmB,IAAI,CACtB,KAAC,GAAG,IACF,WAAW,EAAC,OAAO,EACnB,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,EACjC,QAAQ,EAAE,CAAC,EACX,OAAO,EAAE,CAAC,EACV,aAAa,EAAC,QAAQ,YAErB,eAAe,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,CACvC,KAAC,IAAI,IAAa,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,YAC1C,OAAO,IADC,KAAK,CAET,CACR,CAAC,GACE,CACP,EACA,aAAa,IAAI,CAChB,MAAC,GAAG,IACF,WAAW,EAAC,OAAO,EACnB,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,EAC/B,QAAQ,EAAE,CAAC,EACX,YAAY,EAAE,CAAC,aAEf,MAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,uCACN,SAAS,IAC3B,EACP,MAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,aAC5B,GAAG,+CAEC,IACH,CACP,IACA,CACJ,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"file":"Notifications.js","sourceRoot":"","sources":["../../../../src/ui/components/Notifications.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,wBAAwB,EAAE,MAAM,KAAK,CAAC;AAC1D,OA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