summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/hooks
diff options
context:
space:
mode:
Diffstat (limited to 'packages/cli/src/ui/hooks')
-rw-r--r--packages/cli/src/ui/hooks/slashCommandProcessor.test.ts3
-rw-r--r--packages/cli/src/ui/hooks/slashCommandProcessor.ts10
-rw-r--r--packages/cli/src/ui/hooks/useCompletion.ts1
3 files changed, 13 insertions, 1 deletions
diff --git a/packages/cli/src/ui/hooks/slashCommandProcessor.test.ts b/packages/cli/src/ui/hooks/slashCommandProcessor.test.ts
index 4055dfd3..f7f1bb5e 100644
--- a/packages/cli/src/ui/hooks/slashCommandProcessor.test.ts
+++ b/packages/cli/src/ui/hooks/slashCommandProcessor.test.ts
@@ -48,6 +48,7 @@ describe('useSlashCommandProcessor', () => {
let mockOpenThemeDialog: ReturnType<typeof vi.fn>;
let mockPerformMemoryRefresh: ReturnType<typeof vi.fn>;
let mockConfig: Config;
+ let mockCorgiMode: ReturnType<typeof vi.fn>;
beforeEach(() => {
mockAddItem = vi.fn();
@@ -58,6 +59,7 @@ describe('useSlashCommandProcessor', () => {
mockOpenThemeDialog = vi.fn();
mockPerformMemoryRefresh = vi.fn().mockResolvedValue(undefined);
mockConfig = { getDebugMode: vi.fn(() => false) } as unknown as Config;
+ mockCorgiMode = vi.fn();
// Clear mocks for fsPromises if they were used directly or indirectly
vi.mocked(fsPromises.readFile).mockClear();
@@ -89,6 +91,7 @@ describe('useSlashCommandProcessor', () => {
mockOnDebugMessage,
mockOpenThemeDialog,
mockPerformMemoryRefresh,
+ mockCorgiMode,
),
);
return result.current;
diff --git a/packages/cli/src/ui/hooks/slashCommandProcessor.ts b/packages/cli/src/ui/hooks/slashCommandProcessor.ts
index f489c648..095f4ad7 100644
--- a/packages/cli/src/ui/hooks/slashCommandProcessor.ts
+++ b/packages/cli/src/ui/hooks/slashCommandProcessor.ts
@@ -15,7 +15,7 @@ import { addMemoryEntry } from '../../config/memoryUtils.js';
export interface SlashCommand {
name: string;
altName?: string;
- description: string;
+ description?: string;
action: (mainCommand: string, subCommand?: string, args?: string) => void;
}
@@ -31,6 +31,7 @@ export const useSlashCommandProcessor = (
onDebugMessage: (message: string) => void,
openThemeDialog: () => void,
performMemoryRefresh: () => Promise<void>, // Add performMemoryRefresh prop
+ toggleCorgiMode: () => void,
) => {
const addMessage = useCallback(
(message: Message) => {
@@ -132,6 +133,12 @@ export const useSlashCommandProcessor = (
},
},
{
+ name: 'corgi',
+ action: (_mainCommand, _subCommand, _args) => {
+ toggleCorgiMode();
+ },
+ },
+ {
name: 'quit',
altName: 'exit',
description: 'exit the cli',
@@ -151,6 +158,7 @@ export const useSlashCommandProcessor = (
showMemoryAction,
addMemoryAction,
addMessage,
+ toggleCorgiMode,
],
);
diff --git a/packages/cli/src/ui/hooks/useCompletion.ts b/packages/cli/src/ui/hooks/useCompletion.ts
index 9c0c2db1..c707adef 100644
--- a/packages/cli/src/ui/hooks/useCompletion.ts
+++ b/packages/cli/src/ui/hooks/useCompletion.ts
@@ -142,6 +142,7 @@ export function useCompletion(
(altNameMatch && cmd.altName && cmd.altName.length > 1)
);
})
+ .filter((cmd) => cmd.description)
.map((cmd) => ({
label: cmd.name, // Always show the main name as label
value: cmd.name, // Value should be the main command name for execution