summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/components/InputPrompt.tsx
diff options
context:
space:
mode:
authorAbhi <[email protected]>2025-07-20 16:57:34 -0400
committerGitHub <[email protected]>2025-07-20 20:57:34 +0000
commit2a95c8287ed3b6fc38e7dcec5f0a19b9e2d843e7 (patch)
tree1a9ffb6be8468aa44e54bfcb8ae2f961b970cf9a /packages/cli/src/ui/components/InputPrompt.tsx
parent7a9821607bafcbb98cf059705aaab358d46e711c (diff)
prefactor(commands): Command Service Prefactor for Extensible Commands (#4511)
Diffstat (limited to 'packages/cli/src/ui/components/InputPrompt.tsx')
-rw-r--r--packages/cli/src/ui/components/InputPrompt.tsx10
1 files changed, 6 insertions, 4 deletions
diff --git a/packages/cli/src/ui/components/InputPrompt.tsx b/packages/cli/src/ui/components/InputPrompt.tsx
index 46326431..b7c53196 100644
--- a/packages/cli/src/ui/components/InputPrompt.tsx
+++ b/packages/cli/src/ui/components/InputPrompt.tsx
@@ -32,7 +32,7 @@ export interface InputPromptProps {
userMessages: readonly string[];
onClearScreen: () => void;
config: Config;
- slashCommands: SlashCommand[];
+ slashCommands: readonly SlashCommand[];
commandContext: CommandContext;
placeholder?: string;
focus?: boolean;
@@ -180,18 +180,20 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
// If there's no trailing space, we need to check if the current query
// is already a complete path to a parent command.
if (!hasTrailingSpace) {
- let currentLevel: SlashCommand[] | undefined = slashCommands;
+ let currentLevel: readonly SlashCommand[] | undefined = slashCommands;
for (let i = 0; i < parts.length; i++) {
const part = parts[i];
const found: SlashCommand | undefined = currentLevel?.find(
- (cmd) => cmd.name === part || cmd.altName === part,
+ (cmd) => cmd.name === part || cmd.altNames?.includes(part),
);
if (found) {
if (i === parts.length - 1 && found.subCommands) {
isParentPath = true;
}
- currentLevel = found.subCommands;
+ currentLevel = found.subCommands as
+ | readonly SlashCommand[]
+ | undefined;
} else {
// Path is invalid, so it can't be a parent path.
currentLevel = undefined;