fix(cli): slash command UX — ignore bare /, fix gateway connection check
Some checks failed
ci/woodpecker/push/ci Pipeline failed
ci/woodpecker/pr/ci Pipeline failed

- 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:
2026-03-16 08:07:00 -05:00
parent 31aea56345
commit 193d171acb
2 changed files with 3 additions and 4 deletions

View File

@@ -117,12 +117,12 @@ export function TuiApp({
const handleGatewayCommand = useCallback(
(parsed: ParsedCommand) => {
if (!socket.socketRef.current?.connected || !socket.conversationId) {
if (!socket.socketRef.current?.connected) {
socket.addSystemMessage('Not connected to gateway. Command cannot be executed.');
return;
}
socket.socketRef.current.emit('command:execute', {
conversationId: socket.conversationId,
conversationId: socket.conversationId ?? '',
command: parsed.command,
args: parsed.args ?? undefined,
});

View File

@@ -59,8 +59,7 @@ export function InputBar({
if (trimmed.startsWith('/')) {
const parsed = parseSlashCommand(trimmed);
if (!parsed) {
onSystemMessage?.(`Unknown command format: ${trimmed}`);
setInput('');
// Bare "/" or malformed — ignore silently (autocomplete handles discovery)
return;
}
const def = commandRegistry.find(parsed.command);