@google/gemini-cli 0.1.13 → 0.1.15

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.
Files changed (215) hide show
  1. package/README.md +22 -1
  2. package/dist/google-gemini-cli-0.1.13.tgz +0 -0
  3. package/dist/package.json +6 -3
  4. package/dist/src/config/config.d.ts +3 -2
  5. package/dist/src/config/config.js +19 -29
  6. package/dist/src/config/config.js.map +1 -1
  7. package/dist/src/config/settings.d.ts +7 -2
  8. package/dist/src/config/settings.js +25 -10
  9. package/dist/src/config/settings.js.map +1 -1
  10. package/dist/src/gemini.d.ts +1 -0
  11. package/dist/src/gemini.js +28 -35
  12. package/dist/src/gemini.js.map +1 -1
  13. package/dist/src/generated/git-commit.d.ts +1 -1
  14. package/dist/src/generated/git-commit.js +1 -1
  15. package/dist/src/patches/is-in-ci.d.ts +7 -0
  16. package/dist/src/patches/is-in-ci.js +15 -0
  17. package/dist/src/patches/is-in-ci.js.map +1 -0
  18. package/dist/src/services/BuiltinCommandLoader.d.ts +24 -0
  19. package/dist/src/services/BuiltinCommandLoader.js +72 -0
  20. package/dist/src/services/BuiltinCommandLoader.js.map +1 -0
  21. package/dist/src/services/CommandService.d.ts +43 -7
  22. package/dist/src/services/CommandService.js +61 -56
  23. package/dist/src/services/CommandService.js.map +1 -1
  24. package/dist/src/services/FileCommandLoader.d.ts +37 -0
  25. package/dist/src/services/FileCommandLoader.js +179 -0
  26. package/dist/src/services/FileCommandLoader.js.map +1 -0
  27. package/dist/src/services/McpPromptLoader.d.ts +25 -0
  28. package/dist/src/services/McpPromptLoader.js +192 -0
  29. package/dist/src/services/McpPromptLoader.js.map +1 -0
  30. package/dist/src/services/prompt-processors/argumentProcessor.d.ts +21 -0
  31. package/dist/src/services/prompt-processors/argumentProcessor.js +28 -0
  32. package/dist/src/services/prompt-processors/argumentProcessor.js.map +1 -0
  33. package/dist/src/services/prompt-processors/shellProcessor.d.ts +32 -0
  34. package/dist/src/services/prompt-processors/shellProcessor.js +77 -0
  35. package/dist/src/services/prompt-processors/shellProcessor.js.map +1 -0
  36. package/dist/src/services/prompt-processors/types.d.ts +38 -0
  37. package/dist/src/services/prompt-processors/types.js +14 -0
  38. package/dist/src/services/prompt-processors/types.js.map +1 -0
  39. package/dist/src/services/types.d.ts +22 -0
  40. package/dist/src/services/types.js +7 -0
  41. package/dist/src/services/types.js.map +1 -0
  42. package/dist/src/ui/App.js +84 -59
  43. package/dist/src/ui/App.js.map +1 -1
  44. package/dist/src/ui/colors.js +6 -0
  45. package/dist/src/ui/colors.js.map +1 -1
  46. package/dist/src/ui/commands/aboutCommand.js +2 -0
  47. package/dist/src/ui/commands/aboutCommand.js.map +1 -1
  48. package/dist/src/ui/commands/authCommand.js +2 -0
  49. package/dist/src/ui/commands/authCommand.js.map +1 -1
  50. package/dist/src/ui/commands/bugCommand.js +2 -0
  51. package/dist/src/ui/commands/bugCommand.js.map +1 -1
  52. package/dist/src/ui/commands/chatCommand.js +12 -2
  53. package/dist/src/ui/commands/chatCommand.js.map +1 -1
  54. package/dist/src/ui/commands/clearCommand.js +2 -0
  55. package/dist/src/ui/commands/clearCommand.js.map +1 -1
  56. package/dist/src/ui/commands/compressCommand.js +3 -1
  57. package/dist/src/ui/commands/compressCommand.js.map +1 -1
  58. package/dist/src/ui/commands/copyCommand.d.ts +7 -0
  59. package/dist/src/ui/commands/copyCommand.js +59 -0
  60. package/dist/src/ui/commands/copyCommand.js.map +1 -0
  61. package/dist/src/ui/commands/corgiCommand.js +2 -0
  62. package/dist/src/ui/commands/corgiCommand.js.map +1 -1
  63. package/dist/src/ui/commands/docsCommand.js +2 -0
  64. package/dist/src/ui/commands/docsCommand.js.map +1 -1
  65. package/dist/src/ui/commands/editorCommand.js +2 -0
  66. package/dist/src/ui/commands/editorCommand.js.map +1 -1
  67. package/dist/src/ui/commands/extensionsCommand.js +2 -0
  68. package/dist/src/ui/commands/extensionsCommand.js.map +1 -1
  69. package/dist/src/ui/commands/helpCommand.js +3 -1
  70. package/dist/src/ui/commands/helpCommand.js.map +1 -1
  71. package/dist/src/ui/commands/ideCommand.js +20 -22
  72. package/dist/src/ui/commands/ideCommand.js.map +1 -1
  73. package/dist/src/ui/commands/mcpCommand.js +229 -8
  74. package/dist/src/ui/commands/mcpCommand.js.map +1 -1
  75. package/dist/src/ui/commands/memoryCommand.js +11 -4
  76. package/dist/src/ui/commands/memoryCommand.js.map +1 -1
  77. package/dist/src/ui/commands/privacyCommand.js +2 -0
  78. package/dist/src/ui/commands/privacyCommand.js.map +1 -1
  79. package/dist/src/ui/commands/quitCommand.js +3 -1
  80. package/dist/src/ui/commands/quitCommand.js.map +1 -1
  81. package/dist/src/ui/commands/restoreCommand.js +2 -0
  82. package/dist/src/ui/commands/restoreCommand.js.map +1 -1
  83. package/dist/src/ui/commands/statsCommand.js +5 -1
  84. package/dist/src/ui/commands/statsCommand.js.map +1 -1
  85. package/dist/src/ui/commands/themeCommand.js +2 -0
  86. package/dist/src/ui/commands/themeCommand.js.map +1 -1
  87. package/dist/src/ui/commands/toolsCommand.js +2 -0
  88. package/dist/src/ui/commands/toolsCommand.js.map +1 -1
  89. package/dist/src/ui/commands/types.d.ts +41 -3
  90. package/dist/src/ui/commands/types.js +6 -1
  91. package/dist/src/ui/commands/types.js.map +1 -1
  92. package/dist/src/ui/commands/vimCommand.d.ts +7 -0
  93. package/dist/src/ui/commands/vimCommand.js +23 -0
  94. package/dist/src/ui/commands/vimCommand.js.map +1 -0
  95. package/dist/src/ui/components/ContextSummaryDisplay.d.ts +2 -2
  96. package/dist/src/ui/components/ContextSummaryDisplay.js +12 -12
  97. package/dist/src/ui/components/ContextSummaryDisplay.js.map +1 -1
  98. package/dist/src/ui/components/Footer.d.ts +1 -0
  99. package/dist/src/ui/components/Footer.js +2 -2
  100. package/dist/src/ui/components/Footer.js.map +1 -1
  101. package/dist/src/ui/components/Header.js +1 -1
  102. package/dist/src/ui/components/Header.js.map +1 -1
  103. package/dist/src/ui/components/Help.d.ts +1 -1
  104. package/dist/src/ui/components/IDEContextDetailDisplay.d.ts +11 -0
  105. package/dist/src/ui/components/IDEContextDetailDisplay.js +19 -0
  106. package/dist/src/ui/components/IDEContextDetailDisplay.js.map +1 -0
  107. package/dist/src/ui/components/InputPrompt.d.ts +3 -1
  108. package/dist/src/ui/components/InputPrompt.js +14 -100
  109. package/dist/src/ui/components/InputPrompt.js.map +1 -1
  110. package/dist/src/ui/components/ShellConfirmationDialog.d.ts +15 -0
  111. package/dist/src/ui/components/ShellConfirmationDialog.js +44 -0
  112. package/dist/src/ui/components/ShellConfirmationDialog.js.map +1 -0
  113. package/dist/src/ui/components/ThemeDialog.js +42 -17
  114. package/dist/src/ui/components/ThemeDialog.js.map +1 -1
  115. package/dist/src/ui/components/Tips.js +1 -1
  116. package/dist/src/ui/components/Tips.js.map +1 -1
  117. package/dist/src/ui/components/messages/DiffRenderer.d.ts +1 -0
  118. package/dist/src/ui/components/messages/DiffRenderer.js +12 -11
  119. package/dist/src/ui/components/messages/DiffRenderer.js.map +1 -1
  120. package/dist/src/ui/components/messages/ToolConfirmationMessage.js +5 -4
  121. package/dist/src/ui/components/messages/ToolConfirmationMessage.js.map +1 -1
  122. package/dist/src/ui/components/shared/text-buffer.d.ts +273 -3
  123. package/dist/src/ui/components/shared/text-buffer.js +425 -79
  124. package/dist/src/ui/components/shared/text-buffer.js.map +1 -1
  125. package/dist/src/ui/components/shared/vim-buffer-actions.d.ts +72 -0
  126. package/dist/src/ui/components/shared/vim-buffer-actions.js +565 -0
  127. package/dist/src/ui/components/shared/vim-buffer-actions.js.map +1 -0
  128. package/dist/src/ui/contexts/VimModeContext.d.ts +19 -0
  129. package/dist/src/ui/contexts/VimModeContext.js +48 -0
  130. package/dist/src/ui/contexts/VimModeContext.js.map +1 -0
  131. package/dist/src/ui/hooks/atCommandProcessor.js +54 -15
  132. package/dist/src/ui/hooks/atCommandProcessor.js.map +1 -1
  133. package/dist/src/ui/hooks/shellCommandProcessor.d.ts +1 -0
  134. package/dist/src/ui/hooks/shellCommandProcessor.js +139 -186
  135. package/dist/src/ui/hooks/shellCommandProcessor.js.map +1 -1
  136. package/dist/src/ui/hooks/slashCommandProcessor.d.ts +8 -4
  137. package/dist/src/ui/hooks/slashCommandProcessor.js +199 -108
  138. package/dist/src/ui/hooks/slashCommandProcessor.js.map +1 -1
  139. package/dist/src/ui/hooks/useAuthCommand.js +2 -2
  140. package/dist/src/ui/hooks/useAuthCommand.js.map +1 -1
  141. package/dist/src/ui/hooks/useCompletion.d.ts +3 -1
  142. package/dist/src/ui/hooks/useCompletion.js +118 -24
  143. package/dist/src/ui/hooks/useCompletion.js.map +1 -1
  144. package/dist/src/ui/hooks/useConsoleMessages.js +53 -37
  145. package/dist/src/ui/hooks/useConsoleMessages.js.map +1 -1
  146. package/dist/src/ui/hooks/useGeminiStream.js +57 -11
  147. package/dist/src/ui/hooks/useGeminiStream.js.map +1 -1
  148. package/dist/src/ui/hooks/useInputHistory.d.ts +1 -1
  149. package/dist/src/ui/hooks/useKeypress.js +5 -2
  150. package/dist/src/ui/hooks/useKeypress.js.map +1 -1
  151. package/dist/src/ui/hooks/useShellHistory.d.ts +3 -2
  152. package/dist/src/ui/hooks/useShellHistory.js.map +1 -1
  153. package/dist/src/ui/hooks/useThemeCommand.js +24 -23
  154. package/dist/src/ui/hooks/useThemeCommand.js.map +1 -1
  155. package/dist/src/ui/hooks/vim.d.ts +28 -0
  156. package/dist/src/ui/hooks/vim.js +630 -0
  157. package/dist/src/ui/hooks/vim.js.map +1 -0
  158. package/dist/src/ui/themes/ansi-light.js +2 -0
  159. package/dist/src/ui/themes/ansi-light.js.map +1 -1
  160. package/dist/src/ui/themes/ansi.js +2 -0
  161. package/dist/src/ui/themes/ansi.js.map +1 -1
  162. package/dist/src/ui/themes/atom-one-dark.js +2 -0
  163. package/dist/src/ui/themes/atom-one-dark.js.map +1 -1
  164. package/dist/src/ui/themes/ayu-light.js +3 -1
  165. package/dist/src/ui/themes/ayu-light.js.map +1 -1
  166. package/dist/src/ui/themes/ayu.js +3 -1
  167. package/dist/src/ui/themes/ayu.js.map +1 -1
  168. package/dist/src/ui/themes/color-utils.d.ts +21 -0
  169. package/dist/src/ui/themes/color-utils.js +221 -0
  170. package/dist/src/ui/themes/color-utils.js.map +1 -0
  171. package/dist/src/ui/themes/dracula.js +2 -0
  172. package/dist/src/ui/themes/dracula.js.map +1 -1
  173. package/dist/src/ui/themes/github-dark.js +2 -0
  174. package/dist/src/ui/themes/github-dark.js.map +1 -1
  175. package/dist/src/ui/themes/github-light.js +2 -0
  176. package/dist/src/ui/themes/github-light.js.map +1 -1
  177. package/dist/src/ui/themes/googlecode.js +2 -0
  178. package/dist/src/ui/themes/googlecode.js.map +1 -1
  179. package/dist/src/ui/themes/no-color.js +3 -1
  180. package/dist/src/ui/themes/no-color.js.map +1 -1
  181. package/dist/src/ui/themes/shades-of-purple.d.ts +1 -1
  182. package/dist/src/ui/themes/shades-of-purple.js +3 -1
  183. package/dist/src/ui/themes/shades-of-purple.js.map +1 -1
  184. package/dist/src/ui/themes/theme-manager.d.ts +31 -6
  185. package/dist/src/ui/themes/theme-manager.js +113 -34
  186. package/dist/src/ui/themes/theme-manager.js.map +1 -1
  187. package/dist/src/ui/themes/theme.d.ts +23 -3
  188. package/dist/src/ui/themes/theme.js +244 -182
  189. package/dist/src/ui/themes/theme.js.map +1 -1
  190. package/dist/src/ui/themes/xcode.js +2 -0
  191. package/dist/src/ui/themes/xcode.js.map +1 -1
  192. package/dist/src/ui/types.d.ts +9 -1
  193. package/dist/src/ui/utils/CodeColorizer.d.ts +3 -1
  194. package/dist/src/ui/utils/CodeColorizer.js +23 -11
  195. package/dist/src/ui/utils/CodeColorizer.js.map +1 -1
  196. package/dist/src/ui/utils/commandUtils.d.ts +1 -0
  197. package/dist/src/ui/utils/commandUtils.js +47 -0
  198. package/dist/src/ui/utils/commandUtils.js.map +1 -1
  199. package/dist/src/ui/utils/markdownUtilities.js +1 -1
  200. package/dist/src/ui/utils/textUtils.d.ts +0 -8
  201. package/dist/src/ui/utils/textUtils.js +0 -22
  202. package/dist/src/ui/utils/textUtils.js.map +1 -1
  203. package/dist/src/utils/events.d.ts +11 -0
  204. package/dist/src/utils/events.js +13 -0
  205. package/dist/src/utils/events.js.map +1 -0
  206. package/dist/src/utils/sandbox.js +7 -3
  207. package/dist/src/utils/sandbox.js.map +1 -1
  208. package/dist/src/utils/userStartupWarnings.js +22 -1
  209. package/dist/src/utils/userStartupWarnings.js.map +1 -1
  210. package/dist/src/validateNonInterActiveAuth.d.ts +7 -0
  211. package/dist/src/validateNonInterActiveAuth.js +35 -0
  212. package/dist/src/validateNonInterActiveAuth.js.map +1 -0
  213. package/dist/tsconfig.tsbuildinfo +1 -1
  214. package/package.json +7 -4
  215. package/dist/google-gemini-cli-0.1.12.tgz +0 -0
@@ -14,6 +14,7 @@ import { DefaultLight } from './default-light.js';
14
14
  import { DefaultDark } from './default.js';
15
15
  import { ShadesOfPurple } from './shades-of-purple.js';
16
16
  import { XCode } from './xcode.js';
17
+ import { createCustomTheme, validateCustomTheme, } from './theme.js';
17
18
  import { ANSI } from './ansi.js';
18
19
  import { ANSILight } from './ansi-light.js';
19
20
  import { NoColorTheme } from './no-color.js';
@@ -22,6 +23,7 @@ export const DEFAULT_THEME = DefaultDark;
22
23
  class ThemeManager {
23
24
  availableThemes;
24
25
  activeTheme;
26
+ customThemes = new Map();
25
27
  constructor() {
26
28
  this.availableThemes = [
27
29
  AyuDark,
@@ -40,19 +42,116 @@ class ThemeManager {
40
42
  ];
41
43
  this.activeTheme = DEFAULT_THEME;
42
44
  }
45
+ /**
46
+ * Loads custom themes from settings.
47
+ * @param customThemesSettings Custom themes from settings.
48
+ */
49
+ loadCustomThemes(customThemesSettings) {
50
+ this.customThemes.clear();
51
+ if (!customThemesSettings) {
52
+ return;
53
+ }
54
+ for (const [name, customThemeConfig] of Object.entries(customThemesSettings)) {
55
+ const validation = validateCustomTheme(customThemeConfig);
56
+ if (validation.isValid) {
57
+ if (validation.warning) {
58
+ console.warn(`Theme "${name}": ${validation.warning}`);
59
+ }
60
+ const themeWithDefaults = {
61
+ ...DEFAULT_THEME.colors,
62
+ ...customThemeConfig,
63
+ name: customThemeConfig.name || name,
64
+ type: 'custom',
65
+ };
66
+ try {
67
+ const theme = createCustomTheme(themeWithDefaults);
68
+ this.customThemes.set(name, theme);
69
+ }
70
+ catch (error) {
71
+ console.warn(`Failed to load custom theme "${name}":`, error);
72
+ }
73
+ }
74
+ else {
75
+ console.warn(`Invalid custom theme "${name}": ${validation.error}`);
76
+ }
77
+ }
78
+ // If the current active theme is a custom theme, keep it if still valid
79
+ if (this.activeTheme &&
80
+ this.activeTheme.type === 'custom' &&
81
+ this.customThemes.has(this.activeTheme.name)) {
82
+ this.activeTheme = this.customThemes.get(this.activeTheme.name);
83
+ }
84
+ }
85
+ /**
86
+ * Sets the active theme.
87
+ * @param themeName The name of the theme to set as active.
88
+ * @returns True if the theme was successfully set, false otherwise.
89
+ */
90
+ setActiveTheme(themeName) {
91
+ const theme = this.findThemeByName(themeName);
92
+ if (!theme) {
93
+ return false;
94
+ }
95
+ this.activeTheme = theme;
96
+ return true;
97
+ }
98
+ /**
99
+ * Gets the currently active theme.
100
+ * @returns The active theme.
101
+ */
102
+ getActiveTheme() {
103
+ if (process.env.NO_COLOR) {
104
+ return NoColorTheme;
105
+ }
106
+ // Ensure the active theme is always valid (fall back to default if not)
107
+ if (!this.activeTheme || !this.findThemeByName(this.activeTheme.name)) {
108
+ this.activeTheme = DEFAULT_THEME;
109
+ }
110
+ return this.activeTheme;
111
+ }
112
+ /**
113
+ * Gets a list of custom theme names.
114
+ * @returns Array of custom theme names.
115
+ */
116
+ getCustomThemeNames() {
117
+ return Array.from(this.customThemes.keys());
118
+ }
119
+ /**
120
+ * Checks if a theme name is a custom theme.
121
+ * @param themeName The theme name to check.
122
+ * @returns True if the theme is custom.
123
+ */
124
+ isCustomTheme(themeName) {
125
+ return this.customThemes.has(themeName);
126
+ }
43
127
  /**
44
128
  * Returns a list of available theme names.
45
129
  */
46
130
  getAvailableThemes() {
47
- const sortedThemes = [...this.availableThemes].sort((a, b) => {
131
+ const builtInThemes = this.availableThemes.map((theme) => ({
132
+ name: theme.name,
133
+ type: theme.type,
134
+ isCustom: false,
135
+ }));
136
+ const customThemes = Array.from(this.customThemes.values()).map((theme) => ({
137
+ name: theme.name,
138
+ type: theme.type,
139
+ isCustom: true,
140
+ }));
141
+ const allThemes = [...builtInThemes, ...customThemes];
142
+ const sortedThemes = allThemes.sort((a, b) => {
48
143
  const typeOrder = (type) => {
49
144
  switch (type) {
50
145
  case 'dark':
51
146
  return 1;
52
147
  case 'light':
53
148
  return 2;
54
- default:
149
+ case 'ansi':
55
150
  return 3;
151
+ case 'custom':
152
+ return 4; // Custom themes at the end
153
+ default:
154
+ return 5;
56
155
  }
57
156
  };
58
157
  const typeComparison = typeOrder(a.type) - typeOrder(b.type);
@@ -61,47 +160,27 @@ class ThemeManager {
61
160
  }
62
161
  return a.name.localeCompare(b.name);
63
162
  });
64
- return sortedThemes.map((theme) => ({
65
- name: theme.name,
66
- type: theme.type,
67
- }));
163
+ return sortedThemes;
68
164
  }
69
165
  /**
70
- * Sets the active theme.
71
- * @param themeName The name of the theme to activate.
72
- * @returns True if the theme was successfully set, false otherwise.
166
+ * Gets a theme by name.
167
+ * @param themeName The name of the theme to get.
168
+ * @returns The theme if found, undefined otherwise.
73
169
  */
74
- setActiveTheme(themeName) {
75
- const foundTheme = this.findThemeByName(themeName);
76
- if (foundTheme) {
77
- this.activeTheme = foundTheme;
78
- return true;
79
- }
80
- else {
81
- // If themeName is undefined, it means we want to set the default theme.
82
- // If findThemeByName returns undefined (e.g. default theme is also not found for some reason)
83
- // then this will return false.
84
- if (themeName === undefined) {
85
- this.activeTheme = DEFAULT_THEME;
86
- return true;
87
- }
88
- return false;
89
- }
170
+ getTheme(themeName) {
171
+ return this.findThemeByName(themeName);
90
172
  }
91
173
  findThemeByName(themeName) {
92
174
  if (!themeName) {
93
175
  return DEFAULT_THEME;
94
176
  }
95
- return this.availableThemes.find((theme) => theme.name === themeName);
96
- }
97
- /**
98
- * Returns the currently active theme object.
99
- */
100
- getActiveTheme() {
101
- if (process.env.NO_COLOR) {
102
- return NoColorTheme;
177
+ // First check built-in themes
178
+ const builtInTheme = this.availableThemes.find((theme) => theme.name === themeName);
179
+ if (builtInTheme) {
180
+ return builtInTheme;
103
181
  }
104
- return this.activeTheme;
182
+ // Then check custom themes
183
+ return this.customThemes.get(themeName);
105
184
  }
106
185
  }
107
186
  // Export an instance of the ThemeManager
@@ -1 +1 @@
1
- {"version":3,"file":"theme-manager.js","sourceRoot":"","sources":["../../../../src/ui/themes/theme-manager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,OAAO,MAAM,cAAc,CAAC;AAOnC,MAAM,CAAC,MAAM,aAAa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AG,CAAC,SAAS,CAAC,CAAC;IAC1C,CAAC;CACF;AAED,yCAAyC;AACzC,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,YAAY,EAAE,CAAC"}
@@ -4,7 +4,7 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import type { CSSProperties } from 'react';
7
- export type ThemeType = 'light' | 'dark' | 'ansi';
7
+ export type ThemeType = 'light' | 'dark' | 'ansi' | 'custom';
8
8
  export interface ColorsTheme {
9
9
  type: ThemeType;
10
10
  Background: string;
@@ -16,10 +16,16 @@ export interface ColorsTheme {
16
16
  AccentGreen: string;
17
17
  AccentYellow: string;
18
18
  AccentRed: string;
19
+ DiffAdded: string;
20
+ DiffRemoved: string;
19
21
  Comment: string;
20
22
  Gray: string;
21
23
  GradientColors?: string[];
22
24
  }
25
+ export interface CustomTheme extends ColorsTheme {
26
+ type: 'custom';
27
+ name: string;
28
+ }
23
29
  export declare const lightTheme: ColorsTheme;
24
30
  export declare const darkTheme: ColorsTheme;
25
31
  export declare const ansiTheme: ColorsTheme;
@@ -37,8 +43,6 @@ export declare class Theme {
37
43
  * to Ink-compatible color strings (hex or name).
38
44
  */
39
45
  protected readonly _colorMap: Readonly<Record<string, string>>;
40
- private static readonly cssNameToHexMap;
41
- private static readonly inkSupportedNames;
42
46
  /**
43
47
  * Creates a new Theme instance.
44
48
  * @param name The name of the theme.
@@ -65,3 +69,19 @@ export declare class Theme {
65
69
  */
66
70
  protected _buildColorMap(hljsTheme: Record<string, CSSProperties>): Record<string, string>;
67
71
  }
72
+ /**
73
+ * Creates a Theme instance from a custom theme configuration.
74
+ * @param customTheme The custom theme configuration.
75
+ * @returns A new Theme instance.
76
+ */
77
+ export declare function createCustomTheme(customTheme: CustomTheme): Theme;
78
+ /**
79
+ * Validates a custom theme configuration.
80
+ * @param customTheme The custom theme to validate.
81
+ * @returns An object with isValid boolean and error message if invalid.
82
+ */
83
+ export declare function validateCustomTheme(customTheme: Partial<CustomTheme>): {
84
+ isValid: boolean;
85
+ error?: string;
86
+ warning?: string;
87
+ };