Skip to content

Chat: slash commands + card UI primitives#73

Merged
lezama merged 1 commit into
mainfrom
feat/slash-commands
May 19, 2026
Merged

Chat: slash commands + card UI primitives#73
lezama merged 1 commit into
mainfrom
feat/slash-commands

Conversation

@lezama
Copy link
Copy Markdown
Owner

@lezama lezama commented May 19, 2026

Summary

Two new chat primitives that work together:

Card UI — a small JS primitive for rich inline responses. Cards have a kind, title, markdown body, and an optional row of action buttons. Slash-command responses render as cards in a small stack above the message list. Each card has a dismiss button.

Slash commands — composable primitive, mostly offline. Detection runs before the message hits the LLM. Bundled commands:

  • /help — list all commands
  • /clear — clear the active conversation
  • /reset — clear conversation + restore the Discover panel
  • /status — site / plugin / agent context
  • /tools — tool inspection (placeholder when no endpoint exists)

Both surfaces (the chat block and the floating admin-bar panel) get this behaviour for free because they mount the same <ChatSurface>.

Why

Slash commands give users a fast, predictable way to manage the conversation without LLM round-trips. Cards give the chat surface a way to return structured UI (status panels, action buttons) instead of raw markdown — the foundation for future surfaces like the in-chat setup wizard.

Test plan

  • Type /help — a card appears listing the bundled commands.
  • Type /clear — the conversation resets; a success card confirms.
  • Type /asdf (unknown command) — a warning card with the help text appears.
  • Open the floating panel and the chat block in different tabs; both expose the same commands.
  • Click an action button on a card — the linked command runs.
  • Existing message flow to the LLM still works for non-slash inputs.

🤖 Generated with Claude Code

Adds two cooperating primitives to the shared <ChatSurface>:

- Card UI: small JS shape rendered as a colored-border panel above the
  message list. Supports title, light-markdown body, and optional action
  buttons. Cards stack newest-on-top with per-card dismiss.
- Slash commands: composable registry under blocks/chat-shared/commands/.
  Detection happens before the message reaches useAgentChat, so offline
  commands never round-trip to the LLM. Bundled: /help, /clear, /reset,
  /status, /tools.

Both the chat block and the floating admin-bar panel pick this up for
free because they both mount ChatSurface.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@lezama lezama merged commit 50a1075 into main May 19, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant