Expand description
Helpers for building Claude Code’s slash-command strings.
The interactive CLI exposes commands like /compact, /clear,
/model that the user types mid-conversation. In stream-json
input mode the same /foo args strings are passed through as
turn prompts – the CLI interprets them, the model doesn’t see
them as user prompts.
Hosts wrapping a duplex session as a chat (MCP servers, IDE
backends, agent runtimes) need to construct these strings
safely, especially when forwarding optional user instructions.
These helpers keep the CLI’s slash syntax in one place rather
than having every caller hand-roll format!("/compact {}", ...).
§Example
use claude_wrapper::slash;
assert_eq!(slash::compact(None), "/compact");
assert_eq!(slash::compact(Some("focus on auth bug")), "/compact focus on auth bug");Functions§
- compact
- Build the prompt string for
/compact.