feat: interactive cli client - #70
Merged
Merged
Conversation
adds the foundational modules for the interactive cli client: - connection.rs: async tcp connection with RESP3 framing, send_command/authenticate methods, and buffered reads - format.rs: pretty-print server responses with colors matching redis-cli conventions (colored strings, numbered arrays, etc.) - Cargo.toml: add rustyline, colored, dirs, tokio, bytes, ember-protocol, thiserror dependencies
static table of ~70 commands across 10 groups (connection, string, generic, list, hash, set, sorted_set, server, pubsub, cluster). provides case-insensitive lookup and group-based iteration for the help display and tab completion.
main.rs dispatches between one-shot (command-line args) and interactive REPL mode. the REPL provides: - rustyline integration with history (~/.emberkv_history) - tab-completion of command names (first token) - local commands: help, help <cmd>, quit, exit, clear - automatic reconnection on server disconnect - quoted string tokenizer with backslash escapes
replaces the stub notice with actual documentation covering repl features, one-shot mode, local commands, and connection options.
audit findings addressed: - remove all process::exit() calls — main returns ExitCode so destructors run and connections close cleanly - remove all .expect() calls — runtime and editor creation errors are handled with eprintln + early return - add Connection::shutdown() — sends QUIT to the server then does a TCP shutdown (FIN instead of RST) - call shutdown on every exit path: repl quit/exit/ctrl-d, one-shot mode, and auth failures - add connect timeout (5s) and read timeout (10s) to prevent hanging on unreachable or unresponsive servers - cap read buffer at 64 KiB to prevent unbounded memory growth from malformed responses - flush stdout after clear escape sequence - extract reconnect helper to properly handle auth on reconnect
- fix -h to -H in cli readme (host flag changed to avoid conflict with --help) - add options table and timeout info to cli readme - replace redis-cli with ember-cli throughout root readme examples and quickstart - add ember-cli to features list - update project structure description
restructure the quickstart examples to make it clear that redis-cli works as a drop-in replacement (same protocol, same port) while ember-cli adds repl features like autocomplete and help. command examples are shown tool-agnostic (bare commands) so readers see they work with either client.
kacy
added a commit
that referenced
this pull request
Feb 11, 2026
* feat: add tcp connection and response formatting for cli adds the foundational modules for the interactive cli client: - connection.rs: async tcp connection with RESP3 framing, send_command/authenticate methods, and buffered reads - format.rs: pretty-print server responses with colors matching redis-cli conventions (colored strings, numbered arrays, etc.) - Cargo.toml: add rustyline, colored, dirs, tokio, bytes, ember-protocol, thiserror dependencies * feat: add command metadata table for autocomplete and help static table of ~70 commands across 10 groups (connection, string, generic, list, hash, set, sorted_set, server, pubsub, cluster). provides case-insensitive lookup and group-based iteration for the help display and tab completion. * feat: add interactive repl and one-shot mode main.rs dispatches between one-shot (command-line args) and interactive REPL mode. the REPL provides: - rustyline integration with history (~/.emberkv_history) - tab-completion of command names (first token) - local commands: help, help <cmd>, quit, exit, clear - automatic reconnection on server disconnect - quoted string tokenizer with backslash escapes * docs: update cli readme with usage and feature docs replaces the stub notice with actual documentation covering repl features, one-shot mode, local commands, and connection options. * fix: use -H for host flag to avoid conflict with --help * fix: handle errors and exits gracefully across the cli audit findings addressed: - remove all process::exit() calls — main returns ExitCode so destructors run and connections close cleanly - remove all .expect() calls — runtime and editor creation errors are handled with eprintln + early return - add Connection::shutdown() — sends QUIT to the server then does a TCP shutdown (FIN instead of RST) - call shutdown on every exit path: repl quit/exit/ctrl-d, one-shot mode, and auth failures - add connect timeout (5s) and read timeout (10s) to prevent hanging on unreachable or unresponsive servers - cap read buffer at 64 KiB to prevent unbounded memory growth from malformed responses - flush stdout after clear escape sequence - extract reconnect helper to properly handle auth on reconnect * chore: cargo fmt * docs: update cli and root readmes for ember-cli - fix -h to -H in cli readme (host flag changed to avoid conflict with --help) - add options table and timeout info to cli readme - replace redis-cli with ember-cli throughout root readme examples and quickstart - add ember-cli to features list - update project structure description * docs: show redis-cli drop-in compatibility alongside ember-cli restructure the quickstart examples to make it clear that redis-cli works as a drop-in replacement (same protocol, same port) while ember-cli adds repl features like autocomplete and help. command examples are shown tool-agnostic (bare commands) so readers see they work with either client.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
summary
implements the full interactive CLI client (phase 5, week 16). the cli is a thin client that tokenizes user input into RESP3 arrays and sends them to the server — no client-side command validation.
~/.emberkv_history), tab-completion, quoted string tokenizer, local commands (help, quit, clear), and automatic reconnectionwhat was tested
cargo clippy -p emberkv-cli -- -D warnings— cleancargo test --workspace— no regressionscargo build -p emberkv-clidesign considerations
block_onfor async calls rather than#[tokio::main].--tlsflag is parsed but prints "not yet supported". keeps the PR focused on core functionality.