mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 16:57:46 +00:00
feat: add CLI version number to footer (#134)
This commit is contained in:
@@ -10,6 +10,12 @@ import { App } from './ui/App.js';
|
||||
import { loadCliConfig } from './config/config.js';
|
||||
import { readStdin } from './utils/readStdin.js';
|
||||
import { GeminiClient } from '@gemini-code/server';
|
||||
import { readPackageUp } from 'read-package-up';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { dirname } from 'node:path';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = dirname(__filename);
|
||||
|
||||
async function main() {
|
||||
const config = loadCliConfig();
|
||||
@@ -17,14 +23,20 @@ async function main() {
|
||||
|
||||
// Render UI, passing necessary config values. Check that there is no command line question.
|
||||
if (process.stdin.isTTY && input?.length === 0) {
|
||||
const readUpResult = await readPackageUp({ cwd: __dirname });
|
||||
const cliVersion =
|
||||
process.env.NODE_ENV === 'development'
|
||||
? 'local'
|
||||
: (readUpResult?.packageJson.version ?? 'unknown');
|
||||
|
||||
render(
|
||||
React.createElement(App, {
|
||||
config,
|
||||
cliVersion,
|
||||
}),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// If not a TTY, read from stdin
|
||||
// This is for cases where the user pipes input directly into the command
|
||||
if (!process.stdin.isTTY) {
|
||||
|
||||
@@ -28,9 +28,10 @@ import { Tips } from './components/Tips.js';
|
||||
|
||||
interface AppProps {
|
||||
config: Config;
|
||||
cliVersion: string;
|
||||
}
|
||||
|
||||
export const App = ({ config }: AppProps) => {
|
||||
export const App = ({ config, cliVersion }: AppProps) => {
|
||||
const [history, setHistory] = useState<HistoryItem[]>([]);
|
||||
const [startupWarnings, setStartupWarnings] = useState<string[]>([]);
|
||||
const { streamingState, submitQuery, initError, debugMessage } =
|
||||
@@ -165,6 +166,7 @@ export const App = ({ config }: AppProps) => {
|
||||
queryLength={query.length}
|
||||
debugMode={config.getDebugMode()}
|
||||
debugMessage={debugMessage}
|
||||
cliVersion={cliVersion}
|
||||
/>
|
||||
<ITermDetectionWarning />
|
||||
</Box>
|
||||
|
||||
@@ -14,6 +14,7 @@ interface FooterProps {
|
||||
queryLength: number;
|
||||
debugMode: boolean;
|
||||
debugMessage: string;
|
||||
cliVersion: string;
|
||||
}
|
||||
|
||||
export const Footer: React.FC<FooterProps> = ({
|
||||
@@ -21,6 +22,7 @@ export const Footer: React.FC<FooterProps> = ({
|
||||
queryLength,
|
||||
debugMode,
|
||||
debugMessage,
|
||||
cliVersion,
|
||||
}) => (
|
||||
<Box marginTop={1} display="flex" justifyContent="space-between" width="100%">
|
||||
{/* Left Section: Help/DebugMode */}
|
||||
@@ -50,6 +52,7 @@ export const Footer: React.FC<FooterProps> = ({
|
||||
{/* Right Section: Gemini Label */}
|
||||
<Box>
|
||||
<Text color={Colors.AccentBlue}> {config.getModel()} </Text>
|
||||
<Text color={Colors.SubtleComment}> | CLI Version: {cliVersion} </Text>
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user