docs/design/web-shell-custom-slash-command-actions.md
Web Shell handles built-in slash commands locally and forwards other slash commands to the daemon. Embedders cannot observe a command before that default behavior or replace it with an application-specific action.
Add an optional onSlashCommand prop. It runs before hidden-command,
built-in-command, daemon-connection, and daemon-forwarding behavior in both the
main composer and split-view composers. It receives:
command: the slash command name, normalized to lower case;args: the trimmed text after the command name;input: the original submitted text.Returning true marks the command as handled and skips Web Shell's default
behavior. Returning false or nothing lets the existing command pipeline
continue unchanged. The callback is synchronous so composer acceptance keeps
the existing synchronous submit contract; embedders may start asynchronous
work inside the callback. Callback errors are reported through Web Shell's
existing error path before default handling continues.
Only a leading slash followed by a word-or-hyphen command name and then
whitespace or the end of the input is recognized. This keeps absolute paths
such as /usr/local/bin/tool out of the host callback.
The prop is optional, so existing embedders and all current command behavior remain unchanged. The callback also observes unknown commands, allowing an embedder to implement a command without daemon support.
true prevents the command from reaching the daemon.true prevents a built-in command's local behavior.