Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ describe('<SessionSummaryDisplay />', () => {
unmount();
});

it('renders a standard UUID-formatted session ID in the footer (powershell) on Windows', async () => {
it('renders a standard UUID-formatted session ID without quotes in the footer (powershell) on Windows', async () => {
isWindowsMock.mockReturnValue(true);
getShellConfigurationMock.mockReturnValue({
executable: 'powershell.exe',
Expand All @@ -186,8 +186,11 @@ describe('<SessionSummaryDisplay />', () => {
);
const output = lastFrame();

// PowerShell doesn't wrap UUID in quotes by default, but we wrap it in double quotes on Windows.
expect(output).toContain('gemini --resume "1234-abcd-5678-efgh"');
// escapeShellArg already returns simple alphanumeric strings (like UUIDs)
// unquoted for PowerShell, and such strings paste safely into both
// PowerShell and cmd.exe. No additional wrapping is required.
expect(output).toContain('gemini --resume 1234-abcd-5678-efgh');
expect(output).not.toContain('"1234-abcd-5678-efgh"');
unmount();
});

Expand Down
16 changes: 3 additions & 13 deletions packages/cli/src/ui/components/SessionSummaryDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ import type React from 'react';
import { StatsDisplay } from './StatsDisplay.js';
import { useSessionStats } from '../contexts/SessionContext.js';
import { useConfig } from '../contexts/ConfigContext.js';
import {
escapeShellArg,
getShellConfiguration,
isWindows,
} from '@google/gemini-cli-core';
import { escapeShellArg, getShellConfiguration } from '@google/gemini-cli-core';

interface SessionSummaryDisplayProps {
duration: string;
Expand All @@ -28,17 +24,11 @@ export const SessionSummaryDisplay: React.FC<SessionSummaryDisplayProps> = ({
const worktreeSettings = config.getWorktreeSettings();

const escapedSessionId = escapeShellArg(stats.sessionId, shell);
const footerSessionId =
isWindows() &&
!escapedSessionId.startsWith('"') &&
!escapedSessionId.startsWith("'")
? `"${escapedSessionId}"`
: escapedSessionId;
let footer = `To resume this session: gemini --resume ${footerSessionId}`;
let footer = `To resume this session: gemini --resume ${escapedSessionId}`;

if (worktreeSettings) {
footer =
`To resume work in this worktree: cd ${escapeShellArg(worktreeSettings.path, shell)} && gemini --resume ${footerSessionId}\n` +
`To resume work in this worktree: cd ${escapeShellArg(worktreeSettings.path, shell)} && gemini --resume ${escapedSessionId}\n` +
`To remove manually: git worktree remove ${escapeShellArg(worktreeSettings.path, shell)}`;
}

Expand Down