summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlcan <[email protected]>2025-05-19 16:58:57 -0700
committerGitHub <[email protected]>2025-05-19 16:58:57 -0700
commit9c72a3ae129a5ab6cbc13fded86da01f2a354a75 (patch)
tree772d6f405e6ce2858e3087f3b2f472a95a79642c
parent28acb8d495f847edc5c32e4d18b62bd08a9132d2 (diff)
ui tweaks (#442)
-rw-r--r--packages/cli/src/ui/App.tsx19
-rw-r--r--packages/cli/src/ui/components/Footer.tsx17
-rw-r--r--packages/cli/src/ui/components/InputPrompt.tsx2
-rw-r--r--packages/server/src/utils/paths.ts14
4 files changed, 30 insertions, 22 deletions
diff --git a/packages/cli/src/ui/App.tsx b/packages/cli/src/ui/App.tsx
index befefec1..c07c623e 100644
--- a/packages/cli/src/ui/App.tsx
+++ b/packages/cli/src/ui/App.tsx
@@ -20,7 +20,7 @@ import { ShellModeIndicator } from './components/ShellModeIndicator.js';
import { EditorState, InputPrompt } from './components/InputPrompt.js';
import { Footer } from './components/Footer.js';
import { ThemeDialog } from './components/ThemeDialog.js';
-import { shortenPath, type Config } from '@gemini-code/server';
+import { type Config } from '@gemini-code/server';
import { Colors } from './colors.js';
import { Help } from './components/Help.js';
import { loadHierarchicalGeminiMemory } from '../config/config.js';
@@ -342,14 +342,16 @@ export const App = ({
justifyContent="space-between"
width="100%"
>
- <Box>
- <>
- <Text color={Colors.SubtleComment}>cwd: </Text>
- <Text color={Colors.LightBlue}>
- {shortenPath(config.getTargetDir(), 70)}
+ {geminiMdFileCount > 0 && (
+ <Box>
+ {process.env.GEMINI_SYSTEM_MD && (
+ <Text color={Colors.AccentRed}>|⌐■_■| </Text>
+ )}
+ <Text color={Colors.SubtleComment}>
+ Using {geminiMdFileCount} GEMINI.md files
</Text>
- </>
- </Box>
+ </Box>
+ )}
<Box>
{showAutoAcceptIndicator && !shellModeActive && (
<AutoAcceptIndicator />
@@ -431,7 +433,6 @@ export const App = ({
debugMode={config.getDebugMode()}
debugMessage={debugMessage}
cliVersion={cliVersion}
- geminiMdFileCount={geminiMdFileCount}
corgiMode={corgiMode}
/>
<ConsoleOutput debugMode={config.getDebugMode()} />
diff --git a/packages/cli/src/ui/components/Footer.tsx b/packages/cli/src/ui/components/Footer.tsx
index 0e2779cb..03e85db1 100644
--- a/packages/cli/src/ui/components/Footer.tsx
+++ b/packages/cli/src/ui/components/Footer.tsx
@@ -7,14 +7,13 @@
import React from 'react';
import { Box, Text } from 'ink';
import { Colors } from '../colors.js';
-import { Config } from '@gemini-code/server';
+import { shortenPath, tildeifyPath, Config } from '@gemini-code/server';
interface FooterProps {
config: Config;
debugMode: boolean;
debugMessage: string;
cliVersion: string;
- geminiMdFileCount: number;
corgiMode: boolean;
}
@@ -23,19 +22,16 @@ export const Footer: React.FC<FooterProps> = ({
debugMode,
debugMessage,
cliVersion,
- geminiMdFileCount,
corgiMode,
}) => (
<Box marginTop={1}>
<Box>
- {geminiMdFileCount > 0 && (
- <Text color={Colors.SubtleComment}>
- Using {geminiMdFileCount} GEMINI.md files
- </Text>
- )}
+ <Text color={Colors.LightBlue}>
+ {shortenPath(tildeifyPath(config.getTargetDir()), 70)}
+ </Text>
{debugMode && (
<Text color={Colors.AccentRed}>
- {debugMessage || ' | Running in debug mode.'}
+ {' ' + (debugMessage || '--debug')}
</Text>
)}
</Box>
@@ -74,9 +70,6 @@ export const Footer: React.FC<FooterProps> = ({
<Text color={Colors.AccentRed}>▼ </Text>
</Text>
)}
- {process.env.GEMINI_SYSTEM_MD && (
- <Text color={Colors.AccentRed}>|⌐■_■|</Text>
- )}
</Box>
</Box>
);
diff --git a/packages/cli/src/ui/components/InputPrompt.tsx b/packages/cli/src/ui/components/InputPrompt.tsx
index c9ebaf14..f77ac4d6 100644
--- a/packages/cli/src/ui/components/InputPrompt.tsx
+++ b/packages/cli/src/ui/components/InputPrompt.tsx
@@ -216,7 +216,7 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
initialCursorOffset={editorState.initialCursorOffset}
initialText={query}
onChange={onChange}
- placeholder="Enter your message or use tools (e.g., @src/file.txt)..."
+ placeholder="Type your message or @path/to/file"
/* Account for width used by the box and &gt; */
navigateUp={inputHistory.navigateUp}
navigateDown={inputHistory.navigateDown}
diff --git a/packages/server/src/utils/paths.ts b/packages/server/src/utils/paths.ts
index 4ff74897..bbd479fd 100644
--- a/packages/server/src/utils/paths.ts
+++ b/packages/server/src/utils/paths.ts
@@ -5,6 +5,20 @@
*/
import path from 'node:path';
+import os from 'os';
+
+/**
+ * Replaces the home directory with a tilde.
+ * @param path - The path to tildeify.
+ * @returns The tildeified path.
+ */
+export function tildeifyPath(path: string): string {
+ const homeDir = os.homedir();
+ if (path.startsWith(homeDir)) {
+ return path.replace(homeDir, '~');
+ }
+ return path;
+}
/**
* Shortens a path string if it exceeds maxLen, prioritizing the start and end segments.