@google/gemini-cli 0.1.15 → 0.1.16
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 +32 -0
- package/dist/google-gemini-cli-0.1.15.tgz +0 -0
- package/dist/package.json +2 -2
- package/dist/src/config/config.d.ts +4 -2
- package/dist/src/config/config.js +36 -14
- 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 +6 -0
- package/dist/src/config/settings.js +34 -18
- package/dist/src/config/settings.js.map +1 -1
- package/dist/src/gemini.d.ts +2 -0
- package/dist/src/gemini.js +30 -3
- 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/nonInteractiveCli.js +15 -40
- package/dist/src/nonInteractiveCli.js.map +1 -1
- package/dist/src/services/BuiltinCommandLoader.js +8 -1
- package/dist/src/services/BuiltinCommandLoader.js.map +1 -1
- package/dist/src/services/CommandService.d.ts +8 -4
- package/dist/src/services/CommandService.js +24 -8
- package/dist/src/services/CommandService.js.map +1 -1
- package/dist/src/services/FileCommandLoader.d.ts +15 -3
- package/dist/src/services/FileCommandLoader.js +64 -35
- package/dist/src/services/FileCommandLoader.js.map +1 -1
- package/dist/src/ui/App.js +29 -16
- package/dist/src/ui/App.js.map +1 -1
- package/dist/src/ui/commands/chatCommand.js +39 -1
- package/dist/src/ui/commands/chatCommand.js.map +1 -1
- package/dist/src/ui/commands/directoryCommand.d.ts +8 -0
- package/dist/src/ui/commands/directoryCommand.js +116 -0
- package/dist/src/ui/commands/directoryCommand.js.map +1 -0
- package/dist/src/ui/commands/ideCommand.js +101 -105
- 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/memoryCommand.js +2 -1
- package/dist/src/ui/commands/memoryCommand.js.map +1 -1
- package/dist/src/ui/commands/setupGithubCommand.d.ts +7 -0
- package/dist/src/ui/commands/setupGithubCommand.js +49 -0
- package/dist/src/ui/commands/setupGithubCommand.js.map +1 -0
- package/dist/src/ui/commands/types.d.ts +1 -0
- package/dist/src/ui/components/ContextSummaryDisplay.d.ts +2 -2
- package/dist/src/ui/components/ContextSummaryDisplay.js +8 -8
- package/dist/src/ui/components/ContextSummaryDisplay.js.map +1 -1
- package/dist/src/ui/components/DebugProfiler.d.ts +6 -0
- package/dist/src/ui/components/DebugProfiler.js +26 -0
- package/dist/src/ui/components/DebugProfiler.js.map +1 -0
- package/dist/src/ui/components/Footer.js +3 -2
- package/dist/src/ui/components/Footer.js.map +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 +4 -3
- package/dist/src/ui/components/IDEContextDetailDisplay.js +6 -13
- package/dist/src/ui/components/IDEContextDetailDisplay.js.map +1 -1
- package/dist/src/ui/components/InputPrompt.js +8 -1
- package/dist/src/ui/components/InputPrompt.js.map +1 -1
- package/dist/src/ui/components/messages/ToolConfirmationMessage.js +15 -4
- package/dist/src/ui/components/messages/ToolConfirmationMessage.js.map +1 -1
- package/dist/src/ui/components/messages/UserMessage.js +4 -1
- package/dist/src/ui/components/messages/UserMessage.js.map +1 -1
- package/dist/src/ui/components/shared/text-buffer.js +9 -14
- package/dist/src/ui/components/shared/text-buffer.js.map +1 -1
- package/dist/src/ui/editors/editorSettingsManager.js +6 -13
- package/dist/src/ui/editors/editorSettingsManager.js.map +1 -1
- package/dist/src/ui/hooks/atCommandProcessor.js +56 -48
- package/dist/src/ui/hooks/atCommandProcessor.js.map +1 -1
- package/dist/src/ui/hooks/slashCommandProcessor.js +12 -2
- package/dist/src/ui/hooks/slashCommandProcessor.js.map +1 -1
- package/dist/src/ui/hooks/useCompletion.d.ts +1 -1
- package/dist/src/ui/hooks/useCompletion.js +142 -126
- package/dist/src/ui/hooks/useCompletion.js.map +1 -1
- package/dist/src/ui/hooks/useGeminiStream.js +5 -2
- package/dist/src/ui/hooks/useGeminiStream.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/utils/updateCheck.d.ts +7 -1
- package/dist/src/ui/utils/updateCheck.js +46 -8
- package/dist/src/ui/utils/updateCheck.js.map +1 -1
- package/dist/src/utils/gitUtils.d.ts +10 -0
- package/dist/src/utils/gitUtils.js +24 -0
- package/dist/src/utils/gitUtils.js.map +1 -0
- package/dist/src/utils/handleAutoUpdate.d.ts +11 -0
- package/dist/src/utils/handleAutoUpdate.js +98 -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 +35 -11
- package/dist/src/utils/sandbox.js.map +1 -1
- package/dist/src/utils/spawnWrapper.d.ts +7 -0
- package/dist/src/utils/spawnWrapper.js +8 -0
- package/dist/src/utils/spawnWrapper.js.map +1 -0
- 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/validateNonInterActiveAuth.d.ts +1 -1
- package/dist/src/validateNonInterActiveAuth.js +7 -5
- package/dist/src/validateNonInterActiveAuth.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/dist/google-gemini-cli-0.1.13.tgz +0 -0
|
@@ -3,27 +3,8 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { executeToolCall, shutdownTelemetry, isTelemetrySdkInitialized, } from '@google/gemini-cli-core';
|
|
6
|
+
import { executeToolCall, shutdownTelemetry, isTelemetrySdkInitialized, GeminiEventType, ToolErrorType, } from '@google/gemini-cli-core';
|
|
7
7
|
import { parseAndFormatApiError } from './ui/utils/errorParsing.js';
|
|
8
|
-
function getResponseText(response) {
|
|
9
|
-
if (response.candidates && response.candidates.length > 0) {
|
|
10
|
-
const candidate = response.candidates[0];
|
|
11
|
-
if (candidate.content &&
|
|
12
|
-
candidate.content.parts &&
|
|
13
|
-
candidate.content.parts.length > 0) {
|
|
14
|
-
// We are running in headless mode so we don't need to return thoughts to STDOUT.
|
|
15
|
-
const thoughtPart = candidate.content.parts[0];
|
|
16
|
-
if (thoughtPart?.thought) {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
return candidate.content.parts
|
|
20
|
-
.filter((part) => part.text)
|
|
21
|
-
.map((part) => part.text)
|
|
22
|
-
.join('');
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
8
|
export async function runNonInteractive(config, input, prompt_id) {
|
|
28
9
|
await config.initialize();
|
|
29
10
|
// Handle EPIPE errors when the output is piped to a command that closes early.
|
|
@@ -35,39 +16,35 @@ export async function runNonInteractive(config, input, prompt_id) {
|
|
|
35
16
|
});
|
|
36
17
|
const geminiClient = config.getGeminiClient();
|
|
37
18
|
const toolRegistry = await config.getToolRegistry();
|
|
38
|
-
const chat = await geminiClient.getChat();
|
|
39
19
|
const abortController = new AbortController();
|
|
40
20
|
let currentMessages = [{ role: 'user', parts: [{ text: input }] }];
|
|
41
21
|
let turnCount = 0;
|
|
42
22
|
try {
|
|
43
23
|
while (true) {
|
|
44
24
|
turnCount++;
|
|
45
|
-
if (config.getMaxSessionTurns()
|
|
25
|
+
if (config.getMaxSessionTurns() >= 0 &&
|
|
46
26
|
turnCount > config.getMaxSessionTurns()) {
|
|
47
27
|
console.error('\n Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json.');
|
|
48
28
|
return;
|
|
49
29
|
}
|
|
50
30
|
const functionCalls = [];
|
|
51
|
-
const responseStream =
|
|
52
|
-
|
|
53
|
-
config: {
|
|
54
|
-
abortSignal: abortController.signal,
|
|
55
|
-
tools: [
|
|
56
|
-
{ functionDeclarations: toolRegistry.getFunctionDeclarations() },
|
|
57
|
-
],
|
|
58
|
-
},
|
|
59
|
-
}, prompt_id);
|
|
60
|
-
for await (const resp of responseStream) {
|
|
31
|
+
const responseStream = geminiClient.sendMessageStream(currentMessages[0]?.parts || [], abortController.signal, prompt_id);
|
|
32
|
+
for await (const event of responseStream) {
|
|
61
33
|
if (abortController.signal.aborted) {
|
|
62
34
|
console.error('Operation cancelled.');
|
|
63
35
|
return;
|
|
64
36
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
process.stdout.write(textPart);
|
|
37
|
+
if (event.type === GeminiEventType.Content) {
|
|
38
|
+
process.stdout.write(event.value);
|
|
68
39
|
}
|
|
69
|
-
if (
|
|
70
|
-
|
|
40
|
+
else if (event.type === GeminiEventType.ToolCallRequest) {
|
|
41
|
+
const toolCallRequest = event.value;
|
|
42
|
+
const fc = {
|
|
43
|
+
name: toolCallRequest.name,
|
|
44
|
+
args: toolCallRequest.args,
|
|
45
|
+
id: toolCallRequest.callId,
|
|
46
|
+
};
|
|
47
|
+
functionCalls.push(fc);
|
|
71
48
|
}
|
|
72
49
|
}
|
|
73
50
|
if (functionCalls.length > 0) {
|
|
@@ -83,11 +60,9 @@ export async function runNonInteractive(config, input, prompt_id) {
|
|
|
83
60
|
};
|
|
84
61
|
const toolResponse = await executeToolCall(config, requestInfo, toolRegistry, abortController.signal);
|
|
85
62
|
if (toolResponse.error) {
|
|
86
|
-
const isToolNotFound = toolResponse.error.message.includes('not found in registry');
|
|
87
63
|
console.error(`Error executing tool ${fc.name}: ${toolResponse.resultDisplay || toolResponse.error.message}`);
|
|
88
|
-
if (
|
|
64
|
+
if (toolResponse.errorType === ToolErrorType.UNHANDLED_EXCEPTION)
|
|
89
65
|
process.exit(1);
|
|
90
|
-
}
|
|
91
66
|
}
|
|
92
67
|
if (toolResponse.responseParts) {
|
|
93
68
|
const parts = Array.isArray(toolResponse.responseParts)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nonInteractiveCli.js","sourceRoot":"","sources":["../../src/nonInteractiveCli.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAGL,eAAe,EAEf,iBAAiB,EACjB,yBAAyB,
|
|
1
|
+
{"version":3,"file":"nonInteractiveCli.js","sourceRoot":"","sources":["../../src/nonInteractiveCli.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAGL,eAAe,EAEf,iBAAiB,EACjB,yBAAyB,EACzB,eAAe,EACf,aAAa,GACd,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAAc,EACd,KAAa,EACb,SAAiB;IAEjB,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC;IAC1B,+EAA+E;IAC/E,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAA0B,EAAE,EAAE;QACxD,IAAI,GAAG,CAAC,IAAI,KAAK,OAAO,EAAE,CAA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BAC/B,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,aAAa,CAAC;4BACrD,CAAC,CAAC,YAAY,CAAC,aAAa;4BAC5B,CAAC,CAAC,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;wBACjC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;4BACzB,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;gCAC7B,iBAAiB,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;4BACzC,CAAC;iCAAM,IAAI,IAAI,EAAE,CAAC;gCAChB,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;4BAC/B,CAAC;wBACH,CAAC;oBACH,CAAC;gBACH,CAAC;gBACD,eAAe,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC,CAAC;YACjE,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,yBAAyB;gBACrD,OAAO;YACT,CAAC;QACH,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CACX,sBAAsB,CACpB,KAAK,EACL,MAAM,CAAC,yBAAyB,EAAE,EAAE,QAAQ,CAC7C,CACF,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;YAAS,CAAC;QACT,IAAI,yBAAyB,EAAE,EAAE,CAAC;YAChC,MAAM,iBAAiB,EAAE,CAAC;QAC5B,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -12,10 +12,12 @@ import { compressCommand } from '../ui/commands/compressCommand.js';
|
|
|
12
12
|
import { copyCommand } from '../ui/commands/copyCommand.js';
|
|
13
13
|
import { corgiCommand } from '../ui/commands/corgiCommand.js';
|
|
14
14
|
import { docsCommand } from '../ui/commands/docsCommand.js';
|
|
15
|
+
import { directoryCommand } from '../ui/commands/directoryCommand.js';
|
|
15
16
|
import { editorCommand } from '../ui/commands/editorCommand.js';
|
|
16
17
|
import { extensionsCommand } from '../ui/commands/extensionsCommand.js';
|
|
17
18
|
import { helpCommand } from '../ui/commands/helpCommand.js';
|
|
18
19
|
import { ideCommand } from '../ui/commands/ideCommand.js';
|
|
20
|
+
import { initCommand } from '../ui/commands/initCommand.js';
|
|
19
21
|
import { mcpCommand } from '../ui/commands/mcpCommand.js';
|
|
20
22
|
import { memoryCommand } from '../ui/commands/memoryCommand.js';
|
|
21
23
|
import { privacyCommand } from '../ui/commands/privacyCommand.js';
|
|
@@ -25,6 +27,8 @@ import { statsCommand } from '../ui/commands/statsCommand.js';
|
|
|
25
27
|
import { themeCommand } from '../ui/commands/themeCommand.js';
|
|
26
28
|
import { toolsCommand } from '../ui/commands/toolsCommand.js';
|
|
27
29
|
import { vimCommand } from '../ui/commands/vimCommand.js';
|
|
30
|
+
import { setupGithubCommand } from '../ui/commands/setupGithubCommand.js';
|
|
31
|
+
import { isGitHubRepository } from '../utils/gitUtils.js';
|
|
28
32
|
/**
|
|
29
33
|
* Loads the core, hard-coded slash commands that are an integral part
|
|
30
34
|
* of the Gemini CLI application.
|
|
@@ -52,19 +56,22 @@ export class BuiltinCommandLoader {
|
|
|
52
56
|
copyCommand,
|
|
53
57
|
corgiCommand,
|
|
54
58
|
docsCommand,
|
|
59
|
+
directoryCommand,
|
|
55
60
|
editorCommand,
|
|
56
61
|
extensionsCommand,
|
|
57
62
|
helpCommand,
|
|
58
63
|
ideCommand(this.config),
|
|
64
|
+
initCommand,
|
|
65
|
+
mcpCommand,
|
|
59
66
|
memoryCommand,
|
|
60
67
|
privacyCommand,
|
|
61
|
-
mcpCommand,
|
|
62
68
|
quitCommand,
|
|
63
69
|
restoreCommand(this.config),
|
|
64
70
|
statsCommand,
|
|
65
71
|
themeCommand,
|
|
66
72
|
toolsCommand,
|
|
67
73
|
vimCommand,
|
|
74
|
+
...(isGitHubRepository() ? [setupGithubCommand] : []),
|
|
68
75
|
];
|
|
69
76
|
return allDefinitions.filter((cmd) => cmd !== null);
|
|
70
77
|
}
|
|
@@ -1 +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,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,OA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AC,MAAM,CAAC;YAC3B,YAAY;YACZ,YAAY;YACZ,YAAY;YACZ,UAAU;YACV,GAAG,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SACtD,CAAC;QAEF,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC,GAAG,EAAuB,EAAE,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC;IAC3E,CAAC;CACF"}
|
|
@@ -28,13 +28,17 @@ export declare class CommandService {
|
|
|
28
28
|
*
|
|
29
29
|
* This factory method orchestrates the entire command loading process. It
|
|
30
30
|
* runs all provided loaders in parallel, aggregates their results, handles
|
|
31
|
-
* name conflicts
|
|
31
|
+
* name conflicts for extension commands by renaming them, and then returns a
|
|
32
32
|
* fully constructed `CommandService` instance.
|
|
33
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
|
+
*
|
|
34
40
|
* @param loaders An array of objects that conform to the `ICommandLoader`
|
|
35
|
-
* interface.
|
|
36
|
-
* provide a command with the same name, the command from the loader that
|
|
37
|
-
* appears later in the array will take precedence.
|
|
41
|
+
* interface. Built-in commands should come first, followed by FileCommandLoader.
|
|
38
42
|
* @param signal An AbortSignal to cancel the loading process.
|
|
39
43
|
* @returns A promise that resolves to a new, fully initialized `CommandService` instance.
|
|
40
44
|
*/
|
|
@@ -28,13 +28,17 @@ export class CommandService {
|
|
|
28
28
|
*
|
|
29
29
|
* This factory method orchestrates the entire command loading process. It
|
|
30
30
|
* runs all provided loaders in parallel, aggregates their results, handles
|
|
31
|
-
* name conflicts
|
|
31
|
+
* name conflicts for extension commands by renaming them, and then returns a
|
|
32
32
|
* fully constructed `CommandService` instance.
|
|
33
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
|
+
*
|
|
34
40
|
* @param loaders An array of objects that conform to the `ICommandLoader`
|
|
35
|
-
* interface.
|
|
36
|
-
* provide a command with the same name, the command from the loader that
|
|
37
|
-
* appears later in the array will take precedence.
|
|
41
|
+
* interface. Built-in commands should come first, followed by FileCommandLoader.
|
|
38
42
|
* @param signal An AbortSignal to cancel the loading process.
|
|
39
43
|
* @returns A promise that resolves to a new, fully initialized `CommandService` instance.
|
|
40
44
|
*/
|
|
@@ -49,12 +53,24 @@ export class CommandService {
|
|
|
49
53
|
console.debug('A command loader failed:', result.reason);
|
|
50
54
|
}
|
|
51
55
|
}
|
|
52
|
-
// De-duplicate commands using a Map. The last one found with a given name wins.
|
|
53
|
-
// This creates a natural override system based on the order of the loaders
|
|
54
|
-
// passed to the constructor.
|
|
55
56
|
const commandMap = new Map();
|
|
56
57
|
for (const cmd of allCommands) {
|
|
57
|
-
|
|
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
|
+
});
|
|
58
74
|
}
|
|
59
75
|
const finalCommands = Object.freeze(Array.from(commandMap.values()));
|
|
60
76
|
return new CommandService(finalCommands);
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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"}
|
|
@@ -21,16 +21,28 @@ export declare class FileCommandLoader implements ICommandLoader {
|
|
|
21
21
|
private readonly projectRoot;
|
|
22
22
|
constructor(config: Config | null);
|
|
23
23
|
/**
|
|
24
|
-
* Loads all commands
|
|
25
|
-
* commands
|
|
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
|
+
*
|
|
26
31
|
* @param signal An AbortSignal to cancel the loading process.
|
|
27
|
-
* @returns A promise that resolves to an array of loaded SlashCommands.
|
|
32
|
+
* @returns A promise that resolves to an array of all loaded SlashCommands.
|
|
28
33
|
*/
|
|
29
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;
|
|
30
41
|
/**
|
|
31
42
|
* Parses a single .toml file and transforms it into a SlashCommand object.
|
|
32
43
|
* @param filePath The absolute path to the .toml file.
|
|
33
44
|
* @param baseDir The root command directory for name calculation.
|
|
45
|
+
* @param extensionName Optional extension name to prefix commands with.
|
|
34
46
|
* @returns A promise resolving to a SlashCommand, or null if the file is invalid.
|
|
35
47
|
*/
|
|
36
48
|
private parseAndAdaptFile;
|
|
@@ -42,55 +42,78 @@ export class FileCommandLoader {
|
|
|
42
42
|
this.projectRoot = config?.getProjectRoot() || process.cwd();
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
|
-
* Loads all commands
|
|
46
|
-
* commands
|
|
45
|
+
* Loads all commands from user, project, and extension directories.
|
|
46
|
+
* Returns commands in order: user → project → extensions (alphabetically).
|
|
47
|
+
*
|
|
48
|
+
* Order is important for conflict resolution in CommandService:
|
|
49
|
+
* - User/project commands (without extensionName) use "last wins" strategy
|
|
50
|
+
* - Extension commands (with extensionName) get renamed if conflicts exist
|
|
51
|
+
*
|
|
47
52
|
* @param signal An AbortSignal to cancel the loading process.
|
|
48
|
-
* @returns A promise that resolves to an array of loaded SlashCommands.
|
|
53
|
+
* @returns A promise that resolves to an array of all loaded SlashCommands.
|
|
49
54
|
*/
|
|
50
55
|
async loadCommands(signal) {
|
|
51
|
-
const
|
|
56
|
+
const allCommands = [];
|
|
52
57
|
const globOptions = {
|
|
53
58
|
nodir: true,
|
|
54
59
|
dot: true,
|
|
55
60
|
signal,
|
|
56
61
|
follow: true,
|
|
57
62
|
};
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
// Load commands from each directory
|
|
64
|
+
const commandDirs = this.getCommandDirectories();
|
|
65
|
+
for (const dirInfo of commandDirs) {
|
|
66
|
+
try {
|
|
67
|
+
const files = await glob('**/*.toml', {
|
|
68
|
+
...globOptions,
|
|
69
|
+
cwd: dirInfo.path,
|
|
70
|
+
});
|
|
71
|
+
const commandPromises = files.map((file) => this.parseAndAdaptFile(path.join(dirInfo.path, file), dirInfo.path, dirInfo.extensionName));
|
|
72
|
+
const commands = (await Promise.all(commandPromises)).filter((cmd) => cmd !== null);
|
|
73
|
+
// Add all commands without deduplication
|
|
74
|
+
allCommands.push(...commands);
|
|
69
75
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
cwd: projectDir,
|
|
75
|
-
});
|
|
76
|
-
const projectCommandPromises = projectFiles.map((file) => this.parseAndAdaptFile(path.join(projectDir, file), projectDir));
|
|
77
|
-
const projectCommands = (await Promise.all(projectCommandPromises)).filter((cmd) => cmd !== null);
|
|
78
|
-
for (const cmd of projectCommands) {
|
|
79
|
-
commandMap.set(cmd.name, cmd);
|
|
76
|
+
catch (error) {
|
|
77
|
+
if (error.code !== 'ENOENT') {
|
|
78
|
+
console.error(`[FileCommandLoader] Error loading commands from ${dirInfo.path}:`, error);
|
|
79
|
+
}
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
return allCommands;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Get all command directories in order for loading.
|
|
86
|
+
* User commands → Project commands → Extension commands
|
|
87
|
+
* This order ensures extension commands can detect all conflicts.
|
|
88
|
+
*/
|
|
89
|
+
getCommandDirectories() {
|
|
90
|
+
const dirs = [];
|
|
91
|
+
// 1. User commands
|
|
92
|
+
dirs.push({ path: getUserCommandsDir() });
|
|
93
|
+
// 2. Project commands (override user commands)
|
|
94
|
+
dirs.push({ path: getProjectCommandsDir(this.projectRoot) });
|
|
95
|
+
// 3. Extension commands (processed last to detect all conflicts)
|
|
96
|
+
if (this.config) {
|
|
97
|
+
const activeExtensions = this.config
|
|
98
|
+
.getExtensions()
|
|
99
|
+
.filter((ext) => ext.isActive)
|
|
100
|
+
.sort((a, b) => a.name.localeCompare(b.name)); // Sort alphabetically for deterministic loading
|
|
101
|
+
const extensionCommandDirs = activeExtensions.map((ext) => ({
|
|
102
|
+
path: path.join(ext.path, 'commands'),
|
|
103
|
+
extensionName: ext.name,
|
|
104
|
+
}));
|
|
105
|
+
dirs.push(...extensionCommandDirs);
|
|
84
106
|
}
|
|
85
|
-
return
|
|
107
|
+
return dirs;
|
|
86
108
|
}
|
|
87
109
|
/**
|
|
88
110
|
* Parses a single .toml file and transforms it into a SlashCommand object.
|
|
89
111
|
* @param filePath The absolute path to the .toml file.
|
|
90
112
|
* @param baseDir The root command directory for name calculation.
|
|
113
|
+
* @param extensionName Optional extension name to prefix commands with.
|
|
91
114
|
* @returns A promise resolving to a SlashCommand, or null if the file is invalid.
|
|
92
115
|
*/
|
|
93
|
-
async parseAndAdaptFile(filePath, baseDir) {
|
|
116
|
+
async parseAndAdaptFile(filePath, baseDir, extensionName) {
|
|
94
117
|
let fileContent;
|
|
95
118
|
try {
|
|
96
119
|
fileContent = await fs.readFile(filePath, 'utf-8');
|
|
@@ -115,17 +138,23 @@ export class FileCommandLoader {
|
|
|
115
138
|
const validDef = validationResult.data;
|
|
116
139
|
const relativePathWithExt = path.relative(baseDir, filePath);
|
|
117
140
|
const relativePath = relativePathWithExt.substring(0, relativePathWithExt.length - 5);
|
|
118
|
-
const
|
|
141
|
+
const baseCommandName = relativePath
|
|
119
142
|
.split(path.sep)
|
|
120
143
|
// Sanitize each path segment to prevent ambiguity. Since ':' is our
|
|
121
144
|
// namespace separator, we replace any literal colons in filenames
|
|
122
145
|
// with underscores to avoid naming conflicts.
|
|
123
146
|
.map((segment) => segment.replaceAll(':', '_'))
|
|
124
147
|
.join(':');
|
|
148
|
+
// Add extension name tag for extension commands
|
|
149
|
+
const defaultDescription = `Custom command from ${path.basename(filePath)}`;
|
|
150
|
+
let description = validDef.description || defaultDescription;
|
|
151
|
+
if (extensionName) {
|
|
152
|
+
description = `[${extensionName}] ${description}`;
|
|
153
|
+
}
|
|
125
154
|
const processors = [];
|
|
126
155
|
// Add the Shell Processor if needed.
|
|
127
156
|
if (validDef.prompt.includes(SHELL_INJECTION_TRIGGER)) {
|
|
128
|
-
processors.push(new ShellProcessor(
|
|
157
|
+
processors.push(new ShellProcessor(baseCommandName));
|
|
129
158
|
}
|
|
130
159
|
// The presence of '{{args}}' is the switch that determines the behavior.
|
|
131
160
|
if (validDef.prompt.includes(SHORTHAND_ARGS_PLACEHOLDER)) {
|
|
@@ -135,13 +164,13 @@ export class FileCommandLoader {
|
|
|
135
164
|
processors.push(new DefaultArgumentProcessor());
|
|
136
165
|
}
|
|
137
166
|
return {
|
|
138
|
-
name:
|
|
139
|
-
description
|
|
140
|
-
`Custom command from ${path.basename(filePath)}`,
|
|
167
|
+
name: baseCommandName,
|
|
168
|
+
description,
|
|
141
169
|
kind: CommandKind.FILE,
|
|
170
|
+
extensionName,
|
|
142
171
|
action: async (context, _args) => {
|
|
143
172
|
if (!context.invocation) {
|
|
144
|
-
console.error(`[FileCommandLoader] Critical error: Command '${
|
|
173
|
+
console.error(`[FileCommandLoader] Critical error: Command '${baseCommandName}' was executed without invocation context.`);
|
|
145
174
|
return {
|
|
146
175
|
type: 'submit_prompt',
|
|
147
176
|
content: validDef.prompt, // Fallback to unprocessed prompt
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileCommandLoader.js","sourceRoot":"","sources":["../../../src/services/FileCommandLoader.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAEL,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAEL,WAAW,GAGZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAEL,0BAA0B,EAC1B,uBAAuB,GACxB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,yBAAyB,EACzB,cAAc,GACf,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"FileCommandLoader.js","sourceRoot":"","sources":["../../../src/services/FileCommandLoader.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAEL,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAEL,WAAW,GAGZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAEL,0BAA0B,EAC1B,uBAAuB,GACxB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,yBAAyB,EACzB,cAAc,GACf,MAAM,uCAAuC,C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O;YACL,IAAI,EAAE,eAAe;YACrB,WAAW;YACX,IAAI,EAAE,WAAW,CAAC,IAAI;YACtB,aAAa;YACb,MAAM,EAAE,KAAK,EACX,OAAuB,EACvB,KAAa,EACsB,EAAE;gBACrC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;oBACxB,OAAO,CAAC,KAAK,CACX,gDAAgD,eAAe,4CAA4C,CAC5G,CAAC;oBACF,OAAO;wBACL,IAAI,EAAE,eAAe;wBACrB,OAAO,EAAE,QAAQ,CAAC,MAAM,EAAE,iCAAiC;qBAC5D,CAAC;gBACJ,CAAC;gBAED,IAAI,CAAC;oBACH,IAAI,eAAe,GAAG,QAAQ,CAAC,MAAM,CAAC;oBACtC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;wBACnC,eAAe,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;oBACtE,CAAC;oBAED,OAAO;wBACL,IAAI,EAAE,eAAe;wBACrB,OAAO,EAAE,eAAe;qBACzB,CAAC;gBACJ,CAAC;gBAAC,OAAO,CAAC,EAAE,CAAC;oBACX,wCAAwC;oBACxC,IAAI,CAAC,YAAY,yBAAyB,EAAE,CAAC;wBAC3C,mDAAmD;wBACnD,OAAO;4BACL,IAAI,EAAE,wBAAwB;4BAC9B,iBAAiB,EAAE,CAAC,CAAC,iBAAiB;4BACtC,kBAAkB,EAAE;gCAClB,GAAG,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG;6BAC5B;yBACF,CAAC;oBACJ,CAAC;oBACD,mEAAmE;oBACnE,MAAM,CAAC,CAAC;gBACV,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF"}
|
package/dist/src/ui/App.js
CHANGED
|
@@ -53,24 +53,25 @@ import { useVim } from './hooks/vim.js';
|
|
|
53
53
|
import * as fs from 'fs';
|
|
54
54
|
import { UpdateNotification } from './components/UpdateNotification.js';
|
|
55
55
|
import { isProQuotaExceededError, isGenericQuotaExceededError, UserTierId, } from '@google/gemini-cli-core';
|
|
56
|
-
import { checkForUpdates } from './utils/updateCheck.js';
|
|
57
56
|
import ansiEscapes from 'ansi-escapes';
|
|
58
57
|
import { OverflowProvider } from './contexts/OverflowContext.js';
|
|
59
58
|
import { ShowMoreLines } from './components/ShowMoreLines.js';
|
|
60
59
|
import { PrivacyNotice } from './privacy/PrivacyNotice.js';
|
|
60
|
+
import { setUpdateHandler } from '../utils/handleAutoUpdate.js';
|
|
61
61
|
import { appEvents, AppEvent } from '../utils/events.js';
|
|
62
62
|
const CTRL_EXIT_PROMPT_DURATION_MS = 1000;
|
|
63
63
|
export const AppWrapper = (props) => (_jsx(SessionStatsProvider, { children: _jsx(VimModeProvider, { settings: props.settings, children: _jsx(App, { ...props }) }) }));
|
|
64
64
|
const App = ({ config, settings, startupWarnings = [], version }) => {
|
|
65
65
|
const isFocused = useFocus();
|
|
66
66
|
useBracketedPaste();
|
|
67
|
-
const [
|
|
67
|
+
const [updateInfo, setUpdateInfo] = useState(null);
|
|
68
68
|
const { stdout } = useStdout();
|
|
69
69
|
const nightly = version.includes('nightly');
|
|
70
|
-
useEffect(() => {
|
|
71
|
-
checkForUpdates().then(setUpdateMessage);
|
|
72
|
-
}, []);
|
|
73
70
|
const { history, addItem, clearItems, loadHistory } = useHistory();
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
const cleanup = setUpdateHandler(addItem, setUpdateInfo);
|
|
73
|
+
return cleanup;
|
|
74
|
+
}, [addItem]);
|
|
74
75
|
const { consoleMessages, handleNewMessage, clearConsoleMessages: clearConsoleMessagesState, } = useConsoleMessages();
|
|
75
76
|
useEffect(() => {
|
|
76
77
|
const consolePatcher = new ConsolePatcher({
|
|
@@ -109,12 +110,12 @@ const App = ({ config, settings, startupWarnings = [], version }) => {
|
|
|
109
110
|
const [showPrivacyNotice, setShowPrivacyNotice] = useState(false);
|
|
110
111
|
const [modelSwitchedFromQuotaError, setModelSwitchedFromQuotaError] = useState(false);
|
|
111
112
|
const [userTier, setUserTier] = useState(undefined);
|
|
112
|
-
const [
|
|
113
|
+
const [ideContextState, setIdeContextState] = useState();
|
|
113
114
|
const [isProcessing, setIsProcessing] = useState(false);
|
|
114
115
|
useEffect(() => {
|
|
115
|
-
const unsubscribe = ideContext.
|
|
116
|
+
const unsubscribe = ideContext.subscribeToIdeContext(setIdeContextState);
|
|
116
117
|
// Set the initial value
|
|
117
|
-
|
|
118
|
+
setIdeContextState(ideContext.getIdeContext());
|
|
118
119
|
return unsubscribe;
|
|
119
120
|
}, []);
|
|
120
121
|
useEffect(() => {
|
|
@@ -146,14 +147,19 @@ const App = ({ config, settings, startupWarnings = [], version }) => {
|
|
|
146
147
|
const { isThemeDialogOpen, openThemeDialog, handleThemeSelect, handleThemeHighlight, } = useThemeCommand(settings, setThemeError, addItem);
|
|
147
148
|
const { isAuthDialogOpen, openAuthDialog, handleAuthSelect, isAuthenticating, cancelAuthentication, } = useAuthCommand(settings, setAuthError, config);
|
|
148
149
|
useEffect(() => {
|
|
149
|
-
if (settings.merged.selectedAuthType) {
|
|
150
|
+
if (settings.merged.selectedAuthType && !settings.merged.useExternalAuth) {
|
|
150
151
|
const error = validateAuthMethod(settings.merged.selectedAuthType);
|
|
151
152
|
if (error) {
|
|
152
153
|
setAuthError(error);
|
|
153
154
|
openAuthDialog();
|
|
154
155
|
}
|
|
155
156
|
}
|
|
156
|
-
}, [
|
|
157
|
+
}, [
|
|
158
|
+
settings.merged.selectedAuthType,
|
|
159
|
+
settings.merged.useExternalAuth,
|
|
160
|
+
openAuthDialog,
|
|
161
|
+
setAuthError,
|
|
162
|
+
]);
|
|
157
163
|
// Sync user tier from config when authentication changes
|
|
158
164
|
useEffect(() => {
|
|
159
165
|
// Only sync when not currently authenticating
|
|
@@ -171,7 +177,8 @@ const App = ({ config, settings, startupWarnings = [], version }) => {
|
|
|
171
177
|
text: 'Refreshing hierarchical memory (GEMINI.md or other context files)...',
|
|
172
178
|
}, Date.now());
|
|
173
179
|
try {
|
|
174
|
-
const { memoryContent, fileCount } = await loadHierarchicalGeminiMemory(process.cwd(), config.getDebugMode(), config.getFileService(), settings.merged, config.getExtensionContextFilePaths(),
|
|
180
|
+
const { memoryContent, fileCount } = await loadHierarchicalGeminiMemory(process.cwd(), config.getDebugMode(), config.getFileService(), settings.merged, config.getExtensionContextFilePaths(), settings.merged.memoryImportFormat || 'tree', // Use setting or default to 'tree'
|
|
181
|
+
config.getFileFilteringOptions());
|
|
175
182
|
config.setUserMemory(memoryContent);
|
|
176
183
|
config.setGeminiMdFileCount(fileCount);
|
|
177
184
|
setGeminiMdFileCount(fileCount);
|
|
@@ -270,6 +277,7 @@ const App = ({ config, settings, startupWarnings = [], version }) => {
|
|
|
270
277
|
}
|
|
271
278
|
// Switch model for future use but return false to stop current retry
|
|
272
279
|
config.setModel(fallbackModel);
|
|
280
|
+
config.setFallbackMode(true);
|
|
273
281
|
logFlashFallback(config, new FlashFallbackEvent(config.getContentGeneratorConfig().authType));
|
|
274
282
|
return false; // Don't continue with current prompt
|
|
275
283
|
};
|
|
@@ -365,7 +373,10 @@ const App = ({ config, settings, startupWarnings = [], version }) => {
|
|
|
365
373
|
handleSlashCommand(newValue ? '/mcp desc' : '/mcp nodesc');
|
|
366
374
|
}
|
|
367
375
|
}
|
|
368
|
-
else if (key.ctrl &&
|
|
376
|
+
else if (key.ctrl &&
|
|
377
|
+
input === 'e' &&
|
|
378
|
+
config.getIdeMode() &&
|
|
379
|
+
ideContextState) {
|
|
369
380
|
setShowIDEContextDetail((prev) => !prev);
|
|
370
381
|
}
|
|
371
382
|
else if (key.ctrl && (input === 'c' || input === 'C')) {
|
|
@@ -505,13 +516,13 @@ const App = ({ config, settings, startupWarnings = [], version }) => {
|
|
|
505
516
|
const placeholder = vimModeEnabled
|
|
506
517
|
? " Press 'i' for INSERT mode and 'Esc' for NORMAL mode."
|
|
507
518
|
: ' Type your message or @path/to/file';
|
|
508
|
-
return (_jsx(StreamingContext.Provider, { value: streamingState, children: _jsxs(Box, { flexDirection: "column", width: "90%", children: [
|
|
519
|
+
return (_jsx(StreamingContext.Provider, { value: streamingState, children: _jsxs(Box, { flexDirection: "column", width: "90%", children: [_jsx(Static, { items: [
|
|
509
520
|
_jsxs(Box, { flexDirection: "column", children: [!settings.merged.hideBanner && (_jsx(Header, { terminalWidth: terminalWidth, version: version, nightly: nightly })), !settings.merged.hideTips && _jsx(Tips, { config: config })] }, "header"),
|
|
510
521
|
...history.map((h) => (_jsx(HistoryItemDisplay, { terminalWidth: mainAreaWidth, availableTerminalHeight: staticAreaMaxItemHeight, item: h, isPending: false, config: config }, h.id))),
|
|
511
522
|
], children: (item) => item }, staticKey), _jsx(OverflowProvider, { children: _jsxs(Box, { ref: pendingHistoryItemRef, flexDirection: "column", children: [pendingHistoryItems.map((item, i) => (_jsx(HistoryItemDisplay, { availableTerminalHeight: constrainHeight ? availableTerminalHeight : undefined, terminalWidth: mainAreaWidth,
|
|
512
523
|
// TODO(taehykim): It seems like references to ids aren't necessary in
|
|
513
524
|
// HistoryItemDisplay. Refactor later. Use a fake id for now.
|
|
514
|
-
item: { ...item, id: 0 }, isPending: true, config: config, isFocused: !isEditorDialogOpen }, i))), _jsx(ShowMoreLines, { constrainHeight: constrainHeight })] }) }), showHelp && _jsx(Help, { commands: slashCommands }), _jsxs(Box, { flexDirection: "column", ref: mainControlsRef, children: [startupWarnings.length > 0 && (_jsx(Box, { borderStyle: "round", borderColor: Colors.AccentYellow, paddingX: 1, marginY: 1, flexDirection: "column", children: startupWarnings.map((warning, index) => (_jsx(Text, { color: Colors.AccentYellow, children: warning }, index))) })), shellConfirmationRequest ? (_jsx(ShellConfirmationDialog, { request: shellConfirmationRequest })) : isThemeDialogOpen ? (_jsxs(Box, { flexDirection: "column", children: [themeError && (_jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: Colors.AccentRed, children: themeError }) })), _jsx(ThemeDialog, { onSelect: handleThemeSelect, onHighlight: handleThemeHighlight, settings: settings, availableTerminalHeight: constrainHeight
|
|
525
|
+
item: { ...item, id: 0 }, isPending: true, config: config, isFocused: !isEditorDialogOpen }, i))), _jsx(ShowMoreLines, { constrainHeight: constrainHeight })] }) }), showHelp && _jsx(Help, { commands: slashCommands }), _jsxs(Box, { flexDirection: "column", ref: mainControlsRef, children: [updateInfo && _jsx(UpdateNotification, { message: updateInfo.message }), startupWarnings.length > 0 && (_jsx(Box, { borderStyle: "round", borderColor: Colors.AccentYellow, paddingX: 1, marginY: 1, flexDirection: "column", children: startupWarnings.map((warning, index) => (_jsx(Text, { color: Colors.AccentYellow, children: warning }, index))) })), shellConfirmationRequest ? (_jsx(ShellConfirmationDialog, { request: shellConfirmationRequest })) : isThemeDialogOpen ? (_jsxs(Box, { flexDirection: "column", children: [themeError && (_jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: Colors.AccentRed, children: themeError }) })), _jsx(ThemeDialog, { onSelect: handleThemeSelect, onHighlight: handleThemeHighlight, settings: settings, availableTerminalHeight: constrainHeight
|
|
515
526
|
? terminalHeight - staticExtraHeight
|
|
516
527
|
: undefined, terminalWidth: mainAreaWidth })] })) : isAuthenticating ? (_jsxs(_Fragment, { children: [_jsx(AuthInProgress, { onTimeout: () => {
|
|
517
528
|
setAuthError('Authentication timed out. Please try again.');
|
|
@@ -522,7 +533,9 @@ const App = ({ config, settings, startupWarnings = [], version }) => {
|
|
|
522
533
|
? undefined
|
|
523
534
|
: thought, currentLoadingPhrase: config.getAccessibility()?.disableLoadingPhrases
|
|
524
535
|
? undefined
|
|
525
|
-
: currentLoadingPhrase, elapsedTime: elapsedTime }), _jsxs(Box, { marginTop: 1, display: "flex", justifyContent: "space-between", width: "100%", children: [_jsxs(Box, { children: [process.env.GEMINI_SYSTEM_MD && (_jsx(Text, { color: Colors.AccentRed, children: "|\u2310\u25A0_\u25A0| " })), ctrlCPressedOnce ? (_jsx(Text, { color: Colors.AccentYellow, children: "Press Ctrl+C again to exit." })) : ctrlDPressedOnce ? (_jsx(Text, { color: Colors.AccentYellow, children: "Press Ctrl+D again to exit." })) : (_jsx(ContextSummaryDisplay, {
|
|
526
|
-
!shellModeActive && (_jsx(AutoAcceptIndicator, { approvalMode: showAutoAcceptIndicator })), shellModeActive && _jsx(ShellModeIndicator, {})] })] }), showIDEContextDetail && (_jsx(IDEContextDetailDisplay, {
|
|
536
|
+
: currentLoadingPhrase, elapsedTime: elapsedTime }), _jsxs(Box, { marginTop: 1, display: "flex", justifyContent: "space-between", width: "100%", children: [_jsxs(Box, { children: [process.env.GEMINI_SYSTEM_MD && (_jsx(Text, { color: Colors.AccentRed, children: "|\u2310\u25A0_\u25A0| " })), ctrlCPressedOnce ? (_jsx(Text, { color: Colors.AccentYellow, children: "Press Ctrl+C again to exit." })) : ctrlDPressedOnce ? (_jsx(Text, { color: Colors.AccentYellow, children: "Press Ctrl+D again to exit." })) : (_jsx(ContextSummaryDisplay, { ideContext: ideContextState, geminiMdFileCount: geminiMdFileCount, contextFileNames: contextFileNames, mcpServers: config.getMcpServers(), blockedMcpServers: config.getBlockedMcpServers(), showToolDescriptions: showToolDescriptions }))] }), _jsxs(Box, { children: [showAutoAcceptIndicator !== ApprovalMode.DEFAULT &&
|
|
537
|
+
!shellModeActive && (_jsx(AutoAcceptIndicator, { approvalMode: showAutoAcceptIndicator })), shellModeActive && _jsx(ShellModeIndicator, {})] })] }), showIDEContextDetail && (_jsx(IDEContextDetailDisplay, { ideContext: ideContextState, detectedIdeDisplay: config
|
|
538
|
+
.getIdeClient()
|
|
539
|
+
.getDetectedIdeDisplayName() })), showErrorDetails && (_jsx(OverflowProvider, { children: _jsxs(Box, { flexDirection: "column", children: [_jsx(DetailedMessagesDisplay, { messages: filteredConsoleMessages, maxHeight: constrainHeight ? debugConsoleMaxHeight : undefined, width: inputWidth }), _jsx(ShowMoreLines, { constrainHeight: constrainHeight })] }) })), isInputActive && (_jsx(InputPrompt, { buffer: buffer, inputWidth: inputWidth, suggestionsWidth: suggestionsWidth, onSubmit: handleFinalSubmit, userMessages: userMessages, onClearScreen: handleClearScreen, config: config, slashCommands: slashCommands, commandContext: commandContext, shellModeActive: shellModeActive, setShellModeActive: setShellModeActive, focus: isFocused, vimHandleInput: vimHandleInput, placeholder: placeholder }))] })), initError && streamingState !== StreamingState.Responding && (_jsx(Box, { borderStyle: "round", borderColor: Colors.AccentRed, paddingX: 1, marginBottom: 1, children: history.find((item) => item.type === 'error' && item.text?.includes(initError))?.text ? (_jsx(Text, { color: Colors.AccentRed, children: history.find((item) => item.type === 'error' && item.text?.includes(initError))?.text })) : (_jsxs(_Fragment, { children: [_jsxs(Text, { color: Colors.AccentRed, children: ["Initialization Error: ", initError] }), _jsxs(Text, { color: Colors.AccentRed, children: [' ', "Please check API key and configuration."] })] })) })), _jsx(Footer, { model: currentModel, targetDir: config.getTargetDir(), debugMode: config.getDebugMode(), branchName: branchName, debugMessage: debugMessage, corgiMode: corgiMode, errorCount: errorCount, showErrorDetails: showErrorDetails, showMemoryUsage: config.getDebugMode() || config.getShowMemoryUsage(), promptTokenCount: sessionStats.lastPromptTokenCount, nightly: nightly, vimMode: vimModeEnabled ? vimMode : undefined })] })] }) }));
|
|
527
540
|
};
|
|
528
541
|
//# sourceMappingURL=App.js.map
|