Introduce a small easter egg. Woof. (#412)
Also changes auto-completion and /help to skip over slash commands that don't contain a description to avoid spoiling the surprise.
This commit is contained in:
parent
9749fcb425
commit
13a6a9a690
|
@ -58,6 +58,12 @@ export const App = ({
|
||||||
const [showHelp, setShowHelp] = useState<boolean>(false);
|
const [showHelp, setShowHelp] = useState<boolean>(false);
|
||||||
const [themeError, setThemeError] = useState<string | null>(null);
|
const [themeError, setThemeError] = useState<string | null>(null);
|
||||||
const [footerHeight, setFooterHeight] = useState<number>(0);
|
const [footerHeight, setFooterHeight] = useState<number>(0);
|
||||||
|
const [corgiMode, setCorgiMode] = useState(false);
|
||||||
|
|
||||||
|
const toggleCorgiMode = useCallback(() => {
|
||||||
|
setCorgiMode((prev) => !prev);
|
||||||
|
}, []);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
isThemeDialogOpen,
|
isThemeDialogOpen,
|
||||||
openThemeDialog,
|
openThemeDialog,
|
||||||
|
@ -124,6 +130,7 @@ export const App = ({
|
||||||
setDebugMessage,
|
setDebugMessage,
|
||||||
openThemeDialog,
|
openThemeDialog,
|
||||||
performMemoryRefresh,
|
performMemoryRefresh,
|
||||||
|
toggleCorgiMode,
|
||||||
);
|
);
|
||||||
|
|
||||||
const { streamingState, submitQuery, initError, pendingHistoryItem } =
|
const { streamingState, submitQuery, initError, pendingHistoryItem } =
|
||||||
|
@ -408,6 +415,7 @@ export const App = ({
|
||||||
debugMessage={debugMessage}
|
debugMessage={debugMessage}
|
||||||
cliVersion={cliVersion}
|
cliVersion={cliVersion}
|
||||||
geminiMdFileCount={geminiMdFileCount}
|
geminiMdFileCount={geminiMdFileCount}
|
||||||
|
corgiMode={corgiMode}
|
||||||
/>
|
/>
|
||||||
<ConsoleOutput debugMode={config.getDebugMode()} />
|
<ConsoleOutput debugMode={config.getDebugMode()} />
|
||||||
</Box>
|
</Box>
|
||||||
|
|
|
@ -15,6 +15,7 @@ interface FooterProps {
|
||||||
debugMessage: string;
|
debugMessage: string;
|
||||||
cliVersion: string;
|
cliVersion: string;
|
||||||
geminiMdFileCount: number;
|
geminiMdFileCount: number;
|
||||||
|
corgiMode: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Footer: React.FC<FooterProps> = ({
|
export const Footer: React.FC<FooterProps> = ({
|
||||||
|
@ -23,6 +24,7 @@ export const Footer: React.FC<FooterProps> = ({
|
||||||
debugMessage,
|
debugMessage,
|
||||||
cliVersion,
|
cliVersion,
|
||||||
geminiMdFileCount,
|
geminiMdFileCount,
|
||||||
|
corgiMode,
|
||||||
}) => (
|
}) => (
|
||||||
<Box marginTop={1}>
|
<Box marginTop={1}>
|
||||||
<Box>
|
<Box>
|
||||||
|
@ -62,6 +64,16 @@ export const Footer: React.FC<FooterProps> = ({
|
||||||
<Box>
|
<Box>
|
||||||
<Text color={Colors.AccentBlue}> {config.getModel()} </Text>
|
<Text color={Colors.AccentBlue}> {config.getModel()} </Text>
|
||||||
<Text color={Colors.SubtleComment}>| CLI {cliVersion} </Text>
|
<Text color={Colors.SubtleComment}>| CLI {cliVersion} </Text>
|
||||||
|
{corgiMode && (
|
||||||
|
<Text>
|
||||||
|
<Text color={Colors.SubtleComment}>| </Text>
|
||||||
|
<Text color={Colors.AccentRed}>▼</Text>
|
||||||
|
<Text color={Colors.Foreground}>(´</Text>
|
||||||
|
<Text color={Colors.AccentRed}>ᴥ</Text>
|
||||||
|
<Text color={Colors.Foreground}>`)</Text>
|
||||||
|
<Text color={Colors.AccentRed}>▼ </Text>
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
|
|
|
@ -28,7 +28,9 @@ export const Help: React.FC<Help> = ({ commands }) => (
|
||||||
<Text bold color={Colors.Foreground}>
|
<Text bold color={Colors.Foreground}>
|
||||||
Commands:
|
Commands:
|
||||||
</Text>
|
</Text>
|
||||||
{commands.map((command: SlashCommand) => (
|
{commands
|
||||||
|
.filter((command) => command.description)
|
||||||
|
.map((command: SlashCommand) => (
|
||||||
<Text key={command.name} color={Colors.SubtleComment}>
|
<Text key={command.name} color={Colors.SubtleComment}>
|
||||||
<Text bold color={Colors.AccentPurple}>
|
<Text bold color={Colors.AccentPurple}>
|
||||||
{' '}
|
{' '}
|
||||||
|
|
|
@ -48,6 +48,7 @@ describe('useSlashCommandProcessor', () => {
|
||||||
let mockOpenThemeDialog: ReturnType<typeof vi.fn>;
|
let mockOpenThemeDialog: ReturnType<typeof vi.fn>;
|
||||||
let mockPerformMemoryRefresh: ReturnType<typeof vi.fn>;
|
let mockPerformMemoryRefresh: ReturnType<typeof vi.fn>;
|
||||||
let mockConfig: Config;
|
let mockConfig: Config;
|
||||||
|
let mockCorgiMode: ReturnType<typeof vi.fn>;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
mockAddItem = vi.fn();
|
mockAddItem = vi.fn();
|
||||||
|
@ -58,6 +59,7 @@ describe('useSlashCommandProcessor', () => {
|
||||||
mockOpenThemeDialog = vi.fn();
|
mockOpenThemeDialog = vi.fn();
|
||||||
mockPerformMemoryRefresh = vi.fn().mockResolvedValue(undefined);
|
mockPerformMemoryRefresh = vi.fn().mockResolvedValue(undefined);
|
||||||
mockConfig = { getDebugMode: vi.fn(() => false) } as unknown as Config;
|
mockConfig = { getDebugMode: vi.fn(() => false) } as unknown as Config;
|
||||||
|
mockCorgiMode = vi.fn();
|
||||||
|
|
||||||
// Clear mocks for fsPromises if they were used directly or indirectly
|
// Clear mocks for fsPromises if they were used directly or indirectly
|
||||||
vi.mocked(fsPromises.readFile).mockClear();
|
vi.mocked(fsPromises.readFile).mockClear();
|
||||||
|
@ -89,6 +91,7 @@ describe('useSlashCommandProcessor', () => {
|
||||||
mockOnDebugMessage,
|
mockOnDebugMessage,
|
||||||
mockOpenThemeDialog,
|
mockOpenThemeDialog,
|
||||||
mockPerformMemoryRefresh,
|
mockPerformMemoryRefresh,
|
||||||
|
mockCorgiMode,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
return result.current;
|
return result.current;
|
||||||
|
|
|
@ -15,7 +15,7 @@ import { addMemoryEntry } from '../../config/memoryUtils.js';
|
||||||
export interface SlashCommand {
|
export interface SlashCommand {
|
||||||
name: string;
|
name: string;
|
||||||
altName?: string;
|
altName?: string;
|
||||||
description: string;
|
description?: string;
|
||||||
action: (mainCommand: string, subCommand?: string, args?: string) => void;
|
action: (mainCommand: string, subCommand?: string, args?: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ export const useSlashCommandProcessor = (
|
||||||
onDebugMessage: (message: string) => void,
|
onDebugMessage: (message: string) => void,
|
||||||
openThemeDialog: () => void,
|
openThemeDialog: () => void,
|
||||||
performMemoryRefresh: () => Promise<void>, // Add performMemoryRefresh prop
|
performMemoryRefresh: () => Promise<void>, // Add performMemoryRefresh prop
|
||||||
|
toggleCorgiMode: () => void,
|
||||||
) => {
|
) => {
|
||||||
const addMessage = useCallback(
|
const addMessage = useCallback(
|
||||||
(message: Message) => {
|
(message: Message) => {
|
||||||
|
@ -131,6 +132,12 @@ export const useSlashCommandProcessor = (
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'corgi',
|
||||||
|
action: (_mainCommand, _subCommand, _args) => {
|
||||||
|
toggleCorgiMode();
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'quit',
|
name: 'quit',
|
||||||
altName: 'exit',
|
altName: 'exit',
|
||||||
|
@ -151,6 +158,7 @@ export const useSlashCommandProcessor = (
|
||||||
showMemoryAction,
|
showMemoryAction,
|
||||||
addMemoryAction,
|
addMemoryAction,
|
||||||
addMessage,
|
addMessage,
|
||||||
|
toggleCorgiMode,
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -142,6 +142,7 @@ export function useCompletion(
|
||||||
(altNameMatch && cmd.altName && cmd.altName.length > 1)
|
(altNameMatch && cmd.altName && cmd.altName.length > 1)
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
|
.filter((cmd) => cmd.description)
|
||||||
.map((cmd) => ({
|
.map((cmd) => ({
|
||||||
label: cmd.name, // Always show the main name as label
|
label: cmd.name, // Always show the main name as label
|
||||||
value: cmd.name, // Value should be the main command name for execution
|
value: cmd.name, // Value should be the main command name for execution
|
||||||
|
|
Loading…
Reference in New Issue