Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added err.txt
Empty file.
41 changes: 41 additions & 0 deletions help.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
Usage: gemini [options] [command]

Gemini CLI - Defaults to interactive mode. Use -p/--prompt for non-interactive (headless) mode.

Commands:
gemini [query..] Launch Gemini CLI [default]
gemini mcp Manage MCP servers
gemini extensions <command> Manage Gemini CLI extensions. [aliases: extension]
gemini skills <command> Manage agent skills. [aliases: skill]
gemini hooks <command> Manage Gemini CLI hooks. [aliases: hook]

Positionals:
query Initial prompt. Runs in interactive mode by default; use -p/--prompt for non-interactive.

Options:
-d, --debug Run in debug mode (open debug console with F12) [boolean] [default: false]
-m, --model Model [string]
-p, --prompt Run in non-interactive (headless) mode with the given prompt. Appended to input on stdin (if any). [string]
-i, --prompt-interactive Execute the provided prompt and continue in interactive mode [string]
-w, --worktree Start Gemini in a new git worktree. If no name is provided, one is generated automatically. [string]
-s, --sandbox Run in sandbox? [boolean]
-y, --yolo Automatically accept all actions (aka YOLO mode, see https://www.youtube.com/watch?v=xvFZjo5PgG0 for more details)? [boolean] [default: false]
--approval-mode Set the approval mode: default (prompt for approval), auto_edit (auto-approve edit tools), yolo (auto-approve all tools), plan (read-only mode) [string] [choices: "default", "auto_edit", "yolo", "plan"]
--policy Additional policy files or directories to load (comma-separated or multiple --policy) [array]
--admin-policy Additional admin policy files or directories to load (comma-separated or multiple --admin-policy) [array]
--acp Starts the agent in ACP mode [boolean]
--experimental-acp Starts the agent in ACP mode (deprecated, use --acp instead) [boolean]
--allowed-mcp-server-names Allowed MCP server names [array]
--allowed-tools [DEPRECATED: Use Policy Engine instead See https://geminicli.com/docs/core/policy-engine] Tools that are allowed to run without confirmation [array]
-e, --extensions A list of extensions to use. If not provided, all extensions are used. [array]
-l, --list-extensions List all available extensions and exit. [boolean]
-r, --resume Resume a previous session. Use "latest" for most recent or index number (e.g. --resume 5) [string]
--list-sessions List available sessions for the current project and exit. [boolean]
--delete-session Delete a session by index number (use --list-sessions to see available sessions). [string]
--include-directories Additional directories to include in the workspace (comma-separated or multiple --include-directories) [array]
--screen-reader Enable screen reader mode for accessibility. [boolean]
-o, --output-format The format of the CLI output. [string] [choices: "text", "json", "stream-json"]
--raw-output Disable sanitization of model output (e.g. allow ANSI escape sequences). WARNING: This can be a security risk if the model output is untrusted. [boolean]
--accept-raw-output-risk Suppress the security warning when using --raw-output. [boolean]
-v, --version Show version number [boolean]
-h, --help Show help [boolean]
Binary file added out.txt
Binary file not shown.
18 changes: 4 additions & 14 deletions packages/core/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1568,6 +1568,10 @@ export class Config implements McpContext, AgentLoopContext {
return this.promptId;
}

getCustomExcludes(): string[] {
return this.fileFiltering.customIgnoreFilePaths;
}

getWorktreeSettings(): WorktreeSettings | undefined {
return this.worktreeSettings;
}
Expand Down Expand Up @@ -2508,20 +2512,6 @@ export class Config implements McpContext, AgentLoopContext {
};
}

/**
* Gets custom file exclusion patterns from configuration.
* TODO: This is a placeholder implementation. In the future, this could
* read from settings files, CLI arguments, or environment variables.
*/
getCustomExcludes(): string[] {
// Placeholder implementation - returns empty array for now
// Future implementation could read from:
// - User settings file
// - Project-specific configuration
// - Environment variables
// - CLI arguments
return [];
}

getCheckpointingEnabled(): boolean {
return this.checkpointing;
Expand Down
8 changes: 0 additions & 8 deletions packages/core/src/telemetry/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -355,14 +355,6 @@ export async function initializeTelemetry(
// Note: We don't use process.on('exit') here because that callback is synchronous
// and won't wait for the async shutdownTelemetry() to complete.
// Instead, telemetry shutdown is handled in runExitCleanup() in cleanup.ts
process.on('SIGTERM', () => {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
shutdownTelemetry(config);
});
process.on('SIGINT', () => {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
shutdownTelemetry(config);
});
}

/**
Expand Down
19 changes: 19 additions & 0 deletions packages/core/src/tools/mcp-client-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -626,8 +626,13 @@ export class McpClientManager {
* This is the cleanup method to be called on application exit.
*/
async stop(): Promise<void> {
const pidsToKill: number[] = [];

const disconnectionPromises = Array.from(this.clients.entries()).map(
async ([name, client]) => {
const pid = client.getPid();
if (pid) pidsToKill.push(pid);

try {
await client.disconnect();
} catch (error) {
Expand All @@ -641,6 +646,20 @@ export class McpClientManager {
);

await Promise.all(disconnectionPromises);

// Hard kill any processes that are still running after graceful disconnect
for (const pid of pidsToKill) {
try {
// Check if process is still running
process.kill(pid, 0);
// If it didn't throw, it's still there. Force it.
debugLogger.log(`Hard killing lingering MCP process ${pid}`);
process.kill(pid, 'SIGKILL');
} catch {
// Process is already gone, which is good
}
}

this.clients.clear();
}

Expand Down
14 changes: 7 additions & 7 deletions packages/core/src/tools/mcp-client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2420,7 +2420,7 @@ describe('connectToMcpServer with OAuth', () => {
},
);

const client = await connectToMcpServer(
const { client } = await connectToMcpServer(
'0.0.1',
'test-server',
{ httpUrl: serverUrl, oauth: { enabled: true } },
Expand Down Expand Up @@ -2465,7 +2465,7 @@ describe('connectToMcpServer with OAuth', () => {
},
);

const client = await connectToMcpServer(
const { client } = await connectToMcpServer(
'0.0.1',
'test-server',
{ httpUrl: serverUrl, oauth: { enabled: true } },
Expand Down Expand Up @@ -2505,7 +2505,7 @@ describe('connectToMcpServer with OAuth', () => {

vi.mocked(mockedClient.connect).mockResolvedValueOnce(undefined);

const client = await connectToMcpServer(
const { client } = await connectToMcpServer(
'0.0.1',
'test-server',
{ httpUrl: serverUrl, oauth: { enabled: true } },
Expand Down Expand Up @@ -2549,7 +2549,7 @@ describe('connectToMcpServer with OAuth', () => {

vi.mocked(mockedClient.connect).mockResolvedValueOnce(undefined);

const client = await connectToMcpServer(
const { client } = await connectToMcpServer(
'0.0.1',
'test-server',
{ httpUrl: serverUrl, oauth: { enabled: true } },
Expand Down Expand Up @@ -2644,7 +2644,7 @@ describe('connectToMcpServer - HTTP→SSE fallback', () => {
.mockRejectedValueOnce(new StreamableHTTPError(500, 'Server error'))
.mockResolvedValueOnce(undefined);

const client = await connectToMcpServer(
const { client } = await connectToMcpServer(
'0.0.1',
'test-server',
{ url: 'http://test-server' },
Expand Down Expand Up @@ -2685,7 +2685,7 @@ describe('connectToMcpServer - HTTP→SSE fallback', () => {
.mockRejectedValueOnce(new StreamableHTTPError(404, 'Not Found'))
.mockResolvedValueOnce(undefined);

const client = await connectToMcpServer(
const { client } = await connectToMcpServer(
'0.0.1',
'test-server',
{ url: 'http://test-server' },
Expand Down Expand Up @@ -2770,7 +2770,7 @@ describe('connectToMcpServer - OAuth with transport fallback', () => {
.mockRejectedValueOnce(new StreamableHTTPError(401, 'Unauthorized'))
.mockResolvedValueOnce(undefined);

const client = await connectToMcpServer(
const { client } = await connectToMcpServer(
'0.0.1',
'test-server',
{ url: 'http://test-server', oauth: { enabled: true } },
Expand Down
Loading