@google/gemini-cli 0.1.13 → 0.1.15-nightly.250731.0c6f7884
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.
- package/README.md +50 -1
- package/dist/google-gemini-cli-0.1.15.tgz +0 -0
- package/dist/package.json +6 -3
- package/dist/src/config/config.d.ts +5 -3
- package/dist/src/config/config.js +29 -32
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/extension.d.ts +1 -0
- package/dist/src/config/extension.js +4 -0
- package/dist/src/config/extension.js.map +1 -1
- package/dist/src/config/settings.d.ts +9 -2
- package/dist/src/config/settings.js +25 -10
- package/dist/src/config/settings.js.map +1 -1
- package/dist/src/gemini.d.ts +1 -0
- package/dist/src/gemini.js +41 -36
- package/dist/src/gemini.js.map +1 -1
- package/dist/src/generated/git-commit.d.ts +1 -1
- package/dist/src/generated/git-commit.js +1 -1
- package/dist/src/patches/is-in-ci.d.ts +7 -0
- package/dist/src/patches/is-in-ci.js +15 -0
- package/dist/src/patches/is-in-ci.js.map +1 -0
- package/dist/src/services/BuiltinCommandLoader.d.ts +24 -0
- package/dist/src/services/BuiltinCommandLoader.js +74 -0
- package/dist/src/services/BuiltinCommandLoader.js.map +1 -0
- package/dist/src/services/CommandService.d.ts +47 -7
- package/dist/src/services/CommandService.js +77 -56
- package/dist/src/services/CommandService.js.map +1 -1
- package/dist/src/services/FileCommandLoader.d.ts +49 -0
- package/dist/src/services/FileCommandLoader.js +208 -0
- package/dist/src/services/FileCommandLoader.js.map +1 -0
- package/dist/src/services/McpPromptLoader.d.ts +25 -0
- package/dist/src/services/McpPromptLoader.js +192 -0
- package/dist/src/services/McpPromptLoader.js.map +1 -0
- package/dist/src/services/prompt-processors/argumentProcessor.d.ts +21 -0
- package/dist/src/services/prompt-processors/argumentProcessor.js +28 -0
- package/dist/src/services/prompt-processors/argumentProcessor.js.map +1 -0
- package/dist/src/services/prompt-processors/shellProcessor.d.ts +32 -0
- package/dist/src/services/prompt-processors/shellProcessor.js +77 -0
- package/dist/src/services/prompt-processors/shellProcessor.js.map +1 -0
- package/dist/src/services/prompt-processors/types.d.ts +38 -0
- package/dist/src/services/prompt-processors/types.js +14 -0
- package/dist/src/services/prompt-processors/types.js.map +1 -0
- package/dist/src/services/types.d.ts +22 -0
- package/dist/src/services/types.js +7 -0
- package/dist/src/services/types.js.map +1 -0
- package/dist/src/ui/App.js +96 -64
- package/dist/src/ui/App.js.map +1 -1
- package/dist/src/ui/colors.js +6 -0
- package/dist/src/ui/colors.js.map +1 -1
- package/dist/src/ui/commands/aboutCommand.js +2 -0
- package/dist/src/ui/commands/aboutCommand.js.map +1 -1
- package/dist/src/ui/commands/authCommand.js +2 -0
- package/dist/src/ui/commands/authCommand.js.map +1 -1
- package/dist/src/ui/commands/bugCommand.js +2 -0
- package/dist/src/ui/commands/bugCommand.js.map +1 -1
- package/dist/src/ui/commands/chatCommand.js +51 -3
- package/dist/src/ui/commands/chatCommand.js.map +1 -1
- package/dist/src/ui/commands/clearCommand.js +2 -0
- package/dist/src/ui/commands/clearCommand.js.map +1 -1
- package/dist/src/ui/commands/compressCommand.js +3 -1
- package/dist/src/ui/commands/compressCommand.js.map +1 -1
- package/dist/src/ui/commands/copyCommand.d.ts +7 -0
- package/dist/src/ui/commands/copyCommand.js +59 -0
- package/dist/src/ui/commands/copyCommand.js.map +1 -0
- package/dist/src/ui/commands/corgiCommand.js +2 -0
- package/dist/src/ui/commands/corgiCommand.js.map +1 -1
- package/dist/src/ui/commands/docsCommand.js +2 -0
- package/dist/src/ui/commands/docsCommand.js.map +1 -1
- package/dist/src/ui/commands/editorCommand.js +2 -0
- package/dist/src/ui/commands/editorCommand.js.map +1 -1
- package/dist/src/ui/commands/extensionsCommand.js +2 -0
- package/dist/src/ui/commands/extensionsCommand.js.map +1 -1
- package/dist/src/ui/commands/helpCommand.js +3 -1
- package/dist/src/ui/commands/helpCommand.js.map +1 -1
- package/dist/src/ui/commands/ideCommand.js +103 -109
- package/dist/src/ui/commands/ideCommand.js.map +1 -1
- package/dist/src/ui/commands/initCommand.d.ts +7 -0
- package/dist/src/ui/commands/initCommand.js +76 -0
- package/dist/src/ui/commands/initCommand.js.map +1 -0
- package/dist/src/ui/commands/mcpCommand.js +229 -8
- package/dist/src/ui/commands/mcpCommand.js.map +1 -1
- package/dist/src/ui/commands/memoryCommand.js +11 -4
- package/dist/src/ui/commands/memoryCommand.js.map +1 -1
- package/dist/src/ui/commands/privacyCommand.js +2 -0
- package/dist/src/ui/commands/privacyCommand.js.map +1 -1
- package/dist/src/ui/commands/quitCommand.js +3 -1
- package/dist/src/ui/commands/quitCommand.js.map +1 -1
- package/dist/src/ui/commands/restoreCommand.js +2 -0
- package/dist/src/ui/commands/restoreCommand.js.map +1 -1
- package/dist/src/ui/commands/statsCommand.js +5 -1
- package/dist/src/ui/commands/statsCommand.js.map +1 -1
- package/dist/src/ui/commands/themeCommand.js +2 -0
- package/dist/src/ui/commands/themeCommand.js.map +1 -1
- package/dist/src/ui/commands/toolsCommand.js +2 -0
- package/dist/src/ui/commands/toolsCommand.js.map +1 -1
- package/dist/src/ui/commands/types.d.ts +42 -3
- package/dist/src/ui/commands/types.js +6 -1
- package/dist/src/ui/commands/types.js.map +1 -1
- package/dist/src/ui/commands/vimCommand.d.ts +7 -0
- package/dist/src/ui/commands/vimCommand.js +23 -0
- package/dist/src/ui/commands/vimCommand.js.map +1 -0
- package/dist/src/ui/components/ContextSummaryDisplay.d.ts +2 -2
- package/dist/src/ui/components/ContextSummaryDisplay.js +12 -12
- package/dist/src/ui/components/ContextSummaryDisplay.js.map +1 -1
- package/dist/src/ui/components/Footer.d.ts +1 -0
- package/dist/src/ui/components/Footer.js +2 -2
- package/dist/src/ui/components/Footer.js.map +1 -1
- package/dist/src/ui/components/Header.js +1 -1
- package/dist/src/ui/components/Header.js.map +1 -1
- package/dist/src/ui/components/Help.d.ts +1 -1
- package/dist/src/ui/components/Help.js +2 -2
- package/dist/src/ui/components/Help.js.map +1 -1
- package/dist/src/ui/components/IDEContextDetailDisplay.d.ts +12 -0
- package/dist/src/ui/components/IDEContextDetailDisplay.js +12 -0
- package/dist/src/ui/components/IDEContextDetailDisplay.js.map +1 -0
- package/dist/src/ui/components/InputPrompt.d.ts +3 -1
- package/dist/src/ui/components/InputPrompt.js +20 -99
- package/dist/src/ui/components/InputPrompt.js.map +1 -1
- package/dist/src/ui/components/ShellConfirmationDialog.d.ts +15 -0
- package/dist/src/ui/components/ShellConfirmationDialog.js +44 -0
- package/dist/src/ui/components/ShellConfirmationDialog.js.map +1 -0
- package/dist/src/ui/components/ThemeDialog.js +42 -17
- package/dist/src/ui/components/ThemeDialog.js.map +1 -1
- package/dist/src/ui/components/Tips.js +1 -1
- package/dist/src/ui/components/Tips.js.map +1 -1
- package/dist/src/ui/components/messages/DiffRenderer.d.ts +1 -0
- package/dist/src/ui/components/messages/DiffRenderer.js +12 -11
- package/dist/src/ui/components/messages/DiffRenderer.js.map +1 -1
- package/dist/src/ui/components/messages/ToolConfirmationMessage.js +19 -7
- package/dist/src/ui/components/messages/ToolConfirmationMessage.js.map +1 -1
- package/dist/src/ui/components/shared/text-buffer.d.ts +273 -3
- package/dist/src/ui/components/shared/text-buffer.js +425 -79
- package/dist/src/ui/components/shared/text-buffer.js.map +1 -1
- package/dist/src/ui/components/shared/vim-buffer-actions.d.ts +72 -0
- package/dist/src/ui/components/shared/vim-buffer-actions.js +565 -0
- package/dist/src/ui/components/shared/vim-buffer-actions.js.map +1 -0
- package/dist/src/ui/contexts/VimModeContext.d.ts +19 -0
- package/dist/src/ui/contexts/VimModeContext.js +48 -0
- package/dist/src/ui/contexts/VimModeContext.js.map +1 -0
- package/dist/src/ui/hooks/atCommandProcessor.js +103 -56
- package/dist/src/ui/hooks/atCommandProcessor.js.map +1 -1
- package/dist/src/ui/hooks/shellCommandProcessor.d.ts +1 -0
- package/dist/src/ui/hooks/shellCommandProcessor.js +139 -186
- package/dist/src/ui/hooks/shellCommandProcessor.js.map +1 -1
- package/dist/src/ui/hooks/slashCommandProcessor.d.ts +8 -4
- package/dist/src/ui/hooks/slashCommandProcessor.js +209 -108
- package/dist/src/ui/hooks/slashCommandProcessor.js.map +1 -1
- package/dist/src/ui/hooks/useAuthCommand.js +2 -2
- package/dist/src/ui/hooks/useAuthCommand.js.map +1 -1
- package/dist/src/ui/hooks/useCompletion.d.ts +3 -1
- package/dist/src/ui/hooks/useCompletion.js +173 -65
- package/dist/src/ui/hooks/useCompletion.js.map +1 -1
- package/dist/src/ui/hooks/useConsoleMessages.js +53 -37
- package/dist/src/ui/hooks/useConsoleMessages.js.map +1 -1
- package/dist/src/ui/hooks/useGeminiStream.js +62 -13
- package/dist/src/ui/hooks/useGeminiStream.js.map +1 -1
- package/dist/src/ui/hooks/useInputHistory.d.ts +1 -1
- package/dist/src/ui/hooks/useKeypress.js +5 -2
- package/dist/src/ui/hooks/useKeypress.js.map +1 -1
- package/dist/src/ui/hooks/usePhraseCycler.js +1 -0
- package/dist/src/ui/hooks/usePhraseCycler.js.map +1 -1
- package/dist/src/ui/hooks/useReactToolScheduler.js +0 -1
- package/dist/src/ui/hooks/useReactToolScheduler.js.map +1 -1
- package/dist/src/ui/hooks/useShellHistory.d.ts +3 -2
- package/dist/src/ui/hooks/useShellHistory.js.map +1 -1
- package/dist/src/ui/hooks/useThemeCommand.js +24 -23
- package/dist/src/ui/hooks/useThemeCommand.js.map +1 -1
- package/dist/src/ui/hooks/vim.d.ts +28 -0
- package/dist/src/ui/hooks/vim.js +630 -0
- package/dist/src/ui/hooks/vim.js.map +1 -0
- package/dist/src/ui/themes/ansi-light.js +2 -0
- package/dist/src/ui/themes/ansi-light.js.map +1 -1
- package/dist/src/ui/themes/ansi.js +2 -0
- package/dist/src/ui/themes/ansi.js.map +1 -1
- package/dist/src/ui/themes/atom-one-dark.js +2 -0
- package/dist/src/ui/themes/atom-one-dark.js.map +1 -1
- package/dist/src/ui/themes/ayu-light.js +3 -1
- package/dist/src/ui/themes/ayu-light.js.map +1 -1
- package/dist/src/ui/themes/ayu.js +3 -1
- package/dist/src/ui/themes/ayu.js.map +1 -1
- package/dist/src/ui/themes/color-utils.d.ts +21 -0
- package/dist/src/ui/themes/color-utils.js +221 -0
- package/dist/src/ui/themes/color-utils.js.map +1 -0
- package/dist/src/ui/themes/dracula.js +2 -0
- package/dist/src/ui/themes/dracula.js.map +1 -1
- package/dist/src/ui/themes/github-dark.js +2 -0
- package/dist/src/ui/themes/github-dark.js.map +1 -1
- package/dist/src/ui/themes/github-light.js +2 -0
- package/dist/src/ui/themes/github-light.js.map +1 -1
- package/dist/src/ui/themes/googlecode.js +2 -0
- package/dist/src/ui/themes/googlecode.js.map +1 -1
- package/dist/src/ui/themes/no-color.js +3 -1
- package/dist/src/ui/themes/no-color.js.map +1 -1
- package/dist/src/ui/themes/shades-of-purple.d.ts +1 -1
- package/dist/src/ui/themes/shades-of-purple.js +3 -1
- package/dist/src/ui/themes/shades-of-purple.js.map +1 -1
- package/dist/src/ui/themes/theme-manager.d.ts +31 -6
- package/dist/src/ui/themes/theme-manager.js +113 -34
- package/dist/src/ui/themes/theme-manager.js.map +1 -1
- package/dist/src/ui/themes/theme.d.ts +23 -3
- package/dist/src/ui/themes/theme.js +244 -182
- package/dist/src/ui/themes/theme.js.map +1 -1
- package/dist/src/ui/themes/xcode.js +2 -0
- package/dist/src/ui/themes/xcode.js.map +1 -1
- package/dist/src/ui/types.d.ts +9 -1
- package/dist/src/ui/utils/CodeColorizer.d.ts +3 -1
- package/dist/src/ui/utils/CodeColorizer.js +23 -11
- package/dist/src/ui/utils/CodeColorizer.js.map +1 -1
- package/dist/src/ui/utils/commandUtils.d.ts +1 -0
- package/dist/src/ui/utils/commandUtils.js +47 -0
- package/dist/src/ui/utils/commandUtils.js.map +1 -1
- package/dist/src/ui/utils/markdownUtilities.js +1 -1
- package/dist/src/ui/utils/textUtils.d.ts +0 -8
- package/dist/src/ui/utils/textUtils.js +0 -22
- package/dist/src/ui/utils/textUtils.js.map +1 -1
- package/dist/src/ui/utils/updateCheck.d.ts +7 -1
- package/dist/src/ui/utils/updateCheck.js +9 -3
- package/dist/src/ui/utils/updateCheck.js.map +1 -1
- package/dist/src/utils/events.d.ts +11 -0
- package/dist/src/utils/events.js +13 -0
- package/dist/src/utils/events.js.map +1 -0
- package/dist/src/utils/handleAutoUpdate.d.ts +10 -0
- package/dist/src/utils/handleAutoUpdate.js +97 -0
- package/dist/src/utils/handleAutoUpdate.js.map +1 -0
- package/dist/src/utils/installationInfo.d.ts +23 -0
- package/dist/src/utils/installationInfo.js +154 -0
- package/dist/src/utils/installationInfo.js.map +1 -0
- package/dist/src/utils/sandbox-macos-permissive-closed.sb +6 -0
- package/dist/src/utils/sandbox-macos-permissive-open.sb +6 -0
- package/dist/src/utils/sandbox-macos-permissive-proxied.sb +6 -0
- package/dist/src/utils/sandbox-macos-restrictive-closed.sb +6 -0
- package/dist/src/utils/sandbox-macos-restrictive-open.sb +6 -0
- package/dist/src/utils/sandbox-macos-restrictive-proxied.sb +6 -0
- package/dist/src/utils/sandbox.d.ts +2 -2
- package/dist/src/utils/sandbox.js +36 -13
- package/dist/src/utils/sandbox.js.map +1 -1
- package/dist/src/utils/updateEventEmitter.d.ts +11 -0
- package/dist/src/utils/updateEventEmitter.js +12 -0
- package/dist/src/utils/updateEventEmitter.js.map +1 -0
- package/dist/src/utils/userStartupWarnings.js +22 -1
- package/dist/src/utils/userStartupWarnings.js.map +1 -1
- package/dist/src/validateNonInterActiveAuth.d.ts +7 -0
- package/dist/src/validateNonInterActiveAuth.js +35 -0
- package/dist/src/validateNonInterActiveAuth.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -4
- package/dist/google-gemini-cli-0.1.12.tgz +0 -0
package/dist/src/gemini.js
CHANGED
|
@@ -14,7 +14,7 @@ import v8 from 'node:v8';
|
|
|
14
14
|
import os from 'node:os';
|
|
15
15
|
import { spawn } from 'node:child_process';
|
|
16
16
|
import { start_sandbox } from './utils/sandbox.js';
|
|
17
|
-
import { loadSettings,
|
|
17
|
+
import { loadSettings, SettingScope, } from './config/settings.js';
|
|
18
18
|
import { themeManager } from './ui/themes/theme-manager.js';
|
|
19
19
|
import { getStartupWarnings } from './utils/startupWarnings.js';
|
|
20
20
|
import { getUserStartupWarnings } from './utils/userStartupWarnings.js';
|
|
@@ -22,9 +22,13 @@ import { runNonInteractive } from './nonInteractiveCli.js';
|
|
|
22
22
|
import { loadExtensions } from './config/extension.js';
|
|
23
23
|
import { cleanupCheckpoints, registerCleanup } from './utils/cleanup.js';
|
|
24
24
|
import { getCliVersion } from './utils/version.js';
|
|
25
|
-
import { ApprovalMode, EditTool, ShellTool, WriteFileTool, sessionId, logUserPrompt, AuthType, getOauthClient,
|
|
25
|
+
import { ApprovalMode, EditTool, ShellTool, WriteFileTool, sessionId, logUserPrompt, AuthType, getOauthClient, } from '@google/gemini-cli-core';
|
|
26
26
|
import { validateAuthMethod } from './config/auth.js';
|
|
27
27
|
import { setMaxSizedBoxDebugging } from './ui/components/shared/MaxSizedBox.js';
|
|
28
|
+
import { validateNonInteractiveAuth } from './validateNonInterActiveAuth.js';
|
|
29
|
+
import { checkForUpdates } from './ui/utils/updateCheck.js';
|
|
30
|
+
import { handleAutoUpdate } from './utils/handleAutoUpdate.js';
|
|
31
|
+
import { appEvents, AppEvent } from './utils/events.js';
|
|
28
32
|
function getNodeMemoryArgs(config) {
|
|
29
33
|
const totalMemoryMB = os.totalmem() / (1024 * 1024);
|
|
30
34
|
const heapStats = v8.getHeapStatistics();
|
|
@@ -56,7 +60,27 @@ async function relaunchWithAdditionalArgs(additionalArgs) {
|
|
|
56
60
|
process.exit(0);
|
|
57
61
|
}
|
|
58
62
|
import { runAcpPeer } from './acp/acpPeer.js';
|
|
63
|
+
export function setupUnhandledRejectionHandler() {
|
|
64
|
+
let unhandledRejectionOccurred = false;
|
|
65
|
+
process.on('unhandledRejection', (reason, _promise) => {
|
|
66
|
+
const errorMessage = `=========================================
|
|
67
|
+
This is an unexpected error. Please file a bug report using the /bug tool.
|
|
68
|
+
CRITICAL: Unhandled Promise Rejection!
|
|
69
|
+
=========================================
|
|
70
|
+
Reason: ${reason}${reason instanceof Error && reason.stack
|
|
71
|
+
? `
|
|
72
|
+
Stack trace:
|
|
73
|
+
${reason.stack}`
|
|
74
|
+
: ''}`;
|
|
75
|
+
appEvents.emit(AppEvent.LogError, errorMessage);
|
|
76
|
+
if (!unhandledRejectionOccurred) {
|
|
77
|
+
unhandledRejectionOccurred = true;
|
|
78
|
+
appEvents.emit(AppEvent.OpenDebugConsole);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
59
82
|
export async function main() {
|
|
83
|
+
setupUnhandledRejectionHandler();
|
|
60
84
|
const workspaceRoot = process.cwd();
|
|
61
85
|
const settings = loadSettings(workspaceRoot);
|
|
62
86
|
await cleanupCheckpoints();
|
|
@@ -93,6 +117,8 @@ export async function main() {
|
|
|
93
117
|
}
|
|
94
118
|
setMaxSizedBoxDebugging(config.getDebugMode());
|
|
95
119
|
await config.initialize();
|
|
120
|
+
// Load custom themes from settings
|
|
121
|
+
themeManager.loadCustomThemes(settings.merged.customThemes);
|
|
96
122
|
if (settings.merged.theme) {
|
|
97
123
|
if (!themeManager.setActiveTheme(settings.merged.theme)) {
|
|
98
124
|
// If the theme is not found during initial load, log a warning and continue.
|
|
@@ -121,7 +147,7 @@ export async function main() {
|
|
|
121
147
|
process.exit(1);
|
|
122
148
|
}
|
|
123
149
|
}
|
|
124
|
-
await start_sandbox(sandboxConfig, memoryArgs);
|
|
150
|
+
await start_sandbox(sandboxConfig, memoryArgs, config);
|
|
125
151
|
process.exit(0);
|
|
126
152
|
}
|
|
127
153
|
else {
|
|
@@ -134,7 +160,7 @@ export async function main() {
|
|
|
134
160
|
}
|
|
135
161
|
}
|
|
136
162
|
if (settings.merged.selectedAuthType === AuthType.LOGIN_WITH_GOOGLE &&
|
|
137
|
-
|
|
163
|
+
config.isBrowserLaunchSuppressed()) {
|
|
138
164
|
// Do oauth before app renders to make copying the link possible.
|
|
139
165
|
await getOauthClient(settings.merged.selectedAuthType, config);
|
|
140
166
|
}
|
|
@@ -152,6 +178,16 @@ export async function main() {
|
|
|
152
178
|
const version = await getCliVersion();
|
|
153
179
|
setWindowTitle(basename(workspaceRoot), settings);
|
|
154
180
|
const instance = render(_jsx(React.StrictMode, { children: _jsx(AppWrapper, { config: config, settings: settings, startupWarnings: startupWarnings, version: version }) }), { exitOnCtrlC: false });
|
|
181
|
+
checkForUpdates()
|
|
182
|
+
.then((info) => {
|
|
183
|
+
handleAutoUpdate(info, settings, config.getProjectRoot());
|
|
184
|
+
})
|
|
185
|
+
.catch((err) => {
|
|
186
|
+
// Silently ignore update check errors.
|
|
187
|
+
if (config.getDebugMode()) {
|
|
188
|
+
console.error('Update check failed:', err);
|
|
189
|
+
}
|
|
190
|
+
});
|
|
155
191
|
registerCleanup(() => instance.unmount());
|
|
156
192
|
return;
|
|
157
193
|
}
|
|
@@ -189,20 +225,6 @@ function setWindowTitle(title, settings) {
|
|
|
189
225
|
});
|
|
190
226
|
}
|
|
191
227
|
}
|
|
192
|
-
// --- Global Unhandled Rejection Handler ---
|
|
193
|
-
process.on('unhandledRejection', (reason, _promise) => {
|
|
194
|
-
// Log other unexpected unhandled rejections as critical errors
|
|
195
|
-
console.error('=========================================');
|
|
196
|
-
console.error('CRITICAL: Unhandled Promise Rejection!');
|
|
197
|
-
console.error('=========================================');
|
|
198
|
-
console.error('Reason:', reason);
|
|
199
|
-
console.error('Stack trace may follow:');
|
|
200
|
-
if (!(reason instanceof Error)) {
|
|
201
|
-
console.error(reason);
|
|
202
|
-
}
|
|
203
|
-
// Exit for genuinely unhandled errors
|
|
204
|
-
process.exit(1);
|
|
205
|
-
});
|
|
206
228
|
async function loadNonInteractiveConfig(config, extensions, settings, argv) {
|
|
207
229
|
let finalConfig = config;
|
|
208
230
|
if (config.getApprovalMode() !== ApprovalMode.YOLO) {
|
|
@@ -223,23 +245,6 @@ async function loadNonInteractiveConfig(config, extensions, settings, argv) {
|
|
|
223
245
|
finalConfig = await loadCliConfig(nonInteractiveSettings, extensions, config.getSessionId(), argv);
|
|
224
246
|
await finalConfig.initialize();
|
|
225
247
|
}
|
|
226
|
-
return await
|
|
227
|
-
}
|
|
228
|
-
async function validateNonInterActiveAuth(selectedAuthType, nonInteractiveConfig) {
|
|
229
|
-
// making a special case for the cli. many headless environments might not have a settings.json set
|
|
230
|
-
// so if GEMINI_API_KEY is set, we'll use that. However since the oauth things are interactive anyway, we'll
|
|
231
|
-
// still expect that exists
|
|
232
|
-
if (!selectedAuthType && !process.env.GEMINI_API_KEY) {
|
|
233
|
-
console.error(`Please set an Auth method in your ${USER_SETTINGS_PATH} OR specify GEMINI_API_KEY env variable file before running`);
|
|
234
|
-
process.exit(1);
|
|
235
|
-
}
|
|
236
|
-
selectedAuthType = selectedAuthType || AuthType.USE_GEMINI;
|
|
237
|
-
const err = validateAuthMethod(selectedAuthType);
|
|
238
|
-
if (err != null) {
|
|
239
|
-
console.error(err);
|
|
240
|
-
process.exit(1);
|
|
241
|
-
}
|
|
242
|
-
await nonInteractiveConfig.refreshAuth(selectedAuthType);
|
|
243
|
-
return nonInteractiveConfig;
|
|
248
|
+
return await validateNonInteractiveAuth(settings.merged.selectedAuthType, finalConfig);
|
|
244
249
|
}
|
|
245
250
|
//# sourceMappingURL=gemini.js.map
|
package/dist/src/gemini.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gemini.js","sourceRoot":"","sources":["../../src/gemini.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAW,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,C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This file is auto-generated by the build script (scripts/build.js)
|
|
7
7
|
// Do not edit this file manually.
|
|
8
|
-
export const GIT_COMMIT_INFO = '
|
|
8
|
+
export const GIT_COMMIT_INFO = '0c6f7884 (local modifications)';
|
|
9
9
|
//# sourceMappingURL=git-commit.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
// This is a replacement for the `is-in-ci` package that always returns false.
|
|
7
|
+
// We are doing this to avoid the issue where `ink` does not render the UI
|
|
8
|
+
// when it detects that it is running in a CI environment.
|
|
9
|
+
// This is safe because `ink` (and thus `is-in-ci`) is only used in the
|
|
10
|
+
// interactive code path of the CLI.
|
|
11
|
+
// See issue #1563 for more details.
|
|
12
|
+
const isInCi = false;
|
|
13
|
+
// eslint-disable-next-line import/no-default-export
|
|
14
|
+
export default isInCi;
|
|
15
|
+
//# sourceMappingURL=is-in-ci.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-in-ci.js","sourceRoot":"","sources":["../../../src/patches/is-in-ci.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,8EAA8E;AAC9E,0EAA0E;AAC1E,0DAA0D;AAC1D,uEAAuE;AACvE,oCAAoC;AACpC,oCAAoC;AAEpC,MAAM,MAAM,GAAG,KAAK,CAAC;AAErB,oDAAoD;AACpD,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { ICommandLoader } from './types.js';
|
|
7
|
+
import { SlashCommand } from '../ui/commands/types.js';
|
|
8
|
+
import { Config } from '@google/gemini-cli-core';
|
|
9
|
+
/**
|
|
10
|
+
* Loads the core, hard-coded slash commands that are an integral part
|
|
11
|
+
* of the Gemini CLI application.
|
|
12
|
+
*/
|
|
13
|
+
export declare class BuiltinCommandLoader implements ICommandLoader {
|
|
14
|
+
private config;
|
|
15
|
+
constructor(config: Config | null);
|
|
16
|
+
/**
|
|
17
|
+
* Gathers all raw built-in command definitions, injects dependencies where
|
|
18
|
+
* needed (e.g., config) and filters out any that are not available.
|
|
19
|
+
*
|
|
20
|
+
* @param _signal An AbortSignal (unused for this synchronous loader).
|
|
21
|
+
* @returns A promise that resolves to an array of `SlashCommand` objects.
|
|
22
|
+
*/
|
|
23
|
+
loadCommands(_signal: AbortSignal): Promise<SlashCommand[]>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { aboutCommand } from '../ui/commands/aboutCommand.js';
|
|
7
|
+
import { authCommand } from '../ui/commands/authCommand.js';
|
|
8
|
+
import { bugCommand } from '../ui/commands/bugCommand.js';
|
|
9
|
+
import { chatCommand } from '../ui/commands/chatCommand.js';
|
|
10
|
+
import { clearCommand } from '../ui/commands/clearCommand.js';
|
|
11
|
+
import { compressCommand } from '../ui/commands/compressCommand.js';
|
|
12
|
+
import { copyCommand } from '../ui/commands/copyCommand.js';
|
|
13
|
+
import { corgiCommand } from '../ui/commands/corgiCommand.js';
|
|
14
|
+
import { docsCommand } from '../ui/commands/docsCommand.js';
|
|
15
|
+
import { editorCommand } from '../ui/commands/editorCommand.js';
|
|
16
|
+
import { extensionsCommand } from '../ui/commands/extensionsCommand.js';
|
|
17
|
+
import { helpCommand } from '../ui/commands/helpCommand.js';
|
|
18
|
+
import { ideCommand } from '../ui/commands/ideCommand.js';
|
|
19
|
+
import { initCommand } from '../ui/commands/initCommand.js';
|
|
20
|
+
import { mcpCommand } from '../ui/commands/mcpCommand.js';
|
|
21
|
+
import { memoryCommand } from '../ui/commands/memoryCommand.js';
|
|
22
|
+
import { privacyCommand } from '../ui/commands/privacyCommand.js';
|
|
23
|
+
import { quitCommand } from '../ui/commands/quitCommand.js';
|
|
24
|
+
import { restoreCommand } from '../ui/commands/restoreCommand.js';
|
|
25
|
+
import { statsCommand } from '../ui/commands/statsCommand.js';
|
|
26
|
+
import { themeCommand } from '../ui/commands/themeCommand.js';
|
|
27
|
+
import { toolsCommand } from '../ui/commands/toolsCommand.js';
|
|
28
|
+
import { vimCommand } from '../ui/commands/vimCommand.js';
|
|
29
|
+
/**
|
|
30
|
+
* Loads the core, hard-coded slash commands that are an integral part
|
|
31
|
+
* of the Gemini CLI application.
|
|
32
|
+
*/
|
|
33
|
+
export class BuiltinCommandLoader {
|
|
34
|
+
config;
|
|
35
|
+
constructor(config) {
|
|
36
|
+
this.config = config;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Gathers all raw built-in command definitions, injects dependencies where
|
|
40
|
+
* needed (e.g., config) and filters out any that are not available.
|
|
41
|
+
*
|
|
42
|
+
* @param _signal An AbortSignal (unused for this synchronous loader).
|
|
43
|
+
* @returns A promise that resolves to an array of `SlashCommand` objects.
|
|
44
|
+
*/
|
|
45
|
+
async loadCommands(_signal) {
|
|
46
|
+
const allDefinitions = [
|
|
47
|
+
aboutCommand,
|
|
48
|
+
authCommand,
|
|
49
|
+
bugCommand,
|
|
50
|
+
chatCommand,
|
|
51
|
+
clearCommand,
|
|
52
|
+
compressCommand,
|
|
53
|
+
copyCommand,
|
|
54
|
+
corgiCommand,
|
|
55
|
+
docsCommand,
|
|
56
|
+
editorCommand,
|
|
57
|
+
extensionsCommand,
|
|
58
|
+
helpCommand,
|
|
59
|
+
ideCommand(this.config),
|
|
60
|
+
initCommand,
|
|
61
|
+
mcpCommand,
|
|
62
|
+
memoryCommand,
|
|
63
|
+
privacyCommand,
|
|
64
|
+
quitCommand,
|
|
65
|
+
restoreCommand(this.config),
|
|
66
|
+
statsCommand,
|
|
67
|
+
themeCommand,
|
|
68
|
+
toolsCommand,
|
|
69
|
+
vimCommand,
|
|
70
|
+
];
|
|
71
|
+
return allDefinitions.filter((cmd) => cmd !== null);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=BuiltinCommandLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BuiltinCommandLoader.js","sourceRoot":"","sources":["../../../src/services/BuiltinCommandLoader.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1D;;;GAGG;AACH,MAAM,OAAO,oBAAoB;IACX;IAApB,YAAoB,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAE7C;;;;;;OAMG;IACH,KAAK,CAAC,YAAY,CAAC,OAAoB;QACrC,MAAM,cAAc,GAA+B;YACjD,YAAY;YACZ,WAAW;YACX,UAAU;YACV,WAAW;YACX,YAAY;YACZ,eAAe;YACf,WAAW;YACX,YAAY;YACZ,WAAW;YACX,aAAa;YACb,iBAAiB;YACjB,WAAW;YACX,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC;YACvB,WAAW;YACX,UAAU;YACV,aAAa;YACb,cAAc;YACd,WAAW;YACX,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC;YAC3B,YAAY;YACZ,YAAY;YACZ,YAAY;YACZ,UAAU;SACX,CAAC;QAEF,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC,GAAG,EAAuB,EAAE,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC;IAC3E,CAAC;CACF"}
|
|
@@ -3,13 +3,53 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { Config } from '@google/gemini-cli-core';
|
|
7
6
|
import { SlashCommand } from '../ui/commands/types.js';
|
|
7
|
+
import { ICommandLoader } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Orchestrates the discovery and loading of all slash commands for the CLI.
|
|
10
|
+
*
|
|
11
|
+
* This service operates on a provider-based loader pattern. It is initialized
|
|
12
|
+
* with an array of `ICommandLoader` instances, each responsible for fetching
|
|
13
|
+
* commands from a specific source (e.g., built-in code, local files).
|
|
14
|
+
*
|
|
15
|
+
* The CommandService is responsible for invoking these loaders, aggregating their
|
|
16
|
+
* results, and resolving any name conflicts. This architecture allows the command
|
|
17
|
+
* system to be extended with new sources without modifying the service itself.
|
|
18
|
+
*/
|
|
8
19
|
export declare class CommandService {
|
|
9
|
-
private
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
20
|
+
private readonly commands;
|
|
21
|
+
/**
|
|
22
|
+
* Private constructor to enforce the use of the async factory.
|
|
23
|
+
* @param commands A readonly array of the fully loaded and de-duplicated commands.
|
|
24
|
+
*/
|
|
25
|
+
private constructor();
|
|
26
|
+
/**
|
|
27
|
+
* Asynchronously creates and initializes a new CommandService instance.
|
|
28
|
+
*
|
|
29
|
+
* This factory method orchestrates the entire command loading process. It
|
|
30
|
+
* runs all provided loaders in parallel, aggregates their results, handles
|
|
31
|
+
* name conflicts for extension commands by renaming them, and then returns a
|
|
32
|
+
* fully constructed `CommandService` instance.
|
|
33
|
+
*
|
|
34
|
+
* Conflict resolution:
|
|
35
|
+
* - Extension commands that conflict with existing commands are renamed to
|
|
36
|
+
* `extensionName.commandName`
|
|
37
|
+
* - Non-extension commands (built-in, user, project) override earlier commands
|
|
38
|
+
* with the same name based on loader order
|
|
39
|
+
*
|
|
40
|
+
* @param loaders An array of objects that conform to the `ICommandLoader`
|
|
41
|
+
* interface. Built-in commands should come first, followed by FileCommandLoader.
|
|
42
|
+
* @param signal An AbortSignal to cancel the loading process.
|
|
43
|
+
* @returns A promise that resolves to a new, fully initialized `CommandService` instance.
|
|
44
|
+
*/
|
|
45
|
+
static create(loaders: ICommandLoader[], signal: AbortSignal): Promise<CommandService>;
|
|
46
|
+
/**
|
|
47
|
+
* Retrieves the currently loaded and de-duplicated list of slash commands.
|
|
48
|
+
*
|
|
49
|
+
* This method is a safe accessor for the service's state. It returns a
|
|
50
|
+
* readonly array, preventing consumers from modifying the service's internal state.
|
|
51
|
+
*
|
|
52
|
+
* @returns A readonly, unified array of available `SlashCommand` objects.
|
|
53
|
+
*/
|
|
54
|
+
getCommands(): readonly SlashCommand[];
|
|
15
55
|
}
|
|
@@ -3,65 +3,86 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
import { privacyCommand } from '../ui/commands/privacyCommand.js';
|
|
18
|
-
import { aboutCommand } from '../ui/commands/aboutCommand.js';
|
|
19
|
-
import { extensionsCommand } from '../ui/commands/extensionsCommand.js';
|
|
20
|
-
import { toolsCommand } from '../ui/commands/toolsCommand.js';
|
|
21
|
-
import { compressCommand } from '../ui/commands/compressCommand.js';
|
|
22
|
-
import { ideCommand } from '../ui/commands/ideCommand.js';
|
|
23
|
-
import { bugCommand } from '../ui/commands/bugCommand.js';
|
|
24
|
-
import { quitCommand } from '../ui/commands/quitCommand.js';
|
|
25
|
-
import { restoreCommand } from '../ui/commands/restoreCommand.js';
|
|
26
|
-
const loadBuiltInCommands = async (config) => {
|
|
27
|
-
const allCommands = [
|
|
28
|
-
aboutCommand,
|
|
29
|
-
authCommand,
|
|
30
|
-
bugCommand,
|
|
31
|
-
chatCommand,
|
|
32
|
-
clearCommand,
|
|
33
|
-
compressCommand,
|
|
34
|
-
corgiCommand,
|
|
35
|
-
docsCommand,
|
|
36
|
-
editorCommand,
|
|
37
|
-
extensionsCommand,
|
|
38
|
-
helpCommand,
|
|
39
|
-
ideCommand(config),
|
|
40
|
-
mcpCommand,
|
|
41
|
-
memoryCommand,
|
|
42
|
-
privacyCommand,
|
|
43
|
-
quitCommand,
|
|
44
|
-
restoreCommand(config),
|
|
45
|
-
statsCommand,
|
|
46
|
-
themeCommand,
|
|
47
|
-
toolsCommand,
|
|
48
|
-
];
|
|
49
|
-
return allCommands.filter((command) => command !== null);
|
|
50
|
-
};
|
|
6
|
+
/**
|
|
7
|
+
* Orchestrates the discovery and loading of all slash commands for the CLI.
|
|
8
|
+
*
|
|
9
|
+
* This service operates on a provider-based loader pattern. It is initialized
|
|
10
|
+
* with an array of `ICommandLoader` instances, each responsible for fetching
|
|
11
|
+
* commands from a specific source (e.g., built-in code, local files).
|
|
12
|
+
*
|
|
13
|
+
* The CommandService is responsible for invoking these loaders, aggregating their
|
|
14
|
+
* results, and resolving any name conflicts. This architecture allows the command
|
|
15
|
+
* system to be extended with new sources without modifying the service itself.
|
|
16
|
+
*/
|
|
51
17
|
export class CommandService {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
18
|
+
commands;
|
|
19
|
+
/**
|
|
20
|
+
* Private constructor to enforce the use of the async factory.
|
|
21
|
+
* @param commands A readonly array of the fully loaded and de-duplicated commands.
|
|
22
|
+
*/
|
|
23
|
+
constructor(commands) {
|
|
24
|
+
this.commands = commands;
|
|
59
25
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Asynchronously creates and initializes a new CommandService instance.
|
|
28
|
+
*
|
|
29
|
+
* This factory method orchestrates the entire command loading process. It
|
|
30
|
+
* runs all provided loaders in parallel, aggregates their results, handles
|
|
31
|
+
* name conflicts for extension commands by renaming them, and then returns a
|
|
32
|
+
* fully constructed `CommandService` instance.
|
|
33
|
+
*
|
|
34
|
+
* Conflict resolution:
|
|
35
|
+
* - Extension commands that conflict with existing commands are renamed to
|
|
36
|
+
* `extensionName.commandName`
|
|
37
|
+
* - Non-extension commands (built-in, user, project) override earlier commands
|
|
38
|
+
* with the same name based on loader order
|
|
39
|
+
*
|
|
40
|
+
* @param loaders An array of objects that conform to the `ICommandLoader`
|
|
41
|
+
* interface. Built-in commands should come first, followed by FileCommandLoader.
|
|
42
|
+
* @param signal An AbortSignal to cancel the loading process.
|
|
43
|
+
* @returns A promise that resolves to a new, fully initialized `CommandService` instance.
|
|
44
|
+
*/
|
|
45
|
+
static async create(loaders, signal) {
|
|
46
|
+
const results = await Promise.allSettled(loaders.map((loader) => loader.loadCommands(signal)));
|
|
47
|
+
const allCommands = [];
|
|
48
|
+
for (const result of results) {
|
|
49
|
+
if (result.status === 'fulfilled') {
|
|
50
|
+
allCommands.push(...result.value);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
console.debug('A command loader failed:', result.reason);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const commandMap = new Map();
|
|
57
|
+
for (const cmd of allCommands) {
|
|
58
|
+
let finalName = cmd.name;
|
|
59
|
+
// Extension commands get renamed if they conflict with existing commands
|
|
60
|
+
if (cmd.extensionName && commandMap.has(cmd.name)) {
|
|
61
|
+
let renamedName = `${cmd.extensionName}.${cmd.name}`;
|
|
62
|
+
let suffix = 1;
|
|
63
|
+
// Keep trying until we find a name that doesn't conflict
|
|
64
|
+
while (commandMap.has(renamedName)) {
|
|
65
|
+
renamedName = `${cmd.extensionName}.${cmd.name}${suffix}`;
|
|
66
|
+
suffix++;
|
|
67
|
+
}
|
|
68
|
+
finalName = renamedName;
|
|
69
|
+
}
|
|
70
|
+
commandMap.set(finalName, {
|
|
71
|
+
...cmd,
|
|
72
|
+
name: finalName,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
const finalCommands = Object.freeze(Array.from(commandMap.values()));
|
|
76
|
+
return new CommandService(finalCommands);
|
|
64
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Retrieves the currently loaded and de-duplicated list of slash commands.
|
|
80
|
+
*
|
|
81
|
+
* This method is a safe accessor for the service's state. It returns a
|
|
82
|
+
* readonly array, preventing consumers from modifying the service's internal state.
|
|
83
|
+
*
|
|
84
|
+
* @returns A readonly, unified array of available `SlashCommand` objects.
|
|
85
|
+
*/
|
|
65
86
|
getCommands() {
|
|
66
87
|
return this.commands;
|
|
67
88
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandService.js","sourceRoot":"","sources":["../../../src/services/CommandService.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"CommandService.js","sourceRoot":"","sources":["../../../src/services/CommandService.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;;;;;;;;;GAUG;AACH,MAAM,OAAO,cAAc;IAKY;IAJrC;;;OAGG;IACH,YAAqC,QAAiC;QAAjC,aAAQ,GAAR,QAAQ,CAAyB;IAAG,CAAC;IAE1E;;;;;;;;;;;;;;;;;;OAkBG;IACH,MAAM,CAAC,KAAK,CAAC,MAAM,CACjB,OAAyB,EACzB,MAAmB;QAEnB,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,UAAU,CACtC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CACrD,CAAC;QAEF,MAAM,WAAW,GAAmB,EAAE,CAAC;QACvC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,IAAI,MAAM,CAAC,MAAM,KAAK,WAAW,EAAE,CAAC;gBAClC,WAAW,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;YACpC,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;YAC3D,CAAC;QACH,CAAC;QAED,MAAM,UAAU,GAAG,IAAI,GAAG,EAAwB,CAAC;QACnD,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;YAC9B,IAAI,SAAS,GAAG,GAAG,CAAC,IAAI,CAAC;YAEzB,yEAAyE;YACzE,IAAI,GAAG,CAAC,aAAa,IAAI,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;gBAClD,IAAI,WAAW,GAAG,GAAG,GAAG,CAAC,aAAa,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;gBACrD,IAAI,MAAM,GAAG,CAAC,CAAC;gBAEf,yDAAyD;gBACzD,OAAO,UAAU,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;oBACnC,WAAW,GAAG,GAAG,GAAG,CAAC,aAAa,IAAI,GAAG,CAAC,IAAI,GAAG,MAAM,EAAE,CAAC;oBAC1D,MAAM,EAAE,CAAC;gBACX,CAAC;gBAED,SAAS,GAAG,WAAW,CAAC;YAC1B,CAAC;YAED,UAAU,CAAC,GAAG,CAAC,SAAS,EAAE;gBACxB,GAAG,GAAG;gBACN,IAAI,EAAE,SAAS;aAChB,CAAC,CAAC;QACL,CAAC;QAED,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QACrE,OAAO,IAAI,cAAc,CAAC,aAAa,CAAC,CAAC;IAC3C,CAAC;IAED;;;;;;;OAOG;IACH,WAAW;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Config } from '@google/gemini-cli-core';
|
|
7
|
+
import { ICommandLoader } from './types.js';
|
|
8
|
+
import { SlashCommand } from '../ui/commands/types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Discovers and loads custom slash commands from .toml files in both the
|
|
11
|
+
* user's global config directory and the current project's directory.
|
|
12
|
+
*
|
|
13
|
+
* This loader is responsible for:
|
|
14
|
+
* - Recursively scanning command directories.
|
|
15
|
+
* - Parsing and validating TOML files.
|
|
16
|
+
* - Adapting valid definitions into executable SlashCommand objects.
|
|
17
|
+
* - Handling file system errors and malformed files gracefully.
|
|
18
|
+
*/
|
|
19
|
+
export declare class FileCommandLoader implements ICommandLoader {
|
|
20
|
+
private readonly config;
|
|
21
|
+
private readonly projectRoot;
|
|
22
|
+
constructor(config: Config | null);
|
|
23
|
+
/**
|
|
24
|
+
* Loads all commands from user, project, and extension directories.
|
|
25
|
+
* Returns commands in order: user → project → extensions (alphabetically).
|
|
26
|
+
*
|
|
27
|
+
* Order is important for conflict resolution in CommandService:
|
|
28
|
+
* - User/project commands (without extensionName) use "last wins" strategy
|
|
29
|
+
* - Extension commands (with extensionName) get renamed if conflicts exist
|
|
30
|
+
*
|
|
31
|
+
* @param signal An AbortSignal to cancel the loading process.
|
|
32
|
+
* @returns A promise that resolves to an array of all loaded SlashCommands.
|
|
33
|
+
*/
|
|
34
|
+
loadCommands(signal: AbortSignal): Promise<SlashCommand[]>;
|
|
35
|
+
/**
|
|
36
|
+
* Get all command directories in order for loading.
|
|
37
|
+
* User commands → Project commands → Extension commands
|
|
38
|
+
* This order ensures extension commands can detect all conflicts.
|
|
39
|
+
*/
|
|
40
|
+
private getCommandDirectories;
|
|
41
|
+
/**
|
|
42
|
+
* Parses a single .toml file and transforms it into a SlashCommand object.
|
|
43
|
+
* @param filePath The absolute path to the .toml file.
|
|
44
|
+
* @param baseDir The root command directory for name calculation.
|
|
45
|
+
* @param extensionName Optional extension name to prefix commands with.
|
|
46
|
+
* @returns A promise resolving to a SlashCommand, or null if the file is invalid.
|
|
47
|
+
*/
|
|
48
|
+
private parseAndAdaptFile;
|
|
49
|
+
}
|