fix(cli): slash command UX — ignore bare /, fix gateway connection check
- Submitting bare "/" no longer shows "Unknown command format: /" — input is ignored silently so autocomplete can guide discovery instead - Gateway command handler no longer requires a conversationId before emitting — the socket connection check alone is sufficient; missing conversationId caused false "Not connected" errors on fresh sessions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -117,12 +117,12 @@ export function TuiApp({
|
|||||||
|
|
||||||
const handleGatewayCommand = useCallback(
|
const handleGatewayCommand = useCallback(
|
||||||
(parsed: ParsedCommand) => {
|
(parsed: ParsedCommand) => {
|
||||||
if (!socket.socketRef.current?.connected || !socket.conversationId) {
|
if (!socket.socketRef.current?.connected) {
|
||||||
socket.addSystemMessage('Not connected to gateway. Command cannot be executed.');
|
socket.addSystemMessage('Not connected to gateway. Command cannot be executed.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
socket.socketRef.current.emit('command:execute', {
|
socket.socketRef.current.emit('command:execute', {
|
||||||
conversationId: socket.conversationId,
|
conversationId: socket.conversationId ?? '',
|
||||||
command: parsed.command,
|
command: parsed.command,
|
||||||
args: parsed.args ?? undefined,
|
args: parsed.args ?? undefined,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -59,8 +59,7 @@ export function InputBar({
|
|||||||
if (trimmed.startsWith('/')) {
|
if (trimmed.startsWith('/')) {
|
||||||
const parsed = parseSlashCommand(trimmed);
|
const parsed = parseSlashCommand(trimmed);
|
||||||
if (!parsed) {
|
if (!parsed) {
|
||||||
onSystemMessage?.(`Unknown command format: ${trimmed}`);
|
// Bare "/" or malformed — ignore silently (autocomplete handles discovery)
|
||||||
setInput('');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const def = commandRegistry.find(parsed.command);
|
const def = commandRegistry.find(parsed.command);
|
||||||
|
|||||||
Reference in New Issue
Block a user